diff options
author | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-03-11 15:38:19 +0000 |
---|---|---|
committer | Tim-Philipp Müller <tim.muller@collabora.co.uk> | 2010-03-11 15:38:19 +0000 |
commit | df2c773e7da8faa78d2e6edd41e1ee6b7a4e5a95 (patch) | |
tree | f3f60af8337ac73773d764db4b5d99736eedb591 | |
parent | 954064a8d61d0fca26542d4caab7cdb9a3a5f79e (diff) |
tests: fix metadata not writable warnings with apev2mux and id3v2mux tests
-rw-r--r-- | tests/check/elements/apev2mux.c | 13 | ||||
-rw-r--r-- | tests/check/elements/id3v2mux.c | 12 |
2 files changed, 13 insertions, 12 deletions
diff --git a/tests/check/elements/apev2mux.c b/tests/check/elements/apev2mux.c index 47e2c631f..fbbfb0dd3 100644 --- a/tests/check/elements/apev2mux.c +++ b/tests/check/elements/apev2mux.c @@ -175,18 +175,18 @@ static void fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad, guint64 * p_offset) { - GstCaps *caps; - fail_unless (GST_BUFFER_SIZE (buf) == MP3_FRAME_SIZE); GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT, *p_offset); memcpy (GST_BUFFER_DATA (buf), mp3_dummyhdr, sizeof (mp3_dummyhdr)); - caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, - "layer", G_TYPE_INT, 3, NULL); - gst_buffer_set_caps (buf, caps); - gst_caps_unref (caps); + + /* can't use gst_buffer_set_caps() here because the metadata isn't writable + * because of the extra refcounts taken by the signal emission mechanism; + * we know it's fine to use GST_BUFFER_CAPS() here though */ + GST_BUFFER_CAPS (buf) = gst_caps_new_simple ("audio/mpeg", "mpegversion", + G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); GST_BUFFER_OFFSET (buf) = *p_offset; *p_offset += GST_BUFFER_SIZE (buf); @@ -223,6 +223,7 @@ got_buffer (GstElement * fakesink, GstBuffer * buf, GstPad * pad, memcpy (GST_BUFFER_DATA (*p_buf) + off, GST_BUFFER_DATA (buf), size); } } + static void demux_pad_added (GstElement * apedemux, GstPad * srcpad, GstBuffer ** p_outbuf) { diff --git a/tests/check/elements/id3v2mux.c b/tests/check/elements/id3v2mux.c index fa9e5541c..4afc0178a 100644 --- a/tests/check/elements/id3v2mux.c +++ b/tests/check/elements/id3v2mux.c @@ -248,18 +248,18 @@ static void fill_mp3_buffer (GstElement * fakesrc, GstBuffer * buf, GstPad * pad, guint64 * p_offset) { - GstCaps *caps; - fail_unless (GST_BUFFER_SIZE (buf) == MP3_FRAME_SIZE); GST_LOG ("filling buffer with fake mp3 data, offset = %" G_GUINT64_FORMAT, *p_offset); memcpy (GST_BUFFER_DATA (buf), mp3_dummyhdr, sizeof (mp3_dummyhdr)); - caps = gst_caps_new_simple ("audio/mpeg", "mpegversion", G_TYPE_INT, 1, - "layer", G_TYPE_INT, 3, NULL); - gst_buffer_set_caps (buf, caps); - gst_caps_unref (caps); + + /* can't use gst_buffer_set_caps() here because the metadata isn't writable + * because of the extra refcounts taken by the signal emission mechanism; + * we know it's fine to use GST_BUFFER_CAPS() here though */ + GST_BUFFER_CAPS (buf) = gst_caps_new_simple ("audio/mpeg", "mpegversion", + G_TYPE_INT, 1, "layer", G_TYPE_INT, 3, NULL); GST_BUFFER_OFFSET (buf) = *p_offset; *p_offset += GST_BUFFER_SIZE (buf); |