File: BaseDecoderTest.h

package info (click to toggle)
openh264 2.6.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,120 kB
  • sloc: cpp: 74,004; asm: 34,842; ansic: 23,866; sh: 2,540; python: 937; objc: 612; cs: 471; makefile: 354; java: 319; xml: 204; javascript: 17
file content (53 lines) | stat: -rw-r--r-- 955 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#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 {
    virtual void onDecodeFrame (const Frame& frame) = 0;
  };

  BaseDecoderTest();
  int32_t SetUp();
  void TearDown();
  bool DecodeFile (const char* fileName, Callback* cbk);

  bool Open (const char* fileName);
  bool DecodeNextFrame (Callback* cbk);
  ISVCDecoder* decoder_;

 private:
  void DecodeFrame (const uint8_t* src, size_t sliceSize, Callback* cbk);
  void FlushFrame (Callback* cbk);

  std::ifstream file_;
  BufferedData buf_;
  enum {\
    OpenFile,
    Decoding,
    EndOfStream,
    End
  } decodeStatus_;
};

#endif //__BASEDECODERTEST_H__