diff --git a/debian/patches/0078-add-detection-of-atmos-in-eac3.patch b/debian/patches/0078-add-detection-of-atmos-in-eac3.patch new file mode 100644 index 00000000000..8b104381711 --- /dev/null +++ b/debian/patches/0078-add-detection-of-atmos-in-eac3.patch @@ -0,0 +1,119 @@ +Index: jellyfin-ffmpeg/libavcodec/ac3dec.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/ac3dec.c ++++ jellyfin-ffmpeg/libavcodec/ac3dec.c +@@ -1714,6 +1714,7 @@ skip: + if (!err) { + avctx->sample_rate = s->sample_rate; + avctx->bit_rate = s->bit_rate + s->prev_bit_rate; ++ avctx->profile = s->eac3_extension_type_a == 1 ? FF_PROFILE_EAC3_DDP_ATMOS : FF_PROFILE_UNKNOWN; + } + + if (!avctx->sample_rate) { +Index: jellyfin-ffmpeg/libavcodec/ac3dec.h +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/ac3dec.h ++++ jellyfin-ffmpeg/libavcodec/ac3dec.h +@@ -102,6 +102,7 @@ typedef struct AC3DecodeContext { + int eac3; ///< indicates if current frame is E-AC-3 + int eac3_frame_dependent_found; ///< bitstream has E-AC-3 dependent frame(s) + int eac3_subsbtreamid_found; ///< bitstream has E-AC-3 additional substream(s) ++ int eac3_extension_type_a; ///< bitstream has E-AC-3 extension type A enabled frame(s) + int dolby_surround_mode; ///< dolby surround mode (dsurmod) + int dolby_surround_ex_mode; ///< dolby surround ex mode (dsurexmod) + int dolby_headphone_mode; ///< dolby headphone mode (dheadphonmod) +Index: jellyfin-ffmpeg/libavcodec/ac3dec_float.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/ac3dec_float.c ++++ jellyfin-ffmpeg/libavcodec/ac3dec_float.c +@@ -33,6 +33,7 @@ + + #include "ac3dec.h" + #include "codec_internal.h" ++#include "profiles.h" + #include "eac3dec.c" + #include "ac3dec.c" + +@@ -92,6 +93,7 @@ const FFCodec ff_eac3_decoder = { + .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, + AV_SAMPLE_FMT_NONE }, + .p.priv_class = &ac3_eac3_decoder_class, ++ .p.profiles = NULL_IF_CONFIG_SMALL(ff_eac3_profiles), + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, + }; + #endif +Index: jellyfin-ffmpeg/libavcodec/avcodec.h +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/avcodec.h ++++ jellyfin-ffmpeg/libavcodec/avcodec.h +@@ -1593,6 +1593,8 @@ typedef struct AVCodecContext { + #define FF_PROFILE_DTS_HD_MA_X 61 + #define FF_PROFILE_DTS_HD_MA_X_IMAX 62 + ++#define FF_PROFILE_EAC3_DDP_ATMOS 30 ++ + #define FF_PROFILE_MPEG2_422 0 + #define FF_PROFILE_MPEG2_HIGH 1 + #define FF_PROFILE_MPEG2_SS 2 +Index: jellyfin-ffmpeg/libavcodec/codec_desc.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/codec_desc.c ++++ jellyfin-ffmpeg/libavcodec/codec_desc.c +@@ -2931,6 +2931,7 @@ static const AVCodecDescriptor codec_des + .name = "eac3", + .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52B (AC-3, E-AC-3)"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, ++ .profiles = NULL_IF_CONFIG_SMALL(ff_eac3_profiles), + }, + { + .id = AV_CODEC_ID_SIPR, +Index: jellyfin-ffmpeg/libavcodec/eac3dec.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/eac3dec.c ++++ jellyfin-ffmpeg/libavcodec/eac3dec.c +@@ -464,7 +464,16 @@ static int ff_eac3_parse_header(AC3Decod + if (get_bits1(gbc)) { + int addbsil = get_bits(gbc, 6); + for (i = 0; i < addbsil + 1; i++) { +- skip_bits(gbc, 8); // skip additional bit stream info ++ if (i == 0) { ++ /* In this 8 bit chunk, the LSB is equal to flag_ec3_extension_type_a ++ which can be used to detect Atmos presence */ ++ skip_bits(gbc, 7); ++ if (get_bits1(gbc)) { ++ s->eac3_extension_type_a = 1; ++ } ++ } else { ++ skip_bits(gbc, 8); // skip additional bit stream info ++ } + } + } + +Index: jellyfin-ffmpeg/libavcodec/profiles.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/profiles.c ++++ jellyfin-ffmpeg/libavcodec/profiles.c +@@ -47,6 +47,11 @@ const AVProfile ff_dca_profiles[] = { + { FF_PROFILE_UNKNOWN }, + }; + ++const AVProfile ff_eac3_profiles[] = { ++ { FF_PROFILE_EAC3_DDP_ATMOS, "Dolby Digital Plus + Dolby Atmos"}, ++ { FF_PROFILE_UNKNOWN }, ++}; ++ + const AVProfile ff_dnxhd_profiles[] = { + { FF_PROFILE_DNXHD, "DNXHD"}, + { FF_PROFILE_DNXHR_LB, "DNXHR LB"}, +Index: jellyfin-ffmpeg/libavcodec/profiles.h +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/profiles.h ++++ jellyfin-ffmpeg/libavcodec/profiles.h +@@ -58,6 +58,7 @@ + + extern const AVProfile ff_aac_profiles[]; + extern const AVProfile ff_dca_profiles[]; ++extern const AVProfile ff_eac3_profiles[]; + extern const AVProfile ff_dnxhd_profiles[]; + extern const AVProfile ff_h264_profiles[]; + extern const AVProfile ff_hevc_profiles[]; diff --git a/debian/patches/0079-add-detection-of-atmos-in-truehd.patch b/debian/patches/0079-add-detection-of-atmos-in-truehd.patch new file mode 100644 index 00000000000..9a5ed445b3d --- /dev/null +++ b/debian/patches/0079-add-detection-of-atmos-in-truehd.patch @@ -0,0 +1,87 @@ +Index: jellyfin-ffmpeg/libavcodec/avcodec.h +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/avcodec.h ++++ jellyfin-ffmpeg/libavcodec/avcodec.h +@@ -1595,6 +1595,8 @@ typedef struct AVCodecContext { + + #define FF_PROFILE_EAC3_DDP_ATMOS 30 + ++#define FF_PROFILE_TRUEHD_ATMOS 30 ++ + #define FF_PROFILE_MPEG2_422 0 + #define FF_PROFILE_MPEG2_HIGH 1 + #define FF_PROFILE_MPEG2_SS 2 +Index: jellyfin-ffmpeg/libavcodec/codec_desc.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/codec_desc.c ++++ jellyfin-ffmpeg/libavcodec/codec_desc.c +@@ -2960,6 +2960,7 @@ static const AVCodecDescriptor codec_des + .name = "truehd", + .long_name = NULL_IF_CONFIG_SMALL("TrueHD"), + .props = AV_CODEC_PROP_LOSSLESS, ++ .profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles), + }, + { + .id = AV_CODEC_ID_MP4ALS, +Index: jellyfin-ffmpeg/libavcodec/mlpdec.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/mlpdec.c ++++ jellyfin-ffmpeg/libavcodec/mlpdec.c +@@ -42,6 +42,7 @@ + #include "mlpdsp.h" + #include "mlp.h" + #include "config.h" ++#include "profiles.h" + + /** number of bits used for VLC lookup - longest Huffman code is 9 */ + #if ARCH_ARM +@@ -392,6 +393,14 @@ static int read_major_sync(MLPDecodeCont + m->num_substreams = mh.num_substreams; + m->substream_info = mh.substream_info; + ++ /* If there is a 4th substream and the MSB of substream_info is set, ++ * there is a 16-channel spatial presentation (Atmos in TrueHD). ++ */ ++ if (m->avctx->codec_id == AV_CODEC_ID_TRUEHD ++ && m->num_substreams == 4 && m->substream_info >> 7 == 1) { ++ m->avctx->profile = FF_PROFILE_TRUEHD_ATMOS; ++ } ++ + /* limit to decoding 3 substreams, as the 4th is used by Dolby Atmos for non-audio data */ + m->max_decoded_substream = FFMIN(m->num_substreams - 1, 2); + +@@ -1452,5 +1461,6 @@ const FFCodec ff_truehd_decoder = { + FF_CODEC_DECODE_CB(read_access_unit), + .flush = mlp_decode_flush, + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, ++ .p.profiles = NULL_IF_CONFIG_SMALL(ff_truehd_profiles), + }; + #endif /* CONFIG_TRUEHD_DECODER */ +Index: jellyfin-ffmpeg/libavcodec/profiles.c +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/profiles.c ++++ jellyfin-ffmpeg/libavcodec/profiles.c +@@ -52,6 +52,11 @@ const AVProfile ff_eac3_profiles[] = { + { FF_PROFILE_UNKNOWN }, + }; + ++const AVProfile ff_truehd_profiles[] = { ++ { FF_PROFILE_TRUEHD_ATMOS, "Dolby TrueHD + Dolby Atmos"}, ++ { FF_PROFILE_UNKNOWN }, ++}; ++ + const AVProfile ff_dnxhd_profiles[] = { + { FF_PROFILE_DNXHD, "DNXHD"}, + { FF_PROFILE_DNXHR_LB, "DNXHR LB"}, +Index: jellyfin-ffmpeg/libavcodec/profiles.h +=================================================================== +--- jellyfin-ffmpeg.orig/libavcodec/profiles.h ++++ jellyfin-ffmpeg/libavcodec/profiles.h +@@ -59,6 +59,7 @@ + extern const AVProfile ff_aac_profiles[]; + extern const AVProfile ff_dca_profiles[]; + extern const AVProfile ff_eac3_profiles[]; ++extern const AVProfile ff_truehd_profiles[]; + extern const AVProfile ff_dnxhd_profiles[]; + extern const AVProfile ff_h264_profiles[]; + extern const AVProfile ff_hevc_profiles[]; diff --git a/debian/patches/series b/debian/patches/series index 8d9a0d69c2f..89f73782901 100644 --- a/debian/patches/series +++ b/debian/patches/series @@ -75,3 +75,5 @@ 0075-fix-gcc-14-warnings-in-qsv-hwcontext.patch 0076-vt-low-priority-keyframe-decoding.patch 0077-add-detection-of-dtsx.patch +0078-add-detection-of-atmos-in-eac3.patch +0079-add-detection-of-atmos-in-truehd.patch