Commit ba7a998c57 for ffmpeg
commit ba7a998c57685bd40f8e0d268ab8ee697ac96a73
Author: James Almer <jamrial@gmail.com>
Date: Thu Oct 29 15:26:09 2026 -0300
avformat: add a raw LCEVC demuxer
Signed-off-by: James Almer <jamrial@gmail.com>
diff --git a/libavformat/Makefile b/libavformat/Makefile
index ae8baaa12f..e012ce5ae6 100644
--- a/libavformat/Makefile
+++ b/libavformat/Makefile
@@ -359,6 +359,7 @@ OBJS-$(CONFIG_LAF_DEMUXER) += lafdec.o
OBJS-$(CONFIG_LATM_MUXER) += latmenc.o rawenc.o
OBJS-$(CONFIG_LC3_DEMUXER) += lc3.o
OBJS-$(CONFIG_LC3_MUXER) += lc3.o
+OBJS-$(CONFIG_LCEVC_DEMUXER) += lcevcdec.o
OBJS-$(CONFIG_LMLM4_DEMUXER) += lmlm4.o
OBJS-$(CONFIG_LOAS_DEMUXER) += loasdec.o rawdec.o
OBJS-$(CONFIG_LUODAT_DEMUXER) += luodatdec.o
diff --git a/libavformat/allformats.c b/libavformat/allformats.c
index a4e859da33..c18072c082 100644
--- a/libavformat/allformats.c
+++ b/libavformat/allformats.c
@@ -263,6 +263,7 @@ extern const FFInputFormat ff_laf_demuxer;
extern const FFOutputFormat ff_latm_muxer;
extern const FFInputFormat ff_lc3_demuxer;
extern const FFOutputFormat ff_lc3_muxer;
+extern const FFInputFormat ff_lcevc_demuxer;
extern const FFInputFormat ff_lmlm4_demuxer;
extern const FFInputFormat ff_loas_demuxer;
extern const FFInputFormat ff_luodat_demuxer;
diff --git a/libavformat/lcevcdec.c b/libavformat/lcevcdec.c
new file mode 100644
index 0000000000..66ea063f6d
--- /dev/null
+++ b/libavformat/lcevcdec.c
@@ -0,0 +1,56 @@
+/*
+ * RAW LCEVC video demuxer
+ *
+ * This file is part of FFmpeg.
+ *
+ * FFmpeg is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * FFmpeg is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with FFmpeg; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "libavcodec/lcevc.h"
+
+#include "avformat.h"
+#include "rawdec.h"
+
+static int lcevc_probe(const AVProbeData *p)
+{
+ uint32_t code = -1;
+ int idr = 0;
+ int i;
+
+ for (i = 0; i < p->buf_size - 1; i++) {
+ code = (code << 8) + p->buf[i];
+ if ((code & 0xffffff00) == 0x100) {
+ int nal2 = p->buf[i + 1];
+ int type = (code & 0x3E) >> 1;
+
+ if (code & 0x80) // forbidden zero bit
+ return 0;
+ if (!(code & 0x40)) // forbidden one bit
+ return 0;
+ if (!(code & 1) || nal2 != 0xff) // reserved ones
+ return 0;
+
+ switch (type) {
+ case LCEVC_IDR_NUT: idr++; break;
+ }
+ }
+ }
+
+ if (idr)
+ return AVPROBE_SCORE_EXTENSION + 1; // 1 more than .mpg
+ return 0;
+}
+
+FF_DEF_RAWVIDEO_DEMUXER(lcevc, "raw LCEVC video", lcevc_probe, "lcevc", AV_CODEC_ID_LCEVC)