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 namespace media {
11
12 // Define GUID for I420. This is the color format we would like to support but
13 // it is not defined in the DirectShow SDK.
14 // http://msdn.microsoft.com/en-us/library/dd757532.aspx
15 // 30323449-0000-0010-8000-00AA00389B71.
16 GUID kMediaSubTypeI420 = {
17 0x30323449, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71}
18 };
19
20 // UYVY synonym with BT709 color components, used in HD video. This variation
21 // might appear in non-USB capture cards and it's implemented as a normal YUV
22 // pixel format with the characters HDYC encoded in the first array word.
23 GUID kMediaSubTypeHDYC = {
24 0x43594448, 0x0000, 0x0010, { 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}
25 };
26
~SinkFilterObserver()27 SinkFilterObserver::~SinkFilterObserver() {}
28
SinkFilter(SinkFilterObserver * observer)29 SinkFilter::SinkFilter(SinkFilterObserver* observer)
30 : input_pin_(NULL) {
31 input_pin_ = new SinkInputPin(this, observer);
32 }
33
~SinkFilter()34 SinkFilter::~SinkFilter() {
35 input_pin_->SetOwner(NULL);
36 }
37
SetRequestedMediaFormat(const VideoCaptureFormat & format)38 void SinkFilter::SetRequestedMediaFormat(const VideoCaptureFormat& format) {
39 input_pin_->SetRequestedMediaFormat(format);
40 }
41
ResultingFormat()42 const VideoCaptureFormat& SinkFilter::ResultingFormat() {
43 return input_pin_->ResultingFormat();
44 }
45
NoOfPins()46 size_t SinkFilter::NoOfPins() {
47 return 1;
48 }
49
GetPin(int index)50 IPin* SinkFilter::GetPin(int index) {
51 return index == 0 ? input_pin_ : NULL;
52 }
53
GetClassID(CLSID * clsid)54 STDMETHODIMP SinkFilter::GetClassID(CLSID* clsid) {
55 *clsid = __uuidof(SinkFilter);
56 return S_OK;
57 }
58
59 } // namespace media
60