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
8946e6df
Commit
8946e6df
authored
Jan 23, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Feb 16, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfreadwrite/reader: Introduce a new source_reader_allocate_stream_sample helper.
parent
dd6e8198
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
23 deletions
+28
-23
reader.c
dlls/mfreadwrite/reader.c
+28
-23
No files found.
dlls/mfreadwrite/reader.c
View file @
8946e6df
...
...
@@ -655,42 +655,47 @@ static ULONG WINAPI source_reader_stream_events_callback_Release(IMFAsyncCallbac
return
source_reader_release
(
reader
);
}
static
HRESULT
source_reader_allocate_stream_sample
(
MFT_OUTPUT_STREAM_INFO
*
info
,
IMFSample
**
out
)
{
IMFMediaBuffer
*
buffer
;
IMFSample
*
sample
;
HRESULT
hr
;
*
out
=
NULL
;
if
(
FAILED
(
hr
=
MFCreateSample
(
&
sample
)))
return
hr
;
if
(
SUCCEEDED
(
hr
=
MFCreateAlignedMemoryBuffer
(
info
->
cbSize
,
info
->
cbAlignment
,
&
buffer
)))
{
if
(
SUCCEEDED
(
hr
=
IMFSample_AddBuffer
(
sample
,
buffer
)))
{
*
out
=
sample
;
IMFSample_AddRef
(
sample
);
}
IMFMediaBuffer_Release
(
buffer
);
}
IMFSample_Release
(
sample
);
return
hr
;
}
static
HRESULT
source_reader_pull_transform_samples
(
struct
source_reader
*
reader
,
struct
media_stream
*
stream
,
struct
transform_entry
*
entry
)
{
MFT_OUTPUT_STREAM_INFO
stream_info
=
{
0
};
MFT_OUTPUT_DATA_BUFFER
out_buffer
;
unsigned
int
buffer_size
;
IMFMediaBuffer
*
buffer
;
DWORD
status
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
IMFTransform_GetOutputStreamInfo
(
entry
->
transform
,
0
,
&
stream_info
)))
{
WARN
(
"Failed to get output stream info, hr %#lx.
\n
"
,
hr
);
return
hr
;
}
stream_info
.
cbSize
=
max
(
stream_info
.
cbSize
,
entry
->
min_buffer_size
);
for
(;;)
{
memset
(
&
out_buffer
,
0
,
sizeof
(
out_buffer
));
if
(
!
(
stream_info
.
dwFlags
&
(
MFT_OUTPUT_STREAM_PROVIDES_SAMPLES
|
MFT_OUTPUT_STREAM_CAN_PROVIDE_SAMPLES
)))
{
if
(
FAILED
(
hr
=
MFCreateSample
(
&
out_buffer
.
pSample
)))
break
;
MFT_OUTPUT_DATA_BUFFER
out_buffer
=
{
0
};
buffer_size
=
max
(
stream_info
.
cbSize
,
entry
->
min_buffer_size
);
if
(
FAILED
(
hr
=
MFCreateAlignedMemoryBuffer
(
buffer_size
,
stream_info
.
cbAlignment
,
&
buffer
)))
{
IMFSample_Release
(
out_buffer
.
pSample
);
break
;
}
IMFSample_AddBuffer
(
out_buffer
.
pSample
,
buffer
);
IMFMediaBuffer_Release
(
buffer
);
}
if
(
!
(
stream_info
.
dwFlags
&
(
MFT_OUTPUT_STREAM_PROVIDES_SAMPLES
|
MFT_OUTPUT_STREAM_CAN_PROVIDE_SAMPLES
))
&&
FAILED
(
hr
=
source_reader_allocate_stream_sample
(
&
stream_info
,
&
out_buffer
.
pSample
)))
break
;
if
(
FAILED
(
hr
=
IMFTransform_ProcessOutput
(
entry
->
transform
,
0
,
1
,
&
out_buffer
,
&
status
)))
{
...
...
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