[gst-devel] playbin: get sample rate and channels in current stream

Alfred E. Heggestad aeh at db.org
Fri Sep 1 13:05:11 CEST 2006


Tim Müller wrote:
> On Fri, 2006-09-01 at 12:24 +0200, Alfred E. Heggestad wrote:
> 
>> the gst_caps_get_structure() returns a valid pointer, however the
>> gst_structure_get_int() both return FALSE..
>>
>> when dumping the caps I get:
>>
>>   caps: audio/x-raw-int, endianness=(int)1234, signed=(boolean)true, 
>> width=(int)32, depth=(int)32, rate=(int){ 8000, 11025, 12000, 16000, 
>> 22050, 24000, 32000, 44100, 48000 }, channels=(int)[ 1, 2 ]
>>
>> ..which I guess indicates the ranges of e.g. rate/channels..
>> any way of getting the current value?
> 
> Those are the template caps, which is what you get when the real caps
> haven't been set yet. Caps negotiation will take place when data flow
> happens, so you should check again then. The easiest way is to wait
> until the pipeline has reached PAUSED state and only then check the
> stream-info.
> 

in the failing case, it was done in the READY -> PAUSED state transition


> Alternatively, you can extract this information at the sink when the
> first buffer arrives (it should have the caps set on the buffer, check
> GST_BUFFER_CAPS(), and fakesink's sink pad should also have caps set on
> it then).
> 
> 


Yes! that really works! very cool. this approach works fine for me, as
it will also handle any changes in srate/channels ;)


thanks very much for your help, gstreamer rocks!



/alfred




More information about the gstreamer-devel mailing list