#include <libavformat/avformat.h>
#include <libavutil/dict.h>
#include <libavutil/frame.h>
+#include <libswscale/swscale.h>
}
using namespace std;
}
AVFormatContextWithCloser avformat_open_input_unique(
- const char *pathname, AVInputFormat *fmt, AVDictionary **options)
+ const char *pathname, AVInputFormat *fmt,
+ AVDictionary **options)
{
- AVFormatContext *format_ctx = nullptr;
+ return avformat_open_input_unique(pathname, fmt, options, AVIOInterruptCB{ nullptr, nullptr });
+}
+
+AVFormatContextWithCloser avformat_open_input_unique(
+ const char *pathname, AVInputFormat *fmt,
+ AVDictionary **options,
+ const AVIOInterruptCB &interrupt_cb)
+{
+ AVFormatContext *format_ctx = avformat_alloc_context();
+ format_ctx->interrupt_callback = interrupt_cb;
if (avformat_open_input(&format_ctx, pathname, fmt, options) != 0) {
format_ctx = nullptr;
}
return AVFormatContextWithCloser(format_ctx);
}
-
// AVCodecContext
void avcodec_free_context_unique::operator() (AVCodecContext *codec_ctx) const
return AVFrameWithDeleter(av_frame_alloc());
}
+// SwsContext
+
+void sws_free_context_unique::operator() (SwsContext *context) const
+{
+ sws_freeContext(context);
+}