}
}
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (avimux->srcpad));
+ caps = gst_pad_get_pad_template_caps (avimux->srcpad);
gst_pad_set_caps (avimux->srcpad, caps);
gst_caps_unref (caps);
pad = self->sinkpad;
if (gst_pad_has_current_caps (pad)) {
ret = gst_pad_get_current_caps (pad);
- gst_caps_replace (&ret, gst_caps_copy (ret));
- gst_caps_unref (ret);
goto done;
}
gst_structure_get_int (structure, "channels", &alawenc->channels);
gst_structure_get_int (structure, "rate", &alawenc->rate);
- base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (alawenc->srcpad));
+ base_caps = gst_pad_get_pad_template_caps (alawenc->srcpad);
+ base_caps = gst_caps_make_writable (base_caps);
structure = gst_caps_get_structure (base_caps, 0);
gst_structure_set (structure, "rate", G_TYPE_INT, alawenc->rate, NULL);
gst_structure_set (structure, "channels", G_TYPE_INT, alawenc->channels,
gst_structure_get_int (structure, "channels", &mulawenc->channels);
gst_structure_get_int (structure, "rate", &mulawenc->rate);
- base_caps = gst_caps_copy (gst_pad_get_pad_template_caps (mulawenc->srcpad));
+ base_caps = gst_pad_get_pad_template_caps (mulawenc->srcpad);
+ base_caps = gst_caps_make_writable (base_caps);
structure = gst_caps_get_structure (base_caps, 0);
gst_structure_set (structure, "rate", G_TYPE_INT, mulawenc->rate, NULL);
size = gst_buffer_get_size (*buf);
if (size > 2 && data[0] == 0xff && (data[1] >> 4 == 0x0f)) {
- GstCaps *new_caps;
GstStructure *s;
/* tss, ADTS data, remove codec_data
* still assume it is at least parsed */
- new_caps = gst_caps_copy (stream->caps);
- s = gst_caps_get_structure (new_caps, 0);
+ stream->caps = gst_caps_make_writable (stream->caps);
+ s = gst_caps_get_structure (stream->caps, 0);
g_assert (s);
gst_structure_remove_field (s, "codec_data");
- gst_caps_replace (&stream->caps, new_caps);
- gst_pad_set_caps (stream->pad, new_caps);
+ gst_pad_set_caps (stream->pad, stream->caps);
GST_DEBUG_OBJECT (element, "ADTS AAC audio data; removing codec-data, "
- "new caps: %" GST_PTR_FORMAT, new_caps);
- gst_caps_unref (new_caps);
+ "new caps: %" GST_PTR_FORMAT, stream->caps);
}
/* disable subsequent checking */
if (!gst_pad_has_current_caps (asteriskh263->srcpad)) {
GstCaps *caps;
- caps = gst_caps_copy
- (gst_pad_get_pad_template_caps (asteriskh263->srcpad));
+ caps = gst_pad_get_pad_template_caps (asteriskh263->srcpad);
gst_pad_set_caps (asteriskh263->srcpad, caps);
gst_caps_unref (caps);
}
GstCaps *otherpadcaps;
GstCaps *caps;
- otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
+ otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
GstStructure *structure;
gint rate;
structure = gst_caps_get_structure (otherpadcaps, 0);
+ caps = gst_caps_make_writable (caps);
if (gst_structure_get_int (structure, "channels", &channels)) {
gst_caps_set_simple (caps, "channels", G_TYPE_INT, channels, NULL);
GstCaps *otherpadcaps;
GstCaps *caps;
- otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
+ otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
GstStructure *structure;
mode = -1;
if (mode == 16 || mode == 32) {
+ caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_set (structure, "mode", G_TYPE_INT, mode, NULL);
}
GstCaps *caps;
const gchar *params;
- otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
+ otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
- GstStructure *ps = gst_caps_get_structure (otherpadcaps, 0);
- GstStructure *s = gst_caps_get_structure (caps, 0);
+ GstStructure *ps;
+ GstStructure *s;
gint clock_rate = 0, frame_size = 0, channels = 1;
+ caps = gst_caps_make_writable (caps);
+
+ ps = gst_caps_get_structure (otherpadcaps, 0);
+ s = gst_caps_get_structure (caps, 0);
+
if (gst_structure_get_int (ps, "clock-rate", &clock_rate)) {
gst_structure_fixate_field_nearest_int (s, "rate", clock_rate);
}
GstCaps *caps;
otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
+ caps = gst_caps_make_writable (caps);
gst_caps_set_simple (caps, "channels", G_TYPE_INT, 1, NULL);
gst_caps_set_simple (caps, "rate", G_TYPE_INT, 16000, NULL);
}
GstCaps * filter)
{
GstRtpH263PPay *rtph263ppay;
- GstCaps *caps = NULL;
+ GstCaps *caps = NULL, *templ;
GstCaps *peercaps = NULL;
GstCaps *intersect = NULL;
guint i;
gst_pad_peer_query_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload), filter);
if (!peercaps)
return
- gst_caps_copy (gst_pad_get_pad_template_caps
- (GST_RTP_BASE_PAYLOAD_SINKPAD (payload)));
+ gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SINKPAD (payload));
- intersect = gst_caps_intersect (peercaps,
- gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload)));
+ templ = gst_pad_get_pad_template_caps (GST_RTP_BASE_PAYLOAD_SRCPAD (payload));
+ intersect = gst_caps_intersect (peercaps, templ);
gst_caps_unref (peercaps);
+ gst_caps_unref (templ);
if (gst_caps_is_empty (intersect))
return intersect;
GstCaps *caps;
otherpadcaps = gst_pad_get_allowed_caps (rtppayload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
if (mode_str) {
mode = strtol (mode_str, NULL, 10);
if (mode == 20 || mode == 30) {
+ caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0);
gst_structure_set (structure, "mode", G_TYPE_INT, mode, NULL);
}
GstCaps *caps;
otherpadcaps = gst_pad_get_allowed_caps (payload->srcpad);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ caps = gst_pad_get_pad_template_caps (pad);
if (otherpadcaps) {
if (!gst_caps_is_empty (otherpadcaps)) {
- GstStructure *ps = gst_caps_get_structure (otherpadcaps, 0);
- GstStructure *s = gst_caps_get_structure (caps, 0);
+ GstStructure *ps;
+ GstStructure *s;
gint clock_rate;
+ ps = gst_caps_get_structure (otherpadcaps, 0);
+ caps = gst_caps_make_writable (caps);
+ s = gst_caps_get_structure (caps, 0);
+
if (gst_structure_get_int (ps, "clock-rate", &clock_rate)) {
gst_structure_fixate_field_nearest_int (s, "rate", clock_rate);
}
gst_shape_wipe_video_sink_getcaps (GstPad * pad, GstCaps * filter)
{
GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
- GstCaps *ret, *tmp;
+ GstCaps *templ, *ret, *tmp;
if (gst_pad_has_current_caps (pad))
return gst_pad_get_current_caps (pad);
+ templ = gst_pad_get_pad_template_caps (pad);
tmp = gst_pad_peer_query_caps (self->srcpad, NULL);
if (tmp) {
- ret = gst_caps_intersect (tmp, gst_pad_get_pad_template_caps (pad));
+ ret = gst_caps_intersect (tmp, templ);
+ gst_caps_unref (templ);
gst_caps_unref (tmp);
} else {
- ret = gst_caps_copy (gst_pad_get_pad_template_caps (pad));
+ ret = templ;
}
GST_LOG_OBJECT (pad, "srcpad accepted caps: %" GST_PTR_FORMAT, ret);
if (self->vinfo.height && self->vinfo.width) {
guint i, n;
+ ret = gst_caps_make_writable (ret);
n = gst_caps_get_size (ret);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (ret, i);
GstCaps *intersection, *tmp2;
guint i, n;
- tmp = gst_caps_make_writable (tmp);
-
- tmp2 = gst_caps_copy (gst_pad_get_pad_template_caps (self->mask_sinkpad));
-
+ tmp2 = gst_pad_get_pad_template_caps (self->mask_sinkpad);
intersection = gst_caps_intersect (tmp, tmp2);
gst_caps_unref (tmp);
gst_caps_unref (tmp2);
tmp = intersection;
+ tmp = gst_caps_make_writable (tmp);
n = gst_caps_get_size (tmp);
for (i = 0; i < n; i++) {
gst_pad_get_pad_template_caps (self->video_sinkpad));
gst_caps_unref (tmp);
} else {
- ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad));
+ ret = gst_pad_get_pad_template_caps (self->video_sinkpad);
}
GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret);
gst_shape_wipe_src_getcaps (GstPad * pad, GstCaps * filter)
{
GstShapeWipe *self = GST_SHAPE_WIPE (gst_pad_get_parent (pad));
- GstCaps *ret, *tmp;
+ GstCaps *templ, *ret, *tmp;
if (gst_pad_has_current_caps (pad))
return gst_pad_get_current_caps (pad);
else if (gst_pad_has_current_caps (self->video_sinkpad))
return gst_pad_get_current_caps (self->video_sinkpad);
+ templ = gst_pad_get_pad_template_caps (self->video_sinkpad);
tmp = gst_pad_peer_query_caps (self->video_sinkpad, NULL);
if (tmp) {
- ret =
- gst_caps_intersect (tmp,
- gst_pad_get_pad_template_caps (self->video_sinkpad));
+ ret = gst_caps_intersect (tmp, templ);
+ gst_caps_unref (templ);
gst_caps_unref (tmp);
} else {
- ret = gst_caps_copy (gst_pad_get_pad_template_caps (self->video_sinkpad));
+ ret = templ;
}
GST_LOG_OBJECT (pad, "video sink accepted caps: %" GST_PTR_FORMAT, ret);
if (self->vinfo.height && self->vinfo.width) {
guint i, n;
+ ret = gst_caps_make_writable (ret);
n = gst_caps_get_size (ret);
for (i = 0; i < n; i++) {
GstStructure *s = gst_caps_get_structure (ret, i);
GstCaps *intersection, *tmp2;
guint i, n;
- tmp = gst_caps_make_writable (tmp);
- tmp2 = gst_caps_copy (gst_pad_get_pad_template_caps (self->mask_sinkpad));
-
+ tmp2 = gst_pad_get_pad_template_caps (self->mask_sinkpad);
intersection = gst_caps_intersect (tmp, tmp2);
gst_caps_unref (tmp);
gst_caps_unref (tmp2);
- tmp = intersection;
+ tmp = gst_caps_make_writable (intersection);
n = gst_caps_get_size (tmp);
for (i = 0; i < n; i++) {
GstSegment segment;
caps =
- gst_caps_copy (gst_static_caps_get
+ gst_caps_make_writable (gst_static_caps_get
(&gst_smpte_src_template.static_caps));
gst_caps_set_simple (caps, "width", G_TYPE_INT, smpte->width, "height",
G_TYPE_INT, smpte->height, "framerate", GST_TYPE_FRACTION,
smpte->fps_num, smpte->fps_denom, NULL);
gst_pad_set_caps (smpte->srcpad, caps);
+ gst_caps_unref (caps);
gst_segment_init (&segment, GST_FORMAT_TIME);
gst_pad_push_event (smpte->srcpad, gst_event_new_segment (&segment));
osssink = GST_OSSSINK (bsink);
if (osssink->fd == -1) {
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD
- (bsink)));
+ caps = gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (bsink));
} else if (osssink->probed_caps) {
- caps = gst_caps_copy (osssink->probed_caps);
+ caps = gst_caps_ref (osssink->probed_caps);
} else {
caps = gst_oss_helper_probe_caps (osssink->fd);
if (caps && !gst_caps_is_empty (caps)) {
- osssink->probed_caps = gst_caps_copy (caps);
+ osssink->probed_caps = gst_caps_ref (caps);
}
}
if (!GST_V4L2_IS_OPEN (v4l2sink->v4l2object)) {
/* FIXME: copy? */
GST_DEBUG_OBJECT (v4l2sink, "device is not open");
- return
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD
- (v4l2sink)));
+ return gst_pad_get_pad_template_caps (GST_BASE_SINK_PAD (v4l2sink));
}
if (v4l2sink->probed_caps == NULL) {
obj = v4l2src->v4l2object;
if (!GST_V4L2_IS_OPEN (obj)) {
- /* FIXME: copy? */
- return
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD
- (v4l2src)));
+ return gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (v4l2src));
}
if (v4l2src->probed_caps)
GstVideoFormat format;
if ((!s->xcontext) && (!gst_ximage_src_open_display (s, s->display_name)))
- return
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC
- (s)->srcpad));
+ return gst_pad_get_pad_template_caps (GST_BASE_SRC (s)->srcpad);
if (!gst_ximage_src_recalc (s))
- return
- gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC
- (s)->srcpad));
+ return gst_pad_get_pad_template_caps (GST_BASE_SRC (s)->srcpad);
xcontext = s->xcontext;
width = s->xcontext->width;
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
+ caps = gst_pad_get_pad_template_caps (mysrcpad);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
fail_unless (gst_pad_push_event (mysrcpad, gst_event_new_segment (&segment)));
inbuffer = gst_buffer_new_and_alloc (1);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
+ caps = gst_pad_get_pad_template_caps (mysrcpad);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
inbuffer = gst_buffer_new_and_alloc (1);
fail_unless (inbuffer != NULL);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
+ caps = gst_pad_get_pad_template_caps (mysrcpad);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = 0;
for (i = 0; i < 3; i++) {
inbuffer = gst_buffer_new_and_alloc (bytes[i]);
- caps = gst_caps_copy (gst_pad_get_pad_template_caps (mysrcpad));
+ caps = gst_pad_get_pad_template_caps (mysrcpad);
gst_pad_set_caps (mysrcpad, caps);
gst_caps_unref (caps);
GST_BUFFER_TIMESTAMP (inbuffer) = total_duration;