1 #include "DMO_Filter.h"
3 #include "loader/wine/winerror.h"
4 #include "loader/wine/windef.h"
21 static HRESULT STDCALL
CMediaBuffer_SetLength(IMediaBuffer
* This
,
22 unsigned long cbLength
)
24 CMediaBuffer
* cmb
= (CMediaBuffer
*) This
;
25 Debug
printf("CMediaBuffer_SetLength(%p) called (%ld, %ld)\n", This
, cbLength
, cmb
->maxlen
);
26 if (cbLength
> cmb
->maxlen
)
32 static HRESULT STDCALL
CMediaBuffer_GetMaxLength(IMediaBuffer
* This
,
33 /* [out] */ unsigned long *pcbMaxLength
)
35 CMediaBuffer
* cmb
= (CMediaBuffer
*) This
;
36 Debug
printf("CMediaBuffer_GetMaxLength(%p) called -> %ld\n", This
, cmb
->maxlen
);
39 *pcbMaxLength
= cmb
->maxlen
;
43 static HRESULT STDCALL
CMediaBuffer_GetBufferAndLength(IMediaBuffer
* This
,
44 /* [out] */ char** ppBuffer
,
45 /* [out] */ unsigned long* pcbLength
)
47 CMediaBuffer
* cmb
= (CMediaBuffer
*) This
;
48 Debug
printf("CMediaBuffer_GetBufferAndLength(%p) called -> %p %ld\n", This
, cmb
->mem
, cmb
->len
);
49 if (!ppBuffer
&& !pcbLength
)
54 *pcbLength
= cmb
->len
;
58 static void CMediaBuffer_Destroy(CMediaBuffer
* This
)
60 Debug
printf("CMediaBuffer_Destroy(%p) called\n", This
);
67 IMPLEMENT_IUNKNOWN(CMediaBuffer
)
69 CMediaBuffer
* CMediaBufferCreate(unsigned long maxlen
, void* mem
,
70 unsigned long len
, int copy
)
72 CMediaBuffer
* This
= malloc(sizeof(CMediaBuffer
));
77 This
->vt
= malloc(sizeof(IMediaBuffer_vt
));
80 CMediaBuffer_Destroy(This
);
86 This
->maxlen
= maxlen
;
90 /* make a private copy of data */
92 if (This
->mem
== NULL
)
96 This
->mem
= malloc(This
->maxlen
);
99 CMediaBuffer_Destroy(This
);
104 memcpy(This
->mem
, mem
, This
->len
);
107 This
->vt
->QueryInterface
= CMediaBuffer_QueryInterface
;
108 This
->vt
->AddRef
= CMediaBuffer_AddRef
;
109 This
->vt
->Release
= CMediaBuffer_Release
;
111 This
->vt
->SetLength
= CMediaBuffer_SetLength
;
112 This
->vt
->GetMaxLength
= CMediaBuffer_GetMaxLength
;
113 This
->vt
->GetBufferAndLength
= CMediaBuffer_GetBufferAndLength
;
115 This
->interfaces
[0] = IID_IUnknown
;
116 This
->interfaces
[1] = IID_IMediaBuffer
;