Plugin Writing - Pad Caps Format Change

emreterzioglu emreterzioglu at mistelektronik.com
Wed Feb 27 07:00:26 UTC 2019


Hi there,

Thanks for reply, I switched normal Transform function and added
transform_caps function(Trying to convert GRAY16_LE to GRAY8. Transform_caps
added below), now i think i am doing things in true way but i am still
getting same errors.My debug output added below. Do you have any idea about
"GST_ELEMENT_PADS gstutils.c:1061:gst_element_get_compatible_pad: found
existing unlinked compatible pad mistherfilter0:sink".

Thanks.

DEBUG OUTPUT:

0:00:00.568450393 16427      0x24a5800 INFO                GST_PADS
gstutils.c:932:gst_pad_check_link: trying to link fakesrc0:src and
myfilter0:sink
0:00:00.568459077 16427      0x24a5800 DEBUG               GST_CAPS
gstutils.c:2840:gst_pad_query_caps:<fakesrc0:src> get pad caps with filter
(NULL)
0:00:00.568469537 16427      0x24a5800 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x25d75e0 caps
0:00:00.568477304 16427      0x24a5800 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<fakesrc0:src> doing query 0x25d75e0 (caps)
0:00:00.568489201 16427      0x24a5800 DEBUG                basesrc
gstbasesrc.c:1296:gst_base_src_default_query:<fakesrc0> query caps returns 1
0:00:00.568496979 16427      0x24a5800 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<fakesrc0:src> sent query 0x25d75e0 (caps),
result 1
0:00:00.568505548 16427      0x24a5800 DEBUG               GST_CAPS
gstutils.c:2847:gst_pad_query_caps:<fakesrc0:src> query returned ANY
0:00:00.568516127 16427      0x24a5800 DEBUG               GST_CAPS
gstutils.c:2840:gst_pad_query_caps:<myfilter0:sink> get pad caps with filter
(NULL)
0:00:00.568523948 16427      0x24a5800 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x25d7630 caps
0:00:00.568532111 16427      0x24a5800 DEBUG               GST_PADS
gstpad.c:3915:gst_pad_query:<myfilter0:sink> doing query 0x25d7630 (caps)
0:00:00.568541383 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:730:gst_base_transform_query_caps:<myfilter0:sink> peer
filter caps (NULL)
0:00:00.568549557 16427      0x24a5800 DEBUG               GST_CAPS
gstutils.c:2886:gst_pad_peer_query_caps:<myfilter0:src> get pad peer caps
with filter (NULL)
0:00:00.568577106 16427      0x24a5800 DEBUG                  query
gstquery.c:674:gst_query_new_custom: creating new query 0x25d75e0 caps
0:00:00.568602805 16427      0x24a5800 DEBUG               GST_PADS
gstpad.c:4042:gst_pad_peer_query:<myfilter0:src> peer query 0x25d75e0 (caps)
0:00:00.568612816 16427      0x24a5800 INFO                GST_PADS
gstpad.c:4098:gst_pad_peer_query:<myfilter0:src> pad has no peer
0:00:00.568622454 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:746:gst_base_transform_query_caps:<myfilter0:sink> peer
caps  ANY
0:00:00.568629926 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:749:gst_base_transform_query_caps:<myfilter0:sink> our
template  video/x-raw, format=(string)GRAY16_LE, width=(int)[ 1, 2147483647
], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568645714 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:751:gst_base_transform_query_caps:<myfilter0:sink>
intersected video/x-raw, format=(string)GRAY16_LE, width=(int)[ 1,
2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1,
2147483647/1 ]
0:00:00.568656532 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:533:gst_base_transform_transform_caps:<myfilter0>
transform caps (direction = 1)
0:00:00.568681582 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:560:gst_base_transform_transform_caps:<myfilter0> to:
video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647 ],
height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568697034 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:759:gst_base_transform_query_caps:<myfilter0:sink>
transformed  video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647
], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568707124 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:766:gst_base_transform_query_caps:<myfilter0:sink> our
template  video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647 ],
height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568719317 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:769:gst_base_transform_query_caps:<myfilter0:sink>
intersected video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647 ],
height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568729287 16427      0x24a5800 DEBUG          basetransform
gstbasetransform.c:793:gst_base_transform_query_caps:<myfilter0> returning 
video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647 ],
height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568739245 16427      0x24a5800 DEBUG               GST_PADS
gstpad.c:3938:gst_pad_query:<myfilter0:sink> sent query 0x25d7630 (caps),
result 1
0:00:00.568747548 16427      0x24a5800 DEBUG               GST_CAPS
gstutils.c:2847:gst_pad_query_caps:<myfilter0:sink> query returned
video/x-raw, format=(string)GRAY8, width=(int)[ 1, 2147483647 ],
height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]
0:00:00.568759369 16427      0x24a5800 DEBUG       GST_ELEMENT_PADS
gstutils.c:1061:gst_element_get_compatible_pad: found existing unlinked
compatible pad myfilter0:sink
0:00:00.568768671 16427      0x24a5800 INFO                GST_PADS
gstutils.c:1446:prepare_link_maybe_ghosting: fakesrc0 and myfilter0 in same
bin, no need for ghost pads

*_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_=_
*
Transform_caps Function:


static GstCaps *
gst_myfilter_transform_caps (GstBaseTransform * trans,
    GstPadDirection direction, GstCaps * caps, GstCaps * filter)
{
	GstCaps *to, *ret;
  GstCaps *templ;
  GstStructure *structure;
  GstPad *other;
  gint i;
	printf("DEBUG 1 %s \n",__func__);
  to = gst_caps_new_empty ();

  for (i = 0; i < gst_caps_get_size (caps); i++) {
    const GValue *v;
    GValue list = { 0, };
    GValue val = { 0, };
		printf("DEBUG 2 %s \n",__func__);
    structure = gst_structure_copy (gst_caps_get_structure (caps, i));

    g_value_init (&list, GST_TYPE_LIST);

    g_value_init (&val, G_TYPE_STRING);
    g_value_set_string (&val, "GRAY8");
    gst_value_list_append_value (&list, &val);
    g_value_unset (&val);
		printf("DEBUG 3 %s \n",__func__);
    g_value_init (&val, G_TYPE_STRING);
/*
#if G_BYTE_ORDER == G_BIG_ENDIAN
    g_value_set_string (&val, "GRAY16_BE");
#else
    g_value_set_string (&val, "GRAY16_LE");
#endif
*/
		g_value_set_string (&val, "GRAY16_LE");	
    gst_value_list_append_value (&list, &val);
    g_value_unset (&val);
		printf("DEBUG 4 %s \n",__func__);
    v = gst_structure_get_value (structure, "format");

    gst_value_list_merge (&val, v, &list);
    gst_structure_set_value (structure, "format", &val);
    g_value_unset (&val);
    g_value_unset (&list);

    gst_structure_remove_field (structure, "colorimetry");
    gst_structure_remove_field (structure, "chroma-site");
		printf("DEBUG 5 %s \n",__func__);
    gst_caps_append_structure (to, structure);

  }
  /* filter against set allowed caps on the pad */
  other = (direction == GST_PAD_SINK) ?  trans->srcpad : trans->sinkpad;
  templ = gst_pad_get_pad_template_caps (other);
  ret = gst_caps_intersect (to, templ);
  gst_caps_unref (to);
  gst_caps_unref (templ);
	printf("DEBUG 6 %s \n",__func__);
  if (ret && filter) {
    GstCaps *intersection;
		printf("DEBUG 7 %s \n",__func__);
    intersection =
        gst_caps_intersect_full (filter, ret, GST_CAPS_INTERSECT_FIRST);
    gst_caps_unref (ret);
    ret = intersection;
  }
	printf("DEBUG 8 %s \n",__func__);
  return ret;
}



--
Sent from: http://gstreamer-devel.966125.n4.nabble.com/


More information about the gstreamer-devel mailing list