mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
channelmix: GstChannel -> GstAudioChannel
Rename GstChannel to GstAudioChannel
This commit is contained in:
parent
59db8ce542
commit
7f5104f52f
3 changed files with 136 additions and 122 deletions
|
@ -78,7 +78,7 @@ struct _GstAudioConverter
|
|||
|
||||
GstAudioFormat mix_format;
|
||||
gboolean mix_passthrough;
|
||||
GstChannelMix *mix;
|
||||
GstAudioChannelMix *mix;
|
||||
|
||||
AudioConvertFunc convert_out;
|
||||
|
||||
|
@ -203,7 +203,7 @@ gst_audio_converter_new (GstAudioInfo * in, GstAudioInfo * out,
|
|||
{
|
||||
GstAudioConverter *convert;
|
||||
gint in_depth, out_depth;
|
||||
GstChannelMixFlags flags;
|
||||
GstAudioChannelMixFlags flags;
|
||||
gboolean in_int, out_int;
|
||||
GstAudioFormat format;
|
||||
GstAudioDitherMethod dither;
|
||||
|
@ -242,10 +242,10 @@ gst_audio_converter_new (GstAudioInfo * in, GstAudioInfo * out,
|
|||
|
||||
flags =
|
||||
GST_AUDIO_INFO_IS_UNPOSITIONED (in) ?
|
||||
GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN : 0;
|
||||
GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN : 0;
|
||||
flags |=
|
||||
GST_AUDIO_INFO_IS_UNPOSITIONED (out) ?
|
||||
GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT : 0;
|
||||
GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT : 0;
|
||||
|
||||
|
||||
/* step 1, unpack */
|
||||
|
@ -264,9 +264,10 @@ gst_audio_converter_new (GstAudioInfo * in, GstAudioInfo * out,
|
|||
|
||||
/* step 3, channel mix */
|
||||
convert->mix_format = format;
|
||||
convert->mix = gst_channel_mix_new (flags, in->channels, in->position,
|
||||
convert->mix = gst_audio_channel_mix_new (flags, in->channels, in->position,
|
||||
out->channels, out->position);
|
||||
convert->mix_passthrough = gst_channel_mix_is_passthrough (convert->mix);
|
||||
convert->mix_passthrough =
|
||||
gst_audio_channel_mix_is_passthrough (convert->mix);
|
||||
GST_INFO ("mix format %s, passthrough %d, in_channels %d, out_channels %d",
|
||||
gst_audio_format_to_string (format), convert->mix_passthrough,
|
||||
in->channels, out->channels);
|
||||
|
@ -336,7 +337,7 @@ gst_audio_converter_free (GstAudioConverter * convert)
|
|||
if (convert->quant)
|
||||
gst_audio_quantize_free (convert->quant);
|
||||
if (convert->mix)
|
||||
gst_channel_mix_free (convert->mix);
|
||||
gst_audio_channel_mix_free (convert->mix);
|
||||
gst_audio_info_init (&convert->in);
|
||||
gst_audio_info_init (&convert->out);
|
||||
|
||||
|
@ -426,8 +427,8 @@ gst_audio_converter_samples (GstAudioConverter * convert,
|
|||
else
|
||||
outbuf = tmpbuf;
|
||||
|
||||
gst_channel_mix_mix (convert->mix, convert->mix_format, convert->in.layout,
|
||||
src, outbuf, samples);
|
||||
gst_audio_channel_mix_samples (convert->mix, convert->mix_format,
|
||||
convert->in.layout, src, outbuf, samples);
|
||||
src = outbuf;
|
||||
}
|
||||
/* step 4, optional convert F64 -> S32 for quantize */
|
||||
|
|
|
@ -31,9 +31,9 @@
|
|||
|
||||
#define INT_MATRIX_FACTOR_EXPONENT 10
|
||||
|
||||
struct _GstChannelMix
|
||||
struct _GstAudioChannelMix
|
||||
{
|
||||
GstChannelMixFlags flags;
|
||||
GstAudioChannelMixFlags flags;
|
||||
|
||||
gint in_channels;
|
||||
gint out_channels;
|
||||
|
@ -53,13 +53,13 @@ struct _GstChannelMix
|
|||
};
|
||||
|
||||
/**
|
||||
* gst_channel_mix_free:
|
||||
* @mix: a #GstChannelMix
|
||||
* gst_audio_channel_mix_free:
|
||||
* @mix: a #GstAudioChannelMix
|
||||
*
|
||||
* Free memory allocated by @mix.
|
||||
*/
|
||||
void
|
||||
gst_channel_mix_free (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_free (GstAudioChannelMix * mix)
|
||||
{
|
||||
gint i;
|
||||
|
||||
|
@ -77,7 +77,7 @@ gst_channel_mix_free (GstChannelMix * mix)
|
|||
g_free (mix->tmp);
|
||||
mix->tmp = NULL;
|
||||
|
||||
g_slice_free (GstChannelMix, mix);
|
||||
g_slice_free (GstAudioChannelMix, mix);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -87,7 +87,7 @@ gst_channel_mix_free (GstChannelMix * mix)
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_identical (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_identical (GstAudioChannelMix * mix)
|
||||
{
|
||||
gint ci, co;
|
||||
|
||||
|
@ -111,7 +111,7 @@ gst_channel_mix_fill_identical (GstChannelMix * mix)
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_compatible (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_compatible (GstAudioChannelMix * mix)
|
||||
{
|
||||
/* Conversions from one-channel to compatible two-channel configs */
|
||||
struct
|
||||
|
@ -209,10 +209,10 @@ gst_channel_mix_fill_compatible (GstChannelMix * mix)
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_channel_mix_detect_pos (gint channels, GstAudioChannelPosition position[64],
|
||||
gint * f, gboolean * has_f,
|
||||
gint * c, gboolean * has_c, gint * r, gboolean * has_r,
|
||||
gint * s, gboolean * has_s, gint * b, gboolean * has_b)
|
||||
gst_audio_channel_mix_detect_pos (gint channels,
|
||||
GstAudioChannelPosition position[64], gint * f, gboolean * has_f, gint * c,
|
||||
gboolean * has_c, gint * r, gboolean * has_r, gint * s, gboolean * has_s,
|
||||
gint * b, gboolean * has_b)
|
||||
{
|
||||
gint n;
|
||||
|
||||
|
@ -273,7 +273,7 @@ gst_channel_mix_detect_pos (gint channels, GstAudioChannelPosition position[64],
|
|||
}
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_one_other (gfloat ** matrix,
|
||||
gst_audio_channel_mix_fill_one_other (gfloat ** matrix,
|
||||
gint * from_idx, gint * to_idx, gfloat ratio)
|
||||
{
|
||||
|
||||
|
@ -339,7 +339,7 @@ gst_channel_mix_fill_one_other (gfloat ** matrix,
|
|||
#define RATIO_REAR_BASS (1.0 / sqrt (2.0))
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_others (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_others (GstAudioChannelMix * mix)
|
||||
{
|
||||
gboolean in_has_front = FALSE, out_has_front = FALSE,
|
||||
in_has_center = FALSE, out_has_center = FALSE,
|
||||
|
@ -364,11 +364,11 @@ gst_channel_mix_fill_others (GstChannelMix * mix)
|
|||
|
||||
/* First see where (if at all) the various channels from/to
|
||||
* which we want to convert are located in our matrix/array. */
|
||||
gst_channel_mix_detect_pos (mix->in_channels, mix->in_position,
|
||||
gst_audio_channel_mix_detect_pos (mix->in_channels, mix->in_position,
|
||||
in_f, &in_has_front,
|
||||
in_c, &in_has_center, in_r, &in_has_rear,
|
||||
in_s, &in_has_side, in_b, &in_has_bass);
|
||||
gst_channel_mix_detect_pos (mix->out_channels, mix->out_position,
|
||||
gst_audio_channel_mix_detect_pos (mix->out_channels, mix->out_position,
|
||||
out_f, &out_has_front,
|
||||
out_c, &out_has_center, out_r, &out_has_rear,
|
||||
out_s, &out_has_side, out_b, &out_has_bass);
|
||||
|
@ -385,137 +385,149 @@ gst_channel_mix_fill_others (GstChannelMix * mix)
|
|||
|
||||
/* center <-> front/side/rear */
|
||||
if (!in_has_center && in_has_front && out_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_c,
|
||||
RATIO_CENTER_FRONT);
|
||||
} else if (!in_has_center && !in_has_front && in_has_side && out_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_c,
|
||||
RATIO_CENTER_SIDE);
|
||||
} else if (!in_has_center && !in_has_front && !in_has_side && in_has_rear
|
||||
&& out_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_c,
|
||||
RATIO_CENTER_REAR);
|
||||
} else if (in_has_center && !out_has_center && out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
RATIO_CENTER_FRONT);
|
||||
} else if (in_has_center && !out_has_center && !out_has_front && out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_s,
|
||||
RATIO_CENTER_SIDE);
|
||||
} else if (in_has_center && !out_has_center && !out_has_front && !out_has_side
|
||||
&& out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_r,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_r,
|
||||
RATIO_CENTER_REAR);
|
||||
}
|
||||
|
||||
/* front <-> center/side/rear */
|
||||
if (!in_has_front && in_has_center && !in_has_side && out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
RATIO_CENTER_FRONT);
|
||||
} else if (!in_has_front && !in_has_center && in_has_side && out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_f, RATIO_FRONT_SIDE);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
RATIO_FRONT_SIDE);
|
||||
} else if (!in_has_front && in_has_center && in_has_side && out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_f,
|
||||
0.5 * RATIO_CENTER_FRONT);
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
0.5 * RATIO_FRONT_SIDE);
|
||||
} else if (!in_has_front && !in_has_center && !in_has_side && in_has_rear
|
||||
&& out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_f, RATIO_FRONT_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_f,
|
||||
RATIO_FRONT_REAR);
|
||||
} else if (in_has_front && out_has_center && !out_has_side && !out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix,
|
||||
in_f, out_c, RATIO_CENTER_FRONT);
|
||||
} else if (in_has_front && !out_has_center && out_has_side && !out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_s, RATIO_FRONT_SIDE);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
RATIO_FRONT_SIDE);
|
||||
} else if (in_has_front && out_has_center && out_has_side && !out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_c,
|
||||
0.5 * RATIO_CENTER_FRONT);
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
0.5 * RATIO_FRONT_SIDE);
|
||||
} else if (in_has_front && !out_has_center && !out_has_side && !out_has_front
|
||||
&& out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_r, RATIO_FRONT_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_r,
|
||||
RATIO_FRONT_REAR);
|
||||
}
|
||||
|
||||
/* side <-> center/front/rear */
|
||||
if (!in_has_side && in_has_front && !in_has_rear && out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_s, RATIO_FRONT_SIDE);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
RATIO_FRONT_SIDE);
|
||||
} else if (!in_has_side && !in_has_front && in_has_rear && out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_s, RATIO_SIDE_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_s,
|
||||
RATIO_SIDE_REAR);
|
||||
} else if (!in_has_side && in_has_front && in_has_rear && out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_s,
|
||||
0.5 * RATIO_FRONT_SIDE);
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_s,
|
||||
0.5 * RATIO_SIDE_REAR);
|
||||
} else if (!in_has_side && !in_has_front && !in_has_rear && in_has_center
|
||||
&& out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_s,
|
||||
RATIO_CENTER_SIDE);
|
||||
} else if (in_has_side && out_has_front && !out_has_rear && !out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_f, RATIO_FRONT_SIDE);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
RATIO_FRONT_SIDE);
|
||||
} else if (in_has_side && !out_has_front && out_has_rear && !out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_r, RATIO_SIDE_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_r,
|
||||
RATIO_SIDE_REAR);
|
||||
} else if (in_has_side && out_has_front && out_has_rear && !out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_f,
|
||||
0.5 * RATIO_FRONT_SIDE);
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_r,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_r,
|
||||
0.5 * RATIO_SIDE_REAR);
|
||||
} else if (in_has_side && !out_has_front && !out_has_rear && out_has_center
|
||||
&& !out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_c,
|
||||
RATIO_CENTER_SIDE);
|
||||
}
|
||||
|
||||
/* rear <-> center/front/side */
|
||||
if (!in_has_rear && in_has_side && out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_r, RATIO_SIDE_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_r,
|
||||
RATIO_SIDE_REAR);
|
||||
} else if (!in_has_rear && !in_has_side && in_has_front && out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_r, RATIO_FRONT_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_r,
|
||||
RATIO_FRONT_REAR);
|
||||
} else if (!in_has_rear && !in_has_side && !in_has_front && in_has_center
|
||||
&& out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_r,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_r,
|
||||
RATIO_CENTER_REAR);
|
||||
} else if (in_has_rear && !out_has_rear && out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_s, RATIO_SIDE_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_s,
|
||||
RATIO_SIDE_REAR);
|
||||
} else if (in_has_rear && !out_has_rear && !out_has_side && out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_f, RATIO_FRONT_REAR);
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_f,
|
||||
RATIO_FRONT_REAR);
|
||||
} else if (in_has_rear && !out_has_rear && !out_has_side && !out_has_front
|
||||
&& out_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_c,
|
||||
RATIO_CENTER_REAR);
|
||||
}
|
||||
|
||||
/* bass <-> any */
|
||||
if (in_has_bass && !out_has_bass) {
|
||||
if (out_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_b, out_c,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_b, out_c,
|
||||
RATIO_CENTER_BASS);
|
||||
}
|
||||
if (out_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_b, out_f,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_b, out_f,
|
||||
RATIO_FRONT_BASS);
|
||||
}
|
||||
if (out_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_b, out_s,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_b, out_s,
|
||||
RATIO_SIDE_BASS);
|
||||
}
|
||||
if (out_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_b, out_r,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_b, out_r,
|
||||
RATIO_REAR_BASS);
|
||||
}
|
||||
} else if (!in_has_bass && out_has_bass) {
|
||||
if (in_has_center) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_c, out_b,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_c, out_b,
|
||||
RATIO_CENTER_BASS);
|
||||
}
|
||||
if (in_has_front) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_f, out_b,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_f, out_b,
|
||||
RATIO_FRONT_BASS);
|
||||
}
|
||||
if (in_has_side) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_s, out_b,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_s, out_b,
|
||||
RATIO_REAR_BASS);
|
||||
}
|
||||
if (in_has_rear) {
|
||||
gst_channel_mix_fill_one_other (mix->matrix, in_r, out_b,
|
||||
gst_audio_channel_mix_fill_one_other (mix->matrix, in_r, out_b,
|
||||
RATIO_REAR_BASS);
|
||||
}
|
||||
}
|
||||
|
@ -526,7 +538,7 @@ gst_channel_mix_fill_others (GstChannelMix * mix)
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_normalize (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_normalize (GstAudioChannelMix * mix)
|
||||
{
|
||||
gfloat sum, top = 0;
|
||||
gint i, j;
|
||||
|
@ -554,7 +566,7 @@ gst_channel_mix_fill_normalize (GstChannelMix * mix)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gst_channel_mix_fill_special (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_special (GstAudioChannelMix * mix)
|
||||
{
|
||||
/* Special, standard conversions here */
|
||||
|
||||
|
@ -589,23 +601,23 @@ gst_channel_mix_fill_special (GstChannelMix * mix)
|
|||
*/
|
||||
|
||||
static void
|
||||
gst_channel_mix_fill_matrix (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_fill_matrix (GstAudioChannelMix * mix)
|
||||
{
|
||||
if (gst_channel_mix_fill_special (mix))
|
||||
if (gst_audio_channel_mix_fill_special (mix))
|
||||
return;
|
||||
|
||||
gst_channel_mix_fill_identical (mix);
|
||||
gst_audio_channel_mix_fill_identical (mix);
|
||||
|
||||
if (!(mix->flags & GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN)) {
|
||||
gst_channel_mix_fill_compatible (mix);
|
||||
gst_channel_mix_fill_others (mix);
|
||||
gst_channel_mix_fill_normalize (mix);
|
||||
if (!(mix->flags & GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN)) {
|
||||
gst_audio_channel_mix_fill_compatible (mix);
|
||||
gst_audio_channel_mix_fill_others (mix);
|
||||
gst_audio_channel_mix_fill_normalize (mix);
|
||||
}
|
||||
}
|
||||
|
||||
/* only call mix after mix->matrix is fully set up and normalized */
|
||||
static void
|
||||
gst_channel_mix_setup_matrix_int (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_setup_matrix_int (GstAudioChannelMix * mix)
|
||||
{
|
||||
gint i, j;
|
||||
gfloat tmp;
|
||||
|
@ -624,7 +636,7 @@ gst_channel_mix_setup_matrix_int (GstChannelMix * mix)
|
|||
}
|
||||
|
||||
static void
|
||||
gst_channel_mix_setup_matrix (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_setup_matrix (GstAudioChannelMix * mix)
|
||||
{
|
||||
gint i, j;
|
||||
|
||||
|
@ -639,9 +651,9 @@ gst_channel_mix_setup_matrix (GstChannelMix * mix)
|
|||
}
|
||||
|
||||
/* setup the matrix' internal values */
|
||||
gst_channel_mix_fill_matrix (mix);
|
||||
gst_audio_channel_mix_fill_matrix (mix);
|
||||
|
||||
gst_channel_mix_setup_matrix_int (mix);
|
||||
gst_audio_channel_mix_setup_matrix_int (mix);
|
||||
|
||||
#ifndef GST_DISABLE_GST_DEBUG
|
||||
/* debug */
|
||||
|
@ -670,7 +682,7 @@ gst_channel_mix_setup_matrix (GstChannelMix * mix)
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_channel_mix_new:
|
||||
* gst_audio_channel_mix_new:
|
||||
* @flags:
|
||||
* @in_channels:
|
||||
* @in_position:
|
||||
|
@ -679,19 +691,19 @@ gst_channel_mix_setup_matrix (GstChannelMix * mix)
|
|||
*
|
||||
* Create a new channel mixer object.
|
||||
*
|
||||
* Returns: a new #GstChannelMix object. Free with gst_channel_mix_free()
|
||||
* Returns: a new #GstAudioChannelMix object. Free with gst_audio_channel_mix_free()
|
||||
* after usage.
|
||||
*/
|
||||
GstChannelMix *
|
||||
gst_channel_mix_new (GstChannelMixFlags flags,
|
||||
GstAudioChannelMix *
|
||||
gst_audio_channel_mix_new (GstAudioChannelMixFlags flags,
|
||||
gint in_channels,
|
||||
GstAudioChannelPosition in_position[64],
|
||||
gint out_channels, GstAudioChannelPosition out_position[64])
|
||||
{
|
||||
GstChannelMix *mix;
|
||||
GstAudioChannelMix *mix;
|
||||
gint i;
|
||||
|
||||
mix = g_slice_new0 (GstChannelMix);
|
||||
mix = g_slice_new0 (GstAudioChannelMix);
|
||||
mix->flags = flags;
|
||||
mix->in_channels = in_channels;
|
||||
mix->out_channels = out_channels;
|
||||
|
@ -699,21 +711,21 @@ gst_channel_mix_new (GstChannelMixFlags flags,
|
|||
mix->in_position[i] = in_position[i];
|
||||
mix->out_position[i] = out_position[i];
|
||||
}
|
||||
gst_channel_mix_setup_matrix (mix);
|
||||
gst_audio_channel_mix_setup_matrix (mix);
|
||||
|
||||
return mix;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_channel_mix_is_passthrough:
|
||||
* @mix: a #GstChannelMix
|
||||
* gst_audio_channel_mix_is_passthrough:
|
||||
* @mix: a #GstAudioChannelMix
|
||||
*
|
||||
* Check if @mix is in passthrough.
|
||||
*
|
||||
* Returns: %TRUE is @mix is passthrough.
|
||||
*/
|
||||
gboolean
|
||||
gst_channel_mix_is_passthrough (GstChannelMix * mix)
|
||||
gst_audio_channel_mix_is_passthrough (GstAudioChannelMix * mix)
|
||||
{
|
||||
gint i;
|
||||
guint64 in_mask, out_mask;
|
||||
|
@ -738,7 +750,7 @@ gst_channel_mix_is_passthrough (GstChannelMix * mix)
|
|||
/* IMPORTANT: out_data == in_data is possible, make sure to not overwrite data
|
||||
* you might need later on! */
|
||||
static void
|
||||
gst_channel_mix_mix_int (GstChannelMix * mix,
|
||||
gst_audio_channel_mix_mix_int (GstAudioChannelMix * mix,
|
||||
const gint32 * in_data, gint32 * out_data, gint samples)
|
||||
{
|
||||
gint in, out, n;
|
||||
|
@ -779,7 +791,7 @@ gst_channel_mix_mix_int (GstChannelMix * mix,
|
|||
}
|
||||
|
||||
static void
|
||||
gst_channel_mix_mix_double (GstChannelMix * mix,
|
||||
gst_audio_channel_mix_mix_double (GstAudioChannelMix * mix,
|
||||
const gdouble * in_data, gdouble * out_data, gint samples)
|
||||
{
|
||||
gint in, out, n;
|
||||
|
@ -817,8 +829,8 @@ gst_channel_mix_mix_double (GstChannelMix * mix,
|
|||
}
|
||||
|
||||
/**
|
||||
* gst_channel_mix_mix:
|
||||
* @mix: a #GstChannelMix
|
||||
* gst_audio_channel_mix_samples:
|
||||
* @mix: a #GstAudioChannelMix
|
||||
* @format: a #GstAudioFormat
|
||||
* @layout: a #GstAudioLayout
|
||||
* @in_data: input samples
|
||||
|
@ -829,7 +841,7 @@ gst_channel_mix_mix_double (GstChannelMix * mix,
|
|||
* @in_data and @out_data need to be in @format and @layout.
|
||||
*/
|
||||
void
|
||||
gst_channel_mix_mix (GstChannelMix * mix, GstAudioFormat format,
|
||||
gst_audio_channel_mix_samples (GstAudioChannelMix * mix, GstAudioFormat format,
|
||||
GstAudioLayout layout, const gpointer in_data, gpointer out_data,
|
||||
gint samples)
|
||||
{
|
||||
|
@ -839,11 +851,11 @@ gst_channel_mix_mix (GstChannelMix * mix, GstAudioFormat format,
|
|||
|
||||
switch (format) {
|
||||
case GST_AUDIO_FORMAT_S32:
|
||||
gst_channel_mix_mix_int (mix, (const gint32 *) in_data,
|
||||
gst_audio_channel_mix_mix_int (mix, (const gint32 *) in_data,
|
||||
(gint32 *) out_data, samples);
|
||||
break;
|
||||
case GST_AUDIO_FORMAT_F64:
|
||||
gst_channel_mix_mix_double (mix, (const gdouble *) in_data,
|
||||
gst_audio_channel_mix_mix_double (mix, (const gdouble *) in_data,
|
||||
(gdouble *) out_data, samples);
|
||||
break;
|
||||
default:
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
/* GStreamer
|
||||
* Copyright (C) 2004 Ronald Bultje <rbultje@ronald.bitfreak.net>
|
||||
* (C) 2015 Wim Taymans <wim.taymans@gmail.com>
|
||||
*
|
||||
* gstchannelmix.h: setup of channel conversion matrices
|
||||
* audiochannelmix.h: setup of channel conversion matrices
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Library General Public
|
||||
|
@ -19,48 +20,48 @@
|
|||
* Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef __GST_CHANNEL_MIX_H__
|
||||
#define __GST_CHANNEL_MIX_H__
|
||||
#ifndef __GST_AUDIO_CHANNEL_MIX_H__
|
||||
#define __GST_AUDIO_CHANNEL_MIX_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/audio/audio.h>
|
||||
|
||||
typedef struct _GstChannelMix GstChannelMix;
|
||||
typedef struct _GstAudioChannelMix GstAudioChannelMix;
|
||||
|
||||
/**
|
||||
* GstChannelMixFlags:
|
||||
* @GST_CHANNEL_MIX_FLAGS_NONE: no flag
|
||||
* @GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN: input channels are explicitly unpositioned
|
||||
* @GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT: output channels are explicitly unpositioned
|
||||
* GstAudioChannelMixFlags:
|
||||
* @GST_AUDIO_CHANNEL_MIX_FLAGS_NONE: no flag
|
||||
* @GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN: input channels are explicitly unpositioned
|
||||
* @GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT: output channels are explicitly unpositioned
|
||||
*
|
||||
* Flags passed to gst_channel_mix_new()
|
||||
* Flags passed to gst_audio_channel_mix_new()
|
||||
*/
|
||||
typedef enum {
|
||||
GST_CHANNEL_MIX_FLAGS_NONE = 0,
|
||||
GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN = (1 << 0),
|
||||
GST_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT = (1 << 1)
|
||||
} GstChannelMixFlags;
|
||||
GST_AUDIO_CHANNEL_MIX_FLAGS_NONE = 0,
|
||||
GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_IN = (1 << 0),
|
||||
GST_AUDIO_CHANNEL_MIX_FLAGS_UNPOSITIONED_OUT = (1 << 1)
|
||||
} GstAudioChannelMixFlags;
|
||||
|
||||
GstChannelMix * gst_channel_mix_new (GstChannelMixFlags flags,
|
||||
gint in_channels,
|
||||
GstAudioChannelPosition in_position[64],
|
||||
gint out_channels,
|
||||
GstAudioChannelPosition out_position[64]);
|
||||
void gst_channel_mix_free (GstChannelMix *mix);
|
||||
GstAudioChannelMix * gst_audio_channel_mix_new (GstAudioChannelMixFlags flags,
|
||||
gint in_channels,
|
||||
GstAudioChannelPosition in_position[64],
|
||||
gint out_channels,
|
||||
GstAudioChannelPosition out_position[64]);
|
||||
void gst_audio_channel_mix_free (GstAudioChannelMix *mix);
|
||||
|
||||
/*
|
||||
* Checks for passthrough (= identity matrix).
|
||||
*/
|
||||
gboolean gst_channel_mix_is_passthrough (GstChannelMix *mix);
|
||||
gboolean gst_audio_channel_mix_is_passthrough (GstAudioChannelMix *mix);
|
||||
|
||||
/*
|
||||
* Do actual mixing.
|
||||
*/
|
||||
void gst_channel_mix_mix (GstChannelMix * mix,
|
||||
GstAudioFormat format,
|
||||
GstAudioLayout layout,
|
||||
const gpointer in_data,
|
||||
gpointer out_data,
|
||||
gint samples);
|
||||
void gst_audio_channel_mix_samples (GstAudioChannelMix * mix,
|
||||
GstAudioFormat format,
|
||||
GstAudioLayout layout,
|
||||
const gpointer in_data,
|
||||
gpointer out_data,
|
||||
gint samples);
|
||||
|
||||
#endif /* __GST_CHANNEL_MIX_H__ */
|
||||
#endif /* __GST_AUDIO_CHANNEL_MIX_H__ */
|
||||
|
|
Loading…
Reference in a new issue