fix for caps API changes

This commit is contained in:
Wim Taymans 2012-03-11 19:04:41 +01:00
parent 7296ef7c63
commit 25137962ad
20 changed files with 81 additions and 70 deletions

View file

@ -101,7 +101,7 @@ static const struct
32, 32, SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32} 32, 32, SND_PCM_FORMAT_S32, SND_PCM_FORMAT_U32}
}; };
static void static GstCaps *
add_format (const gchar * str, GstStructure * s, snd_pcm_format_mask_t * mask, add_format (const gchar * str, GstStructure * s, snd_pcm_format_mask_t * mask,
GstCaps * caps) GstCaps * caps)
{ {
@ -112,7 +112,7 @@ add_format (const gchar * str, GstStructure * s, snd_pcm_format_mask_t * mask,
format = gst_audio_format_from_string (str); format = gst_audio_format_from_string (str);
if (format == GST_AUDIO_FORMAT_UNKNOWN) if (format == GST_AUDIO_FORMAT_UNKNOWN)
return; return caps;
finfo = gst_audio_format_get_info (format); finfo = gst_audio_format_get_info (format);
@ -123,7 +123,7 @@ add_format (const gchar * str, GstStructure * s, snd_pcm_format_mask_t * mask,
if (pcmformats[w].width == width && pcmformats[w].depth == depth) if (pcmformats[w].width == width && pcmformats[w].depth == depth)
break; break;
if (w == G_N_ELEMENTS (pcmformats)) if (w == G_N_ELEMENTS (pcmformats))
return; /* Unknown format */ return caps; /* Unknown format */
if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) && if (snd_pcm_format_mask_test (mask, pcmformats[w].sformat) &&
snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) { snd_pcm_format_mask_test (mask, pcmformats[w].uformat)) {
@ -138,8 +138,9 @@ add_format (const gchar * str, GstStructure * s, snd_pcm_format_mask_t * mask,
scopy = NULL; scopy = NULL;
} }
if (scopy) { if (scopy) {
gst_caps_merge_structure (caps, scopy); caps = gst_caps_merge_structure (caps, scopy);
} }
return caps;
} }
@ -179,10 +180,10 @@ gst_alsa_detect_formats (GstObject * obj, snd_pcm_hw_params_t * hw_params,
val = gst_value_list_get_value (format, i); val = gst_value_list_get_value (format, i);
if (G_VALUE_HOLDS_STRING (val)) if (G_VALUE_HOLDS_STRING (val))
add_format (g_value_get_string (val), s, mask, caps); caps = add_format (g_value_get_string (val), s, mask, caps);
} }
} else if (G_VALUE_HOLDS_STRING (format)) { } else if (G_VALUE_HOLDS_STRING (format)) {
add_format (g_value_get_string (format), s, mask, caps); caps = add_format (g_value_get_string (format), s, mask, caps);
} else } else
continue; continue;
} }
@ -211,7 +212,7 @@ get_channel_free_structure (const GstStructure * in_structure)
#define CHANNEL_MASK_5_1 (CHANNEL_MASK_4_0 | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER) | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_LFE1)) #define CHANNEL_MASK_5_1 (CHANNEL_MASK_4_0 | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER) | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_LFE1))
#define CHANNEL_MASK_7_1 (CHANNEL_MASK_5_1 | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT) | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT)) #define CHANNEL_MASK_7_1 (CHANNEL_MASK_5_1 | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT) | (ONE_64<<GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT))
static void static GstCaps *
caps_add_channel_configuration (GstCaps * caps, caps_add_channel_configuration (GstCaps * caps,
const GstStructure * in_structure, gint min_chans, gint max_chans) const GstStructure * in_structure, gint min_chans, gint max_chans)
{ {
@ -221,8 +222,8 @@ caps_add_channel_configuration (GstCaps * caps,
if (min_chans == max_chans && max_chans == 1) { if (min_chans == max_chans && max_chans == 1) {
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL); gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
return; return caps;
} }
g_assert (min_chans >= 1); g_assert (min_chans >= 1);
@ -232,15 +233,15 @@ caps_add_channel_configuration (GstCaps * caps,
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, 2, "channel-mask", gst_structure_set (s, "channels", G_TYPE_INT, 2, "channel-mask",
GST_TYPE_BITMASK, CHANNEL_MASK_STEREO, NULL); GST_TYPE_BITMASK, CHANNEL_MASK_STEREO, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
} else if (min_chans == 1 && max_chans >= 2) { } else if (min_chans == 1 && max_chans >= 2) {
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, 2, "channel-mask", gst_structure_set (s, "channels", G_TYPE_INT, 2, "channel-mask",
GST_TYPE_BITMASK, CHANNEL_MASK_STEREO, NULL); GST_TYPE_BITMASK, CHANNEL_MASK_STEREO, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL); gst_structure_set (s, "channels", G_TYPE_INT, 1, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
} }
/* don't know whether to use 2.1 or 3.0 here - but I suspect /* don't know whether to use 2.1 or 3.0 here - but I suspect
@ -250,7 +251,7 @@ caps_add_channel_configuration (GstCaps * caps,
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, 3, "channel-mask", gst_structure_set (s, "channels", G_TYPE_INT, 3, "channel-mask",
GST_TYPE_BITMASK, CHANNEL_MASK_2_1, NULL); GST_TYPE_BITMASK, CHANNEL_MASK_2_1, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
} }
/* everything else (4, 6, 8 channels) needs a channel layout */ /* everything else (4, 6, 8 channels) needs a channel layout */
@ -275,7 +276,7 @@ caps_add_channel_configuration (GstCaps * caps,
} }
gst_structure_set (s, "channels", G_TYPE_INT, c, "channel-mask", gst_structure_set (s, "channels", G_TYPE_INT, c, "channel-mask",
GST_TYPE_BITMASK, channel_mask, NULL); GST_TYPE_BITMASK, channel_mask, NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
} }
} }
@ -284,8 +285,9 @@ caps_add_channel_configuration (GstCaps * caps,
s = get_channel_free_structure (in_structure); s = get_channel_free_structure (in_structure);
gst_structure_set (s, "channels", G_TYPE_INT, c, "channel-mask", gst_structure_set (s, "channels", G_TYPE_INT, c, "channel-mask",
GST_TYPE_BITMASK, G_GUINT64_CONSTANT (0), NULL); GST_TYPE_BITMASK, G_GUINT64_CONSTANT (0), NULL);
gst_caps_merge_structure (caps, s); caps = gst_caps_merge_structure (caps, s);
} }
return caps;
} }
static GstCaps * static GstCaps *
@ -373,7 +375,7 @@ gst_alsa_detect_channels (GstObject * obj, snd_pcm_hw_params_t * hw_params,
c_max = max_chans; c_max = max_chans;
} }
caps_add_channel_configuration (caps, s, c_min, c_max); caps = caps_add_channel_configuration (caps, s, c_min, c_max);
} }
gst_caps_unref (in_caps); gst_caps_unref (in_caps);

View file

@ -435,15 +435,14 @@ gst_vis_src_negotiate (GstVisual * visual)
if (gst_caps_is_empty (target)) if (gst_caps_is_empty (target))
goto no_format; goto no_format;
target = gst_caps_make_writable (target); target = gst_caps_truncate (target);
gst_caps_truncate (target);
} else { } else {
/* need a copy, we'll be modifying it when fixating */ /* need a copy, we'll be modifying it when fixating */
target = gst_caps_copy (caps); target = gst_caps_ref (caps);
gst_caps_unref (caps);
} }
GST_DEBUG_OBJECT (visual, "before fixate caps %" GST_PTR_FORMAT, target); GST_DEBUG_OBJECT (visual, "before fixate caps %" GST_PTR_FORMAT, target);
target = gst_caps_make_writable (target);
/* fixate in case something is not fixed. This does nothing if the value is /* fixate in case something is not fixed. This does nothing if the value is
* already fixed. For video we always try to fixate to something like * already fixed. For video we always try to fixate to something like
* 320x240x25 by convention. */ * 320x240x25 by convention. */
@ -452,7 +451,7 @@ gst_vis_src_negotiate (GstVisual * visual)
gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT); gst_structure_fixate_field_nearest_int (structure, "height", DEFAULT_HEIGHT);
gst_structure_fixate_field_nearest_fraction (structure, "framerate", gst_structure_fixate_field_nearest_fraction (structure, "framerate",
DEFAULT_FPS_N, DEFAULT_FPS_D); DEFAULT_FPS_N, DEFAULT_FPS_D);
gst_caps_fixate (target); target = gst_caps_fixate (target);
GST_DEBUG_OBJECT (visual, "after fixate caps %" GST_PTR_FORMAT, target); GST_DEBUG_OBJECT (visual, "after fixate caps %" GST_PTR_FORMAT, target);

View file

@ -376,12 +376,14 @@ gst_text_render_src_setcaps (GstTextRender * render, GstCaps * caps)
return ret; return ret;
} }
static void static GstCaps *
gst_text_render_fixate_caps (GstTextRender * render, GstCaps * caps) gst_text_render_fixate_caps (GstTextRender * render, GstCaps * caps)
{ {
GstStructure *s; GstStructure *s;
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_DEBUG ("Fixating caps %" GST_PTR_FORMAT, caps); GST_DEBUG ("Fixating caps %" GST_PTR_FORMAT, caps);
@ -390,6 +392,8 @@ gst_text_render_fixate_caps (GstTextRender * render, GstCaps * caps)
gst_structure_fixate_field_nearest_int (s, "height", gst_structure_fixate_field_nearest_int (s, "height",
MAX (render->image_height + render->ypad, DEFAULT_RENDER_HEIGHT)); MAX (render->image_height + render->ypad, DEFAULT_RENDER_HEIGHT));
GST_DEBUG ("Fixated to %" GST_PTR_FORMAT, caps); GST_DEBUG ("Fixated to %" GST_PTR_FORMAT, caps);
return caps;
} }
#define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \ #define CAIRO_UNPREMULTIPLY(a,r,g,b) G_STMT_START { \
@ -508,7 +512,7 @@ gst_text_render_chain (GstPad * pad, GstObject * parent, GstBuffer * inbuf)
goto done; goto done;
} }
gst_text_render_fixate_caps (render, caps); caps = gst_text_render_fixate_caps (render, caps);
if (!gst_text_render_src_setcaps (render, caps)) { if (!gst_text_render_src_setcaps (render, caps)) {
GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL)); GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));

View file

@ -584,7 +584,7 @@ theora_enc_sink_getcaps (GstPad * pad, GstCaps * filter)
peer = gst_pad_get_peer (encoder->srcpad); peer = gst_pad_get_peer (encoder->srcpad);
if (peer) { if (peer) {
const GstCaps *templ_caps; GstCaps *templ_caps;
GstCaps *peer_caps, *tmp_caps; GstCaps *peer_caps, *tmp_caps;
GstStructure *s; GstStructure *s;
guint i, n; guint i, n;

View file

@ -180,7 +180,8 @@ static void gst_audio_base_sink_get_times (GstBaseSink * bsink,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end); GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_audio_base_sink_setcaps (GstBaseSink * bsink, static gboolean gst_audio_base_sink_setcaps (GstBaseSink * bsink,
GstCaps * caps); GstCaps * caps);
static void gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps); static GstCaps *gst_audio_base_sink_fixate (GstBaseSink * bsink,
GstCaps * caps);
static gboolean gst_audio_base_sink_query_pad (GstBaseSink * bsink, static gboolean gst_audio_base_sink_query_pad (GstBaseSink * bsink,
GstQuery * query); GstQuery * query);
@ -940,12 +941,14 @@ acquire_error:
} }
} }
static void static GstCaps *
gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps) gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
{ {
GstStructure *s; GstStructure *s;
gint width, depth; gint width, depth;
caps = gst_caps_make_writable (caps);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
/* fields for all formats */ /* fields for all formats */
@ -965,7 +968,9 @@ gst_audio_base_sink_fixate (GstBaseSink * bsink, GstCaps * caps)
if (gst_structure_has_field (s, "endianness")) if (gst_structure_has_field (s, "endianness"))
gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER); gst_structure_fixate_field_nearest_int (s, "endianness", G_BYTE_ORDER);
GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps); caps = GST_BASE_SINK_CLASS (parent_class)->fixate (bsink, caps);
return caps;
} }
static void static void

View file

@ -142,7 +142,7 @@ static void gst_audio_base_src_get_times (GstBaseSrc * bsrc,
GstBuffer * buffer, GstClockTime * start, GstClockTime * end); GstBuffer * buffer, GstClockTime * start, GstClockTime * end);
static gboolean gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps); static gboolean gst_audio_base_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
static gboolean gst_audio_base_src_query (GstBaseSrc * bsrc, GstQuery * query); static gboolean gst_audio_base_src_query (GstBaseSrc * bsrc, GstQuery * query);
static void gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps); static GstCaps *gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
/* static guint gst_audio_base_src_signals[LAST_SIGNAL] = { 0 }; */ /* static guint gst_audio_base_src_signals[LAST_SIGNAL] = { 0 }; */
@ -512,11 +512,13 @@ gst_audio_base_src_get_property (GObject * object, guint prop_id,
} }
} }
static void static GstCaps *
gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
{ {
GstStructure *s; GstStructure *s;
caps = gst_caps_make_writable (caps);
s = gst_caps_get_structure (caps, 0); s = gst_caps_get_structure (caps, 0);
/* fields for all formats */ /* fields for all formats */
@ -525,7 +527,9 @@ gst_audio_base_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
GST_AUDIO_DEF_CHANNELS); GST_AUDIO_DEF_CHANNELS);
gst_structure_fixate_field_string (s, "format", GST_AUDIO_DEF_FORMAT); gst_structure_fixate_field_string (s, "format", GST_AUDIO_DEF_FORMAT);
GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps); caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
return caps;
} }
static gboolean static gboolean

View file

@ -1217,7 +1217,7 @@ gst_audio_encoder_proxy_getcaps (GstAudioEncoder * enc, GstCaps * caps)
if ((val = gst_structure_get_value (allowed_s, "channel-mask"))) if ((val = gst_structure_get_value (allowed_s, "channel-mask")))
gst_structure_set_value (s, "channel-mask", val); gst_structure_set_value (s, "channel-mask", val);
gst_caps_merge_structure (filter_caps, s); filter_caps = gst_caps_merge_structure (filter_caps, s);
} }
} }

View file

@ -846,7 +846,7 @@ gst_encoding_profile_get_input_caps (GstEncodingProfile * profile)
for (ltmp = GST_ENCODING_CONTAINER_PROFILE (profile)->encodingprofiles; for (ltmp = GST_ENCODING_CONTAINER_PROFILE (profile)->encodingprofiles;
ltmp; ltmp = ltmp->next) { ltmp; ltmp = ltmp->next) {
GstEncodingProfile *sprof = (GstEncodingProfile *) ltmp->data; GstEncodingProfile *sprof = (GstEncodingProfile *) ltmp->data;
gst_caps_merge (res, gst_encoding_profile_get_input_caps (sprof)); res = gst_caps_merge (res, gst_encoding_profile_get_input_caps (sprof));
} }
return res; return res;
} }

View file

@ -607,7 +607,7 @@ gst_rtp_base_payload_set_outcaps (GstRTPBasePayload * payload,
} }
/* 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);
/* get first structure */ /* get first structure */
s = gst_caps_get_structure (temp, 0); s = gst_caps_get_structure (temp, 0);

View file

@ -609,7 +609,7 @@ gst_audio_convert_fixate_caps (GstBaseTransform * base,
outs = gst_caps_get_structure (result, 0); outs = gst_caps_get_structure (result, 0);
gst_audio_convert_fixate_channels (base, ins, outs); gst_audio_convert_fixate_channels (base, ins, outs);
gst_caps_fixate (result); result = gst_caps_fixate (result);
GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, result); GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, result);

View file

@ -318,10 +318,11 @@ gst_audio_resample_fixate_caps (GstBaseTransform * base,
if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate))) if (G_UNLIKELY (!gst_structure_get_int (s, "rate", &rate)))
return othercaps; return othercaps;
othercaps = gst_caps_truncate (othercaps);
othercaps = gst_caps_make_writable (othercaps); othercaps = gst_caps_make_writable (othercaps);
gst_caps_truncate (othercaps);
s = gst_caps_get_structure (othercaps, 0); s = gst_caps_get_structure (othercaps, 0);
gst_structure_fixate_field_nearest_int (s, "rate", rate); gst_structure_fixate_field_nearest_int (s, "rate", rate);
return othercaps; return othercaps;
} }

View file

@ -141,7 +141,7 @@ static void gst_audio_test_src_get_property (GObject * object,
static gboolean gst_audio_test_src_setcaps (GstBaseSrc * basesrc, static gboolean gst_audio_test_src_setcaps (GstBaseSrc * basesrc,
GstCaps * caps); GstCaps * caps);
static void gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps); static GstCaps *gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps);
static gboolean gst_audio_test_src_is_seekable (GstBaseSrc * basesrc); static gboolean gst_audio_test_src_is_seekable (GstBaseSrc * basesrc);
static gboolean gst_audio_test_src_do_seek (GstBaseSrc * basesrc, static gboolean gst_audio_test_src_do_seek (GstBaseSrc * basesrc,
@ -262,12 +262,14 @@ gst_audio_test_src_finalize (GObject * object)
G_OBJECT_CLASS (parent_class)->finalize (object); G_OBJECT_CLASS (parent_class)->finalize (object);
} }
static void static GstCaps *
gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
{ {
GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (bsrc); GstAudioTestSrc *src = GST_AUDIO_TEST_SRC (bsrc);
GstStructure *structure; GstStructure *structure;
caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
GST_DEBUG_OBJECT (src, "fixating samplerate to %d", GST_AUDIO_DEF_RATE); GST_DEBUG_OBJECT (src, "fixating samplerate to %d", GST_AUDIO_DEF_RATE);
@ -280,7 +282,9 @@ gst_audio_test_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
/* fixate to mono unless downstream requires stereo, for backwards compat */ /* fixate to mono unless downstream requires stereo, for backwards compat */
gst_structure_fixate_field_nearest_int (structure, "channels", 1); gst_structure_fixate_field_nearest_int (structure, "channels", 1);
GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps); caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
return caps;
} }
static gboolean static gboolean

View file

@ -289,7 +289,7 @@ resync:
if (res) { if (res) {
GstCaps *peercaps = gst_pad_peer_query_caps (srcpad, filter); GstCaps *peercaps = gst_pad_peer_query_caps (srcpad, filter);
if (peercaps) if (peercaps)
gst_caps_merge (res, gst_caps_make_writable (peercaps)); res = gst_caps_merge (res, peercaps);
} else { } else {
res = gst_pad_peer_query_caps (srcpad, filter); res = gst_pad_peer_query_caps (srcpad, filter);
} }

View file

@ -1558,13 +1558,13 @@ analyze_new_pad (GstDecodeBin * dbin, GstElement * src, GstPad * pad,
tcaps = gst_static_pad_template_get_caps (st); tcaps = gst_static_pad_template_get_caps (st);
intersection = intersection =
gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST); gst_caps_intersect_full (tcaps, caps, GST_CAPS_INTERSECT_FIRST);
gst_caps_merge (filter_caps, intersection); filter_caps = gst_caps_merge (filter_caps, intersection);
gst_caps_unref (tcaps); gst_caps_unref (tcaps);
} }
} }
/* Append the parser caps to prevent any not-negotiated errors */ /* Append the parser caps to prevent any not-negotiated errors */
gst_caps_merge (filter_caps, gst_caps_copy (caps)); filter_caps = gst_caps_merge (filter_caps, gst_caps_ref (caps));
delem->capsfilter = gst_element_factory_make ("capsfilter", NULL); delem->capsfilter = gst_element_factory_make ("capsfilter", NULL);
g_object_set (G_OBJECT (delem->capsfilter), "caps", filter_caps, NULL); g_object_set (G_OBJECT (delem->capsfilter), "caps", filter_caps, NULL);

View file

@ -403,9 +403,7 @@ gst_play_sink_convert_bin_getcaps (GstPad * pad, GstCaps * filter)
GstCaps *peer_caps = gst_pad_query_caps (peer, filter); GstCaps *peer_caps = gst_pad_query_caps (peer, filter);
gst_object_unref (peer); gst_object_unref (peer);
if (self->converter_caps && is_raw_caps (peer_caps, self->audio)) { if (self->converter_caps && is_raw_caps (peer_caps, self->audio)) {
peer_caps = gst_caps_make_writable (peer_caps); ret = gst_caps_merge (peer_caps, gst_caps_ref (self->converter_caps));
gst_caps_merge (peer_caps, gst_caps_ref (self->converter_caps));
ret = peer_caps;
} else { } else {
ret = peer_caps; ret = peer_caps;
} }

View file

@ -364,13 +364,13 @@ _factory_filter (GstPluginFeature * feature, GstCaps ** subcaps)
GST_DEBUG ("Found renderer element %s (%s) with caps %" GST_PTR_FORMAT, GST_DEBUG ("Found renderer element %s (%s) with caps %" GST_PTR_FORMAT,
gst_element_factory_get_longname (factory), gst_element_factory_get_longname (factory),
gst_plugin_feature_get_name (feature), templ_caps); gst_plugin_feature_get_name (feature), templ_caps);
gst_caps_merge (*subcaps, templ_caps); *subcaps = gst_caps_merge (*subcaps, templ_caps);
return TRUE; return TRUE;
} else if (!is_renderer && !have_video_sink && templ_caps) { } else if (!is_renderer && !have_video_sink && templ_caps) {
GST_DEBUG ("Found parser element %s (%s) with caps %" GST_PTR_FORMAT, GST_DEBUG ("Found parser element %s (%s) with caps %" GST_PTR_FORMAT,
gst_element_factory_get_longname (factory), gst_element_factory_get_longname (factory),
gst_plugin_feature_get_name (feature), templ_caps); gst_plugin_feature_get_name (feature), templ_caps);
gst_caps_merge (*subcaps, templ_caps); *subcaps = gst_caps_merge (*subcaps, templ_caps);
return TRUE; return TRUE;
} else { } else {
if (templ_caps) if (templ_caps)

View file

@ -152,8 +152,7 @@ gst_video_convert_fixate_caps (GstBaseTransform * trans,
} }
/* fixate remaining fields */ /* fixate remaining fields */
result = gst_caps_make_writable (result); result = gst_caps_fixate (result);
gst_caps_fixate (result);
return result; return result;
} }

View file

@ -438,10 +438,10 @@ gst_video_rate_transform_caps (GstBaseTransform * trans,
G_MAXINT, 1, NULL); G_MAXINT, 1, NULL);
} }
if (s1 != NULL) if (s1 != NULL)
gst_caps_merge_structure (ret, s1); ret = gst_caps_merge_structure (ret, s1);
gst_caps_merge_structure (ret, s2); ret = gst_caps_merge_structure (ret, s2);
if (s3 != NULL) if (s3 != NULL)
gst_caps_merge_structure (ret, s3); ret = gst_caps_merge_structure (ret, s3);
} }
if (filter) { if (filter) {
GstCaps *intersection; GstCaps *intersection;
@ -465,8 +465,8 @@ gst_video_rate_fixate_caps (GstBaseTransform * trans,
if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &num, &denom))) if (G_UNLIKELY (!gst_structure_get_fraction (s, "framerate", &num, &denom)))
return othercaps; return othercaps;
othercaps = gst_caps_truncate (othercaps);
othercaps = gst_caps_make_writable (othercaps); othercaps = gst_caps_make_writable (othercaps);
gst_caps_truncate (othercaps);
s = gst_caps_get_structure (othercaps, 0); s = gst_caps_get_structure (othercaps, 0);
gst_structure_fixate_field_nearest_fraction (s, "framerate", num, denom); gst_structure_fixate_field_nearest_fraction (s, "framerate", num, denom);

View file

@ -118,9 +118,8 @@ enum
"v308, Y800, Y16, RGB16, RGB15, ARGB64, AYUV64, NV12 } " "v308, Y800, Y16, RGB16, RGB15, ARGB64, AYUV64, NV12 } "
static GstStaticCaps gst_video_scale_format_caps[] = { static GstStaticCaps gst_video_scale_format_caps =
GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS)) GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS));
};
#define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type()) #define GST_TYPE_VIDEO_SCALE_METHOD (gst_video_scale_method_get_type())
static GType static GType
@ -150,18 +149,9 @@ gst_video_scale_get_capslist (void)
static volatile gsize inited = 0; static volatile gsize inited = 0;
if (g_once_init_enter (&inited)) { if (g_once_init_enter (&inited)) {
gint i; caps = gst_static_caps_get (&gst_video_scale_format_caps);
g_assert (caps == NULL);
caps = gst_caps_new_empty ();
for (i = 0; i < G_N_ELEMENTS (gst_video_scale_format_caps); i++)
gst_caps_append (caps,
gst_caps_make_writable
(gst_static_caps_get (&gst_video_scale_format_caps[i])));
g_once_init_leave (&inited, 1); g_once_init_leave (&inited, 1);
} }
return caps; return caps;
} }
@ -570,8 +560,8 @@ gst_video_scale_fixate_caps (GstBaseTransform * base, GstPadDirection direction,
GValue fpar = { 0, }, tpar = { GValue fpar = { 0, }, tpar = {
0,}; 0,};
othercaps = gst_caps_truncate (othercaps);
othercaps = gst_caps_make_writable (othercaps); othercaps = gst_caps_make_writable (othercaps);
gst_caps_truncate (othercaps);
GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
" based on caps %" GST_PTR_FORMAT, othercaps, caps); " based on caps %" GST_PTR_FORMAT, othercaps, caps);

View file

@ -92,7 +92,8 @@ static void gst_video_test_src_get_property (GObject * object, guint prop_id,
static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc, static GstCaps *gst_video_test_src_getcaps (GstBaseSrc * bsrc,
GstCaps * filter); GstCaps * filter);
static gboolean gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps); static gboolean gst_video_test_src_setcaps (GstBaseSrc * bsrc, GstCaps * caps);
static void gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps); static GstCaps *gst_video_test_src_src_fixate (GstBaseSrc * bsrc,
GstCaps * caps);
static gboolean gst_video_test_src_is_seekable (GstBaseSrc * psrc); static gboolean gst_video_test_src_is_seekable (GstBaseSrc * psrc);
static gboolean gst_video_test_src_do_seek (GstBaseSrc * bsrc, static gboolean gst_video_test_src_do_seek (GstBaseSrc * bsrc,
@ -301,11 +302,13 @@ gst_video_test_src_init (GstVideoTestSrc * src)
gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE); gst_base_src_set_live (GST_BASE_SRC (src), DEFAULT_IS_LIVE);
} }
static void static GstCaps *
gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps) gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
{ {
GstStructure *structure; GstStructure *structure;
caps = gst_caps_make_writable (caps);
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
gst_structure_fixate_field_nearest_int (structure, "width", 320); gst_structure_fixate_field_nearest_int (structure, "width", 320);
@ -322,7 +325,9 @@ gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
if (gst_structure_has_field (structure, "interlaced")) if (gst_structure_has_field (structure, "interlaced"))
gst_structure_fixate_field_boolean (structure, "interlaced", FALSE); gst_structure_fixate_field_boolean (structure, "interlaced", FALSE);
GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps); caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
return caps;
} }
static void static void