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
79b37c8a
Commit
79b37c8a
authored
Mar 19, 2019
by
Nikolay Sivov
Committed by
Alexandre Julliard
Mar 19, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfreadwrite: Determine first streams on reader creation.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
160b4093
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
0 deletions
+48
-0
main.c
dlls/mfreadwrite/main.c
+48
-0
No files found.
dlls/mfreadwrite/main.c
View file @
79b37c8a
...
...
@@ -30,6 +30,8 @@
#undef INITGUID
#include <guiddef.h>
#include "mfapi.h"
#include "mferror.h"
#include "mfidl.h"
#include "mfreadwrite.h"
...
...
@@ -77,6 +79,8 @@ typedef struct source_reader
LONG
refcount
;
IMFMediaSource
*
source
;
IMFPresentationDescriptor
*
descriptor
;
DWORD
first_audio_stream_index
;
DWORD
first_video_stream_index
;
}
srcreader
;
struct
sink_writer
...
...
@@ -374,6 +378,40 @@ struct IMFSourceReaderVtbl srcreader_vtbl =
src_reader_GetPresentationAttribute
};
static
DWORD
reader_get_first_stream_index
(
IMFPresentationDescriptor
*
descriptor
,
const
GUID
*
major
)
{
unsigned
int
count
,
i
;
BOOL
selected
;
HRESULT
hr
;
GUID
guid
;
if
(
FAILED
(
IMFPresentationDescriptor_GetStreamDescriptorCount
(
descriptor
,
&
count
)))
return
MF_SOURCE_READER_INVALID_STREAM_INDEX
;
for
(
i
=
0
;
i
<
count
;
++
i
)
{
IMFMediaTypeHandler
*
handler
;
IMFStreamDescriptor
*
sd
;
if
(
SUCCEEDED
(
IMFPresentationDescriptor_GetStreamDescriptorByIndex
(
descriptor
,
i
,
&
selected
,
&
sd
)))
{
hr
=
IMFStreamDescriptor_GetMediaTypeHandler
(
sd
,
&
handler
);
IMFStreamDescriptor_Release
(
sd
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
IMFMediaTypeHandler_GetMajorType
(
handler
,
&
guid
);
IMFMediaTypeHandler_Release
(
handler
);
if
(
SUCCEEDED
(
hr
)
&&
IsEqualGUID
(
&
guid
,
major
))
{
return
i
;
}
}
}
}
return
MF_SOURCE_READER_INVALID_STREAM_INDEX
;
}
static
HRESULT
create_source_reader_from_source
(
IMFMediaSource
*
source
,
IMFAttributes
*
attributes
,
REFIID
riid
,
void
**
out
)
{
...
...
@@ -393,6 +431,16 @@ static HRESULT create_source_reader_from_source(IMFMediaSource *source, IMFAttri
if
(
FAILED
(
hr
=
IMFMediaSource_CreatePresentationDescriptor
(
object
->
source
,
&
object
->
descriptor
)))
goto
failed
;
/* At least one major type has to be set. */
object
->
first_audio_stream_index
=
reader_get_first_stream_index
(
object
->
descriptor
,
&
MFMediaType_Audio
);
object
->
first_video_stream_index
=
reader_get_first_stream_index
(
object
->
descriptor
,
&
MFMediaType_Video
);
if
(
object
->
first_audio_stream_index
==
MF_SOURCE_READER_INVALID_STREAM_INDEX
&&
object
->
first_video_stream_index
==
MF_SOURCE_READER_INVALID_STREAM_INDEX
)
{
hr
=
MF_E_ATTRIBUTENOTFOUND
;
}
if
(
FAILED
(
hr
=
IMFMediaSource_BeginGetEvent
(
object
->
source
,
&
object
->
source_events_callback
,
(
IUnknown
*
)
object
->
source
)))
{
...
...
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