Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
48c3a306
Commit
48c3a306
authored
Jun 03, 2020
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mfmediaengine: Implement error object.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
63d8cfa8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
150 additions
and
2 deletions
+150
-2
main.c
dlls/mfmediaengine/main.c
+122
-2
mfmediaengine.c
dlls/mfmediaengine/tests/mfmediaengine.c
+28
-0
No files found.
dlls/mfmediaengine/main.c
View file @
48c3a306
...
...
@@ -89,6 +89,126 @@ struct media_engine
CRITICAL_SECTION
cs
;
};
struct
media_error
{
IMFMediaError
IMFMediaError_iface
;
LONG
refcount
;
unsigned
int
code
;
HRESULT
extended_code
;
};
static
struct
media_error
*
impl_from_IMFMediaError
(
IMFMediaError
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
media_error
,
IMFMediaError_iface
);
}
static
HRESULT
WINAPI
media_error_QueryInterface
(
IMFMediaError
*
iface
,
REFIID
riid
,
void
**
obj
)
{
TRACE
(
"%p, %s, %p.
\n
"
,
iface
,
debugstr_guid
(
riid
),
obj
);
if
(
IsEqualIID
(
riid
,
&
IID_IMFMediaError
)
||
IsEqualIID
(
riid
,
&
IID_IUnknown
))
{
*
obj
=
iface
;
IMFMediaError_AddRef
(
iface
);
return
S_OK
;
}
WARN
(
"Unsupported interface %s.
\n
"
,
debugstr_guid
(
riid
));
*
obj
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
media_error_AddRef
(
IMFMediaError
*
iface
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
me
->
refcount
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
return
refcount
;
}
static
ULONG
WINAPI
media_error_Release
(
IMFMediaError
*
iface
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
me
->
refcount
);
TRACE
(
"%p, refcount %u.
\n
"
,
iface
,
refcount
);
if
(
!
refcount
)
heap_free
(
me
);
return
refcount
;
}
static
USHORT
WINAPI
media_error_GetErrorCode
(
IMFMediaError
*
iface
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
me
->
code
;
}
static
HRESULT
WINAPI
media_error_GetExtendedErrorCode
(
IMFMediaError
*
iface
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
TRACE
(
"%p.
\n
"
,
iface
);
return
me
->
extended_code
;
}
static
HRESULT
WINAPI
media_error_SetErrorCode
(
IMFMediaError
*
iface
,
MF_MEDIA_ENGINE_ERR
code
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
TRACE
(
"%p, %u.
\n
"
,
iface
,
code
);
if
((
unsigned
int
)
code
>
MF_MEDIA_ENGINE_ERR_ENCRYPTED
)
return
E_INVALIDARG
;
me
->
code
=
code
;
return
S_OK
;
}
static
HRESULT
WINAPI
media_error_SetExtendedErrorCode
(
IMFMediaError
*
iface
,
HRESULT
code
)
{
struct
media_error
*
me
=
impl_from_IMFMediaError
(
iface
);
TRACE
(
"%p, %#x.
\n
"
,
iface
,
code
);
me
->
extended_code
=
code
;
return
S_OK
;
}
static
const
IMFMediaErrorVtbl
media_error_vtbl
=
{
media_error_QueryInterface
,
media_error_AddRef
,
media_error_Release
,
media_error_GetErrorCode
,
media_error_GetExtendedErrorCode
,
media_error_SetErrorCode
,
media_error_SetExtendedErrorCode
,
};
static
HRESULT
create_media_error
(
IMFMediaError
**
ret
)
{
struct
media_error
*
object
;
*
ret
=
NULL
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
return
E_OUTOFMEMORY
;
object
->
IMFMediaError_iface
.
lpVtbl
=
&
media_error_vtbl
;
object
->
refcount
=
1
;
*
ret
=
&
object
->
IMFMediaError_iface
;
return
S_OK
;
}
static
void
media_engine_set_flag
(
struct
media_engine
*
engine
,
unsigned
int
mask
,
BOOL
value
)
{
if
(
value
)
...
...
@@ -1060,9 +1180,9 @@ static HRESULT WINAPI media_engine_factory_CreateTimeRange(IMFMediaEngineClassFa
static
HRESULT
WINAPI
media_engine_factory_CreateError
(
IMFMediaEngineClassFactory
*
iface
,
IMFMediaError
**
error
)
{
FIXME
(
"(%p, %p): stub
.
\n
"
,
iface
,
error
);
TRACE
(
"%p, %p
.
\n
"
,
iface
,
error
);
return
E_NOTIMPL
;
return
create_media_error
(
error
)
;
}
static
const
IMFMediaEngineClassFactoryVtbl
media_engine_factory_vtbl
=
...
...
dlls/mfmediaengine/tests/mfmediaengine.c
View file @
48c3a306
...
...
@@ -496,6 +496,7 @@ static void test_error(void)
IMFMediaEngineNotify
*
callback
=
&
notify_impl
.
IMFMediaEngineNotify_iface
;
IMFMediaEngine
*
media_engine
;
IMFMediaError
*
eo
,
*
eo2
;
unsigned
int
code
;
HRESULT
hr
;
media_engine
=
create_media_engine
(
callback
);
...
...
@@ -542,6 +543,33 @@ todo_wine {
ok
(
!
eo
,
"Unexpected instance.
\n
"
);
}
IMFMediaEngine_Release
(
media_engine
);
/* Error object. */
hr
=
IMFMediaEngineClassFactory_CreateError
(
factory
,
&
eo
);
ok
(
hr
==
S_OK
,
"Failed to create error object, hr %#x.
\n
"
,
hr
);
code
=
IMFMediaError_GetErrorCode
(
eo
);
ok
(
code
==
MF_MEDIA_ENGINE_ERR_NOERROR
,
"Unexpected code %u.
\n
"
,
code
);
hr
=
IMFMediaError_GetExtendedErrorCode
(
eo
);
ok
(
hr
==
S_OK
,
"Unexpected code %#x.
\n
"
,
hr
);
hr
=
IMFMediaError_SetErrorCode
(
eo
,
MF_MEDIA_ENGINE_ERR_ENCRYPTED
+
1
);
ok
(
hr
==
E_INVALIDARG
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaError_SetErrorCode
(
eo
,
MF_MEDIA_ENGINE_ERR_ABORTED
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
code
=
IMFMediaError_GetErrorCode
(
eo
);
ok
(
code
==
MF_MEDIA_ENGINE_ERR_ABORTED
,
"Unexpected code %u.
\n
"
,
code
);
hr
=
IMFMediaError_SetExtendedErrorCode
(
eo
,
E_FAIL
);
ok
(
hr
==
S_OK
,
"Unexpected hr %#x.
\n
"
,
hr
);
hr
=
IMFMediaError_GetExtendedErrorCode
(
eo
);
ok
(
hr
==
E_FAIL
,
"Unexpected code %#x.
\n
"
,
hr
);
IMFMediaError_Release
(
eo
);
}
START_TEST
(
mfmediaengine
)
...
...
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