how get audio track sample rate,

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

how get audio track sample rate,

zare laky
Hi everyone,
    I want to know, how to get audio track sample rate, when pipeline
constructing, such as get it when 'on_pad_added' invoking.

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

Re: how get audio track sample rate,

Tim Müller
On Fri, 2017-02-10 at 08:48 +0000, zare laky wrote:

Hi,

> I want to know, how to get audio track sample rate, when
> pipeline  constructing, such as get it when 'on_pad_added' invoking.

Depends a bit on the details of the pipeline, but in general you'd do

 caps = gst_pad_get_current_caps (new_pad);
 ..
 gst_caps_unref (caps);

And check the sample rate there (get_structure(caps,0) then
gst_structure_get_int()).

Cheers
 -Tim

--
Tim Müller, Centricular Ltd - http://www.centricular.com
_______________________________________________
gstreamer-devel mailing list
[hidden email]
https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: how get audio track sample rate,

zare laky
Hi
  Tim,
  my gstreamer version is 0.10, I got caps below, rate is range value
type, can you tell me, how to find the one that the rate of current play
file.

caps=audio/x-raw-int, width=(int){ 16, 24, 32 }, depth=(int){ 16, 24, 32
}, rate=(int){ 7350, 8000, 11025, 12000, 16000, 2205
0, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, channels=(int)[ 1, 8 ]

my code like:
     caps = gst_pad_get_caps (pad);
     stru = gst_caps_get_structure (caps, 0);
     gst_structure_get_int(stru, "rate", &rate);
my pipeline is,
filesrc -> decodebin2 -> <constructed dynamically> -> alsasink

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

Fwd: Re: how get audio track sample rate,

zare laky

Hi
   Tim,
   my gstreamer version is 0.10, I got caps below, rate is range value
type, can you tell me, how to find the one that the rate of current play
file.

caps=audio/x-raw-int, width=(int){ 16, 24, 32 }, depth=(int){ 16, 24, 32
}, rate=(int){ 7350, 8000, 11025, 12000, 16000, 2205
0, 24000, 32000, 44100, 48000, 64000, 88200, 96000 }, channels=(int)[ 1, 8 ]

my code like:
      caps = gst_pad_get_caps (pad);
      stru = gst_caps_get_structure (caps, 0);
      gst_structure_get_int(stru, "rate", &rate);
my pipeline is,
filesrc -> decodebin2 -> <constructed dynamically> -> alsasink

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