ext/theora/theoradec.c: make comments work
authorBenjamin Otte <otte@gnome.org>
Sat, 31 Jan 2004 11:24:18 +0000 (11:24 +0000)
committerBenjamin Otte <otte@gnome.org>
Sat, 31 Jan 2004 11:24:18 +0000 (11:24 +0000)
Original commit message from CVS:
2004-01-31  Benjamin Otte  <in7y118@public.uni-hamburg.de>

* ext/theora/theoradec.c: (theora_dec_chain):
make comments work
* ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
(vorbis_dec_src_event), (vorbis_dec_chain):
add encoder tag, fix tag reading to be more error tolerant, change
BITRATE to NOMINAL_BITRATE, add debugging, don't unref events after
gst_pad_event_default.
* gst/tags/gstvorbistag.c:
(gst_tag_list_from_vorbiscomment_buffer):
undefine function specific define at end of function

ChangeLog
ext/theora/theoradec.c
ext/vorbis/vorbisdec.c
gst/tags/gstvorbistag.c

index 80909d9..3400beb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2004-01-31  Benjamin Otte  <in7y118@public.uni-hamburg.de>
+
+       * ext/theora/theoradec.c: (theora_dec_chain):
+         make comments work
+       * ext/vorbis/vorbisdec.c: (vorbis_dec_src_query),
+       (vorbis_dec_src_event), (vorbis_dec_chain):
+         add encoder tag, fix tag reading to be more error tolerant, change
+         BITRATE to NOMINAL_BITRATE, add debugging, don't unref events after
+         gst_pad_event_default.
+       * gst/tags/gstvorbistag.c:
+       (gst_tag_list_from_vorbiscomment_buffer):
+         undefine function specific define at end of function
+
 2004-01-31  Jeremy Simon  <jesimon@libertysurf.fr>
 
        * ext/flac/gstflac.c: (plugin_init):
index 04bef04..1174503 100644 (file)
@@ -248,7 +248,17 @@ theora_dec_chain (GstPad *pad, GstData *data)
       return;
     }
     if (packet.packetno == 1) {
-      GstTagList *list = gst_tag_list_from_vorbiscomment_buffer (buf, "\101theora", 7, NULL);
+      gchar *encoder = NULL;
+      GstTagList *list = gst_tag_list_from_vorbiscomment_buffer (buf, "\201theora", 7, &encoder);
+      if (!list) {
+       GST_ERROR_OBJECT (dec, "failed to parse tags");
+       list = gst_tag_list_new ();
+      }
+      if (encoder) {
+       gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
+           GST_TAG_ENCODER, encoder, NULL);
+       g_free (encoder);
+      }
       gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
          GST_TAG_ENCODER_VERSION, dec->info.version_major, NULL);
       gst_element_found_tags_for_pad (GST_ELEMENT (dec), dec->srcpad, 0, list);
index 4209d5a..74c3f15 100644 (file)
@@ -211,7 +211,8 @@ vorbis_dec_src_query (GstPad *pad, GstQueryType query, GstFormat *format, gint64
   if (!vorbis_dec_from_granulepos (dec, *format, granulepos, value))
     return FALSE;
 
-  g_print ("peer returned granulepos: %llu - we return %llu\n", granulepos, *value);
+  GST_LOG_OBJECT (dec, "query %u: peer returned granulepos: %llu - we return %llu (format %u)\n", 
+      query, granulepos, *value, *format);
   return TRUE;
 }
 
@@ -233,6 +234,7 @@ vorbis_dec_src_event (GstPad *pad, GstEvent *event)
            value);
        res = gst_pad_send_event (GST_PAD_PEER (dec->sinkpad), real_seek);
       }
+      gst_event_unref (event);
       break;
     }
     default:
@@ -240,7 +242,6 @@ vorbis_dec_src_event (GstPad *pad, GstEvent *event)
       break;
   }
 
-  gst_event_unref (event);
   return res;
 }
 static void
@@ -302,7 +303,17 @@ vorbis_dec_chain (GstPad *pad, GstData *data)
       return;
     }
     if (packet.packetno == 1) {
-      GstTagList *list = gst_tag_list_from_vorbiscomment_buffer (buf, "\003vorbis", 7, NULL);
+      gchar *encoder = NULL;
+      GstTagList *list = gst_tag_list_from_vorbiscomment_buffer (buf, "\003vorbis", 7, &encoder);
+      if (!list) {
+       GST_ERROR_OBJECT (vd, "couldn't decode comments");
+       list = gst_tag_list_new ();
+      }
+      if (encoder) {
+       gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
+           GST_TAG_ENCODER, encoder, NULL);
+       g_free (encoder);
+      }
       gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
          GST_TAG_ENCODER_VERSION, vd->vi.version, NULL);
       if (vd->vi.bitrate_upper)
@@ -310,7 +321,7 @@ vorbis_dec_chain (GstPad *pad, GstData *data)
            GST_TAG_MAXIMUM_BITRATE, (guint) vd->vi.bitrate_upper, NULL);
       if (vd->vi.bitrate_nominal)
        gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, 
-           GST_TAG_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
+           GST_TAG_NOMINAL_BITRATE, (guint) vd->vi.bitrate_nominal, NULL);
       if (vd->vi.bitrate_lower)
        gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, 
            GST_TAG_MINIMUM_BITRATE, (guint) vd->vi.bitrate_lower, NULL);
index 72089fc..55b9d43 100644 (file)
@@ -366,6 +366,7 @@ gst_tag_list_from_vorbiscomment_buffer (const GstBuffer *buffer, const guint8 *i
 error:
   gst_tag_list_free (list);
   return NULL;
+#undef ADVANCE
 }
 typedef struct {
   guint count;