Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove fuzz #381

Merged
merged 2 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ jellyfin-ffmpeg (6.0.1-6) unstable; urgency=medium

* Fix Noble builds and update dependencies
* Add RKMPP MJPEG/JPEG encoder
* Add VideoToolbox MJPEG encoder

-- nyanmisaka <[email protected]> Thu, 11 Apr 2024 20:31:19 +0800

Expand Down Expand Up @@ -297,7 +298,7 @@ jellyfin-ffmpeg (4.4.1-4) unstable; urgency=medium
* fix libass AR and blur issue (#119)

-- Joshua Boniface <[email protected]> Wed, 23 Mar 2022 01:02:21 -0500

jellyfin-ffmpeg (4.4.1-3) unstable; urgency=medium

* Allow configuration of used driver via ENV variable (#101)
Expand Down
71 changes: 28 additions & 43 deletions debian/patches/0072-add-mjpeg-videotoolbox.patch
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
Subject: [PATCH] lavc/videotoolboxenc: add MJPEG support
---
Index: configure
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Index: FFmpeg/configure
===================================================================
diff --git a/configure b/configure
--- a/configure (revision b9297128f5f66bb9e6d2e755e4b82818bc1ada32)
+++ b/configure (revision 8fd379cbb6043da3095c2a37b8c148c1ed6e8070)
@@ -3474,6 +3474,8 @@
--- FFmpeg.orig/configure
+++ FFmpeg/configure
@@ -3347,6 +3347,8 @@ hevc_videotoolbox_encoder_deps="pthreads
hevc_videotoolbox_encoder_select="atsc_a53 videotoolbox_encoder"
prores_videotoolbox_encoder_deps="pthreads"
prores_videotoolbox_encoder_select="videotoolbox_encoder"
Expand All @@ -17,55 +13,43 @@ diff --git a/configure b/configure
libaom_av1_decoder_deps="libaom"
libaom_av1_encoder_deps="libaom"
libaom_av1_encoder_select="extract_extradata_bsf"
Index: libavcodec/Makefile
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Index: FFmpeg/libavcodec/Makefile
===================================================================
diff --git a/libavcodec/Makefile b/libavcodec/Makefile
--- a/libavcodec/Makefile (revision b9297128f5f66bb9e6d2e755e4b82818bc1ada32)
+++ b/libavcodec/Makefile (revision 8fd379cbb6043da3095c2a37b8c148c1ed6e8070)
@@ -503,6 +503,7 @@
OBJS-$(CONFIG_MJPEG_CUVID_DECODER) += cuviddec.o
--- FFmpeg.orig/libavcodec/Makefile
+++ FFmpeg/libavcodec/Makefile
@@ -504,6 +504,7 @@ OBJS-$(CONFIG_MJPEG_CUVID_DECODER) +
OBJS-$(CONFIG_MJPEG_QSV_ENCODER) += qsvenc_jpeg.o
OBJS-$(CONFIG_MJPEG_RKMPP_ENCODER) += rkmppenc.o
OBJS-$(CONFIG_MJPEG_VAAPI_ENCODER) += vaapi_encode_mjpeg.o
+OBJS-$(CONFIG_MJPEG_VIDEOTOOLBOX_ENCODER) += videotoolboxenc.o
OBJS-$(CONFIG_MLP_DECODER) += mlpdec.o mlpdsp.o
OBJS-$(CONFIG_MLP_ENCODER) += mlpenc.o mlp.o
OBJS-$(CONFIG_MMVIDEO_DECODER) += mmvideo.o
Index: libavcodec/allcodecs.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Index: FFmpeg/libavcodec/allcodecs.c
===================================================================
diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c
--- a/libavcodec/allcodecs.c (revision b9297128f5f66bb9e6d2e755e4b82818bc1ada32)
+++ b/libavcodec/allcodecs.c (revision 8fd379cbb6043da3095c2a37b8c148c1ed6e8070)
@@ -879,6 +879,7 @@
--- FFmpeg.orig/libavcodec/allcodecs.c
+++ FFmpeg/libavcodec/allcodecs.c
@@ -883,6 +883,7 @@ extern const FFCodec ff_mpeg4_mediacodec
extern const FFCodec ff_mpeg4_omx_encoder;
extern const FFCodec ff_mpeg4_v4l2m2m_encoder;
extern const FFCodec ff_prores_videotoolbox_encoder;
+extern const FFCodec ff_mjpeg_videotoolbox_encoder;
extern const FFCodec ff_vc1_cuvid_decoder;
extern const FFCodec ff_vp8_cuvid_decoder;
extern const FFCodec ff_vp8_mediacodec_decoder;
Index: libavcodec/videotoolboxenc.c
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
Index: FFmpeg/libavcodec/videotoolboxenc.c
===================================================================
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
--- a/libavcodec/videotoolboxenc.c (revision b9297128f5f66bb9e6d2e755e4b82818bc1ada32)
+++ b/libavcodec/videotoolboxenc.c (revision 8fd379cbb6043da3095c2a37b8c148c1ed6e8070)
@@ -547,6 +547,7 @@
--- FFmpeg.orig/libavcodec/videotoolboxenc.c
+++ FFmpeg/libavcodec/videotoolboxenc.c
@@ -547,6 +547,7 @@ static CMVideoCodecType get_cm_codec_typ
else
return MKBETAG('a','p','c','n'); // kCMVideoCodecType_AppleProRes422
}
+ case AV_CODEC_ID_MJPEG: return kCMVideoCodecType_JPEG;
default: return 0;
}
}
@@ -1233,7 +1234,7 @@
@@ -1233,7 +1234,7 @@ static int vtenc_create_encoder(AVCodecC
kVTCompressionPropertyKey_Quality,
quality_num);
CFRelease(quality_num);
Expand All @@ -74,28 +58,28 @@ diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
bit_rate_num = CFNumberCreate(kCFAllocatorDefault,
kCFNumberSInt32Type,
&bit_rate);
@@ -1347,7 +1348,7 @@
@@ -1347,7 +1348,7 @@ static int vtenc_create_encoder(AVCodecC
}
}

- if (avctx->gop_size > 0 && avctx->codec_id != AV_CODEC_ID_PRORES) {
+ if (avctx->gop_size > 0 && avctx->codec_id != AV_CODEC_ID_PRORES && avctx->codec_id != AV_CODEC_ID_MJPEG) {
CFNumberRef interval = CFNumberCreate(kCFAllocatorDefault,
kCFNumberIntType,
&avctx->gop_size);
@@ -1496,7 +1497,7 @@
@@ -1496,7 +1497,7 @@ static int vtenc_create_encoder(AVCodecC
}
}

- if (!vtctx->has_b_frames && avctx->codec_id != AV_CODEC_ID_PRORES) {
+ if (!vtctx->has_b_frames && avctx->codec_id != AV_CODEC_ID_PRORES && avctx->codec_id != AV_CODEC_ID_MJPEG) {
status = VTSessionSetProperty(vtctx->session,
kVTCompressionPropertyKey_AllowFrameReordering,
kCFBooleanFalse);
@@ -2844,6 +2845,13 @@
@@ -2844,6 +2845,13 @@ static const enum AVPixelFormat prores_p
AV_PIX_FMT_NONE
};

+static const enum AVPixelFormat mjpeg_pix_fmts[] = {
+ AV_PIX_FMT_VIDEOTOOLBOX,
+ AV_PIX_FMT_NV12,
Expand All @@ -106,10 +90,11 @@ diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
#define COMMON_OPTIONS \
{ "allow_sw", "Allow software encoding", OFFSET(allow_sw), AV_OPT_TYPE_BOOL, \
@@ -3004,3 +3012,28 @@
@@ -3003,4 +3011,29 @@ const FFCodec ff_prores_videotoolbox_enc
.caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
.p.wrapper_name = "videotoolbox",
.hw_configs = vt_encode_hw_configs,
};
+};
+
+static const AVClass mjpeg_videotoolbox_class = {
+ .class_name = "mjpeg_videotoolbox",
Expand All @@ -134,4 +119,4 @@ diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
+ .caps_internal = FF_CODEC_CAP_INIT_CLEANUP,
+ .p.wrapper_name = "videotoolbox",
+ .hw_configs = vt_encode_hw_configs,
+};
};