From ae658f35dd639b5fcb5903b04ca3462d5cff87e1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 May 2008 09:34:58 +0000 Subject: [PATCH] plugins/elements/gstfakesrc.*: Added format property to control the format of the newsegment events. Original commit message from CVS: * plugins/elements/gstfakesrc.c: (gst_fake_src_class_init), (gst_fake_src_init), (gst_fake_src_set_property), (gst_fake_src_get_property), (gst_fake_src_start): * plugins/elements/gstfakesrc.h: Added format property to control the format of the newsegment events. API: GstFakeSrc:format --- ChangeLog | 9 +++++++++ plugins/elements/gstfakesrc.c | 25 ++++++++++++++++++++++++- plugins/elements/gstfakesrc.h | 1 + 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index eacd56b..1f9b87a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2008-05-07 Wim Taymans + + * plugins/elements/gstfakesrc.c: (gst_fake_src_class_init), + (gst_fake_src_init), (gst_fake_src_set_property), + (gst_fake_src_get_property), (gst_fake_src_start): + * plugins/elements/gstfakesrc.h: + Added format property to control the format of the newsegment events. + API: GstFakeSrc:format + 2008-05-06 Sebastian Dröge * win32/common/libgstreamer.def: diff --git a/plugins/elements/gstfakesrc.c b/plugins/elements/gstfakesrc.c index 95cbe31..01793f0 100644 --- a/plugins/elements/gstfakesrc.c +++ b/plugins/elements/gstfakesrc.c @@ -90,6 +90,7 @@ enum #define DEFAULT_PARENTSIZE 4096*10 #define DEFAULT_CAN_ACTIVATE_PULL TRUE #define DEFAULT_CAN_ACTIVATE_PUSH TRUE +#define DEFAULT_FORMAT GST_FORMAT_BYTES enum { @@ -111,7 +112,9 @@ enum PROP_LAST_MESSAGE, PROP_CAN_ACTIVATE_PULL, PROP_CAN_ACTIVATE_PUSH, - PROP_IS_LIVE + PROP_IS_LIVE, + PROP_FORMAT, + PROP_LAST, }; /* not implemented @@ -325,6 +328,17 @@ gst_fake_src_class_init (GstFakeSrcClass * klass) g_param_spec_boolean ("is-live", "Is this a live source", "True if the element cannot produce data in PAUSED", FALSE, G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); + /** + * GstFakeSrc:format + * + * Set the format of the newsegment events to produce. + * + * Since: 0.10.20 + */ + g_object_class_install_property (gobject_class, PROP_FORMAT, + g_param_spec_enum ("format", "Format", + "The format of the segment events", GST_TYPE_FORMAT, + DEFAULT_FORMAT, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GstFakeSrc::handoff: @@ -367,6 +381,7 @@ gst_fake_src_init (GstFakeSrc * fakesrc, GstFakeSrcClass * g_class) fakesrc->last_message = NULL; fakesrc->datarate = DEFAULT_DATARATE; fakesrc->sync = DEFAULT_SYNC; + fakesrc->format = DEFAULT_FORMAT; } static void @@ -501,6 +516,9 @@ gst_fake_src_set_property (GObject * object, guint prop_id, case PROP_IS_LIVE: gst_base_src_set_live (basesrc, g_value_get_boolean (value)); break; + case PROP_FORMAT: + src->format = g_value_get_enum (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -573,6 +591,9 @@ gst_fake_src_get_property (GObject * object, guint prop_id, GValue * value, case PROP_IS_LIVE: g_value_set_boolean (value, gst_base_src_is_live (basesrc)); break; + case PROP_FORMAT: + g_value_set_enum (value, src->format); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -835,6 +856,8 @@ gst_fake_src_start (GstBaseSrc * basesrc) src->pattern_byte = 0x00; src->bytes_sent = 0; + gst_base_src_set_format (basesrc, src->format); + return TRUE; } diff --git a/plugins/elements/gstfakesrc.h b/plugins/elements/gstfakesrc.h index a7b6043..00675c2 100644 --- a/plugins/elements/gstfakesrc.h +++ b/plugins/elements/gstfakesrc.h @@ -147,6 +147,7 @@ struct _GstFakeSrc { gboolean signal_handoffs; gboolean dump; gboolean can_activate_pull; + GstFormat format; guint64 bytes_sent; -- 2.7.4