wbemprox: Win32_NetworkAdapter.InterfaceIndex is unsigned.
[wine/multimedia.git] / dlls / wineqtdecoder / qtutils.c
blob19ba90c565f8e7914229f631a147196b12b310da
1 /*
2 * QuickTime Toolkit decoder utils
4 * Copyright 2011 Aric Stewart, CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "config.h"
23 #define ULONG CoreFoundation_ULONG
24 #define HRESULT CoreFoundation_HRESULT
26 #define LoadResource __carbon_LoadResource
27 #define CompareString __carbon_CompareString
28 #define GetCurrentThread __carbon_GetCurrentThread
29 #define GetCurrentProcess __carbon_GetCurrentProcess
30 #define AnimatePalette __carbon_AnimatePalette
31 #define EqualRgn __carbon_EqualRgn
32 #define FillRgn __carbon_FillRgn
33 #define FrameRgn __carbon_FrameRgn
34 #define GetPixel __carbon_GetPixel
35 #define InvertRgn __carbon_InvertRgn
36 #define LineTo __carbon_LineTo
37 #define OffsetRgn __carbon_OffsetRgn
38 #define PaintRgn __carbon_PaintRgn
39 #define Polygon __carbon_Polygon
40 #define ResizePalette __carbon_ResizePalette
41 #define SetRectRgn __carbon_SetRectRgn
43 #define CheckMenuItem __carbon_CheckMenuItem
44 #define DeleteMenu __carbon_DeleteMenu
45 #define DrawMenuBar __carbon_DrawMenuBar
46 #define EnableMenuItem __carbon_EnableMenuItem
47 #define EqualRect __carbon_EqualRect
48 #define FillRect __carbon_FillRect
49 #define FrameRect __carbon_FrameRect
50 #define GetCursor __carbon_GetCursor
51 #define GetMenu __carbon_GetMenu
52 #define InvertRect __carbon_InvertRect
53 #define IsWindowVisible __carbon_IsWindowVisible
54 #define MoveWindow __carbon_MoveWindow
55 #define OffsetRect __carbon_OffsetRect
56 #define PtInRect __carbon_PtInRect
57 #define SetCursor __carbon_SetCursor
58 #define SetRect __carbon_SetRect
59 #define ShowCursor __carbon_ShowCursor
60 #define ShowWindow __carbon_ShowWindow
61 #define UnionRect __carbon_UnionRect
63 #include <CoreVideo/CVPixelBuffer.h>
65 #undef LoadResource
66 #undef CompareString
67 #undef GetCurrentThread
68 #undef _CDECL
69 #undef DPRINTF
70 #undef GetCurrentProcess
71 #undef AnimatePalette
72 #undef EqualRgn
73 #undef FillRgn
74 #undef FrameRgn
75 #undef GetPixel
76 #undef InvertRgn
77 #undef LineTo
78 #undef OffsetRgn
79 #undef PaintRgn
80 #undef Polygon
81 #undef ResizePalette
82 #undef SetRectRgn
83 #undef CheckMenuItem
84 #undef DeleteMenu
85 #undef DrawMenuBar
86 #undef EnableMenuItem
87 #undef EqualRect
88 #undef FillRect
89 #undef FrameRect
90 #undef GetCursor
91 #undef GetMenu
92 #undef InvertRect
93 #undef IsWindowVisible
94 #undef MoveWindow
95 #undef OffsetRect
96 #undef PtInRect
97 #undef SetCursor
98 #undef SetRect
99 #undef ShowCursor
100 #undef ShowWindow
101 #undef UnionRect
103 #undef ULONG
104 #undef HRESULT
105 #undef DPRINTF
106 #undef STDMETHODCALLTYPE
108 #include "windef.h"
109 #include "winbase.h"
110 #include "wtypes.h"
111 #include "winuser.h"
112 #include "dshow.h"
114 #include "wine/debug.h"
115 #include "qtprivate.h"
117 WINE_DEFAULT_DEBUG_CHANNEL(qtdecoder);
119 typedef struct {
120 UInt8 a; /* Alpha Channel */
121 UInt8 r; /* red component */
122 UInt8 g; /* green component */
123 UInt8 b; /* blue component */
124 } ARGBPixelRecord, *ARGBPixelPtr, **ARGBPixelHdl;
126 HRESULT AccessPixelBufferPixels( CVPixelBufferRef pixelBuffer, LPBYTE pbDstStream)
128 LPBYTE pPixels = NULL;
129 size_t bytesPerRow = 0, height = 0, width = 0;
130 OSType actualType;
131 int i;
133 actualType = CVPixelBufferGetPixelFormatType(pixelBuffer);
134 if (k32ARGBPixelFormat != actualType)
136 ERR("Pixel Buffer is not desired Type\n");
137 return E_FAIL;
139 CVPixelBufferLockBaseAddress(pixelBuffer,0);
140 pPixels = (LPBYTE)CVPixelBufferGetBaseAddress(pixelBuffer);
141 bytesPerRow = CVPixelBufferGetBytesPerRow(pixelBuffer);
142 height = CVPixelBufferGetHeight(pixelBuffer);
143 width = CVPixelBufferGetWidth(pixelBuffer);
145 for (i = 1; i <= height; i++)
147 int j;
148 LPBYTE out = pbDstStream + ((height - i) * width * 3);
150 for (j = 0; j < width; j++)
152 *((DWORD*)out) = (((ARGBPixelPtr)pPixels)[j].r) << 16
153 | (((ARGBPixelPtr)pPixels)[j].g) << 8
154 | (((ARGBPixelPtr)pPixels)[j].b);
155 out+=3;
157 pPixels += bytesPerRow;
159 CVPixelBufferUnlockBaseAddress(pixelBuffer,0);
160 return S_OK;