blob: f94b133c6f3eefba69f182edcc6eff6b9ed16610
1 | #ifndef MEDIA_VORBIS_MEDIASOURCE_H_ |
2 | #define MEDIA_VORBIS_MEDIASOURCE_H_ |
3 | |
4 | #include "MediaSource.h" |
5 | #include "DataSource.h" |
6 | #include "MediaBufferGroup.h" |
7 | #include "MetaData.h" |
8 | #include "audio_mediasource.h" |
9 | #include "audio-dec.h" |
10 | |
11 | namespace android |
12 | { |
13 | |
14 | typedef int (*fp_read_buffer)(unsigned char *, int); |
15 | class Vorbis_MediaSource : public AudioMediaSource |
16 | { |
17 | public: |
18 | Vorbis_MediaSource(void *read_buffer, aml_audio_dec_t *audec); |
19 | |
20 | status_t start(MetaData *params = NULL); |
21 | status_t stop(); |
22 | sp<MetaData> getFormat(); |
23 | status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL); |
24 | |
25 | int GetReadedBytes(); |
26 | int GetSampleRate(); |
27 | int GetChNum(); |
28 | int* Get_pStop_ReadBuf_Flag(); |
29 | int Set_pStop_ReadBuf_Flag(int *pStop); |
30 | int MediaSourceRead_buffer(unsigned char *buffer, int size); |
31 | |
32 | fp_read_buffer fpread_buffer; |
33 | int sample_rate; |
34 | int ChNum; |
35 | int packt_size; |
36 | int *pStop_ReadBuf_Flag; |
37 | int64_t bytes_readed_sum_pre; |
38 | int64_t bytes_readed_sum; |
39 | int FrameNumReaded; |
40 | protected: |
41 | virtual ~Vorbis_MediaSource(); |
42 | private: |
43 | bool mStarted; |
44 | sp<DataSource> mDataSource; |
45 | sp<MetaData> mMeta; |
46 | MediaBufferGroup *mGroup; |
47 | int64_t mCurrentTimeUs; |
48 | int mBytesReaded; |
49 | int block_align; |
50 | Vorbis_MediaSource(const Vorbis_MediaSource &); |
51 | Vorbis_MediaSource &operator=(const Vorbis_MediaSource &); |
52 | }; |
53 | |
54 | |
55 | } |
56 | |
57 | #endif |
58 | |
59 |