[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gstreamer-cvs
Subject:    gst-plugins-base: ext/taglib/gsttaglib.cc: We do not want to proxy
From:       tpm () kemper ! freedesktop ! org (Tim Müller)
Date:       2011-07-29 18:40:04
Message-ID: 20110729184004.69F96D8003 () kemper ! freedesktop ! org
[Download RAW message or body]

Module: gst-plugins-base
Branch: master
Commit: 800c145a3a37e0e8d4db6b3b7a8534931d06f163
URL:    http://cgit.freedesktop.org/gstreamer/gst-plugins-base/commit/?id=800c145a3a37e0e8d4db6b3b7a8534931d06f163


Author: Tim-Philipp Müller <tim@centricular.net>
Date:   Sat Mar 25 21:57:24 2006 +0000

ext/taglib/gsttaglib.cc: We do not want to proxy the caps on the
sink pad; our source pad should have application/x-i...

Original commit message from CVS:
* ext/taglib/gsttaglib.cc:
We do not want to proxy the caps on the sink pad; our
source pad should have application/x-id3 caps; also,
don't use already-freed strings in debug messages;
finally, adjust buffer offsets on buffers sent out.

---

 gst-libs/gst/tag/gsttagmux.c |   30 ++++++++++++++++++++----------
 1 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/gst-libs/gst/tag/gsttagmux.c b/gst-libs/gst/tag/gsttagmux.c
index 99af3ee..23ce328 100644
--- a/gst-libs/gst/tag/gsttagmux.c
+++ b/gst-libs/gst/tag/gsttagmux.c
@@ -149,14 +149,11 @@ static void
 gst_tag_lib_mux_init (GstTagLibMux * taglib,
     GstTagLibMuxClass * taglibmux_class)
 {
-  GstElementClass *klass = GST_ELEMENT_CLASS (taglibmux_class);
+  GstCaps *srccaps;
 
   /* pad through which data comes in to the element */
   taglib->sinkpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
-          "sink"), "sink");
-  gst_pad_set_setcaps_function (taglib->sinkpad,
-      GST_DEBUG_FUNCPTR (gst_pad_proxy_setcaps));
+      gst_pad_new_from_static_template (&gst_tag_lib_mux_sink_template, "sink");
   gst_pad_set_chain_function (taglib->sinkpad,
       GST_DEBUG_FUNCPTR (gst_tag_lib_mux_chain));
   gst_pad_set_event_function (taglib->sinkpad,
@@ -165,8 +162,10 @@ gst_tag_lib_mux_init (GstTagLibMux * taglib,
 
   /* pad through which data goes out of the element */
   taglib->srcpad =
-      gst_pad_new_from_template (gst_element_class_get_pad_template (klass,
-          "src"), "src");
+      gst_pad_new_from_static_template (&gst_tag_lib_mux_src_template, "src");
+  srccaps = gst_static_pad_template_get_caps (&gst_tag_lib_mux_src_template);
+  gst_pad_use_fixed_caps (taglib->srcpad);
+  gst_pad_set_caps (taglib->srcpad, srccaps);
   gst_element_add_pad (GST_ELEMENT (taglib), taglib->srcpad);
 
   taglib->render_tag = TRUE;
@@ -309,10 +308,11 @@ add_one_tag (const GstTagList * list, const gchar * tag, \
gpointer user_data)  tag_str = g_strdup_printf ("%d", volume_number);
       }
 
+      GST_DEBUG ("Setting album number to %s", tag_str);
+
       id3v2tag->addFrame (frame);
       frame->setText (tag_str);
       g_free (tag_str);
-      GST_DEBUG ("Setting album number to %s", tag_str);
     }
   } else if (strcmp (tag, GST_TAG_COPYRIGHT) == 0) {
     gchar *copyright;
@@ -322,12 +322,13 @@ add_one_tag (const GstTagList * list, const gchar * tag, \
gpointer user_data)  if (result != FALSE) {
       ID3v2::TextIdentificationFrame * frame;
 
+      GST_DEBUG ("Setting copyright to %s", copyright);
+
       frame = new ID3v2::TextIdentificationFrame ("TCOP", String::UTF8);
 
       id3v2tag->addFrame (frame);
       frame->setText (copyright);
       g_free (copyright);
-      GST_DEBUG ("Setting copyright to %s", copyright);
     }
   } else if (strcmp (tag, GST_TAG_MUSICBRAINZ_ARTISTID) == 0) {
     gchar *id_str;
@@ -417,6 +418,8 @@ gst_tag_lib_mux_render_tag (GstTagLibMux * taglib)
   event = gst_event_new_tag (taglist);
   gst_pad_push_event (taglib->srcpad, event);
 
+  GST_BUFFER_OFFSET (buffer) = 0;
+
   return buffer;
 }
 
@@ -429,7 +432,7 @@ gst_tag_lib_mux_chain (GstPad * pad, GstBuffer * buffer)
   if (taglib->render_tag) {
     GstFlowReturn ret;
 
-    GST_INFO ("Adding tags to stream");
+    GST_INFO_OBJECT (taglib, "Adding tags to stream");
     ret = gst_pad_push (taglib->srcpad, gst_tag_lib_mux_render_tag (taglib));
     if (ret != GST_FLOW_OK) {
       gst_buffer_unref (buffer);
@@ -438,6 +441,13 @@ gst_tag_lib_mux_chain (GstPad * pad, GstBuffer * buffer)
     taglib->render_tag = FALSE;
   }
 
+  if (GST_BUFFER_OFFSET (buffer) != GST_BUFFER_OFFSET_NONE) {
+    GST_LOG_OBJECT (taglib, "Adjusting buffer offset from %" G_GINT64_FORMAT
+        " to %" G_GINT64_FORMAT, GST_BUFFER_OFFSET (buffer),
+        GST_BUFFER_OFFSET (buffer) + taglib->tag_size);
+    GST_BUFFER_OFFSET (buffer) += taglib->tag_size;
+  }
+
   gst_buffer_set_caps (buffer, GST_PAD_CAPS (taglib->srcpad));
   return gst_pad_push (taglib->srcpad, buffer);
 }



_______________________________________________
gstreamer-commits mailing list
gstreamer-commits@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic