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
 The default constructor ensures that the internal pointer to IUnknown is set to nullptr.
 
 Unknown (IUnknown *unknown, bool addref=false) noexcept
 Constructs a new Unknown, taking ownership of the interface pointer held by unknown.
 
 Unknown (REFIID iid, const Unknown &unknown, bool throwIfNoInterface=true)
 Initializes the new object to the interface identified by the iid parameter by querying the interface held by unknown for the requested interface.
 
 Unknown (const Unknown &other) noexcept
 Copy constructor, calls AddRef on the interface pointer held by other.
 
 Unknown (Unknown &&other) noexcept
 Move constructor takes ownership of the interface pointer held by other.
 
 ~Unknown () noexcept
 Destructor, calling Release on the wrapped interface.
 
constexpr operator bool () const noexcept
 Returns true if this object references an interface.
 
Unknownoperator= (const Unknown &other) noexcept
 Copy assignment, which does nothing if other holds the same interface pointer as this object; and if not, calls Release on the currently held interface pointer, then copying the interface pointer from other, calling AddRef on the newly assigned interface pointer.
 
Unknownoperator= (Unknown &&other) noexcept
 Move assignment exchanges the current interface pointer, with the interface pointer held by other.
 
void swap (Unknown &other) noexcept
 Exchanges the current interface pointer, with the interface pointer held by other.
 
void ResetPtr (IUnknown *other=nullptr, bool addRef=false) noexcept
 Calls Release on the currently held interface pointer if the interface pointer held by other points to a different interface.
 
Unknownoperator= (nullptr_t)
 Assigning nullptr to the object, releases the currently held interface pointer, and sets the interface pointer to nullptr.
 
IUnknown * Detach ()
 Returns the currently held interface pointer, setting the interface pointer of the object to nullptr.
 
template<typename T >
requires std::is_base_of_v<Unknown, T >
T As () const
 Creates an instance of the interface wrapper class T, by querying the interface pointer for the interface type wrapped by T.
 
template<typename T >
requires std::is_base_of_v<Unknown, T>
bool Is () const noexcept
 Returns true if the interface can successfully be queried for the interface wrapped by T.
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
ComPtr< TAs () const
 Creates an instance of the interface smart pointer ComPtr<T> for the interface T, by querying the interface pointer for the interface type T.
 
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
 Retrieves a pointer to the interface wrapped by this object.
 
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).
 
template<typename T >
requires std::is_base_of_v<IUnknown, T>
bool QueryInterface (T **itf) const
 Queries the interface for an interface pointer of type T.
 
constexpr bool operator== (const Unknown &other) const noexcept
 Returns true if the interface pointer held by this object is the same as the interface pointer held by the other object.
 
constexpr bool operator!= (const Unknown &other) const noexcept
 Returns true if the interface pointer held by this object is not the same as the interface pointer held by the other object.
 
constexpr bool operator== (const IUnknown *other) const noexcept
 Returns true if the interface pointer held by this object is the same as the interface pointer held by other.
 
constexpr bool operator!= (const IUnknown *other) const noexcept
 Returns true if the interface pointer held by this object is not the same as the interface pointer held by other.
 

Additional Inherited Members

- Public Types inherited from Harlinn::Common::Core::Unknown
using InterfaceType = IUnknown
 Every derived class defines InterfaceType as the type of the interface wrapped by the derived class.
 
- Static Public Member Functions inherited from Harlinn::Common::Core::Unknown
template<typename T = Unknown>
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const CLSID &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 Creates and default-initializes a single object of the class associated with a specified CLSID.
 
template<typename T = Unknown>
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const wchar_t *clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T = Unknown>
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromClassId (const WideString &clsid, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T = Unknown>
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const wchar_t *progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T = Unknown>
requires std::is_base_of_v<Unknown, T>
static T CoCreateInstanceFromProgId (const WideString &progId, DWORD classContext=CLSCTX_INPROC_SERVER)
 
template<typename T = Unknown>
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: