gpt4 book ai didi

c++ - QAudioDecoder "GStreamer; Unable to start decoding process"

转载 作者:太空宇宙 更新时间:2023-11-04 13:24:03 26 4
gpt4 key购买 nike

我得到以下错误

GStreamer; Unable to start decoding process

当我尝试启动 QAudioDecoder 时在控制台中。

以下代码:

void Media::decode(Memo* memo){
decoder = new QAudioDecoder();
format.setSampleRate(48000);
format.setChannelCount(1);
format.setSampleSize(8);
format.setCodec("audio/pcm");
format.setSampleType(QAudioFormat::UnSignedInt);
format.setByteOrder(QAudioFormat::LittleEndian);
decoder->setAudioFormat(format);
decoder->setSourceFilename(memo->getPathMedia());
connect(decoder, SIGNAL(bufferReady()), this, SLOT(readBuffer()));
decoder->start();
}



void Media::readBuffer(){
buffer = decoder->read();
}

我希望你能帮助我。

最佳答案

正如@nayana 建议的那样,我使用 GST_DEBUG=3 启用了 GStreamer 调试日志。它显示源文件名设置不正确:

filesrc gstfilesrc.c:632:gst_file_src_uri_set_uri:<source> Invalid URI 'file:file:///home/rom1/Music/track01.mp3'

只需删除 file:前缀并且有效。

// In my source file ...
QString source = qvariant_cast<QString>(audioPlayer->property("source"));

source.remove(0, 7);

qDebug() << "Loading media" << source;
decoder.setSourceFilename(source);
decoder.start();

关于c++ - QAudioDecoder "GStreamer; Unable to start decoding process",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33943680/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com