annotate loader/dshow/cmediasample.c @ 594:dc093ff7b86e

Encrypted DVD playback works again ;-)
author lgb
date Mon, 23 Apr 2001 17:30:01 +0000
parents a4d3c83eeb52
children 9355b2ae634e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
1 #include <stdio.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
2 #include <string.h>
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
3 #include "cmediasample.h"
170
a4d3c83eeb52 small cosmetic to avoid gcc warnings
arpi_esp
parents: 168
diff changeset
4 //#define E_NOTIMPL 0x80004003
168
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
5 CMediaSample::CMediaSample(IMemAllocator* allocator, long _size):refcount(0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
6 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
7 vt=new IMediaSample_vt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
8
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
9 vt->QueryInterface=QueryInterface;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
10 vt->AddRef=AddRef;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
11 vt->Release=Release;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
12 vt->GetPointer=GetPointer ;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
13 vt->GetSize=GetSize ;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
14 vt->GetTime=GetTime ;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
15 vt->SetTime=SetTime ;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
16 vt->IsSyncPoint=IsSyncPoint ;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
17 vt->SetSyncPoint=SetSyncPoint;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
18 vt->IsPreroll=IsPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
19 vt->SetPreroll=SetPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
20 vt->GetActualDataLength=GetActualDataLength;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
21 vt->SetActualDataLength=SetActualDataLength;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
22 vt->GetMediaType=GetMediaType;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
23 vt->SetMediaType=SetMediaType;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
24 vt->IsDiscontinuity=IsDiscontinuity;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
25 vt->SetDiscontinuity=SetDiscontinuity;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
26 vt->GetMediaTime=GetMediaTime;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
27 vt->SetMediaTime=SetMediaTime;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
28
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
29 all=allocator;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
30 size=_size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
31 actual_size=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
32 media_type.pbFormat=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
33 isPreroll=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
34 type_valid=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
35 block=new char[size];
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
36 Debug printf("%x: Creating media sample with size %d, buffer 0x%x\n", this, _size, block);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
37 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
38 CMediaSample::~CMediaSample()
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
39 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
40 Debug printf("%x: CMediaSample::~CMediaSample() called\n", this);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
41 delete vt;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
42 delete[] block;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
43 if(media_type.pbFormat)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
44 CoTaskMemFree(media_type.pbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
45 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
46
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
47 long STDCALL CMediaSample::QueryInterface (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
48 IUnknown * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
49 /* [in] */ IID* iid,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
50 /* [iid_is][out] */ void **ppv)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
51 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
52 Debug printf("CMediaSample::QueryInterface() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
53 if(!ppv)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
54 if(!memcmp(iid, &IID_IUnknown, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
55 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
56 *ppv=(void*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
57 This->vt->AddRef(This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
58 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
59 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
60 if(!memcmp(iid, &IID_IMediaSample, 16))
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
61 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
62 *ppv=(void*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
63 This->vt->AddRef(This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
64 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
65 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
66 return 0x80004002;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
67 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
68
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
69 long STDCALL CMediaSample::AddRef (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
70 IUnknown * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
71 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
72 Debug printf("CMediaSample::AddRef() called\n");
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
73 ((CMediaSample*)This)->refcount++;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
74 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
75 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
76
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
77 long STDCALL CMediaSample::Release (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
78 IUnknown * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
79 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
80 Debug printf("%x: CMediaSample::Release() called, new refcount %d\n", This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
81 ((CMediaSample*)This)->refcount-1);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
82 CMediaSample* parent=(CMediaSample*)This;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
83 if(--((CMediaSample*)This)->refcount==0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
84 parent->
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
85 all->
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
86 vt->
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
87 ReleaseBuffer(
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
88 (IMemAllocator*)(parent->all),
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
89 (IMediaSample*)This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
90 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
91 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
92 HRESULT STDCALL CMediaSample::GetPointer (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
93 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
94 /* [out] */ BYTE **ppBuffer)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
95 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
96 Debug printf("%x: CMediaSample::GetPointer() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
97 if(!ppBuffer)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
98 *ppBuffer=(BYTE *)((CMediaSample*)This)->block;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
99 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
100 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
101
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
102 long STDCALL CMediaSample::GetSize (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
103 IMediaSample * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
104 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
105 Debug printf("%x: CMediaSample::GetSize() called -> %d\n", This, ((CMediaSample*)This)->size);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
106 return ((CMediaSample*)This)->size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
107 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
108
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
109 HRESULT STDCALL CMediaSample::GetTime (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
110 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
111 /* [out] */ REFERENCE_TIME *pTimeStart,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
112 /* [out] */ REFERENCE_TIME *pTimeEnd)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
113 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
114 Debug printf("%x: CMediaSample::GetTime() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
115 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
116 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
117
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
118 HRESULT STDCALL CMediaSample::SetTime (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
119 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
120 /* [in] */ REFERENCE_TIME *pTimeStart,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
121 /* [in] */ REFERENCE_TIME *pTimeEnd)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
122 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
123 Debug printf("%x: CMediaSample::SetTime() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
124 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
125 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
126
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
127 HRESULT STDCALL CMediaSample::IsSyncPoint (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
128 IMediaSample * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
129 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
130 Debug printf("%x: CMediaSample::IsSyncPoint() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
131 if(((CMediaSample*)This)->isSyncPoint)return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
132 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
133 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
134
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
135 HRESULT STDCALL CMediaSample::SetSyncPoint (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
136 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
137 long bIsSyncPoint)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
138 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
139 Debug printf("%x: CMediaSample::SetSyncPoint() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
140 ((CMediaSample*)This)->isSyncPoint=bIsSyncPoint;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
141 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
142 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
143
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
144 HRESULT STDCALL CMediaSample::IsPreroll (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
145 IMediaSample * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
146 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
147 Debug printf("%x: CMediaSample::IsPreroll() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
148 if(((CMediaSample*)This)->isPreroll==0)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
149 return 1;//S_FALSE
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
150 else
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
151 return 0;//S_OK
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
152 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
153
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
154 HRESULT STDCALL CMediaSample::SetPreroll (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
155 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
156 long bIsPreroll)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
157 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
158 Debug printf("%x: CMediaSample::SetPreroll() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
159 ((CMediaSample*)This)->isPreroll=bIsPreroll;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
160 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
161 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
162
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
163 long STDCALL CMediaSample::GetActualDataLength (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
164 IMediaSample * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
165 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
166 Debug printf("%x: CMediaSample::GetActualDataLength() called -> %d\n", This, ((CMediaSample*)This)->actual_size);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
167 return ((CMediaSample*)This)->actual_size;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
168 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
169
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
170 HRESULT STDCALL CMediaSample::SetActualDataLength (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
171 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
172 long __MIDL_0010)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
173 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
174 Debug printf("%x: CMediaSample::SetActualDataLength(%d) called\n", This, __MIDL_0010);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
175 if(__MIDL_0010>((CMediaSample*)This)->size)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
176 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
177 printf("%x: ERROR: CMediaSample buffer overflow\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
178 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
179 ((CMediaSample*)This)->actual_size=__MIDL_0010;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
180 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
181 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
182
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
183 HRESULT STDCALL CMediaSample::GetMediaType (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
184 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
185 AM_MEDIA_TYPE **ppMediaType)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
186 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
187 Debug printf("%x: CMediaSample::GetMediaType() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
188 if(!ppMediaType)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
189 return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
190 if(!((CMediaSample*)This)->type_valid)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
191 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
192 *ppMediaType=0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
193 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
194 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
195 AM_MEDIA_TYPE& t=((CMediaSample*)This)->media_type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
196 // if(t.pbFormat)CoTaskMemFree(t.pbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
197 (*ppMediaType)=(AM_MEDIA_TYPE*)CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
198 memcpy(*ppMediaType, &t, sizeof(AM_MEDIA_TYPE));
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
199 (*ppMediaType)->pbFormat=(char*)CoTaskMemAlloc(t.cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
200 memcpy((*ppMediaType)->pbFormat, t.pbFormat, t.cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
201 // *ppMediaType=0; //media type was not changed
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
202 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
203 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
204
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
205 HRESULT STDCALL CMediaSample::SetMediaType (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
206 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
207 AM_MEDIA_TYPE *pMediaType)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
208 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
209 Debug printf("%x: CMediaSample::SetMediaType() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
210 if(!pMediaType)return 0x80004003;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
211 AM_MEDIA_TYPE& t=((CMediaSample*)This)->media_type;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
212 if(t.pbFormat)CoTaskMemFree(t.pbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
213 t=*pMediaType;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
214 t.pbFormat=(char*)CoTaskMemAlloc(t.cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
215 memcpy(t.pbFormat, pMediaType->pbFormat, t.cbFormat);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
216 ((CMediaSample*)This)->type_valid=1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
217 return 0;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
218 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
219
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
220 HRESULT STDCALL CMediaSample::IsDiscontinuity (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
221 IMediaSample * This)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
222 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
223 Debug printf("%x: CMediaSample::IsDiscontinuity() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
224 return 1;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
225 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
226
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
227 HRESULT STDCALL CMediaSample::SetDiscontinuity (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
228 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
229 long bDiscontinuity)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
230 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
231 Debug printf("%x: CMediaSample::SetDiscontinuity() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
232 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
233 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
234
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
235 HRESULT STDCALL CMediaSample::GetMediaTime (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
236 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
237 /* [out] */ LONGLONG *pTimeStart,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
238 /* [out] */ LONGLONG *pTimeEnd)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
239 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
240 Debug printf("%x: CMediaSample::GetMediaTime() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
241 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
242 }
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
243
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
244 HRESULT STDCALL CMediaSample::SetMediaTime (
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
245 IMediaSample * This,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
246 /* [in] */ LONGLONG *pTimeStart,
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
247 /* [in] */ LONGLONG *pTimeEnd)
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
248 {
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
249 Debug printf("%x: CMediaSample::SetMediaTime() called\n", This);
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
250 return E_NOTIMPL;
bdc4a8fc04d8 Initial revision
arpi_esp
parents:
diff changeset
251 }