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
3b0d68e4
Commit
3b0d68e4
authored
Apr 09, 2008
by
Dan Hipschman
Committed by
Alexandre Julliard
Apr 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qedit: Implement IMediaDet_get_StreamMediaType.
parent
38994a42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
10 deletions
+104
-10
mediadet.c
dlls/qedit/mediadet.c
+84
-4
mediadet.c
dlls/qedit/tests/mediadet.c
+20
-6
No files found.
dlls/qedit/mediadet.c
View file @
3b0d68e4
/* DirectShow Media Detector object (QEDIT.DLL)
*
* Copyright 2008 Google (Lei Zhang)
* Copyright 2008 Google (Lei Zhang
, Dan Hipschman
)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -17,6 +17,7 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <assert.h>
#include <stdarg.h>
#define COBJMACROS
...
...
@@ -39,10 +40,13 @@ typedef struct MediaDetImpl {
IBaseFilter
*
splitter
;
long
num_streams
;
long
cur_stream
;
IPin
*
cur_pin
;
}
MediaDetImpl
;
static
void
MD_cleanup
(
MediaDetImpl
*
This
)
{
if
(
This
->
cur_pin
)
IPin_Release
(
This
->
cur_pin
);
This
->
cur_pin
=
NULL
;
if
(
This
->
source
)
IBaseFilter_Release
(
This
->
source
);
This
->
source
=
NULL
;
if
(
This
->
splitter
)
IBaseFilter_Release
(
This
->
splitter
);
...
...
@@ -164,6 +168,47 @@ static HRESULT WINAPI MediaDet_get_CurrentStream(IMediaDet* iface, long *pVal)
return
S_OK
;
}
static
HRESULT
SetCurPin
(
MediaDetImpl
*
This
,
long
strm
)
{
IEnumPins
*
pins
;
IPin
*
pin
;
HRESULT
hr
;
assert
(
This
->
splitter
);
assert
(
0
<=
strm
&&
strm
<
This
->
num_streams
);
if
(
This
->
cur_pin
)
{
IPin_Release
(
This
->
cur_pin
);
This
->
cur_pin
=
NULL
;
}
hr
=
IBaseFilter_EnumPins
(
This
->
splitter
,
&
pins
);
if
(
FAILED
(
hr
))
return
hr
;
while
(
IEnumPins_Next
(
pins
,
1
,
&
pin
,
NULL
)
==
S_OK
&&
!
This
->
cur_pin
)
{
PIN_DIRECTION
dir
;
hr
=
IPin_QueryDirection
(
pin
,
&
dir
);
if
(
FAILED
(
hr
))
{
IPin_Release
(
pin
);
IEnumPins_Release
(
pins
);
return
hr
;
}
if
(
dir
==
PINDIR_OUTPUT
&&
strm
--
==
0
)
This
->
cur_pin
=
pin
;
else
IPin_Release
(
pin
);
}
IEnumPins_Release
(
pins
);
assert
(
This
->
cur_pin
);
return
S_OK
;
}
static
HRESULT
WINAPI
MediaDet_put_CurrentStream
(
IMediaDet
*
iface
,
long
newVal
)
{
MediaDetImpl
*
This
=
(
MediaDetImpl
*
)
iface
;
...
...
@@ -182,6 +227,10 @@ static HRESULT WINAPI MediaDet_put_CurrentStream(IMediaDet* iface, long newVal)
if
(
newVal
<
0
||
This
->
num_streams
<=
newVal
)
return
E_INVALIDARG
;
hr
=
SetCurPin
(
This
,
newVal
);
if
(
FAILED
(
hr
))
return
hr
;
This
->
cur_stream
=
newVal
;
return
S_OK
;
}
...
...
@@ -403,7 +452,11 @@ static HRESULT WINAPI MediaDet_put_Filename(IMediaDet* iface, BSTR newVal)
This
->
graph
=
gb
;
This
->
source
=
bf
;
return
GetSplitter
(
This
);
hr
=
GetSplitter
(
This
);
if
(
FAILED
(
hr
))
return
hr
;
return
MediaDet_put_CurrentStream
(
iface
,
0
);
}
static
HRESULT
WINAPI
MediaDet_GetBitmapBits
(
IMediaDet
*
iface
,
...
...
@@ -430,8 +483,34 @@ static HRESULT WINAPI MediaDet_get_StreamMediaType(IMediaDet* iface,
AM_MEDIA_TYPE
*
pVal
)
{
MediaDetImpl
*
This
=
(
MediaDetImpl
*
)
iface
;
FIXME
(
"(%p)->(%p): not implemented!
\n
"
,
This
,
pVal
);
return
E_NOTIMPL
;
IEnumMediaTypes
*
types
;
AM_MEDIA_TYPE
*
pmt
;
HRESULT
hr
;
TRACE
(
"(%p)
\n
"
,
This
);
if
(
!
pVal
)
return
E_POINTER
;
if
(
!
This
->
cur_pin
)
return
E_INVALIDARG
;
hr
=
IPin_EnumMediaTypes
(
This
->
cur_pin
,
&
types
);
if
(
SUCCEEDED
(
hr
))
{
hr
=
(
IEnumMediaTypes_Next
(
types
,
1
,
&
pmt
,
NULL
)
==
S_OK
?
S_OK
:
E_NOINTERFACE
);
IEnumMediaTypes_Release
(
types
);
}
if
(
SUCCEEDED
(
hr
))
{
*
pVal
=
*
pmt
;
CoTaskMemFree
(
pmt
);
}
return
hr
;
}
static
HRESULT
WINAPI
MediaDet_GetSampleGrabber
(
IMediaDet
*
iface
,
...
...
@@ -500,6 +579,7 @@ HRESULT MediaDet_create(IUnknown * pUnkOuter, LPVOID * ppv) {
obj
->
graph
=
NULL
;
obj
->
source
=
NULL
;
obj
->
splitter
=
NULL
;
obj
->
cur_pin
=
NULL
;
obj
->
num_streams
=
-
1
;
obj
->
cur_stream
=
0
;
*
ppv
=
obj
;
...
...
dlls/qedit/tests/mediadet.c
View file @
3b0d68e4
/*
* Unit tests for Media Detector
*
* Copyright (C) 2008 Google (Lei Zhang)
* Copyright (C) 2008 Google (Lei Zhang
, Dan Hipschman
)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
...
...
@@ -136,6 +136,12 @@ static void test_mediadet(void)
hr
=
IMediaDet_put_CurrentStream
(
pM
,
-
1
);
ok
(
hr
==
E_INVALIDARG
,
"IMediaDet_put_CurrentStream
\n
"
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
&
mt
);
ok
(
hr
==
E_INVALIDARG
,
"IMediaDet_get_StreamMediaType
\n
"
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
NULL
);
ok
(
hr
==
E_POINTER
,
"IMediaDet_get_StreamMediaType
\n
"
);
filename
=
SysAllocString
(
test_avi_filename
);
hr
=
IMediaDet_put_Filename
(
pM
,
filename
);
ok
(
hr
==
S_OK
,
"IMediaDet_put_Filename -> %x
\n
"
,
hr
);
...
...
@@ -147,6 +153,11 @@ static void test_mediadet(void)
ok
(
hr
==
S_OK
,
"IMediaDet_get_CurrentStream
\n
"
);
ok
(
strm
==
0
,
"IMediaDet_get_CurrentStream
\n
"
);
ZeroMemory
(
&
mt
,
sizeof
mt
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
&
mt
);
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
CoTaskMemFree
(
mt
.
pbFormat
);
/* Even before get_OutputStreams. */
hr
=
IMediaDet_put_CurrentStream
(
pM
,
1
);
ok
(
hr
==
E_INVALIDARG
,
"IMediaDet_put_CurrentStream
\n
"
);
...
...
@@ -195,9 +206,10 @@ static void test_mediadet(void)
ZeroMemory
(
&
mt
,
sizeof
mt
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
&
mt
);
todo_wine
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
todo_wine
ok
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Video
),
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
ok
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Video
),
"IMediaDet_get_StreamMediaType
\n
"
);
CoTaskMemFree
(
mt
.
pbFormat
);
hr
=
IMediaDet_Release
(
pM
);
ok
(
hr
==
0
,
"IMediaDet_Release returned: %x
\n
"
,
hr
);
...
...
@@ -235,12 +247,13 @@ static void test_mediadet(void)
ZeroMemory
(
&
mt
,
sizeof
mt
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
&
mt
);
todo_wine
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
flags
+=
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Video
)
?
1
:
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Audio
)
?
2
:
0
));
CoTaskMemFree
(
mt
.
pbFormat
);
hr
=
IMediaDet_put_CurrentStream
(
pM
,
1
);
ok
(
hr
==
S_OK
,
"IMediaDet_put_CurrentStream
\n
"
);
...
...
@@ -252,14 +265,15 @@ static void test_mediadet(void)
ZeroMemory
(
&
mt
,
sizeof
mt
);
hr
=
IMediaDet_get_StreamMediaType
(
pM
,
&
mt
);
todo_wine
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
ok
(
hr
==
S_OK
,
"IMediaDet_get_StreamMediaType
\n
"
);
flags
+=
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Video
)
?
1
:
(
IsEqualGUID
(
&
mt
.
majortype
,
&
MEDIATYPE_Audio
)
?
2
:
0
));
CoTaskMemFree
(
mt
.
pbFormat
);
todo_wine
ok
(
flags
==
3
,
"IMediaDet_get_StreamMediaType
\n
"
);
ok
(
flags
==
3
,
"IMediaDet_get_StreamMediaType
\n
"
);
hr
=
IMediaDet_put_CurrentStream
(
pM
,
2
);
ok
(
hr
==
E_INVALIDARG
,
"IMediaDet_put_CurrentStream
\n
"
);
...
...
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