"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dlls/mfplat/buffer.c" between
wine-5.12.tar.xz and wine-5.13.tar.xz

About: Wine is an Open Source implementation of the MS Windows API on top of X, OpenGL, and Unix. Think of Wine as a compatibility layer for running Windows programs. Development release.

buffer.c  (wine-5.12.tar.xz):buffer.c  (wine-5.13.tar.xz)
skipping to change at line 22 skipping to change at line 22
* Lesser General Public License for more details. * Lesser General Public License for more details.
* *
* You should have received a copy of the GNU Lesser General Public * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#define COBJMACROS #define COBJMACROS
#include "mfplat_private.h" #include "mfplat_private.h"
#include "rtworkq.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat); WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
#define ALIGN_SIZE(size, alignment) (((size) + (alignment)) & ~((alignment))) #define ALIGN_SIZE(size, alignment) (((size) + (alignment)) & ~((alignment)))
struct memory_buffer struct memory_buffer
{ {
IMFMediaBuffer IMFMediaBuffer_iface; IMFMediaBuffer IMFMediaBuffer_iface;
skipping to change at line 74 skipping to change at line 75
IMFSample IMFSample_iface; IMFSample IMFSample_iface;
IMFTrackedSample IMFTrackedSample_iface; IMFTrackedSample IMFTrackedSample_iface;
IMFMediaBuffer **buffers; IMFMediaBuffer **buffers;
size_t buffer_count; size_t buffer_count;
size_t capacity; size_t capacity;
DWORD flags; DWORD flags;
DWORD prop_flags; DWORD prop_flags;
LONGLONG duration; LONGLONG duration;
LONGLONG timestamp; LONGLONG timestamp;
/* Tracked sample functionality. */
IRtwqAsyncResult *tracked_result;
LONG tracked_refcount;
}; };
static inline struct memory_buffer *impl_from_IMFMediaBuffer(IMFMediaBuffer *ifa ce) static inline struct memory_buffer *impl_from_IMFMediaBuffer(IMFMediaBuffer *ifa ce)
{ {
return CONTAINING_RECORD(iface, struct memory_buffer, IMFMediaBuffer_iface); return CONTAINING_RECORD(iface, struct memory_buffer, IMFMediaBuffer_iface);
} }
static struct memory_buffer *impl_from_IMF2DBuffer2(IMF2DBuffer2 *iface) static struct memory_buffer *impl_from_IMF2DBuffer2(IMF2DBuffer2 *iface)
{ {
return CONTAINING_RECORD(iface, struct memory_buffer, IMF2DBuffer2_iface); return CONTAINING_RECORD(iface, struct memory_buffer, IMF2DBuffer2_iface);
skipping to change at line 755 skipping to change at line 760
static ULONG WINAPI sample_AddRef(IMFSample *iface) static ULONG WINAPI sample_AddRef(IMFSample *iface)
{ {
struct sample *sample = impl_from_IMFSample(iface); struct sample *sample = impl_from_IMFSample(iface);
ULONG refcount = InterlockedIncrement(&sample->attributes.ref); ULONG refcount = InterlockedIncrement(&sample->attributes.ref);
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
return refcount; return refcount;
} }
static void release_sample_object(struct sample *sample)
{
size_t i;
for (i = 0; i < sample->buffer_count; ++i)
IMFMediaBuffer_Release(sample->buffers[i]);
clear_attributes_object(&sample->attributes);
heap_free(sample->buffers);
heap_free(sample);
}
static ULONG WINAPI sample_Release(IMFSample *iface) static ULONG WINAPI sample_Release(IMFSample *iface)
{ {
struct sample *sample = impl_from_IMFSample(iface); struct sample *sample = impl_from_IMFSample(iface);
ULONG refcount = InterlockedDecrement(&sample->attributes.ref); ULONG refcount = InterlockedDecrement(&sample->attributes.ref);
size_t i;
TRACE("%p, refcount %u.\n", iface, refcount); TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount) if (!refcount)
release_sample_object(sample);
return refcount;
}
static ULONG WINAPI sample_tracked_Release(IMFSample *iface)
{
struct sample *sample = impl_from_IMFSample(iface);
ULONG refcount;
HRESULT hr;
EnterCriticalSection(&sample->attributes.cs);
refcount = InterlockedDecrement(&sample->attributes.ref);
if (sample->tracked_result && sample->tracked_refcount == refcount)
{ {
for (i = 0; i < sample->buffer_count; ++i) /* Call could fail if queue system is not initialized, it's not critical
IMFMediaBuffer_Release(sample->buffers[i]); . */
clear_attributes_object(&sample->attributes); if (FAILED(hr = RtwqInvokeCallback(sample->tracked_result)))
heap_free(sample->buffers); WARN("Failed to invoke tracking callback, hr %#x.\n", hr);
heap_free(sample); IRtwqAsyncResult_Release(sample->tracked_result);
sample->tracked_result = NULL;
sample->tracked_refcount = 0;
} }
LeaveCriticalSection(&sample->attributes.cs);
TRACE("%p, refcount %u.\n", iface, refcount);
if (!refcount)
release_sample_object(sample);
return refcount; return refcount;
} }
static HRESULT WINAPI sample_GetItem(IMFSample *iface, REFGUID key, PROPVARIANT *value) static HRESULT WINAPI sample_GetItem(IMFSample *iface, REFGUID key, PROPVARIANT *value)
{ {
struct sample *sample = impl_from_IMFSample(iface); struct sample *sample = impl_from_IMFSample(iface);
TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), value); TRACE("%p, %s, %p.\n", iface, debugstr_attr(key), value);
skipping to change at line 1487 skipping to change at line 1523
static ULONG WINAPI tracked_sample_Release(IMFTrackedSample *iface) static ULONG WINAPI tracked_sample_Release(IMFTrackedSample *iface)
{ {
struct sample *sample = impl_from_IMFTrackedSample(iface); struct sample *sample = impl_from_IMFTrackedSample(iface);
return IMFSample_Release(&sample->IMFSample_iface); return IMFSample_Release(&sample->IMFSample_iface);
} }
static HRESULT WINAPI tracked_sample_SetAllocator(IMFTrackedSample *iface, static HRESULT WINAPI tracked_sample_SetAllocator(IMFTrackedSample *iface,
IMFAsyncCallback *sample_allocator, IUnknown *state) IMFAsyncCallback *sample_allocator, IUnknown *state)
{ {
FIXME("%p, %p, %p.\n", iface, sample_allocator, state); struct sample *sample = impl_from_IMFTrackedSample(iface);
HRESULT hr = S_OK;
return E_NOTIMPL; TRACE("%p, %p, %p.\n", iface, sample_allocator, state);
EnterCriticalSection(&sample->attributes.cs);
if (sample->tracked_result)
hr = MF_E_NOTACCEPTING;
else
{
if (SUCCEEDED(hr = RtwqCreateAsyncResult((IUnknown *)iface, (IRtwqAsyncC
allback *)sample_allocator,
state, &sample->tracked_result)))
{
/* Account for additional refcount brought by 'state' object. This t
hreshold is used
on Release() to invoke tracker callback. */
sample->tracked_refcount = 1;
if (state == (IUnknown *)&sample->IMFTrackedSample_iface ||
state == (IUnknown *)&sample->IMFSample_iface)
{
++sample->tracked_refcount;
}
}
}
LeaveCriticalSection(&sample->attributes.cs);
return hr;
} }
static const IMFTrackedSampleVtbl tracked_sample_vtbl = static const IMFTrackedSampleVtbl tracked_sample_vtbl =
{ {
tracked_sample_QueryInterface, tracked_sample_QueryInterface,
tracked_sample_AddRef, tracked_sample_AddRef,
tracked_sample_Release, tracked_sample_Release,
tracked_sample_SetAllocator, tracked_sample_SetAllocator,
}; };
static const IMFSampleVtbl sample_tracked_vtbl =
{
sample_QueryInterface,
sample_AddRef,
sample_tracked_Release,
sample_GetItem,
sample_GetItemType,
sample_CompareItem,
sample_Compare,
sample_GetUINT32,
sample_GetUINT64,
sample_GetDouble,
sample_GetGUID,
sample_GetStringLength,
sample_GetString,
sample_GetAllocatedString,
sample_GetBlobSize,
sample_GetBlob,
sample_GetAllocatedBlob,
sample_GetUnknown,
sample_SetItem,
sample_DeleteItem,
sample_DeleteAllItems,
sample_SetUINT32,
sample_SetUINT64,
sample_SetDouble,
sample_SetGUID,
sample_SetString,
sample_SetBlob,
sample_SetUnknown,
sample_LockStore,
sample_UnlockStore,
sample_GetCount,
sample_GetItemByIndex,
sample_CopyAllItems,
sample_GetSampleFlags,
sample_SetSampleFlags,
sample_GetSampleTime,
sample_SetSampleTime,
sample_GetSampleDuration,
sample_SetSampleDuration,
sample_GetBufferCount,
sample_GetBufferByIndex,
sample_ConvertToContiguousBuffer,
sample_AddBuffer,
sample_RemoveBufferByIndex,
sample_RemoveAllBuffers,
sample_GetTotalLength,
sample_CopyToBuffer,
};
/*********************************************************************** /***********************************************************************
* MFCreateSample (mfplat.@) * MFCreateSample (mfplat.@)
*/ */
HRESULT WINAPI MFCreateSample(IMFSample **sample) HRESULT WINAPI MFCreateSample(IMFSample **sample)
{ {
struct sample *object; struct sample *object;
HRESULT hr; HRESULT hr;
TRACE("%p.\n", sample); TRACE("%p.\n", sample);
skipping to change at line 1549 skipping to change at line 1661
object = heap_alloc_zero(sizeof(*object)); object = heap_alloc_zero(sizeof(*object));
if (!object) if (!object)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
if (FAILED(hr = init_attributes_object(&object->attributes, 0))) if (FAILED(hr = init_attributes_object(&object->attributes, 0)))
{ {
heap_free(object); heap_free(object);
return hr; return hr;
} }
object->IMFSample_iface.lpVtbl = &samplevtbl; object->IMFSample_iface.lpVtbl = &sample_tracked_vtbl;
object->IMFTrackedSample_iface.lpVtbl = &tracked_sample_vtbl; object->IMFTrackedSample_iface.lpVtbl = &tracked_sample_vtbl;
*sample = &object->IMFTrackedSample_iface; *sample = &object->IMFTrackedSample_iface;
return S_OK; return S_OK;
} }
 End of changes. 11 change blocks. 
9 lines changed or deleted 124 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)