Question about a custom decoder and caps renegotiation

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

Question about a custom decoder and caps renegotiation

Carlos Rafael Giani
Hello,

I am writing a GStreamer plugin for a decoder. It already works fine,
but outputs 16 bit integer samples at the moment, even though it
supports many more formats.

My question is how to inform the decoder about the desired sample
format. My guess is that I should use upstream caps renegotation. Here
is an example of what I mean, using a capsfilter:

gst-launch-0.10 filesrc location=foo ! mydecoder ! "audio/x-raw-int,
width=(int)32, signed=(boolean)true" ! fakesink

Then, the decoder would be told to produce 32bit signed integer samples.

Am I correct with this idea? Unfortunately, this section of the docs is
incomplete:

http://gstreamer.freedesktop.org/data/doc/gstreamer/0.10.36/pwg/html/section-nego-upstream.html

"Unfortunately, not all details here have been worked out yet, so this
documentation is incomplete. FIXME."

but the information on it is useful regardless.
_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: Question about a custom decoder and caps renegotiation

Tim-Philipp Müller-2
On Sat, 2012-06-30 at 11:16 +0200, dv wrote:

Hi,

> I am writing a GStreamer plugin for a decoder. It already works fine,
> but outputs 16 bit integer samples at the moment, even though it
> supports many more formats.
>
> My question is how to inform the decoder about the desired sample
> format. My guess is that I should use upstream caps renegotation.

You don't need upstream renegotiation for this, that's to tell upstream
elements that something has changed downstream.

In your decoder, you can simply do a gst_pad_get_allowed_caps(srcpad).
If you get a non-NULL return value, just pick the first structure of the
GstCaps and use that (or fixate that if needed). The first structure(s)
in GstCaps are the preferred ones generally.

Cheers
 -Tim

_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel