2003-04-14 01:20:30 +00:00
|
|
|
/* GStreamer
|
|
|
|
* Copyright (C) 2003 Benjamin Otte <in7y118@public.uni-hamburg.de>
|
2005-08-24 13:32:52 +00:00
|
|
|
* Copyright (C) 2005 Thomas Vander Stichele <thomas at apestaart dot org>
|
2011-08-18 17:15:03 +00:00
|
|
|
* Copyright (C) 2011 Wim Taymans <wim.taymans at gmail dot com>
|
2003-04-14 01:20:30 +00:00
|
|
|
*
|
|
|
|
* gstaudioconvert.c: Convert audio to different audio formats automatically
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-03 23:05:09 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2003-04-14 01:20:30 +00:00
|
|
|
*/
|
2005-09-23 14:41:31 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-audioconvert
|
2017-01-23 19:36:11 +00:00
|
|
|
* @title: audioconvert
|
2005-09-23 14:41:31 +00:00
|
|
|
*
|
|
|
|
* Audioconvert converts raw audio buffers between various possible formats.
|
2005-11-08 12:18:14 +00:00
|
|
|
* It supports integer to float conversion, width/depth conversion,
|
2015-05-09 21:33:26 +00:00
|
|
|
* signedness and endianness conversion and channel transformations
|
|
|
|
* (ie. upmixing and downmixing), as well as dithering and noise-shaping.
|
2008-07-10 21:06:06 +00:00
|
|
|
*
|
2017-01-23 19:36:11 +00:00
|
|
|
* ## Example launch line
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v -m audiotestsrc ! audioconvert ! audio/x-raw,format=S8,channels=2 ! level ! fakesink silent=TRUE
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* This pipeline converts audio to 8-bit. The level element shows that
|
2005-09-23 14:41:31 +00:00
|
|
|
* the output levels still match the one for a sine wave.
|
2008-07-10 21:06:06 +00:00
|
|
|
* |[
|
2015-05-09 21:33:26 +00:00
|
|
|
* gst-launch-1.0 -v -m uridecodebin uri=file:///path/to/audio.flac ! audioconvert ! vorbisenc ! oggmux ! filesink location=audio.ogg
|
2017-01-23 19:36:11 +00:00
|
|
|
* ]|
|
|
|
|
* The vorbis encoder takes float audio data instead of the integer data
|
2015-05-09 21:33:26 +00:00
|
|
|
* output by most other audio elements. This pipeline decodes a FLAC audio file
|
|
|
|
* (or any other audio file for which decoders are installed) and re-encodes
|
|
|
|
* it into an Ogg/Vorbis audio file.
|
2017-01-23 19:36:11 +00:00
|
|
|
*
|
2017-08-15 00:39:54 +00:00
|
|
|
* A mix matrix can be passed to audioconvert, that will govern the
|
|
|
|
* remapping of input to output channels.
|
2023-10-20 13:21:03 +00:00
|
|
|
* This is required if the input channels are unpositioned and no standard layout can be determined.
|
|
|
|
* If an empty mix matrix is specified, a (potentially truncated) identity matrix will be generated.
|
|
|
|
*
|
2017-08-15 00:39:54 +00:00
|
|
|
* ## Example matrix generation code
|
|
|
|
* To generate the matrix using code:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* GValue v = G_VALUE_INIT;
|
|
|
|
* GValue v2 = G_VALUE_INIT;
|
|
|
|
* GValue v3 = G_VALUE_INIT;
|
|
|
|
*
|
|
|
|
* g_value_init (&v2, GST_TYPE_ARRAY);
|
|
|
|
* g_value_init (&v3, G_TYPE_FLOAT);
|
|
|
|
* g_value_set_float (&v3, 1);
|
|
|
|
* gst_value_array_append_value (&v2, &v3);
|
|
|
|
* g_value_unset (&v3);
|
|
|
|
* [ Repeat for as many float as your input channels - unset and reinit v3 ]
|
|
|
|
* g_value_init (&v, GST_TYPE_ARRAY);
|
|
|
|
* gst_value_array_append_value (&v, &v2);
|
|
|
|
* g_value_unset (&v2);
|
|
|
|
* [ Repeat for as many v2's as your output channels - unset and reinit v2]
|
|
|
|
* g_object_set_property (G_OBJECT (audioconvert), "mix-matrix", &v);
|
|
|
|
* g_value_unset (&v);
|
|
|
|
* ]|
|
|
|
|
*
|
2024-08-15 15:01:31 +00:00
|
|
|
* The mix matrix can also be passed through a custom upstream event:
|
|
|
|
*
|
|
|
|
* |[
|
|
|
|
* GstStructure *s = gst_structure_new("GstRequestAudioMixMatrix", "matrix", GST_TYPE_ARRAY, &v, NULL);
|
|
|
|
* GstEvent *event = gst_event_new_custom (GST_EVENT_CUSTOM_UPSTREAM, s);
|
|
|
|
* GstPad *srcpad = gst_element_get_static_pad(audioconvert, "src");
|
|
|
|
* gst_pad_send_event (srcpad, event);
|
|
|
|
* gst_object_unref (pad);
|
|
|
|
* ]|
|
|
|
|
*
|
2017-08-15 00:39:54 +00:00
|
|
|
* ## Example launch line
|
|
|
|
* |[
|
2022-08-31 14:50:38 +00:00
|
|
|
* gst-launch-1.0 audiotestsrc ! audio/x-raw, channels=4 ! audioconvert mix-matrix="<<(float)1.0, (float)0.0, (float)0.0, (float)0.0>, <(float)0.0, (float)1.0, (float)0.0, (float)0.0>>" ! audio/x-raw,channels=2 ! autoaudiosink
|
2017-08-15 00:39:54 +00:00
|
|
|
* ]|
|
2017-10-11 16:03:20 +00:00
|
|
|
*
|
2017-10-26 16:05:31 +00:00
|
|
|
*
|
|
|
|
* ## Example empty matrix generation code
|
|
|
|
* |[
|
|
|
|
* GValue v = G_VALUE_INIT;
|
|
|
|
*
|
2017-10-27 15:29:40 +00:00
|
|
|
* g_value_init (&v, GST_TYPE_ARRAY);
|
2017-10-26 16:05:31 +00:00
|
|
|
* g_object_set_property (G_OBJECT (audioconvert), "mix-matrix", &v);
|
|
|
|
* g_value_unset (&v);
|
|
|
|
* ]|
|
|
|
|
*
|
|
|
|
* ## Example empty matrix launch line
|
|
|
|
* |[
|
|
|
|
* gst-launch-1.0 -v audiotestsrc ! audio/x-raw,channels=8 ! audioconvert mix-matrix="<>" ! audio/x-raw,channels=16,channel-mask=\(bitmask\)0x0000000000000000 ! fakesink
|
|
|
|
* ]|
|
2024-02-08 19:37:53 +00:00
|
|
|
*
|
|
|
|
* If input channels are unpositioned but follow a standard layout, they can be
|
|
|
|
* automatically positioned according to their index using one of the reorder
|
|
|
|
* configurations.
|
|
|
|
*
|
|
|
|
* ## Example with unpositioned input channels reordering
|
|
|
|
* |[
|
|
|
|
* gst-launch-1.0 -v audiotestsrc ! audio/x-raw,channels=6,channel-mask=\(bitmask\)0x0000000000000000 ! audioconvert input-channels-reorder-mode=unpositioned input-channels-reorder=smpte ! fakesink
|
|
|
|
* ]|
|
|
|
|
* In this case the input channels will be automatically positioned to the
|
|
|
|
* SMPTE order (left, right, center, lfe, rear-left and rear-right).
|
|
|
|
*
|
|
|
|
* The input channels reorder configurations can also be used to force the
|
|
|
|
* repositioning of the input channels when needed, for example when channels'
|
|
|
|
* positions are not correctly identified in an encoded file.
|
|
|
|
*
|
|
|
|
* ## Example with the forced reordering of input channels wrongly positioned
|
|
|
|
* |[
|
|
|
|
* gst-launch-1.0 -v audiotestsrc ! audio/x-raw,channels=3,channel-mask=\(bitmask\)0x0000000000000034 ! audioconvert input-channels-reorder-mode=force input-channels-reorder=aac ! fakesink
|
|
|
|
* ]|
|
|
|
|
* In this case the input channels are positioned upstream as center,
|
|
|
|
* rear-left and rear-right in this order. Using the "force" reorder mode and
|
|
|
|
* the "aac" order, the input channels are going to be repositioned to left,
|
|
|
|
* right and lfe, ignoring the actual value of the `channel-mask` in the input
|
|
|
|
* caps.
|
2005-09-23 14:41:31 +00:00
|
|
|
*/
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2004-03-06 15:31:25 +00:00
|
|
|
/*
|
|
|
|
* design decisions:
|
2005-08-24 13:32:52 +00:00
|
|
|
* - audioconvert converts buffers in a set of supported caps. If it supports
|
|
|
|
* a caps, it supports conversion from these caps to any other caps it
|
2004-03-06 15:31:25 +00:00
|
|
|
* supports. (example: if it does A=>B and A=>C, it also does B=>C)
|
|
|
|
* - audioconvert does not save state between buffers. Every incoming buffer is
|
|
|
|
* converted and the converted buffer is pushed out.
|
|
|
|
* conclusion:
|
|
|
|
* audioconvert is not supposed to be a one-element-does-anything solution for
|
|
|
|
* audio conversions.
|
|
|
|
*/
|
|
|
|
|
2003-06-29 19:46:12 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2004-02-25 18:02:19 +00:00
|
|
|
#include "config.h"
|
2003-06-29 19:46:12 +00:00
|
|
|
#endif
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
#include <string.h>
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
|
|
|
|
#include "gstaudioconvert.h"
|
2003-04-14 01:20:30 +00:00
|
|
|
|
gst/audioconvert/: Implement a channel mixer.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_init),
(gst_audio_convert_link), (gst_audio_convert_change_state),
(gst_audio_convert_channels):
* gst/audioconvert/gstchannelmix.c:
(gst_audio_convert_unset_matrix),
(gst_audio_convert_fill_identical),
(gst_audio_convert_fill_compatible),
(gst_audio_convert_detect_pos), (gst_audio_convert_fill_one_other),
(gst_audio_convert_fill_others),
(gst_audio_convert_fill_normalize),
(gst_audio_convert_fill_matrix), (gst_audio_convert_setup_matrix),
(gst_audio_convert_passthrough), (gst_audio_convert_mix):
* gst/audioconvert/gstchannelmix.h:
Implement a channel mixer.
2004-11-28 16:09:13 +00:00
|
|
|
GST_DEBUG_CATEGORY (audio_convert_debug);
|
2009-10-12 18:30:15 +00:00
|
|
|
GST_DEBUG_CATEGORY_STATIC (GST_CAT_PERFORMANCE);
|
2015-11-06 16:29:22 +00:00
|
|
|
#define GST_CAT_DEFAULT (audio_convert_debug)
|
2004-01-12 19:46:45 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** DEFINITIONS **************************************************************/
|
|
|
|
|
|
|
|
/* type functions */
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
static void gst_audio_convert_dispose (GObject * obj);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
|
|
|
/* gstreamer functions */
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static gboolean gst_audio_convert_get_unit_size (GstBaseTransform * base,
|
2011-03-27 14:35:28 +00:00
|
|
|
GstCaps * caps, gsize * size);
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static GstCaps *gst_audio_convert_transform_caps (GstBaseTransform * base,
|
2011-05-16 08:56:11 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter);
|
2012-02-22 11:27:49 +00:00
|
|
|
static GstCaps *gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
2005-08-24 13:32:52 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps);
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static gboolean gst_audio_convert_set_caps (GstBaseTransform * base,
|
|
|
|
GstCaps * incaps, GstCaps * outcaps);
|
|
|
|
static GstFlowReturn gst_audio_convert_transform (GstBaseTransform * base,
|
|
|
|
GstBuffer * inbuf, GstBuffer * outbuf);
|
2016-10-19 10:21:37 +00:00
|
|
|
static GstFlowReturn gst_audio_convert_transform_ip (GstBaseTransform * base,
|
|
|
|
GstBuffer * buf);
|
2015-06-04 15:59:17 +00:00
|
|
|
static gboolean gst_audio_convert_transform_meta (GstBaseTransform * trans,
|
|
|
|
GstBuffer * outbuf, GstMeta * meta, GstBuffer * inbuf);
|
2015-10-24 17:05:10 +00:00
|
|
|
static GstFlowReturn gst_audio_convert_submit_input_buffer (GstBaseTransform *
|
|
|
|
base, gboolean is_discont, GstBuffer * input);
|
2018-02-01 16:08:51 +00:00
|
|
|
static GstFlowReturn gst_audio_convert_prepare_output_buffer (GstBaseTransform *
|
|
|
|
base, GstBuffer * inbuf, GstBuffer ** outbuf);
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
static void gst_audio_convert_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec);
|
|
|
|
static void gst_audio_convert_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec);
|
2005-08-24 13:32:52 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/* AudioConvert signals and args */
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2003-04-14 01:20:30 +00:00
|
|
|
/* FILL ME */
|
|
|
|
LAST_SIGNAL
|
|
|
|
};
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2004-03-14 22:34:34 +00:00
|
|
|
enum
|
|
|
|
{
|
2015-04-27 10:26:10 +00:00
|
|
|
PROP_0,
|
|
|
|
PROP_DITHERING,
|
|
|
|
PROP_NOISE_SHAPING,
|
2017-08-15 00:39:54 +00:00
|
|
|
PROP_MIX_MATRIX,
|
2024-02-08 19:37:53 +00:00
|
|
|
PROP_DITHERING_THRESHOLD,
|
|
|
|
PROP_INPUT_CHANNELS_REORDER,
|
|
|
|
PROP_INPUT_CHANNELS_REORDER_MODE
|
2003-04-14 01:20:30 +00:00
|
|
|
};
|
|
|
|
|
2011-04-19 09:35:53 +00:00
|
|
|
#define DEBUG_INIT \
|
2009-10-12 18:30:15 +00:00
|
|
|
GST_DEBUG_CATEGORY_INIT (audio_convert_debug, "audioconvert", 0, "audio conversion element"); \
|
|
|
|
GST_DEBUG_CATEGORY_GET (GST_CAT_PERFORMANCE, "GST_PERFORMANCE");
|
2011-04-19 09:35:53 +00:00
|
|
|
#define gst_audio_convert_parent_class parent_class
|
|
|
|
G_DEFINE_TYPE_WITH_CODE (GstAudioConvert, gst_audio_convert,
|
2005-08-24 13:32:52 +00:00
|
|
|
GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
|
2020-12-11 16:54:31 +00:00
|
|
|
GST_ELEMENT_REGISTER_DEFINE (audioconvert, "audioconvert",
|
|
|
|
GST_RANK_PRIMARY, GST_TYPE_AUDIO_CONVERT);
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** GSTREAMER PROTOTYPES *****************************************************/
|
|
|
|
|
2004-03-06 13:26:12 +00:00
|
|
|
#define STATIC_CAPS \
|
2011-12-31 13:21:27 +00:00
|
|
|
GST_STATIC_CAPS (GST_AUDIO_CAPS_MAKE (GST_AUDIO_FORMATS_ALL) \
|
2018-02-01 16:08:51 +00:00
|
|
|
", layout = (string) { interleaved, non-interleaved }")
|
2004-03-06 13:26:12 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audio_convert_src_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
STATIC_CAPS);
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2003-12-22 01:47:09 +00:00
|
|
|
static GstStaticPadTemplate gst_audio_convert_sink_template =
|
2004-03-14 22:34:34 +00:00
|
|
|
GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
STATIC_CAPS);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2019-06-14 08:14:23 +00:00
|
|
|
/* cached quark to avoid contention on the global quark table lock */
|
|
|
|
#define META_TAG_AUDIO meta_tag_audio_quark
|
|
|
|
static GQuark meta_tag_audio_quark;
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** TYPE FUNCTIONS ***********************************************************/
|
2024-02-08 19:37:53 +00:00
|
|
|
|
|
|
|
#define GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER (gst_audio_convert_input_channels_reorder_get_type ())
|
|
|
|
|
|
|
|
static GType
|
|
|
|
gst_audio_convert_input_channels_reorder_get_type (void)
|
|
|
|
{
|
|
|
|
static GType reorder_type = 0;
|
|
|
|
|
|
|
|
if (g_once_init_enter (&reorder_type)) {
|
|
|
|
static GEnumValue reorder_types[] = {
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST,
|
|
|
|
"Reorder the input channels using the default GStreamer order",
|
|
|
|
"gst"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_SMPTE,
|
|
|
|
"Reorder the input channels using the SMPTE order",
|
|
|
|
"smpte"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_CINE,
|
|
|
|
"Reorder the input channels using the CINE order",
|
|
|
|
"cine"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AC3,
|
|
|
|
"Reorder the input channels using the AC3 order",
|
|
|
|
"ac3"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AAC,
|
|
|
|
"Reorder the input channels using the AAC order",
|
|
|
|
"aac"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MONO,
|
|
|
|
"Reorder and mix all input channels to a single mono channel",
|
|
|
|
"mono"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE,
|
|
|
|
"Reorder and mix all input channels to a single left and a single right stereo channels alternately",
|
|
|
|
"alternate"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
GType type = g_enum_register_static ("GstAudioConvertInputChannelsReorder",
|
|
|
|
reorder_types);
|
|
|
|
|
|
|
|
g_once_init_leave (&reorder_type, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return reorder_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE (gst_audio_convert_input_channels_reorder_mode_get_type ())
|
|
|
|
|
|
|
|
static GType
|
|
|
|
gst_audio_convert_input_channels_reorder_mode_get_type (void)
|
|
|
|
{
|
|
|
|
static GType reorder_mode_type = 0;
|
|
|
|
|
|
|
|
if (g_once_init_enter (&reorder_mode_type)) {
|
|
|
|
static GEnumValue reorder_mode_types[] = {
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_NONE,
|
|
|
|
"Never reorder the input channels",
|
|
|
|
"none"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_UNPOSITIONED,
|
|
|
|
"Reorder the input channels only if they are unpositioned",
|
|
|
|
"unpositioned"},
|
|
|
|
{GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_FORCE,
|
|
|
|
"Always reorder the input channels according to the selected configuration",
|
|
|
|
"force"},
|
|
|
|
{0, NULL, NULL},
|
|
|
|
};
|
|
|
|
|
|
|
|
GType type =
|
|
|
|
g_enum_register_static ("GstAudioConvertInputChannelsReorderMode",
|
|
|
|
reorder_mode_types);
|
|
|
|
|
|
|
|
g_once_init_leave (&reorder_mode_type, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
return reorder_mode_type;
|
|
|
|
}
|
|
|
|
|
2024-08-15 15:01:31 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_set_mix_matrix (GstAudioConvert * this, const GValue * value);
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_src_event (GstBaseTransform * trans, GstEvent * event)
|
|
|
|
{
|
|
|
|
gboolean ret = TRUE;
|
|
|
|
|
|
|
|
switch (GST_EVENT_TYPE (event)) {
|
|
|
|
case GST_EVENT_CUSTOM_UPSTREAM:
|
|
|
|
{
|
|
|
|
const GstStructure *s = gst_event_get_structure (event);
|
|
|
|
|
|
|
|
if (s && gst_structure_has_name (s, "GstRequestAudioMixMatrix")) {
|
|
|
|
const GValue *matrix = gst_structure_get_value (s, "matrix");
|
|
|
|
|
|
|
|
if (matrix) {
|
|
|
|
gst_audio_convert_set_mix_matrix (GST_AUDIO_CONVERT (trans), matrix);
|
|
|
|
g_object_notify (G_OBJECT (trans), "mix-matrix");
|
|
|
|
}
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->src_event (trans, event);
|
|
|
|
|
|
|
|
done:
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static void
|
2004-03-14 22:34:34 +00:00
|
|
|
gst_audio_convert_class_init (GstAudioConvertClass * klass)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
|
2011-04-19 09:35:53 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
2007-02-28 11:47:45 +00:00
|
|
|
GstBaseTransformClass *basetransform_class = GST_BASE_TRANSFORM_CLASS (klass);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
gobject_class->dispose = gst_audio_convert_dispose;
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
gobject_class->set_property = gst_audio_convert_set_property;
|
|
|
|
gobject_class->get_property = gst_audio_convert_get_property;
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
|
2015-04-27 10:26:10 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_DITHERING,
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
g_param_spec_enum ("dithering", "Dithering",
|
|
|
|
"Selects between different dithering methods.",
|
2015-11-06 11:10:48 +00:00
|
|
|
GST_TYPE_AUDIO_DITHER_METHOD, GST_AUDIO_DITHER_TPDF,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
|
2015-04-27 10:26:10 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_NOISE_SHAPING,
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
g_param_spec_enum ("noise-shaping", "Noise shaping",
|
|
|
|
"Selects between different noise shaping methods.",
|
2015-11-06 11:10:48 +00:00
|
|
|
GST_TYPE_AUDIO_NOISE_SHAPING_METHOD, GST_AUDIO_NOISE_SHAPING_NONE,
|
2008-03-22 15:00:53 +00:00
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
|
2023-10-20 13:21:03 +00:00
|
|
|
/**
|
|
|
|
* GstAudioConvert:mix-matrix:
|
|
|
|
*
|
|
|
|
* Transformation matrix for input/output channels.
|
|
|
|
* Required if the input channels are unpositioned and no standard layout can be determined.
|
|
|
|
* Setting an empty matrix like \"< >\" will generate an identity matrix."
|
|
|
|
*
|
|
|
|
*/
|
2017-08-15 00:39:54 +00:00
|
|
|
g_object_class_install_property (gobject_class, PROP_MIX_MATRIX,
|
|
|
|
gst_param_spec_array ("mix-matrix",
|
|
|
|
"Input/output channel matrix",
|
2023-10-20 13:21:03 +00:00
|
|
|
"Transformation matrix for input/output channels.",
|
2017-08-15 00:39:54 +00:00
|
|
|
gst_param_spec_array ("matrix-rows", "rows", "rows",
|
|
|
|
g_param_spec_float ("matrix-cols", "cols", "cols",
|
|
|
|
-1, 1, 0,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS),
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2022-02-16 16:49:52 +00:00
|
|
|
/**
|
|
|
|
* GstAudioConvert:dithering-threshold:
|
|
|
|
*
|
|
|
|
* Threshold for the output bit depth at/below which to apply dithering.
|
|
|
|
*
|
|
|
|
* Since: 1.22
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class, PROP_DITHERING_THRESHOLD,
|
|
|
|
g_param_spec_uint ("dithering-threshold", "Dithering Threshold",
|
|
|
|
"Threshold for the output bit depth at/below which to apply dithering.",
|
|
|
|
0, 32, 20, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
/**
|
|
|
|
* GstAudioConvert:input-channels-reorder:
|
|
|
|
*
|
|
|
|
* The positions configuration to use to reorder the input channels
|
|
|
|
* consecutively according to their index. If a `mix-matrix` is specified,
|
|
|
|
* this configuration is ignored.
|
|
|
|
*
|
|
|
|
* When the input channels reordering is activated (because the
|
|
|
|
* `input-channels-reorder-mode` property is
|
|
|
|
* @GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_FORCE or the input channels
|
|
|
|
* are unpositioned and the reorder mode is
|
|
|
|
* @GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_UNPOSITIONED), input
|
|
|
|
* channels will be reordered consecutively according to their index
|
|
|
|
* independently of the `channel-mask` value in the sink pad audio caps.
|
|
|
|
*
|
|
|
|
* Since: 1.26
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_INPUT_CHANNELS_REORDER,
|
|
|
|
g_param_spec_enum ("input-channels-reorder",
|
|
|
|
"Input Channels Reorder",
|
|
|
|
"The positions configuration to use to reorder the input channels consecutively according to their index.",
|
|
|
|
GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER,
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
gst_type_mark_as_plugin_api (GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER,
|
|
|
|
0);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* GstAudioConvert:input-channels-reorder-mode:
|
|
|
|
*
|
|
|
|
* The input channels reordering mode used to apply the selected positions
|
|
|
|
* configuration.
|
|
|
|
*
|
|
|
|
* Since: 1.26
|
|
|
|
*/
|
|
|
|
g_object_class_install_property (gobject_class,
|
|
|
|
PROP_INPUT_CHANNELS_REORDER_MODE,
|
|
|
|
g_param_spec_enum ("input-channels-reorder-mode",
|
|
|
|
"Input Channels Reorder Mode",
|
|
|
|
"The input channels reordering mode used to apply the selected positions configuration.",
|
|
|
|
GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE,
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_NONE,
|
|
|
|
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
|
|
gst_type_mark_as_plugin_api
|
|
|
|
(GST_TYPE_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE, 0);
|
|
|
|
|
2016-03-03 07:46:24 +00:00
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&gst_audio_convert_src_template);
|
|
|
|
gst_element_class_add_static_pad_template (element_class,
|
|
|
|
&gst_audio_convert_sink_template);
|
|
|
|
gst_element_class_set_static_metadata (element_class, "Audio converter",
|
|
|
|
"Filter/Converter/Audio", "Convert audio to different formats",
|
|
|
|
"Benjamin Otte <otte@gnome.org>");
|
2011-04-19 09:35:53 +00:00
|
|
|
|
2007-02-28 11:47:45 +00:00
|
|
|
basetransform_class->get_unit_size =
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_get_unit_size);
|
2007-02-28 11:47:45 +00:00
|
|
|
basetransform_class->transform_caps =
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_transform_caps);
|
2007-02-28 11:47:45 +00:00
|
|
|
basetransform_class->fixate_caps =
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_fixate_caps);
|
2007-02-28 11:47:45 +00:00
|
|
|
basetransform_class->set_caps =
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_set_caps);
|
2007-02-28 11:47:45 +00:00
|
|
|
basetransform_class->transform =
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_transform);
|
2016-10-19 10:21:37 +00:00
|
|
|
basetransform_class->transform_ip =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_transform_ip);
|
2015-06-04 15:59:17 +00:00
|
|
|
basetransform_class->transform_meta =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_transform_meta);
|
2015-10-24 17:05:10 +00:00
|
|
|
basetransform_class->submit_input_buffer =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_submit_input_buffer);
|
2018-02-01 16:08:51 +00:00
|
|
|
basetransform_class->prepare_output_buffer =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_prepare_output_buffer);
|
2024-08-15 15:01:31 +00:00
|
|
|
basetransform_class->src_event =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_audio_convert_src_event);
|
check/: Add extra tests for basetransform based components.
Original commit message from CVS:
* check/Makefile.am:
* check/pipelines/simple_launch_lines.c: (setup_pipeline),
(run_pipeline), (GST_START_TEST), (simple_launch_lines_suite):
Add extra tests for basetransform based components.
Comment out the test_element_negotiation test until we decide
if it's testing correct behaviour.
* ext/libvisual/visual.c: (gst_visual_init), (get_buffer),
(gst_visual_chain), (gst_visual_change_state):
Slightly more correct but still bogus timestamping.
Fix state change function.
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init):
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/gstffmpegcolorspace.c:
(gst_ffmpegcsp_class_init):
* gst/videoscale/gstvideoscale.c: (gst_videoscale_class_init),
(gst_videoscale_prepare_size), (gst_videoscale_set_caps),
(gst_videoscale_prepare_image):
* gst/volume/gstvolume.c: (gst_volume_class_init),
(volume_transform_ip):
Basetransform updates. Enable passthrough modes.
* sys/ximage/ximagesink.c: (gst_ximage_buffer_init),
(gst_ximagesink_renegotiate_size), (gst_ximagesink_xcontext_get),
(gst_ximagesink_setcaps), (gst_ximagesink_buffer_alloc):
Negotiation fix that allows the window to return to the original
size and renegotiate passthrough upstream. Extra debug output.
2005-09-09 17:53:47 +00:00
|
|
|
|
2016-11-30 08:36:14 +00:00
|
|
|
basetransform_class->transform_ip_on_passthrough = FALSE;
|
2019-06-14 08:14:23 +00:00
|
|
|
|
|
|
|
meta_tag_audio_quark = g_quark_from_static_string (GST_META_TAG_AUDIO_STR);
|
2004-01-12 19:46:45 +00:00
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
static void
|
2011-04-19 09:35:53 +00:00
|
|
|
gst_audio_convert_init (GstAudioConvert * this)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
2015-10-27 16:28:06 +00:00
|
|
|
this->dither = GST_AUDIO_DITHER_TPDF;
|
2022-02-16 16:49:52 +00:00
|
|
|
this->dither_threshold = 20;
|
2015-10-27 16:28:06 +00:00
|
|
|
this->ns = GST_AUDIO_NOISE_SHAPING_NONE;
|
2017-08-15 00:39:54 +00:00
|
|
|
g_value_init (&this->mix_matrix, GST_TYPE_ARRAY);
|
2008-03-21 15:58:44 +00:00
|
|
|
|
|
|
|
gst_base_transform_set_gap_aware (GST_BASE_TRANSFORM (this), TRUE);
|
Surround sound support.
Original commit message from CVS:
* ext/a52dec/gsta52dec.c: (gst_a52dec_channels), (gst_a52dec_push),
(gst_a52dec_reneg), (gst_a52dec_loop), (plugin_init):
* ext/alsa/gstalsa.c: (gst_alsa_get_caps):
* ext/alsa/gstalsaplugin.c: (plugin_init):
* ext/dts/gstdtsdec.c: (gst_dtsdec_channels),
(gst_dtsdec_renegotiate), (gst_dtsdec_loop), (plugin_init):
* ext/faad/gstfaad.c: (gst_faad_init), (gst_faad_chanpos_from_gst),
(gst_faad_chanpos_to_gst), (gst_faad_sinkconnect),
(gst_faad_srcgetcaps), (gst_faad_srcconnect), (gst_faad_chain),
(gst_faad_change_state), (plugin_init):
* ext/faad/gstfaad.h:
* ext/vorbis/vorbis.c: (plugin_init):
* ext/vorbis/vorbisdec.c: (vorbis_dec_chain):
* gst-libs/gst/audio/Makefile.am:
* gst-libs/gst/audio/audio.c: (plugin_init):
* gst-libs/gst/audio/multichannel.c:
(gst_audio_check_channel_positions),
(gst_audio_get_channel_positions),
(gst_audio_set_channel_positions),
(gst_audio_set_structure_channel_positions_list),
(add_list_to_struct), (gst_audio_set_caps_channel_positions_list),
(gst_audio_fixate_channel_positions):
* gst-libs/gst/audio/multichannel.h:
* gst-libs/gst/audio/testchannels.c: (main):
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_getcaps),
(gst_audio_convert_parse_caps), (gst_audio_convert_link),
(gst_audio_convert_fixate), (gst_audio_convert_channels):
* gst/audioconvert/plugin.c: (plugin_init):
Surround sound support.
2004-11-25 20:36:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_convert_dispose (GObject * obj)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (obj);
|
|
|
|
|
2015-12-16 09:44:16 +00:00
|
|
|
if (this->convert) {
|
2015-11-06 11:46:36 +00:00
|
|
|
gst_audio_converter_free (this->convert);
|
2015-12-16 09:44:16 +00:00
|
|
|
this->convert = NULL;
|
|
|
|
}
|
2005-08-25 17:32:34 +00:00
|
|
|
|
2017-08-15 00:39:54 +00:00
|
|
|
g_value_unset (&this->mix_matrix);
|
|
|
|
|
2004-11-27 14:41:51 +00:00
|
|
|
G_OBJECT_CLASS (parent_class)->dispose (obj);
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
/*** INPUT CHANNELS REORDER FUNCTIONS *****************************************/
|
|
|
|
|
|
|
|
typedef struct
|
|
|
|
{
|
|
|
|
gboolean has_stereo;
|
|
|
|
gboolean lfe_as_last_channel;
|
|
|
|
} GstAudioConvertInputChannelsReorderConfig;
|
|
|
|
|
|
|
|
static const GstAudioConvertInputChannelsReorderConfig
|
|
|
|
input_channels_reorder_config[] = {
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST
|
|
|
|
{TRUE, FALSE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_SMPTE
|
|
|
|
{TRUE, FALSE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_CINE
|
|
|
|
{TRUE, TRUE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AC3
|
|
|
|
{TRUE, TRUE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AAC
|
|
|
|
{TRUE, TRUE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MONO
|
|
|
|
{FALSE, FALSE},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE
|
|
|
|
{TRUE, FALSE}
|
|
|
|
};
|
|
|
|
|
|
|
|
#define GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_NB G_N_ELEMENTS (input_channels_reorder_config)
|
|
|
|
|
|
|
|
static const GstAudioChannelPosition
|
|
|
|
channel_position_per_reorder_config
|
|
|
|
[GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_NB][64] = {
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE2,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_SMPTE (see: https://www.sis.se/api/document/preview/919377/)
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // Left front (L)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // Right front (R)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, // Center front (C)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1, // Low frequency enhancement (LFE)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, // Left surround (Ls)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, // Right surround (Rs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, // Left front center (Lc)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, // Right front center (Rc)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT, // Rear surround left (Lsr)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT, // Rear surround right (Rsr)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, // Rear center (Cs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, // Left side surround (Lss)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, // Right side surround (Rss)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT, // Left wide front (Lw)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT, // Right wide front (Rw)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT, // Left front vertical height (Lv)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT, // Right front vertical height (Rv)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER, // Center front vertical height (Cv)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT, // Left surround vertical height rear (Lvr)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT, // Right surround vertical height rear (Rvr)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER, // Center vertical height rear (Cvr)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT, // Left vertical height side surround (Lvss)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT, // Right vertical height side surround (Rvss)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER, // Top center surround (Ts)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE2, // Low frequency enhancement 2 (LFE2)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT, // Left front vertical bottom (Lb)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT, // Right front vertical bottom (Rb)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER, // Center front vertical bottom (Cb)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Left vertical height surround (Lvs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Right vertical height surround (Rvs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Reserved
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Reserved
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Reserved
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Reserved
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Low frequency enhancement 3 (LFE3)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Left edge of screen (Leos)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Right edge of screen (Reos)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Half-way between center of screen and left edge of screen (Hwbcal)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Half-way between center of screen and right edge of screen (Hwbcar)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Left back surround (Lbs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID, // Right back surround (Rbs)
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_CINE
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, // C
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, // Ls
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, // Rs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, // Lc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, // Rc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT, // Lsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT, // Rsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, // Cs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER, // Ts
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT, // Lw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT, // Rw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT, // Lv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT, // Rv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER, // Cv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT, // Lvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT, // Rvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER, // Cvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, // Lss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, // Rss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT, // Lvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT, // Rvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT, // Lb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT, // Rb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER, // Cb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE2, // LFE2
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1, // LFE1
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AC3
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, // C
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, // Ls
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, // Rs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, // Lc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, // Rc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT, // Lsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT, // Rsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, // Cs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER, // Ts
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT, // Lw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT, // Rw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT, // Lv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT, // Rv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER, // Cv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT, // Lvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT, // Rvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER, // Cvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, // Lss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, // Rss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT, // Lvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT, // Rvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT, // Lb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT, // Rb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER, // Cb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE2, // LFE2
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1, // LFE1
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AAC
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER, // C
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT, // Ls
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT, // Rs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER, // Lc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER, // Rc
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_LEFT, // Lsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SURROUND_RIGHT, // Rsr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER, // Cs
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_CENTER, // Ts
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_LEFT, // Lw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_WIDE_RIGHT, // Rw
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_LEFT, // Lv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_RIGHT, // Rv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_FRONT_CENTER, // Cv
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_LEFT, // Lvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_RIGHT, // Rvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_REAR_CENTER, // Cvr
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT, // Lss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT, // Rss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_LEFT, // Lvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_TOP_SIDE_RIGHT, // Rvss
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_LEFT, // Lb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_RIGHT, // Rb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_BOTTOM_FRONT_CENTER, // Cb
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE2, // LFE2
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1, // LFE1
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_INVALID,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MONO
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO,
|
|
|
|
},
|
|
|
|
// GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT, // L
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT, // R
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
static const gchar *gst_audio_convert_input_channels_reorder_to_string
|
|
|
|
(GstAudioConvertInputChannelsReorder reorder)
|
|
|
|
{
|
|
|
|
switch (reorder) {
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST:
|
|
|
|
return "GST";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_SMPTE:
|
|
|
|
return "SMPTE";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_CINE:
|
|
|
|
return "CINE";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AC3:
|
|
|
|
return "AC3";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AAC:
|
|
|
|
return "AAC";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MONO:
|
|
|
|
return "MONO";
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE:
|
|
|
|
return "ALTERNATE";
|
|
|
|
default:
|
|
|
|
return "UNKNOWN";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_position_channels_from_reorder_configuration (gint channels,
|
|
|
|
GstAudioConvertInputChannelsReorder reorder,
|
|
|
|
GstAudioChannelPosition * position)
|
|
|
|
{
|
|
|
|
g_return_val_if_fail (channels > 0, FALSE);
|
|
|
|
g_return_val_if_fail (reorder >= 0
|
|
|
|
&& reorder < GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_NB, FALSE);
|
|
|
|
g_return_val_if_fail (position != NULL, FALSE);
|
|
|
|
|
|
|
|
GST_DEBUG ("ordering %d audio channel(s) according to the %s configuration",
|
|
|
|
channels, gst_audio_convert_input_channels_reorder_to_string (reorder));
|
|
|
|
|
|
|
|
if (channels == 1) {
|
|
|
|
position[0] = GST_AUDIO_CHANNEL_POSITION_MONO;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channels == 2 && input_channels_reorder_config[reorder].has_stereo) {
|
|
|
|
position[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
position[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
for (gint i = 0; i < channels; ++i) {
|
|
|
|
if (i < G_N_ELEMENTS (channel_position_per_reorder_config[reorder]))
|
|
|
|
position[i] = channel_position_per_reorder_config[reorder][i];
|
|
|
|
else
|
|
|
|
position[i] = GST_AUDIO_CHANNEL_POSITION_INVALID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (channels > 2
|
|
|
|
&& input_channels_reorder_config[reorder].lfe_as_last_channel) {
|
|
|
|
position[channels - 1] = GST_AUDIO_CHANNEL_POSITION_LFE1;
|
|
|
|
if (channels == 3 && input_channels_reorder_config[reorder].has_stereo) {
|
|
|
|
position[0] = GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT;
|
|
|
|
position[1] = GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2003-04-14 01:20:30 +00:00
|
|
|
/*** GSTREAMER FUNCTIONS ******************************************************/
|
|
|
|
|
2005-08-24 13:32:52 +00:00
|
|
|
/* BaseTransform vmethods */
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_get_unit_size (GstBaseTransform * base, GstCaps * caps,
|
2011-03-27 14:35:28 +00:00
|
|
|
gsize * size)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
2011-08-18 17:15:03 +00:00
|
|
|
GstAudioInfo info;
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2006-08-20 13:05:44 +00:00
|
|
|
g_assert (size);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
if (!gst_audio_info_from_caps (&info, caps))
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
goto parse_error;
|
2005-05-23 17:28:02 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
*size = info.bpf;
|
2023-12-18 09:28:18 +00:00
|
|
|
GST_DEBUG_OBJECT (base, "unit_size = %" G_GSIZE_FORMAT, *size);
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
|
2005-08-24 13:32:52 +00:00
|
|
|
return TRUE;
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
|
|
|
|
parse_error:
|
|
|
|
{
|
2023-12-18 09:28:18 +00:00
|
|
|
GST_WARNING_OBJECT (base, "failed to parse caps to get unit_size");
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
2005-08-24 13:32:52 +00:00
|
|
|
}
|
gst/: Don't ignore _push() return values.
Original commit message from CVS:
* gst/audioconvert/gstaudioconvert.c: (gst_audio_convert_chain),
(gst_audio_convert_caps_remove_format_info),
(gst_audio_convert_setcaps), (gst_audio_convert_fixate),
(gst_audio_convert_change_state), (gst_audio_convert_channels):
* gst/videotestsrc/gstvideotestsrc.c:
(gst_videotestsrc_src_negotiate), (gst_videotestsrc_src_link),
(gst_videotestsrc_parse_caps), (gst_videotestsrc_src_accept_caps),
(gst_videotestsrc_setcaps), (gst_videotestsrc_activate),
(gst_videotestsrc_init), (gst_videotestsrc_loop):
Don't ignore _push() return values.
Make sure no processing is done when shutting down.
Videotestsrc pad activation fix.
2005-05-05 09:49:08 +00:00
|
|
|
|
2017-08-14 22:20:40 +00:00
|
|
|
static gboolean
|
|
|
|
remove_format_from_structure (GstCapsFeatures * features,
|
|
|
|
GstStructure * structure, gpointer user_data G_GNUC_UNUSED)
|
2007-03-16 17:29:09 +00:00
|
|
|
{
|
2017-08-14 22:20:40 +00:00
|
|
|
gst_structure_remove_field (structure, "format");
|
|
|
|
return TRUE;
|
|
|
|
}
|
2012-07-25 12:55:56 +00:00
|
|
|
|
2018-02-01 16:08:51 +00:00
|
|
|
static gboolean
|
|
|
|
remove_layout_from_structure (GstCapsFeatures * features,
|
|
|
|
GstStructure * structure, gpointer user_data G_GNUC_UNUSED)
|
|
|
|
{
|
|
|
|
gst_structure_remove_field (structure, "layout");
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2017-08-14 22:20:40 +00:00
|
|
|
static gboolean
|
|
|
|
remove_channels_from_structure (GstCapsFeatures * features, GstStructure * s,
|
2017-08-15 00:39:54 +00:00
|
|
|
gpointer user_data)
|
2017-08-14 22:20:40 +00:00
|
|
|
{
|
|
|
|
guint64 mask;
|
|
|
|
gint channels;
|
2024-02-08 19:37:53 +00:00
|
|
|
gboolean force_removing = *(gboolean *) user_data;
|
2017-08-14 22:20:40 +00:00
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
/* Only remove the channels and channel-mask if a mix matrix was manually
|
|
|
|
* specified or an input channels reordering is applied, or if no
|
|
|
|
* channel-mask is specified, for non-NONE channel layouts or for a single
|
|
|
|
* channel layout.
|
2023-10-20 13:21:03 +00:00
|
|
|
*/
|
2024-02-08 19:37:53 +00:00
|
|
|
if (force_removing ||
|
2017-08-15 00:39:54 +00:00
|
|
|
!gst_structure_get (s, "channel-mask", GST_TYPE_BITMASK, &mask, NULL) ||
|
2017-08-14 22:20:40 +00:00
|
|
|
(mask != 0 || (gst_structure_get_int (s, "channels", &channels)
|
|
|
|
&& channels == 1))) {
|
|
|
|
gst_structure_remove_fields (s, "channel-mask", "channels", NULL);
|
2008-05-06 12:12:16 +00:00
|
|
|
}
|
|
|
|
|
2017-08-14 22:20:40 +00:00
|
|
|
return TRUE;
|
2008-05-06 12:12:16 +00:00
|
|
|
}
|
|
|
|
|
2017-08-15 00:39:54 +00:00
|
|
|
static gboolean
|
|
|
|
add_other_channels_to_structure (GstCapsFeatures * features, GstStructure * s,
|
|
|
|
gpointer user_data)
|
|
|
|
{
|
|
|
|
gint other_channels = GPOINTER_TO_INT (user_data);
|
|
|
|
|
|
|
|
gst_structure_set (s, "channels", G_TYPE_INT, other_channels, NULL);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
/* The caps can be transformed into any other caps with format info removed.
|
|
|
|
* However, we should prefer passthrough, so if passthrough is possible,
|
|
|
|
* put it first in the list. */
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static GstCaps *
|
2011-08-18 17:15:03 +00:00
|
|
|
gst_audio_convert_transform_caps (GstBaseTransform * btrans,
|
2011-05-16 08:56:11 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * filter)
|
2005-08-24 13:32:52 +00:00
|
|
|
{
|
2011-08-18 17:15:03 +00:00
|
|
|
GstCaps *tmp, *tmp2;
|
|
|
|
GstCaps *result;
|
2017-08-15 00:39:54 +00:00
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (btrans);
|
2006-05-29 11:04:48 +00:00
|
|
|
|
2017-08-14 22:20:40 +00:00
|
|
|
tmp = gst_caps_copy (caps);
|
|
|
|
|
|
|
|
gst_caps_map_in_place (tmp, remove_format_from_structure, NULL);
|
2018-02-01 16:08:51 +00:00
|
|
|
gst_caps_map_in_place (tmp, remove_layout_from_structure, NULL);
|
2024-02-08 19:37:53 +00:00
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
2024-02-08 19:37:53 +00:00
|
|
|
gboolean force_removing = this->mix_matrix_is_set
|
|
|
|
|| (direction == GST_PAD_SINK
|
|
|
|
&& this->input_channels_reorder_mode !=
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_NONE);
|
|
|
|
gst_caps_map_in_place (tmp, remove_channels_from_structure, &force_removing);
|
2017-08-15 00:39:54 +00:00
|
|
|
|
|
|
|
/* We can infer the required input / output channels based on the
|
|
|
|
* matrix dimensions */
|
|
|
|
if (gst_value_array_get_size (&this->mix_matrix)) {
|
|
|
|
gint other_channels;
|
|
|
|
|
|
|
|
if (direction == GST_PAD_SRC) {
|
|
|
|
const GValue *first_row =
|
|
|
|
gst_value_array_get_value (&this->mix_matrix, 0);
|
|
|
|
other_channels = gst_value_array_get_size (first_row);
|
|
|
|
} else {
|
|
|
|
other_channels = gst_value_array_get_size (&this->mix_matrix);
|
|
|
|
}
|
|
|
|
|
|
|
|
gst_caps_map_in_place (tmp, add_other_channels_to_structure,
|
|
|
|
GINT_TO_POINTER (other_channels));
|
|
|
|
}
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_UNLOCK (this);
|
2006-05-29 11:04:48 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
if (filter) {
|
|
|
|
tmp2 = gst_caps_intersect_full (filter, tmp, GST_CAPS_INTERSECT_FIRST);
|
|
|
|
gst_caps_unref (tmp);
|
|
|
|
tmp = tmp2;
|
2011-05-27 10:13:14 +00:00
|
|
|
}
|
2006-05-29 11:04:48 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
result = tmp;
|
2007-03-16 16:42:23 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
GST_DEBUG_OBJECT (btrans, "transformed %" GST_PTR_FORMAT " into %"
|
|
|
|
GST_PTR_FORMAT, caps, result);
|
2011-05-16 08:56:11 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
return result;
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2016-10-14 20:31:41 +00:00
|
|
|
/* Count the number of bits set
|
|
|
|
* Optimized for the common case, assuming that the number of channels
|
|
|
|
* (i.e. bits set) is small
|
|
|
|
*/
|
2011-12-19 11:41:24 +00:00
|
|
|
static gint
|
|
|
|
n_bits_set (guint64 x)
|
2007-10-31 17:54:48 +00:00
|
|
|
{
|
2016-10-14 20:31:41 +00:00
|
|
|
gint c;
|
|
|
|
|
|
|
|
for (c = 0; x; c++)
|
|
|
|
x &= x - 1;
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
return c;
|
|
|
|
}
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2016-10-14 20:31:41 +00:00
|
|
|
/* Reduce the mask to the n_chans lowest set bits
|
|
|
|
*
|
|
|
|
* The algorithm clears the n_chans lowest set bits and subtracts the
|
|
|
|
* result from the original mask to get the desired mask.
|
|
|
|
* It is optimized for the common case where n_chans is a small
|
|
|
|
* number. In the worst case, however, it stops after 64 iterations.
|
|
|
|
*/
|
2011-12-19 11:41:24 +00:00
|
|
|
static guint64
|
|
|
|
find_suitable_mask (guint64 mask, gint n_chans)
|
|
|
|
{
|
2016-10-14 20:31:41 +00:00
|
|
|
guint64 x = mask;
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2016-10-14 20:31:41 +00:00
|
|
|
for (; x && n_chans; n_chans--)
|
|
|
|
x &= x - 1;
|
2011-12-19 11:41:24 +00:00
|
|
|
|
2016-10-14 20:31:41 +00:00
|
|
|
g_assert (x || n_chans == 0);
|
|
|
|
/* assertion fails if mask contained less bits than n_chans
|
|
|
|
* or n_chans was < 0 */
|
2011-12-19 11:41:24 +00:00
|
|
|
|
2016-10-14 20:31:41 +00:00
|
|
|
return mask - x;
|
2007-10-31 17:54:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-18 20:13:09 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_fixate_format (GstBaseTransform * base, GstStructure * ins,
|
|
|
|
GstStructure * outs)
|
|
|
|
{
|
|
|
|
const gchar *in_format;
|
|
|
|
const GValue *format;
|
|
|
|
const GstAudioFormatInfo *in_info, *out_info = NULL;
|
2013-08-23 16:51:59 +00:00
|
|
|
GstAudioFormatFlags in_flags, out_flags = 0;
|
2013-08-23 18:05:41 +00:00
|
|
|
gint in_depth, out_depth = -1;
|
2013-08-23 17:52:44 +00:00
|
|
|
gint i, len;
|
2012-10-18 20:13:09 +00:00
|
|
|
|
|
|
|
in_format = gst_structure_get_string (ins, "format");
|
|
|
|
if (!in_format)
|
|
|
|
return;
|
|
|
|
|
|
|
|
format = gst_structure_get_value (outs, "format");
|
|
|
|
/* should not happen */
|
|
|
|
if (format == NULL)
|
|
|
|
return;
|
|
|
|
|
2013-08-23 17:52:44 +00:00
|
|
|
/* nothing to fixate? */
|
|
|
|
if (!GST_VALUE_HOLDS_LIST (format))
|
|
|
|
return;
|
|
|
|
|
2012-10-18 20:13:09 +00:00
|
|
|
in_info =
|
|
|
|
gst_audio_format_get_info (gst_audio_format_from_string (in_format));
|
|
|
|
if (!in_info)
|
|
|
|
return;
|
|
|
|
|
2012-10-31 19:01:05 +00:00
|
|
|
in_flags = GST_AUDIO_FORMAT_INFO_FLAGS (in_info);
|
|
|
|
in_flags &= ~(GST_AUDIO_FORMAT_FLAG_UNPACK);
|
2012-11-01 13:31:29 +00:00
|
|
|
in_flags &= ~(GST_AUDIO_FORMAT_FLAG_SIGNED);
|
2012-10-31 19:01:05 +00:00
|
|
|
|
2013-08-23 18:05:41 +00:00
|
|
|
in_depth = GST_AUDIO_FORMAT_INFO_DEPTH (in_info);
|
|
|
|
|
2013-08-23 17:52:44 +00:00
|
|
|
len = gst_value_list_get_size (format);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
const GstAudioFormatInfo *t_info;
|
|
|
|
GstAudioFormatFlags t_flags;
|
2013-08-23 18:47:57 +00:00
|
|
|
gboolean t_flags_better;
|
2013-08-23 17:52:44 +00:00
|
|
|
const GValue *val;
|
|
|
|
const gchar *fname;
|
2013-08-23 18:05:41 +00:00
|
|
|
gint t_depth;
|
2013-08-23 17:52:44 +00:00
|
|
|
|
|
|
|
val = gst_value_list_get_value (format, i);
|
|
|
|
if (!G_VALUE_HOLDS_STRING (val))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
fname = g_value_get_string (val);
|
|
|
|
t_info = gst_audio_format_get_info (gst_audio_format_from_string (fname));
|
|
|
|
if (!t_info)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* accept input format immediately */
|
|
|
|
if (strcmp (fname, in_format) == 0) {
|
|
|
|
out_info = t_info;
|
|
|
|
break;
|
2012-10-18 20:13:09 +00:00
|
|
|
}
|
2013-08-23 17:52:44 +00:00
|
|
|
|
|
|
|
t_flags = GST_AUDIO_FORMAT_INFO_FLAGS (t_info);
|
|
|
|
t_flags &= ~(GST_AUDIO_FORMAT_FLAG_UNPACK);
|
|
|
|
t_flags &= ~(GST_AUDIO_FORMAT_FLAG_SIGNED);
|
|
|
|
|
2013-08-23 18:05:41 +00:00
|
|
|
t_depth = GST_AUDIO_FORMAT_INFO_DEPTH (t_info);
|
|
|
|
|
2013-08-23 18:41:32 +00:00
|
|
|
/* Any output format is better than no output format at all */
|
|
|
|
if (!out_info) {
|
|
|
|
out_info = t_info;
|
|
|
|
out_depth = t_depth;
|
|
|
|
out_flags = t_flags;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2013-08-23 18:47:57 +00:00
|
|
|
t_flags_better = (t_flags == in_flags && out_flags != in_flags);
|
|
|
|
|
|
|
|
if (t_depth == in_depth && (out_depth != in_depth || t_flags_better)) {
|
2013-08-23 17:52:44 +00:00
|
|
|
/* Prefer to use the first format that has the same depth with the same
|
|
|
|
* flags, and if none with the same flags exist use the first other one
|
|
|
|
* that has the same depth */
|
|
|
|
out_info = t_info;
|
2013-08-23 18:05:41 +00:00
|
|
|
out_depth = t_depth;
|
2013-08-23 17:52:44 +00:00
|
|
|
out_flags = t_flags;
|
2013-08-23 18:41:32 +00:00
|
|
|
} else if (t_depth >= in_depth && (in_depth > out_depth
|
2013-08-23 18:47:57 +00:00
|
|
|
|| (out_depth >= in_depth && t_flags_better))) {
|
2013-08-23 17:52:44 +00:00
|
|
|
/* Otherwise use the first format that has a higher depth with the same flags,
|
|
|
|
* if none with the same flags exist use the first other one that has a higher
|
|
|
|
* depth */
|
|
|
|
out_info = t_info;
|
2013-08-23 18:05:41 +00:00
|
|
|
out_depth = t_depth;
|
2013-08-23 17:52:44 +00:00
|
|
|
out_flags = t_flags;
|
2013-08-23 18:41:32 +00:00
|
|
|
} else if ((t_depth > out_depth && out_depth < in_depth)
|
2013-08-23 18:47:57 +00:00
|
|
|
|| (t_flags_better && out_depth == t_depth)) {
|
2013-08-23 17:52:44 +00:00
|
|
|
/* Else get at least the one with the highest depth, ideally with the same flags */
|
|
|
|
out_info = t_info;
|
2013-08-23 18:05:41 +00:00
|
|
|
out_depth = t_depth;
|
2013-08-23 17:52:44 +00:00
|
|
|
out_flags = t_flags;
|
|
|
|
}
|
|
|
|
|
2012-10-18 20:13:09 +00:00
|
|
|
}
|
2013-08-23 17:52:44 +00:00
|
|
|
|
|
|
|
if (out_info)
|
|
|
|
gst_structure_set (outs, "format", G_TYPE_STRING,
|
|
|
|
GST_AUDIO_FORMAT_INFO_NAME (out_info), NULL);
|
2012-10-18 20:13:09 +00:00
|
|
|
}
|
|
|
|
|
2007-10-31 17:54:48 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_fixate_channels (GstBaseTransform * base, GstStructure * ins,
|
|
|
|
GstStructure * outs)
|
|
|
|
{
|
|
|
|
gint in_chans, out_chans;
|
2011-12-19 11:41:24 +00:00
|
|
|
guint64 in_mask = 0, out_mask = 0;
|
|
|
|
gboolean has_in_mask = FALSE, has_out_mask = FALSE;
|
2007-10-31 17:54:48 +00:00
|
|
|
|
|
|
|
if (!gst_structure_get_int (ins, "channels", &in_chans))
|
|
|
|
return; /* this shouldn't really happen, should it? */
|
|
|
|
|
|
|
|
if (!gst_structure_has_field (outs, "channels")) {
|
|
|
|
/* we could try to get the implied number of channels from the layout,
|
|
|
|
* but that seems overdoing it for a somewhat exotic corner case */
|
2011-12-19 11:41:24 +00:00
|
|
|
gst_structure_remove_field (outs, "channel-mask");
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* ok, let's fixate the channels if they are not fixated yet */
|
|
|
|
gst_structure_fixate_field_nearest_int (outs, "channels", in_chans);
|
|
|
|
|
|
|
|
if (!gst_structure_get_int (outs, "channels", &out_chans)) {
|
|
|
|
/* shouldn't really happen ... */
|
2011-12-19 11:41:24 +00:00
|
|
|
gst_structure_remove_field (outs, "channel-mask");
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
/* get the channel layout of the output if any */
|
|
|
|
has_out_mask = gst_structure_has_field (outs, "channel-mask");
|
|
|
|
if (has_out_mask) {
|
|
|
|
gst_structure_get (outs, "channel-mask", GST_TYPE_BITMASK, &out_mask, NULL);
|
|
|
|
} else {
|
|
|
|
/* channels == 1 => MONO */
|
|
|
|
if (out_chans == 2) {
|
|
|
|
out_mask =
|
2012-01-04 09:26:33 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_LEFT) |
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_RIGHT);
|
2011-12-19 11:41:24 +00:00
|
|
|
has_out_mask = TRUE;
|
2012-01-04 09:26:33 +00:00
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, out_mask,
|
|
|
|
NULL);
|
2011-12-19 11:41:24 +00:00
|
|
|
}
|
|
|
|
}
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2008-05-20 12:15:34 +00:00
|
|
|
/* get the channel layout of the input if any */
|
2011-12-19 11:41:24 +00:00
|
|
|
has_in_mask = gst_structure_has_field (ins, "channel-mask");
|
|
|
|
if (has_in_mask) {
|
|
|
|
gst_structure_get (ins, "channel-mask", GST_TYPE_BITMASK, &in_mask, NULL);
|
|
|
|
} else {
|
|
|
|
/* channels == 1 => MONO */
|
|
|
|
if (in_chans == 2) {
|
|
|
|
in_mask =
|
2012-01-04 09:26:33 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_LEFT) |
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_MASK (FRONT_RIGHT);
|
2011-12-19 11:41:24 +00:00
|
|
|
has_in_mask = TRUE;
|
|
|
|
} else if (in_chans > 2)
|
|
|
|
g_warning ("%s: Upstream caps contain no channel mask",
|
|
|
|
GST_ELEMENT_NAME (base));
|
2007-10-31 17:54:48 +00:00
|
|
|
}
|
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
if (!has_out_mask && out_chans == 1 && (in_chans != out_chans
|
|
|
|
|| !has_in_mask))
|
|
|
|
return; /* nothing to do, default layout will be assumed */
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
if (in_chans == out_chans && (has_in_mask || in_chans == 1)) {
|
2007-10-31 17:54:48 +00:00
|
|
|
/* same number of channels and no output layout: just use input layout */
|
2011-12-19 11:41:24 +00:00
|
|
|
if (!has_out_mask) {
|
|
|
|
/* in_chans == 1 handled above already */
|
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, in_mask, NULL);
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
/* If both masks are the same we're done, this includes the NONE layout case */
|
|
|
|
if (in_mask == out_mask)
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
/* if output layout is fixed already and looks sane, we're done */
|
|
|
|
if (n_bits_set (out_mask) == out_chans)
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
|
2011-12-19 11:41:24 +00:00
|
|
|
if (n_bits_set (out_mask) < in_chans) {
|
|
|
|
/* Not much we can do here, this shouldn't just happen */
|
|
|
|
g_warning ("%s: Invalid downstream channel-mask with too few bits set",
|
|
|
|
GST_ELEMENT_NAME (base));
|
|
|
|
} else {
|
|
|
|
guint64 intersection;
|
|
|
|
|
|
|
|
/* if the output layout is not fixed, check if the output layout contains
|
|
|
|
* the input layout */
|
|
|
|
intersection = in_mask & out_mask;
|
|
|
|
if (n_bits_set (intersection) >= in_chans) {
|
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, in_mask,
|
|
|
|
NULL);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* output layout is not fixed and does not contain the input layout, so
|
|
|
|
* just pick the first possibility */
|
|
|
|
intersection = find_suitable_mask (out_mask, out_chans);
|
|
|
|
if (intersection) {
|
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, intersection,
|
|
|
|
NULL);
|
|
|
|
return;
|
|
|
|
}
|
2007-10-31 17:54:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ... else fall back to default layout (NB: out_layout is NULL here) */
|
|
|
|
GST_WARNING_OBJECT (base, "unexpected output channel layout");
|
2011-12-19 11:41:24 +00:00
|
|
|
} else {
|
|
|
|
guint64 intersection;
|
|
|
|
|
|
|
|
/* number of input channels != number of output channels:
|
|
|
|
* if this value contains a list of channel layouts (or even worse: a list
|
|
|
|
* with another list), just pick the first value and repeat until we find a
|
|
|
|
* channel position array or something else that's not a list; we assume
|
|
|
|
* the input if half-way sane and don't try to fall back on other list items
|
|
|
|
* if the first one is something unexpected or non-channel-pos-array-y */
|
|
|
|
if (n_bits_set (out_mask) >= out_chans) {
|
|
|
|
intersection = find_suitable_mask (out_mask, out_chans);
|
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, intersection,
|
|
|
|
NULL);
|
2007-10-31 17:54:48 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* what now?! Just ignore what we're given and use default positions */
|
|
|
|
GST_WARNING_OBJECT (base, "invalid or unexpected channel-positions");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* missing or invalid output layout and we can't use the input layout for
|
|
|
|
* one reason or another, so just pick a default layout (we could be smarter
|
|
|
|
* and try to add/remove channels from the input layout, or pick a default
|
|
|
|
* layout based on LFE-presence in input layout, but let's save that for
|
2016-06-29 16:14:51 +00:00
|
|
|
* another day). For mono, no mask is required and the fallback mask is 0 */
|
|
|
|
if (out_chans > 1
|
2015-11-05 11:42:56 +00:00
|
|
|
&& (out_mask = gst_audio_channel_get_fallback_mask (out_chans))) {
|
2007-10-31 17:54:48 +00:00
|
|
|
GST_DEBUG_OBJECT (base, "using default channel layout as fallback");
|
2011-12-19 11:41:24 +00:00
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK, out_mask, NULL);
|
2016-06-29 16:14:51 +00:00
|
|
|
} else if (out_chans > 1) {
|
2011-12-19 11:41:24 +00:00
|
|
|
GST_ERROR_OBJECT (base, "Have no default layout for %d channels",
|
|
|
|
out_chans);
|
2022-05-03 10:37:31 +00:00
|
|
|
gst_structure_set (outs, "channel-mask", GST_TYPE_BITMASK,
|
|
|
|
G_GUINT64_CONSTANT (0), NULL);
|
2007-10-31 17:54:48 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-08-24 13:32:52 +00:00
|
|
|
/* try to keep as many of the structure members the same by fixating the
|
|
|
|
* possible ranges; this way we convert the least amount of things as possible
|
|
|
|
*/
|
2012-02-22 11:27:49 +00:00
|
|
|
static GstCaps *
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
gst_audio_convert_fixate_caps (GstBaseTransform * base,
|
2005-08-24 13:32:52 +00:00
|
|
|
GstPadDirection direction, GstCaps * caps, GstCaps * othercaps)
|
2004-01-15 21:05:17 +00:00
|
|
|
{
|
2005-08-24 13:32:52 +00:00
|
|
|
GstStructure *ins, *outs;
|
2012-02-27 11:52:07 +00:00
|
|
|
GstCaps *result;
|
2005-08-24 13:32:52 +00:00
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (base, "trying to fixate othercaps %" GST_PTR_FORMAT
|
|
|
|
" based on caps %" GST_PTR_FORMAT, othercaps, caps);
|
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
result = gst_caps_intersect (othercaps, caps);
|
|
|
|
if (gst_caps_is_empty (result)) {
|
2017-08-14 22:20:40 +00:00
|
|
|
GstCaps *removed = gst_caps_copy (caps);
|
2012-07-25 12:55:56 +00:00
|
|
|
|
2012-03-30 14:56:40 +00:00
|
|
|
if (result)
|
|
|
|
gst_caps_unref (result);
|
2017-08-14 22:20:40 +00:00
|
|
|
gst_caps_map_in_place (removed, remove_format_from_structure, NULL);
|
2018-09-29 08:39:46 +00:00
|
|
|
gst_caps_map_in_place (removed, remove_layout_from_structure, NULL);
|
2012-07-25 12:55:56 +00:00
|
|
|
result = gst_caps_intersect (othercaps, removed);
|
|
|
|
gst_caps_unref (removed);
|
|
|
|
if (gst_caps_is_empty (result)) {
|
|
|
|
if (result)
|
|
|
|
gst_caps_unref (result);
|
|
|
|
result = othercaps;
|
2012-09-06 11:58:28 +00:00
|
|
|
} else {
|
|
|
|
gst_caps_unref (othercaps);
|
2012-07-25 12:55:56 +00:00
|
|
|
}
|
2012-02-27 11:52:07 +00:00
|
|
|
} else {
|
|
|
|
gst_caps_unref (othercaps);
|
|
|
|
}
|
2005-08-24 13:32:52 +00:00
|
|
|
|
2012-07-25 12:55:56 +00:00
|
|
|
GST_DEBUG_OBJECT (base, "now fixating %" GST_PTR_FORMAT, result);
|
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
/* fixate remaining fields */
|
|
|
|
result = gst_caps_make_writable (result);
|
2007-10-31 17:54:48 +00:00
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
ins = gst_caps_get_structure (caps, 0);
|
|
|
|
outs = gst_caps_get_structure (result, 0);
|
2011-08-18 17:15:03 +00:00
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
gst_audio_convert_fixate_channels (base, ins, outs);
|
2012-10-18 20:13:09 +00:00
|
|
|
gst_audio_convert_fixate_format (base, ins, outs);
|
|
|
|
|
|
|
|
/* fixate remaining */
|
2012-03-11 18:04:41 +00:00
|
|
|
result = gst_caps_fixate (result);
|
2011-11-10 14:24:30 +00:00
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
GST_DEBUG_OBJECT (base, "fixated othercaps to %" GST_PTR_FORMAT, result);
|
2012-02-22 11:27:49 +00:00
|
|
|
|
2012-02-27 11:52:07 +00:00
|
|
|
return result;
|
2005-03-31 09:43:49 +00:00
|
|
|
}
|
|
|
|
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static gboolean
|
2024-08-14 14:09:06 +00:00
|
|
|
gst_audio_convert_ensure_converter (GstBaseTransform * base,
|
|
|
|
GstAudioInfo * in_info, GstAudioInfo * out_info)
|
2005-03-31 09:43:49 +00:00
|
|
|
{
|
2005-08-24 13:32:52 +00:00
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (base);
|
2017-08-15 00:39:54 +00:00
|
|
|
GstStructure *config;
|
2024-08-14 14:09:06 +00:00
|
|
|
gboolean in_place;
|
|
|
|
gboolean ret = TRUE;
|
2004-03-14 22:34:34 +00:00
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
2015-11-06 11:10:48 +00:00
|
|
|
if (this->convert) {
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_TRACE_OBJECT (this, "We already have a converter");
|
|
|
|
goto done;
|
2015-11-06 11:10:48 +00:00
|
|
|
}
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
if (!GST_AUDIO_INFO_IS_VALID (in_info) || !GST_AUDIO_INFO_IS_VALID (out_info)) {
|
|
|
|
GST_LOG_OBJECT (this,
|
|
|
|
"No format information (yet), not creating converter");
|
|
|
|
goto done;
|
|
|
|
}
|
2005-08-24 13:32:52 +00:00
|
|
|
|
2017-08-15 00:39:54 +00:00
|
|
|
config = gst_structure_new ("GstAudioConverterConfig",
|
|
|
|
GST_AUDIO_CONVERTER_OPT_DITHER_METHOD, GST_TYPE_AUDIO_DITHER_METHOD,
|
|
|
|
this->dither,
|
2022-02-16 16:49:52 +00:00
|
|
|
GST_AUDIO_CONVERTER_OPT_DITHER_THRESHOLD, G_TYPE_UINT,
|
|
|
|
this->dither_threshold,
|
2017-08-15 00:39:54 +00:00
|
|
|
GST_AUDIO_CONVERTER_OPT_NOISE_SHAPING_METHOD,
|
|
|
|
GST_TYPE_AUDIO_NOISE_SHAPING_METHOD, this->ns, NULL);
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
if (this->mix_matrix_is_set) {
|
2017-08-15 00:39:54 +00:00
|
|
|
gst_structure_set_value (config, GST_AUDIO_CONVERTER_OPT_MIX_MATRIX,
|
|
|
|
&this->mix_matrix);
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
this->convert = gst_audio_converter_new (0, in_info, out_info, config);
|
2024-02-08 19:37:53 +00:00
|
|
|
} else if (this->input_channels_reorder_mode !=
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_NONE) {
|
|
|
|
GstAudioFlags in_flags;
|
|
|
|
GstAudioChannelPosition in_position[64];
|
|
|
|
gboolean restore_in = FALSE;
|
|
|
|
|
|
|
|
if (this->input_channels_reorder_mode ==
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_FORCE
|
2024-08-14 14:09:06 +00:00
|
|
|
|| GST_AUDIO_INFO_IS_UNPOSITIONED (in_info)) {
|
|
|
|
in_flags = GST_AUDIO_INFO_FLAGS (in_info);
|
|
|
|
memcpy (in_position, in_info->position,
|
|
|
|
GST_AUDIO_INFO_CHANNELS (in_info) * sizeof (GstAudioChannelPosition));
|
2024-02-08 19:37:53 +00:00
|
|
|
|
|
|
|
if (gst_audio_convert_position_channels_from_reorder_configuration
|
2024-08-14 14:09:06 +00:00
|
|
|
(GST_AUDIO_INFO_CHANNELS (in_info), this->input_channels_reorder,
|
|
|
|
in_info->position)) {
|
|
|
|
GST_AUDIO_INFO_FLAGS (in_info) &= ~GST_AUDIO_FLAG_UNPOSITIONED;
|
2024-02-08 19:37:53 +00:00
|
|
|
restore_in = TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
this->convert = gst_audio_converter_new (0, in_info, out_info, config);
|
2024-02-08 19:37:53 +00:00
|
|
|
|
|
|
|
if (restore_in) {
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_AUDIO_INFO_FLAGS (in_info) = in_flags;
|
|
|
|
memcpy (in_info->position, in_position,
|
|
|
|
GST_AUDIO_INFO_CHANNELS (in_info) * sizeof (GstAudioChannelPosition));
|
2024-02-08 19:37:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
2024-08-14 14:09:06 +00:00
|
|
|
this->convert = gst_audio_converter_new (0, in_info, out_info, config);
|
2024-02-08 19:37:53 +00:00
|
|
|
}
|
2015-11-06 11:10:48 +00:00
|
|
|
|
|
|
|
if (this->convert == NULL)
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
goto no_converter;
|
2005-08-24 13:32:52 +00:00
|
|
|
|
2017-01-02 12:26:36 +00:00
|
|
|
in_place = gst_audio_converter_supports_inplace (this->convert);
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_UNLOCK (this);
|
|
|
|
|
2017-01-02 12:26:36 +00:00
|
|
|
gst_base_transform_set_in_place (base, in_place);
|
|
|
|
|
2018-12-17 12:33:56 +00:00
|
|
|
gst_base_transform_set_passthrough (base,
|
|
|
|
gst_audio_converter_is_passthrough (this->convert));
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_LOCK (this);
|
2015-11-06 11:10:48 +00:00
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
done:
|
|
|
|
GST_OBJECT_UNLOCK (this);
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
no_converter:
|
|
|
|
GST_ERROR_OBJECT (this, "Failed to make converter");
|
|
|
|
ret = FALSE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_set_caps (GstBaseTransform * base, GstCaps * incaps,
|
|
|
|
GstCaps * outcaps)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (base);
|
|
|
|
GstAudioInfo in_info;
|
|
|
|
GstAudioInfo out_info;
|
|
|
|
gboolean ret;
|
|
|
|
|
|
|
|
GST_DEBUG_OBJECT (base, "incaps %" GST_PTR_FORMAT ", outcaps %"
|
|
|
|
GST_PTR_FORMAT, incaps, outcaps);
|
|
|
|
|
|
|
|
if (this->convert) {
|
|
|
|
gst_audio_converter_free (this->convert);
|
|
|
|
this->convert = NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!gst_audio_info_from_caps (&in_info, incaps))
|
|
|
|
goto invalid_in;
|
|
|
|
if (!gst_audio_info_from_caps (&out_info, outcaps))
|
|
|
|
goto invalid_out;
|
|
|
|
|
|
|
|
ret = gst_audio_convert_ensure_converter (base, &in_info, &out_info);
|
|
|
|
|
|
|
|
if (ret) {
|
|
|
|
this->in_info = in_info;
|
|
|
|
this->out_info = out_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
return ret;
|
2005-03-31 09:43:49 +00:00
|
|
|
|
2011-08-18 17:15:03 +00:00
|
|
|
/* ERRORS */
|
|
|
|
invalid_in:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (base, "invalid input caps");
|
2024-08-14 14:09:06 +00:00
|
|
|
ret = FALSE;
|
|
|
|
goto done;
|
2011-08-18 17:15:03 +00:00
|
|
|
}
|
|
|
|
invalid_out:
|
|
|
|
{
|
|
|
|
GST_ERROR_OBJECT (base, "invalid output caps");
|
2024-08-14 14:09:06 +00:00
|
|
|
ret = FALSE;
|
|
|
|
goto done;
|
2004-05-25 20:14:10 +00:00
|
|
|
}
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
2003-07-19 22:58:41 +00:00
|
|
|
|
2016-10-19 10:21:37 +00:00
|
|
|
/* if called through gst_audio_convert_transform_ip() inbuf == outbuf */
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_convert_transform (GstBaseTransform * base, GstBuffer * inbuf,
|
|
|
|
GstBuffer * outbuf)
|
2003-04-14 01:20:30 +00:00
|
|
|
{
|
2011-03-27 14:35:28 +00:00
|
|
|
GstFlowReturn ret;
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (base);
|
2018-02-01 16:08:51 +00:00
|
|
|
GstAudioBuffer srcabuf, dstabuf;
|
2013-10-04 11:57:51 +00:00
|
|
|
gboolean inbuf_writable;
|
2015-11-06 11:10:48 +00:00
|
|
|
GstAudioConverterFlags flags;
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
|
2018-02-01 16:08:51 +00:00
|
|
|
/* https://bugzilla.gnome.org/show_bug.cgi?id=396835 */
|
|
|
|
if (gst_buffer_get_size (inbuf) == 0)
|
2007-01-30 11:29:17 +00:00
|
|
|
return GST_FLOW_OK;
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
gst_audio_convert_ensure_converter (base, &this->in_info, &this->out_info);
|
|
|
|
|
|
|
|
if (!this->convert) {
|
|
|
|
GST_ERROR_OBJECT (this, "No audio converter at transform time");
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
|
2016-11-30 08:48:40 +00:00
|
|
|
if (inbuf != outbuf) {
|
|
|
|
inbuf_writable = gst_buffer_is_writable (inbuf)
|
|
|
|
&& gst_buffer_n_memory (inbuf) == 1
|
|
|
|
&& gst_memory_is_writable (gst_buffer_peek_memory (inbuf, 0));
|
|
|
|
|
2018-02-01 16:08:51 +00:00
|
|
|
if (!gst_audio_buffer_map (&srcabuf, &this->in_info, inbuf,
|
2016-11-30 08:55:16 +00:00
|
|
|
inbuf_writable ? GST_MAP_READWRITE : GST_MAP_READ))
|
|
|
|
goto inmap_error;
|
2016-11-30 08:48:40 +00:00
|
|
|
} else {
|
|
|
|
inbuf_writable = TRUE;
|
|
|
|
}
|
2011-03-27 14:35:28 +00:00
|
|
|
|
2018-02-01 16:08:51 +00:00
|
|
|
if (!gst_audio_buffer_map (&dstabuf, &this->out_info, outbuf, GST_MAP_WRITE))
|
|
|
|
goto outmap_error;
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
|
|
|
|
/* and convert the samples */
|
2015-11-06 11:10:48 +00:00
|
|
|
flags = 0;
|
|
|
|
if (inbuf_writable)
|
2016-01-08 16:34:50 +00:00
|
|
|
flags |= GST_AUDIO_CONVERTER_FLAG_IN_WRITABLE;
|
2015-11-06 11:10:48 +00:00
|
|
|
|
2008-03-21 15:58:44 +00:00
|
|
|
if (!GST_BUFFER_FLAG_IS_SET (inbuf, GST_BUFFER_FLAG_GAP)) {
|
2015-12-10 16:46:26 +00:00
|
|
|
if (!gst_audio_converter_samples (this->convert, flags,
|
2018-02-01 16:08:51 +00:00
|
|
|
inbuf != outbuf ? srcabuf.planes : dstabuf.planes,
|
|
|
|
dstabuf.n_samples, dstabuf.planes, dstabuf.n_samples))
|
2008-03-21 15:58:44 +00:00
|
|
|
goto convert_error;
|
|
|
|
} else {
|
|
|
|
/* Create silence buffer */
|
2018-02-01 16:08:51 +00:00
|
|
|
gint i;
|
|
|
|
for (i = 0; i < dstabuf.n_planes; i++) {
|
2020-11-24 19:54:49 +00:00
|
|
|
gst_audio_format_info_fill_silence (this->out_info.finfo,
|
|
|
|
dstabuf.planes[i], GST_AUDIO_BUFFER_PLANE_SIZE (&dstabuf));
|
2018-02-01 16:08:51 +00:00
|
|
|
}
|
2008-03-21 15:58:44 +00:00
|
|
|
}
|
2011-03-27 14:35:28 +00:00
|
|
|
ret = GST_FLOW_OK;
|
2005-12-02 10:17:35 +00:00
|
|
|
|
2011-03-27 14:35:28 +00:00
|
|
|
done:
|
2018-02-01 16:08:51 +00:00
|
|
|
gst_audio_buffer_unmap (&dstabuf);
|
2016-11-30 08:48:40 +00:00
|
|
|
if (inbuf != outbuf)
|
2018-02-01 16:08:51 +00:00
|
|
|
gst_audio_buffer_unmap (&srcabuf);
|
2003-04-14 01:20:30 +00:00
|
|
|
|
2011-03-27 14:35:28 +00:00
|
|
|
return ret;
|
2003-07-19 22:58:41 +00:00
|
|
|
|
gst/audioconvert/: Cleanups, librarify a bit, optimize, better negotiation and more.
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (if), (float),
(audio_convert_get_func_index), (check_default),
(audio_convert_clean_fmt), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_get_sizes),
(get_temp_buffer), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_class_init), (gst_audio_convert_init),
(gst_audio_convert_dispose), (gst_audio_convert_parse_caps),
(gst_audio_convert_get_unit_size),
(gst_audio_convert_transform_caps),
(gst_audio_convert_fixate_caps), (gst_audio_convert_set_caps),
(gst_audio_convert_transform_ip), (gst_audio_convert_transform):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstchannelmix.c: (gst_channel_mix_unset_matrix),
(gst_channel_mix_fill_identical),
(gst_channel_mix_fill_compatible), (gst_channel_mix_detect_pos),
(gst_channel_mix_fill_one_other), (gst_channel_mix_fill_others),
(gst_channel_mix_fill_normalize), (gst_channel_mix_fill_matrix),
(gst_channel_mix_setup_matrix), (gst_channel_mix_passthrough),
(gst_channel_mix_mix):
* gst/audioconvert/gstchannelmix.h:
Cleanups, librarify a bit, optimize, better negotiation and more.
2005-08-26 15:43:56 +00:00
|
|
|
/* ERRORS */
|
2005-12-02 10:17:35 +00:00
|
|
|
convert_error:
|
|
|
|
{
|
2007-03-09 12:22:53 +00:00
|
|
|
GST_ELEMENT_ERROR (this, STREAM, FORMAT,
|
|
|
|
(NULL), ("error while converting"));
|
2011-03-27 14:35:28 +00:00
|
|
|
ret = GST_FLOW_ERROR;
|
|
|
|
goto done;
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
2016-11-30 08:55:16 +00:00
|
|
|
inmap_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (this, STREAM, FORMAT,
|
|
|
|
(NULL), ("failed to map input buffer"));
|
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
|
|
|
outmap_error:
|
|
|
|
{
|
|
|
|
GST_ELEMENT_ERROR (this, STREAM, FORMAT,
|
|
|
|
(NULL), ("failed to map output buffer"));
|
|
|
|
if (inbuf != outbuf)
|
2018-02-01 16:08:51 +00:00
|
|
|
gst_audio_buffer_unmap (&srcabuf);
|
2016-11-30 08:55:16 +00:00
|
|
|
return GST_FLOW_ERROR;
|
|
|
|
}
|
2003-04-14 01:20:30 +00:00
|
|
|
}
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
|
2016-10-19 10:21:37 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_convert_transform_ip (GstBaseTransform * base, GstBuffer * buf)
|
|
|
|
{
|
|
|
|
return gst_audio_convert_transform (base, buf, buf);
|
|
|
|
}
|
|
|
|
|
2015-06-04 15:59:17 +00:00
|
|
|
static gboolean
|
|
|
|
gst_audio_convert_transform_meta (GstBaseTransform * trans, GstBuffer * outbuf,
|
|
|
|
GstMeta * meta, GstBuffer * inbuf)
|
|
|
|
{
|
|
|
|
const GstMetaInfo *info = meta->info;
|
|
|
|
const gchar *const *tags;
|
|
|
|
|
|
|
|
tags = gst_meta_api_type_get_tags (info->api);
|
|
|
|
|
2015-06-29 11:06:49 +00:00
|
|
|
if (!tags || (g_strv_length ((gchar **) tags) == 1
|
2019-06-14 08:14:23 +00:00
|
|
|
&& gst_meta_api_type_has_tag (info->api, META_TAG_AUDIO)))
|
2015-06-04 15:59:17 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2015-10-24 17:05:10 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_convert_submit_input_buffer (GstBaseTransform * base,
|
|
|
|
gboolean is_discont, GstBuffer * input)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (base);
|
|
|
|
|
|
|
|
if (base->segment.format == GST_FORMAT_TIME) {
|
2022-11-26 08:23:59 +00:00
|
|
|
if (!GST_AUDIO_INFO_IS_VALID (&this->in_info)) {
|
|
|
|
GST_WARNING_OBJECT (this, "Got buffer, but not negotiated yet!");
|
|
|
|
return GST_FLOW_NOT_NEGOTIATED;
|
|
|
|
}
|
|
|
|
|
2015-10-24 17:05:10 +00:00
|
|
|
input =
|
2015-11-06 11:10:48 +00:00
|
|
|
gst_audio_buffer_clip (input, &base->segment, this->in_info.rate,
|
|
|
|
this->in_info.bpf);
|
2015-10-24 17:05:10 +00:00
|
|
|
|
|
|
|
if (!input)
|
|
|
|
return GST_FLOW_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return GST_BASE_TRANSFORM_CLASS (parent_class)->submit_input_buffer (base,
|
|
|
|
is_discont, input);
|
|
|
|
}
|
|
|
|
|
2018-02-01 16:08:51 +00:00
|
|
|
static GstFlowReturn
|
|
|
|
gst_audio_convert_prepare_output_buffer (GstBaseTransform * base,
|
|
|
|
GstBuffer * inbuf, GstBuffer ** outbuf)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (base);
|
|
|
|
GstAudioMeta *meta;
|
|
|
|
GstFlowReturn ret;
|
|
|
|
|
|
|
|
ret = GST_BASE_TRANSFORM_CLASS (parent_class)->prepare_output_buffer (base,
|
|
|
|
inbuf, outbuf);
|
|
|
|
|
|
|
|
if (ret != GST_FLOW_OK)
|
|
|
|
return ret;
|
|
|
|
|
|
|
|
meta = gst_buffer_get_audio_meta (inbuf);
|
|
|
|
|
|
|
|
if (inbuf != *outbuf) {
|
|
|
|
gsize samples = meta ?
|
|
|
|
meta->samples : (gst_buffer_get_size (inbuf) / this->in_info.bpf);
|
|
|
|
|
|
|
|
/* ensure that the output buffer is not bigger than what we need */
|
|
|
|
gst_buffer_resize (*outbuf, 0, samples * this->out_info.bpf);
|
|
|
|
|
|
|
|
/* add the audio meta on the output buffer if it's planar */
|
|
|
|
if (this->out_info.layout == GST_AUDIO_LAYOUT_NON_INTERLEAVED) {
|
|
|
|
gst_buffer_add_audio_meta (*outbuf, &this->out_info, samples, NULL);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
/* if the input buffer came with a GstAudioMeta,
|
|
|
|
* update it to reflect the properties of the output format */
|
|
|
|
if (meta)
|
|
|
|
meta->info = this->out_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2024-08-14 14:09:06 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_set_mix_matrix (GstAudioConvert * this, const GValue * value)
|
|
|
|
{
|
|
|
|
gboolean mix_matrix_was_set;
|
|
|
|
GstAudioConverter *old_converter;
|
2024-08-15 15:01:31 +00:00
|
|
|
GValue old_mix_matrix = G_VALUE_INIT;
|
2024-08-14 14:09:06 +00:00
|
|
|
gboolean restore = FALSE;
|
|
|
|
|
|
|
|
g_value_init (&old_mix_matrix, GST_TYPE_ARRAY);
|
|
|
|
|
|
|
|
GST_OBJECT_LOCK (this);
|
|
|
|
|
|
|
|
mix_matrix_was_set = this->mix_matrix_is_set;
|
|
|
|
old_converter = this->convert;
|
|
|
|
if (mix_matrix_was_set) {
|
|
|
|
g_value_copy (&this->mix_matrix, &old_mix_matrix);
|
|
|
|
}
|
|
|
|
|
2024-08-15 15:01:31 +00:00
|
|
|
this->convert = NULL;
|
2024-08-14 14:09:06 +00:00
|
|
|
|
|
|
|
if (!gst_value_array_get_size (value)) {
|
|
|
|
g_value_copy (value, &this->mix_matrix);
|
|
|
|
this->mix_matrix_is_set = TRUE;
|
|
|
|
} else {
|
|
|
|
const GValue *first_row = gst_value_array_get_value (value, 0);
|
|
|
|
|
|
|
|
if (gst_value_array_get_size (first_row)) {
|
|
|
|
g_value_copy (value, &this->mix_matrix);
|
|
|
|
this->mix_matrix_is_set = TRUE;
|
|
|
|
} else {
|
|
|
|
g_warning ("Empty mix matrix's first row.");
|
|
|
|
restore = TRUE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_OBJECT_UNLOCK (this);
|
|
|
|
|
|
|
|
/* We need to call this here already because gst_audio_convert_transform
|
|
|
|
* might never get called otherwise if the element was set to passthrough.
|
|
|
|
*
|
|
|
|
* In any case if this succeeds we still want to reconfigure the sink to give
|
|
|
|
* upstream a chance to renegotiate channels.
|
|
|
|
*/
|
|
|
|
if (gst_audio_convert_ensure_converter (GST_BASE_TRANSFORM (this),
|
|
|
|
&this->in_info, &this->out_info)) {
|
|
|
|
gst_base_transform_reconfigure_sink (GST_BASE_TRANSFORM (this));
|
|
|
|
} else {
|
|
|
|
g_warning ("Cannot build converter with this mix matrix");
|
|
|
|
restore = TRUE;
|
|
|
|
goto done;
|
|
|
|
}
|
|
|
|
|
|
|
|
done:
|
|
|
|
if (restore) {
|
|
|
|
this->mix_matrix_is_set = mix_matrix_was_set;
|
|
|
|
if (mix_matrix_was_set) {
|
|
|
|
g_value_copy (&old_mix_matrix, &this->mix_matrix);
|
|
|
|
}
|
|
|
|
this->convert = old_converter;
|
|
|
|
} else if (old_converter) {
|
|
|
|
gst_audio_converter_free (old_converter);
|
|
|
|
}
|
2024-08-15 15:01:31 +00:00
|
|
|
g_value_unset (&old_mix_matrix);
|
2024-08-14 14:09:06 +00:00
|
|
|
}
|
|
|
|
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
static void
|
|
|
|
gst_audio_convert_set_property (GObject * object, guint prop_id,
|
|
|
|
const GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:26:10 +00:00
|
|
|
case PROP_DITHERING:
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
this->dither = g_value_get_enum (value);
|
|
|
|
break;
|
2015-04-27 10:26:10 +00:00
|
|
|
case PROP_NOISE_SHAPING:
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
this->ns = g_value_get_enum (value);
|
|
|
|
break;
|
2022-02-16 16:49:52 +00:00
|
|
|
case PROP_DITHERING_THRESHOLD:
|
|
|
|
this->dither_threshold = g_value_get_uint (value);
|
|
|
|
break;
|
2017-08-15 00:39:54 +00:00
|
|
|
case PROP_MIX_MATRIX:
|
2024-08-14 14:09:06 +00:00
|
|
|
gst_audio_convert_set_mix_matrix (this, value);
|
2017-08-15 00:39:54 +00:00
|
|
|
break;
|
2024-02-08 19:37:53 +00:00
|
|
|
case PROP_INPUT_CHANNELS_REORDER:
|
|
|
|
this->input_channels_reorder = g_value_get_enum (value);
|
|
|
|
break;
|
|
|
|
case PROP_INPUT_CHANNELS_REORDER_MODE:
|
|
|
|
this->input_channels_reorder_mode = g_value_get_enum (value);
|
|
|
|
break;
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
gst_audio_convert_get_property (GObject * object, guint prop_id,
|
|
|
|
GValue * value, GParamSpec * pspec)
|
|
|
|
{
|
|
|
|
GstAudioConvert *this = GST_AUDIO_CONVERT (object);
|
|
|
|
|
|
|
|
switch (prop_id) {
|
2015-04-27 10:26:10 +00:00
|
|
|
case PROP_DITHERING:
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
g_value_set_enum (value, this->dither);
|
|
|
|
break;
|
2015-04-27 10:26:10 +00:00
|
|
|
case PROP_NOISE_SHAPING:
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
g_value_set_enum (value, this->ns);
|
|
|
|
break;
|
2022-02-16 16:49:52 +00:00
|
|
|
case PROP_DITHERING_THRESHOLD:
|
|
|
|
g_value_set_uint (value, this->dither_threshold);
|
|
|
|
break;
|
2017-08-15 00:39:54 +00:00
|
|
|
case PROP_MIX_MATRIX:
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_LOCK (object);
|
2019-11-03 10:25:55 +00:00
|
|
|
if (this->mix_matrix_is_set)
|
2017-08-15 00:39:54 +00:00
|
|
|
g_value_copy (&this->mix_matrix, value);
|
2024-08-14 14:09:06 +00:00
|
|
|
GST_OBJECT_UNLOCK (object);
|
2017-08-15 00:39:54 +00:00
|
|
|
break;
|
2024-02-08 19:37:53 +00:00
|
|
|
case PROP_INPUT_CHANNELS_REORDER:
|
|
|
|
g_value_set_enum (value, this->input_channels_reorder);
|
|
|
|
break;
|
|
|
|
case PROP_INPUT_CHANNELS_REORDER_MODE:
|
|
|
|
g_value_set_enum (value, this->input_channels_reorder_mode);
|
|
|
|
break;
|
gst/audioconvert/: Implement dithering and noise shaping in audioconvert. By default now
Original commit message from CVS:
* gst/audioconvert/Makefile.am:
* gst/audioconvert/audioconvert.c: (audio_convert_get_func_index),
(check_default), (audio_convert_prepare_context),
(audio_convert_clean_context), (audio_convert_convert):
* gst/audioconvert/audioconvert.h:
* gst/audioconvert/gstaudioconvert.c:
(gst_audio_convert_dithering_get_type),
(gst_audio_convert_ns_get_type), (gst_audio_convert_class_init),
(gst_audio_convert_init), (gst_audio_convert_set_caps),
(gst_audio_convert_set_property), (gst_audio_convert_get_property):
* gst/audioconvert/gstaudioconvert.h:
* gst/audioconvert/gstaudioquantize.c:
(gst_audio_quantize_setup_noise_shaping),
(gst_audio_quantize_free_noise_shaping),
(gst_audio_quantize_setup_dither),
(gst_audio_quantize_free_dither),
(gst_audio_quantize_setup_quantize_func),
(gst_audio_quantize_setup), (gst_audio_quantize_free):
* gst/audioconvert/gstaudioquantize.h:
Implement dithering and noise shaping in audioconvert. By default now
TPDF dithering (and no noise shaping) will be used when converting
from a higher bit depth to 20 bit depth or smaller, otherwise
everything will be as it is now.
For the last audioconvert in a pipeline it would make sense to
use some kind of noise shaping, enabling it by default for all
conversions would give undesired results though. Fixes #360246.
* tests/check/elements/audioconvert.c: (setup_audioconvert),
(GST_START_TEST):
Adjust unit test for the new audioconvert.
2007-06-28 20:37:58 +00:00
|
|
|
default:
|
|
|
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|