<div dir="ltr">Thanks for your input. Finally I got it working last night. As per doc I should not be setting the resolution information in input caps instead those info should be set in the returned GstVideoCodeState.<br><br>"The specified <em class=""><code>caps</code></em>
 should not contain any resolution, pixel-aspect-ratio,
framerate, codec-data, .... Those should be specified instead in the returned
<a class="" href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstvideoutils.html#GstVideoCodecState" title="struct GstVideoCodecState"><span class="">GstVideoCodecState</span></a>." <br><br>But I did tried setting the resolution in input caps which didn't help.  Then I looked at  gst_video_encoder_negotiate_default() implementation which gave me hint that the width and height information is retrieved from the state->info{width/height} fields and not from the caps. After setting the info->width and info->height in the state I see the correct negotiated caps.<br><br>now my code looks like this:<br><br>state = gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps, self->input_state);<br><div>state->info.width = scaling_width;<br>state->info.height = scaling_height;<br><br> if (!gst_video_encoder_negotiate (GST_VIDEO_ENCODER (self))) {<br>      if (buf)<br>        gst_omx_port_release_buffer (self->enc_out_port, buf);<br>      GST_VIDEO_ENCODER_STREAM_UNLOCK (self);<br>      goto caps_failed;<br>   }<br><br>    GST_DEBUG_OBJECT (self, "final caps : %" GST_PTR_FORMAT, state->caps);<br><br></div><div>final cap print the correct caps and gst-launch -v also shows the right caps.<br><br></div><div>Thanks<br></div><div>BK<br><br></div><div><br></div><br><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jan 16, 2015 at 5:22 AM, Sebastian Dröge <span dir="ltr"><<a href="mailto:sebastian@centricular.com" target="_blank">sebastian@centricular.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On Mi, 2015-01-14 at 13:19 -0500, BK wrote:<br>
> Hi,<br>
><br>
> I am using gst-omx encoder element to support hw accelerated code on my<br>
> platform. In addition to encode the module also support scaling plus<br>
> encode. I have added a new property in element to pass the resize parameter<br>
> and its working as expected. But caps still have the old resolution as<br>
> passed from upstream element. As per the gst plugin doc I am using<br>
> gst_video_encoder_set_output_state() to change the caps resolution<br>
> information. Can anyone comment on what I am missing here<br>
><br>
> static void<br>
> gst_omx_video_enc_loop (GstOMXVideoEnc * self)<br>
> {<br>
><br>
><br>
> ....<br>
> ...<br>
> .....<br>
>     caps = klass->get_caps (self, self->enc_out_port, self->input_state);<br>
>     if (!caps) {<br>
>       if (buf)<br>
>         gst_omx_port_release_buffer (self->enc_out_port, buf);<br>
>       GST_VIDEO_ENCODER_STREAM_UNLOCK (self);<br>
>       goto caps_failed;<br>
>     }<br>
><br>
>     GST_DEBUG_OBJECT (self, "Setting output state: %" GST_PTR_FORMAT, caps);<br>
><br>
>     state =<br>
>         gst_video_encoder_set_output_state (GST_VIDEO_ENCODER (self), caps,<br>
>         self->input_state);<br>
>      gst_caps_set_simple (state->caps, "width", G_TYPE_INT, 640, NULL);<br>
>      gst_caps_set_simple (state->caps, "height", G_TYPE_INT, 480, NULL);<br>
>     GST_DEBUG_OBJECT (self, "requesting caps : %" GST_PTR_FORMAT,<br>
> state->caps);<br>
<br>
</div></div>You have to change the fields of the caps *before* calling<br>
gst_video_encoder_set_output_state(), and then pass the caps to that<br>
function.<br>
<br>
By default it will take over any generic fields from the input state<br>
though, so usually it's not necessary to set width or height manually.<br>
<br>
<br>
Also by giving the caps to gst_video_encoder_set_output_state() you give<br>
them away and don't own a reference to them anymore, so you're not<br>
allowed to use them (or change them). If you want to keep a reference<br>
for yourself you need to call gst_caps_ref() before, but then you still<br>
can't change them without copying first as they become immutable once<br>
there are more than 1 references to the caps.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Sebastian Dröge, Centricular Ltd · <a href="http://www.centricular.com" target="_blank">http://www.centricular.com</a><br>
</font></span><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br>
<a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br></div>