OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/video/capture/win/pin_base_win.h" | 5 #include "media/video/capture/win/pin_base_win.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 return S_OK; | 86 return S_OK; |
87 } | 87 } |
88 | 88 |
89 STDMETHOD(Reset)() { | 89 STDMETHOD(Reset)() { |
90 index_ = 0; | 90 index_ = 0; |
91 return S_OK; | 91 return S_OK; |
92 } | 92 } |
93 | 93 |
94 STDMETHOD(Clone)(IEnumMediaTypes** clone) { | 94 STDMETHOD(Clone)(IEnumMediaTypes** clone) { |
95 TypeEnumerator* type_enum = new TypeEnumerator(pin_); | 95 TypeEnumerator* type_enum = new TypeEnumerator(pin_); |
96 if (!type_enum) | |
97 return E_OUTOFMEMORY; | |
98 type_enum->AddRef(); | 96 type_enum->AddRef(); |
99 type_enum->index_ = index_; | 97 type_enum->index_ = index_; |
100 *clone = type_enum; | 98 *clone = type_enum; |
101 return S_OK; | 99 return S_OK; |
102 } | 100 } |
103 | 101 |
104 private: | 102 private: |
105 void FreeAllocatedMediaTypes(ULONG allocated, AM_MEDIA_TYPE** types) { | 103 void FreeAllocatedMediaTypes(ULONG allocated, AM_MEDIA_TYPE** types) { |
106 for (ULONG i = 0; i < allocated; ++i) { | 104 for (ULONG i = 0; i < allocated; ++i) { |
107 CoTaskMemFree(types[i]->pbFormat); | 105 CoTaskMemFree(types[i]->pbFormat); |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 base::RefCounted<PinBase>::AddRef(); | 271 base::RefCounted<PinBase>::AddRef(); |
274 return 1; | 272 return 1; |
275 } | 273 } |
276 | 274 |
277 STDMETHODIMP_(ULONG) PinBase::Release() { | 275 STDMETHODIMP_(ULONG) PinBase::Release() { |
278 base::RefCounted<PinBase>::Release(); | 276 base::RefCounted<PinBase>::Release(); |
279 return 1; | 277 return 1; |
280 } | 278 } |
281 | 279 |
282 } // namespace media | 280 } // namespace media |
OLD | NEW |