Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.2 KiB

  1. #include "clone.h"
  2. HRESULT StandardDMOClone_Ending(IMediaObject *pThis, IMediaObject *pCloned, IMediaObjectInPlace **ppCloned)
  3. {
  4. HRESULT hr = S_OK;
  5. // Copy the input and output types
  6. DMO_MEDIA_TYPE mt;
  7. DWORD cInputStreams = 0;
  8. DWORD cOutputStreams = 0;
  9. pThis->GetStreamCount(&cInputStreams, &cOutputStreams);
  10. for (DWORD i = 0; i < cInputStreams && SUCCEEDED(hr); ++i)
  11. {
  12. hr = pThis->GetInputCurrentType(i, &mt);
  13. if (hr == DMO_E_TYPE_NOT_SET)
  14. {
  15. hr = S_OK; // great, don't need to set the cloned DMO
  16. }
  17. else if (SUCCEEDED(hr))
  18. {
  19. hr = pCloned->SetInputType(i, &mt, 0);
  20. }
  21. }
  22. for (i = 0; i < cOutputStreams && SUCCEEDED(hr); ++i)
  23. {
  24. hr = pThis->GetOutputCurrentType(i, &mt);
  25. if (hr == DMO_E_TYPE_NOT_SET)
  26. {
  27. hr = S_OK; // great, don't need to set the cloned DMO
  28. }
  29. else if (SUCCEEDED(hr))
  30. {
  31. hr = pCloned->SetOutputType(i, &mt, 0);
  32. }
  33. }
  34. if (SUCCEEDED(hr))
  35. hr = pCloned->QueryInterface(IID_IMediaObjectInPlace, (void**)ppCloned);
  36. // Release the object's original ref. If clone succeeded (made it through QI) then returned pointer
  37. // has one ref. If we failed, refs drop to zero, freeing the object.
  38. pCloned->Release();
  39. return hr;
  40. }