Go to the documentation of this file.
13 #include <unordered_map>
15 #include <compass_msgs/Azimuth.h>
19 #include <geometry_msgs/TransformStamped.h>
20 #include <gps_common/GPSFix.h>
26 #include <sensor_msgs/CameraInfo.h>
27 #include <sensor_msgs/Imu.h>
28 #include <sensor_msgs/MagneticField.h>
29 #include <sensor_msgs/NavSatFix.h>
31 #include <vision_msgs/Detection2DArray.h>
34 #include <libavcodec/avcodec.h>
35 #include <libavfilter/avfilter.h>
36 #include <libavformat/avformat.h>
37 #include <libswscale/swscale.h>
45 av_always_inline
char* av_err2str(
const int errnum)
47 thread_local
char str[AV_ERROR_MAX_STRING_SIZE] = {0};
48 return av_make_error_string(str, AV_ERROR_MAX_STRING_SIZE, errnum);
56 void operator()(AVPacket* packet) noexcept { av_packet_unref(packet); }
62 void operator()(AVFrame* frame) noexcept { av_frame_unref(frame); }
64 using AVFramePtr = std::unique_ptr<AVFrame, AVFrameClose>;
70 copy.header.stamp = stamp;
211 cras::expected<std::pair<AVCodec*, int>, std::string>
selectStream();
217 cras::expected<void, std::string>
openCodec(
const AVCodec* codec);
RationalNumber getFrameRate() const
void operator()(AVFrame *frame) noexcept
Configuration specifying what movie file to open and how.
AVFilterContext * filterBuffersinkContext
Context for filter outputs.
bool isStillImage() const
cras::optional< StreamTime > subclipEnd
If nonempty, specifies the end of subclip to process.
void extractMetadata()
Run metadata extractors to parse as much as possible in the *Msg members.
void detectTargetPixelFormat()
Detect the pixel format into which we should extract images.
void prepareMetadataExtractors()
Prepare metadata extractors.
StreamTime lastSeek
The value of the last seek request (0 before first seek).
std::shared_ptr< MovieMetadataListener > metadataListener
Listener to the extracted metadata.
PIMPL structure for Movie.
MoviePrivate(const cras::LogHelperPtr &log)
Constructor.
StreamDuration getDuration() const
cras::optional< StreamTime > subclipStart
If nonempty, specifies the start of subclip to process.
ros::Time getTimestamp(const StreamTime &ptsTime) const
Compute ROS timestamp corresponding to the given stream timestamp taking into account the configured ...
Time type denoting movie stream time.
MoviePlaybackState::Ptr playbackState
Playback state of the movie.
AVStream * stream
The selected stream.
std::string const * frameId(const M &m)
StreamDuration getStreamDuration() const
int imageBufferSize
Size of the image buffer.
SwsContext * swscaleContext
Scaling context.
AVFilterContext * filterBuffersrcContext
Context for filter inputs.
MovieOpenConfig::Ptr config
AVCodecContext * codecContext
Codec context.
AVPixelFormat targetPixelFormat
The desired output pixel format.
cras::expected< void, std::string > addRotationFilter()
Add an image rotation filter to the libav graph so that the outputs are upright.
std::shared_ptr< MoviePlaybackState > Ptr
std::shared_ptr< MovieOpenConfig > Ptr
cras::optional< StreamDuration > subclipDuration
If nonempty, specifies the duration of subclip to process.
::cras::LogHelper::Ptr LogHelperPtr
std::unique_ptr< AVFrame, AVFrameClose > AVFramePtr
AVFormatContext * formatContext
Format context.
StreamTime getStreamStart() const
cras::expected< void, std::string > openCodec(const AVCodec *codec)
Open the given codec for decoding.
cras::optional< int64_t > seekRequest
When set, the next returned frame should be seeked to this position.
std::shared_ptr< MetadataManager > metadataManager
Manager of the extractable metadata.
void operator()(AVPacket *packet) noexcept
std::shared_ptr< MovieInfo > Ptr
StreamDuration getContainerDuration() const
Read a movie or image file.
StreamTime getStreamEnd() const
A simple representation of rational numbers of the form numerator/denominator.
cras::expected< void, std::string > configSwscale()
Add a scaling filter to the libav graph so that the outputs are properly scaled and color-transformed...
Duration type denoting movie stream duration.
AVFilterGraph * filterGraph
Filter graph for decoding effects.
size_t getNumFrames() const
std::unique_ptr< AVPacket, AVPacketClose > AVPacketPtr
M updateHeader(const M &msg, const ros::Time &stamp, const std::string &frameId)
cras::expected< std::pair< AVCodec *, int >, std::string > selectStream()
Select the best quality stream and open it for decoding.
void updateMetadata(const StreamTime &ptsTime)
Update the metadata for another frame (if some metadata are time-dependent).
movie_publisher
Author(s): Martin Pecka
autogenerated on Wed May 28 2025 02:07:22