~ubuntu-branches/ubuntu/utopic/libav/utopic

« back to all changes in this revision

Viewing changes to libavresample/audio_mix.h

  • Committer: Package Import Robot
  • Author(s): Reinhard Tartler
  • Date: 2012-12-21 15:32:13 UTC
  • mto: (1.2.18)
  • mto: This revision was merged to the branch mainline in revision 34.
  • Revision ID: package-import@ubuntu.com-20121221153213-fudzrugjzivtv0wp
Tags: upstream-9~beta3
ImportĀ upstreamĀ versionĀ 9~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
typedef void (mix_func)(uint8_t **src, void **matrix, int len, int out_ch,
31
31
                        int in_ch);
32
32
 
33
 
typedef struct AudioMix {
34
 
    AVAudioResampleContext *avr;
35
 
    enum AVSampleFormat fmt;
36
 
    enum AVMixCoeffType coeff_type;
37
 
    uint64_t in_layout;
38
 
    uint64_t out_layout;
39
 
    int in_channels;
40
 
    int out_channels;
41
 
 
42
 
    int ptr_align;
43
 
    int samples_align;
44
 
    int has_optimized_func;
45
 
    const char *func_descr;
46
 
    const char *func_descr_generic;
47
 
    mix_func *mix;
48
 
    mix_func *mix_generic;
49
 
 
50
 
    int16_t *matrix_q8[AVRESAMPLE_MAX_CHANNELS];
51
 
    int32_t *matrix_q15[AVRESAMPLE_MAX_CHANNELS];
52
 
    float   *matrix_flt[AVRESAMPLE_MAX_CHANNELS];
53
 
    void   **matrix;
54
 
} AudioMix;
 
33
typedef struct AudioMix AudioMix;
55
34
 
56
35
/**
57
36
 * Set mixing function if the parameters match.
79
58
                           const char *descr, void *mix_func);
80
59
 
81
60
/**
82
 
 * Initialize the AudioMix context in the AVAudioResampleContext.
 
61
 * Allocate and initialize an AudioMix context.
83
62
 *
84
63
 * The parameters in the AVAudioResampleContext are used to initialize the
85
 
 * AudioMix context and set the mixing matrix.
 
64
 * AudioMix context.
86
65
 *
87
66
 * @param avr  AVAudioResampleContext
88
 
 * @return     0 on success, negative AVERROR code on failure
 
67
 * @return     newly-allocated AudioMix context.
89
68
 */
90
 
int ff_audio_mix_init(AVAudioResampleContext *avr);
 
69
AudioMix *ff_audio_mix_alloc(AVAudioResampleContext *avr);
91
70
 
92
71
/**
93
 
 * Close an AudioMix context.
94
 
 *
95
 
 * This clears and frees the mixing matrix arrays.
 
72
 * Free an AudioMix context.
96
73
 */
97
 
void ff_audio_mix_close(AudioMix *am);
 
74
void ff_audio_mix_free(AudioMix **am);
98
75
 
99
76
/**
100
77
 * Apply channel mixing to audio data using the current mixing matrix.
101
78
 */
102
79
int ff_audio_mix(AudioMix *am, AudioData *src);
103
80
 
 
81
/**
 
82
 * Get the current mixing matrix.
 
83
 */
 
84
int ff_audio_mix_get_matrix(AudioMix *am, double *matrix, int stride);
 
85
 
 
86
/**
 
87
 * Set the current mixing matrix.
 
88
 */
 
89
int ff_audio_mix_set_matrix(AudioMix *am, const double *matrix, int stride);
 
90
 
104
91
/* arch-specific initialization functions */
105
92
 
106
93
void ff_audio_mix_init_x86(AudioMix *am);