#pragma once #include #include #include #include #include #include #include #include #include "defs.h" #include "memory_buffer.h" #include "sync_decoder.h" using namespace ffmpeg; struct Video : torch::CustomClassHolder { std::tuple current_stream; // stream type, id // global video metadata c10::Dict>> streamsMetadata; public: Video(std::string videoPath, std::string stream); std::tuple getCurrentStream() const; c10::Dict>> getStreamMetadata() const; void Seek(double ts); bool setCurrentStream(std::string stream); std::tuple Next(); private: bool video_any_frame = false; // add this to input parameters? bool succeeded = false; // decoder init flag // seekTS and doSeek act as a flag - if it's not set, next function simply // retruns the next frame. If it's set, we look at the global seek // time in comination with any_frame settings double seekTS = -1; bool doSeek = false; void _getDecoderParams( double videoStartS, int64_t getPtsOnly, std::string stream, long stream_id, bool all_streams, double seekFrameMarginUs); // this needs to be improved std::map> streamTimeBase; // not used DecoderInCallback callback = nullptr; std::vector metadata; protected: SyncDecoder decoder; DecoderParameters params; }; // struct Video