aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/svq1enc.c
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2022-11-01 09:24:29 +1100
committerPeter Ross <pross@xvid.org>2022-11-01 09:24:29 +1100
commitb0c1f248d9dd5b21d9c11e4e28b8862548d64cbd (patch)
tree647a5ff8f9ad61ff65a9bf3b32d520d3fcbeb70c /libavcodec/svq1enc.c
parente1dd4a27ca275fd44c3700e2adf8d76903c17678 (diff)
downloadffmpeg-b0c1f248d9dd5b21d9c11e4e28b8862548d64cbd.tar.gz
avcodec/svq1enc: output ident string in extradata field
This will enable the acurate identification of FFmpeg produced SVQ1 streams, should there be new bugs found in the encoder.
Diffstat (limited to 'libavcodec/svq1enc.c')
-rw-r--r--libavcodec/svq1enc.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/libavcodec/svq1enc.c b/libavcodec/svq1enc.c
index b275b333dc..8f09e634a5 100644
--- a/libavcodec/svq1enc.c
+++ b/libavcodec/svq1enc.c
@@ -41,6 +41,7 @@
#include "svq1.h"
#include "svq1encdsp.h"
#include "svq1enc_cb.h"
+#include "version.h"
#include "libavutil/avassert.h"
#include "libavutil/frame.h"
@@ -572,6 +573,19 @@ static av_cold int svq1_encode_end(AVCodecContext *avctx)
return 0;
}
+static av_cold int write_ident(AVCodecContext *avctx, const char *ident)
+{
+ int size = strlen(ident);
+ avctx->extradata = av_malloc(size + 8);
+ if (!avctx->extradata)
+ return AVERROR(ENOMEM);
+ AV_WB32(avctx->extradata, size + 8);
+ AV_WL32(avctx->extradata + 4, MKTAG('S', 'V', 'Q', '1'));
+ memcpy(avctx->extradata + 8, ident, size);
+ avctx->extradata_size = size + 8;
+ return 0;
+}
+
static av_cold int svq1_encode_init(AVCodecContext *avctx)
{
SVQ1EncContext *const s = avctx->priv_data;
@@ -632,7 +646,7 @@ static av_cold int svq1_encode_init(AVCodecContext *avctx)
ff_h263_encode_init(&s->m); // mv_penalty
- return 0;
+ return write_ident(avctx, s->avctx->flags & AV_CODEC_FLAG_BITEXACT ? "Lavc" : LIBAVCODEC_IDENT);
}
static int svq1_encode_frame(AVCodecContext *avctx, AVPacket *pkt,