diff options
author | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-04 10:37:20 +0100 |
---|---|---|
committer | Sebastian Dröge <sebastian.droege@collabora.co.uk> | 2009-02-04 11:12:13 +0100 |
commit | cc5699340d0f5c17ba966dbed05cb3dd3b021c38 (patch) | |
tree | 5fc622d805b15b311e7174e18aa86d2fda300ab1 /gst/mxf | |
parent | fd72ef34f6282df4d8059038bbab8fea60c23c76 (diff) | |
download | gst-plugins-bad-cc5699340d0f5c17ba966dbed05cb3dd3b021c38.tar.gz gst-plugins-bad-cc5699340d0f5c17ba966dbed05cb3dd3b021c38.tar.bz2 gst-plugins-bad-cc5699340d0f5c17ba966dbed05cb3dd3b021c38.zip |
Add property to set the maximum allowed time difference between tracks
Diffstat (limited to 'gst/mxf')
-rw-r--r-- | gst/mxf/mxfdemux.c | 21 | ||||
-rw-r--r-- | gst/mxf/mxfdemux.h | 3 |
2 files changed, 21 insertions, 3 deletions
diff --git a/gst/mxf/mxfdemux.c b/gst/mxf/mxfdemux.c index 293f2249..27af01b5 100644 --- a/gst/mxf/mxfdemux.c +++ b/gst/mxf/mxfdemux.c @@ -113,7 +113,8 @@ gst_mxf_demux_pad_init (GstMXFDemuxPad * pad) enum { PROP_0, - PROP_PACKAGE + PROP_PACKAGE, + PROP_MAX_DRIFT }; static gboolean gst_mxf_demux_sink_event (GstPad * pad, GstEvent * event); @@ -1590,7 +1591,7 @@ gst_mxf_demux_handle_generic_container_essence_element (GstMXFDemux * demux, GstMXFDemuxPad *earliest = gst_mxf_demux_get_earliest_pad (demux); if (earliest && earliest != pad && earliest->last_stop < pad->last_stop && - pad->last_stop - earliest->last_stop > 500 * GST_MSECOND) { + pad->last_stop - earliest->last_stop > demux->max_drift) { GST_DEBUG_OBJECT (demux, "Pad is too far ahead of time"); continue; } @@ -2488,7 +2489,7 @@ gst_mxf_demux_pull_and_handle_klv_packet (GstMXFDemux * demux) GstMXFDemuxPad *earliest = NULL; /* We allow time drifts of at most 500ms */ while ((earliest = gst_mxf_demux_get_earliest_pad (demux)) && - demux->segment.last_stop - earliest->last_stop > 500 * GST_MSECOND) { + demux->segment.last_stop - earliest->last_stop > demux->max_drift) { guint i; guint64 offset; gint64 position; @@ -3533,6 +3534,9 @@ gst_mxf_demux_set_property (GObject * object, guint prop_id, g_free (demux->requested_package_string); demux->requested_package_string = g_value_dup_string (value); break; + case PROP_MAX_DRIFT: + demux->max_drift = g_value_get_uint64 (value); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -3549,6 +3553,9 @@ gst_mxf_demux_get_property (GObject * object, guint prop_id, case PROP_PACKAGE: g_value_set_string (value, demux->current_package_string); break; + case PROP_MAX_DRIFT: + g_value_set_uint64 (value, demux->max_drift); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -3614,6 +3621,12 @@ gst_mxf_demux_class_init (GstMXFDemuxClass * klass) "Material or Source package to use for playback", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + g_object_class_install_property (gobject_class, PROP_MAX_DRIFT, + g_param_spec_uint64 ("max-drift", "Maximum drift", + "Maximum number of nanoseconds by which tracks can differ", + 100 * GST_MSECOND, G_MAXUINT64, 500 * GST_MSECOND, + G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); + gstelement_class->change_state = GST_DEBUG_FUNCPTR (gst_mxf_demux_change_state); gstelement_class->query = GST_DEBUG_FUNCPTR (gst_mxf_demux_query); @@ -3640,6 +3653,8 @@ gst_mxf_demux_init (GstMXFDemux * demux, GstMXFDemuxClass * g_class) gst_element_add_pad (GST_ELEMENT (demux), demux->sinkpad); + demux->max_drift = 500 * GST_MSECOND; + demux->adapter = gst_adapter_new (); demux->src = g_ptr_array_new (); gst_segment_init (&demux->segment, GST_FORMAT_TIME); diff --git a/gst/mxf/mxfdemux.h b/gst/mxf/mxfdemux.h index 9ae739fc..8e64e403 100644 --- a/gst/mxf/mxfdemux.h +++ b/gst/mxf/mxfdemux.h @@ -161,7 +161,10 @@ struct _GstMXFDemux MXFUMID current_package_uid; MXFMetadataGenericPackage *current_package; gchar *current_package_string; + + /* Properties */ gchar *requested_package_string; + GstClockTime max_drift; }; struct _GstMXFDemuxClass |