Transcoder CAP Negotiation

ht techdev ht.techdev at gmail.com
Sun Jun 12 23:00:49 UTC 2016


Hi

Have a working transcoder pipeline that uses avlib to do the initial AVC
decoding which is followed by a homebrewed HEVC encoder, with its sink pad
defined as:

  static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE
("sink",

        GST_PAD_SINK,

        GST_PAD_ALWAYS,

        GST_STATIC_CAPS ("video/x-raw, "

                         "format = (string) { " FORMATS " }, "

                         "framerate = (fraction) [ 0/1, MAX], "

                         "width = (int) [ 16, MAX ], " "height = (int) [ 16,
MAX ]")

        );

 

Trying to replace the avlib AVC decoder with another homebrewed version and
am seeing endless calls to encoder's video_encoder_class->getcaps method,
which returns the following:

    returning video/x-raw, framerate=(fraction)[ 0/1, 2147483647/1 ],
width=(int)[ 16, 2147483647 ], height=(int)[ 16, 2147483647 ],
format=(string){ I420, I420_10LE }

 

Decoder's source pad is defined as follow:

  static GstStaticPadTemplate gst_avcdec_src_template =

    GST_STATIC_PAD_TEMPLATE ("src",

    GST_PAD_SRC,

    GST_PAD_ALWAYS,

                GST_STATIC_CAPS ("video/x-raw,"

                                "width = (int)[ 16, MAX ],"

                                "height = (int)[ 16, MAX ],"

                                "framerate = (fraction) [ 0/1, MAX ],"

                                "format = (string) {I420}"

                                                                )

    );

 

And is setup in the following manner:

In its init function, I have:

.

avcdec->srcpad = gst_pad_new_from_static_template (&gst_avcdec_src_template,
"src");

                GST_PAD_SET_PROXY_CAPS (avcdec->srcpad);

                gst_pad_set_query_function (avcdec->srcpad,GST_DEBUG_FUNCPTR
(gst_avcdec_src_query));

                gst_pad_use_fixed_caps(avcdec->srcpad);

                gst_element_add_pad (GST_ELEMENT (avcdec), avcdec->srcpad);

.

 

In source pad query function I do the following:

.

                switch (GST_QUERY_TYPE (query)) {

                case GST_QUERY_CAPS:{

                                GstCaps *caps;

                                GST_DEBUG_OBJECT (avcdec, "Using src
template caps");

                                caps = gst_static_pad_template_get_caps
(&gst_avcdec_src_template);

                                //caps = gst_pad_get_pad_template_caps(pad);

                                gst_query_set_caps_result (query, caps);

                                gst_caps_unref (caps);

                                break;

                }

                default:

                                res = gst_pad_query_default (pad, parent,
query);

                                break;

                }

                return res;

.

 

And on sink pad's cap event I do this:

.

//avcdec->vinfo.chroma_site=GST_VIDEO_CHROMA_SITE_MPEG2;

// avcdec->vinfo.colorimetry.matrix=GST_VIDEO_COLOR_MATRIX_BT709;

// avcdec->vinfo.interlace_mode=GST_VIDEO_INTERLACE_MODE_PROGRESSIVE;

  //avcdec->vinfo.size=avcdec->vinfo.width*avcdec->vinfo.height;

 
gst_video_info_set_format(&avcdec->vinfo,GST_VIDEO_FORMAT_I420,avcdec->vinfo
.width,avcdec->vinfo.height);

  gst_pad_set_caps (avcdec->srcpad, gst_video_info_to_caps(&avcdec->vinfo));

.

It should be noted that I can dump proper YUV frames into filesink element.

By the looks of it I am missing something, any help or pointers would be
appreciated.

Cheers,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160612/d1375f99/attachment.html>


More information about the gstreamer-devel mailing list