[gst-cvs] gst-plugins-good: flvmux: Add a is-live property
Sebastian Dröge
slomo at kemper.freedesktop.org
Mon Mar 15 05:56:52 PDT 2010
Module: gst-plugins-good
Branch: master
Commit: 54a8237d625e9d84a4c25ae09a785af2d13f53ad
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=54a8237d625e9d84a4c25ae09a785af2d13f53ad
Author: Jan Urbański <wulczer at wulczer.org>
Date: Sun Mar 14 01:34:02 2010 +0100
flvmux: Add a is-live property
If it is set, the muxer will not write the index. Defaults to false.
---
gst/flv/gstflvmux.c | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++-
gst/flv/gstflvmux.h | 1 +
2 files changed, 62 insertions(+), 1 deletions(-)
diff --git a/gst/flv/gstflvmux.c b/gst/flv/gstflvmux.c
index 3ba5d43..b229ec9 100644
--- a/gst/flv/gstflvmux.c
+++ b/gst/flv/gstflvmux.c
@@ -43,6 +43,14 @@
GST_DEBUG_CATEGORY_STATIC (flvmux_debug);
#define GST_CAT_DEFAULT flvmux_debug
+enum
+{
+ ARG_0,
+ ARG_IS_LIVE
+};
+
+#define DEFAULT_IS_LIVE FALSE
+
static GstStaticPadTemplate src_templ = GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
@@ -95,6 +103,11 @@ static GstPad *gst_flv_mux_request_new_pad (GstElement * element,
GstPadTemplate * templ, const gchar * name);
static void gst_flv_mux_release_pad (GstElement * element, GstPad * pad);
+static void gst_flv_mux_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec);
+static void gst_flv_mux_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec);
+
static GstStateChangeReturn
gst_flv_mux_change_state (GstElement * element, GstStateChange transition);
@@ -142,8 +155,15 @@ gst_flv_mux_class_init (GstFlvMuxClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
+ gobject_class->get_property = gst_flv_mux_get_property;
+ gobject_class->set_property = gst_flv_mux_set_property;
gobject_class->finalize = gst_flv_mux_finalize;
+ g_object_class_install_property (gobject_class, ARG_IS_LIVE,
+ g_param_spec_boolean ("is-live", "Is Live",
+ "The stream is live and does not need an index", DEFAULT_IS_LIVE,
+ G_PARAM_READWRITE));
+
gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_flv_mux_change_state);
gstelement_class->request_new_pad =
GST_DEBUG_FUNCPTR (gst_flv_mux_request_new_pad);
@@ -157,6 +177,9 @@ gst_flv_mux_init (GstFlvMux * mux, GstFlvMuxClass * g_class)
gst_pad_set_event_function (mux->srcpad, gst_flv_mux_handle_src_event);
gst_element_add_pad (GST_ELEMENT (mux), mux->srcpad);
+ /* property */
+ mux->is_live = DEFAULT_IS_LIVE;
+
mux->collect = gst_collect_pads_new ();
gst_collect_pads_set_function (mux->collect,
(GstCollectPadsFunction) GST_DEBUG_FUNCPTR (gst_flv_mux_collected), mux);
@@ -970,7 +993,8 @@ next:
GST_BUFFER_OFFSET (tag) = GST_BUFFER_OFFSET_END (tag) =
GST_BUFFER_OFFSET_NONE;
- gst_flv_mux_update_index (mux, buffer, cpad);
+ if (!mux->is_live)
+ gst_flv_mux_update_index (mux, buffer, cpad);
gst_buffer_unref (buffer);
@@ -1174,6 +1198,42 @@ gst_flv_mux_collected (GstCollectPads * pads, gpointer user_data)
}
}
+static void
+gst_flv_mux_get_property (GObject * object,
+ guint prop_id, GValue * value, GParamSpec * pspec)
+{
+ GstFlvMux *mux;
+
+ mux = GST_FLV_MUX (object);
+
+ switch (prop_id) {
+ case ARG_IS_LIVE:
+ g_value_set_boolean (value, mux->is_live);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+gst_flv_mux_set_property (GObject * object,
+ guint prop_id, const GValue * value, GParamSpec * pspec)
+{
+ GstFlvMux *mux;
+
+ mux = GST_FLV_MUX (object);
+
+ switch (prop_id) {
+ case ARG_IS_LIVE:
+ mux->is_live = g_value_get_boolean (value);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
static GstStateChangeReturn
gst_flv_mux_change_state (GstElement * element, GstStateChange transition)
{
diff --git a/gst/flv/gstflvmux.h b/gst/flv/gstflvmux.h
index fb60cdd..1af6530 100644
--- a/gst/flv/gstflvmux.h
+++ b/gst/flv/gstflvmux.h
@@ -74,6 +74,7 @@ typedef struct _GstFlvMux {
GstFlvMuxState state;
gboolean have_audio;
gboolean have_video;
+ gboolean is_live;
GstTagList *tags;
GList *index;
More information about the Gstreamer-commits
mailing list