summaryrefslogtreecommitdiff
blob: 3c115d7b45c5fc6718d1c52371739b751ae37e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
--- 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;