summaryrefslogtreecommitdiff
path: root/amadec/omx_audio/THD_mediasource.h (plain)
blob: e8d9c65c71dc8f8443aa008d92f09b1a71b985a3
1#ifndef MEDIA_THDMEDIASOURCE_H_
2#define MEDIA_THDMEDIASOURCE_H_
3
4#include "MediaSource.h"
5#include "DataSource.h"
6#include "MediaBufferGroup.h"
7#include "MetaData.h"
8#include "audio_mediasource.h"
9
10#define TRUEHDSYNC 0xf8726fba //main sync header
11#define MAX_AUSIZE 4000 //max access unit size
12#define MIN_AUSIZE 6 //min access unit size
13
14typedef unsigned char uchar;
15typedef unsigned short ushort;
16typedef unsigned int uint;
17
18
19
20namespace android
21{
22
23typedef int (*fp_read_buffer)(unsigned char *, int);
24
25class THD_MediaSource : public AudioMediaSource
26{
27public:
28 THD_MediaSource(void *read_buffer);
29
30 status_t start(MetaData *params = NULL);
31 status_t stop();
32 sp<MetaData> getFormat();
33 status_t read(MediaBuffer **buffer, const ReadOptions *options = NULL);
34
35 int GetReadedBytes();
36 int GetSampleRate();
37 int GetChNum();
38 int* Get_pStop_ReadBuf_Flag();
39 int Set_pStop_ReadBuf_Flag(int *pStop);
40
41 int SetReadedBytes(int size);
42 int MediaSourceRead_buffer(unsigned char *buffer, int size);
43
44 fp_read_buffer fpread_buffer;
45
46 int StreamAnalysis(char *buffer);
47
48 int sample_rate;
49 int ChNum;
50 int frame_size;
51 int64_t bytes_readed_sum_pre;
52 int64_t bytes_readed_sum;
53 int* pStop_ReadBuf_Flag;
54
55protected:
56 virtual ~THD_MediaSource();
57
58private:
59 bool mStarted;
60 sp<DataSource> mDataSource;
61 sp<MetaData> mMeta;
62 MediaBufferGroup *mGroup;
63 int64_t mCurrentTimeUs;
64 int mBytesReaded;
65 bool mSyncMain;
66
67 THD_MediaSource(const THD_MediaSource &);
68 THD_MediaSource &operator=(const THD_MediaSource &);
69};
70
71
72}
73
74#endif
75