Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
ac4a2c4c
Commit
ac4a2c4c
authored
May 09, 2023
by
Paul Gofman
Committed by
Alexandre Julliard
Oct 31, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat/sample: Refactor sample_CopyToBuffer().
parent
b7fe6359
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
23 deletions
+29
-23
sample.c
dlls/mfplat/sample.c
+29
-23
No files found.
dlls/mfplat/sample.c
View file @
ac4a2c4c
...
...
@@ -810,36 +810,42 @@ static HRESULT WINAPI sample_CopyToBuffer(IMFSample *iface, IMFMediaBuffer *buff
dst_ptr
=
NULL
;
dst_length
=
current_length
=
0
;
locked
=
SUCCEEDED
(
hr
=
IMFMediaBuffer_Lock
(
buffer
,
&
dst_ptr
,
&
dst_length
,
&
current_length
));
if
(
locked
)
if
(
!
locked
)
goto
done
;
if
(
dst_length
<
total_length
)
{
if
(
dst_length
<
total_length
)
hr
=
MF_E_BUFFERTOOSMALL
;
else
if
(
dst_ptr
)
hr
=
MF_E_BUFFERTOOSMALL
;
goto
done
;
}
if
(
!
dst_ptr
)
goto
done
;
for
(
i
=
0
;
i
<
sample
->
buffer_count
&&
SUCCEEDED
(
hr
);
++
i
)
{
src_ptr
=
NULL
;
src_max_length
=
current_length
=
0
;
if
(
FAILED
(
hr
=
IMFMediaBuffer_Lock
(
sample
->
buffers
[
i
],
&
src_ptr
,
&
src_max_length
,
&
current_length
)))
continue
;
if
(
src_ptr
)
{
for
(
i
=
0
;
i
<
sample
->
buffer_count
&&
SUCCEEDED
(
hr
);
++
i
)
if
(
current_length
>
dst_length
)
hr
=
MF_E_BUFFERTOOSMALL
;
else
if
(
current_length
)
{
src_ptr
=
NULL
;
src_max_length
=
current_length
=
0
;
if
(
SUCCEEDED
(
hr
=
IMFMediaBuffer_Lock
(
sample
->
buffers
[
i
],
&
src_ptr
,
&
src_max_length
,
&
current_length
)))
{
if
(
src_ptr
)
{
if
(
current_length
>
dst_length
)
hr
=
MF_E_BUFFERTOOSMALL
;
else
if
(
current_length
)
{
memcpy
(
dst_ptr
,
src_ptr
,
current_length
);
dst_length
-=
current_length
;
dst_current_length
+=
current_length
;
dst_ptr
+=
current_length
;
}
}
IMFMediaBuffer_Unlock
(
sample
->
buffers
[
i
]);
}
memcpy
(
dst_ptr
,
src_ptr
,
current_length
);
dst_length
-=
current_length
;
dst_current_length
+=
current_length
;
dst_ptr
+=
current_length
;
}
}
IMFMediaBuffer_Unlock
(
sample
->
buffers
[
i
]);
}
done:
IMFMediaBuffer_SetCurrentLength
(
buffer
,
dst_current_length
);
if
(
locked
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment