Merge structures into caps instead of appending them
This commit is contained in:
parent
9f7ed3f180
commit
0b0255ed12
@ -95,21 +95,21 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/3gpp") == 0) {
|
} else if (strcmp (type->mime, "audio/3gpp") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
tmp = gst_structure_new ("audio/AMR",
|
tmp = gst_structure_new ("audio/AMR",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/amr-wb") == 0) {
|
} else if (strcmp (type->mime, "audio/amr-wb") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
tmp = gst_structure_new ("audio/AMR-WB",
|
tmp = gst_structure_new ("audio/AMR-WB",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/mp4a-latm") == 0) {
|
} else if (strcmp (type->mime, "audio/mp4a-latm") == 0) {
|
||||||
gint j;
|
gint j;
|
||||||
GstStructure *tmp, *tmp2;
|
GstStructure *tmp, *tmp2;
|
||||||
@ -147,13 +147,13 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
|
|
||||||
tmp2 = gst_structure_copy (tmp);
|
tmp2 = gst_structure_copy (tmp);
|
||||||
gst_structure_set (tmp2, "profile", G_TYPE_STRING, profile, NULL);
|
gst_structure_set (tmp2, "profile", G_TYPE_STRING, profile, NULL);
|
||||||
gst_caps_append_structure (ret, tmp2);
|
gst_caps_merge_structure (ret, tmp2);
|
||||||
|
|
||||||
have_profile = TRUE;
|
have_profile = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_profile) {
|
if (!have_profile) {
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
gst_structure_free (tmp);
|
gst_structure_free (tmp);
|
||||||
}
|
}
|
||||||
@ -163,21 +163,21 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
tmp = gst_structure_new ("audio/x-alaw",
|
tmp = gst_structure_new ("audio/x-alaw",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/g711-mlaw") == 0) {
|
} else if (strcmp (type->mime, "audio/g711-mlaw") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
tmp = gst_structure_new ("audio/x-mulaw",
|
tmp = gst_structure_new ("audio/x-mulaw",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/vorbis") == 0) {
|
} else if (strcmp (type->mime, "audio/vorbis") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
tmp = gst_structure_new ("audio/x-vorbis",
|
tmp = gst_structure_new ("audio/x-vorbis",
|
||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/flac") == 0) {
|
} else if (strcmp (type->mime, "audio/flac") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"framed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "audio/mpeg-L2") == 0) {
|
} else if (strcmp (type->mime, "audio/mpeg-L2") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"rate", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
"channels", GST_TYPE_INT_RANGE, 1, G_MAXINT,
|
||||||
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("Unsupported mimetype '%s'", type->mime);
|
GST_WARNING ("Unsupported mimetype '%s'", type->mime);
|
||||||
}
|
}
|
||||||
|
@ -156,12 +156,12 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
gst_structure_set_value (tmp2, "level", &va);
|
gst_structure_set_value (tmp2, "level", &va);
|
||||||
g_value_unset (&va);
|
g_value_unset (&va);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
gst_caps_append_structure (ret, tmp2);
|
gst_caps_merge_structure (ret, tmp2);
|
||||||
have_profile_level = TRUE;
|
have_profile_level = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_profile_level) {
|
if (!have_profile_level) {
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
gst_structure_free (tmp);
|
gst_structure_free (tmp);
|
||||||
}
|
}
|
||||||
@ -210,12 +210,12 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
gst_structure_set_value (tmp2, "level", &va);
|
gst_structure_set_value (tmp2, "level", &va);
|
||||||
g_value_unset (&va);
|
g_value_unset (&va);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
gst_caps_append_structure (ret, tmp2);
|
gst_caps_merge_structure (ret, tmp2);
|
||||||
have_profile_level = TRUE;
|
have_profile_level = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_profile_level) {
|
if (!have_profile_level) {
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
gst_structure_free (tmp);
|
gst_structure_free (tmp);
|
||||||
}
|
}
|
||||||
@ -267,20 +267,20 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
if (!alternative)
|
if (!alternative)
|
||||||
g_value_unset (&va);
|
g_value_unset (&va);
|
||||||
g_value_unset (&v);
|
g_value_unset (&v);
|
||||||
gst_caps_append_structure (ret, tmp2);
|
gst_caps_merge_structure (ret, tmp2);
|
||||||
|
|
||||||
if (alternative) {
|
if (alternative) {
|
||||||
tmp2 = gst_structure_copy (tmp);
|
tmp2 = gst_structure_copy (tmp);
|
||||||
gst_structure_set (tmp2, "profile", G_TYPE_STRING, alternative, NULL);
|
gst_structure_set (tmp2, "profile", G_TYPE_STRING, alternative, NULL);
|
||||||
gst_structure_set_value (tmp2, "level", &va);
|
gst_structure_set_value (tmp2, "level", &va);
|
||||||
g_value_unset (&va);
|
g_value_unset (&va);
|
||||||
gst_caps_append_structure (ret, tmp2);
|
gst_caps_merge_structure (ret, tmp2);
|
||||||
}
|
}
|
||||||
have_profile_level = TRUE;
|
have_profile_level = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!have_profile_level) {
|
if (!have_profile_level) {
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
gst_structure_free (tmp);
|
gst_structure_free (tmp);
|
||||||
}
|
}
|
||||||
@ -292,7 +292,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
"height", GST_TYPE_INT_RANGE, 16, 4096,
|
||||||
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
"framerate", GST_TYPE_FRACTION_RANGE, 0, 1, G_MAXINT, 1, NULL);
|
||||||
|
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else if (strcmp (type->mime, "video/mpeg2") == 0) {
|
} else if (strcmp (type->mime, "video/mpeg2") == 0) {
|
||||||
GstStructure *tmp;
|
GstStructure *tmp;
|
||||||
|
|
||||||
@ -305,7 +305,7 @@ create_sink_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
"systemstream", G_TYPE_BOOLEAN, FALSE,
|
||||||
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
"parsed", G_TYPE_BOOLEAN, TRUE, NULL);
|
||||||
|
|
||||||
gst_caps_append_structure (ret, tmp);
|
gst_caps_merge_structure (ret, tmp);
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING ("Unsupported mimetype '%s'", type->mime);
|
GST_WARNING ("Unsupported mimetype '%s'", type->mime);
|
||||||
}
|
}
|
||||||
@ -369,7 +369,7 @@ create_src_caps (const GstAmcCodecInfo * codec_info)
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tmp = gst_video_format_new_template_caps (format);
|
tmp = gst_video_format_new_template_caps (format);
|
||||||
gst_caps_append (ret, tmp);
|
gst_caps_merge (ret, tmp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user