fix for caps api changes

This commit is contained in:
Wim Taymans 2012-03-11 19:06:59 +01:00
parent 857a9564f1
commit 77299ba6ae
12 changed files with 41 additions and 34 deletions

View file

@ -430,27 +430,29 @@ gst_ass_render_getcaps (GstPad * pad, GstCaps * filter)
GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad)); GstAssRender *render = GST_ASS_RENDER (gst_pad_get_parent (pad));
GstPad *otherpad; GstPad *otherpad;
GstCaps *caps; GstCaps *caps;
GstCaps *templ;
if (pad == render->srcpad) if (pad == render->srcpad)
otherpad = render->video_sinkpad; otherpad = render->video_sinkpad;
else else
otherpad = render->srcpad; otherpad = render->srcpad;
templ = gst_pad_get_pad_template_caps (otherpad);
/* we can do what the peer can */ /* we can do what the peer can */
caps = gst_pad_peer_query_caps (otherpad, filter); caps = gst_pad_peer_query_caps (otherpad, filter);
if (caps) { if (caps) {
GstCaps *temp; GstCaps *temp;
const GstCaps *templ;
/* filtered against our padtemplate */ /* filtered against our padtemplate */
templ = gst_pad_get_pad_template_caps (otherpad);
temp = gst_caps_intersect (caps, templ); temp = gst_caps_intersect (caps, templ);
gst_caps_unref (caps); gst_caps_unref (caps);
gst_caps_unref (templ);
/* this is what we can do */ /* this is what we can do */
caps = temp; caps = temp;
} else { } else {
/* no peer, our padtemplate is enough then */ /* no peer, our padtemplate is enough then */
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); caps = templ;
} }
gst_object_unref (render); gst_object_unref (render);

View file

@ -474,7 +474,7 @@ gst_modplug_load_song (GstModPlug * modplug)
GST_DEBUG_OBJECT (modplug, "normalized caps %"GST_PTR_FORMAT, newcaps); GST_DEBUG_OBJECT (modplug, "normalized caps %"GST_PTR_FORMAT, newcaps);
gst_caps_fixate (newcaps); newcaps = gst_caps_fixate (newcaps);
GST_DEBUG_OBJECT (modplug, "fixated caps %"GST_PTR_FORMAT, newcaps); GST_DEBUG_OBJECT (modplug, "fixated caps %"GST_PTR_FORMAT, newcaps);

View file

@ -384,7 +384,7 @@ static GstCaps *
gst_base_video_encoder_sink_getcaps (GstPad * pad, GstCaps * filter) gst_base_video_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstBaseVideoEncoder *base_video_encoder; GstBaseVideoEncoder *base_video_encoder;
const GstCaps *templ_caps; GstCaps *templ_caps;
GstCaps *allowed; GstCaps *allowed;
GstCaps *fcaps, *filter_caps; GstCaps *fcaps, *filter_caps;
gint i, j; gint i, j;
@ -403,7 +403,7 @@ gst_base_video_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD gst_pad_get_allowed_caps (GST_BASE_VIDEO_CODEC_SRC_PAD
(base_video_encoder)); (base_video_encoder));
if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) { if (!allowed || gst_caps_is_empty (allowed) || gst_caps_is_any (allowed)) {
fcaps = gst_caps_copy (templ_caps); fcaps = templ_caps;
goto done; goto done;
} }
@ -432,7 +432,7 @@ gst_base_video_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
if ((val = gst_structure_get_value (allowed_s, "pixel-aspect-ratio"))) if ((val = gst_structure_get_value (allowed_s, "pixel-aspect-ratio")))
gst_structure_set_value (s, "pixel-aspect-ratio", val); gst_structure_set_value (s, "pixel-aspect-ratio", val);
gst_caps_merge_structure (filter_caps, s); filter_caps = gst_caps_merge_structure (filter_caps, s);
} }
} }
@ -440,6 +440,7 @@ gst_base_video_encoder_sink_getcaps (GstPad * pad, GstCaps * filter)
filter_caps); filter_caps);
fcaps = gst_caps_intersect (filter_caps, templ_caps); fcaps = gst_caps_intersect (filter_caps, templ_caps);
gst_caps_unref (templ_caps);
gst_caps_unref (filter_caps); gst_caps_unref (filter_caps);
if (filter) { if (filter) {

View file

@ -685,11 +685,12 @@ gst_base_audio_visualizer_src_negotiate (GstBaseAudioVisualizer * scope)
if (gst_caps_is_empty (target)) if (gst_caps_is_empty (target))
goto no_format; goto no_format;
gst_caps_truncate (target); target = gst_caps_truncate (target);
} else { } else {
target = gst_caps_ref ((GstCaps *) templ); target = templ;
} }
target = gst_caps_make_writable (target);
structure = gst_caps_get_structure (target, 0); structure = gst_caps_get_structure (target, 0);
gst_structure_fixate_field_nearest_int (structure, "width", scope->width); gst_structure_fixate_field_nearest_int (structure, "width", scope->width);
gst_structure_fixate_field_nearest_int (structure, "height", scope->height); gst_structure_fixate_field_nearest_int (structure, "height", scope->height);

View file

@ -1147,7 +1147,7 @@ gst_auto_convert_getcaps (GstAutoConvert * autoconvert, GstCaps * filter,
if (element_caps) { if (element_caps) {
if (!gst_caps_is_any (element_caps) && if (!gst_caps_is_any (element_caps) &&
!gst_caps_is_empty (element_caps)) { !gst_caps_is_empty (element_caps)) {
gst_caps_merge (caps, element_caps); caps = gst_caps_merge (caps, element_caps);
} else { } else {
gst_caps_unref (element_caps); gst_caps_unref (element_caps);
} }
@ -1166,7 +1166,7 @@ gst_auto_convert_getcaps (GstAutoConvert * autoconvert, GstCaps * filter,
if (static_caps && !gst_caps_is_any (static_caps) && if (static_caps && !gst_caps_is_any (static_caps) &&
!gst_caps_is_empty (static_caps)) { !gst_caps_is_empty (static_caps)) {
gst_caps_merge (caps, static_caps); caps = gst_caps_merge (caps, static_caps);
} }
} }
} }

View file

@ -852,14 +852,16 @@ gst_dtmf_src_negotiate (GstBaseSrc * basesrc)
caps = gst_pad_get_allowed_caps (GST_BASE_SRC_PAD (basesrc)); caps = gst_pad_get_allowed_caps (GST_BASE_SRC_PAD (basesrc));
if (!caps) if (!caps)
caps = caps = gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD (basesrc));
gst_caps_copy (gst_pad_get_pad_template_caps (GST_BASE_SRC_PAD
(basesrc)));
if (gst_caps_is_empty (caps)) if (gst_caps_is_empty (caps)) {
gst_caps_unref (caps);
return FALSE; return FALSE;
}
gst_caps_truncate (caps); caps = gst_caps_truncate (caps);
caps = gst_caps_make_writable (caps);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (s, "rate", DEFAULT_SAMPLE_RATE); gst_structure_fixate_field_nearest_int (s, "rate", DEFAULT_SAMPLE_RATE);

View file

@ -904,7 +904,8 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
} }
/* now fixate, start by taking the first caps */ /* now fixate, start by taking the first caps */
gst_caps_truncate (temp); temp = gst_caps_truncate (temp);
temp = gst_caps_make_writable (temp);
srccaps = temp; srccaps = temp;
/* get first structure */ /* get first structure */

View file

@ -401,28 +401,29 @@ gst_dvbsub_overlay_getcaps (GstPad * pad, GstCaps * filter)
{ {
GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad)); GstDVBSubOverlay *render = GST_DVBSUB_OVERLAY (gst_pad_get_parent (pad));
GstPad *otherpad; GstPad *otherpad;
GstCaps *caps; GstCaps *caps, *templ;
if (pad == render->srcpad) if (pad == render->srcpad)
otherpad = render->video_sinkpad; otherpad = render->video_sinkpad;
else else
otherpad = render->srcpad; otherpad = render->srcpad;
templ = gst_pad_get_pad_template_caps (otherpad);
/* we can do what the peer can */ /* we can do what the peer can */
caps = gst_pad_peer_query_caps (otherpad, filter); caps = gst_pad_peer_query_caps (otherpad, filter);
if (caps) { if (caps) {
GstCaps *temp; GstCaps *temp;
const GstCaps *templ;
/* filtered against our padtemplate */ /* filtered against our padtemplate */
templ = gst_pad_get_pad_template_caps (otherpad);
temp = gst_caps_intersect (caps, templ); temp = gst_caps_intersect (caps, templ);
gst_caps_unref (templ);
gst_caps_unref (caps); gst_caps_unref (caps);
/* this is what we can do */ /* this is what we can do */
caps = temp; caps = temp;
} else { } else {
/* no peer, our padtemplate is enough then */ /* no peer, our padtemplate is enough then */
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); caps = templ;
} }
gst_object_unref (render); gst_object_unref (render);

View file

@ -363,15 +363,15 @@ gst_dvd_spu_video_proxy_getcaps (GstPad * pad, GstCaps * filter)
caps = gst_pad_peer_query_caps (otherpad, filter); caps = gst_pad_peer_query_caps (otherpad, filter);
if (caps) { if (caps) {
GstCaps *temp; GstCaps *temp, *templ;
const GstCaps *templ;
templ = gst_pad_get_pad_template_caps (otherpad); templ = gst_pad_get_pad_template_caps (otherpad);
temp = gst_caps_intersect (caps, templ); temp = gst_caps_intersect (caps, templ);
gst_caps_unref (templ);
gst_caps_unref (caps); gst_caps_unref (caps);
caps = temp; caps = temp;
} else { } else {
caps = gst_caps_copy (gst_pad_get_pad_template_caps (pad)); caps = gst_pad_get_pad_template_caps (pad);
} }
gst_object_unref (dvdspu); gst_object_unref (dvdspu);

View file

@ -591,15 +591,14 @@ same_clock_rate_fold (const GValue * item, GValue * ret, gpointer user_data)
GstPad *mypad = user_data; GstPad *mypad = user_data;
GstPad *pad = g_value_get_object (item); GstPad *pad = g_value_get_object (item);
GstCaps *peercaps; GstCaps *peercaps;
const GstCaps *accumcaps; GstCaps *accumcaps;
GstCaps *intersect; GstCaps *intersect;
if (pad == mypad) { if (pad == mypad)
return TRUE; return TRUE;
}
accumcaps = gst_value_get_caps (ret); accumcaps = g_value_get_boxed (ret);
peercaps = gst_pad_peer_query_caps (pad, (GstCaps *) accumcaps); peercaps = gst_pad_peer_query_caps (pad, accumcaps);
if (!peercaps) { if (!peercaps) {
g_warning ("no peercaps"); g_warning ("no peercaps");
return TRUE; return TRUE;

View file

@ -328,8 +328,7 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, gint in_format,
/* concentrate on leading structure, since decodebin2 parser /* concentrate on leading structure, since decodebin2 parser
* capsfilter always includes parser template caps */ * capsfilter always includes parser template caps */
if (caps) { if (caps) {
caps = gst_caps_make_writable (caps); caps = gst_caps_truncate (caps);
gst_caps_truncate (caps);
GST_DEBUG_OBJECT (h264parse, "negotiating with caps: %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (h264parse, "negotiating with caps: %" GST_PTR_FORMAT,
caps); caps);
} }
@ -345,7 +344,7 @@ gst_h264_parse_negotiate (GstH264Parse * h264parse, gint in_format,
if (caps) { if (caps) {
/* fixate to avoid ambiguity with lists when parsing */ /* fixate to avoid ambiguity with lists when parsing */
gst_caps_fixate (caps); caps = gst_caps_fixate (caps);
gst_h264_parse_format_from_caps (caps, &format, &align); gst_h264_parse_format_from_caps (caps, &format, &align);
gst_caps_unref (caps); gst_caps_unref (caps);
} }

View file

@ -58,7 +58,7 @@ colorspace_compare (gint width, gint height, gboolean comp)
GstElement *pipeline, *src, *filter1, *filter2, *csp, *fcsp, *fakesink; GstElement *pipeline, *src, *filter1, *filter2, *csp, *fcsp, *fakesink;
GstElement *queue1, *queue2, *tee, *compare; GstElement *queue1, *queue2, *tee, *compare;
GstCaps *caps, *tcaps, *rcaps, *fcaps; GstCaps *caps, *tcaps, *rcaps, *fcaps;
const GstCaps *ccaps; GstCaps *ccaps;
GstPad *pad; GstPad *pad;
gint i, j; gint i, j;
@ -122,7 +122,7 @@ colorspace_compare (gint width, gint height, gboolean comp)
fail_unless (pad != NULL); fail_unless (pad != NULL);
ccaps = gst_pad_get_pad_template_caps (pad); ccaps = gst_pad_get_pad_template_caps (pad);
fail_unless (ccaps != NULL); fail_unless (ccaps != NULL);
fcaps = gst_caps_copy (ccaps); fcaps = ccaps;
gst_object_unref (pad); gst_object_unref (pad);
} else { } else {
fcaps = gst_caps_new_any (); fcaps = gst_caps_new_any ();
@ -163,6 +163,7 @@ colorspace_compare (gint width, gint height, gboolean comp)
tcaps = gst_caps_intersect (fcaps, ccaps); tcaps = gst_caps_intersect (fcaps, ccaps);
gst_caps_unref (fcaps); gst_caps_unref (fcaps);
gst_caps_unref (ccaps);
caps = gst_caps_intersect (tcaps, caps); caps = gst_caps_intersect (tcaps, caps);
gst_caps_unref (tcaps); gst_caps_unref (tcaps);
tcaps = caps; tcaps = caps;