Skip to content

Filter configuration

If the source is a video file (or audio file)

  1. create the filter instance
  2. add the "Datastead Multipurpose Encoder (From File)" to the graph
  3. query the filter's IDatasteadMultipurposeDirectShowEncoder interface
  4. invoke SetCommandLine on this interface
  5. 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)

  1. create the filter instance
  2. add the camera video device to the graph
  3. add the camera audio device to the graph (if audio needed)
  4. add the Datastead Multipurpose Encoder to the graph
  5. query the filter's IDatasteadMultipurposeDirectShowEncoder interface, set the command line
  6. connect the video and/or audio pins
  7. 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.