使用Gstreamer播放PCM文件

时间:2015-03-24 15:23:34

标签: android c gstreamer pcm

我用这个Android应用创建了一个pcm文件:https://github.com/roman10/roman10-android-tutorial/tree/master/AndroidPCMRecorder

现在我想用gstreamer播放创建的文件。我在这里找到了代码:https://delog.wordpress.com/2011/10/04/read-and-write-raw-pcm-using-gstreamer/

这是我使用Gstreamer 1.0的控制台命令:

gst-launch-1.0 filesrc location=testpcm.pcm ! 
audio/x-raw, rate=44100, channels=1, endianness=4321, width=16, depth=16, signed=true !
pulsesink

当我执行此命令时,我收到此错误

ERROR OF ELEMENT: /GstPipeline:pipeline0/GstCapsFilter:capsfilter0: Filter caps do not completely specify the output format

ADDITIONALDEBUGINFO:
gstcapsfilter.c(356): gst_capsfilter_prepare_buf ():   
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0:
Output caps are unfixed: audio/x-raw, rate=(int)44100, channels=(int)1, endianness=(int)4321, width=(int)16, depth=(int)16, signed=(boolean)true, format=(string){ S16LE, S16BE, F32LE, F32BE, S32LE, S32BE, S24LE, S24BE, S24_32LE, S24_32BE, U8 }, layout=(string)interleaved

1 个答案:

答案 0 :(得分:3)

您正在使用GStreamer-0.1,但您只需将其更新为GStreamer-1.0即可。该命令如下所示:

gst-launch-1.0 filesrc location=testpcm.pcm ! 
audio/x-raw, format=S16LE, channels=1, layout=interleaved, rate=44100 ! pulsesink