简体   繁体   English

gstreamer如何播放PCM文件,编程(C优先),而不是gst-launch

[英]How can gstreamer play PCM file, programming(C prefer), not gst-launch

I can play a PCM(RAW data, NOT wav format file) file, using the following command: 我可以使用以下命令播放PCM(RAW数据,不是wav格式的文件)文件:

gst-launch filesrc location=./44K_16bits.pcm ! audio/x-raw-int, width=16, depth=16, endianness=1234, channels=2, rate=44100, signed=true ! alsasink

How can this work in programming(C will be great)? 这在编程中如何工作(C会很棒)?

I tried to link the filesrc and convert + alsasink. 我试图链接filesrc并转换+ alsasink。

But the pipeline didn't work. 但是管道不起作用。 What's the part audio/x-raw-int ? 什么是audio/x-raw-int The caps setting to filesrc's "Source" or convert's "Sink"? 设置为filesrc的“源”或转换的“接收器”的上限?

It is a capsfilter, so you need to put a capsfilter in there and set its "caps" property. 它是一个capsfilter,因此您需要在其中放置一个capsfilter并设置其“ caps”属性。 The launch is just doing a simplification of: 该发布只是在简化以下内容:

gst-launch filesrc location=./44K_16bits.pcm ! capsfilter caps="audio/x-raw-int, width=16, depth=16, endianness=1234, channels=2, rate=44100, signed=true" ! alsasink

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM