X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=ffmpeg_raii.h;h=33d233480528dd8414e92b3fd32b04c1281d4ffa;hb=3c5cf4ffcabcd8c7948bda313a5139fc06acc80d;hp=d27c20d3b298ec866a6450c6067b404966d6dff8;hpb=cd319a6f4b11d888d8e9f996a2ec487668777e13;p=nageru diff --git a/ffmpeg_raii.h b/ffmpeg_raii.h index d27c20d..33d2334 100644 --- a/ffmpeg_raii.h +++ b/ffmpeg_raii.h @@ -18,40 +18,63 @@ struct AVDictionary; struct AVFormatContext; struct AVFrame; struct AVInputFormat; - +struct SwsContext; +typedef struct AVIOInterruptCB AVIOInterruptCB; // AVFormatContext -void avformat_close_input_unique(AVFormatContext *format_ctx); +struct avformat_close_input_unique { + void operator() (AVFormatContext *format_ctx) const; +}; -typedef std::unique_ptr +typedef std::unique_ptr AVFormatContextWithCloser; AVFormatContextWithCloser avformat_open_input_unique( - const char *pathname, AVInputFormat *fmt, AVDictionary **options); + const char *pathname, AVInputFormat *fmt, + AVDictionary **options); + +AVFormatContextWithCloser avformat_open_input_unique( + const char *pathname, AVInputFormat *fmt, + AVDictionary **options, + const AVIOInterruptCB &interrupt_cb); // AVCodecContext -void avcodec_free_context_unique(AVCodecContext *codec_ctx); +struct avcodec_free_context_unique { + void operator() (AVCodecContext *ctx) const; +}; -typedef std::unique_ptr +typedef std::unique_ptr AVCodecContextWithDeleter; AVCodecContextWithDeleter avcodec_alloc_context3_unique(const AVCodec *codec); // AVCodecParameters -void avcodec_parameters_free_unique(AVCodecParameters *codec_par); +struct avcodec_parameters_free_unique { + void operator() (AVCodecParameters *codec_par) const; +}; -typedef std::unique_ptr +typedef std::unique_ptr AVCodecParametersWithDeleter; // AVFrame -void av_frame_free_unique(AVFrame *frame); +struct av_frame_free_unique { + void operator() (AVFrame *frame) const; +}; -typedef std::unique_ptr +typedef std::unique_ptr AVFrameWithDeleter; AVFrameWithDeleter av_frame_alloc_unique(); +// SwsContext +struct sws_free_context_unique { + void operator() (SwsContext *context) const; +}; + +typedef std::unique_ptr + SwsContextWithDeleter; + #endif // !defined(_FFMPEG_RAII_H)