CustomTimelineSource: Allow giving user_data to the callback

This commit is contained in:
Edward Hervey 2009-08-07 20:31:11 +02:00
parent a25c707999
commit 83c3e87661
3 changed files with 16 additions and 6 deletions

View file

@ -90,7 +90,7 @@ ges_cust_timeline_src_fill_track_object (GESTimelineObject * object,
res =
GES_CUSTOM_TIMELINE_SOURCE (object)->filltrackobjectfunc (object,
trobject, gnlobj);
trobject, gnlobj, GES_CUSTOM_TIMELINE_SOURCE (object)->user_data);
GST_DEBUG ("Returning res:%d", res);
@ -98,12 +98,14 @@ ges_cust_timeline_src_fill_track_object (GESTimelineObject * object,
}
GESCustomTimelineSource *
ges_custom_timeline_source_new (FillTrackObjectFunc func)
ges_custom_timeline_source_new (FillTrackObjectUserFunc func,
gpointer user_data)
{
GESCustomTimelineSource *src;
src = g_object_new (GES_TYPE_CUSTOM_TIMELINE_SOURCE, NULL);
src->filltrackobjectfunc = func;
src->user_data = user_data;
return src;
}

View file

@ -43,10 +43,17 @@ G_BEGIN_DECLS
#define GES_CUSTOM_TIMELINE_SOURCE_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GES_TYPE_CUSTOM_TIMELINE_SOURCE, GESCustomTimelineSourceClass))
typedef gboolean (*FillTrackObjectUserFunc) (GESTimelineObject * object,
GESTrackObject * trobject,
GstElement * gnlobj,
gpointer user_data);
struct _GESCustomTimelineSource {
GESTimelineSource parent;
FillTrackObjectFunc filltrackobjectfunc;
FillTrackObjectUserFunc filltrackobjectfunc;
gpointer user_data;
};
struct _GESCustomTimelineSourceClass {
@ -56,7 +63,8 @@ struct _GESCustomTimelineSourceClass {
GType ges_cust_timeline_src_get_type (void);
GESCustomTimelineSource*
ges_custom_timeline_source_new (FillTrackObjectFunc);
ges_custom_timeline_source_new (FillTrackObjectUserFunc,
gpointer user_data);
G_END_DECLS

View file

@ -30,7 +30,7 @@ GST_END_TEST;
static gboolean
my_fill_track_func (GESTimelineObject * object,
GESTrackObject * trobject, GstElement * gnlobj)
GESTrackObject * trobject, GstElement * gnlobj, gpointer user_data)
{
GstElement *src;
@ -81,7 +81,7 @@ GST_START_TEST (test_ges_scenario)
/* Create a source and add it to the Layer */
source = ges_custom_timeline_source_new (my_fill_track_func);
source = ges_custom_timeline_source_new (my_fill_track_func, NULL);
fail_unless (source != NULL);
fail_unless (ges_timeline_layer_add_object (layer,