ext/ffmpeg/gstffmpegdec.c: Actually convert to time instead of pretending.. Also the bitrate of the context is mostly...

Original commit message from CVS:
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_sink_event):
Actually convert to time instead of pretending.. Also
the bitrate of the context is mostly wrong so don't
bother calculating a stop position.
This commit is contained in:
Wim Taymans 2006-04-11 17:53:21 +00:00
parent 016275008f
commit 0041a8fede
2 changed files with 21 additions and 4 deletions

View file

@ -1,3 +1,10 @@
2006-04-11 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_sink_event):
Actually convert to time instead of pretending.. Also
the bitrate of the context is mostly wrong so don't
bother calculating a stop position.
2006-04-10 Wim Taymans <wim@fluendo.com> 2006-04-10 Wim Taymans <wim@fluendo.com>
* ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain): * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):

View file

@ -1337,25 +1337,35 @@ gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event)
break; break;
case GST_FORMAT_BYTES: case GST_FORMAT_BYTES:
{ {
gint bit_rate;
bit_rate = ffmpegdec->context->bit_rate;
/* convert to time or fail */ /* convert to time or fail */
if (!ffmpegdec->context->bit_rate) if (!bit_rate)
goto no_bitrate; goto no_bitrate;
GST_DEBUG_OBJECT (ffmpegdec, "bitrate: %d", bit_rate);
/* convert values to TIME */ /* convert values to TIME */
if (start != -1) if (start != -1)
start = gst_util_uint64_scale_int (start, GST_SECOND, start = gst_util_uint64_scale_int (start, GST_SECOND,
ffmpegdec->context->bit_rate); bit_rate);
if (stop != -1) if (stop != -1)
stop = gst_util_uint64_scale_int (stop, GST_SECOND, stop = gst_util_uint64_scale_int (stop, GST_SECOND,
ffmpegdec->context->bit_rate); bit_rate);
if (time != -1) if (time != -1)
time = gst_util_uint64_scale_int (time, GST_SECOND, time = gst_util_uint64_scale_int (time, GST_SECOND,
ffmpegdec->context->bit_rate); bit_rate);
/* unref old event */ /* unref old event */
gst_event_unref (event); gst_event_unref (event);
/* create new converted time segment */ /* create new converted time segment */
fmt = GST_FORMAT_TIME;
/* FIXME, bitrate is not good enough too find a good stop, let's
* hope start and time were 0... */
stop = -1;
event = gst_event_new_new_segment (update, rate, fmt, event = gst_event_new_new_segment (update, rate, fmt,
start, stop, time); start, stop, time);
break; break;