Filter configuration
If the source is a video file (or audio file)
- create the filter instance
- add the "Datastead Multipurpose Encoder (From File)" to the graph
- query the filter's IDatasteadMultipurposeDirectShowEncoder interface
- invoke
SetCommandLineon this interface - run the graph
// ... create the filter graph ...
IBaseFilter *DatasteadMPE = NULL;
HRESULT hr = CoCreateInstance(CLSID_DatasteadMultipurposeDirectShowEncoderFromFile,
NULL, CLSCTX_INPROC_SERVER, (void**) &DatasteadMPE);
if (SUCCEEDED (hr)) {
hr = pGraph->AddFilter(DatasteadMPE, "Datastead Multipurpose Encoder (From File)");
if (SUCCEEDED (hr)) {
IDatasteadMultipurposeDirectShowEncoder *MPEConfig;
hr = DatasteadMPE->QueryInterface (IID_IDatasteadMultipurposeDirectShowEncoder, (void**) &MPEConfig);
if (SUCCEEDED (hr)) {
hr = MPEConfig->SetCommandLine (/* ...transcoder's ".exe" command line... */);
if (SUCCEEDED (hr)) {
// ... run the graph
}
MPEConfig->Release();
}
}
DatasteadMPE->Release();
}
If the source is a live DirectShow source (e.g. a webcam)
- create the filter instance
- add the camera video device to the graph
- add the camera audio device to the graph (if audio needed)
- add the Datastead Multipurpose Encoder to the graph
- query the filter's IDatasteadMultipurposeDirectShowEncoder interface, set the command line
- connect the video and/or audio pins
- run the graph
// ... create filter graph ...
// ... add video and/or audio capture devices ...
IBaseFilter *DatasteadMPE = NULL;
HRESULT hr = CoCreateInstance(CLSID_DatasteadMultipurposeDirectShowEncoder,
NULL, CLSCTX_INPROC_SERVER, (void**) &DatasteadMPE);
if (SUCCEEDED (hr)) {
hr = pGraph->AddFilter(DatasteadMPE, "Datastead Multipurpose Encoder");
if (SUCCEEDED (hr)) {
IDatasteadMultipurposeDirectShowEncoder *MPEConfig;
hr = DatasteadMPE->QueryInterface (IID_IDatasteadMultipurposeDirectShowEncoder, (void**) &MPEConfig);
if (SUCCEEDED (hr)) {
hr = MPEConfig->SetCommandLine (/* ...transcoder's ".exe" command line... */);
if (SUCCEEDED (hr)) {
// ... render the video and audio output pins, and run the graph
}
MPEConfig->Release();
}
}
DatasteadMPE->Release();
}
The command-line syntax is described in the Command-line syntax chapter.