app_mp3_encode.h
2.08 KB
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
#ifndef _APP_MP3_ENCODE_H_
#define _APP_MP3_ENCODE_H_
#include "app_dac.h"
//#define MP3_ENC_FRAME_SAMPLE 1152
extern U8 RECORD_BUF_START[];
extern U8 RECORD_BUF_END[];
enum {
RECORD_MP3_BITRATE_128K = 128000,
RECORD_MP3_BITRATE_192K = 192000,
RECORD_MP3_BITRATE_256K = 256000
};
#define MP3_ENC_BITRATE 192000
#define MP3E_OUTPUT_SIZE 2880 // the maximum size of the output buffer is 2880 bytes.
#define NUM_AUDIO_CHANNELS 2
#define MPG_MD_JOINT_STEREO 1
#define MPG_MD_MONO 3
#define FRSIZE 1152
#define MAX_FRAME_BUFFER 2088
#define HFRSIZE 576
//#define PCM_RCV_BUF_SIZE (32*1024)
#define PCM_RCV_BUF_SIZE 0x10000
//#define PCM_RCV_BUF_SIZE 0x20000
//#define PCM_RCV_BUF_SIZE 0x30000
//#define RECORD_BUF_SIZE 0x20000
//#define RECORD_BUF_SIZE 0x10000
//#define RECORD_BUF_SIZE 0x8000
//#define RECORD_BUF_SIZE 0x4000
//#define RECORD_BUF_SIZE 0x3000
#define RECORD_BUF_SIZE (MP3_ENC_FRAME_SAMPLE*4)
typedef struct
{
int version;
int lay;
int error_protection;
int bitrate_index;
int sampling_frequency;
int padding;
int extension;
int mode;
int mode_ext;
int copyright;
int original;
int emphasis;
} MP3E_layer;
typedef enum
{
MP3E_OK, // no error
MP3E_ERROR_PARAMS, // error in parsing header
MP3E_NULL_INPUT, // Input buffer pointer is null
MP3E_NULL_OUTPUT, // Output buffer pointer is null
MP3E_INTERNAL_ERROR // General encoding error
} MP3E_RET_CODE;
typedef struct
{
U16 encoder_type;
U16 sampling_rate;
U32 bitrate;
U16 mode;
} MP3E_ENC_PARAMS;
#define FIFO_ENC_DATA_MARGIN 0x2000 /*max one frame size 1152*4 kbytes*/
#define ENC_X 3
extern FIFO record_fifo;
extern U8 record_buf_overflow;
#ifdef CD_KARAOKE_REC_ENABLE
extern FIFO pcm_RcvFifo;
extern U8 pcm_RcvBuf[PCM_RCV_BUF_SIZE];
extern U16 pcm_OutBuf[2*MP3_DEC_FRAME_SIZE];
#endif
void app_mp3_encode_param_set (void);
BOOL app_mp3_copy_init (void);
BOOL app_ad_pcm_mp3_encode_frame (I16 *ppBuf, I32 len);
#endif //_APP_MP3_ENCODE_H_