mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
ext/theora/theoradec.c: Implement clipping for accurate seeking.
Original commit message from CVS: * ext/theora/theoradec.c: (clip_buffer), (theora_dec_push): Implement clipping for accurate seeking. Closes #345225
This commit is contained in:
parent
f68c41710a
commit
9dbfbfde27
2 changed files with 49 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-06-19 Edward Hervey <edward@fluendo.com>
|
||||
|
||||
* ext/theora/theoradec.c: (clip_buffer), (theora_dec_push):
|
||||
Implement clipping for accurate seeking.
|
||||
Closes #345225
|
||||
|
||||
2006-06-19 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
Patch by: Philip Jaegenstedt <philip at lysator dot liu dot se>
|
||||
|
|
|
@ -863,17 +863,50 @@ header_read_error:
|
|||
}
|
||||
}
|
||||
|
||||
/* returns TRUE if buffer is within segment, else FALSE.
|
||||
* if Buffer is on segment border, it's timestamp and duration will be clipped */
|
||||
|
||||
static gboolean
|
||||
clip_buffer (GstTheoraDec * dec, GstBuffer * buf)
|
||||
{
|
||||
gboolean res = FALSE;
|
||||
gint64 cstart, cstop;
|
||||
|
||||
GST_LOG_OBJECT (dec,
|
||||
"timestamp:%" GST_TIME_FORMAT " , duration:%" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)),
|
||||
GST_TIME_ARGS (GST_BUFFER_DURATION (buf)));
|
||||
|
||||
if (dec->segment.format != GST_FORMAT_TIME) {
|
||||
res = TRUE;
|
||||
goto beach;
|
||||
}
|
||||
|
||||
if (!(gst_segment_clip (&dec->segment, GST_FORMAT_TIME,
|
||||
GST_BUFFER_TIMESTAMP (buf),
|
||||
GST_BUFFER_TIMESTAMP (buf) + GST_BUFFER_DURATION (buf),
|
||||
&cstart, &cstop)))
|
||||
goto beach;
|
||||
|
||||
GST_BUFFER_TIMESTAMP (buf) = cstart;
|
||||
GST_BUFFER_DURATION (buf) = cstop - cstart;
|
||||
res = TRUE;
|
||||
|
||||
beach:
|
||||
GST_LOG_OBJECT (dec, "dropping : %d", res);
|
||||
return res;
|
||||
}
|
||||
|
||||
/* FIXME, this needs to be moved to the demuxer */
|
||||
static GstFlowReturn
|
||||
theora_dec_push (GstTheoraDec * dec, GstBuffer * buf)
|
||||
{
|
||||
GstFlowReturn result;
|
||||
GstFlowReturn result = GST_FLOW_OK;
|
||||
GstClockTime outtime = GST_BUFFER_TIMESTAMP (buf);
|
||||
|
||||
if (outtime == GST_CLOCK_TIME_NONE) {
|
||||
dec->queued = g_list_append (dec->queued, buf);
|
||||
GST_DEBUG_OBJECT (dec, "queued buffer");
|
||||
result = GST_FLOW_OK;
|
||||
} else {
|
||||
if (dec->queued) {
|
||||
gint64 size;
|
||||
|
@ -898,7 +931,10 @@ theora_dec_push (GstTheoraDec * dec, GstBuffer * buf)
|
|||
dec->discont = FALSE;
|
||||
}
|
||||
/* ignore the result.. */
|
||||
gst_pad_push (dec->srcpad, buffer);
|
||||
if (clip_buffer (dec, buffer))
|
||||
gst_pad_push (dec->srcpad, buffer);
|
||||
else
|
||||
gst_buffer_unref (buffer);
|
||||
size--;
|
||||
}
|
||||
g_list_free (dec->queued);
|
||||
|
@ -908,7 +944,10 @@ theora_dec_push (GstTheoraDec * dec, GstBuffer * buf)
|
|||
GST_BUFFER_FLAG_SET (buf, GST_BUFFER_FLAG_DISCONT);
|
||||
dec->discont = FALSE;
|
||||
}
|
||||
result = gst_pad_push (dec->srcpad, buf);
|
||||
if (clip_buffer (dec, buf))
|
||||
result = gst_pad_push (dec->srcpad, buf);
|
||||
else
|
||||
gst_buffer_unref (buf);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
|
Loading…
Reference in a new issue