DvppStreamDecoder.h
1.92 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef __DVPP_STREAM_DECODER_H__
#define __DVPP_STREAM_DECODER_H__
#include "depend_headers.h"
#include "dvpp_headers.h"
#include "VpcUtils.h"
#include "FFRecoderTaskManager.h"
using namespace std;
class DvppStreamDecoder
{
public:
DvppStreamDecoder(/* args */);
~DvppStreamDecoder();
bool Init(FFDecConfig cfg);
int SendData(int videoType, char* data, int len, int isKey, uint64_t pts);
void Close();
DvppDataMemory* GetFrame();
void doRecode(RecoderInfo& recoderInfo);
void set_mq_callback(mq_callback_t cb);
public:
void doProcessReport();
void doVdppVdecCallBack(acldvppStreamDesc *input, acldvppPicDesc *output, void *pUserData);
private:
bool sendVdecEos(aclvdecChannelDesc *vdecChannelDesc);
int sendPkt(aclvdecChannelDesc *vdecChannelDesc, AVPacket* pkt, unsigned long long frame_nb, int vdec_out_size);
int parse_stream_info(int videoType, AVPacket* pkt);
void release_dvpp();
void release_channeldesc();
int getVdecType(int videoType);
private:
string m_dec_name {""};
int m_deviceId {-1};
int m_dvpp_channel {-1};
aclrtContext m_context{nullptr};
aclvdecChannelDesc *vdecChannelDesc {nullptr};
pthread_t report_thread;
bool m_bExitReportThd{false};
int m_vdec_out_size {-1};
int m_fps {-1};
int frameW {-1};
int frameH {-1};
int out_frame_width{0};
int out_frame_height{0};
VpcUtils m_vpcUtils;
unsigned long m_frame_nb {0};
std::atomic<int> m_DvppCacheCounter{0};
queue<DvppDataMemory*> m_decoded_data_queue;
mutex m_decoded_data_queue_mtx;
bool m_bExit {false};
const void * m_finishedDecArg {nullptr};
DECODE_FINISHED_CALLBACK decode_finished_cbk {nullptr};
AVBSFContext * h264bsfc{nullptr};
uint64_t m_in_count {0};
uint64_t m_out_count {0};
bool m_bResize {false};
FFRecoderTaskManager m_recoderManager;
};
#endif // __DVPP_STREAM_DECODER_H__