Make caps writable before writing to it.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 9 May 2005 17:07:27 +0000 (17:07 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 9 May 2005 17:07:27 +0000 (17:07 +0000)
Original commit message from CVS:
* ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
(gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
(gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
(gst_vorbisenc_chain):
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
Make caps writable before writing to it.
Fix negotiation in audioconvert some more.

ChangeLog
ext/vorbis/vorbisenc.c
gst/audioconvert/gstaudioconvert.c

index 17c5370..1b6bce9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2005-05-09  Wim Taymans  <wim@fluendo.com>
 
+       * ext/vorbis/vorbisenc.c: (gst_vorbisenc_sink_setcaps),
+       (gst_vorbisenc_src_query), (gst_vorbisenc_sink_query),
+       (gst_vorbisenc_set_header_on_caps), (gst_vorbisenc_sink_event),
+       (gst_vorbisenc_chain):
+       * gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
+       (gst_audio_convert_caps_remove_format_info),
+       (gst_audio_convert_getcaps), (gst_audio_convert_setcaps),
+       (gst_audio_convert_fixate), (gst_audio_convert_channels):
+       Make caps writable before writing to it.
+       Fix negotiation in audioconvert some more.
+
+2005-05-09  Wim Taymans  <wim@fluendo.com>
+
        * gst/videorate/gstvideorate.c: (gst_videorate_transformcaps),
        (gst_videorate_getcaps), (gst_videorate_setcaps),
        (gst_videorate_event), (gst_videorate_chain):
index 980cf11..3a0aee2 100644 (file)
@@ -241,7 +241,7 @@ gst_vorbisenc_sink_setcaps (GstPad * pad, GstCaps * caps)
   VorbisEnc *vorbisenc;
   GstStructure *structure;
 
-  vorbisenc = GST_VORBISENC (gst_pad_get_parent (pad));
+  vorbisenc = GST_VORBISENC (GST_PAD_PARENT (pad));
   vorbisenc->setup = FALSE;
 
   structure = gst_caps_get_structure (caps, 0);
@@ -783,14 +783,17 @@ gst_vorbisenc_push_packet (VorbisEnc * vorbisenc, ogg_packet * packet)
   gst_vorbisenc_push_buffer (vorbisenc, outbuf);
 }
 
-static void
+static GstCaps *
 gst_vorbisenc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
     GstBuffer * buf2, GstBuffer * buf3)
 {
-  GstStructure *structure = gst_caps_get_structure (caps, 0);
+  GstStructure *structure;
   GValue list = { 0 };
   GValue value = { 0 };
 
+  caps = gst_caps_make_writable (caps);
+  structure = gst_caps_get_structure (caps, 0);
+
   /* mark buffers */
   GST_BUFFER_FLAG_SET (buf1, GST_BUFFER_IN_CAPS);
   GST_BUFFER_FLAG_SET (buf2, GST_BUFFER_IN_CAPS);
@@ -812,6 +815,8 @@ gst_vorbisenc_set_header_on_caps (GstCaps * caps, GstBuffer * buf1,
   gst_structure_set_value (structure, "streamheader", &list);
   g_value_unset (&value);
   g_value_unset (&list);
+
+  return caps;
 }
 
 static gboolean
@@ -895,7 +900,7 @@ gst_vorbisenc_chain (GstPad * pad, GstBuffer * buffer)
 
       /* mark and put on caps */
       caps = gst_pad_get_caps (vorbisenc->srcpad);
-      gst_vorbisenc_set_header_on_caps (caps, buf1, buf2, buf3);
+      caps = gst_vorbisenc_set_header_on_caps (caps, buf1, buf2, buf3);
 
       /* negotiate with these caps */
       GST_DEBUG ("here are the caps: %" GST_PTR_FORMAT, caps);
index d9f7427..534555f 100644 (file)
@@ -438,17 +438,19 @@ gst_audio_convert_setcaps (GstPad * pad, GstCaps * caps)
 
       gst_caps_unref (othercaps);
 
-      /* set the rate on the caps */
+      /* set the rate on the caps, this has to work */
       gst_structure_set (structure, "rate", G_TYPE_INT, ac_caps.rate, NULL);
       gst_structure_set (structure, "channels", G_TYPE_INT, ac_caps.channels,
           NULL);
+
       if (strcmp (gst_structure_get_name (structure), "audio/x-raw-float") == 0) {
         if (!ac_caps.is_int) {
+          /* copy over */
           gst_structure_set (structure, "buffer-frames", G_TYPE_INT,
               ac_caps.buffer_frames, NULL);
         } else {
-          gst_structure_set (structure, "buffer-frames", GST_TYPE_INT_RANGE, 0,
-              G_MAXINT, NULL);
+          /* set to anything */
+          gst_structure_set (structure, "buffer-frames", G_TYPE_INT, 0, NULL);
         }
       }