From 074a00d192c0e749d677b008b337da42597e780f Mon Sep 17 00:00:00 2001 From: Justin Ruggles Date: Wed, 19 Dec 2012 14:58:57 -0500 Subject: lavr: add a public function for setting a custom channel map This allows reordering, duplication, and silencing of input channels. --- libavresample/internal.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'libavresample/internal.h') diff --git a/libavresample/internal.h b/libavresample/internal.h index c094f08f49..057f89a49c 100644 --- a/libavresample/internal.h +++ b/libavresample/internal.h @@ -32,6 +32,24 @@ typedef struct AudioConvert AudioConvert; typedef struct AudioMix AudioMix; typedef struct ResampleContext ResampleContext; +enum RemapPoint { + REMAP_NONE, + REMAP_IN_COPY, + REMAP_IN_CONVERT, + REMAP_OUT_COPY, + REMAP_OUT_CONVERT, +}; + +typedef struct ChannelMapInfo { + int channel_map[AVRESAMPLE_MAX_CHANNELS]; /**< source index of each output channel, -1 if not remapped */ + int do_remap; /**< remap needed */ + int channel_copy[AVRESAMPLE_MAX_CHANNELS]; /**< dest index to copy from */ + int do_copy; /**< copy needed */ + int channel_zero[AVRESAMPLE_MAX_CHANNELS]; /**< dest index to zero */ + int do_zero; /**< zeroing needed */ + int input_map[AVRESAMPLE_MAX_CHANNELS]; /**< dest index of each input channel */ +} ChannelMapInfo; + struct AVAudioResampleContext { const AVClass *av_class; /**< AVClass for logging and AVOptions */ @@ -65,6 +83,7 @@ struct AVAudioResampleContext { int resample_needed; /**< resampling is needed */ int in_convert_needed; /**< input sample format conversion is needed */ int out_convert_needed; /**< output sample format conversion is needed */ + int in_copy_needed; /**< input data copy is needed */ AudioData *in_buffer; /**< buffer for converted input */ AudioData *resample_out_buffer; /**< buffer for output from resampler */ @@ -82,6 +101,10 @@ struct AVAudioResampleContext { * only used if avresample_set_matrix() is called before avresample_open() */ double *mix_matrix; + + int use_channel_map; + enum RemapPoint remap_point; + ChannelMapInfo ch_map_info; }; #endif /* AVRESAMPLE_INTERNAL_H */ -- cgit v1.2.3