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
e497f0e8
Commit
e497f0e8
authored
Feb 17, 2024
by
Rémi Bernon
Committed by
Alexandre Julliard
Mar 15, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfplat/mediatype: Implement implicit MFInitMediaTypeFromVideoInfoHeader subtype.
parent
2692cd8b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
29 deletions
+36
-29
mediatype.c
dlls/mfplat/mediatype.c
+29
-8
mfplat.c
dlls/mfplat/tests/mfplat.c
+7
-21
No files found.
dlls/mfplat/mediatype.c
View file @
e497f0e8
...
@@ -2697,13 +2697,14 @@ struct uncompressed_video_format
...
@@ -2697,13 +2697,14 @@ struct uncompressed_video_format
static
int
__cdecl
uncompressed_video_format_compare
(
const
void
*
a
,
const
void
*
b
)
static
int
__cdecl
uncompressed_video_format_compare
(
const
void
*
a
,
const
void
*
b
)
{
{
const
GUID
*
guid
=
a
;
const
struct
uncompressed_video_format
*
a_format
=
a
,
*
b_format
=
b
;
const
struct
uncompressed_video_format
*
format
=
b
;
return
memcmp
(
a_format
->
subtype
,
b_format
->
subtype
,
sizeof
(
GUID
));
return
memcmp
(
guid
,
format
->
subtype
,
sizeof
(
*
guid
));
}
}
static
const
struct
uncompressed_video_format
video_formats
[]
=
static
struct
uncompressed_video_format
video_formats
[]
=
{
{
{
&
MFVideoFormat_RGB1
,
1
,
0
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_RGB4
,
4
,
0
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_RGB24
,
24
,
3
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_RGB24
,
24
,
3
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_ARGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_ARGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_RGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
{
&
MFVideoFormat_RGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
...
@@ -2736,14 +2737,26 @@ static const struct uncompressed_video_format video_formats[] =
...
@@ -2736,14 +2737,26 @@ static const struct uncompressed_video_format video_formats[] =
{
&
MEDIASUBTYPE_RGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
{
&
MEDIASUBTYPE_RGB32
,
32
,
3
,
1
,
0
,
BI_RGB
},
};
};
static
BOOL
WINAPI
mf_video_formats_init
(
INIT_ONCE
*
once
,
void
*
param
,
void
**
context
)
{
qsort
(
video_formats
,
ARRAY_SIZE
(
video_formats
),
sizeof
(
*
video_formats
),
uncompressed_video_format_compare
);
return
TRUE
;
}
static
struct
uncompressed_video_format
*
mf_get_video_format
(
const
GUID
*
subtype
)
static
struct
uncompressed_video_format
*
mf_get_video_format
(
const
GUID
*
subtype
)
{
{
return
bsearch
(
subtype
,
video_formats
,
ARRAY_SIZE
(
video_formats
),
sizeof
(
*
video_formats
),
static
INIT_ONCE
init_once
=
INIT_ONCE_STATIC_INIT
;
struct
uncompressed_video_format
key
=
{.
subtype
=
subtype
};
InitOnceExecuteOnce
(
&
init_once
,
mf_video_formats_init
,
NULL
,
NULL
);
return
bsearch
(
&
key
,
video_formats
,
ARRAY_SIZE
(
video_formats
),
sizeof
(
*
video_formats
),
uncompressed_video_format_compare
);
uncompressed_video_format_compare
);
}
}
static
unsigned
int
mf_get_stride_for_format
(
const
struct
uncompressed_video_format
*
format
,
unsigned
int
width
)
static
unsigned
int
mf_get_stride_for_format
(
const
struct
uncompressed_video_format
*
format
,
unsigned
int
width
)
{
{
if
(
format
->
bpp
<
8
)
return
(
width
*
format
->
bpp
)
/
8
;
return
(
width
*
(
format
->
bpp
/
8
)
+
format
->
alignment
)
&
~
format
->
alignment
;
return
(
width
*
(
format
->
bpp
/
8
)
+
format
->
alignment
)
&
~
format
->
alignment
;
}
}
...
@@ -3743,14 +3756,22 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader(IMFMediaType *media_type, cons
...
@@ -3743,14 +3756,22 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader(IMFMediaType *media_type, cons
DWORD
height
;
DWORD
height
;
LONG
stride
;
LONG
stride
;
FIXM
E
(
"%p, %p, %u, %s.
\n
"
,
media_type
,
vih
,
size
,
debugstr_guid
(
subtype
));
TRAC
E
(
"%p, %p, %u, %s.
\n
"
,
media_type
,
vih
,
size
,
debugstr_guid
(
subtype
));
IMFMediaType_DeleteAllItems
(
media_type
);
IMFMediaType_DeleteAllItems
(
media_type
);
if
(
!
subtype
)
if
(
!
subtype
)
{
{
FIXME
(
"Implicit subtype is not supported.
\n
"
);
switch
(
vih
->
bmiHeader
.
biBitCount
)
return
E_NOTIMPL
;
{
case
1
:
subtype
=
&
MFVideoFormat_RGB1
;
break
;
case
4
:
subtype
=
&
MFVideoFormat_RGB4
;
break
;
case
8
:
subtype
=
&
MFVideoFormat_RGB8
;
break
;
case
16
:
subtype
=
&
MFVideoFormat_RGB555
;
break
;
case
24
:
subtype
=
&
MFVideoFormat_RGB24
;
break
;
case
32
:
subtype
=
&
MFVideoFormat_RGB32
;
break
;
default:
return
E_INVALIDARG
;
}
}
}
height
=
abs
(
vih
->
bmiHeader
.
biHeight
);
height
=
abs
(
vih
->
bmiHeader
.
biHeight
);
...
...
dlls/mfplat/tests/mfplat.c
View file @
e497f0e8
...
@@ -9854,10 +9854,8 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
...
@@ -9854,10 +9854,8 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
memset
(
&
vih
,
0
,
sizeof
(
vih
));
memset
(
&
vih
,
0
,
sizeof
(
vih
));
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
0
,
NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
0
,
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
&
GUID_NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
&
GUID_NULL
);
...
@@ -9974,7 +9972,6 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
...
@@ -9974,7 +9972,6 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
/* biBitCount is used for implicit RGB format if GUID is NULL */
/* biBitCount is used for implicit RGB format if GUID is NULL */
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
for
(
vih
.
bmiHeader
.
biBitCount
=
1
;
vih
.
bmiHeader
.
biBitCount
<=
32
;
vih
.
bmiHeader
.
biBitCount
++
)
for
(
vih
.
bmiHeader
.
biBitCount
=
1
;
vih
.
bmiHeader
.
biBitCount
<=
32
;
vih
.
bmiHeader
.
biBitCount
++
)
...
@@ -9984,35 +9981,31 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
...
@@ -9984,35 +9981,31 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
if
(
vih
.
bmiHeader
.
biBitCount
!=
1
&&
vih
.
bmiHeader
.
biBitCount
!=
4
&&
vih
.
bmiHeader
.
biBitCount
!=
8
if
(
vih
.
bmiHeader
.
biBitCount
!=
1
&&
vih
.
bmiHeader
.
biBitCount
!=
4
&&
vih
.
bmiHeader
.
biBitCount
!=
8
&&
vih
.
bmiHeader
.
biBitCount
!=
16
&&
vih
.
bmiHeader
.
biBitCount
!=
24
&&
vih
.
bmiHeader
.
biBitCount
!=
32
)
&&
vih
.
bmiHeader
.
biBitCount
!=
16
&&
vih
.
bmiHeader
.
biBitCount
!=
24
&&
vih
.
bmiHeader
.
biBitCount
!=
32
)
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#lx.
\n
"
,
hr
);
else
else
{
{
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
memset
(
&
guid
,
0xcd
,
sizeof
(
guid
));
memset
(
&
guid
,
0xcd
,
sizeof
(
guid
));
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
hr
=
IMFMediaType_GetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
&
guid
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
vih
.
bmiHeader
.
biBitCount
==
32
)
if
(
vih
.
bmiHeader
.
biBitCount
==
32
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB32
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
else
if
(
vih
.
bmiHeader
.
biBitCount
==
24
)
else
if
(
vih
.
bmiHeader
.
biBitCount
==
24
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB24
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB24
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
else
if
(
vih
.
bmiHeader
.
biBitCount
==
16
)
else
if
(
vih
.
bmiHeader
.
biBitCount
==
16
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB555
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB555
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
else
if
(
vih
.
bmiHeader
.
biBitCount
==
8
)
else
if
(
vih
.
bmiHeader
.
biBitCount
==
8
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB8
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB8
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
else
if
(
vih
.
bmiHeader
.
biBitCount
==
4
)
else
if
(
vih
.
bmiHeader
.
biBitCount
==
4
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB4
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB4
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
else
if
(
vih
.
bmiHeader
.
biBitCount
==
1
)
else
if
(
vih
.
bmiHeader
.
biBitCount
==
1
)
todo_wine
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB1
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
ok
(
IsEqualGUID
(
&
guid
,
&
MFVideoFormat_RGB1
),
"Unexpected guid %s.
\n
"
,
debugstr_guid
(
&
guid
));
value32
=
0xdeadbeef
;
value32
=
0xdeadbeef
;
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
vih
.
bmiHeader
.
biBitCount
>
1
)
if
(
vih
.
bmiHeader
.
biBitCount
>
1
)
todo_wine
ok
(
value32
==
16
*
vih
.
bmiHeader
.
biBitCount
/
8
,
"Unexpected value %#x.
\n
"
,
value32
);
ok
(
value32
==
16
*
vih
.
bmiHeader
.
biBitCount
/
8
,
"Unexpected value %#x.
\n
"
,
value32
);
else
else
todo_wine
ok
(
value32
==
-
4
,
"Unexpected value %#x.
\n
"
,
value32
);
todo_wine
ok
(
value32
==
-
4
,
"Unexpected value %#x.
\n
"
,
value32
);
...
@@ -10025,27 +10018,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
...
@@ -10025,27 +10018,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
value32
=
0xdeadbeef
;
value32
=
0xdeadbeef
;
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
&
value32
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
value32
==
1
,
"Unexpected value %#x.
\n
"
,
value32
);
ok
(
value32
==
1
,
"Unexpected value %#x.
\n
"
,
value32
);
value32
=
0xdeadbeef
;
value32
=
0xdeadbeef
;
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
&
value32
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
todo_wine
ok
(
value32
==
1
,
"Unexpected value %#x.
\n
"
,
value32
);
ok
(
value32
==
1
,
"Unexpected value %#x.
\n
"
,
value32
);
value32
=
0xdeadbeef
;
value32
=
0xdeadbeef
;
vih
.
bmiHeader
.
biHeight
=
32
;
vih
.
bmiHeader
.
biHeight
=
32
;
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
hr
=
MFInitMediaTypeFromVideoInfoHeader
(
media_type
,
&
vih
,
sizeof
(
vih
),
NULL
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
hr
=
IMFMediaType_GetUINT32
(
media_type
,
&
MF_MT_DEFAULT_STRIDE
,
&
value32
);
todo_wine
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#lx.
\n
"
,
hr
);
if
(
vih
.
bmiHeader
.
biBitCount
>
1
)
if
(
vih
.
bmiHeader
.
biBitCount
>
1
)
todo_wine
ok
(
value32
==
-
16
*
vih
.
bmiHeader
.
biBitCount
/
8
,
"Unexpected value %#x.
\n
"
,
value32
);
ok
(
value32
==
-
16
*
vih
.
bmiHeader
.
biBitCount
/
8
,
"Unexpected value %#x.
\n
"
,
value32
);
else
else
todo_wine
ok
(
value32
==
-
4
,
"Unexpected value %#x.
\n
"
,
value32
);
todo_wine
ok
(
value32
==
-
4
,
"Unexpected value %#x.
\n
"
,
value32
);
...
...
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