2005-08-25 17:20:02 +00:00
|
|
|
/* GStreamer
|
|
|
|
*
|
|
|
|
* unit test for audioconvert
|
|
|
|
*
|
|
|
|
* Copyright (C) <2005> Thomas Vander Stichele <thomas at apestaart dot org>
|
2008-05-06 12:12:16 +00:00
|
|
|
* Copyright (C) <2007> Tim-Philipp Müller <tim centricular net>
|
2005-08-25 17:20:02 +00:00
|
|
|
*
|
|
|
|
* 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.
|
2005-08-25 17:20:02 +00:00
|
|
|
*/
|
2018-01-16 18:14:59 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
2005-08-25 17:20:02 +00:00
|
|
|
|
|
|
|
#include <gst/check/gstcheck.h>
|
2011-12-19 13:27:28 +00:00
|
|
|
#include <gst/audio/audio.h>
|
2024-02-08 19:37:53 +00:00
|
|
|
#include <gst/audioconvert/gstaudioconvert.h>
|
2005-08-25 17:20:02 +00:00
|
|
|
|
|
|
|
/* For ease of programming we use globals to keep refs for our floating
|
|
|
|
* src and sink pads we create; otherwise we always have to do get_pad,
|
|
|
|
* get_peer, and then remove references in every test function */
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static GstPad *mysrcpad, *mysinkpad;
|
2005-08-25 17:20:02 +00:00
|
|
|
|
2011-09-29 11:46:36 +00:00
|
|
|
#define FORMATS "{ F32LE, F32BE, F64LE, F64BE, " \
|
|
|
|
"S32LE, S32BE, U32LE, U32BE, " \
|
|
|
|
"S24LE, S24BE, U24LE, U24BE, " \
|
|
|
|
"S16LE, S16BE, U16LE, U16BE, " \
|
|
|
|
"S8, U8 } "
|
|
|
|
|
2005-12-06 19:42:02 +00:00
|
|
|
#define CONVERT_CAPS_TEMPLATE_STRING \
|
2011-09-29 11:46:36 +00:00
|
|
|
"audio/x-raw, " \
|
|
|
|
"format = (string) "FORMATS", " \
|
2005-08-25 17:20:02 +00:00
|
|
|
"rate = (int) [ 1, MAX ], " \
|
2011-09-29 11:46:36 +00:00
|
|
|
"channels = (int) [ 1, MAX ]"
|
2005-08-25 17:20:02 +00:00
|
|
|
|
|
|
|
/* takes over reference for outcaps */
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static GstElement *
|
2023-10-20 13:21:03 +00:00
|
|
|
setup_audioconvert (GstCaps * outcaps, gboolean use_mix_matrix,
|
|
|
|
GValue * mix_matrix)
|
2005-08-25 17:20:02 +00:00
|
|
|
{
|
2014-04-15 11:03:34 +00:00
|
|
|
GstPadTemplate *sinktemplate;
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
2013-05-10 10:29:15 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
|
|
|
|
);
|
2005-08-25 17:20:02 +00:00
|
|
|
GstElement *audioconvert;
|
2013-05-10 10:29:15 +00:00
|
|
|
|
2014-04-15 11:03:34 +00:00
|
|
|
sinktemplate =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, outcaps);
|
2005-08-25 17:20:02 +00:00
|
|
|
|
2005-10-11 14:49:44 +00:00
|
|
|
GST_DEBUG ("setup_audioconvert with caps %" GST_PTR_FORMAT, outcaps);
|
2005-08-25 17:20:02 +00:00
|
|
|
audioconvert = gst_check_setup_element ("audioconvert");
|
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_object_set (G_OBJECT (audioconvert), "dithering", 0, NULL);
|
|
|
|
g_object_set (G_OBJECT (audioconvert), "noise-shaping", 0, NULL);
|
2023-10-20 13:21:03 +00:00
|
|
|
if (use_mix_matrix) {
|
|
|
|
g_object_set_property (G_OBJECT (audioconvert), "mix-matrix", mix_matrix);
|
|
|
|
}
|
2011-11-24 20:39:14 +00:00
|
|
|
mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate);
|
2014-04-15 11:03:34 +00:00
|
|
|
mysinkpad =
|
|
|
|
gst_check_setup_sink_pad_from_template (audioconvert, sinktemplate);
|
2005-08-25 17:20:02 +00:00
|
|
|
/* this installs a getcaps func that will always return the caps we set
|
|
|
|
* later */
|
|
|
|
gst_pad_use_fixed_caps (mysinkpad);
|
2011-05-27 10:13:32 +00:00
|
|
|
|
|
|
|
gst_pad_set_active (mysrcpad, TRUE);
|
|
|
|
gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
|
2014-04-15 11:03:34 +00:00
|
|
|
gst_object_unref (sinktemplate);
|
2005-08-25 17:20:02 +00:00
|
|
|
|
|
|
|
return audioconvert;
|
|
|
|
}
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
static GstElement *
|
|
|
|
setup_audioconvert_with_input_channels_reorder (GstCaps * outcaps,
|
|
|
|
GstAudioConvertInputChannelsReorder reorder)
|
|
|
|
{
|
|
|
|
GstPadTemplate *sinktemplate;
|
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
|
|
|
|
);
|
|
|
|
GstElement *audioconvert;
|
|
|
|
|
|
|
|
ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 1);
|
|
|
|
sinktemplate =
|
|
|
|
gst_pad_template_new ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, outcaps);
|
|
|
|
|
|
|
|
GST_DEBUG ("setup_audioconvert with caps %" GST_PTR_FORMAT, outcaps);
|
|
|
|
audioconvert = gst_check_setup_element ("audioconvert");
|
|
|
|
g_object_set (G_OBJECT (audioconvert), "dithering", 0, NULL);
|
|
|
|
g_object_set (G_OBJECT (audioconvert), "noise-shaping", 0, NULL);
|
|
|
|
g_object_set (G_OBJECT (audioconvert), "input-channels-reorder",
|
|
|
|
reorder, "input-channels-reorder-mode",
|
|
|
|
GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MODE_UNPOSITIONED, NULL);
|
|
|
|
|
|
|
|
mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate);
|
|
|
|
mysinkpad =
|
|
|
|
gst_check_setup_sink_pad_from_template (audioconvert, sinktemplate);
|
|
|
|
/* this installs a getcaps func that will always return the caps we set
|
|
|
|
* later */
|
|
|
|
gst_pad_use_fixed_caps (mysinkpad);
|
|
|
|
|
|
|
|
gst_pad_set_active (mysrcpad, TRUE);
|
|
|
|
gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
|
|
|
|
gst_object_unref (sinktemplate);
|
|
|
|
|
|
|
|
ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 2);
|
|
|
|
return audioconvert;
|
|
|
|
}
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static void
|
2005-08-25 17:20:02 +00:00
|
|
|
cleanup_audioconvert (GstElement * audioconvert)
|
|
|
|
{
|
|
|
|
GST_DEBUG ("cleanup_audioconvert");
|
|
|
|
|
2005-10-11 14:49:44 +00:00
|
|
|
gst_pad_set_active (mysrcpad, FALSE);
|
|
|
|
gst_pad_set_active (mysinkpad, FALSE);
|
2005-08-25 17:20:02 +00:00
|
|
|
gst_check_teardown_src_pad (audioconvert);
|
|
|
|
gst_check_teardown_sink_pad (audioconvert);
|
|
|
|
gst_check_teardown_element (audioconvert);
|
|
|
|
}
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
static gchar *
|
|
|
|
format_input_channels_reorder_test_name (const gchar * test_name,
|
|
|
|
GstAudioConvertInputChannelsReorder reorder)
|
|
|
|
{
|
|
|
|
const gchar *reorder_name = "unknown";
|
|
|
|
switch (reorder) {
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST:
|
|
|
|
reorder_name = "gst";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_SMPTE:
|
|
|
|
reorder_name = "smpte";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_CINE:
|
|
|
|
reorder_name = "cine";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AC3:
|
|
|
|
reorder_name = "ac3";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_AAC:
|
|
|
|
reorder_name = "aac";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_MONO:
|
|
|
|
reorder_name = "mono";
|
|
|
|
break;
|
|
|
|
case GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE:
|
|
|
|
reorder_name = "alternate";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return g_strdup_printf ("%s with input channels %s reorder", test_name,
|
|
|
|
reorder_name);
|
|
|
|
}
|
|
|
|
|
2005-10-11 14:49:44 +00:00
|
|
|
/* returns a newly allocated caps */
|
|
|
|
static GstCaps *
|
2011-09-29 11:46:36 +00:00
|
|
|
get_int_caps (guint channels, gint endianness, guint width,
|
2018-02-09 12:29:57 +00:00
|
|
|
guint depth, gboolean signedness, GstAudioLayout layout)
|
2005-08-25 17:20:02 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
2011-09-29 11:46:36 +00:00
|
|
|
GstAudioFormat fmt;
|
2011-12-19 13:27:28 +00:00
|
|
|
GstAudioInfo info;
|
|
|
|
|
|
|
|
g_assert (channels <= 2);
|
2011-09-29 11:46:36 +00:00
|
|
|
|
2011-12-30 12:21:35 +00:00
|
|
|
GST_DEBUG ("channels:%d, endianness:%d, width:%d, depth:%d, signedness:%d",
|
|
|
|
channels, endianness, width, depth, signedness);
|
|
|
|
|
2011-09-29 11:46:36 +00:00
|
|
|
fmt = gst_audio_format_build_integer (signedness, endianness, width, depth);
|
2005-08-25 17:20:02 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
gst_audio_info_init (&info);
|
2015-12-29 13:23:59 +00:00
|
|
|
gst_audio_info_set_format (&info, fmt, GST_AUDIO_DEF_RATE, channels, NULL);
|
2018-02-09 12:29:57 +00:00
|
|
|
info.layout = layout;
|
2011-12-19 13:27:28 +00:00
|
|
|
|
|
|
|
caps = gst_audio_info_to_caps (&info);
|
2005-10-11 14:49:44 +00:00
|
|
|
fail_unless (caps != NULL);
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_DEBUG ("returning caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
static GstAudioFormat
|
|
|
|
get_float_format (gint endianness, gint width)
|
2006-04-28 14:22:16 +00:00
|
|
|
{
|
2011-09-29 11:46:36 +00:00
|
|
|
if (endianness == G_LITTLE_ENDIAN) {
|
|
|
|
if (width == 32)
|
2011-12-19 13:27:28 +00:00
|
|
|
return GST_AUDIO_FORMAT_F32LE;
|
2011-09-29 11:46:36 +00:00
|
|
|
else
|
2011-12-19 13:27:28 +00:00
|
|
|
return GST_AUDIO_FORMAT_F64LE;
|
2011-09-29 11:46:36 +00:00
|
|
|
} else {
|
|
|
|
if (width == 32)
|
2011-12-19 13:27:28 +00:00
|
|
|
return GST_AUDIO_FORMAT_F32BE;
|
2011-09-29 11:46:36 +00:00
|
|
|
else
|
2011-12-19 13:27:28 +00:00
|
|
|
return GST_AUDIO_FORMAT_F64BE;
|
2011-09-29 11:46:36 +00:00
|
|
|
}
|
2011-12-19 13:27:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* returns a newly allocated caps */
|
|
|
|
static GstCaps *
|
2018-02-09 12:29:57 +00:00
|
|
|
get_float_caps (guint channels, gint endianness, guint width,
|
|
|
|
GstAudioLayout layout)
|
2011-12-19 13:27:28 +00:00
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
GstAudioInfo info;
|
2011-09-29 11:46:36 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
g_assert (channels <= 2);
|
|
|
|
|
|
|
|
gst_audio_info_init (&info);
|
2015-12-29 13:23:59 +00:00
|
|
|
gst_audio_info_set_format (&info, get_float_format (endianness, width),
|
|
|
|
GST_AUDIO_DEF_RATE, channels, NULL);
|
2018-02-09 12:29:57 +00:00
|
|
|
info.layout = layout;
|
2011-12-19 13:27:28 +00:00
|
|
|
|
|
|
|
caps = gst_audio_info_to_caps (&info);
|
2006-04-28 14:22:16 +00:00
|
|
|
fail_unless (caps != NULL);
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_DEBUG ("returning caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2006-04-28 14:22:16 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
static GstCaps *
|
|
|
|
get_unpositioned_input_caps (guint channels)
|
|
|
|
{
|
|
|
|
GstCaps *caps;
|
|
|
|
GstAudioInfo info;
|
|
|
|
|
|
|
|
gst_audio_info_init (&info);
|
|
|
|
gst_audio_info_set_format (&info,
|
|
|
|
gst_audio_format_build_integer (TRUE, G_BYTE_ORDER, 16, 16),
|
|
|
|
GST_AUDIO_DEF_RATE, channels, NULL);
|
|
|
|
info.layout = GST_AUDIO_LAYOUT_INTERLEAVED;
|
|
|
|
|
|
|
|
info.flags = GST_AUDIO_FLAG_UNPOSITIONED;
|
|
|
|
for (guint i = 0; i < MIN (64, channels); ++i)
|
|
|
|
info.position[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
|
|
|
|
|
|
|
|
caps = gst_audio_info_to_caps (&info);
|
|
|
|
fail_unless (caps != NULL);
|
|
|
|
GST_DEBUG ("returning caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
/* Copied from vorbis; the particular values used don't matter */
|
|
|
|
static GstAudioChannelPosition channelpositions[][6] = {
|
|
|
|
{ /* Mono */
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_MONO},
|
2006-05-14 18:15:17 +00:00
|
|
|
{ /* Stereo */
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT},
|
|
|
|
{ /* Stereo + Centre */
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER},
|
2006-05-14 18:15:17 +00:00
|
|
|
{ /* Quadraphonic */
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
},
|
|
|
|
{ /* Stereo + Centre + rear stereo */
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
},
|
2011-12-19 13:27:28 +00:00
|
|
|
{ /* Full 5.1 Surround */
|
2006-07-11 21:04:16 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1,
|
2006-07-11 21:04:16 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
}
|
2006-05-14 18:15:17 +00:00
|
|
|
};
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* we get this when recording from a soundcard with lots of input channels */
|
2008-05-30 08:42:17 +00:00
|
|
|
static GstAudioChannelPosition undefined_positions[][15] = {
|
2008-05-06 12:12:16 +00:00
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
2008-05-30 08:42:17 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE},
|
|
|
|
{
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE,
|
2008-05-06 12:12:16 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_NONE}
|
|
|
|
};
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
/* For channels > 2, caps have to have channel positions. This adds some simple
|
|
|
|
* ones. Only implemented for channels between 1 and 6.
|
|
|
|
*/
|
|
|
|
static GstCaps *
|
2011-09-29 11:46:36 +00:00
|
|
|
get_float_mc_caps (guint channels, gint endianness, guint width,
|
2018-02-09 12:29:57 +00:00
|
|
|
GstAudioLayout layout, const GstAudioChannelPosition * position)
|
2006-05-14 18:15:17 +00:00
|
|
|
{
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstAudioInfo info;
|
2006-05-14 18:15:17 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
gst_audio_info_init (&info);
|
|
|
|
|
|
|
|
if (position) {
|
|
|
|
gst_audio_info_set_format (&info, get_float_format (endianness, width),
|
2015-12-29 13:23:59 +00:00
|
|
|
GST_AUDIO_DEF_RATE, channels, position);
|
2011-12-19 13:27:28 +00:00
|
|
|
} else if (channels <= 6) {
|
|
|
|
gst_audio_info_set_format (&info, get_float_format (endianness, width),
|
2015-12-29 13:23:59 +00:00
|
|
|
GST_AUDIO_DEF_RATE, channels, channelpositions[channels - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
} else {
|
|
|
|
GstAudioChannelPosition pos[64];
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < 64; i++)
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
|
|
|
|
gst_audio_info_set_format (&info, get_float_format (endianness, width),
|
2015-12-29 13:23:59 +00:00
|
|
|
GST_AUDIO_DEF_RATE, channels, pos);
|
2006-07-11 21:04:16 +00:00
|
|
|
}
|
2006-05-14 18:15:17 +00:00
|
|
|
|
2018-02-09 12:29:57 +00:00
|
|
|
info.layout = layout;
|
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
caps = gst_audio_info_to_caps (&info);
|
|
|
|
fail_unless (caps != NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("returning caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstCaps *
|
2011-09-29 11:46:36 +00:00
|
|
|
get_int_mc_caps (guint channels, gint endianness, guint width,
|
2018-02-09 12:29:57 +00:00
|
|
|
guint depth, gboolean signedness, GstAudioLayout layout,
|
|
|
|
const GstAudioChannelPosition * position)
|
2006-05-14 18:15:17 +00:00
|
|
|
{
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *caps;
|
|
|
|
GstAudioFormat fmt;
|
|
|
|
GstAudioInfo info;
|
2006-05-14 18:15:17 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
fmt = gst_audio_format_build_integer (signedness, endianness, width, depth);
|
|
|
|
|
|
|
|
gst_audio_info_init (&info);
|
|
|
|
|
|
|
|
if (position) {
|
2015-12-29 13:23:59 +00:00
|
|
|
gst_audio_info_set_format (&info, fmt, GST_AUDIO_DEF_RATE, channels,
|
|
|
|
position);
|
2011-12-19 13:27:28 +00:00
|
|
|
} else if (channels <= 6) {
|
2015-12-29 13:23:59 +00:00
|
|
|
gst_audio_info_set_format (&info, fmt, GST_AUDIO_DEF_RATE, channels,
|
2011-12-19 13:27:28 +00:00
|
|
|
channelpositions[channels - 1]);
|
|
|
|
} else {
|
|
|
|
GstAudioChannelPosition pos[64];
|
|
|
|
gint i;
|
|
|
|
|
|
|
|
for (i = 0; i < 64; i++)
|
|
|
|
pos[i] = GST_AUDIO_CHANNEL_POSITION_NONE;
|
2015-12-29 13:23:59 +00:00
|
|
|
gst_audio_info_set_format (&info, fmt, GST_AUDIO_DEF_RATE, channels, pos);
|
2006-07-11 21:04:16 +00:00
|
|
|
}
|
2006-05-14 18:15:17 +00:00
|
|
|
|
2018-02-09 12:29:57 +00:00
|
|
|
info.layout = layout;
|
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
caps = gst_audio_info_to_caps (&info);
|
|
|
|
fail_unless (caps != NULL);
|
|
|
|
|
|
|
|
GST_DEBUG ("returning caps %" GST_PTR_FORMAT, caps);
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
return caps;
|
|
|
|
}
|
|
|
|
|
2005-10-11 14:49:44 +00:00
|
|
|
/* eats the refs to the caps */
|
2005-08-25 17:20:02 +00:00
|
|
|
static void
|
2006-04-29 11:55:09 +00:00
|
|
|
verify_convert (const gchar * which, void *in, int inlength,
|
2008-05-06 12:12:16 +00:00
|
|
|
GstCaps * incaps, void *out, int outlength, GstCaps * outcaps,
|
2023-10-20 13:21:03 +00:00
|
|
|
GstFlowReturn expected_flow, gboolean in_place_allowed,
|
2024-02-08 19:37:53 +00:00
|
|
|
gboolean use_mix_matrix, GValue * mix_matrix,
|
|
|
|
GstElement * custom_audioconvert)
|
2005-08-25 17:20:02 +00:00
|
|
|
{
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
2005-10-11 14:49:44 +00:00
|
|
|
GstElement *audioconvert;
|
2018-02-09 12:29:57 +00:00
|
|
|
GstAudioInfo in_info;
|
2005-10-11 14:49:44 +00:00
|
|
|
|
2006-04-29 11:55:09 +00:00
|
|
|
GST_DEBUG ("verifying conversion %s", which);
|
2005-10-11 14:49:44 +00:00
|
|
|
GST_DEBUG ("incaps: %" GST_PTR_FORMAT, incaps);
|
|
|
|
GST_DEBUG ("outcaps: %" GST_PTR_FORMAT, outcaps);
|
|
|
|
ASSERT_CAPS_REFCOUNT (incaps, "incaps", 1);
|
2024-02-08 19:37:53 +00:00
|
|
|
|
|
|
|
if (custom_audioconvert) {
|
|
|
|
audioconvert = custom_audioconvert;
|
|
|
|
} else {
|
|
|
|
ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 1);
|
|
|
|
audioconvert = setup_audioconvert (outcaps, use_mix_matrix, mix_matrix);
|
|
|
|
}
|
2014-04-15 11:03:34 +00:00
|
|
|
ASSERT_CAPS_REFCOUNT (outcaps, "outcaps", 2);
|
2005-08-25 17:20:02 +00:00
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
2005-09-02 15:43:18 +00:00
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
2005-08-25 17:20:02 +00:00
|
|
|
|
2013-05-10 10:29:15 +00:00
|
|
|
gst_check_setup_events (mysrcpad, audioconvert, incaps, GST_FORMAT_TIME);
|
2011-05-27 10:13:32 +00:00
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
GST_DEBUG ("Creating buffer of %d bytes", inlength);
|
|
|
|
inbuffer = gst_buffer_new_and_alloc (inlength);
|
2011-03-28 12:12:24 +00:00
|
|
|
gst_buffer_fill (inbuffer, 0, in, inlength);
|
2005-08-25 17:20:02 +00:00
|
|
|
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
|
|
|
|
|
2018-02-09 12:29:57 +00:00
|
|
|
fail_unless (gst_audio_info_from_caps (&in_info, incaps));
|
|
|
|
gst_buffer_add_audio_meta (inbuffer, &in_info, inlength / in_info.bpf, NULL);
|
|
|
|
|
2015-12-29 13:23:59 +00:00
|
|
|
if (!in_place_allowed) {
|
|
|
|
/* take extra ref to force processing */
|
|
|
|
gst_buffer_ref (inbuffer);
|
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (audioconvert),
|
|
|
|
FALSE);
|
|
|
|
}
|
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
/* pushing gives away my reference ... */
|
2005-10-11 14:49:44 +00:00
|
|
|
GST_DEBUG ("push it");
|
2008-05-06 12:12:16 +00:00
|
|
|
fail_unless_equals_int (gst_pad_push (mysrcpad, inbuffer), expected_flow);
|
2005-10-11 14:49:44 +00:00
|
|
|
GST_DEBUG ("pushed it");
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
if (expected_flow != GST_FLOW_OK)
|
|
|
|
goto done;
|
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
/* ... and puts a new buffer on the global list */
|
|
|
|
fail_unless (g_list_length (buffers) == 1);
|
|
|
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
|
|
|
|
2015-12-29 13:23:59 +00:00
|
|
|
if (!in_place_allowed) {
|
|
|
|
/* release extra ref */
|
|
|
|
gst_buffer_unref (inbuffer);
|
|
|
|
}
|
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
ASSERT_BUFFER_REFCOUNT (outbuffer, "outbuffer", 1);
|
2011-03-28 12:12:24 +00:00
|
|
|
fail_unless_equals_int (gst_buffer_get_size (outbuffer), outlength);
|
2006-04-29 12:10:52 +00:00
|
|
|
|
2011-03-28 12:12:24 +00:00
|
|
|
gst_check_buffer_data (outbuffer, out, outlength);
|
2007-11-02 14:59:06 +00:00
|
|
|
|
|
|
|
/* make sure that the channel positions are not lost */
|
|
|
|
{
|
|
|
|
GstStructure *in_s, *out_s;
|
|
|
|
gint out_chans;
|
2012-03-30 14:56:45 +00:00
|
|
|
GstCaps *ccaps;
|
2007-11-02 14:59:06 +00:00
|
|
|
|
|
|
|
in_s = gst_caps_get_structure (incaps, 0);
|
2012-03-30 14:56:45 +00:00
|
|
|
ccaps = gst_pad_get_current_caps (mysinkpad);
|
|
|
|
out_s = gst_caps_get_structure (ccaps, 0);
|
2007-11-02 14:59:06 +00:00
|
|
|
fail_unless (gst_structure_get_int (out_s, "channels", &out_chans));
|
|
|
|
|
|
|
|
/* positions for 1 and 2 channels are implicit if not provided */
|
2018-01-19 18:50:07 +00:00
|
|
|
if (out_chans > 2 && gst_structure_has_field (in_s, "channel-mask")) {
|
|
|
|
if (!gst_structure_has_field (out_s, "channel-mask")) {
|
2017-06-05 05:08:33 +00:00
|
|
|
gst_printerrln ("In : %" GST_PTR_FORMAT, in_s);
|
|
|
|
gst_printerrln ("Out : %" GST_PTR_FORMAT, out_s);
|
|
|
|
g_error ("Channel layout got lost somewhere\n");
|
2007-11-02 14:59:06 +00:00
|
|
|
}
|
|
|
|
}
|
2012-03-30 14:56:45 +00:00
|
|
|
gst_caps_unref (ccaps);
|
2007-11-02 14:59:06 +00:00
|
|
|
}
|
|
|
|
|
2005-08-25 18:03:48 +00:00
|
|
|
buffers = g_list_remove (buffers, outbuffer);
|
|
|
|
gst_buffer_unref (outbuffer);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
done:
|
2005-10-11 14:49:44 +00:00
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
/* cleanup */
|
|
|
|
GST_DEBUG ("cleanup audioconvert");
|
|
|
|
cleanup_audioconvert (audioconvert);
|
|
|
|
GST_DEBUG ("cleanup, unref incaps");
|
|
|
|
gst_caps_unref (incaps);
|
2014-04-15 11:03:34 +00:00
|
|
|
gst_caps_unref (outcaps);
|
2005-08-25 17:20:02 +00:00
|
|
|
}
|
|
|
|
|
2005-10-11 14:49:44 +00:00
|
|
|
|
2006-04-29 11:55:09 +00:00
|
|
|
#define RUN_CONVERSION(which, inarray, in_get_caps, outarray, out_get_caps) \
|
|
|
|
verify_convert (which, inarray, sizeof (inarray), \
|
2015-12-29 13:23:59 +00:00
|
|
|
in_get_caps, outarray, sizeof (outarray), out_get_caps, GST_FLOW_OK, \
|
2024-02-08 19:37:53 +00:00
|
|
|
TRUE, FALSE, &(GValue) G_VALUE_INIT, NULL);
|
2023-10-20 13:21:03 +00:00
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
#define RUN_CONVERSION_WITH_MATRIX(which, inarray, in_get_caps, outarray, out_get_caps, mix_matrix) \
|
2023-10-20 13:21:03 +00:00
|
|
|
verify_convert (which, inarray, sizeof (inarray), \
|
|
|
|
in_get_caps, outarray, sizeof (outarray), out_get_caps, GST_FLOW_OK, \
|
2024-02-08 19:37:53 +00:00
|
|
|
TRUE, TRUE, mix_matrix, NULL);
|
|
|
|
|
|
|
|
#define RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER(which, inarray, \
|
|
|
|
in_channels, reorder, outarray, out_channels) \
|
|
|
|
{ \
|
|
|
|
GstCaps *in_get_caps = get_unpositioned_input_caps (in_channels); \
|
|
|
|
GstCaps *out_get_caps = get_int_mc_caps (out_channels, G_BYTE_ORDER, 16, \
|
|
|
|
16, TRUE, GST_AUDIO_LAYOUT_INTERLEAVED, NULL); \
|
|
|
|
verify_convert ( \
|
|
|
|
which, inarray, sizeof (inarray), in_get_caps, outarray, \
|
|
|
|
sizeof (outarray), out_get_caps, GST_FLOW_OK, TRUE, FALSE, \
|
|
|
|
&(GValue) G_VALUE_INIT, \
|
|
|
|
setup_audioconvert_with_input_channels_reorder (out_get_caps, \
|
|
|
|
reorder)); \
|
|
|
|
}
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
#define RUN_CONVERSION_TO_FAIL(which, inarray, in_caps, outarray, out_caps) \
|
|
|
|
verify_convert (which, inarray, sizeof (inarray), \
|
2015-12-29 13:23:59 +00:00
|
|
|
in_caps, outarray, sizeof (outarray), out_caps, \
|
2024-02-08 19:37:53 +00:00
|
|
|
GST_FLOW_NOT_NEGOTIATED, TRUE, FALSE, &(GValue) G_VALUE_INIT, NULL);
|
2015-12-29 13:23:59 +00:00
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
#define RUN_CONVERSION_NOT_INPLACE(which, inarray, in_get_caps, outarray, out_get_caps) \
|
2015-12-29 13:23:59 +00:00
|
|
|
verify_convert (which, inarray, sizeof (inarray), \
|
|
|
|
in_get_caps, outarray, sizeof (outarray), out_get_caps, GST_FLOW_OK, \
|
2024-02-08 19:37:53 +00:00
|
|
|
FALSE, FALSE, &(GValue) G_VALUE_INIT, NULL);
|
2005-08-25 18:03:48 +00:00
|
|
|
|
2018-02-09 12:29:57 +00:00
|
|
|
#define INTERLEAVED GST_AUDIO_LAYOUT_INTERLEAVED
|
|
|
|
#define PLANAR GST_AUDIO_LAYOUT_NON_INTERLEAVED
|
2007-02-28 11:47:45 +00:00
|
|
|
|
2005-08-25 18:03:48 +00:00
|
|
|
GST_START_TEST (test_int16)
|
2005-08-25 17:20:02 +00:00
|
|
|
{
|
2005-08-25 18:03:48 +00:00
|
|
|
/* stereo to mono */
|
|
|
|
{
|
2018-02-09 15:07:48 +00:00
|
|
|
gint16 in_i[] = { 16384, -256, 1024, 1024 };
|
|
|
|
gint16 in_p[] = { 16384, 1024, -256, 1024 };
|
2005-08-25 18:03:48 +00:00
|
|
|
gint16 out[] = { 8064, 1024 };
|
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("int16 stereo to mono interleaved",
|
|
|
|
in_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("int16 stereo to mono planar",
|
|
|
|
in_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
2005-08-25 18:03:48 +00:00
|
|
|
}
|
|
|
|
/* mono to stereo */
|
|
|
|
{
|
|
|
|
gint16 in[] = { 512, 1024 };
|
2018-02-09 15:07:48 +00:00
|
|
|
gint16 out_i[] = { 512, 512, 1024, 1024 };
|
|
|
|
gint16 out_p[] = { 512, 1024, 512, 1024 };
|
2005-08-25 18:03:48 +00:00
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("int16 mono to stereo interleaved",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
2018-02-09 15:07:48 +00:00
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
RUN_CONVERSION ("int16 mono to stereo planar",
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
2005-08-25 18:27:24 +00:00
|
|
|
}
|
|
|
|
/* signed -> unsigned */
|
|
|
|
{
|
|
|
|
gint16 in[] = { 0, -32767, 32767, -32768 };
|
|
|
|
guint16 out[] = { 32768, 1, 65535, 0 };
|
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("int16 signed to unsigned interleaved",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED));
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("int16 unsigned to signed interleaved",
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED),
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2018-02-09 15:07:48 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 signed to unsigned planar",
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, PLANAR));
|
|
|
|
RUN_CONVERSION ("int16 unsigned to signed planar",
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, PLANAR),
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
2005-08-25 18:27:24 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2007-02-28 11:47:45 +00:00
|
|
|
|
|
|
|
GST_START_TEST (test_float32)
|
|
|
|
{
|
|
|
|
/* stereo to mono */
|
|
|
|
{
|
2018-02-09 15:07:48 +00:00
|
|
|
gfloat in_i[] = { 0.6, -0.0078125, 0.03125, 0.03125 };
|
|
|
|
gfloat in_p[] = { 0.6, 0.03125, -0.0078125, 0.03125 };
|
2007-02-28 11:47:45 +00:00
|
|
|
gfloat out[] = { 0.29609375, 0.03125 };
|
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("float32 stereo to mono interleaved",
|
|
|
|
in_i, get_float_caps (2, G_BYTE_ORDER, 32, INTERLEAVED),
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 32, INTERLEAVED));
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("float32 stereo to mono planar",
|
|
|
|
in_p, get_float_caps (2, G_BYTE_ORDER, 32, PLANAR),
|
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 32, PLANAR));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
|
|
|
/* mono to stereo */
|
|
|
|
{
|
|
|
|
gfloat in[] = { 0.015625, 0.03125 };
|
2018-02-09 15:07:48 +00:00
|
|
|
gfloat out_i[] = { 0.015625, 0.015625, 0.03125, 0.03125 };
|
|
|
|
gfloat out_p[] = { 0.015625, 0.03125, 0.015625, 0.03125 };
|
2007-02-28 11:47:45 +00:00
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
RUN_CONVERSION ("float32 mono to stereo interleaved",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_float_caps (1, G_BYTE_ORDER, 32, INTERLEAVED),
|
2018-02-09 15:07:48 +00:00
|
|
|
out_i, get_float_caps (2, G_BYTE_ORDER, 32, INTERLEAVED));
|
|
|
|
RUN_CONVERSION ("float32 mono to stereo planar",
|
|
|
|
in, get_float_caps (1, G_BYTE_ORDER, 32, PLANAR),
|
|
|
|
out_p, get_float_caps (2, G_BYTE_ORDER, 32, PLANAR));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
2005-08-25 18:27:24 +00:00
|
|
|
GST_START_TEST (test_int_conversion)
|
|
|
|
{
|
|
|
|
/* 8 <-> 16 signed */
|
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
|
|
|
{
|
|
|
|
gint8 in[] = { 0, 1, 2, 127, -127 };
|
|
|
|
gint16 out[] = { 0, 256, 512, 32512, -32512 };
|
|
|
|
|
2006-04-29 11:55:09 +00:00
|
|
|
RUN_CONVERSION ("int 8bit to 16bit signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED)
|
2005-08-25 18:27:24 +00:00
|
|
|
);
|
2006-04-29 11:55:09 +00:00
|
|
|
RUN_CONVERSION ("int 16bit signed to 8bit",
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED)
|
2005-08-25 18:27:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
/* 16 -> 8 signed */
|
|
|
|
{
|
2007-03-27 12:44:14 +00:00
|
|
|
gint16 in[] = { 0, 127, 128, 256, 256 + 127, 256 + 128 };
|
|
|
|
gint8 out[] = { 0, 0, 1, 1, 1, 2 };
|
2005-08-25 18:27:24 +00:00
|
|
|
|
2006-04-29 11:55:09 +00:00
|
|
|
RUN_CONVERSION ("16 bit to 8 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED)
|
2005-08-25 18:27:24 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
/* 8 unsigned <-> 16 signed */
|
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
|
|
|
{
|
|
|
|
guint8 in[] = { 128, 129, 130, 255, 1 };
|
|
|
|
gint16 out[] = { 0, 256, 512, 32512, -32512 };
|
2005-10-11 14:49:44 +00:00
|
|
|
GstCaps *incaps, *outcaps;
|
|
|
|
|
|
|
|
/* exploded for easier valgrinding */
|
2018-02-09 12:29:57 +00:00
|
|
|
incaps = get_int_caps (1, G_BYTE_ORDER, 8, 8, FALSE, INTERLEAVED);
|
|
|
|
outcaps = get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED);
|
2005-10-11 14:49:44 +00:00
|
|
|
GST_DEBUG ("incaps: %" GST_PTR_FORMAT, incaps);
|
|
|
|
GST_DEBUG ("outcaps: %" GST_PTR_FORMAT, outcaps);
|
2006-04-29 11:55:09 +00:00
|
|
|
RUN_CONVERSION ("8 unsigned to 16 signed", in, incaps, out, outcaps);
|
|
|
|
RUN_CONVERSION ("16 signed to 8 unsigned", out, get_int_caps (1,
|
2018-02-09 12:29:57 +00:00
|
|
|
G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED), in, get_int_caps (1,
|
|
|
|
G_BYTE_ORDER, 8, 8, FALSE, INTERLEAVED)
|
2005-08-25 18:27:24 +00:00
|
|
|
);
|
2005-08-25 18:03:48 +00:00
|
|
|
}
|
2005-09-17 17:17:59 +00:00
|
|
|
/* 8 <-> 24 signed */
|
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
|
|
|
{
|
|
|
|
gint8 in[] = { 0, 1, 127 };
|
|
|
|
guint8 out[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x7f };
|
2006-04-29 13:09:52 +00:00
|
|
|
/* out has the bytes in little-endian, so that's how they should be
|
|
|
|
* interpreted during conversion */
|
2005-09-17 17:17:59 +00:00
|
|
|
|
2011-09-29 11:46:36 +00:00
|
|
|
RUN_CONVERSION ("8 to 24 signed", in, get_int_caps (1, G_BYTE_ORDER, 8, 8,
|
2018-02-09 12:29:57 +00:00
|
|
|
TRUE, INTERLEAVED), out, get_int_caps (1, G_LITTLE_ENDIAN, 24, 24,
|
|
|
|
TRUE, INTERLEAVED)
|
2005-09-17 17:17:59 +00:00
|
|
|
);
|
2011-09-29 11:46:36 +00:00
|
|
|
RUN_CONVERSION ("24 signed to 8", out, get_int_caps (1, G_LITTLE_ENDIAN, 24,
|
2018-02-09 12:29:57 +00:00
|
|
|
24, TRUE, INTERLEAVED), in, get_int_caps (1, G_BYTE_ORDER, 8, 8,
|
|
|
|
TRUE, INTERLEAVED)
|
2005-09-17 17:17:59 +00:00
|
|
|
);
|
|
|
|
}
|
2007-03-27 12:44:14 +00:00
|
|
|
|
|
|
|
/* 16 bit signed <-> unsigned */
|
|
|
|
{
|
|
|
|
gint16 in[] = { 0, 128, -128 };
|
|
|
|
guint16 out[] = { 32768, 32896, 32640 };
|
|
|
|
RUN_CONVERSION ("16 signed to 16 unsigned",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED)
|
2007-03-27 12:44:14 +00:00
|
|
|
);
|
|
|
|
RUN_CONVERSION ("16 unsigned to 16 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED),
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED)
|
2007-03-27 12:44:14 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 32 bit signed -> 16 bit signed for rounding check */
|
2007-03-29 18:42:34 +00:00
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
2007-03-27 12:44:14 +00:00
|
|
|
{
|
|
|
|
gint32 in[] = { 0, G_MININT32, G_MAXINT32,
|
|
|
|
(32 << 16), (32 << 16) + (1 << 15), (32 << 16) - (1 << 15),
|
|
|
|
(32 << 16) + (2 << 15), (32 << 16) - (2 << 15),
|
2016-01-06 01:04:31 +00:00
|
|
|
(-(32 << 16)) + (1 << 15), (-(32 << 16)) - (1 << 15),
|
|
|
|
(-(32 << 16)) + (2 << 15), (-(32 << 16)) - (2 << 15),
|
|
|
|
(-(32 << 16))
|
2007-03-27 12:44:14 +00:00
|
|
|
};
|
|
|
|
gint16 out[] = { 0, G_MININT16, G_MAXINT16,
|
|
|
|
32, 33, 32,
|
|
|
|
33, 31,
|
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
|
|
|
-31, -32,
|
2007-03-27 12:44:14 +00:00
|
|
|
-31, -33,
|
|
|
|
-32
|
|
|
|
};
|
|
|
|
RUN_CONVERSION ("32 signed to 16 signed for rounding",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED)
|
2007-03-27 12:44:14 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 32 bit signed -> 16 bit unsigned for rounding check */
|
2007-03-29 18:42:34 +00:00
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
2007-03-27 12:44:14 +00:00
|
|
|
{
|
|
|
|
gint32 in[] = { 0, G_MININT32, G_MAXINT32,
|
|
|
|
(32 << 16), (32 << 16) + (1 << 15), (32 << 16) - (1 << 15),
|
|
|
|
(32 << 16) + (2 << 15), (32 << 16) - (2 << 15),
|
2016-01-06 01:04:31 +00:00
|
|
|
(-(32 << 16)) + (1 << 15), (-(32 << 16)) - (1 << 15),
|
|
|
|
(-(32 << 16)) + (2 << 15), (-(32 << 16)) - (2 << 15),
|
|
|
|
(-(32 << 16))
|
2007-03-27 12:44:14 +00:00
|
|
|
};
|
|
|
|
guint16 out[] = { (1 << 15), 0, G_MAXUINT16,
|
|
|
|
(1 << 15) + 32, (1 << 15) + 33, (1 << 15) + 32,
|
|
|
|
(1 << 15) + 33, (1 << 15) + 31,
|
|
|
|
(1 << 15) - 31, (1 << 15) - 32,
|
|
|
|
(1 << 15) - 31, (1 << 15) - 33,
|
|
|
|
(1 << 15) - 32
|
|
|
|
};
|
|
|
|
RUN_CONVERSION ("32 signed to 16 unsigned for rounding",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED)
|
2007-03-27 12:44:14 +00:00
|
|
|
);
|
|
|
|
}
|
2005-08-25 17:20:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-04-28 14:22:16 +00:00
|
|
|
GST_START_TEST (test_float_conversion)
|
2015-12-29 13:23:59 +00:00
|
|
|
{
|
|
|
|
/* 64-bit float <-> 32-bit float */
|
|
|
|
{
|
|
|
|
gdouble in[] = { 0.0, 1.0, -1.0, 0.5, -0.5 };
|
|
|
|
gfloat out[] = { 0.0, 1.0, -1.0, 0.5, -0.5 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("64 float to 32 float",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_float_caps (1, G_BYTE_ORDER, 64, INTERLEAVED),
|
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 32, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("32 float to 64 float",
|
2018-02-09 12:29:57 +00:00
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 32, INTERLEAVED),
|
|
|
|
in, get_float_caps (1, G_BYTE_ORDER, 64, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 32-bit float little endian <-> big endian */
|
|
|
|
{
|
|
|
|
gfloat le[] = { GFLOAT_TO_LE (0.0), GFLOAT_TO_LE (1.0), GFLOAT_TO_LE (-1.0),
|
|
|
|
GFLOAT_TO_LE (0.5), GFLOAT_TO_LE (-0.5)
|
|
|
|
};
|
|
|
|
gfloat be[] = { GFLOAT_TO_BE (0.0), GFLOAT_TO_BE (1.0), GFLOAT_TO_BE (-1.0),
|
|
|
|
GFLOAT_TO_BE (0.5), GFLOAT_TO_BE (-0.5)
|
|
|
|
};
|
|
|
|
|
|
|
|
RUN_CONVERSION ("32 float LE to BE",
|
2018-02-09 12:29:57 +00:00
|
|
|
le, get_float_caps (1, G_LITTLE_ENDIAN, 32, INTERLEAVED),
|
|
|
|
be, get_float_caps (1, G_BIG_ENDIAN, 32, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("32 float BE to LE",
|
2018-02-09 12:29:57 +00:00
|
|
|
be, get_float_caps (1, G_BIG_ENDIAN, 32, INTERLEAVED),
|
|
|
|
le, get_float_caps (1, G_LITTLE_ENDIAN, 32, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 64-bit float little endian <-> big endian */
|
|
|
|
{
|
|
|
|
gdouble le[] =
|
|
|
|
{ GDOUBLE_TO_LE (0.0), GDOUBLE_TO_LE (1.0), GDOUBLE_TO_LE (-1.0),
|
|
|
|
GDOUBLE_TO_LE (0.5), GDOUBLE_TO_LE (-0.5)
|
|
|
|
};
|
|
|
|
gdouble be[] =
|
|
|
|
{ GDOUBLE_TO_BE (0.0), GDOUBLE_TO_BE (1.0), GDOUBLE_TO_BE (-1.0),
|
|
|
|
GDOUBLE_TO_BE (0.5), GDOUBLE_TO_BE (-0.5)
|
|
|
|
};
|
|
|
|
|
|
|
|
RUN_CONVERSION ("64 float LE to BE",
|
2018-02-09 12:29:57 +00:00
|
|
|
le, get_float_caps (1, G_LITTLE_ENDIAN, 64, INTERLEAVED),
|
|
|
|
be, get_float_caps (1, G_BIG_ENDIAN, 64, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("64 float BE to LE",
|
2018-02-09 12:29:57 +00:00
|
|
|
be, get_float_caps (1, G_BIG_ENDIAN, 64, INTERLEAVED),
|
|
|
|
le, get_float_caps (1, G_LITTLE_ENDIAN, 64, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST (test_int_float_conversion)
|
2006-04-28 14:22:16 +00:00
|
|
|
{
|
2006-04-29 11:55:09 +00:00
|
|
|
/* 32 float <-> 16 signed */
|
2006-04-28 14:22:16 +00:00
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
|
|
|
{
|
2007-03-29 18:42:34 +00:00
|
|
|
gfloat in_le[] =
|
|
|
|
{ GFLOAT_TO_LE (0.0), GFLOAT_TO_LE (1.0), GFLOAT_TO_LE (-1.0),
|
|
|
|
GFLOAT_TO_LE (0.5), GFLOAT_TO_LE (-0.5), GFLOAT_TO_LE (1.1),
|
|
|
|
GFLOAT_TO_LE (-1.1)
|
|
|
|
};
|
|
|
|
gfloat in_be[] =
|
|
|
|
{ GFLOAT_TO_BE (0.0), GFLOAT_TO_BE (1.0), GFLOAT_TO_BE (-1.0),
|
|
|
|
GFLOAT_TO_BE (0.5), GFLOAT_TO_BE (-0.5), GFLOAT_TO_BE (1.1),
|
|
|
|
GFLOAT_TO_BE (-1.1)
|
|
|
|
};
|
2006-04-28 14:22:16 +00:00
|
|
|
gint16 out[] = { 0, 32767, -32768, 16384, -16384, 32767, -32768 };
|
|
|
|
|
|
|
|
/* only one direction conversion, the other direction does
|
|
|
|
* not produce exactly the same as the input due to floating
|
|
|
|
* point rounding errors etc. */
|
2007-03-29 18:42:34 +00:00
|
|
|
RUN_CONVERSION ("32 float le to 16 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in_le, get_float_caps (1, G_LITTLE_ENDIAN, 32, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2007-03-29 18:42:34 +00:00
|
|
|
RUN_CONVERSION ("32 float be to 16 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in_be, get_float_caps (1, G_BIG_ENDIAN, 32, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
2007-03-29 18:42:34 +00:00
|
|
|
|
2007-02-28 11:47:45 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 0, -32768, 16384, -16384 };
|
|
|
|
gfloat out[] = { 0.0, -1.0, 0.5, -0.5 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("16 signed to 32 float",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 32, INTERLEAVED));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 64 float <-> 16 signed */
|
|
|
|
/* NOTE: if audioconvert was doing dithering we'd have a problem */
|
|
|
|
{
|
2007-03-29 18:42:34 +00:00
|
|
|
gdouble in_le[] =
|
|
|
|
{ GDOUBLE_TO_LE (0.0), GDOUBLE_TO_LE (1.0), GDOUBLE_TO_LE (-1.0),
|
|
|
|
GDOUBLE_TO_LE (0.5), GDOUBLE_TO_LE (-0.5), GDOUBLE_TO_LE (1.1),
|
|
|
|
GDOUBLE_TO_LE (-1.1)
|
|
|
|
};
|
|
|
|
gdouble in_be[] =
|
|
|
|
{ GDOUBLE_TO_BE (0.0), GDOUBLE_TO_BE (1.0), GDOUBLE_TO_BE (-1.0),
|
|
|
|
GDOUBLE_TO_BE (0.5), GDOUBLE_TO_BE (-0.5), GDOUBLE_TO_BE (1.1),
|
|
|
|
GDOUBLE_TO_BE (-1.1)
|
|
|
|
};
|
2007-02-28 11:47:45 +00:00
|
|
|
gint16 out[] = { 0, 32767, -32768, 16384, -16384, 32767, -32768 };
|
|
|
|
|
|
|
|
/* only one direction conversion, the other direction does
|
|
|
|
* not produce exactly the same as the input due to floating
|
|
|
|
* point rounding errors etc. */
|
2007-03-29 18:42:34 +00:00
|
|
|
RUN_CONVERSION ("64 float LE to 16 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in_le, get_float_caps (1, G_LITTLE_ENDIAN, 64, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2007-03-29 18:42:34 +00:00
|
|
|
RUN_CONVERSION ("64 float BE to 16 signed",
|
2018-02-09 12:29:57 +00:00
|
|
|
in_be, get_float_caps (1, G_BIG_ENDIAN, 64, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
|
|
|
{
|
|
|
|
gint16 in[] = { 0, -32768, 16384, -16384 };
|
|
|
|
gdouble out[] = { 0.0,
|
2016-01-18 02:40:36 +00:00
|
|
|
(gdouble) (-(G_GINT64_CONSTANT (32768) << 16)) / 2147483648.0, /* ~ -1.0 */
|
2015-11-03 10:44:54 +00:00
|
|
|
(gdouble) (16384L << 16) / 2147483648.0, /* ~ 0.5 */
|
2016-01-06 01:04:31 +00:00
|
|
|
(gdouble) (-(16384L << 16)) / 2147483648.0, /* ~ -0.5 */
|
2007-02-28 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
RUN_CONVERSION ("16 signed to 64 float",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 64, INTERLEAVED));
|
2007-02-28 11:47:45 +00:00
|
|
|
}
|
|
|
|
{
|
2016-01-18 02:40:36 +00:00
|
|
|
gint32 in[] =
|
|
|
|
{ 0, (-(G_GINT64_CONSTANT (1) << 31)), (1L << 30), (-(1L << 30)) };
|
2007-02-28 11:47:45 +00:00
|
|
|
gdouble out[] = { 0.0,
|
2016-01-18 02:40:36 +00:00
|
|
|
(gdouble) (-(G_GINT64_CONSTANT (1) << 31)) / 2147483648.0, /* ~ -1.0 */
|
2015-11-03 10:44:54 +00:00
|
|
|
(gdouble) (1L << 30) / 2147483648.0, /* ~ 0.5 */
|
2016-01-06 01:04:31 +00:00
|
|
|
(gdouble) (-(1L << 30)) / 2147483648.0, /* ~ -0.5 */
|
2007-02-28 11:47:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
RUN_CONVERSION ("32 signed to 64 float",
|
2018-02-09 12:29:57 +00:00
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED),
|
|
|
|
out, get_float_caps (1, G_BYTE_ORDER, 64, INTERLEAVED));
|
2006-04-28 14:22:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
GST_START_TEST (test_multichannel_conversion)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gfloat in[] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
|
|
|
|
gfloat out[] = { 0.0, 0.0 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("3 channels to 1", in, get_float_mc_caps (3,
|
2018-02-09 12:29:57 +00:00
|
|
|
G_BYTE_ORDER, 32, INTERLEAVED, NULL), out, get_float_caps (1,
|
|
|
|
G_BYTE_ORDER, 32, INTERLEAVED));
|
2011-12-19 13:27:28 +00:00
|
|
|
RUN_CONVERSION ("1 channels to 3", out, get_float_caps (1, G_BYTE_ORDER,
|
2018-02-09 12:29:57 +00:00
|
|
|
32, INTERLEAVED), in, get_float_mc_caps (3, G_BYTE_ORDER, 32,
|
|
|
|
INTERLEAVED, NULL));
|
2008-05-06 12:12:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 0, 0, 0, 0, 0, 0 };
|
|
|
|
gint16 out[] = { 0, 0 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("3 channels to 1", in, get_int_mc_caps (3,
|
2018-02-09 12:29:57 +00:00
|
|
|
G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, NULL), out,
|
|
|
|
get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2011-09-29 11:46:36 +00:00
|
|
|
RUN_CONVERSION ("1 channels to 3", out, get_int_caps (1, G_BYTE_ORDER, 16,
|
2018-02-09 12:29:57 +00:00
|
|
|
16, TRUE, INTERLEAVED), in, get_int_mc_caps (3, G_BYTE_ORDER, 16,
|
|
|
|
16, TRUE, INTERLEAVED, NULL));
|
2006-07-11 21:04:16 +00:00
|
|
|
}
|
2008-05-06 12:12:16 +00:00
|
|
|
|
2008-05-21 07:39:56 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2 };
|
|
|
|
gint16 out[] = { 1, 1, 2, 2 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstAudioChannelPosition in_layout[1] = { GST_AUDIO_CHANNEL_POSITION_MONO };
|
2008-05-21 07:39:56 +00:00
|
|
|
GstAudioChannelPosition out_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channels to 2 with standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-21 07:46:02 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2 };
|
|
|
|
gint16 out[] = { 1, 1, 2, 2 };
|
2018-02-09 12:29:57 +00:00
|
|
|
GstCaps *in_caps =
|
|
|
|
get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED);
|
|
|
|
GstCaps *out_caps =
|
|
|
|
get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED);
|
2008-05-21 07:46:02 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channels to 2 with standard layout and no positions set",
|
|
|
|
in, gst_caps_copy (in_caps), out, gst_caps_copy (out_caps));
|
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels to 1 with standard layout and no positions set",
|
|
|
|
out, out_caps, in, in_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-21 07:39:56 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2 };
|
|
|
|
gint16 out[] = { 1, 0, 2, 0 };
|
|
|
|
GstAudioChannelPosition in_layout[1] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT };
|
|
|
|
GstAudioChannelPosition out_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channels to 2 with non-standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2, 3, 4 };
|
|
|
|
gint16 out[] = { 2, 4 };
|
|
|
|
GstAudioChannelPosition in_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
|
|
|
|
};
|
|
|
|
GstAudioChannelPosition out_layout[1] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2, 3, 4 };
|
|
|
|
gint16 out[] = { 2, 4 };
|
|
|
|
GstAudioChannelPosition in_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstAudioChannelPosition out_layout[1] = { GST_AUDIO_CHANNEL_POSITION_MONO };
|
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels to 1 with standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2, 3, 4 };
|
2008-05-29 11:34:09 +00:00
|
|
|
gint16 out[] = { 1, 3 };
|
2008-05-21 07:39:56 +00:00
|
|
|
GstAudioChannelPosition in_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstAudioChannelPosition out_layout[1] = { GST_AUDIO_CHANNEL_POSITION_MONO };
|
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 1, 2, 3, 4 };
|
|
|
|
gint16 out[] = { 1, 3 };
|
|
|
|
GstAudioChannelPosition in_layout[2] =
|
|
|
|
{ GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstAudioChannelPosition out_layout[1] = { GST_AUDIO_CHANNEL_POSITION_MONO };
|
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels to 1 with non-standard layout", in,
|
|
|
|
in_caps, out, out_caps);
|
|
|
|
}
|
2008-05-29 11:34:09 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 4, 5, 4, 2, 2, 1 };
|
|
|
|
gint16 out[] = { 3, 3 };
|
2018-02-09 12:29:57 +00:00
|
|
|
GstCaps *in_caps =
|
|
|
|
get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, NULL);
|
|
|
|
GstCaps *out_caps =
|
|
|
|
get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED);
|
2008-05-29 11:34:09 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("5.1 to 2 channels", in, in_caps, out, out_caps);
|
|
|
|
}
|
2008-05-30 08:42:17 +00:00
|
|
|
{
|
|
|
|
gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
gint16 out[] = { 0, 0 };
|
|
|
|
GstAudioChannelPosition in_layout[11] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1,
|
2008-05-30 08:42:17 +00:00
|
|
|
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,
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_CENTER,
|
2008-05-30 08:42:17 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
|
|
|
|
};
|
2018-02-09 12:29:57 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (11, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, in_layout);
|
|
|
|
GstCaps *out_caps =
|
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, NULL);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
2012-03-30 14:56:45 +00:00
|
|
|
RUN_CONVERSION ("11 channels to 2", in, in_caps, out, out_caps);
|
2008-05-21 07:39:56 +00:00
|
|
|
}
|
|
|
|
{
|
2011-12-19 13:27:28 +00:00
|
|
|
gint16 in[] = { 0, 0 };
|
|
|
|
gint16 out[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
GstAudioChannelPosition out_layout[11] = {
|
|
|
|
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_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT,
|
2008-05-21 07:39:56 +00:00
|
|
|
};
|
2018-02-09 12:29:57 +00:00
|
|
|
GstCaps *in_caps =
|
|
|
|
get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, NULL);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (11, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, out_layout);
|
2008-05-21 07:39:56 +00:00
|
|
|
|
2012-03-30 14:56:45 +00:00
|
|
|
RUN_CONVERSION ("2 channels to 11", in, in_caps, out, out_caps);
|
2008-05-21 07:39:56 +00:00
|
|
|
}
|
|
|
|
|
2006-05-14 18:15:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2005-08-25 18:27:24 +00:00
|
|
|
|
2024-02-08 19:37:53 +00:00
|
|
|
GST_START_TEST (test_multichannel_crossmixing_with_input_channels_reorder)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120 };
|
|
|
|
gint16 out[] = { 12400, -120 };
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("1 channel to 1", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 1, reorder,
|
|
|
|
out, 1);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120 };
|
|
|
|
gint16 out[] = { 12400, 12400, -120, -120 };
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("1 channel to 2", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 1, reorder,
|
|
|
|
out, 2);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120 };
|
|
|
|
gint16 out[] = { 12400, 12400, 8767, -120, -120, -85 };
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("1 channel to 3", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 1, reorder,
|
|
|
|
out, 3);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, -10844, 5842 };
|
|
|
|
gint16 out[] = { 6140, -2501 };
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("2 channels to 1", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 2, reorder,
|
|
|
|
out, 1);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, -10844, 5842 };
|
|
|
|
gint16 out[][4] = {
|
|
|
|
{12400, -120, -10844, 5842},
|
|
|
|
{12400, -120, -10844, 5842},
|
|
|
|
{12400, -120, -10844, 5842},
|
|
|
|
{12400, -120, -10844, 5842},
|
|
|
|
{12400, -120, -10844, 5842},
|
|
|
|
{6140, 6140, -2501, -2501},
|
|
|
|
{12400, -120, -10844, 5842}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("2 channels to 2", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 2, reorder,
|
|
|
|
out[reorder], 2);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, -10844, 5842 };
|
|
|
|
gint16 out[][6] = {
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501},
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501},
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501},
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501},
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501},
|
|
|
|
{6140, 6140, 4341, -2501, -2501, -1768},
|
|
|
|
{8767, -85, 6140, -7667, 4130, -2501}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("2 channels to 3", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 2, reorder,
|
|
|
|
out[reorder], 3);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, 1120, -10844, 5842, -48 };
|
|
|
|
gint16 out[][2] = {
|
|
|
|
{4825, -1859},
|
|
|
|
{4825, -1859},
|
|
|
|
{4462, -1682},
|
|
|
|
{4462, -1682},
|
|
|
|
{4462, -1682},
|
|
|
|
{4462, -1682},
|
|
|
|
{3320, 198}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("3 channels to 1", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 3, reorder,
|
|
|
|
out[reorder], 1);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, 1120, -10844, 5842, -48 };
|
|
|
|
gint16 out[][4] = {
|
|
|
|
{7717, 394, -6363, 3397},
|
|
|
|
{7717, 394, -6363, 3397},
|
|
|
|
{6760, 500, -5446, 2897},
|
|
|
|
{6760, 500, -5446, 2897},
|
|
|
|
{6760, 500, -5446, 2897},
|
|
|
|
{4462, 4462, -1682, -1682},
|
|
|
|
{6760, -120, -5446, 5842}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("3 channels to 2", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 3, reorder,
|
|
|
|
out[reorder], 2);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] = { 12400, -120, 1120, -10844, 5842, -48 };
|
|
|
|
gint16 out[][6] = {
|
|
|
|
{12400, -120, 1120, -10844, 5842, -48},
|
|
|
|
{12400, -120, 1120, -10844, 5842, -48},
|
|
|
|
{6364, 471, 4462, -5127, 2727, -1682},
|
|
|
|
{6364, 471, 4462, -5127, 2727, -1682},
|
|
|
|
{6364, 471, 4462, -5127, 2727, -1682},
|
|
|
|
{4462, 4462, 3154, -1682, -1682, -1189},
|
|
|
|
{4780, -85, 3320, -3850, 4130, 198}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("3 channels to 3", reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 3, reorder,
|
|
|
|
out[reorder], 3);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
GST_START_TEST
|
|
|
|
(test_multichannel_downmixing_to_stereo_with_input_channels_reorder) {
|
|
|
|
{
|
|
|
|
gint16 in[] =
|
|
|
|
{ 12400, -120, 1248, 10140, 368, -32124, 8145, 7411, -212, -5489, 18523,
|
|
|
|
10003
|
|
|
|
};
|
|
|
|
gint16 out[][4] = {
|
|
|
|
{7353, -1592, 3657, 2105},
|
|
|
|
{7353, -1592, 3657, 2105},
|
|
|
|
{-4296, -9713, 4755, 8254},
|
|
|
|
{-4596, -9588, 6430, 7555},
|
|
|
|
{-5746, -6837, 6362, 7716},
|
|
|
|
{-1343, -1343, 6372, 6372},
|
|
|
|
{4667, -7361, 8810, 3971}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("5.1 channels to stereo",
|
|
|
|
reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 6, reorder,
|
|
|
|
out[reorder], 2);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
gint16 in[] =
|
|
|
|
{ 12400, -120, 1248, 10140, 368, -32124, 1247, -458, 8145, 7411, -212,
|
|
|
|
-5489, 18523, 10003, 789, -5557
|
|
|
|
};
|
|
|
|
gint16 out[][4] = {
|
|
|
|
{6739, -1645, 3467, 813},
|
|
|
|
{6739, -1645, 3467, 813},
|
|
|
|
{-1482, 260, 1921, 3242},
|
|
|
|
{-1617, 508, 2673, 1857},
|
|
|
|
{-3891, 1743, 2539, 1930},
|
|
|
|
{-912, -912, 4202, 4202},
|
|
|
|
{3816, -5640, 6811, 1592}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (gint reorder = GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_GST;
|
|
|
|
reorder <= GST_AUDIO_CONVERT_INPUT_CHANNELS_REORDER_ALTERNATE;
|
|
|
|
++reorder) {
|
|
|
|
gchar *test_name =
|
|
|
|
format_input_channels_reorder_test_name ("7.1 channels to stereo",
|
|
|
|
reorder);
|
|
|
|
RUN_CONVERSION_WITH_INPUT_CHANNELS_REORDER (test_name, in, 8, reorder,
|
|
|
|
out[reorder], 2);
|
|
|
|
g_free (test_name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-12-29 13:23:59 +00:00
|
|
|
GST_START_TEST (test_passthrough)
|
|
|
|
{
|
|
|
|
/* int 8 bit */
|
|
|
|
{
|
|
|
|
gint8 data[] = { 0, 1, 2, 127, -127 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int 8 bit passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
RUN_CONVERSION_NOT_INPLACE ("int 8 bit passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 8, 8, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
/* int 16 bit signed */
|
|
|
|
{
|
|
|
|
gint16 data[] = { 0, 256, 512, 32512, -32512 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int 16 bit signed passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
RUN_CONVERSION_NOT_INPLACE ("int 16 bit signed passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
/* int 32 bit signed */
|
|
|
|
{
|
|
|
|
gint32 data[] = { 0, G_MININT32, G_MAXINT32,
|
|
|
|
(32 << 16), (32 << 16) + (1 << 15), (32 << 16) - (1 << 15),
|
|
|
|
(32 << 16) + (2 << 15), (32 << 16) - (2 << 15),
|
2016-01-06 01:04:31 +00:00
|
|
|
(-(32 << 16)) + (1 << 15), (-(32 << 16)) - (1 << 15),
|
|
|
|
(-(32 << 16)) + (2 << 15), (-(32 << 16)) - (2 << 15),
|
|
|
|
(-(32 << 16))
|
2015-12-29 13:23:59 +00:00
|
|
|
};
|
|
|
|
RUN_CONVERSION ("int 32 bit signed passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
RUN_CONVERSION_NOT_INPLACE ("int 32 bit signed passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (1, G_BYTE_ORDER, 32, 32, TRUE, INTERLEAVED)
|
2015-12-29 13:23:59 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* int 16 bit signed stereo */
|
|
|
|
{
|
|
|
|
gint16 data[] = { 0, 0, 1, 1, 2, 2, 3, 3 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int 16 bit signed 2 channel passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
RUN_CONVERSION_NOT_INPLACE ("int 16 bit signed 2 channel passthrough",
|
2018-02-09 12:29:57 +00:00
|
|
|
data, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
data, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
2015-12-29 13:23:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2006-08-21 08:54:06 +00:00
|
|
|
GST_START_TEST (test_caps_negotiation)
|
|
|
|
{
|
|
|
|
GstElement *src, *ac1, *ac2, *ac3, *sink;
|
|
|
|
GstElement *pipeline;
|
|
|
|
GstPad *ac3_src;
|
|
|
|
GstCaps *caps1, *caps2;
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("test");
|
|
|
|
|
|
|
|
/* create elements */
|
|
|
|
src = gst_element_factory_make ("audiotestsrc", "src");
|
|
|
|
ac1 = gst_element_factory_make ("audioconvert", "ac1");
|
|
|
|
ac2 = gst_element_factory_make ("audioconvert", "ac2");
|
|
|
|
ac3 = gst_element_factory_make ("audioconvert", "ac3");
|
|
|
|
sink = gst_element_factory_make ("fakesink", "sink");
|
Don't use bad gst_element_get_pad().
Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_pad_typefind):
* gst/playback/decodetest.c: (new_decoded_pad_cb):
* gst/playback/gstdecodebin.c: (gst_decode_bin_init),
(try_to_link_1), (elem_is_dynamic), (close_link), (type_found),
(cleanup_decodebin):
* gst/playback/gstdecodebin2.c: (gst_decode_bin_init),
(connect_element), (gst_decode_group_control_demuxer_pad):
* gst/playback/gstplaybasebin.c: (queue_remove_probe),
(queue_out_of_data), (gen_preroll_element), (preroll_unlinked),
(mute_group_type):
* gst/playback/gstplaybin.c: (gst_play_bin_vis_blocked),
(gst_play_bin_set_property), (handoff), (gen_video_element),
(gen_text_element), (gen_audio_element), (gen_vis_element),
(remove_sinks), (add_sink), (setup_sinks):
* gst/playback/gstplaybin2.c: (pad_added_cb), (no_more_pads_cb):
* gst/playback/gstplaysink.c: (gst_play_sink_get_video_sink),
(gst_play_sink_get_audio_sink), (gst_play_sink_vis_unblocked),
(gst_play_sink_vis_blocked), (gst_play_sink_set_vis_plugin),
(gst_play_sink_get_vis_plugin), (gst_play_sink_set_mute),
(gen_video_chain), (gen_text_chain), (gen_audio_chain),
(gen_vis_chain), (gst_play_sink_reconfigure),
(gst_play_sink_set_font_desc), (gst_play_sink_get_font_desc),
(gst_play_sink_request_pad):
* gst/playback/gsturidecodebin.c: (type_found), (setup_source):
* gst/playback/test.c: (gen_video_element), (gen_audio_element),
(cb_newpad):
* gst/playback/test6.c: (new_decoded_pad_cb):
* tests/check/elements/audioconvert.c: (GST_START_TEST):
* tests/check/elements/audiorate.c: (test_injector_chain),
(do_perfect_stream_test):
* tests/check/elements/ffmpegcolorspace.c: (GST_START_TEST):
* tests/check/elements/gdpdepay.c: (GST_START_TEST):
* tests/check/elements/gnomevfssink.c:
* tests/check/elements/textoverlay.c:
(notgst_check_setup_src_pad2), (notgst_check_teardown_src_pad2):
* tests/check/elements/videotestsrc.c: (GST_START_TEST):
* tests/check/libs/cddabasesrc.c: (GST_START_TEST):
* tests/check/pipelines/oggmux.c: (test_pipeline):
* tests/check/pipelines/streamheader.c: (GST_START_TEST):
* tests/check/pipelines/theoraenc.c: (GST_START_TEST):
* tests/check/pipelines/vorbisenc.c: (GST_START_TEST):
* tests/examples/seek/scrubby.c: (make_wav_pipeline):
* tests/examples/seek/seek.c: (make_mod_pipeline),
(make_dv_pipeline), (make_wav_pipeline), (make_flac_pipeline),
(make_sid_pipeline), (make_parse_pipeline), (make_vorbis_pipeline),
(make_theora_pipeline), (make_vorbis_theora_pipeline),
(make_avi_msmpeg4v3_mp3_pipeline), (make_mp3_pipeline),
(make_avi_pipeline), (make_mpeg_pipeline), (make_mpegnt_pipeline),
(update_fill), (msg_buffering):
Don't use bad gst_element_get_pad().
2008-05-21 16:36:50 +00:00
|
|
|
ac3_src = gst_element_get_static_pad (ac3, "src");
|
2006-08-21 08:54:06 +00:00
|
|
|
|
|
|
|
/* test with 2 audioconvert elements */
|
|
|
|
gst_bin_add_many (GST_BIN (pipeline), src, ac1, ac3, sink, NULL);
|
|
|
|
gst_element_link_many (src, ac1, ac3, sink, NULL);
|
2006-08-21 11:42:12 +00:00
|
|
|
|
|
|
|
/* Set to PAUSED and wait for PREROLL */
|
|
|
|
fail_if (gst_element_set_state (pipeline, GST_STATE_PAUSED) ==
|
|
|
|
GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline to PAUSED");
|
|
|
|
fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
|
|
|
|
GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline to PAUSED");
|
|
|
|
|
2011-11-15 15:48:15 +00:00
|
|
|
caps1 = gst_pad_query_caps (ac3_src, NULL);
|
|
|
|
fail_if (caps1 == NULL, "gst_pad_query_caps returned NULL");
|
2010-06-15 11:09:29 +00:00
|
|
|
GST_DEBUG ("Caps size 1 : %d", gst_caps_get_size (caps1));
|
2006-08-21 11:42:12 +00:00
|
|
|
|
|
|
|
fail_if (gst_element_set_state (pipeline, GST_STATE_READY) ==
|
|
|
|
GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to READY");
|
|
|
|
fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
|
|
|
|
GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to READY");
|
2006-08-21 08:54:06 +00:00
|
|
|
|
|
|
|
/* test with 3 audioconvert elements */
|
|
|
|
gst_element_unlink (ac1, ac3);
|
|
|
|
gst_bin_add (GST_BIN (pipeline), ac2);
|
|
|
|
gst_element_link_many (ac1, ac2, ac3, NULL);
|
2006-08-21 11:42:12 +00:00
|
|
|
|
|
|
|
fail_if (gst_element_set_state (pipeline, GST_STATE_PAUSED) ==
|
|
|
|
GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to PAUSED");
|
|
|
|
fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
|
|
|
|
GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to PAUSED");
|
|
|
|
|
2011-11-15 15:48:15 +00:00
|
|
|
caps2 = gst_pad_query_caps (ac3_src, NULL);
|
2006-08-21 11:42:12 +00:00
|
|
|
|
2011-11-15 15:48:15 +00:00
|
|
|
fail_if (caps2 == NULL, "gst_pad_query_caps returned NULL");
|
2010-06-15 11:09:29 +00:00
|
|
|
GST_DEBUG ("Caps size 2 : %d", gst_caps_get_size (caps2));
|
2006-08-21 08:54:06 +00:00
|
|
|
fail_unless (gst_caps_get_size (caps1) == gst_caps_get_size (caps2));
|
|
|
|
|
2006-08-21 11:42:12 +00:00
|
|
|
gst_caps_unref (caps1);
|
|
|
|
gst_caps_unref (caps2);
|
|
|
|
|
|
|
|
fail_if (gst_element_set_state (pipeline, GST_STATE_NULL) ==
|
|
|
|
GST_STATE_CHANGE_FAILURE, "Failed to set test pipeline back to NULL");
|
|
|
|
fail_if (gst_element_get_state (pipeline, NULL, NULL, GST_CLOCK_TIME_NONE) !=
|
|
|
|
GST_STATE_CHANGE_SUCCESS, "Failed to set test pipeline back to NULL");
|
|
|
|
|
|
|
|
gst_object_unref (ac3_src);
|
|
|
|
gst_object_unref (pipeline);
|
2006-08-21 08:54:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
GST_START_TEST (test_convert_undefined_multichannel)
|
|
|
|
{
|
|
|
|
/* (A) CONVERSION FROM 'WORSE' TO 'BETTER' FORMAT */
|
|
|
|
|
|
|
|
/* 1 channel, NONE positions, int8 => int16 */
|
|
|
|
{
|
|
|
|
guint16 out[] = { 0x2000 };
|
|
|
|
guint8 in[] = { 0x20 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
|
|
|
|
"int8 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2 channels, NONE positions, int8 => int16 */
|
|
|
|
{
|
|
|
|
guint16 out[] = { 0x8000, 0x2000 };
|
|
|
|
guint8 in[] = { 0x80, 0x20 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
|
|
|
|
"int8 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 6 channels, NONE positions, int8 => int16 */
|
|
|
|
{
|
|
|
|
guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
|
|
|
|
guint8 in[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
|
|
|
|
"int8 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 9 channels, NONE positions, int8 => int16 */
|
|
|
|
{
|
|
|
|
guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000
|
|
|
|
};
|
|
|
|
guint8 in[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
|
|
|
|
"int8 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:42:17 +00:00
|
|
|
/* 15 channels, NONE positions, int8 => int16 */
|
|
|
|
{
|
|
|
|
guint16 out[] =
|
|
|
|
{ 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00,
|
|
|
|
0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000, 0x0000
|
|
|
|
};
|
|
|
|
guint8 in[] =
|
|
|
|
{ 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00, 0xff, 0x00,
|
|
|
|
0x20, 0x80, 0x20, 0x00
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
|
|
|
|
"int8 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* (B) CONVERSION FROM 'BETTER' TO 'WORSE' FORMAT */
|
|
|
|
|
|
|
|
/* 1 channel, NONE positions, int16 => int8 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x2000 };
|
|
|
|
guint8 out[] = { 0x20 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
|
|
|
|
"int16 => int8", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2 channels, NONE positions, int16 => int8 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x8000, 0x2000 };
|
|
|
|
guint8 out[] = { 0x80, 0x20 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int8", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 6 channels, NONE positions, int16 => int8 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
|
|
|
|
guint8 out[] = { 0x00, 0x20, 0x80, 0x20, 0x00, 0xff };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int8", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 9 channels, NONE positions, int16 => int8 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000
|
|
|
|
};
|
|
|
|
guint8 out[] = { 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int8", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:42:17 +00:00
|
|
|
/* 15 channels, NONE positions, int16 => int8 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000
|
|
|
|
};
|
|
|
|
guint8 out[] =
|
|
|
|
{ 0x00, 0xff, 0x00, 0x20, 0x80, 0x20, 0x00, 0xff, 0x00, 0xff, 0x00,
|
|
|
|
0x20, 0x80, 0x20, 0x00
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (15, G_BYTE_ORDER, 8, 8, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int8", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* (C) NO CONVERSION, SAME FORMAT */
|
|
|
|
|
|
|
|
/* 1 channel, NONE positions, int16 => int16 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x2000 };
|
|
|
|
guint16 out[] = { 0x2000 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (1, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[1 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("1 channel, undefined layout, identity conversion, "
|
|
|
|
"int16 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 2 channels, NONE positions, int16 => int16 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x8000, 0x2000 };
|
|
|
|
guint16 out[] = { 0x8000, 0x2000 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[2 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("2 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 6 channels, NONE positions, int16 => int16 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
|
|
|
|
guint16 out[] = { 0x0000, 0x2000, 0x8000, 0x2000, 0x0000, 0xff00 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[6 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("6 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 9 channels, NONE positions, int16 => int16 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000
|
|
|
|
};
|
|
|
|
guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:42:17 +00:00
|
|
|
/* 15 channels, NONE positions, int16 => int16 */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000
|
|
|
|
};
|
|
|
|
guint16 out[] = { 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000, 0xff00, 0x0000, 0xff00, 0x0000, 0x2000, 0x8000, 0x2000,
|
|
|
|
0x0000
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *out_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => int16", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* (C) int16 => float */
|
|
|
|
|
|
|
|
/* 9 channels, NONE positions, int16 => float */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000, 0x8000, 0x0000
|
|
|
|
};
|
|
|
|
gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (9, G_BYTE_ORDER, 32, INTERLEAVED,
|
2011-12-19 13:27:28 +00:00
|
|
|
undefined_positions[9 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => float", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:42:17 +00:00
|
|
|
/* 15 channels, NONE positions, int16 => float */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000, 0x8000, 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000
|
|
|
|
};
|
|
|
|
gfloat out[] =
|
|
|
|
{ -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
|
|
|
|
0.0, -1.0
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (15, G_BYTE_ORDER, 32, INTERLEAVED,
|
2011-12-19 13:27:28 +00:00
|
|
|
undefined_positions[15 - 1]);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => float", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* 9 channels, NONE positions, int16 => float (same as above, but no
|
|
|
|
* position on output caps to see if audioconvert transforms correctly) */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000, 0x8000, 0x0000
|
|
|
|
};
|
|
|
|
gfloat out[] = { -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (9, G_BYTE_ORDER, 32, INTERLEAVED,
|
2011-12-19 13:27:28 +00:00
|
|
|
undefined_positions[9 - 1]);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
gst_structure_remove_field (gst_caps_get_structure (out_caps, 0),
|
|
|
|
"channel-mask");
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("9 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => float", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-30 08:42:17 +00:00
|
|
|
/* 15 channels, NONE positions, int16 => float (same as above, but no
|
|
|
|
* position on output caps to see if audioconvert transforms correctly) */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000, 0x8000, 0x0000, 0x8000, 0x0000, 0x8000, 0x8000, 0x8000,
|
|
|
|
0x0000
|
|
|
|
};
|
|
|
|
gfloat out[] =
|
|
|
|
{ -1.0, 0.0, -1.0, 0.0, 0.0, 0.0, -1.0, 0.0, -1.0, 0.0, -1.0, 0.0, 0.0,
|
|
|
|
0.0, -1.0
|
|
|
|
};
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (15, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[15 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (15, G_BYTE_ORDER, 32, INTERLEAVED,
|
2011-12-19 13:27:28 +00:00
|
|
|
undefined_positions[15 - 1]);
|
2008-05-30 08:42:17 +00:00
|
|
|
|
2011-12-19 13:27:28 +00:00
|
|
|
gst_structure_remove_field (gst_caps_get_structure (out_caps, 0),
|
|
|
|
"channel-mask");
|
2008-05-30 08:42:17 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("15 channels, undefined layout, identity conversion, "
|
|
|
|
"int16 => float", in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
/* 8 channels, NONE positions => 2 channels: should fail, no mixing allowed */
|
|
|
|
{
|
|
|
|
guint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
gfloat out[] = { -1.0, -1.0 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps = get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, FALSE,
|
2018-02-09 12:29:57 +00:00
|
|
|
INTERLEAVED, undefined_positions[8 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (2, G_BYTE_ORDER, 32, INTERLEAVED,
|
|
|
|
NULL);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION_TO_FAIL ("8 channels with layout => 2 channels",
|
|
|
|
in, in_caps, out, out_caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 8 channels, with positions => 2 channels (makes sure channel-position
|
|
|
|
* fields are removed properly in some cases in ::transform_caps, so we
|
|
|
|
* don't up with caps with 2 channels and 8 channel positions) */
|
|
|
|
{
|
|
|
|
GstAudioChannelPosition layout8ch[] = {
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_RIGHT,
|
2011-12-19 13:27:28 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_FRONT_CENTER,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_LFE1,
|
2008-05-06 12:12:16 +00:00
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_REAR_RIGHT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_LEFT,
|
|
|
|
GST_AUDIO_CHANNEL_POSITION_SIDE_RIGHT
|
|
|
|
};
|
|
|
|
gint16 in[] = { 0, 0, 0, 0, 0, 0, 0, 0 };
|
|
|
|
gint16 out[] = { 0, 0 };
|
2011-12-19 13:27:28 +00:00
|
|
|
GstCaps *in_caps =
|
2018-02-09 12:29:57 +00:00
|
|
|
get_int_mc_caps (8, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, layout8ch);
|
|
|
|
GstCaps *out_caps = get_int_mc_caps (2, G_BYTE_ORDER, 16, 16, TRUE,
|
|
|
|
INTERLEAVED, NULL);
|
2008-05-06 12:12:16 +00:00
|
|
|
|
|
|
|
RUN_CONVERSION ("8 channels with layout => 2 channels",
|
|
|
|
in, in_caps, out, out_caps);
|
|
|
|
}
|
2023-10-20 13:21:03 +00:00
|
|
|
|
|
|
|
/* 9 channels, NONE positions => 2 channels, with empty mix-matrix */
|
|
|
|
{
|
|
|
|
guint16 in[] =
|
|
|
|
{ 0, 0, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 };
|
|
|
|
gfloat out[] = { -1.0, -1.0 };
|
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (2, G_BYTE_ORDER, 32, INTERLEAVED,
|
|
|
|
NULL);
|
|
|
|
GValue empty_mix_matrix = G_VALUE_INIT;
|
|
|
|
g_value_init (&empty_mix_matrix, GST_TYPE_ARRAY);
|
|
|
|
|
|
|
|
RUN_CONVERSION_WITH_MATRIX ("9 channels, undefined layout => 2 channels",
|
|
|
|
in, in_caps, out, out_caps, &empty_mix_matrix);
|
|
|
|
g_value_unset (&empty_mix_matrix);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* 9 channels, NONE positions => 2 channels, with specified mix-matrix */
|
|
|
|
{
|
|
|
|
guint16 in[] =
|
|
|
|
{ 0, 0, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000, 0x8000 };
|
|
|
|
gfloat out[] = { -1.0, -1.0 };
|
|
|
|
GstCaps *in_caps = get_int_mc_caps (9, G_BYTE_ORDER, 16, 16, FALSE,
|
|
|
|
INTERLEAVED, undefined_positions[9 - 1]);
|
|
|
|
GstCaps *out_caps = get_float_mc_caps (2, G_BYTE_ORDER, 32, INTERLEAVED,
|
|
|
|
NULL);
|
|
|
|
GValue mix_matrix = G_VALUE_INIT;
|
|
|
|
GValue row = G_VALUE_INIT;
|
|
|
|
GValue value = G_VALUE_INIT;
|
|
|
|
g_value_init (&mix_matrix, GST_TYPE_ARRAY);
|
|
|
|
for (int j = 0; j < 2; j++) {
|
|
|
|
g_value_init (&row, GST_TYPE_ARRAY);
|
|
|
|
for (int i = 0; i < 9; i++) {
|
|
|
|
g_value_init (&value, G_TYPE_FLOAT);
|
|
|
|
g_value_set_float (&value, i == j && i < 2 ? 1 : 0);
|
|
|
|
gst_value_array_append_value (&row, &value);
|
|
|
|
g_value_unset (&value);
|
|
|
|
}
|
|
|
|
gst_value_array_append_value (&mix_matrix, &row);
|
|
|
|
g_value_unset (&row);
|
|
|
|
}
|
|
|
|
|
|
|
|
RUN_CONVERSION_WITH_MATRIX ("9 channels, undefined layout => 2 channels",
|
|
|
|
in, in_caps, out, out_caps, &mix_matrix);
|
|
|
|
g_value_unset (&mix_matrix);
|
|
|
|
}
|
2008-05-06 12:12:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2006-08-21 08:54:06 +00:00
|
|
|
|
2012-10-31 19:01:05 +00:00
|
|
|
#define SIMPLE_CAPS_TEMPLATE_STRING \
|
|
|
|
"audio/x-raw, " \
|
|
|
|
"format = (string) {S8, S16LE, S24LE, S32LE}, " \
|
|
|
|
"rate = (int) [ 1, MAX ], " \
|
|
|
|
"channels = (int) [ 1, MAX ]"
|
|
|
|
|
|
|
|
GST_START_TEST (test_preserve_width)
|
|
|
|
{
|
2014-04-15 11:03:34 +00:00
|
|
|
static GstStaticPadTemplate sinktemplate = GST_STATIC_PAD_TEMPLATE ("sink",
|
2013-05-10 10:29:15 +00:00
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (SIMPLE_CAPS_TEMPLATE_STRING)
|
|
|
|
);
|
2014-04-15 11:03:34 +00:00
|
|
|
static GstStaticPadTemplate srctemplate = GST_STATIC_PAD_TEMPLATE ("src",
|
2013-05-10 10:29:15 +00:00
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS (CONVERT_CAPS_TEMPLATE_STRING)
|
|
|
|
);
|
2012-10-31 19:01:05 +00:00
|
|
|
static const struct _test_formats
|
|
|
|
{
|
|
|
|
int width;
|
|
|
|
const gchar *outf;
|
|
|
|
} test_formats[] = { {
|
2023-03-15 18:51:58 +00:00
|
|
|
8, "S8"}, {
|
|
|
|
16, "S16LE"}, {
|
|
|
|
24, "S24LE"}, {
|
|
|
|
32, "S32LE"}, {
|
|
|
|
0, NULL}
|
|
|
|
};
|
2012-10-31 19:01:05 +00:00
|
|
|
|
|
|
|
gint i;
|
|
|
|
GstStructure *structure;
|
|
|
|
GstElement *audioconvert;
|
|
|
|
GstCaps *incaps, *convert_outcaps;
|
|
|
|
|
|
|
|
audioconvert = gst_check_setup_element ("audioconvert");
|
|
|
|
mysrcpad = gst_check_setup_src_pad (audioconvert, &srctemplate);
|
2013-05-10 10:29:15 +00:00
|
|
|
mysinkpad = gst_check_setup_sink_pad (audioconvert, &sinktemplate);
|
2012-10-31 19:01:05 +00:00
|
|
|
|
|
|
|
gst_pad_set_active (mysrcpad, TRUE);
|
|
|
|
gst_pad_set_active (mysinkpad, TRUE);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
|
|
|
|
for (i = 0; test_formats[i].width; i++) {
|
|
|
|
gint width = test_formats[i].width;
|
2018-02-09 12:29:57 +00:00
|
|
|
incaps = get_int_caps (1, G_BIG_ENDIAN, width, width, TRUE, INTERLEAVED);
|
2012-10-31 19:01:05 +00:00
|
|
|
gst_pad_set_caps (mysrcpad, incaps);
|
|
|
|
|
|
|
|
convert_outcaps = gst_pad_get_current_caps (mysinkpad);
|
|
|
|
structure = gst_caps_get_structure (convert_outcaps, 0);
|
|
|
|
fail_unless_equals_string (gst_structure_get_string (structure, "format"),
|
|
|
|
test_formats[i].outf);
|
|
|
|
|
|
|
|
gst_caps_unref (convert_outcaps);
|
|
|
|
gst_caps_unref (incaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
cleanup_audioconvert (audioconvert);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2015-12-29 13:40:04 +00:00
|
|
|
GST_START_TEST (test_gap_buffers)
|
|
|
|
{
|
|
|
|
GstBuffer *inbuffer, *outbuffer;
|
|
|
|
GstElement *audioconvert;
|
2018-02-09 12:29:57 +00:00
|
|
|
GstCaps *caps = get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED);
|
2015-12-29 13:40:04 +00:00
|
|
|
gint16 data[] = { 0, 0, 0, 0 };
|
|
|
|
gsize data_len = sizeof (data);
|
|
|
|
gint i;
|
|
|
|
|
2023-10-20 13:21:03 +00:00
|
|
|
audioconvert = setup_audioconvert (caps, FALSE, &(GValue) G_VALUE_INIT);
|
2015-12-29 13:40:04 +00:00
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
|
|
|
|
gst_check_setup_events (mysrcpad, audioconvert, caps, GST_FORMAT_TIME);
|
|
|
|
|
|
|
|
inbuffer = gst_buffer_new_and_alloc (data_len);
|
|
|
|
gst_buffer_fill (inbuffer, 0, data, data_len);
|
|
|
|
GST_BUFFER_FLAG_SET (inbuffer, GST_BUFFER_FLAG_GAP);
|
|
|
|
|
|
|
|
for (i = 0; i < 2; i++) {
|
|
|
|
gst_base_transform_set_passthrough (GST_BASE_TRANSFORM (audioconvert),
|
|
|
|
(i == 0));
|
|
|
|
|
|
|
|
gst_pad_push (mysrcpad, inbuffer);
|
|
|
|
|
|
|
|
fail_unless (g_list_length (buffers) == 1);
|
|
|
|
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
|
|
|
|
|
|
|
|
fail_unless (GST_BUFFER_FLAG_IS_SET (outbuffer, GST_BUFFER_FLAG_GAP));
|
|
|
|
|
|
|
|
buffers = g_list_remove (buffers, outbuffer);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("cleanup, unref buffers");
|
|
|
|
gst_buffer_unref (outbuffer);
|
|
|
|
cleanup_audioconvert (audioconvert);
|
|
|
|
GST_DEBUG ("cleanup, unref caps");
|
|
|
|
gst_caps_unref (caps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2018-02-09 15:07:48 +00:00
|
|
|
GST_START_TEST (test_layout_conversion)
|
|
|
|
{
|
|
|
|
/* just layout conversion */
|
|
|
|
{
|
|
|
|
gint16 in[] = { 123, 123, 1024, 1024 };
|
|
|
|
gint16 out[] = { 123, 1024, 123, 1024 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 interleaved -> planar",
|
|
|
|
in, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
RUN_CONVERSION ("int16 interleaved -> planar",
|
|
|
|
in, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
}
|
|
|
|
/* int16 stereo to mono with layout conversion */
|
|
|
|
{
|
|
|
|
gint16 in_i[] = { 16384, -256, 1024, 1024 };
|
|
|
|
gint16 in_p[] = { 16384, 1024, -256, 1024 };
|
|
|
|
gint16 out[] = { 8064, 1024 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 stereo to mono / interleaved -> planar",
|
|
|
|
in_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
RUN_CONVERSION ("int16 stereo to mono / planar -> interleaved",
|
|
|
|
in_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
}
|
|
|
|
/* int16 mono to stereo with layout conversion */
|
|
|
|
{
|
|
|
|
gint16 in[] = { 512, 1024 };
|
|
|
|
gint16 out_i[] = { 512, 512, 1024, 1024 };
|
|
|
|
gint16 out_p[] = { 512, 1024, 512, 1024 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 mono to stereo / planar -> interleaved",
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
RUN_CONVERSION ("int16 mono to stereo / interleaved -> planar",
|
|
|
|
in, get_int_caps (1, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
}
|
|
|
|
/* change format with layout conversion */
|
|
|
|
{
|
|
|
|
gint16 in_p[] = { 0, 32767, -32767, -32768 };
|
|
|
|
gint16 in_i[] = { 0, -32767, 32767, -32768 };
|
|
|
|
guint16 out_p[] = { 32768, 65535, 1, 0 };
|
|
|
|
guint16 out_i[] = { 32768, 1, 65535, 0 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 signed -> unsigned / planar -> interleaved",
|
|
|
|
in_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR),
|
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED));
|
|
|
|
RUN_CONVERSION ("int16 signed -> unsigned / interleaved -> planar",
|
|
|
|
in_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED),
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, FALSE, PLANAR));
|
|
|
|
|
|
|
|
RUN_CONVERSION ("int16 unsigned -> signed / planar -> interleaved",
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, FALSE, PLANAR),
|
|
|
|
in_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
RUN_CONVERSION ("int16 unsigned -> signed / interleaved -> planar",
|
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, FALSE, INTERLEAVED),
|
|
|
|
in_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
}
|
|
|
|
/* channel mixing with layout conversion */
|
|
|
|
{
|
|
|
|
gint16 in_i[] = { 4, 5, 4, 2, 2, 1, 8, 10, 8, 4, 4, 2 };
|
|
|
|
gint16 in_p[] = { 4, 8, 5, 10, 4, 8, 2, 4, 2, 4, 1, 2 };
|
|
|
|
gint16 out_i[] = { 3, 3, 6, 6 };
|
|
|
|
gint16 out_p[] = { 3, 6, 3, 6 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("5.1 to 2 channels / interleaved -> planar", in_i,
|
|
|
|
get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED, NULL),
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
|
|
|
|
RUN_CONVERSION ("5.1 to 2 channels / planar -> interleaved", in_p,
|
|
|
|
get_int_mc_caps (6, G_BYTE_ORDER, 16, 16, TRUE, PLANAR, NULL),
|
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
}
|
|
|
|
/* change format + channels + layout */
|
|
|
|
{
|
|
|
|
guint8 in_i[] = {
|
|
|
|
0x00, 0x04, 0x00, 0x00, 0x05, 0x00, 0x00, 0x04, 0x00,
|
|
|
|
0x00, 0x02, 0x00, 0x00, 0x02, 0x00, 0x00, 0x01, 0x00,
|
|
|
|
0x00, 0x08, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x08, 0x00,
|
|
|
|
0x00, 0x04, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00
|
|
|
|
};
|
|
|
|
guint8 in_p[] = {
|
|
|
|
0x00, 0x04, 0x00, 0x00, 0x08, 0x00, 0x00, 0x05, 0x00,
|
|
|
|
0x00, 0x0a, 0x00, 0x00, 0x04, 0x00, 0x00, 0x08, 0x00,
|
|
|
|
0x00, 0x02, 0x00, 0x00, 0x04, 0x00, 0x00, 0x02, 0x00,
|
|
|
|
0x00, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x02, 0x00
|
|
|
|
};
|
|
|
|
gint16 out_i[] = { 3, 3, 6, 6 };
|
|
|
|
gint16 out_p[] = { 3, 6, 3, 6 };
|
|
|
|
|
|
|
|
RUN_CONVERSION ("5.1 to 2 channels / S24LE interleaved -> S16 planar", in_i,
|
|
|
|
get_int_mc_caps (6, G_LITTLE_ENDIAN, 24, 24, TRUE, INTERLEAVED, NULL),
|
|
|
|
out_p, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, PLANAR));
|
|
|
|
RUN_CONVERSION ("5.1 to 2 channels / S24LE planar -> S16 interleaved", in_p,
|
|
|
|
get_int_mc_caps (6, G_LITTLE_ENDIAN, 24, 24, TRUE, PLANAR, NULL),
|
|
|
|
out_i, get_int_caps (2, G_BYTE_ORDER, 16, 16, TRUE, INTERLEAVED));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
2015-12-29 13:40:04 +00:00
|
|
|
|
2018-10-05 12:37:45 +00:00
|
|
|
GST_START_TEST (test_layout_conv_fixate_caps)
|
|
|
|
{
|
|
|
|
GstCaps *incaps, *outcaps;
|
|
|
|
GstElement *audioconvert;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
incaps = gst_caps_from_string ("audio/x-raw, "
|
|
|
|
"format = (string) F32LE, "
|
|
|
|
"layout = (string) interleaved, "
|
2018-11-28 03:51:53 +00:00
|
|
|
"rate = (int) 44100, " "channels = (int) 1");
|
2018-10-05 12:37:45 +00:00
|
|
|
outcaps = gst_caps_from_string ("audio/x-raw, "
|
|
|
|
"format = (string) S16LE, "
|
|
|
|
"layout = (string) interleaved, "
|
|
|
|
"rate = (int) [ 1, MAX ], "
|
|
|
|
"channels = (int) 2;"
|
|
|
|
"audio/x-raw, "
|
|
|
|
"format = (string) { F32LE, F32BE, F64LE, F64BE }, "
|
|
|
|
"layout = (string) non-interleaved, "
|
2018-11-28 03:51:53 +00:00
|
|
|
"rate = (int) [ 1, MAX ], " "channels = (int) [1, 8]");
|
2018-10-05 12:37:45 +00:00
|
|
|
|
2023-10-20 13:21:03 +00:00
|
|
|
audioconvert = setup_audioconvert (outcaps, FALSE, &(GValue) G_VALUE_INIT);
|
2018-10-05 12:37:45 +00:00
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
|
|
|
|
gst_check_setup_events (mysrcpad, audioconvert, incaps, GST_FORMAT_TIME);
|
|
|
|
|
|
|
|
caps = gst_pad_get_current_caps (mysinkpad);
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
assert_equals_string (gst_structure_get_string (s, "format"), "F32LE");
|
|
|
|
assert_equals_string (gst_structure_get_string (s, "layout"),
|
|
|
|
"non-interleaved");
|
2019-03-06 09:22:17 +00:00
|
|
|
gst_clear_caps (&caps);
|
2018-10-05 12:37:45 +00:00
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
/* cleanup */
|
|
|
|
GST_DEBUG ("cleanup audioconvert");
|
|
|
|
cleanup_audioconvert (audioconvert);
|
|
|
|
GST_DEBUG ("cleanup, unref incaps");
|
|
|
|
gst_caps_unref (incaps);
|
|
|
|
gst_caps_unref (outcaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
2024-05-09 09:41:45 +00:00
|
|
|
GST_START_TEST (test_96_channels_conversion)
|
|
|
|
{
|
|
|
|
GstCaps *incaps, *outcaps;
|
|
|
|
GstElement *audioconvert;
|
|
|
|
GstCaps *caps;
|
|
|
|
GstStructure *s;
|
|
|
|
|
|
|
|
incaps = gst_caps_from_string ("audio/x-raw, "
|
|
|
|
"format = (string) F32LE, "
|
|
|
|
"layout = (string) interleaved, "
|
|
|
|
"rate = (int) 44100, "
|
|
|
|
"channels = (int) 96, " "channel-mask = (bitmask) 0");
|
|
|
|
outcaps = gst_caps_from_string ("audio/x-raw, "
|
|
|
|
"format = (string) F64LE, " "layout = (string) non-interleaved");
|
|
|
|
|
|
|
|
audioconvert = setup_audioconvert (outcaps, FALSE, &(GValue) G_VALUE_INIT);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
|
|
|
"could not set to playing");
|
|
|
|
|
|
|
|
gst_check_setup_events (mysrcpad, audioconvert, incaps, GST_FORMAT_TIME);
|
|
|
|
|
|
|
|
caps = gst_pad_get_current_caps (mysinkpad);
|
|
|
|
s = gst_caps_get_structure (caps, 0);
|
|
|
|
assert_equals_string (gst_structure_get_string (s, "format"), "F64LE");
|
|
|
|
assert_equals_string (gst_structure_get_string (s, "layout"),
|
|
|
|
"non-interleaved");
|
|
|
|
gst_clear_caps (&caps);
|
|
|
|
|
|
|
|
fail_unless (gst_element_set_state (audioconvert,
|
|
|
|
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
|
|
|
/* cleanup */
|
|
|
|
GST_DEBUG ("cleanup audioconvert");
|
|
|
|
cleanup_audioconvert (audioconvert);
|
|
|
|
GST_DEBUG ("cleanup, unref incaps");
|
|
|
|
gst_caps_unref (incaps);
|
|
|
|
gst_caps_unref (outcaps);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_END_TEST;
|
|
|
|
|
|
|
|
|
Correct all relevant warnings found by the sparse semantic code analyzer. This include marking several symbols static...
Original commit message from CVS:
* ext/alsa/gstalsamixertrack.c: (gst_alsa_mixer_track_get_type):
* ext/alsa/gstalsasink.c: (set_hwparams):
* ext/alsa/gstalsasrc.c: (set_hwparams):
* ext/gio/gstgio.c: (gst_gio_uri_handler_get_uri):
* ext/ogg/gstoggmux.h:
* ext/ogg/gstogmparse.c:
* gst-libs/gst/audio/audio.c:
* gst-libs/gst/fft/kiss_fft_f64.c: (kiss_fft_f64_alloc):
* gst-libs/gst/pbutils/missing-plugins.c:
(gst_missing_uri_sink_message_new),
(gst_missing_element_message_new),
(gst_missing_decoder_message_new),
(gst_missing_encoder_message_new):
* gst-libs/gst/rtp/gstbasertppayload.c:
* gst-libs/gst/rtp/gstrtcpbuffer.c:
(gst_rtcp_packet_bye_get_reason):
* gst/audioconvert/gstaudioconvert.c:
* gst/audioresample/gstaudioresample.c:
* gst/ffmpegcolorspace/imgconvert.c:
* gst/playback/test.c: (gen_video_element), (gen_audio_element):
* gst/typefind/gsttypefindfunctions.c:
* gst/videoscale/vs_4tap.c:
* gst/videoscale/vs_4tap.h:
* sys/v4l/gstv4lelement.c:
* sys/v4l/gstv4lsrc.c: (gst_v4lsrc_get_any_caps):
* sys/v4l/v4l_calls.c:
* sys/v4l/v4lsrc_calls.c: (gst_v4lsrc_capture_init),
(gst_v4lsrc_try_capture):
* sys/ximage/ximagesink.c: (gst_ximagesink_check_xshm_calls),
(gst_ximagesink_ximage_new):
* sys/xvimage/xvimagesink.c: (gst_xvimagesink_check_xshm_calls),
(gst_xvimagesink_xvimage_new):
* tests/check/elements/audioconvert.c:
* tests/check/elements/audioresample.c:
(fail_unless_perfect_stream):
* tests/check/elements/audiotestsrc.c: (setup_audiotestsrc):
* tests/check/elements/decodebin.c:
* tests/check/elements/gdpdepay.c: (setup_gdpdepay),
(setup_gdpdepay_streamheader):
* tests/check/elements/gdppay.c: (setup_gdppay), (GST_START_TEST),
(setup_gdppay_streamheader):
* tests/check/elements/gnomevfssink.c: (setup_gnomevfssink):
* tests/check/elements/multifdsink.c: (setup_multifdsink):
* tests/check/elements/textoverlay.c:
* tests/check/elements/videorate.c: (setup_videorate):
* tests/check/elements/videotestsrc.c: (setup_videotestsrc):
* tests/check/elements/volume.c: (setup_volume):
* tests/check/elements/vorbisdec.c: (setup_vorbisdec):
* tests/check/elements/vorbistag.c:
* tests/check/generic/clock-selection.c:
* tests/check/generic/states.c: (setup), (teardown):
* tests/check/libs/cddabasesrc.c:
* tests/check/libs/video.c:
* tests/check/pipelines/gio.c:
* tests/check/pipelines/oggmux.c:
* tests/check/pipelines/simple-launch-lines.c:
(simple_launch_lines_suite):
* tests/check/pipelines/streamheader.c:
* tests/check/pipelines/theoraenc.c:
* tests/check/pipelines/vorbisdec.c:
* tests/check/pipelines/vorbisenc.c:
* tests/examples/seek/scrubby.c:
* tests/examples/seek/seek.c: (query_positions_elems),
(query_positions_pads):
* tests/icles/stress-xoverlay.c: (myclock):
Correct all relevant warnings found by the sparse semantic code
analyzer. This include marking several symbols static, using
NULL instead of 0 for pointers and using "foo (void)" instead
of "foo ()" for declarations.
* win32/common/libgstrtp.def:
Add gst_rtp_buffer_set_extension_data to the symbol definition file.
2008-03-03 06:04:31 +00:00
|
|
|
static Suite *
|
2005-08-25 17:20:02 +00:00
|
|
|
audioconvert_suite (void)
|
|
|
|
{
|
|
|
|
Suite *s = suite_create ("audioconvert");
|
|
|
|
TCase *tc_chain = tcase_create ("general");
|
|
|
|
|
|
|
|
suite_add_tcase (s, tc_chain);
|
2005-08-25 18:03:48 +00:00
|
|
|
tcase_add_test (tc_chain, test_int16);
|
2007-02-28 11:47:45 +00:00
|
|
|
tcase_add_test (tc_chain, test_float32);
|
2006-04-28 14:22:16 +00:00
|
|
|
tcase_add_test (tc_chain, test_int_conversion);
|
|
|
|
tcase_add_test (tc_chain, test_float_conversion);
|
2015-12-29 13:23:59 +00:00
|
|
|
tcase_add_test (tc_chain, test_int_float_conversion);
|
2006-05-14 18:15:17 +00:00
|
|
|
tcase_add_test (tc_chain, test_multichannel_conversion);
|
2024-02-08 19:37:53 +00:00
|
|
|
tcase_add_test (tc_chain,
|
|
|
|
test_multichannel_crossmixing_with_input_channels_reorder);
|
|
|
|
tcase_add_test (tc_chain,
|
|
|
|
test_multichannel_downmixing_to_stereo_with_input_channels_reorder);
|
2015-12-29 13:23:59 +00:00
|
|
|
tcase_add_test (tc_chain, test_passthrough);
|
2006-08-21 08:54:06 +00:00
|
|
|
tcase_add_test (tc_chain, test_caps_negotiation);
|
2008-05-06 12:12:16 +00:00
|
|
|
tcase_add_test (tc_chain, test_convert_undefined_multichannel);
|
2012-10-31 19:01:05 +00:00
|
|
|
tcase_add_test (tc_chain, test_preserve_width);
|
2015-12-29 13:40:04 +00:00
|
|
|
tcase_add_test (tc_chain, test_gap_buffers);
|
2018-02-09 15:07:48 +00:00
|
|
|
tcase_add_test (tc_chain, test_layout_conversion);
|
2018-10-05 12:37:45 +00:00
|
|
|
tcase_add_test (tc_chain, test_layout_conv_fixate_caps);
|
2024-05-09 09:41:45 +00:00
|
|
|
tcase_add_test (tc_chain, test_96_channels_conversion);
|
2015-12-29 13:23:59 +00:00
|
|
|
|
2005-08-25 17:20:02 +00:00
|
|
|
return s;
|
|
|
|
}
|
|
|
|
|
2008-05-06 12:12:16 +00:00
|
|
|
GST_CHECK_MAIN (audioconvert);
|