movie.h
Go to the documentation of this file.
1 // SPDX-License-Identifier: BSD-3-Clause
2 // SPDX-FileCopyrightText: Czech Technical University in Prague
3 
10 #pragma once
11 
12 #include <memory>
13 #include <string>
14 #include <vector>
15 
22 #include <movie_publisher/types.h>
23 #include <ros/duration.h>
25 #include <sensor_msgs/Image.h>
26 
27 namespace movie_publisher
28 {
29 
30 struct MoviePrivate;
31 
35 class Movie : public cras::HasLogger
36 {
37 public:
45 
46  virtual ~Movie();
47 
51  MovieInfo::ConstPtr info() const;
52 
56  const MovieOpenConfig& config() const;
57 
61  virtual MetadataExtractor::Ptr staticMetadata() const;
62 
67 
95  cras::expected<void, std::string> setSubClip(
96  const cras::optional<StreamTime>& start, const cras::optional<StreamTime>& end,
97  const cras::optional<StreamDuration>& duration);
98 
99 protected:
105  virtual cras::expected<void, std::string> setSubClip(
106  const cras::optional<StreamTime>& start, const cras::optional<StreamTime>& end,
107  const cras::optional<StreamDuration>& duration, bool allowReopen);
108 
109 public:
114  virtual void setTimestampOffset(const ros::Duration& offset);
115 
127  virtual cras::expected<std::pair<MoviePlaybackState, sensor_msgs::ImageConstPtr>, std::string> nextFrame();
128 
135  cras::expected<void, std::string> seek(const StreamTime& time);
136 
137 protected:
142  virtual cras::expected<void, std::string> seek(const StreamTime& time, bool allowReopen);
143 
144 public:
151  virtual cras::expected<void, std::string> seekInSubclip(const StreamTime& time);
152 
153 protected:
158  virtual cras::expected<void, std::string> open();
159 
164  virtual void close();
165 
170 
175 
180 
181 private:
182  std::unique_ptr<MoviePrivate> data;
183 };
184 
185 using MoviePtr = std::shared_ptr<Movie>;
186 using MovieConstPtr = std::shared_ptr<const Movie>;
187 }
movie_publisher::Movie::seek
cras::expected< void, std::string > seek(const StreamTime &time)
Seek the movie to the given time (relative to the start of the movie).
movie_publisher::Movie::nextFrame
virtual cras::expected< std::pair< MoviePlaybackState, sensor_msgs::ImageConstPtr >, std::string > nextFrame()
Generator returning next frame of the movie on each call.
movie_publisher::MovieOpenConfig
Configuration specifying what movie file to open and how.
Definition: movie_open_config.h:28
movie_publisher::Movie::_playbackState
MoviePlaybackState::Ptr _playbackState()
image_encodings.h
types.h
Custom movie_publisher datatypes.
movie_publisher::Movie::~Movie
virtual ~Movie()
movie_info.h
Basic information about an open movie.
movie_publisher::Movie::data
std::unique_ptr< MoviePrivate > data
PIMPL.
Definition: movie.h:182
movie_publisher::Movie::close
virtual void close()
Close the movie, free all acquired resources.
cras::HasLogger
movie_publisher::MoviePtr
std::shared_ptr< Movie > MoviePtr
Definition: movie.h:185
movie_playback_state.h
State of movie playback.
movie_publisher::StreamTime
Time type denoting movie stream time.
Definition: types.h:115
log_utils.h
duration.h
movie_open_config.h
Configuration specifying what movie file to open and how.
movie_publisher::Movie::_config
MovieOpenConfig & _config()
movie_publisher::MoviePlaybackState::Ptr
std::shared_ptr< MoviePlaybackState > Ptr
Definition: movie_playback_state.h:100
movie_publisher::Movie::_info
MovieInfo::Ptr _info()
movie_publisher::MovieInfo::ConstPtr
std::shared_ptr< const MovieInfo > ConstPtr
Definition: movie_info.h:195
start
ROSCPP_DECL void start()
movie_publisher::Movie::seekInSubclip
virtual cras::expected< void, std::string > seekInSubclip(const StreamTime &time)
Seek the movie to the given time (relative to the start of the subclip).
expected.hpp
cras::LogHelperPtr
::cras::LogHelper::Ptr LogHelperPtr
movie_publisher::Movie::open
virtual cras::expected< void, std::string > open()
Open the file configured in the config object passed to constructor.
movie_publisher::MetadataExtractor::Ptr
std::shared_ptr< MetadataExtractor > Ptr
Definition: metadata_extractor.h:79
movie_publisher
Definition: ExifBaseMetadataExtractor.h:27
movie_publisher::Movie
An open movie that can be read, seeked and closed.
Definition: movie.h:35
movie_publisher::MoviePlaybackState::ConstPtr
std::shared_ptr< const MoviePlaybackState > ConstPtr
Definition: movie_playback_state.h:101
movie_publisher::MovieInfo::Ptr
std::shared_ptr< MovieInfo > Ptr
Definition: movie_info.h:194
cras::HasLogger::log
::cras::LogHelperPtr log
movie_publisher::Movie::config
const MovieOpenConfig & config() const
movie_publisher::Movie::staticMetadata
virtual MetadataExtractor::Ptr staticMetadata() const
movie_publisher::Movie::playbackState
MoviePlaybackState::ConstPtr playbackState() const
movie_metadata_processor.h
Base for consumers of movie metadata.
movie_publisher::Movie::Movie
Movie(const cras::LogHelperPtr &log, const MovieOpenConfig &config)
Open a movie in the referenced file.
ros::Duration
movie_publisher::MovieConstPtr
std::shared_ptr< const Movie > MovieConstPtr
Definition: movie.h:186
movie_publisher::Movie::setSubClip
cras::expected< void, std::string > setSubClip(const cras::optional< StreamTime > &start, const cras::optional< StreamTime > &end, const cras::optional< StreamDuration > &duration)
Limit the part of the movie returned by nextFrame() calls to the given subclip.
movie_publisher::Movie::info
MovieInfo::ConstPtr info() const
movie_publisher::Movie::setTimestampOffset
virtual void setTimestampOffset(const ros::Duration &offset)
Set the offset of the computed ROS timestamps relative to the reference time.


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