Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/buffer.c | 55 +++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 29 deletions(-)
diff --git a/dlls/mfplat/buffer.c b/dlls/mfplat/buffer.c index 03037590ec..8e54a538f6 100644 --- a/dlls/mfplat/buffer.c +++ b/dlls/mfplat/buffer.c @@ -49,7 +49,6 @@ struct sample size_t buffer_count; size_t capacity; DWORD flags; - CRITICAL_SECTION cs; DWORD prop_flags; LONGLONG duration; LONGLONG timestamp; @@ -281,7 +280,6 @@ static ULONG WINAPI sample_Release(IMFSample *iface) for (i = 0; i < sample->buffer_count; ++i) IMFMediaBuffer_Release(sample->buffers[i]); clear_attributes_object(&sample->attributes); - DeleteCriticalSection(&sample->cs); heap_free(sample->buffers); heap_free(sample); } @@ -566,9 +564,9 @@ static HRESULT WINAPI sample_GetSampleFlags(IMFSample *iface, DWORD *flags)
TRACE("%p, %p.\n", iface, flags);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); *flags = sample->flags; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -579,9 +577,9 @@ static HRESULT WINAPI sample_SetSampleFlags(IMFSample *iface, DWORD flags)
TRACE("%p, %#x.\n", iface, flags);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); sample->flags = flags; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -593,12 +591,12 @@ static HRESULT WINAPI sample_GetSampleTime(IMFSample *iface, LONGLONG *timestamp
TRACE("%p, %p.\n", iface, timestamp);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); if (sample->prop_flags & SAMPLE_PROP_HAS_TIMESTAMP) *timestamp = sample->timestamp; else hr = MF_E_NO_SAMPLE_TIMESTAMP; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -609,10 +607,10 @@ static HRESULT WINAPI sample_SetSampleTime(IMFSample *iface, LONGLONG timestamp)
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(timestamp));
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); sample->timestamp = timestamp; sample->prop_flags |= SAMPLE_PROP_HAS_TIMESTAMP; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -624,12 +622,12 @@ static HRESULT WINAPI sample_GetSampleDuration(IMFSample *iface, LONGLONG *durat
TRACE("%p, %p.\n", iface, duration);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); if (sample->prop_flags & SAMPLE_PROP_HAS_DURATION) *duration = sample->duration; else hr = MF_E_NO_SAMPLE_DURATION; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -640,10 +638,10 @@ static HRESULT WINAPI sample_SetSampleDuration(IMFSample *iface, LONGLONG durati
TRACE("%p, %s.\n", iface, wine_dbgstr_longlong(duration));
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); sample->duration = duration; sample->prop_flags |= SAMPLE_PROP_HAS_DURATION; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -657,9 +655,9 @@ static HRESULT WINAPI sample_GetBufferCount(IMFSample *iface, DWORD *count) if (!count) return E_INVALIDARG;
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); *count = sample->buffer_count; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -671,7 +669,7 @@ static HRESULT WINAPI sample_GetBufferByIndex(IMFSample *iface, DWORD index, IMF
TRACE("%p, %u, %p.\n", iface, index, buffer);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); if (index < sample->buffer_count) { *buffer = sample->buffers[index]; @@ -679,7 +677,7 @@ static HRESULT WINAPI sample_GetBufferByIndex(IMFSample *iface, DWORD index, IMF } else hr = E_INVALIDARG; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -691,7 +689,7 @@ static HRESULT WINAPI sample_ConvertToContiguousBuffer(IMFSample *iface, IMFMedi
TRACE("%p, %p.\n", iface, buffer);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs);
if (sample->buffer_count == 0) hr = E_UNEXPECTED; @@ -706,7 +704,7 @@ static HRESULT WINAPI sample_ConvertToContiguousBuffer(IMFSample *iface, IMFMedi hr = E_NOTIMPL; }
- LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -718,7 +716,7 @@ static HRESULT WINAPI sample_AddBuffer(IMFSample *iface, IMFMediaBuffer *buffer)
TRACE("%p, %p.\n", iface, buffer);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); if (!mf_array_reserve((void **)&sample->buffers, &sample->capacity, sample->buffer_count + 1, sizeof(*sample->buffers))) hr = E_OUTOFMEMORY; @@ -727,7 +725,7 @@ static HRESULT WINAPI sample_AddBuffer(IMFSample *iface, IMFMediaBuffer *buffer) sample->buffers[sample->buffer_count++] = buffer; IMFMediaBuffer_AddRef(buffer); } - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -739,7 +737,7 @@ static HRESULT WINAPI sample_RemoveBufferByIndex(IMFSample *iface, DWORD index)
TRACE("%p, %u.\n", iface, index);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); if (index < sample->buffer_count) { IMFMediaBuffer_Release(sample->buffers[index]); @@ -752,7 +750,7 @@ static HRESULT WINAPI sample_RemoveBufferByIndex(IMFSample *iface, DWORD index) } else hr = E_INVALIDARG; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return hr; } @@ -764,11 +762,11 @@ static HRESULT WINAPI sample_RemoveAllBuffers(IMFSample *iface)
TRACE("%p.\n", iface);
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); for (i = 0; i < sample->buffer_count; ++i) IMFMediaBuffer_Release(sample->buffers[i]); sample->buffer_count = 0; - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -783,13 +781,13 @@ static HRESULT WINAPI sample_GetTotalLength(IMFSample *iface, DWORD *total_lengt
*total_length = 0;
- EnterCriticalSection(&sample->cs); + EnterCriticalSection(&sample->attributes.cs); for (i = 0; i < sample->buffer_count; ++i) { if (SUCCEEDED(IMFMediaBuffer_GetCurrentLength(sample->buffers[i], &length))) *total_length += length; } - LeaveCriticalSection(&sample->cs); + LeaveCriticalSection(&sample->attributes.cs);
return S_OK; } @@ -873,7 +871,6 @@ HRESULT WINAPI MFCreateSample(IMFSample **sample) }
object->IMFSample_iface.lpVtbl = &samplevtbl; - InitializeCriticalSection(&object->cs);
*sample = &object->IMFSample_iface;
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 382f066327..c52255723c 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -58,7 +58,6 @@ struct presentation_desc IMFPresentationDescriptor IMFPresentationDescriptor_iface; struct presentation_desc_entry *descriptors; unsigned int count; - CRITICAL_SECTION cs; };
static HRESULT presentation_descriptor_init(struct presentation_desc *object, DWORD count); @@ -1239,7 +1238,6 @@ static ULONG WINAPI presentation_descriptor_Release(IMFPresentationDescriptor *i IMFStreamDescriptor_Release(presentation_desc->descriptors[i].descriptor); } clear_attributes_object(&presentation_desc->attributes); - DeleteCriticalSection(&presentation_desc->cs); heap_free(presentation_desc->descriptors); heap_free(presentation_desc); } @@ -1553,9 +1551,9 @@ static HRESULT WINAPI presentation_descriptor_GetStreamDescriptorByIndex(IMFPres if (index >= presentation_desc->count) return E_INVALIDARG;
- EnterCriticalSection(&presentation_desc->cs); + EnterCriticalSection(&presentation_desc->attributes.cs); *selected = presentation_desc->descriptors[index].selected; - LeaveCriticalSection(&presentation_desc->cs); + LeaveCriticalSection(&presentation_desc->attributes.cs);
*descriptor = presentation_desc->descriptors[index].descriptor; IMFStreamDescriptor_AddRef(*descriptor); @@ -1572,9 +1570,9 @@ static HRESULT WINAPI presentation_descriptor_SelectStream(IMFPresentationDescri if (index >= presentation_desc->count) return E_INVALIDARG;
- EnterCriticalSection(&presentation_desc->cs); + EnterCriticalSection(&presentation_desc->attributes.cs); presentation_desc->descriptors[index].selected = TRUE; - LeaveCriticalSection(&presentation_desc->cs); + LeaveCriticalSection(&presentation_desc->attributes.cs);
return S_OK; } @@ -1588,9 +1586,9 @@ static HRESULT WINAPI presentation_descriptor_DeselectStream(IMFPresentationDesc if (index >= presentation_desc->count) return E_INVALIDARG;
- EnterCriticalSection(&presentation_desc->cs); + EnterCriticalSection(&presentation_desc->attributes.cs); presentation_desc->descriptors[index].selected = FALSE; - LeaveCriticalSection(&presentation_desc->cs); + LeaveCriticalSection(&presentation_desc->attributes.cs);
return S_OK; } @@ -1610,7 +1608,7 @@ static HRESULT WINAPI presentation_descriptor_Clone(IMFPresentationDescriptor *i
presentation_descriptor_init(object, presentation_desc->count);
- EnterCriticalSection(&presentation_desc->cs); + EnterCriticalSection(&presentation_desc->attributes.cs);
for (i = 0; i < presentation_desc->count; ++i) { @@ -1620,7 +1618,7 @@ static HRESULT WINAPI presentation_descriptor_Clone(IMFPresentationDescriptor *i
attributes_CopyAllItems(&presentation_desc->attributes, (IMFAttributes *)&object->IMFPresentationDescriptor_iface);
- LeaveCriticalSection(&presentation_desc->cs); + LeaveCriticalSection(&presentation_desc->attributes.cs);
*descriptor = &object->IMFPresentationDescriptor_iface;
@@ -1677,7 +1675,6 @@ static HRESULT presentation_descriptor_init(struct presentation_desc *object, DW return hr; object->IMFPresentationDescriptor_iface.lpVtbl = &presentationdescriptorvtbl; object->descriptors = heap_alloc_zero(count * sizeof(*object->descriptors)); - InitializeCriticalSection(&object->cs); if (!object->descriptors) { IMFPresentationDescriptor_Release(&object->IMFPresentationDescriptor_iface);
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index c52255723c..69b302ca89 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -43,7 +43,6 @@ struct stream_desc IMFMediaType **media_types; unsigned int media_types_count; IMFMediaType *current_type; - CRITICAL_SECTION cs; };
struct presentation_desc_entry @@ -665,7 +664,6 @@ static ULONG WINAPI stream_descriptor_Release(IMFStreamDescriptor *iface) if (stream_desc->current_type) IMFMediaType_Release(stream_desc->current_type); clear_attributes_object(&stream_desc->attributes); - DeleteCriticalSection(&stream_desc->cs); heap_free(stream_desc); }
@@ -1087,12 +1085,12 @@ static HRESULT WINAPI mediatype_handler_SetCurrentMediaType(IMFMediaTypeHandler if (!type) return E_POINTER;
- EnterCriticalSection(&stream_desc->cs); + EnterCriticalSection(&stream_desc->attributes.cs); if (stream_desc->current_type) IMFMediaType_Release(stream_desc->current_type); stream_desc->current_type = type; IMFMediaType_AddRef(stream_desc->current_type); - LeaveCriticalSection(&stream_desc->cs); + LeaveCriticalSection(&stream_desc->attributes.cs);
return S_OK; } @@ -1104,7 +1102,7 @@ static HRESULT WINAPI mediatype_handler_GetCurrentMediaType(IMFMediaTypeHandler
TRACE("%p, %p.\n", iface, type);
- EnterCriticalSection(&stream_desc->cs); + EnterCriticalSection(&stream_desc->attributes.cs); if (stream_desc->current_type) { *type = stream_desc->current_type; @@ -1112,7 +1110,7 @@ static HRESULT WINAPI mediatype_handler_GetCurrentMediaType(IMFMediaTypeHandler } else hr = MF_E_NOT_INITIALIZED; - LeaveCriticalSection(&stream_desc->cs); + LeaveCriticalSection(&stream_desc->attributes.cs);
return hr; } @@ -1124,12 +1122,12 @@ static HRESULT WINAPI mediatype_handler_GetMajorType(IMFMediaTypeHandler *iface,
TRACE("%p, %p.\n", iface, type);
- EnterCriticalSection(&stream_desc->cs); + EnterCriticalSection(&stream_desc->attributes.cs); if (stream_desc->current_type) hr = IMFMediaType_GetGUID(stream_desc->current_type, &MF_MT_MAJOR_TYPE, type); else hr = MF_E_ATTRIBUTENOTFOUND; - LeaveCriticalSection(&stream_desc->cs); + LeaveCriticalSection(&stream_desc->attributes.cs);
return hr; } @@ -1175,7 +1173,6 @@ HRESULT WINAPI MFCreateStreamDescriptor(DWORD identifier, DWORD count, object->IMFMediaTypeHandler_iface.lpVtbl = &mediatypehandlervtbl; object->identifier = identifier; object->media_types = heap_alloc(count * sizeof(*object->media_types)); - InitializeCriticalSection(&object->cs); if (!object->media_types) { IMFStreamDescriptor_Release(&object->IMFStreamDescriptor_iface);