Filter GUID and interface
Filter CLSID
CLSID_DatasteadMultipurposeDirectShowEncoder:
TGUID = '{39E3007B-6185-47FC-9839-C4B8621AC065}';
IDatasteadMultipurposeDirectShowEncoder interface
The filter exposes the following interface:
DECLARE_INTERFACE_(IDatasteadMultipurposeDirectShowEncoder, IUnknown)
{
virtual HRESULT STDMETHODCALLTYPE SetCommandLine(/*in*/ LPWSTR CommandLine) PURE;
virtual HRESULT STDMETHODCALLTYPE GetCommandLine(/*out*/ LPWSTR *CommandLine) PURE;
virtual HRESULT STDMETHODCALLTYPE Stop_PauseWhenStop() PURE;
virtual HRESULT STDMETHODCALLTYPE GetCurrentLog(
/*in*/ bool OnlyIfUpdated,
/*in*/ PCHAR pBuffer,
/*in*/ int MaxBufferSize,
/*out*/ int *CurrentLogSize,
/*out*/ int *CurrentLogFlag) PURE;
virtual HRESULT STDMETHODCALLTYPE IsCurrentLogUpdated() PURE;
virtual int STDMETHODCALLTYPE GetExitCode() PURE;
virtual unsigned int STDMETHODCALLTYPE GetInputsTotalDurationMs() PURE;
virtual unsigned int STDMETHODCALLTYPE GetProgress_FrameCount() PURE;
virtual unsigned int STDMETHODCALLTYPE GetProgress_TimeMs() PURE;
virtual unsigned int STDMETHODCALLTYPE GetProgress_DuplicatedCount() PURE;
virtual unsigned int STDMETHODCALLTYPE GetProgress_DroppedCount() PURE;
virtual double STDMETHODCALLTYPE GetProgress_Fps() PURE;
virtual double STDMETHODCALLTYPE GetProgress_Quality() PURE;
virtual double STDMETHODCALLTYPE GetProgress_SizeWrittenKb() PURE;
virtual double STDMETHODCALLTYPE GetProgress_BitRateKbps() PURE;
virtual HRESULT STDMETHODCALLTYPE GetConnectedVideoPinInfo(
/*out*/ int *VideoWidth,
/*out*/ int *VideoHeight,
/*out*/ int *VideoAvgTimePerFrame) PURE;
virtual HRESULT STDMETHODCALLTYPE GetConnectedAudioPinInfo(
/*out*/ int *AudioChannels,
/*out*/ int *AudioSampleRate,
/*out*/ int *AudioBitsPerSample) PURE;
virtual HRESULT STDMETHODCALLTYPE SetMediaEventSinkNotifyID (LONG_PTR Value) PURE;
virtual BOOL STDMETHODCALLTYPE Is64BitWindows() PURE;
virtual BOOL STDMETHODCALLTYPE Is64BitApplication() PURE;
};
SetCommandLine
Sets the FFmpeg command line, with eventual extra keywords destined to the filter. The syntax is described in the Command-line syntax chapter.
GetCommandLine
Retrieves the current command line. Pass a LPWSTR pointer to the function. The function allocates memory and copies the string. If the function succeeds, the LPWSTR pointer must be freed by invoking CoTaskMemFree.
E.g.:
LPWSTR pCommandLine;
if (SUCCEEDED (MPEConfig->GetCommandLine (&pCommandLine))) {
// ... do what you need with the pCommandLine string returned
CoTaskMemFree (pCommandLine);
}
Stop_PauseWhenStop
See the PAUSEWHENSTOP keyword in the reserved keywords chapter.
GetCurrentLog
Copies the current FFmpeg log string in a buffer. If the string contains several lines, they are separated by CR/LF characters: char(13)/char(10).
Note that this function does not work if SHOWCONSOLE has been specified.
You must allocate the buffer and pass its pointer to the function.
To determine the required maximum buffer size and allocate the buffer, invoke GetCurrentLog with all parameters to 0 / NULL excepted CurrentLogSize that will return the size required to allocate the buffer, e.g.:
int MaxBufferSize;
CHAR *pBuffer = NULL;
// ...
if (pBuffer == NULL) {
if (SUCCEEDED (MPEConfig->GetCurrentLog (false, NULL, 0, &MaxBufferSize, NULL))) {
pBuffer = new CHAR[MaxBufferSize];
}
}
Then to read the current log:
int BufferSizeRead = 0;
if (SUCCEEDED (MPEConfig->GetCurrentLog (true, pBuffer, BufferSize, &BufferSizeRead, NULL))) {
// ... do anything with the string in the buffer ...
}
Notes:
OnlyIfUpdatedparameter: if false, the buffer returns its content, even if this content has already been returned by the function; if true and the buffer content has changed, the function fills the buffer and returns S_OK, otherwise it returns E_NOT_SET.- The buffer is "string safe":
GetCurrentLogwrites a NULL character at the end of the text read.
IsCurrentLogUpdated
Returns S_OK if the buffer content has changed, or E_NOT_SET. It is useless to invoke it to determine if GetCurrentLog must be invoked just after: in this case invoke GetCurrentLog directly with the OnlyIfUpdated parameter = true, so it will return directly E_NOT_SET if no new log is available.
GetExitCode
Returns the exit code, 0 on success or another value if the encoding failed for any reason (usually a wrong command-line syntax or a non-writeable output file).
GetInputsTotalDurationMs
(*) When the input file has a fixed size, it returns the duration reported by FFmpeg in milliseconds. If several input files are used (e.g. when concatenating clips), the value returned is the total duration of the final clip (the sum of the durations of the concatenated clips).
GetProgress_FrameCount
Returns the current frame count. (*)
GetProgress_TimeMs
Returns the current stream time in milliseconds. (*)
GetProgress_DuplicatedCount
Returns the number of duplicated frames, if any. (*)
GetProgress_DroppedCount
Returns the number of dropped frames, if any. (*)
GetProgress_Fps
Returns the average number of frames per second. (*)
GetProgress_Quality
Returns the average quality (the meaning depends on the codec). (*)
GetProgress_SizeWrittenKb
Returns the size written to disk in KiloBytes. (*)
GetProgress_BitRateKbps
Returns the average bit rate in KiloBytes per second. (*)
(*) these functions are currently supported only with FFmpeg, and only if SHOWCONSOLE has not been specified.
GetConnectedVideoPinInfo
Returns the video size of the input pin, and average time per frame of the video input stream (expressed in 100 nanoseconds units, 1 second = 10000000, e.g. at 25 fps the average time per frame returns 400000).
GetConnectedAudioPinInfo
Returns the number of audio channels, the sample rate and the number of bits per sample of the audio input pin.
SetMediaEventSinkNotifyID
This is useful only:
- when processing the event notifications sent by the filter to the graph (when implementing
IMediaEventSink), - and when using more than one instance of the Multipurpose Encoder in the same graph.
See Graph event notifications.
Is64BitWindows
This helper function lets you know if your app is running on a Windows 64bit PC, or on a Windows 32bit PC.
Is64BitApplication
This helper function lets you know if the application is compiled in 32bit or 64bit.