ReactOS 0.4.17-dev-966-gf06eace
mediatype.c File Reference
#include "strmbase_private.h"
#include "dvdmedia.h"
#include "dxva.h"
#include "uuids.h"
Include dependency graph for mediatype.c:

Go to the source code of this file.

Macros

#define X(g)   {&(g), #g}
 
#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)   X(name),
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (quartz)
 
static const char * strmbase_debugstr_guid (const GUID *guid)
 
void strmbase_dump_media_type (const AM_MEDIA_TYPE *mt)
 
HRESULT WINAPI CopyMediaType (AM_MEDIA_TYPE *dest, const AM_MEDIA_TYPE *src)
 
void WINAPI FreeMediaType (AM_MEDIA_TYPE *pMediaType)
 
AM_MEDIA_TYPE *WINAPI CreateMediaType (AM_MEDIA_TYPE const *pSrc)
 
void WINAPI DeleteMediaType (AM_MEDIA_TYPE *pMediaType)
 

Variables

struct {
   const GUID *   guid
 
   const char *   name
 
} strmbase_guids []
 

Macro Definition Documentation

◆ OUR_GUID_ENTRY

#define OUR_GUID_ENTRY (   name,
  l,
  w1,
  w2,
  b1,
  b2,
  b3,
  b4,
  b5,
  b6,
  b7,
  b8 
)    X(name),

◆ X

#define X (   g)    {&(g), #g}

Function Documentation

◆ CopyMediaType()

HRESULT WINAPI CopyMediaType ( AM_MEDIA_TYPE *  dest,
const AM_MEDIA_TYPE *  src 
)

Definition at line 150 of file mediatype.c.

151{
152 *dest = *src;
153 if (src->pbFormat)
154 {
155 dest->pbFormat = CoTaskMemAlloc(src->cbFormat);
156 if (!dest->pbFormat)
157 return E_OUTOFMEMORY;
158 memcpy(dest->pbFormat, src->pbFormat, src->cbFormat);
159 }
160 if (dest->pUnk)
161 IUnknown_AddRef(dest->pUnk);
162 return S_OK;
163}
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
void *WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: malloc.c:381
GLenum src
Definition: glext.h:6340
#define S_OK
Definition: intsafe.h:52
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static char * dest
Definition: rtl.c:149

Referenced by acm_wrapper_sink_connect(), acm_wrapper_source_get_media_type(), AMStreamConfig_GetFormat(), audio_sink_ConnectionMediaType(), audio_sink_ReceiveConnection(), BaseOutputPinImpl_AttemptConnection(), configure_buffer(), CreateMediaType(), ddraw_IDirectDrawMediaStream_SetFormat(), ddraw_sink_ConnectionMediaType(), ddraw_sink_ReceiveConnection(), FileAsyncReaderPin_AttemptConnection(), FileSource_GetCurFile(), FileSource_Load(), fill_media_type(), pin_ConnectionMediaType(), sample_grabber_sink_get_media_type(), sample_grabber_source_get_media_type(), SampleGrabber_ISampleGrabber_GetConnectedMediaType(), SampleGrabber_ISampleGrabber_SetMediaType(), sink_get_media_type(), sink_ReceiveConnection(), source_get_media_type(), StdMediaSample2_GetMediaType(), StdMediaSample2_SetMediaType(), stream_config_GetFormat(), stream_config_SetFormat(), test_connect_pin(), testsink_get_media_type(), testsource_AttemptConnection(), testsource_get_media_type(), and TransformFilter_Output_GetMediaType().

◆ CreateMediaType()

AM_MEDIA_TYPE *WINAPI CreateMediaType ( AM_MEDIA_TYPE const *  pSrc)

Definition at line 176 of file mediatype.c.

177{
178 AM_MEDIA_TYPE * pDest;
179
180 pDest = CoTaskMemAlloc(sizeof(AM_MEDIA_TYPE));
181 if (!pDest)
182 return NULL;
183
184 if (FAILED(CopyMediaType(pDest, pSrc)))
185 {
186 CoTaskMemFree(pDest);
187 return NULL;
188 }
189
190 return pDest;
191}
#define NULL
Definition: types.h:112
void WINAPI CoTaskMemFree(void *ptr)
Definition: malloc.c:389
#define FAILED(hr)
Definition: intsafe.h:51
HRESULT WINAPI CopyMediaType(AM_MEDIA_TYPE *dest, const AM_MEDIA_TYPE *src)
Definition: mediatype.c:150

◆ DeleteMediaType()

◆ FreeMediaType()

◆ strmbase_debugstr_guid()

static const char * strmbase_debugstr_guid ( const GUID *  guid)
static

Definition at line 45 of file mediatype.c.

46{
47 unsigned int i;
48
49 for (i = 0; i < ARRAY_SIZE(strmbase_guids); ++i)
50 {
53 }
54
55 return debugstr_guid(guid);
56}
#define ARRAY_SIZE(A)
Definition: main.h:20
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define debugstr_guid
Definition: kernel32.h:35
static const struct @5231 strmbase_guids[]
const GUID * guid
Definition: mediatype.c:30
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
Definition: name.c:39

Referenced by strmbase_dump_media_type().

◆ strmbase_dump_media_type()

void strmbase_dump_media_type ( const AM_MEDIA_TYPE *  mt)

Definition at line 58 of file mediatype.c.

59{
60 if (!TRACE_ON(quartz) || !mt) return;
61
62 TRACE("Dumping media type %p: major type %s, subtype %s",
63 mt, strmbase_debugstr_guid(&mt->majortype), strmbase_debugstr_guid(&mt->subtype));
64 if (mt->bFixedSizeSamples) TRACE(", fixed size samples");
65 if (mt->bTemporalCompression) TRACE(", temporal compression");
66 if (mt->lSampleSize) TRACE(", sample size %ld", mt->lSampleSize);
67 if (mt->pUnk) TRACE(", pUnk %p", mt->pUnk);
68 TRACE(", format type %s.\n", strmbase_debugstr_guid(&mt->formattype));
69
70 if (!mt->pbFormat) return;
71
72 TRACE("Dumping format %p: ", mt->pbFormat);
73
74 if (IsEqualGUID(&mt->formattype, &FORMAT_WaveFormatEx) && mt->cbFormat >= sizeof(WAVEFORMATEX))
75 {
76 WAVEFORMATEX *wfx = (WAVEFORMATEX *)mt->pbFormat;
77
78 TRACE("tag %#x, %u channels, sample rate %lu, %lu bytes/sec, alignment %u, %u bits/sample.\n",
79 wfx->wFormatTag, wfx->nChannels, wfx->nSamplesPerSec,
81
82 if (wfx->cbSize)
83 {
84 const unsigned char *extra = (const unsigned char *)(wfx + 1);
85 unsigned int i;
86
87 TRACE(" Extra bytes:");
88 for (i = 0; i < wfx->cbSize; ++i)
89 {
90 if (!(i % 16)) TRACE("\n ");
91 TRACE(" %02x", extra[i]);
92 }
93 TRACE("\n");
94 }
95 }
96 else if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo) && mt->cbFormat >= sizeof(VIDEOINFOHEADER))
97 {
98 VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)mt->pbFormat;
99
100 if (!IsRectEmpty(&vih->rcSource)) TRACE("source %s, ", wine_dbgstr_rect(&vih->rcSource));
101 if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget));
102 if (vih->dwBitRate) TRACE("bitrate %lu, ", vih->dwBitRate);
103 if (vih->dwBitErrorRate) TRACE("error rate %lu, ", vih->dwBitErrorRate);
104 TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame));
105 TRACE("size %ldx%ld, %u planes, %u bpp, compression %s, image size %lu",
110 TRACE(", resolution %ldx%ld", vih->bmiHeader.biXPelsPerMeter, vih->bmiHeader.biYPelsPerMeter);
111 if (vih->bmiHeader.biClrUsed) TRACE(", %lu colours", vih->bmiHeader.biClrUsed);
112 if (vih->bmiHeader.biClrImportant) TRACE(", %lu important colours", vih->bmiHeader.biClrImportant);
113 TRACE(".\n");
114 }
115 else if (IsEqualGUID(&mt->formattype, &FORMAT_VideoInfo2) && mt->cbFormat >= sizeof(VIDEOINFOHEADER2))
116 {
117 VIDEOINFOHEADER2 *vih = (VIDEOINFOHEADER2 *)mt->pbFormat;
118
119 if (!IsRectEmpty(&vih->rcSource)) TRACE("source %s, ", wine_dbgstr_rect(&vih->rcSource));
120 if (!IsRectEmpty(&vih->rcTarget)) TRACE("target %s, ", wine_dbgstr_rect(&vih->rcTarget));
121 if (vih->dwBitRate) TRACE("bitrate %lu, ", vih->dwBitRate);
122 if (vih->dwBitErrorRate) TRACE("error rate %lu, ", vih->dwBitErrorRate);
123 TRACE("%s sec/frame, ", debugstr_time(vih->AvgTimePerFrame));
124 if (vih->dwInterlaceFlags) TRACE("interlace flags %#lx, ", vih->dwInterlaceFlags);
125 if (vih->dwCopyProtectFlags) TRACE("copy-protection flags %#lx, ", vih->dwCopyProtectFlags);
126 TRACE("aspect ratio %lu/%lu, ", vih->dwPictAspectRatioX, vih->dwPictAspectRatioY);
127 if (vih->dwControlFlags) TRACE("control flags %#lx, ", vih->dwControlFlags);
129 {
130 const DXVA_ExtendedFormat *colorimetry = (const DXVA_ExtendedFormat *)&vih->dwControlFlags;
131
132 TRACE("chroma site %#x, range %#x, matrix %#x, lighting %#x, primaries %#x, transfer function %#x, ",
133 colorimetry->VideoChromaSubsampling, colorimetry->NominalRange, colorimetry->VideoTransferMatrix,
134 colorimetry->VideoLighting, colorimetry->VideoPrimaries, colorimetry->VideoTransferFunction);
135 }
136 TRACE("size %ldx%ld, %u planes, %u bpp, compression %s, image size %lu",
141 TRACE(", resolution %ldx%ld", vih->bmiHeader.biXPelsPerMeter, vih->bmiHeader.biYPelsPerMeter);
142 if (vih->bmiHeader.biClrUsed) TRACE(", %lu colours", vih->bmiHeader.biClrUsed);
143 if (vih->bmiHeader.biClrImportant) TRACE(", %lu important colours", vih->bmiHeader.biClrImportant);
144 TRACE(".\n");
145 }
146 else
147 TRACE("not implemented for this format type.\n");
148}
static const char * wine_dbgstr_rect(const RECT *prc)
Definition: atltest.h:160
#define TRACE_ON(x)
Definition: compat.h:75
#define AMCONTROL_COLORINFO_PRESENT
Definition: dvdmedia.h:25
@ extra
Definition: id3.c:95
if(dx< 0)
Definition: linetemp.h:194
static const char * strmbase_debugstr_guid(const GUID *guid)
Definition: mediatype.c:45
BOOL WINAPI IsRectEmpty(_In_ LPCRECT)
static __inline const char * debugstr_fourcc(unsigned int cc)
Definition: debug.h:397
#define TRACE(s)
Definition: solgame.cpp:4
static const char * debugstr_time(REFERENCE_TIME time)
Definition: strmbase.h:32
LONG biYPelsPerMeter
Definition: amvideo.idl:38
DWORD biCompression
Definition: amvideo.idl:35
DWORD biClrImportant
Definition: amvideo.idl:40
LONG biXPelsPerMeter
Definition: amvideo.idl:37
DWORD biSizeImage
Definition: amvideo.idl:36
DWORD nAvgBytesPerSec
Definition: audioclient.idl:43
WORD wBitsPerSample
Definition: audioclient.idl:45
DWORD nSamplesPerSec
Definition: audioclient.idl:42
DXVA_VideoTransferFunction VideoTransferFunction
Definition: dxva.h:1022
DXVA_NominalRange NominalRange
Definition: dxva.h:1018
DXVA_VideoLighting VideoLighting
Definition: dxva.h:1020
UINT VideoChromaSubsampling
Definition: dxva.h:1017
DXVA_VideoTransferMatrix VideoTransferMatrix
Definition: dxva.h:1019
DXVA_VideoPrimaries VideoPrimaries
Definition: dxva.h:1021
DWORD dwCopyProtectFlags
Definition: dvdmedia.h:34
DWORD dwPictAspectRatioX
Definition: dvdmedia.h:35
DWORD dwInterlaceFlags
Definition: dvdmedia.h:33
DWORD dwBitErrorRate
Definition: dvdmedia.h:31
DWORD dwPictAspectRatioY
Definition: dvdmedia.h:36
REFERENCE_TIME AvgTimePerFrame
Definition: dvdmedia.h:32
DWORD dwControlFlags
Definition: dvdmedia.h:38
BITMAPINFOHEADER bmiHeader
Definition: dvdmedia.h:42
BITMAPINFOHEADER bmiHeader
Definition: amvideo.idl:189
REFERENCE_TIME AvgTimePerFrame
Definition: amvideo.idl:187

Referenced by AMStreamConfig_GetFormat(), AMStreamConfig_SetFormat(), BaseRenderer_Receive(), configure_buffer(), enum_media_types_Next(), filesinkfilter_SetFileName(), FileSource_Load(), FilterGraph2_ConnectDirect(), GraphConfig_Reconnect(), pin_ConnectionMediaType(), pin_QueryAccept(), SampleGrabber_ISampleGrabber_SetMediaType(), sink_ReceiveConnection(), source_Connect(), and stream_config_SetFormat().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( quartz  )

Variable Documentation

◆ guid

const GUID* guid

Definition at line 30 of file mediatype.c.

Referenced by strmbase_debugstr_guid().

◆ name

Definition at line 31 of file mediatype.c.

◆ 

const struct { ... } strmbase_guids[]
Initial value:
=
{
#define X(g)
#define OUR_GUID_ENTRY(name, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8)
}
#define GUID_NULL
Definition: ks.h:106
#define X(g)

Referenced by strmbase_debugstr_guid().