mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 08:46:40 +00:00
videoparsers: refactor remove_fields in getcaps
This commit is contained in:
parent
26bf14c9fd
commit
d5a16bccac
7 changed files with 103 additions and 57 deletions
|
@ -387,6 +387,19 @@ gst_dirac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
|
|||
return GST_FLOW_OK;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_dirac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -397,15 +410,9 @@ gst_dirac_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
/* Remove the parsed field */
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -361,6 +361,19 @@ more:
|
|||
return res;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_h263_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -371,15 +384,9 @@ gst_h263_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
/* Remove parsed field */
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -1894,6 +1894,21 @@ refuse_caps:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "alignment");
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_h264_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -1903,16 +1918,8 @@ gst_h264_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse));
|
||||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
gst_structure_remove_field (s, "alignment");
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -1832,6 +1832,21 @@ refuse_caps:
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "alignment");
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_h265_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -1841,16 +1856,8 @@ gst_h265_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse));
|
||||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
gst_structure_remove_field (s, "alignment");
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -830,6 +830,19 @@ gst_mpeg4vparse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static GstCaps *
|
||||
gst_mpeg4vparse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
|
@ -841,16 +854,9 @@ gst_mpeg4vparse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
/* Remove the parsed field */
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -1023,6 +1023,19 @@ gst_mpegv_parse_set_caps (GstBaseParse * parse, GstCaps * caps)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_mpegv_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -1032,15 +1045,9 @@ gst_mpegv_parse_get_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse));
|
||||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), filter);
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
|
||||
/* Remove the parsed field */
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (peercaps, i);
|
||||
gst_structure_remove_field (s, "parsed");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
res = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
|
@ -363,6 +363,20 @@ gst_vc1_parse_renegotiate (GstVC1Parse * vc1parse)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
remove_fields (GstCaps * caps)
|
||||
{
|
||||
guint i, n;
|
||||
|
||||
n = gst_caps_get_size (caps);
|
||||
for (i = 0; i < n; i++) {
|
||||
GstStructure *s = gst_caps_get_structure (caps, i);
|
||||
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "header-format");
|
||||
}
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
gst_vc1_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
||||
{
|
||||
|
@ -373,20 +387,11 @@ gst_vc1_parse_get_sink_caps (GstBaseParse * parse, GstCaps * filter)
|
|||
templ = gst_pad_get_pad_template_caps (GST_BASE_PARSE_SINK_PAD (parse));
|
||||
peercaps = gst_pad_peer_query_caps (GST_BASE_PARSE_SRC_PAD (parse), NULL);
|
||||
if (peercaps) {
|
||||
guint i, n;
|
||||
GstStructure *s;
|
||||
|
||||
/* Remove the stream-format and header-format fields
|
||||
* and add the generic ones again by intersecting
|
||||
* with our template */
|
||||
peercaps = gst_caps_make_writable (peercaps);
|
||||
n = gst_caps_get_size (peercaps);
|
||||
for (i = 0; i < n; i++) {
|
||||
s = gst_caps_get_structure (peercaps, i);
|
||||
|
||||
gst_structure_remove_field (s, "stream-format");
|
||||
gst_structure_remove_field (s, "header-format");
|
||||
}
|
||||
remove_fields (peercaps);
|
||||
|
||||
ret = gst_caps_intersect_full (peercaps, templ, GST_CAPS_INTERSECT_FIRST);
|
||||
gst_caps_unref (peercaps);
|
||||
|
|
Loading…
Reference in a new issue