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
b33f0583
Commit
b33f0583
authored
Oct 05, 2019
by
Zebediah Figura
Committed by
Alexandre Julliard
Oct 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
strmbase: Introduce a helper to more thoroughly trace media type.
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a9b87a82
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
116 additions
and
22 deletions
+116
-22
mediatype.c
dlls/strmbase/mediatype.c
+104
-6
pin.c
dlls/strmbase/pin.c
+5
-16
renderer.c
dlls/strmbase/renderer.c
+4
-0
transform.c
dlls/strmbase/transform.c
+1
-0
strmbase.h
include/wine/strmbase.h
+2
-0
No files found.
dlls/strmbase/mediatype.c
View file @
b33f0583
...
...
@@ -18,16 +18,108 @@
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <stdarg.h>
#define COBJMACROS
#include "dshow.h"
#include "wine/strmbase.h"
#include "wine/debug.h"
#include "strmbase_private.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
strmbase
);
static
const
struct
{
const
GUID
*
guid
;
const
char
*
name
;
}
strmbase_guids
[]
=
{
#define X(g) {&(g), #g}
X
(
GUID_NULL
),
#undef OUR_GUID_ENTRY
#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) X(name),
#include "uuids.h"
#undef X
};
static
const
char
*
strmbase_debugstr_guid
(
const
GUID
*
guid
)
{
unsigned
int
i
;
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
strmbase_guids
);
++
i
)
{
if
(
IsEqualGUID
(
strmbase_guids
[
i
].
guid
,
guid
))
return
wine_dbg_sprintf
(
"%s"
,
strmbase_guids
[
i
].
name
);
}
return
debugstr_guid
(
guid
);
}
static
const
char
*
debugstr_fourcc
(
DWORD
fourcc
)
{
char
str
[
4
]
=
{
fourcc
,
fourcc
>>
8
,
fourcc
>>
16
,
fourcc
>>
24
};
if
(
isprint
(
str
[
0
])
&&
isprint
(
str
[
1
])
&&
isprint
(
str
[
2
])
&&
isprint
(
str
[
3
]))
return
wine_dbgstr_an
(
str
,
4
);
return
wine_dbg_sprintf
(
"%#x"
,
fourcc
);
}
void
strmbase_dump_media_type
(
const
AM_MEDIA_TYPE
*
mt
)
{
if
(
!
TRACE_ON
(
strmbase
)
||
!
mt
)
return
;
TRACE
(
"Dumping media type %p: major type %s, subtype %s"
,
mt
,
strmbase_debugstr_guid
(
&
mt
->
majortype
),
strmbase_debugstr_guid
(
&
mt
->
subtype
));
if
(
mt
->
bFixedSizeSamples
)
TRACE
(
", fixed size samples"
);
if
(
mt
->
bTemporalCompression
)
TRACE
(
", temporal compression"
);
if
(
mt
->
lSampleSize
)
TRACE
(
", sample size %d"
,
mt
->
lSampleSize
);
if
(
mt
->
pUnk
)
TRACE
(
", pUnk %p"
,
mt
->
pUnk
);
TRACE
(
", format type %s.
\n
"
,
strmbase_debugstr_guid
(
&
mt
->
formattype
));
if
(
!
mt
->
pbFormat
)
return
;
TRACE
(
"Dumping format %p: "
,
mt
->
pbFormat
);
if
(
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_WaveFormatEx
)
&&
mt
->
cbFormat
>=
sizeof
(
WAVEFORMATEX
))
{
WAVEFORMATEX
*
wfx
=
(
WAVEFORMATEX
*
)
mt
->
pbFormat
;
TRACE
(
"tag %#x, %u channels, sample rate %u, %u bytes/sec, alignment %u, %u bits/sample.
\n
"
,
wfx
->
wFormatTag
,
wfx
->
nChannels
,
wfx
->
nSamplesPerSec
,
wfx
->
nAvgBytesPerSec
,
wfx
->
nBlockAlign
,
wfx
->
wBitsPerSample
);
if
(
wfx
->
cbSize
)
{
const
unsigned
char
*
extra
=
(
const
unsigned
char
*
)(
wfx
+
1
);
unsigned
int
i
;
TRACE
(
" Extra bytes:"
);
for
(
i
=
0
;
i
<
wfx
->
cbSize
;
++
i
)
{
if
(
!
(
i
%
16
))
TRACE
(
"
\n
"
);
TRACE
(
" %02x"
,
extra
[
i
]);
}
TRACE
(
"
\n
"
);
}
}
else
if
(
IsEqualGUID
(
&
mt
->
formattype
,
&
FORMAT_VideoInfo
)
&&
mt
->
cbFormat
>=
sizeof
(
VIDEOINFOHEADER
))
{
VIDEOINFOHEADER
*
vih
=
(
VIDEOINFOHEADER
*
)
mt
->
pbFormat
;
TRACE
(
"source %s, target %s, bitrate %u, error rate %u, %s sec/frame, "
,
wine_dbgstr_rect
(
&
vih
->
rcSource
),
wine_dbgstr_rect
(
&
vih
->
rcTarget
),
vih
->
dwBitRate
,
vih
->
dwBitErrorRate
,
debugstr_time
(
vih
->
AvgTimePerFrame
));
TRACE
(
"size %dx%d, %u planes, %u bpp, compression %s, image size %u"
,
vih
->
bmiHeader
.
biWidth
,
vih
->
bmiHeader
.
biHeight
,
vih
->
bmiHeader
.
biPlanes
,
vih
->
bmiHeader
.
biBitCount
,
debugstr_fourcc
(
vih
->
bmiHeader
.
biCompression
),
vih
->
bmiHeader
.
biSizeImage
);
if
(
vih
->
bmiHeader
.
biXPelsPerMeter
||
vih
->
bmiHeader
.
biYPelsPerMeter
)
TRACE
(
", resolution %dx%d"
,
vih
->
bmiHeader
.
biXPelsPerMeter
,
vih
->
bmiHeader
.
biYPelsPerMeter
);
if
(
vih
->
bmiHeader
.
biClrUsed
)
TRACE
(
", %d colours"
,
vih
->
bmiHeader
.
biClrUsed
);
if
(
vih
->
bmiHeader
.
biClrImportant
)
TRACE
(
", %d important colours"
,
vih
->
bmiHeader
.
biClrImportant
);
TRACE
(
".
\n
"
);
}
else
TRACE
(
"not implemented for this format type.
\n
"
);
}
HRESULT
WINAPI
CopyMediaType
(
AM_MEDIA_TYPE
*
dest
,
const
AM_MEDIA_TYPE
*
src
)
{
*
dest
=
*
src
;
...
...
@@ -176,6 +268,12 @@ static HRESULT WINAPI IEnumMediaTypesImpl_Next(IEnumMediaTypes *iface,
*
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
)
...
...
dlls/strmbase/pin.c
View file @
b33f0583
...
...
@@ -135,19 +135,8 @@ out:
return
hr
;
}
static
void
dump_AM_MEDIA_TYPE
(
const
AM_MEDIA_TYPE
*
pmt
)
{
if
(
!
pmt
)
return
;
TRACE
(
"
\t
%s
\n\t
%s
\n\t
...
\n\t
%s
\n
"
,
debugstr_guid
(
&
pmt
->
majortype
),
debugstr_guid
(
&
pmt
->
subtype
),
debugstr_guid
(
&
pmt
->
formattype
));
}
static
BOOL
CompareMediaTypes
(
const
AM_MEDIA_TYPE
*
pmt1
,
const
AM_MEDIA_TYPE
*
pmt2
,
BOOL
bWildcards
)
{
TRACE
(
"pmt1: "
);
dump_AM_MEDIA_TYPE
(
pmt1
);
TRACE
(
"pmt2: "
);
dump_AM_MEDIA_TYPE
(
pmt2
);
return
(((
bWildcards
&&
(
IsEqualGUID
(
&
pmt1
->
majortype
,
&
GUID_NULL
)
||
IsEqualGUID
(
&
pmt2
->
majortype
,
&
GUID_NULL
)))
||
IsEqualGUID
(
&
pmt1
->
majortype
,
&
pmt2
->
majortype
))
&&
((
bWildcards
&&
(
IsEqualGUID
(
&
pmt1
->
subtype
,
&
GUID_NULL
)
||
IsEqualGUID
(
&
pmt2
->
subtype
,
&
GUID_NULL
)))
||
IsEqualGUID
(
&
pmt1
->
subtype
,
&
pmt2
->
subtype
)));
}
...
...
@@ -257,6 +246,7 @@ HRESULT WINAPI BasePinImpl_ConnectionMediaType(IPin * iface, AM_MEDIA_TYPE * pmt
if
(
This
->
peer
)
{
CopyMediaType
(
pmt
,
&
This
->
mtCurrent
);
strmbase_dump_media_type
(
pmt
);
hr
=
S_OK
;
}
else
...
...
@@ -313,6 +303,7 @@ HRESULT WINAPI BasePinImpl_QueryAccept(IPin * iface, const AM_MEDIA_TYPE * pmt)
struct
strmbase_pin
*
This
=
impl_from_IPin
(
iface
);
TRACE
(
"(%p)->(%p)
\n
"
,
iface
,
pmt
);
strmbase_dump_media_type
(
pmt
);
return
(
This
->
pFuncsTable
->
pin_query_accept
(
This
,
pmt
)
==
S_OK
?
S_OK
:
S_FALSE
);
}
...
...
@@ -369,7 +360,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
struct
strmbase_source
*
This
=
impl_source_from_IPin
(
iface
);
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
pReceivePin
,
pmt
);
dump_AM_MEDIA_TYPE
(
pmt
);
strmbase_dump_media_type
(
pmt
);
if
(
!
pReceivePin
)
return
E_POINTER
;
...
...
@@ -400,7 +391,6 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
while
(
S_OK
==
IEnumMediaTypes_Next
(
pEnumCandidates
,
1
,
&
pmtCandidate
,
NULL
))
{
assert
(
pmtCandidate
);
dump_AM_MEDIA_TYPE
(
pmtCandidate
);
if
(
!
IsEqualGUID
(
&
FORMAT_None
,
&
pmtCandidate
->
formattype
)
&&
!
IsEqualGUID
(
&
GUID_NULL
,
&
pmtCandidate
->
formattype
))
assert
(
pmtCandidate
->
pbFormat
);
...
...
@@ -427,7 +417,7 @@ HRESULT WINAPI BaseOutputPinImpl_Connect(IPin * iface, IPin * pReceivePin, const
while
(
S_OK
==
IEnumMediaTypes_Next
(
pEnumCandidates
,
1
,
&
pmtCandidate
,
&
fetched
))
{
assert
(
pmtCandidate
);
dump_AM_MEDIA_TYPE
(
pmtCandidate
);
strmbase_dump_media_type
(
pmtCandidate
);
if
((
!
pmt
||
CompareMediaTypes
(
pmt
,
pmtCandidate
,
TRUE
))
&&
This
->
pFuncsTable
->
pfnAttemptConnection
(
This
,
pReceivePin
,
pmtCandidate
)
==
S_OK
)
{
...
...
@@ -653,7 +643,6 @@ HRESULT WINAPI BaseOutputPinImpl_AttemptConnection(struct strmbase_source *This,
IMemAllocator
*
pMemAlloc
=
NULL
;
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
pReceivePin
,
pmt
);
dump_AM_MEDIA_TYPE
(
pmt
);
if
((
hr
=
This
->
pFuncsTable
->
base
.
pin_query_accept
(
&
This
->
pin
,
pmt
))
!=
S_OK
)
return
hr
;
...
...
@@ -744,7 +733,7 @@ HRESULT WINAPI BaseInputPinImpl_ReceiveConnection(IPin * iface, IPin * pReceiveP
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p)->(%p, %p)
\n
"
,
This
,
pReceivePin
,
pmt
);
dump_AM_MEDIA_TYPE
(
pmt
);
strmbase_dump_media_type
(
pmt
);
EnterCriticalSection
(
&
This
->
pin
.
filter
->
csFilter
);
{
...
...
dlls/strmbase/renderer.c
View file @
b33f0583
...
...
@@ -51,6 +51,7 @@ static HRESULT WINAPI BaseRenderer_InputPin_ReceiveConnection(IPin *iface, IPin
HRESULT
hr
;
TRACE
(
"iface %p, peer %p, mt %p.
\n
"
,
iface
,
peer
,
mt
);
strmbase_dump_media_type
(
mt
);
EnterCriticalSection
(
&
filter
->
filter
.
csFilter
);
hr
=
BaseInputPinImpl_ReceiveConnection
(
iface
,
peer
,
mt
);
...
...
@@ -322,6 +323,9 @@ HRESULT WINAPI BaseRendererImpl_Receive(BaseRenderer *This, IMediaSample * pSamp
if
(
IMediaSample_GetMediaType
(
pSample
,
&
pmt
)
==
S_OK
)
{
TRACE
(
"Format change.
\n
"
);
strmbase_dump_media_type
(
pmt
);
if
(
FAILED
(
This
->
pFuncsTable
->
pfnCheckMediaType
(
This
,
pmt
)))
{
return
VFW_E_TYPE_NOT_ACCEPTED
;
...
...
dlls/strmbase/transform.c
View file @
b33f0583
...
...
@@ -387,6 +387,7 @@ static HRESULT WINAPI TransformFilter_InputPin_ReceiveConnection(IPin * iface, I
HRESULT
hr
=
S_OK
;
TRACE
(
"(%p)->(%p, %p)
\n
"
,
iface
,
pReceivePin
,
pmt
);
strmbase_dump_media_type
(
pmt
);
if
(
pTransform
->
pFuncsTable
->
pfnSetMediaType
)
hr
=
pTransform
->
pFuncsTable
->
pfnSetMediaType
(
pTransform
,
PINDIR_INPUT
,
pmt
);
...
...
include/wine/strmbase.h
View file @
b33f0583
...
...
@@ -26,6 +26,8 @@ void WINAPI FreeMediaType(AM_MEDIA_TYPE * pMediaType);
AM_MEDIA_TYPE
*
WINAPI
CreateMediaType
(
AM_MEDIA_TYPE
const
*
pSrc
);
void
WINAPI
DeleteMediaType
(
AM_MEDIA_TYPE
*
pMediaType
);
void
strmbase_dump_media_type
(
const
AM_MEDIA_TYPE
*
mt
);
/* Pin functions */
struct
strmbase_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