Re: Proposal for change notifications



On Wed, 2011-01-19 at 15:49 +0000, Lionel Landwerlin wrote:
> Why not just emit GSignals ?
> Even if we still use such callback mechanism within Grilo/Grilo-plugins.
> 

Yep, I completely forgot about it. We do not use gsignals because not
all plugins can send the signal. gupnp works in a similar way.

Told this, I thought about using also the gsignal way, so Grilo would
offer both ways. Of course, this would be done without adding an extra
effort to plugins. So in case of doing it, I would do later.

> > 
> > 
> > These operations are optional, and if plugin supports them, it should be
> > listed in the GrlSupportedOps (using a new flag like
> > GRL_OP_UPDATE_NOTIFY).
> > 
> > The first one installs a callback that will be invoked when a change
> > happens in the source.
> > 
> > Regarding the *_add() function, not sure if we should indicate which
> > element we want to monitor. I didn't consider it, but maybe it's worth
> > to add as parameter: if plugin can monitor a specific element, then it
> > can use it, else it will ignore the parameter. Plugin's documentation
> > should clearly state if it allows to monitor a specific folder or not.
> > 
> > 
> > How the notifications are sent? This is the callback signature:
> > 
> > typedef void
> > (*GrlMediaSourceUpdatedCb) (GrlMediaSource *source,
> > 			GrlMedia *media,
> > 			GrlMediaSourceUpdatedType type,
> > 			gboolean include_children,
> > 			gpointer user_data);
> > 
> > 
> > "media" is the media that has changed. Usually, it will be a GrlBox,
> > meaning that content in that box has changed. But I keep the more
> > generic GrlMedia just in case a plugin has the ability to specifically
> > notifiy that a media has changed.
> > 
> > We use a "media" and not the media "id" because it is expected that if
> > it changes, user application will perform a metadata/browse operation.
> > Thus it doesn't need to create the right media to do it; it already has
> > the changed element to use.
> > 
> > Also, using a GrlMedia is easy to know if content has changed (in case
> > it is a GrlBox) or if the property of the element has changed (in case
> > of GrlAudio, for instance).
> 
> Does that mean the plugin will have to request metadatas before
> notifying change ?

No, it doesn't. When building the changed media it can use the minimum
set of fields, that is, the "id" and "source". Then the user can ask for
other fields if requested.


	J.A.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]