blob: 7c1e15e72769f3e2e7e0e2bbdb7481b1400572e5
1 | /** |
2 | * \file audiodsp.h |
3 | * \brief Definitiond Of Audiodsp Types And Structures |
4 | * \version 1.0.0 |
5 | * \date 2011-03-08 |
6 | */ |
7 | /* Copyright (C) 2007-2011, Amlogic Inc. |
8 | * All right reserved |
9 | * |
10 | */ |
11 | #ifndef AUDIODSP_H |
12 | #define AUDIODSP_H |
13 | |
14 | #include <adec-macros.h> |
15 | #include <adec-types.h> |
16 | #include "../audio-dec.h" |
17 | |
18 | ADEC_BEGIN_DECLS |
19 | |
20 | #define DSP_DEV_NOD "/dev/audiodsp0" |
21 | |
22 | #ifdef ANDROID |
23 | #define AUDIODSP_SET_FMT _IOW('a',1,long) |
24 | #define AUDIODSP_START _IOW('a',2,long) |
25 | #define AUDIODSP_STOP _IOW('a',3,long) |
26 | #define AUDIODSP_DECODE_START _IOW('a',4,long) |
27 | #define AUDIODSP_DECODE_STOP _IOW('a',5,long) |
28 | #define AUDIODSP_REGISTER_FIRMWARE _IOW('a',6,long) |
29 | #define AUDIODSP_UNREGISTER_ALLFIRMWARE _IOW('a',7,long) |
30 | #define AUDIODSP_SYNC_SET_APTS _IOW('a', 10, unsigned long) |
31 | #define AUDIODSP_WAIT_FORMAT _IOW('a',11,long) |
32 | |
33 | #define AUDIODSP_SKIP_BYTES _IOW('a', 13, unsigned long) |
34 | |
35 | #define AUDIODSP_GET_CHANNELS_NUM _IOR('r',1,long) |
36 | #define AUDIODSP_GET_SAMPLERATE _IOR('r',2,long) |
37 | #define AUDIODSP_GET_BITS_PER_SAMPLE _IOR('r',3,long) |
38 | #define AUDIODSP_GET_PTS _IOR('r',4,long) |
39 | #define AUDIODSP_GET_DECODED_NB_FRAMES _IOR('r',5,long) |
40 | #define AUDIODSP_GET_FIRST_PTS_FLAG _IOR('r',6,long) |
41 | #define AUDIODSP_SYNC_GET_APTS _IOR('r',7,unsigned long) |
42 | #define AUDIODSP_SYNC_GET_PCRSCR _IOR('r',8,unsigned long) |
43 | #define AUDIODSP_AUTOMUTE_ON _IOW('r',9,unsigned long) |
44 | #define AUDIODSP_AUTOMUTE_OFF _IOW('r',10,unsigned long) |
45 | #define AUDIODSP_GET_PCM_LEVEL _IOR('r',12,unsigned long) |
46 | #define AUDIODSP_SET_PCM_BUF_SIZE _IOW('r',13,long) |
47 | #define AMAUDIO_IOC_SET_RESAMPLE_ENA _IOW('A', 0x19, unsigned long) |
48 | #define AMAUDIO_IOC_GET_RESAMPLE_ENA _IOR('A', 0x1a, unsigned long) |
49 | #else |
50 | |
51 | #define AUDIODSP_SET_FMT _IOW('a',1,sizeof(long)) |
52 | #define AUDIODSP_START _IOW('a',2,sizeof(long)) |
53 | #define AUDIODSP_STOP _IOW('a',3,sizeof(long)) |
54 | #define AUDIODSP_DECODE_START _IOW('a',4,sizeof(long)) |
55 | #define AUDIODSP_DECODE_STOP _IOW('a',5,sizeof(long)) |
56 | #define AUDIODSP_REGISTER_FIRMWARE _IOW('a',6,sizeof(long)) |
57 | #define AUDIODSP_UNREGISTER_ALLFIRMWARE _IOW('a',7,sizeof(long)) |
58 | #define AUDIODSP_WAIT_FORMAT _IOW('a',11,long) |
59 | |
60 | |
61 | #define AUDIODSP_GET_CHANNELS_NUM _IOR('r',1,sizeof(long)) |
62 | #define AUDIODSP_GET_SAMPLERATE _IOR('r',2,sizeof(long)) |
63 | #define AUDIODSP_GET_BITS_PER_SAMPLE _IOR('r',3,sizeof(long)) |
64 | #define AUDIODSP_GET_PTS _IOR('r',4,sizeof(long)) |
65 | #define AUDIODSP_GET_DECODED_NB_FRAMES _IOR('r',5,sizeof(long)) |
66 | #define AUDIODSP_GET_FIRST_PTS_FLAG _IOR('r',6,sizeof(long)) |
67 | #endif |
68 | |
69 | |
70 | #define MCODEC_FMT_MPEG123 (1<<0) |
71 | #define MCODEC_FMT_AAC (1<<1) |
72 | #define MCODEC_FMT_AC3 (1<<2) |
73 | #define MCODEC_FMT_DTS (1<<3) |
74 | #define MCODEC_FMT_FLAC (1<<4) |
75 | #define MCODEC_FMT_COOK (1<<5) |
76 | #define MCODEC_FMT_AMR (1<<6) |
77 | #define MCODEC_FMT_RAAC (1<<7) |
78 | #define MCODEC_FMT_ADPCM (1<<8) |
79 | #define MCODEC_FMT_WMA (1<<9) |
80 | #define MCODEC_FMT_PCM (1<<10) |
81 | #define MCODEC_FMT_WMAPRO (1<<11) |
82 | #define MCODEC_FMT_ALAC (1<<12) |
83 | #define MCODEC_FMT_VORBIS (1<<13) |
84 | #define MCODEC_FMT_AAC_LATM (1<<14) |
85 | #define MCODEC_FMT_APE (1<<15) |
86 | #define MCODEC_FMT_EAC3 (1<<16) |
87 | |
88 | /*********************************************************************************************/ |
89 | typedef struct dsp_operations dsp_operations_t; |
90 | |
91 | struct dsp_operations { |
92 | int dsp_file_fd; |
93 | int dsp_on; |
94 | unsigned long kernel_audio_pts; |
95 | unsigned long last_audio_pts; |
96 | unsigned long last_pts_valid; |
97 | int (*dsp_read)(dsp_operations_t *dsp_ops, char *buffer, int len); /* read pcm stream from dsp */ |
98 | int (*dsp_read_raw)(dsp_operations_t *dsp_ops, char *buffer, int len); /* read raw stream from dsp */ |
99 | unsigned long(*get_cur_pts)(dsp_operations_t *); |
100 | unsigned long(*get_cur_pcrscr)(dsp_operations_t *); |
101 | int (*set_cur_apts)(dsp_operations_t *dsp_ops, unsigned long apts); |
102 | int (*set_skip_bytes)(dsp_operations_t *dsp_ops, unsigned int skip_bytes); |
103 | |
104 | int amstream_fd; |
105 | void *audec; |
106 | }; |
107 | |
108 | typedef struct { |
109 | int cmd; |
110 | int fmt; |
111 | int data_len; |
112 | char *data; |
113 | } audiodsp_cmd_t; |
114 | |
115 | typedef struct { |
116 | int id; |
117 | int fmt; |
118 | char name[64]; |
119 | } firmware_s_t; |
120 | |
121 | |
122 | /************************************************************************************************/ |
123 | |
124 | int audiodsp_stream_read(dsp_operations_t *dsp_ops, char *buffer, int size); |
125 | unsigned long audiodsp_get_pts(dsp_operations_t *dsp_ops); |
126 | unsigned long audiodsp_get_pcrscr(dsp_operations_t *dsp_ops); |
127 | int audiodsp_set_apts(dsp_operations_t *dsp_ops, unsigned long apts); |
128 | int audiodsp_get_decoded_nb_frames(dsp_operations_t *dsp_ops); |
129 | int audiodsp_get_first_pts_flag(dsp_operations_t *dsp_ops); |
130 | int audiodsp_automute_on(dsp_operations_t *dsp_ops); |
131 | int audiodsp_automute_off(dsp_operations_t *dsp_ops); |
132 | int audiodsp_set_skip_bytes(dsp_operations_t* dsp_ops, unsigned int bytes); |
133 | int audiodsp_get_pcm_level(dsp_operations_t* dsp_ops); |
134 | |
135 | int audiodsp_init(dsp_operations_t *dsp_ops); |
136 | //int audiodsp_start(aml_audio_dec_t *audec); |
137 | int audiodsp_stop(dsp_operations_t *dsp_ops); |
138 | int audiodsp_release(dsp_operations_t *dsp_ops); |
139 | |
140 | ADEC_END_DECLS |
141 | |
142 | #endif |
143 |