From: Tim-Philipp Müller Date: Wed, 4 Jul 2012 15:16:04 +0000 (+0100) Subject: segment: make sure we don't have unmapped seek flags littering out segment flags X-Git-Tag: RELEASE-0.11.93~207 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=49ea16e041ef41e7a85f9c9810a2a28bc3929be9;p=platform%2Fupstream%2Fgstreamer.git segment: make sure we don't have unmapped seek flags littering out segment flags Make GstSeekFlag to GstSegmentFlag conversion explicit, and set only those seek flags in the segment flags which are mapped. This makes sure we don't have extraneous flags littering our segment flag field, which also fixes the debug printing/serialisation of segment events in the debug log. --- diff --git a/docs/design/part-segments.txt b/docs/design/part-segments.txt index 56a2e1a..ab6606c 100644 --- a/docs/design/part-segments.txt +++ b/docs/design/part-segments.txt @@ -64,7 +64,7 @@ Use case: FLUSHING seek When it reaches timestamp 5, it does not decode and push frames anymore. The video sink receives a frame of timestamp 1. It takes the start value of - the previous segment and aplies the folowing (simplified) formula: + the previous segment and aplies the following (simplified) formula: render_time = BUFFER_TIMESTAMP - segment_start + element->base_time diff --git a/gst/gstsegment.c b/gst/gstsegment.c index 0e5cc17..fb73068 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -317,7 +317,12 @@ gst_segment_do_seek (GstSegment * segment, gdouble rate, segment->rate = rate; segment->applied_rate = 1.0; segment->base = base; - segment->flags = (GstSegmentFlags) flags; + /* be explicit about our GstSeekFlag -> GstSegmentFlag conversion */ + segment->flags = GST_SEGMENT_FLAG_NONE; + if ((flags & GST_SEEK_FLAG_FLUSH) != 0) + segment->flags |= GST_SEGMENT_FLAG_RESET; + if ((flags & GST_SEEK_FLAG_SKIP) != 0) + segment->flags |= GST_SEGMENT_FLAG_SKIP; segment->start = start; segment->stop = stop; segment->time = start; diff --git a/gst/gstsegment.h b/gst/gstsegment.h index 9d3a8d1..ac8c07e 100644 --- a/gst/gstsegment.h +++ b/gst/gstsegment.h @@ -130,6 +130,7 @@ typedef enum { * Flags for the GstSegment structure. Currently mapped to the corresponding * values of the seek flags. */ +/* Note: update gst_segment_do_seek() when adding new flags here */ typedef enum { GST_SEGMENT_FLAG_NONE = GST_SEEK_FLAG_NONE, GST_SEGMENT_FLAG_RESET = GST_SEEK_FLAG_FLUSH,