From 0041a8fedec5c7c7f5ff9c3fc555a7d67d784045 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 11 Apr 2006 17:53:21 +0000 Subject: [PATCH] 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. --- ChangeLog | 7 +++++++ ext/ffmpeg/gstffmpegdec.c | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index c951657..24cd8ee 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-04-11 Wim Taymans + + * 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 * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain): diff --git a/ext/ffmpeg/gstffmpegdec.c b/ext/ffmpeg/gstffmpegdec.c index 2f8eaa0..3afc899 100644 --- a/ext/ffmpeg/gstffmpegdec.c +++ b/ext/ffmpeg/gstffmpegdec.c @@ -1337,25 +1337,35 @@ gst_ffmpegdec_sink_event (GstPad * pad, GstEvent * event) break; case GST_FORMAT_BYTES: { + gint bit_rate; + + bit_rate = ffmpegdec->context->bit_rate; + /* convert to time or fail */ - if (!ffmpegdec->context->bit_rate) + if (!bit_rate) goto no_bitrate; + GST_DEBUG_OBJECT (ffmpegdec, "bitrate: %d", bit_rate); + /* convert values to TIME */ if (start != -1) start = gst_util_uint64_scale_int (start, GST_SECOND, - ffmpegdec->context->bit_rate); + bit_rate); if (stop != -1) stop = gst_util_uint64_scale_int (stop, GST_SECOND, - ffmpegdec->context->bit_rate); + bit_rate); if (time != -1) time = gst_util_uint64_scale_int (time, GST_SECOND, - ffmpegdec->context->bit_rate); + bit_rate); /* unref old event */ gst_event_unref (event); /* 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, start, stop, time); break; -- 2.7.4