diff mbox series

[FFmpeg-devel,v2,1/7] lavc/codec2utils: Use actual libcodec2 version

Message ID a85bc5d6a405ba989d98383a10612d42d015ea90.camel@haerdin.se
State New
Headers show
Series [FFmpeg-devel,v2,1/7] lavc/codec2utils: Use actual libcodec2 version | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished
andriy/make_x86 success Make finished
andriy/make_fate_x86 success Make fate finished

Commit Message

Tomas Härdin Dec. 30, 2023, 9:22 p.m. UTC
Should compile without libcodec2 installed now

/Tomas
diff mbox series

Patch

From 098a3b7e78dc0b1bbdfce051de21526f0a886b4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tomas=20H=C3=A4rdin?= <git@haerdin.se>
Date: Wed, 27 Dec 2023 17:32:21 +0100
Subject: [PATCH 1/7] lavc/codec2utils: Use actual libcodec2 version

---
 libavcodec/codec2utils.h | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/libavcodec/codec2utils.h b/libavcodec/codec2utils.h
index 6812ae895c..e1314b05b6 100644
--- a/libavcodec/codec2utils.h
+++ b/libavcodec/codec2utils.h
@@ -23,6 +23,10 @@ 
 #define AVCODEC_CODEC2UTILS_H
 
 #include <stdint.h>
+#include "config.h"
+#if CONFIG_LIBCODEC2
+#include <codec2/version.h>
+#endif
 
 //Highest mode we're willing to use.
 //Don't want to let users accidentally produce files that can't be decoded in the future.
@@ -49,9 +53,16 @@ 
 
 //Used in codec2raw demuxer and libcodec2 encoder
 static inline void codec2_make_extradata(uint8_t *ptr, int mode) {
-    //version 0.8 as of 2017-12-23 (r3386)
-    ptr[0] = 0;     //major
-    ptr[1] = 8;     //minor
+#if CONFIG_LIBCODEC2
+    ptr[0] = CODEC2_VERSION_MAJOR;
+    ptr[1] = CODEC2_VERSION_MINOR;
+#else
+    // this codepath is only hit when demuxing raw codec2 with libcodec2 disabled,
+    // and only relevant when remuxing from raw codec2 to .c2,
+    // because version information is ignored except when writing the .c2 header
+    ptr[0] = 1;     // version 1.2.0 is the latest we know of
+    ptr[1] = 2;
+#endif
     ptr[2] = mode;  //mode
     ptr[3] = 0;     //flags
 }
-- 
2.39.2