ex
Fork of mbed-os-example-mbed5-blinky by
DuerOS-Light-SDK-v1.1.0/duer-os-light/src/media-player/baidu_media_play_m4a.h@47:9e361da97763, 2017-07-18 (annotated)
- Committer:
- TMBOY
- Date:
- Tue Jul 18 16:54:45 2017 +0800
- Revision:
- 47:9e361da97763
?
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| TMBOY | 47:9e361da97763 | 1 | // Copyright 2017 Baidu Inc. All Rights Reserved. |
| TMBOY | 47:9e361da97763 | 2 | // Author: Chen Xihao (chenxihao@baidu.com) |
| TMBOY | 47:9e361da97763 | 3 | // |
| TMBOY | 47:9e361da97763 | 4 | // Description: Play m4a type file |
| TMBOY | 47:9e361da97763 | 5 | |
| TMBOY | 47:9e361da97763 | 6 | #ifndef BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H |
| TMBOY | 47:9e361da97763 | 7 | #define BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H |
| TMBOY | 47:9e361da97763 | 8 | |
| TMBOY | 47:9e361da97763 | 9 | #include "mp4ff.h" |
| TMBOY | 47:9e361da97763 | 10 | #include "rda_mp4.h" |
| TMBOY | 47:9e361da97763 | 11 | #include "baidu_media_type.h" |
| TMBOY | 47:9e361da97763 | 12 | |
| TMBOY | 47:9e361da97763 | 13 | namespace duer { |
| TMBOY | 47:9e361da97763 | 14 | |
| TMBOY | 47:9e361da97763 | 15 | const int M4AERR_OK = 0; |
| TMBOY | 47:9e361da97763 | 16 | const int M4AERR_MAC = -1; |
| TMBOY | 47:9e361da97763 | 17 | const int M4AERR_ARG = -2; |
| TMBOY | 47:9e361da97763 | 18 | const int M4AERR_VAL = -3; |
| TMBOY | 47:9e361da97763 | 19 | |
| TMBOY | 47:9e361da97763 | 20 | class MediaAdapter; |
| TMBOY | 47:9e361da97763 | 21 | |
| TMBOY | 47:9e361da97763 | 22 | class MediaPlayM4A { |
| TMBOY | 47:9e361da97763 | 23 | public: |
| TMBOY | 47:9e361da97763 | 24 | MediaPlayM4A(MediaAdapter* media_adapter); |
| TMBOY | 47:9e361da97763 | 25 | |
| TMBOY | 47:9e361da97763 | 26 | ~MediaPlayM4A(); |
| TMBOY | 47:9e361da97763 | 27 | |
| TMBOY | 47:9e361da97763 | 28 | int m4a_file_start(MediaType type, const unsigned char* p_buff, int buff_sz); |
| TMBOY | 47:9e361da97763 | 29 | |
| TMBOY | 47:9e361da97763 | 30 | int m4a_file_play(const unsigned char* p_buff, int buff_sz); |
| TMBOY | 47:9e361da97763 | 31 | |
| TMBOY | 47:9e361da97763 | 32 | int m4a_file_end(const unsigned char* p_buff, int buff_sz); |
| TMBOY | 47:9e361da97763 | 33 | |
| TMBOY | 47:9e361da97763 | 34 | int get_m4a_file_pos(); |
| TMBOY | 47:9e361da97763 | 35 | |
| TMBOY | 47:9e361da97763 | 36 | private: |
| TMBOY | 47:9e361da97763 | 37 | MediaPlayM4A(const MediaPlayM4A&); |
| TMBOY | 47:9e361da97763 | 38 | |
| TMBOY | 47:9e361da97763 | 39 | MediaPlayM4A& operator=(const MediaPlayM4A&); |
| TMBOY | 47:9e361da97763 | 40 | |
| TMBOY | 47:9e361da97763 | 41 | int m4a_header_save(const unsigned char* p_buff, int buff_sz); |
| TMBOY | 47:9e361da97763 | 42 | |
| TMBOY | 47:9e361da97763 | 43 | int m4a_header_parse(); |
| TMBOY | 47:9e361da97763 | 44 | |
| TMBOY | 47:9e361da97763 | 45 | int m4a_frame_to_codec(const unsigned char* p_buff, int buff_sz); |
| TMBOY | 47:9e361da97763 | 46 | |
| TMBOY | 47:9e361da97763 | 47 | static uint32_t read_callback(void* user_data, void* buffer, uint32_t length); |
| TMBOY | 47:9e361da97763 | 48 | |
| TMBOY | 47:9e361da97763 | 49 | static uint32_t seek_callback(void* user_data, uint64_t position); |
| TMBOY | 47:9e361da97763 | 50 | |
| TMBOY | 47:9e361da97763 | 51 | static mp4ff_callback_t _s_mp4cb; |
| TMBOY | 47:9e361da97763 | 52 | |
| TMBOY | 47:9e361da97763 | 53 | FILE* _p_file_sd; |
| TMBOY | 47:9e361da97763 | 54 | int _m4a_header_size; |
| TMBOY | 47:9e361da97763 | 55 | int _buff_data_size; |
| TMBOY | 47:9e361da97763 | 56 | unsigned char* _p_buff_data; |
| TMBOY | 47:9e361da97763 | 57 | int _m4a_file_pos; |
| TMBOY | 47:9e361da97763 | 58 | bool _m4a_parse_done; |
| TMBOY | 47:9e361da97763 | 59 | |
| TMBOY | 47:9e361da97763 | 60 | int _num_samples; |
| TMBOY | 47:9e361da97763 | 61 | int _track; |
| TMBOY | 47:9e361da97763 | 62 | int _sample_id; |
| TMBOY | 47:9e361da97763 | 63 | mp4AudioSpecificConfig _mp4_asc; |
| TMBOY | 47:9e361da97763 | 64 | mp4ff_t _infile; |
| TMBOY | 47:9e361da97763 | 65 | |
| TMBOY | 47:9e361da97763 | 66 | MediaAdapter* _media_adapter; |
| TMBOY | 47:9e361da97763 | 67 | }; |
| TMBOY | 47:9e361da97763 | 68 | |
| TMBOY | 47:9e361da97763 | 69 | } // namespace duer |
| TMBOY | 47:9e361da97763 | 70 | |
| TMBOY | 47:9e361da97763 | 71 | #endif // BAIDU_TINYDU_IOT_OS_SRC_MEDIA_PLAYER_BAIDU_MEDIA_PLAY_M4A_H |
