gst/asfdemux/gstasfdemux.c: Align by packetsize, and assert that we a packet available before playing. The first make...

Original commit message from CVS:
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_loop):
Align by packetsize, and assert that we a packet available before
playing. The first makes webstreams work (they often include
trailing padding data in a packet), the second allows pausing a
ASF stream in totem without getting demux errors afterwards.
This commit is contained in:
Ronald S. Bultje 2004-12-10 21:11:33 +00:00
parent 571efb17ee
commit 4abe8302cd
2 changed files with 38 additions and 1 deletions

View file

@ -1,3 +1,11 @@
2004-12-10 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* gst/asfdemux/gstasfdemux.c: (gst_asf_demux_loop):
Align by packetsize, and assert that we a packet available before
playing. The first makes webstreams work (they often include
trailing padding data in a packet), the second allows pausing a
ASF stream in totem without getting demux errors afterwards.
2004-12-09 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
* ext/ogg/gstoggdemux.c: (get_relative):

View file

@ -218,9 +218,38 @@ gst_asf_demux_loop (GstElement * element)
case GST_ASF_DEMUX_STATE_HEADER:
gst_asf_demux_process_object (asf_demux);
break;
case GST_ASF_DEMUX_STATE_DATA:
case GST_ASF_DEMUX_STATE_DATA:{
guint64 start_off = gst_bytestream_tell (asf_demux->bs), end_off;
/* make sure a full packet is actually available */
if (asf_demux->packet_size != (guint32) - 1)
do {
guint32 remaining;
GstEvent *event;
guint got_bytes;
guint8 *data;
if ((got_bytes = gst_bytestream_peek_bytes (asf_demux->bs, &data,
asf_demux->packet_size)) == asf_demux->packet_size)
break;
gst_bytestream_get_status (asf_demux->bs, &remaining, &event);
if (!gst_asf_demux_handle_sink_event (asf_demux, event, remaining))
return;
} while (1);
/* now handle data */
gst_asf_demux_handle_data (asf_demux);
/* align by packet size */
end_off = gst_bytestream_tell (asf_demux->bs);
if (asf_demux->packet_size != (guint32) - 1 &&
end_off - start_off < asf_demux->packet_size) {
gst_bytestream_flush_fast (asf_demux->bs,
asf_demux->packet_size - (end_off - start_off));
}
break;
}
case GST_ASF_DEMUX_STATE_EOS:
gst_pad_event_default (asf_demux->sinkpad, gst_event_new (GST_EVENT_EOS));
break;