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
2d5ea4b5
Commit
2d5ea4b5
authored
Feb 12, 2010
by
Paul Chitescu
Committed by
Alexandre Julliard
Feb 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit: Add media type enumerator to SampleGrabber.
parent
43fe5e35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
158 additions
and
2 deletions
+158
-2
samplegrabber.c
dlls/qedit/samplegrabber.c
+158
-2
No files found.
dlls/qedit/samplegrabber.c
View file @
2d5ea4b5
...
@@ -37,6 +37,7 @@ static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
...
@@ -37,6 +37,7 @@ static WCHAR const pin_in_name[] = { 'I', 'n', 0 };
static
WCHAR
const
pin_out_name
[]
=
{
'O'
,
'u'
,
't'
,
0
};
static
WCHAR
const
pin_out_name
[]
=
{
'O'
,
'u'
,
't'
,
0
};
IEnumPins
*
pinsenum_create
(
IBaseFilter
*
filter
,
IPin
**
pins
,
ULONG
pinCount
);
IEnumPins
*
pinsenum_create
(
IBaseFilter
*
filter
,
IPin
**
pins
,
ULONG
pinCount
);
IEnumMediaTypes
*
mediaenum_create
(
AM_MEDIA_TYPE
*
mtype
);
/* Fixed pins enumerator, holds filter referenced */
/* Fixed pins enumerator, holds filter referenced */
typedef
struct
_PE_Impl
{
typedef
struct
_PE_Impl
{
...
@@ -190,6 +191,160 @@ IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
...
@@ -190,6 +191,160 @@ IEnumPins *pinsenum_create(IBaseFilter *filter, IPin **pins, ULONG pinCount)
}
}
/* Single media type enumerator */
typedef
struct
_ME_Impl
{
IEnumMediaTypes
me
;
LONG
refCount
;
BOOL
past
;
AM_MEDIA_TYPE
mtype
;
}
ME_Impl
;
/* IEnumMediaTypes interface implementation */
/* IUnknown */
static
ULONG
WINAPI
Single_IEnumMediaTypes_AddRef
(
IEnumMediaTypes
*
iface
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
ULONG
refCount
=
InterlockedIncrement
(
&
This
->
refCount
);
TRACE
(
"(%p) new ref = %u
\n
"
,
This
,
refCount
);
return
refCount
;
}
/* IUnknown */
static
ULONG
WINAPI
Single_IEnumMediaTypes_Release
(
IEnumMediaTypes
*
iface
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
ULONG
refCount
=
InterlockedDecrement
(
&
This
->
refCount
);
TRACE
(
"(%p) new ref = %u
\n
"
,
This
,
refCount
);
if
(
refCount
==
0
)
{
if
(
This
->
mtype
.
pbFormat
)
CoTaskMemFree
(
This
->
mtype
.
pbFormat
);
CoTaskMemFree
(
This
);
return
0
;
}
return
refCount
;
}
/* IUnknown */
static
HRESULT
WINAPI
Single_IEnumMediaTypes_QueryInterface
(
IEnumMediaTypes
*
iface
,
REFIID
riid
,
void
**
ppvObject
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
TRACE
(
"(%p)->(%s %p)
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
if
(
IsEqualIID
(
riid
,
&
IID_IUnknown
)
||
IsEqualIID
(
riid
,
&
IID_IEnumMediaTypes
))
{
Single_IEnumMediaTypes_AddRef
(
iface
);
*
ppvObject
=
&
(
This
->
me
);
return
S_OK
;
}
*
ppvObject
=
NULL
;
WARN
(
"(%p, %s,%p): not found
\n
"
,
This
,
debugstr_guid
(
riid
),
ppvObject
);
return
E_NOINTERFACE
;
}
/* IEnumMediaTypes */
static
HRESULT
WINAPI
Single_IEnumMediaTypes_Next
(
IEnumMediaTypes
*
iface
,
ULONG
nTypes
,
AM_MEDIA_TYPE
**
types
,
ULONG
*
fetched
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
ULONG
count
=
0
;
TRACE
(
"(%p)->(%u, %p, %p)
\n
"
,
This
,
nTypes
,
types
,
fetched
);
if
(
!
nTypes
)
return
E_INVALIDARG
;
if
(
!
types
||
((
nTypes
!=
1
)
&&
!
fetched
))
return
E_POINTER
;
if
(
!
This
->
past
)
{
AM_MEDIA_TYPE
*
mtype
=
CoTaskMemAlloc
(
sizeof
(
AM_MEDIA_TYPE
));
*
mtype
=
This
->
mtype
;
if
(
mtype
->
cbFormat
)
{
mtype
->
pbFormat
=
CoTaskMemAlloc
(
mtype
->
cbFormat
);
CopyMemory
(
mtype
->
pbFormat
,
This
->
mtype
.
pbFormat
,
mtype
->
cbFormat
);
}
*
types
=
mtype
;
This
->
past
=
TRUE
;
count
=
1
;
}
if
(
fetched
)
*
fetched
=
count
;
return
(
count
==
nTypes
)
?
S_OK
:
S_FALSE
;
}
/* IEnumMediaTypes */
static
HRESULT
WINAPI
Single_IEnumMediaTypes_Skip
(
IEnumMediaTypes
*
iface
,
ULONG
nTypes
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
TRACE
(
"(%p)->(%u)
\n
"
,
This
,
nTypes
);
if
(
nTypes
)
This
->
past
=
TRUE
;
return
This
->
past
?
S_FALSE
:
S_OK
;
}
/* IEnumMediaTypes */
static
HRESULT
WINAPI
Single_IEnumMediaTypes_Reset
(
IEnumMediaTypes
*
iface
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
TRACE
(
"(%p)->()
\n
"
,
This
);
This
->
past
=
FALSE
;
return
S_OK
;
}
/* IEnumMediaTypes */
static
HRESULT
WINAPI
Single_IEnumMediaTypes_Clone
(
IEnumMediaTypes
*
iface
,
IEnumMediaTypes
**
me
)
{
ME_Impl
*
This
=
(
ME_Impl
*
)
iface
;
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
me
);
if
(
!
me
)
return
E_POINTER
;
*
me
=
mediaenum_create
(
&
This
->
mtype
);
if
(
!*
me
)
return
E_OUTOFMEMORY
;
((
ME_Impl
*
)
*
me
)
->
past
=
This
->
past
;
return
S_OK
;
}
/* Virtual tables and constructor */
static
const
IEnumMediaTypesVtbl
IEnumMediaTypes_VTable
=
{
Single_IEnumMediaTypes_QueryInterface
,
Single_IEnumMediaTypes_AddRef
,
Single_IEnumMediaTypes_Release
,
Single_IEnumMediaTypes_Next
,
Single_IEnumMediaTypes_Skip
,
Single_IEnumMediaTypes_Reset
,
Single_IEnumMediaTypes_Clone
,
};
IEnumMediaTypes
*
mediaenum_create
(
AM_MEDIA_TYPE
*
mtype
)
{
ME_Impl
*
obj
=
CoTaskMemAlloc
(
sizeof
(
ME_Impl
));
if
(
obj
)
{
ZeroMemory
(
obj
,
sizeof
(
ME_Impl
));
obj
->
me
.
lpVtbl
=
&
IEnumMediaTypes_VTable
;
obj
->
refCount
=
1
;
obj
->
past
=
FALSE
;
obj
->
mtype
=
*
mtype
;
obj
->
mtype
.
pUnk
=
NULL
;
if
(
mtype
->
cbFormat
)
{
obj
->
mtype
.
pbFormat
=
CoTaskMemAlloc
(
mtype
->
cbFormat
);
CopyMemory
(
obj
->
mtype
.
pbFormat
,
mtype
->
pbFormat
,
mtype
->
cbFormat
);
}
else
obj
->
mtype
.
pbFormat
=
NULL
;
}
return
&
obj
->
me
;
}
/* Sample Grabber pin implementation */
/* Sample Grabber pin implementation */
typedef
struct
_SG_Pin
{
typedef
struct
_SG_Pin
{
const
IPinVtbl
*
lpVtbl
;
const
IPinVtbl
*
lpVtbl
;
...
@@ -1039,10 +1194,11 @@ static HRESULT WINAPI
...
@@ -1039,10 +1194,11 @@ static HRESULT WINAPI
SampleGrabber_IPin_EnumMediaTypes
(
IPin
*
iface
,
IEnumMediaTypes
**
mtypes
)
SampleGrabber_IPin_EnumMediaTypes
(
IPin
*
iface
,
IEnumMediaTypes
**
mtypes
)
{
{
SG_Pin
*
This
=
(
SG_Pin
*
)
iface
;
SG_Pin
*
This
=
(
SG_Pin
*
)
iface
;
FIXME
(
"(%p)->(%p): stub
\n
"
,
This
,
mtypes
);
TRACE
(
"(%p)->(%p)
\n
"
,
This
,
mtypes
);
if
(
!
mtypes
)
if
(
!
mtypes
)
return
E_POINTER
;
return
E_POINTER
;
return
E_OUTOFMEMORY
;
*
mtypes
=
mediaenum_create
(
&
This
->
sg
->
mtype
);
return
*
mtypes
?
S_OK
:
E_OUTOFMEMORY
;
}
}
/* IPin - input pin */
/* IPin - input pin */
...
...
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