Harlinn.Windows 0.1
Loading...
Searching...
No Matches
Harlinn::Windows::Media::MediaObject Class Reference

The MediaObject class provides functions for manipulating a Microsoft DirectX Media Object. More...

#include <HWMediaObj.h>

Inheritance diagram for Harlinn::Windows::Media::MediaObject:
[legend]
Collaboration diagram for Harlinn::Windows::Media::MediaObject:
[legend]

Classes

class  MediaType
 
struct  StreamCount
 

Public Member Functions

void GetStreamCount (DWORD *numberOfInputStreams, DWORD *numberOfOutputStreams) const
 Retrieves the number of input and output streams.
 
StreamCount GetStreamCount () const
 
void GetInputStreamInfo (DWORD inputStreamIndex, DWORD *flags) const
 Retrieves information about an input stream, such as any restrictions on the number of samples per buffer, and whether the stream performs lookahead on the input data. This information never changes.
 
DWORD GetInputStreamInfo (DWORD inputStreamIndex) const
 
void GetOutputStreamInfo (DWORD outputStreamIndex, DWORD *flags) const
 Retrieves information about an output stream; for example, whether the stream is discardable, and whether it uses a fixed sample size. This information never changes.
 
DWORD GetOutputStreamInfo (DWORD outputStreamIndex) const
 
bool GetInputType (DWORD inputStreamIndex, DWORD typeIndex, DMO_MEDIA_TYPE *mediaType) const
 Retrieves a preferred media type for a specified input stream.
 
bool GetOutputType (DWORD outputStreamIndex, DWORD typeIndex, DMO_MEDIA_TYPE *mediaType) const
 Retrieves a preferred media type for a specified output stream.
 
bool SetInputType (DWORD inputStreamIndex, const DMO_MEDIA_TYPE *mediaType, DWORD flags=0) const
 Sets the media type on an input stream, or tests whether a media type is acceptable.
 
bool IsValidInputType (DWORD inputStreamIndex, const DMO_MEDIA_TYPE *mediaType)
 
void ClearInputType (DWORD inputStreamIndex)
 
bool SetOutputType (DWORD outputStreamIndex, const DMO_MEDIA_TYPE *mediaType, DWORD flags) const
 Sets the media type on an output stream, or tests whether a media type is acceptable.
 
bool IsValidOutputType (DWORD outputStreamIndex, const DMO_MEDIA_TYPE *mediaType)
 
void ClearOutputType (DWORD outputStreamIndex)
 
bool GetInputCurrentType (DWORD inputStreamIndex, DMO_MEDIA_TYPE *mediaType) const
 Retrieves the media type that was set for an input stream, if any.
 
bool GetOutputCurrentType (DWORD outputStreamIndex, DMO_MEDIA_TYPE *mediaType) const
 
void GetInputSizeInfo (DWORD iputStreamIndex, DWORD *size, DWORD *maxLookahead, DWORD *alignment) const
 
void GetOutputSizeInfo (DWORD outputStreamIndex, DWORD *size, DWORD *alignment) const
 
void GetInputMaxLatency (DWORD inputStreamIndex, REFERENCE_TIME *maxLatency) const
 
void SetInputMaxLatency (DWORD inputStreamIndex, REFERENCE_TIME maxLatency) const
 
void Flush () const
 
void Discontinuity (DWORD inputStreamIndex) const
 
void AllocateStreamingResources () const
 
void FreeStreamingResources () const
 
void GetInputStatus (DWORD inputStreamIndex, DWORD *flags) const
 
void ProcessInput (DWORD inputStreamIndex, IMediaBuffer *buffer, DWORD flags, REFERENCE_TIME timestamp, REFERENCE_TIME timelength) const
 
void ProcessOutput (DWORD flags, DWORD outputBufferCount, DMO_OUTPUT_DATA_BUFFER *outputBuffers, DWORD *status) const
 
void Lock (LONG lock) const
 
- Public Member Functions inherited from Harlinn::Common::Core::Unknown
constexpr Unknown () noexcept
 
 Unknown (IUnknown *unknown, bool addref=false) noexcept
 
 Unknown (REFIID iid, const Unknown &unknown, bool throwIfNoInterface=true)
 
 Unknown (const Unknown &other) noexcept
 
 Unknown (Unknown &&other) noexcept
 
 ~Unknown () noexcept
 
constexpr operator bool () const noexcept
 
Unknownoperator= (const Unknown &other) noexcept
 
Unknownoperator= (Unknown &&other) noexcept
 
void swap (Unknown &other) noexcept
 
void ResetPtr (IUnknown *other=nullptr, bool addRef=false) noexcept
 
Unknownoperator= (nullptr_t)
 
IUnknown * Detach ()
 
template<typename T >
requires std::is_base_of_v<Unknown, T >
T As () const
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
bool Is () const noexcept
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
ComPtr< TAs () const
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
bool Is () const noexcept
 This function can be used to detect if an object supports a particular COM interface derived from IUnknown.
 
template<typename T = IUnknown>
TGetInterfacePointer () const noexcept
 
bool QueryInterface (REFIID riid, void **itf) const
 Queries a COM object for a pointer to one of its interface; identifying the interface by a reference to its interface identifier (IID). If the COM object implements the interface, then it returns a pointer to that interface after calling IUnknown::AddRef on it.
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
bool QueryInterface (T **itf) const
 
constexpr bool operator== (const Unknown &other) const noexcept
 
constexpr bool operator!= (const Unknown &other) const noexcept
 
constexpr bool operator== (const IUnknown *other) const noexcept
 
constexpr bool operator!= (const IUnknown *other) const noexcept
 

Additional Inherited Members

- Public Types inherited from Harlinn::Common::Core::Unknown
typedef IUnknown InterfaceType
 
- Static Public Member Functions inherited from Harlinn::Common::Core::Unknown
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const CLSID &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const wchar_t *clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const WideString &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const wchar_t *progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const WideString &progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromDll (const ModuleHandle &dll, const CLSID &clsid)
 
- Protected Attributes inherited from Harlinn::Common::Core::Unknown
IUnknown * unknown_
 

Detailed Description

The MediaObject class provides functions for manipulating a Microsoft DirectX Media Object.

Member Function Documentation

◆ AllocateStreamingResources()

void Harlinn::Windows::Media::MediaObject::AllocateStreamingResources ( ) const
inline

◆ ClearInputType()

void Harlinn::Windows::Media::MediaObject::ClearInputType ( DWORD inputStreamIndex)
inline

◆ ClearOutputType()

void Harlinn::Windows::Media::MediaObject::ClearOutputType ( DWORD outputStreamIndex)
inline

◆ Discontinuity()

void Harlinn::Windows::Media::MediaObject::Discontinuity ( DWORD inputStreamIndex) const
inline

◆ Flush()

void Harlinn::Windows::Media::MediaObject::Flush ( ) const
inline

◆ FreeStreamingResources()

void Harlinn::Windows::Media::MediaObject::FreeStreamingResources ( ) const
inline

◆ GetInputCurrentType()

bool Harlinn::Windows::Media::MediaObject::GetInputCurrentType ( DWORD inputStreamIndex,
DMO_MEDIA_TYPE * mediaType ) const
inline

Retrieves the media type that was set for an input stream, if any.

Parameters
inputStreamIndexZero-based index of an input stream
mediaTypePointer to a DMO_MEDIA_TYPE structure allocated by the caller. The method fills the structure with the media type.
Returns
true on success, false if media type was not set.

The caller must set the media type for the stream before calling this method. To set the media type, call the MediaObject::SetInputType method.

If the method succeeds, call MoFreeMediaType to free the format block.

◆ GetInputMaxLatency()

void Harlinn::Windows::Media::MediaObject::GetInputMaxLatency ( DWORD inputStreamIndex,
REFERENCE_TIME * maxLatency ) const
inline

◆ GetInputSizeInfo()

void Harlinn::Windows::Media::MediaObject::GetInputSizeInfo ( DWORD iputStreamIndex,
DWORD * size,
DWORD * maxLookahead,
DWORD * alignment ) const
inline

◆ GetInputStatus()

void Harlinn::Windows::Media::MediaObject::GetInputStatus ( DWORD inputStreamIndex,
DWORD * flags ) const
inline

◆ GetInputStreamInfo() [1/2]

DWORD Harlinn::Windows::Media::MediaObject::GetInputStreamInfo ( DWORD inputStreamIndex) const
inline

◆ GetInputStreamInfo() [2/2]

void Harlinn::Windows::Media::MediaObject::GetInputStreamInfo ( DWORD inputStreamIndex,
DWORD * flags ) const
inline

Retrieves information about an input stream, such as any restrictions on the number of samples per buffer, and whether the stream performs lookahead on the input data. This information never changes.

Parameters
inputStreamIndexZero-based index of an input stream.
flagsPointer to a variable that receives a bitwise combination of zero or more _DMO_INPUT_STREAM_INFO_FLAGS flags.

◆ GetInputType()

bool Harlinn::Windows::Media::MediaObject::GetInputType ( DWORD inputStreamIndex,
DWORD typeIndex,
DMO_MEDIA_TYPE * mediaType ) const
inline

Retrieves a preferred media type for a specified input stream.

Parameters
inputStreamIndexZero-based index of an input stream
typeIndexZero-based index on the set of acceptable media types.
mediaTypePointer to a DMO_MEDIA_TYPE structure allocated by the caller, or nullptr. If this parameter is non-NULL, the method fills the structure with the media type. You can use the value NULL to test whether the type index is in range, by checking the return code.
Returns
true on success, or false if the typeIndex is out of range.

Call this method to enumerate an input stream's preferred media types. The DMO assigns each media type an index value in order of preference. The most preferred type has an index of zero. To enumerate all the types, make successive calls while incrementing the type index until the method returns false. The DMO is not guaranteed to enumerate every media type that it supports.

The format block in the returned type might be NULL. If so, the format type is GUID_NULL. Check the format type before dereferencing the format block.

If the method succeeds, call MoFreeMediaType to free the format block. (This function is also safe to call when the format block is NULL.)

To set the media type, call the MediaObject::SetInputType method. Setting the media type on one stream can change another stream's preferred types. In fact, a stream might not have a preferred type until the type is set on another stream. For example, a decoder might not have a preferred output type until the input type is set. However, the DMO is not required to update its preferred types dynamically in this fashion. Thus, the types returned by this method are not guaranteed to be valid; they might fail when used in the SetInputType method.

To test whether a particular media type is acceptable, call SetInputType with the DMO_SET_TYPEF_TEST_ONLY flag.

To test whether the typeIndex parameter is in range, set mediaType to NULL. The method returns true if the index is in range, or false if the index is out of range.

◆ GetOutputCurrentType()

bool Harlinn::Windows::Media::MediaObject::GetOutputCurrentType ( DWORD outputStreamIndex,
DMO_MEDIA_TYPE * mediaType ) const
inline

◆ GetOutputSizeInfo()

void Harlinn::Windows::Media::MediaObject::GetOutputSizeInfo ( DWORD outputStreamIndex,
DWORD * size,
DWORD * alignment ) const
inline

◆ GetOutputStreamInfo() [1/2]

DWORD Harlinn::Windows::Media::MediaObject::GetOutputStreamInfo ( DWORD outputStreamIndex) const
inline

◆ GetOutputStreamInfo() [2/2]

void Harlinn::Windows::Media::MediaObject::GetOutputStreamInfo ( DWORD outputStreamIndex,
DWORD * flags ) const
inline

Retrieves information about an output stream; for example, whether the stream is discardable, and whether it uses a fixed sample size. This information never changes.

Parameters
outputStreamIndexZero-based index of an output stream
flagsPointer to a variable that receives a bitwise combination of zero or more _DMO_OUTPUT_STREAM_INFO_FLAGS flags.

◆ GetOutputType()

bool Harlinn::Windows::Media::MediaObject::GetOutputType ( DWORD outputStreamIndex,
DWORD typeIndex,
DMO_MEDIA_TYPE * mediaType ) const
inline

Retrieves a preferred media type for a specified output stream.

Parameters
outputStreamIndexZero-based index of an output stream
typeIndexZero-based index on the set of acceptable media types.
mediaTypePointer to a DMO_MEDIA_TYPE structure allocated by the caller, or NULL. If this parameter is non-NULL, the method fills the structure with the media type. You can use the value NULL to test whether the type index is in range, by checking the return code.
Returns
true on success, or false if the typeIndex is out of range.

Call this method to enumerate an output stream's preferred media types. The DMO assigns each media type an index value, in order of preference. The most preferred type has an index of zero. To enumerate all the types, make successive calls while incrementing the type index, until the method returns false. The DMO is not guaranteed to enumerate every media type that it supports.

The format block in the returned type might be NULL. If so, the format type is GUID_NULL. You should check the format type before dereferencing the format block.

If the method succeeds, call MoFreeMediaType to free the format block. (This function is also safe to call when the format block is NULL.)

To set the media type, call the MediaObject::SetOutputType method. Setting the media type on one stream can change another stream's preferred types. In fact, a stream might not have a preferred type until the type is set on another stream. For example, a decoder might not have a preferred output type until the input type is set. However, the DMO is not required to update its preferred types dynamically in this fashion. Thus, the types returned by this method are not guaranteed to be valid; they might fail when used in the SetOutputType method.

To test whether a particular media type is acceptable, call SetOutputType with the DMO_SET_TYPEF_TEST_ONLY flag.

To test whether the typeIndex parameter is in range, set mediaType to NULL. The method returns true if the index is in range, or false if the index is out of range.

◆ GetStreamCount() [1/2]

StreamCount Harlinn::Windows::Media::MediaObject::GetStreamCount ( ) const
inline

◆ GetStreamCount() [2/2]

void Harlinn::Windows::Media::MediaObject::GetStreamCount ( DWORD * numberOfInputStreams,
DWORD * numberOfOutputStreams ) const
inline

Retrieves the number of input and output streams.

Parameters
numberOfInputStreamsPointer to a variable that receives the number of input streams.
numberOfOutputStreamsPointer to a variable that receives the number of output streams.
Returns

◆ IsValidInputType()

bool Harlinn::Windows::Media::MediaObject::IsValidInputType ( DWORD inputStreamIndex,
const DMO_MEDIA_TYPE * mediaType )
inline

◆ IsValidOutputType()

bool Harlinn::Windows::Media::MediaObject::IsValidOutputType ( DWORD outputStreamIndex,
const DMO_MEDIA_TYPE * mediaType )
inline

◆ Lock()

void Harlinn::Windows::Media::MediaObject::Lock ( LONG lock) const
inline

◆ ProcessInput()

void Harlinn::Windows::Media::MediaObject::ProcessInput ( DWORD inputStreamIndex,
IMediaBuffer * buffer,
DWORD flags,
REFERENCE_TIME timestamp,
REFERENCE_TIME timelength ) const
inline

◆ ProcessOutput()

void Harlinn::Windows::Media::MediaObject::ProcessOutput ( DWORD flags,
DWORD outputBufferCount,
DMO_OUTPUT_DATA_BUFFER * outputBuffers,
DWORD * status ) const
inline

◆ SetInputMaxLatency()

void Harlinn::Windows::Media::MediaObject::SetInputMaxLatency ( DWORD inputStreamIndex,
REFERENCE_TIME maxLatency ) const
inline

◆ SetInputType()

bool Harlinn::Windows::Media::MediaObject::SetInputType ( DWORD inputStreamIndex,
const DMO_MEDIA_TYPE * mediaType,
DWORD flags = 0 ) const
inline

Sets the media type on an input stream, or tests whether a media type is acceptable.

Parameters
inputStreamIndexZero-based index of an input stream
mediaTypePointer to a DMO_MEDIA_TYPE structure that specifies the media type.
flagsBitwise combination of zero or more flags from the DMO_SET_TYPE_FLAGS enumeration.
Returns
true on success, false if flags was equal to DMO_SET_TYPEF_TEST_ONLY and the mediaType was not acceptable.

Call this method to test, set, or clear the media type on an input stream:

  • To test the media type without setting it, use the DMO_SET_TYPEF_TEST_ONLY flag. If the media type is not acceptable, the method returns false.
  • To set the media type, set flags to zero. If the media type is not acceptable, the method throws an exception for DMO_E_TYPE_NOT_ACCEPTED.
  • To clear the current media type (if any), use the DMO_SET_TYPEF_CLEAR flag and set mediaType to NULL. When the method returns, the stream no longer has a media type. The DMO cannot process samples until the application sets a new media type.

The media types that are currently set on other streams can affect whether the media type is acceptable.

◆ SetOutputType()

bool Harlinn::Windows::Media::MediaObject::SetOutputType ( DWORD outputStreamIndex,
const DMO_MEDIA_TYPE * mediaType,
DWORD flags ) const
inline

Sets the media type on an output stream, or tests whether a media type is acceptable.

Parameters
outputStreamIndexZero-based index of an output stream
mediaTypeointer to a DMO_MEDIA_TYPE structure that specifies the media type.
flagsBitwise combination of zero or more flags from the DMO_SET_TYPE_FLAGS enumeration.
Returns
true on success, false if flags was equal to DMO_SET_TYPEF_TEST_ONLY and the mediaType was not acceptable.

Call this method to test, set, or clear the media type on an input stream:

  • To test the media type without setting it, use the DMO_SET_TYPEF_TEST_ONLY flag. If the media type is not acceptable, the method returns false.
  • To set the media type, set flags to zero. If the media type is not acceptable, the method throws an exception for DMO_E_TYPE_NOT_ACCEPTED.
  • To clear the current media type (if any), use the DMO_SET_TYPEF_CLEAR flag and set mediaType to NULL. When the method returns, the stream no longer has a media type. The DMO cannot process samples until the application sets a new media type.

The media types that are currently set on other streams can affect whether the media type is acceptable.


The documentation for this class was generated from the following file: