Q解码器 "GStreamer; Unable to start decoding process"

QAudioDecoder "GStreamer; Unable to start decoding process"

本文关键字:start decoding to process 解码器 GStreamer Unable      更新时间:2023-10-16

我得到以下错误

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();
相关文章: