gst-omx encoder change caps

BK brijeshku84 at gmail.com
Wed Jan 14 10:19:36 PST 2015


Hi,

I am using gst-omx encoder element to support hw accelerated code on my
platform. In addition to encode the module also support scaling plus
encode. I have added a new property in element to pass the resize parameter
and its working as expected. But caps still have the old resolution as
passed from upstream element. As per the gst plugin doc I am using
gst_video_encoder_set_output_state() to change the caps resolution
information. Can anyone comment on what I am missing here

static void
gst_omx_video_enc_loop (GstOMXVideoEnc * self)
{


....
...
.....
    caps = klass->get_caps (self, self->enc_out_port, self->input_state);
    if (!caps) {
      if (buf)
        gst_omx_port_release_buffer (self->enc_out_port, buf);
      GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
      goto caps_failed;
    }

    GST_DEBUG_OBJECT (self, "Setting output state: %" GST_PTR_FORMAT, caps);

    state =
        gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,
        self->input_state);
     gst_caps_set_simple (state->caps, "width", G_TYPE_INT, 640, NULL);
     gst_caps_set_simple (state->caps, "height", G_TYPE_INT, 480, NULL);
    GST_DEBUG_OBJECT (self, "requesting caps : %" GST_PTR_FORMAT,
state->caps);

    if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {
      if (buf)
        gst_omx_port_release_buffer (self->enc_out_port, buf);
      GST_VIDEO_ENCODER_STREAM_UNLOCK (self);
      goto caps_failed;
    }

    GST_DEBUG_OBJECT (self, "final caps : %" GST_PTR_FORMAT, state->caps);
    GST_VIDEO_ENCODER_STREAM_UNLOCK (self);

....................

The output from GST_LOG is below

:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0> Port settings have
changed, updating caps
gst_omx_h264_enc_get_caps: caps is video/x-h264,
stream-format=(string)byte-stream, alignment=(string)au,
profile=(string)baseline, level=(string)4.2
0:00:00.253150223 19354 0x7f3c44002850 DEBUG            omxvideoenc
gstomxvideoenc.c:924:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0>
Setting output state: video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, profile=(string)baseline, level=(string)4.2
0:00:00.253196485 19354 0x7f3c44002850 DEBUG            omxvideoenc
gstomxvideoenc.c:931:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0>
Setting output state: video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, profile=(string)baseline, level=(string)4.2
0:00:00.253243548 19354 0x7f3c44002850 DEBUG            omxvideoenc
gstomxvideoenc.c:940:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0> before
caps : video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, profile=(string)baseline, level=(string)4.2,
width=(int)640, height=(int)480
0:00:00.253385517 19354 0x7f3c44002850 DEBUG            omxvideoenc
gstomxvideoenc.c:949:gst_omx_video_enc_loop:<omxh264enc-omxh264enc0> final
caps : video/x-h264, stream-format=(string)byte-stream,
alignment=(string)au, profile=(string)baseline, level=(string)4.2,
width=(int)320, height=(int)240, pixel-aspect-ratio=(fraction)1/1,
framerate=(fraction)30/1


May be I am missing something in the doc, as per
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-GstVideoEncoder.html#gst-video-encoder-set-output-state
, the subclass can override the resolution information in returned state
but somehow its not working for me.

Any help is greatly appreciated.

Thanks
BK
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150114/4e8d5e11/attachment.html>


More information about the gstreamer-devel mailing list