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
4244b4b1
Commit
4244b4b1
authored
Aug 11, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Aug 11, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfreadwrite/writer: Create output stream if it wasn't provided.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
aaebf839
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
0 deletions
+26
-0
mfplat.c
dlls/mfreadwrite/tests/mfplat.c
+13
-0
writer.c
dlls/mfreadwrite/writer.c
+13
-0
No files found.
dlls/mfreadwrite/tests/mfplat.c
View file @
4244b4b1
...
...
@@ -1291,6 +1291,18 @@ done:
DestroyWindow
(
window
);
}
static
void
test_sink_writer
(
void
)
{
IMFSinkWriter
*
writer
;
HRESULT
hr
;
hr
=
MFCreateSinkWriterFromURL
(
NULL
,
NULL
,
NULL
,
NULL
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFCreateSinkWriterFromURL
(
NULL
,
NULL
,
NULL
,
&
writer
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
}
START_TEST
(
mfplat
)
{
HRESULT
hr
;
...
...
@@ -1304,6 +1316,7 @@ START_TEST(mfplat)
test_source_reader
();
test_source_reader_from_media_source
();
test_reader_d3d9
();
test_sink_writer
();
hr
=
MFShutdown
();
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
...
...
dlls/mfreadwrite/writer.c
View file @
4244b4b1
...
...
@@ -289,6 +289,9 @@ HRESULT create_sink_writer_from_url(const WCHAR *url, IMFByteStream *bytestream,
CLSID
clsid
;
HRESULT
hr
;
if
(
!
url
&&
!
bytestream
)
return
E_INVALIDARG
;
if
(
FAILED
(
hr
=
sink_writer_get_sink_factory_class
(
url
,
attributes
,
&
clsid
)))
return
hr
;
if
(
FAILED
(
hr
=
CoCreateInstance
(
&
clsid
,
NULL
,
CLSCTX_INPROC_SERVER
,
&
IID_IMFSinkClassFactory
,
(
void
**
)
&
factory
)))
...
...
@@ -297,8 +300,18 @@ HRESULT create_sink_writer_from_url(const WCHAR *url, IMFByteStream *bytestream,
return
hr
;
}
if
(
bytestream
)
IMFByteStream_AddRef
(
bytestream
);
else
if
(
FAILED
(
hr
=
MFCreateFile
(
MF_ACCESSMODE_WRITE
,
MF_OPENMODE_DELETE_IF_EXIST
,
0
,
url
,
&
bytestream
)))
{
WARN
(
"Failed to create output file stream, hr %#lx.
\n
"
,
hr
);
IMFSinkClassFactory_Release
(
factory
);
return
hr
;
}
hr
=
IMFSinkClassFactory_CreateMediaSink
(
factory
,
bytestream
,
NULL
,
NULL
,
&
sink
);
IMFSinkClassFactory_Release
(
factory
);
IMFByteStream_Release
(
bytestream
);
if
(
FAILED
(
hr
))
{
WARN
(
"Failed to create a sink, hr %#lx.
\n
"
,
hr
);
...
...
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