Martin Storsjö | 0195b1a | 2018-07-28 00:47:05 +0300 | [diff] [blame] | 1 | #ifndef __BASEDECODERTEST_H__ |
| 2 | #define __BASEDECODERTEST_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 | |
| 11 | class BaseDecoderTest { |
| 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 | struct Callback { |
| 27 | virtual void onDecodeFrame (const Frame& frame) = 0; |
| 28 | }; |
| 29 | |
| 30 | BaseDecoderTest(); |
| 31 | int32_t SetUp(); |
| 32 | void TearDown(); |
wayne | 5cf42ab | 2018-12-26 15:10:53 +0800 | [diff] [blame] | 33 | bool DecodeFile (const char* fileName, Callback* cbk); |
Martin Storsjö | 0195b1a | 2018-07-28 00:47:05 +0300 | [diff] [blame] | 34 | |
| 35 | bool Open (const char* fileName); |
| 36 | bool DecodeNextFrame (Callback* cbk); |
| 37 | ISVCDecoder* decoder_; |
| 38 | |
| 39 | private: |
| 40 | void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk); |
| 41 | void FlushFrame (Callback* cbk); |
| 42 | |
| 43 | std::ifstream file_; |
| 44 | BufferedData buf_; |
wayne | 5cf42ab | 2018-12-26 15:10:53 +0800 | [diff] [blame] | 45 | enum {\ |
Martin Storsjö | 0195b1a | 2018-07-28 00:47:05 +0300 | [diff] [blame] | 46 | OpenFile, |
| 47 | Decoding, |
| 48 | EndOfStream, |
| 49 | End |
| 50 | } decodeStatus_; |
| 51 | }; |
| 52 | |
| 53 | #endif //__BASEDECODERTEST_H__ |