equal
deleted
inserted
replaced
41 |
41 |
42 template <typename T> ComPointer<T> getService(const Filter &filter, REFGUID guidService, REFIID riid) |
42 template <typename T> ComPointer<T> getService(const Filter &filter, REFGUID guidService, REFIID riid) |
43 { |
43 { |
44 //normally we should use IID_IMFGetService but this introduces another dependency |
44 //normally we should use IID_IMFGetService but this introduces another dependency |
45 //so here we simply define our own IId with the same value |
45 //so here we simply define our own IId with the same value |
|
46 ComPointer<T> ret; |
46 ComPointer<IMFGetService> getService(filter, IID_IMFGetService); |
47 ComPointer<IMFGetService> getService(filter, IID_IMFGetService); |
47 Q_ASSERT(getService); |
48 if (getService) { |
48 T *ptr = 0; |
49 getService->GetService(guidService, riid, reinterpret_cast<void**>(ret.pparam())); |
49 HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr)); |
50 } |
50 if (!SUCCEEDED(hr) || ptr == 0) |
51 return ret; |
51 Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); |
|
52 ComPointer<T> service(ptr); |
|
53 return service; |
|
54 } |
52 } |
55 |
53 |
56 VideoRendererEVR::~VideoRendererEVR() |
54 VideoRendererEVR::~VideoRendererEVR() |
57 { |
55 { |
58 } |
56 } |
68 if (!m_filter) { |
66 if (!m_filter) { |
69 return; |
67 return; |
70 } |
68 } |
71 |
69 |
72 ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); |
70 ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); |
|
71 if (!filterControl) { |
|
72 m_filter = Filter(); //will release the interface |
|
73 return; |
|
74 } |
73 |
75 |
74 filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); |
76 filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); |
75 filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size |
77 filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size |
76 } |
78 } |
77 |
79 |