| --- ext/ffmpeg/gstffmpegaudioresample.c~ 2015-05-29 11:38:03.639001637 +0200 |
| +++ ext/ffmpeg/gstffmpegaudioresample.c 2015-05-29 20:08:24.744107000 +0200 |
| @@ -24,6 +24,7 @@ |
| #include "config.h" |
| #endif |
| |
| +#include <libavresample/avresample.h> |
| #ifdef HAVE_FFMPEG_UNINSTALLED |
| #include <avcodec.h> |
| #else |
| @@ -37,6 +38,60 @@ |
| #include "gstffmpeg.h" |
| #include "gstffmpegcodecmap.h" |
| |
| +struct AudioData { |
| + const AVClass *class; /**< AVClass for logging */ |
| + uint8_t *data[AVRESAMPLE_MAX_CHANNELS]; /**< data plane pointers */ |
| + uint8_t *buffer; /**< data buffer */ |
| + unsigned int buffer_size; /**< allocated buffer size */ |
| + int allocated_samples; /**< number of samples the buffer can hold */ |
| + int nb_samples; /**< current number of samples */ |
| + enum AVSampleFormat sample_fmt; /**< sample format */ |
| + int channels; /**< channel count */ |
| + int allocated_channels; /**< allocated channel count */ |
| + int is_planar; /**< sample format is planar */ |
| + int planes; /**< number of data planes */ |
| + int sample_size; /**< bytes per sample */ |
| + int stride; /**< sample byte offset within a plane */ |
| + int read_only; /**< data is read-only */ |
| + int allow_realloc; /**< realloc is allowed */ |
| + int ptr_align; /**< minimum data pointer alignment */ |
| + int samples_align; /**< allocated samples alignment */ |
| + const char *name; /**< name for debug logging */ |
| +}; |
| + |
| +typedef struct AudioData AudioData; |
| + |
| +struct ReSampleContext { |
| + AVAudioResampleContext *avr; |
| + AudioData *buffer; |
| + uint8_t *filter_bank; |
| + int filter_length; |
| + int ideal_dst_incr; |
| + int dst_incr; |
| + unsigned int index; |
| + int frac; |
| + int src_incr; |
| + int compensation_distance; |
| + int phase_shift; |
| + int phase_mask; |
| + int linear; |
| + enum AVResampleFilterType filter_type; |
| + int kaiser_beta; |
| + void (*set_filter)(void *filter, double *tab, int phase, int tap_count); |
| + void (*resample_one)(struct ResampleContext *c, void *dst0, |
| + int dst_index, const void *src0, |
| + unsigned int index, int frac); |
| + void (*resample_nearest)(void *dst0, int dst_index, |
| + const void *src0, unsigned int index); |
| + int padding_size; |
| + int initial_padding_filled; |
| + int initial_padding_samples; |
| + int final_padding_filled; |
| + int final_padding_samples; |
| +}; |
| + |
| +typedef struct ReSampleContext ReSampleContext; |
| + |
| typedef struct _GstFFMpegAudioResample |
| { |
| GstBaseTransform element; |