swr: make audio convert code explicitely private.

Only what's declared in libswresample/swresample.h is public.
This commit is contained in:
Clément Bœsch 2011-11-16 08:00:31 +01:00
parent 3a5fc38574
commit fc6351d019
4 changed files with 35 additions and 35 deletions

View File

@ -34,7 +34,7 @@
typedef void (conv_func_type)(uint8_t *po, const uint8_t *pi, int is, int os, uint8_t *end);
struct AVAudioConvert {
struct AudioConvert {
int channels;
conv_func_type *conv_f;
const int *ch_map;
@ -108,17 +108,17 @@ conv_func_type *fmt_pair_to_conv_functions[AV_SAMPLE_FMT_NB*AV_SAMPLE_FMT_NB] =
FMT_PAIR_FUNC(AV_SAMPLE_FMT_DBL, AV_SAMPLE_FMT_DBL),
};
AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels, const int *ch_map,
int flags)
AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels, const int *ch_map,
int flags)
{
AVAudioConvert *ctx;
AudioConvert *ctx;
conv_func_type *f = fmt_pair_to_conv_functions[out_fmt + AV_SAMPLE_FMT_NB*in_fmt];
if (!f)
return NULL;
ctx = av_malloc(sizeof(AVAudioConvert));
ctx = av_malloc(sizeof(*ctx));
if (!ctx)
return NULL;
ctx->channels = channels;
@ -127,12 +127,12 @@ AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
return ctx;
}
void swr_audio_convert_free(AVAudioConvert **ctx)
void swri_audio_convert_free(AudioConvert **ctx)
{
av_freep(ctx);
}
int swr_audio_convert(AVAudioConvert *ctx, AudioData *out, AudioData*in, int len)
int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len)
{
int ch;
const uint8_t null_input[8] = {0};

View File

@ -33,8 +33,8 @@
#include "libavutil/cpu.h"
#include "libavutil/audioconvert.h"
struct AVAudioConvert;
typedef struct AVAudioConvert AVAudioConvert;
struct AudioConvert;
typedef struct AudioConvert AudioConvert;
/**
* Create an audio sample format converter context
@ -46,16 +46,16 @@ typedef struct AVAudioConvert AVAudioConvert;
* if all channels must be selected
* @return NULL on error
*/
AVAudioConvert *swr_audio_convert_alloc(enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels, const int *ch_map,
int flags);
AudioConvert *swri_audio_convert_alloc(enum AVSampleFormat out_fmt,
enum AVSampleFormat in_fmt,
int channels, const int *ch_map,
int flags);
/**
* Free audio sample format converter context.
* and set the pointer to NULL
*/
void swr_audio_convert_free(AVAudioConvert **ctx);
void swri_audio_convert_free(AudioConvert **ctx);
/**
* Convert between audio sample formats
@ -63,6 +63,6 @@ void swr_audio_convert_free(AVAudioConvert **ctx);
* @param[in] in array of input buffers for each channel
* @param len length of audio frame size (measured in samples)
*/
int swr_audio_convert(AVAudioConvert *ctx, AudioData *out, AudioData *in, int len);
int swri_audio_convert(AudioConvert *ctx, AudioData *out, AudioData *in, int len);
#endif /* AUDIOCONVERT_H */

View File

@ -119,9 +119,9 @@ void swr_free(SwrContext **ss){
free_temp(&s->midbuf);
free_temp(&s->preout);
free_temp(&s->in_buffer);
swr_audio_convert_free(&s-> in_convert);
swr_audio_convert_free(&s->out_convert);
swr_audio_convert_free(&s->full_convert);
swri_audio_convert_free(&s-> in_convert);
swri_audio_convert_free(&s->out_convert);
swri_audio_convert_free(&s->full_convert);
swr_resample_free(&s->resample);
}
@ -136,9 +136,9 @@ int swr_init(SwrContext *s){
free_temp(&s->midbuf);
free_temp(&s->preout);
free_temp(&s->in_buffer);
swr_audio_convert_free(&s-> in_convert);
swr_audio_convert_free(&s->out_convert);
swr_audio_convert_free(&s->full_convert);
swri_audio_convert_free(&s-> in_convert);
swri_audio_convert_free(&s->out_convert);
swri_audio_convert_free(&s->full_convert);
s-> in.planar= s-> in_sample_fmt >= 0x100;
s->out.planar= s->out_sample_fmt >= 0x100;
@ -209,15 +209,15 @@ av_assert0(s->out.ch_count);
s->out.bps= av_get_bytes_per_sample(s->out_sample_fmt);
if(!s->resample && !s->rematrix && !s->channel_map){
s->full_convert = swr_audio_convert_alloc(s->out_sample_fmt,
s-> in_sample_fmt, s-> in.ch_count, NULL, 0);
s->full_convert = swri_audio_convert_alloc(s->out_sample_fmt,
s-> in_sample_fmt, s-> in.ch_count, NULL, 0);
return 0;
}
s->in_convert = swr_audio_convert_alloc(s->int_sample_fmt,
s-> in_sample_fmt, s->used_ch_count, s->channel_map, 0);
s->out_convert= swr_audio_convert_alloc(s->out_sample_fmt,
s->int_sample_fmt, s->out.ch_count, NULL, 0);
s->in_convert = swri_audio_convert_alloc(s->int_sample_fmt,
s-> in_sample_fmt, s->used_ch_count, s->channel_map, 0);
s->out_convert= swri_audio_convert_alloc(s->out_sample_fmt,
s->int_sample_fmt, s->out.ch_count, NULL, 0);
s->postin= s->in;
@ -335,7 +335,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if(s->full_convert){
av_assert0(!s->resample);
swr_audio_convert(s->full_convert, out, in, in_count);
swri_audio_convert(s->full_convert, out, in, in_count);
return out_count;
}
@ -385,7 +385,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
}
if(in != postin){
swr_audio_convert(s->in_convert, postin, in, in_count);
swri_audio_convert(s->in_convert, postin, in, in_count);
}
if(s->resample_first){
@ -402,7 +402,7 @@ int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int out_coun
if(preout != out){
//FIXME packed doesnt need more than 1 chan here!
swr_audio_convert(s->out_convert, out, preout, out_count);
swri_audio_convert(s->out_convert, out, preout, out_count);
}
if(!in_arg)
s->in_buffer_count = 0;

View File

@ -58,9 +58,9 @@ typedef struct SwrContext { //FIXME find unused fields
int in_buffer_count;
int resample_in_constraint;
struct AVAudioConvert *in_convert;
struct AVAudioConvert *out_convert;
struct AVAudioConvert *full_convert;
struct AudioConvert *in_convert;
struct AudioConvert *out_convert;
struct AudioConvert *full_convert;
struct AVResampleContext *resample;
float matrix[SWR_CH_MAX][SWR_CH_MAX];