mirror of
https://github.com/reactos/reactos.git
synced 2024-08-02 17:40:58 +00:00
[QEDIT]
sync qedit with wine 1.1.41 svn path=/trunk/; revision=46312
This commit is contained in:
parent
f8e7a6dbaf
commit
b0d8fe0832
|
@ -37,7 +37,7 @@ static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
|
||||||
static WCHAR const pin_out_name[] = { 'O', 'u', 't', 0 };
|
static WCHAR const pin_out_name[] = { 'O', 'u', 't', 0 };
|
||||||
|
|
||||||
IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
|
IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount);
|
||||||
IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype);
|
IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype);
|
||||||
|
|
||||||
/* Fixed pins enumerator, holds filter referenced */
|
/* Fixed pins enumerator, holds filter referenced */
|
||||||
typedef struct _PE_Impl {
|
typedef struct _PE_Impl {
|
||||||
|
@ -258,7 +258,7 @@ Single_IEnumMediaTypes_Next(IEnumMediaTypes *iface, ULONG nTypes, AM_MEDIA_TYPE
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
if (!types || ((nTypes != 1) && !fetched))
|
if (!types || ((nTypes != 1) && !fetched))
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
if (!This->past) {
|
if (!This->past && !IsEqualGUID(&This->mtype.majortype,&GUID_NULL)) {
|
||||||
AM_MEDIA_TYPE *mtype = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
AM_MEDIA_TYPE *mtype = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
|
||||||
*mtype = This->mtype;
|
*mtype = This->mtype;
|
||||||
if (mtype->cbFormat) {
|
if (mtype->cbFormat) {
|
||||||
|
@ -324,7 +324,7 @@ static const IEnumMediaTypesVtbl IEnumMediaTypes_VTable =
|
||||||
Single_IEnumMediaTypes_Clone,
|
Single_IEnumMediaTypes_Clone,
|
||||||
};
|
};
|
||||||
|
|
||||||
IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
|
IEnumMediaTypes *mediaenum_create(const AM_MEDIA_TYPE *mtype)
|
||||||
{
|
{
|
||||||
ME_Impl *obj = CoTaskMemAlloc(sizeof(ME_Impl));
|
ME_Impl *obj = CoTaskMemAlloc(sizeof(ME_Impl));
|
||||||
if (obj) {
|
if (obj) {
|
||||||
|
@ -332,14 +332,18 @@ IEnumMediaTypes *mediaenum_create(AM_MEDIA_TYPE *mtype)
|
||||||
obj->me.lpVtbl = &IEnumMediaTypes_VTable;
|
obj->me.lpVtbl = &IEnumMediaTypes_VTable;
|
||||||
obj->refCount = 1;
|
obj->refCount = 1;
|
||||||
obj->past = FALSE;
|
obj->past = FALSE;
|
||||||
obj->mtype = *mtype;
|
if (mtype) {
|
||||||
obj->mtype.pUnk = NULL;
|
obj->mtype = *mtype;
|
||||||
if (mtype->cbFormat) {
|
obj->mtype.pUnk = NULL;
|
||||||
obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
|
if (mtype->cbFormat) {
|
||||||
CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
|
obj->mtype.pbFormat = CoTaskMemAlloc(mtype->cbFormat);
|
||||||
|
CopyMemory(obj->mtype.pbFormat, mtype->pbFormat, mtype->cbFormat);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
obj->mtype.pbFormat = NULL;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
obj->mtype.pbFormat = NULL;
|
obj->mtype.majortype = GUID_NULL;
|
||||||
}
|
}
|
||||||
return &obj->me;
|
return &obj->me;
|
||||||
}
|
}
|
||||||
|
@ -361,6 +365,7 @@ typedef struct _SG_Impl {
|
||||||
const IMemInputPinVtbl* IMemInputPin_Vtbl;
|
const IMemInputPinVtbl* IMemInputPin_Vtbl;
|
||||||
/* TODO: IMediaPosition, IMediaSeeking, IQualityControl */
|
/* TODO: IMediaPosition, IMediaSeeking, IQualityControl */
|
||||||
LONG refCount;
|
LONG refCount;
|
||||||
|
CRITICAL_SECTION critSect;
|
||||||
FILTER_INFO info;
|
FILTER_INFO info;
|
||||||
FILTER_STATE state;
|
FILTER_STATE state;
|
||||||
AM_MEDIA_TYPE mtype;
|
AM_MEDIA_TYPE mtype;
|
||||||
|
@ -372,6 +377,8 @@ typedef struct _SG_Impl {
|
||||||
ISampleGrabberCB *grabberIface;
|
ISampleGrabberCB *grabberIface;
|
||||||
LONG grabberMethod;
|
LONG grabberMethod;
|
||||||
LONG oneShot;
|
LONG oneShot;
|
||||||
|
LONG bufferLen;
|
||||||
|
void* bufferData;
|
||||||
} SG_Impl;
|
} SG_Impl;
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -413,6 +420,10 @@ static void SampleGrabber_cleanup(SG_Impl *This)
|
||||||
ISampleGrabberCB_Release(This->grabberIface);
|
ISampleGrabberCB_Release(This->grabberIface);
|
||||||
if (This->mtype.pbFormat)
|
if (This->mtype.pbFormat)
|
||||||
CoTaskMemFree(This->mtype.pbFormat);
|
CoTaskMemFree(This->mtype.pbFormat);
|
||||||
|
if (This->bufferData)
|
||||||
|
CoTaskMemFree(This->bufferData);
|
||||||
|
This->critSect.DebugInfo->Spare[0] = 0;
|
||||||
|
DeleteCriticalSection(&This->critSect);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Common helper AddRef called from all interfaces */
|
/* Common helper AddRef called from all interfaces */
|
||||||
|
@ -471,11 +482,31 @@ static HRESULT SampleGrabber_query(SG_Impl *This, REFIID riid, void **ppvObject)
|
||||||
return E_NOINTERFACE;
|
return E_NOINTERFACE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper that calls installed sample callbacks */
|
/* Helper that buffers data and/or calls installed sample callbacks */
|
||||||
static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
|
static void SampleGrabber_callback(SG_Impl *This, IMediaSample *sample)
|
||||||
{
|
{
|
||||||
double time = 0.0;
|
double time = 0.0;
|
||||||
REFERENCE_TIME tStart, tEnd;
|
REFERENCE_TIME tStart, tEnd;
|
||||||
|
if (This->bufferLen >= 0) {
|
||||||
|
BYTE *data = 0;
|
||||||
|
long size = IMediaSample_GetActualDataLength(sample);
|
||||||
|
if (size >= 0 && SUCCEEDED(IMediaSample_GetPointer(sample, &data))) {
|
||||||
|
if (!data)
|
||||||
|
size = 0;
|
||||||
|
EnterCriticalSection(&This->critSect);
|
||||||
|
if (This->bufferLen != size) {
|
||||||
|
if (This->bufferData)
|
||||||
|
CoTaskMemFree(This->bufferData);
|
||||||
|
This->bufferData = size ? CoTaskMemAlloc(size) : NULL;
|
||||||
|
This->bufferLen = size;
|
||||||
|
}
|
||||||
|
if (size)
|
||||||
|
CopyMemory(This->bufferData, data, size);
|
||||||
|
LeaveCriticalSection(&This->critSect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!This->grabberIface)
|
||||||
|
return;
|
||||||
if (SUCCEEDED(IMediaSample_GetTime(sample, &tStart, &tEnd)))
|
if (SUCCEEDED(IMediaSample_GetTime(sample, &tStart, &tEnd)))
|
||||||
time = 1e-7 * tStart;
|
time = 1e-7 * tStart;
|
||||||
switch (This->grabberMethod) {
|
switch (This->grabberMethod) {
|
||||||
|
@ -777,11 +808,16 @@ SampleGrabber_ISampleGrabber_GetConnectedMediaType(ISampleGrabber *iface, AM_MED
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL bufferEm)
|
SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL bufferEm)
|
||||||
{
|
{
|
||||||
TRACE("(%u)\n", bufferEm);
|
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||||
|
TRACE("(%p)->(%u)\n", This, bufferEm);
|
||||||
|
EnterCriticalSection(&This->critSect);
|
||||||
if (bufferEm) {
|
if (bufferEm) {
|
||||||
FIXME("buffering not implemented\n");
|
if (This->bufferLen < 0)
|
||||||
return E_NOTIMPL;
|
This->bufferLen = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
This->bufferLen = -1;
|
||||||
|
LeaveCriticalSection(&This->critSect);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -789,10 +825,29 @@ SampleGrabber_ISampleGrabber_SetBufferSamples(ISampleGrabber *iface, BOOL buffer
|
||||||
static HRESULT WINAPI
|
static HRESULT WINAPI
|
||||||
SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSize, LONG *buffer)
|
SampleGrabber_ISampleGrabber_GetCurrentBuffer(ISampleGrabber *iface, LONG *bufSize, LONG *buffer)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %p): stub\n", bufSize, buffer);
|
SG_Impl *This = impl_from_ISampleGrabber(iface);
|
||||||
|
HRESULT ret = S_OK;
|
||||||
|
TRACE("(%p)->(%p, %p)\n", This, bufSize, buffer);
|
||||||
if (!bufSize)
|
if (!bufSize)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
return E_INVALIDARG;
|
EnterCriticalSection(&This->critSect);
|
||||||
|
if (!This->pin_in.pair)
|
||||||
|
ret = VFW_E_NOT_CONNECTED;
|
||||||
|
else if (This->bufferLen < 0)
|
||||||
|
ret = E_INVALIDARG;
|
||||||
|
else if (This->bufferLen == 0)
|
||||||
|
ret = VFW_E_WRONG_STATE;
|
||||||
|
else {
|
||||||
|
if (buffer) {
|
||||||
|
if (*bufSize >= This->bufferLen)
|
||||||
|
CopyMemory(buffer, This->bufferData, This->bufferLen);
|
||||||
|
else
|
||||||
|
ret = E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
*bufSize = This->bufferLen;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&This->critSect);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ISampleGrabber */
|
/* ISampleGrabber */
|
||||||
|
@ -896,8 +951,7 @@ SampleGrabber_IMemInputPin_Receive(IMemInputPin *iface, IMediaSample *sample)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
if (This->grabberIface)
|
SampleGrabber_callback(This, sample);
|
||||||
SampleGrabber_callback(This, sample);
|
|
||||||
hr = This->memOutput ? IMemInputPin_Receive(This->memOutput, sample) : S_OK;
|
hr = This->memOutput ? IMemInputPin_Receive(This->memOutput, sample) : S_OK;
|
||||||
if (This->oneShot == OneShot_Wait) {
|
if (This->oneShot == OneShot_Wait) {
|
||||||
This->oneShot = OneShot_Past;
|
This->oneShot = OneShot_Past;
|
||||||
|
@ -913,16 +967,14 @@ static HRESULT WINAPI
|
||||||
SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **samples, LONG nSamples, LONG *nProcessed)
|
SampleGrabber_IMemInputPin_ReceiveMultiple(IMemInputPin *iface, IMediaSample **samples, LONG nSamples, LONG *nProcessed)
|
||||||
{
|
{
|
||||||
SG_Impl *This = impl_from_IMemInputPin(iface);
|
SG_Impl *This = impl_from_IMemInputPin(iface);
|
||||||
|
LONG idx;
|
||||||
TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->memOutput, This->grabberIface);
|
TRACE("(%p)->(%p, %u, %p) output = %p, grabber = %p\n", This, samples, nSamples, nProcessed, This->memOutput, This->grabberIface);
|
||||||
if (!samples || !nProcessed)
|
if (!samples || !nProcessed)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
if ((This->state != State_Running) || (This->oneShot == OneShot_Past))
|
||||||
return S_FALSE;
|
return S_FALSE;
|
||||||
if (This->grabberIface) {
|
for (idx = 0; idx < nSamples; idx++)
|
||||||
LONG idx;
|
SampleGrabber_callback(This, samples[idx]);
|
||||||
for (idx = 0; idx < nSamples; idx++)
|
|
||||||
SampleGrabber_callback(This, samples[idx]);
|
|
||||||
}
|
|
||||||
return This->memOutput ? IMemInputPin_ReceiveMultiple(This->memOutput, samples, nSamples, nProcessed) : S_OK;
|
return This->memOutput ? IMemInputPin_ReceiveMultiple(This->memOutput, samples, nSamples, nProcessed) : S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1048,6 +1100,10 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
|
||||||
debugstr_guid(&type->majortype), debugstr_guid(&type->subtype),
|
debugstr_guid(&type->majortype), debugstr_guid(&type->subtype),
|
||||||
type->lSampleSize,
|
type->lSampleSize,
|
||||||
debugstr_guid(&type->formattype), type->cbFormat);
|
debugstr_guid(&type->formattype), type->cbFormat);
|
||||||
|
if (!IsEqualGUID(&type->formattype, &FORMAT_None) &&
|
||||||
|
!IsEqualGUID(&type->formattype, &GUID_NULL) &&
|
||||||
|
!type->pbFormat)
|
||||||
|
return VFW_E_INVALIDMEDIATYPE;
|
||||||
if (!IsEqualGUID(&This->sg->mtype.majortype,&GUID_NULL) &&
|
if (!IsEqualGUID(&This->sg->mtype.majortype,&GUID_NULL) &&
|
||||||
!IsEqualGUID(&This->sg->mtype.majortype,&type->majortype))
|
!IsEqualGUID(&This->sg->mtype.majortype,&type->majortype))
|
||||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||||
|
@ -1058,10 +1114,6 @@ SampleGrabber_In_IPin_ReceiveConnection(IPin *iface, IPin *connector, const AM_M
|
||||||
!IsEqualGUID(&This->sg->mtype.formattype,&FORMAT_None) &&
|
!IsEqualGUID(&This->sg->mtype.formattype,&FORMAT_None) &&
|
||||||
!IsEqualGUID(&This->sg->mtype.formattype,&type->formattype))
|
!IsEqualGUID(&This->sg->mtype.formattype,&type->formattype))
|
||||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
return VFW_E_TYPE_NOT_ACCEPTED;
|
||||||
if (!IsEqualGUID(&type->formattype, &FORMAT_None) &&
|
|
||||||
!IsEqualGUID(&type->formattype, &GUID_NULL) &&
|
|
||||||
!type->pbFormat)
|
|
||||||
return VFW_E_TYPE_NOT_ACCEPTED;
|
|
||||||
if (This->sg->mtype.pbFormat)
|
if (This->sg->mtype.pbFormat)
|
||||||
CoTaskMemFree(This->sg->mtype.pbFormat);
|
CoTaskMemFree(This->sg->mtype.pbFormat);
|
||||||
This->sg->mtype = *type;
|
This->sg->mtype = *type;
|
||||||
|
@ -1212,7 +1264,7 @@ SampleGrabber_IPin_EnumMediaTypes(IPin *iface, IEnumMediaTypes **mtypes)
|
||||||
TRACE("(%p)->(%p)\n", This, mtypes);
|
TRACE("(%p)->(%p)\n", This, mtypes);
|
||||||
if (!mtypes)
|
if (!mtypes)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
*mtypes = mediaenum_create(&This->sg->mtype);
|
*mtypes = mediaenum_create(This->sg->pin_in.pair ? &This->sg->mtype : (const AM_MEDIA_TYPE *)NULL);
|
||||||
return *mtypes ? S_OK : E_OUTOFMEMORY;
|
return *mtypes ? S_OK : E_OUTOFMEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1401,6 +1453,8 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
|
||||||
obj->pin_out.name = pin_out_name;
|
obj->pin_out.name = pin_out_name;
|
||||||
obj->pin_out.sg = obj;
|
obj->pin_out.sg = obj;
|
||||||
obj->pin_out.pair = NULL;
|
obj->pin_out.pair = NULL;
|
||||||
|
InitializeCriticalSection(&obj->critSect);
|
||||||
|
obj->critSect.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": SG_Impl.critSect");
|
||||||
obj->info.achName[0] = 0;
|
obj->info.achName[0] = 0;
|
||||||
obj->info.pGraph = NULL;
|
obj->info.pGraph = NULL;
|
||||||
obj->state = State_Stopped;
|
obj->state = State_Stopped;
|
||||||
|
@ -1413,6 +1467,8 @@ HRESULT SampleGrabber_create(IUnknown *pUnkOuter, LPVOID *ppv)
|
||||||
obj->grabberIface = NULL;
|
obj->grabberIface = NULL;
|
||||||
obj->grabberMethod = -1;
|
obj->grabberMethod = -1;
|
||||||
obj->oneShot = OneShot_None;
|
obj->oneShot = OneShot_None;
|
||||||
|
obj->bufferLen = -1;
|
||||||
|
obj->bufferData = NULL;
|
||||||
*ppv = obj;
|
*ppv = obj;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
|
|
Loading…
Reference in a new issue