blob: c900a5a448d2ebe63f3e0716c0b8dc40cf758c93 [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);
43 bool DecodeNextFrame (Callback* cbk);
44 ISVCDecoder* decoder_;
45
46 private:
47 void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
48 void FlushFrame (Callback* cbk);
49
50 std::ifstream file_;
51 BufferedData buf_;
52 BufferedData buf[16];
53 SBufferInfo sBufInfo;
54 uint8_t* pData[3];
55 uint64_t uiTimeStamp;
56 FILE* pYuvFile;
57 bool bEnableYuvDumpTest;
58 eDecodeStatus decodeStatus_;
59};
60
61#endif //__BASETHREADDECODERTEST_H__