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
c806c4ee
Commit
c806c4ee
authored
Jul 29, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Aug 01, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mf: Implement SAR media type required attributes checks.
parent
e5a512eb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
41 additions
and
10 deletions
+41
-10
sar.c
dlls/mf/sar.c
+41
-8
mf.c
dlls/mf/tests/mf.c
+0
-2
No files found.
dlls/mf/sar.c
View file @
c806c4ee
...
@@ -1499,20 +1499,57 @@ static ULONG WINAPI audio_renderer_stream_type_handler_Release(IMFMediaTypeHandl
...
@@ -1499,20 +1499,57 @@ static ULONG WINAPI audio_renderer_stream_type_handler_Release(IMFMediaTypeHandl
return
IMFStreamSink_Release
(
&
renderer
->
IMFStreamSink_iface
);
return
IMFStreamSink_Release
(
&
renderer
->
IMFStreamSink_iface
);
}
}
static
HRESULT
check_media_type
(
IMFMediaType
*
type
,
IMFMediaType
*
current
)
{
static
const
GUID
*
required_attrs
[]
=
{
&
MF_MT_AUDIO_SAMPLES_PER_SECOND
,
&
MF_MT_AUDIO_NUM_CHANNELS
,
&
MF_MT_AUDIO_BITS_PER_SAMPLE
,
&
MF_MT_AUDIO_BLOCK_ALIGNMENT
,
&
MF_MT_AUDIO_AVG_BYTES_PER_SECOND
,
};
PROPVARIANT
value
;
BOOL
result
;
HRESULT
hr
;
GUID
major
;
int
i
;
if
(
FAILED
(
hr
=
IMFMediaType_GetGUID
(
type
,
&
MF_MT_MAJOR_TYPE
,
&
major
)))
return
hr
;
if
(
!
IsEqualGUID
(
&
major
,
&
MFMediaType_Audio
))
return
MF_E_INVALIDMEDIATYPE
;
for
(
i
=
0
;
SUCCEEDED
(
hr
)
&&
i
<
ARRAY_SIZE
(
required_attrs
);
++
i
)
{
PropVariantInit
(
&
value
);
hr
=
IMFMediaType_GetItem
(
type
,
required_attrs
[
i
],
&
value
);
if
(
SUCCEEDED
(
hr
))
hr
=
IMFMediaType_CompareItem
(
current
,
required_attrs
[
i
],
&
value
,
&
result
);
if
(
SUCCEEDED
(
hr
)
&&
!
result
)
hr
=
MF_E_INVALIDMEDIATYPE
;
PropVariantClear
(
&
value
);
}
if
(
FAILED
(
hr
))
return
MF_E_INVALIDMEDIATYPE
;
return
S_OK
;
}
static
HRESULT
WINAPI
audio_renderer_stream_type_handler_IsMediaTypeSupported
(
IMFMediaTypeHandler
*
iface
,
static
HRESULT
WINAPI
audio_renderer_stream_type_handler_IsMediaTypeSupported
(
IMFMediaTypeHandler
*
iface
,
IMFMediaType
*
in_type
,
IMFMediaType
**
out_type
)
IMFMediaType
*
in_type
,
IMFMediaType
**
out_type
)
{
{
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaTypeHandler
(
iface
);
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaTypeHandler
(
iface
);
DWORD
flags
;
HRESULT
hr
;
HRESULT
hr
;
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
TRACE
(
"%p, %p, %p.
\n
"
,
iface
,
in_type
,
out_type
);
EnterCriticalSection
(
&
renderer
->
cs
);
EnterCriticalSection
(
&
renderer
->
cs
);
hr
=
IMFMediaType_IsEqual
(
renderer
->
media_type
,
in_type
,
&
flags
);
hr
=
check_media_type
(
in_type
,
renderer
->
media_type
);
LeaveCriticalSection
(
&
renderer
->
cs
);
LeaveCriticalSection
(
&
renderer
->
cs
);
return
hr
!=
S_OK
?
MF_E_INVALIDMEDIATYPE
:
hr
;
return
hr
;
}
}
static
HRESULT
WINAPI
audio_renderer_stream_type_handler_GetMediaTypeCount
(
IMFMediaTypeHandler
*
iface
,
DWORD
*
count
)
static
HRESULT
WINAPI
audio_renderer_stream_type_handler_GetMediaTypeCount
(
IMFMediaTypeHandler
*
iface
,
DWORD
*
count
)
...
@@ -1625,10 +1662,8 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_SetCurrentMediaType(IMF
...
@@ -1625,10 +1662,8 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_SetCurrentMediaType(IMF
IMFMediaType
*
media_type
)
IMFMediaType
*
media_type
)
{
{
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaTypeHandler
(
iface
);
struct
audio_renderer
*
renderer
=
impl_from_IMFMediaTypeHandler
(
iface
);
const
unsigned
int
test_flags
=
MF_MEDIATYPE_EQUAL_MAJOR_TYPES
|
MF_MEDIATYPE_EQUAL_FORMAT_TYPES
;
BOOL
compare_result
;
BOOL
compare_result
;
HRESULT
hr
=
S_OK
;
HRESULT
hr
=
S_OK
;
DWORD
flags
;
TRACE
(
"%p, %p.
\n
"
,
iface
,
media_type
);
TRACE
(
"%p, %p.
\n
"
,
iface
,
media_type
);
...
@@ -1636,7 +1671,7 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_SetCurrentMediaType(IMF
...
@@ -1636,7 +1671,7 @@ static HRESULT WINAPI audio_renderer_stream_type_handler_SetCurrentMediaType(IMF
return
E_POINTER
;
return
E_POINTER
;
EnterCriticalSection
(
&
renderer
->
cs
);
EnterCriticalSection
(
&
renderer
->
cs
);
if
(
SUCCEEDED
(
IMFMediaType_IsEqual
(
renderer
->
media_type
,
media_type
,
&
flags
))
&&
((
flags
&
test_flags
)
==
test_flags
))
if
(
SUCCEEDED
(
hr
=
check_media_type
(
media_type
,
renderer
->
media_type
)
))
{
{
if
(
renderer
->
current_media_type
)
if
(
renderer
->
current_media_type
)
IMFMediaType_Release
(
renderer
->
current_media_type
);
IMFMediaType_Release
(
renderer
->
current_media_type
);
...
@@ -1745,8 +1780,6 @@ static HRESULT audio_renderer_collect_supported_types(struct audio_renderer *ren
...
@@ -1745,8 +1780,6 @@ static HRESULT audio_renderer_collect_supported_types(struct audio_renderer *ren
return
hr
;
return
hr
;
}
}
IMFMediaType_DeleteItem
(
renderer
->
media_type
,
&
MF_MT_AUDIO_PREFER_WAVEFORMATEX
);
return
hr
;
return
hr
;
}
}
...
...
dlls/mf/tests/mf.c
View file @
c806c4ee
...
@@ -4651,13 +4651,11 @@ if (SUCCEEDED(hr))
...
@@ -4651,13 +4651,11 @@ if (SUCCEEDED(hr))
hr
=
MFCreateMediaType
(
&
mediatype
);
hr
=
MFCreateMediaType
(
&
mediatype
);
ok
(
hr
==
S_OK
,
"MFCreateMediaType returned %#lx
\n
"
,
hr
);
ok
(
hr
==
S_OK
,
"MFCreateMediaType returned %#lx
\n
"
,
hr
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
mediatype
,
NULL
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
mediatype
,
NULL
);
todo_wine
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"Unexpected hr %#lx.
\n
"
,
hr
);
init_media_type
(
mediatype
,
rate
==
44100
?
input_type_desc_44100
:
input_type_desc_48000
,
2
);
init_media_type
(
mediatype
,
rate
==
44100
?
input_type_desc_44100
:
input_type_desc_48000
,
2
);
for
(
int
i
=
1
;
i
<
(
rate
==
44100
?
ARRAY_SIZE
(
input_type_desc_44100
)
:
ARRAY_SIZE
(
input_type_desc_48000
))
-
1
;
++
i
)
for
(
int
i
=
1
;
i
<
(
rate
==
44100
?
ARRAY_SIZE
(
input_type_desc_44100
)
:
ARRAY_SIZE
(
input_type_desc_48000
))
-
1
;
++
i
)
{
{
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
mediatype
,
NULL
);
hr
=
IMFMediaTypeHandler_IsMediaTypeSupported
(
handler
,
mediatype
,
NULL
);
todo_wine
ok
(
hr
==
MF_E_INVALIDMEDIATYPE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
ok
(
hr
==
MF_E_INVALIDMEDIATYPE
,
"Unexpected hr %#lx.
\n
"
,
hr
);
init_media_type
(
mediatype
,
rate
==
44100
?
input_type_desc_44100
:
input_type_desc_48000
,
i
+
1
);
init_media_type
(
mediatype
,
rate
==
44100
?
input_type_desc_44100
:
input_type_desc_48000
,
i
+
1
);
}
}
...
...
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