libpromeki main
PROfessional MEdia toolKIt
 
Loading...
Searching...
No Matches
mediaport.h
Go to the documentation of this file.
1
8#pragma once
9
12#include <promeki/core/string.h>
17
19
20class MediaNode;
21
31class MediaPort {
33 public:
36
39
42
48
61
63 MediaPort() = default;
64
72 _name(name), _direction(direction), _mediaType(mediaType) { }
73
75 const String &name() const { return _name; }
76
81 void setName(const String &name) { _name = name; return; }
82
84 Direction direction() const { return _direction; }
85
87 MediaType mediaType() const { return _mediaType; }
88
94 const AudioDesc &audioDesc() const { return _audioDesc; }
95
100 void setAudioDesc(const AudioDesc &desc) { _audioDesc = desc; return; }
101
107 const VideoDesc &videoDesc() const { return _videoDesc; }
108
113 void setVideoDesc(const VideoDesc &desc) { _videoDesc = desc; return; }
114
120 const ImageDesc &imageDesc() const { return _imageDesc; }
121
126 void setImageDesc(const ImageDesc &desc) { _imageDesc = desc; return; }
127
133 const EncodedDesc &encodedDesc() const { return _encodedDesc; }
134
139 void setEncodedDesc(const EncodedDesc &desc) { _encodedDesc = desc; return; }
140
142 bool isConnected() const { return _connected; }
143
148 void setConnected(bool connected) { _connected = connected; return; }
149
151 MediaNode *node() const { return _node; }
152
157 void setNode(MediaNode *node) { _node = node; return; }
158
172 bool isCompatible(const MediaPort &other) const;
173
174 private:
175 String _name;
176 Direction _direction = Input;
177 MediaType _mediaType = Frame;
178 AudioDesc _audioDesc;
179 VideoDesc _videoDesc;
180 ImageDesc _imageDesc;
181 EncodedDesc _encodedDesc;
182 bool _connected = false;
183 MediaNode *_node = nullptr;
184};
185
Describes an audio format including sample type, rate, and channel count.
Definition audiodesc.h:28
Describes a compressed or encoded media format.
Definition encodeddesc.h:28
Describes the format and layout of a single image.
Definition imagedesc.h:33
Dynamic array container wrapping std::vector.
Definition list.h:40
List()=default
Default constructor. Creates an empty list.
Base class for all pipeline processing nodes.
Definition medianode.h:81
Describes a node's input or output connection point.
Definition mediaport.h:31
void setVideoDesc(const VideoDesc &desc)
Sets the video description.
Definition mediaport.h:113
void setEncodedDesc(const EncodedDesc &desc)
Sets the encoded description.
Definition mediaport.h:139
promeki::List< Ptr > PtrList
List of shared pointers to MediaPort.
Definition mediaport.h:41
bool isConnected() const
Returns true if this port is currently connected.
Definition mediaport.h:142
const String & name() const
Returns the port name.
Definition mediaport.h:75
Direction
Port direction.
Definition mediaport.h:44
@ Input
Input port (receives data).
Definition mediaport.h:45
@ Output
Output port (produces data).
Definition mediaport.h:46
const VideoDesc & videoDesc() const
Returns the video description.
Definition mediaport.h:107
MediaType
Media type carried by this port.
Definition mediaport.h:55
@ Frame
Full frame (image + audio + metadata). Described by VideoDesc + AudioDesc.
Definition mediaport.h:56
@ Audio
Audio + metadata. Described by AudioDesc.
Definition mediaport.h:58
@ Encoded
Compressed/encoded data + metadata. Described by EncodedDesc.
Definition mediaport.h:59
@ Image
Image + metadata. Described by ImageDesc.
Definition mediaport.h:57
void setImageDesc(const ImageDesc &desc)
Sets the image description.
Definition mediaport.h:126
const EncodedDesc & encodedDesc() const
Returns the encoded description.
Definition mediaport.h:133
MediaNode * node() const
Returns the node that owns this port, or nullptr.
Definition mediaport.h:151
void setAudioDesc(const AudioDesc &desc)
Sets the audio description.
Definition mediaport.h:100
const AudioDesc & audioDesc() const
Returns the audio description.
Definition mediaport.h:94
void setConnected(bool connected)
Sets the connected state of this port.
Definition mediaport.h:148
MediaPort()=default
Constructs a default (unnamed, Frame/Input) port.
bool isCompatible(const MediaPort &other) const
Tests whether this port is compatible with another port for connection.
void setName(const String &name)
Sets the port name.
Definition mediaport.h:81
MediaType mediaType() const
Returns the media type carried by this port.
Definition mediaport.h:87
promeki::List< MediaPort > List
Plain value list of MediaPort objects.
Definition mediaport.h:38
Direction direction() const
Returns the port direction.
Definition mediaport.h:84
MediaPort(const String &name, Direction direction, MediaType mediaType)
Constructs a port with the given name, direction, and media type.
Definition mediaport.h:71
const ImageDesc & imageDesc() const
Returns the image description.
Definition mediaport.h:120
void setNode(MediaNode *node)
Sets the owning node.
Definition mediaport.h:157
Encoding-aware string class with copy-on-write semantics.
Definition string.h:35
Describes a video format including frame rate, image layers, audio channels, and metadata.
Definition videodesc.h:25
#define PROMEKI_NAMESPACE_BEGIN
Starts a promeki namespace block.
Definition namespace.h:14
#define PROMEKI_NAMESPACE_END
Ends a promeki namespace block.
Definition namespace.h:19
#define PROMEKI_SHARED_FINAL(TYPE)
Macro for non-polymorphic native shared objects.
Definition sharedptr.h:88