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

Connects an output port to an input port in a media pipeline. More...

#include <medialink.h>

Public Types

using Ptr = SharedPtr< MediaLink >
 Shared pointer type for MediaLink.
 
using List = promeki::List< MediaLink >
 Plain value list of MediaLink objects.
 
using PtrList = promeki::List< Ptr >
 List of shared pointers to MediaLink.
 

Public Member Functions

 MediaLink ()=default
 Constructs an empty (disconnected) link.
 
 MediaLink (MediaPort::Ptr source, MediaPort::Ptr sink)
 Constructs a link between the given source and sink ports.
 
const MediaPort::Ptrsource () const
 Returns the source (output) port.
 
const MediaPort::Ptrsink () const
 Returns the sink (input) port.
 
MediaNodesourceNode () const
 Returns the node that owns the source port, or nullptr.
 
MediaNodesinkNode () const
 Returns the node that owns the sink port, or nullptr.
 
Error deliver (Frame::Ptr frame) const
 Delivers a frame from the source to the sink node's input queue.
 
bool isValid () const
 Returns true if the source and sink ports are compatible.
 

Detailed Description

Connects an output port to an input port in a media pipeline.

MediaLink delivers frames from a source node's output port to a sink node's input queue. When the source port is a Frame port and the sink port is an Image or Audio port, the link extracts the relevant sub-frame data automatically.

MediaLink does not buffer — the buffering is in the sink node's input queue (see MediaNode).

Constructor & Destructor Documentation

◆ MediaLink()

MediaLink::MediaLink ( MediaPort::Ptr  source,
MediaPort::Ptr  sink 
)
inline

Constructs a link between the given source and sink ports.

Parameters
sourceThe output port.
sinkThe input port.

Member Function Documentation

◆ deliver()

Error MediaLink::deliver ( Frame::Ptr  frame) const

Delivers a frame from the source to the sink node's input queue.

Handles Frame-to-Image and Frame-to-Audio extraction if the source and sink port types differ.

Parameters
frameThe frame to deliver.
Returns
Error::Ok on success, or an error if delivery fails.

◆ isValid()

bool MediaLink::isValid ( ) const

Returns true if the source and sink ports are compatible.

Returns
true if the link's ports can be connected.

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