Ocean
Ocean::Media::MediaFoundation::Utilities Class Reference

This class implements utilities functions for the Microsoft Media Foundation. More...

Data Structures

struct  GUIDCompare
 GUID helper struct. More...
 

Static Public Member Functions

static std::string attribute2String (const GUID &attribute)
 Translates a media foundation attribute to a readable string. More...
 
static std::string majorMediaType2String (const GUID &type)
 Translates a major media type to a readable string. More...
 
static std::string videoSubtype2String (const GUID &type)
 Translates a video subtype to a readable string. More...
 
static std::string unregisteredVideoSubtype2String (const GUID &type)
 Translates an unregistered video subtype to a readable string. More...
 
static std::string audioSubtype2String (const GUID &type)
 Translates an audio subtype to a readable string. More...
 
static std::string transformCategory2String (const GUID &category)
 Translates an transform category to a readable string. More...
 
static std::string guid2String (const GUID &value)
 Translates the GUID key to a string. More...
 
static bool dumpAttributes (IMFAttributes *attributes, std::string &result)
 Dumps a set of attributes to a string object. More...
 
static bool enumerateTransforms (std::string &result)
 Enumerates the registered media foundation transforms. More...
 
static FrameType::PixelFormat convertMediaSubtype (const GUID &mediaSubtype)
 Converts a Media Foundation media subtype to a pixel format. More...
 
static FrameType::PixelOrigin extractPixelOrigin (const GUID &mediaSubtype)
 Returns the pixel origin of a Media Foundation media subtype. More...
 
static GUID convertPixelFormat (const FrameType::PixelFormat pixelFormat)
 Converts a pixel format to a Media Foundation media subtype. More...
 
static ScopedIMFMediaSource createMediaSourceByUrl (const std::wstring &url)
 Creates the media source object for a given URL. More...
 
static ScopedIMFTopologyNode addSourceNodeToTopology (IMFTopology *topology, IMFMediaSource *mediaSource, IMFPresentationDescriptor *presentationDescriptor, IMFStreamDescriptor *streamDescriptor)
 Adds a source node to a given topology. More...
 
static ScopedIMFTopologyNode addOutputNodeToTopology (IMFTopology *topology, IMFActivate *sinkActivate, const DWORD streamIndex=0)
 Adds an output node to a given topology. More...
 
static bool connectSelectedStream (IMFTopology *topology, IMFMediaSource *mediaSource, IMFActivate *sinkActivate, const GUID &majorMediaType)
 Connects the selected media source with a given sink activate object. More...
 
static bool getAllocatedString (IMFActivate *activate, const GUID &key, std::string &value)
 Returns an allocated string from an activate. More...
 
template<typename T >
static ScopedMediaFoundationObject< T > topologyNodeObject (IMFTopologyNode *node)
 Extracts an object from a topology node. More...
 
template<typename T >
static ScopedMediaFoundationObject< T > eventObject (IMFMediaEvent *mediaEvent)
 Extracts an object from an event. More...
 

Private Types

typedef std::map< GUID, std::string, GUIDCompareIdMap
 Definition of a map mapping GUID objects to strings. More...
 

Static Private Member Functions

static IdMap guidMap ()
 Returns a map mapping all GUID ids to readable strings. More...
 
static IdMap attributeMap ()
 Returns a map mapping attribute GUID ids to readable strings. More...
 
static IdMap majorMediaTypeMap ()
 Returns a map mapping major media type GUID ids to readable strings. More...
 
static IdMap videoSubtypeMap ()
 Returns a map mapping video subtype GUID ids to readable strings. More...
 
static IdMap audioSubtypeMap ()
 Returns a map mapping audio subtype GUID ids to readable strings. More...
 
static IdMap transformCategoryMap ()
 Returns a map mapping transform category GUID ids to readable strings. More...
 

Detailed Description

This class implements utilities functions for the Microsoft Media Foundation.

Member Typedef Documentation

◆ IdMap

typedef std::map<GUID, std::string, GUIDCompare> Ocean::Media::MediaFoundation::Utilities::IdMap
private

Definition of a map mapping GUID objects to strings.

Member Function Documentation

◆ addOutputNodeToTopology()

static ScopedIMFTopologyNode Ocean::Media::MediaFoundation::Utilities::addOutputNodeToTopology ( IMFTopology *  topology,
IMFActivate *  sinkActivate,
const DWORD  streamIndex = 0 
)
static

Adds an output node to a given topology.

Parameters
topologyThe topology to that the node will be added, must be valid
sinkActivateSink activate object, must be valid
streamIndexStream index
Returns
Resulting topology node, invalid otherwise

◆ addSourceNodeToTopology()

static ScopedIMFTopologyNode Ocean::Media::MediaFoundation::Utilities::addSourceNodeToTopology ( IMFTopology *  topology,
IMFMediaSource *  mediaSource,
IMFPresentationDescriptor *  presentationDescriptor,
IMFStreamDescriptor *  streamDescriptor 
)
static

Adds a source node to a given topology.

Parameters
topologyThe topology to that the node will be added, must be valid
mediaSourceMedia source object, must be valid
presentationDescriptorPresentation descriptor, must be valid
streamDescriptorStream descriptor, must be valid
Returns
Resulting topology node, invalid otherwise

◆ attribute2String()

static std::string Ocean::Media::MediaFoundation::Utilities::attribute2String ( const GUID &  attribute)
static

Translates a media foundation attribute to a readable string.

Parameters
attributeThe attribute to be translated
Returns
Translated attribute

◆ attributeMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::attributeMap ( )
staticprivate

Returns a map mapping attribute GUID ids to readable strings.

Returns
GUID map

◆ audioSubtype2String()

static std::string Ocean::Media::MediaFoundation::Utilities::audioSubtype2String ( const GUID &  type)
static

Translates an audio subtype to a readable string.

Parameters
typeThe type to be translated
Returns
Translated type

◆ audioSubtypeMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::audioSubtypeMap ( )
staticprivate

Returns a map mapping audio subtype GUID ids to readable strings.

Returns
GUID map

◆ connectSelectedStream()

static bool Ocean::Media::MediaFoundation::Utilities::connectSelectedStream ( IMFTopology *  topology,
IMFMediaSource *  mediaSource,
IMFActivate *  sinkActivate,
const GUID &  majorMediaType 
)
static

Connects the selected media source with a given sink activate object.

Parameters
topologyThe topology that will receive the connection, must be valid
mediaSourceThe media source object, must be valid
sinkActivateThe sink activate object, must be valid
majorMediaTypeMajor media type
Returns
True, if succeeded

◆ convertMediaSubtype()

static FrameType::PixelFormat Ocean::Media::MediaFoundation::Utilities::convertMediaSubtype ( const GUID &  mediaSubtype)
static

Converts a Media Foundation media subtype to a pixel format.

Parameters
mediaSubtypeMedia Foundation media type to convert
Returns
Resulting pixel format

◆ convertPixelFormat()

static GUID Ocean::Media::MediaFoundation::Utilities::convertPixelFormat ( const FrameType::PixelFormat  pixelFormat)
static

Converts a pixel format to a Media Foundation media subtype.

Parameters
pixelFormatPixel format
Returns
Media Foundation media type

◆ createMediaSourceByUrl()

static ScopedIMFMediaSource Ocean::Media::MediaFoundation::Utilities::createMediaSourceByUrl ( const std::wstring &  url)
static

Creates the media source object for a given URL.

The resulting object has to be released by the caller.

Parameters
urlURL for that the media source object will be returned
Returns
Resulting media source object, invalid otherwise

◆ dumpAttributes()

static bool Ocean::Media::MediaFoundation::Utilities::dumpAttributes ( IMFAttributes *  attributes,
std::string &  result 
)
static

Dumps a set of attributes to a string object.

Parameters
attributesThe attributes to dump
resultResulting dump
Returns
True, if succeeded

◆ enumerateTransforms()

static bool Ocean::Media::MediaFoundation::Utilities::enumerateTransforms ( std::string &  result)
static

Enumerates the registered media foundation transforms.

Parameters
resultThe resulting enumerated transforms
Returns
True, if succeeded

◆ eventObject()

template<typename T >
ScopedMediaFoundationObject< T > Ocean::Media::MediaFoundation::Utilities::eventObject ( IMFMediaEvent *  mediaEvent)
static

Extracts an object from an event.

Parameters
mediaEventMedia event from that the object will be extracted, must be valid
Returns
Resulting object which must be released by the caller, otherwise nullptr
Template Parameters
TData type of the desired object

◆ extractPixelOrigin()

static FrameType::PixelOrigin Ocean::Media::MediaFoundation::Utilities::extractPixelOrigin ( const GUID &  mediaSubtype)
static

Returns the pixel origin of a Media Foundation media subtype.

Parameters
mediaSubtypeMedia Foundation media type to return the pixel origin for
Returns
Pixel origin

◆ getAllocatedString()

static bool Ocean::Media::MediaFoundation::Utilities::getAllocatedString ( IMFActivate *  activate,
const GUID &  key,
std::string &  value 
)
static

Returns an allocated string from an activate.

Parameters
activateThe activate from which the string will be returned, must be valid
keyThe key identifying which value to retrieve, must be valid
valueThe resulting string value @reutrn True, if succeeded

◆ guid2String()

static std::string Ocean::Media::MediaFoundation::Utilities::guid2String ( const GUID &  value)
static

Translates the GUID key to a string.

Parameters
valueThe value to be translated
Returns
Translated key

◆ guidMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::guidMap ( )
staticprivate

Returns a map mapping all GUID ids to readable strings.

Returns
GUID map

◆ majorMediaType2String()

static std::string Ocean::Media::MediaFoundation::Utilities::majorMediaType2String ( const GUID &  type)
static

Translates a major media type to a readable string.

Parameters
typeThe type to be translated
Returns
Translated type

◆ majorMediaTypeMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::majorMediaTypeMap ( )
staticprivate

Returns a map mapping major media type GUID ids to readable strings.

Returns
GUID map

◆ topologyNodeObject()

template<typename T >
ScopedMediaFoundationObject< T > Ocean::Media::MediaFoundation::Utilities::topologyNodeObject ( IMFTopologyNode *  node)
static

Extracts an object from a topology node.

Parameters
nodeThe node from that the object will be extracted, must be valid
Returns
Resulting object which must be released by the caller, otherwise nullptr
Template Parameters
TData type of the desired object

◆ transformCategory2String()

static std::string Ocean::Media::MediaFoundation::Utilities::transformCategory2String ( const GUID &  category)
static

Translates an transform category to a readable string.

Parameters
categoryThe category to be translated
Returns
Translated type

◆ transformCategoryMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::transformCategoryMap ( )
staticprivate

Returns a map mapping transform category GUID ids to readable strings.

Returns
GUID map

◆ unregisteredVideoSubtype2String()

static std::string Ocean::Media::MediaFoundation::Utilities::unregisteredVideoSubtype2String ( const GUID &  type)
static

Translates an unregistered video subtype to a readable string.

Parameters
typeThe type to be translated
Returns
Translated type

◆ videoSubtype2String()

static std::string Ocean::Media::MediaFoundation::Utilities::videoSubtype2String ( const GUID &  type)
static

Translates a video subtype to a readable string.

Parameters
typeThe type to be translated
Returns
Translated type

◆ videoSubtypeMap()

static IdMap Ocean::Media::MediaFoundation::Utilities::videoSubtypeMap ( )
staticprivate

Returns a map mapping video subtype GUID ids to readable strings.

Returns
GUID map

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