ReactOS 0.4.16-dev-300-g2aadf2e
dmort.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "objbase.h"
#include "mediaobj.h"
#include "dmort.h"
#include "wine/debug.h"
Include dependency graph for dmort.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (msdmo)
 
HRESULT WINAPI MoCreateMediaType (DMO_MEDIA_TYPE **ppmedia, DWORD cbFormat)
 
HRESULT WINAPI MoInitMediaType (DMO_MEDIA_TYPE *pmedia, DWORD cbFormat)
 
HRESULT WINAPI MoDeleteMediaType (DMO_MEDIA_TYPE *pmedia)
 
HRESULT WINAPI MoFreeMediaType (DMO_MEDIA_TYPE *pmedia)
 
HRESULT WINAPI MoDuplicateMediaType (DMO_MEDIA_TYPE **ppdst, const DMO_MEDIA_TYPE *psrc)
 
HRESULT WINAPI MoCopyMediaType (DMO_MEDIA_TYPE *pdst, const DMO_MEDIA_TYPE *psrc)
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 21 of file dmort.c.

Function Documentation

◆ MoCopyMediaType()

HRESULT WINAPI MoCopyMediaType ( DMO_MEDIA_TYPE pdst,
const DMO_MEDIA_TYPE psrc 
)

Definition at line 163 of file dmort.c.

165{
166 TRACE("%p %p\n", pdst, psrc);
167
168 if (!pdst || !psrc)
169 return E_POINTER;
170
171 pdst->majortype = psrc->majortype;
172 pdst->subtype = psrc->subtype;
173 pdst->formattype = psrc->formattype;
174
177 pdst->lSampleSize = psrc->lSampleSize;
178 pdst->cbFormat = psrc->cbFormat;
179
180 if (psrc->pbFormat && psrc->cbFormat > 0)
181 {
182 pdst->pbFormat = CoTaskMemAlloc(psrc->cbFormat);
183 if (!pdst->pbFormat)
184 return E_OUTOFMEMORY;
185
186 memcpy(pdst->pbFormat, psrc->pbFormat, psrc->cbFormat);
187 }
188 else
189 pdst->pbFormat = NULL;
190
191 if (psrc->pUnk)
192 {
193 pdst->pUnk = psrc->pUnk;
194 IUnknown_AddRef(pdst->pUnk);
195 }
196 else
197 pdst->pUnk = NULL;
198
199 return S_OK;
200}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define NULL
Definition: types.h:112
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426
#define S_OK
Definition: intsafe.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define TRACE(s)
Definition: solgame.cpp:4
GUID majortype
Definition: mediaobj.idl:36
IUnknown * pUnk
Definition: mediaobj.idl:42
ULONG lSampleSize
Definition: mediaobj.idl:40
ULONG cbFormat
Definition: mediaobj.idl:43
BOOL bFixedSizeSamples
Definition: mediaobj.idl:38
BYTE * pbFormat
Definition: mediaobj.idl:44
BOOL bTemporalCompression
Definition: mediaobj.idl:39
GUID formattype
Definition: mediaobj.idl:41
#define E_POINTER
Definition: winerror.h:2365

Referenced by MoDuplicateMediaType().

◆ MoCreateMediaType()

HRESULT WINAPI MoCreateMediaType ( DMO_MEDIA_TYPE **  ppmedia,
DWORD  cbFormat 
)

Definition at line 38 of file dmort.c.

39{
40 HRESULT r;
41
42 TRACE("%p %u\n", ppmedia, cbFormat);
43
44 if (!ppmedia)
45 return E_POINTER;
46
47 *ppmedia = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
48 if (!*ppmedia)
49 return E_OUTOFMEMORY;
50
51 r = MoInitMediaType(*ppmedia, cbFormat);
52 if (FAILED(r))
53 {
54 CoTaskMemFree(*ppmedia);
55 *ppmedia = NULL;
56 }
57
58 return r;
59}
HRESULT WINAPI MoInitMediaType(DMO_MEDIA_TYPE *pmedia, DWORD cbFormat)
Definition: dmort.c:66
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
#define FAILED(hr)
Definition: intsafe.h:51

◆ MoDeleteMediaType()

HRESULT WINAPI MoDeleteMediaType ( DMO_MEDIA_TYPE pmedia)

Definition at line 92 of file dmort.c.

93{
94 TRACE("%p\n", pmedia);
95
96 if (!pmedia)
97 return E_POINTER;
98
99 MoFreeMediaType(pmedia);
100 CoTaskMemFree(pmedia);
101
102 return S_OK;
103}
HRESULT WINAPI MoFreeMediaType(DMO_MEDIA_TYPE *pmedia)
Definition: dmort.c:110

◆ MoDuplicateMediaType()

HRESULT WINAPI MoDuplicateMediaType ( DMO_MEDIA_TYPE **  ppdst,
const DMO_MEDIA_TYPE psrc 
)

Definition at line 134 of file dmort.c.

136{
137 HRESULT r;
138
139 TRACE("%p %p\n", ppdst, psrc);
140
141 if (!ppdst || !psrc)
142 return E_POINTER;
143
144 *ppdst = CoTaskMemAlloc(sizeof(DMO_MEDIA_TYPE));
145 if (!*ppdst)
146 return E_OUTOFMEMORY;
147
148 r = MoCopyMediaType(*ppdst, psrc);
149 if (FAILED(r))
150 {
151 MoFreeMediaType(*ppdst);
152 *ppdst = NULL;
153 }
154
155 return r;
156}
HRESULT WINAPI MoCopyMediaType(DMO_MEDIA_TYPE *pdst, const DMO_MEDIA_TYPE *psrc)
Definition: dmort.c:163

◆ MoFreeMediaType()

HRESULT WINAPI MoFreeMediaType ( DMO_MEDIA_TYPE pmedia)

Definition at line 110 of file dmort.c.

111{
112 TRACE("%p\n", pmedia);
113
114 if (!pmedia)
115 return E_POINTER;
116
117 if (pmedia->pUnk)
118 {
119 IUnknown_Release(pmedia->pUnk);
120 pmedia->pUnk = NULL;
121 }
122
123 CoTaskMemFree(pmedia->pbFormat);
124 pmedia->pbFormat = NULL;
125
126 return S_OK;
127}

Referenced by MoDeleteMediaType(), and MoDuplicateMediaType().

◆ MoInitMediaType()

HRESULT WINAPI MoInitMediaType ( DMO_MEDIA_TYPE pmedia,
DWORD  cbFormat 
)

Definition at line 66 of file dmort.c.

67{
68 TRACE("%p %u\n", pmedia, cbFormat);
69
70 if (!pmedia)
71 return E_POINTER;
72
73 memset(pmedia, 0, sizeof(DMO_MEDIA_TYPE));
74
75 if (cbFormat > 0)
76 {
77 pmedia->pbFormat = CoTaskMemAlloc(cbFormat);
78 if (!pmedia->pbFormat)
79 return E_OUTOFMEMORY;
80
81 pmedia->cbFormat = cbFormat;
82 }
83
84 return S_OK;
85}
#define memset(x, y, z)
Definition: compat.h:39

Referenced by MoCreateMediaType().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( msdmo  )