Transcoder CAP Negotiation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Transcoder CAP Negotiation

HtGst

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,


_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Transcoder CAP Negotiation

Sebastian Dröge-3
On So, 2016-06-12 at 16:00 -0700, ht techdev wrote:
> [...]
> 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 }

In the code you pasted, nothing looks wrong. More information would be
needed, like at least a backtrace of the infinite calls (to see where
they come from) but ideally a testcase to reproduce the problem.

Also consider using GstVideoDecoder as baseclass for the decoder.

--
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

signature.asc (968 bytes) Download Attachment