blob: f9c317eaae157d319600f665a7208625ad3c983c [file] [log] [blame]
xiaotian.shicd1a9602019-11-26 15:41:20 -08001#ifndef __BASETHREADDECODERTEST_H__
2#define __BASETHREADDECODERTEST_H__
3
4#include "test_stdint.h"
5#include <limits.h>
6#include <fstream>
7#include "codec_api.h"
8
9#include "utils/BufferedData.h"
10
11class BaseThreadDecoderTest {
12 public:
13 struct Plane {
14 const uint8_t* data;
15 int width;
16 int height;
17 int stride;
18 };
19
20 struct Frame {
21 Plane y;
22 Plane u;
23 Plane v;
24 };
25
26 typedef enum tagDecodeStatus {
27 OpenFile,
28 Decoding,
29 EndOfStream,
30 End
31 } eDecodeStatus;
32
33 struct Callback {
34 virtual void onDecodeFrame (const Frame& frame) = 0;
35 };
36
37 BaseThreadDecoderTest();
38 int32_t SetUp();
39 void TearDown();
40 bool ThreadDecodeFile (const char* fileName, Callback* cbk);
41
42 bool Open (const char* fileName);
xiaotian.shicd1a9602019-11-26 15:41:20 -080043 ISVCDecoder* decoder_;
44
45 private:
46 void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
47 void FlushFrame (Callback* cbk);
48
49 std::ifstream file_;
xiaotian.shicd1a9602019-11-26 15:41:20 -080050 SBufferInfo sBufInfo;
51 uint8_t* pData[3];
52 uint64_t uiTimeStamp;
53 FILE* pYuvFile;
54 bool bEnableYuvDumpTest;
55 eDecodeStatus decodeStatus_;
56};
57
58#endif //__BASETHREADDECODERTEST_H__