Fix YUY2 output issue, see Issue 18.
[xy_vsfilter.git] / src / dsutil / NullRenderers.cpp
blobf924384014c0b2cd432e52dad5e133726d0f3d4d
1 /*
2 * Copyright (C) 2003-2006 Gabest
3 * http://www.gabest.org
5 * This Program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2, or (at your option)
8 * any later version.
9 *
10 * This Program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with GNU Make; see the file COPYING. If not, write to
17 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
18 * http://www.gnu.org/copyleft/gpl.html
22 #include "StdAfx.h"
23 #include "NullRenderers.h"
24 #include "..\..\include\moreuuids.h"
27 // CNullRenderer
30 CNullRenderer::CNullRenderer(REFCLSID clsid, TCHAR* pName, LPUNKNOWN pUnk, HRESULT* phr)
31 : CBaseRenderer(clsid, pName, pUnk, phr)
36 // CNullVideoRenderer
39 CNullVideoRenderer::CNullVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr)
40 : CNullRenderer(__uuidof(this), NAME("Null Video Renderer"), pUnk, phr)
44 HRESULT CNullVideoRenderer::CheckMediaType(const CMediaType* pmt)
46 return pmt->majortype == MEDIATYPE_Video
47 || pmt->subtype == MEDIASUBTYPE_MPEG2_VIDEO
48 ? S_OK
49 : E_FAIL;
53 // CNullUVideoRenderer
56 CNullUVideoRenderer::CNullUVideoRenderer(LPUNKNOWN pUnk, HRESULT* phr)
57 : CNullRenderer(__uuidof(this), NAME("Null Video Renderer (Uncompressed)"), pUnk, phr)
61 HRESULT CNullUVideoRenderer::CheckMediaType(const CMediaType* pmt)
63 return pmt->majortype == MEDIATYPE_Video
64 && (pmt->subtype == MEDIASUBTYPE_YV12
65 || pmt->subtype == MEDIASUBTYPE_I420
66 || pmt->subtype == MEDIASUBTYPE_YUYV
67 || pmt->subtype == MEDIASUBTYPE_IYUV
68 || pmt->subtype == MEDIASUBTYPE_YVU9
69 || pmt->subtype == MEDIASUBTYPE_Y411
70 || pmt->subtype == MEDIASUBTYPE_Y41P
71 || pmt->subtype == MEDIASUBTYPE_YUY2
72 || pmt->subtype == MEDIASUBTYPE_YVYU
73 || pmt->subtype == MEDIASUBTYPE_UYVY
74 || pmt->subtype == MEDIASUBTYPE_Y211
75 || pmt->subtype == MEDIASUBTYPE_RGB1
76 || pmt->subtype == MEDIASUBTYPE_RGB4
77 || pmt->subtype == MEDIASUBTYPE_RGB8
78 || pmt->subtype == MEDIASUBTYPE_RGB565
79 || pmt->subtype == MEDIASUBTYPE_RGB555
80 || pmt->subtype == MEDIASUBTYPE_RGB24
81 || pmt->subtype == MEDIASUBTYPE_RGB32
82 || pmt->subtype == MEDIASUBTYPE_ARGB1555
83 || pmt->subtype == MEDIASUBTYPE_ARGB4444
84 || pmt->subtype == MEDIASUBTYPE_ARGB32
85 || pmt->subtype == MEDIASUBTYPE_A2R10G10B10
86 || pmt->subtype == MEDIASUBTYPE_A2B10G10R10)
87 ? S_OK
88 : E_FAIL;
92 // CNullAudioRenderer
95 CNullAudioRenderer::CNullAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr)
96 : CNullRenderer(__uuidof(this), NAME("Null Audio Renderer"), pUnk, phr)
100 HRESULT CNullAudioRenderer::CheckMediaType(const CMediaType* pmt)
102 return pmt->majortype == MEDIATYPE_Audio
103 || pmt->majortype == MEDIATYPE_Midi
104 || pmt->subtype == MEDIASUBTYPE_MPEG2_AUDIO
105 || pmt->subtype == MEDIASUBTYPE_DOLBY_AC3
106 || pmt->subtype == MEDIASUBTYPE_DVD_LPCM_AUDIO
107 || pmt->subtype == MEDIASUBTYPE_DTS
108 || pmt->subtype == MEDIASUBTYPE_SDDS
109 || pmt->subtype == MEDIASUBTYPE_MPEG1AudioPayload
110 || pmt->subtype == MEDIASUBTYPE_MPEG1Audio
111 || pmt->subtype == MEDIASUBTYPE_MPEG1Audio
112 ? S_OK
113 : E_FAIL;
117 // CNullUAudioRenderer
120 CNullUAudioRenderer::CNullUAudioRenderer(LPUNKNOWN pUnk, HRESULT* phr)
121 : CNullRenderer(__uuidof(this), NAME("Null Audio Renderer (Uncompressed)"), pUnk, phr)
125 HRESULT CNullUAudioRenderer::CheckMediaType(const CMediaType* pmt)
127 return pmt->majortype == MEDIATYPE_Audio
128 && (pmt->subtype == MEDIASUBTYPE_PCM
129 || pmt->subtype == MEDIASUBTYPE_IEEE_FLOAT
130 || pmt->subtype == MEDIASUBTYPE_DRM_Audio
131 || pmt->subtype == MEDIASUBTYPE_DOLBY_AC3_SPDIF
132 || pmt->subtype == MEDIASUBTYPE_RAW_SPORT
133 || pmt->subtype == MEDIASUBTYPE_SPDIF_TAG_241h)
134 ? S_OK
135 : E_FAIL;
139 // CNullTextRenderer
142 HRESULT CNullTextRenderer::CTextInputPin::CheckMediaType(const CMediaType* pmt)
144 return pmt->majortype == MEDIATYPE_Text
145 || pmt->majortype == MEDIATYPE_ScriptCommand
146 || pmt->majortype == MEDIATYPE_Subtitle
147 || pmt->subtype == MEDIASUBTYPE_DVD_SUBPICTURE
148 || pmt->subtype == MEDIASUBTYPE_CVD_SUBPICTURE
149 || pmt->subtype == MEDIASUBTYPE_SVCD_SUBPICTURE
150 ? S_OK
151 : E_FAIL;
154 CNullTextRenderer::CNullTextRenderer(LPUNKNOWN pUnk, HRESULT* phr)
155 : CBaseFilter(NAME("CNullTextRenderer"), pUnk, this, __uuidof(this), phr)
157 m_pInput.Attach(new CTextInputPin(this, this, phr));