[Development] Qt 5 on Linux: QAudioRecorder::setOutputLocation() behaviour differs from docs
dpurgin at gmail.com
Sun Jun 29 15:01:18 CEST 2014
I'm trying to make a sound recording using QAudioRecorder. After
setting encoder, codec and input device I'm calling
setOutputLocation(QUrl::fromLocalFile()) as it's proposed in the docs
and QAudioRecorder example. setOutputLocation() returns true but
QAudioRecorder emits error() signal after calling record(). The
errorString() shows "Could not open file "file:///tmp/temp.ogg" for
writing" although /tmp/temp.ogg can actually be created both by hand
and via QFile calls.
The problem is reproduced also in a QAudioRecorder example bundled in
I ran strace on the program and found out that the output file name is
passed to syscall open() with protocol in it like this:
open("file:///tmp/temp.ogg", O_WRONLY|O_CREAT|O_TRUNC, 0666) = -1
ENOENT (No such file or directory)
So the solution is to setOutputLocation with just QUrl("/tmp/temp.ogg").
The issue is observed on both Fedora 20 (Qt 5.2.1) and SailfishOS (Qt
5.1.1). I've checked the SRPM package in Fedora repository, looks like
there are no patches applied to QtMultimedia.
Could you tell please if is this an intended behaviour on Linux?
Should I file a bug report since there seems to be nothing about it in
More information about the Development