libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
MediaPort Class Reference

Describes a node's input or output connection point. More...

#include <mediaport.h>

Public Types

enum  Direction { Input , Output }
 Port direction. More...
 
enum  MediaType { Frame , Image , Audio , Encoded }
 Media type carried by this port. More...
 
using Ptr = SharedPtr< MediaPort >
 Shared pointer type for MediaPort.
 
using List = promeki::List< MediaPort >
 Plain value list of MediaPort objects.
 
using PtrList = promeki::List< Ptr >
 List of shared pointers to MediaPort.
 

Public Member Functions

 MediaPort ()=default
 Constructs a default (unnamed, Frame/Input) port.
 
 MediaPort (const String &name, Direction direction, MediaType mediaType)
 Constructs a port with the given name, direction, and media type.
 
const Stringname () const
 Returns the port name.
 
void setName (const String &name)
 Sets the port name.
 
Direction direction () const
 Returns the port direction.
 
MediaType mediaType () const
 Returns the media type carried by this port.
 
const AudioDescaudioDesc () const
 Returns the audio description.
 
void setAudioDesc (const AudioDesc &desc)
 Sets the audio description.
 
const VideoDescvideoDesc () const
 Returns the video description.
 
void setVideoDesc (const VideoDesc &desc)
 Sets the video description.
 
const ImageDescimageDesc () const
 Returns the image description.
 
void setImageDesc (const ImageDesc &desc)
 Sets the image description.
 
const EncodedDescencodedDesc () const
 Returns the encoded description.
 
void setEncodedDesc (const EncodedDesc &desc)
 Sets the encoded description.
 
bool isConnected () const
 Returns true if this port is currently connected.
 
void setConnected (bool connected)
 Sets the connected state of this port.
 
MediaNodenode () const
 Returns the node that owns this port, or nullptr.
 
void setNode (MediaNode *node)
 Sets the owning node.
 
bool isCompatible (const MediaPort &other) const
 Tests whether this port is compatible with another port for connection.
 

Detailed Description

Describes a node's input or output connection point.

Port types define what media a port carries. A Frame port carries the full Frame (image + audio + metadata). Image and Audio ports carry their respective sub-frame data plus metadata. This allows nodes to work at the level of abstraction they need.

Member Enumeration Documentation

◆ Direction

Port direction.

Enumerator
Input 

Input port (receives data).

Output 

Output port (produces data).

◆ MediaType

Media type carried by this port.

Determines what kind of media data flows through the port and which descriptor fields are meaningful.

Enumerator
Frame 

Full frame (image + audio + metadata). Described by VideoDesc + AudioDesc.

Image 

Image + metadata. Described by ImageDesc.

Audio 

Audio + metadata. Described by AudioDesc.

Encoded 

Compressed/encoded data + metadata. Described by EncodedDesc.

Constructor & Destructor Documentation

◆ MediaPort()

MediaPort::MediaPort ( const String name,
Direction  direction,
MediaType  mediaType 
)
inline

Constructs a port with the given name, direction, and media type.

Parameters
nameHuman-readable port name.
directionPort direction (Input or Output).
mediaTypeThe type of media this port carries.

Member Function Documentation

◆ audioDesc()

const AudioDesc & MediaPort::audioDesc ( ) const
inline

Returns the audio description.

Valid when mediaType is Audio or Frame.

◆ encodedDesc()

const EncodedDesc & MediaPort::encodedDesc ( ) const
inline

Returns the encoded description.

Valid when mediaType is Encoded.

◆ imageDesc()

const ImageDesc & MediaPort::imageDesc ( ) const
inline

Returns the image description.

Valid when mediaType is Image or Frame.

◆ isCompatible()

bool MediaPort::isCompatible ( const MediaPort other) const

Tests whether this port is compatible with another port for connection.

Compatibility rules:

  • Same media type: check descriptor match
  • Frame output to Image input: compatible (image extracted from frame)
  • Frame output to Audio input: compatible (audio extracted from frame)
  • Image/Audio to Frame: not compatible
  • Encoded only compatible with Encoded
Parameters
otherThe port to check compatibility with.
Returns
true if the ports can be connected.

◆ setAudioDesc()

void MediaPort::setAudioDesc ( const AudioDesc desc)
inline

Sets the audio description.

Parameters
descThe audio format description.

◆ setConnected()

void MediaPort::setConnected ( bool  connected)
inline

Sets the connected state of this port.

Parameters
connectedThe new connected state.

◆ setEncodedDesc()

void MediaPort::setEncodedDesc ( const EncodedDesc desc)
inline

Sets the encoded description.

Parameters
descThe encoded format description.

◆ setImageDesc()

void MediaPort::setImageDesc ( const ImageDesc desc)
inline

Sets the image description.

Parameters
descThe image format description.

◆ setName()

void MediaPort::setName ( const String name)
inline

Sets the port name.

Parameters
nameThe new port name.

◆ setNode()

void MediaPort::setNode ( MediaNode node)
inline

Sets the owning node.

Parameters
nodeThe node that owns this port.

◆ setVideoDesc()

void MediaPort::setVideoDesc ( const VideoDesc desc)
inline

Sets the video description.

Parameters
descThe video format description.

◆ videoDesc()

const VideoDesc & MediaPort::videoDesc ( ) const
inline

Returns the video description.

Valid when mediaType is Frame.


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