#ifndef FFCONV_MEDIAFILE_H #define FFCONV_MEDIAFILE_H #include "Stream.h" extern "C" { #include } #include namespace ffcpp { enum class Mode { Read, Write }; class MediaFile { private: AVFormatContext* _formatCtx; Mode _mode; public: MediaFile(const std::string& src, Mode mode); operator AVFormatContext*() const; bool hasVideo() const; bool hasAudio() const; Stream videoStream(size_t index = 0) const; Stream audioStream(size_t index = 0) const; Stream addStream(AVCodecID codecID, int width, int height, AVPixelFormat pixelFormat); void writeHeader(); void writeTrailer(); ~MediaFile(); private: bool hasStream(AVMediaType type) const; Stream getStream(AVMediaType type, size_t index) const; }; } #endif //FFCONV_MEDIAFILE_H