1 /*
2  * This file is part of MPlayer.
3  *
4  * MPlayer is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * MPlayer is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with MPlayer; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef MPLAYER_AE_H
20 #define MPLAYER_AE_H
21 
22 #include "libmpdemux/muxer.h"
23 
24 #define ACODEC_COPY 0
25 #define ACODEC_PCM 1
26 #define ACODEC_VBRMP3 2
27 #define ACODEC_NULL 3
28 #define ACODEC_LAVC 4
29 #define ACODEC_TOOLAME 5
30 #define ACODEC_FAAC 6
31 #define ACODEC_TWOLAME 7
32 
33 #define AE_NEEDS_COMPRESSED_INPUT 1
34 
35 typedef struct {
36 	int channels;
37 	int sample_rate;
38 	int bitrate;
39 	int samples_per_frame;
40 	int audio_preload;
41 	int sample_format;
42 } audio_encoding_params_t;
43 
44 typedef struct audio_encoder_s {
45 	int codec;
46 	int flags;
47 	muxer_stream_t *stream;
48 	audio_encoding_params_t params;
49 	int audio_preload;	//in ms
50 	int input_format;
51 	int min_buffer_size, max_buffer_size;	//for init_audio_filters
52 	unsigned char *decode_buffer;
53 	int decode_buffer_size;
54 	int decode_buffer_len;
55 	void *priv;
56 	int (*bind)(struct audio_encoder_s*, muxer_stream_t*);
57 	int (*get_frame_size)(struct audio_encoder_s*);
58 	int (*set_decoded_len)(struct audio_encoder_s *encoder, int len);
59 	int (*encode)(struct audio_encoder_s *encoder, uint8_t *dest, void *src, int nsamples, int max_size);
60 	void (*fixup)(struct audio_encoder_s *encoder);
61 	int (*close)(struct audio_encoder_s *encoder);
62 } audio_encoder_t;
63 
64 audio_encoder_t *new_audio_encoder(muxer_stream_t *stream, audio_encoding_params_t *params);
65 
66 #endif /* MPLAYER_AE_H */
67