Public Types | Public Member Functions | Protected Attributes | List of all members
movie_publisher::TimedMetadataExtractor Class Referenceabstract

Extractor of timed metadata. More...

#include <metadata_extractor.h>

Inheritance diagram for movie_publisher::TimedMetadataExtractor:
Inheritance graph
[legend]

Public Types

using ConstPtr = std::shared_ptr< const TimedMetadataExtractor >
 
using Ptr = std::shared_ptr< TimedMetadataExtractor >
 
- Public Types inherited from movie_publisher::MetadataExtractor
using ConstPtr = std::shared_ptr< const MetadataExtractor >
 
using Ptr = std::shared_ptr< MetadataExtractor >
 

Public Member Functions

virtual void addTimedMetadataListener (const std::shared_ptr< TimedMetadataListener > &listener)
 Add a new timed metadata listener. More...
 
virtual bool hasTimedMetadata () const
 
virtual void prepareTimedMetadata (const std::unordered_set< MetadataType > &metadataTypes)
 Perform any required initialization of the extractor so that it is prepared to extract metadata of the given types. More...
 
virtual size_t processTimedMetadata (MetadataType type, const StreamTime &maxTime, bool requireOptional)
 Process timed metadata up until the time passed as parameter. More...
 
virtual void seekTimedMetadata (const StreamTime &seekTime)
 Seek timed metadata to the given stream time. More...
 
virtual std::unordered_set< MetadataTypesupportedTimedMetadata (const std::unordered_set< MetadataType > &availableMetadata) const =0
 Get a list of timed metadata that are supported by this instance of the extractor based on the given available metadata. More...
 
 TimedMetadataExtractor (const cras::LogHelperPtr &log)
 
- Public Member Functions inherited from movie_publisher::MetadataExtractor
virtual cras::optional< geometry_msgs::Vector3 > getAcceleration ()
 
virtual cras::optional< geometry_msgs::Vector3 > getAngularVelocity ()
 
virtual cras::optional< compass_msgs::Azimuth > getAzimuth ()
 
virtual cras::optional< std::string > getCameraGeneralName ()
 
virtual cras::optional< sensor_msgs::CameraInfo > getCameraInfo ()
 
virtual cras::optional< std::string > getCameraMake ()
 
virtual cras::optional< std::string > getCameraModel ()
 
virtual cras::optional< std::string > getCameraSerialNumber ()
 
virtual cras::optional< std::string > getCameraUniqueName ()
 
virtual cras::optional< ros::TimegetCreationTime ()
 
virtual cras::optional< double > getCropFactor ()
 
virtual cras::optional< DistortionDatagetDistortion ()
 
virtual cras::optional< vision_msgs::Detection2DArray > getFaces ()
 
virtual cras::optional< double > getFocalLength35MM ()
 
virtual cras::optional< double > getFocalLengthMM ()
 
virtual cras::optional< double > getFocalLengthPx ()
 
virtual GNSSFixAndDetail getGNSSPosition ()
 
virtual cras::optional< sensor_msgs::Imu > getImu ()
 
virtual cras::optional< IntrinsicMatrixgetIntrinsicMatrix ()
 
virtual cras::optional< std::string > getLensMake ()
 
virtual cras::optional< std::string > getLensModel ()
 
virtual cras::optional< sensor_msgs::MagneticField > getMagneticField ()
 
virtual std::string getName () const =0
 Return the name of the extractor. More...
 
virtual cras::optional< geometry_msgs::Transform > getOpticalFrameTF ()
 
virtual int getPriority () const =0
 Return the priority of the extractor (for ordering in MetadataManager). More...
 
virtual cras::optional< RollPitchgetRollPitch ()
 
virtual cras::optional< intgetRotation ()
 
virtual cras::optional< SensorSizegetSensorSizeMM ()
 
virtual cras::optional< geometry_msgs::Transform > getZeroRollPitchTF ()
 
 MetadataExtractor (const cras::LogHelperPtr &log)
 Constructor. More...
 
virtual void processPacket (const AVPacket *packet)
 Optional processing of libav packets as they are read from the movie file. More...
 
virtual ~MetadataExtractor ()
 
- Public Member Functions inherited from cras::HasLogger
::cras::LogHelperConstPtr getCrasLogger () const
 
 HasLogger (const ::cras::LogHelperPtr &log)
 
void setCrasLogger (const ::cras::LogHelperPtr &log)
 

Protected Attributes

std::vector< TimedMetadataListener::Ptrlisteners
 The listeners whose callbacks should be called. More...
 
- Protected Attributes inherited from cras::HasLogger
::cras::LogHelperPtr log
 

Detailed Description

Extractor of timed metadata.

Different from the static metadata, timed metadata can get new values as the movie is advanced. Also, the update rates of the timed metadata may not match the framerate of the movie. That is wHy "reading" the timed metadata is implemented via callbacks to the TimedMetadataListener classes.

Definition at line 386 of file metadata_extractor.h.

Member Typedef Documentation

◆ ConstPtr

Definition at line 390 of file metadata_extractor.h.

◆ Ptr

Definition at line 389 of file metadata_extractor.h.

Constructor & Destructor Documentation

◆ TimedMetadataExtractor()

movie_publisher::TimedMetadataExtractor::TimedMetadataExtractor ( const cras::LogHelperPtr log)
explicit
Parameters
[in]logLogger.

Member Function Documentation

◆ addTimedMetadataListener()

virtual void movie_publisher::TimedMetadataExtractor::addTimedMetadataListener ( const std::shared_ptr< TimedMetadataListener > &  listener)
virtual

Add a new timed metadata listener.

Parameters
[in]listenerThe listener to be added.
Note
Implementing classes should call this base method implementation. It adds the listener to listeners field.

◆ hasTimedMetadata()

virtual bool movie_publisher::TimedMetadataExtractor::hasTimedMetadata ( ) const
virtual
Returns
Whether the extractor is able to extract some timed metadata from the movie it is bound to.
Note
This is the best guess based on the current knowledge of the extractor. It can still happen that processTimedMetadata() will fail to produce the metadata.
Implementing classes should not call this base method implementation.

Reimplemented in movie_publisher::MetadataManager.

◆ prepareTimedMetadata()

virtual void movie_publisher::TimedMetadataExtractor::prepareTimedMetadata ( const std::unordered_set< MetadataType > &  metadataTypes)
virtual

Perform any required initialization of the extractor so that it is prepared to extract metadata of the given types.

Parameters
[in]metadataTypesThe types of metadata this extractor should provide.
Note
This method should be called before the first call to processTimedMetadata() and canProduceTimedMetadata().
Implementing classes should not call this base method implementation.

Reimplemented in movie_publisher::MetadataManager.

◆ processTimedMetadata()

virtual size_t movie_publisher::TimedMetadataExtractor::processTimedMetadata ( MetadataType  type,
const StreamTime maxTime,
bool  requireOptional 
)
virtual

Process timed metadata up until the time passed as parameter.

Parameters
[in]typeType of the requested metadata.
[in]maxTimeThe maximum stream timestamp of the timed metadata that should be passed to listeners.
[in]requireOptionalIf true and the timed metadata are composed of multiple base metadata, treat even optional metadata as required. This is used by the metadata creation loop to first make sure other providers have produced as much as they can before this metadata is asked to be produced even with incomplete optional dependencies.
Returns
The number of produced metadata (corresponds to the number of callbacks called).
Note
It is assumed that maxTime is a sequence of times growing as fast as the video frame timestamps. Use seekTimedMetadata() to inform the extractor that it should seek somewhere (create a discontinuity in this growing sequence of timestamps).
If timed metadata are present and supported, all listeners added by addTimedMetadataListener() will be called with appropriate data.
Implementing classes should not call this base method implementation.

Reimplemented in movie_publisher::MetadataManager.

◆ seekTimedMetadata()

virtual void movie_publisher::TimedMetadataExtractor::seekTimedMetadata ( const StreamTime seekTime)
virtual

Seek timed metadata to the given stream time.

Parameters
[in]seekTimeThe stream timestamp to seek to.
Note
Implementing classes should not call this base method implementation.

Reimplemented in movie_publisher::MetadataManager.

◆ supportedTimedMetadata()

virtual std::unordered_set<MetadataType> movie_publisher::TimedMetadataExtractor::supportedTimedMetadata ( const std::unordered_set< MetadataType > &  availableMetadata) const
pure virtual

Get a list of timed metadata that are supported by this instance of the extractor based on the given available metadata.

Parameters
[in]availableMetadataThe timed metadata that is currently available.
Returns
Supported metadata types.
Note
This function should return a correct result right after the extractor is constructed. It should reflect the actual content of the file the extractor is bound to, and if the extractor doesn't see anything it could decode, it should return an empty value from this function.

Implemented in movie_publisher::MetadataManager.

Member Data Documentation

◆ listeners

std::vector<TimedMetadataListener::Ptr> movie_publisher::TimedMetadataExtractor::listeners
protected

The listeners whose callbacks should be called.

Definition at line 459 of file metadata_extractor.h.


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


movie_publisher
Author(s): Martin Pecka
autogenerated on Wed May 28 2025 02:07:22