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
85d411aa
Commit
85d411aa
authored
Jan 28, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Jan 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strmbase: Move the IEnumMediaTypes implementation to pin.c.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
0820b125
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
176 additions
and
172 deletions
+176
-172
mediatype.c
dlls/strmbase/mediatype.c
+0
-170
pin.c
dlls/strmbase/pin.c
+176
-0
strmbase_private.h
dlls/strmbase/strmbase_private.h
+0
-2
No files found.
dlls/strmbase/mediatype.c
View file @
85d411aa
...
...
@@ -168,173 +168,3 @@ void WINAPI DeleteMediaType(AM_MEDIA_TYPE * pMediaType)
FreeMediaType
(
pMediaType
);
CoTaskMemFree
(
pMediaType
);
}
typedef
struct
IEnumMediaTypesImpl
{
IEnumMediaTypes
IEnumMediaTypes_iface
;
LONG
refCount
;
struct
strmbase_pin
*
basePin
;
ULONG
count
;
ULONG
uIndex
;
}
IEnumMediaTypesImpl
;
static
inline
IEnumMediaTypesImpl
*
impl_from_IEnumMediaTypes
(
IEnumMediaTypes
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
IEnumMediaTypesImpl
,
IEnumMediaTypes_iface
);
}
static
const
struct
IEnumMediaTypesVtbl
IEnumMediaTypesImpl_Vtbl
;
HRESULT
enum_media_types_create
(
struct
strmbase_pin
*
basePin
,
IEnumMediaTypes
**
ppEnum
)
{
IEnumMediaTypesImpl
*
pEnumMediaTypes
=
CoTaskMemAlloc
(
sizeof
(
IEnumMediaTypesImpl
));
*
ppEnum
=
NULL
;
if
(
!
pEnumMediaTypes
)
return
E_OUTOFMEMORY
;
pEnumMediaTypes
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
IEnumMediaTypesImpl_Vtbl
;
pEnumMediaTypes
->
refCount
=
1
;
pEnumMediaTypes
->
uIndex
=
0
;
IPin_AddRef
(
&
basePin
->
IPin_iface
);
pEnumMediaTypes
->
basePin
=
basePin
;
IEnumMediaTypes_Reset
(
&
pEnumMediaTypes
->
IEnumMediaTypes_iface
);
*
ppEnum
=
&
pEnumMediaTypes
->
IEnumMediaTypes_iface
;
return
S_OK
;
}
static
HRESULT
WINAPI
IEnumMediaTypesImpl_QueryInterface
(
IEnumMediaTypes
*
iface
,
REFIID
riid
,
void
**
ret_iface
)
{
TRACE
(
"(%p)->(%s, %p)
\n
"
,
iface
,
debugstr_guid
(
riid
),
ret_iface
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IEnumMediaTypes
))
{
IEnumMediaTypes_AddRef
(
iface
);
*
ret_iface
=
iface
;
return
S_OK
;
}
*
ret_iface
=
NULL
;
WARN
(
"No interface for %s
\n
"
,
debugstr_guid
(
riid
));
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
IEnumMediaTypesImpl_AddRef
(
IEnumMediaTypes
*
iface
)
{
IEnumMediaTypesImpl
*
This
=
impl_from_IEnumMediaTypes
(
iface
);
ULONG
ref
=
InterlockedIncrement
(
&
This
->
refCount
);
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
iface
,
ref
);
return
ref
;
}
static
ULONG
WINAPI
IEnumMediaTypesImpl_Release
(
IEnumMediaTypes
*
iface
)
{
IEnumMediaTypesImpl
*
This
=
impl_from_IEnumMediaTypes
(
iface
);
ULONG
ref
=
InterlockedDecrement
(
&
This
->
refCount
);
TRACE
(
"(%p)->(): new ref = %u
\n
"
,
iface
,
ref
);
if
(
!
ref
)
{
IPin_Release
(
&
This
->
basePin
->
IPin_iface
);
CoTaskMemFree
(
This
);
}
return
ref
;
}
static
HRESULT
WINAPI
IEnumMediaTypesImpl_Next
(
IEnumMediaTypes
*
iface
,
ULONG
count
,
AM_MEDIA_TYPE
**
mts
,
ULONG
*
ret_count
)
{
IEnumMediaTypesImpl
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
ULONG
i
;
TRACE
(
"iface %p, count %u, mts %p, ret_count %p.
\n
"
,
iface
,
count
,
mts
,
ret_count
);
for
(
i
=
0
;
i
<
count
&&
enummt
->
uIndex
+
i
<
enummt
->
count
;
i
++
)
{
if
(
!
(
mts
[
i
]
=
CoTaskMemAlloc
(
sizeof
(
AM_MEDIA_TYPE
)))
||
FAILED
(
enummt
->
basePin
->
pFuncsTable
->
pin_get_media_type
(
enummt
->
basePin
,
enummt
->
uIndex
+
i
,
mts
[
i
])))
{
while
(
i
--
)
DeleteMediaType
(
mts
[
i
]);
*
ret_count
=
0
;
return
E_OUTOFMEMORY
;
}
if
(
TRACE_ON
(
strmbase
))
{
TRACE
(
"Returning media type %u:
\n
"
,
enummt
->
uIndex
+
i
);
strmbase_dump_media_type
(
mts
[
i
]);
}
}
if
((
count
!=
1
)
||
ret_count
)
*
ret_count
=
i
;
enummt
->
uIndex
+=
i
;
return
i
==
count
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
IEnumMediaTypesImpl_Skip
(
IEnumMediaTypes
*
iface
,
ULONG
count
)
{
IEnumMediaTypesImpl
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
TRACE
(
"iface %p, count %u.
\n
"
,
iface
,
count
);
enummt
->
uIndex
+=
count
;
return
enummt
->
uIndex
>
enummt
->
count
?
S_FALSE
:
S_OK
;
}
static
HRESULT
WINAPI
IEnumMediaTypesImpl_Reset
(
IEnumMediaTypes
*
iface
)
{
ULONG
i
;
AM_MEDIA_TYPE
amt
;
IEnumMediaTypesImpl
*
This
=
impl_from_IEnumMediaTypes
(
iface
);
TRACE
(
"(%p)->()
\n
"
,
iface
);
i
=
0
;
while
(
This
->
basePin
->
pFuncsTable
->
pin_get_media_type
(
This
->
basePin
,
i
,
&
amt
)
==
S_OK
)
{
FreeMediaType
(
&
amt
);
i
++
;
}
This
->
count
=
i
;
This
->
uIndex
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
IEnumMediaTypesImpl_Clone
(
IEnumMediaTypes
*
iface
,
IEnumMediaTypes
**
ppEnum
)
{
HRESULT
hr
;
IEnumMediaTypesImpl
*
This
=
impl_from_IEnumMediaTypes
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
iface
,
ppEnum
);
hr
=
enum_media_types_create
(
This
->
basePin
,
ppEnum
);
if
(
FAILED
(
hr
))
return
hr
;
return
IEnumMediaTypes_Skip
(
*
ppEnum
,
This
->
uIndex
);
}
static
const
IEnumMediaTypesVtbl
IEnumMediaTypesImpl_Vtbl
=
{
IEnumMediaTypesImpl_QueryInterface
,
IEnumMediaTypesImpl_AddRef
,
IEnumMediaTypesImpl_Release
,
IEnumMediaTypesImpl_Next
,
IEnumMediaTypesImpl_Skip
,
IEnumMediaTypesImpl_Reset
,
IEnumMediaTypesImpl_Clone
};
dlls/strmbase/pin.c
View file @
85d411aa
...
...
@@ -27,6 +27,182 @@ static const IMemInputPinVtbl MemInputPin_Vtbl;
typedef
HRESULT
(
*
SendPinFunc
)(
IPin
*
to
,
LPVOID
arg
);
struct
enum_media_types
{
IEnumMediaTypes
IEnumMediaTypes_iface
;
LONG
refcount
;
unsigned
int
index
,
count
;
struct
strmbase_pin
*
pin
;
};
static
const
IEnumMediaTypesVtbl
enum_media_types_vtbl
;
static
HRESULT
enum_media_types_create
(
struct
strmbase_pin
*
pin
,
IEnumMediaTypes
**
out
)
{
struct
enum_media_types
*
object
;
AM_MEDIA_TYPE
mt
;
if
(
!
out
)
return
E_POINTER
;
if
(
!
(
object
=
heap_alloc_zero
(
sizeof
(
*
object
))))
{
*
out
=
NULL
;
return
E_OUTOFMEMORY
;
}
object
->
IEnumMediaTypes_iface
.
lpVtbl
=
&
enum_media_types_vtbl
;
object
->
refcount
=
1
;
object
->
pin
=
pin
;
IPin_AddRef
(
&
pin
->
IPin_iface
);
while
(
pin
->
pFuncsTable
->
pin_get_media_type
(
pin
,
object
->
count
,
&
mt
)
==
S_OK
)
{
FreeMediaType
(
&
mt
);
++
object
->
count
;
}
TRACE
(
"Created enumerator %p.
\n
"
,
object
);
*
out
=
&
object
->
IEnumMediaTypes_iface
;
return
S_OK
;
}
static
struct
enum_media_types
*
impl_from_IEnumMediaTypes
(
IEnumMediaTypes
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
enum_media_types
,
IEnumMediaTypes_iface
);
}
static
HRESULT
WINAPI
enum_media_types_QueryInterface
(
IEnumMediaTypes
*
iface
,
REFIID
iid
,
void
**
out
)
{
TRACE
(
"iface %p, iid %s, out %p.
\n
"
,
iface
,
debugstr_guid
(
iid
),
out
);
if
(
IsEqualGUID
(
iid
,
&
IID_IUnknown
)
||
IsEqualGUID
(
iid
,
&
IID_IEnumMediaTypes
))
{
IEnumMediaTypes_AddRef
(
iface
);
*
out
=
iface
;
return
S_OK
;
}
WARN
(
"%s not implemented, returning E_NOINTERFACE.
\n
"
,
debugstr_guid
(
iid
));
*
out
=
NULL
;
return
E_NOINTERFACE
;
}
static
ULONG
WINAPI
enum_media_types_AddRef
(
IEnumMediaTypes
*
iface
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
ULONG
refcount
=
InterlockedIncrement
(
&
enummt
->
refcount
);
TRACE
(
"%p increasing refcount to %u.
\n
"
,
enummt
,
refcount
);
return
refcount
;
}
static
ULONG
WINAPI
enum_media_types_Release
(
IEnumMediaTypes
*
iface
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
ULONG
refcount
=
InterlockedDecrement
(
&
enummt
->
refcount
);
TRACE
(
"%p decreasing refcount to %u.
\n
"
,
enummt
,
refcount
);
if
(
!
refcount
)
{
IPin_Release
(
&
enummt
->
pin
->
IPin_iface
);
heap_free
(
enummt
);
}
return
refcount
;
}
static
HRESULT
WINAPI
enum_media_types_Next
(
IEnumMediaTypes
*
iface
,
ULONG
count
,
AM_MEDIA_TYPE
**
mts
,
ULONG
*
ret_count
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
unsigned
int
i
;
HRESULT
hr
;
TRACE
(
"enummt %p, count %u, mts %p, ret_count %p.
\n
"
,
enummt
,
count
,
mts
,
ret_count
);
for
(
i
=
0
;
i
<
count
;
++
i
)
{
if
((
mts
[
i
]
=
CoTaskMemAlloc
(
sizeof
(
AM_MEDIA_TYPE
))))
hr
=
enummt
->
pin
->
pFuncsTable
->
pin_get_media_type
(
enummt
->
pin
,
enummt
->
index
+
i
,
mts
[
i
]);
else
hr
=
E_OUTOFMEMORY
;
if
(
FAILED
(
hr
))
{
while
(
i
--
)
DeleteMediaType
(
mts
[
i
]);
*
ret_count
=
0
;
return
E_OUTOFMEMORY
;
}
else
if
(
hr
!=
S_OK
)
break
;
if
(
TRACE_ON
(
strmbase
))
{
TRACE
(
"Returning media type %u:
\n
"
,
enummt
->
index
+
i
);
strmbase_dump_media_type
(
mts
[
i
]);
}
}
if
(
count
!=
1
||
ret_count
)
*
ret_count
=
i
;
enummt
->
index
+=
i
;
return
i
==
count
?
S_OK
:
S_FALSE
;
}
static
HRESULT
WINAPI
enum_media_types_Skip
(
IEnumMediaTypes
*
iface
,
ULONG
count
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
TRACE
(
"enummt %p, count %u.
\n
"
,
enummt
,
count
);
enummt
->
index
+=
count
;
return
enummt
->
index
>
enummt
->
count
?
S_FALSE
:
S_OK
;
}
static
HRESULT
WINAPI
enum_media_types_Reset
(
IEnumMediaTypes
*
iface
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
AM_MEDIA_TYPE
mt
;
TRACE
(
"enummt %p.
\n
"
,
enummt
);
enummt
->
count
=
0
;
while
(
enummt
->
pin
->
pFuncsTable
->
pin_get_media_type
(
enummt
->
pin
,
enummt
->
count
,
&
mt
)
==
S_OK
)
{
FreeMediaType
(
&
mt
);
++
enummt
->
count
;
}
enummt
->
index
=
0
;
return
S_OK
;
}
static
HRESULT
WINAPI
enum_media_types_Clone
(
IEnumMediaTypes
*
iface
,
IEnumMediaTypes
**
out
)
{
struct
enum_media_types
*
enummt
=
impl_from_IEnumMediaTypes
(
iface
);
HRESULT
hr
;
TRACE
(
"enummt %p, out %p.
\n
"
,
enummt
,
out
);
if
(
FAILED
(
hr
=
enum_media_types_create
(
enummt
->
pin
,
out
)))
return
hr
;
return
IEnumMediaTypes_Skip
(
*
out
,
enummt
->
index
);
}
static
const
IEnumMediaTypesVtbl
enum_media_types_vtbl
=
{
enum_media_types_QueryInterface
,
enum_media_types_AddRef
,
enum_media_types_Release
,
enum_media_types_Next
,
enum_media_types_Skip
,
enum_media_types_Reset
,
enum_media_types_Clone
,
};
static
inline
struct
strmbase_pin
*
impl_from_IPin
(
IPin
*
iface
)
{
return
CONTAINING_RECORD
(
iface
,
struct
strmbase_pin
,
IPin_iface
);
...
...
dlls/strmbase/strmbase_private.h
View file @
85d411aa
...
...
@@ -77,8 +77,6 @@ void QualityControlRender_DoQOS(QualityControlImpl *priv);
void
QualityControlRender_BeginRender
(
QualityControlImpl
*
This
,
REFERENCE_TIME
start
,
REFERENCE_TIME
stop
);
void
QualityControlRender_EndRender
(
QualityControlImpl
*
This
);
HRESULT
enum_media_types_create
(
struct
strmbase_pin
*
pin
,
IEnumMediaTypes
**
enum_media_types
)
DECLSPEC_HIDDEN
;
HRESULT
WINAPI
RendererPosPassThru_RegisterMediaTime
(
IUnknown
*
iface
,
REFERENCE_TIME
start
);
HRESULT
WINAPI
RendererPosPassThru_ResetMediaTime
(
IUnknown
*
iface
);
HRESULT
WINAPI
RendererPosPassThru_EOS
(
IUnknown
*
iface
);
...
...
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