mirror of https://github.com/mpv-player/mpv
reorder_ch: remove old channel reorder functions
This is done in af_lavrresample now, and as part of format negotiation. Also remove the remaining reorder_channel calls. They were redundant and did nothing.
This commit is contained in:
parent
408b7eecee
commit
586b75ad08
|
@ -451,13 +451,6 @@ static int decode_audio(sh_audio_t *sh_audio, unsigned char *buf, int minlen,
|
|||
memcpy(buf, priv->output, size);
|
||||
priv->output += size;
|
||||
priv->output_left -= size;
|
||||
if (avctx->channels >= 5) {
|
||||
int samplesize = av_get_bytes_per_sample(avctx->sample_fmt);
|
||||
reorder_channel_nch(buf, AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
|
||||
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
|
||||
avctx->channels,
|
||||
size / samplesize, samplesize);
|
||||
}
|
||||
if (len < 0)
|
||||
len = size;
|
||||
else
|
||||
|
|
|
@ -233,15 +233,6 @@ static struct mp_audio* play(struct af_instance* af, struct mp_audio* data)
|
|||
src2= s->pending_data;
|
||||
}
|
||||
|
||||
if (c->nch >= 5) {
|
||||
reorder_channel_nch(src2,
|
||||
AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT,
|
||||
AF_CHANNEL_LAYOUT_LAVC_DEFAULT,
|
||||
c->nch,
|
||||
s->expect_len / samplesize,
|
||||
samplesize);
|
||||
}
|
||||
|
||||
void *data = (void *) src2;
|
||||
if (s->planarize) {
|
||||
void *data2 = malloc(s->expect_len);
|
||||
|
|
1373
audio/reorder_ch.c
1373
audio/reorder_ch.c
File diff suppressed because it is too large
Load Diff
|
@ -25,114 +25,6 @@
|
|||
|
||||
#include <inttypes.h>
|
||||
|
||||
// L - Left
|
||||
// R - Right
|
||||
// C - Center
|
||||
// Ls - Left Surround
|
||||
// Rs - Right Surround
|
||||
// Cs - Center Surround
|
||||
// Rls - Rear Left Surround
|
||||
// Rrs - Rear Right Surround
|
||||
|
||||
#define AF_LFE (1<<7)
|
||||
|
||||
#define AF_CHANNEL_LAYOUT_MONO ((100<<8)|1)
|
||||
#define AF_CHANNEL_LAYOUT_STEREO ((101<<8)|2)
|
||||
#define AF_CHANNEL_LAYOUT_1_0 AF_CHANNEL_LAYOUT_MONO // C
|
||||
#define AF_CHANNEL_LAYOUT_2_0 AF_CHANNEL_LAYOUT_STEREO // L R
|
||||
#define AF_CHANNEL_LAYOUT_2_1 ((102<<8)|3) // L R LFE
|
||||
#define AF_CHANNEL_LAYOUT_3_0_A ((103<<8)|3) // L R C
|
||||
#define AF_CHANNEL_LAYOUT_3_0_B ((104<<8)|3) // C L R
|
||||
#define AF_CHANNEL_LAYOUT_4_0_A ((105<<8)|4) // L R C Cs
|
||||
#define AF_CHANNEL_LAYOUT_4_0_B ((106<<8)|4) // C L R Cs
|
||||
#define AF_CHANNEL_LAYOUT_4_0_C ((107<<8)|4) // L R Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_0_A ((108<<8)|5) // L R C Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_0_B ((109<<8)|5) // L R Ls Rs C
|
||||
#define AF_CHANNEL_LAYOUT_5_0_C ((110<<8)|5) // L C R Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_0_D ((111<<8)|5) // C L R Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_1_A ((112<<8)|6|AF_LFE) // L R C LFE Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_1_B ((113<<8)|6|AF_LFE) // L R Ls Rs C LFE
|
||||
#define AF_CHANNEL_LAYOUT_5_1_C ((114<<8)|6|AF_LFE) // L C R Ls Rs LFE
|
||||
#define AF_CHANNEL_LAYOUT_5_1_D ((115<<8)|6|AF_LFE) // C L R Ls Rs LFE
|
||||
#define AF_CHANNEL_LAYOUT_5_1_E ((116<<8)|6|AF_LFE) // LFE L C R Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_5_1_F ((117<<8)|6|AF_LFE) // C L R LFE Ls Rs
|
||||
#define AF_CHANNEL_LAYOUT_6_1_A ((118<<8)|7|AF_LFE) // L R C LFE Ls Rs Cs
|
||||
#define AF_CHANNEL_LAYOUT_7_1_A ((119<<8)|8|AF_LFE) // L R C LFE Ls Rs Rls Rrs
|
||||
#define AF_CHANNEL_LAYOUT_7_1_B ((120<<8)|8|AF_LFE) // L R Ls Rs C LFE Rls Rrs
|
||||
#define AF_CHANNEL_LAYOUT_7_1_C ((121<<8)|8|AF_LFE) // L C R Ls Rs LFE Rls Rrs
|
||||
#define AF_CHANNEL_LAYOUT_7_1_D ((122<<8)|8|AF_LFE) // C L R Ls Rs Rls Rrs LFE
|
||||
#define AF_CHANNEL_LAYOUT_7_1_F ((123<<8)|8|AF_LFE) // C L R LFE Ls Rs Rls Rrs
|
||||
|
||||
|
||||
#define AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_B
|
||||
#define AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_B
|
||||
#define AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_B
|
||||
#define AF_CHANNEL_LAYOUT_MPLAYER_5CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_5CH_DEFAULT
|
||||
#define AF_CHANNEL_LAYOUT_MPLAYER_6CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_6CH_DEFAULT
|
||||
#define AF_CHANNEL_LAYOUT_MPLAYER_8CH_DEFAULT AF_CHANNEL_LAYOUT_ALSA_8CH_DEFAULT
|
||||
#define AF_CHANNEL_LAYOUT_AAC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_D
|
||||
#define AF_CHANNEL_LAYOUT_AAC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_D
|
||||
#define AF_CHANNEL_LAYOUT_AAC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_D
|
||||
#define AF_CHANNEL_LAYOUT_WAVEEX_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
|
||||
#define AF_CHANNEL_LAYOUT_WAVEEX_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
|
||||
#define AF_CHANNEL_LAYOUT_WAVEEX_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
|
||||
#define AF_CHANNEL_LAYOUT_LAVC_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_A
|
||||
#define AF_CHANNEL_LAYOUT_LAVC_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_A
|
||||
#define AF_CHANNEL_LAYOUT_LAVC_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_A
|
||||
#define AF_CHANNEL_LAYOUT_VORBIS_5CH_DEFAULT AF_CHANNEL_LAYOUT_5_0_C
|
||||
#define AF_CHANNEL_LAYOUT_VORBIS_6CH_DEFAULT AF_CHANNEL_LAYOUT_5_1_C
|
||||
#define AF_CHANNEL_LAYOUT_VORBIS_8CH_DEFAULT AF_CHANNEL_LAYOUT_7_1_C
|
||||
|
||||
#define AF_CHANNEL_MASK 0xFF
|
||||
#define AF_GET_CH_NUM(A) ((A)&0x7F)
|
||||
#define AF_GET_CH_NUM_WITH_LFE(A) ((A)&0xFF)
|
||||
#define AF_IS_SAME_CH_NUM(A,B) (((A)&0xFF)==((B)&0xFF))
|
||||
#define AF_IS_LAYOUT_SPECIFIED(A) ((A)&0xFFFFF800)
|
||||
#define AF_IS_LAYOUT_UNSPECIFIED(A) (!AF_IS_LAYOUT_SPECIFIED(A))
|
||||
|
||||
/// Optimized channel reorder between channel layouts with same channel number.
|
||||
void reorder_channel_copy(void *src,
|
||||
int src_layout,
|
||||
void *dest,
|
||||
int dest_layout,
|
||||
int samples,
|
||||
int samplesize);
|
||||
|
||||
/// Same with reorder_channel_copy, but works on single buffer.
|
||||
void reorder_channel(void *buf,
|
||||
int src_layout,
|
||||
int dest_layout,
|
||||
int samples,
|
||||
int samplesize);
|
||||
|
||||
// Channel layout definitions for different audio sources or targets
|
||||
// When specified channel number, they will be map to the specific layouts.
|
||||
#define AF_CHANNEL_LAYOUT_ALSA_DEFAULT 0
|
||||
#define AF_CHANNEL_LAYOUT_AAC_DEFAULT 1
|
||||
#define AF_CHANNEL_LAYOUT_WAVEEX_DEFAULT 2
|
||||
#define AF_CHANNEL_LAYOUT_LAVC_DEFAULT 3
|
||||
#define AF_CHANNEL_LAYOUT_VORBIS_DEFAULT 4
|
||||
#define AF_CHANNEL_LAYOUT_SOURCE_NUM 5
|
||||
#define AF_CHANNEL_LAYOUT_MPLAYER_DEFAULT AF_CHANNEL_LAYOUT_LAVC_DEFAULT
|
||||
|
||||
/// Optimized channel reorder between different audio sources and targets.
|
||||
void reorder_channel_copy_nch(void *src,
|
||||
int src_layout,
|
||||
void *dest,
|
||||
int dest_layout,
|
||||
int chnum,
|
||||
int samples,
|
||||
int samplesize);
|
||||
|
||||
/// Same with reorder_channel_copy_nch, but works on single buffer.
|
||||
void reorder_channel_nch(void *buf,
|
||||
int src_layout,
|
||||
int dest_layout,
|
||||
int chnum,
|
||||
int samples,
|
||||
int samplesize);
|
||||
|
||||
/// Utility function for planar audio conversions
|
||||
void reorder_to_planar(void *restrict out, const void *restrict in,
|
||||
size_t size, size_t nchan, size_t nmemb);
|
||||
void reorder_to_packed(uint8_t *out, uint8_t **in,
|
||||
|
|
Loading…
Reference in New Issue