) {
caps = gst_pad_get_current_caps (pad);
if (!caps)
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
peer_caps = gst_pad_get_current_caps (peer_pad);
if (!peer_caps)
- peer_caps = gst_caps_copy (gst_pad_get_pad_template_caps (peer_pad));
+ peer_caps = gst_pad_get_pad_template_caps (peer_pad);
media = debug_dump_describe_caps (caps, details);
/* check if peer caps are different */
gboolean
gst_pad_proxy_query_caps (GstPad * pad, GstQuery * query)
{
- GstCaps *intersected;
+ GstCaps *templ, *intersected;
QueryCapsData data;
g_return_val_if_fail (GST_IS_PAD (pad), FALSE);
gst_pad_forward (pad, (GstPadForwardFunction) query_caps_func, &data);
+ templ = gst_pad_get_pad_template_caps (pad);
if (data.ret) {
- intersected =
- gst_caps_intersect (data.ret, gst_pad_get_pad_template_caps (pad));
+ intersected = gst_caps_intersect (data.ret, templ);
gst_caps_unref (data.ret);
} else {
- intersected = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ intersected = templ;
}
gst_query_set_caps_result (query, intersected);
+ gst_caps_unref (templ);
gst_caps_unref (intersected);
return TRUE;
GstBuffer *buffer;
guint avail;
GstMapInfo info;
- const guint8 *data1, *data2;
+ const guint8 *data1, *data2, *idata;
adapter = gst_adapter_new ();
fail_if (adapter == NULL);
buffer = gst_buffer_new_and_alloc (512);
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
+ idata = info.data;
+ gst_buffer_unmap (buffer, &info);
fail_if (buffer == NULL);
gst_adapter_push (adapter, buffer);
data1 = gst_adapter_map (adapter, 512);
fail_if (data1 == NULL);
/* it should point to the buffer data as well */
- fail_if (data1 != info.data);
+ fail_if (data1 != idata);
gst_adapter_unmap (adapter);
data2 = gst_adapter_map (adapter, 512);
fail_if (data2 == NULL);
/* peek should return the same old pointer + 10 */
fail_if (data2 != data1 + 10);
- fail_if (data2 != (guint8 *) info.data + 10);
+ fail_if (data2 != (guint8 *) idata + 10);
gst_adapter_unmap (adapter);
/* flush some more */
data2 = gst_adapter_map (adapter, 2);
fail_if (data2 == NULL);
fail_if (data2 != data1 + 510);
- fail_if (data2 != (guint8 *) info.data + 510);
+ fail_if (data2 != (guint8 *) idata + 510);
gst_adapter_unmap (adapter);
/* flush some more */
fail_unless (gst_buffer_map (buffer, &info, GST_MAP_READ));
fail_unless (info.data != NULL);
fail_unless (info.size == 100);
+ gst_buffer_unmap (buffer, &info);
/* set up and push subbuffers */
buffer2 = gst_buffer_copy_region (buffer, GST_BUFFER_COPY_ALL, 0, 25);
/* the data should be the same */
fail_unless (info.data == info2.data);
+ gst_buffer_unmap (buffer2, &info2);
gst_buffer_unref (buffer2);
g_object_unref (adapter);