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.

83 lines
2.5 KiB

  1. //------------------------------------------------------------------------------
  2. // File: SeekPT.cpp
  3. //
  4. // Desc: DirectShow base classes.
  5. //
  6. // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
  7. //------------------------------------------------------------------------------
  8. #include <streams.h>
  9. #include "seekpt.h"
  10. //==================================================================
  11. // CreateInstance
  12. // This goes in the factory template table to create new instances
  13. // If there is already a mapper instance - return that, else make one
  14. // and save it in a static variable so that forever after we can return that.
  15. //==================================================================
  16. CUnknown * CSeekingPassThru::CreateInstance(LPUNKNOWN pUnk, HRESULT *phr)
  17. {
  18. return new CSeekingPassThru(NAME("Seeking PassThru"),pUnk, phr);
  19. }
  20. STDMETHODIMP CSeekingPassThru::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
  21. {
  22. if (riid == IID_ISeekingPassThru) {
  23. return GetInterface((ISeekingPassThru *) this, ppv);
  24. } else {
  25. if (m_pPosPassThru &&
  26. (riid == IID_IMediaSeeking ||
  27. riid == IID_IMediaPosition)) {
  28. return m_pPosPassThru->NonDelegatingQueryInterface(riid,ppv);
  29. } else {
  30. return CUnknown::NonDelegatingQueryInterface(riid, ppv);
  31. }
  32. }
  33. }
  34. CSeekingPassThru::CSeekingPassThru( TCHAR *pName, LPUNKNOWN pUnk, HRESULT *phr )
  35. : CUnknown(pName, pUnk, phr),
  36. m_pPosPassThru(NULL)
  37. {
  38. }
  39. CSeekingPassThru::~CSeekingPassThru()
  40. {
  41. delete m_pPosPassThru;
  42. }
  43. STDMETHODIMP CSeekingPassThru::Init(BOOL bRendererSeeking, IPin *pPin)
  44. {
  45. HRESULT hr = NOERROR;
  46. if (m_pPosPassThru) {
  47. hr = E_FAIL;
  48. } else {
  49. m_pPosPassThru =
  50. bRendererSeeking ?
  51. new CRendererPosPassThru(
  52. NAME("Render Seeking COM object"),
  53. (IUnknown *)this,
  54. &hr,
  55. pPin) :
  56. new CPosPassThru(
  57. NAME("Render Seeking COM object"),
  58. (IUnknown *)this,
  59. &hr,
  60. pPin);
  61. if (!m_pPosPassThru) {
  62. hr = E_OUTOFMEMORY;
  63. } else {
  64. if (FAILED(hr)) {
  65. delete m_pPosPassThru;
  66. m_pPosPassThru = NULL;
  67. }
  68. }
  69. }
  70. return hr;
  71. }