Mercurial > mplayer.hg
annotate loader/dshow/graph.c @ 35816:f2bb2d68fe52
Be less verbose on unkown FFmpeg pixel formats.
author | cehoyos |
---|---|
date | Tue, 05 Feb 2013 16:07:37 +0000 |
parents | 9f57c99fce86 |
children |
rev | line source |
---|---|
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
1 /* |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
2 * Implemention of FilterGraph. Based on allocator.c. |
30831 | 3 * Copyright 2010 Steinar H. Gunderson |
4 * | |
5 * This file is part of MPlayer. | |
6 * | |
7 * MPlayer is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * MPlayer is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License along | |
18 * with MPlayer; if not, write to the Free Software Foundation, Inc., | |
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
20 * |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
21 * Modified for use with MPlayer, detailed changelog at |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
22 * http://svn.mplayerhq.hu/mplayer/trunk/ |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
23 */ |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
24 |
30830 | 25 #include <stdio.h> |
26 #include <stdlib.h> | |
27 | |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
28 #include "config.h" |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
29 #include "loader/com.h" |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
30 #include "loader/dshow/graph.h" |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
31 #include "loader/wine/winerror.h" |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
32 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
33 // How many FilterGraph objects exist. |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
34 // Used for knowing when to register and unregister the class in COM. |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
35 static int GraphKeeper = 0; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
36 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
37 static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
38 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
39 IUnknown* p; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
40 int result; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
41 if (!ppv) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
42 return -1; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
43 *ppv = 0; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
44 if (memcmp(clsid, &CLSID_FilterGraph, sizeof(*clsid))) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
45 return -1; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
46 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
47 p = (IUnknown*) FilterGraphCreate(); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
48 result = p->vt->QueryInterface(p, iid, ppv); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
49 p->vt->Release(p); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
50 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
51 return result; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
52 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
53 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
54 static void FilterGraph_Destroy(FilterGraph* This) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
55 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
56 Debug printf("FilterGraph_Destroy(%p) called (%d, %d)\n", This, This->refcount, GraphKeeper); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
57 #ifdef WIN32_LOADER |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
58 if (--GraphKeeper == 0) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
59 UnregisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
60 #endif |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
61 free(This->vt); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
62 free(This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
63 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
64 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
65 HRESULT STDCALL FilterGraph_AddFilter(FilterGraph* This, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
66 IBaseFilter* pFilter, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
67 unsigned short* pName) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
68 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
69 Debug printf("FilterGraph_AddFilter(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
70 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
71 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
72 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
73 HRESULT STDCALL FilterGraph_RemoveFilter(FilterGraph* This, IBaseFilter* pFilter) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
74 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
75 Debug printf("FilterGraph_RemoveFilter(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
76 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
77 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
78 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
79 HRESULT STDCALL FilterGraph_EnumFilters(FilterGraph* This, IEnumFilters** ppEnum) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
80 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
81 Debug printf("FilterGraph_EnumFilters(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
82 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
83 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
84 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
85 HRESULT STDCALL FilterGraph_FindFilterByName(FilterGraph* This, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
86 unsigned short* pName, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
87 IBaseFilter** ppFilter) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
88 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
89 Debug printf("FilterGraph_FindFilterByName(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
90 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
91 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
92 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
93 HRESULT STDCALL FilterGraph_ConnectDirect(FilterGraph* This, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
94 IPin* ppinOut, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
95 IPin* ppinIn, |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
96 const AM_MEDIA_TYPE* pmt) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
97 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
98 Debug printf("FilterGraph_ConnectDirect(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
99 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
100 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
101 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
102 HRESULT STDCALL FilterGraph_Reconnect(FilterGraph* This, IPin* ppin) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
103 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
104 Debug printf("FilterGraph_Reconnect(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
105 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
106 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
107 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
108 HRESULT STDCALL FilterGraph_Disconnect(FilterGraph* This, IPin* ppin) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
109 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
110 Debug printf("FilterGraph_Disconnect(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
111 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
112 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
113 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
114 HRESULT STDCALL FilterGraph_SetDefaultSyncSource(FilterGraph* This) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
115 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
116 Debug printf("FilterGraph_SetDefaultSyncSource(%p) called\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
117 return E_NOTIMPL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
118 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
119 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
120 IMPLEMENT_IUNKNOWN(FilterGraph) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
121 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
122 FilterGraph* FilterGraphCreate() |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
123 { |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
124 FilterGraph* This = calloc(1, sizeof(*This)); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
125 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
126 if (!This) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
127 return NULL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
128 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
129 Debug printf("FilterGraphCreate() called -> %p\n", This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
130 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
131 This->refcount = 1; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
132 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
133 This->vt = calloc(1, sizeof(*This->vt)); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
134 |
30830 | 135 if (!This->vt) { |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
136 free(This); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
137 return NULL; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
138 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
139 |
30830 | 140 This->vt->QueryInterface = FilterGraph_QueryInterface; |
141 This->vt->AddRef = FilterGraph_AddRef; | |
142 This->vt->Release = FilterGraph_Release; | |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
143 |
30830 | 144 This->vt->AddFilter = FilterGraph_AddFilter; |
145 This->vt->RemoveFilter = FilterGraph_RemoveFilter; | |
146 This->vt->EnumFilters = FilterGraph_EnumFilters; | |
147 This->vt->FindFilterByName = FilterGraph_FindFilterByName; | |
148 This->vt->ConnectDirect = FilterGraph_ConnectDirect; | |
149 This->vt->Reconnect = FilterGraph_Reconnect; | |
150 This->vt->Disconnect = FilterGraph_Disconnect; | |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
151 This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
152 |
30830 | 153 This->interfaces[0] = IID_IUnknown; |
154 This->interfaces[1] = IID_IFilterGraph; | |
30828
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
155 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
156 #ifdef WIN32_LOADER |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
157 if (GraphKeeper++ == 0) |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
158 RegisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph); |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
159 #endif |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
160 |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
161 return This; |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
162 } |
5f145a3b3832
Commit files by Steinar Gunderson, forgotten in r30866.
cehoyos
parents:
diff
changeset
|
163 |