ext/ffmpeg/gstffmpegdec.c: Actually convert to time instead of pretending.. Also...
authorWim Taymans <wim.taymans@gmail.com>
Tue, 11 Apr 2006 17:53:21 +0000 (17:53 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Tue, 11 Apr 2006 17:53:21 +0000 (17:53 +0000)
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
ext/ffmpeg/gstffmpegdec.c

index c951657..24cd8ee 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
 
        * ext/ffmpeg/gstffmpegdec.c: (gst_ffmpegdec_chain):
index 2f8eaa0..3afc899 100644 (file)
@@ -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;