gst/avi/gstavidemux.*: Mark DISCONT.

Original commit message from CVS:
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
(gst_avi_demux_do_seek), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry):
* gst/avi/gstavidemux.h:
Mark DISCONT.
Remove old unused fields and reorder the struct a bit.
This commit is contained in:
Wim Taymans 2006-08-22 17:02:39 +00:00
parent 0f38451f20
commit 2bd16585bc
3 changed files with 46 additions and 15 deletions

View file

@ -1,3 +1,12 @@
2006-08-22 Wim Taymans <wim@fluendo.com>
* gst/avi/gstavidemux.c: (gst_avi_demux_parse_stream),
(gst_avi_demux_do_seek), (gst_avi_demux_handle_seek),
(gst_avi_demux_process_next_entry):
* gst/avi/gstavidemux.h:
Mark DISCONT.
Remove old unused fields and reorder the struct a bit.
2006-08-22 Wim Taymans <wim@fluendo.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_media_to_caps),

View file

@ -1084,6 +1084,7 @@ gst_avi_demux_parse_stream (GstElement * element, GstBuffer * buf)
gst_object_unref (stream->pad);
pad = stream->pad = gst_pad_new_from_template (templ, padname);
stream->last_flow = GST_FLOW_OK;
stream->discont = TRUE;
stream->idx_duration = GST_CLOCK_TIME_NONE;
g_free (padname);
@ -1100,7 +1101,6 @@ gst_avi_demux_parse_stream (GstElement * element, GstBuffer * buf)
stream->total_frames = 0;
stream->current_frame = 0;
stream->current_byte = 0;
stream->current_entry = -1;
gst_pad_set_element_private (pad, stream);
avi->num_streams++;
gst_pad_set_caps (pad, caps);
@ -2278,6 +2278,7 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
GstClockTime seek_time;
gboolean keyframe;
gst_avi_index_entry *entry;
gint old_entry;
seek_time = segment->last_stop;
keyframe = !!(segment->flags & GST_SEEK_FLAG_KEY_UNIT);
@ -2285,6 +2286,9 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
/* FIXME: if we seek in an openDML file, we will have multiple
* primary levels. Seeking in between those will cause havoc. */
/* save old position so we can see if we must mark a discont. */
old_entry = avi->current_entry;
/* get the entry for the requested position, which is always in last_stop.
* we search the index intry for stream 0, since all entries are sorted by
* time and stream we automagically are positioned for the other streams as
@ -2307,6 +2311,15 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
avi->current_entry = avi->index_size - 1;
}
/* if we changed position, mark a DISCONT on all streams */
if (avi->current_entry != old_entry) {
gint i;
for (i = 0; i < avi->num_streams; i++) {
avi->stream[i].discont = TRUE;
}
}
GST_DEBUG_OBJECT (avi, "seek: %" GST_TIME_FORMAT
" keyframe seeking:%d", GST_TIME_ARGS (seek_time), keyframe);
@ -2401,9 +2414,10 @@ gst_avi_demux_handle_seek (GstAviDemux * avi, GstPad * pad, GstEvent * event)
GST_DEBUG_OBJECT (avi, "sending flush stop");
gst_avi_demux_push_event (avi, gst_event_new_flush_stop ());
gst_pad_push_event (avi->sinkpad, gst_event_new_flush_stop ());
/* reset the last flow */
/* reset the last flow and mark discont, FLUSH is always DISCONT */
for (i = 0; i < avi->num_streams; i++) {
avi->stream[i].last_flow = GST_FLOW_OK;
avi->stream[i].discont = TRUE;
}
} else if (avi->segment_running) {
GstEvent *seg;
@ -2612,6 +2626,12 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
/* update current position in the segment */
gst_segment_set_last_stop (&avi->segment, GST_FORMAT_TIME, entry->ts);
/* mark discont when pending */
if (stream->discont) {
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
stream->discont = FALSE;
}
res = stream->last_flow = gst_pad_push (stream->pad, buf);
/* mark as processed, we increment the frame and byte counters then
* return the GstFlowReturn */

View file

@ -60,9 +60,10 @@ typedef struct {
/* index of this streamcontext */
guint num;
/* pad, strh */
/* pad*/
GstPad *pad;
GstFlowReturn last_flow;
/* stream info and headers */
gst_riff_strh *strh;
union {
gst_riff_strf_vids *vids;
@ -73,22 +74,23 @@ typedef struct {
GstBuffer *extradata, *initdata;
gchar *name;
/* current position (byte, frame, time) */
/* current position (byte, frame, time) and other status vars */
guint current_frame;
guint64 current_byte;
gint current_entry;
GstFlowReturn last_flow;
gboolean discont;
/* stream length */
guint64 total_bytes;
guint32 total_frames;
guint64 total_time;
/* VBR indicator */
gboolean is_vbr;
/* stream length according to index */
GstClockTime idx_duration;
/* VBR indicator */
gboolean is_vbr;
guint64 *indexes;
GstTagList *taglist;
@ -125,14 +127,14 @@ typedef struct _GstAviDemux {
/* some stream info for length */
gst_riff_avih *avih;
/* seeking in TIME */
gboolean streaming;
GstSegment segment;
gboolean segment_running;
GstEvent *seek_event;
/* segment in TIME */
GstSegment segment;
gboolean segment_running;
gboolean streaming;
/* pending tags/events */
GstEvent *seek_event;
GstTagList *globaltags;
gboolean got_tags;
} GstAviDemux;