Wine-Devel
By thread
wine-devel@list.winehq.org
By month
Messages by month
- ----- 2026 -----
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2001 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
June 2022
- 68 participants
- 3274 messages
Re: [PATCH v2 resend 2/6] comctl32/listview: Move LVN_ODSTATECHANGED notification to function.
by Zhiyi Zhang
Let's use "comctl32/listview: Move sending LVN_ODSTATECHANGED notifications to a function." for the subject.
On 5/26/22 04:00, Angelo Haller wrote:
> From: Angelo Haller <angelo(a)szanni.org>
>
> Signed-off-by: Angelo Haller <angelo(a)szanni.org>
> ---
> v2: Remove header and change return to VOID.
> ---
> dlls/comctl32/listview.c | 31 +++++++++++++++++++------------
> 1 file changed, 19 insertions(+), 12 deletions(-)
>
> diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c
> index 730bf4aaddd..72ade724313 100644
> --- a/dlls/comctl32/listview.c
> +++ b/dlls/comctl32/listview.c
> @@ -437,6 +437,7 @@ static INT LISTVIEW_GetStringWidthT(const LISTVIEW_INFO *, LPCWSTR, BOOL);
> static BOOL LISTVIEW_KeySelection(LISTVIEW_INFO *, INT, BOOL);
> static UINT LISTVIEW_GetItemState(const LISTVIEW_INFO *, INT, UINT);
> static BOOL LISTVIEW_SetItemState(LISTVIEW_INFO *, INT, const LVITEMW *);
> +static VOID LISTVIEW_SetOwnerDataState(LISTVIEW_INFO *, INT, INT, const LVITEMW *);
> static LRESULT LISTVIEW_VScroll(LISTVIEW_INFO *, INT, INT);
> static LRESULT LISTVIEW_HScroll(LISTVIEW_INFO *, INT, INT);
> static BOOL LISTVIEW_EnsureVisible(LISTVIEW_INFO *, INT, BOOL);
> @@ -3557,16 +3558,11 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
> INT nFirst = min(infoPtr->nSelectionMark, nItem);
> INT nLast = max(infoPtr->nSelectionMark, nItem);
> HWND hwndSelf = infoPtr->hwndSelf;
> - NMLVODSTATECHANGE nmlv;
> DWORD old_mask;
> LVITEMW item;
> INT i;
>
> - /* Temporarily disable change notification
> - * If the control is LVS_OWNERDATA, we need to send
> - * only one LVN_ODSTATECHANGED notification.
> - * See MSDN documentation for LVN_ITEMCHANGED.
> - */
> + /* disable per item notifications on LVS_OWNERDATA style */
Nitpick. disable -> Disable. There are other places like this.
> old_mask = infoPtr->notify_mask & NOTIFY_MASK_ITEM_CHANGE;
> if (infoPtr->dwStyle & LVS_OWNERDATA)
> infoPtr->notify_mask &= ~NOTIFY_MASK_ITEM_CHANGE;
> @@ -3579,13 +3575,8 @@ static BOOL LISTVIEW_AddGroupSelection(LISTVIEW_INFO *infoPtr, INT nItem)
> for (i = nFirst; i <= nLast; i++)
> LISTVIEW_SetItemState(infoPtr,i,&item);
>
> - ZeroMemory(&nmlv, sizeof(nmlv));
> - nmlv.iFrom = nFirst;
> - nmlv.iTo = nLast;
> - nmlv.uOldState = 0;
> - nmlv.uNewState = item.state;
> + LISTVIEW_SetOwnerDataState(infoPtr, nFirst, nLast, &item);
>
> - notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv);
> if (!IsWindow(hwndSelf))
> return FALSE;
> infoPtr->notify_mask |= old_mask;
> @@ -8950,6 +8941,22 @@ static BOOL LISTVIEW_SetItemPosition(LISTVIEW_INFO *infoPtr, INT nItem, const PO
> return LISTVIEW_MoveIconTo(infoPtr, nItem, &Pt, FALSE);
> }
>
> +/* Make sure to also disable per item notifications via the notification mask. */
> +static VOID LISTVIEW_SetOwnerDataState(LISTVIEW_INFO *infoPtr, INT nFirst, INT nLast, const LVITEMW *item)
> +{
> + NMLVODSTATECHANGE nmlv;
> +
> + if (!item) return;
> +
> + ZeroMemory(&nmlv, sizeof(nmlv));
> + nmlv.iFrom = nFirst;
> + nmlv.iTo = nLast;
> + nmlv.uOldState = 0;
> + nmlv.uNewState = item->state;
> +
> + notify_hdr(infoPtr, LVN_ODSTATECHANGED, (LPNMHDR)&nmlv);
> +}
> +
> /***
> * DESCRIPTION:
> * Sets the state of one or many items.
June 10, 2022
Re: [PATCH v2 resend 1/6] comctl32/tests: Expand ownerdata listview tests.
by Zhiyi Zhang
On 5/26/22 04:00, Angelo Haller wrote:
> From: Angelo Haller <angelo(a)szanni.org>
>
> Add more test cases to ownderdata listviews.
> Check LVN_ITEMCHANGED IDs.
>
> Signed-off-by: Angelo Haller <angelo(a)szanni.org>
> ---
> dlls/comctl32/tests/listview.c | 59 +++++++++++++++++++++++++++++-----
> 1 file changed, 51 insertions(+), 8 deletions(-)
>
> diff --git a/dlls/comctl32/tests/listview.c b/dlls/comctl32/tests/listview.c
> index 6ac7f53137d..78b3e3ae069 100644
> --- a/dlls/comctl32/tests/listview.c
> +++ b/dlls/comctl32/tests/listview.c
> @@ -255,11 +255,33 @@ static const struct message ownerdata_deselect_all_parent_seq[] = {
> { 0 }
> };
>
> -static const struct message ownerdata_multiselect_odstatechanged_seq[] = {
> - { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
> +static const struct message ownerdata_multiselect_select_0_to_1_seq[] = {
> + { WM_NOTIFY, sent|id|wparam, -1, 0, LVN_ITEMCHANGED },
> { WM_NOTIFY, sent|id, 0, 0, LVN_ODSTATECHANGED },
> - { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
> - { WM_NOTIFY, sent|id, 0, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 0, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 1, 0, LVN_ITEMCHANGED },
> + { 0 }
> +};
> +
> +static const struct message ownerdata_multiselect_select_0_to_2_seq[] = {
> + { WM_NOTIFY, sent|id|wparam, -1, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id, 0, 0, LVN_ODSTATECHANGED },
> + { WM_NOTIFY, sent|id|wparam, 1, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 2, 0, LVN_ITEMCHANGED },
> + { 0 }
> +};
> +
> +static const struct message ownerdata_multiselect_deselect_all_select_3_seq[] = {
> + { WM_NOTIFY, sent|id|wparam, -1, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 2, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 3, 0, LVN_ITEMCHANGED },
> + { 0 }
> +};
> +
> +static const struct message ownerdata_multiselect_deselect_3_select_2_seq[] = {
> + { WM_NOTIFY, sent|id|wparam, -1, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 3, 0, LVN_ITEMCHANGED },
> + { WM_NOTIFY, sent|id|wparam, 2, 0, LVN_ITEMCHANGED },
> { 0 }
> };
>
> @@ -3575,8 +3597,8 @@ static void test_ownerdata_multiselect(void)
> expect(0, res);
>
> ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
> - ownerdata_multiselect_odstatechanged_seq,
> - "ownerdata select multiple notification", TRUE);
> + ownerdata_multiselect_select_0_to_1_seq,
> + "ownerdata multiselect: select multiple via SHIFT", TRUE);
>
> res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0);
> expect(0, res);
> @@ -3592,8 +3614,8 @@ static void test_ownerdata_multiselect(void)
> expect(0, res);
>
> ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
> - ownerdata_multiselect_odstatechanged_seq,
> - "ownerdata select multiple notification", TRUE);
> + ownerdata_multiselect_select_0_to_2_seq,
> + "ownerdata multiselect: select multiple via SHIFT+CONTROL", TRUE);
>
> res = SendMessageA(hwnd, WM_KEYUP, VK_DOWN, 0);
> expect(0, res);
> @@ -3604,6 +3626,27 @@ static void test_ownerdata_multiselect(void)
> res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
> expect(3, res);
>
> + flush_sequences(sequences, NUM_MSG_SEQUENCES);
> +
> + res = SendMessageA(hwnd, WM_KEYDOWN, VK_DOWN, 0);
> + expect(0, res);
> +
> + ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
> + ownerdata_multiselect_deselect_all_select_3_seq,
> + "ownerdata multiselect: deselect all, select item 3", TRUE);
> +
> + res = SendMessageA(hwnd, LVM_GETSELECTEDCOUNT, 0, 0);
> + expect(1, res);
Hi Angelo,
Thanks for looking into this. There are a few things can be improved for this series.
Please complete the keyboard sequence by sending WM_KEYUP for VK_DOWN and
WM_KEYUP for VK_UP.
Also please add tests for pressing VK_UP while holding Shift after setting pressing VK_DOWN while holding Shift.
Same for holding both Shift and Control And add checks for NMLVODSTATECHANGE member values. For example,
I don't think uOldState should always be 0.
> +
> + flush_sequences(sequences, NUM_MSG_SEQUENCES);
> +
> + res = SendMessageA(hwnd, WM_KEYDOWN, VK_UP, 0);
> + expect(0, res);
> +
> + ok_sequence(sequences, PARENT_ODSTATECHANGED_SEQ_INDEX,
> + ownerdata_multiselect_deselect_3_select_2_seq,
> + "ownerdata multiselect: deselect item 3, select item 2", TRUE);
> +
> DestroyWindow(hwnd);
> }
>
June 10, 2022
[PATCH 1/1] comctl32: Fix integer overflow in DPA_Search.
by Jinoh Kang
From: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
---
dlls/comctl32/dpa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/comctl32/dpa.c b/dlls/comctl32/dpa.c
index b8d23f6cafa..aa9a045e516 100644
--- a/dlls/comctl32/dpa.c
+++ b/dlls/comctl32/dpa.c
@@ -859,7 +859,7 @@ INT WINAPI DPA_Search (HDPA hdpa, LPVOID pFind, INT nStart,
r = hdpa->nItemCount - 1;
lpPtr = hdpa->ptrs;
while (r >= l) {
- x = (l + r) / 2;
+ x = l + (r - l) / 2;
n = (pfnCompare)(pFind, lpPtr[x], lParam);
if (n == 0)
return x;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/221
June 10, 2022
[PATCH 0/1] MR221: comctl32: Fix integer overflow in DPA_Search.
by Jinoh Kang (@iamahuman)
Signed-off-by: Jinoh Kang <jinoh.kang.kr(a)gmail.com>
--
https://gitlab.winehq.org/wine/wine/-/merge_requests/221
June 10, 2022
[PATCH 7/7] winegstreamer: Remove copying support from wg_transform_push_data.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 5 ++++-
dlls/winegstreamer/main.c | 9 +++++++--
dlls/winegstreamer/unixlib.h | 2 --
dlls/winegstreamer/wg_sample.c | 18 ++++--------------
dlls/winegstreamer/wg_transform.c | 12 +-----------
5 files changed, 16 insertions(+), 30 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 6657cb792f9..5f7a34780fc 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -69,6 +69,8 @@ struct wg_sample_queue;
HRESULT wg_sample_queue_create(struct wg_sample_queue **out);
void wg_sample_queue_destroy(struct wg_sample_queue *queue);
void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all);
+void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample);
+void wg_sample_queue_end_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample);
struct wg_parser *wg_parser_create(enum wg_parser_type type, bool unlimited_buffering);
void wg_parser_destroy(struct wg_parser *parser);
@@ -102,7 +104,8 @@ void wg_parser_stream_seek(struct wg_parser_stream *stream, double rate,
struct wg_transform *wg_transform_create(const struct wg_format *input_format,
const struct wg_format *output_format);
void wg_transform_destroy(struct wg_transform *transform);
-HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample);
+HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample,
+ struct wg_sample_queue *queue);
HRESULT wg_transform_read_data(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
diff --git a/dlls/winegstreamer/main.c b/dlls/winegstreamer/main.c
index 5075b3118cd..c9d1ec0cc20 100644
--- a/dlls/winegstreamer/main.c
+++ b/dlls/winegstreamer/main.c
@@ -312,7 +312,8 @@ void wg_transform_destroy(struct wg_transform *transform)
__wine_unix_call(unix_handle, unix_wg_transform_destroy, transform);
}
-HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample)
+HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample *sample,
+ struct wg_sample_queue *queue)
{
struct wg_transform_push_data_params params =
{
@@ -323,7 +324,11 @@ HRESULT wg_transform_push_data(struct wg_transform *transform, struct wg_sample
TRACE("transform %p, sample %p.\n", transform, sample);
- if ((status = __wine_unix_call(unix_handle, unix_wg_transform_push_data, ¶ms)))
+ wg_sample_queue_begin_append(queue, sample);
+ status = __wine_unix_call(unix_handle, unix_wg_transform_push_data, ¶ms);
+ wg_sample_queue_end_append(queue, sample);
+
+ if (status)
return HRESULT_FROM_NT(status);
return params.result;
diff --git a/dlls/winegstreamer/unixlib.h b/dlls/winegstreamer/unixlib.h
index ed56fb47908..860a8ab2a52 100644
--- a/dlls/winegstreamer/unixlib.h
+++ b/dlls/winegstreamer/unixlib.h
@@ -121,8 +121,6 @@ enum wg_sample_flag
WG_SAMPLE_FLAG_HAS_PTS = 2,
WG_SAMPLE_FLAG_HAS_DURATION = 4,
WG_SAMPLE_FLAG_SYNC_POINT = 8,
-
- WG_SAMPLE_FLAG_HAS_REFCOUNT = 0x10000, /* sample is queued on the client side and may be wrapped */
};
struct wg_sample
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 646d8511821..bc802008805 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -149,20 +149,19 @@ void wg_sample_release(struct wg_sample *wg_sample)
free(sample);
}
-static void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample)
+void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample)
{
struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
/* make sure a concurrent wg_sample_queue_flush call won't release the sample until we're done */
InterlockedIncrement(&wg_sample->refcount);
- sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_REFCOUNT;
EnterCriticalSection(&queue->cs);
list_add_tail(&queue->samples, &sample->entry);
LeaveCriticalSection(&queue->cs);
}
-static void wg_sample_queue_end_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample)
+void wg_sample_queue_end_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample)
{
/* release temporary ref taken in wg_sample_queue_begin_append */
InterlockedDecrement(&wg_sample->refcount);
@@ -221,7 +220,6 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *w
struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
LONGLONG time, duration;
UINT32 value;
- HRESULT hr;
if (sample->type != WG_SAMPLE_TYPE_MF)
return E_INVALIDARG;
@@ -239,11 +237,7 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *w
if (SUCCEEDED(IMFSample_GetUINT32(sample->u.mf.sample, &MFSampleExtension_CleanPoint, &value)) && value)
sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
- wg_sample_queue_begin_append(queue, wg_sample);
- hr = wg_transform_push_data(transform, wg_sample);
- wg_sample_queue_end_append(queue, wg_sample);
-
- return hr;
+ return wg_transform_push_data(transform, wg_sample, queue);
}
HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *wg_sample,
@@ -271,11 +265,7 @@ HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *w
if (IMediaSample_IsSyncPoint(sample->u.qz.sample) == S_OK)
wg_sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
- wg_sample_queue_begin_append(queue, wg_sample);
- hr = wg_transform_push_data(transform, wg_sample);
- wg_sample_queue_end_append(queue, wg_sample);
-
- return hr;
+ return wg_transform_push_data(transform, wg_sample, queue);
}
HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
diff --git a/dlls/winegstreamer/wg_transform.c b/dlls/winegstreamer/wg_transform.c
index d40f508250c..b5517f24515 100644
--- a/dlls/winegstreamer/wg_transform.c
+++ b/dlls/winegstreamer/wg_transform.c
@@ -542,17 +542,7 @@ NTSTATUS wg_transform_push_data(void *args)
return STATUS_SUCCESS;
}
- if (!(sample->flags & WG_SAMPLE_FLAG_HAS_REFCOUNT))
- {
- if (!(buffer = gst_buffer_new_and_alloc(sample->size)))
- {
- GST_ERROR("Failed to allocate input buffer");
- return STATUS_NO_MEMORY;
- }
- gst_buffer_fill(buffer, 0, sample->data, sample->size);
- GST_INFO("Copied %u bytes from sample %p to buffer %p", sample->size, sample, buffer);
- }
- else if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
+ if (!(buffer = gst_buffer_new_wrapped_full(GST_MEMORY_FLAG_READONLY, sample->data, sample->max_size,
0, sample->size, sample, wg_sample_free_notify)))
{
GST_ERROR("Failed to allocate input buffer");
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022
[PATCH 6/7] winegstreamer: Support zero-copy wg_transform_read_data in quartz_transform.c.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 2 ++
dlls/winegstreamer/quartz_transform.c | 31 +++-------------------
dlls/winegstreamer/wg_sample.c | 38 +++++++++++++++++++++++++++
3 files changed, 43 insertions(+), 28 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index 10d0497ba3e..6657cb792f9 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -136,6 +136,8 @@ HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *s
struct wg_sample_queue *queue);
HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
+HRESULT wg_transform_read_qz(struct wg_transform *transform, struct wg_sample *sample,
+ struct wg_format *format);
HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj);
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c
index 0adad9b4c6c..4801de7d3b5 100644
--- a/dlls/winegstreamer/quartz_transform.c
+++ b/dlls/winegstreamer/quartz_transform.c
@@ -291,8 +291,6 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
{
struct transform *filter = impl_from_strmbase_filter(pin->pin.filter);
struct wg_sample *wg_sample;
- REFERENCE_TIME start_time;
- REFERENCE_TIME end_time;
HRESULT hr;
/* We do not expect pin connection state to change while the filter is
@@ -335,10 +333,11 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
return hr;
}
- hr = wg_transform_read_data(filter->transform, wg_sample, NULL);
+ hr = wg_transform_read_qz(filter->transform, wg_sample, NULL);
+ wg_sample_release(wg_sample);
+
if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT)
{
- wg_sample_release(wg_sample);
IMediaSample_Release(output_sample);
break;
}
@@ -346,36 +345,12 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
{
if (hr == MF_E_TRANSFORM_STREAM_CHANGE)
FIXME("Unexpected stream format change!\n");
- wg_sample_release(wg_sample);
IMediaSample_Release(output_sample);
return hr;
}
wg_sample_queue_flush(filter->sample_queue, false);
- hr = IMediaSample_SetActualDataLength(output_sample, wg_sample->size);
- if (FAILED(hr))
- {
- wg_sample_release(wg_sample);
- IMediaSample_Release(output_sample);
- return hr;
- }
-
- if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS)
- {
- start_time = wg_sample->pts;
- if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
- {
- end_time = start_time + wg_sample->duration;
- IMediaSample_SetTime(output_sample, &start_time, &end_time);
- }
- else
- {
- IMediaSample_SetTime(output_sample, &start_time, NULL);
- }
- }
- wg_sample_release(wg_sample);
-
hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample);
if (FAILED(hr))
{
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 4a0be9460a7..646d8511821 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -301,3 +301,41 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *w
return S_OK;
}
+
+HRESULT wg_transform_read_qz(struct wg_transform *transform, struct wg_sample *wg_sample,
+ struct wg_format *format)
+{
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
+ REFERENCE_TIME start_pts, end_pts;
+ HRESULT hr;
+ BOOL value;
+
+ if (sample->type != WG_SAMPLE_TYPE_QZ)
+ return E_INVALIDARG;
+
+ if (FAILED(hr = wg_transform_read_data(transform, wg_sample, format)))
+ return hr;
+
+ hr = IMediaSample_SetActualDataLength(sample->u.qz.sample, wg_sample->size);
+ if (FAILED(hr))
+ return hr;
+
+ if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS)
+ {
+ start_pts = wg_sample->pts;
+ if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
+ {
+ end_pts = start_pts + wg_sample->duration;
+ IMediaSample_SetTime(sample->u.qz.sample, &start_pts, &end_pts);
+ }
+ else
+ {
+ IMediaSample_SetTime(sample->u.qz.sample, &start_pts, NULL);
+ }
+ }
+
+ value = !!(wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT);
+ IMediaSample_SetSyncPoint(sample->u.qz.sample, value);
+
+ return S_OK;
+}
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022
[PATCH 5/7] winegstreamer: Support zero-copy wg_transform_push_data in quartz_transform.c.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 2 ++
dlls/winegstreamer/quartz_transform.c | 19 ++++------------
dlls/winegstreamer/wg_sample.c | 32 +++++++++++++++++++++++++++
3 files changed, 38 insertions(+), 15 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index cc799b51090..10d0497ba3e 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -132,6 +132,8 @@ void wg_sample_release(struct wg_sample *wg_sample);
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *sample,
struct wg_sample_queue *queue);
+HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *sample,
+ struct wg_sample_queue *queue);
HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *sample,
struct wg_format *format);
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c
index 715d7c2747b..0adad9b4c6c 100644
--- a/dlls/winegstreamer/quartz_transform.c
+++ b/dlls/winegstreamer/quartz_transform.c
@@ -315,23 +315,10 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
if (FAILED(hr))
return hr;
- hr = IMediaSample_GetTime(sample, &start_time, &end_time);
- if (SUCCEEDED(hr))
- {
- wg_sample->pts = start_time;
- wg_sample->flags |= WG_SAMPLE_FLAG_HAS_PTS;
- }
- if (hr == S_OK)
- {
- wg_sample->duration = end_time - start_time;
- wg_sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
- }
-
- hr = wg_transform_push_data(filter->transform, wg_sample);
- wg_sample_release(wg_sample);
-
+ hr = wg_transform_push_qz(filter->transform, wg_sample, filter->sample_queue);
if (FAILED(hr))
return hr;
+ wg_sample_queue_flush(filter->sample_queue, false);
for (;;)
{
@@ -364,6 +351,8 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
return hr;
}
+ wg_sample_queue_flush(filter->sample_queue, false);
+
hr = IMediaSample_SetActualDataLength(output_sample, wg_sample->size);
if (FAILED(hr))
{
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 40af112db39..4a0be9460a7 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -246,6 +246,38 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *w
return hr;
}
+HRESULT wg_transform_push_qz(struct wg_transform *transform, struct wg_sample *wg_sample,
+ struct wg_sample_queue *queue)
+{
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
+ REFERENCE_TIME start_pts, end_pts;
+ HRESULT hr;
+
+ if (sample->type != WG_SAMPLE_TYPE_QZ)
+ return E_INVALIDARG;
+
+ hr = IMediaSample_GetTime(sample->u.qz.sample, &start_pts, &end_pts);
+ if (SUCCEEDED(hr))
+ {
+ wg_sample->pts = start_pts;
+ wg_sample->flags |= WG_SAMPLE_FLAG_HAS_PTS;
+ }
+ if (hr == S_OK)
+ {
+ wg_sample->duration = end_pts - start_pts;
+ wg_sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
+ }
+
+ if (IMediaSample_IsSyncPoint(sample->u.qz.sample) == S_OK)
+ wg_sample->flags |= WG_SAMPLE_FLAG_SYNC_POINT;
+
+ wg_sample_queue_begin_append(queue, wg_sample);
+ hr = wg_transform_push_data(transform, wg_sample);
+ wg_sample_queue_end_append(queue, wg_sample);
+
+ return hr;
+}
+
HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
struct wg_format *format)
{
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022
[PATCH 4/7] winegstreamer: Introduce new wg_sample_create_qz helper for quartz_transform.c.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/gst_private.h | 1 +
dlls/winegstreamer/quartz_transform.c | 40 +++++++++++++--------------
dlls/winegstreamer/wg_sample.c | 38 +++++++++++++++++++++++++
3 files changed, 59 insertions(+), 20 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h
index da76452fbf4..cc799b51090 100644
--- a/dlls/winegstreamer/gst_private.h
+++ b/dlls/winegstreamer/gst_private.h
@@ -127,6 +127,7 @@ IMFMediaType *mf_media_type_from_wg_format(const struct wg_format *format);
void mf_media_type_to_wg_format(IMFMediaType *type, struct wg_format *format);
HRESULT wg_sample_create_mf(IMFSample *sample, struct wg_sample **out);
+HRESULT wg_sample_create_qz(IMediaSample *sample, struct wg_sample **out);
void wg_sample_release(struct wg_sample *wg_sample);
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *sample,
diff --git a/dlls/winegstreamer/quartz_transform.c b/dlls/winegstreamer/quartz_transform.c
index b701b3f6369..715d7c2747b 100644
--- a/dlls/winegstreamer/quartz_transform.c
+++ b/dlls/winegstreamer/quartz_transform.c
@@ -290,7 +290,7 @@ static HRESULT transform_sink_query_interface(struct strmbase_pin *pin, REFIID i
static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSample *sample)
{
struct transform *filter = impl_from_strmbase_filter(pin->pin.filter);
- struct wg_sample input_wg_sample = {0};
+ struct wg_sample *wg_sample;
REFERENCE_TIME start_time;
REFERENCE_TIME end_time;
HRESULT hr;
@@ -311,50 +311,47 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
if (filter->sink.flushing)
return S_FALSE;
- input_wg_sample.max_size = IMediaSample_GetSize(sample);
- input_wg_sample.size = IMediaSample_GetActualDataLength(sample);
-
- hr = IMediaSample_GetPointer(sample, &input_wg_sample.data);
+ hr = wg_sample_create_qz(sample, &wg_sample);
if (FAILED(hr))
return hr;
hr = IMediaSample_GetTime(sample, &start_time, &end_time);
if (SUCCEEDED(hr))
{
- input_wg_sample.pts = start_time;
- input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
+ wg_sample->pts = start_time;
+ wg_sample->flags |= WG_SAMPLE_FLAG_HAS_PTS;
}
if (hr == S_OK)
{
- input_wg_sample.duration = end_time - start_time;
- input_wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
+ wg_sample->duration = end_time - start_time;
+ wg_sample->flags |= WG_SAMPLE_FLAG_HAS_DURATION;
}
- hr = wg_transform_push_data(filter->transform, &input_wg_sample);
+ hr = wg_transform_push_data(filter->transform, wg_sample);
+ wg_sample_release(wg_sample);
+
if (FAILED(hr))
return hr;
for (;;)
{
- struct wg_sample output_wg_sample = {0};
IMediaSample *output_sample;
hr = IMemAllocator_GetBuffer(filter->source.pAllocator, &output_sample, NULL, NULL, 0);
if (FAILED(hr))
return hr;
- output_wg_sample.max_size = IMediaSample_GetSize(output_sample);
-
- hr = IMediaSample_GetPointer(output_sample, &output_wg_sample.data);
+ hr = wg_sample_create_qz(output_sample, &wg_sample);
if (FAILED(hr))
{
IMediaSample_Release(output_sample);
return hr;
}
- hr = wg_transform_read_data(filter->transform, &output_wg_sample, NULL);
+ hr = wg_transform_read_data(filter->transform, wg_sample, NULL);
if (hr == MF_E_TRANSFORM_NEED_MORE_INPUT)
{
+ wg_sample_release(wg_sample);
IMediaSample_Release(output_sample);
break;
}
@@ -362,23 +359,25 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
{
if (hr == MF_E_TRANSFORM_STREAM_CHANGE)
FIXME("Unexpected stream format change!\n");
+ wg_sample_release(wg_sample);
IMediaSample_Release(output_sample);
return hr;
}
- hr = IMediaSample_SetActualDataLength(output_sample, output_wg_sample.size);
+ hr = IMediaSample_SetActualDataLength(output_sample, wg_sample->size);
if (FAILED(hr))
{
+ wg_sample_release(wg_sample);
IMediaSample_Release(output_sample);
return hr;
}
- if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_PTS)
+ if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS)
{
- start_time = output_wg_sample.pts;
- if (output_wg_sample.flags & WG_SAMPLE_FLAG_HAS_DURATION)
+ start_time = wg_sample->pts;
+ if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
{
- end_time = start_time + output_wg_sample.duration;
+ end_time = start_time + wg_sample->duration;
IMediaSample_SetTime(output_sample, &start_time, &end_time);
}
else
@@ -386,6 +385,7 @@ static HRESULT WINAPI transform_sink_receive(struct strmbase_sink *pin, IMediaSa
IMediaSample_SetTime(output_sample, &start_time, NULL);
}
}
+ wg_sample_release(wg_sample);
hr = IMemInputPin_Receive(filter->source.pMemInputPin, output_sample);
if (FAILED(hr))
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 017ec706f50..40af112db39 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -25,6 +25,7 @@
#include "wine/list.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
+WINE_DECLARE_DEBUG_CHANNEL(quartz);
struct wg_sample_queue
{
@@ -40,6 +41,7 @@ struct sample
enum wg_sample_type
{
WG_SAMPLE_TYPE_MF = 1,
+ WG_SAMPLE_TYPE_QZ = 2,
} type;
union
@@ -49,6 +51,10 @@ struct sample
IMFSample *sample;
IMFMediaBuffer *buffer;
} mf;
+ struct
+ {
+ IMediaSample *sample;
+ } qz;
} u;
};
@@ -83,6 +89,32 @@ fail:
return hr;
}
+HRESULT wg_sample_create_qz(IMediaSample *qz_sample, struct wg_sample **out)
+{
+ DWORD current_length, max_length;
+ struct sample *sample;
+ BYTE *buffer;
+ HRESULT hr;
+
+ if (FAILED(hr = IMediaSample_GetPointer(qz_sample, &buffer)))
+ return hr;
+ current_length = IMediaSample_GetActualDataLength(qz_sample);
+ max_length = IMediaSample_GetSize(qz_sample);
+
+ if (!(sample = calloc(1, sizeof(*sample))))
+ return E_OUTOFMEMORY;
+
+ IMediaSample_AddRef((sample->u.qz.sample = qz_sample));
+ sample->wg_sample.data = buffer;
+ sample->wg_sample.size = current_length;
+ sample->wg_sample.max_size = max_length;
+ sample->type = WG_SAMPLE_TYPE_QZ;
+
+ TRACE_(quartz)("Created wg_sample %p for sample %p.\n", &sample->wg_sample, qz_sample);
+ *out = &sample->wg_sample;
+ return S_OK;
+}
+
void wg_sample_release(struct wg_sample *wg_sample)
{
struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
@@ -103,6 +135,12 @@ void wg_sample_release(struct wg_sample *wg_sample)
IMFSample_Release(sample->u.mf.sample);
break;
+ case WG_SAMPLE_TYPE_QZ:
+ TRACE_(quartz)("wg_sample %p\n", wg_sample);
+
+ IMediaSample_Release(sample->u.qz.sample);
+ break;
+
default:
FIXME("Unknown wg_sample %p, type %u\n", wg_sample, sample->type);
break;
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022
[PATCH 3/7] winegstreamer: Use a union in struct sample to keep API pointers.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/wg_sample.c | 64 +++++++++++++++++++++++++---------
1 file changed, 47 insertions(+), 17 deletions(-)
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index b7fd9a002a5..017ec706f50 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -34,10 +34,22 @@ struct wg_sample_queue
struct sample
{
- IMFSample *sample;
- IMFMediaBuffer *media_buffer;
struct wg_sample wg_sample;
struct list entry;
+
+ enum wg_sample_type
+ {
+ WG_SAMPLE_TYPE_MF = 1,
+ } type;
+
+ union
+ {
+ struct
+ {
+ IMFSample *sample;
+ IMFMediaBuffer *buffer;
+ } mf;
+ } u;
};
HRESULT wg_sample_create_mf(IMFSample *mf_sample, struct wg_sample **out)
@@ -49,23 +61,24 @@ HRESULT wg_sample_create_mf(IMFSample *mf_sample, struct wg_sample **out)
if (!(sample = calloc(1, sizeof(*sample))))
return E_OUTOFMEMORY;
- if (FAILED(hr = IMFSample_ConvertToContiguousBuffer(mf_sample, &sample->media_buffer)))
+ if (FAILED(hr = IMFSample_ConvertToContiguousBuffer(mf_sample, &sample->u.mf.buffer)))
goto fail;
- if (FAILED(hr = IMFMediaBuffer_Lock(sample->media_buffer, &buffer, &max_length, ¤t_length)))
+ if (FAILED(hr = IMFMediaBuffer_Lock(sample->u.mf.buffer, &buffer, &max_length, ¤t_length)))
goto fail;
- IMFSample_AddRef((sample->sample = mf_sample));
+ IMFSample_AddRef((sample->u.mf.sample = mf_sample));
sample->wg_sample.data = buffer;
sample->wg_sample.size = current_length;
sample->wg_sample.max_size = max_length;
+ sample->type = WG_SAMPLE_TYPE_MF;
*out = &sample->wg_sample;
TRACE("Created wg_sample %p for MF sample %p.\n", *out, mf_sample);
return S_OK;
fail:
- if (sample->media_buffer)
- IMFMediaBuffer_Release(sample->media_buffer);
+ if (sample->u.mf.buffer)
+ IMFMediaBuffer_Release(sample->u.mf.buffer);
free(sample);
return hr;
}
@@ -80,9 +93,20 @@ void wg_sample_release(struct wg_sample *wg_sample)
return;
}
- IMFMediaBuffer_Unlock(sample->media_buffer);
- IMFMediaBuffer_Release(sample->media_buffer);
- IMFSample_Release(sample->sample);
+ switch (sample->type)
+ {
+ case WG_SAMPLE_TYPE_MF:
+ TRACE("wg_sample %p\n", wg_sample);
+
+ IMFMediaBuffer_Unlock(sample->u.mf.buffer);
+ IMFMediaBuffer_Release(sample->u.mf.buffer);
+ IMFSample_Release(sample->u.mf.sample);
+ break;
+
+ default:
+ FIXME("Unknown wg_sample %p, type %u\n", wg_sample, sample->type);
+ break;
+ }
free(sample);
}
@@ -161,17 +185,20 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *w
UINT32 value;
HRESULT hr;
- if (SUCCEEDED(IMFSample_GetSampleTime(sample->sample, &time)))
+ if (sample->type != WG_SAMPLE_TYPE_MF)
+ return E_INVALIDARG;
+
+ if (SUCCEEDED(IMFSample_GetSampleTime(sample->u.mf.sample, &time)))
{
sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
sample->wg_sample.pts = time;
}
- if (SUCCEEDED(IMFSample_GetSampleDuration(sample->sample, &duration)))
+ if (SUCCEEDED(IMFSample_GetSampleDuration(sample->u.mf.sample, &duration)))
{
sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
sample->wg_sample.duration = duration;
}
- if (SUCCEEDED(IMFSample_GetUINT32(sample->sample, &MFSampleExtension_CleanPoint, &value)) && value)
+ if (SUCCEEDED(IMFSample_GetUINT32(sample->u.mf.sample, &MFSampleExtension_CleanPoint, &value)) && value)
sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
wg_sample_queue_begin_append(queue, wg_sample);
@@ -187,17 +214,20 @@ HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *w
struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
HRESULT hr;
+ if (sample->type != WG_SAMPLE_TYPE_MF)
+ return E_INVALIDARG;
+
if (FAILED(hr = wg_transform_read_data(transform, wg_sample, format)))
return hr;
- IMFMediaBuffer_SetCurrentLength(sample->media_buffer, wg_sample->size);
+ IMFMediaBuffer_SetCurrentLength(sample->u.mf.buffer, wg_sample->size);
if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS)
- IMFSample_SetSampleTime(sample->sample, wg_sample->pts);
+ IMFSample_SetSampleTime(sample->u.mf.sample, wg_sample->pts);
if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
- IMFSample_SetSampleDuration(sample->sample, wg_sample->duration);
+ IMFSample_SetSampleDuration(sample->u.mf.sample, wg_sample->duration);
if (wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT)
- IMFSample_SetUINT32(sample->sample, &MFSampleExtension_CleanPoint, 1);
+ IMFSample_SetUINT32(sample->u.mf.sample, &MFSampleExtension_CleanPoint, 1);
return S_OK;
}
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022
[PATCH 2/7] winegstreamer: Rename struct mf_sample to struct sample.
by Rémi Bernon
From: Rémi Bernon <rbernon(a)codeweavers.com>
Signed-off-by: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/winegstreamer/wg_sample.c | 94 +++++++++++++++++-----------------
1 file changed, 47 insertions(+), 47 deletions(-)
diff --git a/dlls/winegstreamer/wg_sample.c b/dlls/winegstreamer/wg_sample.c
index 8879de6c232..b7fd9a002a5 100644
--- a/dlls/winegstreamer/wg_sample.c
+++ b/dlls/winegstreamer/wg_sample.c
@@ -32,7 +32,7 @@ struct wg_sample_queue
struct list samples;
};
-struct mf_sample
+struct sample
{
IMFSample *sample;
IMFMediaBuffer *media_buffer;
@@ -40,39 +40,39 @@ struct mf_sample
struct list entry;
};
-HRESULT wg_sample_create_mf(IMFSample *sample, struct wg_sample **out)
+HRESULT wg_sample_create_mf(IMFSample *mf_sample, struct wg_sample **out)
{
DWORD current_length, max_length;
- struct mf_sample *mf_sample;
+ struct sample *sample;
BYTE *buffer;
HRESULT hr;
- if (!(mf_sample = calloc(1, sizeof(*mf_sample))))
+ if (!(sample = calloc(1, sizeof(*sample))))
return E_OUTOFMEMORY;
- if (FAILED(hr = IMFSample_ConvertToContiguousBuffer(sample, &mf_sample->media_buffer)))
- goto out;
- if (FAILED(hr = IMFMediaBuffer_Lock(mf_sample->media_buffer, &buffer, &max_length, ¤t_length)))
- goto out;
-
- IMFSample_AddRef((mf_sample->sample = sample));
- mf_sample->wg_sample.data = buffer;
- mf_sample->wg_sample.size = current_length;
- mf_sample->wg_sample.max_size = max_length;
-
- TRACE("Created mf_sample %p for sample %p.\n", mf_sample, sample);
- *out = &mf_sample->wg_sample;
+ if (FAILED(hr = IMFSample_ConvertToContiguousBuffer(mf_sample, &sample->media_buffer)))
+ goto fail;
+ if (FAILED(hr = IMFMediaBuffer_Lock(sample->media_buffer, &buffer, &max_length, ¤t_length)))
+ goto fail;
+
+ IMFSample_AddRef((sample->sample = mf_sample));
+ sample->wg_sample.data = buffer;
+ sample->wg_sample.size = current_length;
+ sample->wg_sample.max_size = max_length;
+
+ *out = &sample->wg_sample;
+ TRACE("Created wg_sample %p for MF sample %p.\n", *out, mf_sample);
return S_OK;
-out:
- if (mf_sample->media_buffer)
- IMFMediaBuffer_Release(mf_sample->media_buffer);
- free(mf_sample);
+fail:
+ if (sample->media_buffer)
+ IMFMediaBuffer_Release(sample->media_buffer);
+ free(sample);
return hr;
}
void wg_sample_release(struct wg_sample *wg_sample)
{
- struct mf_sample *mf_sample = CONTAINING_RECORD(wg_sample, struct mf_sample, wg_sample);
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
if (InterlockedOr(&wg_sample->refcount, 0))
{
@@ -80,23 +80,23 @@ void wg_sample_release(struct wg_sample *wg_sample)
return;
}
- IMFMediaBuffer_Unlock(mf_sample->media_buffer);
- IMFMediaBuffer_Release(mf_sample->media_buffer);
- IMFSample_Release(mf_sample->sample);
+ IMFMediaBuffer_Unlock(sample->media_buffer);
+ IMFMediaBuffer_Release(sample->media_buffer);
+ IMFSample_Release(sample->sample);
- free(mf_sample);
+ free(sample);
}
static void wg_sample_queue_begin_append(struct wg_sample_queue *queue, struct wg_sample *wg_sample)
{
- struct mf_sample *mf_sample = CONTAINING_RECORD(wg_sample, struct mf_sample, wg_sample);
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
/* make sure a concurrent wg_sample_queue_flush call won't release the sample until we're done */
InterlockedIncrement(&wg_sample->refcount);
- mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_REFCOUNT;
+ sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_REFCOUNT;
EnterCriticalSection(&queue->cs);
- list_add_tail(&queue->samples, &mf_sample->entry);
+ list_add_tail(&queue->samples, &sample->entry);
LeaveCriticalSection(&queue->cs);
}
@@ -110,16 +110,16 @@ static void wg_sample_queue_end_append(struct wg_sample_queue *queue, struct wg_
void wg_sample_queue_flush(struct wg_sample_queue *queue, bool all)
{
- struct mf_sample *mf_sample, *next;
+ struct sample *sample, *next;
EnterCriticalSection(&queue->cs);
- LIST_FOR_EACH_ENTRY_SAFE(mf_sample, next, &queue->samples, struct mf_sample, entry)
+ LIST_FOR_EACH_ENTRY_SAFE(sample, next, &queue->samples, struct sample, entry)
{
- if (!InterlockedOr(&mf_sample->wg_sample.refcount, 0) || all)
+ if (!InterlockedOr(&sample->wg_sample.refcount, 0) || all)
{
- list_remove(&mf_sample->entry);
- wg_sample_release(&mf_sample->wg_sample);
+ list_remove(&sample->entry);
+ wg_sample_release(&sample->wg_sample);
}
}
@@ -156,23 +156,23 @@ void wg_sample_queue_destroy(struct wg_sample_queue *queue)
HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
struct wg_sample_queue *queue)
{
- struct mf_sample *mf_sample = CONTAINING_RECORD(wg_sample, struct mf_sample, wg_sample);
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
LONGLONG time, duration;
UINT32 value;
HRESULT hr;
- if (SUCCEEDED(IMFSample_GetSampleTime(mf_sample->sample, &time)))
+ if (SUCCEEDED(IMFSample_GetSampleTime(sample->sample, &time)))
{
- mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
- mf_sample->wg_sample.pts = time;
+ sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_PTS;
+ sample->wg_sample.pts = time;
}
- if (SUCCEEDED(IMFSample_GetSampleDuration(mf_sample->sample, &duration)))
+ if (SUCCEEDED(IMFSample_GetSampleDuration(sample->sample, &duration)))
{
- mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
- mf_sample->wg_sample.duration = duration;
+ sample->wg_sample.flags |= WG_SAMPLE_FLAG_HAS_DURATION;
+ sample->wg_sample.duration = duration;
}
- if (SUCCEEDED(IMFSample_GetUINT32(mf_sample->sample, &MFSampleExtension_CleanPoint, &value)) && value)
- mf_sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
+ if (SUCCEEDED(IMFSample_GetUINT32(sample->sample, &MFSampleExtension_CleanPoint, &value)) && value)
+ sample->wg_sample.flags |= WG_SAMPLE_FLAG_SYNC_POINT;
wg_sample_queue_begin_append(queue, wg_sample);
hr = wg_transform_push_data(transform, wg_sample);
@@ -184,20 +184,20 @@ HRESULT wg_transform_push_mf(struct wg_transform *transform, struct wg_sample *w
HRESULT wg_transform_read_mf(struct wg_transform *transform, struct wg_sample *wg_sample,
struct wg_format *format)
{
- struct mf_sample *mf_sample = CONTAINING_RECORD(wg_sample, struct mf_sample, wg_sample);
+ struct sample *sample = CONTAINING_RECORD(wg_sample, struct sample, wg_sample);
HRESULT hr;
if (FAILED(hr = wg_transform_read_data(transform, wg_sample, format)))
return hr;
- IMFMediaBuffer_SetCurrentLength(mf_sample->media_buffer, wg_sample->size);
+ IMFMediaBuffer_SetCurrentLength(sample->media_buffer, wg_sample->size);
if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_PTS)
- IMFSample_SetSampleTime(mf_sample->sample, wg_sample->pts);
+ IMFSample_SetSampleTime(sample->sample, wg_sample->pts);
if (wg_sample->flags & WG_SAMPLE_FLAG_HAS_DURATION)
- IMFSample_SetSampleDuration(mf_sample->sample, wg_sample->duration);
+ IMFSample_SetSampleDuration(sample->sample, wg_sample->duration);
if (wg_sample->flags & WG_SAMPLE_FLAG_SYNC_POINT)
- IMFSample_SetUINT32(mf_sample->sample, &MFSampleExtension_CleanPoint, 1);
+ IMFSample_SetUINT32(sample->sample, &MFSampleExtension_CleanPoint, 1);
return S_OK;
}
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/220
June 10, 2022