ext/: Fix old naming.
authorWim Taymans <wim.taymans@gmail.com>
Fri, 21 Oct 2005 15:14:36 +0000 (15:14 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Fri, 21 Oct 2005 15:14:36 +0000 (15:14 +0000)
Original commit message from CVS:
* ext/theora/theoradec.c: (theora_dec_src_query),
(theora_dec_sink_event):
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_sink_event), (vorbis_handle_identification_packet),
(vorbis_handle_data_packet):
* ext/vorbis/vorbisdec.h:
Fix old naming.

* gst-libs/gst/audio/gstbaseaudiosink.c:
(gst_base_audio_sink_render):
Don't try to sync on buffers without a timestamp.

ChangeLog
ext/theora/theoradec.c
ext/vorbis/vorbisdec.c
ext/vorbis/vorbisdec.h
gst-libs/gst/audio/gstbaseaudiosink.c

index 6ce2390..67753ed 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2005-10-21  Wim Taymans  <wim@fluendo.com>
+
+       * ext/theora/theoradec.c: (theora_dec_src_query),
+       (theora_dec_sink_event):
+       * ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
+       (vorbis_dec_sink_event), (vorbis_handle_identification_packet),
+       (vorbis_handle_data_packet):
+       * ext/vorbis/vorbisdec.h:
+       Fix old naming.
+
+       * gst-libs/gst/audio/gstbaseaudiosink.c:
+       (gst_base_audio_sink_render):
+       Don't try to sync on buffers without a timestamp.
+
+2005-10-21  Wim Taymans  <wim@fluendo.com>
+
+       * ext/theora/theoradec.c: (theora_dec_src_query),
+       (theora_dec_sink_event):
+       * ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
+       (vorbis_dec_sink_event), (vorbis_handle_identification_packet),
+       (vorbis_handle_data_packet):
+       * ext/vorbis/vorbisdec.h:
+       Fix old naming.
+
 2005-10-20  Tim-Philipp Müller  <tim at centricular dot net>
 
        * ext/vorbis/vorbisenc.c: (gst_vorbisenc_get_query_types),
index 91c317c..46532fb 100644 (file)
@@ -70,7 +70,7 @@ struct _GstTheoraDec
   gdouble segment_rate;
   gint64 segment_start;
   gint64 segment_stop;
-  gint64 segment_base;
+  gint64 segment_time;
 };
 
 struct _GstTheoraDecClass
@@ -447,7 +447,7 @@ theora_dec_src_query (GstPad * pad, GstQuery * query)
                   granulepos, &my_format, &time)))
         goto error;
 
-      time = (time - dec->segment_start) + dec->segment_base;
+      time = (time - dec->segment_start) + dec->segment_time;
 
       GST_LOG_OBJECT (dec,
           "query %p: our time: %" GST_TIME_FORMAT, query, GST_TIME_ARGS (time));
@@ -609,11 +609,11 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
     {
       GstFormat format;
       gdouble rate;
-      gint64 start, stop, base;
+      gint64 start, stop, time;
 
       GST_STREAM_LOCK (pad);
       gst_event_parse_newsegment (event, NULL, &rate, &format, &start, &stop,
-          &base);
+          &time);
 
       /* we need TIME and a positive rate */
       if (format != GST_FORMAT_TIME)
@@ -626,7 +626,7 @@ theora_dec_sink_event (GstPad * pad, GstEvent * event)
       dec->segment_rate = rate;
       dec->segment_start = start;
       dec->segment_stop = stop;
-      dec->segment_base = base;
+      dec->segment_time = time;
 
       dec->need_keyframe = TRUE;
       dec->granulepos = -1;
index d4e2e19..73c0ecb 100644 (file)
@@ -291,7 +291,7 @@ vorbis_dec_src_query (GstPad * pad, GstQuery * query)
                   &value)))
         goto error;
 
-      value = (value - dec->segment_start) + dec->segment_base;
+      value = (value - dec->segment_start) + dec->segment_time;
 
       gst_query_set_position (query, format, value);
 
@@ -433,12 +433,12 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
     {
       GstFormat format;
       gdouble rate;
-      gint64 start, stop, base;
+      gint64 start, stop, time;
       gboolean update;
 
       GST_STREAM_LOCK (pad);
       gst_event_parse_newsegment (event, &update, &rate, &format, &start, &stop,
-          &base);
+          &time);
 
       if (format != GST_FORMAT_TIME)
         goto newseg_wrong_format;
@@ -450,7 +450,7 @@ vorbis_dec_sink_event (GstPad * pad, GstEvent * event)
       dec->segment_rate = rate;
       dec->segment_start = start;
       dec->segment_stop = stop;
-      dec->segment_base = base;
+      dec->segment_time = time;
 
       dec->granulepos = -1;
       dec->cur_timestamp = GST_CLOCK_TIME_NONE;
index 4c01366..5ec19f1 100644 (file)
@@ -62,7 +62,7 @@ struct _GstVorbisDec {
   gdouble segment_rate;
   gint64  segment_start;
   gint64  segment_stop;
-  gint64  segment_base;
+  gint64  segment_time;
 
   GstClockTime          cur_timestamp; /* only used with non-ogg container formats */
   GstClockTime          prev_timestamp; /* only used with non-ogg container formats */
index 69ecda2..2aaa1a1 100644 (file)
@@ -374,13 +374,19 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
   GST_DEBUG ("time %" GST_TIME_FORMAT ", offset %llu, start %" GST_TIME_FORMAT,
       GST_TIME_ARGS (time), in_offset, GST_TIME_ARGS (bsink->segment_start));
 
+  if (!GST_CLOCK_TIME_IS_VALID (time)) {
+    render_offset = sink->next_sample;
+    goto no_sync;
+  }
+
   render_diff = time - bsink->segment_start;
+
   /* samples should be rendered based on their timestamp. All samples
    * arriving before the segment_start are to be thrown away */
   /* FIXME, for now we drop the sample completely, we should
    * in fact clip the sample. Same for the segment_stop, actually. */
   if (render_diff < 0)
-    return GST_FLOW_OK;
+    goto out_of_segment;
 
   /* bring buffer timestamp to stream time */
   render_time = render_diff;
@@ -415,6 +421,7 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
     GST_DEBUG ("resync");
   }
 
+no_sync:
   /* clip length based on rate */
   samples /= ABS (bsink->segment_rate);
 
@@ -423,13 +430,20 @@ gst_base_audio_sink_render (GstBaseSink * bsink, GstBuffer * buf)
 
   gst_ring_buffer_commit (ringbuf, render_offset, data, samples);
 
-  if (time + duration >= bsink->segment_stop) {
+  if (GST_CLOCK_TIME_IS_VALID (time) && time + duration >= bsink->segment_stop) {
     GST_DEBUG ("start playback because we are at the end of segment");
     gst_ring_buffer_start (ringbuf);
   }
 
   return GST_FLOW_OK;
 
+out_of_segment:
+  {
+    GST_DEBUG ("dropping sample out of segment time %" GST_TIME_FORMAT
+        ", start %" GST_TIME_FORMAT,
+        GST_TIME_ARGS (time), GST_TIME_ARGS (bsink->segment_start));
+    return GST_FLOW_OK;
+  }
 wrong_state:
   {
     GST_DEBUG ("ringbuffer not negotiated");