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
41184e9d
Commit
41184e9d
authored
Jun 13, 2022
by
Rémi Bernon
Committed by
Alexandre Julliard
Jun 16, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winegstreamer: Implement ColorConvertDMO transform.
Signed-off-by:
Rémi Bernon
<
rbernon@codeweavers.com
>
parent
5b178b2f
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
397 additions
and
66 deletions
+397
-66
mf.c
dlls/mf/tests/mf.c
+0
-39
color_convert.c
dlls/winegstreamer/color_convert.c
+396
-26
wg_transform.c
dlls/winegstreamer/wg_transform.c
+1
-1
No files found.
dlls/mf/tests/mf.c
View file @
41184e9d
...
...
@@ -8027,10 +8027,8 @@ static void test_color_convert(void)
/* check default media types */
hr
=
IMFTransform_GetInputStreamInfo
(
transform
,
0
,
&
input_info
);
todo_wine
ok
(
hr
==
MF_E_TRANSFORM_TYPE_NOT_SET
,
"GetInputStreamInfo returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_GetOutputStreamInfo
(
transform
,
0
,
&
output_info
);
todo_wine
ok
(
hr
==
MF_E_TRANSFORM_TYPE_NOT_SET
,
"GetOutputStreamInfo returned %#lx
\n
"
,
hr
);
i
=
-
1
;
...
...
@@ -8044,9 +8042,7 @@ static void test_color_convert(void)
ok
(
ret
==
0
,
"Release returned %lu
\n
"
,
ret
);
winetest_pop_context
();
}
todo_wine
ok
(
hr
==
MF_E_NO_MORE_TYPES
,
"GetOutputAvailableType returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
i
==
16
,
"%lu output media types
\n
"
,
i
);
i
=
-
1
;
...
...
@@ -8068,9 +8064,7 @@ static void test_color_convert(void)
ok
(
ret
==
0
,
"Release returned %lu
\n
"
,
ret
);
winetest_pop_context
();
}
todo_wine
ok
(
hr
==
MF_E_NO_MORE_TYPES
,
"GetInputAvailableType returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
i
==
20
,
"%lu input media types
\n
"
,
i
);
/* check required output media type attributes */
...
...
@@ -8078,22 +8072,18 @@ static void test_color_convert(void)
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"MFCreateMediaType returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_SetOutputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"SetOutputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
output_type_desc
,
1
);
hr
=
IMFTransform_SetOutputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"SetOutputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
output_type_desc
,
2
);
for
(
i
=
2
;
i
<
ARRAY_SIZE
(
output_type_desc
)
-
1
;
++
i
)
{
hr
=
IMFTransform_SetOutputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"SetOutputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
output_type_desc
,
i
+
1
);
}
hr
=
IMFTransform_SetOutputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"SetOutputType returned %#lx.
\n
"
,
hr
);
ret
=
IMFMediaType_Release
(
media_type
);
ok
(
ret
==
0
,
"Release returned %lu
\n
"
,
ret
);
...
...
@@ -8103,50 +8093,36 @@ static void test_color_convert(void)
hr
=
MFCreateMediaType
(
&
media_type
);
ok
(
hr
==
S_OK
,
"MFCreateMediaType returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_SetInputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"SetInputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
input_type_desc
,
1
);
hr
=
IMFTransform_SetInputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
MF_E_ATTRIBUTENOTFOUND
,
"SetInputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
input_type_desc
,
2
);
for
(
i
=
2
;
i
<
ARRAY_SIZE
(
input_type_desc
)
-
1
;
++
i
)
{
hr
=
IMFTransform_SetInputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
E_INVALIDARG
,
"SetInputType returned %#lx.
\n
"
,
hr
);
init_media_type
(
media_type
,
input_type_desc
,
i
+
1
);
}
hr
=
IMFTransform_SetInputType
(
transform
,
0
,
media_type
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"SetInputType returned %#lx.
\n
"
,
hr
);
ret
=
IMFMediaType_Release
(
media_type
);
ok
(
ret
==
0
,
"Release returned %lu
\n
"
,
ret
);
memset
(
&
input_info
,
0xcd
,
sizeof
(
input_info
));
hr
=
IMFTransform_GetInputStreamInfo
(
transform
,
0
,
&
input_info
);
todo_wine
ok
(
hr
==
S_OK
,
"GetInputStreamInfo returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
input_info
.
hnsMaxLatency
==
0
,
"got hnsMaxLatency %s
\n
"
,
wine_dbgstr_longlong
(
input_info
.
hnsMaxLatency
));
todo_wine
ok
(
input_info
.
dwFlags
==
0
,
"got dwFlags %#lx
\n
"
,
input_info
.
dwFlags
);
todo_wine
ok
(
input_info
.
cbSize
==
actual_width
*
actual_height
*
3
/
2
,
"got cbSize %#lx
\n
"
,
input_info
.
cbSize
);
todo_wine
ok
(
input_info
.
cbMaxLookahead
==
0
,
"got cbMaxLookahead %#lx
\n
"
,
input_info
.
cbMaxLookahead
);
todo_wine
ok
(
input_info
.
cbAlignment
==
1
,
"got cbAlignment %#lx
\n
"
,
input_info
.
cbAlignment
);
memset
(
&
output_info
,
0xcd
,
sizeof
(
output_info
));
hr
=
IMFTransform_GetOutputStreamInfo
(
transform
,
0
,
&
output_info
);
todo_wine
ok
(
hr
==
S_OK
,
"GetOutputStreamInfo returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
output_info
.
dwFlags
==
0
,
"got dwFlags %#lx
\n
"
,
output_info
.
dwFlags
);
todo_wine
ok
(
output_info
.
cbSize
==
actual_width
*
actual_height
*
4
,
"got cbSize %#lx
\n
"
,
output_info
.
cbSize
);
todo_wine
ok
(
output_info
.
cbAlignment
==
1
,
"got cbAlignment %#lx
\n
"
,
output_info
.
cbAlignment
);
resource
=
FindResourceW
(
NULL
,
L"nv12frame.bin"
,
(
const
WCHAR
*
)
RT_RCDATA
);
...
...
@@ -8161,13 +8137,10 @@ static void test_color_convert(void)
hr
=
IMFSample_SetSampleDuration
(
sample
,
10000000
);
ok
(
hr
==
S_OK
,
"SetSampleDuration returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_ProcessInput
(
transform
,
0
,
sample
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"ProcessInput returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_ProcessInput
(
transform
,
0
,
sample
,
0
);
todo_wine
ok
(
hr
==
MF_E_NOTACCEPTING
,
"ProcessInput returned %#lx
\n
"
,
hr
);
hr
=
IMFTransform_ProcessMessage
(
transform
,
MFT_MESSAGE_COMMAND_DRAIN
,
0
);
todo_wine
ok
(
hr
==
S_OK
,
"ProcessMessage returned %#lx
\n
"
,
hr
);
IMFSample_Release
(
sample
);
...
...
@@ -8175,9 +8148,7 @@ static void test_color_convert(void)
ok
(
resource
!=
0
,
"FindResourceW failed, error %lu
\n
"
,
GetLastError
());
rgb32_data
=
LockResource
(
LoadResource
(
GetModuleHandleW
(
NULL
),
resource
));
rgb32_data_len
=
SizeofResource
(
GetModuleHandleW
(
NULL
),
resource
);
todo_wine
ok
(
rgb32_data_len
==
output_info
.
cbSize
,
"got length %lu
\n
"
,
rgb32_data_len
);
if
(
rgb32_data_len
!=
output_info
.
cbSize
)
output_info
.
cbSize
=
actual_width
*
actual_height
*
4
;
/* and generate a new one as well in a temporary directory */
GetTempPathW
(
ARRAY_SIZE
(
output_path
),
output_path
);
...
...
@@ -8190,28 +8161,20 @@ static void test_color_convert(void)
memset
(
&
output
,
0
,
sizeof
(
output
));
output
.
pSample
=
sample
;
hr
=
IMFTransform_ProcessOutput
(
transform
,
0
,
1
,
&
output
,
&
status
);
todo_wine
ok
(
hr
==
S_OK
,
"ProcessOutput returned %#lx
\n
"
,
hr
);
ok
(
output
.
pSample
==
sample
,
"got pSample %p
\n
"
,
output
.
pSample
);
ok
(
output
.
dwStatus
==
0
||
broken
(
output
.
dwStatus
==
6
)
/* win7 */
,
"got dwStatus %#lx
\n
"
,
output
.
dwStatus
);
todo_wine
ok
(
status
==
0
,
"got status %#lx
\n
"
,
status
);
hr
=
IMFSample_GetSampleTime
(
sample
,
&
time
);
todo_wine
ok
(
hr
==
S_OK
,
"GetSampleTime returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
time
==
0
,
"got time %I64d
\n
"
,
time
);
hr
=
IMFSample_GetSampleDuration
(
sample
,
&
duration
);
todo_wine
ok
(
hr
==
S_OK
,
"GetSampleDuration returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
duration
==
10000000
,
"got duration %I64d
\n
"
,
duration
);
hr
=
IMFSample_GetTotalLength
(
sample
,
&
length
);
ok
(
hr
==
S_OK
,
"GetTotalLength returned %#lx
\n
"
,
hr
);
todo_wine
ok
(
length
==
output_info
.
cbSize
,
"got length %lu
\n
"
,
length
);
if
(
length
==
output_info
.
cbSize
)
check_sample_rgb32
(
sample
,
rgb32_data
,
output_file
);
rgb32_data_len
-=
output_info
.
cbSize
;
rgb32_data
+=
output_info
.
cbSize
;
...
...
@@ -8227,11 +8190,9 @@ static void test_color_convert(void)
memset
(
&
output
,
0
,
sizeof
(
output
));
output
.
pSample
=
sample
;
hr
=
IMFTransform_ProcessOutput
(
transform
,
0
,
1
,
&
output
,
&
status
);
todo_wine
ok
(
hr
==
MF_E_TRANSFORM_NEED_MORE_INPUT
,
"ProcessOutput returned %#lx
\n
"
,
hr
);
ok
(
output
.
pSample
==
sample
,
"got pSample %p
\n
"
,
output
.
pSample
);
ok
(
output
.
dwStatus
==
0
,
"got dwStatus %#lx
\n
"
,
output
.
dwStatus
);
todo_wine
ok
(
status
==
0
,
"got status %#lx
\n
"
,
status
);
hr
=
IMFSample_GetTotalLength
(
sample
,
&
length
);
ok
(
hr
==
S_OK
,
"GetTotalLength returned %#lx
\n
"
,
hr
);
...
...
dlls/winegstreamer/color_convert.c
View file @
41184e9d
...
...
@@ -28,6 +28,49 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
mfplat
);
WINE_DECLARE_DEBUG_CHANNEL
(
winediag
);
static
const
GUID
*
const
input_types
[]
=
{
&
MFVideoFormat_YV12
,
&
MFVideoFormat_YUY2
,
&
MFVideoFormat_UYVY
,
&
MFVideoFormat_AYUV
,
&
MFVideoFormat_NV12
,
&
MFVideoFormat_RGB32
,
&
MFVideoFormat_RGB565
,
&
MFVideoFormat_I420
,
&
MFVideoFormat_IYUV
,
&
MFVideoFormat_YVYU
,
&
MFVideoFormat_RGB24
,
&
MFVideoFormat_RGB555
,
&
MEDIASUBTYPE_RGB8
,
&
MEDIASUBTYPE_V216
,
&
MEDIASUBTYPE_V410
,
&
MFVideoFormat_NV11
,
&
MFVideoFormat_Y41P
,
&
MFVideoFormat_Y41T
,
&
MFVideoFormat_Y42T
,
&
MFVideoFormat_YVU9
,
};
static
const
GUID
*
const
output_types
[]
=
{
&
MFVideoFormat_YV12
,
&
MFVideoFormat_YUY2
,
&
MFVideoFormat_UYVY
,
&
MFVideoFormat_AYUV
,
&
MFVideoFormat_NV12
,
&
MFVideoFormat_RGB32
,
&
MFVideoFormat_RGB565
,
&
MFVideoFormat_I420
,
&
MFVideoFormat_IYUV
,
&
MFVideoFormat_YVYU
,
&
MFVideoFormat_RGB24
,
&
MFVideoFormat_RGB555
,
&
MEDIASUBTYPE_RGB8
,
&
MEDIASUBTYPE_V216
,
&
MEDIASUBTYPE_V410
,
&
MFVideoFormat_NV11
,
};
struct
color_convert
{
IUnknown
IUnknown_inner
;
...
...
@@ -37,6 +80,11 @@ struct color_convert
IPropertyStore
IPropertyStore_iface
;
IUnknown
*
outer
;
LONG
refcount
;
IMFMediaType
*
input_type
;
IMFMediaType
*
output_type
;
struct
wg_transform
*
wg_transform
;
struct
wg_sample_queue
*
wg_sample_queue
;
};
static
inline
struct
color_convert
*
impl_from_IUnknown
(
IUnknown
*
iface
)
...
...
@@ -44,6 +92,28 @@ static inline struct color_convert *impl_from_IUnknown(IUnknown *iface)
return
CONTAINING_RECORD
(
iface
,
struct
color_convert
,
IUnknown_inner
);
}
static
HRESULT
try_create_wg_transform
(
struct
color_convert
*
impl
)
{
struct
wg_format
input_format
,
output_format
;
if
(
impl
->
wg_transform
)
wg_transform_destroy
(
impl
->
wg_transform
);
impl
->
wg_transform
=
NULL
;
mf_media_type_to_wg_format
(
impl
->
input_type
,
&
input_format
);
if
(
input_format
.
major_type
==
WG_MAJOR_TYPE_UNKNOWN
)
return
MF_E_INVALIDMEDIATYPE
;
mf_media_type_to_wg_format
(
impl
->
output_type
,
&
output_format
);
if
(
output_format
.
major_type
==
WG_MAJOR_TYPE_UNKNOWN
)
return
MF_E_INVALIDMEDIATYPE
;
if
(
!
(
impl
->
wg_transform
=
wg_transform_create
(
&
input_format
,
&
output_format
)))
return
E_FAIL
;
return
S_OK
;
}
static
HRESULT
WINAPI
unknown_QueryInterface
(
IUnknown
*
iface
,
REFIID
iid
,
void
**
out
)
{
struct
color_convert
*
impl
=
impl_from_IUnknown
(
iface
);
...
...
@@ -89,7 +159,17 @@ static ULONG WINAPI unknown_Release(IUnknown *iface)
TRACE
(
"iface %p decreasing refcount to %lu.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
{
if
(
impl
->
wg_transform
)
wg_transform_destroy
(
impl
->
wg_transform
);
if
(
impl
->
input_type
)
IMFMediaType_Release
(
impl
->
input_type
);
if
(
impl
->
output_type
)
IMFMediaType_Release
(
impl
->
output_type
);
wg_sample_queue_destroy
(
impl
->
wg_sample_queue
);
free
(
impl
);
}
return
refcount
;
}
...
...
@@ -124,15 +204,17 @@ static ULONG WINAPI transform_Release(IMFTransform *iface)
static
HRESULT
WINAPI
transform_GetStreamLimits
(
IMFTransform
*
iface
,
DWORD
*
input_minimum
,
DWORD
*
input_maximum
,
DWORD
*
output_minimum
,
DWORD
*
output_maximum
)
{
FIXME
(
"iface %p, input_minimum %p, input_maximum %p, output_minimum %p, output_maximum %p stub!
\n
"
,
TRACE
(
"iface %p, input_minimum %p, input_maximum %p, output_minimum %p, output_maximum %p.
\n
"
,
iface
,
input_minimum
,
input_maximum
,
output_minimum
,
output_maximum
);
return
E_NOTIMPL
;
*
input_minimum
=
*
input_maximum
=
*
output_minimum
=
*
output_maximum
=
1
;
return
S_OK
;
}
static
HRESULT
WINAPI
transform_GetStreamCount
(
IMFTransform
*
iface
,
DWORD
*
inputs
,
DWORD
*
outputs
)
{
FIXME
(
"iface %p, inputs %p, outputs %p stub!
\n
"
,
iface
,
inputs
,
outputs
);
return
E_NOTIMPL
;
TRACE
(
"iface %p, inputs %p, outputs %p.
\n
"
,
iface
,
inputs
,
outputs
);
*
inputs
=
*
outputs
=
1
;
return
S_OK
;
}
static
HRESULT
WINAPI
transform_GetStreamIDs
(
IMFTransform
*
iface
,
DWORD
input_size
,
DWORD
*
inputs
,
...
...
@@ -145,14 +227,56 @@ static HRESULT WINAPI transform_GetStreamIDs(IMFTransform *iface, DWORD input_si
static
HRESULT
WINAPI
transform_GetInputStreamInfo
(
IMFTransform
*
iface
,
DWORD
id
,
MFT_INPUT_STREAM_INFO
*
info
)
{
FIXME
(
"iface %p, id %#lx, info %p stub!
\n
"
,
iface
,
id
,
info
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
UINT32
sample_size
;
UINT64
framesize
;
GUID
subtype
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, info %p.
\n
"
,
iface
,
id
,
info
);
if
(
!
impl
->
input_type
||
!
impl
->
output_type
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
if
(
SUCCEEDED
(
hr
=
IMFMediaType_GetGUID
(
impl
->
input_type
,
&
MF_MT_SUBTYPE
,
&
subtype
))
&&
SUCCEEDED
(
hr
=
IMFMediaType_GetUINT64
(
impl
->
input_type
,
&
MF_MT_FRAME_SIZE
,
&
framesize
)))
MFCalculateImageSize
(
&
subtype
,
framesize
>>
32
,
(
UINT32
)
framesize
,
&
sample_size
);
else
sample_size
=
0
;
info
->
dwFlags
=
0
;
info
->
cbSize
=
sample_size
;
info
->
cbAlignment
=
1
;
info
->
hnsMaxLatency
=
0
;
info
->
cbMaxLookahead
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
transform_GetOutputStreamInfo
(
IMFTransform
*
iface
,
DWORD
id
,
MFT_OUTPUT_STREAM_INFO
*
info
)
{
FIXME
(
"iface %p, id %#lx, info %p stub!
\n
"
,
iface
,
id
,
info
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
UINT32
sample_size
;
UINT64
framesize
;
GUID
subtype
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, info %p.
\n
"
,
iface
,
id
,
info
);
if
(
!
impl
->
input_type
||
!
impl
->
output_type
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
if
(
SUCCEEDED
(
hr
=
IMFMediaType_GetGUID
(
impl
->
output_type
,
&
MF_MT_SUBTYPE
,
&
subtype
))
&&
SUCCEEDED
(
hr
=
IMFMediaType_GetUINT64
(
impl
->
output_type
,
&
MF_MT_FRAME_SIZE
,
&
framesize
)))
MFCalculateImageSize
(
&
subtype
,
framesize
>>
32
,
(
UINT32
)
framesize
,
&
sample_size
);
else
sample_size
=
0
;
info
->
dwFlags
=
0
;
info
->
cbSize
=
sample_size
;
info
->
cbAlignment
=
1
;
return
S_OK
;
}
static
HRESULT
WINAPI
transform_GetAttributes
(
IMFTransform
*
iface
,
IMFAttributes
**
attributes
)
...
...
@@ -164,7 +288,7 @@ static HRESULT WINAPI transform_GetAttributes(IMFTransform *iface, IMFAttributes
static
HRESULT
WINAPI
transform_GetInputStreamAttributes
(
IMFTransform
*
iface
,
DWORD
id
,
IMFAttributes
**
attributes
)
{
FIXME
(
"iface %p, id %#lx, attributes %p stub!
\n
"
,
iface
,
id
,
attributes
);
return
E_NOTIMPL
;
return
MFCreateAttributes
(
attributes
,
0
)
;
}
static
HRESULT
WINAPI
transform_GetOutputStreamAttributes
(
IMFTransform
*
iface
,
DWORD
id
,
IMFAttributes
**
attributes
)
...
...
@@ -188,39 +312,195 @@ static HRESULT WINAPI transform_AddInputStreams(IMFTransform *iface, DWORD strea
static
HRESULT
WINAPI
transform_GetInputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
IMFMediaType
**
type
)
{
FIXME
(
"iface %p, id %#lx, index %lu, type %p stub!
\n
"
,
iface
,
id
,
index
,
type
);
return
E_NOTIMPL
;
IMFMediaType
*
media_type
;
const
GUID
*
subtype
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, index %#lx, type %p.
\n
"
,
iface
,
id
,
index
,
type
);
*
type
=
NULL
;
if
(
index
>=
ARRAY_SIZE
(
input_types
))
return
MF_E_NO_MORE_TYPES
;
subtype
=
input_types
[
index
];
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
media_type
)))
return
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
subtype
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
1
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
1
)))
goto
done
;
IMFMediaType_AddRef
((
*
type
=
media_type
));
done:
IMFMediaType_Release
(
media_type
);
return
hr
;
}
static
HRESULT
WINAPI
transform_GetOutputAvailableType
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
index
,
IMFMediaType
**
type
)
{
FIXME
(
"iface %p, id %#lx, index %lu, type %p stub!
\n
"
,
iface
,
id
,
index
,
type
);
return
E_NOTIMPL
;
IMFMediaType
*
media_type
;
const
GUID
*
subtype
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, index %#lx, type %p.
\n
"
,
iface
,
id
,
index
,
type
);
*
type
=
NULL
;
if
(
index
>=
ARRAY_SIZE
(
output_types
))
return
MF_E_NO_MORE_TYPES
;
subtype
=
output_types
[
index
];
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
media_type
)))
return
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_MAJOR_TYPE
,
&
MFMediaType_Video
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetGUID
(
media_type
,
&
MF_MT_SUBTYPE
,
subtype
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetUINT32
(
media_type
,
&
MF_MT_FIXED_SIZE_SAMPLES
,
1
)))
goto
done
;
if
(
FAILED
(
hr
=
IMFMediaType_SetUINT32
(
media_type
,
&
MF_MT_ALL_SAMPLES_INDEPENDENT
,
1
)))
goto
done
;
IMFMediaType_AddRef
((
*
type
=
media_type
));
done:
IMFMediaType_Release
(
media_type
);
return
hr
;
}
static
HRESULT
WINAPI
transform_SetInputType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
*
type
,
DWORD
flags
)
{
FIXME
(
"iface %p, id %#lx, type %p, flags %#lx stub!
\n
"
,
iface
,
id
,
type
,
flags
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
MF_ATTRIBUTE_TYPE
item_type
;
GUID
major
,
subtype
;
HRESULT
hr
;
ULONG
i
;
TRACE
(
"iface %p, id %#lx, type %p, flags %#lx.
\n
"
,
iface
,
id
,
type
,
flags
);
if
(
FAILED
(
hr
=
IMFMediaType_GetGUID
(
type
,
&
MF_MT_MAJOR_TYPE
,
&
major
))
||
FAILED
(
hr
=
IMFMediaType_GetGUID
(
type
,
&
MF_MT_SUBTYPE
,
&
subtype
)))
return
MF_E_ATTRIBUTENOTFOUND
;
if
(
!
IsEqualGUID
(
&
major
,
&
MFMediaType_Video
)
||
FAILED
(
IMFMediaType_GetItemType
(
type
,
&
MF_MT_FRAME_SIZE
,
&
item_type
))
||
item_type
!=
MF_ATTRIBUTE_UINT64
)
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
input_types
);
++
i
)
if
(
IsEqualGUID
(
&
subtype
,
input_types
[
i
]))
break
;
if
(
i
==
ARRAY_SIZE
(
input_types
))
return
MF_E_INVALIDMEDIATYPE
;
if
(
!
impl
->
input_type
&&
FAILED
(
hr
=
MFCreateMediaType
(
&
impl
->
input_type
)))
return
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_CopyAllItems
(
type
,
(
IMFAttributes
*
)
impl
->
input_type
)))
{
IMFMediaType_Release
(
impl
->
input_type
);
impl
->
input_type
=
NULL
;
}
if
(
impl
->
output_type
&&
FAILED
(
hr
=
try_create_wg_transform
(
impl
)))
{
IMFMediaType_Release
(
impl
->
input_type
);
impl
->
input_type
=
NULL
;
}
return
hr
;
}
static
HRESULT
WINAPI
transform_SetOutputType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
*
type
,
DWORD
flags
)
{
FIXME
(
"iface %p, id %#lx, type %p, flags %#lx stub!
\n
"
,
iface
,
id
,
type
,
flags
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
MF_ATTRIBUTE_TYPE
item_type
;
GUID
major
,
subtype
;
HRESULT
hr
;
ULONG
i
;
TRACE
(
"iface %p, id %#lx, type %p, flags %#lx.
\n
"
,
iface
,
id
,
type
,
flags
);
if
(
FAILED
(
hr
=
IMFMediaType_GetGUID
(
type
,
&
MF_MT_MAJOR_TYPE
,
&
major
))
||
FAILED
(
hr
=
IMFMediaType_GetGUID
(
type
,
&
MF_MT_SUBTYPE
,
&
subtype
)))
return
MF_E_ATTRIBUTENOTFOUND
;
if
(
!
IsEqualGUID
(
&
major
,
&
MFMediaType_Video
)
||
FAILED
(
IMFMediaType_GetItemType
(
type
,
&
MF_MT_FRAME_SIZE
,
&
item_type
))
||
item_type
!=
MF_ATTRIBUTE_UINT64
)
return
E_INVALIDARG
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
output_types
);
++
i
)
if
(
IsEqualGUID
(
&
subtype
,
output_types
[
i
]))
break
;
if
(
i
==
ARRAY_SIZE
(
output_types
))
return
MF_E_INVALIDMEDIATYPE
;
if
(
!
impl
->
output_type
&&
FAILED
(
hr
=
MFCreateMediaType
(
&
impl
->
output_type
)))
return
hr
;
if
(
FAILED
(
hr
=
IMFMediaType_CopyAllItems
(
type
,
(
IMFAttributes
*
)
impl
->
output_type
)))
{
IMFMediaType_Release
(
impl
->
output_type
);
impl
->
output_type
=
NULL
;
}
if
(
impl
->
input_type
&&
FAILED
(
hr
=
try_create_wg_transform
(
impl
)))
{
IMFMediaType_Release
(
impl
->
output_type
);
impl
->
output_type
=
NULL
;
}
return
hr
;
}
static
HRESULT
WINAPI
transform_GetInputCurrentType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
**
type
)
{
FIXME
(
"iface %p, id %#lx, type %p stub!
\n
"
,
iface
,
id
,
type
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
IMFMediaType
*
ret
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, type %p.
\n
"
,
iface
,
id
,
type
);
if
(
id
!=
0
)
return
MF_E_INVALIDSTREAMNUMBER
;
if
(
!
impl
->
input_type
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
ret
)))
return
hr
;
return
IMFMediaType_CopyAllItems
(
impl
->
input_type
,
(
IMFAttributes
*
)
ret
);
}
static
HRESULT
WINAPI
transform_GetOutputCurrentType
(
IMFTransform
*
iface
,
DWORD
id
,
IMFMediaType
**
type
)
{
FIXME
(
"iface %p, id %#lx, type %p stub!
\n
"
,
iface
,
id
,
type
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
IMFMediaType
*
ret
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, type %p.
\n
"
,
iface
,
id
,
type
);
if
(
id
!=
0
)
return
MF_E_INVALIDSTREAMNUMBER
;
if
(
!
impl
->
output_type
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
if
(
FAILED
(
hr
=
MFCreateMediaType
(
&
ret
)))
return
hr
;
return
IMFMediaType_CopyAllItems
(
impl
->
output_type
,
(
IMFAttributes
*
)
ret
);
}
static
HRESULT
WINAPI
transform_GetInputStatus
(
IMFTransform
*
iface
,
DWORD
id
,
DWORD
*
flags
)
...
...
@@ -250,20 +530,75 @@ static HRESULT WINAPI transform_ProcessEvent(IMFTransform *iface, DWORD id, IMFM
static
HRESULT
WINAPI
transform_ProcessMessage
(
IMFTransform
*
iface
,
MFT_MESSAGE_TYPE
message
,
ULONG_PTR
param
)
{
FIXME
(
"iface %p, message %#x, param %#Ix stub!
\n
"
,
iface
,
message
,
param
);
return
E_NOTIMPL
;
return
S_OK
;
}
static
HRESULT
WINAPI
transform_ProcessInput
(
IMFTransform
*
iface
,
DWORD
id
,
IMFSample
*
sample
,
DWORD
flags
)
{
FIXME
(
"iface %p, id %#lx, sample %p, flags %#lx stub!
\n
"
,
iface
,
id
,
sample
,
flags
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
struct
wg_sample
*
wg_sample
;
MFT_INPUT_STREAM_INFO
info
;
HRESULT
hr
;
TRACE
(
"iface %p, id %#lx, sample %p, flags %#lx.
\n
"
,
iface
,
id
,
sample
,
flags
);
if
(
FAILED
(
hr
=
IMFTransform_GetInputStreamInfo
(
iface
,
0
,
&
info
)))
return
hr
;
if
(
!
impl
->
wg_transform
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
if
(
FAILED
(
hr
=
wg_sample_create_mf
(
sample
,
&
wg_sample
)))
return
hr
;
return
wg_transform_push_mf
(
impl
->
wg_transform
,
wg_sample
,
impl
->
wg_sample_queue
);
}
static
HRESULT
WINAPI
transform_ProcessOutput
(
IMFTransform
*
iface
,
DWORD
flags
,
DWORD
count
,
MFT_OUTPUT_DATA_BUFFER
*
samples
,
DWORD
*
status
)
{
FIXME
(
"iface %p, flags %#lx, count %lu, samples %p, status %p stub!
\n
"
,
iface
,
flags
,
count
,
samples
,
status
);
return
E_NOTIMPL
;
struct
color_convert
*
impl
=
impl_from_IMFTransform
(
iface
);
MFT_OUTPUT_STREAM_INFO
info
;
struct
wg_sample
*
wg_sample
;
HRESULT
hr
;
TRACE
(
"iface %p, flags %#lx, count %lu, samples %p, status %p.
\n
"
,
iface
,
flags
,
count
,
samples
,
status
);
if
(
count
!=
1
)
return
E_INVALIDARG
;
if
(
FAILED
(
hr
=
IMFTransform_GetOutputStreamInfo
(
iface
,
0
,
&
info
)))
return
hr
;
if
(
!
impl
->
wg_transform
)
return
MF_E_TRANSFORM_TYPE_NOT_SET
;
*
status
=
0
;
samples
[
0
].
dwStatus
=
0
;
if
(
!
samples
[
0
].
pSample
)
return
E_INVALIDARG
;
if
(
FAILED
(
hr
=
wg_sample_create_mf
(
samples
[
0
].
pSample
,
&
wg_sample
)))
return
hr
;
if
(
wg_sample
->
max_size
<
info
.
cbSize
)
{
wg_sample_release
(
wg_sample
);
return
MF_E_BUFFERTOOSMALL
;
}
if
(
SUCCEEDED
(
hr
=
wg_transform_read_mf
(
impl
->
wg_transform
,
wg_sample
,
NULL
)))
wg_sample_queue_flush
(
impl
->
wg_sample_queue
,
false
);
wg_sample_release
(
wg_sample
);
if
(
hr
==
MF_E_TRANSFORM_STREAM_CHANGE
)
{
FIXME
(
"Unexpected stream format change!
\n
"
);
samples
[
0
].
dwStatus
|=
MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE
;
*
status
|=
MFT_OUTPUT_DATA_BUFFER_FORMAT_CHANGE
;
}
return
hr
;
}
static
const
IMFTransformVtbl
transform_vtbl
=
...
...
@@ -585,13 +920,48 @@ static const IPropertyStoreVtbl property_store_vtbl =
HRESULT
color_convert_create
(
IUnknown
*
outer
,
IUnknown
**
out
)
{
static
const
struct
wg_format
input_format
=
{
.
major_type
=
WG_MAJOR_TYPE_VIDEO
,
.
u
.
video
=
{
.
format
=
WG_VIDEO_FORMAT_I420
,
.
width
=
1920
,
.
height
=
1080
,
},
};
static
const
struct
wg_format
output_format
=
{
.
major_type
=
WG_MAJOR_TYPE_VIDEO
,
.
u
.
video
=
{
.
format
=
WG_VIDEO_FORMAT_NV12
,
.
width
=
1920
,
.
height
=
1080
,
},
};
struct
wg_transform
*
transform
;
struct
color_convert
*
impl
;
HRESULT
hr
;
TRACE
(
"outer %p, out %p.
\n
"
,
outer
,
out
);
if
(
!
(
transform
=
wg_transform_create
(
&
input_format
,
&
output_format
)))
{
ERR_
(
winediag
)(
"GStreamer doesn't support video conversion, please install appropriate plugins.
\n
"
);
return
E_FAIL
;
}
wg_transform_destroy
(
transform
);
if
(
!
(
impl
=
calloc
(
1
,
sizeof
(
*
impl
))))
return
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
=
wg_sample_queue_create
(
&
impl
->
wg_sample_queue
)))
{
free
(
impl
);
return
hr
;
}
impl
->
IUnknown_inner
.
lpVtbl
=
&
unknown_vtbl
;
impl
->
IMFTransform_iface
.
lpVtbl
=
&
transform_vtbl
;
impl
->
IMediaObject_iface
.
lpVtbl
=
&
media_object_vtbl
;
...
...
dlls/winegstreamer/wg_transform.c
View file @
41184e9d
...
...
@@ -406,8 +406,8 @@ NTSTATUS wg_transform_create(void *args)
break
;
case
WG_MAJOR_TYPE_AUDIO
:
break
;
case
WG_MAJOR_TYPE_VIDEO
:
break
;
case
WG_MAJOR_TYPE_UNKNOWN
:
GST_FIXME
(
"Format %u not implemented!"
,
input_format
.
major_type
);
gst_caps_unref
(
raw_caps
);
...
...
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