forked from ZhaoliangGuo/pxScreenLiveStreaming
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CPxFLVMuxer.h
72 lines (52 loc) · 2.77 KB
/
CPxFLVMuxer.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
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
#pragma once
#include "pxFLVGlobal.h"
class CPxFLVMuxer
{
public:
CPxFLVMuxer();
virtual ~CPxFLVMuxer();
public:
HRESULT AddFile(char *in_pwszFileName);
HRESULT CloseFile(void);
HRESULT BeginWriteFile(void);
HRESULT EndWriteFile(void);
HRESULT SetFileProperty(SPxRecordFileProperty *in_psFileProperty);
HRESULT AddAudioStream(int in_nStreamNum, int in_nType, int in_nChannels, int in_nSamplesPerSecond, int in_nBitsPerSample);
HRESULT AddVideoStream(int in_nStreamNum, int in_nType, int in_nWidth, int in_nHeight, int in_nBitrate, int in_nFrameRate);
HRESULT WriteAudioSample(int in_nStreamNum, unsigned char *in_pBuffer, int in_nBufferLen, int in_nTimeStamp);
HRESULT WriteVideoSample(int in_nStreamNum, unsigned char *in_pBuffer, int in_nBufferLen, bool in_bIsKeyFrame, int in_nTimeStamp);
HRESULT FlushFile(void);
HRESULT Write(char *in_pBuffer, int in_nBufferLen);
HRESULT GetAVCNalType(LPVOID in_pBSBuf, const LONG in_nBSLen, ePxAVCNalType *out_eAVCNalType, int *out_nAVCNalLen);
HRESULT GetBufferFrameType(unsigned char *in_pBuffer, int in_nBufferLen, ePxAVCNalType *out_eBufferFrameType, int *out_nBufferFrameHeadLen, int *out_nBufferFrameLen);
public:
HRESULT SetStreamProperty(SPxRecordStreamProperty *in_psFileStreamProperty);
private:
SPxFLVRecorderFileHeader m_sFlvFileHeader;
SPxFLVRecorderTagHeader m_sFlvFileTagHeader;
unsigned int m_nLastTagSize;
sPxFLVRecorderAudioData m_sFlvFileAudioData;
sPxFLVRecorderAACAudioData m_sFlvFileAACAudioData;
sPxFLVRecorderVideoData m_sFlvFileVideoData;
sPxFLVRecorderAVCVideoData m_sFlvFileAVCVideoData;
bool m_bAVCInited;
bool m_bAACInited;
bool m_bFirstIFrame;
DWORD m_dwDurationPosition; //FLV文件头信息中对应录制文件总时长的偏移量
DWORD m_dwFileSizePosition; //FLV文件头信息中对应录制文件总大小的偏移量
FILE *m_fpFLVFile; //生成文件的指针,主要用于FLV文件
double m_dFLVFileDuration; //生成文件的总时长
//SPxRecordFileProperty m_sPxRecordFileProperty;
int m_nVideoStreamNum; //视频流编号
char m_szVideoFileName[_MAX_PATH];
//CNsCriticalSection m_oCritDevice;
long m_lVideoTimeSample;
bool m_bVideoSampleArrived;
long m_lAudioTimeSample;
long m_bAudioSampleArrived;
LARGE_INTEGER m_lnSysBeginVideoTimeSample;
LARGE_INTEGER m_lnSysBeginAudioTimeSample;
long m_lSysDValueVideoTimeSample;
long m_lSysDValueAudioTimeSample;
SPxRecordStreamProperty m_sRecordStreamProperty;
};