openh264/test/BaseDecoderTest.h

53 lines
919 B
C
Raw Normal View History

#ifndef __BASEDECODERTEST_H__
#define __BASEDECODERTEST_H__
#include "test_stdint.h"
#include <limits.h>
#include <fstream>
#include "codec_api.h"
#include "utils/BufferedData.h"
class BaseDecoderTest {
public:
struct Plane {
const uint8_t* data;
int width;
int height;
int stride;
};
struct Frame {
Plane y;
Plane u;
Plane v;
};
struct Callback {
2014-06-26 03:50:41 +02:00
virtual void onDecodeFrame (const Frame& frame) = 0;
};
BaseDecoderTest();
2016-03-04 08:49:32 +01:00
int32_t SetUp();
void TearDown();
2014-06-26 03:50:41 +02:00
void DecodeFile (const char* fileName, Callback* cbk);
2014-06-26 03:50:41 +02:00
bool Open (const char* fileName);
bool DecodeNextFrame (Callback* cbk);
2014-08-13 03:31:41 +02:00
ISVCDecoder* decoder_;
private:
void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
std::ifstream file_;
BufferedData buf_;
enum {
OpenFile,
Decoding,
EndOfStream,
End
} decodeStatus_;
};
#endif //__BASEDECODERTEST_H__