forked from markessien/DirectEncode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMPEGObj.h
172 lines (139 loc) · 4.81 KB
/
MPEGObj.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/** This file is part of The Standard Mpeg Encoder.
The Standard Mpeg Encoder is free software: you can redistribute it
and/or modify it under the terms of the GNU General Public License
as published by the Free Software Foundation, either version 3 of
the License, or (at your option) any later version.
The Standard Mpeg Encoder is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with The Standard Mpeg Encoder.
If not, see <http://www.gnu.org/licenses/>.
**/
#pragma once
#include "Profile.h"
#include "license.h"
#include "Encodeerdlib.h"
#include "LogoOverlay.h"
class CMPEGFilter;
class CMPEGFilterInterface;
class CMPEGObj : public CUnknown,
public ISpecifyPropertyPages,
public IDeliverCallback,
public CPersistStream
{
STDMETHODIMP QueryInterface(REFIID riid, void **ppv)
{
return GetOwner()->QueryInterface(riid,ppv);
};
STDMETHODIMP_(ULONG) AddRef()
{
return GetOwner()->AddRef();
};
STDMETHODIMP_(ULONG) Release()
{
return GetOwner()->Release();
};
friend class CMPEGFilterInterface;
friend class CMPEGOutputPin;
friend class CMPEGFilter;
public:
CMPEGObj(LPUNKNOWN pUnk, HRESULT *phr);
~CMPEGObj();
static CUnknown * WINAPI CreateInstance(LPUNKNOWN punk, HRESULT *phr);
bool GetShouldMultiplex();
void SetShouldMultiplex(bool b);
bool IsWaitingInPause();
bool IsPaused();
void Pause();
bool IsPrimed();
REFERENCE_TIME GetCurrentTime();
HRESULT PrimeForEncode();
HRESULT ReceiveAudio(IMediaSample *pSample);
HRESULT ReceiveVideo(IMediaSample *pSample);
HRESULT EndOfStream(MediaFormat mediaFormat);
HRESULT Stop();
HRESULT Run();
HRESULT LoadSettings(BSTR strKey);
HRESULT SaveSettings(BSTR strKey);
HRESULT PassThruCmd(BSTR strCmd, long nCmd, double dCmd, BYTE* pCmd);
HRESULT Deliver(unsigned char* pBuf, int nBufLen, int nID);
signed __int64 SeekOutput(signed __int64 newPos, int nID);
STDMETHODIMP SelectFormat(SystemsOutputFormat systemsFormat, Constraint constraint);
CMPEGProfile& GetSettingsProfile(SystemsOutputFormat systemsFormat, Constraint constrain);
CMPEGProfile& GetCurrentSettingsProfile();
CEncodeErdLib* GetEncodeLib() { return m_pEncode; }
// CPeristStream stuff
HRESULT WriteToStream(IStream *pStream);
HRESULT ReadFromStream(IStream *pStream);
int SizeMax() {return 10;}
// CPersistStream override
STDMETHODIMP GetClassID(CLSID *pClsid);
private:
void StopConversion();
protected:
STDMETHODIMP SetFileName(LPCOLESTR pszFileName,const AM_MEDIA_TYPE *pmt);
STDMETHODIMP GetCurFile(LPOLESTR * ppszFileName,AM_MEDIA_TYPE *pmt);
STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void ** ppv);
STDMETHODIMP GetPages(CAUUID *pPages);
private:
CComPtr<IDirectEncodeVB> m_pDirectEncodeVB;
CCritSec m_ReceiveLock;
CMPEGFilterInterface* m_pInterface;
CMPEGFilter* m_pFilter;
CEncodeErdLib* m_pEncode;
CLicense* m_pLicense;
CLogoOverlay m_LogoOverlay;
CMPEGProfile* m_pCurrentProfile;
/* NEW_FORMAT CHANGE POINT */
CMPEGProfile m_prElementary; // special profile for just an elementary stream -> only audio or video
CMPEGProfile m_prMPEG1;
CMPEGProfile m_prMPEG2;
CMPEGProfile m_prDVDPal;
CMPEGProfile m_prDVDNtsc;
CMPEGProfile m_prVCDPal;
CMPEGProfile m_prVCDNtsc;
CMPEGProfile m_prSVCDPal;
CMPEGProfile m_prSVCDNtsc;
CMPEGProfile m_prSVCDNtsc_Still;
CMPEGProfile m_prSVCDPal_Still;
CMPEGProfile m_prVCDNtsc_Still;
CMPEGProfile m_prVCDPal_Still;
CMPEGProfile m_prMP4;
CMPEGProfile m_prMP4IPod;
CMPEGProfile m_prMP4IPod_Nano;
CMPEGProfile m_prMP4IPhone;
CMPEGProfile m_prMP4H264;
CMPEGProfile m_prMP4QT;
CMPEGProfile m_prMP4AVI;
CMPEGProfile m_pr3GP;
CMPEGProfile m_pr3G2;
CMPEGProfile m_prPSP;
CMPEGProfile m_prFLV;
CMPEGProfile m_prDVB;
CMPEGProfile m_prRM;
CMPEGProfile m_prMPEG2_HD;
CAMEvent m_eventIsPrimed;
wchar_t m_szOutputFile[1024];
wchar_t m_szLicense[1024];
wchar_t m_szEncodeLibrary[1024];
bool m_bPrimed;
bool m_bStopped;
bool m_bLicensed;
bool m_bLicensedMP4;
bool m_bAuthenticated;
bool m_bHasAudio;
bool m_bHasVideo;
bool m_bMultiplex;
int m_iStreamCount;
int m_iStreamsStopped;
bool m_bAudioLocked;
DWORD m_dwSleep;
REFERENCE_TIME m_rtCurrentVideo;
REFERENCE_TIME m_rtCurrentAudio;
__int64 m_nVideoFramesReceived;
__int64 m_nAudioSamplesReceived;
__int64 m_nVideoFramesReceivedSincePause;
__int64 m_nAudioSamplesReceivedSincePause;
};