diff options
author | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-07-16 17:13:43 +0200 |
---|---|---|
committer | VaL Doroshchuk <valentyn.doroshchuk@qt.io> | 2019-08-07 12:45:00 +0200 |
commit | 9cd70bd2d9c37491b59b8eb91ff7ea13aa87ae8b (patch) | |
tree | ce9c963f5bc4a5e9333ee81cd6ba0b15bfb93953 | |
parent | 26c4e47afacf8b4072fb8500111fe471672e7e37 (diff) |
GStreamer: Allow audio/x-raw codec in QAudioRecorder
Currently QAudioRecorder is implemented to find a codec and muxer that match some caps.
E.g. if we would want "audio/x-wav" container with PCM format, there is only one gst element
which supports it:
wavenc element accepts "audio/x-raw", "audio/x-alaw" or "audio/x-mulaw"
and provides buffers in "audio/x-wav" or "audio/x-rf64".
Next, we would need to find a codec which provides buffers in
"audio/x-raw", "audio/x-alaw" or "audio/x-mulaw". It might be mulawenc and alawenc.
And finally we combine them together to pipeline:
audio/x-raw -> mulawenc|alawenc -> wavenc -> audio/x-wav
And as a result there will be wav file and encoded in "audio/x-alaw" or "audio/x-mulaw"
and not in desired PCM format.
So suggesting to add audioconvert element to the audio encoders to allow to link
with various containers:
audio/x-raw -> audioconvert -> wavenc -> audio/x-wav
Change-Id: Icd77124267f5a0999625fa1fe4e3de3740218741
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Reviewed-by: Andy Shaw <andy.shaw@qt.io>
-rw-r--r-- | src/gsttools/qgstcodecsinfo.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gsttools/qgstcodecsinfo.cpp b/src/gsttools/qgstcodecsinfo.cpp index 512bb828d..c6e61f824 100644 --- a/src/gsttools/qgstcodecsinfo.cpp +++ b/src/gsttools/qgstcodecsinfo.cpp @@ -263,7 +263,16 @@ GList *QGstCodecsInfo::elementFactories(ElementType elementType) const break; } - return gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL); + GList *list = gst_element_factory_list_get_elements(gstElementType, GST_RANK_MARGINAL); + if (elementType == AudioEncoder) { + // Manually add "audioconvert" to the list + // to allow linking with various containers. + auto factory = gst_element_factory_find("audioconvert"); + if (factory) + list = g_list_prepend(list, factory); + } + + return list; #else GList *result = gst_registry_feature_filter(gst_registry_get_default(), element_filter, |