gst_aac_parse_init (GstAacParse * aacparse)
{
GST_DEBUG ("initialized");
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (aacparse));
}
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
gst_ac3_parse_reset (ac3parse);
ac3parse->baseparse_chainfunc =
GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE (ac3parse))->chainfunc;
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (ac3parse));
}
static void
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
/* init rest */
gst_base_parse_set_min_frame_size (GST_BASE_PARSE (amrparse), 62);
GST_DEBUG ("initialized");
-
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (amrparse));
}
gst_dca_parse_reset (dcaparse);
dcaparse->baseparse_chainfunc =
GST_BASE_PARSE_SINK_PAD (GST_BASE_PARSE (dcaparse))->chainfunc;
+
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (dcaparse));
}
static void
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
gst_flac_parse_init (GstFlacParse * flacparse)
{
flacparse->check_frame_checksums = DEFAULT_CHECK_FRAME_CHECKSUMS;
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (flacparse));
}
static void
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
gst_mpeg_audio_parse_init (GstMpegAudioParse * mp3parse)
{
gst_mpeg_audio_parse_reset (mp3parse);
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (mp3parse));
}
static void
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
gst_sbc_parse_init (GstSbcParse * sbcparse)
{
gst_sbc_parse_reset (sbcparse);
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (sbcparse));
}
static gboolean
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
gst_wavpack_parse_init (GstWavpackParse * wvparse)
{
gst_wavpack_parse_reset (wvparse);
+ GST_PAD_SET_ACCEPT_INTERSECT (GST_BASE_PARSE_SINK_PAD (wvparse));
}
static void
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
gst_caps_unref (peercaps);
- res = gst_caps_make_writable (res);
-
- /* Append the template caps because we still want to accept
- * caps without any fields in the case upstream does not
- * know anything.
- */
- gst_caps_append (res, templ);
} else {
res = templ;
}
GST_END_TEST;
+GST_START_TEST (test_parse_proxy_constraints)
+{
+ GstCaps *caps;
+ GstElement *parse, *filter;
+ GstPad *sinkpad;
+ GstStructure *s;
+
+ parse = gst_element_factory_make ("aacparse", NULL);
+ filter = gst_element_factory_make ("capsfilter", NULL);
+
+ /* constraint on rate and version */
+ caps = gst_caps_from_string ("audio/mpeg,mpegversion=2,rate=44100");
+ g_object_set (filter, "caps", caps, NULL);
+ gst_caps_unref (caps);
+
+ gst_element_link (parse, filter);
+
+ sinkpad = gst_element_get_static_pad (parse, "sink");
+ caps = gst_pad_query_caps (sinkpad, NULL);
+ GST_LOG ("caps %" GST_PTR_FORMAT, caps);
+
+ fail_unless (gst_caps_get_size (caps) == 1);
+
+ /* getcaps should proxy the rate constraint */
+ s = gst_caps_get_structure (caps, 0);
+ fail_unless (gst_structure_has_name (s, "audio/mpeg"));
+ fail_unless_structure_field_int_equals (s, "rate", 44100);
+ gst_caps_unref (caps);
+
+ /* should accept without the constraint */
+ caps = gst_caps_from_string ("audio/mpeg,mpegversion=2");
+ fail_unless (gst_pad_query_accept_caps (sinkpad, caps));
+ gst_caps_unref (caps);
+
+ /* should not accept with conflicting version */
+ caps = gst_caps_from_string ("audio/mpeg,mpegversion=4");
+ fail_if (gst_pad_query_accept_caps (sinkpad, caps));
+ gst_caps_unref (caps);
+
+ gst_object_unref (sinkpad);
+
+}
+
+GST_END_TEST;
static Suite *
aacparse_suite (void)
/* Other tests */
tcase_add_test (tc_chain, test_parse_handle_codec_data);
+ /* caps tests */
+ tcase_add_test (tc_chain, test_parse_proxy_constraints);
+
return s;
}