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> 2006-08-22 Wim Taymans <wim@fluendo.com>
* gst/rtsp/gstrtspsrc.c: (gst_rtspsrc_media_to_caps), * 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); gst_object_unref (stream->pad);
pad = stream->pad = gst_pad_new_from_template (templ, padname); pad = stream->pad = gst_pad_new_from_template (templ, padname);
stream->last_flow = GST_FLOW_OK; stream->last_flow = GST_FLOW_OK;
stream->discont = TRUE;
stream->idx_duration = GST_CLOCK_TIME_NONE; stream->idx_duration = GST_CLOCK_TIME_NONE;
g_free (padname); g_free (padname);
@ -1100,7 +1101,6 @@ gst_avi_demux_parse_stream (GstElement * element, GstBuffer * buf)
stream->total_frames = 0; stream->total_frames = 0;
stream->current_frame = 0; stream->current_frame = 0;
stream->current_byte = 0; stream->current_byte = 0;
stream->current_entry = -1;
gst_pad_set_element_private (pad, stream); gst_pad_set_element_private (pad, stream);
avi->num_streams++; avi->num_streams++;
gst_pad_set_caps (pad, caps); gst_pad_set_caps (pad, caps);
@ -2278,6 +2278,7 @@ gst_avi_demux_do_seek (GstAviDemux * avi, GstSegment * segment)
GstClockTime seek_time; GstClockTime seek_time;
gboolean keyframe; gboolean keyframe;
gst_avi_index_entry *entry; gst_avi_index_entry *entry;
gint old_entry;
seek_time = segment->last_stop; seek_time = segment->last_stop;
keyframe = !!(segment->flags & GST_SEEK_FLAG_KEY_UNIT); 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 /* FIXME: if we seek in an openDML file, we will have multiple
* primary levels. Seeking in between those will cause havoc. */ * 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. /* 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 * 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 * 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; 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 GST_DEBUG_OBJECT (avi, "seek: %" GST_TIME_FORMAT
" keyframe seeking:%d", GST_TIME_ARGS (seek_time), keyframe); " 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_DEBUG_OBJECT (avi, "sending flush stop");
gst_avi_demux_push_event (avi, gst_event_new_flush_stop ()); gst_avi_demux_push_event (avi, gst_event_new_flush_stop ());
gst_pad_push_event (avi->sinkpad, 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++) { for (i = 0; i < avi->num_streams; i++) {
avi->stream[i].last_flow = GST_FLOW_OK; avi->stream[i].last_flow = GST_FLOW_OK;
avi->stream[i].discont = TRUE;
} }
} else if (avi->segment_running) { } else if (avi->segment_running) {
GstEvent *seg; GstEvent *seg;
@ -2612,6 +2626,12 @@ gst_avi_demux_process_next_entry (GstAviDemux * avi)
/* update current position in the segment */ /* update current position in the segment */
gst_segment_set_last_stop (&avi->segment, GST_FORMAT_TIME, entry->ts); 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); res = stream->last_flow = gst_pad_push (stream->pad, buf);
/* mark as processed, we increment the frame and byte counters then /* mark as processed, we increment the frame and byte counters then
* return the GstFlowReturn */ * return the GstFlowReturn */

View File

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