gst-omx encoder change caps

Sebastian Dröge sebastian at centricular.com
Fri Jan 16 02:22:42 PST 2015


On Mi, 2015-01-14 at 13:19 -0500, BK wrote:
> 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);

You have to change the fields of the caps *before* calling
gst_video_encoder_set_output_state(), and then pass the caps to that
function.

By default it will take over any generic fields from the input state
though, so usually it's not necessary to set width or height manually.


Also by giving the caps to gst_video_encoder_set_output_state() you give
them away and don't own a reference to them anymore, so you're not
allowed to use them (or change them). If you want to keep a reference
for yourself you need to call gst_caps_ref() before, but then you still
can't change them without copying first as they become immutable once
there are more than 1 references to the caps.

-- 
Sebastian Dröge, Centricular Ltd · http://www.centricular.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 949 bytes
Desc: This is a digitally signed message part
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20150116/fafe466e/attachment.sig>


More information about the gstreamer-devel mailing list