summaryrefslogtreecommitdiffstats
path: root/gst
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-08-22 17:02:39 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-08-22 17:02:39 +0000
commit2bd16585bc39f674e14fac93646175a562901370 (patch)
tree804a3d56d32705d7b0d80c3f5fc3bb02bc9ea2ef /gst
parent0f38451f208637683b47694f74bf09da10d26a3a (diff)
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.
Diffstat (limited to 'gst')
-rw-r--r--gst/avi/gstavidemux.c24
-rw-r--r--gst/avi/gstavidemux.h28
2 files changed, 37 insertions, 15 deletions
diff --git a/gst/avi/gstavidemux.c b/gst/avi/gstavidemux.c
index 8164847b..3f2d0603 100644
--- a/gst/avi/gstavidemux.c
+++ b/gst/avi/gstavidemux.c
@@ -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 */
diff --git a/gst/avi/gstavidemux.h b/gst/avi/gstavidemux.h
index 259906fa..bc14183f 100644
--- a/gst/avi/gstavidemux.h
+++ b/gst/avi/gstavidemux.h
@@ -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;