[qtmultimedia] Don't append suggested extension if filename includes extension. Contributes to JB#36676
Commit 6b19a24b58 changed the way that the file name is composed
for a video recording, so that a suggested extension for the given
media format is appended to the file name. That introduced a bug
in the case where the correct extension was already part of the
output location (filename) set for the sink, by causing a second
(and possibly incorrect) extension to be appended to the filename.
This commit ensures that if the filename already has a suffix, no
suggested extension is appended.
Contributes to JB#36676
This commit is contained in:
@@ -1125,11 +1125,16 @@ void CameraBinSession::recordVideo()
|
||||
if (format.isEmpty())
|
||||
format = m_mediaContainerControl->actualContainerFormat();
|
||||
|
||||
const QString actualFileName = m_mediaStorageLocation.generateFileName(m_sink.isLocalFile() ? m_sink.toLocalFile()
|
||||
: m_sink.toString(),
|
||||
const QString fileName = m_sink.isLocalFile() ? m_sink.toLocalFile() : m_sink.toString();
|
||||
const QFileInfo fileInfo(fileName);
|
||||
const QString extension = fileInfo.suffix().isEmpty()
|
||||
? m_mediaContainerControl->suggestedFileExtension(format)
|
||||
: fileInfo.suffix();
|
||||
|
||||
const QString actualFileName = m_mediaStorageLocation.generateFileName(fileName,
|
||||
QMediaStorageLocation::Movies,
|
||||
QLatin1String("clip_"),
|
||||
m_mediaContainerControl->suggestedFileExtension(format));
|
||||
extension);
|
||||
|
||||
m_recordingActive = true;
|
||||
m_actualSink = QUrl::fromLocalFile(actualFileName);
|
||||
|
||||
Reference in New Issue
Block a user