]> git.sesse.net Git - nageru/blobdiff - shared/ffmpeg_raii.cpp
Fix a Clang 19 warning.
[nageru] / shared / ffmpeg_raii.cpp
index f2948e9feba8908f88ee529daaf43e99d1f2b518..f77dfabb4d820784b41df91357e2e9b61aa30a6b 100644 (file)
@@ -31,7 +31,11 @@ AVFormatContextWithCloser avformat_open_input_unique(
 {
        AVFormatContext *format_ctx = avformat_alloc_context();
        format_ctx->interrupt_callback = interrupt_cb;
+#ifdef ff_const59
+       if (avformat_open_input(&format_ctx, pathname, const_cast<ff_const59 AVInputFormat *>(fmt), options) != 0) {
+#else
        if (avformat_open_input(&format_ctx, pathname, fmt, options) != 0) {
+#endif
                format_ctx = nullptr;
        }
        return AVFormatContextWithCloser(format_ctx);
@@ -48,7 +52,11 @@ AVFormatContextWithCloser avformat_open_input_unique(
        unsigned char *buf = (unsigned char *)av_malloc(buf_size);
        format_ctx->pb = avio_alloc_context(buf, buf_size, /*write_flag=*/false, opaque,
                read_packet, /*write_packet=*/nullptr, /*seek=*/nullptr);
+#ifdef ff_const59
+       if (avformat_open_input(&format_ctx, "", const_cast<ff_const59 AVInputFormat *>(fmt), options) != 0) {
+#else
        if (avformat_open_input(&format_ctx, "", fmt, options) != 0) {
+#endif
                format_ctx = nullptr;
        }
        return AVFormatContextWithCloser(format_ctx);
@@ -86,6 +94,17 @@ AVFrameWithDeleter av_frame_alloc_unique()
        return AVFrameWithDeleter(av_frame_alloc());
 }
 
+// AVPacket
+void av_packet_free_unique::operator() (AVPacket *packet) const
+{
+       av_packet_unref(packet);
+}
+
+AVPacketWithDeleter av_packet_alloc_unique()
+{
+       return AVPacketWithDeleter(av_packet_alloc());
+}
+
 // SwsContext
 
 void sws_free_context_unique::operator() (SwsContext *context) const