gst/mpegstream/: Resend tags event after a FLUSH (seek) to support prerolling a partial pipeline.

Original commit message from CVS:
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_parse_packhead), (gst_dvd_demux_reset):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init),
(gst_mpeg_demux_process_event), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_parse_packhead), (gst_mpeg_demux_reset):
* gst/mpegstream/gstmpegdemux.h:
Resend tags event after a FLUSH (seek) to support prerolling
a partial pipeline.
This commit is contained in:
Mark Nauwelaerts 2008-07-05 15:56:56 +00:00
parent f887811a64
commit e701517a31
4 changed files with 69 additions and 0 deletions

View file

@ -1,3 +1,16 @@
2008-07-05 Mark Nauwelaerts <mark.nauwelaerts@collabora.co.uk>
* gst/mpegstream/gstdvddemux.c: (gst_dvd_demux_base_init),
(gst_dvd_demux_get_audio_stream),
(gst_dvd_demux_get_subpicture_stream),
(gst_dvd_demux_parse_packhead), (gst_dvd_demux_reset):
* gst/mpegstream/gstmpegdemux.c: (gst_mpeg_demux_init),
(gst_mpeg_demux_process_event), (gst_mpeg_demux_init_stream),
(gst_mpeg_demux_parse_packhead), (gst_mpeg_demux_reset):
* gst/mpegstream/gstmpegdemux.h:
Resend tags event after a FLUSH (seek) to support prerolling
a partial pipeline.
2008-07-03 Tim-Philipp Müller <tim.muller at collabora co uk> 2008-07-03 Tim-Philipp Müller <tim.muller at collabora co uk>
* configure.ac: * configure.ac:

View file

@ -141,6 +141,8 @@ static void gst_dvd_demux_init (GstDVDDemux * dvd_demux,
static gboolean gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse, static gboolean gst_dvd_demux_process_event (GstMPEGParse * mpeg_parse,
GstEvent * event); GstEvent * event);
static gboolean gst_dvd_demux_parse_packhead (GstMPEGParse * mpeg_parse,
GstBuffer * buffer);
static gboolean gst_dvd_demux_handle_dvd_event static gboolean gst_dvd_demux_handle_dvd_event
(GstDVDDemux * dvd_demux, GstEvent * event); (GstDVDDemux * dvd_demux, GstEvent * event);
@ -195,6 +197,7 @@ gst_dvd_demux_base_init (gpointer klass)
mpeg_parse_class->send_buffer = NULL; mpeg_parse_class->send_buffer = NULL;
mpeg_parse_class->process_event = gst_dvd_demux_process_event; mpeg_parse_class->process_event = gst_dvd_demux_process_event;
mpeg_parse_class->parse_packhead = gst_dvd_demux_parse_packhead;
/* sink pad */ /* sink pad */
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
@ -669,6 +672,7 @@ gst_dvd_demux_get_audio_stream (GstMPEGDemux * mpeg_demux,
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_LANGUAGE_CODE, lang_code, NULL); GST_TAG_LANGUAGE_CODE, lang_code, NULL);
} }
str->tags = gst_tag_list_copy (list);
gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux), gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux),
str->pad, list); str->pad, list);
} }
@ -758,6 +762,7 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux,
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
GST_TAG_LANGUAGE_CODE, lang_code, NULL); GST_TAG_LANGUAGE_CODE, lang_code, NULL);
str->tags = gst_tag_list_copy (list);
gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux), gst_element_found_tags_for_pad (GST_ELEMENT (mpeg_demux),
str->pad, list); str->pad, list);
} }
@ -768,6 +773,31 @@ gst_dvd_demux_get_subpicture_stream (GstMPEGDemux * mpeg_demux,
return str; return str;
} }
static gboolean
gst_dvd_demux_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
{
GstMPEGDemux *mpeg_demux = GST_MPEG_DEMUX (mpeg_parse);
GstDVDDemux *dvd_demux = GST_DVD_DEMUX (mpeg_parse);
gboolean pending_tags = mpeg_demux->pending_tags;
GST_MPEG_PARSE_CLASS (parent_class)->parse_packhead (mpeg_parse, buffer);
if (pending_tags) {
GstMPEGStream **streams;
guint i, num;
streams = dvd_demux->subpicture_stream;
num = GST_DVD_DEMUX_NUM_SUBPICTURE_STREAMS;
for (i = 0; i < num; ++i) {
if (streams[i] != NULL && streams[i]->tags != NULL)
gst_pad_push_event (streams[i]->pad,
gst_event_new_tag (gst_tag_list_copy (streams[i]->tags)));
}
}
return TRUE;
}
static GstFlowReturn static GstFlowReturn
gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux, gst_dvd_demux_process_private (GstMPEGDemux * mpeg_demux,
GstBuffer * buffer, GstBuffer * buffer,
@ -1134,6 +1164,8 @@ gst_dvd_demux_reset (GstDVDDemux * dvd_demux)
gst_element_remove_pad (GST_ELEMENT (dvd_demux), gst_element_remove_pad (GST_ELEMENT (dvd_demux),
dvd_demux->subpicture_stream[i]->pad); dvd_demux->subpicture_stream[i]->pad);
if (dvd_demux->subpicture_stream[i]->tags)
gst_tag_list_free (dvd_demux->subpicture_stream[i]->tags);
g_free (dvd_demux->subpicture_stream[i]); g_free (dvd_demux->subpicture_stream[i]);
dvd_demux->subpicture_stream[i] = NULL; dvd_demux->subpicture_stream[i] = NULL;
} }

View file

@ -231,6 +231,7 @@ gst_mpeg_demux_init (GstMPEGDemux * mpeg_demux, GstMPEGDemuxClass * klass)
mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE; mpeg_demux->max_gap_tolerance = GST_CLOCK_TIME_NONE;
mpeg_demux->last_pts = -1; mpeg_demux->last_pts = -1;
mpeg_demux->pending_tags = FALSE;
} }
@ -245,6 +246,8 @@ gst_mpeg_demux_process_event (GstMPEGParse * mpeg_parse, GstEvent * event)
ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse, ret = GST_MPEG_PARSE_CLASS (parent_class)->process_event (mpeg_parse,
event); event);
demux->pending_tags = TRUE;
gst_mpeg_streams_reset_last_flow (demux->video_stream, gst_mpeg_streams_reset_last_flow (demux->video_stream,
GST_MPEG_DEMUX_NUM_VIDEO_STREAMS); GST_MPEG_DEMUX_NUM_VIDEO_STREAMS);
gst_mpeg_streams_reset_last_flow (demux->audio_stream, gst_mpeg_streams_reset_last_flow (demux->audio_stream,
@ -327,6 +330,7 @@ gst_mpeg_demux_init_stream (GstMPEGDemux * mpeg_demux,
str->last_flow = GST_FLOW_OK; str->last_flow = GST_FLOW_OK;
str->buffers_sent = 0; str->buffers_sent = 0;
str->tags = NULL;
} }
static GstMPEGStream * static GstMPEGStream *
@ -493,6 +497,7 @@ gst_mpeg_demux_get_private_stream (GstMPEGDemux * mpeg_demux,
static gboolean static gboolean
gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer) gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
{ {
GstMPEGDemux *demux = GST_MPEG_DEMUX (mpeg_parse);
guint8 *buf; guint8 *buf;
parent_class->parse_packhead (mpeg_parse, buffer); parent_class->parse_packhead (mpeg_parse, buffer);
@ -500,6 +505,20 @@ gst_mpeg_demux_parse_packhead (GstMPEGParse * mpeg_parse, GstBuffer * buffer)
buf = GST_BUFFER_DATA (buffer); buf = GST_BUFFER_DATA (buffer);
/* do something useful here */ /* do something useful here */
if (demux->pending_tags) {
GstMPEGStream **streams;
guint i, num;
streams = demux->audio_stream;
num = GST_MPEG_DEMUX_NUM_AUDIO_STREAMS;
for (i = 0; i < num; ++i) {
if (streams[i] != NULL && streams[i]->tags != NULL)
gst_pad_push_event (streams[i]->pad,
gst_event_new_tag (gst_tag_list_copy (streams[i]->tags)));
}
demux->pending_tags = FALSE;
}
return TRUE; return TRUE;
} }
@ -1323,6 +1342,8 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
gst_event_new_eos ()); gst_event_new_eos ());
gst_element_remove_pad (GST_ELEMENT (mpeg_demux), gst_element_remove_pad (GST_ELEMENT (mpeg_demux),
mpeg_demux->audio_stream[i]->pad); mpeg_demux->audio_stream[i]->pad);
if (mpeg_demux->audio_stream[i]->tags)
gst_tag_list_free (mpeg_demux->audio_stream[i]->tags);
g_free (mpeg_demux->audio_stream[i]); g_free (mpeg_demux->audio_stream[i]);
mpeg_demux->audio_stream[i] = NULL; mpeg_demux->audio_stream[i] = NULL;
} }
@ -1351,6 +1372,7 @@ gst_mpeg_demux_reset (GstMPEGDemux * mpeg_demux)
mpeg_demux->index = NULL; mpeg_demux->index = NULL;
mpeg_demux->last_pts = -1; mpeg_demux->last_pts = -1;
mpeg_demux->pending_tags = FALSE;
/* /*
* Don't adjust things that are only for subclass use * Don't adjust things that are only for subclass use

View file

@ -98,6 +98,7 @@ struct _GstMPEGStream {
GstClockTimeDiff scr_offs; GstClockTimeDiff scr_offs;
GstFlowReturn last_flow; GstFlowReturn last_flow;
guint buffers_sent; guint buffers_sent;
GstTagList *tags;
}; };
/* Extended structure to hold additional information for video /* Extended structure to hold additional information for video
@ -126,6 +127,7 @@ struct _GstMPEGDemux {
gint64 total_size_bound; gint64 total_size_bound;
gint64 last_pts; gint64 last_pts;
gboolean pending_tags;
GstIndex *index; GstIndex *index;
/* stream output */ /* stream output */