-
Notifications
You must be signed in to change notification settings - Fork 0
/
cvideodecoder.h
42 lines (36 loc) · 876 Bytes
/
cvideodecoder.h
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
#ifndef CVIDEODECODER_H
#define CVIDEODECODER_H
#ifdef __cplusplus
extern "C"
{
#endif
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavutil/imgutils.h>
#ifdef __cplusplus
};
#endif
#include <string>
class CVideoDecoder
{
public:
CVideoDecoder(const std::string& strFile);
void GetDecodedData(unsigned char*& pBuffer, int& iFrameDataPitch);
void GetPixInfo(int& PixW, int& PixH);
private:
int Decode();
void Init();
private:
std::string m_VideoFileName;
AVFormatContext *m_pFormatCtx;
AVCodecContext *m_pCodecCtx;
const AVCodec *m_pCodec;
AVFrame *m_pFrame, *m_pFrameYUV;
AVPacket *m_pPacket;
SwsContext *m_ConvertCtx;
int m_iVideoIndex;
int m_PixelW;
int m_PixelH;
};
#endif // CVIDEODECODER_H