]> git.sesse.net Git - nageru/blobdiff - nageru/video_encoder.cpp
Fix compilation with FFmpeg _before_ version 5.0.
[nageru] / nageru / video_encoder.cpp
index 8138e76a42c99a7cf984d030ea7241423d99599d..c75c4e3f365f851a0aa056fdebb3bacd7701bf9a 100644 (file)
@@ -191,7 +191,7 @@ RefCountedGLsync VideoEncoder::end_frame()
 void VideoEncoder::open_output_stream()
 {
        AVFormatContext *avctx = avformat_alloc_context();
-       avctx->oformat = oformat;
+       avctx->oformat = const_cast<decltype(avctx->oformat)>(oformat);  // const_cast is a hack to work in FFmpeg both before and after 5.0.
 
        uint8_t *buf = (uint8_t *)av_malloc(MUX_BUFFER_SIZE);
        avctx->pb = avio_alloc_context(buf, MUX_BUFFER_SIZE, 1, this, nullptr, nullptr, nullptr);