diff options
author | Douglas Bagnall <douglas@paradise.net.nz> | 2013-03-10 12:07:40 +1300 |
---|---|---|
committer | Edward Hervey <edward@collabora.com> | 2013-07-22 09:53:46 +0200 |
commit | dfb101e0edf16733997dd33e4fb43071dc26d7b8 (patch) | |
tree | d1cef5879bfcc665abef1bd8f65f80c935adc658 /gst | |
parent | 8e4f966018409592eca28014bdafaffb4ef59d0a (diff) |
tsdemux: disentangle requested program number from active program number
The program_number attribute was overloaded, trying to indicate both
the currently playing program, and the program requested via the
"program-number" property. The end result was that setting the
property didn't work (see #690934).
I added a new requested_program_number field rather than reviving the
current_program_number field because it seemed this would result in
fewer changes overall and be less confusing. It breaks symmetry with
the "program-number" property, but it retains parallels with the likes
of program->program_number.
Because gst_ts_demux_reset is called after the properties have been
parsed, requested_program_number is initialised in gst_ts_demux_init.
Whether this is exactly the right place, I don't know.
Diffstat (limited to 'gst')
-rw-r--r-- | gst/mpegtsdemux/tsdemux.c | 14 | ||||
-rw-r--r-- | gst/mpegtsdemux/tsdemux.h | 3 |
2 files changed, 10 insertions, 7 deletions
diff --git a/gst/mpegtsdemux/tsdemux.c b/gst/mpegtsdemux/tsdemux.c index cc09269ff6..af6570e281 100644 --- a/gst/mpegtsdemux/tsdemux.c +++ b/gst/mpegtsdemux/tsdemux.c @@ -341,6 +341,7 @@ gst_ts_demux_init (GstTSDemux * demux) /* We are not interested in sections (all handled by mpegtsbase) */ base->push_section = FALSE; + demux->requested_program_number = -1; demux->program_number = -1; gst_ts_demux_reset (base); } @@ -356,7 +357,7 @@ gst_ts_demux_set_property (GObject * object, guint prop_id, case PROP_PROGRAM_NUMBER: /* FIXME: do something if program is switched as opposed to set at * beginning */ - demux->program_number = g_value_get_int (value); + demux->requested_program_number = g_value_get_int (value); break; case PROP_EMIT_STATS: demux->emit_statistics = g_value_get_boolean (value); @@ -374,7 +375,7 @@ gst_ts_demux_get_property (GObject * object, guint prop_id, switch (prop_id) { case PROP_PROGRAM_NUMBER: - g_value_set_int (value, demux->program_number); + g_value_set_int (value, demux->requested_program_number); break; case PROP_EMIT_STATS: g_value_set_boolean (value, demux->emit_statistics); @@ -1099,11 +1100,12 @@ gst_ts_demux_program_started (MpegTSBase * base, MpegTSBaseProgram * program) { GstTSDemux *demux = GST_TS_DEMUX (base); - GST_DEBUG ("Current program %d, new program %d", - demux->program_number, program->program_number); + GST_DEBUG ("Current program %d, new program %d requested program %d", + (gint) demux->program_number, program->program_number, + demux->requested_program_number); - if (demux->program_number == -1 || - demux->program_number == program->program_number) { + if (demux->requested_program_number == program->program_number || + (demux->requested_program_number == -1 && demux->program_number == -1)) { GST_LOG ("program %d started", program->program_number); demux->program_number = program->program_number; diff --git a/gst/mpegtsdemux/tsdemux.h b/gst/mpegtsdemux/tsdemux.h index 603b593b68..f11c969bca 100644 --- a/gst/mpegtsdemux/tsdemux.h +++ b/gst/mpegtsdemux/tsdemux.h @@ -55,7 +55,8 @@ struct _GstTSDemux /* the following vars must be protected with the OBJECT_LOCK as they can be * accessed from the application thread and the streaming thread */ - guint program_number; /* Required program number (ignore:-1) */ + gint requested_program_number; /* Required program number (ignore:-1) */ + guint program_number; gboolean emit_statistics; /*< private >*/ |