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
3 // found in the LICENSE file.
4
5 #include "media/video/capture/win/sink_filter_win.h"
6
7 #include "base/logging.h"
8 #include "media/video/capture/win/sink_input_pin_win.h"
9
10 // Define GUID for I420. This is the color format we would like to support but
11 // it is not defined in the DirectShow SDK.
12 // http://msdn.microsoft.com/en-us/library/dd757532.aspx
13 // 30323449-0000-0010-8000-00AA00389B71.
14 GUID kMediaSubTypeI420 = {
15 0x30323449, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}
16 };
17
18 namespace media {
19
~SinkFilterObserver()20 SinkFilterObserver::~SinkFilterObserver() {}
21
SinkFilter(SinkFilterObserver * observer)22 SinkFilter::SinkFilter(SinkFilterObserver* observer)
23 : input_pin_(NULL) {
24 input_pin_ = new SinkInputPin(this, observer);
25 }
26
~SinkFilter()27 SinkFilter::~SinkFilter() {
28 input_pin_->SetOwner(NULL);
29 }
30
SetRequestedMediaFormat(const VideoCaptureFormat & format)31 void SinkFilter::SetRequestedMediaFormat(const VideoCaptureFormat& format) {
32 input_pin_->SetRequestedMediaFormat(format);
33 }
34
ResultingFormat()35 const VideoCaptureFormat& SinkFilter::ResultingFormat() {
36 return input_pin_->ResultingFormat();
37 }
38
NoOfPins()39 size_t SinkFilter::NoOfPins() {
40 return 1;
41 }
42
GetPin(int index)43 IPin* SinkFilter::GetPin(int index) {
44 return index == 0 ? input_pin_ : NULL;
45 }
46
GetClassID(CLSID * clsid)47 STDMETHODIMP SinkFilter::GetClassID(CLSID* clsid) {
48 *clsid = __uuidof(SinkFilter);
49 return S_OK;
50 }
51
52 } // namespace media
53