From db0f076e8f724deee604af7a1a85c1d130f1f87d Mon Sep 17 00:00:00 2001
From: stephen-e <33672591+reticulatedpines@users.noreply.github.com>
Date: Mon, 21 Oct 2024 16:35:49 +0100
Subject: [PATCH 2/2] avformat/mlvdec: add LJ92 support
MLV files can contain LJ92 compressed raw video data.
MJPEG codec can be used to handle these.
---
libavformat/mlvdec.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
@@ -44,8 +44,9 @@
#define MLV_AUDIO_CLASS_WAV 1
-#define MLV_CLASS_FLAG_DELTA 0x40
#define MLV_CLASS_FLAG_LZMA 0x80
+#define MLV_CLASS_FLAG_DELTA 0x40
+#define MLV_CLASS_FLAG_LJ92 0x20
typedef struct {
AVIOContext *pb[101];
@@ -298,9 +299,12 @@ static int read_header(AVFormatContext *avctx)
if ((mlv->class[0] & (MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)))
avpriv_request_sample(avctx, "compression");
vst->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
- switch (mlv->class[0] & ~(MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA)) {
+ switch (mlv->class[0] & ~(MLV_CLASS_FLAG_DELTA|MLV_CLASS_FLAG_LZMA|MLV_CLASS_FLAG_LJ92)) {
case MLV_VIDEO_CLASS_RAW:
- vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
+ if (mlv->class[0] & MLV_CLASS_FLAG_LJ92)
+ vst->codecpar->codec_id = AV_CODEC_ID_MJPEG;
+ else
+ vst->codecpar->codec_id = AV_CODEC_ID_RAWVIDEO;
break;
case MLV_VIDEO_CLASS_YUV:
vst->codecpar->format = AV_PIX_FMT_YUV420P;
--
2.45.2