MCPcopy Create free account
hub / github.com/cisco/openh264 / DecodeEncodeTest

Class DecodeEncodeTest

test/api/decode_encode_test.cpp:38–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36};
37
38class DecodeEncodeTest : public ::testing::TestWithParam<DecodeEncodeFileParam>,
39 public BaseDecoderTest, public BaseDecoderTest::Callback,
40 public BaseEncoderTest , public BaseEncoderTest::Callback,
41 public InputStream {
42 public:
43 virtual void SetUp() {
44 BaseDecoderTest::SetUp();
45 if (HasFatalFailure()) {
46 return;
47 }
48 BaseEncoderTest::SetUp();
49 if (HasFatalFailure()) {
50 return;
51 }
52 SHA1Reset (&ctx_);
53 }
54
55 virtual void TearDown() {
56 BaseDecoderTest::TearDown();
57 BaseEncoderTest::TearDown();
58 }
59
60 virtual void onDecodeFrame (const Frame& frame) {
61 const Plane& y = frame.y;
62 const Plane& u = frame.u;
63 const Plane& v = frame.v;
64 WritePlaneBuffer (&buf_, y.data, y.width, y.height, y.stride);
65 WritePlaneBuffer (&buf_, u.data, u.width, u.height, u.stride);
66 WritePlaneBuffer (&buf_, v.data, v.width, v.height, v.stride);
67 }
68
69 virtual void onEncodeFrame (const SFrameBSInfo& frameInfo) {
70 UpdateHashFromFrame (frameInfo, &ctx_);
71 }
72
73 virtual int read (void* ptr, size_t len) {
74 while (buf_.Length() < len) {
75 bool hasNext = DecodeNextFrame (this);
76 if (HasFatalFailure()) {
77 return -1;
78 }
79 if (!hasNext) {
80 if (buf_.Length() == 0) {
81 return -1;
82 }
83 break;
84 }
85 }
86 return (int) buf_.PopFront (static_cast<uint8_t*> (ptr), len);
87 }
88
89 protected:
90 SHA1Context ctx_;
91 BufferedData buf_;
92};
93
94void DecEncFileParamToParamExt (DecodeEncodeFileParam* pDecEncFileParam, SEncParamExt* pEnxParamExt) {
95 ASSERT_TRUE (NULL != pDecEncFileParam && NULL != pEnxParamExt);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected