AJA NTV2 SDK  18.0.0.2717
NTV2 SDK 18.0.0.2717
mtype.h
Go to the documentation of this file.
1 //------------------------------------------------------------------------------
2 // File: MtType.h
3 //
4 // Desc: DirectShow base classes - defines a class that holds and manages
5 // media type information.
6 //
7 // Copyright (c) 1992-2001 Microsoft Corporation. All rights reserved.
8 //------------------------------------------------------------------------------
9 
10 
11 #ifndef __MTYPE__
12 #define __MTYPE__
13 
14 /* Helper class that derived pin objects can use to compare media
15  types etc. Has same data members as the struct AM_MEDIA_TYPE defined
16  in the streams IDL file, but also has (non-virtual) functions */
17 
18 class CMediaType : public _AMMediaType {
19 
20 public:
21 
22  ~CMediaType();
23  CMediaType();
24  CMediaType(const GUID * majortype);
25  CMediaType(const AM_MEDIA_TYPE&, __out_opt HRESULT* phr = NULL);
26  CMediaType(const CMediaType&, __out_opt HRESULT* phr = NULL);
27 
29  CMediaType& operator=(const AM_MEDIA_TYPE&);
30 
31  BOOL operator == (const CMediaType&) const;
32  BOOL operator != (const CMediaType&) const;
33 
34  HRESULT Set(const CMediaType& rt);
35  HRESULT Set(const AM_MEDIA_TYPE& rt);
36 
37  BOOL IsValid() const;
38 
39  const GUID *Type() const { return &majortype;} ;
40  void SetType(const GUID *);
41  const GUID *Subtype() const { return &subtype;} ;
42  void SetSubtype(const GUID *);
43 
44  BOOL IsFixedSize() const {return bFixedSizeSamples; };
45  BOOL IsTemporalCompressed() const {return bTemporalCompression; };
46  ULONG GetSampleSize() const;
47 
48  void SetSampleSize(ULONG sz);
49  void SetVariableSize();
50  void SetTemporalCompression(BOOL bCompressed);
51 
52  // read/write pointer to format - can't change length without
53  // calling SetFormat, AllocFormatBuffer or ReallocFormatBuffer
54 
55  BYTE* Format() const {return pbFormat; };
56  ULONG FormatLength() const { return cbFormat; };
57 
58  void SetFormatType(const GUID *);
59  const GUID *FormatType() const {return &formattype; };
60  BOOL SetFormat(__in_bcount(length) BYTE *pFormat, ULONG length);
61  void ResetFormatBuffer();
62  BYTE* AllocFormatBuffer(ULONG length);
63  BYTE* ReallocFormatBuffer(ULONG length);
64 
65  void InitMediaType();
66 
67  BOOL MatchesPartial(const CMediaType* ppartial) const;
68  BOOL IsPartiallySpecified(void) const;
69 };
70 
71 
72 /* General purpose functions to copy and delete a task allocated AM_MEDIA_TYPE
73  structure which is useful when using the IEnumMediaFormats interface as
74  the implementation allocates the structures which you must later delete */
75 
76 void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt);
77 AM_MEDIA_TYPE * WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc);
78 HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource);
79 void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE& mt);
80 
81 // Initialize a media type from a WAVEFORMATEX
82 
84  const WAVEFORMATEX *pwfx,
85  __out AM_MEDIA_TYPE *pmt,
86  BOOL bSetFormat);
87 
88 #endif /* __MTYPE__ */
89 
CMediaType::Format
BYTE * Format() const
Definition: mtype.h:55
CMediaType::IsPartiallySpecified
BOOL IsPartiallySpecified(void) const
Definition: mtype.cpp:306
CMediaType::Type
const GUID * Type() const
Definition: mtype.h:39
NULL
#define NULL
Definition: ntv2caption608types.h:19
CMediaType::SetSubtype
void SetSubtype(const GUID *)
Definition: mtype.cpp:144
CMediaType::Set
HRESULT Set(const CMediaType &rt)
Definition: mtype.cpp:108
CMediaType::SetFormat
BOOL SetFormat(__in_bcount(length) BYTE *pFormat, ULONG length)
Definition: mtype.cpp:183
CMediaType::SetFormatType
void SetFormatType(const GUID *)
Definition: mtype.cpp:200
CMediaType::MatchesPartial
BOOL MatchesPartial(const CMediaType *ppartial) const
Definition: mtype.cpp:317
CMediaType::IsValid
BOOL IsValid() const
Definition: mtype.cpp:130
CopyMediaType
HRESULT WINAPI CopyMediaType(__out AM_MEDIA_TYPE *pmtTarget, const AM_MEDIA_TYPE *pmtSource)
Definition: mtype.cpp:397
CMediaType
Definition: mtype.h:18
CMediaType::~CMediaType
~CMediaType()
Definition: mtype.cpp:18
CMediaType::operator=
CMediaType & operator=(const CMediaType &)
Definition: mtype.cpp:69
CreateMediaType
AM_MEDIA_TYPE *WINAPI CreateMediaType(AM_MEDIA_TYPE const *pSrc)
Definition: mtype.cpp:371
CMediaType::SetVariableSize
void SetVariableSize()
Definition: mtype.cpp:172
CMediaType::InitMediaType
void InitMediaType()
Definition: mtype.cpp:294
CreateAudioMediaType
STDAPI CreateAudioMediaType(const WAVEFORMATEX *pwfx, __out AM_MEDIA_TYPE *pmt, BOOL bSetFormat)
Definition: mtype.cpp:440
FreeMediaType
void WINAPI FreeMediaType(__inout AM_MEDIA_TYPE &mt)
Definition: mtype.cpp:423
CMediaType::SetType
void SetType(const GUID *)
Definition: mtype.cpp:137
CMediaType::FormatType
const GUID * FormatType() const
Definition: mtype.h:59
CMediaType::SetSampleSize
void SetSampleSize(ULONG sz)
Definition: mtype.cpp:161
DeleteMediaType
void WINAPI DeleteMediaType(__inout_opt AM_MEDIA_TYPE *pmt)
Definition: mtype.cpp:353
CMediaType::AllocFormatBuffer
BYTE * AllocFormatBuffer(ULONG length)
Definition: mtype.cpp:223
CMediaType::CMediaType
CMediaType()
Definition: mtype.cpp:23
CMediaType::ReallocFormatBuffer
BYTE * ReallocFormatBuffer(ULONG length)
Definition: mtype.cpp:260
CMediaType::operator==
BOOL operator==(const CMediaType &) const
Definition: mtype.cpp:76
CMediaType::ResetFormatBuffer
void ResetFormatBuffer()
Definition: mtype.cpp:208
CMediaType::operator!=
BOOL operator!=(const CMediaType &) const
Definition: mtype.cpp:96
ULONG
ULONG(__stdcall *_RegisterTraceGuids)(__in IN WMIDPREQUEST RequestAddress
CMediaType::IsTemporalCompressed
BOOL IsTemporalCompressed() const
Definition: mtype.h:45
CMediaType::Subtype
const GUID * Subtype() const
Definition: mtype.h:41
CMediaType::FormatLength
ULONG FormatLength() const
Definition: mtype.h:56
CMediaType::SetTemporalCompression
void SetTemporalCompression(BOOL bCompressed)
Definition: mtype.cpp:178
CMediaType::GetSampleSize
ULONG GetSampleSize() const
Definition: mtype.cpp:151
CMediaType::IsFixedSize
BOOL IsFixedSize() const
Definition: mtype.h:44