GstAudioDecoder feature proposal for 1.0

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

GstAudioDecoder feature proposal for 1.0

Carlos Rafael Giani
Hello,

in 0.10, I noticed that it seems to be impossible to adapt a decoder
based on GstAudioDecoder to the downstream caps.

The use case is this:

Suppose there is a decoder "mydecoder", which has the capability of
optimized decoding to several sample formats. That is, for each
supported sample format, the decoder has a separate, optimized codepath.
It makes sense to make use of these optimizations. But that requires the
decoder to somehow determine what kind of sample format downstream
needs. Like:

   filesrc location=foo ! mydecoder ! "audio/x-raw-int, width=(int)32" !
fakesink

Ideally, in a case like this, mydecoder would determine that a 32-bit
integer output is the right choice, and use the corresponding internal
codepath.

The problem is that I cannot find out what downstream needs. In this
case, I could not determine that a 32bit integer format is the best
choice. GstAudioDecoder's setformat call informs me about incoming (that
is, upstream) caps, but nothing informs me about downstream. It seems to
be a limitation of GstAudioDecoder.

If so, I suggest to extend GstAudioDecoder in 0.11/1.0 to also inform
about downstream caps.

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

Re: GstAudioDecoder feature proposal for 1.0

Tim-Philipp Müller-2
On Fri, 2012-07-06 at 22:23 +0200, dv wrote:

Hi "C.R.",

> The problem is that I cannot find out what downstream needs. In this
> case, I could not determine that a 32bit integer format is the best
> choice. GstAudioDecoder's setformat call informs me about incoming (that
> is, upstream) caps, but nothing informs me about downstream. It seems to
> be a limitation of GstAudioDecoder.
>
> If so, I suggest to extend GstAudioDecoder in 0.11/1.0 to also inform
> about downstream caps.

When set_format gets called with the input caps, or you get your first
handle_frame call, you could do a gst_pad_get_allowed_caps() on the
decoder's source pad to find out what downstream supports (compatible
with your output caps as per the pad template). The rule is generally
that the preferred format(s) should be listed first if the GstCaps have
multiple structures or contain lists with multiple allowed values.

It's up to you to decide what you want to output then. You could have a
look at e.g. a52dec to see how it tries to figure out whether to downmix
multichannel audio to stereo itself or not.

Cheers
 -Tim

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