blob: 4812073ca72a7944daf877292e9f2f4fbd95244d
1 | #ifndef MEDIA_ADECOMX_H_ |
2 | #define MEDIA_ADECOMX_H_ |
3 | |
4 | #include "OMX_Index.h" |
5 | #include "OMX_Core.h" |
6 | #include "OMXClient.h" |
7 | #include "audio_mediasource.h" |
8 | #include "../audio-dec.h" |
9 | |
10 | namespace android |
11 | { |
12 | |
13 | static const char *MEDIA_MIMETYPE_AUDIO_AC3 = "audio/ac3"; |
14 | static const char *MEDIA_MIMETYPE_AUDIO_EC3 = "audio/eac3"; |
15 | static const char *MEDIA_MIMETYPE_AUDIO_AMR_NB = "audio/3gpp"; |
16 | static const char *MEDIA_MIMETYPE_AUDIO_AMR_WB = "audio/amr-wb"; |
17 | static const char *MEDIA_MIMETYPE_AUDIO_MPEG = "audio/mpeg"; //mp3 |
18 | static const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_I = "audio/mpeg-L1"; |
19 | static const char *MEDIA_MIMETYPE_AUDIO_MPEG_LAYER_II = "audio/mpeg-L2"; |
20 | static const char *MEDIA_MIMETYPE_AUDIO_AAC = "audio/mp4a-latm"; |
21 | static const char *MEDIA_MIMETYPE_AUDIO_QCELP = "audio/qcelp"; |
22 | static const char *MEDIA_MIMETYPE_AUDIO_VORBIS = "audio/vorbis"; |
23 | static const char *MEDIA_MIMETYPE_AUDIO_G711_ALAW = "audio/g711-alaw"; |
24 | static const char *MEDIA_MIMETYPE_AUDIO_G711_MLAW = "audio/g711-mlaw"; |
25 | static const char *MEDIA_MIMETYPE_AUDIO_RAW = "audio/raw"; |
26 | static const char *MEDIA_MIMETYPE_AUDIO_ADPCM_IMA = "audio/adpcm-ima"; |
27 | static const char *MEDIA_MIMETYPE_AUDIO_ADPCM_MS = "audio/adpcm-ms"; |
28 | static const char *MEDIA_MIMETYPE_AUDIO_FLAC = "audio/flac"; |
29 | static const char *MEDIA_MIMETYPE_AUDIO_AAC_ADTS = "audio/aac-adts"; |
30 | static const char *MEDIA_MIMETYPE_AUDIO_ALAC = "audio/alac"; |
31 | static const char *MEDIA_MIMETYPE_AUDIO_AAC_ADIF = "audio/aac-adif"; |
32 | static const char *MEDIA_MIMETYPE_AUDIO_AAC_LATM = "audio/aac-latm"; |
33 | static const char *MEDIA_MIMETYPE_AUDIO_ADTS_PROFILE = "audio/adts"; |
34 | static const char *MEDIA_MIMETYPE_AUDIO_WMA = "audio/wma"; |
35 | static const char *MEDIA_MIMETYPE_AUDIO_WMAPRO = "audio/wmapro"; |
36 | static const char *MEDIA_MIMETYPE_AUDIO_DTSHD = "audio/dtshd"; |
37 | static const char *MEDIA_MIMETYPE_AUDIO_TRUEHD = "audio/truehd"; |
38 | static const char *MEDIA_MIMETYPE_AUDIO_FFMPEG = "audio/ffmpeg"; |
39 | |
40 | class AmlOMXCodec |
41 | { |
42 | public: |
43 | |
44 | AmlOMXCodec(int codec_type, void *read_buffer, int *exit, aml_audio_dec *audec); |
45 | |
46 | OMXClient m_OMXClient; |
47 | sp<AudioMediaSource> m_OMXMediaSource; |
48 | int read(unsigned char *buf, unsigned *size, int *exit); |
49 | virtual status_t start(aml_audio_dec_t *audec); |
50 | void pause(); |
51 | void stop(); |
52 | int GetDecBytes(); |
53 | void lock_init(); |
54 | void locked(); |
55 | void unlocked(); |
56 | int started_flag; |
57 | int omx_codec_type; |
58 | //protected: |
59 | virtual ~AmlOMXCodec(); |
60 | //private: |
61 | sp<MediaSource> m_codec; |
62 | pthread_mutex_t lock; |
63 | int64_t buf_decode_offset; |
64 | int64_t buf_decode_offset_pre; |
65 | |
66 | }; |
67 | |
68 | |
69 | } |
70 | |
71 | #endif |
72 |