Ocean
|
This class is the base class for all live videos. More...
Data Structures | |
class | StreamConfiguration |
This class holds the relevant information describing a video stream configuration. More... | |
Public Types | |
enum | ControlMode : uint32_t { CM_INVALID = 0u , CM_FIXED , CM_DYNAMIC } |
Definition of individual control modes. More... | |
enum | StreamType : uint32_t { ST_INVALID = 0u , ST_FRAME , ST_MJPEG , ST_CODEC } |
Definition of individual stream types. More... | |
enum | CodecType : uint32_t { CT_INVALID = 0u , CT_H264 , CT_H265 } |
Definition of individual codec types. More... | |
using | StreamTypes = std::vector< StreamType > |
Definition of a vector holding stream types. More... | |
using | StreamConfigurations = std::vector< StreamConfiguration > |
Definition of a vector holding stream configurations. More... | |
Public Types inherited from Ocean::Media::FrameMedium | |
typedef double | FrameFrequency |
Definition of a frame frequency defined in Hz. More... | |
typedef std::function< void(const Frame &frame, const SharedAnyCamera &camera)> | FrameCallbackFunction |
Definition of a callback function for frame events. More... | |
typedef ScopedSubscriptionHandler::ScopedSubscriptionType | FrameCallbackScopedSubscription |
Definition of a subscription object for frame callback events. More... | |
Public Types inherited from Ocean::Media::Medium | |
enum | Type : uint32_t { MEDIUM = 0u , FRAME_MEDIUM = 1u << 0u , SOUND_MEDIUM = 1u << 1u , FINITE_MEDIUM = 1u << 2u , LIVE_MEDIUM = 1u << 3u , CONFIG_MEDIUM = 1u << 4u , AUDIO = (1u << 5u) | FINITE_MEDIUM | SOUND_MEDIUM , IMAGE = (1u << 6u) | FRAME_MEDIUM , PIXEL_IMAGE = (1u << 7u) | FRAME_MEDIUM , BUFFER_IMAGE = (1u << 8u) | FRAME_MEDIUM , IMAGE_SEQUENCE = (1u << 9u) | FRAME_MEDIUM | FINITE_MEDIUM , LIVE_AUDIO = (1u << 10u) | LIVE_MEDIUM | SOUND_MEDIUM , LIVE_VIDEO = (1u << 11u) | LIVE_MEDIUM | FRAME_MEDIUM , MICROPHONE = (1u << 12u) | LIVE_MEDIUM , MOVIE = (1u << 13u) | FINITE_MEDIUM | FRAME_MEDIUM | SOUND_MEDIUM } |
Definition of different medium types. More... | |
Public Types inherited from Ocean::Media::ConfigMedium | |
typedef std::vector< std::string > | ConfigNames |
Definition of a vector holding configuration names. More... | |
Public Member Functions | |
virtual StreamTypes | supportedStreamTypes () const |
Returns the supported stream types. More... | |
virtual StreamConfigurations | supportedStreamConfigurations (const StreamType streamType=ST_INVALID) const |
Returns the supported stream configurations for a given stream type. More... | |
virtual double | exposureDuration (double *minDuration=nullptr, double *maxDuration=nullptr, ControlMode *exposureMode=nullptr) const |
Returns the current exposure duration of this device. More... | |
virtual float | iso (float *minISO=nullptr, float *maxISO=nullptr, ControlMode *isoMode=nullptr) const |
Returns the current ISO of this device. More... | |
virtual float | focus (ControlMode *focusMode=nullptr) const |
Returns the current focus of this device. More... | |
virtual bool | setPreferredStreamType (const StreamType streamType) |
Sets the preferred stream type. More... | |
virtual bool | setPreferredStreamConfiguration (const StreamConfiguration &streamConfiguration) |
Sets the preferred stream configuration. More... | |
virtual bool | setExposureDuration (const double duration) |
Sets the exposure duration of this device. More... | |
virtual bool | setISO (const float iso) |
Sets the ISO of this device. More... | |
virtual bool | setFocus (const float position) |
Sets the focus of this device. More... | |
Public Member Functions inherited from Ocean::Media::FrameMedium | |
~FrameMedium () override | |
Destructs a frame object. More... | |
bool | hasFrame () const |
Returns whether the object holds a frame. More... | |
FrameFrequency | frameFrequency () const |
Returns the frequency of the frame in Hz. More... | |
virtual FrameRef | frame (SharedAnyCamera *anyCamera=nullptr) const |
Returns the most recent frame. More... | |
virtual FrameRef | frame (const Timestamp timestamp, SharedAnyCamera *anyCamera=nullptr) const |
Returns the frame with a specific timestamp. More... | |
virtual FrameRef | frameTimeout (const double timeout, SharedAnyCamera *anyCamera=nullptr) const |
Waits until the first frame is available. More... | |
virtual bool | hasFrame (const Timestamp timestamp) const |
Returns whether this media object currently holds a frame with specified timestamp. More... | |
unsigned int | preferredFrameWidth () const |
Returns the preferred width of the frame in pixel. More... | |
unsigned int | preferredFrameHeight () const |
Returns the preferred height of the frame in pixel. More... | |
FrameType::PixelFormat | preferredFramePixelFormat () const |
Returns the preferred frame pixel format. More... | |
FrameFrequency | preferredFrameFrequency () const |
Returns the preferred frame frequency in Hz. More... | |
virtual HomogenousMatrixD4 | device_T_camera () const |
Returns the transformation between the camera and device. More... | |
virtual bool | setPreferredFrameDimension (const unsigned int width, const unsigned int height) |
Sets the preferred frame dimension. More... | |
virtual bool | setPreferredFramePixelFormat (const FrameType::PixelFormat format) |
Sets the preferred frame pixel format. More... | |
virtual bool | setPreferredFrameFrequency (const FrameFrequency frequency) |
Sets the preferred frame frequency in Hz. More... | |
size_t | capacity () const |
Returns the capacity of the frame history of this frame medium object. More... | |
bool | setCapacity (const size_t capacity) |
Sets or changes the capacity of the frame history of this frame medium object. More... | |
FrameCallbackScopedSubscription | addFrameCallback (FrameCallbackFunction &&frameCallbackFunction) |
Adds a callback function which is called whenever a new frame arrives. More... | |
Public Member Functions inherited from Ocean::Media::Medium | |
const std::string & | url () const |
Returns the url of the medium. More... | |
bool | isValid () const |
Returns whether the medium is valid. More... | |
const std::string & | library () const |
Returns the name of the owner library. More... | |
Type | type () const |
Returns the type of the medium. More... | |
bool | isType (const Type type) const |
Returns whether a medium has a given type. More... | |
virtual bool | isStarted () const =0 |
Returns whether the medium is started currently. More... | |
bool | isExclusive () const |
Returns whether this medium can be use exclusively. More... | |
virtual bool | start ()=0 |
Starts the medium. More... | |
virtual bool | pause ()=0 |
Pauses the medium. More... | |
virtual bool | stop ()=0 |
Stops the medium. More... | |
virtual Timestamp | startTimestamp () const =0 |
Returns the start timestamp. More... | |
virtual Timestamp | pauseTimestamp () const =0 |
Returns the pause timestamp. More... | |
virtual Timestamp | stopTimestamp () const =0 |
Returns the stop timestamp. More... | |
virtual MediumRef | clone () const |
Clones this medium and returns a new independent instance of this medium. More... | |
Public Member Functions inherited from Ocean::Media::ConfigMedium | |
virtual bool | configuration (const std::string &name, long long data) |
Starts a configuration possibility. More... | |
virtual ConfigNames | configs () const |
Returns the names of the configuration possibilities. More... | |
Static Public Member Functions | |
static std::string | translateControlMode (const ControlMode controlMode) |
Translates a control mode to a string. More... | |
static std::string | translateStreamType (const StreamType streamType) |
Translates a stream type to a string. More... | |
static std::string | translateCodecType (const CodecType codecType) |
Translates a codec type to a string. More... | |
Static Public Member Functions inherited from Ocean::Media::FrameMedium | |
static bool | syncedFrames (const FrameMediumRefs &frameMediums, const Timestamp lastTimestamp, FrameRefs &frames, SharedAnyCameras &cameras, const unsigned int waitTime=2u, bool *timedOut=nullptr, HomogenousMatricesD4 *device_T_cameras=nullptr) |
Extracts most recent frames from several frame medium objects and ensures that the timestamps of all frames are identical. More... | |
Static Public Member Functions inherited from Ocean::Media::Medium | |
static std::string | convertType (const Type type) |
Converts a medium type to a unique string. More... | |
static Type | convertType (const std::string &type) |
Converts a medium type string to a medium type. More... | |
Protected Member Functions | |
LiveVideo (const std::string &url) | |
Creates a new live video source by a given url. More... | |
Protected Member Functions inherited from Ocean::Media::FrameMedium | |
FrameMedium (const std::string &url) | |
Creates a new frame medium by a given url. More... | |
virtual bool | deliverNewFrame (Frame &&frame, SharedAnyCamera &&anyCamera=SharedAnyCamera()) |
Delivers a new frame to this FrameMedium. More... | |
Protected Member Functions inherited from Ocean::Media::Medium | |
Medium (const Medium &medium)=delete | |
Disabled copy constructor. More... | |
Medium (const std::string &url) | |
Creates a new medium by a given url. More... | |
virtual | ~Medium () |
Destructs a medium. More... | |
Medium & | operator= (const Medium &medium)=delete |
Disabled copy operator. More... | |
Protected Member Functions inherited from Ocean::Media::LiveMedium | |
LiveMedium (const std::string &url) | |
Creates a new live medium by a given url. More... | |
Protected Member Functions inherited from Ocean::Media::ConfigMedium | |
ConfigMedium (const std::string &url) | |
Creates a new ConfigMedium object by a given url. More... | |
Additional Inherited Members | |
Protected Types inherited from Ocean::Media::FrameMedium | |
typedef ScopedSubscriptionCallbackHandlerT< FrameCallbackFunction, FrameMedium, true > | FrameCallbackHandler |
Definition of a thread-safe subscription handler for frame callback functions. More... | |
typedef std::vector< MediaFrameType > | FrameTypes |
Definition of a vector holding frame types. More... | |
Protected Attributes inherited from Ocean::Media::FrameMedium | |
FrameCollection | frameCollection_ |
Frame collection storing several frames with different timestamps. More... | |
FrameCallbackHandler | frameCallbackHandler_ |
The handler for frame callback functions. More... | |
FrameFrequency | recentFrameFrequency_ = FrameFrequency(0) |
Frame frequency. More... | |
MediaFrameType | preferredFrameType_ |
Preferred frame type of the medium. More... | |
Protected Attributes inherited from Ocean::Media::Medium | |
std::string | url_ |
Url of the medium. More... | |
std::string | libraryName_ |
Name of the owner library. More... | |
bool | isValid_ = false |
Determines whether the medium is valid. More... | |
Type | type_ = MEDIUM |
Type of the medium. More... | |
Lock | lock_ |
Medium lock. More... | |
This class is the base class for all live videos.
using Ocean::Media::LiveVideo::StreamConfigurations = std::vector<StreamConfiguration> |
Definition of a vector holding stream configurations.
using Ocean::Media::LiveVideo::StreamTypes = std::vector<StreamType> |
Definition of a vector holding stream types.
enum Ocean::Media::LiveVideo::CodecType : uint32_t |
enum Ocean::Media::LiveVideo::ControlMode : uint32_t |
Definition of individual control modes.
The modes are used for exposure, ISO, and focus.
enum Ocean::Media::LiveVideo::StreamType : uint32_t |
Definition of individual stream types.
|
explicitprotected |
Creates a new live video source by a given url.
url | Url of the live video source |
|
virtual |
Returns the current exposure duration of this device.
minDuration | Optional resulting minimal duration to set, in seconds, with range (0, infinity), -1 if unknown |
maxDuration | Optional resulting maximal duration to set, in seconds, with range [minDuration, infinity), -1 if unknown |
exposureMode | Optional resulting exposure mode, nullptr if not of interest |
Reimplemented in Ocean::Media::USB::USBLiveVideo, Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Returns the current focus of this device.
focusMode | Optional resulting focus mode, nullptr if not of interest |
Reimplemented in Ocean::Media::USB::USBLiveVideo, Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Returns the current ISO of this device.
minISO | Optional resulting minimal ISO to set, with range (0, infinity), -1 if unknown |
maxISO | Optional resulting maximal ISO to set, with range (0, infinity), -1 if unknown |
isoMode | Optional resulting ISO mode, nullptr if not of interest |
Reimplemented in Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Sets the exposure duration of this device.
duration | The exposure duration to be set, in seconds, with range (0, infinity), 0 for auto exposure, -1 for a one-time auto exposure |
Reimplemented in Ocean::Media::USB::USBLiveVideo, Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Sets the focus of this device.
position | The focus position to be set, with range [0, 1] with 0 shortest distance and 1 furthest distance, -1 for auto focus |
Reimplemented in Ocean::Media::USB::USBLiveVideo, Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Sets the ISO of this device.
iso | The ISO to be set, with range (0, infinity), -1 for auto ISO |
Reimplemented in Ocean::Media::AVFoundation::AVFLiveVideo, and Ocean::Media::Android::ALiveVideo.
|
virtual |
Sets the preferred stream configuration.
Using this function will forward some settings to the underlying FrameMedium object via setPreferredFrameDimension(), setPreferredFramePixelFormat(), and setPreferredFrameFrequency(). There is no guarantee that the device will use this stream type.
streamConfiguration | The preferred stream configuration to be set, must be valid |
Reimplemented in Ocean::Media::USB::USBLiveVideo.
|
virtual |
Sets the preferred stream type.
There is no guarantee that the device will use this stream type.
streamType | The preferred stream type to be set, must be valid |
Reimplemented in Ocean::Media::USB::USBLiveVideo.
|
virtual |
Returns the supported stream configurations for a given stream type.
streamType | The type of the stream for which the supported stream configurations will be returned, ST_INVALID to return all stream configurations for all stream types |
Reimplemented in Ocean::Media::USB::USBLiveVideo, and Ocean::Media::MediaFoundation::MFLiveVideo.
|
virtual |
Returns the supported stream types.
Reimplemented in Ocean::Media::USB::USBLiveVideo, and Ocean::Media::MediaFoundation::MFLiveVideo.
|
static |
Translates a codec type to a string.
codecType | The stream type to be translated |
|
static |
Translates a control mode to a string.
controlMode | The control mode to translate |
|
static |
Translates a stream type to a string.
streamType | The stream type to be translated |