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
3a603357
Commit
3a603357
authored
Jun 01, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 16, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Introduce new init_video_media_types helper.
parent
b0ecfc96
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
54 additions
and
41 deletions
+54
-41
media_source.c
dlls/winegstreamer/media_source.c
+54
-41
No files found.
dlls/winegstreamer/media_source.c
View file @
3a603357
...
...
@@ -319,6 +319,58 @@ static HRESULT stream_descriptor_set_tag(IMFStreamDescriptor *descriptor, struct
return
hr
;
}
static
HRESULT
init_video_media_types
(
struct
wg_format
*
format
,
IMFMediaType
*
types
[
6
],
DWORD
*
types_count
)
{
/* Try to prefer YUV formats over RGB ones. Most decoders output in the
* YUV color space, and it's generally much less expensive for
* videoconvert to do YUV -> YUV transformations. */
static
const
enum
wg_video_format
video_formats
[]
=
{
WG_VIDEO_FORMAT_NV12
,
WG_VIDEO_FORMAT_YV12
,
WG_VIDEO_FORMAT_YUY2
,
WG_VIDEO_FORMAT_I420
,
};
UINT
count
=
*
types_count
,
i
;
GUID
base_subtype
;
HRESULT
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_GetGUID
(
types
[
0
],
&
MF_MT_SUBTYPE
,
&
base_subtype
)))
return
hr
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
video_formats
);
++
i
)
{
struct
wg_format
new_format
=
*
format
;
IMFMediaType
*
new_type
;
new_format
.
u
.
video
.
format
=
video_formats
[
i
];
if
(
!
(
new_type
=
mf_media_type_from_wg_format
(
&
new_format
)))
{
hr
=
E_OUTOFMEMORY
;
goto
done
;
}
types
[
count
++
]
=
new_type
;
if
(
video_formats
[
i
]
==
WG_VIDEO_FORMAT_I420
)
{
IMFMediaType
*
iyuv_type
;
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
iyuv_type
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_CopyAllItems
(
new_type
,
(
IMFAttributes
*
)
iyuv_type
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
iyuv_type
,
&
MF_MT_SUBTYPE
,
&
MFVideoFormat_IYUV
)))
goto
done
;
types
[
count
++
]
=
iyuv_type
;
}
}
done:
*
types_count
=
count
;
return
hr
;
}
static
BOOL
enqueue_token
(
struct
media_stream
*
stream
,
IUnknown
*
token
)
{
if
(
stream
->
token_queue_count
==
stream
->
token_queue_cap
)
...
...
@@ -931,47 +983,8 @@ static HRESULT media_stream_init_desc(struct media_stream *stream)
if
(
format
.
major_type
==
WG_MAJOR_TYPE_VIDEO
)
{
/* Try to prefer YUV formats over RGB ones. Most decoders output in the
* YUV color space, and it's generally much less expensive for
* videoconvert to do YUV -> YUV transformations. */
static
const
enum
wg_video_format
video_formats
[]
=
{
WG_VIDEO_FORMAT_NV12
,
WG_VIDEO_FORMAT_YV12
,
WG_VIDEO_FORMAT_YUY2
,
WG_VIDEO_FORMAT_I420
,
};
GUID
base_subtype
;
IMFMediaType_GetGUID
(
stream_types
[
0
],
&
MF_MT_SUBTYPE
,
&
base_subtype
);
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
video_formats
);
++
i
)
{
struct
wg_format
new_format
=
format
;
IMFMediaType
*
new_type
;
new_format
.
u
.
video
.
format
=
video_formats
[
i
];
if
(
!
(
new_type
=
mf_media_type_from_wg_format
(
&
new_format
)))
{
hr
=
E_OUTOFMEMORY
;
goto
done
;
}
stream_types
[
type_count
++
]
=
new_type
;
if
(
video_formats
[
i
]
==
WG_VIDEO_FORMAT_I420
)
{
IMFMediaType
*
iyuv_type
;
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
iyuv_type
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_CopyAllItems
(
new_type
,
(
IMFAttributes
*
)
iyuv_type
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
iyuv_type
,
&
MF_MT_SUBTYPE
,
&
MFVideoFormat_IYUV
)))
goto
done
;
stream_types
[
type_count
++
]
=
iyuv_type
;
}
}
if
(
FAILED
(
hr
=
init_video_media_types
(
&
format
,
stream_types
,
&
type_count
)))
goto
done
;
}
else
if
(
format
.
major_type
==
WG_MAJOR_TYPE_AUDIO
)
{
...
...
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