mirror of
https://github.com/mumble-voip/mumble.git
synced 2025-10-26 11:19:16 +00:00
FEAT(client): Add opus as output format for recording
This commits adds opus as an output format for voice recordings as requested in #5065. It uses an OGG container like the already implemented Vorbis codec but has much better compression. For clarity the .opus file extension is used. Implements #5065 Co-authored-by: Robert Adam <dev@robert-adam.de>
This commit is contained in:
parent
207dbe0d8a
commit
665a658c97
@ -451,6 +451,13 @@ endif()
|
||||
|
||||
find_pkg("SndFile;LibSndFile;sndfile" REQUIRED)
|
||||
|
||||
# Check if sndfile version supports opus
|
||||
if("${sndfile_VERSION}" VERSION_GREATER_EQUAL "1.0.29")
|
||||
target_compile_definitions(mumble PRIVATE USE_SNDFILE_OPUS)
|
||||
else()
|
||||
message(WARNING "libsnfile is missing Opus-support -> No Opus-format recording")
|
||||
endif()
|
||||
|
||||
# Look for various targets as they are named differently on different platforms
|
||||
if(static AND TARGET sndfile-static)
|
||||
target_link_libraries(mumble PRIVATE sndfile-static)
|
||||
|
||||
@ -212,6 +212,18 @@ SF_INFO VoiceRecorder::createSoundFileInfo() const {
|
||||
qWarning() << "VoiceRecorder: recording started to" << m_config.fileName << "@" << m_config.sampleRate
|
||||
<< "hz in FLAC format";
|
||||
break;
|
||||
#ifdef USE_SNDFILE_OPUS
|
||||
case VoiceRecorderFormat::OPUS:
|
||||
sfinfo.frames = 0;
|
||||
sfinfo.samplerate = m_config.sampleRate;
|
||||
sfinfo.channels = 1;
|
||||
sfinfo.format = SF_FORMAT_OGG | SF_FORMAT_OPUS;
|
||||
sfinfo.sections = 0;
|
||||
sfinfo.seekable = 0;
|
||||
qWarning() << "VoiceRecorder: recording started to" << m_config.fileName << "@" << m_config.sampleRate
|
||||
<< "hz in OPUS format";
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
|
||||
Q_ASSERT(sf_format_check(&sfinfo));
|
||||
@ -429,6 +441,10 @@ QString VoiceRecorderFormat::getFormatDescription(VoiceRecorderFormat::Format fm
|
||||
return VoiceRecorder::tr(".au - Uncompressed");
|
||||
case VoiceRecorderFormat::FLAC:
|
||||
return VoiceRecorder::tr(".flac - Lossless compressed");
|
||||
#ifdef USE_SNDFILE_OPUS
|
||||
case VoiceRecorderFormat::OPUS:
|
||||
return VoiceRecorder::tr(".opus - Lossy compressed");
|
||||
#endif
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
@ -446,6 +462,10 @@ QString VoiceRecorderFormat::getFormatDefaultExtension(VoiceRecorderFormat::Form
|
||||
return QLatin1String("au");
|
||||
case VoiceRecorderFormat::FLAC:
|
||||
return QLatin1String("flac");
|
||||
#ifdef USE_SNDFILE_OPUS
|
||||
case VoiceRecorderFormat::OPUS:
|
||||
return QLatin1String("opus");
|
||||
#endif
|
||||
default:
|
||||
return QString();
|
||||
}
|
||||
|
||||
@ -51,6 +51,10 @@ enum Format {
|
||||
AU,
|
||||
/// FLAC Format
|
||||
FLAC,
|
||||
#ifdef USE_SNDFILE_OPUS
|
||||
// OPUS Format
|
||||
OPUS,
|
||||
#endif
|
||||
kEnd
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user