asfdemux: properly do chained asfs on push mode

To properly do chained asfs work with playbin2, we need to
push eos on the old pads before removing them.

Fixes #599718
This commit is contained in:
Thiago Santos 2009-11-09 10:24:46 -03:00
parent 37e805ef24
commit dc65baacf6
2 changed files with 33 additions and 0 deletions

View file

@ -203,6 +203,23 @@ gst_asf_demux_reset (GstASFDemux * demux, gboolean chain_reset)
NULL); NULL);
g_slist_free (demux->ext_stream_props); g_slist_free (demux->ext_stream_props);
demux->ext_stream_props = NULL; demux->ext_stream_props = NULL;
while (demux->old_num_streams > 0) {
gst_asf_demux_free_stream (demux,
&demux->old_stream[demux->old_num_streams - 1]);
--demux->old_num_streams;
}
memset (demux->old_stream, 0, sizeof (demux->old_stream));
demux->old_num_streams = 0;
/* when resetting for a new chained asf, we don't want to remove the pads
* before adding the new ones */
if (chain_reset) {
memcpy (demux->old_stream, demux->stream, sizeof (demux->stream));
demux->old_num_streams = demux->num_streams;
demux->num_streams = 0;
}
while (demux->num_streams > 0) { while (demux->num_streams > 0) {
gst_asf_demux_free_stream (demux, &demux->stream[demux->num_streams - 1]); gst_asf_demux_free_stream (demux, &demux->stream[demux->num_streams - 1]);
--demux->num_streams; --demux->num_streams;
@ -796,6 +813,17 @@ gst_asf_demux_chain_headers (GstASFDemux * demux)
if (flow != GST_FLOW_OK) if (flow != GST_FLOW_OK)
goto parse_failed; goto parse_failed;
/* release old pads (only happens on chained asfs) */
while (demux->old_num_streams > 0) {
gst_pad_push_event (demux->old_stream[demux->old_num_streams - 1].pad,
gst_event_new_eos ());
gst_asf_demux_free_stream (demux,
&demux->old_stream[demux->old_num_streams - 1]);
--demux->old_num_streams;
}
memset (demux->old_stream, 0, sizeof (demux->old_stream));
demux->old_num_streams = 0;
/* calculate where the packet data starts */ /* calculate where the packet data starts */
demux->data_offset = obj.size + 50; demux->data_offset = obj.size + 50;

View file

@ -158,6 +158,11 @@ struct _GstASFDemux {
AsfStream stream[GST_ASF_DEMUX_NUM_STREAMS]; AsfStream stream[GST_ASF_DEMUX_NUM_STREAMS];
gboolean activated_streams; gboolean activated_streams;
/* for chained asf handling, we need to hold the old asf streams until
* we detect the new ones */
AsfStream old_stream[GST_ASF_DEMUX_NUM_STREAMS];
gboolean old_num_streams;
GstClockTime first_ts; /* first timestamp found */ GstClockTime first_ts; /* first timestamp found */
guint32 packet_size; guint32 packet_size;