Version in base suite: 140.8.0esr-1~deb13u1 Version in overlay suite: 140.10.0esr-1~deb13u1 Base version: thunderbird_140.10.0esr-1~deb13u1 Target version: thunderbird_140.10.1esr-1~deb13u1 Base file: /srv/ftp-master.debian.org/ftp/pool/main/t/thunderbird/thunderbird_140.10.0esr-1~deb13u1.dsc Target file: /srv/ftp-master.debian.org/policy/pool/main/t/thunderbird/thunderbird_140.10.1esr-1~deb13u1.dsc /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-44.1k-1ch.wav |binary /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-44.1k-2ch.wav |binary /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-48k-1ch.wav |binary /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-48k-2ch.wav |binary thunderbird-140.10.1esr/accessible/base/CachedTableAccessible.cpp | 8 thunderbird-140.10.1esr/accessible/ipc/DocAccessibleParent.cpp | 2 thunderbird-140.10.1esr/browser/config/version.txt | 2 thunderbird-140.10.1esr/browser/config/version_display.txt | 2 thunderbird-140.10.1esr/comm/.gecko_rev.yml | 4 thunderbird-140.10.1esr/comm/mail/branding/nightly/content/inAppNotificationData.json | 48 thunderbird-140.10.1esr/comm/mail/branding/tb_beta/content/inAppNotificationData.json | 48 thunderbird-140.10.1esr/comm/mail/branding/thunderbird/content/inAppNotificationData.json | 48 thunderbird-140.10.1esr/comm/mail/config/version.txt | 2 thunderbird-140.10.1esr/comm/mail/config/version_display.txt | 2 thunderbird-140.10.1esr/config/milestone.txt | 2 thunderbird-140.10.1esr/debian/changelog | 21 thunderbird-140.10.1esr/dom/canvas/WebGLContext.cpp | 4 thunderbird-140.10.1esr/dom/file/FileReader.cpp | 9 thunderbird-140.10.1esr/dom/ipc/ReferrerInfoUtils.cpp | 30 thunderbird-140.10.1esr/dom/media/AudioChannelFormat.h | 12 thunderbird-140.10.1esr/dom/media/AudioSegment.cpp | 13 thunderbird-140.10.1esr/dom/media/AudioSegment.h | 25 thunderbird-140.10.1esr/dom/media/MediaData.cpp | 10 thunderbird-140.10.1esr/dom/media/mp3/MP3Demuxer.cpp | 11 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegDataEncoder.cpp | 4 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp | 139 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp | 9 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp | 41 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoEncoder.cpp | 8 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/COPYING.LGPLv2.1 | 504 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avcodec.h | 2995 ++++++++++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avdct.h | 88 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/bsf.h | 332 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec.h | 367 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_desc.h | 142 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_id.h | 693 ++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_par.h | 253 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/defs.h | 362 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/packet.h | 943 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/vdpau.h | 138 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version.h | 45 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version_major.h | 63 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/attributes.h | 227 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avconfig.h | 6 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avutil.h | 364 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/buffer.h | 322 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/channel_layout.h | 762 ++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/common.h | 589 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/cpu.h | 159 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/dict.h | 242 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/error.h | 129 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/frame.h | 1183 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext.h | 601 ++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_drm.h | 169 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vaapi.h | 117 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vulkan.h | 404 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/intfloat.h | 77 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/log.h | 427 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/macros.h | 80 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mathematics.h | 300 + thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mem.h | 607 ++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/pixfmt.h | 817 ++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/rational.h | 225 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/samplefmt.h | 268 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/version.h | 123 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/moz.build | 53 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffvpx/moz.build | 2 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/moz.build | 1 thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.cpp | 10 thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.h | 5 thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCRtpScriptTransformer.cpp | 5 thunderbird-140.10.1esr/dom/media/webrtc/transport/nricectx.cpp | 10 thunderbird-140.10.1esr/dom/media/webrtc/transport/nricemediastream.cpp | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/test/test_nr_socket_ice_unittest.cpp | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate.c | 20 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate_pair.c | 12 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c | 10 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c | 56 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_media_stream.c | 38 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_parser.c | 22 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_peer_ctx.c | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_socket.c | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_interface_prioritizer.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_resolver.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket.c | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_multi_tcp.c | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_wrapper.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/transport_addr_reg.c | 6 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c | 6 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c | 10 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_turn.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_build.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_client_ctx.c | 10 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_msg.c | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_proc.c | 10 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_server_ctx.c | 16 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/turn_client_ctx.c | 44 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/util/ice_util.c | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp | 1 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/c2ru.c | 24 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c | 12 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h | 2 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c | 22 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registrycb.c | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_assoc.c | 24 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_data.c | 18 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_list.c | 4 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_memory.h | 49 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/p_buf.c | 8 thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c | 2 thunderbird-140.10.1esr/dom/security/ReferrerInfo.cpp | 59 thunderbird-140.10.1esr/dom/security/ReferrerInfo.h | 9 thunderbird-140.10.1esr/dom/security/trusted-types/TrustedTypeUtils.cpp | 1 thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerOp.cpp | 18 thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerPrivate.cpp | 2 thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp | 4 thunderbird-140.10.1esr/dom/workers/loader/CacheLoadHandler.cpp | 18 thunderbird-140.10.1esr/gfx/2d/Swizzle.cpp | 2 thunderbird-140.10.1esr/gfx/angle/checkout/src/compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.cpp | 4 thunderbird-140.10.1esr/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp | 18 thunderbird-140.10.1esr/gfx/layers/BufferTexture.cpp | 94 thunderbird-140.10.1esr/gfx/layers/BufferTexture.h | 4 thunderbird-140.10.1esr/gfx/layers/ipc/ImageBridgeParent.cpp | 6 thunderbird-140.10.1esr/gfx/thebes/gfxFont.cpp | 46 thunderbird-140.10.1esr/gfx/thebes/gfxFontEntry.cpp | 11 thunderbird-140.10.1esr/gfx/thebes/gfxPlatform.cpp | 4 thunderbird-140.10.1esr/gfx/webrender_bindings/RenderThread.cpp | 3 thunderbird-140.10.1esr/intl/icu-patches/bug-2029806-surrogates.diff | 32 thunderbird-140.10.1esr/intl/icu/source/common/ustrcase.cpp | 16 thunderbird-140.10.1esr/js/public/friend/CycleCollector.h | 25 thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.cpp | 32 thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.h | 3 thunderbird-140.10.1esr/js/src/gc/GCRuntime.h | 4 thunderbird-140.10.1esr/js/src/jit/MacroAssembler.cpp | 1 thunderbird-140.10.1esr/js/src/moz.build | 1 thunderbird-140.10.1esr/layout/generic/nsInlineFrame.cpp | 9 thunderbird-140.10.1esr/media/ffvpx/COPYING.LGPLv2.1 | 18 thunderbird-140.10.1esr/media/ffvpx/README_MOZILLA | 4 thunderbird-140.10.1esr/media/ffvpx/bug1603271-videodsp-pointer-overflow.patch | 12 thunderbird-140.10.1esr/media/ffvpx/changes.patch | 103 thunderbird-140.10.1esr/media/ffvpx/compat/w32pthreads.h | 47 thunderbird-140.10.1esr/media/ffvpx/config.h | 14 thunderbird-140.10.1esr/media/ffvpx/config_android32.h | 28 thunderbird-140.10.1esr/media/ffvpx/config_android64.h | 23 thunderbird-140.10.1esr/media/ffvpx/config_android_x86_64.h | 11 thunderbird-140.10.1esr/media/ffvpx/config_components.h | 2 thunderbird-140.10.1esr/media/ffvpx/config_components_audio_only.h | 6 thunderbird-140.10.1esr/media/ffvpx/config_components_audio_video.h | 11 thunderbird-140.10.1esr/media/ffvpx/config_override.h | 64 thunderbird-140.10.1esr/media/ffvpx/flac-alloc-failure.patch | 37 thunderbird-140.10.1esr/media/ffvpx/libaomenc-svc.patch | 10 thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264dsp_init_aarch64.c | 76 thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_init.c | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_neon.S | 13 thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/hpeldsp_neon.S | 58 thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.c | 83 thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.h | 79 thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.c | 77 thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.h | 37 thunderbird-140.10.1esr/media/ffvpx/libavcodec/allcodecs.c | 58 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264chroma_init_arm.c | 57 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264dsp_init_arm.c | 120 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264pred_init_arm.c | 95 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_arm.h | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_arm.c | 71 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_armv6.c | 67 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_neon.c | 88 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/mathops.h | 22 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/startcode.h | 26 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_arm.h | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_arm.c | 30 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_armv5te.c | 33 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8.h | 36 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp.h | 80 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_arm.c | 44 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_armv6.c | 123 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_neon.c | 119 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init.h | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_10bpp_arm.c | 23 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_12bpp_arm.c | 23 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c | 258 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_arm.c | 259 thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vpx_arith.h | 121 thunderbird-140.10.1esr/media/ffvpx/libavcodec/audio_frame_queue.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1_parser.c | 26 thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1dec.c | 184 thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.c | 189 thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.h | 262 thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.symbols | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec_internal.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/avdct.c | 9 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bit_depth_template.c | 7 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bitstream_filters.c | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/blockdsp.h | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/aac_adtstoasc.c | 156 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/moz.build | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf_list.c | 3 thunderbird-140.10.1esr/media/ffvpx/libavcodec/bytestream.h | 20 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.c | 198 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.h | 56 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.c | 197 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.h | 19 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1_syntax_template.c | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_internal.h | 92 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.c | 616 ++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.h | 221 thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9_syntax_template.c | 484 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec.h | 15 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.c | 120 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_id.h | 16 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_internal.h | 81 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_list.c | 33 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.c | 3 thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.h | 7 thunderbird-140.10.1esr/media/ffvpx/libavcodec/dct.h | 12 thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.c | 543 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.h | 42 thunderbird-140.10.1esr/media/ffvpx/libavcodec/defs.h | 25 thunderbird-140.10.1esr/media/ffvpx/libavcodec/dovi_rpu.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2.c | 3 thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_av1.c | 3 thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_vp9.c | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.c | 153 thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.h | 24 thunderbird-140.10.1esr/media/ffvpx/libavcodec/error_resilience.h | 11 thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.c | 124 thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.h | 67 thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.c | 413 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.h | 146 thunderbird-140.10.1esr/media/ffvpx/libavcodec/flac_parse.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdec.c | 17 thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.c | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.h | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/get_bits.h | 127 thunderbird-140.10.1esr/media/ffvpx/libavcodec/golomb.h | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264dsp.h | 114 thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred_template.c | 39 thunderbird-140.10.1esr/media/ffvpx/libavcodec/hpeldsp.h | 28 thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccel_internal.h | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccels.h | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.c | 11 thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/imgconvert.c | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/internal.h | 9 thunderbird-140.10.1esr/media/ffvpx/libavcodec/itut35.h | 19 thunderbird-140.10.1esr/media/ffvpx/libavcodec/jrevdct.c | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/lcevcdec.h | 54 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libaomenc.c | 231 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libdav1d.c | 253 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusdec.c | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusenc.c | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisdec.c | 43 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisenc.c | 85 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxdec.c | 58 thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxenc.c | 175 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathops.h | 34 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathtables.c | 45 thunderbird-140.10.1esr/media/ffvpx/libavcodec/me_cmp.h | 12 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.c | 148 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.h | 103 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.c | 78 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.h | 36 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.c | 339 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.h | 62 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.c | 2724 +++++++++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.h | 456 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec.c | 745 ++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.c | 1153 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.h | 110 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecenc.c | 1514 +++++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/motion_est.h | 40 thunderbird-140.10.1esr/media/ffvpx/libavcodec/moz.build | 25 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.c | 179 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.h | 121 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_copy_pce.h | 69 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.c | 23 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.h | 34 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_fixed.c | 19 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_template.c | 43 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodsp_template.c | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegutils.h | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideo.h | 330 - thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideoencdsp.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/options.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/options_table.h | 22 thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet.c | 85 thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet.h | 68 thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet_internal.h | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser.c | 34 thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser_internal.h | 83 thunderbird-140.10.1esr/media/ffvpx/libavcodec/parsers.c | 154 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm.c | 314 - thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm_tablegen.h | 23 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixblockdsp.h | 24 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixels.h | 37 thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.c | 17 thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/progressframe.h | 10 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread.c | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_frame.c | 35 thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_slice.c | 29 thunderbird-140.10.1esr/media/ffvpx/libavcodec/put_bits.h | 45 thunderbird-140.10.1esr/media/ffvpx/libavcodec/ratecontrol.h | 25 thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.c | 287 thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw_pix_fmt_tags.h | 316 + thunderbird-140.10.1esr/media/ffvpx/libavcodec/rectangle.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/rl.h | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.c | 37 thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct_template.c | 40 thunderbird-140.10.1esr/media/ffvpx/libavcodec/utils.c | 115 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_av1.c | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp8.c | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp9.c | 1 thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.c | 10 thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.h | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/version_major.h | 32 thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.c | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp_template.c | 18 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.c | 14 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.h | 22 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vorbis_parser.c | 11 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp3dsp.h | 14 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56.h | 9 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56dsp.h | 18 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8.c | 145 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp89_rac.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8_parser.c | 7 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8dsp.c | 31 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9.c | 106 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9_parser.c | 12 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dec.h | 10 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9shared.h | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.c | 7 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.h | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdct.c | 4 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdctdsp_init.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/flacdsp_init.c | 18 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred.asm | 44 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred_init.c | 9 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp.h | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp_init.c | 22 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.asm | 1244 ++-- thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.h | 5 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/videodsp_init.c | 19 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp.asm | 556 - thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_init.c | 64 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm | 39 thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c | 6 thunderbird-140.10.1esr/media/ffvpx/libavcodec/xvididct.h | 9 thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/asm.S | 103 thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.c | 85 thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.h | 16 thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/tx_float_neon.S | 42 thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/cpu.c | 40 thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/timer.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes.h | 70 thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes_internal.h | 11 thunderbird-140.10.1esr/media/ffvpx/libavutil/avassert.h | 51 thunderbird-140.10.1esr/media/ffvpx/libavutil/avconfig.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.c | 11 thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.h | 1 thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.symbols | 6 thunderbird-140.10.1esr/media/ffvpx/libavutil/bprint.c | 41 thunderbird-140.10.1esr/media/ffvpx/libavutil/bswap.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.c | 10 thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.h | 6 thunderbird-140.10.1esr/media/ffvpx/libavutil/common.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.c | 9 thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.h | 11 thunderbird-140.10.1esr/media/ffvpx/libavutil/csp.h | 18 thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.c | 38 thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.h | 3 thunderbird-140.10.1esr/media/ffvpx/libavutil/emms.h | 36 thunderbird-140.10.1esr/media/ffvpx/libavutil/error.c | 196 thunderbird-140.10.1esr/media/ffvpx/libavutil/eval.c | 120 thunderbird-140.10.1esr/media/ffvpx/libavutil/film_grain_params.h | 60 thunderbird-140.10.1esr/media/ffvpx/libavutil/fixed_dsp.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.c | 15 thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/float_scalarproduct.c | 32 thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.c | 396 - thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.h | 127 thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.c | 310 + thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.h | 104 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.c | 17 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.h | 5 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.c | 21 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.h | 14 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_internal.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.c | 121 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.h | 61 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.c | 81 thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/imgutils.c | 10 thunderbird-140.10.1esr/media/ffvpx/libavutil/internal.h | 16 thunderbird-140.10.1esr/media/ffvpx/libavutil/intmath.h | 12 thunderbird-140.10.1esr/media/ffvpx/libavutil/libm.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/lls.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/log.c | 60 thunderbird-140.10.1esr/media/ffvpx/libavutil/log.h | 15 thunderbird-140.10.1esr/media/ffvpx/libavutil/mathematics.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/mem_internal.h | 6 thunderbird-140.10.1esr/media/ffvpx/libavutil/moz.build | 15 thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.c | 42 thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.h | 8 thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.c | 337 + thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.h | 10 thunderbird-140.10.1esr/media/ffvpx/libavutil/pixelutils.c | 20 thunderbird-140.10.1esr/media/ffvpx/libavutil/pixfmt.h | 74 thunderbird-140.10.1esr/media/ffvpx/libavutil/random_seed.c | 45 thunderbird-140.10.1esr/media/ffvpx/libavutil/rational.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.h | 12 thunderbird-140.10.1esr/media/ffvpx/libavutil/samplefmt.h | 3 thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.c | 315 + thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.h | 30 thunderbird-140.10.1esr/media/ffvpx/libavutil/slicethread.c | 9 thunderbird-140.10.1esr/media/ffvpx/libavutil/stereo3d.c | 7 thunderbird-140.10.1esr/media/ffvpx/libavutil/thread.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode.c | 40 thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.c | 51 thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.h | 51 thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.c | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.h | 2 thunderbird-140.10.1esr/media/ffvpx/libavutil/tx_template.c | 14 thunderbird-140.10.1esr/media/ffvpx/libavutil/utils.c | 3 thunderbird-140.10.1esr/media/ffvpx/libavutil/version.h | 31 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/asm.h | 5 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.c | 7 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.h | 11 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/intmath.h | 66 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils.asm | 60 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils_init.c | 12 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float.asm | 8 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float_init.c | 18 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86inc.asm | 6 thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86util.asm | 12 thunderbird-140.10.1esr/media/ffvpx/libavutil_visibility.h | 1 thunderbird-140.10.1esr/media/ffvpx/mediacodec_drm.patch | 217 thunderbird-140.10.1esr/media/ffvpx/mediacodec_eos.patch | 25 thunderbird-140.10.1esr/media/ffvpx/mediacodec_force_key_frames.patch | 103 thunderbird-140.10.1esr/media/ffvpx/mediacodec_h264.patch | 104 thunderbird-140.10.1esr/media/ffvpx/mediacodec_low_latency.patch | 13 thunderbird-140.10.1esr/media/ffvpx/vp9-get-format-rollback.patch | 1 thunderbird-140.10.1esr/media/libcubeb/frame-sample.patch | 19 thunderbird-140.10.1esr/media/libcubeb/moz.yaml | 1 thunderbird-140.10.1esr/media/libcubeb/src/cubeb_resampler_internal.h | 8 thunderbird-140.10.1esr/media/libpng/ANNOUNCE | 27 thunderbird-140.10.1esr/media/libpng/CHANGES | 7 thunderbird-140.10.1esr/media/libpng/README | 2 thunderbird-140.10.1esr/media/libpng/libpng-manual.txt | 2 thunderbird-140.10.1esr/media/libpng/moz.yaml | 4 thunderbird-140.10.1esr/media/libpng/png.c | 4 thunderbird-140.10.1esr/media/libpng/png.h | 14 thunderbird-140.10.1esr/media/libpng/pngconf.h | 2 thunderbird-140.10.1esr/media/libpng/pngrtran.c | 20 thunderbird-140.10.1esr/modules/libpref/init/StaticPrefList.yaml | 5 thunderbird-140.10.1esr/netwerk/base/nsStandardURL.cpp | 50 thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.cpp | 18 thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.h | 5 thunderbird-140.10.1esr/netwerk/protocol/res/nsResProtocolHandler.cpp | 1 thunderbird-140.10.1esr/security/manager/tools/PreloadedHPKPins.json | 17 thunderbird-140.10.1esr/security/nss/TAG-INFO | 1 thunderbird-140.10.1esr/security/nss/doc/rst/releases/nss_3_112_5.rst | 36 thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/certdata.txt | 2457 +++++--- thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/nssckbi.h | 4 thunderbird-140.10.1esr/security/nss/lib/nss/nss.h | 4 thunderbird-140.10.1esr/security/nss/lib/softoken/softkver.h | 4 thunderbird-140.10.1esr/security/nss/lib/ssl/dtlscon.c | 14 thunderbird-140.10.1esr/security/nss/lib/ssl/ssl3con.c | 11 thunderbird-140.10.1esr/security/nss/lib/ssl/sslimpl.h | 2 thunderbird-140.10.1esr/security/nss/lib/util/nssutil.h | 4 thunderbird-140.10.1esr/security/nss/moz.yaml | 4 thunderbird-140.10.1esr/sourcestamp.txt | 6 thunderbird-140.10.1esr/testing/web-platform/mozilla/meta/dom/quota/test-partitioned-access-to-fs-in-iframes.https.window.js.ini | 3 thunderbird-140.10.1esr/thunderbird-l10n/af/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ar/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ast/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/be/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/bg/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/br/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ca/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/cak/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/cs/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/cy/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/da/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/de/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/dsb/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/el/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/en-CA/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/en-GB/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/es-AR/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/es-ES/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/es-MX/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/et/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/eu/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/fi/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/fr/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/fy-NL/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ga-IE/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/gd/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/gl/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/he/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/hr/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/hsb/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/hu/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/hy-AM/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/id/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/is/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/it/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ja/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ka/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/kab/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/kk/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ko/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/lt/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/lv/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ms/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/nb-NO/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/nl/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/nn-NO/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/pa-IN/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/pl/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/pt-BR/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/pt-PT/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/rm/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ro/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/ru/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/sk/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/sl/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/sq/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/sr/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/sv-SE/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/th/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/tr/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/uk/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/uz/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/vi/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/zh-CN/manifest.json | 4 thunderbird-140.10.1esr/thunderbird-l10n/zh-TW/manifest.json | 4 thunderbird-140.10.1esr/tools/rewriting/ThirdPartyPaths.txt | 1 thunderbird-140.10.1esr/xpcom/base/nsCycleCollector.cpp | 34 thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.cpp | 19 thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.h | 6 thunderbird-140.10.1esr/xpcom/io/nsICloneableInputStream.idl | 7 thunderbird-140.10.1esr/xpcom/tests/gtest/TestSlicedInputStream.cpp | 35 556 files changed, 38625 insertions(+), 6837 deletions(-) dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpp29lw7my/thunderbird_140.10.0esr-1~deb13u1.dsc: no acceptable signature found dpkg-source: warning: cannot verify inline signature for /srv/release.debian.org/tmp/tmpp29lw7my/thunderbird_140.10.1esr-1~deb13u1.dsc: no acceptable signature found diff -Nru thunderbird-140.10.0esr/accessible/base/CachedTableAccessible.cpp thunderbird-140.10.1esr/accessible/base/CachedTableAccessible.cpp --- thunderbird-140.10.0esr/accessible/base/CachedTableAccessible.cpp 2026-04-21 14:52:50.000000000 +0000 +++ thunderbird-140.10.1esr/accessible/base/CachedTableAccessible.cpp 2026-04-29 18:38:17.000000000 +0000 @@ -71,10 +71,14 @@ return; } - if (Accessible* table = nsAccUtils::TableFor(aAcc)) { + Accessible* table = nsAccUtils::TableFor(aAcc); + while (table && table->IsTable()) { // Destroy the instance (if any). We'll create a new one the next time it - // is requested. + // is requested. Climb up the heirarcy to invalidate parent tables as well. sCachedTables->Remove(table); + // The table may be a direct child of another table, invalidate that one as + // well. + table = table->Parent(); } } diff -Nru thunderbird-140.10.0esr/accessible/ipc/DocAccessibleParent.cpp thunderbird-140.10.1esr/accessible/ipc/DocAccessibleParent.cpp --- thunderbird-140.10.0esr/accessible/ipc/DocAccessibleParent.cpp 2026-04-21 14:52:50.000000000 +0000 +++ thunderbird-140.10.1esr/accessible/ipc/DocAccessibleParent.cpp 2026-04-29 18:38:18.000000000 +0000 @@ -1088,6 +1088,8 @@ RemoteAccessible* acc = iter.Get()->mProxy; MOZ_ASSERT(acc != this); if (acc->IsTable()) { + // Prevents the invalidation code from trying to walk up the tree. + acc->SetParent(nullptr); CachedTableAccessible::Invalidate(acc); } ProxyDestroyed(acc); diff -Nru thunderbird-140.10.0esr/browser/config/version.txt thunderbird-140.10.1esr/browser/config/version.txt --- thunderbird-140.10.0esr/browser/config/version.txt 2026-04-21 14:52:50.000000000 +0000 +++ thunderbird-140.10.1esr/browser/config/version.txt 2026-04-29 18:38:18.000000000 +0000 @@ -1 +1 @@ -140.10.0 +140.10.1 diff -Nru thunderbird-140.10.0esr/browser/config/version_display.txt thunderbird-140.10.1esr/browser/config/version_display.txt --- thunderbird-140.10.0esr/browser/config/version_display.txt 2026-04-21 14:52:50.000000000 +0000 +++ thunderbird-140.10.1esr/browser/config/version_display.txt 2026-04-29 18:38:18.000000000 +0000 @@ -1 +1 @@ -140.10.0esr +140.10.1esr diff -Nru thunderbird-140.10.0esr/comm/.gecko_rev.yml thunderbird-140.10.1esr/comm/.gecko_rev.yml --- thunderbird-140.10.0esr/comm/.gecko_rev.yml 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/.gecko_rev.yml 2026-04-29 18:38:49.000000000 +0000 @@ -1,8 +1,8 @@ --- GECKO_BASE_REPOSITORY: https://hg.mozilla.org/mozilla-unified GECKO_HEAD_REPOSITORY: https://hg.mozilla.org/releases/mozilla-esr140 -GECKO_HEAD_REF: FIREFOX_140_10_0esr_BUILD1 -GECKO_HEAD_REV: a1c8c4081ea0e227dbde64c95ec6942fa71edb28 +GECKO_HEAD_REF: FIREFOX_140_10_1esr_RELEASE +GECKO_HEAD_REV: a24e9e115e02794f72dab9ef6081244403b0183a ###### ### For comm-central diff -Nru thunderbird-140.10.0esr/comm/mail/branding/nightly/content/inAppNotificationData.json thunderbird-140.10.1esr/comm/mail/branding/nightly/content/inAppNotificationData.json --- thunderbird-140.10.0esr/comm/mail/branding/nightly/content/inAppNotificationData.json 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/mail/branding/nightly/content/inAppNotificationData.json 2026-04-29 18:38:49.000000000 +0000 @@ -1,11 +1,11 @@ [ { - "id": "PREBAKED-EoY25-1", - "start_at": "2025-11-03T00:00:00.000Z", - "end_at": "2025-11-30T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-1", + "id": "PREBAKED-Spring26", + "start_at": "2026-04-01T00:00:00.000Z", + "end_at": "2026-06-30T23:59:59.000Z", + "title": "Prebaked Appeal Spring26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-1", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-Spring26", "CTA": "", "severity": 3, "type": "donation_tab", @@ -14,12 +14,40 @@ } }, { - "id": "PREBAKED-EoY25-2", - "start_at": "2025-12-01T00:00:00.000Z", - "end_at": "2026-03-31T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-2", + "id": "PREBAKED-ESR26", + "start_at": "2026-07-01T00:00:00.000Z", + "end_at": "2026-11-02T23:59:59.000Z", + "title": "Prebaked Appeal ESR26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-2", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-ESR26", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-1", + "start_at": "2026-11-03T00:00:00.000Z", + "end_at": "2026-11-30T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-1", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-1", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-2", + "start_at": "2026-12-01T00:00:00.000Z", + "end_at": "2027-03-31T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-2", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-2", "CTA": "", "severity": 3, "type": "donation_tab", diff -Nru thunderbird-140.10.0esr/comm/mail/branding/tb_beta/content/inAppNotificationData.json thunderbird-140.10.1esr/comm/mail/branding/tb_beta/content/inAppNotificationData.json --- thunderbird-140.10.0esr/comm/mail/branding/tb_beta/content/inAppNotificationData.json 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/mail/branding/tb_beta/content/inAppNotificationData.json 2026-04-29 18:38:49.000000000 +0000 @@ -1,11 +1,11 @@ [ { - "id": "PREBAKED-EoY25-1", - "start_at": "2025-11-03T00:00:00.000Z", - "end_at": "2025-11-30T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-1", + "id": "PREBAKED-Spring26", + "start_at": "2026-04-01T00:00:00.000Z", + "end_at": "2026-06-30T23:59:59.000Z", + "title": "Prebaked Appeal Spring26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-1", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-Spring26", "CTA": "", "severity": 3, "type": "donation_tab", @@ -14,12 +14,40 @@ } }, { - "id": "PREBAKED-EoY25-2", - "start_at": "2025-12-01T00:00:00.000Z", - "end_at": "2026-03-31T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-2", + "id": "PREBAKED-ESR26", + "start_at": "2026-07-01T00:00:00.000Z", + "end_at": "2026-11-02T23:59:59.000Z", + "title": "Prebaked Appeal ESR26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-2", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-ESR26", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-1", + "start_at": "2026-11-03T00:00:00.000Z", + "end_at": "2026-11-30T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-1", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-1", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-2", + "start_at": "2026-12-01T00:00:00.000Z", + "end_at": "2027-03-31T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-2", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-2", "CTA": "", "severity": 3, "type": "donation_tab", diff -Nru thunderbird-140.10.0esr/comm/mail/branding/thunderbird/content/inAppNotificationData.json thunderbird-140.10.1esr/comm/mail/branding/thunderbird/content/inAppNotificationData.json --- thunderbird-140.10.0esr/comm/mail/branding/thunderbird/content/inAppNotificationData.json 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/mail/branding/thunderbird/content/inAppNotificationData.json 2026-04-29 18:38:49.000000000 +0000 @@ -1,11 +1,11 @@ [ { - "id": "PREBAKED-EoY25-1", - "start_at": "2025-11-03T00:00:00.000Z", - "end_at": "2025-11-30T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-1", + "id": "PREBAKED-Spring26", + "start_at": "2026-04-01T00:00:00.000Z", + "end_at": "2026-06-30T23:59:59.000Z", + "title": "Prebaked Appeal Spring26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-1", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-Spring26", "CTA": "", "severity": 3, "type": "donation_tab", @@ -14,12 +14,40 @@ } }, { - "id": "PREBAKED-EoY25-2", - "start_at": "2025-12-01T00:00:00.000Z", - "end_at": "2026-03-31T23:59:59.000Z", - "title": "Prebaked Appeal EoY25-2", + "id": "PREBAKED-ESR26", + "start_at": "2026-07-01T00:00:00.000Z", + "end_at": "2026-11-02T23:59:59.000Z", + "title": "Prebaked Appeal ESR26", "description": "", - "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY25-2", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-ESR26", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-1", + "start_at": "2026-11-03T00:00:00.000Z", + "end_at": "2026-11-30T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-1", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-1", + "CTA": "", + "severity": 3, + "type": "donation_tab", + "targeting": { + "percent_chance": 100 + } + }, + { + "id": "PREBAKED-EoY26-2", + "start_at": "2026-12-01T00:00:00.000Z", + "end_at": "2027-03-31T23:59:59.000Z", + "title": "Prebaked Appeal EoY26-2", + "description": "", + "URL": "https://updates.thunderbird.net/%LOCALE%/thunderbird/appeal/?locale=%LOCALE%&version=%VERSION%&channel=%CHANNEL%&os=%OS%&buildid=%APPBUILDID%&ID=PREBAKED-EoY26-2", "CTA": "", "severity": 3, "type": "donation_tab", diff -Nru thunderbird-140.10.0esr/comm/mail/config/version.txt thunderbird-140.10.1esr/comm/mail/config/version.txt --- thunderbird-140.10.0esr/comm/mail/config/version.txt 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/mail/config/version.txt 2026-04-29 18:38:49.000000000 +0000 @@ -1 +1 @@ -140.10.0 +140.10.1 diff -Nru thunderbird-140.10.0esr/comm/mail/config/version_display.txt thunderbird-140.10.1esr/comm/mail/config/version_display.txt --- thunderbird-140.10.0esr/comm/mail/config/version_display.txt 2026-04-21 14:53:23.000000000 +0000 +++ thunderbird-140.10.1esr/comm/mail/config/version_display.txt 2026-04-29 18:38:49.000000000 +0000 @@ -1 +1 @@ -140.10.0esr +140.10.1esr diff -Nru thunderbird-140.10.0esr/config/milestone.txt thunderbird-140.10.1esr/config/milestone.txt --- thunderbird-140.10.0esr/config/milestone.txt 2026-04-21 14:52:51.000000000 +0000 +++ thunderbird-140.10.1esr/config/milestone.txt 2026-04-29 18:38:18.000000000 +0000 @@ -10,4 +10,4 @@ # hardcoded milestones in the tree from these two files. #-------------------------------------------------------- -140.10.0 +140.10.1 diff -Nru thunderbird-140.10.0esr/debian/changelog thunderbird-140.10.1esr/debian/changelog --- thunderbird-140.10.0esr/debian/changelog 2026-04-23 08:41:44.000000000 +0000 +++ thunderbird-140.10.1esr/debian/changelog 2026-05-01 10:00:43.000000000 +0000 @@ -1,3 +1,24 @@ +thunderbird (1:140.10.1esr-1~deb13u1) trixie-security; urgency=medium + + * Rebuild for trixie-security + + -- Christoph Goehre Fri, 01 May 2026 12:00:43 +0200 + +thunderbird (1:140.10.1esr-1) unstable; urgency=medium + + * [f774578] New upstream version 140.10.1esr + Fixed CVE issues in upstream version 140.10.1 (MFSA 2026-39): + CVE-2026-7320: Information disclosure due to incorrect boundary conditions + in the Audio/Video component + CVE-2026-7321: Sandbox escape due to incorrect boundary conditions in the + WebRTC: Networking component + CVE-2026-7322: Memory safety bugs fixed in Thunderbird ESR 140.10.1 and + Thunderbird 150.0.1 + CVE-2026-7323: Memory safety bugs fixed in Thunderbird ESR 140.10.1 and + Thunderbird 150.0.1 + + -- Christoph Goehre Fri, 01 May 2026 10:33:23 +0200 + thunderbird (1:140.10.0esr-1~deb13u1) trixie-security; urgency=medium * Rebuild for trixie-security diff -Nru thunderbird-140.10.0esr/dom/canvas/WebGLContext.cpp thunderbird-140.10.1esr/dom/canvas/WebGLContext.cpp --- thunderbird-140.10.0esr/dom/canvas/WebGLContext.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/canvas/WebGLContext.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -2917,7 +2917,9 @@ const auto elemsPerRowStride = ElemsPerRowStride(); const auto bytesPerRowStride = pii.bytesPerElement * elemsPerRowStride; - if (!bytesPerRowStride.isValid()) { + const auto maxBytesPerRow = StaticPrefs::webgl_max_bytes_per_row(); + if (!bytesPerRowStride.isValid() || + (maxBytesPerRow > 0 && bytesPerRowStride.value() > maxBytesPerRow)) { return Err("ROW_LENGTH or width too large for packing."); } metrics.bytesPerRowStride = bytesPerRowStride.value(); diff -Nru thunderbird-140.10.0esr/dom/file/FileReader.cpp thunderbird-140.10.1esr/dom/file/FileReader.cpp --- thunderbird-140.10.0esr/dom/file/FileReader.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/file/FileReader.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -416,10 +416,15 @@ // Binary Format doesn't need a post-processing of the data. Everything is // written directly into mResult. if (mDataFormat != FILE_AS_BINARY) { + CheckedInt size(mTotal); + if (!size.isValid()) { + aRv.Throw(NS_ERROR_OUT_OF_MEMORY); + return; + } if (mDataFormat == FILE_AS_ARRAYBUFFER) { - mFileData = js_pod_malloc(mTotal); + mFileData = js_pod_malloc(size.value()); } else { - mFileData = (char*)malloc(mTotal); + mFileData = (char*)malloc(size.value()); } if (!mFileData) { diff -Nru thunderbird-140.10.0esr/dom/ipc/ReferrerInfoUtils.cpp thunderbird-140.10.1esr/dom/ipc/ReferrerInfoUtils.cpp --- thunderbird-140.10.0esr/dom/ipc/ReferrerInfoUtils.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/ipc/ReferrerInfoUtils.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -7,25 +7,19 @@ #include "mozilla/dom/ReferrerInfoUtils.h" #include "ipc/IPCMessageUtilsSpecializations.h" -#include "nsSerializationHelper.h" -#include "nsString.h" +#include "mozilla/dom/ReferrerInfo.h" +#include "nsQueryObject.h" namespace IPC { - void ParamTraits::Write(MessageWriter* aWriter, nsIReferrerInfo* aParam) { bool isNull = !aParam; WriteParam(aWriter, isNull); - if (isNull) { - return; - } - nsAutoCString infoString; - nsresult rv = NS_SerializeToString(aParam, infoString); - if (NS_FAILED(rv)) { - MOZ_CRASH("Unable to serialize referrer info."); - return; + if (!isNull) { + RefPtr info = do_QueryObject(aParam); + MOZ_ASSERT(info); + info->Serialize(aWriter); } - WriteParam(aWriter, infoString); } bool ParamTraits::Read(MessageReader* aReader, @@ -38,17 +32,7 @@ *aResult = nullptr; return true; } - nsAutoCString infoString; - if (!ReadParam(aReader, &infoString)) { - return false; - } - nsCOMPtr iSupports; - nsresult rv = NS_DeserializeObject(infoString, getter_AddRefs(iSupports)); - NS_ENSURE_SUCCESS(rv, false); - nsCOMPtr referrerInfo = do_QueryInterface(iSupports); - NS_ENSURE_TRUE(referrerInfo, false); - *aResult = ToRefPtr(std::move(referrerInfo)); - return true; + return mozilla::dom::ReferrerInfo::Deserialize(aReader, aResult); } } // namespace IPC diff -Nru thunderbird-140.10.0esr/dom/media/AudioChannelFormat.h thunderbird-140.10.1esr/dom/media/AudioChannelFormat.h --- thunderbird-140.10.0esr/dom/media/AudioChannelFormat.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/AudioChannelFormat.h 2026-04-29 18:38:20.000000000 +0000 @@ -119,6 +119,8 @@ * Given an array of input channels, downmix to aOutputChannelCount, and copy * the results to the channel buffers in aOutputChannels. Don't call this with * input count <= output count. + * Each of aOutputChannels must be non-null. + * aInputChannels elements may be null. */ template void AudioChannelsDownMix(Span aInputChannels, @@ -131,7 +133,11 @@ if (inputChannelCount > 6) { // Just drop the unknown channels. for (uint32_t o = 0; o < outputChannelCount; ++o) { - ConvertAudioSamples(aInputChannels[o], aOutputChannels[o], aDuration); + if (aInputChannels[o]) { + ConvertAudioSamples(aInputChannels[o], aOutputChannels[o], aDuration); + } else { + std::fill_n(aOutputChannels[o], aDuration, static_cast(0)); + } } return; } @@ -150,7 +156,7 @@ } for (uint32_t c = 0; c < inputChannelCount; ++c) { uint32_t dstIndex = m.mInputDestination[c]; - if (dstIndex == IGNORE) { + if (dstIndex == IGNORE || !aInputChannels[c]) { continue; } AddAudioSamplesWithScale(aInputChannels[c], aOutputChannels[dstIndex], @@ -159,7 +165,7 @@ // Utilize the fact that in every layout, C is the only channel that may // contribute to more than one output channel. uint32_t dstIndex = m.mCExtraDestination; - if (dstIndex != IGNORE) { + if (dstIndex != IGNORE && aInputChannels[SURROUND_C]) { AddAudioSamplesWithScale(aInputChannels[SURROUND_C], aOutputChannels[dstIndex], aDuration, m.mInputCoefficient[SURROUND_C]); diff -Nru thunderbird-140.10.0esr/dom/media/AudioSegment.cpp thunderbird-140.10.1esr/dom/media/AudioSegment.cpp --- thunderbird-140.10.0esr/dom/media/AudioSegment.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/AudioSegment.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -203,9 +203,14 @@ } else { // The channel count is already what we want. for (uint32_t channel = 0; channel < aOutputChannels.Length(); channel++) { - ConvertAudioSamplesWithScale(channelData[channel], - aOutputChannels[channel], frameCount, - aChunk.mVolume); + if (channelData[channel]) { + ConvertAudioSamplesWithScale(channelData[channel], + aOutputChannels[channel], frameCount, + aChunk.mVolume); + } else { + std::fill_n(aOutputChannels[channel], frameCount, + static_cast(0)); + } } } } @@ -276,7 +281,7 @@ // Up-mix. upMixChunk = c; AudioChannelsUpMix(&upMixChunk.mChannelData, aOutputChannels, - SilentChannel::gZeroChannel); + nullptr); downMixInput = &upMixChunk; } downMixInput->DownMixTo(outChannelPtrs); diff -Nru thunderbird-140.10.0esr/dom/media/AudioSegment.h thunderbird-140.10.1esr/dom/media/AudioSegment.h --- thunderbird-140.10.0esr/dom/media/AudioSegment.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/AudioSegment.h 2026-04-29 18:38:20.000000000 +0000 @@ -75,14 +75,21 @@ template static void InterleaveAndConvertBuffer(const SrcT* const* aSourceChannels, uint32_t aLength, float aVolume, - uint32_t aChannels, DestT* aOutput) { - DestT* output = aOutput; - for (size_t i = 0; i < aLength; ++i) { - for (size_t channel = 0; channel < aChannels; ++channel) { - float v = - ConvertAudioSample(aSourceChannels[channel][i]) * aVolume; - *output = FloatToAudioSample(v); - ++output; + uint32_t aChannelCount, DestT* aOutput) { + for (size_t channel = 0; channel < aChannelCount; ++channel) { + DestT* output = aOutput + channel; + if (aSourceChannels[channel]) { + for (size_t i = 0; i < aLength; ++i) { + float v = + ConvertAudioSample(aSourceChannels[channel][i]) * aVolume; + *output = FloatToAudioSample(v); + output += aChannelCount; + } + } else { + for (size_t i = 0; i < aLength; ++i) { + *output = static_cast(0); + output += aChannelCount; + } } } } @@ -473,7 +480,7 @@ // Up-mix. Note that this might actually make channelData have more // than aOutputChannels temporarily. AudioChannelsUpMix(&channelData, aOutputChannels, - SilentChannel::ZeroChannel()); + static_cast(nullptr)); } if (channelData.Length() > aOutputChannels) { // Down-mix. diff -Nru thunderbird-140.10.0esr/dom/media/MediaData.cpp thunderbird-140.10.1esr/dom/media/MediaData.cpp --- thunderbird-140.10.0esr/dom/media/MediaData.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/MediaData.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -118,11 +118,13 @@ } size_t frameOffset = trimBefore.ToTicksAtRate(mRate); - mTrimWindow = Some(aTrim); - mDataOffset = frameOffset * mChannels; - MOZ_DIAGNOSTIC_ASSERT(mDataOffset <= mAudioData.Length(), - "Data offset outside original buffer"); + size_t dataOffset = frameOffset * mChannels; int64_t frameCountAfterTrim = (trimAfter - trimBefore).ToTicksAtRate(mRate); + if (dataOffset > mAudioData.Length() || frameCountAfterTrim < 0) { + return false; + } + mTrimWindow = Some(aTrim); + mDataOffset = dataOffset; const size_t availFrames = (mAudioData.Length() - mDataOffset) / mChannels; if (frameCountAfterTrim > AssertedCast(availFrames)) { // Accept rounding error caused by an imprecise time_base in the container, diff -Nru thunderbird-140.10.0esr/dom/media/mp3/MP3Demuxer.cpp thunderbird-140.10.1esr/dom/media/mp3/MP3Demuxer.cpp --- thunderbird-140.10.0esr/dom/media/mp3/MP3Demuxer.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/mp3/MP3Demuxer.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -14,6 +14,7 @@ #include "TimeUnits.h" #include "VideoUtils.h" #include "mozilla/Assertions.h" +#include "mozilla/CheckedInt.h" extern mozilla::LazyLogModule gMediaDemuxerLog; #define MP3LOG(msg, ...) \ @@ -766,8 +767,14 @@ const auto& vbr = mParser.VBRInfo(); if (vbr.IsComplete()) { - offset = mFirstFrameOffset + aFrameIndex * vbr.NumBytes().value() / - vbr.NumAudioFrames().value(); + CheckedInt product = + CheckedInt(aFrameIndex) * vbr.NumBytes().value(); + if (product.isValid()) { + offset = + mFirstFrameOffset + product.value() / vbr.NumAudioFrames().value(); + } else { + offset = StreamLength(); + } } else if (AverageFrameLength() > 0) { offset = mFirstFrameOffset + AssertedCast(static_cast(aFrameIndex) * diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegDataEncoder.cpp thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegDataEncoder.cpp --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegDataEncoder.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegDataEncoder.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -286,8 +286,12 @@ DestroyFrame(); if (mCodecContext) { +#if LIBAVCODEC_VERSION_MAJOR >= 62 + mLib->avcodec_free_context(&mCodecContext); +#else CloseCodecContext(); mLib->av_freep(&mCodecContext); +#endif mCodecContext = nullptr; } } diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegLibWrapper.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -71,6 +71,7 @@ AV_FUNC_59 = 1 << 6, AV_FUNC_60 = 1 << 7, AV_FUNC_61 = 1 << 8, + AV_FUNC_62 = 1 << 9, AV_FUNC_AVUTIL_53 = AV_FUNC_53 | AV_FUNC_AVUTIL_MASK, AV_FUNC_AVUTIL_54 = AV_FUNC_54 | AV_FUNC_AVUTIL_MASK, AV_FUNC_AVUTIL_55 = AV_FUNC_55 | AV_FUNC_AVUTIL_MASK, @@ -80,9 +81,10 @@ AV_FUNC_AVUTIL_59 = AV_FUNC_59 | AV_FUNC_AVUTIL_MASK, AV_FUNC_AVUTIL_60 = AV_FUNC_60 | AV_FUNC_AVUTIL_MASK, AV_FUNC_AVUTIL_61 = AV_FUNC_61 | AV_FUNC_AVUTIL_MASK, + AV_FUNC_AVUTIL_62 = AV_FUNC_62 | AV_FUNC_AVUTIL_MASK, AV_FUNC_AVCODEC_ALL = AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | - AV_FUNC_61, + AV_FUNC_61 | AV_FUNC_62, AV_FUNC_AVUTIL_ALL = AV_FUNC_AVCODEC_ALL | AV_FUNC_AVUTIL_MASK }; @@ -114,6 +116,9 @@ case 61: version = AV_FUNC_61; break; + case 62: + version = AV_FUNC_62; + break; default: FFMPEGV_LOG("Unknown avcodec version: %d", macro); Unlink(); @@ -154,17 +159,19 @@ AV_FUNC(av_lockmgr_register, AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58) AV_FUNC(avcodec_alloc_context3, AV_FUNC_AVCODEC_ALL) - AV_FUNC(avcodec_close, AV_FUNC_AVCODEC_ALL) + AV_FUNC(avcodec_close, AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | + AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | + AV_FUNC_61) AV_FUNC(avcodec_decode_audio4, AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58) AV_FUNC(avcodec_decode_video2, AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58) AV_FUNC(avcodec_find_decoder, AV_FUNC_AVCODEC_ALL) AV_FUNC(avcodec_find_decoder_by_name, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC(avcodec_find_encoder, AV_FUNC_AVCODEC_ALL) AV_FUNC(avcodec_find_encoder_by_name, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC(avcodec_flush_buffers, AV_FUNC_AVCODEC_ALL) AV_FUNC(avcodec_open2, AV_FUNC_AVCODEC_ALL) AV_FUNC(avcodec_register_all, AV_FUNC_53 | AV_FUNC_54 | AV_FUNC_55 | @@ -179,21 +186,22 @@ AV_FUNC(avcodec_get_frame_defaults, (AV_FUNC_53 | AV_FUNC_54)) AV_FUNC(avcodec_free_frame, AV_FUNC_54) AV_FUNC(avcodec_send_packet, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC(avcodec_receive_packet, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC(avcodec_send_frame, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) + AV_FUNC(avcodec_send_frame, + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC(avcodec_receive_frame, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC(avcodec_default_get_buffer2, (AV_FUNC_55 | AV_FUNC_56 | AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | - AV_FUNC_60 | AV_FUNC_61)) - AV_FUNC(av_packet_alloc, - (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61)) - AV_FUNC(av_packet_unref, - (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61)) - AV_FUNC(av_packet_free, - (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61)) + AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62)) + AV_FUNC(av_packet_alloc, (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | + AV_FUNC_61 | AV_FUNC_62)) + AV_FUNC(av_packet_unref, (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | + AV_FUNC_61 | AV_FUNC_62)) + AV_FUNC(av_packet_free, (AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | + AV_FUNC_61 | AV_FUNC_62)) AV_FUNC(avcodec_descriptor_get, AV_FUNC_AVCODEC_ALL) AV_FUNC(av_log_set_level, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_malloc, AV_FUNC_AVUTIL_ALL) @@ -201,37 +209,39 @@ AV_FUNC(av_frame_alloc, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61)) + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC(av_frame_free, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61)) + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC(av_frame_unref, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61)) + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC(av_frame_get_buffer, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61)) + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC(av_frame_make_writable, (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61)) + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC(av_image_check_size, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_image_get_buffer_size, AV_FUNC_AVUTIL_ALL) AV_FUNC_OPTION(av_channel_layout_default, - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62) AV_FUNC_OPTION(av_channel_layout_from_mask, - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) - AV_FUNC_OPTION(av_channel_layout_copy, AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62) + AV_FUNC_OPTION(av_channel_layout_copy, + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62) AV_FUNC_OPTION(av_buffer_get_opaque, (AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58 | - AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61)) - AV_FUNC( - av_buffer_create, - (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | - AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | AV_FUNC_61)) + AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62)) + AV_FUNC(av_buffer_create, + (AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | + AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62)) AV_FUNC_OPTION(av_frame_get_colorspace, AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58) @@ -239,56 +249,71 @@ AV_FUNC_AVUTIL_55 | AV_FUNC_AVUTIL_56 | AV_FUNC_AVUTIL_57 | AV_FUNC_AVUTIL_58) AV_FUNC(av_strerror, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) AV_FUNC(av_get_sample_fmt_name, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_dict_set, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_dict_free, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_opt_set, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_opt_set_double, AV_FUNC_AVUTIL_ALL) AV_FUNC(av_opt_set_int, AV_FUNC_AVUTIL_ALL) - AV_FUNC(avcodec_free_context, - AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(avcodec_get_hw_config, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_codec_is_decoder, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_codec_iterate, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC(avcodec_free_context, AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | + AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) + AV_FUNC_OPTION_SILENT(avcodec_get_hw_config, AV_FUNC_58 | AV_FUNC_59 | + AV_FUNC_60 | AV_FUNC_61 | + AV_FUNC_62) + AV_FUNC_OPTION_SILENT(av_codec_is_decoder, AV_FUNC_58 | AV_FUNC_59 | + AV_FUNC_60 | AV_FUNC_61 | + AV_FUNC_62) + AV_FUNC_OPTION_SILENT(av_codec_iterate, AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | + AV_FUNC_61 | AV_FUNC_62) AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_init, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_alloc, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) - AV_FUNC_OPTION_SILENT(av_buffer_ref, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) + AV_FUNC_OPTION_SILENT( + av_buffer_ref, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | + AV_FUNC_AVUTIL_61 | AV_FUNC_AVUTIL_62) AV_FUNC_OPTION_SILENT(av_buffer_unref, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | AV_FUNC_AVUTIL_60 | - AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) AV_FUNC_OPTION_SILENT(av_hwframe_ctx_alloc, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) AV_FUNC_OPTION_SILENT(av_hwframe_ctx_init, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) #ifdef MOZ_WIDGET_GTK - AV_FUNC_OPTION_SILENT(av_hwdevice_hwconfig_alloc, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_hwdevice_get_hwframe_constraints, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_hwframe_constraints_free, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_hwframe_transfer_get_formats, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) - AV_FUNC_OPTION_SILENT(av_hwdevice_ctx_create_derived, - AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_OPTION_SILENT(av_hwdevice_hwconfig_alloc, AV_FUNC_58 | AV_FUNC_59 | + AV_FUNC_60 | + AV_FUNC_61 | AV_FUNC_62) + AV_FUNC_OPTION_SILENT( + av_hwdevice_get_hwframe_constraints, + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) + AV_FUNC_OPTION_SILENT( + av_hwframe_constraints_free, + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) + AV_FUNC_OPTION_SILENT( + av_hwframe_transfer_get_formats, + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) + AV_FUNC_OPTION_SILENT( + av_hwdevice_ctx_create_derived, + AV_FUNC_58 | AV_FUNC_59 | AV_FUNC_60 | AV_FUNC_61 | AV_FUNC_62) AV_FUNC_OPTION_SILENT(avcodec_get_name, AV_FUNC_57 | AV_FUNC_58 | AV_FUNC_59 | - AV_FUNC_60 | AV_FUNC_61) + AV_FUNC_60 | AV_FUNC_61 | + AV_FUNC_62) AV_FUNC_OPTION_SILENT(av_get_pix_fmt_string, AV_FUNC_AVUTIL_58 | AV_FUNC_AVUTIL_59 | - AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61) + AV_FUNC_AVUTIL_60 | AV_FUNC_AVUTIL_61 | + AV_FUNC_AVUTIL_62) #endif AV_FUNC_OPTION(av_tx_init, AV_FUNC_AVUTIL_ALL) diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegRuntimeLinker.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -115,6 +115,9 @@ case 61: FFmpegDecoderModule<61>::Init(&sLibAV); break; + case 62: + FFmpegDecoderModule<62>::Init(&sLibAV); + break; } return true; case FFmpegLibWrapper::LinkResult::NoProvidedLib: @@ -205,6 +208,9 @@ case 61: module = FFmpegDecoderModule<61>::Create(&sLibAV); break; + case 62: + module = FFmpegDecoderModule<62>::Create(&sLibAV); + break; default: module = nullptr; } @@ -243,6 +249,9 @@ case 61: module = FFmpegEncoderModule<61>::Create(&sLibAV); break; + case 62: + module = FFmpegEncoderModule<62>::Create(&sLibAV); + break; default: module = nullptr; } diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoDecoder.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -1077,6 +1077,14 @@ } #endif +static bool IsKeyFrame(const AVFrame* aFrame) { +#if LIBAVCODEC_VERSION_MAJOR > 61 + return !!(aFrame->flags & AV_FRAME_FLAG_KEY); +#else + return !!aFrame->key_frame; +#endif +} + MediaResult FFmpegVideoDecoder::DoDecode( MediaRawData* aSample, uint8_t* aData, int aSize, bool* aGotFrame, MediaDataDecoder::DecodedData& aResults) { @@ -1191,6 +1199,12 @@ mDecodeStats.UpdateDecodeTimes(mFrame); + int64_t fpos = +# if LIBAVCODEC_VERSION_MAJOR > 61 + packet->pos; +# else + mFrame->pkt_pos; +# endif MediaResult rv; # ifdef MOZ_USE_HWDECODE if (IsHardwareAccelerated()) { @@ -1205,11 +1219,11 @@ RESULT_DETAIL("HW decoding is slow, switching back to SW decode")); } if (mUsingV4L2) { - rv = CreateImageV4L2(mFrame->pkt_pos, GetFramePts(mFrame), - Duration(mFrame), aResults); + rv = CreateImageV4L2(fpos, GetFramePts(mFrame), Duration(mFrame), + aResults); } else { - rv = CreateImageVAAPI(mFrame->pkt_pos, GetFramePts(mFrame), - Duration(mFrame), aResults); + rv = CreateImageVAAPI(fpos, GetFramePts(mFrame), Duration(mFrame), + aResults); } // If VA-API/V4L2 playback failed, just quit. Decoder is going to be @@ -1221,8 +1235,8 @@ return rv; } # elif defined(MOZ_ENABLE_D3D11VA) - rv = CreateImageD3D11(mFrame->pkt_pos, GetFramePts(mFrame), - Duration(mFrame), aResults); + rv = CreateImageD3D11(fpos, GetFramePts(mFrame), Duration(mFrame), + aResults); # else return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, RESULT_DETAIL("No HW decoding implementation!")); @@ -1230,8 +1244,7 @@ } else # endif { - rv = CreateImage(mFrame->pkt_pos, GetFramePts(mFrame), Duration(mFrame), - aResults); + rv = CreateImage(fpos, GetFramePts(mFrame), Duration(mFrame), aResults); } if (NS_FAILED(rv)) { return rv; @@ -1575,7 +1588,7 @@ v = VideoData::CreateFromImage( mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts), TimeUnit::FromMicroseconds(aDuration), wrapper->AsImage(), - !!mFrame->key_frame, TimeUnit::FromMicroseconds(-1)); + IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1)); } #endif #if defined(MOZ_WIDGET_GTK) && defined(MOZ_USE_HWDECODE) @@ -1602,7 +1615,7 @@ v = VideoData::CreateFromImage( mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts), TimeUnit::FromMicroseconds(aDuration), surface->GetAsImage(), - !!mFrame->key_frame, TimeUnit::FromMicroseconds(-1)); + IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1)); } else { FFMPEG_LOG("Failed to uploaded video data to DMABuf"); } @@ -1615,7 +1628,7 @@ Result, MediaResult> r = VideoData::CreateAndCopyData( mInfo, mImageContainer, aOffset, TimeUnit::FromMicroseconds(aPts), - TimeUnit::FromMicroseconds(aDuration), b, !!mFrame->key_frame, + TimeUnit::FromMicroseconds(aDuration), b, IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1), mInfo.ScaledImageRect(mFrame->width, mFrame->height), mImageAllocator); @@ -1688,7 +1701,7 @@ RefPtr vp = VideoData::CreateFromImage( mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts), TimeUnit::FromMicroseconds(aDuration), surface->GetAsImage(), - !!mFrame->key_frame, TimeUnit::FromMicroseconds(-1)); + IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1)); if (!vp) { return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, @@ -1737,7 +1750,7 @@ RefPtr vp = VideoData::CreateFromImage( mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts), TimeUnit::FromMicroseconds(aDuration), surface->GetAsImage(), - !!mFrame->key_frame, TimeUnit::FromMicroseconds(-1)); + IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1)); if (!vp) { return MediaResult(NS_ERROR_DOM_MEDIA_DECODE_ERR, @@ -2175,7 +2188,7 @@ RefPtr v = VideoData::CreateFromImage( mInfo.mDisplay, aOffset, TimeUnit::FromMicroseconds(aPts), - TimeUnit::FromMicroseconds(aDuration), image, !!mFrame->key_frame, + TimeUnit::FromMicroseconds(aDuration), image, IsKeyFrame(mFrame), TimeUnit::FromMicroseconds(-1)); if (!v) { nsPrintfCString msg("D3D image allocation error"); diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegVideoEncoder.cpp thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoEncoder.cpp --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/FFmpegVideoEncoder.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/FFmpegVideoEncoder.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -118,11 +118,19 @@ H264Setting get() const { return {mValue, mString.AsString()}; } }; +#if LIBAVCODEC_VERSION_MAJOR < 62 static constexpr H264LiteralSetting H264Profiles[]{ {FF_PROFILE_H264_BASELINE, "baseline"_ns}, {FF_PROFILE_H264_MAIN, "main"_ns}, {FF_PROFILE_H264_EXTENDED, ""_ns}, {FF_PROFILE_H264_HIGH, "high"_ns}}; +#else +static constexpr H264LiteralSetting H264Profiles[]{ + {AV_PROFILE_H264_BASELINE, "baseline"_ns}, + {AV_PROFILE_H264_MAIN, "main"_ns}, + {AV_PROFILE_H264_EXTENDED, ""_ns}, + {AV_PROFILE_H264_HIGH, "high"_ns}}; +#endif static Maybe GetH264Profile(const H264_PROFILE& aProfile) { switch (aProfile) { diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/COPYING.LGPLv2.1 thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/COPYING.LGPLv2.1 --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/COPYING.LGPLv2.1 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/COPYING.LGPLv2.1 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,504 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 2.1, February 1999 + + Copyright (C) 1991, 1999 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + +[This is the first released version of the Lesser GPL. It also counts + as the successor of the GNU Library Public License, version 2, hence + the version number 2.1.] + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +Licenses are intended to guarantee your freedom to share and change +free software--to make sure the software is free for all its users. + + This license, the Lesser General Public License, applies to some +specially designated software packages--typically libraries--of the +Free Software Foundation and other authors who decide to use it. You +can use it too, but we suggest you first think carefully about whether +this license or the ordinary General Public License is the better +strategy to use in any particular case, based on the explanations below. + + When we speak of free software, we are referring to freedom of use, +not price. Our General Public Licenses are designed to make sure that +you have the freedom to distribute copies of free software (and charge +for this service if you wish); that you receive source code or can get +it if you want it; that you can change the software and use pieces of +it in new free programs; and that you are informed that you can do +these things. + + To protect your rights, we need to make restrictions that forbid +distributors to deny you these rights or to ask you to surrender these +rights. These restrictions translate to certain responsibilities for +you if you distribute copies of the library or if you modify it. + + For example, if you distribute copies of the library, whether gratis +or for a fee, you must give the recipients all the rights that we gave +you. You must make sure that they, too, receive or can get the source +code. If you link other code with the library, you must provide +complete object files to the recipients, so that they can relink them +with the library after making changes to the library and recompiling +it. And you must show them these terms so they know their rights. + + We protect your rights with a two-step method: (1) we copyright the +library, and (2) we offer you this license, which gives you legal +permission to copy, distribute and/or modify the library. + + To protect each distributor, we want to make it very clear that +there is no warranty for the free library. Also, if the library is +modified by someone else and passed on, the recipients should know +that what they have is not the original version, so that the original +author's reputation will not be affected by problems that might be +introduced by others. + + Finally, software patents pose a constant threat to the existence of +any free program. We wish to make sure that a company cannot +effectively restrict the users of a free program by obtaining a +restrictive license from a patent holder. Therefore, we insist that +any patent license obtained for a version of the library must be +consistent with the full freedom of use specified in this license. + + Most GNU software, including some libraries, is covered by the +ordinary GNU General Public License. This license, the GNU Lesser +General Public License, applies to certain designated libraries, and +is quite different from the ordinary General Public License. We use +this license for certain libraries in order to permit linking those +libraries into non-free programs. + + When a program is linked with a library, whether statically or using +a shared library, the combination of the two is legally speaking a +combined work, a derivative of the original library. The ordinary +General Public License therefore permits such linking only if the +entire combination fits its criteria of freedom. The Lesser General +Public License permits more lax criteria for linking other code with +the library. + + We call this license the "Lesser" General Public License because it +does Less to protect the user's freedom than the ordinary General +Public License. It also provides other free software developers Less +of an advantage over competing non-free programs. These disadvantages +are the reason we use the ordinary General Public License for many +libraries. However, the Lesser license provides advantages in certain +special circumstances. + + For example, on rare occasions, there may be a special need to +encourage the widest possible use of a certain library, so that it becomes +a de-facto standard. To achieve this, non-free programs must be +allowed to use the library. A more frequent case is that a free +library does the same job as widely used non-free libraries. In this +case, there is little to gain by limiting the free library to free +software only, so we use the Lesser General Public License. + + In other cases, permission to use a particular library in non-free +programs enables a greater number of people to use a large body of +free software. For example, permission to use the GNU C Library in +non-free programs enables many more people to use the whole GNU +operating system, as well as its variant, the GNU/Linux operating +system. + + Although the Lesser General Public License is Less protective of the +users' freedom, it does ensure that the user of a program that is +linked with the Library has the freedom and the wherewithal to run +that program using a modified version of the Library. + + The precise terms and conditions for copying, distribution and +modification follow. Pay close attention to the difference between a +"work based on the library" and a "work that uses the library". The +former contains code derived from the library, whereas the latter must +be combined with the library in order to run. + + GNU LESSER GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License Agreement applies to any software library or other +program which contains a notice placed by the copyright holder or +other authorized party saying it may be distributed under the terms of +this Lesser General Public License (also called "this License"). +Each licensee is addressed as "you". + + A "library" means a collection of software functions and/or data +prepared so as to be conveniently linked with application programs +(which use some of those functions and data) to form executables. + + The "Library", below, refers to any such software library or work +which has been distributed under these terms. A "work based on the +Library" means either the Library or any derivative work under +copyright law: that is to say, a work containing the Library or a +portion of it, either verbatim or with modifications and/or translated +straightforwardly into another language. (Hereinafter, translation is +included without limitation in the term "modification".) + + "Source code" for a work means the preferred form of the work for +making modifications to it. For a library, complete source code means +all the source code for all modules it contains, plus any associated +interface definition files, plus the scripts used to control compilation +and installation of the library. + + Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running a program using the Library is not restricted, and output from +such a program is covered only if its contents constitute a work based +on the Library (independent of the use of the Library in a tool for +writing it). Whether that is true depends on what the Library does +and what the program that uses the Library does. + + 1. You may copy and distribute verbatim copies of the Library's +complete source code as you receive it, in any medium, provided that +you conspicuously and appropriately publish on each copy an +appropriate copyright notice and disclaimer of warranty; keep intact +all the notices that refer to this License and to the absence of any +warranty; and distribute a copy of this License along with the +Library. + + You may charge a fee for the physical act of transferring a copy, +and you may at your option offer warranty protection in exchange for a +fee. + + 2. You may modify your copy or copies of the Library or any portion +of it, thus forming a work based on the Library, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) The modified work must itself be a software library. + + b) You must cause the files modified to carry prominent notices + stating that you changed the files and the date of any change. + + c) You must cause the whole of the work to be licensed at no + charge to all third parties under the terms of this License. + + d) If a facility in the modified Library refers to a function or a + table of data to be supplied by an application program that uses + the facility, other than as an argument passed when the facility + is invoked, then you must make a good faith effort to ensure that, + in the event an application does not supply such function or + table, the facility still operates, and performs whatever part of + its purpose remains meaningful. + + (For example, a function in a library to compute square roots has + a purpose that is entirely well-defined independent of the + application. Therefore, Subsection 2d requires that any + application-supplied function or table used by this function must + be optional: if the application does not supply it, the square + root function must still compute square roots.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Library, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Library, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote +it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Library. + +In addition, mere aggregation of another work not based on the Library +with the Library (or with a work based on the Library) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may opt to apply the terms of the ordinary GNU General Public +License instead of this License to a given copy of the Library. To do +this, you must alter all the notices that refer to this License, so +that they refer to the ordinary GNU General Public License, version 2, +instead of to this License. (If a newer version than version 2 of the +ordinary GNU General Public License has appeared, then you can specify +that version instead if you wish.) Do not make any other change in +these notices. + + Once this change is made in a given copy, it is irreversible for +that copy, so the ordinary GNU General Public License applies to all +subsequent copies and derivative works made from that copy. + + This option is useful when you wish to copy part of the code of +the Library into a program that is not a library. + + 4. You may copy and distribute the Library (or a portion or +derivative of it, under Section 2) in object code or executable form +under the terms of Sections 1 and 2 above provided that you accompany +it with the complete corresponding machine-readable source code, which +must be distributed under the terms of Sections 1 and 2 above on a +medium customarily used for software interchange. + + If distribution of object code is made by offering access to copy +from a designated place, then offering equivalent access to copy the +source code from the same place satisfies the requirement to +distribute the source code, even though third parties are not +compelled to copy the source along with the object code. + + 5. A program that contains no derivative of any portion of the +Library, but is designed to work with the Library by being compiled or +linked with it, is called a "work that uses the Library". Such a +work, in isolation, is not a derivative work of the Library, and +therefore falls outside the scope of this License. + + However, linking a "work that uses the Library" with the Library +creates an executable that is a derivative of the Library (because it +contains portions of the Library), rather than a "work that uses the +library". The executable is therefore covered by this License. +Section 6 states terms for distribution of such executables. + + When a "work that uses the Library" uses material from a header file +that is part of the Library, the object code for the work may be a +derivative work of the Library even though the source code is not. +Whether this is true is especially significant if the work can be +linked without the Library, or if the work is itself a library. The +threshold for this to be true is not precisely defined by law. + + If such an object file uses only numerical parameters, data +structure layouts and accessors, and small macros and small inline +functions (ten lines or less in length), then the use of the object +file is unrestricted, regardless of whether it is legally a derivative +work. (Executables containing this object code plus portions of the +Library will still fall under Section 6.) + + Otherwise, if the work is a derivative of the Library, you may +distribute the object code for the work under the terms of Section 6. +Any executables containing that work also fall under Section 6, +whether or not they are linked directly with the Library itself. + + 6. As an exception to the Sections above, you may also combine or +link a "work that uses the Library" with the Library to produce a +work containing portions of the Library, and distribute that work +under terms of your choice, provided that the terms permit +modification of the work for the customer's own use and reverse +engineering for debugging such modifications. + + You must give prominent notice with each copy of the work that the +Library is used in it and that the Library and its use are covered by +this License. You must supply a copy of this License. If the work +during execution displays copyright notices, you must include the +copyright notice for the Library among them, as well as a reference +directing the user to the copy of this License. Also, you must do one +of these things: + + a) Accompany the work with the complete corresponding + machine-readable source code for the Library including whatever + changes were used in the work (which must be distributed under + Sections 1 and 2 above); and, if the work is an executable linked + with the Library, with the complete machine-readable "work that + uses the Library", as object code and/or source code, so that the + user can modify the Library and then relink to produce a modified + executable containing the modified Library. (It is understood + that the user who changes the contents of definitions files in the + Library will not necessarily be able to recompile the application + to use the modified definitions.) + + b) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (1) uses at run time a + copy of the library already present on the user's computer system, + rather than copying library functions into the executable, and (2) + will operate properly with a modified version of the library, if + the user installs one, as long as the modified version is + interface-compatible with the version that the work was made with. + + c) Accompany the work with a written offer, valid for at + least three years, to give the same user the materials + specified in Subsection 6a, above, for a charge no more + than the cost of performing this distribution. + + d) If distribution of the work is made by offering access to copy + from a designated place, offer equivalent access to copy the above + specified materials from the same place. + + e) Verify that the user has already received a copy of these + materials or that you have already sent this user a copy. + + For an executable, the required form of the "work that uses the +Library" must include any data and utility programs needed for +reproducing the executable from it. However, as a special exception, +the materials to be distributed need not include anything that is +normally distributed (in either source or binary form) with the major +components (compiler, kernel, and so on) of the operating system on +which the executable runs, unless that component itself accompanies +the executable. + + It may happen that this requirement contradicts the license +restrictions of other proprietary libraries that do not normally +accompany the operating system. Such a contradiction means you cannot +use both them and the Library together in an executable that you +distribute. + + 7. You may place library facilities that are a work based on the +Library side-by-side in a single library together with other library +facilities not covered by this License, and distribute such a combined +library, provided that the separate distribution of the work based on +the Library and of the other library facilities is otherwise +permitted, and provided that you do these two things: + + a) Accompany the combined library with a copy of the same work + based on the Library, uncombined with any other library + facilities. This must be distributed under the terms of the + Sections above. + + b) Give prominent notice with the combined library of the fact + that part of it is a work based on the Library, and explaining + where to find the accompanying uncombined form of the same work. + + 8. You may not copy, modify, sublicense, link with, or distribute +the Library except as expressly provided under this License. Any +attempt otherwise to copy, modify, sublicense, link with, or +distribute the Library is void, and will automatically terminate your +rights under this License. However, parties who have received copies, +or rights, from you under this License will not have their licenses +terminated so long as such parties remain in full compliance. + + 9. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Library or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Library (or any work based on the +Library), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Library or works based on it. + + 10. Each time you redistribute the Library (or any work based on the +Library), the recipient automatically receives a license from the +original licensor to copy, distribute, link with or modify the Library +subject to these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties with +this License. + + 11. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Library at all. For example, if a patent +license would not permit royalty-free redistribution of the Library by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Library. + +If any portion of this section is held invalid or unenforceable under any +particular circumstance, the balance of the section is intended to apply, +and the section as a whole is intended to apply in other circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 12. If the distribution and/or use of the Library is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Library under this License may add +an explicit geographical distribution limitation excluding those countries, +so that distribution is permitted only in or among countries not thus +excluded. In such case, this License incorporates the limitation as if +written in the body of this License. + + 13. The Free Software Foundation may publish revised and/or new +versions of the Lesser General Public License from time to time. +Such new versions will be similar in spirit to the present version, +but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Library +specifies a version number of this License which applies to it and +"any later version", you have the option of following the terms and +conditions either of that version or of any later version published by +the Free Software Foundation. If the Library does not specify a +license version number, you may choose any version ever published by +the Free Software Foundation. + + 14. If you wish to incorporate parts of the Library into other free +programs whose distribution conditions are incompatible with these, +write to the author to ask for permission. For software which is +copyrighted by the Free Software Foundation, write to the Free +Software Foundation; we sometimes make exceptions for this. Our +decision will be guided by the two goals of preserving the free status +of all derivatives of our free software and of promoting the sharing +and reuse of software generally. + + NO WARRANTY + + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH +DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Libraries + + If you develop a new library, and you want it to be of the greatest +possible use to the public, we recommend making it free software that +everyone can redistribute and change. You can do so by permitting +redistribution under these terms (or, alternatively, under the terms of the +ordinary General Public License). + + To apply these terms, attach the following notices to the library. It is +safest to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least the +"copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This library 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. + + This library 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 this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +Also add information on how to contact you by electronic and paper mail. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the library, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the + library `Frob' (a library for tweaking knobs) written by James Random Hacker. + + , 1 April 1990 + Ty Coon, President of Vice + +That's all there is to it! + + diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avcodec.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avcodec.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avcodec.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avcodec.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,2995 @@ +/* + * copyright (c) 2001 Fabrice Bellard + * + * 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 + */ + +#ifndef AVCODEC_AVCODEC_H +#define AVCODEC_AVCODEC_H + +/** + * @file + * @ingroup libavc + * Libavcodec external API header + */ + +#include "libavutil/samplefmt.h" +#include "libavutil/attributes.h" +#include "libavutil/avutil.h" +#include "libavutil/buffer.h" +#include "libavutil/channel_layout.h" +#include "libavutil/dict.h" +#include "libavutil/frame.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" + +#include "codec.h" +#include "codec_id.h" +#include "defs.h" +#include "packet.h" +#include "version_major.h" +#ifndef HAVE_AV_CONFIG_H +/* When included as part of the ffmpeg build, only include the major version + * to avoid unnecessary rebuilds. When included externally, keep including + * the full version information. */ +#include "version.h" + +#include "codec_desc.h" +#include "codec_par.h" +#endif + +struct AVCodecParameters; + +/** + * @defgroup libavc libavcodec + * Encoding/Decoding Library + * + * @{ + * + * @defgroup lavc_decoding Decoding + * @{ + * @} + * + * @defgroup lavc_encoding Encoding + * @{ + * @} + * + * @defgroup lavc_codec Codecs + * @{ + * @defgroup lavc_codec_native Native Codecs + * @{ + * @} + * @defgroup lavc_codec_wrappers External library wrappers + * @{ + * @} + * @defgroup lavc_codec_hwaccel Hardware Accelerators bridge + * @{ + * @} + * @} + * @defgroup lavc_internal Internal + * @{ + * @} + * @} + */ + +/** + * @ingroup libavc + * @defgroup lavc_encdec send/receive encoding and decoding API overview + * @{ + * + * The avcodec_send_packet()/avcodec_receive_frame()/avcodec_send_frame()/ + * avcodec_receive_packet() functions provide an encode/decode API, which + * decouples input and output. + * + * The API is very similar for encoding/decoding and audio/video, and works as + * follows: + * - Set up and open the AVCodecContext as usual. + * - Send valid input: + * - For decoding, call avcodec_send_packet() to give the decoder raw + * compressed data in an AVPacket. + * - For encoding, call avcodec_send_frame() to give the encoder an AVFrame + * containing uncompressed audio or video. + * + * In both cases, it is recommended that AVPackets and AVFrames are + * refcounted, or libavcodec might have to copy the input data. (libavformat + * always returns refcounted AVPackets, and av_frame_get_buffer() allocates + * refcounted AVFrames.) + * - Receive output in a loop. Periodically call one of the avcodec_receive_*() + * functions and process their output: + * - For decoding, call avcodec_receive_frame(). On success, it will return + * an AVFrame containing uncompressed audio or video data. + * - For encoding, call avcodec_receive_packet(). On success, it will return + * an AVPacket with a compressed frame. + * + * Repeat this call until it returns AVERROR(EAGAIN) or an error. The + * AVERROR(EAGAIN) return value means that new input data is required to + * return new output. In this case, continue with sending input. For each + * input frame/packet, the codec will typically return 1 output frame/packet, + * but it can also be 0 or more than 1. + * + * At the beginning of decoding or encoding, the codec might accept multiple + * input frames/packets without returning a frame, until its internal buffers + * are filled. This situation is handled transparently if you follow the steps + * outlined above. + * + * In theory, sending input can result in EAGAIN - this should happen only if + * not all output was received. You can use this to structure alternative decode + * or encode loops other than the one suggested above. For example, you could + * try sending new input on each iteration, and try to receive output if that + * returns EAGAIN. + * + * End of stream situations. These require "flushing" (aka draining) the codec, + * as the codec might buffer multiple frames or packets internally for + * performance or out of necessity (consider B-frames). + * This is handled as follows: + * - Instead of valid input, send NULL to the avcodec_send_packet() (decoding) + * or avcodec_send_frame() (encoding) functions. This will enter draining + * mode. + * - Call avcodec_receive_frame() (decoding) or avcodec_receive_packet() + * (encoding) in a loop until AVERROR_EOF is returned. The functions will + * not return AVERROR(EAGAIN), unless you forgot to enter draining mode. + * - Before decoding can be resumed again, the codec has to be reset with + * avcodec_flush_buffers(). + * + * Using the API as outlined above is highly recommended. But it is also + * possible to call functions outside of this rigid schema. For example, you can + * call avcodec_send_packet() repeatedly without calling + * avcodec_receive_frame(). In this case, avcodec_send_packet() will succeed + * until the codec's internal buffer has been filled up (which is typically of + * size 1 per output frame, after initial input), and then reject input with + * AVERROR(EAGAIN). Once it starts rejecting input, you have no choice but to + * read at least some output. + * + * Not all codecs will follow a rigid and predictable dataflow; the only + * guarantee is that an AVERROR(EAGAIN) return value on a send/receive call on + * one end implies that a receive/send call on the other end will succeed, or + * at least will not fail with AVERROR(EAGAIN). In general, no codec will + * permit unlimited buffering of input or output. + * + * A codec is not allowed to return AVERROR(EAGAIN) for both sending and receiving. This + * would be an invalid state, which could put the codec user into an endless + * loop. The API has no concept of time either: it cannot happen that trying to + * do avcodec_send_packet() results in AVERROR(EAGAIN), but a repeated call 1 second + * later accepts the packet (with no other receive/flush API calls involved). + * The API is a strict state machine, and the passage of time is not supposed + * to influence it. Some timing-dependent behavior might still be deemed + * acceptable in certain cases. But it must never result in both send/receive + * returning EAGAIN at the same time at any point. It must also absolutely be + * avoided that the current state is "unstable" and can "flip-flop" between + * the send/receive APIs allowing progress. For example, it's not allowed that + * the codec randomly decides that it actually wants to consume a packet now + * instead of returning a frame, after it just returned AVERROR(EAGAIN) on an + * avcodec_send_packet() call. + * @} + */ + +/** + * @defgroup lavc_core Core functions/structures. + * @ingroup libavc + * + * Basic definitions, functions for querying libavcodec capabilities, + * allocating core structures, etc. + * @{ + */ + +/** + * @ingroup lavc_encoding + */ +typedef struct RcOverride{ + int start_frame; + int end_frame; + int qscale; // If this is 0 then quality_factor will be used instead. + float quality_factor; +} RcOverride; + +/* encoding support + These flags can be passed in AVCodecContext.flags before initialization. + Note: Not everything is supported yet. +*/ + +/** + * Allow decoders to produce frames with data planes that are not aligned + * to CPU requirements (e.g. due to cropping). + */ +#define AV_CODEC_FLAG_UNALIGNED (1 << 0) +/** + * Use fixed qscale. + */ +#define AV_CODEC_FLAG_QSCALE (1 << 1) +/** + * 4 MV per MB allowed / advanced prediction for H.263. + */ +#define AV_CODEC_FLAG_4MV (1 << 2) +/** + * Output even those frames that might be corrupted. + */ +#define AV_CODEC_FLAG_OUTPUT_CORRUPT (1 << 3) +/** + * Use qpel MC. + */ +#define AV_CODEC_FLAG_QPEL (1 << 4) +/** + * Request the encoder to output reconstructed frames, i.e.\ frames that would + * be produced by decoding the encoded bitstream. These frames may be retrieved + * by calling avcodec_receive_frame() immediately after a successful call to + * avcodec_receive_packet(). + * + * Should only be used with encoders flagged with the + * @ref AV_CODEC_CAP_ENCODER_RECON_FRAME capability. + * + * @note + * Each reconstructed frame returned by the encoder corresponds to the last + * encoded packet, i.e. the frames are returned in coded order rather than + * presentation order. + * + * @note + * Frame parameters (like pixel format or dimensions) do not have to match the + * AVCodecContext values. Make sure to use the values from the returned frame. + */ +#define AV_CODEC_FLAG_RECON_FRAME (1 << 6) +/** + * @par decoding + * Request the decoder to propagate each packet's AVPacket.opaque and + * AVPacket.opaque_ref to its corresponding output AVFrame. + * + * @par encoding: + * Request the encoder to propagate each frame's AVFrame.opaque and + * AVFrame.opaque_ref values to its corresponding output AVPacket. + * + * @par + * May only be set on encoders that have the + * @ref AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE capability flag. + * + * @note + * While in typical cases one input frame produces exactly one output packet + * (perhaps after a delay), in general the mapping of frames to packets is + * M-to-N, so + * - Any number of input frames may be associated with any given output packet. + * This includes zero - e.g. some encoders may output packets that carry only + * metadata about the whole stream. + * - A given input frame may be associated with any number of output packets. + * Again this includes zero - e.g. some encoders may drop frames under certain + * conditions. + * . + * This implies that when using this flag, the caller must NOT assume that + * - a given input frame's opaques will necessarily appear on some output packet; + * - every output packet will have some non-NULL opaque value. + * . + * When an output packet contains multiple frames, the opaque values will be + * taken from the first of those. + * + * @note + * The converse holds for decoders, with frames and packets switched. + */ +#define AV_CODEC_FLAG_COPY_OPAQUE (1 << 7) +/** + * Signal to the encoder that the values of AVFrame.duration are valid and + * should be used (typically for transferring them to output packets). + * + * If this flag is not set, frame durations are ignored. + */ +#define AV_CODEC_FLAG_FRAME_DURATION (1 << 8) +/** + * Use internal 2pass ratecontrol in first pass mode. + */ +#define AV_CODEC_FLAG_PASS1 (1 << 9) +/** + * Use internal 2pass ratecontrol in second pass mode. + */ +#define AV_CODEC_FLAG_PASS2 (1 << 10) +/** + * loop filter. + */ +#define AV_CODEC_FLAG_LOOP_FILTER (1 << 11) +/** + * Only decode/encode grayscale. + */ +#define AV_CODEC_FLAG_GRAY (1 << 13) +/** + * error[?] variables will be set during encoding. + */ +#define AV_CODEC_FLAG_PSNR (1 << 15) +/** + * Use interlaced DCT. + */ +#define AV_CODEC_FLAG_INTERLACED_DCT (1 << 18) +/** + * Force low delay. + */ +#define AV_CODEC_FLAG_LOW_DELAY (1 << 19) +/** + * Place global headers in extradata instead of every keyframe. + */ +#define AV_CODEC_FLAG_GLOBAL_HEADER (1 << 22) +/** + * Use only bitexact stuff (except (I)DCT). + */ +#define AV_CODEC_FLAG_BITEXACT (1 << 23) +/* Fx : Flag for H.263+ extra options */ +/** + * H.263 advanced intra coding / MPEG-4 AC prediction + */ +#define AV_CODEC_FLAG_AC_PRED (1 << 24) +/** + * interlaced motion estimation + */ +#define AV_CODEC_FLAG_INTERLACED_ME (1 << 29) +#define AV_CODEC_FLAG_CLOSED_GOP (1U << 31) + +/** + * Allow non spec compliant speedup tricks. + */ +#define AV_CODEC_FLAG2_FAST (1 << 0) +/** + * Skip bitstream encoding. + */ +#define AV_CODEC_FLAG2_NO_OUTPUT (1 << 2) +/** + * Place global headers at every keyframe instead of in extradata. + */ +#define AV_CODEC_FLAG2_LOCAL_HEADER (1 << 3) + +/** + * Input bitstream might be truncated at a packet boundaries + * instead of only at frame boundaries. + */ +#define AV_CODEC_FLAG2_CHUNKS (1 << 15) +/** + * Discard cropping information from SPS. + */ +#define AV_CODEC_FLAG2_IGNORE_CROP (1 << 16) + +/** + * Show all frames before the first keyframe + */ +#define AV_CODEC_FLAG2_SHOW_ALL (1 << 22) +/** + * Export motion vectors through frame side data + */ +#define AV_CODEC_FLAG2_EXPORT_MVS (1 << 28) +/** + * Do not skip samples and export skip information as frame side data + */ +#define AV_CODEC_FLAG2_SKIP_MANUAL (1 << 29) +/** + * Do not reset ASS ReadOrder field on flush (subtitles decoding) + */ +#define AV_CODEC_FLAG2_RO_FLUSH_NOOP (1 << 30) +/** + * Generate/parse ICC profiles on encode/decode, as appropriate for the type of + * file. No effect on codecs which cannot contain embedded ICC profiles, or + * when compiled without support for lcms2. + */ +#define AV_CODEC_FLAG2_ICC_PROFILES (1U << 31) + +/* Exported side data. + These flags can be passed in AVCodecContext.export_side_data before initialization. +*/ +/** + * Export motion vectors through frame side data + */ +#define AV_CODEC_EXPORT_DATA_MVS (1 << 0) +/** + * Export encoder Producer Reference Time through packet side data + */ +#define AV_CODEC_EXPORT_DATA_PRFT (1 << 1) +/** + * Decoding only. + * Export the AVVideoEncParams structure through frame side data. + */ +#define AV_CODEC_EXPORT_DATA_VIDEO_ENC_PARAMS (1 << 2) +/** + * Decoding only. + * Do not apply film grain, export it instead. + */ +#define AV_CODEC_EXPORT_DATA_FILM_GRAIN (1 << 3) + +/** + * Decoding only. + * Do not apply picture enhancement layers, export them instead. + */ +#define AV_CODEC_EXPORT_DATA_ENHANCEMENTS (1 << 4) + +/** + * The decoder will keep a reference to the frame and may reuse it later. + */ +#define AV_GET_BUFFER_FLAG_REF (1 << 0) + +/** + * The encoder will keep a reference to the packet and may reuse it later. + */ +#define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0) + +/** + * The decoder will bypass frame threading and return the next frame as soon as + * possible. Note that this may deliver frames earlier than the advertised + * `AVCodecContext.delay`. No effect when frame threading is disabled, or on + * encoding. + */ +#define AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS (1 << 0) + +/** + * main external API structure. + * New fields can be added to the end with minor version bumps. + * Removal, reordering and changes to existing fields require a major + * version bump. + * You can use AVOptions (av_opt* / av_set/get*()) to access these fields from user + * applications. + * The name string for AVOptions options matches the associated command line + * parameter name and can be found in libavcodec/options_table.h + * The AVOption/command line parameter names differ in some cases from the C + * structure field names for historic reasons or brevity. + * sizeof(AVCodecContext) must not be used outside libav*. + */ +typedef struct AVCodecContext { + /** + * information on struct for av_log + * - set by avcodec_alloc_context3 + */ + const AVClass *av_class; + int log_level_offset; + + enum AVMediaType codec_type; /* see AVMEDIA_TYPE_xxx */ + const struct AVCodec *codec; + enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ + + /** + * fourcc (LSB first, so "ABCD" -> ('D'<<24) + ('C'<<16) + ('B'<<8) + 'A'). + * This is used to work around some encoder bugs. + * A demuxer should set this to what is stored in the field used to identify the codec. + * If there are multiple such fields in a container then the demuxer should choose the one + * which maximizes the information about the used codec. + * If the codec tag field in a container is larger than 32 bits then the demuxer should + * remap the longer ID to 32 bits with a table or other structure. Alternatively a new + * extra_codec_tag + size could be added but for this a clear advantage must be demonstrated + * first. + * - encoding: Set by user, if not then the default based on codec_id will be used. + * - decoding: Set by user, will be converted to uppercase by libavcodec during init. + */ + unsigned int codec_tag; + + void *priv_data; + + /** + * Private context used for internal data. + * + * Unlike priv_data, this is not codec-specific. It is used in general + * libavcodec functions. + */ + struct AVCodecInternal *internal; + + /** + * Private data of the user, can be used to carry app specific stuff. + * - encoding: Set by user. + * - decoding: Set by user. + */ + void *opaque; + + /** + * the average bitrate + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: Set by user, may be overwritten by libavcodec + * if this info is available in the stream + */ + int64_t bit_rate; + + /** + * AV_CODEC_FLAG_*. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags; + + /** + * AV_CODEC_FLAG2_* + * - encoding: Set by user. + * - decoding: Set by user. + */ + int flags2; + + /** + * Out-of-band global headers that may be used by some codecs. + * + * - decoding: Should be set by the caller when available (typically from a + * demuxer) before opening the decoder; some decoders require this to be + * set and will fail to initialize otherwise. + * + * The array must be allocated with the av_malloc() family of functions; + * allocated size must be at least AV_INPUT_BUFFER_PADDING_SIZE bytes + * larger than extradata_size. + * + * - encoding: May be set by the encoder in avcodec_open2() (possibly + * depending on whether the AV_CODEC_FLAG_GLOBAL_HEADER flag is set). + * + * After being set, the array is owned by the codec and freed in + * avcodec_free_context(). + */ + uint8_t *extradata; + int extradata_size; + + /** + * This is the fundamental unit of time (in seconds) in terms + * of which frame timestamps are represented. For fixed-fps content, + * timebase should be 1/framerate and timestamp increments should be + * identically 1. + * This often, but not always is the inverse of the frame rate or field rate + * for video. 1/time_base is not the average frame rate if the frame rate is not + * constant. + * + * Like containers, elementary streams also can store timestamps, 1/time_base + * is the unit in which these timestamps are specified. + * As example of such codec time base see ISO/IEC 14496-2:2001(E) + * vop_time_increment_resolution and fixed_vop_rate + * (fixed_vop_rate == 0 implies that it is different from the framerate) + * + * - encoding: MUST be set by user. + * - decoding: unused. + */ + AVRational time_base; + + /** + * Timebase in which pkt_dts/pts and AVPacket.dts/pts are expressed. + * - encoding: unused. + * - decoding: set by user. + */ + AVRational pkt_timebase; + + /** + * - decoding: For codecs that store a framerate value in the compressed + * bitstream, the decoder may export it here. { 0, 1} when + * unknown. + * - encoding: May be used to signal the framerate of CFR content to an + * encoder. + */ + AVRational framerate; + + /** + * Codec delay. + * + * Encoding: Number of frames delay there will be from the encoder input to + * the decoder output. (we assume the decoder matches the spec) + * Decoding: Number of frames delay in addition to what a standard decoder + * as specified in the spec would produce. + * + * Video: + * Number of frames the decoded output will be delayed relative to the + * encoded input. + * + * Audio: + * For encoding, this field is unused (see initial_padding). + * + * For decoding, this is the number of samples the decoder needs to + * output before the decoder's output is valid. When seeking, you should + * start decoding this many samples prior to your desired seek point. + * + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int delay; + + + /* video only */ + /** + * picture width / height. + * + * @note Those fields may not match the values of the last + * AVFrame output by avcodec_receive_frame() due frame + * reordering. + * + * - encoding: MUST be set by user. + * - decoding: May be set by the user before opening the decoder if known e.g. + * from the container. Some decoders will require the dimensions + * to be set by the caller. During decoding, the decoder may + * overwrite those values as required while parsing the data. + */ + int width, height; + + /** + * Bitstream width / height, may be different from width/height e.g. when + * the decoded frame is cropped before being output or lowres is enabled. + * + * @note Those field may not match the value of the last + * AVFrame output by avcodec_receive_frame() due frame + * reordering. + * + * - encoding: unused + * - decoding: May be set by the user before opening the decoder if known + * e.g. from the container. During decoding, the decoder may + * overwrite those values as required while parsing the data. + */ + int coded_width, coded_height; + + /** + * sample aspect ratio (0 if unknown) + * That is the width of a pixel divided by the height of the pixel. + * Numerator and denominator must be relatively prime and smaller than 256 for some video standards. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVRational sample_aspect_ratio; + + /** + * Pixel format, see AV_PIX_FMT_xxx. + * May be set by the demuxer if known from headers. + * May be overridden by the decoder if it knows better. + * + * @note This field may not match the value of the last + * AVFrame output by avcodec_receive_frame() due frame + * reordering. + * + * - encoding: Set by user. + * - decoding: Set by user if known, overridden by libavcodec while + * parsing the data. + */ + enum AVPixelFormat pix_fmt; + + /** + * Nominal unaccelerated pixel format, see AV_PIX_FMT_xxx. + * - encoding: unused. + * - decoding: Set by libavcodec before calling get_format() + */ + enum AVPixelFormat sw_pix_fmt; + + /** + * Chromaticity coordinates of the source primaries. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorPrimaries color_primaries; + + /** + * Color Transfer Characteristic. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user to override the default output color range value, + * If not specified, libavcodec sets the color range depending on the + * output format. + * - decoding: Set by libavcodec, can be set by the user to propagate the + * color range to components reading from the decoder context. + */ + enum AVColorRange color_range; + + /** + * This defines the location of chroma samples. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVChromaLocation chroma_sample_location; + + /** Field order + * - encoding: set by libavcodec + * - decoding: Set by user. + */ + enum AVFieldOrder field_order; + + /** + * number of reference frames + * - encoding: Set by user. + * - decoding: Set by lavc. + */ + int refs; + + /** + * Size of the frame reordering buffer in the decoder. + * For MPEG-2 it is 1 IPB or 0 low delay IP. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int has_b_frames; + + /** + * slice flags + * - encoding: unused + * - decoding: Set by user. + */ + int slice_flags; +#define SLICE_FLAG_CODED_ORDER 0x0001 ///< draw_horiz_band() is called in coded order instead of display +#define SLICE_FLAG_ALLOW_FIELD 0x0002 ///< allow draw_horiz_band() with field slices (MPEG-2 field pics) +#define SLICE_FLAG_ALLOW_PLANE 0x0004 ///< allow draw_horiz_band() with 1 component at a time (SVQ1) + + /** + * If non NULL, 'draw_horiz_band' is called by the libavcodec + * decoder to draw a horizontal band. It improves cache usage. Not + * all codecs can do that. You must check the codec capabilities + * beforehand. + * When multithreading is used, it may be called from multiple threads + * at the same time; threads might draw different parts of the same AVFrame, + * or multiple AVFrames, and there is no guarantee that slices will be drawn + * in order. + * The function is also used by hardware acceleration APIs. + * It is called at least once during frame decoding to pass + * the data needed for hardware render. + * In that mode instead of pixel data, AVFrame points to + * a structure specific to the acceleration API. The application + * reads the structure and can change some fields to indicate progress + * or mark state. + * - encoding: unused + * - decoding: Set by user. + * @param height the height of the slice + * @param y the y position of the slice + * @param type 1->top field, 2->bottom field, 3->frame + * @param offset offset into the AVFrame.data from which the slice should be read + */ + void (*draw_horiz_band)(struct AVCodecContext *s, + const AVFrame *src, int offset[AV_NUM_DATA_POINTERS], + int y, int type, int height); + + /** + * Callback to negotiate the pixel format. Decoding only, may be set by the + * caller before avcodec_open2(). + * + * Called by some decoders to select the pixel format that will be used for + * the output frames. This is mainly used to set up hardware acceleration, + * then the provided format list contains the corresponding hwaccel pixel + * formats alongside the "software" one. The software pixel format may also + * be retrieved from \ref sw_pix_fmt. + * + * This callback will be called when the coded frame properties (such as + * resolution, pixel format, etc.) change and more than one output format is + * supported for those new properties. If a hardware pixel format is chosen + * and initialization for it fails, the callback may be called again + * immediately. + * + * This callback may be called from different threads if the decoder is + * multi-threaded, but not from more than one thread simultaneously. + * + * @param fmt list of formats which may be used in the current + * configuration, terminated by AV_PIX_FMT_NONE. + * @warning Behavior is undefined if the callback returns a value other + * than one of the formats in fmt or AV_PIX_FMT_NONE. + * @return the chosen format or AV_PIX_FMT_NONE + */ + enum AVPixelFormat (*get_format)(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + + /** + * maximum number of B-frames between non-B-frames + * Note: The output will be delayed by max_b_frames+1 relative to the input. + * - encoding: Set by user. + * - decoding: unused + */ + int max_b_frames; + + /** + * qscale factor between IP and B-frames + * If > 0 then the last P-frame quantizer will be used (q= lastp_q*factor+offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_factor; + + /** + * qscale offset between IP and B-frames + * - encoding: Set by user. + * - decoding: unused + */ + float b_quant_offset; + + /** + * qscale factor between P- and I-frames + * If > 0 then the last P-frame quantizer will be used (q = lastp_q * factor + offset). + * If < 0 then normal ratecontrol will be done (q= -normal_q*factor+offset). + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_factor; + + /** + * qscale offset between P and I-frames + * - encoding: Set by user. + * - decoding: unused + */ + float i_quant_offset; + + /** + * luminance masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float lumi_masking; + + /** + * temporary complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float temporal_cplx_masking; + + /** + * spatial complexity masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float spatial_cplx_masking; + + /** + * p block masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float p_masking; + + /** + * darkness masking (0-> disabled) + * - encoding: Set by user. + * - decoding: unused + */ + float dark_masking; + + /** + * noise vs. sse weight for the nsse comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int nsse_weight; + + /** + * motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_cmp; + /** + * subpixel motion estimation comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_sub_cmp; + /** + * macroblock comparison function (not supported yet) + * - encoding: Set by user. + * - decoding: unused + */ + int mb_cmp; + /** + * interlaced DCT comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int ildct_cmp; +#define FF_CMP_SAD 0 +#define FF_CMP_SSE 1 +#define FF_CMP_SATD 2 +#define FF_CMP_DCT 3 +#define FF_CMP_PSNR 4 +#define FF_CMP_BIT 5 +#define FF_CMP_RD 6 +#define FF_CMP_ZERO 7 +#define FF_CMP_VSAD 8 +#define FF_CMP_VSSE 9 +#define FF_CMP_NSSE 10 +#define FF_CMP_W53 11 +#define FF_CMP_W97 12 +#define FF_CMP_DCTMAX 13 +#define FF_CMP_DCT264 14 +#define FF_CMP_MEDIAN_SAD 15 +#define FF_CMP_CHROMA 256 + + /** + * ME diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int dia_size; + + /** + * amount of previous MV predictors (2a+1 x 2a+1 square) + * - encoding: Set by user. + * - decoding: unused + */ + int last_predictor_count; + + /** + * motion estimation prepass comparison function + * - encoding: Set by user. + * - decoding: unused + */ + int me_pre_cmp; + + /** + * ME prepass diamond size & shape + * - encoding: Set by user. + * - decoding: unused + */ + int pre_dia_size; + + /** + * subpel ME quality + * - encoding: Set by user. + * - decoding: unused + */ + int me_subpel_quality; + + /** + * maximum motion estimation search range in subpel units + * If 0 then no limit. + * + * - encoding: Set by user. + * - decoding: unused + */ + int me_range; + + /** + * macroblock decision mode + * - encoding: Set by user. + * - decoding: unused + */ + int mb_decision; +#define FF_MB_DECISION_SIMPLE 0 ///< uses mb_cmp +#define FF_MB_DECISION_BITS 1 ///< chooses the one which needs the fewest bits +#define FF_MB_DECISION_RD 2 ///< rate distortion + + /** + * custom intra quantization matrix + * Must be allocated with the av_malloc() family of functions, and will be freed in + * avcodec_free_context(). + * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL. + * - decoding: Set/allocated/freed by libavcodec. + */ + uint16_t *intra_matrix; + + /** + * custom inter quantization matrix + * Must be allocated with the av_malloc() family of functions, and will be freed in + * avcodec_free_context(). + * - encoding: Set/allocated by user, freed by libavcodec. Can be NULL. + * - decoding: Set/allocated/freed by libavcodec. + */ + uint16_t *inter_matrix; + + /** + * custom intra quantization matrix + * - encoding: Set by user, can be NULL. + * - decoding: unused. + */ + uint16_t *chroma_intra_matrix; + +#if FF_API_INTRA_DC_PRECISION + /** + * precision of the intra DC coefficient - 8 + * - encoding: Set by user. + * - decoding: Set by libavcodec + * @deprecated Use the MPEG-2 encoder's private option "intra_dc_precision" instead. + */ + attribute_deprecated + int intra_dc_precision; +#endif + + /** + * minimum MB Lagrange multiplier + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmin; + + /** + * maximum MB Lagrange multiplier + * - encoding: Set by user. + * - decoding: unused + */ + int mb_lmax; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int bidir_refine; + + /** + * minimum GOP size + * - encoding: Set by user. + * - decoding: unused + */ + int keyint_min; + + /** + * the number of pictures in a group of pictures, or 0 for intra_only + * - encoding: Set by user. + * - decoding: unused + */ + int gop_size; + + /** + * Note: Value depends upon the compare function used for fullpel ME. + * - encoding: Set by user. + * - decoding: unused + */ + int mv0_threshold; + + /** + * Number of slices. + * Indicates number of picture subdivisions. Used for parallelized + * decoding. + * - encoding: Set by user + * - decoding: unused + */ + int slices; + + /* audio only */ + int sample_rate; ///< samples per second + + /** + * audio sample format + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVSampleFormat sample_fmt; ///< sample format + + /** + * Audio channel layout. + * - encoding: must be set by the caller, to one of AVCodec.ch_layouts. + * - decoding: may be set by the caller if known e.g. from the container. + * The decoder can then override during decoding as needed. + */ + AVChannelLayout ch_layout; + + /* The following data should not be initialized. */ + /** + * Number of samples per channel in an audio frame. + * + * - encoding: set by libavcodec in avcodec_open2(). Each submitted frame + * except the last must contain exactly frame_size samples per channel. + * May be 0 when the codec has AV_CODEC_CAP_VARIABLE_FRAME_SIZE set, then the + * frame size is not restricted. + * - decoding: may be set by some decoders to indicate constant frame size + */ + int frame_size; + + /** + * number of bytes per packet if constant and known or 0 + * Used by some WAV based audio codecs. + */ + int block_align; + + /** + * Audio cutoff bandwidth (0 means "automatic") + * - encoding: Set by user. + * - decoding: unused + */ + int cutoff; + + /** + * Type of service that the audio stream conveys. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + enum AVAudioServiceType audio_service_type; + + /** + * desired sample format + * - encoding: Not used. + * - decoding: Set by user. + * Decoder will decode to this format if it can. + */ + enum AVSampleFormat request_sample_fmt; + + /** + * Audio only. The number of "priming" samples (padding) inserted by the + * encoder at the beginning of the audio. I.e. this number of leading + * decoded samples must be discarded by the caller to get the original audio + * without leading padding. + * + * - decoding: unused + * - encoding: Set by libavcodec. The timestamps on the output packets are + * adjusted by the encoder so that they always refer to the + * first sample of the data actually contained in the packet, + * including any added padding. E.g. if the timebase is + * 1/samplerate and the timestamp of the first input sample is + * 0, the timestamp of the first output packet will be + * -initial_padding. + */ + int initial_padding; + + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + * + * - decoding: unused + * - encoding: unused + */ + int trailing_padding; + + /** + * Number of samples to skip after a discontinuity + * - decoding: unused + * - encoding: set by libavcodec + */ + int seek_preroll; + + /** + * This callback is called at the beginning of each frame to get data + * buffer(s) for it. There may be one contiguous buffer for all the data or + * there may be a buffer per each data plane or anything in between. What + * this means is, you may set however many entries in buf[] you feel necessary. + * Each buffer must be reference-counted using the AVBuffer API (see description + * of buf[] below). + * + * The following fields will be set in the frame before this callback is + * called: + * - format + * - width, height (video only) + * - sample_rate, channel_layout, nb_samples (audio only) + * Their values may differ from the corresponding values in + * AVCodecContext. This callback must use the frame values, not the codec + * context values, to calculate the required buffer size. + * + * This callback must fill the following fields in the frame: + * - data[] + * - linesize[] + * - extended_data: + * * if the data is planar audio with more than 8 channels, then this + * callback must allocate and fill extended_data to contain all pointers + * to all data planes. data[] must hold as many pointers as it can. + * extended_data must be allocated with av_malloc() and will be freed in + * av_frame_unref(). + * * otherwise extended_data must point to data + * - buf[] must contain one or more pointers to AVBufferRef structures. Each of + * the frame's data and extended_data pointers must be contained in these. That + * is, one AVBufferRef for each allocated chunk of memory, not necessarily one + * AVBufferRef per data[] entry. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * - extended_buf and nb_extended_buf must be allocated with av_malloc() by + * this callback and filled with the extra buffers if there are more + * buffers than buf[] can hold. extended_buf will be freed in + * av_frame_unref(). + * Decoders will generally initialize the whole buffer before it is output + * but it can in rare error conditions happen that uninitialized data is passed + * through. \important The buffers returned by get_buffer* should thus not contain sensitive + * data. + * + * If AV_CODEC_CAP_DR1 is not set then get_buffer2() must call + * avcodec_default_get_buffer2() instead of providing buffers allocated by + * some other means. + * + * Each data plane must be aligned to the maximum required by the target + * CPU. + * + * @see avcodec_default_get_buffer2() + * + * Video: + * + * If AV_GET_BUFFER_FLAG_REF is set in flags then the frame may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * avcodec_align_dimensions2() should be used to find the required width and + * height, as they normally need to be rounded up to the next multiple of 16. + * + * Some decoders do not support linesizes changing between frames. + * + * If frame multithreading is used, this callback may be called from a + * different thread, but not from more than one at once. Does not need to be + * reentrant. + * + * @see avcodec_align_dimensions2() + * + * Audio: + * + * Decoders request a buffer of a particular size by setting + * AVFrame.nb_samples prior to calling get_buffer2(). The decoder may, + * however, utilize only part of the buffer by setting AVFrame.nb_samples + * to a smaller value in the output frame. + * + * As a convenience, av_samples_get_buffer_size() and + * av_samples_fill_arrays() in libavutil may be used by custom get_buffer2() + * functions to find the required data size and to fill data pointers and + * linesize. In AVFrame.linesize, only linesize[0] may be set for audio + * since all planes must be the same size. + * + * @see av_samples_get_buffer_size(), av_samples_fill_arrays() + * + * - encoding: unused + * - decoding: Set by libavcodec, user can override. + */ + int (*get_buffer2)(struct AVCodecContext *s, AVFrame *frame, int flags); + + /* - encoding parameters */ + /** + * number of bits the bitstream is allowed to diverge from the reference. + * the reference can be CBR (for CBR pass1) or VBR (for pass2) + * - encoding: Set by user; unused for constant quantizer encoding. + * - decoding: unused + */ + int bit_rate_tolerance; + + /** + * Global quality for codecs which cannot change it per frame. + * This should be proportional to MPEG-1/2/4 qscale. + * - encoding: Set by user. + * - decoding: unused + */ + int global_quality; + + /** + * - encoding: Set by user. + * - decoding: unused + */ + int compression_level; +#define FF_COMPRESSION_DEFAULT -1 + + float qcompress; ///< amount of qscale change between easy & hard scenes (0.0-1.0) + float qblur; ///< amount of qscale smoothing over time (0.0-1.0) + + /** + * minimum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmin; + + /** + * maximum quantizer + * - encoding: Set by user. + * - decoding: unused + */ + int qmax; + + /** + * maximum quantizer difference between frames + * - encoding: Set by user. + * - decoding: unused + */ + int max_qdiff; + + /** + * decoder bitstream buffer size + * - encoding: Set by user. + * - decoding: May be set by libavcodec. + */ + int rc_buffer_size; + + /** + * ratecontrol override, see RcOverride + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + int rc_override_count; + RcOverride *rc_override; + + /** + * maximum bitrate + * - encoding: Set by user. + * - decoding: Set by user, may be overwritten by libavcodec. + */ + int64_t rc_max_rate; + + /** + * minimum bitrate + * - encoding: Set by user. + * - decoding: unused + */ + int64_t rc_min_rate; + + /** + * Ratecontrol attempt to use, at maximum, of what can be used without an underflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_max_available_vbv_use; + + /** + * Ratecontrol attempt to use, at least, times the amount needed to prevent a vbv overflow. + * - encoding: Set by user. + * - decoding: unused. + */ + float rc_min_vbv_overflow_use; + + /** + * Number of bits which should be loaded into the rc buffer before decoding starts. + * - encoding: Set by user. + * - decoding: unused + */ + int rc_initial_buffer_occupancy; + + /** + * trellis RD quantization + * - encoding: Set by user. + * - decoding: unused + */ + int trellis; + + /** + * pass1 encoding statistics output buffer + * - encoding: Set by libavcodec. + * - decoding: unused + */ + char *stats_out; + + /** + * pass2 encoding statistics input buffer + * Concatenated stuff from stats_out of pass1 should be placed here. + * - encoding: Allocated/set/freed by user. + * - decoding: unused + */ + char *stats_in; + + /** + * Work around bugs in encoders which sometimes cannot be detected automatically. + * - encoding: Set by user + * - decoding: Set by user + */ + int workaround_bugs; +#define FF_BUG_AUTODETECT 1 ///< autodetection +#define FF_BUG_XVID_ILACE 4 +#define FF_BUG_UMP4 8 +#define FF_BUG_NO_PADDING 16 +#define FF_BUG_AMV 32 +#define FF_BUG_QPEL_CHROMA 64 +#define FF_BUG_STD_QPEL 128 +#define FF_BUG_QPEL_CHROMA2 256 +#define FF_BUG_DIRECT_BLOCKSIZE 512 +#define FF_BUG_EDGE 1024 +#define FF_BUG_HPEL_CHROMA 2048 +#define FF_BUG_DC_CLIP 4096 +#define FF_BUG_MS 8192 ///< Work around various bugs in Microsoft's broken decoders. +#define FF_BUG_TRUNCATED 16384 +#define FF_BUG_IEDGE 32768 + + /** + * strictly follow the standard (MPEG-4, ...). + * - encoding: Set by user. + * - decoding: Set by user. + * Setting this to STRICT or higher means the encoder and decoder will + * generally do stupid things, whereas setting it to unofficial or lower + * will mean the encoder might produce output that is not supported by all + * spec-compliant decoders. Decoders don't differentiate between normal, + * unofficial and experimental (that is, they always try to decode things + * when they can) unless they are explicitly asked to behave stupidly + * (=strictly conform to the specs) + * This may only be set to one of the FF_COMPLIANCE_* values in defs.h. + */ + int strict_std_compliance; + + /** + * error concealment flags + * - encoding: unused + * - decoding: Set by user. + */ + int error_concealment; +#define FF_EC_GUESS_MVS 1 +#define FF_EC_DEBLOCK 2 +#define FF_EC_FAVOR_INTER 256 + + /** + * debug + * - encoding: Set by user. + * - decoding: Set by user. + */ + int debug; +#define FF_DEBUG_PICT_INFO 1 +#define FF_DEBUG_RC 2 +#define FF_DEBUG_BITSTREAM 4 +#define FF_DEBUG_MB_TYPE 8 +#define FF_DEBUG_QP 16 +#define FF_DEBUG_DCT_COEFF 0x00000040 +#define FF_DEBUG_SKIP 0x00000080 +#define FF_DEBUG_STARTCODE 0x00000100 +#define FF_DEBUG_ER 0x00000400 +#define FF_DEBUG_MMCO 0x00000800 +#define FF_DEBUG_BUGS 0x00001000 +#define FF_DEBUG_BUFFERS 0x00008000 +#define FF_DEBUG_THREADS 0x00010000 +#define FF_DEBUG_GREEN_MD 0x00800000 +#define FF_DEBUG_NOMC 0x01000000 + + /** + * Error recognition; may misdetect some more or less valid parts as errors. + * This is a bitfield of the AV_EF_* values defined in defs.h. + * + * - encoding: Set by user. + * - decoding: Set by user. + */ + int err_recognition; + + /** + * Hardware accelerator in use + * - encoding: unused. + * - decoding: Set by libavcodec + */ + const struct AVHWAccel *hwaccel; + + /** + * Legacy hardware accelerator context. + * + * For some hardware acceleration methods, the caller may use this field to + * signal hwaccel-specific data to the codec. The struct pointed to by this + * pointer is hwaccel-dependent and defined in the respective header. Please + * refer to the FFmpeg HW accelerator documentation to know how to fill + * this. + * + * In most cases this field is optional - the necessary information may also + * be provided to libavcodec through @ref hw_frames_ctx or @ref + * hw_device_ctx (see avcodec_get_hw_config()). However, in some cases it + * may be the only method of signalling some (optional) information. + * + * The struct and its contents are owned by the caller. + * + * - encoding: May be set by the caller before avcodec_open2(). Must remain + * valid until avcodec_free_context(). + * - decoding: May be set by the caller in the get_format() callback. + * Must remain valid until the next get_format() call, + * or avcodec_free_context() (whichever comes first). + */ + void *hwaccel_context; + + /** + * A reference to the AVHWFramesContext describing the input (for encoding) + * or output (decoding) frames. The reference is set by the caller and + * afterwards owned (and freed) by libavcodec - it should never be read by + * the caller after being set. + * + * - decoding: This field should be set by the caller from the get_format() + * callback. The previous reference (if any) will always be + * unreffed by libavcodec before the get_format() call. + * + * If the default get_buffer2() is used with a hwaccel pixel + * format, then this AVHWFramesContext will be used for + * allocating the frame buffers. + * + * - encoding: For hardware encoders configured to use a hwaccel pixel + * format, this field should be set by the caller to a reference + * to the AVHWFramesContext describing input frames. + * AVHWFramesContext.format must be equal to + * AVCodecContext.pix_fmt. + * + * This field should be set before avcodec_open2() is called. + */ + AVBufferRef *hw_frames_ctx; + + /** + * A reference to the AVHWDeviceContext describing the device which will + * be used by a hardware encoder/decoder. The reference is set by the + * caller and afterwards owned (and freed) by libavcodec. + * + * This should be used if either the codec device does not require + * hardware frames or any that are used are to be allocated internally by + * libavcodec. If the user wishes to supply any of the frames used as + * encoder input or decoder output then hw_frames_ctx should be used + * instead. When hw_frames_ctx is set in get_format() for a decoder, this + * field will be ignored while decoding the associated stream segment, but + * may again be used on a following one after another get_format() call. + * + * For both encoders and decoders this field should be set before + * avcodec_open2() is called and must not be written to thereafter. + * + * Note that some decoders may require this field to be set initially in + * order to support hw_frames_ctx at all - in that case, all frames + * contexts used must be created on the same device. + */ + AVBufferRef *hw_device_ctx; + + /** + * Bit set of AV_HWACCEL_FLAG_* flags, which affect hardware accelerated + * decoding (if active). + * - encoding: unused + * - decoding: Set by user (either before avcodec_open2(), or in the + * AVCodecContext.get_format callback) + */ + int hwaccel_flags; + + /** + * Video decoding only. Sets the number of extra hardware frames which + * the decoder will allocate for use by the caller. This must be set + * before avcodec_open2() is called. + * + * Some hardware decoders require all frames that they will use for + * output to be defined in advance before decoding starts. For such + * decoders, the hardware frame pool must therefore be of a fixed size. + * The extra frames set here are on top of any number that the decoder + * needs internally in order to operate normally (for example, frames + * used as reference pictures). + */ + int extra_hw_frames; + + /** + * error + * - encoding: Set by libavcodec if flags & AV_CODEC_FLAG_PSNR. + * - decoding: unused + */ + uint64_t error[AV_NUM_DATA_POINTERS]; + + /** + * DCT algorithm, see FF_DCT_* below + * - encoding: Set by user. + * - decoding: unused + */ + int dct_algo; +#define FF_DCT_AUTO 0 +#define FF_DCT_FASTINT 1 +#define FF_DCT_INT 2 +#define FF_DCT_MMX 3 +#define FF_DCT_ALTIVEC 5 +#define FF_DCT_FAAN 6 +#define FF_DCT_NEON 7 + + /** + * IDCT algorithm, see FF_IDCT_* below. + * - encoding: Set by user. + * - decoding: Set by user. + */ + int idct_algo; +#define FF_IDCT_AUTO 0 +#define FF_IDCT_INT 1 +#define FF_IDCT_SIMPLE 2 +#define FF_IDCT_SIMPLEMMX 3 +#define FF_IDCT_ARM 7 +#define FF_IDCT_ALTIVEC 8 +#define FF_IDCT_SIMPLEARM 10 +#define FF_IDCT_XVID 14 +#define FF_IDCT_SIMPLEARMV5TE 16 +#define FF_IDCT_SIMPLEARMV6 17 +#define FF_IDCT_FAAN 20 +#define FF_IDCT_SIMPLENEON 22 +#define FF_IDCT_SIMPLEAUTO 128 + + /** + * bits per sample/pixel from the demuxer (needed for huffyuv). + * - encoding: Set by libavcodec. + * - decoding: Set by user. + */ + int bits_per_coded_sample; + + /** + * Bits per sample/pixel of internal libavcodec pixel/sample format. + * - encoding: set by user. + * - decoding: set by libavcodec. + */ + int bits_per_raw_sample; + + /** + * thread count + * is used to decide how many independent tasks should be passed to execute() + * - encoding: Set by user. + * - decoding: Set by user. + */ + int thread_count; + + /** + * Which multithreading methods to use. + * Use of FF_THREAD_FRAME will increase decoding delay by one frame per thread, + * so clients which cannot provide future frames should not use it. + * + * - encoding: Set by user, otherwise the default is used. + * - decoding: Set by user, otherwise the default is used. + */ + int thread_type; +#define FF_THREAD_FRAME 1 ///< Decode more than one frame at once +#define FF_THREAD_SLICE 2 ///< Decode more than one part of a single frame at once + + /** + * Which multithreading methods are in use by the codec. + * - encoding: Set by libavcodec. + * - decoding: Set by libavcodec. + */ + int active_thread_type; + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param count the number of things to execute + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg), void *arg2, int *ret, int count, int size); + + /** + * The codec may call this to execute several independent things. + * It will return only after finishing all tasks. + * The user may replace this with some multithreaded implementation, + * the default implementation will execute the parts serially. + * @param c context passed also to func + * @param count the number of things to execute + * @param arg2 argument passed unchanged to func + * @param ret return values of executed functions, must have space for "count" values. May be NULL. + * @param func function that will be called count times, with jobnr from 0 to count-1. + * threadnr will be in the range 0 to c->thread_count-1 < MAX_THREADS and so that no + * two instances of func executing at the same time will have the same threadnr. + * @return always 0 currently, but code should handle a future improvement where when any call to func + * returns < 0 no further calls to func may be done and < 0 is returned. + * - encoding: Set by libavcodec, user can override. + * - decoding: Set by libavcodec, user can override. + */ + int (*execute2)(struct AVCodecContext *c, int (*func)(struct AVCodecContext *c2, void *arg, int jobnr, int threadnr), void *arg2, int *ret, int count); + + /** + * profile + * - encoding: Set by user. + * - decoding: Set by libavcodec. + * See the AV_PROFILE_* defines in defs.h. + */ + int profile; + + /** + * Encoding level descriptor. + * - encoding: Set by user, corresponds to a specific level defined by the + * codec, usually corresponding to the profile level, if not specified it + * is set to AV_LEVEL_UNKNOWN. + * - decoding: Set by libavcodec. + * See AV_LEVEL_* in defs.h. + */ + int level; + +#if FF_API_CODEC_PROPS + /** + * Properties of the stream that gets decoded + * - encoding: unused + * - decoding: set by libavcodec + */ + attribute_deprecated + unsigned properties; +#define FF_CODEC_PROPERTY_LOSSLESS 0x00000001 +#define FF_CODEC_PROPERTY_CLOSED_CAPTIONS 0x00000002 +#define FF_CODEC_PROPERTY_FILM_GRAIN 0x00000004 +#endif + + /** + * Skip loop filtering for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_loop_filter; + + /** + * Skip IDCT/dequantization for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_idct; + + /** + * Skip decoding for selected frames. + * - encoding: unused + * - decoding: Set by user. + */ + enum AVDiscard skip_frame; + + /** + * Skip processing alpha if supported by codec. + * Note that if the format uses pre-multiplied alpha (common with VP6, + * and recommended due to better video quality/compression) + * the image will look as if alpha-blended onto a black background. + * However for formats that do not use pre-multiplied alpha + * there might be serious artefacts (though e.g. libswscale currently + * assumes pre-multiplied alpha anyway). + * + * - decoding: set by user + * - encoding: unused + */ + int skip_alpha; + + /** + * Number of macroblock rows at the top which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_top; + + /** + * Number of macroblock rows at the bottom which are skipped. + * - encoding: unused + * - decoding: Set by user. + */ + int skip_bottom; + + /** + * low resolution decoding, 1-> 1/2 size, 2->1/4 size + * - encoding: unused + * - decoding: Set by user. + */ + int lowres; + + /** + * AVCodecDescriptor + * - encoding: unused. + * - decoding: set by libavcodec. + */ + const struct AVCodecDescriptor *codec_descriptor; + + /** + * Character encoding of the input subtitles file. + * - decoding: set by user + * - encoding: unused + */ + char *sub_charenc; + + /** + * Subtitles character encoding mode. Formats or codecs might be adjusting + * this setting (if they are doing the conversion themselves for instance). + * - decoding: set by libavcodec + * - encoding: unused + */ + int sub_charenc_mode; +#define FF_SUB_CHARENC_MODE_DO_NOTHING -1 ///< do nothing (demuxer outputs a stream supposed to be already in UTF-8, or the codec is bitmap for instance) +#define FF_SUB_CHARENC_MODE_AUTOMATIC 0 ///< libavcodec will select the mode itself +#define FF_SUB_CHARENC_MODE_PRE_DECODER 1 ///< the AVPacket data needs to be recoded to UTF-8 before being fed to the decoder, requires iconv +#define FF_SUB_CHARENC_MODE_IGNORE 2 ///< neither convert the subtitles, nor check them for valid UTF-8 + + /** + * Header containing style information for text subtitles. + * For SUBTITLE_ASS subtitle type, it should contain the whole ASS + * [Script Info] and [V4+ Styles] section, plus the [Events] line and + * the Format line following. It shouldn't include any Dialogue line. + * + * - encoding: May be set by the caller before avcodec_open2() to an array + * allocated with the av_malloc() family of functions. + * - decoding: May be set by libavcodec in avcodec_open2(). + * + * After being set, the array is owned by the codec and freed in + * avcodec_free_context(). + */ + int subtitle_header_size; + uint8_t *subtitle_header; + + /** + * dump format separator. + * can be ", " or "\n " or anything else + * - encoding: Set by user. + * - decoding: Set by user. + */ + uint8_t *dump_separator; + + /** + * ',' separated list of allowed decoders. + * If NULL then all are allowed + * - encoding: unused + * - decoding: set by user + */ + char *codec_whitelist; + + /** + * Additional data associated with the entire coded stream. + * + * - decoding: may be set by user before calling avcodec_open2(). + * - encoding: may be set by libavcodec after avcodec_open2(). + */ + AVPacketSideData *coded_side_data; + int nb_coded_side_data; + + /** + * Bit set of AV_CODEC_EXPORT_DATA_* flags, which affects the kind of + * metadata exported in frame, packet, or coded stream side data by + * decoders and encoders. + * + * - decoding: set by user + * - encoding: set by user + */ + int export_side_data; + + /** + * The number of pixels per image to maximally accept. + * + * - decoding: set by user + * - encoding: set by user + */ + int64_t max_pixels; + + /** + * Video decoding only. Certain video codecs support cropping, meaning that + * only a sub-rectangle of the decoded frame is intended for display. This + * option controls how cropping is handled by libavcodec. + * + * When set to 1 (the default), libavcodec will apply cropping internally. + * I.e. it will modify the output frame width/height fields and offset the + * data pointers (only by as much as possible while preserving alignment, or + * by the full amount if the AV_CODEC_FLAG_UNALIGNED flag is set) so that + * the frames output by the decoder refer only to the cropped area. The + * crop_* fields of the output frames will be zero. + * + * When set to 0, the width/height fields of the output frames will be set + * to the coded dimensions and the crop_* fields will describe the cropping + * rectangle. Applying the cropping is left to the caller. + * + * @warning When hardware acceleration with opaque output frames is used, + * libavcodec is unable to apply cropping from the top/left border. + * + * @note when this option is set to zero, the width/height fields of the + * AVCodecContext and output AVFrames have different meanings. The codec + * context fields store display dimensions (with the coded dimensions in + * coded_width/height), while the frame fields store the coded dimensions + * (with the display dimensions being determined by the crop_* fields). + */ + int apply_cropping; + + /** + * The percentage of damaged samples to discard a frame. + * + * - decoding: set by user + * - encoding: unused + */ + int discard_damaged_percentage; + + /** + * The number of samples per frame to maximally accept. + * + * - decoding: set by user + * - encoding: set by user + */ + int64_t max_samples; + + /** + * This callback is called at the beginning of each packet to get a data + * buffer for it. + * + * The following field will be set in the packet before this callback is + * called: + * - size + * This callback must use the above value to calculate the required buffer size, + * which must padded by at least AV_INPUT_BUFFER_PADDING_SIZE bytes. + * + * In some specific cases, the encoder may not use the entire buffer allocated by this + * callback. This will be reflected in the size value in the packet once returned by + * avcodec_receive_packet(). + * + * This callback must fill the following fields in the packet: + * - data: alignment requirements for AVPacket apply, if any. Some architectures and + * encoders may benefit from having aligned data. + * - buf: must contain a pointer to an AVBufferRef structure. The packet's + * data pointer must be contained in it. See: av_buffer_create(), av_buffer_alloc(), + * and av_buffer_ref(). + * + * If AV_CODEC_CAP_DR1 is not set then get_encode_buffer() must call + * avcodec_default_get_encode_buffer() instead of providing a buffer allocated by + * some other means. + * + * The flags field may contain a combination of AV_GET_ENCODE_BUFFER_FLAG_ flags. + * They may be used for example to hint what use the buffer may get after being + * created. + * Implementations of this callback may ignore flags they don't understand. + * If AV_GET_ENCODE_BUFFER_FLAG_REF is set in flags then the packet may be reused + * (read and/or written to if it is writable) later by libavcodec. + * + * This callback must be thread-safe, as when frame threading is used, it may + * be called from multiple threads simultaneously. + * + * @see avcodec_default_get_encode_buffer() + * + * - encoding: Set by libavcodec, user can override. + * - decoding: unused + */ + int (*get_encode_buffer)(struct AVCodecContext *s, AVPacket *pkt, int flags); + + /** + * Frame counter, set by libavcodec. + * + * - decoding: total number of frames returned from the decoder so far. + * - encoding: total number of frames passed to the encoder so far. + * + * @note the counter is not incremented if encoding/decoding resulted in + * an error. + */ + int64_t frame_num; + + /** + * Decoding only. May be set by the caller before avcodec_open2() to an + * av_malloc()'ed array (or via AVOptions). Owned and freed by the decoder + * afterwards. + * + * Side data attached to decoded frames may come from several sources: + * 1. coded_side_data, which the decoder will for certain types translate + * from packet-type to frame-type and attach to frames; + * 2. side data attached to an AVPacket sent for decoding (same + * considerations as above); + * 3. extracted from the coded bytestream. + * The first two cases are supplied by the caller and typically come from a + * container. + * + * This array configures decoder behaviour in cases when side data of the + * same type is present both in the coded bytestream and in the + * user-supplied side data (items 1. and 2. above). In all cases, at most + * one instance of each side data type will be attached to output frames. By + * default it will be the bytestream side data. Adding an + * AVPacketSideDataType value to this array will flip the preference for + * this type, thus making the decoder prefer user-supplied side data over + * bytestream. In case side data of the same type is present both in + * coded_data and attacked to a packet, the packet instance always has + * priority. + * + * The array may also contain a single -1, in which case the preference is + * switched for all side data types. + */ + int *side_data_prefer_packet; + /** + * Number of entries in side_data_prefer_packet. + */ + unsigned nb_side_data_prefer_packet; + + /** + * Array containing static side data, such as HDR10 CLL / MDCV structures. + * Side data entries should be allocated by usage of helpers defined in + * libavutil/frame.h. + * + * - encoding: may be set by user before calling avcodec_open2() for + * encoder configuration. Afterwards owned and freed by the + * encoder. + * - decoding: may be set by libavcodec in avcodec_open2(). + */ + AVFrameSideData **decoded_side_data; + int nb_decoded_side_data; + + /** + * Indicates how the alpha channel of the video is represented. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; +} AVCodecContext; + +/** + * @defgroup lavc_hwaccel AVHWAccel + * + * @note Nothing in this structure should be accessed by the user. At some + * point in future it will not be externally visible at all. + * + * @{ + */ +typedef struct AVHWAccel { + /** + * Name of the hardware accelerated codec. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + */ + const char *name; + + /** + * Type of codec implemented by the hardware accelerator. + * + * See AVMEDIA_TYPE_xxx + */ + enum AVMediaType type; + + /** + * Codec implemented by the hardware accelerator. + * + * See AV_CODEC_ID_xxx + */ + enum AVCodecID id; + + /** + * Supported pixel format. + * + * Only hardware accelerated formats are supported here. + */ + enum AVPixelFormat pix_fmt; + + /** + * Hardware accelerated codec capabilities. + * see AV_HWACCEL_CODEC_CAP_* + */ + int capabilities; +} AVHWAccel; + +/** + * HWAccel is experimental and is thus avoided in favor of non experimental + * codecs + */ +#define AV_HWACCEL_CODEC_CAP_EXPERIMENTAL 0x0200 + +/** + * Hardware acceleration should be used for decoding even if the codec level + * used is unknown or higher than the maximum supported level reported by the + * hardware driver. + * + * It's generally a good idea to pass this flag unless you have a specific + * reason not to, as hardware tends to under-report supported levels. + */ +#define AV_HWACCEL_FLAG_IGNORE_LEVEL (1 << 0) + +/** + * Hardware acceleration can output YUV pixel formats with a different chroma + * sampling than 4:2:0 and/or other than 8 bits per component. + */ +#define AV_HWACCEL_FLAG_ALLOW_HIGH_DEPTH (1 << 1) + +/** + * Hardware acceleration should still be attempted for decoding when the + * codec profile does not match the reported capabilities of the hardware. + * + * For example, this can be used to try to decode baseline profile H.264 + * streams in hardware - it will often succeed, because many streams marked + * as baseline profile actually conform to constrained baseline profile. + * + * @warning If the stream is actually not supported then the behaviour is + * undefined, and may include returning entirely incorrect output + * while indicating success. + */ +#define AV_HWACCEL_FLAG_ALLOW_PROFILE_MISMATCH (1 << 2) + +/** + * Some hardware decoders (namely nvdec) can either output direct decoder + * surfaces, or make an on-device copy and return said copy. + * There is a hard limit on how many decoder surfaces there can be, and it + * cannot be accurately guessed ahead of time. + * For some processing chains, this can be okay, but others will run into the + * limit and in turn produce very confusing errors that require fine tuning of + * more or less obscure options by the user, or in extreme cases cannot be + * resolved at all without inserting an avfilter that forces a copy. + * + * Thus, the hwaccel will by default make a copy for safety and resilience. + * If a users really wants to minimize the amount of copies, they can set this + * flag and ensure their processing chain does not exhaust the surface pool. + */ +#define AV_HWACCEL_FLAG_UNSAFE_OUTPUT (1 << 3) + +/** + * @} + */ + +enum AVSubtitleType { + SUBTITLE_NONE, + + SUBTITLE_BITMAP, ///< A bitmap, pict will be set + + /** + * Plain text, the text field must be set by the decoder and is + * authoritative. ass and pict fields may contain approximations. + */ + SUBTITLE_TEXT, + + /** + * Formatted text, the ass field must be set by the decoder and is + * authoritative. pict and text fields may contain approximations. + */ + SUBTITLE_ASS, +}; + +#define AV_SUBTITLE_FLAG_FORCED 0x00000001 + +typedef struct AVSubtitleRect { + int x; ///< top left corner of pict, undefined when pict is not set + int y; ///< top left corner of pict, undefined when pict is not set + int w; ///< width of pict, undefined when pict is not set + int h; ///< height of pict, undefined when pict is not set + int nb_colors; ///< number of colors in pict, undefined when pict is not set + + /** + * data+linesize for the bitmap of this subtitle. + * Can be set for text/ass as well once they are rendered. + */ + uint8_t *data[4]; + int linesize[4]; + + int flags; + enum AVSubtitleType type; + + char *text; ///< 0 terminated plain UTF-8 text + + /** + * 0 terminated ASS/SSA compatible event line. + * The presentation of this is unaffected by the other values in this + * struct. + */ + char *ass; +} AVSubtitleRect; + +typedef struct AVSubtitle { + uint16_t format; /* 0 = graphics */ + uint32_t start_display_time; /* relative to packet pts, in ms */ + uint32_t end_display_time; /* relative to packet pts, in ms */ + unsigned num_rects; + AVSubtitleRect **rects; + int64_t pts; ///< Same as packet pts, in AV_TIME_BASE +} AVSubtitle; + +/** + * Return the LIBAVCODEC_VERSION_INT constant. + */ +unsigned avcodec_version(void); + +/** + * Return the libavcodec build-time configuration. + */ +const char *avcodec_configuration(void); + +/** + * Return the libavcodec license. + */ +const char *avcodec_license(void); + +/** + * Allocate an AVCodecContext and set its fields to default values. The + * resulting struct should be freed with avcodec_free_context(). + * + * @param codec if non-NULL, allocate private data and initialize defaults + * for the given codec. It is illegal to then call avcodec_open2() + * with a different codec. + * If NULL, then the codec-specific defaults won't be initialized, + * which may result in suboptimal default settings (this is + * important mainly for encoders, e.g. libx264). + * + * @return An AVCodecContext filled with default values or NULL on failure. + */ +AVCodecContext *avcodec_alloc_context3(const AVCodec *codec); + +/** + * Free the codec context and everything associated with it and write NULL to + * the provided pointer. + */ +void avcodec_free_context(AVCodecContext **avctx); + +/** + * Get the AVClass for AVCodecContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_class(void); + +/** + * Get the AVClass for AVSubtitleRect. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *avcodec_get_subtitle_rect_class(void); + +/** + * Fill the parameters struct based on the values from the supplied codec + * context. Any allocated fields in par are freed and replaced with duplicates + * of the corresponding fields in codec. + * + * @return >= 0 on success, a negative AVERROR code on failure + */ +int avcodec_parameters_from_context(struct AVCodecParameters *par, + const AVCodecContext *codec); + +/** + * Fill the codec context based on the values from the supplied codec + * parameters. Any allocated fields in codec that have a corresponding field in + * par are freed and replaced with duplicates of the corresponding field in par. + * Fields in codec that do not have a counterpart in par are not touched. + * + * @return >= 0 on success, a negative AVERROR code on failure. + */ +int avcodec_parameters_to_context(AVCodecContext *codec, + const struct AVCodecParameters *par); + +/** + * Initialize the AVCodecContext to use the given AVCodec. Prior to using this + * function the context has to be allocated with avcodec_alloc_context3(). + * + * The functions avcodec_find_decoder_by_name(), avcodec_find_encoder_by_name(), + * avcodec_find_decoder() and avcodec_find_encoder() provide an easy way for + * retrieving a codec. + * + * Depending on the codec, you might need to set options in the codec context + * also for decoding (e.g. width, height, or the pixel or audio sample format in + * the case the information is not available in the bitstream, as when decoding + * raw audio or video). + * + * Options in the codec context can be set either by setting them in the options + * AVDictionary, or by setting the values in the context itself, directly or by + * using the av_opt_set() API before calling this function. + * + * Example: + * @code + * av_dict_set(&opts, "b", "2.5M", 0); + * codec = avcodec_find_decoder(AV_CODEC_ID_H264); + * if (!codec) + * exit(1); + * + * context = avcodec_alloc_context3(codec); + * + * if (avcodec_open2(context, codec, opts) < 0) + * exit(1); + * @endcode + * + * In the case AVCodecParameters are available (e.g. when demuxing a stream + * using libavformat, and accessing the AVStream contained in the demuxer), the + * codec parameters can be copied to the codec context using + * avcodec_parameters_to_context(), as in the following example: + * + * @code + * AVStream *stream = ...; + * context = avcodec_alloc_context3(codec); + * if (avcodec_parameters_to_context(context, stream->codecpar) < 0) + * exit(1); + * if (avcodec_open2(context, codec, NULL) < 0) + * exit(1); + * @endcode + * + * @note Always call this function before using decoding routines (such as + * @ref avcodec_receive_frame()). + * + * @param avctx The context to initialize. + * @param codec The codec to open this context for. If a non-NULL codec has been + * previously passed to avcodec_alloc_context3() or + * for this context, then this parameter MUST be either NULL or + * equal to the previously passed codec. + * @param options A dictionary filled with AVCodecContext and codec-private + * options, which are set on top of the options already set in + * avctx, can be NULL. On return this object will be filled with + * options that were not found in the avctx codec context. + * + * @return zero on success, a negative value on error + * @see avcodec_alloc_context3(), avcodec_find_decoder(), avcodec_find_encoder(), + * av_dict_set(), av_opt_set(), av_opt_find(), avcodec_parameters_to_context() + */ +int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); + +/** + * Free all allocated data in the given subtitle struct. + * + * @param sub AVSubtitle to free. + */ +void avsubtitle_free(AVSubtitle *sub); + +/** + * @} + */ + +/** + * @addtogroup lavc_decoding + * @{ + */ + +/** + * The default callback for AVCodecContext.get_buffer2(). It is made public so + * it can be called by custom get_buffer2() implementations for decoders without + * AV_CODEC_CAP_DR1 set. + */ +int avcodec_default_get_buffer2(AVCodecContext *s, AVFrame *frame, int flags); + +/** + * The default callback for AVCodecContext.get_encode_buffer(). It is made public so + * it can be called by custom get_encode_buffer() implementations for encoders without + * AV_CODEC_CAP_DR1 set. + */ +int avcodec_default_get_encode_buffer(AVCodecContext *s, AVPacket *pkt, int flags); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you do not use any horizontal + * padding. + * + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height); + +/** + * Modify width and height values so that they will result in a memory + * buffer that is acceptable for the codec if you also ensure that all + * line sizes are a multiple of the respective linesize_align[i]. + * + * May only be used if a codec with AV_CODEC_CAP_DR1 has been opened. + */ +void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, + int linesize_align[AV_NUM_DATA_POINTERS]); + +/** + * Decode a subtitle message. + * Return a negative value on error, otherwise return the number of bytes used. + * If no subtitle could be decompressed, got_sub_ptr is zero. + * Otherwise, the subtitle is stored in *sub. + * Note that AV_CODEC_CAP_DR1 is not available for subtitle codecs. This is for + * simplicity, because the performance difference is expected to be negligible + * and reusing a get_buffer written for video codecs would probably perform badly + * due to a potentially very different allocation pattern. + * + * Some decoders (those marked with AV_CODEC_CAP_DELAY) have a delay between input + * and output. This means that for some packets they will not immediately + * produce decoded output and need to be flushed at the end of decoding to get + * all the decoded data. Flushing is done by calling this function with packets + * with avpkt->data set to NULL and avpkt->size set to 0 until it stops + * returning subtitles. It is safe to flush even those decoders that are not + * marked with AV_CODEC_CAP_DELAY, then no subtitles will be returned. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx the codec context + * @param[out] sub The preallocated AVSubtitle in which the decoded subtitle will be stored, + * must be freed with avsubtitle_free if *got_sub_ptr is set. + * @param[in,out] got_sub_ptr Zero if no subtitle could be decompressed, otherwise, it is nonzero. + * @param[in] avpkt The input AVPacket containing the input buffer. + */ +int avcodec_decode_subtitle2(AVCodecContext *avctx, AVSubtitle *sub, + int *got_sub_ptr, const AVPacket *avpkt); + +/** + * Supply raw packet data as input to a decoder. + * + * Internally, this call will copy relevant AVCodecContext fields, which can + * influence decoding per-packet, and apply them when the packet is actually + * decoded. (For example AVCodecContext.skip_frame, which might direct the + * decoder to drop the frame contained by the packet sent with this function.) + * + * @warning The input buffer, avpkt->data must be AV_INPUT_BUFFER_PADDING_SIZE + * larger than the actual read bytes because some optimized bitstream + * readers read 32 or 64 bits at once and could read over the end. + * + * @note The AVCodecContext MUST have been opened with @ref avcodec_open2() + * before packets may be fed to the decoder. + * + * @param avctx codec context + * @param[in] avpkt The input AVPacket. Usually, this will be a single video + * frame, or several complete audio frames. + * Ownership of the packet remains with the caller, and the + * decoder will not write to the packet. The decoder may create + * a reference to the packet data (or copy it if the packet is + * not reference-counted). + * Unlike with older APIs, the packet is always fully consumed, + * and if it contains multiple frames (e.g. some audio codecs), + * will require you to call avcodec_receive_frame() multiple + * times afterwards before you can send a new packet. + * It can be NULL (or an AVPacket with data set to NULL and + * size set to 0); in this case, it is considered a flush + * packet, which signals the end of the stream. Sending the + * first flush packet will return success. Subsequent ones are + * unnecessary and will return AVERROR_EOF. If the decoder + * still has frames buffered, it will return them after sending + * a flush packet. + * + * @retval 0 success + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user + * must read output with avcodec_receive_frame() (once + * all output is read, the packet should be resent, + * and the call will not fail with EAGAIN). + * @retval AVERROR_EOF the decoder has been flushed, and no new packets can be + * sent to it (also returned if more than 1 flush + * packet is sent) + * @retval AVERROR(EINVAL) codec not opened, it is an encoder, or requires flush + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar + * @retval "another negative error code" legitimate decoding errors + */ +int avcodec_send_packet(AVCodecContext *avctx, const AVPacket *avpkt); + +/** + * Return decoded output data from a decoder or encoder (when the + * @ref AV_CODEC_FLAG_RECON_FRAME flag is used). + * + * @param avctx codec context + * @param frame This will be set to a reference-counted video or audio + * frame (depending on the decoder type) allocated by the + * codec. Note that the function will always call + * av_frame_unref(frame) before doing anything else. + * @param flags Combination of AV_CODEC_RECEIVE_FRAME_FLAG_* flags. + * + * @retval 0 success, a frame was returned + * @retval AVERROR(EAGAIN) output is not available in this state - user must + * try to send new input + * @retval AVERROR_EOF the codec has been fully flushed, and there will be + * no more output frames + * @retval AVERROR(EINVAL) codec not opened, or it is an encoder without the + * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled + * @retval "other negative error code" legitimate decoding errors + */ +int avcodec_receive_frame_flags(AVCodecContext *avctx, AVFrame *frame, unsigned flags); + +/** + * Alias for `avcodec_receive_frame_flags(avctx, frame, 0)`. + */ +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); + +/** + * Supply a raw video or audio frame to the encoder. Use avcodec_receive_packet() + * to retrieve buffered output packets. + * + * @param avctx codec context + * @param[in] frame AVFrame containing the raw audio or video frame to be encoded. + * Ownership of the frame remains with the caller, and the + * encoder will not write to the frame. The encoder may create + * a reference to the frame data (or copy it if the frame is + * not reference-counted). + * It can be NULL, in which case it is considered a flush + * packet. This signals the end of the stream. If the encoder + * still has packets buffered, it will return them after this + * call. Once flushing mode has been entered, additional flush + * packets are ignored, and sending frames will return + * AVERROR_EOF. + * + * For audio: + * If AV_CODEC_CAP_VARIABLE_FRAME_SIZE is set, then each frame + * can have any number of samples. + * If it is not set, frame->nb_samples must be equal to + * avctx->frame_size for all frames except the last. + * The final frame may be smaller than avctx->frame_size. + * @retval 0 success + * @retval AVERROR(EAGAIN) input is not accepted in the current state - user must + * read output with avcodec_receive_packet() (once all + * output is read, the packet should be resent, and the + * call will not fail with EAGAIN). + * @retval AVERROR_EOF the encoder has been flushed, and no new frames can + * be sent to it + * @retval AVERROR(EINVAL) codec not opened, it is a decoder, or requires flush + * @retval AVERROR(ENOMEM) failed to add packet to internal queue, or similar + * @retval "another negative error code" legitimate encoding errors + */ +int avcodec_send_frame(AVCodecContext *avctx, const AVFrame *frame); + +/** + * Read encoded data from the encoder. + * + * @param avctx codec context + * @param avpkt This will be set to a reference-counted packet allocated by the + * encoder. Note that the function will always call + * av_packet_unref(avpkt) before doing anything else. + * @retval 0 success + * @retval AVERROR(EAGAIN) output is not available in the current state - user must + * try to send input + * @retval AVERROR_EOF the encoder has been fully flushed, and there will be no + * more output packets + * @retval AVERROR(EINVAL) codec not opened, or it is a decoder + * @retval "another negative error code" legitimate encoding errors + */ +int avcodec_receive_packet(AVCodecContext *avctx, AVPacket *avpkt); + +/** + * Create and return a AVHWFramesContext with values adequate for hardware + * decoding. This is meant to get called from the get_format callback, and is + * a helper for preparing a AVHWFramesContext for AVCodecContext.hw_frames_ctx. + * This API is for decoding with certain hardware acceleration modes/APIs only. + * + * The returned AVHWFramesContext is not initialized. The caller must do this + * with av_hwframe_ctx_init(). + * + * Calling this function is not a requirement, but makes it simpler to avoid + * codec or hardware API specific details when manually allocating frames. + * + * Alternatively to this, an API user can set AVCodecContext.hw_device_ctx, + * which sets up AVCodecContext.hw_frames_ctx fully automatically, and makes + * it unnecessary to call this function or having to care about + * AVHWFramesContext initialization at all. + * + * There are a number of requirements for calling this function: + * + * - It must be called from get_format with the same avctx parameter that was + * passed to get_format. Calling it outside of get_format is not allowed, and + * can trigger undefined behavior. + * - The function is not always supported (see description of return values). + * Even if this function returns successfully, hwaccel initialization could + * fail later. (The degree to which implementations check whether the stream + * is actually supported varies. Some do this check only after the user's + * get_format callback returns.) + * - The hw_pix_fmt must be one of the choices suggested by get_format. If the + * user decides to use a AVHWFramesContext prepared with this API function, + * the user must return the same hw_pix_fmt from get_format. + * - The device_ref passed to this function must support the given hw_pix_fmt. + * - After calling this API function, it is the user's responsibility to + * initialize the AVHWFramesContext (returned by the out_frames_ref parameter), + * and to set AVCodecContext.hw_frames_ctx to it. If done, this must be done + * before returning from get_format (this is implied by the normal + * AVCodecContext.hw_frames_ctx API rules). + * - The AVHWFramesContext parameters may change every time time get_format is + * called. Also, AVCodecContext.hw_frames_ctx is reset before get_format. So + * you are inherently required to go through this process again on every + * get_format call. + * - It is perfectly possible to call this function without actually using + * the resulting AVHWFramesContext. One use-case might be trying to reuse a + * previously initialized AVHWFramesContext, and calling this API function + * only to test whether the required frame parameters have changed. + * - Fields that use dynamically allocated values of any kind must not be set + * by the user unless setting them is explicitly allowed by the documentation. + * If the user sets AVHWFramesContext.free and AVHWFramesContext.user_opaque, + * the new free callback must call the potentially set previous free callback. + * This API call may set any dynamically allocated fields, including the free + * callback. + * + * The function will set at least the following fields on AVHWFramesContext + * (potentially more, depending on hwaccel API): + * + * - All fields set by av_hwframe_ctx_alloc(). + * - Set the format field to hw_pix_fmt. + * - Set the sw_format field to the most suited and most versatile format. (An + * implication is that this will prefer generic formats over opaque formats + * with arbitrary restrictions, if possible.) + * - Set the width/height fields to the coded frame size, rounded up to the + * API-specific minimum alignment. + * - Only _if_ the hwaccel requires a pre-allocated pool: set the initial_pool_size + * field to the number of maximum reference surfaces possible with the codec, + * plus 1 surface for the user to work (meaning the user can safely reference + * at most 1 decoded surface at a time), plus additional buffering introduced + * by frame threading. If the hwaccel does not require pre-allocation, the + * field is left to 0, and the decoder will allocate new surfaces on demand + * during decoding. + * - Possibly AVHWFramesContext.hwctx fields, depending on the underlying + * hardware API. + * + * Essentially, out_frames_ref returns the same as av_hwframe_ctx_alloc(), but + * with basic frame parameters set. + * + * The function is stateless, and does not change the AVCodecContext or the + * device_ref AVHWDeviceContext. + * + * @param avctx The context which is currently calling get_format, and which + * implicitly contains all state needed for filling the returned + * AVHWFramesContext properly. + * @param device_ref A reference to the AVHWDeviceContext describing the device + * which will be used by the hardware decoder. + * @param hw_pix_fmt The hwaccel format you are going to return from get_format. + * @param out_frames_ref On success, set to a reference to an _uninitialized_ + * AVHWFramesContext, created from the given device_ref. + * Fields will be set to values required for decoding. + * Not changed if an error is returned. + * @return zero on success, a negative value on error. The following error codes + * have special semantics: + * AVERROR(ENOENT): the decoder does not support this functionality. Setup + * is always manual, or it is a decoder which does not + * support setting AVCodecContext.hw_frames_ctx at all, + * or it is a software format. + * AVERROR(EINVAL): it is known that hardware decoding is not supported for + * this configuration, or the device_ref is not supported + * for the hwaccel referenced by hw_pix_fmt. + */ +int avcodec_get_hw_frames_parameters(AVCodecContext *avctx, + AVBufferRef *device_ref, + enum AVPixelFormat hw_pix_fmt, + AVBufferRef **out_frames_ref); + +enum AVCodecConfig { + AV_CODEC_CONFIG_PIX_FORMAT, ///< AVPixelFormat, terminated by AV_PIX_FMT_NONE + AV_CODEC_CONFIG_FRAME_RATE, ///< AVRational, terminated by {0, 0} + AV_CODEC_CONFIG_SAMPLE_RATE, ///< int, terminated by 0 + AV_CODEC_CONFIG_SAMPLE_FORMAT, ///< AVSampleFormat, terminated by AV_SAMPLE_FMT_NONE + AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0} + AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED + AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED + AV_CODEC_CONFIG_ALPHA_MODE, ///< AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED +}; + +/** + * Retrieve a list of all supported values for a given configuration type. + * + * @param avctx An optional context to use. Values such as + * `strict_std_compliance` may affect the result. If NULL, + * default values are used. + * @param codec The codec to query, or NULL to use avctx->codec. + * @param config The configuration to query. + * @param flags Currently unused; should be set to zero. + * @param out_configs On success, set to a list of configurations, terminated + * by a config-specific terminator, or NULL if all + * possible values are supported. + * @param out_num_configs On success, set to the number of elements in + *out_configs, excluding the terminator. Optional. + */ +int avcodec_get_supported_config(const AVCodecContext *avctx, + const AVCodec *codec, enum AVCodecConfig config, + unsigned flags, const void **out_configs, + int *out_num_configs); + + + +/** + * @defgroup lavc_parsing Frame parsing + * @{ + */ + +enum AVPictureStructure { + AV_PICTURE_STRUCTURE_UNKNOWN, ///< unknown + AV_PICTURE_STRUCTURE_TOP_FIELD, ///< coded as top field + AV_PICTURE_STRUCTURE_BOTTOM_FIELD, ///< coded as bottom field + AV_PICTURE_STRUCTURE_FRAME, ///< coded as frame +}; + +typedef struct AVCodecParserContext { + void *priv_data; + const struct AVCodecParser *parser; + int64_t frame_offset; /* offset of the current frame */ + int64_t cur_offset; /* current offset + (incremented by each av_parser_parse()) */ + int64_t next_frame_offset; /* offset of the next frame */ + /* video info */ + int pict_type; /* XXX: Put it back in AVCodecContext. */ + /** + * This field is used for proper frame duration computation in lavf. + * It signals, how much longer the frame duration of the current frame + * is compared to normal frame duration. + * + * frame_duration = (1 + repeat_pict) * time_base + * + * It is used by codecs like H.264 to display telecined material. + */ + int repeat_pict; /* XXX: Put it back in AVCodecContext. */ + int64_t pts; /* pts of the current frame */ + int64_t dts; /* dts of the current frame */ + + /* private data */ + int64_t last_pts; + int64_t last_dts; + int fetch_timestamp; + +#define AV_PARSER_PTS_NB 4 + int cur_frame_start_index; + int64_t cur_frame_offset[AV_PARSER_PTS_NB]; + int64_t cur_frame_pts[AV_PARSER_PTS_NB]; + int64_t cur_frame_dts[AV_PARSER_PTS_NB]; + + int flags; +#define PARSER_FLAG_COMPLETE_FRAMES 0x0001 +#define PARSER_FLAG_ONCE 0x0002 +/// Set if the parser has a valid file offset +#define PARSER_FLAG_FETCHED_OFFSET 0x0004 +#define PARSER_FLAG_USE_CODEC_TS 0x1000 + + int64_t offset; ///< byte offset from starting packet start + int64_t cur_frame_end[AV_PARSER_PTS_NB]; + + /** + * Set by parser to 1 for key frames and 0 for non-key frames. + * It is initialized to -1, so if the parser doesn't set this flag, + * old-style fallback using AV_PICTURE_TYPE_I picture type as key frames + * will be used. + */ + int key_frame; + + // Timestamp generation support: + /** + * Synchronization point for start of timestamp generation. + * + * Set to >0 for sync point, 0 for no sync point and <0 for undefined + * (default). + * + * For example, this corresponds to presence of H.264 buffering period + * SEI message. + */ + int dts_sync_point; + + /** + * Offset of the current timestamp against last timestamp sync point in + * units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain a valid timestamp offset. + * + * Note that the timestamp of sync point has usually a nonzero + * dts_ref_dts_delta, which refers to the previous sync point. Offset of + * the next frame after timestamp sync point will be usually 1. + * + * For example, this corresponds to H.264 cpb_removal_delay. + */ + int dts_ref_dts_delta; + + /** + * Presentation delay of current frame in units of AVCodecContext.time_base. + * + * Set to INT_MIN when dts_sync_point unused. Otherwise, it must + * contain valid non-negative timestamp delta (presentation time of a frame + * must not lie in the past). + * + * This delay represents the difference between decoding and presentation + * time of the frame. + * + * For example, this corresponds to H.264 dpb_output_delay. + */ + int pts_dts_delta; + + /** + * Position of the packet in file. + * + * Analogous to cur_frame_pts/dts + */ + int64_t cur_frame_pos[AV_PARSER_PTS_NB]; + + /** + * Byte position of currently parsed frame in stream. + */ + int64_t pos; + + /** + * Previous frame byte position. + */ + int64_t last_pos; + + /** + * Duration of the current frame. + * For audio, this is in units of 1 / AVCodecContext.sample_rate. + * For all other types, this is in units of AVCodecContext.time_base. + */ + int duration; + + enum AVFieldOrder field_order; + + /** + * Indicate whether a picture is coded as a frame, top field or bottom field. + * + * For example, H.264 field_pic_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_FRAME. An H.264 picture with field_pic_flag + * equal to 1 and bottom_field_flag equal to 0 corresponds to + * AV_PICTURE_STRUCTURE_TOP_FIELD. + */ + enum AVPictureStructure picture_structure; + + /** + * Picture number incremented in presentation or output order. + * This field may be reinitialized at the first picture of a new sequence. + * + * For example, this corresponds to H.264 PicOrderCnt. + */ + int output_picture_number; + + /** + * Dimensions of the decoded video intended for presentation. + */ + int width; + int height; + + /** + * Dimensions of the coded video. + */ + int coded_width; + int coded_height; + + /** + * The format of the coded data, corresponds to enum AVPixelFormat for video + * and for enum AVSampleFormat for audio. + * + * Note that a decoder can have considerable freedom in how exactly it + * decodes the data, so the format reported here might be different from the + * one returned by a decoder. + */ + int format; +} AVCodecParserContext; + +typedef struct AVCodecParser { +#if FF_API_PARSER_CODECID + int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif +#if FF_API_PARSER_PRIVATE + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + attribute_deprecated + int priv_data_size; + attribute_deprecated + int (*parser_init)(AVCodecParserContext *s); + /* This callback never returns an error, a negative value means that + * the frame start was in a previous packet. */ + attribute_deprecated + int (*parser_parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + attribute_deprecated + void (*parser_close)(AVCodecParserContext *s); + attribute_deprecated + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); +#endif +} AVCodecParser; + +/** + * Iterate over all registered codec parsers. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered codec parser or NULL when the iteration is + * finished + */ +const AVCodecParser *av_parser_iterate(void **opaque); + +#if FF_API_PARSER_CODECID +AVCodecParserContext *av_parser_init(int codec_id); +#else +AVCodecParserContext *av_parser_init(enum AVCodecID codec_id); +#endif + +/** + * Parse a packet. + * + * @param s parser context. + * @param avctx codec context. + * @param poutbuf set to pointer to parsed buffer or NULL if not yet finished. + * @param poutbuf_size set to size of parsed buffer or zero if not yet finished. + * @param buf input buffer. + * @param buf_size buffer size in bytes without the padding. I.e. the full buffer + size is assumed to be buf_size + AV_INPUT_BUFFER_PADDING_SIZE. + To signal EOF, this should be 0 (so that the last frame + can be output). + * @param pts input presentation timestamp. + * @param dts input decoding timestamp. + * @param pos input byte position in stream. + * @return the number of bytes of the input bitstream used. + * + * Example: + * @code + * while(in_len){ + * len = av_parser_parse2(myparser, AVCodecContext, &data, &size, + * in_data, in_len, + * pts, dts, pos); + * in_data += len; + * in_len -= len; + * + * if(size) + * decode_frame(data, size); + * } + * @endcode + */ +int av_parser_parse2(AVCodecParserContext *s, + AVCodecContext *avctx, + uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size, + int64_t pts, int64_t dts, + int64_t pos); + +void av_parser_close(AVCodecParserContext *s); + +/** + * @} + * @} + */ + +/** + * @addtogroup lavc_encoding + * @{ + */ + +int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, + const AVSubtitle *sub); + + +/** + * @} + */ + +/** + * @defgroup lavc_misc Utility functions + * @ingroup libavc + * + * Miscellaneous utility functions related to both encoding and decoding + * (or neither). + * @{ + */ + +/** + * @defgroup lavc_misc_pixfmt Pixel formats + * + * Functions for working with pixel formats. + * @{ + */ + +/** + * Return a value representing the fourCC code associated to the + * pixel format pix_fmt, or 0 if no associated fourCC code can be + * found. + */ +unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat pix_fmt); + +/** + * Find the best pixel format to convert to given a certain source pixel + * format. When converting from one pixel format to another, information loss + * may occur. For example, when converting from RGB24 to GRAY, the color + * information will be lost. Similarly, other losses occur when converting from + * some formats to other formats. avcodec_find_best_pix_fmt_of_2() searches which of + * the given pixel formats should be used to suffer the least amount of loss. + * The pixel formats from which it chooses one, are determined by the + * pix_fmt_list parameter. + * + * + * @param[in] pix_fmt_list AV_PIX_FMT_NONE terminated array of pixel formats to choose from + * @param[in] src_pix_fmt source pixel format + * @param[in] has_alpha Whether the source pixel format alpha channel is used. + * @param[out] loss_ptr Combination of flags informing you what kind of losses will occur. + * @return The best pixel format to convert to or -1 if none was found. + */ +enum AVPixelFormat avcodec_find_best_pix_fmt_of_list(const enum AVPixelFormat *pix_fmt_list, + enum AVPixelFormat src_pix_fmt, + int has_alpha, int *loss_ptr); + +enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *s, const enum AVPixelFormat * fmt); + +/** + * @} + */ + +void avcodec_string(char *buf, int buf_size, AVCodecContext *enc, int encode); + +int avcodec_default_execute(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2),void *arg, int *ret, int count, int size); +int avcodec_default_execute2(AVCodecContext *c, int (*func)(AVCodecContext *c2, void *arg2, int, int),void *arg, int *ret, int count); +//FIXME func typedef + +/** + * Fill AVFrame audio data and linesize pointers. + * + * The buffer buf must be a preallocated buffer with a size big enough + * to contain the specified samples amount. The filled AVFrame data + * pointers will point to this buffer. + * + * AVFrame extended_data channel pointers are allocated if necessary for + * planar audio. + * + * @param frame the AVFrame + * frame->nb_samples must be set prior to calling the + * function. This function fills in frame->data, + * frame->extended_data, frame->linesize[0]. + * @param nb_channels channel count + * @param sample_fmt sample format + * @param buf buffer to use for frame data + * @param buf_size size of buffer + * @param align plane size sample alignment (0 = default) + * @return >=0 on success, negative error code on failure + * @todo return the size in bytes required to store the samples in + * case of success, at the next libavutil bump + */ +int avcodec_fill_audio_frame(AVFrame *frame, int nb_channels, + enum AVSampleFormat sample_fmt, const uint8_t *buf, + int buf_size, int align); + +/** + * Reset the internal codec state / flush internal buffers. Should be called + * e.g. when seeking or when switching to a different stream. + * + * @note for decoders, this function just releases any references the decoder + * might keep internally, but the caller's references remain valid. + * + * @note for encoders, this function will only do something if the encoder + * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder + * will drain any remaining packets, and can then be reused for a different + * stream (as opposed to sending a null frame which will leave the encoder + * in a permanent EOF state after draining). This can be desirable if the + * cost of tearing down and replacing the encoder instance is high. + */ +void avcodec_flush_buffers(AVCodecContext *avctx); + +/** + * Return audio frame duration. + * + * @param avctx codec context + * @param frame_bytes size of the frame, or 0 if unknown + * @return frame duration, in samples, if known. 0 if not able to + * determine. + */ +int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes); + +/* memory */ + +/** + * Same behaviour av_fast_malloc but the buffer has additional + * AV_INPUT_BUFFER_PADDING_SIZE at the end which will always be 0. + * + * In addition the whole buffer will initially and after resizes + * be 0-initialized so that no uninitialized data will ever appear. + */ +void av_fast_padded_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Same behaviour av_fast_padded_malloc except that buffer will always + * be 0-initialized after call. + */ +void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** + * @return a positive value if s is open (i.e. avcodec_open2() was called on it), + * 0 otherwise. + */ +int avcodec_is_open(AVCodecContext *s); + +/** + * @} + */ + +#endif /* AVCODEC_AVCODEC_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avdct.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avdct.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avdct.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/avdct.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * 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 + */ + +#ifndef AVCODEC_AVDCT_H +#define AVCODEC_AVDCT_H + +#include "libavutil/opt.h" + +/** + * AVDCT context. + * @note function pointers can be NULL if the specific features have been + * disabled at build time. + */ +typedef struct AVDCT { + const AVClass *av_class; + + void (*idct)(int16_t *block /* align 16 */); + + /** + * IDCT input permutation. + * Several optimized IDCTs need a permutated input (relative to the + * normal order of the reference IDCT). + * This permutation must be performed before the idct_put/add. + * Note, normally this can be merged with the zigzag/alternate scan
+ * An example to avoid confusion: + * - (->decode coeffs -> zigzag reorder -> dequant -> reference IDCT -> ...) + * - (x -> reference DCT -> reference IDCT -> x) + * - (x -> reference DCT -> simple_mmx_perm = idct_permutation + * -> simple_idct_mmx -> x) + * - (-> decode coeffs -> zigzag reorder -> simple_mmx_perm -> dequant + * -> simple_idct_mmx -> ...) + */ + uint8_t idct_permutation[64]; + + void (*fdct)(int16_t *block /* align 16 */); + + + /** + * DCT algorithm. + * must use AVOptions to set this field. + */ + int dct_algo; + + /** + * IDCT algorithm. + * must use AVOptions to set this field. + */ + int idct_algo; + + void (*get_pixels)(int16_t *block /* align 16 */, + const uint8_t *pixels /* align 8 */, + ptrdiff_t line_size); + + int bits_per_sample; + + void (*get_pixels_unaligned)(int16_t *block /* align 16 */, + const uint8_t *pixels, + ptrdiff_t line_size); +} AVDCT; + +/** + * Allocates a AVDCT context. + * This needs to be initialized with avcodec_dct_init() after optionally + * configuring it with AVOptions. + * + * To free it use av_free() + */ +AVDCT *avcodec_dct_alloc(void); +int avcodec_dct_init(AVDCT *); + +const AVClass *avcodec_dct_get_class(void); + +#endif /* AVCODEC_AVDCT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/bsf.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/bsf.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/bsf.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/bsf.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,332 @@ +/* + * Bitstream filters public API + * + * 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 + */ + +#ifndef AVCODEC_BSF_H +#define AVCODEC_BSF_H + +#include "libavutil/dict.h" +#include "libavutil/log.h" +#include "libavutil/rational.h" + +#include "codec_id.h" +#include "codec_par.h" +#include "packet.h" + +/** + * @defgroup lavc_bsf Bitstream filters + * @ingroup libavc + * + * Bitstream filters transform encoded media data without decoding it. This + * allows e.g. manipulating various header values. Bitstream filters operate on + * @ref AVPacket "AVPackets". + * + * The bitstream filtering API is centered around two structures: + * AVBitStreamFilter and AVBSFContext. The former represents a bitstream filter + * in abstract, the latter a specific filtering process. Obtain an + * AVBitStreamFilter using av_bsf_get_by_name() or av_bsf_iterate(), then pass + * it to av_bsf_alloc() to create an AVBSFContext. Fill in the user-settable + * AVBSFContext fields, as described in its documentation, then call + * av_bsf_init() to prepare the filter context for use. + * + * Submit packets for filtering using av_bsf_send_packet(), obtain filtered + * results with av_bsf_receive_packet(). When no more input packets will be + * sent, submit a NULL AVPacket to signal the end of the stream to the filter. + * av_bsf_receive_packet() will then return trailing packets, if any are + * produced by the filter. + * + * Finally, free the filter context with av_bsf_free(). + * @{ + */ + +/** + * The bitstream filter state. + * + * This struct must be allocated with av_bsf_alloc() and freed with + * av_bsf_free(). + * + * The fields in the struct will only be changed (by the caller or by the + * filter) as described in their documentation, and are to be considered + * immutable otherwise. + */ +typedef struct AVBSFContext { + /** + * A class for logging and AVOptions + */ + const AVClass *av_class; + + /** + * The bitstream filter this context is an instance of. + */ + const struct AVBitStreamFilter *filter; + + /** + * Opaque filter-specific private data. If filter->priv_class is non-NULL, + * this is an AVOptions-enabled struct. + */ + void *priv_data; + + /** + * Parameters of the input stream. This field is allocated in + * av_bsf_alloc(), it needs to be filled by the caller before + * av_bsf_init(). + */ + AVCodecParameters *par_in; + + /** + * Parameters of the output stream. This field is allocated in + * av_bsf_alloc(), it is set by the filter in av_bsf_init(). + */ + AVCodecParameters *par_out; + + /** + * The timebase used for the timestamps of the input packets. Set by the + * caller before av_bsf_init(). + */ + AVRational time_base_in; + + /** + * The timebase used for the timestamps of the output packets. Set by the + * filter in av_bsf_init(). + */ + AVRational time_base_out; +} AVBSFContext; + +typedef struct AVBitStreamFilter { + const char *name; + + /** + * A list of codec ids supported by the filter, terminated by + * AV_CODEC_ID_NONE. + * May be NULL, in that case the bitstream filter works with any codec id. + */ + const enum AVCodecID *codec_ids; + + /** + * A class for the private data, used to declare bitstream filter private + * AVOptions. This field is NULL for bitstream filters that do not declare + * any options. + * + * If this field is non-NULL, the first member of the filter private data + * must be a pointer to AVClass, which will be set by libavcodec generic + * code to this class. + */ + const AVClass *priv_class; +} AVBitStreamFilter; + +/** + * @return a bitstream filter with the specified name or NULL if no such + * bitstream filter exists. + */ +const AVBitStreamFilter *av_bsf_get_by_name(const char *name); + +/** + * Iterate over all registered bitstream filters. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered bitstream filter or NULL when the iteration is + * finished + */ +const AVBitStreamFilter *av_bsf_iterate(void **opaque); + +/** + * Allocate a context for a given bitstream filter. The caller must fill in the + * context parameters as described in the documentation and then call + * av_bsf_init() before sending any data to the filter. + * + * @param filter the filter for which to allocate an instance. + * @param[out] ctx a pointer into which the pointer to the newly-allocated context + * will be written. It must be freed with av_bsf_free() after the + * filtering is done. + * + * @return 0 on success, a negative AVERROR code on failure + */ +int av_bsf_alloc(const AVBitStreamFilter *filter, AVBSFContext **ctx); + +/** + * Prepare the filter for use, after all the parameters and options have been + * set. + * + * @param ctx a AVBSFContext previously allocated with av_bsf_alloc() + */ +int av_bsf_init(AVBSFContext *ctx); + +/** + * Submit a packet for filtering. + * + * After sending each packet, the filter must be completely drained by calling + * av_bsf_receive_packet() repeatedly until it returns AVERROR(EAGAIN) or + * AVERROR_EOF. + * + * @param ctx an initialized AVBSFContext + * @param pkt the packet to filter. The bitstream filter will take ownership of + * the packet and reset the contents of pkt. pkt is not touched if an error occurs. + * If pkt is empty (i.e. NULL, or pkt->data is NULL and pkt->side_data_elems zero), + * it signals the end of the stream (i.e. no more non-empty packets will be sent; + * sending more empty packets does nothing) and will cause the filter to output + * any packets it may have buffered internally. + * + * @return + * - 0 on success. + * - AVERROR(EAGAIN) if packets need to be retrieved from the filter (using + * av_bsf_receive_packet()) before new input can be consumed. + * - Another negative AVERROR value if an error occurs. + */ +int av_bsf_send_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Retrieve a filtered packet. + * + * @param ctx an initialized AVBSFContext + * @param[out] pkt this struct will be filled with the contents of the filtered + * packet. It is owned by the caller and must be freed using + * av_packet_unref() when it is no longer needed. + * This parameter should be "clean" (i.e. freshly allocated + * with av_packet_alloc() or unreffed with av_packet_unref()) + * when this function is called. If this function returns + * successfully, the contents of pkt will be completely + * overwritten by the returned data. On failure, pkt is not + * touched. + * + * @return + * - 0 on success. + * - AVERROR(EAGAIN) if more packets need to be sent to the filter (using + * av_bsf_send_packet()) to get more output. + * - AVERROR_EOF if there will be no further output from the filter. + * - Another negative AVERROR value if an error occurs. + * + * @note one input packet may result in several output packets, so after sending + * a packet with av_bsf_send_packet(), this function needs to be called + * repeatedly until it stops returning 0. It is also possible for a filter to + * output fewer packets than were sent to it, so this function may return + * AVERROR(EAGAIN) immediately after a successful av_bsf_send_packet() call. + */ +int av_bsf_receive_packet(AVBSFContext *ctx, AVPacket *pkt); + +/** + * Reset the internal bitstream filter state. Should be called e.g. when seeking. + */ +void av_bsf_flush(AVBSFContext *ctx); + +/** + * Free a bitstream filter context and everything associated with it; write NULL + * into the supplied pointer. + */ +void av_bsf_free(AVBSFContext **ctx); + +/** + * Get the AVClass for AVBSFContext. It can be used in combination with + * AV_OPT_SEARCH_FAKE_OBJ for examining options. + * + * @see av_opt_find(). + */ +const AVClass *av_bsf_get_class(void); + +/** + * Structure for chain/list of bitstream filters. + * Empty list can be allocated by av_bsf_list_alloc(). + */ +typedef struct AVBSFList AVBSFList; + +/** + * Allocate empty list of bitstream filters. + * The list must be later freed by av_bsf_list_free() + * or finalized by av_bsf_list_finalize(). + * + * @return Pointer to @ref AVBSFList on success, NULL in case of failure + */ +AVBSFList *av_bsf_list_alloc(void); + +/** + * Free list of bitstream filters. + * + * @param lst Pointer to pointer returned by av_bsf_list_alloc() + */ +void av_bsf_list_free(AVBSFList **lst); + +/** + * Append bitstream filter to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf Filter context to be appended + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append(AVBSFList *lst, AVBSFContext *bsf); + +/** + * Construct new bitstream filter context given it's name and options + * and append it to the list of bitstream filters. + * + * @param lst List to append to + * @param bsf_name Name of the bitstream filter + * @param options Options for the bitstream filter, can be set to NULL + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_append2(AVBSFList *lst, const char * bsf_name, AVDictionary **options); +/** + * Finalize list of bitstream filters. + * + * This function will transform @ref AVBSFList to single @ref AVBSFContext, + * so the whole chain of bitstream filters can be treated as single filter + * freshly allocated by av_bsf_alloc(). + * If the call is successful, @ref AVBSFList structure is freed and lst + * will be set to NULL. In case of failure, caller is responsible for + * freeing the structure by av_bsf_list_free() + * + * @param lst Filter list structure to be transformed + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_finalize(AVBSFList **lst, AVBSFContext **bsf); + +/** + * Parse string describing list of bitstream filters and create single + * @ref AVBSFContext describing the whole chain of bitstream filters. + * Resulting @ref AVBSFContext can be treated as any other @ref AVBSFContext freshly + * allocated by av_bsf_alloc(). + * + * @param str String describing chain of bitstream filters in format + * `bsf1[=opt1=val1:opt2=val2][,bsf2]` + * @param[out] bsf Pointer to be set to newly created @ref AVBSFContext structure + * representing the chain of bitstream filters + * + * @return >=0 on success, negative AVERROR in case of failure + */ +int av_bsf_list_parse_str(const char *str, AVBSFContext **bsf); + +/** + * Get null/pass-through bitstream filter. + * + * @param[out] bsf Pointer to be set to new instance of pass-through bitstream filter + * + * @return + */ +int av_bsf_get_null_filter(AVBSFContext **bsf); + +/** + * @} + */ + +#endif // AVCODEC_BSF_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,367 @@ +/* + * AVCodec public API + * + * 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 + */ + +#ifndef AVCODEC_CODEC_H +#define AVCODEC_CODEC_H + +#include + +#include "libavutil/avutil.h" +#include "libavutil/hwcontext.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/rational.h" +#include "libavutil/samplefmt.h" + +#include "libavcodec/codec_id.h" +#include "libavcodec/version_major.h" + +/** + * @addtogroup lavc_core + * @{ + */ + +/** + * Decoder can use draw_horiz_band callback. + */ +#define AV_CODEC_CAP_DRAW_HORIZ_BAND (1 << 0) +/** + * Codec uses get_buffer() or get_encode_buffer() for allocating buffers and + * supports custom allocators. + * If not set, it might not use get_buffer() or get_encode_buffer() at all, or + * use operations that assume the buffer was allocated by + * avcodec_default_get_buffer2 or avcodec_default_get_encode_buffer. + */ +#define AV_CODEC_CAP_DR1 (1 << 1) +/** + * Encoder or decoder requires flushing with NULL input at the end in order to + * give the complete and correct output. + * + * NOTE: If this flag is not set, the codec is guaranteed to never be fed with + * with NULL data. The user can still send NULL data to the public encode + * or decode function, but libavcodec will not pass it along to the codec + * unless this flag is set. + * + * Decoders: + * The decoder has a non-zero delay and needs to be fed with avpkt->data=NULL, + * avpkt->size=0 at the end to get the delayed data until the decoder no longer + * returns frames. + * + * Encoders: + * The encoder needs to be fed with NULL data at the end of encoding until the + * encoder no longer returns data. + * + * NOTE: For encoders implementing the AVCodec.encode2() function, setting this + * flag also means that the encoder must set the pts and duration for + * each output packet. If this flag is not set, the pts and duration will + * be determined by libavcodec from the input frame. + */ +#define AV_CODEC_CAP_DELAY (1 << 5) +/** + * Codec can be fed a final frame with a smaller size. + * This can be used to prevent truncation of the last audio samples. + */ +#define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) + +/** + * Codec is experimental and is thus avoided in favor of non experimental + * encoders + */ +#define AV_CODEC_CAP_EXPERIMENTAL (1 << 9) +/** + * Codec should fill in channel configuration and samplerate instead of container + */ +#define AV_CODEC_CAP_CHANNEL_CONF (1 << 10) +/** + * Codec supports frame-level multithreading. + */ +#define AV_CODEC_CAP_FRAME_THREADS (1 << 12) +/** + * Codec supports slice-based (or partition-based) multithreading. + */ +#define AV_CODEC_CAP_SLICE_THREADS (1 << 13) +/** + * Codec supports changed parameters at any point. + */ +#define AV_CODEC_CAP_PARAM_CHANGE (1 << 14) +/** + * Codec supports multithreading through a method other than slice- or + * frame-level multithreading. Typically this marks wrappers around + * multithreading-capable external libraries. + */ +#define AV_CODEC_CAP_OTHER_THREADS (1 << 15) +/** + * Audio encoder supports receiving a different number of samples in each call. + */ +#define AV_CODEC_CAP_VARIABLE_FRAME_SIZE (1 << 16) +/** + * Decoder is not a preferred choice for probing. + * This indicates that the decoder is not a good choice for probing. + * It could for example be an expensive to spin up hardware decoder, + * or it could simply not provide a lot of useful information about + * the stream. + * A decoder marked with this flag should only be used as last resort + * choice for probing. + */ +#define AV_CODEC_CAP_AVOID_PROBING (1 << 17) + +/** + * Codec is backed by a hardware implementation. Typically used to + * identify a non-hwaccel hardware decoder. For information about hwaccels, use + * avcodec_get_hw_config() instead. + */ +#define AV_CODEC_CAP_HARDWARE (1 << 18) + +/** + * Codec is potentially backed by a hardware implementation, but not + * necessarily. This is used instead of AV_CODEC_CAP_HARDWARE, if the + * implementation provides some sort of internal fallback. + */ +#define AV_CODEC_CAP_HYBRID (1 << 19) + +/** + * This encoder can reorder user opaque values from input AVFrames and return + * them with corresponding output packets. + * @see AV_CODEC_FLAG_COPY_OPAQUE + */ +#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE (1 << 20) + +/** + * This encoder can be flushed using avcodec_flush_buffers(). If this flag is + * not set, the encoder must be closed and reopened to ensure that no frames + * remain pending. + */ +#define AV_CODEC_CAP_ENCODER_FLUSH (1 << 21) + +/** + * The encoder is able to output reconstructed frame data, i.e. raw frames that + * would be produced by decoding the encoded bitstream. + * + * Reconstructed frame output is enabled by the AV_CODEC_FLAG_RECON_FRAME flag. + */ +#define AV_CODEC_CAP_ENCODER_RECON_FRAME (1 << 22) + +/** + * AVProfile. + */ +typedef struct AVProfile { + int profile; + const char *name; ///< short name for the profile +} AVProfile; + +/** + * AVCodec. + */ +typedef struct AVCodec { + /** + * Name of the codec implementation. + * The name is globally unique among encoders and among decoders (but an + * encoder and a decoder can share the same name). + * This is the primary way to find a codec from the user perspective. + */ + const char *name; + /** + * Descriptive name for the codec, meant to be more human readable than name. + * You should use the NULL_IF_CONFIG_SMALL() macro to define it. + */ + const char *long_name; + enum AVMediaType type; + enum AVCodecID id; + /** + * Codec capabilities. + * see AV_CODEC_CAP_* + */ + int capabilities; + uint8_t max_lowres; ///< maximum value for lowres supported by the decoder + + /** + * Deprecated codec capabilities. + */ + attribute_deprecated + const AVRational *supported_framerates; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const enum AVPixelFormat *pix_fmts; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const int *supported_samplerates; ///< @deprecated use avcodec_get_supported_config() + attribute_deprecated + const enum AVSampleFormat *sample_fmts; ///< @deprecated use avcodec_get_supported_config() + + const AVClass *priv_class; ///< AVClass for the private context + const AVProfile *profiles; ///< array of recognized profiles, or NULL if unknown, array is terminated by {AV_PROFILE_UNKNOWN} + + /** + * Group name of the codec implementation. + * This is a short symbolic name of the wrapper backing this codec. A + * wrapper uses some kind of external implementation for the codec, such + * as an external library, or a codec implementation provided by the OS or + * the hardware. + * If this field is NULL, this is a builtin, libavcodec native codec. + * If non-NULL, this will be the suffix in AVCodec.name in most cases + * (usually AVCodec.name will be of the form "_"). + */ + const char *wrapper_name; + + /** + * Array of supported channel layouts, terminated with a zeroed layout. + * @deprecated use avcodec_get_supported_config() + */ + attribute_deprecated + const AVChannelLayout *ch_layouts; +} AVCodec; + +/** + * Iterate over all registered codecs. + * + * @param opaque a pointer where libavcodec will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the next registered codec or NULL when the iteration is + * finished + */ +const AVCodec *av_codec_iterate(void **opaque); + +/** + * Find a registered decoder with a matching codec ID. + * + * @param id AVCodecID of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +const AVCodec *avcodec_find_decoder(enum AVCodecID id); + +/** + * Find a registered decoder with the specified name. + * + * @param name name of the requested decoder + * @return A decoder if one was found, NULL otherwise. + */ +const AVCodec *avcodec_find_decoder_by_name(const char *name); + +/** + * Find a registered encoder with a matching codec ID. + * + * @param id AVCodecID of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +const AVCodec *avcodec_find_encoder(enum AVCodecID id); + +/** + * Find a registered encoder with the specified name. + * + * @param name name of the requested encoder + * @return An encoder if one was found, NULL otherwise. + */ +const AVCodec *avcodec_find_encoder_by_name(const char *name); +/** + * @return a non-zero number if codec is an encoder, zero otherwise + */ +int av_codec_is_encoder(const AVCodec *codec); + +/** + * @return a non-zero number if codec is a decoder, zero otherwise + */ +int av_codec_is_decoder(const AVCodec *codec); + +/** + * Return a name for the specified profile, if available. + * + * @param codec the codec that is searched for the given profile + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + */ +const char *av_get_profile_name(const AVCodec *codec, int profile); + +enum { + /** + * The codec supports this format via the hw_device_ctx interface. + * + * When selecting this format, AVCodecContext.hw_device_ctx should + * have been set to a device of the specified type before calling + * avcodec_open2(). + */ + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX = 0x01, + /** + * The codec supports this format via the hw_frames_ctx interface. + * + * When selecting this format for a decoder, + * AVCodecContext.hw_frames_ctx should be set to a suitable frames + * context inside the get_format() callback. The frames context + * must have been created on a device of the specified type. + * + * When selecting this format for an encoder, + * AVCodecContext.hw_frames_ctx should be set to the context which + * will be used for the input frames before calling avcodec_open2(). + */ + AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX = 0x02, + /** + * The codec supports this format by some internal method. + * + * This format can be selected without any additional configuration - + * no device or frames context is required. + */ + AV_CODEC_HW_CONFIG_METHOD_INTERNAL = 0x04, + /** + * The codec supports this format by some ad-hoc method. + * + * Additional settings and/or function calls are required. See the + * codec-specific documentation for details. (Methods requiring + * this sort of configuration are deprecated and others should be + * used in preference.) + */ + AV_CODEC_HW_CONFIG_METHOD_AD_HOC = 0x08, +}; + +typedef struct AVCodecHWConfig { + /** + * For decoders, a hardware pixel format which that decoder may be + * able to decode to if suitable hardware is available. + * + * For encoders, a pixel format which the encoder may be able to + * accept. If set to AV_PIX_FMT_NONE, this applies to all pixel + * formats supported by the codec. + */ + enum AVPixelFormat pix_fmt; + /** + * Bit set of AV_CODEC_HW_CONFIG_METHOD_* flags, describing the possible + * setup methods which can be used with this configuration. + */ + int methods; + /** + * The device type associated with the configuration. + * + * Must be set for AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX and + * AV_CODEC_HW_CONFIG_METHOD_HW_FRAMES_CTX, otherwise unused. + */ + enum AVHWDeviceType device_type; +} AVCodecHWConfig; + +/** + * Retrieve supported hardware configurations for a codec. + * + * Values of index from zero to some maximum return the indexed configuration + * descriptor; all other values return NULL. If the codec does not support + * any hardware configurations then it will always return NULL. + */ +const AVCodecHWConfig *avcodec_get_hw_config(const AVCodec *codec, int index); + +/** + * @} + */ + +#endif /* AVCODEC_CODEC_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_desc.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_desc.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_desc.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_desc.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,142 @@ +/* + * Codec descriptors public API + * + * 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 + */ + +#ifndef AVCODEC_CODEC_DESC_H +#define AVCODEC_CODEC_DESC_H + +#include "libavutil/avutil.h" + +#include "codec_id.h" + +/** + * @addtogroup lavc_core + * @{ + */ + +/** + * This struct describes the properties of a single codec described by an + * AVCodecID. + * @see avcodec_descriptor_get() + */ +typedef struct AVCodecDescriptor { + enum AVCodecID id; + enum AVMediaType type; + /** + * Name of the codec described by this descriptor. It is non-empty and + * unique for each codec descriptor. It should contain alphanumeric + * characters and '_' only. + */ + const char *name; + /** + * A more descriptive name for this codec. May be NULL. + */ + const char *long_name; + /** + * Codec properties, a combination of AV_CODEC_PROP_* flags. + */ + int props; + /** + * MIME type(s) associated with the codec. + * May be NULL; if not, a NULL-terminated array of MIME types. + * The first item is always non-NULL and is the preferred MIME type. + */ + const char *const *mime_types; + /** + * If non-NULL, an array of profiles recognized for this codec. + * Terminated with AV_PROFILE_UNKNOWN. + */ + const struct AVProfile *profiles; +} AVCodecDescriptor; + +/** + * Codec uses only intra compression. + * Video and audio codecs only. + */ +#define AV_CODEC_PROP_INTRA_ONLY (1 << 0) +/** + * Codec supports lossy compression. Audio and video codecs only. + * @note a codec may support both lossy and lossless + * compression modes + */ +#define AV_CODEC_PROP_LOSSY (1 << 1) +/** + * Codec supports lossless compression. Audio and video codecs only. + */ +#define AV_CODEC_PROP_LOSSLESS (1 << 2) +/** + * Codec supports frame reordering. That is, the coded order (the order in which + * the encoded packets are output by the encoders / stored / input to the + * decoders) may be different from the presentation order of the corresponding + * frames. + * + * For codecs that do not have this property set, PTS and DTS should always be + * equal. + */ +#define AV_CODEC_PROP_REORDER (1 << 3) + +/** + * Video codec supports separate coding of fields in interlaced frames. + */ +#define AV_CODEC_PROP_FIELDS (1 << 4) + +/** + * Video codec contains enhancement information meant to be applied to other + * existing frames, and can't generate usable image data on its own. + * A standalone decoder is unlikely to be available for it and should not + * be expected. + */ +#define AV_CODEC_PROP_ENHANCEMENT (1 << 5) + +/** + * Subtitle codec is bitmap based + * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. + */ +#define AV_CODEC_PROP_BITMAP_SUB (1 << 16) +/** + * Subtitle codec is text based. + * Decoded AVSubtitle data can be read from the AVSubtitleRect->ass field. + */ +#define AV_CODEC_PROP_TEXT_SUB (1 << 17) + +/** + * @return descriptor for given codec ID or NULL if no descriptor exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get(enum AVCodecID id); + +/** + * Iterate over all codec descriptors known to libavcodec. + * + * @param prev previous descriptor. NULL to get the first descriptor. + * + * @return next descriptor or NULL after the last descriptor + */ +const AVCodecDescriptor *avcodec_descriptor_next(const AVCodecDescriptor *prev); + +/** + * @return codec descriptor with the given name or NULL if no such descriptor + * exists. + */ +const AVCodecDescriptor *avcodec_descriptor_get_by_name(const char *name); + +/** + * @} + */ + +#endif // AVCODEC_CODEC_DESC_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_id.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_id.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_id.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_id.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,693 @@ +/* + * Codec IDs + * + * 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 + */ + +#ifndef AVCODEC_CODEC_ID_H +#define AVCODEC_CODEC_ID_H + +#include "libavutil/avutil.h" +#include "libavutil/samplefmt.h" + +#include "version_major.h" + +/** + * @addtogroup lavc_core + * @{ + */ + +/** + * Identify the syntax and semantics of the bitstream. + * The principle is roughly: + * Two decoders with the same ID can decode the same streams. + * Two encoders with the same ID can encode compatible streams. + * There may be slight deviations from the principle due to implementation + * details. + * + * If you add a codec ID to this list, add it so that + * 1. no value of an existing codec ID changes (that would break ABI), + * 2. it is as close as possible to similar codecs + * + * After adding new codec IDs, do not forget to add an entry to the codec + * descriptor list and bump libavcodec minor version. + */ +enum AVCodecID { + AV_CODEC_ID_NONE, + + /* video codecs */ + AV_CODEC_ID_MPEG1VIDEO, + AV_CODEC_ID_MPEG2VIDEO, ///< preferred ID for MPEG-1/2 video decoding + AV_CODEC_ID_H261, + AV_CODEC_ID_H263, + AV_CODEC_ID_RV10, + AV_CODEC_ID_RV20, + AV_CODEC_ID_MJPEG, + AV_CODEC_ID_MJPEGB, + AV_CODEC_ID_LJPEG, + AV_CODEC_ID_SP5X, + AV_CODEC_ID_JPEGLS, + AV_CODEC_ID_MPEG4, + AV_CODEC_ID_RAWVIDEO, + AV_CODEC_ID_MSMPEG4V1, + AV_CODEC_ID_MSMPEG4V2, + AV_CODEC_ID_MSMPEG4V3, + AV_CODEC_ID_WMV1, + AV_CODEC_ID_WMV2, + AV_CODEC_ID_H263P, + AV_CODEC_ID_H263I, + AV_CODEC_ID_FLV1, + AV_CODEC_ID_SVQ1, + AV_CODEC_ID_SVQ3, + AV_CODEC_ID_DVVIDEO, + AV_CODEC_ID_HUFFYUV, + AV_CODEC_ID_CYUV, + AV_CODEC_ID_H264, + AV_CODEC_ID_INDEO3, + AV_CODEC_ID_VP3, + AV_CODEC_ID_THEORA, + AV_CODEC_ID_ASV1, + AV_CODEC_ID_ASV2, + AV_CODEC_ID_FFV1, + AV_CODEC_ID_4XM, + AV_CODEC_ID_VCR1, + AV_CODEC_ID_CLJR, + AV_CODEC_ID_MDEC, + AV_CODEC_ID_ROQ, + AV_CODEC_ID_INTERPLAY_VIDEO, + AV_CODEC_ID_XAN_WC3, + AV_CODEC_ID_XAN_WC4, + AV_CODEC_ID_RPZA, + AV_CODEC_ID_CINEPAK, + AV_CODEC_ID_WS_VQA, + AV_CODEC_ID_MSRLE, + AV_CODEC_ID_MSVIDEO1, + AV_CODEC_ID_IDCIN, + AV_CODEC_ID_8BPS, + AV_CODEC_ID_SMC, + AV_CODEC_ID_FLIC, + AV_CODEC_ID_TRUEMOTION1, + AV_CODEC_ID_VMDVIDEO, + AV_CODEC_ID_MSZH, + AV_CODEC_ID_ZLIB, + AV_CODEC_ID_QTRLE, + AV_CODEC_ID_TSCC, + AV_CODEC_ID_ULTI, + AV_CODEC_ID_QDRAW, + AV_CODEC_ID_VIXL, + AV_CODEC_ID_QPEG, + AV_CODEC_ID_PNG, + AV_CODEC_ID_PPM, + AV_CODEC_ID_PBM, + AV_CODEC_ID_PGM, + AV_CODEC_ID_PGMYUV, + AV_CODEC_ID_PAM, + AV_CODEC_ID_FFVHUFF, + AV_CODEC_ID_RV30, + AV_CODEC_ID_RV40, + AV_CODEC_ID_VC1, + AV_CODEC_ID_WMV3, + AV_CODEC_ID_LOCO, + AV_CODEC_ID_WNV1, + AV_CODEC_ID_AASC, + AV_CODEC_ID_INDEO2, + AV_CODEC_ID_FRAPS, + AV_CODEC_ID_TRUEMOTION2, + AV_CODEC_ID_BMP, + AV_CODEC_ID_CSCD, + AV_CODEC_ID_MMVIDEO, + AV_CODEC_ID_ZMBV, + AV_CODEC_ID_AVS, + AV_CODEC_ID_SMACKVIDEO, + AV_CODEC_ID_NUV, + AV_CODEC_ID_KMVC, + AV_CODEC_ID_FLASHSV, + AV_CODEC_ID_CAVS, + AV_CODEC_ID_JPEG2000, + AV_CODEC_ID_VMNC, + AV_CODEC_ID_VP5, + AV_CODEC_ID_VP6, + AV_CODEC_ID_VP6F, + AV_CODEC_ID_TARGA, + AV_CODEC_ID_DSICINVIDEO, + AV_CODEC_ID_TIERTEXSEQVIDEO, + AV_CODEC_ID_TIFF, + AV_CODEC_ID_GIF, + AV_CODEC_ID_DXA, + AV_CODEC_ID_DNXHD, + AV_CODEC_ID_THP, + AV_CODEC_ID_SGI, + AV_CODEC_ID_C93, + AV_CODEC_ID_BETHSOFTVID, + AV_CODEC_ID_PTX, + AV_CODEC_ID_TXD, + AV_CODEC_ID_VP6A, + AV_CODEC_ID_AMV, + AV_CODEC_ID_VB, + AV_CODEC_ID_PCX, + AV_CODEC_ID_SUNRAST, + AV_CODEC_ID_INDEO4, + AV_CODEC_ID_INDEO5, + AV_CODEC_ID_MIMIC, + AV_CODEC_ID_RL2, + AV_CODEC_ID_ESCAPE124, + AV_CODEC_ID_DIRAC, + AV_CODEC_ID_BFI, + AV_CODEC_ID_CMV, + AV_CODEC_ID_MOTIONPIXELS, + AV_CODEC_ID_TGV, + AV_CODEC_ID_TGQ, + AV_CODEC_ID_TQI, + AV_CODEC_ID_AURA, + AV_CODEC_ID_AURA2, + AV_CODEC_ID_V210X, + AV_CODEC_ID_TMV, + AV_CODEC_ID_V210, + AV_CODEC_ID_DPX, + AV_CODEC_ID_MAD, + AV_CODEC_ID_FRWU, + AV_CODEC_ID_FLASHSV2, + AV_CODEC_ID_CDGRAPHICS, + AV_CODEC_ID_R210, + AV_CODEC_ID_ANM, + AV_CODEC_ID_BINKVIDEO, + AV_CODEC_ID_IFF_ILBM, +#define AV_CODEC_ID_IFF_BYTERUN1 AV_CODEC_ID_IFF_ILBM + AV_CODEC_ID_KGV1, + AV_CODEC_ID_YOP, + AV_CODEC_ID_VP8, + AV_CODEC_ID_PICTOR, + AV_CODEC_ID_ANSI, + AV_CODEC_ID_A64_MULTI, + AV_CODEC_ID_A64_MULTI5, + AV_CODEC_ID_R10K, + AV_CODEC_ID_MXPEG, + AV_CODEC_ID_LAGARITH, + AV_CODEC_ID_PRORES, + AV_CODEC_ID_JV, + AV_CODEC_ID_DFA, + AV_CODEC_ID_WMV3IMAGE, + AV_CODEC_ID_VC1IMAGE, + AV_CODEC_ID_UTVIDEO, + AV_CODEC_ID_BMV_VIDEO, + AV_CODEC_ID_VBLE, + AV_CODEC_ID_DXTORY, +#if FF_API_V408_CODECID + AV_CODEC_ID_V410, +#endif + AV_CODEC_ID_XWD, + AV_CODEC_ID_CDXL, + AV_CODEC_ID_XBM, + AV_CODEC_ID_ZEROCODEC, + AV_CODEC_ID_MSS1, + AV_CODEC_ID_MSA1, + AV_CODEC_ID_TSCC2, + AV_CODEC_ID_MTS2, + AV_CODEC_ID_CLLC, + AV_CODEC_ID_MSS2, + AV_CODEC_ID_VP9, + AV_CODEC_ID_AIC, + AV_CODEC_ID_ESCAPE130, + AV_CODEC_ID_G2M, + AV_CODEC_ID_WEBP, + AV_CODEC_ID_HNM4_VIDEO, + AV_CODEC_ID_HEVC, +#define AV_CODEC_ID_H265 AV_CODEC_ID_HEVC + AV_CODEC_ID_FIC, + AV_CODEC_ID_ALIAS_PIX, + AV_CODEC_ID_BRENDER_PIX, + AV_CODEC_ID_PAF_VIDEO, + AV_CODEC_ID_EXR, + AV_CODEC_ID_VP7, + AV_CODEC_ID_SANM, + AV_CODEC_ID_SGIRLE, + AV_CODEC_ID_MVC1, + AV_CODEC_ID_MVC2, + AV_CODEC_ID_HQX, + AV_CODEC_ID_TDSC, + AV_CODEC_ID_HQ_HQA, + AV_CODEC_ID_HAP, + AV_CODEC_ID_DDS, + AV_CODEC_ID_DXV, + AV_CODEC_ID_SCREENPRESSO, + AV_CODEC_ID_RSCC, + AV_CODEC_ID_AVS2, + AV_CODEC_ID_PGX, + AV_CODEC_ID_AVS3, + AV_CODEC_ID_MSP2, + AV_CODEC_ID_VVC, +#define AV_CODEC_ID_H266 AV_CODEC_ID_VVC + AV_CODEC_ID_Y41P, + AV_CODEC_ID_AVRP, + AV_CODEC_ID_012V, + AV_CODEC_ID_AVUI, + AV_CODEC_ID_TARGA_Y216, +#if FF_API_V408_CODECID + AV_CODEC_ID_V308, + AV_CODEC_ID_V408, +#endif + AV_CODEC_ID_YUV4, + AV_CODEC_ID_AVRN, + AV_CODEC_ID_CPIA, + AV_CODEC_ID_XFACE, + AV_CODEC_ID_SNOW, + AV_CODEC_ID_SMVJPEG, + AV_CODEC_ID_APNG, + AV_CODEC_ID_DAALA, + AV_CODEC_ID_CFHD, + AV_CODEC_ID_TRUEMOTION2RT, + AV_CODEC_ID_M101, + AV_CODEC_ID_MAGICYUV, + AV_CODEC_ID_SHEERVIDEO, + AV_CODEC_ID_YLC, + AV_CODEC_ID_PSD, + AV_CODEC_ID_PIXLET, + AV_CODEC_ID_SPEEDHQ, + AV_CODEC_ID_FMVC, + AV_CODEC_ID_SCPR, + AV_CODEC_ID_CLEARVIDEO, + AV_CODEC_ID_XPM, + AV_CODEC_ID_AV1, + AV_CODEC_ID_BITPACKED, + AV_CODEC_ID_MSCC, + AV_CODEC_ID_SRGC, + AV_CODEC_ID_SVG, + AV_CODEC_ID_GDV, + AV_CODEC_ID_FITS, + AV_CODEC_ID_IMM4, + AV_CODEC_ID_PROSUMER, + AV_CODEC_ID_MWSC, + AV_CODEC_ID_WCMV, + AV_CODEC_ID_RASC, + AV_CODEC_ID_HYMT, + AV_CODEC_ID_ARBC, + AV_CODEC_ID_AGM, + AV_CODEC_ID_LSCR, + AV_CODEC_ID_VP4, + AV_CODEC_ID_IMM5, + AV_CODEC_ID_MVDV, + AV_CODEC_ID_MVHA, + AV_CODEC_ID_CDTOONS, + AV_CODEC_ID_MV30, + AV_CODEC_ID_NOTCHLC, + AV_CODEC_ID_PFM, + AV_CODEC_ID_MOBICLIP, + AV_CODEC_ID_PHOTOCD, + AV_CODEC_ID_IPU, + AV_CODEC_ID_ARGO, + AV_CODEC_ID_CRI, + AV_CODEC_ID_SIMBIOSIS_IMX, + AV_CODEC_ID_SGA_VIDEO, + AV_CODEC_ID_GEM, + AV_CODEC_ID_VBN, + AV_CODEC_ID_JPEGXL, + AV_CODEC_ID_QOI, + AV_CODEC_ID_PHM, + AV_CODEC_ID_RADIANCE_HDR, + AV_CODEC_ID_WBMP, + AV_CODEC_ID_MEDIA100, + AV_CODEC_ID_VQC, + AV_CODEC_ID_PDV, + AV_CODEC_ID_EVC, + AV_CODEC_ID_RTV1, + AV_CODEC_ID_VMIX, + AV_CODEC_ID_LEAD, + AV_CODEC_ID_DNXUC, + AV_CODEC_ID_RV60, + AV_CODEC_ID_JPEGXL_ANIM, + AV_CODEC_ID_APV, + AV_CODEC_ID_PRORES_RAW, + AV_CODEC_ID_JPEGXS, + + /* various PCM "codecs" */ + AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs + AV_CODEC_ID_PCM_S16LE = 0x10000, + AV_CODEC_ID_PCM_S16BE, + AV_CODEC_ID_PCM_U16LE, + AV_CODEC_ID_PCM_U16BE, + AV_CODEC_ID_PCM_S8, + AV_CODEC_ID_PCM_U8, + AV_CODEC_ID_PCM_MULAW, + AV_CODEC_ID_PCM_ALAW, + AV_CODEC_ID_PCM_S32LE, + AV_CODEC_ID_PCM_S32BE, + AV_CODEC_ID_PCM_U32LE, + AV_CODEC_ID_PCM_U32BE, + AV_CODEC_ID_PCM_S24LE, + AV_CODEC_ID_PCM_S24BE, + AV_CODEC_ID_PCM_U24LE, + AV_CODEC_ID_PCM_U24BE, + AV_CODEC_ID_PCM_S24DAUD, + AV_CODEC_ID_PCM_ZORK, + AV_CODEC_ID_PCM_S16LE_PLANAR, + AV_CODEC_ID_PCM_DVD, + AV_CODEC_ID_PCM_F32BE, + AV_CODEC_ID_PCM_F32LE, + AV_CODEC_ID_PCM_F64BE, + AV_CODEC_ID_PCM_F64LE, + AV_CODEC_ID_PCM_BLURAY, + AV_CODEC_ID_PCM_LXF, + AV_CODEC_ID_S302M, + AV_CODEC_ID_PCM_S8_PLANAR, + AV_CODEC_ID_PCM_S24LE_PLANAR, + AV_CODEC_ID_PCM_S32LE_PLANAR, + AV_CODEC_ID_PCM_S16BE_PLANAR, + AV_CODEC_ID_PCM_S64LE, + AV_CODEC_ID_PCM_S64BE, + AV_CODEC_ID_PCM_F16LE, + AV_CODEC_ID_PCM_F24LE, + AV_CODEC_ID_PCM_VIDC, + AV_CODEC_ID_PCM_SGA, + + /* various ADPCM codecs */ + AV_CODEC_ID_ADPCM_IMA_QT = 0x11000, + AV_CODEC_ID_ADPCM_IMA_WAV, + AV_CODEC_ID_ADPCM_IMA_DK3, + AV_CODEC_ID_ADPCM_IMA_DK4, + AV_CODEC_ID_ADPCM_IMA_WS, + AV_CODEC_ID_ADPCM_IMA_SMJPEG, + AV_CODEC_ID_ADPCM_MS, + AV_CODEC_ID_ADPCM_4XM, + AV_CODEC_ID_ADPCM_XA, + AV_CODEC_ID_ADPCM_ADX, + AV_CODEC_ID_ADPCM_EA, + AV_CODEC_ID_ADPCM_G726, + AV_CODEC_ID_ADPCM_CT, + AV_CODEC_ID_ADPCM_SWF, + AV_CODEC_ID_ADPCM_YAMAHA, + AV_CODEC_ID_ADPCM_SBPRO_4, + AV_CODEC_ID_ADPCM_SBPRO_3, + AV_CODEC_ID_ADPCM_SBPRO_2, + AV_CODEC_ID_ADPCM_THP, + AV_CODEC_ID_ADPCM_IMA_AMV, + AV_CODEC_ID_ADPCM_EA_R1, + AV_CODEC_ID_ADPCM_EA_R3, + AV_CODEC_ID_ADPCM_EA_R2, + AV_CODEC_ID_ADPCM_IMA_EA_SEAD, + AV_CODEC_ID_ADPCM_IMA_EA_EACS, + AV_CODEC_ID_ADPCM_EA_XAS, + AV_CODEC_ID_ADPCM_EA_MAXIS_XA, + AV_CODEC_ID_ADPCM_IMA_ISS, + AV_CODEC_ID_ADPCM_G722, + AV_CODEC_ID_ADPCM_IMA_APC, + AV_CODEC_ID_ADPCM_VIMA, + AV_CODEC_ID_ADPCM_AFC, + AV_CODEC_ID_ADPCM_IMA_OKI, + AV_CODEC_ID_ADPCM_DTK, + AV_CODEC_ID_ADPCM_IMA_RAD, + AV_CODEC_ID_ADPCM_G726LE, + AV_CODEC_ID_ADPCM_THP_LE, + AV_CODEC_ID_ADPCM_PSX, + AV_CODEC_ID_ADPCM_AICA, + AV_CODEC_ID_ADPCM_IMA_DAT4, + AV_CODEC_ID_ADPCM_MTAF, + AV_CODEC_ID_ADPCM_AGM, + AV_CODEC_ID_ADPCM_ARGO, + AV_CODEC_ID_ADPCM_IMA_SSI, + AV_CODEC_ID_ADPCM_ZORK, + AV_CODEC_ID_ADPCM_IMA_APM, + AV_CODEC_ID_ADPCM_IMA_ALP, + AV_CODEC_ID_ADPCM_IMA_MTF, + AV_CODEC_ID_ADPCM_IMA_CUNNING, + AV_CODEC_ID_ADPCM_IMA_MOFLEX, + AV_CODEC_ID_ADPCM_IMA_ACORN, + AV_CODEC_ID_ADPCM_XMD, + AV_CODEC_ID_ADPCM_IMA_XBOX, + AV_CODEC_ID_ADPCM_SANYO, + AV_CODEC_ID_ADPCM_IMA_HVQM4, + AV_CODEC_ID_ADPCM_IMA_PDA, + AV_CODEC_ID_ADPCM_N64, + AV_CODEC_ID_ADPCM_IMA_HVQM2, + AV_CODEC_ID_ADPCM_IMA_MAGIX, + AV_CODEC_ID_ADPCM_PSXC, + AV_CODEC_ID_ADPCM_CIRCUS, + AV_CODEC_ID_ADPCM_IMA_ESCAPE, + + /* AMR */ + AV_CODEC_ID_AMR_NB = 0x12000, + AV_CODEC_ID_AMR_WB, + + /* RealAudio codecs*/ + AV_CODEC_ID_RA_144 = 0x13000, + AV_CODEC_ID_RA_288, + + /* various DPCM codecs */ + AV_CODEC_ID_ROQ_DPCM = 0x14000, + AV_CODEC_ID_INTERPLAY_DPCM, + AV_CODEC_ID_XAN_DPCM, + AV_CODEC_ID_SOL_DPCM, + AV_CODEC_ID_SDX2_DPCM, + AV_CODEC_ID_GREMLIN_DPCM, + AV_CODEC_ID_DERF_DPCM, + AV_CODEC_ID_WADY_DPCM, + AV_CODEC_ID_CBD2_DPCM, + + /* audio codecs */ + AV_CODEC_ID_MP2 = 0x15000, + AV_CODEC_ID_MP3, ///< preferred ID for decoding MPEG audio layer 1, 2 or 3 + AV_CODEC_ID_AAC, + AV_CODEC_ID_AC3, + AV_CODEC_ID_DTS, + AV_CODEC_ID_VORBIS, + AV_CODEC_ID_DVAUDIO, + AV_CODEC_ID_WMAV1, + AV_CODEC_ID_WMAV2, + AV_CODEC_ID_MACE3, + AV_CODEC_ID_MACE6, + AV_CODEC_ID_VMDAUDIO, + AV_CODEC_ID_FLAC, + AV_CODEC_ID_MP3ADU, + AV_CODEC_ID_MP3ON4, + AV_CODEC_ID_SHORTEN, + AV_CODEC_ID_ALAC, + AV_CODEC_ID_WESTWOOD_SND1, + AV_CODEC_ID_GSM, ///< as in Berlin toast format + AV_CODEC_ID_QDM2, + AV_CODEC_ID_COOK, + AV_CODEC_ID_TRUESPEECH, + AV_CODEC_ID_TTA, + AV_CODEC_ID_SMACKAUDIO, + AV_CODEC_ID_QCELP, + AV_CODEC_ID_WAVPACK, + AV_CODEC_ID_DSICINAUDIO, + AV_CODEC_ID_IMC, + AV_CODEC_ID_MUSEPACK7, + AV_CODEC_ID_MLP, + AV_CODEC_ID_GSM_MS, /* as found in WAV */ + AV_CODEC_ID_ATRAC3, + AV_CODEC_ID_APE, + AV_CODEC_ID_NELLYMOSER, + AV_CODEC_ID_MUSEPACK8, + AV_CODEC_ID_SPEEX, + AV_CODEC_ID_WMAVOICE, + AV_CODEC_ID_WMAPRO, + AV_CODEC_ID_WMALOSSLESS, + AV_CODEC_ID_ATRAC3P, + AV_CODEC_ID_EAC3, + AV_CODEC_ID_SIPR, + AV_CODEC_ID_MP1, + AV_CODEC_ID_TWINVQ, + AV_CODEC_ID_TRUEHD, + AV_CODEC_ID_MP4ALS, + AV_CODEC_ID_ATRAC1, + AV_CODEC_ID_BINKAUDIO_RDFT, + AV_CODEC_ID_BINKAUDIO_DCT, + AV_CODEC_ID_AAC_LATM, + AV_CODEC_ID_QDMC, + AV_CODEC_ID_CELT, + AV_CODEC_ID_G723_1, + AV_CODEC_ID_G729, + AV_CODEC_ID_8SVX_EXP, + AV_CODEC_ID_8SVX_FIB, + AV_CODEC_ID_BMV_AUDIO, + AV_CODEC_ID_RALF, + AV_CODEC_ID_IAC, + AV_CODEC_ID_ILBC, + AV_CODEC_ID_OPUS, + AV_CODEC_ID_COMFORT_NOISE, + AV_CODEC_ID_TAK, + AV_CODEC_ID_METASOUND, + AV_CODEC_ID_PAF_AUDIO, + AV_CODEC_ID_ON2AVC, + AV_CODEC_ID_DSS_SP, + AV_CODEC_ID_CODEC2, + AV_CODEC_ID_FFWAVESYNTH, + AV_CODEC_ID_SONIC, + AV_CODEC_ID_SONIC_LS, + AV_CODEC_ID_EVRC, + AV_CODEC_ID_SMV, + AV_CODEC_ID_DSD_LSBF, + AV_CODEC_ID_DSD_MSBF, + AV_CODEC_ID_DSD_LSBF_PLANAR, + AV_CODEC_ID_DSD_MSBF_PLANAR, + AV_CODEC_ID_4GV, + AV_CODEC_ID_INTERPLAY_ACM, + AV_CODEC_ID_XMA1, + AV_CODEC_ID_XMA2, + AV_CODEC_ID_DST, + AV_CODEC_ID_ATRAC3AL, + AV_CODEC_ID_ATRAC3PAL, + AV_CODEC_ID_DOLBY_E, + AV_CODEC_ID_APTX, + AV_CODEC_ID_APTX_HD, + AV_CODEC_ID_SBC, + AV_CODEC_ID_ATRAC9, + AV_CODEC_ID_HCOM, + AV_CODEC_ID_ACELP_KELVIN, + AV_CODEC_ID_MPEGH_3D_AUDIO, + AV_CODEC_ID_SIREN, + AV_CODEC_ID_HCA, + AV_CODEC_ID_FASTAUDIO, + AV_CODEC_ID_MSNSIREN, + AV_CODEC_ID_DFPWM, + AV_CODEC_ID_BONK, + AV_CODEC_ID_MISC4, + AV_CODEC_ID_APAC, + AV_CODEC_ID_FTR, + AV_CODEC_ID_WAVARC, + AV_CODEC_ID_RKA, + AV_CODEC_ID_AC4, + AV_CODEC_ID_OSQ, + AV_CODEC_ID_QOA, + AV_CODEC_ID_LC3, + AV_CODEC_ID_G728, + AV_CODEC_ID_AHX, + + /* subtitle codecs */ + AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. + AV_CODEC_ID_DVD_SUBTITLE = 0x17000, + AV_CODEC_ID_DVB_SUBTITLE, + AV_CODEC_ID_TEXT, ///< raw UTF-8 text + AV_CODEC_ID_XSUB, + AV_CODEC_ID_SSA, + AV_CODEC_ID_MOV_TEXT, + AV_CODEC_ID_HDMV_PGS_SUBTITLE, + AV_CODEC_ID_DVB_TELETEXT, + AV_CODEC_ID_SRT, + AV_CODEC_ID_MICRODVD, + AV_CODEC_ID_EIA_608, + AV_CODEC_ID_JACOSUB, + AV_CODEC_ID_SAMI, + AV_CODEC_ID_REALTEXT, + AV_CODEC_ID_STL, + AV_CODEC_ID_SUBVIEWER1, + AV_CODEC_ID_SUBVIEWER, + AV_CODEC_ID_SUBRIP, + AV_CODEC_ID_WEBVTT, + AV_CODEC_ID_MPL2, + AV_CODEC_ID_VPLAYER, + AV_CODEC_ID_PJS, + AV_CODEC_ID_ASS, + AV_CODEC_ID_HDMV_TEXT_SUBTITLE, + AV_CODEC_ID_TTML, + AV_CODEC_ID_ARIB_CAPTION, + AV_CODEC_ID_IVTV_VBI, + + /* other specific kind of codecs (generally used for attachments) */ + AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. + AV_CODEC_ID_TTF = 0x18000, + + AV_CODEC_ID_SCTE_35, ///< Contain timestamp estimated through PCR of program stream. + AV_CODEC_ID_EPG, + AV_CODEC_ID_BINTEXT, + AV_CODEC_ID_XBIN, + AV_CODEC_ID_IDF, + AV_CODEC_ID_OTF, + AV_CODEC_ID_SMPTE_KLV, + AV_CODEC_ID_DVD_NAV, + AV_CODEC_ID_TIMED_ID3, + AV_CODEC_ID_BIN_DATA, + AV_CODEC_ID_SMPTE_2038, + AV_CODEC_ID_LCEVC, + AV_CODEC_ID_SMPTE_436M_ANC, + + + AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it + + AV_CODEC_ID_MPEG2TS = 0x20000, /**< _FAKE_ codec to indicate a raw MPEG-2 TS + * stream (only used by libavformat) */ + AV_CODEC_ID_MPEG4SYSTEMS = 0x20001, /**< _FAKE_ codec to indicate a MPEG-4 Systems + * stream (only used by libavformat) */ + AV_CODEC_ID_FFMETADATA = 0x21000, ///< Dummy codec for streams containing only metadata information. + AV_CODEC_ID_WRAPPED_AVFRAME = 0x21001, ///< Passthrough codec, AVFrames wrapped in AVPacket + /** + * Dummy null video codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. + */ + AV_CODEC_ID_VNULL, + /** + * Dummy null audio codec, useful mainly for development and debugging. + * Null encoder/decoder discard all input and never return any output. + */ + AV_CODEC_ID_ANULL, +}; + +/** + * Get the type of the given codec. + */ +enum AVMediaType avcodec_get_type(enum AVCodecID codec_id); + +/** + * Get the name of a codec. + * @return a static string identifying the codec; never NULL + */ +const char *avcodec_get_name(enum AVCodecID id); + +/** + * Return codec bits per sample. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return codec bits per sample. + * Only return non-zero if the bits per sample is exactly correct, not an + * approximation. + * + * @param[in] codec_id the codec + * @return Number of bits per sample or zero if unknown for the given codec. + */ +int av_get_exact_bits_per_sample(enum AVCodecID codec_id); + +/** + * Return a name for the specified profile, if available. + * + * @param codec_id the ID of the codec to which the requested profile belongs + * @param profile the profile value for which a name is requested + * @return A name for the profile if found, NULL otherwise. + * + * @note unlike av_get_profile_name(), which searches a list of profiles + * supported by a specific decoder or encoder implementation, this + * function searches the list of profiles from the AVCodecDescriptor + */ +const char *avcodec_profile_name(enum AVCodecID codec_id, int profile); + +/** + * Return the PCM codec associated with a sample format. + * @param be endianness, 0 for little, 1 for big, + * -1 (or anything else) for native + * @return AV_CODEC_ID_PCM_* or AV_CODEC_ID_NONE + */ +enum AVCodecID av_get_pcm_codec(enum AVSampleFormat fmt, int be); + +/** + * @} + */ + +#endif // AVCODEC_CODEC_ID_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_par.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_par.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_par.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/codec_par.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,253 @@ +/* + * Codec parameters public API + * + * 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 + */ + +#ifndef AVCODEC_CODEC_PAR_H +#define AVCODEC_CODEC_PAR_H + +#include + +#include "libavutil/avutil.h" +#include "libavutil/channel_layout.h" +#include "libavutil/rational.h" +#include "libavutil/pixfmt.h" + +#include "codec_id.h" +#include "defs.h" +#include "packet.h" + +/** + * @addtogroup lavc_core + * @{ + */ + +/** + * This struct describes the properties of an encoded stream. + * + * sizeof(AVCodecParameters) is not a part of the public ABI, this struct must + * be allocated with avcodec_parameters_alloc() and freed with + * avcodec_parameters_free(). + */ +typedef struct AVCodecParameters { + /** + * General type of the encoded data. + */ + enum AVMediaType codec_type; + /** + * Specific type of the encoded data (the codec used). + */ + enum AVCodecID codec_id; + /** + * Additional information about the codec (corresponds to the AVI FOURCC). + */ + uint32_t codec_tag; + + /** + * Extra binary data needed for initializing the decoder, codec-dependent. + * + * Must be allocated with av_malloc() and will be freed by + * avcodec_parameters_free(). The allocated size of extradata must be at + * least extradata_size + AV_INPUT_BUFFER_PADDING_SIZE, with the padding + * bytes zeroed. + */ + uint8_t *extradata; + /** + * Size of the extradata content in bytes. + */ + int extradata_size; + + /** + * Additional data associated with the entire stream. + * + * Should be allocated with av_packet_side_data_new() or + * av_packet_side_data_add(), and will be freed by avcodec_parameters_free(). + */ + AVPacketSideData *coded_side_data; + + /** + * Amount of entries in @ref coded_side_data. + */ + int nb_coded_side_data; + + /** + * - video: the pixel format, the value corresponds to enum AVPixelFormat. + * - audio: the sample format, the value corresponds to enum AVSampleFormat. + */ + int format; + + /** + * The average bitrate of the encoded data (in bits per second). + */ + int64_t bit_rate; + + /** + * The number of bits per sample in the codedwords. + * + * This is basically the bitrate per sample. It is mandatory for a bunch of + * formats to actually decode them. It's the number of bits for one sample in + * the actual coded bitstream. + * + * This could be for example 4 for ADPCM + * For PCM formats this matches bits_per_raw_sample + * Can be 0 + */ + int bits_per_coded_sample; + + /** + * This is the number of valid bits in each output sample. If the + * sample format has more bits, the least significant bits are additional + * padding bits, which are always 0. Use right shifts to reduce the sample + * to its actual size. For example, audio formats with 24 bit samples will + * have bits_per_raw_sample set to 24, and format set to AV_SAMPLE_FMT_S32. + * To get the original sample use "(int32_t)sample >> 8"." + * + * For ADPCM this might be 12 or 16 or similar + * Can be 0 + */ + int bits_per_raw_sample; + + /** + * Codec-specific bitstream restrictions that the stream conforms to. + */ + int profile; + int level; + + /** + * Video only. The dimensions of the video frame in pixels. + */ + int width; + int height; + + /** + * Video only. The aspect ratio (width / height) which a single pixel + * should have when displayed. + * + * When the aspect ratio is unknown / undefined, the numerator should be + * set to 0 (the denominator may have any value). + */ + AVRational sample_aspect_ratio; + + /** + * Video only. Number of frames per second, for streams with constant frame + * durations. Should be set to { 0, 1 } when some frames have differing + * durations or if the value is not known. + * + * @note This field corresponds to values that are stored in codec-level + * headers and is typically overridden by container/transport-layer + * timestamps, when available. It should thus be used only as a last resort, + * when no higher-level timing information is available. + */ + AVRational framerate; + + /** + * Video only. The order of the fields in interlaced video. + */ + enum AVFieldOrder field_order; + + /** + * Video only. Additional colorspace characteristics. + */ + enum AVColorRange color_range; + enum AVColorPrimaries color_primaries; + enum AVColorTransferCharacteristic color_trc; + enum AVColorSpace color_space; + enum AVChromaLocation chroma_location; + + /** + * Video only. Number of delayed frames. + */ + int video_delay; + + /** + * Audio only. The channel layout and number of channels. + */ + AVChannelLayout ch_layout; + /** + * Audio only. The number of audio samples per second. + */ + int sample_rate; + /** + * Audio only. The number of bytes per coded audio frame, required by some + * formats. + * + * Corresponds to nBlockAlign in WAVEFORMATEX. + */ + int block_align; + /** + * Audio only. Audio frame size, if known. Required by some formats to be static. + */ + int frame_size; + + /** + * Audio only. The amount of padding (in samples) inserted by the encoder at + * the beginning of the audio. I.e. this number of leading decoded samples + * must be discarded by the caller to get the original audio without leading + * padding. + */ + int initial_padding; + /** + * Audio only. The amount of padding (in samples) appended by the encoder to + * the end of the audio. I.e. this number of decoded samples must be + * discarded by the caller from the end of the stream to get the original + * audio without any trailing padding. + */ + int trailing_padding; + /** + * Audio only. Number of samples to skip after a discontinuity. + */ + int seek_preroll; + + /** + * Video with alpha channel only. Alpha channel handling + */ + enum AVAlphaMode alpha_mode; +} AVCodecParameters; + +/** + * Allocate a new AVCodecParameters and set its fields to default values + * (unknown/invalid/0). The returned struct must be freed with + * avcodec_parameters_free(). + */ +AVCodecParameters *avcodec_parameters_alloc(void); + +/** + * Free an AVCodecParameters instance and everything associated with it and + * write NULL to the supplied pointer. + */ +void avcodec_parameters_free(AVCodecParameters **par); + +/** + * Copy the contents of src to dst. Any allocated fields in dst are freed and + * replaced with newly allocated duplicates of the corresponding fields in src. + * + * @return >= 0 on success, a negative AVERROR code on failure. + */ +int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src); + +/** + * This function is the same as av_get_audio_frame_duration(), except it works + * with AVCodecParameters instead of an AVCodecContext. + */ +int av_get_audio_frame_duration2(AVCodecParameters *par, int frame_bytes); + +/** + * @} + */ + +#endif // AVCODEC_CODEC_PAR_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/defs.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/defs.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/defs.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/defs.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,362 @@ +/* + * + * 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 + */ + +#ifndef AVCODEC_DEFS_H +#define AVCODEC_DEFS_H + +/** + * @file + * @ingroup libavc + * Misc types and constants that do not belong anywhere else. + */ + +#include +#include + +/** + * @ingroup lavc_decoding + * Required number of additionally allocated bytes at the end of the input bitstream for decoding. + * This is mainly needed because some optimized bitstream readers read + * 32 or 64 bit at once and could read over the end.
+ * Note: If the first 23 bits of the additional bytes are not 0, then damaged + * MPEG bitstreams could cause overread and segfault. + */ +#define AV_INPUT_BUFFER_PADDING_SIZE 64 + +/** + * Verify checksums embedded in the bitstream (could be of either encoded or + * decoded data, depending on the format) and print an error message on mismatch. + * If AV_EF_EXPLODE is also set, a mismatching checksum will result in the + * decoder/demuxer returning an error. + */ +#define AV_EF_CRCCHECK (1<<0) +#define AV_EF_BITSTREAM (1<<1) ///< detect bitstream specification deviations +#define AV_EF_BUFFER (1<<2) ///< detect improper bitstream length +#define AV_EF_EXPLODE (1<<3) ///< abort decoding on minor error detection + +#define AV_EF_IGNORE_ERR (1<<15) ///< ignore errors and continue +#define AV_EF_CAREFUL (1<<16) ///< consider things that violate the spec, are fast to calculate and have not been seen in the wild as errors +#define AV_EF_COMPLIANT (1<<17) ///< consider all spec non compliances as errors +#define AV_EF_AGGRESSIVE (1<<18) ///< consider things that a sane encoder/muxer should not do as an error + +#define FF_COMPLIANCE_VERY_STRICT 2 ///< Strictly conform to an older more strict version of the spec or reference software. +#define FF_COMPLIANCE_STRICT 1 ///< Strictly conform to all the things in the spec no matter what consequences. +#define FF_COMPLIANCE_NORMAL 0 +#define FF_COMPLIANCE_UNOFFICIAL -1 ///< Allow unofficial extensions +#define FF_COMPLIANCE_EXPERIMENTAL -2 ///< Allow nonstandardized experimental things. + + +#define AV_PROFILE_UNKNOWN -99 +#define AV_PROFILE_RESERVED -100 + +#define AV_PROFILE_AAC_MAIN 0 +#define AV_PROFILE_AAC_LOW 1 +#define AV_PROFILE_AAC_SSR 2 +#define AV_PROFILE_AAC_LTP 3 +#define AV_PROFILE_AAC_HE 4 +#define AV_PROFILE_AAC_HE_V2 28 +#define AV_PROFILE_AAC_LD 22 +#define AV_PROFILE_AAC_ELD 38 +#define AV_PROFILE_AAC_USAC 41 +#define AV_PROFILE_MPEG2_AAC_LOW 128 +#define AV_PROFILE_MPEG2_AAC_HE 131 + +#define AV_PROFILE_DNXHD 0 +#define AV_PROFILE_DNXHR_LB 1 +#define AV_PROFILE_DNXHR_SQ 2 +#define AV_PROFILE_DNXHR_HQ 3 +#define AV_PROFILE_DNXHR_HQX 4 +#define AV_PROFILE_DNXHR_444 5 + +#define AV_PROFILE_DTS 20 +#define AV_PROFILE_DTS_ES 30 +#define AV_PROFILE_DTS_96_24 40 +#define AV_PROFILE_DTS_HD_HRA 50 +#define AV_PROFILE_DTS_HD_MA 60 +#define AV_PROFILE_DTS_EXPRESS 70 +#define AV_PROFILE_DTS_HD_MA_X 61 +#define AV_PROFILE_DTS_HD_MA_X_IMAX 62 + +#define AV_PROFILE_EAC3_DDP_ATMOS 30 + +#define AV_PROFILE_TRUEHD_ATMOS 30 + +#define AV_PROFILE_MPEG2_422 0 +#define AV_PROFILE_MPEG2_HIGH 1 +#define AV_PROFILE_MPEG2_SS 2 +#define AV_PROFILE_MPEG2_SNR_SCALABLE 3 +#define AV_PROFILE_MPEG2_MAIN 4 +#define AV_PROFILE_MPEG2_SIMPLE 5 + +#define AV_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag +#define AV_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag + +#define AV_PROFILE_H264_BASELINE 66 +#define AV_PROFILE_H264_CONSTRAINED_BASELINE (66|AV_PROFILE_H264_CONSTRAINED) +#define AV_PROFILE_H264_MAIN 77 +#define AV_PROFILE_H264_EXTENDED 88 +#define AV_PROFILE_H264_HIGH 100 +#define AV_PROFILE_H264_HIGH_10 110 +#define AV_PROFILE_H264_HIGH_10_INTRA (110|AV_PROFILE_H264_INTRA) +#define AV_PROFILE_H264_MULTIVIEW_HIGH 118 +#define AV_PROFILE_H264_HIGH_422 122 +#define AV_PROFILE_H264_HIGH_422_INTRA (122|AV_PROFILE_H264_INTRA) +#define AV_PROFILE_H264_STEREO_HIGH 128 +#define AV_PROFILE_H264_HIGH_444 144 +#define AV_PROFILE_H264_HIGH_444_PREDICTIVE 244 +#define AV_PROFILE_H264_HIGH_444_INTRA (244|AV_PROFILE_H264_INTRA) +#define AV_PROFILE_H264_CAVLC_444 44 + +#define AV_PROFILE_VC1_SIMPLE 0 +#define AV_PROFILE_VC1_MAIN 1 +#define AV_PROFILE_VC1_COMPLEX 2 +#define AV_PROFILE_VC1_ADVANCED 3 + +#define AV_PROFILE_MPEG4_SIMPLE 0 +#define AV_PROFILE_MPEG4_SIMPLE_SCALABLE 1 +#define AV_PROFILE_MPEG4_CORE 2 +#define AV_PROFILE_MPEG4_MAIN 3 +#define AV_PROFILE_MPEG4_N_BIT 4 +#define AV_PROFILE_MPEG4_SCALABLE_TEXTURE 5 +#define AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 +#define AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 +#define AV_PROFILE_MPEG4_HYBRID 8 +#define AV_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 +#define AV_PROFILE_MPEG4_CORE_SCALABLE 10 +#define AV_PROFILE_MPEG4_ADVANCED_CODING 11 +#define AV_PROFILE_MPEG4_ADVANCED_CORE 12 +#define AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 +#define AV_PROFILE_MPEG4_SIMPLE_STUDIO 14 +#define AV_PROFILE_MPEG4_ADVANCED_SIMPLE 15 + +#define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1 +#define AV_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2 +#define AV_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768 +#define AV_PROFILE_JPEG2000_DCINEMA_2K 3 +#define AV_PROFILE_JPEG2000_DCINEMA_4K 4 + +#define AV_PROFILE_VP9_0 0 +#define AV_PROFILE_VP9_1 1 +#define AV_PROFILE_VP9_2 2 +#define AV_PROFILE_VP9_3 3 + +#define AV_PROFILE_HEVC_MAIN 1 +#define AV_PROFILE_HEVC_MAIN_10 2 +#define AV_PROFILE_HEVC_MAIN_STILL_PICTURE 3 +#define AV_PROFILE_HEVC_REXT 4 +#define AV_PROFILE_HEVC_MULTIVIEW_MAIN 6 +#define AV_PROFILE_HEVC_SCC 9 + +#define AV_PROFILE_VVC_MAIN_10 1 +#define AV_PROFILE_VVC_MAIN_10_444 33 + +#define AV_PROFILE_AV1_MAIN 0 +#define AV_PROFILE_AV1_HIGH 1 +#define AV_PROFILE_AV1_PROFESSIONAL 2 + +#define AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0 +#define AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 +#define AV_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 +#define AV_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3 +#define AV_PROFILE_MJPEG_JPEG_LS 0xf7 + +#define AV_PROFILE_SBC_MSBC 1 + +#define AV_PROFILE_PRORES_PROXY 0 +#define AV_PROFILE_PRORES_LT 1 +#define AV_PROFILE_PRORES_STANDARD 2 +#define AV_PROFILE_PRORES_HQ 3 +#define AV_PROFILE_PRORES_4444 4 +#define AV_PROFILE_PRORES_XQ 5 + +#define AV_PROFILE_PRORES_RAW 0 +#define AV_PROFILE_PRORES_RAW_HQ 1 + +#define AV_PROFILE_ARIB_PROFILE_A 0 +#define AV_PROFILE_ARIB_PROFILE_C 1 + +#define AV_PROFILE_KLVA_SYNC 0 +#define AV_PROFILE_KLVA_ASYNC 1 + +#define AV_PROFILE_EVC_BASELINE 0 +#define AV_PROFILE_EVC_MAIN 1 + +#define AV_PROFILE_APV_422_10 33 +#define AV_PROFILE_APV_422_12 44 +#define AV_PROFILE_APV_444_10 55 +#define AV_PROFILE_APV_444_12 66 +#define AV_PROFILE_APV_4444_10 77 +#define AV_PROFILE_APV_4444_12 88 +#define AV_PROFILE_APV_400_10 99 + + +#define AV_LEVEL_UNKNOWN -99 + +enum AVFieldOrder { + AV_FIELD_UNKNOWN, + AV_FIELD_PROGRESSIVE, + AV_FIELD_TT, ///< Top coded_first, top displayed first + AV_FIELD_BB, ///< Bottom coded first, bottom displayed first + AV_FIELD_TB, ///< Top coded first, bottom displayed first + AV_FIELD_BT, ///< Bottom coded first, top displayed first +}; + +/** + * @ingroup lavc_decoding + */ +enum AVDiscard{ + /* We leave some space between them for extensions (drop some + * keyframes for intra-only or drop just some bidir frames). */ + AVDISCARD_NONE =-16, ///< discard nothing + AVDISCARD_DEFAULT = 0, ///< discard useless packets like 0 size packets in avi + AVDISCARD_NONREF = 8, ///< discard all non reference + AVDISCARD_BIDIR = 16, ///< discard all bidirectional frames + AVDISCARD_NONINTRA= 24, ///< discard all non intra frames + AVDISCARD_NONKEY = 32, ///< discard all frames except keyframes + AVDISCARD_ALL = 48, ///< discard all +}; + +enum AVAudioServiceType { + AV_AUDIO_SERVICE_TYPE_MAIN = 0, + AV_AUDIO_SERVICE_TYPE_EFFECTS = 1, + AV_AUDIO_SERVICE_TYPE_VISUALLY_IMPAIRED = 2, + AV_AUDIO_SERVICE_TYPE_HEARING_IMPAIRED = 3, + AV_AUDIO_SERVICE_TYPE_DIALOGUE = 4, + AV_AUDIO_SERVICE_TYPE_COMMENTARY = 5, + AV_AUDIO_SERVICE_TYPE_EMERGENCY = 6, + AV_AUDIO_SERVICE_TYPE_VOICE_OVER = 7, + AV_AUDIO_SERVICE_TYPE_KARAOKE = 8, + AV_AUDIO_SERVICE_TYPE_NB , ///< Not part of ABI +}; + +/** + * Pan Scan area. + * This specifies the area which should be displayed. + * Note there may be multiple such areas for one frame. + */ +typedef struct AVPanScan { + /** + * id + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int id; + + /** + * width and height in 1/16 pel + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int width; + int height; + + /** + * position of the top left corner in 1/16 pel for up to 3 fields/frames + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + int16_t position[3][2]; +} AVPanScan; + +/** + * This structure describes the bitrate properties of an encoded bitstream. It + * roughly corresponds to a subset the VBV parameters for MPEG-2 or HRD + * parameters for H.264/HEVC. + */ +typedef struct AVCPBProperties { + /** + * Maximum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t max_bitrate; + /** + * Minimum bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t min_bitrate; + /** + * Average bitrate of the stream, in bits per second. + * Zero if unknown or unspecified. + */ + int64_t avg_bitrate; + + /** + * The size of the buffer to which the ratecontrol is applied, in bits. + * Zero if unknown or unspecified. + */ + int64_t buffer_size; + + /** + * The delay between the time the packet this structure is associated with + * is received and the time when it should be decoded, in periods of a 27MHz + * clock. + * + * UINT64_MAX when unknown or unspecified. + */ + uint64_t vbv_delay; +} AVCPBProperties; + +/** + * Allocate a CPB properties structure and initialize its fields to default + * values. + * + * @param size if non-NULL, the size of the allocated struct will be written + * here. This is useful for embedding it in side data. + * + * @return the newly allocated struct or NULL on failure + */ +AVCPBProperties *av_cpb_properties_alloc(size_t *size); + +/** + * This structure supplies correlation between a packet timestamp and a wall clock + * production time. The definition follows the Producer Reference Time ('prft') + * as defined in ISO/IEC 14496-12 + */ +typedef struct AVProducerReferenceTime { + /** + * A UTC timestamp, in microseconds, since Unix epoch (e.g, av_gettime()). + */ + int64_t wallclock; + int flags; +} AVProducerReferenceTime; + +/** + * RTCP SR (Sender Report) information + * + * The received sender report information for an RTSP + * stream, exposed as AV_PKT_DATA_RTCP_SR side data. + */ +typedef struct AVRTCPSenderReport { + uint32_t ssrc; ///< Synchronization source identifier + uint64_t ntp_timestamp; ///< NTP time when the report was sent + uint32_t rtp_timestamp; ///< RTP time when the report was sent + uint32_t sender_nb_packets; ///< Total number of packets sent + uint32_t sender_nb_bytes; ///< Total number of bytes sent (excluding headers or padding) +} AVRTCPSenderReport; + +/** + * Encode extradata length to a buffer. Used by xiph codecs. + * + * @param s buffer to write to; must be at least (v/255+1) bytes long + * @param v size of extradata in bytes + * @return number of bytes written to the buffer. + */ +unsigned int av_xiphlacing(unsigned char *s, unsigned int v); + +#endif // AVCODEC_DEFS_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/packet.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/packet.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/packet.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/packet.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,943 @@ +/* + * AVPacket public API + * + * 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 + */ + +#ifndef AVCODEC_PACKET_H +#define AVCODEC_PACKET_H + +#include +#include + +#include "libavutil/attributes.h" +#include "libavutil/buffer.h" +#include "libavutil/dict.h" +#include "libavutil/rational.h" +#include "libavutil/version.h" + +#include "libavcodec/version_major.h" + +/** + * @defgroup lavc_packet_side_data AVPacketSideData + * + * Types and functions for working with AVPacketSideData. + * @{ + */ +enum AVPacketSideDataType { + /** + * An AV_PKT_DATA_PALETTE side data packet contains exactly AVPALETTE_SIZE + * bytes worth of palette. This side data signals that a new palette is + * present. + */ + AV_PKT_DATA_PALETTE, + + /** + * The AV_PKT_DATA_NEW_EXTRADATA is used to notify the codec or the format + * that the extradata buffer was changed and the receiving side should + * act upon it appropriately. The new extradata is embedded in the side + * data buffer and should be immediately used for processing the current + * frame or packet. + */ + AV_PKT_DATA_NEW_EXTRADATA, + + /** + * An AV_PKT_DATA_PARAM_CHANGE side data packet is laid out as follows: + * @code + * u32le param_flags + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE) + * s32le sample_rate + * if (param_flags & AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS) + * s32le width + * s32le height + * @endcode + */ + AV_PKT_DATA_PARAM_CHANGE, + + /** + * An AV_PKT_DATA_H263_MB_INFO side data packet contains a number of + * structures with info about macroblocks relevant to splitting the + * packet into smaller packets on macroblock edges (e.g. as for RFC 2190). + * That is, it does not necessarily contain info about all macroblocks, + * as long as the distance between macroblocks in the info is smaller + * than the target payload size. + * Each MB info structure is 12 bytes, and is laid out as follows: + * @code + * u32le bit offset from the start of the packet + * u8 current quantizer at the start of the macroblock + * u8 GOB number + * u16le macroblock address within the GOB + * u8 horizontal MV predictor + * u8 vertical MV predictor + * u8 horizontal MV predictor for block number 3 + * u8 vertical MV predictor for block number 3 + * @endcode + */ + AV_PKT_DATA_H263_MB_INFO, + + /** + * This side data should be associated with an audio stream and contains + * ReplayGain information in form of the AVReplayGain struct. + */ + AV_PKT_DATA_REPLAYGAIN, + + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the decoded video frames for + * correct presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_PKT_DATA_DISPLAYMATRIX, + + /** + * This side data should be associated with a video stream and contains + * Stereoscopic 3D information in form of the AVStereo3D struct. + */ + AV_PKT_DATA_STEREO3D, + + /** + * This side data should be associated with an audio stream and corresponds + * to enum AVAudioServiceType. + */ + AV_PKT_DATA_AUDIO_SERVICE_TYPE, + + /** + * This side data contains quality related information from the encoder. + * @code + * u32le quality factor of the compressed frame. Allowed range is between 1 (good) and FF_LAMBDA_MAX (bad). + * u8 picture type + * u8 error count + * u16 reserved + * u64le[error count] sum of squared differences between encoder in and output + * @endcode + */ + AV_PKT_DATA_QUALITY_STATS, + + /** + * This side data contains an integer value representing the stream index + * of a "fallback" track. A fallback track indicates an alternate + * track to use when the current track can not be decoded for some reason. + * e.g. no decoder available for codec. + */ + AV_PKT_DATA_FALLBACK_TRACK, + + /** + * This side data corresponds to the AVCPBProperties struct. + */ + AV_PKT_DATA_CPB_PROPERTIES, + + /** + * Recommends skipping the specified number of samples + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_PKT_DATA_SKIP_SAMPLES, + + /** + * An AV_PKT_DATA_JP_DUALMONO side data packet indicates that + * the packet may contain "dual mono" audio specific to Japanese DTV + * and if it is true, recommends only the selected channel to be used. + * @code + * u8 selected channels (0=main/left, 1=sub/right, 2=both) + * @endcode + */ + AV_PKT_DATA_JP_DUALMONO, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. + */ + AV_PKT_DATA_STRINGS_METADATA, + + /** + * Subtitle event position + * @code + * u32le x1 + * u32le y1 + * u32le x2 + * u32le y2 + * @endcode + */ + AV_PKT_DATA_SUBTITLE_POSITION, + + /** + * Data found in BlockAdditional element of matroska container. There is + * no end marker for the data, so it is required to rely on the side data + * size to recognize the end. 8 byte id (as found in BlockAddId) followed + * by data. + */ + AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, + + /** + * The optional first identifier line of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_IDENTIFIER, + + /** + * The optional settings (rendering instructions) that immediately + * follow the timestamp specifier of a WebVTT cue. + */ + AV_PKT_DATA_WEBVTT_SETTINGS, + + /** + * A list of zero terminated key/value strings. There is no end marker for + * the list, so it is required to rely on the side data size to stop. This + * side data includes updated metadata which appeared in the stream. + */ + AV_PKT_DATA_METADATA_UPDATE, + + /** + * MPEGTS stream ID as uint8_t, this is required to pass the stream ID + * information from the demuxer to the corresponding muxer. + */ + AV_PKT_DATA_MPEGTS_STREAM_ID, + + /** + * Mastering display metadata (based on SMPTE-2086:2014). This metadata + * should be associated with a video stream and contains data in the form + * of the AVMasteringDisplayMetadata struct. + */ + AV_PKT_DATA_MASTERING_DISPLAY_METADATA, + + /** + * This side data should be associated with a video stream and corresponds + * to the AVSphericalMapping structure. + */ + AV_PKT_DATA_SPHERICAL, + + /** + * Content light level (based on CTA-861.3). This metadata should be + * associated with a video stream and contains data in the form of the + * AVContentLightMetadata struct. + */ + AV_PKT_DATA_CONTENT_LIGHT_LEVEL, + + /** + * ATSC A53 Part 4 Closed Captions. This metadata should be associated with + * a video stream. A53 CC bitstream is stored as uint8_t in AVPacketSideData.data. + * The number of bytes of CC data is AVPacketSideData.size. + */ + AV_PKT_DATA_A53_CC, + + /** + * This side data is encryption initialization data. + * The format is not part of ABI, use av_encryption_init_info_* methods to + * access. + */ + AV_PKT_DATA_ENCRYPTION_INIT_INFO, + + /** + * This side data contains encryption info for how to decrypt the packet. + * The format is not part of ABI, use av_encryption_info_* methods to access. + */ + AV_PKT_DATA_ENCRYPTION_INFO, + + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + */ + AV_PKT_DATA_AFD, + + /** + * Producer Reference Time data corresponding to the AVProducerReferenceTime struct, + * usually exported by some encoders (on demand through the prft flag set in the + * AVCodecContext export_side_data field). + */ + AV_PKT_DATA_PRFT, + + /** + * ICC profile data consisting of an opaque octet buffer following the + * format described by ISO 15076-1. + */ + AV_PKT_DATA_ICC_PROFILE, + + /** + * DOVI configuration + * ref: + * dolby-vision-bitstreams-within-the-iso-base-media-file-format-v2.1.2, section 2.2 + * dolby-vision-bitstreams-in-mpeg-2-transport-stream-multiplex-v1.2, section 3.3 + * Tags are stored in struct AVDOVIDecoderConfigurationRecord. + */ + AV_PKT_DATA_DOVI_CONF, + + /** + * Timecode which conforms to SMPTE ST 12-1:2014. The data is an array of 4 uint32_t + * where the first uint32_t describes how many (1-3) of the other timecodes are used. + * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum() + * function in libavutil/timecode.h. + */ + AV_PKT_DATA_S12M_TIMECODE, + + /** + * HDR10+ dynamic metadata associated with a video frame. The metadata is in + * the form of the AVDynamicHDRPlus struct and contains + * information for color volume transform - application 4 of + * SMPTE 2094-40:2016 standard. + */ + AV_PKT_DATA_DYNAMIC_HDR10_PLUS, + + /** + * IAMF Mix Gain Parameter Data associated with the audio frame. This metadata + * is in the form of the AVIAMFParamDefinition struct and contains information + * defined in sections 3.6.1 and 3.8.1 of the Immersive Audio Model and + * Formats standard. + */ + AV_PKT_DATA_IAMF_MIX_GAIN_PARAM, + + /** + * IAMF Demixing Info Parameter Data associated with the audio frame. This + * metadata is in the form of the AVIAMFParamDefinition struct and contains + * information defined in sections 3.6.1 and 3.8.2 of the Immersive Audio Model + * and Formats standard. + */ + AV_PKT_DATA_IAMF_DEMIXING_INFO_PARAM, + + /** + * IAMF Recon Gain Info Parameter Data associated with the audio frame. This + * metadata is in the form of the AVIAMFParamDefinition struct and contains + * information defined in sections 3.6.1 and 3.8.3 of the Immersive Audio Model + * and Formats standard. + */ + AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM, + + /** + * Ambient viewing environment metadata, as defined by H.274. This metadata + * should be associated with a video stream and contains data in the form + * of the AVAmbientViewingEnvironment struct. + */ + AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT, + + /** + * The number of pixels to discard from the top/bottom/left/right border of the + * decoded frame to obtain the sub-rectangle intended for presentation. + * + * @code + * u32le crop_top + * u32le crop_bottom + * u32le crop_left + * u32le crop_right + * @endcode + */ + AV_PKT_DATA_FRAME_CROPPING, + + /** + * Raw LCEVC payload data, as a uint8_t array, with NAL emulation + * bytes intact. + */ + AV_PKT_DATA_LCEVC, + + /** + * This side data contains information about the reference display width(s) + * and reference viewing distance(s) as well as information about the + * corresponding reference stereo pair(s), i.e., the pair(s) of views to be + * displayed for the viewer's left and right eyes on the reference display + * at the reference viewing distance. + * The payload is the AV3DReferenceDisplaysInfo struct defined in + * libavutil/tdrdi.h. + */ + AV_PKT_DATA_3D_REFERENCE_DISPLAYS, + + /** + * Contains the last received RTCP SR (Sender Report) information + * in the form of the AVRTCPSenderReport struct. + */ + AV_PKT_DATA_RTCP_SR, + + /** + * Extensible image file format metadata. The payload is a buffer containing + * EXIF metadata, starting with either 49 49 2a 00, or 4d 4d 00 2a. + */ + AV_PKT_DATA_EXIF, + + /** + * The number of side data types. + * This is not part of the public API/ABI in the sense that it may + * change when new side data types are added. + * This must stay the last enum value. + * If its value becomes huge, some code using it + * needs to be updated as it assumes it to be smaller than other limits. + */ + AV_PKT_DATA_NB +}; + +/** + * This structure stores auxiliary information for decoding, presenting, or + * otherwise processing the coded stream. It is typically exported by demuxers + * and encoders and can be fed to decoders and muxers either in a per packet + * basis, or as global side data (applying to the entire coded stream). + * + * Global side data is handled as follows: + * - During demuxing, it may be exported through + * @ref AVCodecParameters.coded_side_data "AVStream's codec parameters", which can + * then be passed as input to decoders through the + * @ref AVCodecContext.coded_side_data "decoder context's side data", for + * initialization. + * - For muxing, it can be fed through @ref AVCodecParameters.coded_side_data + * "AVStream's codec parameters", typically the output of encoders through + * the @ref AVCodecContext.coded_side_data "encoder context's side data", for + * initialization. + * + * Packet specific side data is handled as follows: + * - During demuxing, it may be exported through @ref AVPacket.side_data + * "AVPacket's side data", which can then be passed as input to decoders. + * - For muxing, it can be fed through @ref AVPacket.side_data "AVPacket's + * side data", typically the output of encoders. + * + * Different modules may accept or export different types of side data + * depending on media type and codec. Refer to @ref AVPacketSideDataType for a + * list of defined types and where they may be found or used. + */ +typedef struct AVPacketSideData { + uint8_t *data; + size_t size; + enum AVPacketSideDataType type; +} AVPacketSideData; + +/** + * Allocate a new packet side data. + * + * @param sd pointer to an array of side data to which the side data should + * be added. *sd may be NULL, in which case the array will be + * initialized. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. The integer value will be increased by 1 on success. + * @param type side data type + * @param size desired side data size + * @param flags currently unused. Must be zero + * + * @return pointer to freshly allocated side data on success, or NULL otherwise. + */ +AVPacketSideData *av_packet_side_data_new(AVPacketSideData **psd, int *pnb_sd, + enum AVPacketSideDataType type, + size_t size, int flags); + +/** + * Wrap existing data as packet side data. + * + * @param sd pointer to an array of side data to which the side data should + * be added. *sd may be NULL, in which case the array will be + * initialized + * @param nb_sd pointer to an integer containing the number of entries in + * the array. The integer value will be increased by 1 on success. + * @param type side data type + * @param data a data array. It must be allocated with the av_malloc() family + * of functions. The ownership of the data is transferred to the + * side data array on success + * @param size size of the data array + * @param flags currently unused. Must be zero + * + * @return pointer to freshly allocated side data on success, or NULL otherwise + * On failure, the side data array is unchanged and the data remains + * owned by the caller. + */ +AVPacketSideData *av_packet_side_data_add(AVPacketSideData **sd, int *nb_sd, + enum AVPacketSideDataType type, + void *data, size_t size, int flags); + +/** + * Get side information from a side data array. + * + * @param sd the array from which the side data should be fetched + * @param nb_sd value containing the number of entries in the array. + * @param type desired side information type + * + * @return pointer to side data if present or NULL otherwise + */ +const AVPacketSideData *av_packet_side_data_get(const AVPacketSideData *sd, + int nb_sd, + enum AVPacketSideDataType type); + +/** + * Remove side data of the given type from a side data array. + * + * @param sd the array from which the side data should be removed + * @param nb_sd pointer to an integer containing the number of entries in + * the array. Will be reduced by the amount of entries removed + * upon return + * @param type side information type + */ +void av_packet_side_data_remove(AVPacketSideData *sd, int *nb_sd, + enum AVPacketSideDataType type); + +/** + * Convenience function to free all the side data stored in an array, and + * the array itself. + * + * @param sd pointer to array of side data to free. Will be set to NULL + * upon return. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. Will be set to 0 upon return. + */ +void av_packet_side_data_free(AVPacketSideData **sd, int *nb_sd); + +struct AVFrameSideData; + +/** + * Add a new packet side data entry to an array based on existing frame + * side data, if a matching type exists for packet side data. + * + * @param flags Currently unused. Must be 0. + * @retval >= 0 Success + * @retval AVERROR(EINVAL) The frame side data type does not have a matching + * packet side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_from_frame(AVPacketSideData **sd, int *nb_sd, + const struct AVFrameSideData *src, unsigned int flags); +/** + * Add a new frame side data entry to an array based on existing packet + * side data, if a matching type exists for frame side data. + * + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, + * or 0. + * @retval >= 0 Success + * @retval AVERROR(EINVAL) The packet side data type does not have a matching + * frame side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_to_frame(struct AVFrameSideData ***sd, int *nb_sd, + const AVPacketSideData *src, unsigned int flags); + +const char *av_packet_side_data_name(enum AVPacketSideDataType type); + +/** + * @} + */ + +/** + * @defgroup lavc_packet AVPacket + * + * Types and functions for working with AVPacket. + * @{ + */ + +/** + * This structure stores compressed data. It is typically exported by demuxers + * and then passed as input to decoders, or received as output from encoders and + * then passed to muxers. + * + * For video, it should typically contain one compressed frame. For audio it may + * contain several compressed frames. Encoders are allowed to output empty + * packets, with no compressed data, containing only side data + * (e.g. to update some stream parameters at the end of encoding). + * + * The semantics of data ownership depends on the buf field. + * If it is set, the packet data is dynamically allocated and is + * valid indefinitely until a call to av_packet_unref() reduces the + * reference count to 0. + * + * If the buf field is not set av_packet_ref() would make a copy instead + * of increasing the reference count. + * + * The side data is always allocated with av_malloc(), copied by + * av_packet_ref() and freed by av_packet_unref(). + * + * sizeof(AVPacket) being a part of the public ABI is deprecated. once + * av_init_packet() is removed, new packets will only be able to be allocated + * with av_packet_alloc(), and new fields may be added to the end of the struct + * with a minor bump. + * + * @see av_packet_alloc + * @see av_packet_ref + * @see av_packet_unref + */ +typedef struct AVPacket { + /** + * A reference to the reference-counted buffer where the packet data is + * stored. + * May be NULL, then the packet data is not reference-counted. + */ + AVBufferRef *buf; + /** + * Presentation timestamp in AVStream->time_base units; the time at which + * the decompressed packet will be presented to the user. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + * pts MUST be larger or equal to dts as presentation cannot happen before + * decompression, unless one wants to view hex dumps. Some formats misuse + * the terms dts and pts/cts to mean something different. Such timestamps + * must be converted to true pts/dts before they are stored in AVPacket. + */ + int64_t pts; + /** + * Decompression timestamp in AVStream->time_base units; the time at which + * the packet is decompressed. + * Can be AV_NOPTS_VALUE if it is not stored in the file. + */ + int64_t dts; + uint8_t *data; + int size; + int stream_index; + /** + * A combination of AV_PKT_FLAG values + */ + int flags; + /** + * Additional packet data that can be provided by the container. + * Packet can contain several types of side information. + */ + AVPacketSideData *side_data; + int side_data_elems; + + /** + * Duration of this packet in AVStream->time_base units, 0 if unknown. + * Equals next_pts - this_pts in presentation order. + */ + int64_t duration; + + int64_t pos; ///< byte position in stream, -1 if unknown + + /** + * for some private data of the user + */ + void *opaque; + + /** + * AVBufferRef for free use by the API user. FFmpeg will never check the + * contents of the buffer ref. FFmpeg calls av_buffer_unref() on it when + * the packet is unreferenced. av_packet_copy_props() calls create a new + * reference with av_buffer_ref() for the target packet's opaque_ref field. + * + * This is unrelated to the opaque field, although it serves a similar + * purpose. + */ + AVBufferRef *opaque_ref; + + /** + * Time base of the packet's timestamps. + * In the future, this field may be set on packets output by encoders or + * demuxers, but its value will be by default ignored on input to decoders + * or muxers. + */ + AVRational time_base; +} AVPacket; + +#if FF_API_INIT_PACKET +attribute_deprecated +typedef struct AVPacketList { + AVPacket pkt; + struct AVPacketList *next; +} AVPacketList; +#endif + +#define AV_PKT_FLAG_KEY 0x0001 ///< The packet contains a keyframe +#define AV_PKT_FLAG_CORRUPT 0x0002 ///< The packet content is corrupted +/** + * Flag is used to discard packets which are required to maintain valid + * decoder state but are not required for output and should be dropped + * after decoding. + **/ +#define AV_PKT_FLAG_DISCARD 0x0004 +/** + * The packet comes from a trusted source. + * + * Otherwise-unsafe constructs such as arbitrary pointers to data + * outside the packet may be followed. + */ +#define AV_PKT_FLAG_TRUSTED 0x0008 +/** + * Flag is used to indicate packets that contain frames that can + * be discarded by the decoder. I.e. Non-reference frames. + */ +#define AV_PKT_FLAG_DISPOSABLE 0x0010 + +enum AVSideDataParamChangeFlags { + AV_SIDE_DATA_PARAM_CHANGE_SAMPLE_RATE = 0x0004, + AV_SIDE_DATA_PARAM_CHANGE_DIMENSIONS = 0x0008, +}; + +/** + * Allocate an AVPacket and set its fields to default values. The resulting + * struct must be freed using av_packet_free(). + * + * @return An AVPacket filled with default values or NULL on failure. + * + * @note this only allocates the AVPacket itself, not the data buffers. Those + * must be allocated through other means such as av_new_packet. + * + * @see av_new_packet + */ +AVPacket *av_packet_alloc(void); + +/** + * Create a new packet that references the same data as src. + * + * This is a shortcut for av_packet_alloc()+av_packet_ref(). + * + * @return newly created AVPacket on success, NULL on error. + * + * @see av_packet_alloc + * @see av_packet_ref + */ +AVPacket *av_packet_clone(const AVPacket *src); + +/** + * Free the packet, if the packet is reference counted, it will be + * unreferenced first. + * + * @param pkt packet to be freed. The pointer will be set to NULL. + * @note passing NULL is a no-op. + */ +void av_packet_free(AVPacket **pkt); + +#if FF_API_INIT_PACKET +/** + * Initialize optional fields of a packet with default values. + * + * Note, this does not touch the data and size members, which have to be + * initialized separately. + * + * @param pkt packet + * + * @see av_packet_alloc + * @see av_packet_unref + * + * @deprecated This function is deprecated. Once it's removed, + sizeof(AVPacket) will not be a part of the ABI anymore. + */ +attribute_deprecated +void av_init_packet(AVPacket *pkt); +#endif + +/** + * Allocate the payload of a packet and initialize its fields with + * default values. + * + * @param pkt packet + * @param size wanted payload size + * @return 0 if OK, AVERROR_xxx otherwise + */ +int av_new_packet(AVPacket *pkt, int size); + +/** + * Reduce packet size, correctly zeroing padding + * + * @param pkt packet + * @param size new size + */ +void av_shrink_packet(AVPacket *pkt, int size); + +/** + * Increase packet size, correctly zeroing padding + * + * @param pkt packet + * @param grow_by number of bytes by which to increase the size of the packet + */ +int av_grow_packet(AVPacket *pkt, int grow_by); + +/** + * Initialize a reference-counted packet from av_malloc()ed data. + * + * @param pkt packet to be initialized. This function will set the data, size, + * and buf fields, all others are left untouched. + * @param data Data allocated by av_malloc() to be used as packet data. If this + * function returns successfully, the data is owned by the underlying AVBuffer. + * The caller may not access the data through other means. + * @param size size of data in bytes, without the padding. I.e. the full buffer + * size is assumed to be size + AV_INPUT_BUFFER_PADDING_SIZE. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_packet_from_data(AVPacket *pkt, uint8_t *data, int size); + +/** + * Allocate new information of a packet. + * + * @param pkt packet + * @param type side information type + * @param size side information size + * @return pointer to fresh allocated data or NULL otherwise + */ +uint8_t* av_packet_new_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + size_t size); + +/** + * Wrap an existing array as a packet side data. + * + * @param pkt packet + * @param type side information type + * @param data the side data array. It must be allocated with the av_malloc() + * family of functions. The ownership of the data is transferred to + * pkt. + * @param size side information size + * @return a non-negative number on success, a negative AVERROR code on + * failure. On failure, the packet is unchanged and the data remains + * owned by the caller. + */ +int av_packet_add_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + uint8_t *data, size_t size); + +/** + * Shrink the already allocated side data buffer + * + * @param pkt packet + * @param type side information type + * @param size new side information size + * @return 0 on success, < 0 on failure + */ +int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + size_t size); + +/** + * Get side information from packet. + * + * @param pkt packet + * @param type desired side information type + * @param size If supplied, *size will be set to the size of the side data + * or to zero if the desired side data is not present. + * @return pointer to data if present or NULL otherwise + */ +uint8_t* av_packet_get_side_data(const AVPacket *pkt, enum AVPacketSideDataType type, + size_t *size); + +/** + * Pack a dictionary for use in side_data. + * + * @param dict The dictionary to pack. + * @param size pointer to store the size of the returned data + * @return pointer to data if successful, NULL otherwise + */ +uint8_t *av_packet_pack_dictionary(AVDictionary *dict, size_t *size); +/** + * Unpack a dictionary from side_data. + * + * @param data data from side_data + * @param size size of the data + * @param dict the metadata storage dictionary + * @return 0 on success, < 0 on failure + */ +int av_packet_unpack_dictionary(const uint8_t *data, size_t size, + AVDictionary **dict); + +/** + * Convenience function to free all the side data stored. + * All the other fields stay untouched. + * + * @param pkt packet + */ +void av_packet_free_side_data(AVPacket *pkt); + +/** + * Setup a new reference to the data described by a given packet + * + * If src is reference-counted, setup dst as a new reference to the + * buffer in src. Otherwise allocate a new buffer in dst and copy the + * data from src into it. + * + * All the other fields are copied from src. + * + * @see av_packet_unref + * + * @param dst Destination packet. Will be completely overwritten. + * @param src Source packet + * + * @return 0 on success, a negative AVERROR on error. On error, dst + * will be blank (as if returned by av_packet_alloc()). + */ +int av_packet_ref(AVPacket *dst, const AVPacket *src); + +/** + * Wipe the packet. + * + * Unreference the buffer referenced by the packet and reset the + * remaining packet fields to their default values. + * + * @param pkt The packet to be unreferenced. + */ +void av_packet_unref(AVPacket *pkt); + +/** + * Move every field in src to dst and reset src. + * + * @see av_packet_unref + * + * @param src Source packet, will be reset + * @param dst Destination packet + */ +void av_packet_move_ref(AVPacket *dst, AVPacket *src); + +/** + * Copy only "properties" fields from src to dst. + * + * Properties for the purpose of this function are all the fields + * beside those related to the packet data (buf, data, size) + * + * @param dst Destination packet + * @param src Source packet + * + * @return 0 on success AVERROR on failure. + */ +int av_packet_copy_props(AVPacket *dst, const AVPacket *src); + +/** + * Ensure the data described by a given packet is reference counted. + * + * @note This function does not ensure that the reference will be writable. + * Use av_packet_make_writable instead for that purpose. + * + * @see av_packet_ref + * @see av_packet_make_writable + * + * @param pkt packet whose data should be made reference counted. + * + * @return 0 on success, a negative AVERROR on error. On failure, the + * packet is unchanged. + */ +int av_packet_make_refcounted(AVPacket *pkt); + +/** + * Create a writable reference for the data described by a given packet, + * avoiding data copy if possible. + * + * @param pkt Packet whose data should be made writable. + * + * @return 0 on success, a negative AVERROR on failure. On failure, the + * packet is unchanged. + */ +int av_packet_make_writable(AVPacket *pkt); + +/** + * Convert valid timing fields (timestamps / durations) in a packet from one + * timebase to another. Timestamps with unknown values (AV_NOPTS_VALUE) will be + * ignored. + * + * @param pkt packet on which the conversion will be performed + * @param tb_src source timebase, in which the timing fields in pkt are + * expressed + * @param tb_dst destination timebase, to which the timing fields will be + * converted + */ +void av_packet_rescale_ts(AVPacket *pkt, AVRational tb_src, AVRational tb_dst); + +/** + * Allocate an AVContainerFifo instance for AVPacket. + * + * @param flags currently unused + */ +struct AVContainerFifo *av_container_fifo_alloc_avpacket(unsigned flags); + +/** + * @} + */ + +#endif // AVCODEC_PACKET_H diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/vdpau.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/vdpau.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/vdpau.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/vdpau.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,138 @@ +/* + * The Video Decode and Presentation API for UNIX (VDPAU) is used for + * hardware-accelerated decoding of MPEG-1/2, H.264 and VC-1. + * + * Copyright (C) 2008 NVIDIA + * + * 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 + */ + +#ifndef AVCODEC_VDPAU_H +#define AVCODEC_VDPAU_H + +/** + * @file + * @ingroup lavc_codec_hwaccel_vdpau + * Public libavcodec VDPAU header. + */ + + +/** + * @defgroup lavc_codec_hwaccel_vdpau VDPAU Decoder and Renderer + * @ingroup lavc_codec_hwaccel + * + * VDPAU hardware acceleration has two modules + * - VDPAU decoding + * - VDPAU presentation + * + * The VDPAU decoding module parses all headers using FFmpeg + * parsing mechanisms and uses VDPAU for the actual decoding. + * + * As per the current implementation, the actual decoding + * and rendering (API calls) are done as part of the VDPAU + * presentation (vo_vdpau.c) module. + * + * @{ + */ + +#include + +#include "libavutil/avconfig.h" +#include "libavutil/attributes.h" + +#include "avcodec.h" + +struct AVCodecContext; +struct AVFrame; + +typedef int (*AVVDPAU_Render2)(struct AVCodecContext *, struct AVFrame *, + const VdpPictureInfo *, uint32_t, + const VdpBitstreamBuffer *); + +/** + * This structure is used to share data between the libavcodec library and + * the client video application. + * This structure will be allocated and stored in AVCodecContext.hwaccel_context + * by av_vdpau_bind_context(). Members can be set by the user once + * during initialization or through each AVCodecContext.get_buffer() + * function call. In any case, they must be valid prior to calling + * decoding functions. + * + * The size of this structure is not a part of the public ABI and must not + * be used outside of libavcodec. + */ +typedef struct AVVDPAUContext { + /** + * VDPAU decoder handle + * + * Set by user. + */ + VdpDecoder decoder; + + /** + * VDPAU decoder render callback + * + * Set by the user. + */ + VdpDecoderRender *render; + + AVVDPAU_Render2 render2; +} AVVDPAUContext; + +/** + * Associate a VDPAU device with a codec context for hardware acceleration. + * This function is meant to be called from the get_format() codec callback, + * or earlier. It can also be called after avcodec_flush_buffers() to change + * the underlying VDPAU device mid-stream (e.g. to recover from non-transparent + * display preemption). + * + * @note get_format() must return AV_PIX_FMT_VDPAU if this function completes + * successfully. + * + * @param avctx decoding context whose get_format() callback is invoked + * @param device VDPAU device handle to use for hardware acceleration + * @param get_proc_address VDPAU device driver + * @param flags zero of more OR'd AV_HWACCEL_FLAG_* flags + * + * @return 0 on success, an AVERROR code on failure. + */ +int av_vdpau_bind_context(AVCodecContext *avctx, VdpDevice device, + VdpGetProcAddress *get_proc_address, unsigned flags); + +/** + * Gets the parameters to create an adequate VDPAU video surface for the codec + * context using VDPAU hardware decoding acceleration. + * + * @note Behavior is undefined if the context was not successfully bound to a + * VDPAU device using av_vdpau_bind_context(). + * + * @param avctx the codec context being used for decoding the stream + * @param type storage space for the VDPAU video surface chroma type + * (or NULL to ignore) + * @param width storage space for the VDPAU video surface pixel width + * (or NULL to ignore) + * @param height storage space for the VDPAU video surface pixel height + * (or NULL to ignore) + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_vdpau_get_surface_parameters(AVCodecContext *avctx, VdpChromaType *type, + uint32_t *width, uint32_t *height); + +/** @} */ + +#endif /* AVCODEC_VDPAU_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,45 @@ +/* + * 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 + */ + +#ifndef AVCODEC_VERSION_H +#define AVCODEC_VERSION_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#include "libavutil/version.h" + +#include "version_major.h" + +#define LIBAVCODEC_VERSION_MINOR 29 +#define LIBAVCODEC_VERSION_MICRO 101 + +#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_VERSION AV_VERSION(LIBAVCODEC_VERSION_MAJOR, \ + LIBAVCODEC_VERSION_MINOR, \ + LIBAVCODEC_VERSION_MICRO) +#define LIBAVCODEC_BUILD LIBAVCODEC_VERSION_INT + +#define LIBAVCODEC_IDENT "Lavc" AV_STRINGIFY(LIBAVCODEC_VERSION) + +#endif /* AVCODEC_VERSION_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version_major.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version_major.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version_major.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavcodec/version_major.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,63 @@ +/* + * 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 + */ + +#ifndef AVCODEC_VERSION_MAJOR_H +#define AVCODEC_VERSION_MAJOR_H + +/** + * @file + * @ingroup libavc + * Libavcodec version macros. + */ + +#define LIBAVCODEC_VERSION_MAJOR 62 + +/** + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + */ + +#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63) + +// reminder to remove the OMX encoder on next major bump +#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63) +// reminder to remove Sonic Lossy/Lossless encoders on next major bump +#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63) +// reminder to remove Sonic decoder on next-next major bump +#define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_NVENC_H264_MAIN (LIBAVCODEC_VERSION_MAJOR < 63) + +#endif /* AVCODEC_VERSION_MAJOR_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/attributes.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/attributes.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/attributes.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/attributes.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,227 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +/** + * @file + * Macro definitions for various function/variable attributes + */ + +#ifndef AVUTIL_ATTRIBUTES_H +#define AVUTIL_ATTRIBUTES_H + +#ifdef __GNUC__ +# define AV_GCC_VERSION_AT_LEAST(x,y) (__GNUC__ > (x) || __GNUC__ == (x) && __GNUC_MINOR__ >= (y)) +# define AV_GCC_VERSION_AT_MOST(x,y) (__GNUC__ < (x) || __GNUC__ == (x) && __GNUC_MINOR__ <= (y)) +#else +# define AV_GCC_VERSION_AT_LEAST(x,y) 0 +# define AV_GCC_VERSION_AT_MOST(x,y) 0 +#endif + +#ifdef __has_builtin +# define AV_HAS_BUILTIN(x) __has_builtin(x) +#else +# define AV_HAS_BUILTIN(x) 0 +#endif + +#ifdef __has_attribute +# define AV_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define AV_HAS_ATTRIBUTE(x) 0 +#endif + +#if defined(__cplusplus) && \ + defined(__has_cpp_attribute) && \ + __cplusplus >= 201103L +# define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x) +#elif !defined(__cplusplus) && \ + defined(__has_c_attribute) && \ + defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 202311L +# define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define AV_HAS_STD_ATTRIBUTE(x) 0 +#endif + +#ifndef av_always_inline +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_always_inline __attribute__((always_inline)) inline +#elif defined(_MSC_VER) +# define av_always_inline __forceinline +#else +# define av_always_inline inline +#endif +#endif + +#ifndef av_extern_inline +#if defined(__ICL) && __ICL >= 1210 || defined(__GNUC_STDC_INLINE__) +# define av_extern_inline extern inline +#else +# define av_extern_inline inline +#endif +#endif + +#if AV_HAS_STD_ATTRIBUTE(nodiscard) +# define av_warn_unused_result [[nodiscard]] +#elif AV_GCC_VERSION_AT_LEAST(3,4) || defined(__clang__) +# define av_warn_unused_result __attribute__((warn_unused_result)) +#else +# define av_warn_unused_result +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_noinline __attribute__((noinline)) +#elif defined(_MSC_VER) +# define av_noinline __declspec(noinline) +#else +# define av_noinline +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_pure __attribute__((pure)) +#else +# define av_pure +#endif + +#if AV_GCC_VERSION_AT_LEAST(2,6) || defined(__clang__) +# define av_const __attribute__((const)) +#else +# define av_const +#endif + +#if AV_GCC_VERSION_AT_LEAST(4,3) || defined(__clang__) +# define av_cold __attribute__((cold)) +#else +# define av_cold +#endif + +#if (AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__clang__ )) || AV_HAS_ATTRIBUTE(flatten) +# define av_flatten __attribute__((flatten)) +#else +# define av_flatten +#endif + +#if AV_HAS_STD_ATTRIBUTE(deprecated) +# define attribute_deprecated [[deprecated]] +#elif AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define attribute_deprecated __attribute__((deprecated)) +#elif defined(_MSC_VER) +# define attribute_deprecated __declspec(deprecated) +#else +# define attribute_deprecated +#endif + +/** + * Disable warnings about deprecated features + * This is useful for sections of code kept for backward compatibility and + * scheduled for removal. + */ +#ifndef AV_NOWARN_DEPRECATED +#if AV_GCC_VERSION_AT_LEAST(4,6) || defined(__clang__) +# define AV_NOWARN_DEPRECATED(code) \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \ + code \ + _Pragma("GCC diagnostic pop") +#elif defined(_MSC_VER) +# define AV_NOWARN_DEPRECATED(code) \ + __pragma(warning(push)) \ + __pragma(warning(disable : 4996)) \ + code; \ + __pragma(warning(pop)) +#else +# define AV_NOWARN_DEPRECATED(code) code +#endif +#endif + +#if AV_HAS_STD_ATTRIBUTE(maybe_unused) +# define av_unused [[maybe_unused]] +#elif defined(__GNUC__) || defined(__clang__) +# define av_unused __attribute__((unused)) +#else +# define av_unused +#endif + +/** + * Mark a variable as used and prevent the compiler from optimizing it + * away. This is useful for variables accessed only from inline + * assembler without the compiler being aware. + */ +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) +# define av_used __attribute__((used)) +#else +# define av_used +#endif + +#if AV_GCC_VERSION_AT_LEAST(3,3) || defined(__clang__) +# define av_alias __attribute__((may_alias)) +#else +# define av_alias +#endif + +#if (defined(__GNUC__) || defined(__clang__)) && !defined(__INTEL_COMPILER) +# define av_uninit(x) x=x +#else +# define av_uninit(x) x +#endif + +#if defined(__GNUC__) || defined(__clang__) +# define av_builtin_constant_p __builtin_constant_p +#else +# define av_builtin_constant_p(x) 0 +#endif + +// for __MINGW_PRINTF_FORMAT and __MINGW_SCANF_FORMAT +#ifdef __MINGW32__ +# include +#endif + +#ifdef __MINGW_PRINTF_FORMAT +# define AV_PRINTF_FMT __MINGW_PRINTF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_PRINTF_FMT __printf__ +#endif + +#ifdef __MINGW_SCANF_FORMAT +# define AV_SCANF_FMT __MINGW_SCANF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_SCANF_FMT __scanf__ +#endif + +#ifdef AV_PRINTF_FMT +# define av_printf_format(fmtpos, attrpos) __attribute__((format(AV_PRINTF_FMT, fmtpos, attrpos))) +#else +# define av_printf_format(fmtpos, attrpos) +#endif + +#ifdef AV_SCANF_FMT +# define av_scanf_format(fmtpos, attrpos) __attribute__((format(AV_SCANF_FMT, fmtpos, attrpos))) +#else +# define av_scanf_format(fmtpos, attrpos) +#endif + +#if AV_HAS_STD_ATTRIBUTE(noreturn) +# define av_noreturn [[noreturn]] +#elif AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) +# define av_noreturn __attribute__((noreturn)) +#else +# define av_noreturn +#endif + +#endif /* AVUTIL_ATTRIBUTES_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avconfig.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avconfig.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avconfig.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avconfig.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,6 @@ +/* Generated by ffmpeg configure */ +#ifndef AVUTIL_AVCONFIG_H +#define AVUTIL_AVCONFIG_H +#define AV_HAVE_BIGENDIAN 0 +#define AV_HAVE_FAST_UNALIGNED 0 +#endif /* AVUTIL_AVCONFIG_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avutil.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avutil.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avutil.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/avutil.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,364 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +#ifndef AVUTIL_AVUTIL_H +#define AVUTIL_AVUTIL_H + +/** + * @file + * @ingroup lavu + * Convenience header that includes @ref lavu "libavutil"'s core. + */ + +/** + * @mainpage + * + * @section ffmpeg_intro Introduction + * + * This document describes the usage of the different libraries + * provided by FFmpeg. + * + * @li @ref libavc "libavcodec" encoding/decoding library + * @li @ref lavfi "libavfilter" graph-based frame editing library + * @li @ref libavf "libavformat" I/O and muxing/demuxing library + * @li @ref lavd "libavdevice" special devices muxing/demuxing library + * @li @ref lavu "libavutil" common utility library + * @li @ref lswr "libswresample" audio resampling, format conversion and mixing + * @li @ref libsws "libswscale" color conversion and scaling library + * + * @section ffmpeg_versioning Versioning and compatibility + * + * Each of the FFmpeg libraries contains a version.h header, which defines a + * major, minor and micro version number with the + * LIBRARYNAME_VERSION_{MAJOR,MINOR,MICRO} macros. The major version + * number is incremented with backward incompatible changes - e.g. removing + * parts of the public API, reordering public struct members, etc. The minor + * version number is incremented for backward compatible API changes or major + * new features - e.g. adding a new public function or a new decoder. The micro + * version number is incremented for smaller changes that a calling program + * might still want to check for - e.g. changing behavior in a previously + * unspecified situation. + * + * FFmpeg guarantees backward API and ABI compatibility for each library as long + * as its major version number is unchanged. This means that no public symbols + * will be removed or renamed. Types and names of the public struct members and + * values of public macros and enums will remain the same (unless they were + * explicitly declared as not part of the public API). Documented behavior will + * not change. + * + * In other words, any correct program that works with a given FFmpeg snapshot + * should work just as well without any changes with any later snapshot with the + * same major versions. This applies to both rebuilding the program against new + * FFmpeg versions or to replacing the dynamic FFmpeg libraries that a program + * links against. + * + * However, new public symbols may be added and new members may be appended to + * public structs whose size is not part of public ABI (most public structs in + * FFmpeg). New macros and enum values may be added. Behavior in undocumented + * situations may change slightly (and be documented). All those are accompanied + * by an entry in doc/APIchanges and incrementing either the minor or micro + * version number. + */ + +/** + * @defgroup lavu libavutil + * Common code shared across all FFmpeg libraries. + * + * @note + * libavutil is designed to be modular. In most cases, in order to use the + * functions provided by one component of libavutil you must explicitly include + * the specific header containing that feature. If you are only using + * media-related components, you could simply include libavutil/avutil.h, which + * brings in most of the "core" components. + * + * @{ + * + * @defgroup lavu_crypto Crypto and Hashing + * + * @{ + * @} + * + * @defgroup lavu_math Mathematics + * @{ + * + * @} + * + * @defgroup lavu_string String Manipulation + * + * @{ + * + * @} + * + * @defgroup lavu_mem Memory Management + * + * @{ + * + * @} + * + * @defgroup lavu_data Data Structures + * @{ + * + * @} + * + * @defgroup lavu_video Video related + * + * @{ + * + * @} + * + * @defgroup lavu_audio Audio related + * + * @{ + * + * @} + * + * @defgroup lavu_error Error Codes + * + * @{ + * + * @} + * + * @defgroup lavu_log Logging Facility + * + * @{ + * + * @} + * + * @defgroup lavu_misc Other + * + * @{ + * + * @defgroup preproc_misc Preprocessor String Macros + * + * @{ + * + * @} + * + * @defgroup version_utils Library Version Macros + * + * @{ + * + * @} + */ + + +/** + * @addtogroup lavu_ver + * @{ + */ + +/** + * Return the LIBAVUTIL_VERSION_INT constant. + */ +unsigned avutil_version(void); + +/** + * Return an informative version string. This usually is the actual release + * version number or a git commit description. This string has no fixed format + * and can change any time. It should never be parsed by code. + */ +const char *av_version_info(void); + +/** + * Return the libavutil build-time configuration. + */ +const char *avutil_configuration(void); + +/** + * Return the libavutil license. + */ +const char *avutil_license(void); + +/** + * @} + */ + +/** + * @addtogroup lavu_media Media Type + * @brief Media Type + */ + +enum AVMediaType { + AVMEDIA_TYPE_UNKNOWN = -1, ///< Usually treated as AVMEDIA_TYPE_DATA + AVMEDIA_TYPE_VIDEO, + AVMEDIA_TYPE_AUDIO, + AVMEDIA_TYPE_DATA, ///< Opaque data information usually continuous + AVMEDIA_TYPE_SUBTITLE, + AVMEDIA_TYPE_ATTACHMENT, ///< Opaque data information usually sparse + AVMEDIA_TYPE_NB +}; + +/** + * Return a string describing the media_type enum, NULL if media_type + * is unknown. + */ +const char *av_get_media_type_string(enum AVMediaType media_type); + +/** + * @defgroup lavu_const Constants + * @{ + * + * @defgroup lavu_enc Encoding specific + * + * @note those definition should move to avcodec + * @{ + */ + +#define FF_LAMBDA_SHIFT 7 +#define FF_LAMBDA_SCALE (1< +#include + +/** + * @defgroup lavu_buffer AVBuffer + * @ingroup lavu_data + * + * @{ + * AVBuffer is an API for reference-counted data buffers. + * + * There are two core objects in this API -- AVBuffer and AVBufferRef. AVBuffer + * represents the data buffer itself; it is opaque and not meant to be accessed + * by the caller directly, but only through AVBufferRef. However, the caller may + * e.g. compare two AVBuffer pointers to check whether two different references + * are describing the same data buffer. AVBufferRef represents a single + * reference to an AVBuffer and it is the object that may be manipulated by the + * caller directly. + * + * There are two functions provided for creating a new AVBuffer with a single + * reference -- av_buffer_alloc() to just allocate a new buffer, and + * av_buffer_create() to wrap an existing array in an AVBuffer. From an existing + * reference, additional references may be created with av_buffer_ref(). + * Use av_buffer_unref() to free a reference (this will automatically free the + * data once all the references are freed). + * + * The convention throughout this API and the rest of FFmpeg is such that the + * buffer is considered writable if there exists only one reference to it (and + * it has not been marked as read-only). The av_buffer_is_writable() function is + * provided to check whether this is true and av_buffer_make_writable() will + * automatically create a new writable buffer when necessary. + * Of course nothing prevents the calling code from violating this convention, + * however that is safe only when all the existing references are under its + * control. + * + * @note Referencing and unreferencing the buffers is thread-safe and thus + * may be done from multiple threads simultaneously without any need for + * additional locking. + * + * @note Two different references to the same buffer can point to different + * parts of the buffer (i.e. their AVBufferRef.data will not be equal). + */ + +/** + * A reference counted buffer type. It is opaque and is meant to be used through + * references (AVBufferRef). + */ +typedef struct AVBuffer AVBuffer; + +/** + * A reference to a data buffer. + * + * The size of this struct is not a part of the public ABI and it is not meant + * to be allocated directly. + */ +typedef struct AVBufferRef { + AVBuffer *buffer; + + /** + * The data buffer. It is considered writable if and only if + * this is the only reference to the buffer, in which case + * av_buffer_is_writable() returns 1. + */ + uint8_t *data; + /** + * Size of data in bytes. + */ + size_t size; +} AVBufferRef; + +/** + * Allocate an AVBuffer of the given size using av_malloc(). + * + * @return an AVBufferRef of given size or NULL when out of memory + */ +AVBufferRef *av_buffer_alloc(size_t size); + +/** + * Same as av_buffer_alloc(), except the returned buffer will be initialized + * to zero. + */ +AVBufferRef *av_buffer_allocz(size_t size); + +/** + * Always treat the buffer as read-only, even when it has only one + * reference. + */ +#define AV_BUFFER_FLAG_READONLY (1 << 0) + +/** + * Create an AVBuffer from an existing array. + * + * If this function is successful, data is owned by the AVBuffer. The caller may + * only access data through the returned AVBufferRef and references derived from + * it. + * If this function fails, data is left untouched. + * @param data data array + * @param size size of data in bytes + * @param free a callback for freeing this buffer's data + * @param opaque parameter to be got for processing or passed to free + * @param flags a combination of AV_BUFFER_FLAG_* + * + * @return an AVBufferRef referring to data on success, NULL on failure. + */ +AVBufferRef *av_buffer_create(uint8_t *data, size_t size, + void (*free)(void *opaque, uint8_t *data), + void *opaque, int flags); + +/** + * Default free callback, which calls av_free() on the buffer data. + * This function is meant to be passed to av_buffer_create(), not called + * directly. + */ +void av_buffer_default_free(void *opaque, uint8_t *data); + +/** + * Create a new reference to an AVBuffer. + * + * @return a new AVBufferRef referring to the same AVBuffer as buf or NULL on + * failure. + */ +AVBufferRef *av_buffer_ref(const AVBufferRef *buf); + +/** + * Free a given reference and automatically free the buffer if there are no more + * references to it. + * + * @param buf the reference to be freed. The pointer is set to NULL on return. + */ +void av_buffer_unref(AVBufferRef **buf); + +/** + * @return 1 if the caller may write to the data referred to by buf (which is + * true if and only if buf is the only reference to the underlying AVBuffer). + * Return 0 otherwise. + * A positive answer is valid until av_buffer_ref() is called on buf. + */ +int av_buffer_is_writable(const AVBufferRef *buf); + +/** + * @return the opaque parameter set by av_buffer_create. + */ +void *av_buffer_get_opaque(const AVBufferRef *buf); + +int av_buffer_get_ref_count(const AVBufferRef *buf); + +/** + * Create a writable reference from a given buffer reference, avoiding data copy + * if possible. + * + * @param buf buffer reference to make writable. On success, buf is either left + * untouched, or it is unreferenced and a new writable AVBufferRef is + * written in its place. On failure, buf is left untouched. + * @return 0 on success, a negative AVERROR on failure. + */ +int av_buffer_make_writable(AVBufferRef **buf); + +/** + * Reallocate a given buffer. + * + * @param buf a buffer reference to reallocate. On success, buf will be + * unreferenced and a new reference with the required size will be + * written in its place. On failure buf will be left untouched. *buf + * may be NULL, then a new buffer is allocated. + * @param size required new buffer size. + * @return 0 on success, a negative AVERROR on failure. + * + * @note the buffer is actually reallocated with av_realloc() only if it was + * initially allocated through av_buffer_realloc(NULL) and there is only one + * reference to it (i.e. the one passed to this function). In all other cases + * a new buffer is allocated and the data is copied. + */ +int av_buffer_realloc(AVBufferRef **buf, size_t size); + +/** + * Ensure dst refers to the same data as src. + * + * When *dst is already equivalent to src, do nothing. Otherwise unreference dst + * and replace it with a new reference to src. + * + * @param dst Pointer to either a valid buffer reference or NULL. On success, + * this will point to a buffer reference equivalent to src. On + * failure, dst will be left untouched. + * @param src A buffer reference to replace dst with. May be NULL, then this + * function is equivalent to av_buffer_unref(dst). + * @return 0 on success + * AVERROR(ENOMEM) on memory allocation failure. + */ +int av_buffer_replace(AVBufferRef **dst, const AVBufferRef *src); + +/** + * @} + */ + +/** + * @defgroup lavu_bufferpool AVBufferPool + * @ingroup lavu_data + * + * @{ + * AVBufferPool is an API for a lock-free thread-safe pool of AVBuffers. + * + * Frequently allocating and freeing large buffers may be slow. AVBufferPool is + * meant to solve this in cases when the caller needs a set of buffers of the + * same size (the most obvious use case being buffers for raw video or audio + * frames). + * + * At the beginning, the user must call av_buffer_pool_init() to create the + * buffer pool. Then whenever a buffer is needed, call av_buffer_pool_get() to + * get a reference to a new buffer, similar to av_buffer_alloc(). This new + * reference works in all aspects the same way as the one created by + * av_buffer_alloc(). However, when the last reference to this buffer is + * unreferenced, it is returned to the pool instead of being freed and will be + * reused for subsequent av_buffer_pool_get() calls. + * + * When the caller is done with the pool and no longer needs to allocate any new + * buffers, av_buffer_pool_uninit() must be called to mark the pool as freeable. + * Once all the buffers are released, it will automatically be freed. + * + * Allocating and releasing buffers with this API is thread-safe as long as + * either the default alloc callback is used, or the user-supplied one is + * thread-safe. + */ + +/** + * The buffer pool. This structure is opaque and not meant to be accessed + * directly. It is allocated with av_buffer_pool_init() and freed with + * av_buffer_pool_uninit(). + */ +typedef struct AVBufferPool AVBufferPool; + +/** + * Allocate and initialize a buffer pool. + * + * @param size size of each buffer in this pool + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be used + * (av_buffer_alloc()). + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init(size_t size, AVBufferRef* (*alloc)(size_t size)); + +/** + * Allocate and initialize a buffer pool with a more complex allocator. + * + * @param size size of each buffer in this pool + * @param opaque arbitrary user data used by the allocator + * @param alloc a function that will be used to allocate new buffers when the + * pool is empty. May be NULL, then the default allocator will be + * used (av_buffer_alloc()). + * @param pool_free a function that will be called immediately before the pool + * is freed. I.e. after av_buffer_pool_uninit() is called + * by the caller and all the frames are returned to the pool + * and freed. It is intended to uninitialize the user opaque + * data. May be NULL. + * @return newly created buffer pool on success, NULL on error. + */ +AVBufferPool *av_buffer_pool_init2(size_t size, void *opaque, + AVBufferRef* (*alloc)(void *opaque, size_t size), + void (*pool_free)(void *opaque)); + +/** + * Mark the pool as being available for freeing. It will actually be freed only + * once all the allocated buffers associated with the pool are released. Thus it + * is safe to call this function while some of the allocated buffers are still + * in use. + * + * @param pool pointer to the pool to be freed. It will be set to NULL. + */ +void av_buffer_pool_uninit(AVBufferPool **pool); + +/** + * Allocate a new AVBuffer, reusing an old buffer from the pool when available. + * This function may be called simultaneously from multiple threads. + * + * @return a reference to the new buffer on success, NULL on error. + */ +AVBufferRef *av_buffer_pool_get(AVBufferPool *pool); + +/** + * Query the original opaque parameter of an allocated buffer in the pool. + * + * @param ref a buffer reference to a buffer returned by av_buffer_pool_get. + * @return the opaque parameter set by the buffer allocator function of the + * buffer pool. + * + * @note the opaque parameter of ref is used by the buffer pool implementation, + * therefore you have to use this function to access the original opaque + * parameter of an allocated buffer. + */ +void *av_buffer_pool_buffer_get_opaque(const AVBufferRef *ref); + +/** + * @} + */ + +#endif /* AVUTIL_BUFFER_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/channel_layout.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/channel_layout.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/channel_layout.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/channel_layout.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,762 @@ +/* + * Copyright (c) 2006 Michael Niedermayer + * Copyright (c) 2008 Peter Ross + * + * 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 + */ + +#ifndef AVUTIL_CHANNEL_LAYOUT_H +#define AVUTIL_CHANNEL_LAYOUT_H + +#include +#include + +#include "version.h" +#include "attributes.h" + +/** + * @file + * @ingroup lavu_audio_channels + * Public libavutil channel layout APIs header. + */ + + +/** + * @defgroup lavu_audio_channels Audio channels + * @ingroup lavu_audio + * + * Audio channel layout utility functions + * + * @{ + */ + +enum AVChannel { + /// Invalid channel index + AV_CHAN_NONE = -1, + AV_CHAN_FRONT_LEFT, + AV_CHAN_FRONT_RIGHT, + AV_CHAN_FRONT_CENTER, + AV_CHAN_LOW_FREQUENCY, + AV_CHAN_BACK_LEFT, + AV_CHAN_BACK_RIGHT, + AV_CHAN_FRONT_LEFT_OF_CENTER, + AV_CHAN_FRONT_RIGHT_OF_CENTER, + AV_CHAN_BACK_CENTER, + AV_CHAN_SIDE_LEFT, + AV_CHAN_SIDE_RIGHT, + AV_CHAN_TOP_CENTER, + AV_CHAN_TOP_FRONT_LEFT, + AV_CHAN_TOP_FRONT_CENTER, + AV_CHAN_TOP_FRONT_RIGHT, + AV_CHAN_TOP_BACK_LEFT, + AV_CHAN_TOP_BACK_CENTER, + AV_CHAN_TOP_BACK_RIGHT, + /** Stereo downmix. */ + AV_CHAN_STEREO_LEFT = 29, + /** See above. */ + AV_CHAN_STEREO_RIGHT, + AV_CHAN_WIDE_LEFT, + AV_CHAN_WIDE_RIGHT, + AV_CHAN_SURROUND_DIRECT_LEFT, + AV_CHAN_SURROUND_DIRECT_RIGHT, + AV_CHAN_LOW_FREQUENCY_2, + AV_CHAN_TOP_SIDE_LEFT, + AV_CHAN_TOP_SIDE_RIGHT, + AV_CHAN_BOTTOM_FRONT_CENTER, + AV_CHAN_BOTTOM_FRONT_LEFT, + AV_CHAN_BOTTOM_FRONT_RIGHT, + AV_CHAN_SIDE_SURROUND_LEFT, ///< +90 degrees, Lss, SiL + AV_CHAN_SIDE_SURROUND_RIGHT, ///< -90 degrees, Rss, SiR + AV_CHAN_TOP_SURROUND_LEFT, ///< +110 degrees, Lvs, TpLS + AV_CHAN_TOP_SURROUND_RIGHT, ///< -110 degrees, Rvs, TpRS + + AV_CHAN_BINAURAL_LEFT = 61, + AV_CHAN_BINAURAL_RIGHT, + + /** Channel is empty can be safely skipped. */ + AV_CHAN_UNUSED = 0x200, + + /** Channel contains data, but its position is unknown. */ + AV_CHAN_UNKNOWN = 0x300, + + /** + * Range of channels between AV_CHAN_AMBISONIC_BASE and + * AV_CHAN_AMBISONIC_END represent Ambisonic components using the ACN system. + * + * Given a channel id `` between AV_CHAN_AMBISONIC_BASE and + * AV_CHAN_AMBISONIC_END (inclusive), the ACN index of the channel `` is + * ` = - AV_CHAN_AMBISONIC_BASE`. + * + * @note these values are only used for AV_CHANNEL_ORDER_CUSTOM channel + * orderings, the AV_CHANNEL_ORDER_AMBISONIC ordering orders the channels + * implicitly by their position in the stream. + */ + AV_CHAN_AMBISONIC_BASE = 0x400, + // leave space for 1024 ids, which correspond to maximum order-32 harmonics, + // which should be enough for the foreseeable use cases + AV_CHAN_AMBISONIC_END = 0x7ff, +}; + +enum AVChannelOrder { + /** + * Only the channel count is specified, without any further information + * about the channel order. + */ + AV_CHANNEL_ORDER_UNSPEC, + /** + * The native channel order, i.e. the channels are in the same order in + * which they are defined in the AVChannel enum. This supports up to 63 + * different channels. + */ + AV_CHANNEL_ORDER_NATIVE, + /** + * The channel order does not correspond to any other predefined order and + * is stored as an explicit map. For example, this could be used to support + * layouts with 64 or more channels, or with empty/skipped (AV_CHAN_UNUSED) + * channels at arbitrary positions. + */ + AV_CHANNEL_ORDER_CUSTOM, + /** + * The audio is represented as the decomposition of the sound field into + * spherical harmonics. Each channel corresponds to a single expansion + * component. Channels are ordered according to ACN (Ambisonic Channel + * Number). + * + * The channel with the index n in the stream contains the spherical + * harmonic of degree l and order m given by + * @code{.unparsed} + * l = floor(sqrt(n)), + * m = n - l * (l + 1). + * @endcode + * + * Conversely given a spherical harmonic of degree l and order m, the + * corresponding channel index n is given by + * @code{.unparsed} + * n = l * (l + 1) + m. + * @endcode + * + * Normalization is assumed to be SN3D (Schmidt Semi-Normalization) + * as defined in AmbiX format $ 2.1. + */ + AV_CHANNEL_ORDER_AMBISONIC, + /** + * Number of channel orders, not part of ABI/API + */ + FF_CHANNEL_ORDER_NB +}; + + +/** + * @defgroup channel_masks Audio channel masks + * + * A channel layout is a 64-bits integer with a bit set for every channel. + * The number of bits set must be equal to the number of channels. + * The value 0 means that the channel layout is not known. + * @note this data structure is not powerful enough to handle channels + * combinations that have the same channel multiple times, such as + * dual-mono. + * + * @{ + */ +#define AV_CH_FRONT_LEFT (1ULL << AV_CHAN_FRONT_LEFT ) +#define AV_CH_FRONT_RIGHT (1ULL << AV_CHAN_FRONT_RIGHT ) +#define AV_CH_FRONT_CENTER (1ULL << AV_CHAN_FRONT_CENTER ) +#define AV_CH_LOW_FREQUENCY (1ULL << AV_CHAN_LOW_FREQUENCY ) +#define AV_CH_BACK_LEFT (1ULL << AV_CHAN_BACK_LEFT ) +#define AV_CH_BACK_RIGHT (1ULL << AV_CHAN_BACK_RIGHT ) +#define AV_CH_FRONT_LEFT_OF_CENTER (1ULL << AV_CHAN_FRONT_LEFT_OF_CENTER ) +#define AV_CH_FRONT_RIGHT_OF_CENTER (1ULL << AV_CHAN_FRONT_RIGHT_OF_CENTER) +#define AV_CH_BACK_CENTER (1ULL << AV_CHAN_BACK_CENTER ) +#define AV_CH_SIDE_LEFT (1ULL << AV_CHAN_SIDE_LEFT ) +#define AV_CH_SIDE_RIGHT (1ULL << AV_CHAN_SIDE_RIGHT ) +#define AV_CH_TOP_CENTER (1ULL << AV_CHAN_TOP_CENTER ) +#define AV_CH_TOP_FRONT_LEFT (1ULL << AV_CHAN_TOP_FRONT_LEFT ) +#define AV_CH_TOP_FRONT_CENTER (1ULL << AV_CHAN_TOP_FRONT_CENTER ) +#define AV_CH_TOP_FRONT_RIGHT (1ULL << AV_CHAN_TOP_FRONT_RIGHT ) +#define AV_CH_TOP_BACK_LEFT (1ULL << AV_CHAN_TOP_BACK_LEFT ) +#define AV_CH_TOP_BACK_CENTER (1ULL << AV_CHAN_TOP_BACK_CENTER ) +#define AV_CH_TOP_BACK_RIGHT (1ULL << AV_CHAN_TOP_BACK_RIGHT ) +#define AV_CH_STEREO_LEFT (1ULL << AV_CHAN_STEREO_LEFT ) +#define AV_CH_STEREO_RIGHT (1ULL << AV_CHAN_STEREO_RIGHT ) +#define AV_CH_WIDE_LEFT (1ULL << AV_CHAN_WIDE_LEFT ) +#define AV_CH_WIDE_RIGHT (1ULL << AV_CHAN_WIDE_RIGHT ) +#define AV_CH_SURROUND_DIRECT_LEFT (1ULL << AV_CHAN_SURROUND_DIRECT_LEFT ) +#define AV_CH_SURROUND_DIRECT_RIGHT (1ULL << AV_CHAN_SURROUND_DIRECT_RIGHT) +#define AV_CH_LOW_FREQUENCY_2 (1ULL << AV_CHAN_LOW_FREQUENCY_2 ) +#define AV_CH_TOP_SIDE_LEFT (1ULL << AV_CHAN_TOP_SIDE_LEFT ) +#define AV_CH_TOP_SIDE_RIGHT (1ULL << AV_CHAN_TOP_SIDE_RIGHT ) +#define AV_CH_BOTTOM_FRONT_CENTER (1ULL << AV_CHAN_BOTTOM_FRONT_CENTER ) +#define AV_CH_BOTTOM_FRONT_LEFT (1ULL << AV_CHAN_BOTTOM_FRONT_LEFT ) +#define AV_CH_BOTTOM_FRONT_RIGHT (1ULL << AV_CHAN_BOTTOM_FRONT_RIGHT ) +#define AV_CH_SIDE_SURROUND_LEFT (1ULL << AV_CHAN_SIDE_SURROUND_LEFT ) +#define AV_CH_SIDE_SURROUND_RIGHT (1ULL << AV_CHAN_SIDE_SURROUND_RIGHT ) +#define AV_CH_TOP_SURROUND_LEFT (1ULL << AV_CHAN_TOP_SURROUND_LEFT ) +#define AV_CH_TOP_SURROUND_RIGHT (1ULL << AV_CHAN_TOP_SURROUND_RIGHT ) +#define AV_CH_BINAURAL_LEFT (1ULL << AV_CHAN_BINAURAL_LEFT ) +#define AV_CH_BINAURAL_RIGHT (1ULL << AV_CHAN_BINAURAL_RIGHT ) + +/** + * @} + * @defgroup channel_mask_c Audio channel layouts + * @{ + * */ +#define AV_CH_LAYOUT_MONO (AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_STEREO (AV_CH_FRONT_LEFT|AV_CH_FRONT_RIGHT) +#define AV_CH_LAYOUT_2POINT1 (AV_CH_LAYOUT_STEREO|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_1 (AV_CH_LAYOUT_STEREO|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_SURROUND (AV_CH_LAYOUT_STEREO|AV_CH_FRONT_CENTER) +#define AV_CH_LAYOUT_3POINT1 (AV_CH_LAYOUT_SURROUND|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_4POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_4POINT1 (AV_CH_LAYOUT_4POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_2_2 (AV_CH_LAYOUT_STEREO|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_QUAD (AV_CH_LAYOUT_STEREO|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT0 (AV_CH_LAYOUT_SURROUND|AV_CH_SIDE_LEFT|AV_CH_SIDE_RIGHT) +#define AV_CH_LAYOUT_5POINT1 (AV_CH_LAYOUT_5POINT0|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_5POINT0_BACK (AV_CH_LAYOUT_SURROUND|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1_BACK (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_6POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT0_FRONT (AV_CH_LAYOUT_2_2|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_HEXAGONAL (AV_CH_LAYOUT_5POINT0_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_3POINT1POINT2 (AV_CH_LAYOUT_3POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_6POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_BACK_CENTER) +#define AV_CH_LAYOUT_6POINT1_FRONT (AV_CH_LAYOUT_6POINT0_FRONT|AV_CH_LOW_FREQUENCY) +#define AV_CH_LAYOUT_7POINT0 (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT0_FRONT (AV_CH_LAYOUT_5POINT0|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1 (AV_CH_LAYOUT_5POINT1|AV_CH_BACK_LEFT|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1_WIDE (AV_CH_LAYOUT_5POINT1|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_7POINT1_WIDE_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_5POINT1POINT2 (AV_CH_LAYOUT_5POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_5POINT1POINT2_BACK (AV_CH_LAYOUT_5POINT1_BACK|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_OCTAGONAL (AV_CH_LAYOUT_5POINT0|AV_CH_BACK_LEFT|AV_CH_BACK_CENTER|AV_CH_BACK_RIGHT) +#define AV_CH_LAYOUT_CUBE (AV_CH_LAYOUT_QUAD|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) +#define AV_CH_LAYOUT_5POINT1POINT4_BACK (AV_CH_LAYOUT_5POINT1POINT2|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT1POINT2 (AV_CH_LAYOUT_7POINT1|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_7POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT) +#define AV_CH_LAYOUT_7POINT2POINT3 (AV_CH_LAYOUT_7POINT1POINT2|AV_CH_TOP_BACK_CENTER|AV_CH_LOW_FREQUENCY_2) +#define AV_CH_LAYOUT_9POINT1POINT4_BACK (AV_CH_LAYOUT_7POINT1POINT4_BACK|AV_CH_FRONT_LEFT_OF_CENTER|AV_CH_FRONT_RIGHT_OF_CENTER) +#define AV_CH_LAYOUT_9POINT1POINT6 (AV_CH_LAYOUT_9POINT1POINT4_BACK|AV_CH_TOP_SIDE_LEFT|AV_CH_TOP_SIDE_RIGHT) +#define AV_CH_LAYOUT_HEXADECAGONAL (AV_CH_LAYOUT_OCTAGONAL|AV_CH_WIDE_LEFT|AV_CH_WIDE_RIGHT|AV_CH_TOP_BACK_LEFT|AV_CH_TOP_BACK_RIGHT|AV_CH_TOP_BACK_CENTER|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_FRONT_LEFT|AV_CH_TOP_FRONT_RIGHT) +#define AV_CH_LAYOUT_BINAURAL (AV_CH_BINAURAL_LEFT|AV_CH_BINAURAL_RIGHT) +#define AV_CH_LAYOUT_STEREO_DOWNMIX (AV_CH_STEREO_LEFT|AV_CH_STEREO_RIGHT) +#define AV_CH_LAYOUT_22POINT2 (AV_CH_LAYOUT_9POINT1POINT6|AV_CH_BACK_CENTER|AV_CH_LOW_FREQUENCY_2|AV_CH_TOP_FRONT_CENTER|AV_CH_TOP_CENTER|AV_CH_TOP_BACK_CENTER|AV_CH_BOTTOM_FRONT_CENTER|AV_CH_BOTTOM_FRONT_LEFT|AV_CH_BOTTOM_FRONT_RIGHT) + +#define AV_CH_LAYOUT_7POINT1_TOP_BACK AV_CH_LAYOUT_5POINT1POINT2_BACK + +enum AVMatrixEncoding { + AV_MATRIX_ENCODING_NONE, + AV_MATRIX_ENCODING_DOLBY, + AV_MATRIX_ENCODING_DPLII, + AV_MATRIX_ENCODING_DPLIIX, + AV_MATRIX_ENCODING_DPLIIZ, + AV_MATRIX_ENCODING_DOLBYEX, + AV_MATRIX_ENCODING_DOLBYHEADPHONE, + AV_MATRIX_ENCODING_NB +}; + +/** + * @} + */ + +/** + * An AVChannelCustom defines a single channel within a custom order layout + * + * Unlike most structures in FFmpeg, sizeof(AVChannelCustom) is a part of the + * public ABI. + * + * No new fields may be added to it without a major version bump. + */ +typedef struct AVChannelCustom { + enum AVChannel id; + char name[16]; + void *opaque; +} AVChannelCustom; + +/** + * An AVChannelLayout holds information about the channel layout of audio data. + * + * A channel layout here is defined as a set of channels ordered in a specific + * way (unless the channel order is AV_CHANNEL_ORDER_UNSPEC, in which case an + * AVChannelLayout carries only the channel count). + * All orders may be treated as if they were AV_CHANNEL_ORDER_UNSPEC by + * ignoring everything but the channel count, as long as av_channel_layout_check() + * considers they are valid. + * + * Unlike most structures in FFmpeg, sizeof(AVChannelLayout) is a part of the + * public ABI and may be used by the caller. E.g. it may be allocated on stack + * or embedded in caller-defined structs. + * + * AVChannelLayout can be initialized as follows: + * - default initialization with {0}, followed by setting all used fields + * correctly; + * - by assigning one of the predefined AV_CHANNEL_LAYOUT_* initializers; + * - with a constructor function, such as av_channel_layout_default(), + * av_channel_layout_from_mask() or av_channel_layout_from_string(). + * + * The channel layout must be uninitialized with av_channel_layout_uninit() + * + * Copying an AVChannelLayout via assigning is forbidden, + * av_channel_layout_copy() must be used instead (and its return value should + * be checked) + * + * No new fields may be added to it without a major version bump, except for + * new elements of the union fitting in sizeof(uint64_t). + */ +typedef struct AVChannelLayout { + /** + * Channel order used in this layout. + * This is a mandatory field. + */ + enum AVChannelOrder order; + + /** + * Number of channels in this layout. Mandatory field. + */ + int nb_channels; + + /** + * Details about which channels are present in this layout. + * For AV_CHANNEL_ORDER_UNSPEC, this field is undefined and must not be + * used. + */ + union { + /** + * This member must be used for AV_CHANNEL_ORDER_NATIVE, and may be used + * for AV_CHANNEL_ORDER_AMBISONIC to signal non-diegetic channels. + * It is a bitmask, where the position of each set bit means that the + * AVChannel with the corresponding value is present. + * + * I.e. when (mask & (1 << AV_CHAN_FOO)) is non-zero, then AV_CHAN_FOO + * is present in the layout. Otherwise it is not present. + * + * @note when a channel layout using a bitmask is constructed or + * modified manually (i.e. not using any of the av_channel_layout_* + * functions), the code doing it must ensure that the number of set bits + * is equal to nb_channels. + */ + uint64_t mask; + /** + * This member must be used when the channel order is + * AV_CHANNEL_ORDER_CUSTOM. It is a nb_channels-sized array, with each + * element signalling the presence of the AVChannel with the + * corresponding value in map[i].id. + * + * I.e. when map[i].id is equal to AV_CHAN_FOO, then AV_CH_FOO is the + * i-th channel in the audio data. + * + * When map[i].id is in the range between AV_CHAN_AMBISONIC_BASE and + * AV_CHAN_AMBISONIC_END (inclusive), the channel contains an ambisonic + * component with ACN index (as defined above) + * n = map[i].id - AV_CHAN_AMBISONIC_BASE. + * + * map[i].name may be filled with a 0-terminated string, in which case + * it will be used for the purpose of identifying the channel with the + * convenience functions below. Otherwise it must be zeroed. + */ + AVChannelCustom *map; + } u; + + /** + * For some private data of the user. + */ + void *opaque; +} AVChannelLayout; + +/** + * Macro to define native channel layouts + * + * @note This doesn't use designated initializers for compatibility with C++ 17 and older. + */ +#define AV_CHANNEL_LAYOUT_MASK(nb, m) \ + { /* .order */ AV_CHANNEL_ORDER_NATIVE, \ + /* .nb_channels */ (nb), \ + /* .u.mask */ { m }, \ + /* .opaque */ NULL } + +/** + * @name Common pre-defined channel layouts + * @{ + */ +#define AV_CHANNEL_LAYOUT_MONO AV_CHANNEL_LAYOUT_MASK(1, AV_CH_LAYOUT_MONO) +#define AV_CHANNEL_LAYOUT_STEREO AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO) +#define AV_CHANNEL_LAYOUT_2POINT1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2POINT1) +#define AV_CHANNEL_LAYOUT_2_1 AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_2_1) +#define AV_CHANNEL_LAYOUT_SURROUND AV_CHANNEL_LAYOUT_MASK(3, AV_CH_LAYOUT_SURROUND) +#define AV_CHANNEL_LAYOUT_3POINT1 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_3POINT1) +#define AV_CHANNEL_LAYOUT_4POINT0 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_4POINT0) +#define AV_CHANNEL_LAYOUT_4POINT1 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_4POINT1) +#define AV_CHANNEL_LAYOUT_2_2 AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_2_2) +#define AV_CHANNEL_LAYOUT_QUAD AV_CHANNEL_LAYOUT_MASK(4, AV_CH_LAYOUT_QUAD) +#define AV_CHANNEL_LAYOUT_5POINT0 AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0) +#define AV_CHANNEL_LAYOUT_5POINT1 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1) +#define AV_CHANNEL_LAYOUT_5POINT0_BACK AV_CHANNEL_LAYOUT_MASK(5, AV_CH_LAYOUT_5POINT0_BACK) +#define AV_CHANNEL_LAYOUT_5POINT1_BACK AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_5POINT1_BACK) +#define AV_CHANNEL_LAYOUT_6POINT0 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0) +#define AV_CHANNEL_LAYOUT_6POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_6POINT0_FRONT) +#define AV_CHANNEL_LAYOUT_3POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_3POINT1POINT2) +#define AV_CHANNEL_LAYOUT_HEXAGONAL AV_CHANNEL_LAYOUT_MASK(6, AV_CH_LAYOUT_HEXAGONAL) +#define AV_CHANNEL_LAYOUT_6POINT1 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1) +#define AV_CHANNEL_LAYOUT_6POINT1_BACK AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_BACK) +#define AV_CHANNEL_LAYOUT_6POINT1_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_6POINT1_FRONT) +#define AV_CHANNEL_LAYOUT_7POINT0 AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0) +#define AV_CHANNEL_LAYOUT_7POINT0_FRONT AV_CHANNEL_LAYOUT_MASK(7, AV_CH_LAYOUT_7POINT0_FRONT) +#define AV_CHANNEL_LAYOUT_7POINT1 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1) +#define AV_CHANNEL_LAYOUT_7POINT1_WIDE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE) +#define AV_CHANNEL_LAYOUT_7POINT1_WIDE_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_7POINT1_WIDE_BACK) +#define AV_CHANNEL_LAYOUT_5POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2) +#define AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_5POINT1POINT2_BACK) +#define AV_CHANNEL_LAYOUT_OCTAGONAL AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_OCTAGONAL) +#define AV_CHANNEL_LAYOUT_CUBE AV_CHANNEL_LAYOUT_MASK(8, AV_CH_LAYOUT_CUBE) +#define AV_CHANNEL_LAYOUT_5POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_5POINT1POINT4_BACK) +#define AV_CHANNEL_LAYOUT_7POINT1POINT2 AV_CHANNEL_LAYOUT_MASK(10, AV_CH_LAYOUT_7POINT1POINT2) +#define AV_CHANNEL_LAYOUT_7POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT1POINT4_BACK) +#define AV_CHANNEL_LAYOUT_7POINT2POINT3 AV_CHANNEL_LAYOUT_MASK(12, AV_CH_LAYOUT_7POINT2POINT3) +#define AV_CHANNEL_LAYOUT_9POINT1POINT4_BACK AV_CHANNEL_LAYOUT_MASK(14, AV_CH_LAYOUT_9POINT1POINT4_BACK) +#define AV_CHANNEL_LAYOUT_9POINT1POINT6 AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_9POINT1POINT6) +#define AV_CHANNEL_LAYOUT_HEXADECAGONAL AV_CHANNEL_LAYOUT_MASK(16, AV_CH_LAYOUT_HEXADECAGONAL) +#define AV_CHANNEL_LAYOUT_BINAURAL AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_BINAURAL) +#define AV_CHANNEL_LAYOUT_STEREO_DOWNMIX AV_CHANNEL_LAYOUT_MASK(2, AV_CH_LAYOUT_STEREO_DOWNMIX) +#define AV_CHANNEL_LAYOUT_22POINT2 AV_CHANNEL_LAYOUT_MASK(24, AV_CH_LAYOUT_22POINT2) + +#define AV_CHANNEL_LAYOUT_7POINT1_TOP_BACK AV_CHANNEL_LAYOUT_5POINT1POINT2_BACK + +#define AV_CHANNEL_LAYOUT_AMBISONIC_FIRST_ORDER \ + { /* .order */ AV_CHANNEL_ORDER_AMBISONIC, \ + /* .nb_channels */ 4, \ + /* .u.mask */ { 0 }, \ + /* .opaque */ NULL } +/** @} */ + +struct AVBPrint; + +/** + * Get a human readable string in an abbreviated form describing a given channel. + * This is the inverse function of @ref av_channel_from_string(). + * + * @param buf pre-allocated buffer where to put the generated string + * @param buf_size size in bytes of the buffer. + * @param channel the AVChannel whose name to get + * @return amount of bytes needed to hold the output string, or a negative AVERROR + * on failure. If the returned value is bigger than buf_size, then the + * string was truncated. + */ +int av_channel_name(char *buf, size_t buf_size, enum AVChannel channel); + +/** + * bprint variant of av_channel_name(). + * + * @note the string will be appended to the bprint buffer. + */ +void av_channel_name_bprint(struct AVBPrint *bp, enum AVChannel channel_id); + +/** + * Get a human readable string describing a given channel. + * + * @param buf pre-allocated buffer where to put the generated string + * @param buf_size size in bytes of the buffer. + * @param channel the AVChannel whose description to get + * @return amount of bytes needed to hold the output string, or a negative AVERROR + * on failure. If the returned value is bigger than buf_size, then the + * string was truncated. + */ +int av_channel_description(char *buf, size_t buf_size, enum AVChannel channel); + +/** + * bprint variant of av_channel_description(). + * + * @note the string will be appended to the bprint buffer. + */ +void av_channel_description_bprint(struct AVBPrint *bp, enum AVChannel channel_id); + +/** + * This is the inverse function of @ref av_channel_name(). + * + * @return the channel with the given name + * AV_CHAN_NONE when name does not identify a known channel + */ +enum AVChannel av_channel_from_string(const char *name); + +/** + * Initialize a custom channel layout with the specified number of channels. + * The channel map will be allocated and the designation of all channels will + * be set to AV_CHAN_UNKNOWN. + * + * This is only a convenience helper function, a custom channel layout can also + * be constructed without using this. + * + * @param channel_layout the layout structure to be initialized + * @param nb_channels the number of channels + * + * @return 0 on success + * AVERROR(EINVAL) if the number of channels <= 0 + * AVERROR(ENOMEM) if the channel map could not be allocated + */ +int av_channel_layout_custom_init(AVChannelLayout *channel_layout, int nb_channels); + +/** + * Initialize a native channel layout from a bitmask indicating which channels + * are present. + * + * @param channel_layout the layout structure to be initialized + * @param mask bitmask describing the channel layout + * + * @return 0 on success + * AVERROR(EINVAL) for invalid mask values + */ +int av_channel_layout_from_mask(AVChannelLayout *channel_layout, uint64_t mask); + +/** + * Initialize a channel layout from a given string description. + * The input string can be represented by: + * - the formal channel layout name (returned by av_channel_layout_describe()) + * - single or multiple channel names (returned by av_channel_name(), eg. "FL", + * or concatenated with "+", each optionally containing a custom name after + * a "@", eg. "FL@Left+FR@Right+LFE") + * - a decimal or hexadecimal value of a native channel layout (eg. "4" or "0x4") + * - the number of channels with default layout (eg. "4c") + * - the number of unordered channels (eg. "4C" or "4 channels") + * - the ambisonic order followed by optional non-diegetic channels (eg. + * "ambisonic 2+stereo") + * On error, the channel layout will remain uninitialized, but not necessarily + * untouched. + * + * @param channel_layout uninitialized channel layout for the result + * @param str string describing the channel layout + * @return 0 on success parsing the channel layout + * AVERROR(EINVAL) if an invalid channel layout string was provided + * AVERROR(ENOMEM) if there was not enough memory + */ +int av_channel_layout_from_string(AVChannelLayout *channel_layout, + const char *str); + +/** + * Get the default channel layout for a given number of channels. + * + * @param ch_layout the layout structure to be initialized + * @param nb_channels number of channels + */ +void av_channel_layout_default(AVChannelLayout *ch_layout, int nb_channels); + +/** + * Iterate over all standard channel layouts. + * + * @param opaque a pointer where libavutil will store the iteration state. Must + * point to NULL to start the iteration. + * + * @return the standard channel layout or NULL when the iteration is + * finished + */ +const AVChannelLayout *av_channel_layout_standard(void **opaque); + +/** + * Free any allocated data in the channel layout and reset the channel + * count to 0. + * + * @param channel_layout the layout structure to be uninitialized + */ +void av_channel_layout_uninit(AVChannelLayout *channel_layout); + +/** + * Make a copy of a channel layout. This differs from just assigning src to dst + * in that it allocates and copies the map for AV_CHANNEL_ORDER_CUSTOM. + * + * @note the destination channel_layout will be always uninitialized before copy. + * + * @param dst destination channel layout + * @param src source channel layout + * @return 0 on success, a negative AVERROR on error. + */ +int av_channel_layout_copy(AVChannelLayout *dst, const AVChannelLayout *src); + +/** + * Get a human-readable string describing the channel layout properties. + * The string will be in the same format that is accepted by + * @ref av_channel_layout_from_string(), allowing to rebuild the same + * channel layout, except for opaque pointers. + * + * @param channel_layout channel layout to be described + * @param buf pre-allocated buffer where to put the generated string + * @param buf_size size in bytes of the buffer. + * @return amount of bytes needed to hold the output string, or a negative AVERROR + * on failure. If the returned value is bigger than buf_size, then the + * string was truncated. + */ +int av_channel_layout_describe(const AVChannelLayout *channel_layout, + char *buf, size_t buf_size); + +/** + * bprint variant of av_channel_layout_describe(). + * + * @note the string will be appended to the bprint buffer. + * @return 0 on success, or a negative AVERROR value on failure. + */ +int av_channel_layout_describe_bprint(const AVChannelLayout *channel_layout, + struct AVBPrint *bp); + +/** + * Get the channel with the given index in a channel layout. + * + * @param channel_layout input channel layout + * @param idx index of the channel + * @return channel with the index idx in channel_layout on success or + * AV_CHAN_NONE on failure (if idx is not valid or the channel order is + * unspecified) + */ +enum AVChannel +av_channel_layout_channel_from_index(const AVChannelLayout *channel_layout, unsigned int idx); + +/** + * Get the index of a given channel in a channel layout. In case multiple + * channels are found, only the first match will be returned. + * + * @param channel_layout input channel layout + * @param channel the channel whose index to obtain + * @return index of channel in channel_layout on success or a negative number if + * channel is not present in channel_layout. + */ +int av_channel_layout_index_from_channel(const AVChannelLayout *channel_layout, + enum AVChannel channel); + +/** + * Get the index in a channel layout of a channel described by the given string. + * In case multiple channels are found, only the first match will be returned. + * + * This function accepts channel names in the same format as + * @ref av_channel_from_string(). + * + * @param channel_layout input channel layout + * @param name string describing the channel whose index to obtain + * @return a channel index described by the given string, or a negative AVERROR + * value. + */ +int av_channel_layout_index_from_string(const AVChannelLayout *channel_layout, + const char *name); + +/** + * Get a channel described by the given string. + * + * This function accepts channel names in the same format as + * @ref av_channel_from_string(). + * + * @param channel_layout input channel layout + * @param name string describing the channel to obtain + * @return a channel described by the given string in channel_layout on success + * or AV_CHAN_NONE on failure (if the string is not valid or the channel + * order is unspecified) + */ +enum AVChannel +av_channel_layout_channel_from_string(const AVChannelLayout *channel_layout, + const char *name); + +/** + * Find out what channels from a given set are present in a channel layout, + * without regard for their positions. + * + * @param channel_layout input channel layout + * @param mask a combination of AV_CH_* representing a set of channels + * @return a bitfield representing all the channels from mask that are present + * in channel_layout + */ +uint64_t av_channel_layout_subset(const AVChannelLayout *channel_layout, + uint64_t mask); + +/** + * Check whether a channel layout is valid, i.e. can possibly describe audio + * data. + * + * @param channel_layout input channel layout + * @return 1 if channel_layout is valid, 0 otherwise. + */ +int av_channel_layout_check(const AVChannelLayout *channel_layout); + +/** + * Check whether two channel layouts are semantically the same, i.e. the same + * channels are present on the same positions in both. + * + * If one of the channel layouts is AV_CHANNEL_ORDER_UNSPEC, while the other is + * not, they are considered to be unequal. If both are AV_CHANNEL_ORDER_UNSPEC, + * they are considered equal iff the channel counts are the same in both. + * + * @param chl input channel layout + * @param chl1 input channel layout + * @return 0 if chl and chl1 are equal, 1 if they are not equal. A negative + * AVERROR code if one or both are invalid. + */ +int av_channel_layout_compare(const AVChannelLayout *chl, const AVChannelLayout *chl1); + +/** + * Return the order if the layout is n-th order standard-order ambisonic. + * The presence of optional extra non-diegetic channels at the end is not taken + * into account. + * + * @param channel_layout input channel layout + * @return the order of the layout, a negative error code otherwise. + */ +int av_channel_layout_ambisonic_order(const AVChannelLayout *channel_layout); + +/** + * The conversion must be lossless. + */ +#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS (1 << 0) + +/** + * The specified retype target order is ignored and the simplest possible + * (canonical) order is used for which the input layout can be losslessy + * represented. + */ +#define AV_CHANNEL_LAYOUT_RETYPE_FLAG_CANONICAL (1 << 1) + +/** + * Change the AVChannelOrder of a channel layout. + * + * Change of AVChannelOrder can be either lossless or lossy. In case of a + * lossless conversion all the channel designations and the associated channel + * names (if any) are kept. On a lossy conversion the channel names and channel + * designations might be lost depending on the capabilities of the desired + * AVChannelOrder. Note that some conversions are simply not possible in which + * case this function returns AVERROR(ENOSYS). + * + * The following conversions are supported: + * + * Any -> Custom : Always possible, always lossless. + * Any -> Unspecified: Always possible, lossless if channel designations + * are all unknown and channel names are not used, lossy otherwise. + * Custom -> Ambisonic : Possible if it contains ambisonic channels with + * optional non-diegetic channels in the end. Lossy if the channels have + * custom names, lossless otherwise. + * Custom -> Native : Possible if it contains native channels in native + * order. Lossy if the channels have custom names, lossless otherwise. + * + * On error this function keeps the original channel layout untouched. + * + * @param channel_layout channel layout which will be changed + * @param order the desired channel layout order + * @param flags a combination of AV_CHANNEL_LAYOUT_RETYPE_FLAG_* constants + * @return 0 if the conversion was successful and lossless or if the channel + * layout was already in the desired order + * >0 if the conversion was successful but lossy + * AVERROR(ENOSYS) if the conversion was not possible (or would be + * lossy and AV_CHANNEL_LAYOUT_RETYPE_FLAG_LOSSLESS was specified) + * AVERROR(EINVAL), AVERROR(ENOMEM) on error + */ +int av_channel_layout_retype(AVChannelLayout *channel_layout, enum AVChannelOrder order, int flags); + +/** + * @} + */ + +#endif /* AVUTIL_CHANNEL_LAYOUT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/common.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/common.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/common.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/common.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,589 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +/** + * @file + * common internal and external API header + */ + +#ifndef AVUTIL_COMMON_H +#define AVUTIL_COMMON_H + +#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C) +#error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "attributes.h" +#include "error.h" +#include "macros.h" +#include "version.h" + +#ifdef HAVE_AV_CONFIG_H +# include "config.h" +# include "intmath.h" +# include "internal.h" +#else +# include "mem.h" +#endif /* HAVE_AV_CONFIG_H */ + +//rounded division & shift +#define RSHIFT(a,b) ((a) > 0 ? ((a) + ((1<<(b))>>1))>>(b) : ((a) + ((1<<(b))>>1)-1)>>(b)) +/* assume b>0 */ +#define ROUNDED_DIV(a,b) (((a)>=0 ? (a) + ((b)>>1) : (a) - ((b)>>1))/(b)) +/* Fast a/(1<=0 and b>=0 */ +#define AV_CEIL_RSHIFT(a,b) (!av_builtin_constant_p(b) ? -((-(a)) >> (b)) \ + : ((a) + (1<<(b)) - 1) >> (b)) +/* Backwards compat. */ +#define FF_CEIL_RSHIFT AV_CEIL_RSHIFT + +#define FFUDIV(a,b) (((a)>0 ?(a):(a)-(b)+1) / (b)) +#define FFUMOD(a,b) ((a)-(b)*FFUDIV(a,b)) + +/** + * Absolute value, Note, INT_MIN / INT64_MIN result in undefined behavior as they + * are not representable as absolute values of their type. This is the same + * as with *abs() + * @see FFNABS() + */ +#define FFABS(a) ((a) >= 0 ? (a) : (-(a))) +#define FFSIGN(a) ((a) > 0 ? 1 : -1) + +/** + * Negative Absolute value. + * this works for all integers of all types. + * As with many macros, this evaluates its argument twice, it thus must not have + * a sideeffect, that is FFNABS(x++) has undefined behavior. + */ +#define FFNABS(a) ((a) <= 0 ? (a) : (-(a))) + +/** + * Unsigned Absolute value. + * This takes the absolute value of a signed int and returns it as a unsigned. + * This also works with INT_MIN which would otherwise not be representable + * As with many macros, this evaluates its argument twice. + */ +#define FFABSU(a) ((a) <= 0 ? -(unsigned)(a) : (unsigned)(a)) +#define FFABS64U(a) ((a) <= 0 ? -(uint64_t)(a) : (uint64_t)(a)) + +/* misc math functions */ + +#ifndef av_ceil_log2 +# define av_ceil_log2 av_ceil_log2_c +#endif +#ifndef av_clip +# define av_clip av_clip_c +#endif +#ifndef av_clip64 +# define av_clip64 av_clip64_c +#endif +#ifndef av_clip_uint8 +# define av_clip_uint8 av_clip_uint8_c +#endif +#ifndef av_clip_int8 +# define av_clip_int8 av_clip_int8_c +#endif +#ifndef av_clip_uint16 +# define av_clip_uint16 av_clip_uint16_c +#endif +#ifndef av_clip_int16 +# define av_clip_int16 av_clip_int16_c +#endif +#ifndef av_clipl_int32 +# define av_clipl_int32 av_clipl_int32_c +#endif +#ifndef av_clip_intp2 +# define av_clip_intp2 av_clip_intp2_c +#endif +#ifndef av_clip_uintp2 +# define av_clip_uintp2 av_clip_uintp2_c +#endif +#ifndef av_sat_add32 +# define av_sat_add32 av_sat_add32_c +#endif +#ifndef av_sat_dadd32 +# define av_sat_dadd32 av_sat_dadd32_c +#endif +#ifndef av_sat_sub32 +# define av_sat_sub32 av_sat_sub32_c +#endif +#ifndef av_sat_dsub32 +# define av_sat_dsub32 av_sat_dsub32_c +#endif +#ifndef av_sat_add64 +# define av_sat_add64 av_sat_add64_c +#endif +#ifndef av_sat_sub64 +# define av_sat_sub64 av_sat_sub64_c +#endif +#ifndef av_clipf +# define av_clipf av_clipf_c +#endif +#ifndef av_clipd +# define av_clipd av_clipd_c +#endif +#ifndef av_zero_extend +# define av_zero_extend av_zero_extend_c +#endif +#ifndef av_popcount +# define av_popcount av_popcount_c +#endif +#ifndef av_popcount64 +# define av_popcount64 av_popcount64_c +#endif +#ifndef av_parity +# define av_parity av_parity_c +#endif + +#ifndef av_log2 +av_const int av_log2(unsigned v); +#endif + +#ifndef av_log2_16bit +av_const int av_log2_16bit(unsigned v); +#endif + +/** + * Clip a signed integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int av_clip_c(int a, int amin, int amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed 64bit integer value into the amin-amax range. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const int64_t av_clip64_c(int64_t a, int64_t amin, int64_t amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + if (a < amin) return amin; + else if (a > amax) return amax; + else return a; +} + +/** + * Clip a signed integer value into the 0-255 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint8_t av_clip_uint8_c(int a) +{ + if (a&(~0xFF)) return (~a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -128,127 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int8_t av_clip_int8_c(int a) +{ + if ((a+0x80U) & ~0xFF) return (a>>31) ^ 0x7F; + else return a; +} + +/** + * Clip a signed integer value into the 0-65535 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const uint16_t av_clip_uint16_c(int a) +{ + if (a&(~0xFFFF)) return (~a)>>31; + else return a; +} + +/** + * Clip a signed integer value into the -32768,32767 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int16_t av_clip_int16_c(int a) +{ + if ((a+0x8000U) & ~0xFFFF) return (a>>31) ^ 0x7FFF; + else return a; +} + +/** + * Clip a signed 64-bit integer value into the -2147483648,2147483647 range. + * @param a value to clip + * @return clipped value + */ +static av_always_inline av_const int32_t av_clipl_int32_c(int64_t a) +{ + if ((a+UINT64_C(0x80000000)) & ~UINT64_C(0xFFFFFFFF)) return (int32_t)((a>>63) ^ 0x7FFFFFFF); + else return (int32_t)a; +} + +/** + * Clip a signed integer into the -(2^p),(2^p-1) range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const int av_clip_intp2_c(int a, int p) +{ + if (((unsigned)a + (1U << p)) & ~((2U << p) - 1)) + return (a >> 31) ^ ((1 << p) - 1); + else + return a; +} + +/** + * Clip a signed integer to an unsigned power of two range. + * @param a value to clip + * @param p bit position to clip at + * @return clipped value + */ +static av_always_inline av_const unsigned av_clip_uintp2_c(int a, int p) +{ + if (a & ~((1U<> 31 & ((1U<= 2 + if (p > 31) abort(); +#endif + return a & ((1U << p) - 1); +} + +#if FF_API_MOD_UINTP2 +#ifndef av_mod_uintp2 +# define av_mod_uintp2 av_mod_uintp2_c +#endif +attribute_deprecated +static av_always_inline av_const unsigned av_mod_uintp2_c(unsigned a, unsigned p) +{ + return av_zero_extend_c(a, p); +} +#endif + +/** + * Add two signed 32-bit values with saturation. + * + * @param a one value + * @param b another value + * @return sum with signed saturation + */ +static av_always_inline int av_sat_add32_c(int a, int b) +{ + return av_clipl_int32((int64_t)a + b); +} + +/** + * Add a doubled value to another value with saturation at both stages. + * + * @param a first value + * @param b value doubled and added to a + * @return sum sat(a + sat(2*b)) with signed saturation + */ +static av_always_inline int av_sat_dadd32_c(int a, int b) +{ + return av_sat_add32(a, av_sat_add32(b, b)); +} + +/** + * Subtract two signed 32-bit values with saturation. + * + * @param a one value + * @param b another value + * @return difference with signed saturation + */ +static av_always_inline int av_sat_sub32_c(int a, int b) +{ + return av_clipl_int32((int64_t)a - b); +} + +/** + * Subtract a doubled value from another value with saturation at both stages. + * + * @param a first value + * @param b value doubled and subtracted from a + * @return difference sat(a - sat(2*b)) with signed saturation + */ +static av_always_inline int av_sat_dsub32_c(int a, int b) +{ + return av_sat_sub32(a, av_sat_add32(b, b)); +} + +/** + * Add two signed 64-bit values with saturation. + * + * @param a one value + * @param b another value + * @return sum with signed saturation + */ +static av_always_inline int64_t av_sat_add64_c(int64_t a, int64_t b) { +#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_add_overflow) + int64_t tmp; + return !__builtin_add_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN); +#else + int64_t s = a+(uint64_t)b; + if ((int64_t)(a^b | ~s^b) >= 0) + return INT64_MAX ^ (b >> 63); + return s; +#endif +} + +/** + * Subtract two signed 64-bit values with saturation. + * + * @param a one value + * @param b another value + * @return difference with signed saturation + */ +static av_always_inline int64_t av_sat_sub64_c(int64_t a, int64_t b) { +#if (!defined(__INTEL_COMPILER) && AV_GCC_VERSION_AT_LEAST(5,1)) || AV_HAS_BUILTIN(__builtin_sub_overflow) + int64_t tmp; + return !__builtin_sub_overflow(a, b, &tmp) ? tmp : (tmp < 0 ? INT64_MAX : INT64_MIN); +#else + if (b <= 0 && a >= INT64_MAX + b) + return INT64_MAX; + if (b >= 0 && a <= INT64_MIN + b) + return INT64_MIN; + return a - b; +#endif +} + +/** + * Clip a float value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const float av_clipf_c(float a, float amin, float amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + return FFMIN(FFMAX(a, amin), amax); +} + +/** + * Clip a double value into the amin-amax range. + * If a is nan or -inf amin will be returned. + * If a is +inf amax will be returned. + * @param a value to clip + * @param amin minimum value of the clip range + * @param amax maximum value of the clip range + * @return clipped value + */ +static av_always_inline av_const double av_clipd_c(double a, double amin, double amax) +{ +#if defined(HAVE_AV_CONFIG_H) && defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 + if (amin > amax) abort(); +#endif + return FFMIN(FFMAX(a, amin), amax); +} + +/** Compute ceil(log2(x)). + * @param x value used to compute ceil(log2(x)) + * @return computed ceiling of log2(x) + */ +static av_always_inline av_const int av_ceil_log2_c(int x) +{ + return av_log2((x - 1U) << 1); +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount_c(uint32_t x) +{ + x -= (x >> 1) & 0x55555555; + x = (x & 0x33333333) + ((x >> 2) & 0x33333333); + x = (x + (x >> 4)) & 0x0F0F0F0F; + x += x >> 8; + return (x + (x >> 16)) & 0x3F; +} + +/** + * Count number of bits set to one in x + * @param x value to count bits of + * @return the number of bits set to one in x + */ +static av_always_inline av_const int av_popcount64_c(uint64_t x) +{ + return av_popcount((uint32_t)x) + av_popcount((uint32_t)(x >> 32)); +} + +static av_always_inline av_const int av_parity_c(uint32_t v) +{ + return av_popcount(v) & 1; +} + +/** + * Convert a UTF-8 character (up to 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_BYTE Expression reading one byte from the input. + * Evaluated up to 7 times (4 for the currently + * assigned Unicode range). With a memory buffer + * input, this could be *ptr++, or if you want to make sure + * that *ptr stops at the end of a NULL terminated string then + * *ptr ? *ptr++ : 0 + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + * + * @warning ERROR should not contain a loop control statement which + * could interact with the internal while loop, and should force an + * exit from the macro code (e.g. through a goto or a return) in order + * to prevent undefined results. + */ +#define GET_UTF8(val, GET_BYTE, ERROR)\ + val= (uint8_t)(GET_BYTE);\ + {\ + uint32_t top = (val & 128) >> 1;\ + if ((val & 0xc0) == 0x80 || val >= 0xFE)\ + {ERROR}\ + while (val & top) {\ + unsigned int tmp = (uint8_t)(GET_BYTE) - 128;\ + if(tmp>>6)\ + {ERROR}\ + val= (val<<6) + tmp;\ + top <<= 5;\ + }\ + val &= (top << 1) - 1;\ + } + +/** + * Convert a UTF-16 character (2 or 4 bytes) to its 32-bit UCS-4 encoded form. + * + * @param val Output value, must be an lvalue of type uint32_t. + * @param GET_16BIT Expression returning two bytes of UTF-16 data converted + * to native byte order. Evaluated one or two times. + * @param ERROR Expression to be evaluated on invalid input, + * typically a goto statement. + */ +#define GET_UTF16(val, GET_16BIT, ERROR)\ + val = (uint16_t)(GET_16BIT);\ + {\ + unsigned int hi = val - 0xD800;\ + if (hi < 0x800) {\ + val = (uint16_t)(GET_16BIT) - 0xDC00;\ + if (val > 0x3FFU || hi > 0x3FFU)\ + {ERROR}\ + val += (hi<<10) + 0x10000;\ + }\ + }\ + +/** + * @def PUT_UTF8(val, tmp, PUT_BYTE) + * Convert a 32-bit Unicode character to its UTF-8 encoded form (up to 4 bytes long). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-8. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint8_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_BYTE. + * @param PUT_BYTE writes the converted UTF-8 bytes to any proper destination. + * It could be a function or a statement, and uses tmp as the input byte. + * For example, PUT_BYTE could be "*output++ = tmp;" PUT_BYTE will be + * executed up to 4 times for values in the valid UTF-8 range and up to + * 7 times in the general case, depending on the length of the converted + * Unicode character. + */ +#define PUT_UTF8(val, tmp, PUT_BYTE)\ + {\ + int bytes, shift;\ + uint32_t in = val;\ + if (in < 0x80) {\ + tmp = in;\ + PUT_BYTE\ + } else {\ + bytes = (av_log2(in) + 4) / 5;\ + shift = (bytes - 1) * 6;\ + tmp = (256 - (256 >> bytes)) | (in >> shift);\ + PUT_BYTE\ + while (shift >= 6) {\ + shift -= 6;\ + tmp = 0x80 | ((in >> shift) & 0x3f);\ + PUT_BYTE\ + }\ + }\ + } + +/** + * @def PUT_UTF16(val, tmp, PUT_16BIT) + * Convert a 32-bit Unicode character to its UTF-16 encoded form (2 or 4 bytes). + * @param val is an input-only argument and should be of type uint32_t. It holds + * a UCS-4 encoded Unicode character that is to be converted to UTF-16. If + * val is given as a function it is executed only once. + * @param tmp is a temporary variable and should be of type uint16_t. It + * represents an intermediate value during conversion that is to be + * output by PUT_16BIT. + * @param PUT_16BIT writes the converted UTF-16 data to any proper destination + * in desired endianness. It could be a function or a statement, and uses tmp + * as the input byte. For example, PUT_BYTE could be "*output++ = tmp;" + * PUT_BYTE will be executed 1 or 2 times depending on input character. + */ +#define PUT_UTF16(val, tmp, PUT_16BIT)\ + {\ + uint32_t in = val;\ + if (in < 0x10000) {\ + tmp = in;\ + PUT_16BIT\ + } else {\ + tmp = 0xD800 | ((in - 0x10000) >> 10);\ + PUT_16BIT\ + tmp = 0xDC00 | ((in - 0x10000) & 0x3FF);\ + PUT_16BIT\ + }\ + }\ + +#endif /* AVUTIL_COMMON_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/cpu.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/cpu.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/cpu.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/cpu.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2000, 2001, 2002 Fabrice Bellard + * + * 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 + */ + +#ifndef AVUTIL_CPU_H +#define AVUTIL_CPU_H + +#include +#include "version.h" + +#if FF_API_CPU_FLAG_FORCE +#define AV_CPU_FLAG_FORCE 0x80000000 /* @deprecated, should not be used */ +#endif + + /* lower 16 bits - CPU features */ +#define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX +#define AV_CPU_FLAG_MMXEXT 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_MMX2 0x0002 ///< SSE integer functions or AMD MMX ext +#define AV_CPU_FLAG_3DNOW 0x0004 ///< AMD 3DNOW +#define AV_CPU_FLAG_SSE 0x0008 ///< SSE functions +#define AV_CPU_FLAG_SSE2 0x0010 ///< PIV SSE2 functions +#define AV_CPU_FLAG_SSE2SLOW 0x40000000 ///< SSE2 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_3DNOWEXT 0x0020 ///< AMD 3DNowExt +#define AV_CPU_FLAG_SSE3 0x0040 ///< Prescott SSE3 functions +#define AV_CPU_FLAG_SSE3SLOW 0x20000000 ///< SSE3 supported, but usually not faster + ///< than regular MMX/SSE (e.g. Core1) +#define AV_CPU_FLAG_SSSE3 0x0080 ///< Conroe SSSE3 functions +#define AV_CPU_FLAG_SSSE3SLOW 0x4000000 ///< SSSE3 supported, but usually not faster +#define AV_CPU_FLAG_ATOM 0x10000000 ///< Atom processor, some SSSE3 instructions are slower +#define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions +#define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions +#define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions +#define AV_CPU_FLAG_CLMUL 0x400000 ///< Carry-less Multiplication instruction +#define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) +#define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions +#define AV_CPU_FLAG_FMA4 0x0800 ///< Bulldozer FMA4 functions +#define AV_CPU_FLAG_CMOV 0x1000 ///< supports cmov instruction +#define AV_CPU_FLAG_AVX2 0x8000 ///< AVX2 functions: requires OS support even if YMM registers aren't used +#define AV_CPU_FLAG_FMA3 0x10000 ///< Haswell FMA3 functions +#define AV_CPU_FLAG_BMI1 0x20000 ///< Bit Manipulation Instruction Set 1 +#define AV_CPU_FLAG_BMI2 0x40000 ///< Bit Manipulation Instruction Set 2 +#define AV_CPU_FLAG_AVX512 0x100000 ///< AVX-512 functions: requires OS support even if YMM/ZMM registers aren't used +#define AV_CPU_FLAG_AVX512ICL 0x200000 ///< F/CD/BW/DQ/VL/VNNI/IFMA/VBMI/VBMI2/VPOPCNTDQ/BITALG/GFNI/VAES/VPCLMULQDQ +#define AV_CPU_FLAG_SLOW_GATHER 0x2000000 ///< CPU has slow gathers. + +#define AV_CPU_FLAG_ALTIVEC 0x0001 ///< standard +#define AV_CPU_FLAG_VSX 0x0002 ///< ISA 2.06 +#define AV_CPU_FLAG_POWER8 0x0004 ///< ISA 2.07 + +#define AV_CPU_FLAG_ARMV5TE (1 << 0) +#define AV_CPU_FLAG_ARMV6 (1 << 1) +#define AV_CPU_FLAG_ARMV6T2 (1 << 2) +#define AV_CPU_FLAG_VFP (1 << 3) +#define AV_CPU_FLAG_VFPV3 (1 << 4) +#define AV_CPU_FLAG_NEON (1 << 5) +#define AV_CPU_FLAG_ARMV8 (1 << 6) +#define AV_CPU_FLAG_VFP_VM (1 << 7) ///< VFPv2 vector mode, deprecated in ARMv7-A and unavailable in various CPUs implementations +#define AV_CPU_FLAG_DOTPROD (1 << 8) +#define AV_CPU_FLAG_I8MM (1 << 9) +#define AV_CPU_FLAG_SVE (1 <<10) +#define AV_CPU_FLAG_SVE2 (1 <<11) +#define AV_CPU_FLAG_SME (1 <<12) +#define AV_CPU_FLAG_ARM_CRC (1 <<13) +#define AV_CPU_FLAG_SME2 (1 <<14) +#define AV_CPU_FLAG_SME_I16I64 (1 <<15) +#define AV_CPU_FLAG_SETEND (1 <<16) +#define AV_CPU_FLAG_PMULL (1 <<17) +#define AV_CPU_FLAG_EOR3 (1 <<18) + +#define AV_CPU_FLAG_MMI (1 << 0) +#define AV_CPU_FLAG_MSA (1 << 1) + +//Loongarch SIMD extension. +#define AV_CPU_FLAG_LSX (1 << 0) +#define AV_CPU_FLAG_LASX (1 << 1) + +// RISC-V extensions +#define AV_CPU_FLAG_RVI (1 << 0) ///< I (full GPR bank) +#if FF_API_RISCV_FD_ZBA +#define AV_CPU_FLAG_RVF (1 << 1) ///< F (single precision FP) +#define AV_CPU_FLAG_RVD (1 << 2) ///< D (double precision FP) +#endif +#define AV_CPU_FLAG_RVV_I32 (1 << 3) ///< Vectors of 8/16/32-bit int's */ +#define AV_CPU_FLAG_RVV_F32 (1 << 4) ///< Vectors of float's */ +#define AV_CPU_FLAG_RVV_I64 (1 << 5) ///< Vectors of 64-bit int's */ +#define AV_CPU_FLAG_RVV_F64 (1 << 6) ///< Vectors of double's +#define AV_CPU_FLAG_RVB_BASIC (1 << 7) ///< Basic bit-manipulations +#if FF_API_RISCV_FD_ZBA +#define AV_CPU_FLAG_RVB_ADDR (1 << 8) ///< Address bit-manipulations +#endif +#define AV_CPU_FLAG_RV_ZVBB (1 << 9) ///< Vector basic bit-manipulations +#define AV_CPU_FLAG_RV_MISALIGNED (1 <<10) ///< Fast misaligned accesses +#define AV_CPU_FLAG_RVB (1 <<11) ///< B (bit manipulations) + +// WASM extensions +#define AV_CPU_FLAG_SIMD128 (1 << 0) + +/** + * Return the flags which specify extensions supported by the CPU. + * The returned value is affected by av_force_cpu_flags() if that was used + * before. So av_get_cpu_flags() can easily be used in an application to + * detect the enabled cpu flags. + */ +int av_get_cpu_flags(void); + +/** + * Disables cpu detection and forces the specified flags. + * -1 is a special case that disables forcing of specific flags. + */ +void av_force_cpu_flags(int flags); + +/** + * Parse CPU caps from a string and update the given AV_CPU_* flags based on that. + * + * @return negative on error. + */ +int av_parse_cpu_caps(unsigned *flags, const char *s); + +/** + * @return the number of logical CPU cores present. + */ +int av_cpu_count(void); + +/** + * Overrides cpu count detection and forces the specified count. + * Count < 1 disables forcing of specific count. + */ +void av_cpu_force_count(int count); + +/** + * Get the maximum data alignment that may be required by FFmpeg. + * + * Note that this is affected by the build configuration and the CPU flags mask, + * so e.g. if the CPU supports AVX, but libavutil has been built with + * --disable-avx or the AV_CPU_FLAG_AVX flag has been disabled through + * av_set_cpu_flags_mask(), then this function will behave as if AVX is not + * present. + */ +size_t av_cpu_max_align(void); + +#endif /* AVUTIL_CPU_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/dict.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/dict.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/dict.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/dict.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,242 @@ +/* + * 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 + */ + +/** + * @file + * Public dictionary API. + * @deprecated + * AVDictionary is provided for compatibility with libav. It is both in + * implementation as well as API inefficient. It does not scale and is + * extremely slow with large dictionaries. + * It is recommended that new code uses our tree container from tree.c/h + * where applicable, which uses AVL trees to achieve O(log n) performance. + */ + +#ifndef AVUTIL_DICT_H +#define AVUTIL_DICT_H + +#include + +/** + * @addtogroup lavu_dict AVDictionary + * @ingroup lavu_data + * + * @brief Simple key:value store + * + * @{ + * Dictionaries are used for storing key-value pairs. + * + * - To **create an AVDictionary**, simply pass an address of a NULL + * pointer to av_dict_set(). NULL can be used as an empty dictionary + * wherever a pointer to an AVDictionary is required. + * - To **insert an entry**, use av_dict_set(). + * - Use av_dict_get() to **retrieve an entry**. + * - To **iterate over all entries**, use av_dict_iterate(). + * - In order to **free the dictionary and all its contents**, use av_dict_free(). + * + @code + AVDictionary *d = NULL; // "create" an empty dictionary + AVDictionaryEntry *t = NULL; + + av_dict_set(&d, "foo", "bar", 0); // add an entry + + char *k = av_strdup("key"); // if your strings are already allocated, + char *v = av_strdup("value"); // you can avoid copying them like this + av_dict_set(&d, k, v, AV_DICT_DONT_STRDUP_KEY | AV_DICT_DONT_STRDUP_VAL); + + while ((t = av_dict_iterate(d, t))) { + <....> // iterate over all entries in d + } + av_dict_free(&d); + @endcode + */ + +/** + * @name AVDictionary Flags + * Flags that influence behavior of the matching of keys or insertion to the dictionary. + * @{ + */ +#define AV_DICT_MATCH_CASE 1 /**< Only get an entry with exact-case key match. Only relevant in av_dict_get(). */ +#define AV_DICT_IGNORE_SUFFIX 2 /**< Return first entry in a dictionary whose first part corresponds to the search key, + ignoring the suffix of the found key string. Only relevant in av_dict_get(). */ +#define AV_DICT_DONT_STRDUP_KEY 4 /**< Take ownership of a key that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_STRDUP_VAL 8 /**< Take ownership of a value that's been + allocated with av_malloc() or another memory allocation function. */ +#define AV_DICT_DONT_OVERWRITE 16 /**< Don't overwrite existing entries. */ +#define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no + delimiter is added, the strings are simply concatenated. */ +#define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */ +#define AV_DICT_DEDUP 128 /**< If inserting a value that already exists for a key, do nothing. Only relevant with AV_DICT_MULTIKEY. */ +/** + * @} + */ + +typedef struct AVDictionaryEntry { + char *key; + char *value; +} AVDictionaryEntry; + +typedef struct AVDictionary AVDictionary; + +/** + * Get a dictionary entry with matching key. + * + * The returned entry key or value must not be changed, or it will + * cause undefined behavior. + * + * @param prev Set to the previous matching element to find the next. + * If set to NULL the first matching element is returned. + * @param key Matching key + * @param flags A collection of AV_DICT_* flags controlling how the + * entry is retrieved + * + * @return Found entry or NULL in case no matching entry was found in the dictionary + */ +AVDictionaryEntry *av_dict_get(const AVDictionary *m, const char *key, + const AVDictionaryEntry *prev, int flags); + +/** + * Iterate over a dictionary + * + * Iterates through all entries in the dictionary. + * + * @warning The returned AVDictionaryEntry key/value must not be changed. + * + * @warning As av_dict_set() invalidates all previous entries returned + * by this function, it must not be called while iterating over the dict. + * + * Typical usage: + * @code + * const AVDictionaryEntry *e = NULL; + * while ((e = av_dict_iterate(m, e))) { + * // ... + * } + * @endcode + * + * @param m The dictionary to iterate over + * @param prev Pointer to the previous AVDictionaryEntry, NULL initially + * + * @retval AVDictionaryEntry* The next element in the dictionary + * @retval NULL No more elements in the dictionary + */ +const AVDictionaryEntry *av_dict_iterate(const AVDictionary *m, + const AVDictionaryEntry *prev); + +/** + * Get number of entries in dictionary. + * + * @param m dictionary + * @return number of entries in dictionary + */ +int av_dict_count(const AVDictionary *m); + +/** + * Set the given entry in *pm, overwriting an existing entry. + * + * Note: If AV_DICT_DONT_STRDUP_KEY or AV_DICT_DONT_STRDUP_VAL is set, + * these arguments will be freed on error. + * + * @warning Adding a new entry to a dictionary invalidates all existing entries + * previously returned with av_dict_get() or av_dict_iterate(). + * + * @param pm Pointer to a pointer to a dictionary struct. If *pm is NULL + * a dictionary struct is allocated and put in *pm. + * @param key Entry key to add to *pm (will either be av_strduped or added as a new key depending on flags) + * @param value Entry value to add to *pm (will be av_strduped or added as a new key depending on flags). + * Passing a NULL value will cause an existing entry to be deleted. + * + * @return >= 0 on success otherwise an error code <0 + */ +int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags); + +/** + * Convenience wrapper for av_dict_set() that converts the value to a string + * and stores it. + * + * Note: If ::AV_DICT_DONT_STRDUP_KEY is set, key will be freed on error. + */ +int av_dict_set_int(AVDictionary **pm, const char *key, int64_t value, int flags); + +/** + * Parse the key/value pairs list and add the parsed entries to a dictionary. + * + * In case of failure, all the successfully set entries are stored in + * *pm. You may need to manually free the created dictionary. + * + * @param key_val_sep A 0-terminated list of characters used to separate + * key from value + * @param pairs_sep A 0-terminated list of characters used to separate + * two pairs from each other + * @param flags Flags to use when adding to the dictionary. + * ::AV_DICT_DONT_STRDUP_KEY and ::AV_DICT_DONT_STRDUP_VAL + * are ignored since the key/value tokens will always + * be duplicated. + * + * @return 0 on success, negative AVERROR code on failure + */ +int av_dict_parse_string(AVDictionary **pm, const char *str, + const char *key_val_sep, const char *pairs_sep, + int flags); + +/** + * Copy entries from one AVDictionary struct into another. + * + * @note Metadata is read using the ::AV_DICT_IGNORE_SUFFIX flag + * + * @param dst Pointer to a pointer to a AVDictionary struct to copy into. If *dst is NULL, + * this function will allocate a struct for you and put it in *dst + * @param src Pointer to the source AVDictionary struct to copy items from. + * @param flags Flags to use when setting entries in *dst + * + * @return 0 on success, negative AVERROR code on failure. If dst was allocated + * by this function, callers should free the associated memory. + */ +int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags); + +/** + * Free all the memory allocated for an AVDictionary struct + * and all keys and values. + */ +void av_dict_free(AVDictionary **m); + +/** + * Get dictionary entries as a string. + * + * Create a string containing dictionary's entries. + * Such string may be passed back to av_dict_parse_string(). + * @note String is escaped with backslashes ('\'). + * + * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. + * + * @param[in] m The dictionary + * @param[out] buffer Pointer to buffer that will be allocated with string containing entries. + * Buffer must be freed by the caller when is no longer needed. + * @param[in] key_val_sep Character used to separate key from value + * @param[in] pairs_sep Character used to separate two pairs from each other + * + * @return >= 0 on success, negative on error + */ +int av_dict_get_string(const AVDictionary *m, char **buffer, + const char key_val_sep, const char pairs_sep); + +/** + * @} + */ + +#endif /* AVUTIL_DICT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/error.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/error.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/error.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/error.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,129 @@ +/* + * 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 + */ + +/** + * @file + * error code definitions + */ + +#ifndef AVUTIL_ERROR_H +#define AVUTIL_ERROR_H + +#include +#include + +#include "macros.h" + +/** + * @addtogroup lavu_error + * + * @{ + */ + + +/* error handling */ +#if EDOM > 0 +#define AVERROR(e) (-(e)) ///< Returns a negative error code from a POSIX error code, to return from library functions. +#define AVUNERROR(e) (-(e)) ///< Returns a POSIX error code from a library function error return value. +#else +/* Some platforms have E* and errno already negated. */ +#define AVERROR(e) (e) +#define AVUNERROR(e) (e) +#endif + +#define FFERRTAG(a, b, c, d) (-(int)MKTAG(a, b, c, d)) + +#define AVERROR_BSF_NOT_FOUND FFERRTAG(0xF8,'B','S','F') ///< Bitstream filter not found +#define AVERROR_BUG FFERRTAG( 'B','U','G','!') ///< Internal bug, also see AVERROR_BUG2 +#define AVERROR_BUFFER_TOO_SMALL FFERRTAG( 'B','U','F','S') ///< Buffer too small +#define AVERROR_DECODER_NOT_FOUND FFERRTAG(0xF8,'D','E','C') ///< Decoder not found +#define AVERROR_DEMUXER_NOT_FOUND FFERRTAG(0xF8,'D','E','M') ///< Demuxer not found +#define AVERROR_ENCODER_NOT_FOUND FFERRTAG(0xF8,'E','N','C') ///< Encoder not found +#define AVERROR_EOF FFERRTAG( 'E','O','F',' ') ///< End of file +#define AVERROR_EXIT FFERRTAG( 'E','X','I','T') ///< Immediate exit was requested; the called function should not be restarted +#define AVERROR_EXTERNAL FFERRTAG( 'E','X','T',' ') ///< Generic error in an external library +#define AVERROR_FILTER_NOT_FOUND FFERRTAG(0xF8,'F','I','L') ///< Filter not found +#define AVERROR_INVALIDDATA FFERRTAG( 'I','N','D','A') ///< Invalid data found when processing input +#define AVERROR_MUXER_NOT_FOUND FFERRTAG(0xF8,'M','U','X') ///< Muxer not found +#define AVERROR_OPTION_NOT_FOUND FFERRTAG(0xF8,'O','P','T') ///< Option not found +#define AVERROR_PATCHWELCOME FFERRTAG( 'P','A','W','E') ///< Not yet implemented in FFmpeg, patches welcome +#define AVERROR_PROTOCOL_NOT_FOUND FFERRTAG(0xF8,'P','R','O') ///< Protocol not found + +#define AVERROR_STREAM_NOT_FOUND FFERRTAG(0xF8,'S','T','R') ///< Stream not found +/** + * This is semantically identical to AVERROR_BUG + * it has been introduced in Libav after our AVERROR_BUG and with a modified value. + */ +#define AVERROR_BUG2 FFERRTAG( 'B','U','G',' ') +#define AVERROR_UNKNOWN FFERRTAG( 'U','N','K','N') ///< Unknown error, typically from an external library +#define AVERROR_EXPERIMENTAL (-0x2bb2afa8) ///< Requested feature is flagged experimental. Set strict_std_compliance if you really want to use it. +#define AVERROR_INPUT_CHANGED (-0x636e6701) ///< Input changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_OUTPUT_CHANGED) +#define AVERROR_OUTPUT_CHANGED (-0x636e6702) ///< Output changed between calls. Reconfiguration is required. (can be OR-ed with AVERROR_INPUT_CHANGED) +/* HTTP & RTSP errors */ +#define AVERROR_HTTP_BAD_REQUEST FFERRTAG(0xF8,'4','0','0') +#define AVERROR_HTTP_UNAUTHORIZED FFERRTAG(0xF8,'4','0','1') +#define AVERROR_HTTP_FORBIDDEN FFERRTAG(0xF8,'4','0','3') +#define AVERROR_HTTP_NOT_FOUND FFERRTAG(0xF8,'4','0','4') +#define AVERROR_HTTP_TOO_MANY_REQUESTS FFERRTAG(0xF8,'4','2','9') +#define AVERROR_HTTP_OTHER_4XX FFERRTAG(0xF8,'4','X','X') +#define AVERROR_HTTP_SERVER_ERROR FFERRTAG(0xF8,'5','X','X') + +#define AV_ERROR_MAX_STRING_SIZE 64 + +/** + * Put a description of the AVERROR code errnum in errbuf. + * In case of failure the global variable errno is set to indicate the + * error. Even in case of failure av_strerror() will print a generic + * error message indicating the errnum provided to errbuf. + * + * @param errnum error code to describe + * @param errbuf buffer to which description is written + * @param errbuf_size the size in bytes of errbuf + * @return 0 on success, a negative value if a description for errnum + * cannot be found + */ +int av_strerror(int errnum, char *errbuf, size_t errbuf_size); + +/** + * Fill the provided buffer with a string containing an error string + * corresponding to the AVERROR code errnum. + * + * @param errbuf a buffer + * @param errbuf_size size in bytes of errbuf + * @param errnum error code to describe + * @return the buffer in input, filled with the error description + * @see av_strerror() + */ +static inline char *av_make_error_string(char *errbuf, size_t errbuf_size, int errnum) +{ + av_strerror(errnum, errbuf, errbuf_size); + return errbuf; +} + +/** + * Convenience macro, the return value should be used only directly in + * function arguments but never stand-alone. + */ +#define av_err2str(errnum) \ + av_make_error_string((char[AV_ERROR_MAX_STRING_SIZE]){0}, AV_ERROR_MAX_STRING_SIZE, errnum) + +/** + * @} + */ + +#endif /* AVUTIL_ERROR_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/frame.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/frame.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/frame.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/frame.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,1183 @@ +/* + * 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 + */ + +/** + * @file + * @ingroup lavu_frame + * reference-counted frame API + */ + +#ifndef AVUTIL_FRAME_H +#define AVUTIL_FRAME_H + +#include +#include + +#include "avutil.h" +#include "buffer.h" +#include "channel_layout.h" +#include "dict.h" +#include "rational.h" +#include "samplefmt.h" +#include "pixfmt.h" +#include "version.h" + + +/** + * @defgroup lavu_frame AVFrame + * @ingroup lavu_data + * + * @{ + * AVFrame is an abstraction for reference-counted raw multimedia data. + */ + +enum AVFrameSideDataType { + /** + * The data is the AVPanScan struct defined in libavcodec. + */ + AV_FRAME_DATA_PANSCAN, + /** + * ATSC A53 Part 4 Closed Captions. + * A53 CC bitstream is stored as uint8_t in AVFrameSideData.data. + * The number of bytes of CC data is AVFrameSideData.size. + */ + AV_FRAME_DATA_A53_CC, + /** + * Stereoscopic 3d metadata. + * The data is the AVStereo3D struct defined in libavutil/stereo3d.h. + */ + AV_FRAME_DATA_STEREO3D, + /** + * The data is the AVMatrixEncoding enum defined in libavutil/channel_layout.h. + */ + AV_FRAME_DATA_MATRIXENCODING, + /** + * Metadata relevant to a downmix procedure. + * The data is the AVDownmixInfo struct defined in libavutil/downmix_info.h. + */ + AV_FRAME_DATA_DOWNMIX_INFO, + /** + * ReplayGain information in the form of the AVReplayGain struct. + */ + AV_FRAME_DATA_REPLAYGAIN, + /** + * This side data contains a 3x3 transformation matrix describing an affine + * transformation that needs to be applied to the frame for correct + * presentation. + * + * See libavutil/display.h for a detailed description of the data. + */ + AV_FRAME_DATA_DISPLAYMATRIX, + /** + * Active Format Description data consisting of a single byte as specified + * in ETSI TS 101 154 using AVActiveFormatDescription enum. + */ + AV_FRAME_DATA_AFD, + /** + * Motion vectors exported by some codecs (on demand through the export_mvs + * flag set in the libavcodec AVCodecContext flags2 option). + * The data is the AVMotionVector struct defined in + * libavutil/motion_vector.h. + */ + AV_FRAME_DATA_MOTION_VECTORS, + /** + * Recommends skipping the specified number of samples. This is exported + * only if the "skip_manual" AVOption is set in libavcodec. + * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. + * @code + * u32le number of samples to skip from start of this packet + * u32le number of samples to skip from end of this packet + * u8 reason for start skip + * u8 reason for end skip (0=padding silence, 1=convergence) + * @endcode + */ + AV_FRAME_DATA_SKIP_SAMPLES, + /** + * This side data must be associated with an audio frame and corresponds to + * enum AVAudioServiceType defined in avcodec.h. + */ + AV_FRAME_DATA_AUDIO_SERVICE_TYPE, + /** + * Mastering display metadata associated with a video frame. The payload is + * an AVMasteringDisplayMetadata type and contains information about the + * mastering display color volume. + */ + AV_FRAME_DATA_MASTERING_DISPLAY_METADATA, + /** + * The GOP timecode in 25 bit timecode format. Data format is 64-bit integer. + * This is set on the first frame of a GOP that has a temporal reference of 0. + */ + AV_FRAME_DATA_GOP_TIMECODE, + + /** + * The data represents the AVSphericalMapping structure defined in + * libavutil/spherical.h. + */ + AV_FRAME_DATA_SPHERICAL, + + /** + * Content light level (based on CTA-861.3). This payload contains data in + * the form of the AVContentLightMetadata struct. + */ + AV_FRAME_DATA_CONTENT_LIGHT_LEVEL, + + /** + * The data contains an ICC profile as an opaque octet buffer following the + * format described by ISO 15076-1 with an optional name defined in the + * metadata key entry "name". + */ + AV_FRAME_DATA_ICC_PROFILE, + + /** + * Timecode which conforms to SMPTE ST 12-1. The data is an array of 4 uint32_t + * where the first uint32_t describes how many (1-3) of the other timecodes are used. + * The timecode format is described in the documentation of av_timecode_get_smpte_from_framenum() + * function in libavutil/timecode.h. + */ + AV_FRAME_DATA_S12M_TIMECODE, + + /** + * HDR dynamic metadata associated with a video frame. The payload is + * an AVDynamicHDRPlus type and contains information for color + * volume transform - application 4 of SMPTE 2094-40:2016 standard. + */ + AV_FRAME_DATA_DYNAMIC_HDR_PLUS, + + /** + * Regions Of Interest, the data is an array of AVRegionOfInterest type, the number of + * array element is implied by AVFrameSideData.size / AVRegionOfInterest.self_size. + */ + AV_FRAME_DATA_REGIONS_OF_INTEREST, + + /** + * Encoding parameters for a video frame, as described by AVVideoEncParams. + */ + AV_FRAME_DATA_VIDEO_ENC_PARAMS, + + /** + * User data unregistered metadata associated with a video frame. + * This is the H.26[45] UDU SEI message, and shouldn't be used for any other purpose + * The data is stored as uint8_t in AVFrameSideData.data which is 16 bytes of + * uuid_iso_iec_11578 followed by AVFrameSideData.size - 16 bytes of user_data_payload_byte. + */ + AV_FRAME_DATA_SEI_UNREGISTERED, + + /** + * Film grain parameters for a frame, described by AVFilmGrainParams. + * Must be present for every frame which should have film grain applied. + * + * May be present multiple times, for example when there are multiple + * alternative parameter sets for different video signal characteristics. + * The user should select the most appropriate set for the application. + */ + AV_FRAME_DATA_FILM_GRAIN_PARAMS, + + /** + * Bounding boxes for object detection and classification, + * as described by AVDetectionBBoxHeader. + */ + AV_FRAME_DATA_DETECTION_BBOXES, + + /** + * Dolby Vision RPU raw data, suitable for passing to x265 + * or other libraries. Array of uint8_t, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_DOVI_RPU_BUFFER, + + /** + * Parsed Dolby Vision metadata, suitable for passing to a software + * implementation. The payload is the AVDOVIMetadata struct defined in + * libavutil/dovi_meta.h. + */ + AV_FRAME_DATA_DOVI_METADATA, + + /** + * HDR Vivid dynamic metadata associated with a video frame. The payload is + * an AVDynamicHDRVivid type and contains information for color + * volume transform - CUVA 005.1-2021. + */ + AV_FRAME_DATA_DYNAMIC_HDR_VIVID, + + /** + * Ambient viewing environment metadata, as defined by H.274. + */ + AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT, + + /** + * Provide encoder-specific hinting information about changed/unchanged + * portions of a frame. It can be used to pass information about which + * macroblocks can be skipped because they didn't change from the + * corresponding ones in the previous frame. This could be useful for + * applications which know this information in advance to speed up + * encoding. + */ + AV_FRAME_DATA_VIDEO_HINT, + + /** + * Raw LCEVC payload data, as a uint8_t array, with NAL emulation + * bytes intact. + */ + AV_FRAME_DATA_LCEVC, + + /** + * This side data must be associated with a video frame. + * The presence of this side data indicates that the video stream is + * composed of multiple views (e.g. stereoscopic 3D content, + * cf. H.264 Annex H or H.265 Annex G). + * The data is an int storing the view ID. + */ + AV_FRAME_DATA_VIEW_ID, + + /** + * This side data contains information about the reference display width(s) + * and reference viewing distance(s) as well as information about the + * corresponding reference stereo pair(s), i.e., the pair(s) of views to be + * displayed for the viewer's left and right eyes on the reference display + * at the reference viewing distance. + * The payload is the AV3DReferenceDisplaysInfo struct defined in + * libavutil/tdrdi.h. + */ + AV_FRAME_DATA_3D_REFERENCE_DISPLAYS, + + /** + * Extensible image file format metadata. The payload is a buffer containing + * EXIF metadata, starting with either 49 49 2a 00, or 4d 4d 00 2a. + */ + AV_FRAME_DATA_EXIF, + + /** + * HDR dynamic metadata associated with a video frame. The payload is + * an AVDynamicHDRSmpte2094App5 type and contains information for color + * volume transform as specified in the SMPTE 2094-50 standard. + */ + AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5, +}; + +enum AVActiveFormatDescription { + AV_AFD_SAME = 8, + AV_AFD_4_3 = 9, + AV_AFD_16_9 = 10, + AV_AFD_14_9 = 11, + AV_AFD_4_3_SP_14_9 = 13, + AV_AFD_16_9_SP_14_9 = 14, + AV_AFD_SP_4_3 = 15, +}; + + +/** + * Structure to hold side data for an AVFrame. + * + * sizeof(AVFrameSideData) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + */ +typedef struct AVFrameSideData { + enum AVFrameSideDataType type; + uint8_t *data; + size_t size; + AVDictionary *metadata; + AVBufferRef *buf; +} AVFrameSideData; + +enum AVSideDataProps { + /** + * The side data type can be used in stream-global structures. + * Side data types without this property are only meaningful on per-frame + * basis. + */ + AV_SIDE_DATA_PROP_GLOBAL = (1 << 0), + + /** + * Multiple instances of this side data type can be meaningfully present in + * a single side data array. + */ + AV_SIDE_DATA_PROP_MULTI = (1 << 1), + + /** + * Side data depends on the video dimensions. Side data with this property + * loses its meaning when rescaling or cropping the image, unless + * either recomputed or adjusted to the new resolution. + */ + AV_SIDE_DATA_PROP_SIZE_DEPENDENT = (1 << 2), + + /** + * Side data depends on the video color space. Side data with this property + * loses its meaning when changing the video color encoding, e.g. by + * adapting to a different set of primaries or transfer characteristics. + */ + AV_SIDE_DATA_PROP_COLOR_DEPENDENT = (1 << 3), + + /** + * Side data depends on the channel layout. Side data with this property + * loses its meaning when downmixing or upmixing, unless either recomputed + * or adjusted to the new layout. + */ + AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT = (1 << 4), +}; + +/** + * This struct describes the properties of a side data type. Its instance + * corresponding to a given type can be obtained from av_frame_side_data_desc(). + */ +typedef struct AVSideDataDescriptor { + /** + * Human-readable side data description. + */ + const char *name; + + /** + * Side data property flags, a combination of AVSideDataProps values. + */ + unsigned props; +} AVSideDataDescriptor; + +/** + * Structure describing a single Region Of Interest. + * + * When multiple regions are defined in a single side-data block, they + * should be ordered from most to least important - some encoders are only + * capable of supporting a limited number of distinct regions, so will have + * to truncate the list. + * + * When overlapping regions are defined, the first region containing a given + * area of the frame applies. + */ +typedef struct AVRegionOfInterest { + /** + * Must be set to the size of this data structure (that is, + * sizeof(AVRegionOfInterest)). + */ + uint32_t self_size; + /** + * Distance in pixels from the top edge of the frame to the top and + * bottom edges and from the left edge of the frame to the left and + * right edges of the rectangle defining this region of interest. + * + * The constraints on a region are encoder dependent, so the region + * actually affected may be slightly larger for alignment or other + * reasons. + */ + int top; + int bottom; + int left; + int right; + /** + * Quantisation offset. + * + * Must be in the range -1 to +1. A value of zero indicates no quality + * change. A negative value asks for better quality (less quantisation), + * while a positive value asks for worse quality (greater quantisation). + * + * The range is calibrated so that the extreme values indicate the + * largest possible offset - if the rest of the frame is encoded with the + * worst possible quality, an offset of -1 indicates that this region + * should be encoded with the best possible quality anyway. Intermediate + * values are then interpolated in some codec-dependent way. + * + * For example, in 10-bit H.264 the quantisation parameter varies between + * -12 and 51. A typical qoffset value of -1/10 therefore indicates that + * this region should be encoded with a QP around one-tenth of the full + * range better than the rest of the frame. So, if most of the frame + * were to be encoded with a QP of around 30, this region would get a QP + * of around 24 (an offset of approximately -1/10 * (51 - -12) = -6.3). + * An extreme value of -1 would indicate that this region should be + * encoded with the best possible quality regardless of the treatment of + * the rest of the frame - that is, should be encoded at a QP of -12. + */ + AVRational qoffset; +} AVRegionOfInterest; + +/** + * This structure describes decoded (raw) audio or video data. + * + * AVFrame must be allocated using av_frame_alloc(). Note that this only + * allocates the AVFrame itself, the buffers for the data must be managed + * through other means (see below). + * AVFrame must be freed with av_frame_free(). + * + * AVFrame is typically allocated once and then reused multiple times to hold + * different data (e.g. a single AVFrame to hold frames received from a + * decoder). In such a case, av_frame_unref() will free any references held by + * the frame and reset it to its original clean state before it + * is reused again. + * + * The data described by an AVFrame is usually reference counted through the + * AVBuffer API. The underlying buffer references are stored in AVFrame.buf / + * AVFrame.extended_buf. An AVFrame is considered to be reference counted if at + * least one reference is set, i.e. if AVFrame.buf[0] != NULL. In such a case, + * every single data plane must be contained in one of the buffers in + * AVFrame.buf or AVFrame.extended_buf. + * There may be a single buffer for all the data, or one separate buffer for + * each plane, or anything in between. + * + * sizeof(AVFrame) is not a part of the public ABI, so new fields may be added + * to the end with a minor bump. + * + * Fields can be accessed through AVOptions, the name string used, matches the + * C structure field name for fields accessible through AVOptions. + */ +typedef struct AVFrame { +#define AV_NUM_DATA_POINTERS 8 + /** + * pointer to the picture/channel planes. + * This might be different from the first allocated byte. For video, + * it could even point to the end of the image data. + * + * All pointers in data and extended_data must point into one of the + * AVBufferRef in buf or extended_buf. + * + * Some decoders access areas outside 0,0 - width,height, please + * see avcodec_align_dimensions2(). Some filters and swscale can read + * up to 16 bytes beyond the planes, if these filters are to be used, + * then 16 extra bytes must be allocated. + * + * NOTE: Pointers not needed by the format MUST be set to NULL. + * + * @attention In case of video, the data[] pointers can point to the + * end of image data in order to reverse line order, when used in + * combination with negative values in the linesize[] array. + */ + uint8_t *data[AV_NUM_DATA_POINTERS]; + + /** + * For video, a positive or negative value, which is typically indicating + * the size in bytes of each picture line, but it can also be: + * - the negative byte size of lines for vertical flipping + * (with data[n] pointing to the end of the data + * - a positive or negative multiple of the byte size as for accessing + * even and odd fields of a frame (possibly flipped) + * + * For audio, only linesize[0] may be set. For planar audio, each channel + * plane must be the same size. + * + * For video the linesizes should be multiples of the CPUs alignment + * preference, this is 16 or 32 for modern desktop CPUs. + * Some code requires such alignment other code can be slower without + * correct alignment, for yet other it makes no difference. + * + * @note The linesize may be larger than the size of usable data -- there + * may be extra padding present for performance reasons. + * + * @attention In case of video, line size values can be negative to achieve + * a vertically inverted iteration over image lines. + */ + int linesize[AV_NUM_DATA_POINTERS]; + + /** + * pointers to the data planes/channels. + * + * For video, this should simply point to data[]. + * + * For planar audio, each channel has a separate data pointer, and + * linesize[0] contains the size of each channel buffer. + * For packed audio, there is just one data pointer, and linesize[0] + * contains the total size of the buffer for all channels. + * + * Note: Both data and extended_data should always be set in a valid frame, + * but for planar audio with more channels that can fit in data, + * extended_data must be used in order to access all channels. + */ + uint8_t **extended_data; + + /** + * @name Video dimensions + * Video frames only. The coded dimensions (in pixels) of the video frame, + * i.e. the size of the rectangle that contains some well-defined values. + * + * @note The part of the frame intended for display/presentation is further + * restricted by the @ref cropping "Cropping rectangle". + * @{ + */ + int width, height; + /** + * @} + */ + + /** + * number of audio samples (per channel) described by this frame + */ + int nb_samples; + + /** + * format of the frame, -1 if unknown or unset + * Values correspond to enum AVPixelFormat for video frames, + * enum AVSampleFormat for audio) + */ + int format; + + /** + * Picture type of the frame. + */ + enum AVPictureType pict_type; + + /** + * Sample aspect ratio for the video frame, 0/1 if unknown/unspecified. + */ + AVRational sample_aspect_ratio; + + /** + * Presentation timestamp in time_base units (time when frame should be shown to user). + */ + int64_t pts; + + /** + * DTS copied from the AVPacket that triggered returning this frame. (if frame threading isn't used) + * This is also the Presentation time of this AVFrame calculated from + * only AVPacket.dts values without pts values. + */ + int64_t pkt_dts; + + /** + * Time base for the timestamps in this frame. + * In the future, this field may be set on frames output by decoders or + * filters, but its value will be by default ignored on input to encoders + * or filters. + */ + AVRational time_base; + + /** + * quality (between 1 (good) and FF_LAMBDA_MAX (bad)) + */ + int quality; + + /** + * Frame owner's private data. + * + * This field may be set by the code that allocates/owns the frame data. + * It is then not touched by any library functions, except: + * - it is copied to other references by av_frame_copy_props() (and hence by + * av_frame_ref()); + * - it is set to NULL when the frame is cleared by av_frame_unref() + * - on the caller's explicit request. E.g. libavcodec encoders/decoders + * will copy this field to/from @ref AVPacket "AVPackets" if the caller sets + * @ref AV_CODEC_FLAG_COPY_OPAQUE. + * + * @see opaque_ref the reference-counted analogue + */ + void *opaque; + + /** + * Number of fields in this frame which should be repeated, i.e. the total + * duration of this frame should be repeat_pict + 2 normal field durations. + * + * For interlaced frames this field may be set to 1, which signals that this + * frame should be presented as 3 fields: beginning with the first field (as + * determined by AV_FRAME_FLAG_TOP_FIELD_FIRST being set or not), followed + * by the second field, and then the first field again. + * + * For progressive frames this field may be set to a multiple of 2, which + * signals that this frame's duration should be (repeat_pict + 2) / 2 + * normal frame durations. + * + * @note This field is computed from MPEG2 repeat_first_field flag and its + * associated flags, H.264 pic_struct from picture timing SEI, and + * their analogues in other codecs. Typically it should only be used when + * higher-layer timing information is not available. + */ + int repeat_pict; + + /** + * Sample rate of the audio data. + */ + int sample_rate; + + /** + * AVBuffer references backing the data for this frame. All the pointers in + * data and extended_data must point inside one of the buffers in buf or + * extended_buf. This array must be filled contiguously -- if buf[i] is + * non-NULL then buf[j] must also be non-NULL for all j < i. + * + * There may be at most one AVBuffer per data plane, so for video this array + * always contains all the references. For planar audio with more than + * AV_NUM_DATA_POINTERS channels, there may be more buffers than can fit in + * this array. Then the extra AVBufferRef pointers are stored in the + * extended_buf array. + */ + AVBufferRef *buf[AV_NUM_DATA_POINTERS]; + + /** + * For planar audio which requires more than AV_NUM_DATA_POINTERS + * AVBufferRef pointers, this array will hold all the references which + * cannot fit into AVFrame.buf. + * + * Note that this is different from AVFrame.extended_data, which always + * contains all the pointers. This array only contains the extra pointers, + * which cannot fit into AVFrame.buf. + * + * This array is always allocated using av_malloc() by whoever constructs + * the frame. It is freed in av_frame_unref(). + */ + AVBufferRef **extended_buf; + /** + * Number of elements in extended_buf. + */ + int nb_extended_buf; + + AVFrameSideData **side_data; + int nb_side_data; + +/** + * @defgroup lavu_frame_flags AV_FRAME_FLAGS + * @ingroup lavu_frame + * Flags describing additional frame properties. + * + * @{ + */ + +/** + * The frame data may be corrupted, e.g. due to decoding errors. + */ +#define AV_FRAME_FLAG_CORRUPT (1 << 0) +/** + * A flag to mark frames that are keyframes. + */ +#define AV_FRAME_FLAG_KEY (1 << 1) +/** + * A flag to mark the frames which need to be decoded, but shouldn't be output. + */ +#define AV_FRAME_FLAG_DISCARD (1 << 2) +/** + * A flag to mark frames whose content is interlaced. + */ +#define AV_FRAME_FLAG_INTERLACED (1 << 3) +/** + * A flag to mark frames where the top field is displayed first if the content + * is interlaced. + */ +#define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4) +/** + * A decoder can use this flag to mark frames which were originally encoded losslessly. + * + * For coding bitstream formats which support both lossless and lossy + * encoding, it is sometimes possible for a decoder to determine which method + * was used when the bitstream was encoded. + */ +#define AV_FRAME_FLAG_LOSSLESS (1 << 5) +/** + * @} + */ + + /** + * Frame flags, a combination of @ref lavu_frame_flags + */ + int flags; + + /** + * MPEG vs JPEG YUV range. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorRange color_range; + + enum AVColorPrimaries color_primaries; + + enum AVColorTransferCharacteristic color_trc; + + /** + * YUV colorspace type. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVColorSpace colorspace; + + enum AVChromaLocation chroma_location; + + /** + * frame timestamp estimated using various heuristics, in stream time base + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int64_t best_effort_timestamp; + + /** + * metadata. + * - encoding: Set by user. + * - decoding: Set by libavcodec. + */ + AVDictionary *metadata; + + /** + * decode error flags of the frame, set to a combination of + * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there + * were errors during the decoding. + * - encoding: unused + * - decoding: set by libavcodec, read by user. + */ + int decode_error_flags; +#define FF_DECODE_ERROR_INVALID_BITSTREAM 1 +#define FF_DECODE_ERROR_MISSING_REFERENCE 2 +#define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 +#define FF_DECODE_ERROR_DECODE_SLICES 8 + + /** + * For hwaccel-format frames, this should be a reference to the + * AVHWFramesContext describing the frame. + */ + AVBufferRef *hw_frames_ctx; + + /** + * Frame owner's private data. + * + * This field may be set by the code that allocates/owns the frame data. + * It is then not touched by any library functions, except: + * - a new reference to the underlying buffer is propagated by + * av_frame_copy_props() (and hence by av_frame_ref()); + * - it is unreferenced in av_frame_unref(); + * - on the caller's explicit request. E.g. libavcodec encoders/decoders + * will propagate a new reference to/from @ref AVPacket "AVPackets" if the + * caller sets @ref AV_CODEC_FLAG_COPY_OPAQUE. + * + * @see opaque the plain pointer analogue + */ + AVBufferRef *opaque_ref; + + /** + * @anchor cropping + * @name Cropping + * Video frames only. The number of pixels to discard from the + * top/bottom/left/right border of the frame to obtain the sub-rectangle of + * the frame intended for presentation. + * @{ + */ + size_t crop_top; + size_t crop_bottom; + size_t crop_left; + size_t crop_right; + /** + * @} + */ + + /** + * RefStruct reference for internal use by a single libav* library. + * Must not be used to transfer data between libraries. + * Has to be NULL when ownership of the frame leaves the respective library. + * + * Code outside the FFmpeg libs must never check or change private_ref. + */ + void *private_ref; + + /** + * Channel layout of the audio data. + */ + AVChannelLayout ch_layout; + + /** + * Duration of the frame, in the same units as pts. 0 if unknown. + */ + int64_t duration; + + /** + * Indicates how the alpha channel of the video is to be handled. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; +} AVFrame; + + +/** + * Allocate an AVFrame and set its fields to default values. The resulting + * struct must be freed using av_frame_free(). + * + * @return An AVFrame filled with default values or NULL on failure. + * + * @note this only allocates the AVFrame itself, not the data buffers. Those + * must be allocated through other means, e.g. with av_frame_get_buffer() or + * manually. + */ +AVFrame *av_frame_alloc(void); + +/** + * Free the frame and any dynamically allocated objects in it, + * e.g. extended_data. If the frame is reference counted, it will be + * unreferenced first. + * + * @param frame frame to be freed. The pointer will be set to NULL. + */ +void av_frame_free(AVFrame **frame); + +/** + * Set up a new reference to the data described by the source frame. + * + * Copy frame properties from src to dst and create a new reference for each + * AVBufferRef from src. + * + * If src is not reference counted, new buffers are allocated and the data is + * copied. + * + * @warning: dst MUST have been either unreferenced with av_frame_unref(dst), + * or newly allocated with av_frame_alloc() before calling this + * function, or undefined behavior will occur. + * + * @return 0 on success, a negative AVERROR on error + */ +int av_frame_ref(AVFrame *dst, const AVFrame *src); + +/** + * Ensure the destination frame refers to the same data described by the source + * frame, either by creating a new reference for each AVBufferRef from src if + * they differ from those in dst, by allocating new buffers and copying data if + * src is not reference counted, or by unreferencing it if src is empty. + * + * Frame properties on dst will be replaced by those from src. + * + * @return 0 on success, a negative AVERROR on error. On error, dst is + * unreferenced. + */ +int av_frame_replace(AVFrame *dst, const AVFrame *src); + +/** + * Create a new frame that references the same data as src. + * + * This is a shortcut for av_frame_alloc()+av_frame_ref(). + * + * @return newly created AVFrame on success, NULL on error. + */ +AVFrame *av_frame_clone(const AVFrame *src); + +/** + * Unreference all the buffers referenced by frame and reset the frame fields. + */ +void av_frame_unref(AVFrame *frame); + +/** + * Move everything contained in src to dst and reset src. + * + * @warning: dst is not unreferenced, but directly overwritten without reading + * or deallocating its contents. Call av_frame_unref(dst) manually + * before calling this function to ensure that no memory is leaked. + */ +void av_frame_move_ref(AVFrame *dst, AVFrame *src); + +/** + * Allocate new buffer(s) for audio or video data. + * + * The following fields must be set on frame before calling this function: + * - format (pixel format for video, sample format for audio) + * - width and height for video + * - nb_samples and ch_layout for audio + * + * This function will fill AVFrame.data and AVFrame.buf arrays and, if + * necessary, allocate and fill AVFrame.extended_data and AVFrame.extended_buf. + * For planar formats, one buffer will be allocated for each plane. + * + * @warning: if frame already has been allocated, calling this function will + * leak memory. In addition, undefined behavior can occur in certain + * cases. + * + * @param frame frame in which to store the new buffers. + * @param align Required buffer size and data pointer alignment. If equal to 0, + * alignment will be chosen automatically for the current CPU. + * It is highly recommended to pass 0 here unless you know what + * you are doing. + * + * @return 0 on success, a negative AVERROR on error. + */ +int av_frame_get_buffer(AVFrame *frame, int align); + +/** + * Check if the frame data is writable. + * + * @return A positive value if the frame data is writable (which is true if and + * only if each of the underlying buffers has only one reference, namely the one + * stored in this frame). Return 0 otherwise. + * + * If 1 is returned the answer is valid until av_buffer_ref() is called on any + * of the underlying AVBufferRefs (e.g. through av_frame_ref() or directly). + * + * @see av_frame_make_writable(), av_buffer_is_writable() + */ +int av_frame_is_writable(AVFrame *frame); + +/** + * Ensure that the frame data is writable, avoiding data copy if possible. + * + * Do nothing if the frame is writable, allocate new buffers and copy the data + * if it is not. Non-refcounted frames behave as non-writable, i.e. a copy + * is always made. + * + * @return 0 on success, a negative AVERROR on error. + * + * @see av_frame_is_writable(), av_buffer_is_writable(), + * av_buffer_make_writable() + */ +int av_frame_make_writable(AVFrame *frame); + +/** + * Copy the frame data from src to dst. + * + * This function does not allocate anything, dst must be already initialized and + * allocated with the same parameters as src. + * + * This function only copies the frame data (i.e. the contents of the data / + * extended data arrays), not any other properties. + * + * @return >= 0 on success, a negative AVERROR on error. + */ +int av_frame_copy(AVFrame *dst, const AVFrame *src); + +/** + * Copy only "metadata" fields from src to dst. + * + * Metadata for the purpose of this function are those fields that do not affect + * the data layout in the buffers. E.g. pts, sample rate (for audio) or sample + * aspect ratio (for video), but not width/height or channel layout. + * Side data is also copied. + */ +int av_frame_copy_props(AVFrame *dst, const AVFrame *src); + +/** + * Get the buffer reference a given data plane is stored in. + * + * @param frame the frame to get the plane's buffer from + * @param plane index of the data plane of interest in frame->extended_data. + * + * @return the buffer reference that contains the plane or NULL if the input + * frame is not valid. + */ +AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane); + +/** + * Add a new side data to a frame. + * + * @param frame a frame to which the side data should be added + * @param type type of the added side data + * @param size size of the side data + * + * @return newly added side data on success, NULL on error + */ +AVFrameSideData *av_frame_new_side_data(AVFrame *frame, + enum AVFrameSideDataType type, + size_t size); + +/** + * Add a new side data to a frame from an existing AVBufferRef + * + * @param frame a frame to which the side data should be added + * @param type the type of the added side data + * @param buf an AVBufferRef to add as side data. The ownership of + * the reference is transferred to the frame. + * + * @return newly added side data on success, NULL on error. On failure + * the frame is unchanged and the AVBufferRef remains owned by + * the caller. + */ +AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, + enum AVFrameSideDataType type, + AVBufferRef *buf); + +/** + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this frame. + */ +AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, + enum AVFrameSideDataType type); + +/** + * Remove and free all side data instances of the given type. + */ +void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type); + + +/** + * Flags for frame cropping. + */ +enum { + /** + * Apply the maximum possible cropping, even if it requires setting the + * AVFrame.data[] entries to unaligned pointers. Passing unaligned data + * to FFmpeg API is generally not allowed, and causes undefined behavior + * (such as crashes). You can pass unaligned data only to FFmpeg APIs that + * are explicitly documented to accept it. Use this flag only if you + * absolutely know what you are doing. + */ + AV_FRAME_CROP_UNALIGNED = 1 << 0, +}; + +/** + * Crop the given video AVFrame according to its crop_left/crop_top/crop_right/ + * crop_bottom fields. If cropping is successful, the function will adjust the + * data pointers and the width/height fields, and set the crop fields to 0. + * + * In all cases, the cropping boundaries will be rounded to the inherent + * alignment of the pixel format. In some cases, such as for opaque hwaccel + * formats, the left/top cropping is ignored. The crop fields are set to 0 even + * if the cropping was rounded or ignored. + * + * @param frame the frame which should be cropped + * @param flags Some combination of AV_FRAME_CROP_* flags, or 0. + * + * @return >= 0 on success, a negative AVERROR on error. If the cropping fields + * were invalid, AVERROR(ERANGE) is returned, and nothing is changed. + */ +int av_frame_apply_cropping(AVFrame *frame, int flags); + +/** + * @return a string identifying the side data type + */ +const char *av_frame_side_data_name(enum AVFrameSideDataType type); + +/** + * @return side data descriptor corresponding to a given side data type, NULL + * when not available. + */ +const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type); + +/** + * Free all side data entries and their contents, then zeroes out the + * values which the pointers are pointing to. + * + * @param sd pointer to array of side data to free. Will be set to NULL + * upon return. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. Will be set to 0 upon return. + */ +void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd); + +/** + * Remove existing entries before adding new ones. + */ +#define AV_FRAME_SIDE_DATA_FLAG_UNIQUE (1 << 0) +/** + * Don't add a new entry if another of the same type exists. + * Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop. + */ +#define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1) +/** + * Create a new reference to the passed in buffer instead of taking ownership + * of it. + */ +#define AV_FRAME_SIDE_DATA_FLAG_NEW_REF (1 << 2) + +/** + * Add new side data entry to an array. + * + * @param sd pointer to array of side data to which to add another entry, + * or to NULL in order to start a new array. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. + * @param type type of the added side data + * @param size size of the side data + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0. + * + * @return newly added side data on success, NULL on error. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of + * matching AVFrameSideDataType will be removed before the addition + * is attempted. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an + * entry of the same type already exists, it will be replaced instead. + */ +AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type, + size_t size, unsigned int flags); + +/** + * Add a new side data entry to an array from an existing AVBufferRef. + * + * @param sd pointer to array of side data to which to add another entry, + * or to NULL in order to start a new array. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. + * @param type type of the added side data + * @param buf Pointer to AVBufferRef to add to the array. On success, + * the function takes ownership of the AVBufferRef and *buf is + * set to NULL, unless AV_FRAME_SIDE_DATA_FLAG_NEW_REF is set + * in which case the ownership will remain with the caller. + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0. + * + * @return newly added side data on success, NULL on error. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of + * matching AVFrameSideDataType will be removed before the addition + * is attempted. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an + * entry of the same type already exists, it will be replaced instead. + * + */ +AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type, + AVBufferRef **buf, unsigned int flags); + +/** + * Add a new side data entry to an array based on existing side data, taking + * a reference towards the contained AVBufferRef. + * + * @param sd pointer to array of side data to which to add another entry, + * or to NULL in order to start a new array. + * @param nb_sd pointer to an integer containing the number of entries in + * the array. + * @param src side data to be cloned, with a new reference utilized + * for the buffer. + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, or 0. + * + * @return negative error code on failure, >=0 on success. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_UNIQUE being set, entries of + * matching AVFrameSideDataType will be removed before the addition + * is attempted. + * @note In case of AV_FRAME_SIDE_DATA_FLAG_REPLACE being set, if an + * entry of the same type already exists, it will be replaced instead. + */ +int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, + const AVFrameSideData *src, unsigned int flags); + +/** + * Get a side data entry of a specific type from an array. + * + * @param sd array of side data. + * @param nb_sd integer containing the number of entries in the array. + * @param type type of side data to be queried + * + * @return a pointer to the side data of a given type on success, NULL if there + * is no side data with such type in this set. + */ +const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd, + const int nb_sd, + enum AVFrameSideDataType type); + +/** + * Wrapper around av_frame_side_data_get_c() to workaround the limitation + * that for any type T the conversion from T * const * to const T * const * + * is not performed automatically in C. + * @see av_frame_side_data_get_c() + */ +static inline +const AVFrameSideData *av_frame_side_data_get(AVFrameSideData * const *sd, + const int nb_sd, + enum AVFrameSideDataType type) +{ + return av_frame_side_data_get_c((const AVFrameSideData * const *)sd, + nb_sd, type); +} + +/** + * Remove and free all side data instances of the given type from an array. + */ +void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type); + +/** + * Remove and free all side data instances that match any of the given + * side data properties. (See enum AVSideDataProps) + */ +void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, + int props); + +/** + * @} + */ + +#endif /* AVUTIL_FRAME_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,601 @@ +/* + * 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 + */ + +#ifndef AVUTIL_HWCONTEXT_H +#define AVUTIL_HWCONTEXT_H + +#include "buffer.h" +#include "frame.h" +#include "log.h" +#include "pixfmt.h" + +enum AVHWDeviceType { + AV_HWDEVICE_TYPE_NONE, + AV_HWDEVICE_TYPE_VDPAU, + AV_HWDEVICE_TYPE_CUDA, + AV_HWDEVICE_TYPE_VAAPI, + AV_HWDEVICE_TYPE_DXVA2, + AV_HWDEVICE_TYPE_QSV, + AV_HWDEVICE_TYPE_VIDEOTOOLBOX, + AV_HWDEVICE_TYPE_D3D11VA, + AV_HWDEVICE_TYPE_DRM, + AV_HWDEVICE_TYPE_OPENCL, + AV_HWDEVICE_TYPE_MEDIACODEC, + AV_HWDEVICE_TYPE_VULKAN, + AV_HWDEVICE_TYPE_D3D12VA, + AV_HWDEVICE_TYPE_AMF, + /* OpenHarmony Codec device */ + AV_HWDEVICE_TYPE_OHCODEC, +}; + +/** + * This struct aggregates all the (hardware/vendor-specific) "high-level" state, + * i.e. state that is not tied to a concrete processing configuration. + * E.g., in an API that supports hardware-accelerated encoding and decoding, + * this struct will (if possible) wrap the state that is common to both encoding + * and decoding and from which specific instances of encoders or decoders can be + * derived. + * + * This struct is reference-counted with the AVBuffer mechanism. The + * av_hwdevice_ctx_alloc() constructor yields a reference, whose data field + * points to the actual AVHWDeviceContext. Further objects derived from + * AVHWDeviceContext (such as AVHWFramesContext, describing a frame pool with + * specific properties) will hold an internal reference to it. After all the + * references are released, the AVHWDeviceContext itself will be freed, + * optionally invoking a user-specified callback for uninitializing the hardware + * state. + */ +typedef struct AVHWDeviceContext { + /** + * A class for logging. Set by av_hwdevice_ctx_alloc(). + */ + const AVClass *av_class; + + /** + * This field identifies the underlying API used for hardware access. + * + * This field is set when this struct is allocated and never changed + * afterwards. + */ + enum AVHWDeviceType type; + + /** + * The format-specific data, allocated and freed by libavutil along with + * this context. + * + * Should be cast by the user to the format-specific context defined in the + * corresponding header (hwcontext_*.h) and filled as described in the + * documentation before calling av_hwdevice_ctx_init(). + * + * After calling av_hwdevice_ctx_init() this struct should not be modified + * by the caller. + */ + void *hwctx; + + /** + * This field may be set by the caller before calling av_hwdevice_ctx_init(). + * + * If non-NULL, this callback will be called when the last reference to + * this context is unreferenced, immediately before it is freed. + * + * @note when other objects (e.g an AVHWFramesContext) are derived from this + * struct, this callback will be invoked after all such child objects + * are fully uninitialized and their respective destructors invoked. + */ + void (*free)(struct AVHWDeviceContext *ctx); + + /** + * Arbitrary user data, to be used e.g. by the free() callback. + */ + void *user_opaque; +} AVHWDeviceContext; + +/** + * This struct describes a set or pool of "hardware" frames (i.e. those with + * data not located in normal system memory). All the frames in the pool are + * assumed to be allocated in the same way and interchangeable. + * + * This struct is reference-counted with the AVBuffer mechanism and tied to a + * given AVHWDeviceContext instance. The av_hwframe_ctx_alloc() constructor + * yields a reference, whose data field points to the actual AVHWFramesContext + * struct. + */ +typedef struct AVHWFramesContext { + /** + * A class for logging. + */ + const AVClass *av_class; + + /** + * A reference to the parent AVHWDeviceContext. This reference is owned and + * managed by the enclosing AVHWFramesContext, but the caller may derive + * additional references from it. + */ + AVBufferRef *device_ref; + + /** + * The parent AVHWDeviceContext. This is simply a pointer to + * device_ref->data provided for convenience. + * + * Set by libavutil in av_hwframe_ctx_init(). + */ + AVHWDeviceContext *device_ctx; + + /** + * The format-specific data, allocated and freed automatically along with + * this context. + * + * The user shall ignore this field if the corresponding format-specific + * header (hwcontext_*.h) does not define a context to be used as + * AVHWFramesContext.hwctx. + * + * Otherwise, it should be cast by the user to said context and filled + * as described in the documentation before calling av_hwframe_ctx_init(). + * + * After any frames using this context are created, the contents of this + * struct should not be modified by the caller. + */ + void *hwctx; + + /** + * This field may be set by the caller before calling av_hwframe_ctx_init(). + * + * If non-NULL, this callback will be called when the last reference to + * this context is unreferenced, immediately before it is freed. + */ + void (*free)(struct AVHWFramesContext *ctx); + + /** + * Arbitrary user data, to be used e.g. by the free() callback. + */ + void *user_opaque; + + /** + * A pool from which the frames are allocated by av_hwframe_get_buffer(). + * This field may be set by the caller before calling av_hwframe_ctx_init(). + * The buffers returned by calling av_buffer_pool_get() on this pool must + * have the properties described in the documentation in the corresponding hw + * type's header (hwcontext_*.h). The pool will be freed strictly before + * this struct's free() callback is invoked. + * + * This field may be NULL, then libavutil will attempt to allocate a pool + * internally. Note that certain device types enforce pools allocated at + * fixed size (frame count), which cannot be extended dynamically. In such a + * case, initial_pool_size must be set appropriately. + */ + AVBufferPool *pool; + + /** + * Initial size of the frame pool. If a device type does not support + * dynamically resizing the pool, then this is also the maximum pool size. + * + * May be set by the caller before calling av_hwframe_ctx_init(). Must be + * set if pool is NULL and the device type does not support dynamic pools. + */ + int initial_pool_size; + + /** + * The pixel format identifying the underlying HW surface type. + * + * Must be a hwaccel format, i.e. the corresponding descriptor must have the + * AV_PIX_FMT_FLAG_HWACCEL flag set. + * + * Must be set by the user before calling av_hwframe_ctx_init(). + */ + enum AVPixelFormat format; + + /** + * The pixel format identifying the actual data layout of the hardware + * frames. + * + * Must be set by the caller before calling av_hwframe_ctx_init(). + * + * @note when the underlying API does not provide the exact data layout, but + * only the colorspace/bit depth, this field should be set to the fully + * planar version of that format (e.g. for 8-bit 420 YUV it should be + * AV_PIX_FMT_YUV420P, not AV_PIX_FMT_NV12 or anything else). + */ + enum AVPixelFormat sw_format; + + /** + * The allocated dimensions of the frames in this pool. + * + * Must be set by the user before calling av_hwframe_ctx_init(). + */ + int width, height; +} AVHWFramesContext; + +/** + * Look up an AVHWDeviceType by name. + * + * @param name String name of the device type (case-insensitive). + * @return The type from enum AVHWDeviceType, or AV_HWDEVICE_TYPE_NONE if + * not found. + */ +enum AVHWDeviceType av_hwdevice_find_type_by_name(const char *name); + +/** Get the string name of an AVHWDeviceType. + * + * @param type Type from enum AVHWDeviceType. + * @return Pointer to a static string containing the name, or NULL if the type + * is not valid. + */ +const char *av_hwdevice_get_type_name(enum AVHWDeviceType type); + +/** + * Iterate over supported device types. + * + * @param prev AV_HWDEVICE_TYPE_NONE initially, then the previous type + * returned by this function in subsequent iterations. + * @return The next usable device type from enum AVHWDeviceType, or + * AV_HWDEVICE_TYPE_NONE if there are no more. + */ +enum AVHWDeviceType av_hwdevice_iterate_types(enum AVHWDeviceType prev); + +/** + * Allocate an AVHWDeviceContext for a given hardware type. + * + * @param type the type of the hardware device to allocate. + * @return a reference to the newly created AVHWDeviceContext on success or NULL + * on failure. + */ +AVBufferRef *av_hwdevice_ctx_alloc(enum AVHWDeviceType type); + +/** + * Finalize the device context before use. This function must be called after + * the context is filled with all the required information and before it is + * used in any way. + * + * @param ref a reference to the AVHWDeviceContext + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwdevice_ctx_init(AVBufferRef *ref); + +/** + * Open a device of the specified type and create an AVHWDeviceContext for it. + * + * This is a convenience function intended to cover the simple cases. Callers + * who need to fine-tune device creation/management should open the device + * manually and then wrap it in an AVHWDeviceContext using + * av_hwdevice_ctx_alloc()/av_hwdevice_ctx_init(). + * + * The returned context is already initialized and ready for use, the caller + * should not call av_hwdevice_ctx_init() on it. The user_opaque/free fields of + * the created AVHWDeviceContext are set by this function and should not be + * touched by the caller. + * + * @param device_ctx On success, a reference to the newly-created device context + * will be written here. The reference is owned by the caller + * and must be released with av_buffer_unref() when no longer + * needed. On failure, NULL will be written to this pointer. + * @param type The type of the device to create. + * @param device A type-specific string identifying the device to open. + * @param opts A dictionary of additional (type-specific) options to use in + * opening the device. The dictionary remains owned by the caller. + * @param flags currently unused + * + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create(AVBufferRef **device_ctx, enum AVHWDeviceType type, + const char *device, AVDictionary *opts, int flags); + +/** + * Create a new device of the specified type from an existing device. + * + * If the source device is a device of the target type or was originally + * derived from such a device (possibly through one or more intermediate + * devices of other types), then this will return a reference to the + * existing device of the same type as is requested. + * + * Otherwise, it will attempt to derive a new device from the given source + * device. If direct derivation to the new type is not implemented, it will + * attempt the same derivation from each ancestor of the source device in + * turn looking for an implemented derivation method. + * + * @param dst_ctx On success, a reference to the newly-created + * AVHWDeviceContext. + * @param type The type of the new device to create. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be + * used to create the new device. + * @param flags Currently unused; should be set to zero. + * @return Zero on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create_derived(AVBufferRef **dst_ctx, + enum AVHWDeviceType type, + AVBufferRef *src_ctx, int flags); + +/** + * Create a new device of the specified type from an existing device. + * + * This function performs the same action as av_hwdevice_ctx_create_derived, + * however, it is able to set options for the new device to be derived. + * + * @param dst_ctx On success, a reference to the newly-created + * AVHWDeviceContext. + * @param type The type of the new device to create. + * @param src_ctx A reference to an existing AVHWDeviceContext which will be + * used to create the new device. + * @param options Options for the new device to create, same format as in + * av_hwdevice_ctx_create. + * @param flags Currently unused; should be set to zero. + * @return Zero on success, a negative AVERROR code on failure. + */ +int av_hwdevice_ctx_create_derived_opts(AVBufferRef **dst_ctx, + enum AVHWDeviceType type, + AVBufferRef *src_ctx, + AVDictionary *options, int flags); + +/** + * Allocate an AVHWFramesContext tied to a given device context. + * + * @param device_ctx a reference to a AVHWDeviceContext. This function will make + * a new reference for internal use, the one passed to the + * function remains owned by the caller. + * @return a reference to the newly created AVHWFramesContext on success or NULL + * on failure. + */ +AVBufferRef *av_hwframe_ctx_alloc(AVBufferRef *device_ctx); + +/** + * Finalize the context before use. This function must be called after the + * context is filled with all the required information and before it is attached + * to any frames. + * + * @param ref a reference to the AVHWFramesContext + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwframe_ctx_init(AVBufferRef *ref); + +/** + * Allocate a new frame attached to the given AVHWFramesContext. + * + * @param hwframe_ctx a reference to an AVHWFramesContext + * @param frame an empty (freshly allocated or unreffed) frame to be filled with + * newly allocated buffers. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR code on failure + */ +int av_hwframe_get_buffer(AVBufferRef *hwframe_ctx, AVFrame *frame, int flags); + +/** + * Copy data to or from a hw surface. At least one of dst/src must have an + * AVHWFramesContext attached. + * + * If src has an AVHWFramesContext attached, then the format of dst (if set) + * must use one of the formats returned by av_hwframe_transfer_get_formats(src, + * AV_HWFRAME_TRANSFER_DIRECTION_FROM). + * If dst has an AVHWFramesContext attached, then the format of src must use one + * of the formats returned by av_hwframe_transfer_get_formats(dst, + * AV_HWFRAME_TRANSFER_DIRECTION_TO) + * + * dst may be "clean" (i.e. with data/buf pointers unset), in which case the + * data buffers will be allocated by this function using av_frame_get_buffer(). + * If dst->format is set, then this format will be used, otherwise (when + * dst->format is AV_PIX_FMT_NONE) the first acceptable format will be chosen. + * + * The two frames must have matching allocated dimensions (i.e. equal to + * AVHWFramesContext.width/height), since not all device types support + * transferring a sub-rectangle of the whole surface. The display dimensions + * (i.e. AVFrame.width/height) may be smaller than the allocated dimensions, but + * also have to be equal for both frames. When the display dimensions are + * smaller than the allocated dimensions, the content of the padding in the + * destination frame is unspecified. + * + * @param dst the destination frame. dst is not touched on failure. + * @param src the source frame. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR error code on failure. + */ +int av_hwframe_transfer_data(AVFrame *dst, const AVFrame *src, int flags); + +enum AVHWFrameTransferDirection { + /** + * Transfer the data from the queried hw frame. + */ + AV_HWFRAME_TRANSFER_DIRECTION_FROM, + + /** + * Transfer the data to the queried hw frame. + */ + AV_HWFRAME_TRANSFER_DIRECTION_TO, +}; + +/** + * Get a list of possible source or target formats usable in + * av_hwframe_transfer_data(). + * + * @param hwframe_ctx the frame context to obtain the information for + * @param dir the direction of the transfer + * @param formats the pointer to the output format list will be written here. + * The list is terminated with AV_PIX_FMT_NONE and must be freed + * by the caller when no longer needed using av_free(). + * If this function returns successfully, the format list will + * have at least one item (not counting the terminator). + * On failure, the contents of this pointer are unspecified. + * @param flags currently unused, should be set to zero + * @return 0 on success, a negative AVERROR code on failure. + */ +int av_hwframe_transfer_get_formats(AVBufferRef *hwframe_ctx, + enum AVHWFrameTransferDirection dir, + enum AVPixelFormat **formats, int flags); + + +/** + * This struct describes the constraints on hardware frames attached to + * a given device with a hardware-specific configuration. This is returned + * by av_hwdevice_get_hwframe_constraints() and must be freed by + * av_hwframe_constraints_free() after use. + */ +typedef struct AVHWFramesConstraints { + /** + * A list of possible values for format in the hw_frames_ctx, + * terminated by AV_PIX_FMT_NONE. This member will always be filled. + */ + enum AVPixelFormat *valid_hw_formats; + + /** + * A list of possible values for sw_format in the hw_frames_ctx, + * terminated by AV_PIX_FMT_NONE. Can be NULL if this information is + * not known. + */ + enum AVPixelFormat *valid_sw_formats; + + /** + * The minimum size of frames in this hw_frames_ctx. + * (Zero if not known.) + */ + int min_width; + int min_height; + + /** + * The maximum size of frames in this hw_frames_ctx. + * (INT_MAX if not known / no limit.) + */ + int max_width; + int max_height; +} AVHWFramesConstraints; + +/** + * Allocate a HW-specific configuration structure for a given HW device. + * After use, the user must free all members as required by the specific + * hardware structure being used, then free the structure itself with + * av_free(). + * + * @param device_ctx a reference to the associated AVHWDeviceContext. + * @return The newly created HW-specific configuration structure on + * success or NULL on failure. + */ +void *av_hwdevice_hwconfig_alloc(AVBufferRef *device_ctx); + +/** + * Get the constraints on HW frames given a device and the HW-specific + * configuration to be used with that device. If no HW-specific + * configuration is provided, returns the maximum possible capabilities + * of the device. + * + * @param ref a reference to the associated AVHWDeviceContext. + * @param hwconfig a filled HW-specific configuration structure, or NULL + * to return the maximum possible capabilities of the device. + * @return AVHWFramesConstraints structure describing the constraints + * on the device, or NULL if not available. + */ +AVHWFramesConstraints *av_hwdevice_get_hwframe_constraints(AVBufferRef *ref, + const void *hwconfig); + +/** + * Free an AVHWFrameConstraints structure. + * + * @param constraints The (filled or unfilled) AVHWFrameConstraints structure. + */ +void av_hwframe_constraints_free(AVHWFramesConstraints **constraints); + + +/** + * Flags to apply to frame mappings. + */ +enum { + /** + * The mapping must be readable. + */ + AV_HWFRAME_MAP_READ = 1 << 0, + /** + * The mapping must be writeable. + */ + AV_HWFRAME_MAP_WRITE = 1 << 1, + /** + * The mapped frame will be overwritten completely in subsequent + * operations, so the current frame data need not be loaded. Any values + * which are not overwritten are unspecified. + */ + AV_HWFRAME_MAP_OVERWRITE = 1 << 2, + /** + * The mapping must be direct. That is, there must not be any copying in + * the map or unmap steps. Note that performance of direct mappings may + * be much lower than normal memory. + */ + AV_HWFRAME_MAP_DIRECT = 1 << 3, +}; + +/** + * Map a hardware frame. + * + * This has a number of different possible effects, depending on the format + * and origin of the src and dst frames. On input, src should be a usable + * frame with valid buffers and dst should be blank (typically as just created + * by av_frame_alloc()). src should have an associated hwframe context, and + * dst may optionally have a format and associated hwframe context. + * + * If src was created by mapping a frame from the hwframe context of dst, + * then this function undoes the mapping - dst is replaced by a reference to + * the frame that src was originally mapped from. + * + * If both src and dst have an associated hwframe context, then this function + * attempts to map the src frame from its hardware context to that of dst and + * then fill dst with appropriate data to be usable there. This will only be + * possible if the hwframe contexts and associated devices are compatible - + * given compatible devices, av_hwframe_ctx_create_derived() can be used to + * create a hwframe context for dst in which mapping should be possible. + * + * If src has a hwframe context but dst does not, then the src frame is + * mapped to normal memory and should thereafter be usable as a normal frame. + * If the format is set on dst, then the mapping will attempt to create dst + * with that format and fail if it is not possible. If format is unset (is + * AV_PIX_FMT_NONE) then dst will be mapped with whatever the most appropriate + * format to use is (probably the sw_format of the src hwframe context). + * + * A return value of AVERROR(ENOSYS) indicates that the mapping is not + * possible with the given arguments and hwframe setup, while other return + * values indicate that it failed somehow. + * + * On failure, the destination frame will be left blank, except for the + * hw_frames_ctx/format fields they may have been set by the caller - those will + * be preserved as they were. + * + * @param dst Destination frame, to contain the mapping. + * @param src Source frame, to be mapped. + * @param flags Some combination of AV_HWFRAME_MAP_* flags. + * @return Zero on success, negative AVERROR code on failure. + */ +int av_hwframe_map(AVFrame *dst, const AVFrame *src, int flags); + + +/** + * Create and initialise an AVHWFramesContext as a mapping of another existing + * AVHWFramesContext on a different device. + * + * av_hwframe_ctx_init() should not be called after this. + * + * @param derived_frame_ctx On success, a reference to the newly created + * AVHWFramesContext. + * @param format The AVPixelFormat for the derived context. + * @param derived_device_ctx A reference to the device to create the new + * AVHWFramesContext on. + * @param source_frame_ctx A reference to an existing AVHWFramesContext + * which will be mapped to the derived context. + * @param flags Some combination of AV_HWFRAME_MAP_* flags, defining the + * mapping parameters to apply to frames which are allocated + * in the derived device. + * @return Zero on success, negative AVERROR code on failure. + */ +int av_hwframe_ctx_create_derived(AVBufferRef **derived_frame_ctx, + enum AVPixelFormat format, + AVBufferRef *derived_device_ctx, + AVBufferRef *source_frame_ctx, + int flags); + +#endif /* AVUTIL_HWCONTEXT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_drm.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_drm.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_drm.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_drm.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,169 @@ +/* + * 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 + */ + +#ifndef AVUTIL_HWCONTEXT_DRM_H +#define AVUTIL_HWCONTEXT_DRM_H + +#include +#include + +/** + * @file + * API-specific header for AV_HWDEVICE_TYPE_DRM. + * + * Internal frame allocation is not currently supported - all frames + * must be allocated by the user. Thus AVHWFramesContext is always + * NULL, though this may change if support for frame allocation is + * added in future. + */ + +enum { + /** + * The maximum number of layers/planes in a DRM frame. + */ + AV_DRM_MAX_PLANES = 4 +}; + +/** + * DRM object descriptor. + * + * Describes a single DRM object, addressing it as a PRIME file + * descriptor. + */ +typedef struct AVDRMObjectDescriptor { + /** + * DRM PRIME fd for the object. + */ + int fd; + /** + * Total size of the object. + * + * (This includes any parts not which do not contain image data.) + */ + size_t size; + /** + * Format modifier applied to the object (DRM_FORMAT_MOD_*). + * + * If the format modifier is unknown then this should be set to + * DRM_FORMAT_MOD_INVALID. + */ + uint64_t format_modifier; +} AVDRMObjectDescriptor; + +/** + * DRM plane descriptor. + * + * Describes a single plane of a layer, which is contained within + * a single object. + */ +typedef struct AVDRMPlaneDescriptor { + /** + * Index of the object containing this plane in the objects + * array of the enclosing frame descriptor. + */ + int object_index; + /** + * Offset within that object of this plane. + */ + ptrdiff_t offset; + /** + * Pitch (linesize) of this plane. + */ + ptrdiff_t pitch; +} AVDRMPlaneDescriptor; + +/** + * DRM layer descriptor. + * + * Describes a single layer within a frame. This has the structure + * defined by its format, and will contain one or more planes. + */ +typedef struct AVDRMLayerDescriptor { + /** + * Format of the layer (DRM_FORMAT_*). + */ + uint32_t format; + /** + * Number of planes in the layer. + * + * This must match the number of planes required by format. + */ + int nb_planes; + /** + * Array of planes in this layer. + */ + AVDRMPlaneDescriptor planes[AV_DRM_MAX_PLANES]; +} AVDRMLayerDescriptor; + +/** + * DRM frame descriptor. + * + * This is used as the data pointer for AV_PIX_FMT_DRM_PRIME frames. + * It is also used by user-allocated frame pools - allocating in + * AVHWFramesContext.pool must return AVBufferRefs which contain + * an object of this type. + * + * The fields of this structure should be set such it can be + * imported directly by EGL using the EGL_EXT_image_dma_buf_import + * and EGL_EXT_image_dma_buf_import_modifiers extensions. + * (Note that the exact layout of a particular format may vary between + * platforms - we only specify that the same platform should be able + * to import it.) + * + * The total number of planes must not exceed AV_DRM_MAX_PLANES, and + * the order of the planes by increasing layer index followed by + * increasing plane index must be the same as the order which would + * be used for the data pointers in the equivalent software format. + */ +typedef struct AVDRMFrameDescriptor { + /** + * Number of DRM objects making up this frame. + */ + int nb_objects; + /** + * Array of objects making up the frame. + */ + AVDRMObjectDescriptor objects[AV_DRM_MAX_PLANES]; + /** + * Number of layers in the frame. + */ + int nb_layers; + /** + * Array of layers in the frame. + */ + AVDRMLayerDescriptor layers[AV_DRM_MAX_PLANES]; +} AVDRMFrameDescriptor; + +/** + * DRM device. + * + * Allocated as AVHWDeviceContext.hwctx. + */ +typedef struct AVDRMDeviceContext { + /** + * File descriptor of DRM device. + * + * This is used as the device to create frames on, and may also be + * used in some derivation and mapping operations. + * + * If no device is required, set to -1. + */ + int fd; +} AVDRMDeviceContext; + +#endif /* AVUTIL_HWCONTEXT_DRM_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vaapi.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vaapi.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vaapi.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vaapi.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,117 @@ +/* + * 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 + */ + +#ifndef AVUTIL_HWCONTEXT_VAAPI_H +#define AVUTIL_HWCONTEXT_VAAPI_H + +#include + +/** + * @file + * API-specific header for AV_HWDEVICE_TYPE_VAAPI. + * + * Dynamic frame pools are supported, but note that any pool used as a render + * target is required to be of fixed size in order to be usable as an + * argument to vaCreateContext(). + * + * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs + * with the data pointer set to a VASurfaceID. + */ + +enum { + /** + * The quirks field has been set by the user and should not be detected + * automatically by av_hwdevice_ctx_init(). + */ + AV_VAAPI_DRIVER_QUIRK_USER_SET = (1 << 0), + /** + * The driver does not destroy parameter buffers when they are used by + * vaRenderPicture(). Additional code will be required to destroy them + * separately afterwards. + */ + AV_VAAPI_DRIVER_QUIRK_RENDER_PARAM_BUFFERS = (1 << 1), + + /** + * The driver does not support the VASurfaceAttribMemoryType attribute, + * so the surface allocation code will not try to use it. + */ + AV_VAAPI_DRIVER_QUIRK_ATTRIB_MEMTYPE = (1 << 2), + + /** + * The driver does not support surface attributes at all. + * The surface allocation code will never pass them to surface allocation, + * and the results of the vaQuerySurfaceAttributes() call will be faked. + */ + AV_VAAPI_DRIVER_QUIRK_SURFACE_ATTRIBUTES = (1 << 3), +}; + +/** + * VAAPI connection details. + * + * Allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVVAAPIDeviceContext { + /** + * The VADisplay handle, to be filled by the user. + */ + VADisplay display; + /** + * Driver quirks to apply - this is filled by av_hwdevice_ctx_init(), + * with reference to a table of known drivers, unless the + * AV_VAAPI_DRIVER_QUIRK_USER_SET bit is already present. The user + * may need to refer to this field when performing any later + * operations using VAAPI with the same VADisplay. + */ + unsigned int driver_quirks; +} AVVAAPIDeviceContext; + +/** + * VAAPI-specific data associated with a frame pool. + * + * Allocated as AVHWFramesContext.hwctx. + */ +typedef struct AVVAAPIFramesContext { + /** + * Set by the user to apply surface attributes to all surfaces in + * the frame pool. If null, default settings are used. + */ + VASurfaceAttrib *attributes; + int nb_attributes; + /** + * The surfaces IDs of all surfaces in the pool after creation. + * Only valid if AVHWFramesContext.initial_pool_size was positive. + * These are intended to be used as the render_targets arguments to + * vaCreateContext(). + */ + VASurfaceID *surface_ids; + int nb_surfaces; +} AVVAAPIFramesContext; + +/** + * VAAPI hardware pipeline configuration details. + * + * Allocated with av_hwdevice_hwconfig_alloc(). + */ +typedef struct AVVAAPIHWConfig { + /** + * ID of a VAAPI pipeline configuration. + */ + VAConfigID config_id; +} AVVAAPIHWConfig; + +#endif /* AVUTIL_HWCONTEXT_VAAPI_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vulkan.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vulkan.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vulkan.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/hwcontext_vulkan.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,404 @@ +/* + * 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 + */ + +#ifndef AVUTIL_HWCONTEXT_VULKAN_H +#define AVUTIL_HWCONTEXT_VULKAN_H + +#if defined(_WIN32) && !defined(VK_USE_PLATFORM_WIN32_KHR) +#define VK_USE_PLATFORM_WIN32_KHR +#endif +#include + +#include "pixfmt.h" +#include "frame.h" +#include "hwcontext.h" + +typedef struct AVVkFrame AVVkFrame; + +typedef struct AVVulkanDeviceQueueFamily { + /* Queue family index */ + int idx; + /* Number of queues in the queue family in use */ + int num; + /* Queue family capabilities. Must be non-zero. + * Flags may be removed to indicate the queue family may not be used + * for a given purpose. */ + VkQueueFlagBits flags; + /* Vulkan implementations are allowed to list multiple video queues + * which differ in what they can encode or decode. */ + VkVideoCodecOperationFlagBitsKHR video_caps; +} AVVulkanDeviceQueueFamily; + +/** + * @file + * API-specific header for AV_HWDEVICE_TYPE_VULKAN. + * + * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs + * with the data pointer set to an AVVkFrame. + */ + +/** + * Main Vulkan context, allocated as AVHWDeviceContext.hwctx. + * All of these can be set before init to change what the context uses + */ +typedef struct AVVulkanDeviceContext { + /** + * Custom memory allocator, else NULL + */ + const VkAllocationCallbacks *alloc; + + /** + * Pointer to a vkGetInstanceProcAddr loading function. + * If unset, will dynamically load and use libvulkan. + */ + PFN_vkGetInstanceProcAddr get_proc_addr; + + /** + * Vulkan instance. Must be at least version 1.3. + */ + VkInstance inst; + + /** + * Physical device + */ + VkPhysicalDevice phys_dev; + + /** + * Active device + */ + VkDevice act_dev; + + /** + * This structure should be set to the set of features that present and enabled + * during device creation. When a device is created by FFmpeg, it will default to + * enabling all that are present of the shaderImageGatherExtended, + * fragmentStoresAndAtomics, shaderInt64 and vertexPipelineStoresAndAtomics features. + */ + VkPhysicalDeviceFeatures2 device_features; + + /** + * Enabled instance extensions. + * If supplying your own device context, set this to an array of strings, with + * each entry containing the specified Vulkan extension string to enable. + * Duplicates are possible and accepted. + * If no extensions are enabled, set these fields to NULL, and 0 respectively. + * av_vk_get_optional_instance_extensions() can be used to enumerate extensions + * that FFmpeg may use if enabled. + */ + const char * const *enabled_inst_extensions; + int nb_enabled_inst_extensions; + + /** + * Enabled device extensions. By default, VK_KHR_external_memory_fd, + * VK_EXT_external_memory_dma_buf, VK_EXT_image_drm_format_modifier, + * VK_KHR_external_semaphore_fd and VK_EXT_external_memory_host are enabled if found. + * If supplying your own device context, these fields takes the same format as + * the above fields, with the same conditions that duplicates are possible + * and accepted, and that NULL and 0 respectively means no extensions are enabled. + * av_vk_get_optional_device_extensions() can be used to enumerate extensions + * that FFmpeg may use if enabled. + */ + const char * const *enabled_dev_extensions; + int nb_enabled_dev_extensions; + +#if FF_API_VULKAN_FIXED_QUEUES + /** + * Queue family index for graphics operations, and the number of queues + * enabled for it. If unavailable, will be set to -1. Not required. + * av_hwdevice_create() will attempt to find a dedicated queue for each + * queue family, or pick the one with the least unrelated flags set. + * Queue indices here may overlap if a queue has to share capabilities. + */ + attribute_deprecated + int queue_family_index; + attribute_deprecated + int nb_graphics_queues; + + /** + * Queue family index for transfer operations and the number of queues + * enabled. Required. + */ + attribute_deprecated + int queue_family_tx_index; + attribute_deprecated + int nb_tx_queues; + + /** + * Queue family index for compute operations and the number of queues + * enabled. Required. + */ + attribute_deprecated + int queue_family_comp_index; + attribute_deprecated + int nb_comp_queues; + + /** + * Queue family index for video encode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_encode_index will be -1. + * Not required. + */ + attribute_deprecated + int queue_family_encode_index; + attribute_deprecated + int nb_encode_queues; + + /** + * Queue family index for video decode ops, and the amount of queues enabled. + * If the device doesn't support such, queue_family_decode_index will be -1. + * Not required. + */ + attribute_deprecated + int queue_family_decode_index; + attribute_deprecated + int nb_decode_queues; +#endif + +#if FF_API_VULKAN_SYNC_QUEUES + /** + * Locks a queue, preventing other threads from submitting any command + * buffers to this queue. + * If set to NULL, will be set to lavu-internal functions that utilize a + * mutex. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. + */ + attribute_deprecated + void (*lock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index); + + /** + * Similar to lock_queue(), unlocks a queue. Must only be called after locking. + * + * Deprecated: use VK_KHR_internally_synchronized_queues. + */ + attribute_deprecated + void (*unlock_queue)(struct AVHWDeviceContext *ctx, uint32_t queue_family, uint32_t index); +#endif + + /** + * Queue families used. Must be preferentially ordered. List may contain + * duplicates. + * + * For compatibility reasons, all the enabled queue families listed above + * (queue_family_(tx/comp/encode/decode)_index) must also be included in + * this list until they're removed after deprecation. + */ + AVVulkanDeviceQueueFamily qf[64]; + int nb_qf; +} AVVulkanDeviceContext; + +/** + * Defines the behaviour of frame allocation. + */ +typedef enum AVVkFrameFlags { + /* Unless this flag is set, autodetected flags will be OR'd based on the + * device and tiling during av_hwframe_ctx_init(). */ + AV_VK_FRAME_FLAG_NONE = (1ULL << 0), + + /* Disables multiplane images. + * This is required to export/import images from CUDA. */ + AV_VK_FRAME_FLAG_DISABLE_MULTIPLANE = (1ULL << 2), +} AVVkFrameFlags; + +/** + * Allocated as AVHWFramesContext.hwctx, used to set pool-specific options + */ +typedef struct AVVulkanFramesContext { + /** + * Controls the tiling of allocated frames. + * If left as VK_IMAGE_TILING_OPTIMAL (0), will use optimal tiling. + * Can be set to VK_IMAGE_TILING_LINEAR to force linear images, + * or VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT to force DMABUF-backed + * images. + * @note Imported frames from other APIs ignore this. + */ + VkImageTiling tiling; + + /** + * Defines extra usage of output frames. If non-zero, all flags MUST be + * supported by the VkFormat. Regardless, frames will always have the + * following usage flags enabled, if supported by the format: + * - VK_IMAGE_USAGE_SAMPLED_BIT + * - VK_IMAGE_USAGE_STORAGE_BIT + * - VK_IMAGE_USAGE_TRANSFER_SRC_BIT + * - VK_IMAGE_USAGE_TRANSFER_DST_BIT + */ + VkImageUsageFlagBits usage; + + /** + * Extension data for image creation. + * If DRM tiling is used, a VkImageDrmFormatModifierListCreateInfoEXT structure + * can be added to specify the exact modifier to use. + * + * Additional structures may be added at av_hwframe_ctx_init() time, + * which will be freed automatically on uninit(), so users must only free + * any structures they've allocated themselves. + */ + void *create_pnext; + + /** + * Extension data for memory allocation. Must have as many entries as + * the number of planes of the sw_format. + * This will be chained to VkExportMemoryAllocateInfo, which is used + * to make all pool images exportable to other APIs if the necessary + * extensions are present in enabled_dev_extensions. + */ + void *alloc_pnext[AV_NUM_DATA_POINTERS]; + + /** + * A combination of AVVkFrameFlags. Unless AV_VK_FRAME_FLAG_NONE is set, + * autodetected flags will be OR'd based on the device and tiling during + * av_hwframe_ctx_init(). + */ + AVVkFrameFlags flags; + + /** + * Flags to set during image creation. If unset, defaults to + * VK_IMAGE_CREATE_ALIAS_BIT. + */ + VkImageCreateFlags img_flags; + + /** + * Vulkan format for each image. MUST be compatible with the pixel format. + * If unset, will be automatically set. + * There are at most two compatible formats for a frame - a multiplane + * format, and a single-plane multi-image format. + */ + VkFormat format[AV_NUM_DATA_POINTERS]; + + /** + * Number of layers each image will have. + */ + int nb_layers; + + /** + * Locks a frame, preventing other threads from changing frame properties. + * Users SHOULD only ever lock just before command submission in order + * to get accurate frame properties, and unlock immediately after command + * submission without waiting for it to finish. + * + * If unset, will be set to lavu-internal functions that utilize a mutex. + */ + void (*lock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf); + + /** + * Similar to lock_frame(), unlocks a frame. Must only be called after locking. + */ + void (*unlock_frame)(struct AVHWFramesContext *fc, AVVkFrame *vkf); +} AVVulkanFramesContext; + +/* + * Frame structure. + * + * @note the size of this structure is not part of the ABI, to allocate + * you must use @av_vk_frame_alloc(). + */ +struct AVVkFrame { + /** + * Vulkan images to which the memory is bound to. + * May be one for multiplane formats, or multiple. + */ + VkImage img[AV_NUM_DATA_POINTERS]; + + /** + * Tiling for the frame. + */ + VkImageTiling tiling; + + /** + * Memory backing the images. Either one, or as many as there are planes + * in the sw_format. + * In case of having multiple VkImages, but one memory, the offset field + * will indicate the bound offset for each image. + */ + VkDeviceMemory mem[AV_NUM_DATA_POINTERS]; + size_t size[AV_NUM_DATA_POINTERS]; + + /** + * OR'd flags for all memory allocated + */ + VkMemoryPropertyFlagBits flags; + + /** + * Updated after every barrier. One per VkImage. + */ + VkAccessFlagBits access[AV_NUM_DATA_POINTERS]; + VkImageLayout layout[AV_NUM_DATA_POINTERS]; + + /** + * Synchronization timeline semaphores, one for each VkImage. + * Must not be freed manually. Must be waited on at every submission using + * the value in sem_value, and must be signalled at every submission, + * using an incremented value. + */ + VkSemaphore sem[AV_NUM_DATA_POINTERS]; + + /** + * Up to date semaphore value at which each image becomes accessible. + * One per VkImage. + * Clients must wait on this value when submitting a command queue, + * and increment it when signalling. + */ + uint64_t sem_value[AV_NUM_DATA_POINTERS]; + + /** + * Internal data. + */ + struct AVVkFrameInternal *internal; + + /** + * Describes the binding offset of each image to the VkDeviceMemory. + * One per VkImage. + */ + ptrdiff_t offset[AV_NUM_DATA_POINTERS]; + + /** + * Queue family of the images. Must be VK_QUEUE_FAMILY_IGNORED if + * the image was allocated with the CONCURRENT concurrency option. + * One per VkImage. + */ + uint32_t queue_family[AV_NUM_DATA_POINTERS]; +}; + +/** + * Allocates a single AVVkFrame and initializes everything as 0. + * @note Must be freed via av_free() + */ +AVVkFrame *av_vk_frame_alloc(void); + +/** + * Returns the optimal per-plane Vulkan format for a given sw_format, + * one for each plane. + * Returns NULL on unsupported formats. + */ +const VkFormat *av_vkfmt_from_pixfmt(enum AVPixelFormat p); + +/** + * Returns an array of optional Vulkan instance extensions that FFmpeg + * may use if enabled. + * @note Must be freed via av_free() + */ +const char **av_vk_get_optional_instance_extensions(int *count); + +/** + * Returns an array of optional Vulkan device extensions that FFmpeg + * may use if enabled. + * @note Must be freed via av_free() + */ +const char **av_vk_get_optional_device_extensions(int *count); + +#endif /* AVUTIL_HWCONTEXT_VULKAN_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/intfloat.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/intfloat.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/intfloat.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/intfloat.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2011 Mans Rullgard + * + * 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 + */ + +#ifndef AVUTIL_INTFLOAT_H +#define AVUTIL_INTFLOAT_H + +#include +#include "attributes.h" + +union av_intfloat32 { + uint32_t i; + float f; +}; + +union av_intfloat64 { + uint64_t i; + double f; +}; + +/** + * Reinterpret a 32-bit integer as a float. + */ +static av_always_inline float av_int2float(uint32_t i) +{ + union av_intfloat32 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a float as a 32-bit integer. + */ +static av_always_inline uint32_t av_float2int(float f) +{ + union av_intfloat32 v; + v.f = f; + return v.i; +} + +/** + * Reinterpret a 64-bit integer as a double. + */ +static av_always_inline double av_int2double(uint64_t i) +{ + union av_intfloat64 v; + v.i = i; + return v.f; +} + +/** + * Reinterpret a double as a 64-bit integer. + */ +static av_always_inline uint64_t av_double2int(double f) +{ + union av_intfloat64 v; + v.f = f; + return v.i; +} + +#endif /* AVUTIL_INTFLOAT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/log.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/log.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/log.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/log.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,427 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +#ifndef AVUTIL_LOG_H +#define AVUTIL_LOG_H + +#include +#include "attributes.h" +#include "version.h" + +typedef enum { + AV_CLASS_CATEGORY_NA = 0, + AV_CLASS_CATEGORY_INPUT, + AV_CLASS_CATEGORY_OUTPUT, + AV_CLASS_CATEGORY_MUXER, + AV_CLASS_CATEGORY_DEMUXER, + AV_CLASS_CATEGORY_ENCODER, + AV_CLASS_CATEGORY_DECODER, + AV_CLASS_CATEGORY_FILTER, + AV_CLASS_CATEGORY_BITSTREAM_FILTER, + AV_CLASS_CATEGORY_SWSCALER, + AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_HWDEVICE, + AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40, + AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT, + AV_CLASS_CATEGORY_DEVICE_OUTPUT, + AV_CLASS_CATEGORY_DEVICE_INPUT, + AV_CLASS_CATEGORY_NB ///< not part of ABI/API +}AVClassCategory; + +enum AVClassStateFlags { + /** + * Object initialization has finished and it is now in the 'runtime' stage. + * This affects e.g. what options can be set on the object (only + * AV_OPT_FLAG_RUNTIME_PARAM options can be set on initialized objects). + */ + AV_CLASS_STATE_INITIALIZED = (1 << 0), +}; + +#define AV_IS_INPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_INPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_INPUT)) + +#define AV_IS_OUTPUT_DEVICE(category) \ + (((category) == AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT) || \ + ((category) == AV_CLASS_CATEGORY_DEVICE_OUTPUT)) + +struct AVOptionRanges; + +/** + * Describe the class of an AVClass context structure. That is an + * arbitrary struct of which the first field is a pointer to an + * AVClass struct (e.g. AVCodecContext, AVFormatContext etc.). + */ +typedef struct AVClass { + /** + * The name of the class; usually it is the same name as the + * context structure type to which the AVClass is associated. + */ + const char* class_name; + + /** + * A pointer to a function which returns the name of a context + * instance ctx associated with the class. + */ + const char* (*item_name)(void* ctx); + + /** + * An array of options for the structure or NULL. + * When non-NULL, the array must be terminated by an option with a NULL + * name. + * + * @see av_set_default_options() + */ + const struct AVOption *option; + + /** + * LIBAVUTIL_VERSION with which this structure was created. + * This is used to allow fields to be added to AVClass without requiring + * major version bumps everywhere. + */ + + int version; + + /** + * Offset in the structure where the log level offset is stored. The log + * level offset is an int added to the log level for logging with this + * object as the context. + * + * 0 means there is no such variable. + */ + int log_level_offset_offset; + + /** + * Offset in the structure where a pointer to the parent context for + * logging is stored. For example a decoder could pass its AVCodecContext + * to eval as such a parent context, which an ::av_log() implementation + * could then leverage to display the parent context. + * + * When the pointer is NULL, or this offset is zero, the object is assumed + * to have no parent. + */ + int parent_log_context_offset; + + /** + * Category used for visualization (like color). + * + * Only used when ::get_category() is NULL. Use this field when all + * instances of this class have the same category, use ::get_category() + * otherwise. + */ + AVClassCategory category; + + /** + * Callback to return the instance category. Use this callback when + * different instances of this class may have different categories, + * ::category otherwise. + */ + AVClassCategory (*get_category)(void* ctx); + + /** + * Callback to return the supported/allowed ranges. + */ + int (*query_ranges)(struct AVOptionRanges **, void *obj, const char *key, int flags); + + /** + * Return next AVOptions-enabled child or NULL + */ + void* (*child_next)(void *obj, void *prev); + + /** + * Iterate over the AVClasses corresponding to potential AVOptions-enabled + * children. + * + * @param iter pointer to opaque iteration state. The caller must initialize + * *iter to NULL before the first call. + * @return AVClass for the next AVOptions-enabled child or NULL if there are + * no more such children. + * + * @note The difference between ::child_next() and ::child_class_iterate() + * is that ::child_next() iterates over _actual_ children of an + * _existing_ object instance, while ::child_class_iterate() iterates + * over the classes of all _potential_ children of any possible + * instance of this class. + */ + const struct AVClass* (*child_class_iterate)(void **iter); + + /** + * When non-zero, offset in the object to an unsigned int holding object + * state flags, a combination of AVClassStateFlags values. The flags are + * updated by the object to signal its state to the generic code. + * + * Added in version 59.41.100. + */ + int state_flags_offset; +} AVClass; + +/** + * @addtogroup lavu_log + * + * @{ + * + * @defgroup lavu_log_constants Logging Constants + * + * @{ + */ + +/** + * Print no output. + */ +#define AV_LOG_QUIET -8 + +/** + * Something went really wrong and we will crash now. + */ +#define AV_LOG_PANIC 0 + +/** + * Something went wrong and recovery is not possible. + * For example, no header was found for a format which depends + * on headers or an illegal combination of parameters is used. + */ +#define AV_LOG_FATAL 8 + +/** + * Something went wrong and cannot losslessly be recovered. + * However, not all future data is affected. + */ +#define AV_LOG_ERROR 16 + +/** + * Something somehow does not look correct. This may or may not + * lead to problems. An example would be the use of '-vstrict -2'. + */ +#define AV_LOG_WARNING 24 + +/** + * Standard information. + */ +#define AV_LOG_INFO 32 + +/** + * Detailed information. + */ +#define AV_LOG_VERBOSE 40 + +/** + * Stuff which is only useful for libav* developers. + */ +#define AV_LOG_DEBUG 48 + +/** + * Extremely verbose debugging, useful for libav* development. + */ +#define AV_LOG_TRACE 56 + +#define AV_LOG_MAX_OFFSET (AV_LOG_TRACE - AV_LOG_QUIET) + +/** + * @} + */ + +/** + * Sets additional colors for extended debugging sessions. + * @code + av_log(ctx, AV_LOG_DEBUG|AV_LOG_C(134), "Message in purple\n"); + @endcode + * Requires 256color terminal support. Uses outside debugging is not + * recommended. + */ +#define AV_LOG_C(x) ((x) << 8) + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct or NULL if general log. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + */ +void av_log(void *avcl, int level, const char *fmt, ...) av_printf_format(3, 4); + +/** + * Send the specified message to the log once with the initial_level and then with + * the subsequent_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct or NULL if general log. + * @param initial_level importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant" for the first occurrence. + * @param subsequent_level importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant" after the first occurrence. + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param state a variable to keep trak of if a message has already been printed + * this must be initialized to 0 before the first use. The same state + * must not be accessed by 2 Threads simultaneously. + */ +void av_log_once(void* avcl, int initial_level, int subsequent_level, int *state, const char *fmt, ...) av_printf_format(5, 6); + + +/** + * Send the specified message to the log if the level is less than or equal + * to the current av_log_level. By default, all logging messages are sent to + * stderr. This behavior can be altered by setting a different logging callback + * function. + * @see av_log_set_callback + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_vlog(void *avcl, int level, const char *fmt, va_list vl); + +/** + * Get the current log level + * + * @see lavu_log_constants + * + * @return Current log level + */ +int av_log_get_level(void); + +/** + * Set the log level + * + * @see lavu_log_constants + * + * @param level Logging level + */ +void av_log_set_level(int level); + +/** + * Set the logging callback + * + * @note The callback must be thread safe, even if the application does not use + * threads itself as some codecs are multithreaded. + * + * @see av_log_default_callback + * + * @param callback A logging function with a compatible signature. + */ +void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)); + +/** + * Default logging callback + * + * It prints the message to stderr, optionally colorizing it. + * + * @param avcl A pointer to an arbitrary struct of which the first field is a + * pointer to an AVClass struct. + * @param level The importance level of the message expressed using a @ref + * lavu_log_constants "Logging Constant". + * @param fmt The format string (printf-compatible) that specifies how + * subsequent arguments are converted to output. + * @param vl The arguments referenced by the format string. + */ +void av_log_default_callback(void *avcl, int level, const char *fmt, + va_list vl); + +/** + * Return the context name + * + * @param ctx The AVClass context + * + * @return The AVClass class_name + */ +const char* av_default_item_name(void* ctx); +AVClassCategory av_default_get_category(void *ptr); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formatted line + * @param line_size size of the buffer + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + */ +void av_log_format_line(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * Format a line of log the same way as the default callback. + * @param line buffer to receive the formatted line; + * may be NULL if line_size is 0 + * @param line_size size of the buffer; at most line_size-1 characters will + * be written to the buffer, plus one null terminator + * @param print_prefix used to store whether the prefix must be printed; + * must point to a persistent integer initially set to 1 + * @return Returns a negative value if an error occurred, otherwise returns + * the number of characters that would have been written for a + * sufficiently large buffer, not including the terminating null + * character. If the return value is not less than line_size, it means + * that the log message was truncated to fit the buffer. + */ +int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, + char *line, int line_size, int *print_prefix); + +/** + * Skip repeated messages, this requires the user app to use av_log() instead of + * (f)printf as the 2 would otherwise interfere and lead to + * "Last message repeated x times" messages below (f)printf messages with some + * bad luck. + * Also to receive the last, "last repeated" line if any, the user app must + * call av_log(NULL, AV_LOG_QUIET, "%s", ""); at the end + */ +#define AV_LOG_SKIP_REPEATED 1 + +/** + * Include the log severity in messages originating from codecs. + * + * Results in messages such as: + * [rawvideo @ 0xDEADBEEF] [error] encode did not produce valid pts + */ +#define AV_LOG_PRINT_LEVEL 2 + +/** + * Include system time in log output. + */ +#define AV_LOG_PRINT_TIME 4 + +/** + * Include system date and time in log output. + */ +#define AV_LOG_PRINT_DATETIME 8 + +void av_log_set_flags(int arg); +int av_log_get_flags(void); + +/** + * @} + */ + +#endif /* AVUTIL_LOG_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/macros.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/macros.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/macros.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/macros.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * 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 + */ + +/** + * @file + * @ingroup lavu + * Utility Preprocessor macros + */ + +#ifndef AVUTIL_MACROS_H +#define AVUTIL_MACROS_H + +#include "libavutil/avconfig.h" + +#if AV_HAVE_BIGENDIAN +# define AV_NE(be, le) (be) +#else +# define AV_NE(be, le) (le) +#endif + +/** + * Comparator. + * For two numerical expressions x and y, gives 1 if x > y, -1 if x < y, and 0 + * if x == y. This is useful for instance in a qsort comparator callback. + * Furthermore, compilers are able to optimize this to branchless code, and + * there is no risk of overflow with signed types. + * As with many macros, this evaluates its argument multiple times, it thus + * must not have a side-effect. + */ +#define FFDIFFSIGN(x,y) (((x)>(y)) - ((x)<(y))) + +#define FFMAX(a,b) ((a) > (b) ? (a) : (b)) +#define FFMAX3(a,b,c) FFMAX(FFMAX(a,b),c) +#define FFMIN(a,b) ((a) > (b) ? (b) : (a)) +#define FFMIN3(a,b,c) FFMIN(FFMIN(a,b),c) + +#define FFSWAP(type,a,b) do{type SWAP_tmp= b; b= a; a= SWAP_tmp;}while(0) +#define FF_ARRAY_ELEMS(a) (sizeof(a) / sizeof((a)[0])) + +#define MKTAG(a,b,c,d) ((a) | ((b) << 8) | ((c) << 16) | ((unsigned)(d) << 24)) +#define MKBETAG(a,b,c,d) ((d) | ((c) << 8) | ((b) << 16) | ((unsigned)(a) << 24)) + +/** + * @addtogroup preproc_misc Preprocessor String Macros + * + * String manipulation macros + * + * @{ + */ + +#define AV_STRINGIFY(s) AV_TOSTRING(s) +#define AV_TOSTRING(s) #s + +#define AV_GLUE(a, b) a ## b +#define AV_JOIN(a, b) AV_GLUE(a, b) + +/** + * @} + */ + +#define AV_PRAGMA(s) _Pragma(#s) + +#define FFALIGN(x, a) (((x)+(a)-1)&~((a)-1)) + +#endif /* AVUTIL_MACROS_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mathematics.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mathematics.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mathematics.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mathematics.h 2026-04-29 18:38:20.000000000 +0000 @@ -0,0 +1,300 @@ +/* + * copyright (c) 2005-2012 Michael Niedermayer + * + * 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 + */ + +/** + * @file + * @addtogroup lavu_math + * Mathematical utilities for working with timestamp and time base. + */ + +#ifndef AVUTIL_MATHEMATICS_H +#define AVUTIL_MATHEMATICS_H + +#include +#include +#include "attributes.h" +#include "rational.h" +#include "intfloat.h" + +#ifndef M_E +#define M_E 2.7182818284590452354 /* e */ +#endif +#ifndef M_Ef +#define M_Ef 2.7182818284590452354f /* e */ +#endif +#ifndef M_LN2 +#define M_LN2 0.69314718055994530942 /* log_e 2 */ +#endif +#ifndef M_LN2f +#define M_LN2f 0.69314718055994530942f /* log_e 2 */ +#endif +#ifndef M_LN10 +#define M_LN10 2.30258509299404568402 /* log_e 10 */ +#endif +#ifndef M_LN10f +#define M_LN10f 2.30258509299404568402f /* log_e 10 */ +#endif +#ifndef M_LOG2_10 +#define M_LOG2_10 3.32192809488736234787 /* log_2 10 */ +#endif +#ifndef M_LOG2_10f +#define M_LOG2_10f 3.32192809488736234787f /* log_2 10 */ +#endif +#ifndef M_PHI +#define M_PHI 1.61803398874989484820 /* phi / golden ratio */ +#endif +#ifndef M_PHIf +#define M_PHIf 1.61803398874989484820f /* phi / golden ratio */ +#endif +#ifndef M_PI +#define M_PI 3.14159265358979323846 /* pi */ +#endif +#ifndef M_PIf +#define M_PIf 3.14159265358979323846f /* pi */ +#endif +#ifndef M_PI_2 +#define M_PI_2 1.57079632679489661923 /* pi/2 */ +#endif +#ifndef M_PI_2f +#define M_PI_2f 1.57079632679489661923f /* pi/2 */ +#endif +#ifndef M_PI_4 +#define M_PI_4 0.78539816339744830962 /* pi/4 */ +#endif +#ifndef M_PI_4f +#define M_PI_4f 0.78539816339744830962f /* pi/4 */ +#endif +#ifndef M_1_PI +#define M_1_PI 0.31830988618379067154 /* 1/pi */ +#endif +#ifndef M_1_PIf +#define M_1_PIf 0.31830988618379067154f /* 1/pi */ +#endif +#ifndef M_2_PI +#define M_2_PI 0.63661977236758134308 /* 2/pi */ +#endif +#ifndef M_2_PIf +#define M_2_PIf 0.63661977236758134308f /* 2/pi */ +#endif +#ifndef M_2_SQRTPI +#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */ +#endif +#ifndef M_2_SQRTPIf +#define M_2_SQRTPIf 1.12837916709551257390f /* 2/sqrt(pi) */ +#endif +#ifndef M_SQRT1_2 +#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */ +#endif +#ifndef M_SQRT1_2f +#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */ +#endif +#ifndef M_SQRT2 +#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */ +#endif +#ifndef M_SQRT2f +#define M_SQRT2f 1.41421356237309504880f /* sqrt(2) */ +#endif +#ifndef NAN +#define NAN av_int2float(0x7fc00000) +#endif +#ifndef INFINITY +#define INFINITY av_int2float(0x7f800000) +#endif + +/** + * @addtogroup lavu_math + * + * @{ + */ + +/** + * Rounding methods. + */ +enum AVRounding { + AV_ROUND_ZERO = 0, ///< Round toward zero. + AV_ROUND_INF = 1, ///< Round away from zero. + AV_ROUND_DOWN = 2, ///< Round toward -infinity. + AV_ROUND_UP = 3, ///< Round toward +infinity. + AV_ROUND_NEAR_INF = 5, ///< Round to nearest and halfway cases away from zero. + /** + * Flag telling rescaling functions to pass `INT64_MIN`/`MAX` through + * unchanged, avoiding special cases for #AV_NOPTS_VALUE. + * + * Unlike other values of the enumeration AVRounding, this value is a + * bitmask that must be used in conjunction with another value of the + * enumeration through a bitwise OR, in order to set behavior for normal + * cases. + * + * @code{.c} + * av_rescale_rnd(3, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); + * // Rescaling 3: + * // Calculating 3 * 1 / 2 + * // 3 / 2 is rounded up to 2 + * // => 2 + * + * av_rescale_rnd(AV_NOPTS_VALUE, 1, 2, AV_ROUND_UP | AV_ROUND_PASS_MINMAX); + * // Rescaling AV_NOPTS_VALUE: + * // AV_NOPTS_VALUE == INT64_MIN + * // AV_NOPTS_VALUE is passed through + * // => AV_NOPTS_VALUE + * @endcode + */ + AV_ROUND_PASS_MINMAX = 8192, +}; + +/** + * Compute the greatest common divisor of two integer operands. + * + * @param a Operand + * @param b Operand + * @return GCD of a and b up to sign; if a >= 0 and b >= 0, return value is >= 0; + * if a == 0 and b == 0, returns 0. + */ +int64_t av_const av_gcd(int64_t a, int64_t b); + +/** + * Rescale a 64-bit integer with rounding to nearest. + * + * The operation is mathematically equivalent to `a * b / c`, but writing that + * directly can overflow. + * + * This function is equivalent to av_rescale_rnd() with #AV_ROUND_NEAR_INF. + * + * @see av_rescale_rnd(), av_rescale_q(), av_rescale_q_rnd() + */ +int64_t av_rescale(int64_t a, int64_t b, int64_t c) av_const; + +/** + * Rescale a 64-bit integer with specified rounding. + * + * The operation is mathematically equivalent to `a * b / c`, but writing that + * directly can overflow, and does not support different rounding methods. + * If the result is not representable then INT64_MIN is returned. + * + * @see av_rescale(), av_rescale_q(), av_rescale_q_rnd() + */ +int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers. + * + * The operation is mathematically equivalent to `a * bq / cq`. + * + * This function is equivalent to av_rescale_q_rnd() with #AV_ROUND_NEAR_INF. + * + * @see av_rescale(), av_rescale_rnd(), av_rescale_q_rnd() + */ +int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq) av_const; + +/** + * Rescale a 64-bit integer by 2 rational numbers with specified rounding. + * + * The operation is mathematically equivalent to `a * bq / cq`. + * + * @see av_rescale(), av_rescale_rnd(), av_rescale_q() + */ +int64_t av_rescale_q_rnd(int64_t a, AVRational bq, AVRational cq, + enum AVRounding rnd) av_const; + +/** + * Compare two timestamps each in its own time base. + * + * @return One of the following values: + * - -1 if `ts_a` is before `ts_b` + * - 1 if `ts_a` is after `ts_b` + * - 0 if they represent the same position + * + * @warning + * The result of the function is undefined if one of the timestamps is outside + * the `int64_t` range when represented in the other's timebase. + */ +int av_compare_ts(int64_t ts_a, AVRational tb_a, int64_t ts_b, AVRational tb_b); + +/** + * Compare the remainders of two integer operands divided by a common divisor. + * + * In other words, compare the least significant `log2(mod)` bits of integers + * `a` and `b`. + * + * @code{.c} + * av_compare_mod(0x11, 0x02, 0x10) < 0 // since 0x11 % 0x10 (0x1) < 0x02 % 0x10 (0x2) + * av_compare_mod(0x11, 0x02, 0x20) > 0 // since 0x11 % 0x20 (0x11) > 0x02 % 0x20 (0x02) + * @endcode + * + * @param a Operand + * @param b Operand + * @param mod Divisor; must be a power of 2 + * @return + * - a negative value if `a % mod < b % mod` + * - a positive value if `a % mod > b % mod` + * - zero if `a % mod == b % mod` + */ +int64_t av_compare_mod(uint64_t a, uint64_t b, uint64_t mod); + +/** + * Rescale a timestamp while preserving known durations. + * + * This function is designed to be called per audio packet to scale the input + * timestamp to a different time base. Compared to a simple av_rescale_q() + * call, this function is robust against possible inconsistent frame durations. + * + * The `last` parameter is a state variable that must be preserved for all + * subsequent calls for the same stream. For the first call, `*last` should be + * initialized to #AV_NOPTS_VALUE. + * + * @param[in] in_tb Input time base + * @param[in] in_ts Input timestamp + * @param[in] fs_tb Duration time base; typically this is finer-grained + * (greater) than `in_tb` and `out_tb` + * @param[in] duration Duration till the next call to this function (i.e. + * duration of the current packet/frame) + * @param[in,out] last Pointer to a timestamp expressed in terms of + * `fs_tb`, acting as a state variable + * @param[in] out_tb Output timebase + * @return Timestamp expressed in terms of `out_tb` + * + * @note In the context of this function, "duration" is in term of samples, not + * seconds. + */ +int64_t av_rescale_delta(AVRational in_tb, int64_t in_ts, AVRational fs_tb, int duration, int64_t *last, AVRational out_tb); + +/** + * Add a value to a timestamp. + * + * This function guarantees that when the same value is repeatedly added that + * no accumulation of rounding errors occurs. + * + * @param[in] ts Input timestamp + * @param[in] ts_tb Input timestamp time base + * @param[in] inc Value to be added + * @param[in] inc_tb Time base of `inc` + */ +int64_t av_add_stable(AVRational ts_tb, int64_t ts, AVRational inc_tb, int64_t inc); + +/** + * 0th order modified bessel function of the first kind. + */ +double av_bessel_i0(double x); + +/** + * @} + */ + +#endif /* AVUTIL_MATHEMATICS_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mem.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mem.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mem.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/mem.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,607 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +/** + * @file + * @ingroup lavu_mem + * Memory handling functions + */ + +#ifndef AVUTIL_MEM_H +#define AVUTIL_MEM_H + +#include +#include + +#include "attributes.h" + +/** + * @addtogroup lavu_mem + * Utilities for manipulating memory. + * + * FFmpeg has several applications of memory that are not required of a typical + * program. For example, the computing-heavy components like video decoding and + * encoding can be sped up significantly through the use of aligned memory. + * + * However, for each of FFmpeg's applications of memory, there might not be a + * recognized or standardized API for that specific use. Memory alignment, for + * instance, varies wildly depending on operating systems, architectures, and + * compilers. Hence, this component of @ref libavutil is created to make + * dealing with memory consistently possible on all platforms. + * + * @{ + */ + +/** + * @defgroup lavu_mem_attrs Function Attributes + * Function attributes applicable to memory handling functions. + * + * These function attributes can help compilers emit more useful warnings, or + * generate better code. + * @{ + */ + +/** + * @def av_malloc_attrib + * Function attribute denoting a malloc-like function. + * + * @see Function attribute `malloc` in GCC's documentation + */ + +#if AV_GCC_VERSION_AT_LEAST(3,1) + #define av_malloc_attrib __attribute__((__malloc__)) +#else + #define av_malloc_attrib +#endif + +/** + * @def av_alloc_size(...) + * Function attribute used on a function that allocates memory, whose size is + * given by the specified parameter(s). + * + * @code{.c} + * void *av_malloc(size_t size) av_alloc_size(1); + * void *av_calloc(size_t nmemb, size_t size) av_alloc_size(1, 2); + * @endcode + * + * @param ... One or two parameter indexes, separated by a comma + * + * @see Function attribute `alloc_size` in GCC's documentation + */ + +#if AV_GCC_VERSION_AT_LEAST(4,3) + #define av_alloc_size(...) __attribute__((alloc_size(__VA_ARGS__))) +#else + #define av_alloc_size(...) +#endif + +/** + * @} + */ + +/** + * @defgroup lavu_mem_funcs Heap Management + * Functions responsible for allocating, freeing, and copying memory. + * + * All memory allocation functions have a built-in upper limit of `INT_MAX` + * bytes. This may be changed with av_max_alloc(), although exercise extreme + * caution when doing so. + * + * @{ + */ + +/** + * Allocate a memory block with alignment suitable for all memory accesses + * (including vectors if available on the CPU). + * + * @param size Size in bytes for the memory block to be allocated + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * @see av_mallocz() + */ +void *av_malloc(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a memory block with alignment suitable for all memory accesses + * (including vectors if available on the CPU) and zero all the bytes of the + * block. + * + * @param size Size in bytes for the memory block to be allocated + * @return Pointer to the allocated block, or `NULL` if it cannot be allocated + * @see av_malloc() + */ +void *av_mallocz(size_t size) av_malloc_attrib av_alloc_size(1); + +/** + * Allocate a memory block for an array with av_malloc(). + * + * The allocated memory will have size `size * nmemb` bytes. + * + * @param nmemb Number of element + * @param size Size of a single element + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * @see av_malloc() + */ +av_alloc_size(1, 2) void *av_malloc_array(size_t nmemb, size_t size); + +/** + * Allocate a memory block for an array with av_mallocz(). + * + * The allocated memory will have size `size * nmemb` bytes. + * + * @param nmemb Number of elements + * @param size Size of the single element + * @return Pointer to the allocated block, or `NULL` if the block cannot + * be allocated + * + * @see av_mallocz() + * @see av_malloc_array() + */ +void *av_calloc(size_t nmemb, size_t size) av_malloc_attrib av_alloc_size(1, 2); + +/** + * Allocate, reallocate, or free a block of memory. + * + * If `ptr` is `NULL` and `size` > 0, allocate a new block. Otherwise, expand or + * shrink that block of memory according to `size`. + * + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or `NULL` + * @param size Size in bytes of the memory block to be allocated or + * reallocated + * + * @return Pointer to a newly-reallocated block or `NULL` if the block + * cannot be reallocated + * + * @warning Unlike av_malloc(), the returned pointer is not guaranteed to be + * correctly aligned. The returned pointer must be freed after even + * if size is zero. + * @see av_fast_realloc() + * @see av_reallocp() + */ +void *av_realloc(void *ptr, size_t size) av_alloc_size(2); + +/** + * Allocate, reallocate, or free a block of memory through a pointer to a + * pointer. + * + * If `*ptr` is `NULL` and `size` > 0, allocate a new block. If `size` is + * zero, free the memory block pointed to by `*ptr`. Otherwise, expand or + * shrink that block of memory according to `size`. + * + * @param[in,out] ptr Pointer to a pointer to a memory block already allocated + * with av_realloc(), or a pointer to `NULL`. The pointer + * is updated on success, or freed on failure. + * @param[in] size Size in bytes for the memory block to be allocated or + * reallocated + * + * @return Zero on success, an AVERROR error code on failure + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. + */ +av_warn_unused_result +int av_reallocp(void *ptr, size_t size); + +/** + * Allocate, reallocate, or free a block of memory. + * + * This function does the same thing as av_realloc(), except: + * - It takes two size arguments and allocates `nelem * elsize` bytes, + * after checking the result of the multiplication for integer overflow. + * - It frees the input block in case of failure, thus avoiding the memory + * leak with the classic + * @code{.c} + * buf = realloc(buf); + * if (!buf) + * return -1; + * @endcode + * pattern. + */ +void *av_realloc_f(void *ptr, size_t nelem, size_t elsize); + +/** + * Allocate, reallocate, or free an array. + * + * If `ptr` is `NULL` and `nmemb` > 0, allocate a new block. + * + * @param ptr Pointer to a memory block already allocated with + * av_realloc() or `NULL` + * @param nmemb Number of elements in the array + * @param size Size of the single element of the array + * + * @return Pointer to a newly-reallocated block or NULL if the block + * cannot be reallocated + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. The returned pointer must be freed after even if + * nmemb is zero. + * @see av_reallocp_array() + */ +av_alloc_size(2, 3) void *av_realloc_array(void *ptr, size_t nmemb, size_t size); + +/** + * Allocate, reallocate an array through a pointer to a pointer. + * + * If `*ptr` is `NULL` and `nmemb` > 0, allocate a new block. + * + * @param[in,out] ptr Pointer to a pointer to a memory block already + * allocated with av_realloc(), or a pointer to `NULL`. + * The pointer is updated on success, or freed on failure. + * @param[in] nmemb Number of elements + * @param[in] size Size of the single element + * + * @return Zero on success, an AVERROR error code on failure + * + * @warning Unlike av_malloc(), the allocated memory is not guaranteed to be + * correctly aligned. *ptr must be freed after even if nmemb is zero. + */ +int av_reallocp_array(void *ptr, size_t nmemb, size_t size); + +/** + * Reallocate the given buffer if it is not large enough, otherwise do nothing. + * + * If the given buffer is `NULL`, then a new uninitialized buffer is allocated. + * + * If the given buffer is not large enough, and reallocation fails, `NULL` is + * returned and `*size` is set to 0, but the original buffer is not changed or + * freed. + * + * A typical use pattern follows: + * + * @code{.c} + * uint8_t *buf = ...; + * uint8_t *new_buf = av_fast_realloc(buf, ¤t_size, size_needed); + * if (!new_buf) { + * // Allocation failed; clean up original buffer + * av_freep(&buf); + * return AVERROR(ENOMEM); + * } + * @endcode + * + * @param[in,out] ptr Already allocated buffer, or `NULL` + * @param[in,out] size Pointer to the size of buffer `ptr`. `*size` is + * updated to the new allocated size, in particular 0 + * in case of failure. + * @param[in] min_size Desired minimal size of buffer `ptr` + * @return `ptr` if the buffer is large enough, a pointer to newly reallocated + * buffer if the buffer was not large enough, or `NULL` in case of + * error + * @see av_realloc() + * @see av_fast_malloc() + */ +void *av_fast_realloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate a buffer, reusing the given one if large enough. + * + * Contrary to av_fast_realloc(), the current buffer contents might not be + * preserved and on error the old buffer is freed, thus no special handling to + * avoid memleaks is necessary. + * + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if + * `size_needed` is greater than 0. + * + * @code{.c} + * uint8_t *buf = ...; + * av_fast_malloc(&buf, ¤t_size, size_needed); + * if (!buf) { + * // Allocation failed; buf already freed + * return AVERROR(ENOMEM); + * } + * @endcode + * + * @param[in,out] ptr Pointer to pointer to an already allocated buffer. + * `*ptr` will be overwritten with pointer to new + * buffer on success or `NULL` on failure + * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is + * updated to the new allocated size, in particular 0 + * in case of failure. + * @param[in] min_size Desired minimal size of buffer `*ptr` + * @see av_realloc() + * @see av_fast_mallocz() + */ +void av_fast_malloc(void *ptr, unsigned int *size, size_t min_size); + +/** + * Allocate and clear a buffer, reusing the given one if large enough. + * + * Like av_fast_malloc(), but all newly allocated space is initially cleared. + * Reused buffer is not cleared. + * + * `*ptr` is allowed to be `NULL`, in which case allocation always happens if + * `size_needed` is greater than 0. + * + * @param[in,out] ptr Pointer to pointer to an already allocated buffer. + * `*ptr` will be overwritten with pointer to new + * buffer on success or `NULL` on failure + * @param[in,out] size Pointer to the size of buffer `*ptr`. `*size` is + * updated to the new allocated size, in particular 0 + * in case of failure. + * @param[in] min_size Desired minimal size of buffer `*ptr` + * @see av_fast_malloc() + */ +void av_fast_mallocz(void *ptr, unsigned int *size, size_t min_size); + +/** + * Free a memory block which has been allocated with a function of av_malloc() + * or av_realloc() family. + * + * @param ptr Pointer to the memory block which should be freed. + * + * @note `ptr = NULL` is explicitly allowed. + * @note It is recommended that you use av_freep() instead, to prevent leaving + * behind dangling pointers. + * @see av_freep() + */ +void av_free(void *ptr); + +/** + * Free a memory block which has been allocated with a function of av_malloc() + * or av_realloc() family, and set the pointer pointing to it to `NULL`. + * + * @code{.c} + * uint8_t *buf = av_malloc(16); + * av_free(buf); + * // buf now contains a dangling pointer to freed memory, and accidental + * // dereference of buf will result in a use-after-free, which may be a + * // security risk. + * + * uint8_t *buf = av_malloc(16); + * av_freep(&buf); + * // buf is now NULL, and accidental dereference will only result in a + * // NULL-pointer dereference. + * @endcode + * + * @param ptr Pointer to the pointer to the memory block which should be freed + * @note `*ptr = NULL` is safe and leads to no action. + * @see av_free() + */ +void av_freep(void *ptr); + +/** + * Duplicate a string. + * + * @param s String to be duplicated + * @return Pointer to a newly-allocated string containing a + * copy of `s` or `NULL` if the string cannot be allocated + * @see av_strndup() + */ +char *av_strdup(const char *s) av_malloc_attrib; + +/** + * Duplicate a substring of a string. + * + * @param s String to be duplicated + * @param len Maximum length of the resulting string (not counting the + * terminating byte) + * @return Pointer to a newly-allocated string containing a + * substring of `s` or `NULL` if the string cannot be allocated + */ +char *av_strndup(const char *s, size_t len) av_malloc_attrib; + +/** + * Duplicate a buffer with av_malloc(). + * + * @param p Buffer to be duplicated + * @param size Size in bytes of the buffer copied + * @return Pointer to a newly allocated buffer containing a + * copy of `p` or `NULL` if the buffer cannot be allocated + */ +void *av_memdup(const void *p, size_t size); + +/** + * Overlapping memcpy() implementation. + * + * @param dst Destination buffer + * @param back Number of bytes back to start copying (i.e. the initial size of + * the overlapping window); must be > 0 + * @param cnt Number of bytes to copy; must be >= 0 + * + * @note `cnt > back` is valid, this will copy the bytes we just copied, + * thus creating a repeating pattern with a period length of `back`. + */ +void av_memcpy_backptr(uint8_t *dst, int back, int cnt); + +/** + * @} + */ + +/** + * @defgroup lavu_mem_dynarray Dynamic Array + * + * Utilities to make an array grow when needed. + * + * Sometimes, the programmer would want to have an array that can grow when + * needed. The libavutil dynamic array utilities fill that need. + * + * libavutil supports two systems of appending elements onto a dynamically + * allocated array, the first one storing the pointer to the value in the + * array, and the second storing the value directly. In both systems, the + * caller is responsible for maintaining a variable containing the length of + * the array, as well as freeing of the array after use. + * + * The first system stores pointers to values in a block of dynamically + * allocated memory. Since only pointers are stored, the function does not need + * to know the size of the type. Both av_dynarray_add() and + * av_dynarray_add_nofree() implement this system. + * + * @code + * type **array = NULL; //< an array of pointers to values + * int nb = 0; //< a variable to keep track of the length of the array + * + * type to_be_added = ...; + * type to_be_added2 = ...; + * + * av_dynarray_add(&array, &nb, &to_be_added); + * if (nb == 0) + * return AVERROR(ENOMEM); + * + * av_dynarray_add(&array, &nb, &to_be_added2); + * if (nb == 0) + * return AVERROR(ENOMEM); + * + * // Now: + * // nb == 2 + * // &to_be_added == array[0] + * // &to_be_added2 == array[1] + * + * av_freep(&array); + * @endcode + * + * The second system stores the value directly in a block of memory. As a + * result, the function has to know the size of the type. av_dynarray2_add() + * implements this mechanism. + * + * @code + * type *array = NULL; //< an array of values + * int nb = 0; //< a variable to keep track of the length of the array + * + * type to_be_added = ...; + * type to_be_added2 = ...; + * + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), NULL); + * if (!addr) + * return AVERROR(ENOMEM); + * memcpy(addr, &to_be_added, sizeof(to_be_added)); + * + * // Shortcut of the above. + * type *addr = av_dynarray2_add((void **)&array, &nb, sizeof(*array), + * (const void *)&to_be_added2); + * if (!addr) + * return AVERROR(ENOMEM); + * + * // Now: + * // nb == 2 + * // to_be_added == array[0] + * // to_be_added2 == array[1] + * + * av_freep(&array); + * @endcode + * + * @{ + */ + +/** + * Add the pointer to an element to a dynamic array. + * + * The array to grow is supposed to be an array of pointers to + * structures, and the element to add must be a pointer to an already + * allocated structure. + * + * The array is reallocated when its size reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by `nb_ptr` + * is incremented. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and + * `*nb_ptr` is set to 0. + * + * @param[in,out] tab_ptr Pointer to the array to grow + * @param[in,out] nb_ptr Pointer to the number of elements in the array + * @param[in] elem Element to add + * @see av_dynarray_add_nofree(), av_dynarray2_add() + */ +void av_dynarray_add(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element to a dynamic array. + * + * Function has the same functionality as av_dynarray_add(), + * but it doesn't free memory on fails. It returns error code + * instead and leave current buffer untouched. + * + * @return >=0 on success, negative otherwise + * @see av_dynarray_add(), av_dynarray2_add() + */ +av_warn_unused_result +int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem); + +/** + * Add an element of size `elem_size` to a dynamic array. + * + * The array is reallocated when its number of elements reaches powers of 2. + * Therefore, the amortized cost of adding an element is constant. + * + * In case of success, the pointer to the array is updated in order to + * point to the new grown array, and the number pointed to by `nb_ptr` + * is incremented. + * In case of failure, the array is freed, `*tab_ptr` is set to `NULL` and + * `*nb_ptr` is set to 0. + * + * @param[in,out] tab_ptr Pointer to the array to grow + * @param[in,out] nb_ptr Pointer to the number of elements in the array + * @param[in] elem_size Size in bytes of an element in the array + * @param[in] elem_data Pointer to the data of the element to add. If + * `NULL`, the space of the newly added element is + * allocated but left uninitialized. + * + * @return Pointer to the data of the element to copy in the newly allocated + * space + * @see av_dynarray_add(), av_dynarray_add_nofree() + */ +void *av_dynarray2_add(void **tab_ptr, int *nb_ptr, size_t elem_size, + const uint8_t *elem_data); + +/** + * @} + */ + +/** + * @defgroup lavu_mem_misc Miscellaneous Functions + * + * Other functions related to memory allocation. + * + * @{ + */ + +/** + * Multiply two `size_t` values checking for overflow. + * + * @param[in] a Operand of multiplication + * @param[in] b Operand of multiplication + * @param[out] r Pointer to the result of the operation + * @return 0 on success, AVERROR(EINVAL) on overflow + */ +int av_size_mult(size_t a, size_t b, size_t *r); + +/** + * Set the maximum size that may be allocated in one block. + * + * The value specified with this function is effective for all libavutil's @ref + * lavu_mem_funcs "heap management functions." + * + * By default, the max value is defined as `INT_MAX`. + * + * @param max Value to be set as the new maximum size + * + * @warning Exercise extreme caution when using this function. Don't touch + * this if you do not understand the full consequence of doing so. + */ +void av_max_alloc(size_t max); + +/** + * @} + * @} + */ + +#endif /* AVUTIL_MEM_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/pixfmt.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/pixfmt.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/pixfmt.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/pixfmt.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,817 @@ +/* + * copyright (c) 2006 Michael Niedermayer + * + * 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 + */ + +#ifndef AVUTIL_PIXFMT_H +#define AVUTIL_PIXFMT_H + +/** + * @file + * pixel format definitions + */ + +#include "libavutil/avconfig.h" +#include "version.h" + +#define AVPALETTE_SIZE 1024 +#define AVPALETTE_COUNT 256 + +/** + * Maximum number of planes in any pixel format. + * This should be used when a maximum is needed, but code should not + * be written to require a maximum for no good reason. + */ +#define AV_VIDEO_MAX_PLANES 4 + +/** + * Pixel format. + * + * @note + * AV_PIX_FMT_RGB32 is handled in an endian-specific manner. An RGBA + * color is put together as: + * (A << 24) | (R << 16) | (G << 8) | B + * This is stored as BGRA on little-endian CPU architectures and ARGB on + * big-endian CPUs. + * + * @note + * If the resolution is not a multiple of the chroma subsampling factor + * then the chroma plane resolution must be rounded up. + * + * @par + * When the pixel format is palettized RGB32 (AV_PIX_FMT_PAL8), the palettized + * image data is stored in AVFrame.data[0]. The palette is transported in + * AVFrame.data[1], is 1024 bytes long (256 4-byte entries) and is + * formatted the same as in AV_PIX_FMT_RGB32 described above (i.e., it is + * also endian-specific). Note also that the individual RGB32 palette + * components stored in AVFrame.data[1] should be in the range 0..255. + * This is important as many custom PAL8 video codecs that were designed + * to run on the IBM VGA graphics adapter use 6-bit palette components. + * + * @par + * For all the 8 bits per pixel formats, an RGB32 palette is in data[1] like + * for pal8. This palette is filled in automatically by the function + * allocating the picture. + */ +enum AVPixelFormat { + AV_PIX_FMT_NONE = -1, + AV_PIX_FMT_YUV420P, ///< planar YUV 4:2:0, 12bpp, (1 Cr & Cb sample per 2x2 Y samples) + AV_PIX_FMT_YUYV422, ///< packed YUV 4:2:2, 16bpp, Y0 Cb Y1 Cr + AV_PIX_FMT_RGB24, ///< packed RGB 8:8:8, 24bpp, RGBRGB... + AV_PIX_FMT_BGR24, ///< packed RGB 8:8:8, 24bpp, BGRBGR... + AV_PIX_FMT_YUV422P, ///< planar YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_YUV444P, ///< planar YUV 4:4:4, 24bpp, (1 Cr & Cb sample per 1x1 Y samples) + AV_PIX_FMT_YUV410P, ///< planar YUV 4:1:0, 9bpp, (1 Cr & Cb sample per 4x4 Y samples) + AV_PIX_FMT_YUV411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) + AV_PIX_FMT_GRAY8, ///< Y , 8bpp + AV_PIX_FMT_MONOWHITE, ///< Y , 1bpp, 0 is white, 1 is black, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_MONOBLACK, ///< Y , 1bpp, 0 is black, 1 is white, in each byte pixels are ordered from the msb to the lsb + AV_PIX_FMT_PAL8, ///< 8 bits with AV_PIX_FMT_RGB32 palette + AV_PIX_FMT_YUVJ420P, ///< planar YUV 4:2:0, 12bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV420P and setting color_range + AV_PIX_FMT_YUVJ422P, ///< planar YUV 4:2:2, 16bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV422P and setting color_range + AV_PIX_FMT_YUVJ444P, ///< planar YUV 4:4:4, 24bpp, full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV444P and setting color_range + AV_PIX_FMT_UYVY422, ///< packed YUV 4:2:2, 16bpp, Cb Y0 Cr Y1 + AV_PIX_FMT_UYYVYY411, ///< packed YUV 4:1:1, 12bpp, Cb Y0 Y1 Cr Y2 Y3 + AV_PIX_FMT_BGR8, ///< packed RGB 3:3:2, 8bpp, (msb)2B 3G 3R(lsb) + AV_PIX_FMT_BGR4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1B 2G 1R(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_BGR4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1B 2G 1R(lsb) + AV_PIX_FMT_RGB8, ///< packed RGB 3:3:2, 8bpp, (msb)3R 3G 2B(lsb) + AV_PIX_FMT_RGB4, ///< packed RGB 1:2:1 bitstream, 4bpp, (msb)1R 2G 1B(lsb), a byte contains two pixels, the first pixel in the byte is the one composed by the 4 msb bits + AV_PIX_FMT_RGB4_BYTE, ///< packed RGB 1:2:1, 8bpp, (msb)1R 2G 1B(lsb) + AV_PIX_FMT_NV12, ///< planar YUV 4:2:0, 12bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV21, ///< as above, but U and V bytes are swapped + + AV_PIX_FMT_ARGB, ///< packed ARGB 8:8:8:8, 32bpp, ARGBARGB... + AV_PIX_FMT_RGBA, ///< packed RGBA 8:8:8:8, 32bpp, RGBARGBA... + AV_PIX_FMT_ABGR, ///< packed ABGR 8:8:8:8, 32bpp, ABGRABGR... + AV_PIX_FMT_BGRA, ///< packed BGRA 8:8:8:8, 32bpp, BGRABGRA... + + AV_PIX_FMT_GRAY16BE, ///< Y , 16bpp, big-endian + AV_PIX_FMT_GRAY16LE, ///< Y , 16bpp, little-endian + AV_PIX_FMT_YUV440P, ///< planar YUV 4:4:0 (1 Cr & Cb sample per 1x2 Y samples) + AV_PIX_FMT_YUVJ440P, ///< planar YUV 4:4:0 full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV440P and setting color_range + AV_PIX_FMT_YUVA420P, ///< planar YUV 4:2:0, 20bpp, (1 Cr & Cb sample per 2x2 Y & A samples) + AV_PIX_FMT_RGB48BE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_RGB48LE, ///< packed RGB 16:16:16, 48bpp, 16R, 16G, 16B, the 2-byte value for each R/G/B component is stored as little-endian + + AV_PIX_FMT_RGB565BE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), big-endian + AV_PIX_FMT_RGB565LE, ///< packed RGB 5:6:5, 16bpp, (msb) 5R 6G 5B(lsb), little-endian + AV_PIX_FMT_RGB555BE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), big-endian , X=unused/undefined + AV_PIX_FMT_RGB555LE, ///< packed RGB 5:5:5, 16bpp, (msb)1X 5R 5G 5B(lsb), little-endian, X=unused/undefined + + AV_PIX_FMT_BGR565BE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), big-endian + AV_PIX_FMT_BGR565LE, ///< packed BGR 5:6:5, 16bpp, (msb) 5B 6G 5R(lsb), little-endian + AV_PIX_FMT_BGR555BE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), big-endian , X=unused/undefined + AV_PIX_FMT_BGR555LE, ///< packed BGR 5:5:5, 16bpp, (msb)1X 5B 5G 5R(lsb), little-endian, X=unused/undefined + + /** + * Hardware acceleration through VA-API, data[3] contains a + * VASurfaceID. + */ + AV_PIX_FMT_VAAPI, + + AV_PIX_FMT_YUV420P16LE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P16BE, ///< planar YUV 4:2:0, 24bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV422P16LE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P16BE, ///< planar YUV 4:2:2, 32bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV444P16LE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P16BE, ///< planar YUV 4:4:4, 48bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_DXVA2_VLD, ///< HW decoding through DXVA2, Picture.data[3] contains a LPDIRECT3DSURFACE9 pointer + + AV_PIX_FMT_RGB444LE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_RGB444BE, ///< packed RGB 4:4:4, 16bpp, (msb)4X 4R 4G 4B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_BGR444LE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_BGR444BE, ///< packed BGR 4:4:4, 16bpp, (msb)4X 4B 4G 4R(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_YA8, ///< 8 bits gray, 8 bits alpha + + AV_PIX_FMT_Y400A = AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + AV_PIX_FMT_GRAY8A= AV_PIX_FMT_YA8, ///< alias for AV_PIX_FMT_YA8 + + AV_PIX_FMT_BGR48BE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as big-endian + AV_PIX_FMT_BGR48LE, ///< packed RGB 16:16:16, 48bpp, 16B, 16G, 16R, the 2-byte value for each R/G/B component is stored as little-endian + + /** + * The following 12 formats have the disadvantage of needing 1 format for each bit depth. + * Notice that each 9/10 bits sample is stored in 16 bits with extra padding. + * If you want to support multiple bit depths, then using AV_PIX_FMT_YUV420P16* with the bpp stored separately is better. + */ + AV_PIX_FMT_YUV420P9BE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P9LE, ///< planar YUV 4:2:0, 13.5bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P10BE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P10LE,///< planar YUV 4:2:0, 15bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P10BE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P10LE,///< planar YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P9BE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P9LE, ///< planar YUV 4:4:4, 27bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P10BE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P10LE,///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV422P9BE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P9LE, ///< planar YUV 4:2:2, 18bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_GBRP, ///< planar GBR 4:4:4 24bpp + AV_PIX_FMT_GBR24P = AV_PIX_FMT_GBRP, // alias for #AV_PIX_FMT_GBRP + AV_PIX_FMT_GBRP9BE, ///< planar GBR 4:4:4 27bpp, big-endian + AV_PIX_FMT_GBRP9LE, ///< planar GBR 4:4:4 27bpp, little-endian + AV_PIX_FMT_GBRP10BE, ///< planar GBR 4:4:4 30bpp, big-endian + AV_PIX_FMT_GBRP10LE, ///< planar GBR 4:4:4 30bpp, little-endian + AV_PIX_FMT_GBRP16BE, ///< planar GBR 4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRP16LE, ///< planar GBR 4:4:4 48bpp, little-endian + AV_PIX_FMT_YUVA422P, ///< planar YUV 4:2:2 24bpp, (1 Cr & Cb sample per 2x1 Y & A samples) + AV_PIX_FMT_YUVA444P, ///< planar YUV 4:4:4 32bpp, (1 Cr & Cb sample per 1x1 Y & A samples) + AV_PIX_FMT_YUVA420P9BE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), big-endian + AV_PIX_FMT_YUVA420P9LE, ///< planar YUV 4:2:0 22.5bpp, (1 Cr & Cb sample per 2x2 Y & A samples), little-endian + AV_PIX_FMT_YUVA422P9BE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA422P9LE, ///< planar YUV 4:2:2 27bpp, (1 Cr & Cb sample per 2x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA444P9BE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + AV_PIX_FMT_YUVA444P9LE, ///< planar YUV 4:4:4 36bpp, (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_YUVA420P10BE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P10LE, ///< planar YUV 4:2:0 25bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P10BE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P10LE, ///< planar YUV 4:2:2 30bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P10BE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P10LE, ///< planar YUV 4:4:4 40bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA420P16BE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, big-endian) + AV_PIX_FMT_YUVA420P16LE, ///< planar YUV 4:2:0 40bpp, (1 Cr & Cb sample per 2x2 Y & A samples, little-endian) + AV_PIX_FMT_YUVA422P16BE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA422P16LE, ///< planar YUV 4:2:2 48bpp, (1 Cr & Cb sample per 2x1 Y & A samples, little-endian) + AV_PIX_FMT_YUVA444P16BE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, big-endian) + AV_PIX_FMT_YUVA444P16LE, ///< planar YUV 4:4:4 64bpp, (1 Cr & Cb sample per 1x1 Y & A samples, little-endian) + + AV_PIX_FMT_VDPAU, ///< HW acceleration through VDPAU, Picture.data[3] contains a VdpVideoSurface + + AV_PIX_FMT_XYZ12LE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as little-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_XYZ12BE, ///< packed XYZ 4:4:4, 36 bpp, (msb) 12X, 12Y, 12Z (lsb), the 2-byte value for each X/Y/Z is stored as big-endian, the 4 lower bits are set to 0 + AV_PIX_FMT_NV16, ///< interleaved chroma YUV 4:2:2, 16bpp, (1 Cr & Cb sample per 2x1 Y samples) + AV_PIX_FMT_NV20LE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_NV20BE, ///< interleaved chroma YUV 4:2:2, 20bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + + AV_PIX_FMT_RGBA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_RGBA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16R, 16G, 16B, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + AV_PIX_FMT_BGRA64BE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as big-endian + AV_PIX_FMT_BGRA64LE, ///< packed RGBA 16:16:16:16, 64bpp, 16B, 16G, 16R, 16A, the 2-byte value for each R/G/B/A component is stored as little-endian + + AV_PIX_FMT_YVYU422, ///< packed YUV 4:2:2, 16bpp, Y0 Cr Y1 Cb + + AV_PIX_FMT_YA16BE, ///< 16 bits gray, 16 bits alpha (big-endian) + AV_PIX_FMT_YA16LE, ///< 16 bits gray, 16 bits alpha (little-endian) + + AV_PIX_FMT_GBRAP, ///< planar GBRA 4:4:4:4 32bpp + AV_PIX_FMT_GBRAP16BE, ///< planar GBRA 4:4:4:4 64bpp, big-endian + AV_PIX_FMT_GBRAP16LE, ///< planar GBRA 4:4:4:4 64bpp, little-endian + /** + * HW acceleration through QSV, data[3] contains a pointer to the + * mfxFrameSurface1 structure. + * + * Before FFmpeg 5.0: + * mfxFrameSurface1.Data.MemId contains a pointer when importing + * the following frames as QSV frames: + * + * VAAPI: + * mfxFrameSurface1.Data.MemId contains a pointer to VASurfaceID + * + * DXVA2: + * mfxFrameSurface1.Data.MemId contains a pointer to IDirect3DSurface9 + * + * FFmpeg 5.0 and above: + * mfxFrameSurface1.Data.MemId contains a pointer to the mfxHDLPair + * structure when importing the following frames as QSV frames: + * + * VAAPI: + * mfxHDLPair.first contains a VASurfaceID pointer. + * mfxHDLPair.second is always MFX_INFINITE. + * + * DXVA2: + * mfxHDLPair.first contains IDirect3DSurface9 pointer. + * mfxHDLPair.second is always MFX_INFINITE. + * + * D3D11: + * mfxHDLPair.first contains a ID3D11Texture2D pointer. + * mfxHDLPair.second contains the texture array index of the frame if the + * ID3D11Texture2D is an array texture, or always MFX_INFINITE if it is a + * normal texture. + */ + AV_PIX_FMT_QSV, + /** + * HW acceleration though MMAL, data[3] contains a pointer to the + * MMAL_BUFFER_HEADER_T structure. + */ + AV_PIX_FMT_MMAL, + + AV_PIX_FMT_D3D11VA_VLD, ///< HW decoding through Direct3D11 via old API, Picture.data[3] contains a ID3D11VideoDecoderOutputView pointer + + /** + * HW acceleration through CUDA. data[i] contain CUdeviceptr pointers + * exactly as for system memory frames. + */ + AV_PIX_FMT_CUDA, + + AV_PIX_FMT_0RGB, ///< packed RGB 8:8:8, 32bpp, XRGBXRGB... X=unused/undefined + AV_PIX_FMT_RGB0, ///< packed RGB 8:8:8, 32bpp, RGBXRGBX... X=unused/undefined + AV_PIX_FMT_0BGR, ///< packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined + AV_PIX_FMT_BGR0, ///< packed BGR 8:8:8, 32bpp, BGRXBGRX... X=unused/undefined + + AV_PIX_FMT_YUV420P12BE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P12LE, ///< planar YUV 4:2:0,18bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV420P14BE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), big-endian + AV_PIX_FMT_YUV420P14LE, ///< planar YUV 4:2:0,21bpp, (1 Cr & Cb sample per 2x2 Y samples), little-endian + AV_PIX_FMT_YUV422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV422P14BE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), big-endian + AV_PIX_FMT_YUV422P14LE, ///< planar YUV 4:2:2,28bpp, (1 Cr & Cb sample per 2x1 Y samples), little-endian + AV_PIX_FMT_YUV444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_YUV444P14BE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), big-endian + AV_PIX_FMT_YUV444P14LE, ///< planar YUV 4:4:4,42bpp, (1 Cr & Cb sample per 1x1 Y samples), little-endian + AV_PIX_FMT_GBRP12BE, ///< planar GBR 4:4:4 36bpp, big-endian + AV_PIX_FMT_GBRP12LE, ///< planar GBR 4:4:4 36bpp, little-endian + AV_PIX_FMT_GBRP14BE, ///< planar GBR 4:4:4 42bpp, big-endian + AV_PIX_FMT_GBRP14LE, ///< planar GBR 4:4:4 42bpp, little-endian + AV_PIX_FMT_YUVJ411P, ///< planar YUV 4:1:1, 12bpp, (1 Cr & Cb sample per 4x1 Y samples) full scale (JPEG), deprecated in favor of AV_PIX_FMT_YUV411P and setting color_range + + AV_PIX_FMT_BAYER_BGGR8, ///< bayer, BGBG..(odd line), GRGR..(even line), 8-bit samples + AV_PIX_FMT_BAYER_RGGB8, ///< bayer, RGRG..(odd line), GBGB..(even line), 8-bit samples + AV_PIX_FMT_BAYER_GBRG8, ///< bayer, GBGB..(odd line), RGRG..(even line), 8-bit samples + AV_PIX_FMT_BAYER_GRBG8, ///< bayer, GRGR..(odd line), BGBG..(even line), 8-bit samples + AV_PIX_FMT_BAYER_BGGR16LE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, little-endian + AV_PIX_FMT_BAYER_BGGR16BE, ///< bayer, BGBG..(odd line), GRGR..(even line), 16-bit samples, big-endian + AV_PIX_FMT_BAYER_RGGB16LE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, little-endian + AV_PIX_FMT_BAYER_RGGB16BE, ///< bayer, RGRG..(odd line), GBGB..(even line), 16-bit samples, big-endian + AV_PIX_FMT_BAYER_GBRG16LE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, little-endian + AV_PIX_FMT_BAYER_GBRG16BE, ///< bayer, GBGB..(odd line), RGRG..(even line), 16-bit samples, big-endian + AV_PIX_FMT_BAYER_GRBG16LE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, little-endian + AV_PIX_FMT_BAYER_GRBG16BE, ///< bayer, GRGR..(odd line), BGBG..(even line), 16-bit samples, big-endian + + AV_PIX_FMT_YUV440P10LE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian + AV_PIX_FMT_YUV440P10BE, ///< planar YUV 4:4:0,20bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian + AV_PIX_FMT_YUV440P12LE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), little-endian + AV_PIX_FMT_YUV440P12BE, ///< planar YUV 4:4:0,24bpp, (1 Cr & Cb sample per 1x2 Y samples), big-endian + AV_PIX_FMT_AYUV64LE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), little-endian + AV_PIX_FMT_AYUV64BE, ///< packed AYUV 4:4:4,64bpp (1 Cr & Cb sample per 1x1 Y & A samples), big-endian + + AV_PIX_FMT_VIDEOTOOLBOX, ///< hardware decoding through Videotoolbox + + AV_PIX_FMT_P010LE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, little-endian + AV_PIX_FMT_P010BE, ///< like NV12, with 10bpp per component, data in the high bits, zeros in the low bits, big-endian + + AV_PIX_FMT_GBRAP12BE, ///< planar GBR 4:4:4:4 48bpp, big-endian + AV_PIX_FMT_GBRAP12LE, ///< planar GBR 4:4:4:4 48bpp, little-endian + + AV_PIX_FMT_GBRAP10BE, ///< planar GBR 4:4:4:4 40bpp, big-endian + AV_PIX_FMT_GBRAP10LE, ///< planar GBR 4:4:4:4 40bpp, little-endian + + AV_PIX_FMT_MEDIACODEC, ///< hardware decoding through MediaCodec + + AV_PIX_FMT_GRAY12BE, ///< Y , 12bpp, big-endian + AV_PIX_FMT_GRAY12LE, ///< Y , 12bpp, little-endian + AV_PIX_FMT_GRAY10BE, ///< Y , 10bpp, big-endian + AV_PIX_FMT_GRAY10LE, ///< Y , 10bpp, little-endian + + AV_PIX_FMT_P016LE, ///< like NV12, with 16bpp per component, little-endian + AV_PIX_FMT_P016BE, ///< like NV12, with 16bpp per component, big-endian + + /** + * Hardware surfaces for Direct3D11. + * + * This is preferred over the legacy AV_PIX_FMT_D3D11VA_VLD. The new D3D11 + * hwaccel API and filtering support AV_PIX_FMT_D3D11 only. + * + * data[0] contains a ID3D11Texture2D pointer, and data[1] contains the + * texture array index of the frame as intptr_t if the ID3D11Texture2D is + * an array texture (or always 0 if it's a normal texture). + */ + AV_PIX_FMT_D3D11, + + AV_PIX_FMT_GRAY9BE, ///< Y , 9bpp, big-endian + AV_PIX_FMT_GRAY9LE, ///< Y , 9bpp, little-endian + + AV_PIX_FMT_GBRPF32BE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, big-endian + AV_PIX_FMT_GBRPF32LE, ///< IEEE-754 single precision planar GBR 4:4:4, 96bpp, little-endian + AV_PIX_FMT_GBRAPF32BE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, big-endian + AV_PIX_FMT_GBRAPF32LE, ///< IEEE-754 single precision planar GBRA 4:4:4:4, 128bpp, little-endian + + /** + * DRM-managed buffers exposed through PRIME buffer sharing. + * + * data[0] points to an AVDRMFrameDescriptor. + */ + AV_PIX_FMT_DRM_PRIME, + /** + * Hardware surfaces for OpenCL. + * + * data[i] contain 2D image objects (typed in C as cl_mem, used + * in OpenCL as image2d_t) for each plane of the surface. + */ + AV_PIX_FMT_OPENCL, + + AV_PIX_FMT_GRAY14BE, ///< Y , 14bpp, big-endian + AV_PIX_FMT_GRAY14LE, ///< Y , 14bpp, little-endian + + AV_PIX_FMT_GRAYF32BE, ///< IEEE-754 single precision Y, 32bpp, big-endian + AV_PIX_FMT_GRAYF32LE, ///< IEEE-754 single precision Y, 32bpp, little-endian + + AV_PIX_FMT_YUVA422P12BE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, big-endian + AV_PIX_FMT_YUVA422P12LE, ///< planar YUV 4:2:2,24bpp, (1 Cr & Cb sample per 2x1 Y samples), 12b alpha, little-endian + AV_PIX_FMT_YUVA444P12BE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, big-endian + AV_PIX_FMT_YUVA444P12LE, ///< planar YUV 4:4:4,36bpp, (1 Cr & Cb sample per 1x1 Y samples), 12b alpha, little-endian + + AV_PIX_FMT_NV24, ///< planar YUV 4:4:4, 24bpp, 1 plane for Y and 1 plane for the UV components, which are interleaved (first byte U and the following byte V) + AV_PIX_FMT_NV42, ///< as above, but U and V bytes are swapped + + /** + * Vulkan hardware images. + * + * data[0] points to an AVVkFrame + */ + AV_PIX_FMT_VULKAN, + + AV_PIX_FMT_Y210BE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_Y210LE, ///< packed YUV 4:2:2 like YUYV422, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_X2RGB10LE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2RGB10BE, ///< packed RGB 10:10:10, 30bpp, (msb)2X 10R 10G 10B(lsb), big-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10LE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), little-endian, X=unused/undefined + AV_PIX_FMT_X2BGR10BE, ///< packed BGR 10:10:10, 30bpp, (msb)2X 10B 10G 10R(lsb), big-endian, X=unused/undefined + + AV_PIX_FMT_P210BE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, big-endian + AV_PIX_FMT_P210LE, ///< interleaved chroma YUV 4:2:2, 20bpp, data in the high bits, little-endian + + AV_PIX_FMT_P410BE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, big-endian + AV_PIX_FMT_P410LE, ///< interleaved chroma YUV 4:4:4, 30bpp, data in the high bits, little-endian + + AV_PIX_FMT_P216BE, ///< interleaved chroma YUV 4:2:2, 32bpp, big-endian + AV_PIX_FMT_P216LE, ///< interleaved chroma YUV 4:2:2, 32bpp, little-endian + + AV_PIX_FMT_P416BE, ///< interleaved chroma YUV 4:4:4, 48bpp, big-endian + AV_PIX_FMT_P416LE, ///< interleaved chroma YUV 4:4:4, 48bpp, little-endian + + AV_PIX_FMT_VUYA, ///< packed VUYA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), VUYAVUYA... + + AV_PIX_FMT_RGBAF16BE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., big-endian + AV_PIX_FMT_RGBAF16LE, ///< IEEE-754 half precision packed RGBA 16:16:16:16, 64bpp, RGBARGBA..., little-endian + + AV_PIX_FMT_VUYX, ///< packed VUYX 4:4:4:4, 32bpp, Variant of VUYA where alpha channel is left undefined + + AV_PIX_FMT_P012LE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, little-endian + AV_PIX_FMT_P012BE, ///< like NV12, with 12bpp per component, data in the high bits, zeros in the low bits, big-endian + + AV_PIX_FMT_Y212BE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, big-endian + AV_PIX_FMT_Y212LE, ///< packed YUV 4:2:2 like YUYV422, 24bpp, data in the high bits, zeros in the low bits, little-endian + + AV_PIX_FMT_XV30BE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), big-endian, variant of Y410 where alpha channel is left undefined + AV_PIX_FMT_XV30LE, ///< packed XVYU 4:4:4, 32bpp, (msb)2X 10V 10Y 10U(lsb), little-endian, variant of Y410 where alpha channel is left undefined + + AV_PIX_FMT_XV36BE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, big-endian, variant of Y412 where alpha channel is left undefined + AV_PIX_FMT_XV36LE, ///< packed XVYU 4:4:4, 48bpp, data in the high bits, zeros in the low bits, little-endian, variant of Y412 where alpha channel is left undefined + + AV_PIX_FMT_RGBF32BE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., big-endian + AV_PIX_FMT_RGBF32LE, ///< IEEE-754 single precision packed RGB 32:32:32, 96bpp, RGBRGB..., little-endian + + AV_PIX_FMT_RGBAF32BE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian + AV_PIX_FMT_RGBAF32LE, ///< IEEE-754 single precision packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian + + AV_PIX_FMT_P212BE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, big-endian + AV_PIX_FMT_P212LE, ///< interleaved chroma YUV 4:2:2, 24bpp, data in the high bits, little-endian + + AV_PIX_FMT_P412BE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, big-endian + AV_PIX_FMT_P412LE, ///< interleaved chroma YUV 4:4:4, 36bpp, data in the high bits, little-endian + + AV_PIX_FMT_GBRAP14BE, ///< planar GBR 4:4:4:4 56bpp, big-endian + AV_PIX_FMT_GBRAP14LE, ///< planar GBR 4:4:4:4 56bpp, little-endian + + /** + * Hardware surfaces for Direct3D 12. + * + * data[0] points to an AVD3D12VAFrame + */ + AV_PIX_FMT_D3D12, + + AV_PIX_FMT_AYUV, ///< packed AYUV 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), AYUVAYUV... + + AV_PIX_FMT_UYVA, ///< packed UYVA 4:4:4:4, 32bpp (1 Cr & Cb sample per 1x1 Y & A samples), UYVAUYVA... + + AV_PIX_FMT_VYU444, ///< packed VYU 4:4:4, 24bpp (1 Cr & Cb sample per 1x1 Y), VYUVYU... + + AV_PIX_FMT_V30XBE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), big-endian + AV_PIX_FMT_V30XLE, ///< packed VYUX 4:4:4 like XV30, 32bpp, (msb)10V 10Y 10U 2X(lsb), little-endian + + AV_PIX_FMT_RGBF16BE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., big-endian + AV_PIX_FMT_RGBF16LE, ///< IEEE-754 half precision packed RGB 16:16:16, 48bpp, RGBRGB..., little-endian + + AV_PIX_FMT_RGBA128BE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., big-endian + AV_PIX_FMT_RGBA128LE, ///< packed RGBA 32:32:32:32, 128bpp, RGBARGBA..., little-endian + + AV_PIX_FMT_RGB96BE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., big-endian + AV_PIX_FMT_RGB96LE, ///< packed RGBA 32:32:32, 96bpp, RGBRGB..., little-endian + + AV_PIX_FMT_Y216BE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, big-endian + AV_PIX_FMT_Y216LE, ///< packed YUV 4:2:2 like YUYV422, 32bpp, little-endian + + AV_PIX_FMT_XV48BE, ///< packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined + AV_PIX_FMT_XV48LE, ///< packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined + + AV_PIX_FMT_GBRPF16BE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, big-endian + AV_PIX_FMT_GBRPF16LE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, little-endian + AV_PIX_FMT_GBRAPF16BE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, big-endian + AV_PIX_FMT_GBRAPF16LE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, little-endian + + AV_PIX_FMT_GRAYF16BE, ///< IEEE-754 half precision Y, 16bpp, big-endian + AV_PIX_FMT_GRAYF16LE, ///< IEEE-754 half precision Y, 16bpp, little-endian + + /** + * HW acceleration through AMF. data[0] contain AMFSurface pointer + */ + AV_PIX_FMT_AMF_SURFACE, + + AV_PIX_FMT_GRAY32BE, ///< Y , 32bpp, big-endian + AV_PIX_FMT_GRAY32LE, ///< Y , 32bpp, little-endian + + AV_PIX_FMT_YAF32BE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, big-endian + AV_PIX_FMT_YAF32LE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian + + AV_PIX_FMT_YAF16BE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian + AV_PIX_FMT_YAF16LE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, little-endian + + AV_PIX_FMT_GBRAP32BE, ///< planar GBRA 4:4:4:4 128bpp, big-endian + AV_PIX_FMT_GBRAP32LE, ///< planar GBRA 4:4:4:4 128bpp, little-endian + + AV_PIX_FMT_YUV444P10MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian + AV_PIX_FMT_YUV444P10MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian + AV_PIX_FMT_YUV444P12MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian + AV_PIX_FMT_YUV444P12MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian + AV_PIX_FMT_GBRP10MSBBE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, big-endian + AV_PIX_FMT_GBRP10MSBLE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, little-endian + AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian + AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian + + AV_PIX_FMT_OHCODEC, /// hardware decoding through openharmony + + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions +}; + +#if AV_HAVE_BIGENDIAN +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##be +#else +# define AV_PIX_FMT_NE(be, le) AV_PIX_FMT_##le +#endif + +#define AV_PIX_FMT_RGB32 AV_PIX_FMT_NE(ARGB, BGRA) +#define AV_PIX_FMT_RGB32_1 AV_PIX_FMT_NE(RGBA, ABGR) +#define AV_PIX_FMT_BGR32 AV_PIX_FMT_NE(ABGR, RGBA) +#define AV_PIX_FMT_BGR32_1 AV_PIX_FMT_NE(BGRA, ARGB) +#define AV_PIX_FMT_0RGB32 AV_PIX_FMT_NE(0RGB, BGR0) +#define AV_PIX_FMT_0BGR32 AV_PIX_FMT_NE(0BGR, RGB0) + +#define AV_PIX_FMT_GRAY9 AV_PIX_FMT_NE(GRAY9BE, GRAY9LE) +#define AV_PIX_FMT_GRAY10 AV_PIX_FMT_NE(GRAY10BE, GRAY10LE) +#define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE) +#define AV_PIX_FMT_GRAY14 AV_PIX_FMT_NE(GRAY14BE, GRAY14LE) +#define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_GRAY32 AV_PIX_FMT_NE(GRAY32BE, GRAY32LE) +#define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) +#define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) +#define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) +#define AV_PIX_FMT_RGB555 AV_PIX_FMT_NE(RGB555BE, RGB555LE) +#define AV_PIX_FMT_RGB444 AV_PIX_FMT_NE(RGB444BE, RGB444LE) +#define AV_PIX_FMT_RGBA64 AV_PIX_FMT_NE(RGBA64BE, RGBA64LE) +#define AV_PIX_FMT_BGR48 AV_PIX_FMT_NE(BGR48BE, BGR48LE) +#define AV_PIX_FMT_BGR565 AV_PIX_FMT_NE(BGR565BE, BGR565LE) +#define AV_PIX_FMT_BGR555 AV_PIX_FMT_NE(BGR555BE, BGR555LE) +#define AV_PIX_FMT_BGR444 AV_PIX_FMT_NE(BGR444BE, BGR444LE) +#define AV_PIX_FMT_BGRA64 AV_PIX_FMT_NE(BGRA64BE, BGRA64LE) + +#define AV_PIX_FMT_YUV420P9 AV_PIX_FMT_NE(YUV420P9BE , YUV420P9LE) +#define AV_PIX_FMT_YUV422P9 AV_PIX_FMT_NE(YUV422P9BE , YUV422P9LE) +#define AV_PIX_FMT_YUV444P9 AV_PIX_FMT_NE(YUV444P9BE , YUV444P9LE) +#define AV_PIX_FMT_YUV420P10 AV_PIX_FMT_NE(YUV420P10BE, YUV420P10LE) +#define AV_PIX_FMT_YUV422P10 AV_PIX_FMT_NE(YUV422P10BE, YUV422P10LE) +#define AV_PIX_FMT_YUV440P10 AV_PIX_FMT_NE(YUV440P10BE, YUV440P10LE) +#define AV_PIX_FMT_YUV444P10 AV_PIX_FMT_NE(YUV444P10BE, YUV444P10LE) +#define AV_PIX_FMT_YUV420P12 AV_PIX_FMT_NE(YUV420P12BE, YUV420P12LE) +#define AV_PIX_FMT_YUV422P12 AV_PIX_FMT_NE(YUV422P12BE, YUV422P12LE) +#define AV_PIX_FMT_YUV440P12 AV_PIX_FMT_NE(YUV440P12BE, YUV440P12LE) +#define AV_PIX_FMT_YUV444P12 AV_PIX_FMT_NE(YUV444P12BE, YUV444P12LE) +#define AV_PIX_FMT_YUV420P14 AV_PIX_FMT_NE(YUV420P14BE, YUV420P14LE) +#define AV_PIX_FMT_YUV422P14 AV_PIX_FMT_NE(YUV422P14BE, YUV422P14LE) +#define AV_PIX_FMT_YUV444P14 AV_PIX_FMT_NE(YUV444P14BE, YUV444P14LE) +#define AV_PIX_FMT_YUV420P16 AV_PIX_FMT_NE(YUV420P16BE, YUV420P16LE) +#define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) +#define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) + +#define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE) +#define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE) + +#define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) +#define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) +#define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) +#define AV_PIX_FMT_GBRP14 AV_PIX_FMT_NE(GBRP14BE, GBRP14LE) +#define AV_PIX_FMT_GBRP16 AV_PIX_FMT_NE(GBRP16BE, GBRP16LE) +#define AV_PIX_FMT_GBRAP10 AV_PIX_FMT_NE(GBRAP10BE, GBRAP10LE) +#define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE) +#define AV_PIX_FMT_GBRAP14 AV_PIX_FMT_NE(GBRAP14BE, GBRAP14LE) +#define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE) +#define AV_PIX_FMT_GBRAP32 AV_PIX_FMT_NE(GBRAP32BE, GBRAP32LE) + +#define AV_PIX_FMT_GBRP10MSB AV_PIX_FMT_NE(GBRP10MSBBE, GBRP10MSBLE) +#define AV_PIX_FMT_GBRP12MSB AV_PIX_FMT_NE(GBRP12MSBBE, GBRP12MSBLE) + +#define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) +#define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE) +#define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) +#define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) + +#define AV_PIX_FMT_GBRPF16 AV_PIX_FMT_NE(GBRPF16BE, GBRPF16LE) +#define AV_PIX_FMT_GBRAPF16 AV_PIX_FMT_NE(GBRAPF16BE, GBRAPF16LE) +#define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE) +#define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE) + +#define AV_PIX_FMT_GRAYF16 AV_PIX_FMT_NE(GRAYF16BE, GRAYF16LE) +#define AV_PIX_FMT_GRAYF32 AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE) + +#define AV_PIX_FMT_YAF16 AV_PIX_FMT_NE(YAF16BE, YAF16LE) +#define AV_PIX_FMT_YAF32 AV_PIX_FMT_NE(YAF32BE, YAF32LE) + +#define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) +#define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) +#define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) +#define AV_PIX_FMT_YUVA420P10 AV_PIX_FMT_NE(YUVA420P10BE, YUVA420P10LE) +#define AV_PIX_FMT_YUVA422P10 AV_PIX_FMT_NE(YUVA422P10BE, YUVA422P10LE) +#define AV_PIX_FMT_YUVA444P10 AV_PIX_FMT_NE(YUVA444P10BE, YUVA444P10LE) +#define AV_PIX_FMT_YUVA422P12 AV_PIX_FMT_NE(YUVA422P12BE, YUVA422P12LE) +#define AV_PIX_FMT_YUVA444P12 AV_PIX_FMT_NE(YUVA444P12BE, YUVA444P12LE) +#define AV_PIX_FMT_YUVA420P16 AV_PIX_FMT_NE(YUVA420P16BE, YUVA420P16LE) +#define AV_PIX_FMT_YUVA422P16 AV_PIX_FMT_NE(YUVA422P16BE, YUVA422P16LE) +#define AV_PIX_FMT_YUVA444P16 AV_PIX_FMT_NE(YUVA444P16BE, YUVA444P16LE) + +#define AV_PIX_FMT_XYZ12 AV_PIX_FMT_NE(XYZ12BE, XYZ12LE) +#define AV_PIX_FMT_NV20 AV_PIX_FMT_NE(NV20BE, NV20LE) +#define AV_PIX_FMT_AYUV64 AV_PIX_FMT_NE(AYUV64BE, AYUV64LE) +#define AV_PIX_FMT_P010 AV_PIX_FMT_NE(P010BE, P010LE) +#define AV_PIX_FMT_P012 AV_PIX_FMT_NE(P012BE, P012LE) +#define AV_PIX_FMT_P016 AV_PIX_FMT_NE(P016BE, P016LE) + +#define AV_PIX_FMT_Y210 AV_PIX_FMT_NE(Y210BE, Y210LE) +#define AV_PIX_FMT_Y212 AV_PIX_FMT_NE(Y212BE, Y212LE) +#define AV_PIX_FMT_Y216 AV_PIX_FMT_NE(Y216BE, Y216LE) +#define AV_PIX_FMT_XV30 AV_PIX_FMT_NE(XV30BE, XV30LE) +#define AV_PIX_FMT_XV36 AV_PIX_FMT_NE(XV36BE, XV36LE) +#define AV_PIX_FMT_XV48 AV_PIX_FMT_NE(XV48BE, XV48LE) +#define AV_PIX_FMT_V30X AV_PIX_FMT_NE(V30XBE, V30XLE) +#define AV_PIX_FMT_X2RGB10 AV_PIX_FMT_NE(X2RGB10BE, X2RGB10LE) +#define AV_PIX_FMT_X2BGR10 AV_PIX_FMT_NE(X2BGR10BE, X2BGR10LE) + +#define AV_PIX_FMT_P210 AV_PIX_FMT_NE(P210BE, P210LE) +#define AV_PIX_FMT_P410 AV_PIX_FMT_NE(P410BE, P410LE) +#define AV_PIX_FMT_P212 AV_PIX_FMT_NE(P212BE, P212LE) +#define AV_PIX_FMT_P412 AV_PIX_FMT_NE(P412BE, P412LE) +#define AV_PIX_FMT_P216 AV_PIX_FMT_NE(P216BE, P216LE) +#define AV_PIX_FMT_P416 AV_PIX_FMT_NE(P416BE, P416LE) + +#define AV_PIX_FMT_RGBF16 AV_PIX_FMT_NE(RGBF16BE, RGBF16LE) +#define AV_PIX_FMT_RGBAF16 AV_PIX_FMT_NE(RGBAF16BE, RGBAF16LE) + +#define AV_PIX_FMT_RGBF32 AV_PIX_FMT_NE(RGBF32BE, RGBF32LE) +#define AV_PIX_FMT_RGBAF32 AV_PIX_FMT_NE(RGBAF32BE, RGBAF32LE) + +#define AV_PIX_FMT_RGB96 AV_PIX_FMT_NE(RGB96BE, RGB96LE) +#define AV_PIX_FMT_RGBA128 AV_PIX_FMT_NE(RGBA128BE, RGBA128LE) + +/** + * Chromaticity coordinates of the source primaries. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.1 and ITU-T H.273. + */ +enum AVColorPrimaries { + AVCOL_PRI_RESERVED0 = 0, + AVCOL_PRI_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 / SMPTE RP 177 Annex B + AVCOL_PRI_UNSPECIFIED = 2, + AVCOL_PRI_RESERVED = 3, + AVCOL_PRI_BT470M = 4, ///< also FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + + AVCOL_PRI_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM + AVCOL_PRI_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC + AVCOL_PRI_SMPTE240M = 7, ///< identical to above, also called "SMPTE C" even though it uses D65 + AVCOL_PRI_FILM = 8, ///< colour filters using Illuminant C + AVCOL_PRI_BT2020 = 9, ///< ITU-R BT2020 + AVCOL_PRI_SMPTE428 = 10, ///< SMPTE ST 428-1 (CIE 1931 XYZ) + AVCOL_PRI_SMPTEST428_1 = AVCOL_PRI_SMPTE428, + AVCOL_PRI_SMPTE431 = 11, ///< SMPTE ST 431-2 (2011) / DCI P3 + AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 + AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors + AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, + AVCOL_PRI_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_PRI_EXT_BASE = 256, + AVCOL_PRI_V_GAMUT = AVCOL_PRI_EXT_BASE, + AVCOL_PRI_EXT_NB ///< Not part of ABI +}; + +/** + * Color Transfer Characteristic. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.2. + */ +enum AVColorTransferCharacteristic { + AVCOL_TRC_RESERVED0 = 0, + AVCOL_TRC_BT709 = 1, ///< also ITU-R BT1361 + AVCOL_TRC_UNSPECIFIED = 2, + AVCOL_TRC_RESERVED = 3, + AVCOL_TRC_GAMMA22 = 4, ///< also ITU-R BT470M / ITU-R BT1700 625 PAL & SECAM + AVCOL_TRC_GAMMA28 = 5, ///< also ITU-R BT470BG + AVCOL_TRC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 or 625 / ITU-R BT1358 525 or 625 / ITU-R BT1700 NTSC + AVCOL_TRC_SMPTE240M = 7, + AVCOL_TRC_LINEAR = 8, ///< "Linear transfer characteristics" + AVCOL_TRC_LOG = 9, ///< "Logarithmic transfer characteristic (100:1 range)" + AVCOL_TRC_LOG_SQRT = 10, ///< "Logarithmic transfer characteristic (100 * Sqrt(10) : 1 range)" + AVCOL_TRC_IEC61966_2_4 = 11, ///< IEC 61966-2-4 + AVCOL_TRC_BT1361_ECG = 12, ///< ITU-R BT1361 Extended Colour Gamut + AVCOL_TRC_IEC61966_2_1 = 13, ///< IEC 61966-2-1 (sRGB or sYCC) + AVCOL_TRC_BT2020_10 = 14, ///< ITU-R BT2020 for 10-bit system + AVCOL_TRC_BT2020_12 = 15, ///< ITU-R BT2020 for 12-bit system + AVCOL_TRC_SMPTE2084 = 16, ///< SMPTE ST 2084 for 10-, 12-, 14- and 16-bit systems + AVCOL_TRC_SMPTEST2084 = AVCOL_TRC_SMPTE2084, + AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1 + AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428, + AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" + AVCOL_TRC_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_TRC_EXT_BASE = 256, + AVCOL_TRC_V_LOG = AVCOL_TRC_EXT_BASE, + AVCOL_TRC_EXT_NB ///< Not part of ABI +}; + +/** + * YUV colorspace type. + * These values match the ones defined by ISO/IEC 23091-2_2019 subclause 8.3. + */ +enum AVColorSpace { + AVCOL_SPC_RGB = 0, ///< order of coefficients is actually GBR, also IEC 61966-2-1 (sRGB), YZX and ST 428-1 + AVCOL_SPC_BT709 = 1, ///< also ITU-R BT1361 / IEC 61966-2-4 xvYCC709 / derived in SMPTE RP 177 Annex B + AVCOL_SPC_UNSPECIFIED = 2, + AVCOL_SPC_RESERVED = 3, ///< reserved for future use by ITU-T and ISO/IEC just like 15-255 are + AVCOL_SPC_FCC = 4, ///< FCC Title 47 Code of Federal Regulations 73.682 (a)(20) + AVCOL_SPC_BT470BG = 5, ///< also ITU-R BT601-6 625 / ITU-R BT1358 625 / ITU-R BT1700 625 PAL & SECAM / IEC 61966-2-4 xvYCC601 + AVCOL_SPC_SMPTE170M = 6, ///< also ITU-R BT601-6 525 / ITU-R BT1358 525 / ITU-R BT1700 NTSC / functionally identical to above + AVCOL_SPC_SMPTE240M = 7, ///< derived from 170M primaries and D65 white point, 170M is derived from BT470 System M's primaries + AVCOL_SPC_YCGCO = 8, ///< used by Dirac / VC-2 and H.264 FRext, see ITU-T SG16 + AVCOL_SPC_YCOCG = AVCOL_SPC_YCGCO, + AVCOL_SPC_BT2020_NCL = 9, ///< ITU-R BT2020 non-constant luminance system + AVCOL_SPC_BT2020_CL = 10, ///< ITU-R BT2020 constant luminance system + AVCOL_SPC_SMPTE2085 = 11, ///< SMPTE 2085, Y'D'zD'x + AVCOL_SPC_CHROMA_DERIVED_NCL = 12, ///< Chromaticity-derived non-constant luminance system + AVCOL_SPC_CHROMA_DERIVED_CL = 13, ///< Chromaticity-derived constant luminance system + AVCOL_SPC_ICTCP = 14, ///< ITU-R BT.2100-0, ICtCp + AVCOL_SPC_IPT_C2 = 15, ///< SMPTE ST 2128, IPT-C2 + AVCOL_SPC_YCGCO_RE = 16, ///< YCgCo-R, even addition of bits + AVCOL_SPC_YCGCO_RO = 17, ///< YCgCo-R, odd addition of bits + AVCOL_SPC_NB ///< Not part of ABI +}; + +/** + * Visual content value range. + * + * These values are based on definitions that can be found in multiple + * specifications, such as ITU-T BT.709 (3.4 - Quantization of RGB, luminance + * and colour-difference signals), ITU-T BT.2020 (Table 5 - Digital + * Representation) as well as ITU-T BT.2100 (Table 9 - Digital 10- and 12-bit + * integer representation). At the time of writing, the BT.2100 one is + * recommended, as it also defines the full range representation. + * + * Common definitions: + * - For RGB and luma planes such as Y in YCbCr and I in ICtCp, + * 'E' is the original value in range of 0.0 to 1.0. + * - For chroma planes such as Cb,Cr and Ct,Cp, 'E' is the original + * value in range of -0.5 to 0.5. + * - 'n' is the output bit depth. + * - For additional definitions such as rounding and clipping to valid n + * bit unsigned integer range, please refer to BT.2100 (Table 9). + */ +enum AVColorRange { + AVCOL_RANGE_UNSPECIFIED = 0, + + /** + * Narrow or limited range content. + * + * - For luma planes: + * + * (219 * E + 16) * 2^(n-8) + * + * F.ex. the range of 16-235 for 8 bits + * + * - For chroma planes: + * + * (224 * E + 128) * 2^(n-8) + * + * F.ex. the range of 16-240 for 8 bits + */ + AVCOL_RANGE_MPEG = 1, + + /** + * Full range content. + * + * - For RGB and luma planes: + * + * (2^n - 1) * E + * + * F.ex. the range of 0-255 for 8 bits + * + * - For chroma planes: + * + * (2^n - 1) * E + 2^(n - 1) + * + * F.ex. the range of 1-255 for 8 bits + */ + AVCOL_RANGE_JPEG = 2, + AVCOL_RANGE_NB ///< Not part of ABI +}; + +/** + * Location of chroma samples. + * + * Illustration showing the location of the first (top left) chroma sample of the + * image, the left shows only luma, the right + * shows the location of the chroma sample, the 2 could be imagined to overlay + * each other but are drawn separately due to limitations of ASCII + * + * 1st 2nd 1st 2nd horizontal luma sample positions + * v v v v + * ______ ______ + *1st luma line > |X X ... |3 4 X ... X are luma samples, + * | |1 2 1-6 are possible chroma positions + *2nd luma line > |X X ... |5 6 X ... 0 is undefined/unknown position + */ +enum AVChromaLocation { + AVCHROMA_LOC_UNSPECIFIED = 0, + AVCHROMA_LOC_LEFT = 1, ///< MPEG-2/4 4:2:0, H.264 default for 4:2:0 + AVCHROMA_LOC_CENTER = 2, ///< MPEG-1 4:2:0, JPEG 4:2:0, H.263 4:2:0 + AVCHROMA_LOC_TOPLEFT = 3, ///< ITU-R 601, SMPTE 274M 296M S314M(DV 4:1:1), mpeg2 4:2:2 + AVCHROMA_LOC_TOP = 4, + AVCHROMA_LOC_BOTTOMLEFT = 5, + AVCHROMA_LOC_BOTTOM = 6, + AVCHROMA_LOC_NB ///< Not part of ABI +}; + +/** + * Correlation between the alpha channel and color values. + */ +enum AVAlphaMode { + AVALPHA_MODE_UNSPECIFIED = 0, ///< Unknown alpha handling, or no alpha channel + AVALPHA_MODE_PREMULTIPLIED = 1, ///< Alpha channel is multiplied into color values + AVALPHA_MODE_STRAIGHT = 2, ///< Alpha channel is independent of color values + AVALPHA_MODE_NB ///< Not part of ABI +}; + +#endif /* AVUTIL_PIXFMT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/rational.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/rational.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/rational.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/rational.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,225 @@ +/* + * rational numbers + * Copyright (c) 2003 Michael Niedermayer + * + * 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 + */ + +/** + * @file + * @ingroup lavu_math_rational + * Utilities for rational number calculation. + * @author Michael Niedermayer + */ + +#ifndef AVUTIL_RATIONAL_H +#define AVUTIL_RATIONAL_H + +#include +#include +#include "attributes.h" + +/** + * @defgroup lavu_math_rational AVRational + * @ingroup lavu_math + * Rational number calculation. + * + * While rational numbers can be expressed as floating-point numbers, the + * conversion process is a lossy one, so are floating-point operations. On the + * other hand, the nature of FFmpeg demands highly accurate calculation of + * timestamps. This set of rational number utilities serves as a generic + * interface for manipulating rational numbers as pairs of numerators and + * denominators. + * + * Many of the functions that operate on AVRational's have the suffix `_q`, in + * reference to the mathematical symbol "ℚ" (Q) which denotes the set of all + * rational numbers. + * + * @{ + */ + +/** + * Rational number (pair of numerator and denominator). + */ +typedef struct AVRational{ + int num; ///< Numerator + int den; ///< Denominator +} AVRational; + +/** + * Create an AVRational. + * + * Useful for compilers that do not support compound literals. + * + * @note The return value is not reduced. + * @see av_reduce() + */ +static inline AVRational av_make_q(int num, int den) +{ + AVRational r = { num, den }; + return r; +} + +/** + * Compare two rationals. + * + * @param a First rational + * @param b Second rational + * + * @return One of the following values: + * - 0 if `a == b` + * - 1 if `a > b` + * - -1 if `a < b` + * - `INT_MIN` if one of the values is of the form `0 / 0` + */ +static inline int av_cmp_q(AVRational a, AVRational b){ + const int64_t tmp= a.num * (int64_t)b.den - b.num * (int64_t)a.den; + + if(tmp) return (int)((tmp ^ a.den ^ b.den)>>63)|1; + else if(b.den && a.den) return 0; + else if(a.num && b.num) return (a.num>>31) - (b.num>>31); + else return INT_MIN; +} + +/** + * Convert an AVRational to a `double`. + * @param a AVRational to convert + * @return `a` in floating-point form + * @see av_d2q() + */ +static inline double av_q2d(AVRational a){ + return a.num / (double) a.den; +} + +/** + * Reduce a fraction. + * + * This is useful for framerate calculations. + * + * @param[out] dst_num Destination numerator + * @param[out] dst_den Destination denominator + * @param[in] num Source numerator + * @param[in] den Source denominator + * @param[in] max Maximum allowed values for `dst_num` & `dst_den` + * @return 1 if the operation is exact, 0 otherwise + */ +int av_reduce(int *dst_num, int *dst_den, int64_t num, int64_t den, int64_t max); + +/** + * Multiply two rationals. + * @param b First rational + * @param c Second rational + * @return b*c + */ +AVRational av_mul_q(AVRational b, AVRational c) av_const; + +/** + * Divide one rational by another. + * @param b First rational + * @param c Second rational + * @return b/c + */ +AVRational av_div_q(AVRational b, AVRational c) av_const; + +/** + * Add two rationals. + * @param b First rational + * @param c Second rational + * @return b+c + */ +AVRational av_add_q(AVRational b, AVRational c) av_const; + +/** + * Subtract one rational from another. + * @param b First rational + * @param c Second rational + * @return b-c + */ +AVRational av_sub_q(AVRational b, AVRational c) av_const; + +/** + * Invert a rational. + * @param q value + * @return 1 / q + */ +static av_always_inline AVRational av_inv_q(AVRational q) +{ + AVRational r = { q.den, q.num }; + return r; +} + +/** + * Convert a double precision floating point number to a rational. + * + * In case of infinity, the returned value is expressed as `{1, 0}` or + * `{-1, 0}` depending on the sign. + * + * In general rational numbers with |num| <= 1<<26 && |den| <= 1<<26 + * can be recovered exactly from their double representation. + * (no exceptions were found within 1B random ones) + * + * @param d `double` to convert + * @param max Maximum allowed numerator and denominator + * @return `d` in AVRational form + * @see av_q2d() + */ +AVRational av_d2q(double d, int max) av_const; + +/** + * Find which of the two rationals is closer to another rational. + * + * @param q Rational to be compared against + * @param q1 Rational to be tested + * @param q2 Rational to be tested + * @return One of the following values: + * - 1 if `q1` is nearer to `q` than `q2` + * - -1 if `q2` is nearer to `q` than `q1` + * - 0 if they have the same distance + */ +int av_nearer_q(AVRational q, AVRational q1, AVRational q2); + +/** + * Find the value in a list of rationals nearest a given reference rational. + * + * @param q Reference rational + * @param q_list Array of rationals terminated by `{0, 0}` + * @return Index of the nearest value found in the array + */ +int av_find_nearest_q_idx(AVRational q, const AVRational* q_list); + +/** + * Convert an AVRational to a IEEE 32-bit `float` expressed in fixed-point + * format. + * + * @param q Rational to be converted + * @return Equivalent floating-point value, expressed as an unsigned 32-bit + * integer. + * @note The returned value is platform-indepedant. + */ +uint32_t av_q2intfloat(AVRational q); + +/** + * Return the best rational so that a and b are multiple of it. + * If the resulting denominator is larger than max_den, return def. + */ +AVRational av_gcd_q(AVRational a, AVRational b, int max_den, AVRational def); + +/** + * @} + */ + +#endif /* AVUTIL_RATIONAL_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/samplefmt.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/samplefmt.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/samplefmt.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/samplefmt.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,268 @@ +/* + * 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 + */ + +#ifndef AVUTIL_SAMPLEFMT_H +#define AVUTIL_SAMPLEFMT_H + +#include + +/** + * @addtogroup lavu_audio + * @{ + * + * @defgroup lavu_sampfmts Audio sample formats + * + * Audio sample format enumeration and related convenience functions. + * @{ + */ + +/** + * Audio sample formats + * + * - The data described by the sample format is always in native-endian order. + * Sample values can be expressed by native C types, hence the lack of a signed + * 24-bit sample format even though it is a common raw audio data format. + * + * - The floating-point formats are based on full volume being in the range + * [-1.0, 1.0]. Any values outside this range are beyond full volume level. + * + * - The data layout as used in av_samples_fill_arrays() and elsewhere in FFmpeg + * (such as AVFrame in libavcodec) is as follows: + * + * @par + * For planar sample formats, each audio channel is in a separate data plane, + * and linesize is the buffer size, in bytes, for a single plane. All data + * planes must be the same size. For packed sample formats, only the first data + * plane is used, and samples for each channel are interleaved. In this case, + * linesize is the buffer size, in bytes, for the 1 plane. + * + */ +enum AVSampleFormat { + AV_SAMPLE_FMT_NONE = -1, + AV_SAMPLE_FMT_U8, ///< unsigned 8 bits + AV_SAMPLE_FMT_S16, ///< signed 16 bits + AV_SAMPLE_FMT_S32, ///< signed 32 bits + AV_SAMPLE_FMT_FLT, ///< float + AV_SAMPLE_FMT_DBL, ///< double + + AV_SAMPLE_FMT_U8P, ///< unsigned 8 bits, planar + AV_SAMPLE_FMT_S16P, ///< signed 16 bits, planar + AV_SAMPLE_FMT_S32P, ///< signed 32 bits, planar + AV_SAMPLE_FMT_FLTP, ///< float, planar + AV_SAMPLE_FMT_DBLP, ///< double, planar + AV_SAMPLE_FMT_S64, ///< signed 64 bits + AV_SAMPLE_FMT_S64P, ///< signed 64 bits, planar + + AV_SAMPLE_FMT_NB ///< Number of sample formats. DO NOT USE if linking dynamically +}; + +/** + * Return the name of sample_fmt, or NULL if sample_fmt is not + * recognized. + */ +const char *av_get_sample_fmt_name(enum AVSampleFormat sample_fmt); + +/** + * Return a sample format corresponding to name, or AV_SAMPLE_FMT_NONE + * on error. + */ +enum AVSampleFormat av_get_sample_fmt(const char *name); + +/** + * Return the planar<->packed alternative form of the given sample format, or + * AV_SAMPLE_FMT_NONE on error. If the passed sample_fmt is already in the + * requested planar/packed format, the format returned is the same as the + * input. + */ +enum AVSampleFormat av_get_alt_sample_fmt(enum AVSampleFormat sample_fmt, int planar); + +/** + * Get the packed alternative form of the given sample format. + * + * If the passed sample_fmt is already in packed format, the format returned is + * the same as the input. + * + * @return the packed alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_packed_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Get the planar alternative form of the given sample format. + * + * If the passed sample_fmt is already in planar format, the format returned is + * the same as the input. + * + * @return the planar alternative form of the given sample format or + AV_SAMPLE_FMT_NONE on error. + */ +enum AVSampleFormat av_get_planar_sample_fmt(enum AVSampleFormat sample_fmt); + +/** + * Generate a string corresponding to the sample format with + * sample_fmt, or a header if sample_fmt is negative. + * + * @param buf the buffer where to write the string + * @param buf_size the size of buf + * @param sample_fmt the number of the sample format to print the + * corresponding info string, or a negative value to print the + * corresponding header. + * @return the pointer to the filled buffer or NULL in case of other errors + */ +char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); + +/** + * Return number of bytes per sample. + * + * @param sample_fmt the sample format + * @return number of bytes per sample or zero if unknown for the given + * sample format + */ +int av_get_bytes_per_sample(enum AVSampleFormat sample_fmt); + +/** + * Check if the sample format is planar. + * + * @param sample_fmt the sample format to inspect + * @return 1 if the sample format is planar, 0 if it is interleaved + */ +int av_sample_fmt_is_planar(enum AVSampleFormat sample_fmt); + +/** + * Get the required buffer size for the given audio parameters. + * + * @param[out] linesize calculated linesize, may be NULL + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return required buffer size, or negative error code on failure + */ +int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * @} + * + * @defgroup lavu_sampmanip Samples manipulation + * + * Functions that manipulate audio samples + * @{ + */ + +/** + * Fill plane data pointers and linesize for samples with sample + * format sample_fmt. + * + * The audio_data array is filled with the pointers to the samples data planes: + * for planar, set the start point of each channel's data within the buffer, + * for packed, set the start point of the entire buffer only. + * + * The value pointed to by linesize is set to the aligned size of each + * channel's data buffer for planar layout, or to the aligned size of the + * buffer for all channels for packed layout. + * + * The buffer in buf must be big enough to contain all the samples + * (use av_samples_get_buffer_size() to compute its minimum size), + * otherwise the audio_data pointers will point to invalid data. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize calculated linesize, may be NULL + * @param buf the pointer to a buffer containing the samples + * @param nb_channels the number of channels + * @param nb_samples the number of samples in a single channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return minimum size in bytes required for the buffer on success, + * or a negative error code on failure + */ +int av_samples_fill_arrays(uint8_t **audio_data, int *linesize, + const uint8_t *buf, + int nb_channels, int nb_samples, + enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a samples buffer for nb_samples samples, and fill data pointers and + * linesize accordingly. + * The allocated samples buffer can be freed by using av_freep(&audio_data[0]) + * Allocated data will be initialized to silence. + * + * @see enum AVSampleFormat + * The documentation for AVSampleFormat describes the data layout. + * + * @param[out] audio_data array to be filled with the pointer for each channel + * @param[out] linesize aligned size for audio buffer(s), may be NULL + * @param nb_channels number of audio channels + * @param nb_samples number of samples per channel + * @param sample_fmt the sample format + * @param align buffer size alignment (0 = default, 1 = no alignment) + * @return >=0 on success or a negative error code on failure + * @todo return the size of the allocated buffer in case of success at the next bump + * @see av_samples_fill_arrays() + * @see av_samples_alloc_array_and_samples() + */ +int av_samples_alloc(uint8_t **audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Allocate a data pointers array, samples buffer for nb_samples + * samples, and fill data pointers and linesize accordingly. + * + * This is the same as av_samples_alloc(), but also allocates the data + * pointers array. + * + * @see av_samples_alloc() + */ +int av_samples_alloc_array_and_samples(uint8_t ***audio_data, int *linesize, int nb_channels, + int nb_samples, enum AVSampleFormat sample_fmt, int align); + +/** + * Copy samples from src to dst. + * + * @param dst destination array of pointers to data planes + * @param src source array of pointers to data planes + * @param dst_offset offset in samples at which the data will be written to dst + * @param src_offset offset in samples at which the data will be read from src + * @param nb_samples number of samples to be copied + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_copy(uint8_t * const *dst, uint8_t * const *src, int dst_offset, + int src_offset, int nb_samples, int nb_channels, + enum AVSampleFormat sample_fmt); + +/** + * Fill an audio buffer with silence. + * + * @param audio_data array of pointers to data planes + * @param offset offset in samples at which to start filling + * @param nb_samples number of samples to fill + * @param nb_channels number of audio channels + * @param sample_fmt audio sample format + */ +int av_samples_set_silence(uint8_t * const *audio_data, int offset, int nb_samples, + int nb_channels, enum AVSampleFormat sample_fmt); + +/** + * @} + * @} + */ +#endif /* AVUTIL_SAMPLEFMT_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/version.h thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/version.h --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/version.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/include/libavutil/version.h 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,123 @@ +/* + * copyright (c) 2003 Fabrice Bellard + * + * 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 + */ + +/** + * @file + * @ingroup lavu + * Libavutil version macros + */ + +#ifndef AVUTIL_VERSION_H +#define AVUTIL_VERSION_H + +#include "macros.h" + +/** + * @addtogroup version_utils + * + * Useful to check and match library version in order to maintain + * backward compatibility. + * + * The FFmpeg libraries follow a versioning scheme very similar to + * Semantic Versioning (http://semver.org/) + * The difference is that the component called PATCH is called MICRO in FFmpeg + * and its value is reset to 100 instead of 0 to keep it above or equal to 100. + * Also we do not increase MICRO for every bugfix or change in git master. + * + * Prior to FFmpeg 3.2 point releases did not change any lib version number to + * avoid aliassing different git master checkouts. + * Starting with FFmpeg 3.2, the released library versions will occupy + * a separate MAJOR.MINOR that is not used on the master development branch. + * That is if we branch a release of master 55.10.123 we will bump to 55.11.100 + * for the release and master will continue at 55.12.100 after it. Each new + * point release will then bump the MICRO improving the usefulness of the lib + * versions. + * + * @{ + */ + +#define AV_VERSION_INT(a, b, c) ((a)<<16 | (b)<<8 | (c)) +#define AV_VERSION_DOT(a, b, c) a ##.## b ##.## c +#define AV_VERSION(a, b, c) AV_VERSION_DOT(a, b, c) + +/** + * Extract version components from the full ::AV_VERSION_INT int as returned + * by functions like ::avformat_version() and ::avcodec_version() + */ +#define AV_VERSION_MAJOR(a) ((a) >> 16) +#define AV_VERSION_MINOR(a) (((a) & 0x00FF00) >> 8) +#define AV_VERSION_MICRO(a) ((a) & 0xFF) + +/** + * @} + */ + +/** + * @defgroup lavu_ver Version and Build diagnostics + * + * Macros and function useful to check at compile time and at runtime + * which version of libavutil is in use. + * + * @{ + */ + +#define LIBAVUTIL_VERSION_MAJOR 60 +#define LIBAVUTIL_VERSION_MINOR 30 +#define LIBAVUTIL_VERSION_MICRO 100 + +#define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_VERSION AV_VERSION(LIBAVUTIL_VERSION_MAJOR, \ + LIBAVUTIL_VERSION_MINOR, \ + LIBAVUTIL_VERSION_MICRO) +#define LIBAVUTIL_BUILD LIBAVUTIL_VERSION_INT + +#define LIBAVUTIL_IDENT "Lavu" AV_STRINGIFY(LIBAVUTIL_VERSION) + +/** + * @defgroup lavu_depr_guards Deprecation Guards + * FF_API_* defines may be placed below to indicate public API that will be + * dropped at a future version bump. The defines themselves are not part of + * the public API and may change, break or disappear at any time. + * + * @note, when bumping the major version it is recommended to manually + * disable each FF_API_* in its own commit instead of disabling them all + * at once through the bump. This improves the git bisect-ability of the change. + * + * @{ + */ + +#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_SYNC_QUEUES (LIBAVUTIL_VERSION_MAJOR < 62) + +/** + * @} + * @} + */ + +#endif /* AVUTIL_VERSION_H */ diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/moz.build thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/moz.build --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffmpeg62/moz.build 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffmpeg62/moz.build 2026-04-29 18:38:19.000000000 +0000 @@ -0,0 +1,53 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. + +UNIFIED_SOURCES += [ + "../FFmpegAudioDecoder.cpp", + "../FFmpegAudioEncoder.cpp", + "../FFmpegDataDecoder.cpp", + "../FFmpegDataEncoder.cpp", + "../FFmpegDecoderModule.cpp", + "../FFmpegEncoderModule.cpp", + "../FFmpegVideoDecoder.cpp", + "../FFmpegVideoEncoder.cpp", +] +LOCAL_INCLUDES += [ + "..", + "/media/mozva", + "include", +] + +if CONFIG["CC_TYPE"] in ("clang", "gcc"): + CXXFLAGS += ["-Wno-deprecated-declarations"] +if CONFIG["CC_TYPE"] == "clang": + CXXFLAGS += [ + "-Wno-unknown-attributes", + ] +if CONFIG["CC_TYPE"] == "gcc": + CXXFLAGS += [ + "-Wno-attributes", + ] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "gtk": + CXXFLAGS += CONFIG["MOZ_GTK3_CFLAGS"] +if CONFIG["MOZ_ENABLE_VAAPI"] or CONFIG["MOZ_ENABLE_V4L2"]: + UNIFIED_SOURCES += ["../FFmpegVideoFramePool.cpp"] + CXXFLAGS += CONFIG['MOZ_DRM_CFLAGS'] + if not CONFIG['MOZ_SYSTEM_LIBDRM']: + LOCAL_INCLUDES += [ + '/third_party/drm/drm/include', + '/third_party/drm/drm/include/libdrm' + ] + USE_LIBS += ["mozva"] + DEFINES["MOZ_USE_HWDECODE"] = 1 + +if CONFIG["MOZ_SYSTEM_AV1"]: + CXXFLAGS += CONFIG["MOZ_SYSTEM_LIBAOM_CFLAGS"] + +include("/ipc/chromium/chromium-config.mozbuild") + +LOCAL_INCLUDES += [ + "/media/libyuv/libyuv/include", +] + +FINAL_LIBRARY = "xul" diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffvpx/moz.build thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffvpx/moz.build --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/ffvpx/moz.build 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/ffvpx/moz.build 2026-04-29 18:38:20.000000000 +0000 @@ -25,7 +25,7 @@ ] LOCAL_INCLUDES += [ "..", - "../ffmpeg61/include", + "/media/ffvpx", "/media/mozva", ] diff -Nru thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/moz.build thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/moz.build --- thunderbird-140.10.0esr/dom/media/platforms/ffmpeg/moz.build 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/platforms/ffmpeg/moz.build 2026-04-29 18:38:19.000000000 +0000 @@ -17,6 +17,7 @@ "ffmpeg59", "ffmpeg60", "ffmpeg61", + "ffmpeg62", ] UNIFIED_SOURCES += ["FFmpegRuntimeLinker.cpp"] Binary files /srv/release.debian.org/tmp/8MBZZ7c5XJ/thunderbird-140.10.0esr/dom/media/webaudio/test/ting-44.1k-1ch.wav and /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-44.1k-1ch.wav differ Binary files /srv/release.debian.org/tmp/8MBZZ7c5XJ/thunderbird-140.10.0esr/dom/media/webaudio/test/ting-44.1k-2ch.wav and /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-44.1k-2ch.wav differ Binary files /srv/release.debian.org/tmp/8MBZZ7c5XJ/thunderbird-140.10.0esr/dom/media/webaudio/test/ting-48k-1ch.wav and /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-48k-1ch.wav differ Binary files /srv/release.debian.org/tmp/8MBZZ7c5XJ/thunderbird-140.10.0esr/dom/media/webaudio/test/ting-48k-2ch.wav and /srv/release.debian.org/tmp/yGveqp5hzb/thunderbird-140.10.1esr/dom/media/webaudio/test/ting-48k-2ch.wav differ diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.cpp thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.cpp --- thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -42,8 +42,7 @@ RTCEncodedFrameBase::RTCEncodedFrameBase( nsIGlobalObject* aGlobal, std::unique_ptr aFrame, - uint64_t aCounter, - RTCRtpScriptTransformer* aOwner) + uint64_t aCounter, RTCRtpScriptTransformer* aOwner) : mGlobal(aGlobal), mFrame(std::move(aFrame)), mCounter(aCounter), @@ -111,4 +110,11 @@ return std::move(mFrame); } +size_t RTCEncodedFrameBase::Size() const { + if (!mFrame) { + return 0; + } + return mFrame->GetData().size(); +} + } // namespace mozilla::dom diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.h thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.h --- thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCEncodedFrameBase.h 2026-04-29 18:38:20.000000000 +0000 @@ -24,8 +24,7 @@ explicit RTCEncodedFrameBase( nsIGlobalObject* aGlobal, std::unique_ptr aFrame, - uint64_t aCounter, - RTCRtpScriptTransformer* aOwner); + uint64_t aCounter, RTCRtpScriptTransformer* aOwner); // nsISupports NS_DECL_CYCLE_COLLECTING_ISUPPORTS @@ -42,6 +41,8 @@ uint64_t GetCounter() const; + size_t Size() const; + virtual bool CheckOwner(RTCRtpScriptTransformer* aOwner) const = 0; std::unique_ptr TakeFrame(); diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCRtpScriptTransformer.cpp thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCRtpScriptTransformer.cpp --- thunderbird-140.10.0esr/dom/media/webrtc/jsapi/RTCRtpScriptTransformer.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/jsapi/RTCRtpScriptTransformer.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -8,6 +8,7 @@ #include +#include #include #include #include @@ -436,8 +437,10 @@ already_AddRefed RTCRtpScriptTransformer::OnTransformedFrame( RTCEncodedFrameBase* aFrame, ErrorResult& aError) { // Spec says to skip frames that are out of order or have wrong owner + // We also skip frames that are unreasonably large if (aFrame->GetCounter() > mLastReceivedFrameCounter && - aFrame->CheckOwner(this) && mProxy) { + aFrame->CheckOwner(this) && mProxy && + aFrame->Size() <= std::numeric_limits::max() / 4) { mLastReceivedFrameCounter = aFrame->GetCounter(); mProxy->OnTransformedFrame(aFrame->TakeFrame()); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/nricectx.cpp thunderbird-140.10.1esr/dom/media/webrtc/transport/nricectx.cpp --- thunderbird-140.10.0esr/dom/media/webrtc/transport/nricectx.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/nricectx.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -236,7 +236,7 @@ nsresult rv = ToNicerStunStruct(&server->turn_server); if (NS_FAILED(rv)) return rv; - if (!(server->username = r_strdup(username_.c_str()))) + if (!(server->username = strdup(username_.c_str()))) return NS_ERROR_OUT_OF_MEMORY; // TODO(ekr@rtfm.com): handle non-ASCII passwords somehow? @@ -249,7 +249,7 @@ const UCHAR* data = password_.empty() ? nullptr : &password_[0]; int r = r_data_create(&server->password, data, password_.size()); if (r) { - RFREE(server->username); + free(server->username); return NS_ERROR_OUT_OF_MEMORY; } @@ -968,9 +968,9 @@ for (int i = 0; i < attrct; i++) { ret.push_back(std::string(attrs[i])); - RFREE(attrs[i]); + free(attrs[i]); } - RFREE(attrs); + free(attrs); return ret; } @@ -1102,7 +1102,7 @@ obfuscated_host_addresses_[*actual_address] = *mdns_address; } - candidate->mdns_addr = r_strdup(mdns_address->c_str()); + candidate->mdns_addr = strdup(mdns_address->c_str()); } } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/nricemediastream.cpp thunderbird-140.10.1esr/dom/media/webrtc/transport/nricemediastream.cpp --- thunderbird-140.10.0esr/dom/media/webrtc/transport/nricemediastream.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/nricemediastream.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -516,10 +516,10 @@ for (int i = 0; i < attrct; i++) { ret.push_back(attrs[i]); - RFREE(attrs[i]); + free(attrs[i]); } - RFREE(attrs); + free(attrs); return ret; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/test/test_nr_socket_ice_unittest.cpp thunderbird-140.10.1esr/dom/media/webrtc/transport/test/test_nr_socket_ice_unittest.cpp --- thunderbird-140.10.0esr/dom/media/webrtc/transport/test/test_nr_socket_ice_unittest.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/test/test_nr_socket_ice_unittest.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -147,9 +147,9 @@ for (int i = 0; i < attrct; i++) { ret.push_back(std::string(attrs[i])); - RFREE(attrs[i]); + free(attrs[i]); } - RFREE(attrs); + free(attrs); return ret; } @@ -170,9 +170,9 @@ for (int i = 0; i < attrct; i++) { ret.push_back(std::string(attrs[i])); - RFREE(attrs[i]); + free(attrs[i]); } - RFREE(attrs); + free(attrs); return ret; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate.c 2026-04-29 18:38:20.000000000 +0000 @@ -172,7 +172,7 @@ } } - if(!(cand->label=r_strdup(label))) + if(!(cand->label=strdup(label))) ABORT(R_NO_MEMORY); if(r=nr_ice_get_foundation(ctx,cand)) @@ -220,7 +220,7 @@ if(!(cand=RCALLOC(sizeof(nr_ice_candidate)))) ABORT(R_NO_MEMORY); - if(!(cand->label=r_strdup(label))) + if(!(cand->label=strdup(label))) ABORT(R_NO_MEMORY); cand->state=NR_ICE_CAND_STATE_INITIALIZED; @@ -239,7 +239,7 @@ if(r=nr_transport_addr_copy(&cand->addr,addr)) ABORT(r); /* Bogus foundation */ - if(!(cand->foundation=r_strdup(cand->addr.as_string))) + if(!(cand->foundation=strdup(cand->addr.as_string))) ABORT(R_NO_MEMORY); nr_ice_candidate_compute_codeword(cand); @@ -333,10 +333,10 @@ break; } - RFREE(cand->mdns_addr); - RFREE(cand->foundation); - RFREE(cand->label); - RFREE(cand); + free(cand->mdns_addr); + free(cand->foundation); + free(cand->label); + free(cand); return(0); } @@ -383,7 +383,7 @@ } snprintf(fnd,sizeof(fnd),"%d",i); - if(!(cand->foundation=r_strdup(fnd))) + if(!(cand->foundation=strdup(fnd))) ABORT(R_NO_MEMORY); return(0); @@ -402,7 +402,7 @@ STAILQ_INSERT_TAIL(&ctx->foundations,foundation,entry); snprintf(fnd,sizeof(fnd),"%d",i); - if(!(cand->foundation=r_strdup(fnd))) + if(!(cand->foundation=strdup(fnd))) ABORT(R_NO_MEMORY); _status=0; @@ -933,7 +933,7 @@ r_log(LOG_ICE,LOG_DEBUG,"ICE(%s)/CAND(%s): new relay base=%s addr=%s", cand->ctx->label, cand->label, cand->base.as_string, cand->addr.as_string); - RFREE(cand->label); + free(cand->label); cand->label=label; nr_ice_candidate_mark_done(cand, NR_ICE_CAND_STATE_INITIALIZED); cand = 0; diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate_pair.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate_pair.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate_pair.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_candidate_pair.c 2026-04-29 18:38:20.000000000 +0000 @@ -134,7 +134,7 @@ lcand->osock, &rcand->addr,RTO,&pair->stun_client)) ABORT(r); - if(!(pair->stun_client->params.ice_binding_request.username=r_strdup(rcand->stream->l2r_user))) + if(!(pair->stun_client->params.ice_binding_request.username=strdup(rcand->stream->l2r_user))) ABORT(R_NO_MEMORY); if(r=r_data_copy(&pair->stun_client->params.ice_binding_request.password, &rcand->stream->l2r_pass)) @@ -171,12 +171,12 @@ nr_accumulate_count(&(pair->local->ctx->stats.stun_retransmits), pair->stun_client->retransmit_ct); } - RFREE(pair->as_string); - RFREE(pair->foundation); + free(pair->as_string); + free(pair->foundation); nr_ice_socket_deregister(pair->local->isock,pair->stun_client_handle); if (pair->stun_client) { - RFREE(pair->stun_client->params.ice_binding_request.username); - RFREE(pair->stun_client->params.ice_binding_request.password.data); + free(pair->stun_client->params.ice_binding_request.username); + free(pair->stun_client->params.ice_binding_request.password.data); nr_stun_client_ctx_destroy(&pair->stun_client); } @@ -184,7 +184,7 @@ NR_async_timer_cancel(pair->restart_role_change_cb_timer); NR_async_timer_cancel(pair->restart_nominated_cb_timer); - RFREE(pair); + free(pair); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_component.c 2026-04-29 18:38:20.000000000 +0000 @@ -75,7 +75,7 @@ ABORT(r); if (!nr_stun_message_has_attribute(par->req.request, NR_STUN_ATTR_USERNAME, &attr)) ABORT(R_INTERNAL); - if (!(par->username = r_strdup(attr->u.username))) + if (!(par->username = strdup(attr->u.username))) ABORT(R_NO_MEMORY); *parp=par; @@ -103,8 +103,8 @@ nr_stun_message_destroy(&par->req.request); nr_stun_message_destroy(&par->req.response); - RFREE(par->username); - RFREE(par); + free(par->username); + free(par); return(0); } @@ -174,7 +174,7 @@ nr_ice_pre_answer_request_destroy(&r1); } - RFREE(component); + free(component); return(0); } @@ -1683,7 +1683,7 @@ _status=0; abort: - RFREE(pairs); + free(pairs); return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_ctx.c 2026-04-29 18:38:20.000000000 +0000 @@ -104,7 +104,7 @@ if (r = nr_ip4_port_to_transport_addr(ntohl(addr_int), port, IPPROTO_UDP, &servers[i].addr)) ABORT(r); - RFREE(addr); + free(addr); addr=0; } @@ -112,8 +112,8 @@ _status=0; abort: - RFREE(addr); - if (_status) RFREE(servers); + free(addr); + if (_status) free(servers); return(_status); } @@ -122,7 +122,7 @@ int _status; if(ctx->stun_servers_cfg){ - RFREE(ctx->stun_servers_cfg); + free(ctx->stun_servers_cfg); ctx->stun_servers_cfg=NULL; ctx->stun_server_ct_cfg=0; } @@ -146,10 +146,10 @@ if(ctx->turn_servers_cfg){ for (int i = 0; i < ctx->turn_server_ct_cfg; i++) { - RFREE(ctx->turn_servers_cfg[i].username); + free(ctx->turn_servers_cfg[i].username); r_data_destroy(&ctx->turn_servers_cfg[i].password); } - RFREE(ctx->turn_servers_cfg); + free(ctx->turn_servers_cfg); ctx->turn_servers_cfg=NULL; ctx->turn_server_ct_cfg=0; } @@ -177,7 +177,7 @@ // make copies of the username and password so they aren't freed twice for (i = 0; i < ct; ++i) { - if (!(ctx->turn_servers_cfg[i].username = r_strdup(servers[i].username))) { + if (!(ctx->turn_servers_cfg[i].username = strdup(servers[i].username))) { ABORT(R_NO_MEMORY); } if (r = r_data_create(&ctx->turn_servers_cfg[i].password, @@ -197,7 +197,7 @@ int _status,i,r; if(ctx->local_addrs) { - RFREE(ctx->local_addrs); + free(ctx->local_addrs); ctx->local_addr_ct=0; ctx->local_addrs=0; } @@ -309,7 +309,7 @@ data.data=0; } - RFREE(addr); + free(addr); addr=0; } @@ -317,9 +317,9 @@ _status=0; abort: - RFREE(data.data); - RFREE(addr); - if (_status) RFREE(servers); + free(data.data); + free(addr); + if (_status) free(servers); return(_status); } #endif /* USE_TURN */ @@ -339,7 +339,7 @@ ctx->flags=flags; - if(!(ctx->label=r_strdup(label))) + if(!(ctx->label=strdup(label))) ABORT(R_NO_MEMORY); ctx->gather_handler = gather_handler; @@ -453,39 +453,39 @@ nr_ice_media_stream_destroy(&s1); } - RFREE(ctx->label); + free(ctx->label); ctx->gather_handler = 0; - RFREE(ctx->stun_servers_cfg); + free(ctx->stun_servers_cfg); - RFREE(ctx->local_addrs); + free(ctx->local_addrs); - RFREE(ctx->target_for_default_local_address_lookup); + free(ctx->target_for_default_local_address_lookup); for (i = 0; i < ctx->turn_server_ct_cfg; i++) { - RFREE(ctx->turn_servers_cfg[i].username); + free(ctx->turn_servers_cfg[i].username); r_data_destroy(&ctx->turn_servers_cfg[i].password); } - RFREE(ctx->turn_servers_cfg); + free(ctx->turn_servers_cfg); f1=STAILQ_FIRST(&ctx->foundations); while(f1){ f2=STAILQ_NEXT(f1,entry); - RFREE(f1); + free(f1); f1=f2; } STAILQ_FOREACH_SAFE(id1, &ctx->ids, entry, id2){ STAILQ_REMOVE(&ctx->ids,id1,nr_ice_stun_id_,entry); - RFREE(id1); + free(id1); } nr_resolver_destroy(&ctx->resolver); nr_interface_prioritizer_destroy(&ctx->interface_prioritizer); nr_socket_factory_destroy(&ctx->socket_factory); - RFREE(ctx); + free(ctx); *ctxp=0; } @@ -843,7 +843,7 @@ int r,_status; if (ctx->target_for_default_local_address_lookup) { - RFREE(ctx->target_for_default_local_address_lookup); + free(ctx->target_for_default_local_address_lookup); ctx->target_for_default_local_address_lookup=0; } @@ -851,7 +851,7 @@ ABORT(R_NO_MEMORY); if ((r=nr_str_port_to_transport_addr(target_ip, target_port, IPPROTO_UDP, ctx->target_for_default_local_address_lookup))) { - RFREE(ctx->target_for_default_local_address_lookup); + free(ctx->target_for_default_local_address_lookup); ctx->target_for_default_local_address_lookup=0; ABORT(r); } @@ -1103,13 +1103,13 @@ if(r=nr_ice_random_string(buf,ICE_UFRAG_LEN)) ABORT(r); - if(!(*ufrag=r_strdup(buf))) + if(!(*ufrag=strdup(buf))) ABORT(r); _status=0; abort: if(_status) { - RFREE(*ufrag); + free(*ufrag); *ufrag = 0; } return(_status); @@ -1122,13 +1122,13 @@ if(r=nr_ice_random_string(buf,ICE_PWD_LEN)) ABORT(r); - if(!(*pwd=r_strdup(buf))) + if(!(*pwd=strdup(buf))) ABORT(r); _status=0; abort: if(_status) { - RFREE(*pwd); + free(*pwd); *pwd = 0; } return(_status); diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_media_stream.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_media_stream.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_media_stream.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_media_stream.c 2026-04-29 18:38:19.000000000 +0000 @@ -54,13 +54,13 @@ if(!(stream=RCALLOC(sizeof(nr_ice_media_stream)))) ABORT(R_NO_MEMORY); - if(!(stream->label=r_strdup(label))) + if(!(stream->label=strdup(label))) ABORT(R_NO_MEMORY); - if(!(stream->ufrag=r_strdup(ufrag))) + if(!(stream->ufrag=strdup(ufrag))) ABORT(R_NO_MEMORY); - if(!(stream->pwd=r_strdup(pwd))) + if(!(stream->pwd=strdup(pwd))) ABORT(R_NO_MEMORY); stream->ctx=ctx; @@ -100,7 +100,7 @@ nr_ice_turn_server *dst = &stream->turn_servers[i]; nr_ice_turn_server *src = &ctx->turn_servers_cfg[i]; memcpy(&dst->turn_server, &src->turn_server, sizeof(nr_ice_stun_server)); - dst->username = r_strdup(src->username); + dst->username = strdup(src->username); r_data_create(&dst->password, src->password->data, src->password->len); } stream->turn_server_ct = ctx->turn_server_ct_cfg; @@ -140,26 +140,26 @@ nr_ice_candidate_pair_destroy(&p1); } - RFREE(stream->label); + free(stream->label); - RFREE(stream->ufrag); - RFREE(stream->pwd); - RFREE(stream->r2l_user); - RFREE(stream->l2r_user); + free(stream->ufrag); + free(stream->pwd); + free(stream->r2l_user); + free(stream->l2r_user); r_data_zfree(&stream->r2l_pass); r_data_zfree(&stream->l2r_pass); - RFREE(stream->stun_servers); + free(stream->stun_servers); for (int i = 0; i < stream->turn_server_ct; i++) { - RFREE(stream->turn_servers[i].username); + free(stream->turn_servers[i].username); r_data_destroy(&stream->turn_servers[i].password); } - RFREE(stream->turn_servers); + free(stream->turn_servers); if(stream->timer) NR_async_timer_cancel(stream->timer); - RFREE(stream); + free(stream); return(0); } @@ -228,7 +228,7 @@ if(!(attrs=RCALLOC(sizeof(char *)*attrct))) ABORT(R_NO_MEMORY); for(index=0;indexufrag); attrs[index++]=tmp; - if(!(tmp=RMALLOC(100))) + if(!(tmp=(char*)malloc(100))) ABORT(R_NO_MEMORY); snprintf(tmp,100,"ice-pwd:%s",stream->pwd); attrs[index++]=tmp; @@ -278,9 +278,9 @@ if(_status){ if(attrs){ for(index=0;indexlabel=r_strdup(orig))) + if(!(cand->label=strdup(orig))) ABORT(R_NO_MEMORY); cand->ctx=ctx; @@ -358,8 +358,8 @@ nr_ice_candidate_destroy(&cand); } - RFREE(connection_address); - RFREE(rel_addr); + free(connection_address); + free(rel_addr); return(_status); } @@ -382,7 +382,7 @@ if (*str == '\0') ABORT(R_BAD_DATA); - RFREE(stream->ufrag); + free(stream->ufrag); if ((r=grab_token(&str, &stream->ufrag))) ABORT(r); } @@ -395,7 +395,7 @@ if (*str == '\0') ABORT(R_BAD_DATA); - RFREE(stream->pwd); + free(stream->pwd); if ((r=grab_token(&str, &stream->pwd))) ABORT(r); } @@ -488,7 +488,7 @@ #endif component_id = 0; /* prevent free */ - RFREE(connection_address); + free(connection_address); connection_address = 0; /* prevent free */ } } @@ -532,7 +532,7 @@ skip_whitespace(&str); //TODO: for now, just throw away; later put somewhere - RFREE(ice_option_tag); + free(ice_option_tag); ice_option_tag = 0; /* prevent free */ } @@ -558,9 +558,9 @@ r_log(LOG_ICE,LOG_WARNING,"ICE-PEER(%s): Error parsing attribute: %s",pctx->label,orig); } - RFREE(connection_address); - RFREE(component_id); - RFREE(ice_option_tag); + free(connection_address); + free(component_id); + free(ice_option_tag); return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_peer_ctx.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_peer_ctx.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_peer_ctx.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_peer_ctx.c 2026-04-29 18:38:19.000000000 +0000 @@ -56,7 +56,7 @@ pctx->state = NR_ICE_PEER_STATE_UNPAIRED; - if(!(pctx->label=r_strdup(label))) + if(!(pctx->label=strdup(label))) ABORT(R_NO_MEMORY); pctx->ctx=ctx; @@ -187,7 +187,7 @@ cand->trickled = trickled; if (mdns_addr) { - cand->mdns_addr = r_strdup(mdns_addr); + cand->mdns_addr = strdup(mdns_addr); if (!cand->mdns_addr) { ABORT(R_NO_MEMORY); } @@ -496,7 +496,7 @@ pctx->handler = 0; NR_async_timer_cancel(pctx->connected_cb_timer); - RFREE(pctx->label); + free(pctx->label); STAILQ_FOREACH_SAFE(str1, &pctx->peer_streams, entry, str2){ STAILQ_REMOVE(&pctx->peer_streams,str1,nr_ice_media_stream_,entry); @@ -511,7 +511,7 @@ pctx->trickle_grace_period_timer=0; } - RFREE(pctx); + free(pctx); *pctxp=0; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_socket.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_socket.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_socket.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/ice/ice_socket.c 2026-04-29 18:38:20.000000000 +0000 @@ -110,7 +110,7 @@ /* This has been deleted, prune... */ case NR_ICE_STUN_NONE: TAILQ_REMOVE(&sock->stun_ctxs,sc1,entry); - RFREE(sc1); + free(sc1); break; case NR_ICE_STUN_CLIENT: @@ -243,7 +243,7 @@ _status=0; abort: - if(_status) RFREE(sock); + if(_status) free(sock); return(_status); } @@ -268,10 +268,10 @@ /* Now clean up the STUN ctxs */ TAILQ_FOREACH_SAFE(s1, &isock->stun_ctxs, entry, s2){ TAILQ_REMOVE(&isock->stun_ctxs, s1, entry); - RFREE(s1); + free(s1); } - RFREE(isock); + free(isock); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_interface_prioritizer.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_interface_prioritizer.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_interface_prioritizer.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_interface_prioritizer.c 2026-04-29 18:38:20.000000000 +0000 @@ -66,7 +66,7 @@ ifp = *ifpp; *ifpp = 0; ifp->vtbl->destroy(&ifp->obj); - RFREE(ifp); + free(ifp); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_resolver.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_resolver.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_resolver.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_resolver.c 2026-04-29 18:38:20.000000000 +0000 @@ -65,7 +65,7 @@ resolver->vtbl->destroy(&resolver->obj); - RFREE(resolver); + free(resolver); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket.c 2026-04-29 18:38:20.000000000 +0000 @@ -75,7 +75,7 @@ if (sock->vtbl) sock->vtbl->destroy(&sock->obj); - RFREE(sock); + free(sock); return(0); } @@ -176,7 +176,7 @@ factoryp = *factorypp; *factorypp = NULL; factoryp->vtbl->destroy(&factoryp->obj); - RFREE(factoryp); + free(factoryp); return (0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_multi_tcp.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_multi_tcp.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_multi_tcp.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_multi_tcp.c 2026-04-29 18:38:19.000000000 +0000 @@ -66,7 +66,7 @@ nr_socket_destroy(&sock->inner); - RFREE(sock); + free(sock); return(0); } @@ -462,7 +462,7 @@ nr_tcp_socket_ctx_destroy(&tcpsock); } - RFREE(sock); + free(sock); return 0; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_wrapper.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_wrapper.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_wrapper.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/nr_socket_wrapper.c 2026-04-29 18:38:19.000000000 +0000 @@ -77,7 +77,7 @@ if (wrapper->vtbl) wrapper->vtbl->destroy(&wrapper->obj); - RFREE(wrapper); + free(wrapper); return 0; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/transport_addr_reg.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/transport_addr_reg.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/net/transport_addr_reg.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/net/transport_addr_reg.c 2026-04-29 18:38:20.000000000 +0000 @@ -116,9 +116,9 @@ _status=0; abort: - RFREE(protocol); - RFREE(ifname); - RFREE(address); + free(protocol); + free(ifname); + free(address); return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs-win32.c 2026-04-29 18:38:20.000000000 +0000 @@ -115,7 +115,7 @@ /* According to MSDN (see above) we have try GetAdapterAddresses() multiple times */ for (n = 0; n < 5; n++) { - AdapterAddresses = (PIP_ADAPTER_ADDRESSES) RMALLOC(buflen); + AdapterAddresses = (PIP_ADAPTER_ADDRESSES) malloc(buflen); if (AdapterAddresses == NULL) { r_log(NR_LOG_STUN, LOG_ERR, "Error allocating buf for GetAdaptersAddresses()"); ABORT(R_NO_MEMORY); @@ -126,7 +126,7 @@ break; } r_log(NR_LOG_STUN, LOG_ERR, "GetAdaptersAddresses() returned error (%d)", r); - RFREE(AdapterAddresses); + free(AdapterAddresses); AdapterAddresses = NULL; } @@ -197,7 +197,7 @@ _status = 0; abort: - RFREE(AdapterAddresses); + free(AdapterAddresses); return _status; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/addrs.c 2026-04-29 18:38:19.000000000 +0000 @@ -160,7 +160,7 @@ nr_local_addr *tmp = 0; int dest_index = 0; - tmp = RMALLOC(*count * sizeof(*tmp)); + tmp = (nr_local_addr*)malloc(*count * sizeof(*tmp)); if (!tmp) ABORT(R_NO_MEMORY); @@ -187,7 +187,7 @@ _status = 0; abort: - RFREE(tmp); + free(tmp); return _status; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_buffered_stun.c 2026-04-29 18:38:19.000000000 +0000 @@ -163,7 +163,7 @@ } /* TODO(ekr@rtfm.com): Check this */ - if (!(sock->buffer = RMALLOC(sock->buffer_size))) + if (!(sock->buffer = (UCHAR*)malloc(sock->buffer_size))) ABORT(R_NO_MEMORY); sock->read_state = NR_ICE_SOCKET_READ_NONE; @@ -200,7 +200,7 @@ *objp = 0; /* Free the buffer if needed */ - RFREE(sock->buffer); + free(sock->buffer); /* Cancel waiting on the socket */ if (sock->inner && !nr_socket_getfd(sock->inner, &fd)) { @@ -211,7 +211,7 @@ nr_p_buf_free_chain(sock->p_bufs, &sock->pending_writes); nr_p_buf_ctx_destroy(&sock->p_bufs); nr_socket_destroy(&sock->inner); - RFREE(sock); + free(sock); return 0; } @@ -239,7 +239,7 @@ if (len > NR_MAX_FRAME_SIZE) ABORT(R_FAILED); - if (!(frame = RMALLOC(len + sizeof(nr_frame_header)))) + if (!(frame = (nr_frame_header*)malloc(len + sizeof(nr_frame_header)))) ABORT(R_NO_MEMORY); frame->frame_length = htons(len); @@ -256,7 +256,7 @@ _status=0; abort: - RFREE(frame); + free(frame); return _status; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_turn.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_turn.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_turn.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/nr_socket_turn.c 2026-04-29 18:38:19.000000000 +0000 @@ -111,7 +111,7 @@ /* we don't own the socket, so don't destroy it */ - RFREE(sturn); + free(sturn); _status=0; return(_status); diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_build.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_build.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_build.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_build.c 2026-04-29 18:38:20.000000000 +0000 @@ -95,7 +95,7 @@ _status=0; abort: - if (_status) RFREE(req); + if (_status) free(req); return _status; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_client_ctx.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_client_ctx.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_client_ctx.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_client_ctx.c 2026-04-29 18:38:20.000000000 +0000 @@ -63,7 +63,7 @@ ctx->state=NR_STUN_CLIENT_STATE_INITTED; - if(!(ctx->label=r_strdup(label))) + if(!(ctx->label=strdup(label))) ABORT(R_NO_MEMORY); ctx->sock=sock; @@ -835,11 +835,11 @@ static void nr_stun_client_ctx_destroy_final(NR_SOCKET s, int b, void *cb_arg) { nr_stun_client_ctx *ctx=(nr_stun_client_ctx*)cb_arg; - RFREE(ctx->nonce); - RFREE(ctx->realm); + free(ctx->nonce); + free(ctx->realm); - RFREE(ctx->label); - RFREE(ctx); + free(ctx->label); + free(ctx); } int nr_stun_client_ctx_destroy(nr_stun_client_ctx **ctxp) diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_msg.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_msg.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_msg.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_msg.c 2026-04-29 18:38:20.000000000 +0000 @@ -102,7 +102,7 @@ nr_stun_message_attribute_destroy(*msg, &attr); } - RFREE(*msg); + free(*msg); *msg = 0; } @@ -141,7 +141,7 @@ a = *attr; TAILQ_REMOVE(&msg->attributes, a, entry); - RFREE(a); + free(a); *attr = 0; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_proc.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_proc.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_proc.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_proc.c 2026-04-29 18:38:19.000000000 +0000 @@ -421,7 +421,7 @@ #ifdef USE_TURN assert(_status == 0); /* TODO: !nn! cleanup after I reimplmement TURN */ #endif - RFREE(realm); + free(realm); return _status; } @@ -510,8 +510,8 @@ /* drop thru */ case NR_STUN_MAGIC_COOKIE: if (nr_stun_message_has_attribute(res, NR_STUN_ATTR_REALM, &attr)) { - RFREE(ctx->realm); - ctx->realm = r_strdup(attr->u.realm); + free(ctx->realm); + ctx->realm = strdup(attr->u.realm); if (!ctx->realm) ABORT(R_NO_MEMORY); } @@ -521,8 +521,8 @@ } if (nr_stun_message_has_attribute(res, NR_STUN_ATTR_NONCE, &attr)) { - RFREE(ctx->nonce); - ctx->nonce = r_strdup(attr->u.nonce); + free(ctx->nonce); + ctx->nonce = strdup(attr->u.nonce); if (!ctx->nonce) ABORT(R_NO_MEMORY); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_server_ctx.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_server_ctx.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_server_ctx.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/stun_server_ctx.c 2026-04-29 18:38:19.000000000 +0000 @@ -52,7 +52,7 @@ if(!(ctx=RCALLOC(sizeof(nr_stun_server_ctx)))) ABORT(R_NO_MEMORY); - if(!(ctx->label=r_strdup(label))) + if(!(ctx->label=strdup(label))) ABORT(R_NO_MEMORY); STAILQ_INIT(&ctx->clients); @@ -80,8 +80,8 @@ nr_stun_server_destroy_client(ctx->default_client); - RFREE(ctx->label); - RFREE(ctx); + free(ctx->label); + free(ctx); return(0); } @@ -94,10 +94,10 @@ if(!(clnt=RCALLOC(sizeof(nr_stun_server_client)))) ABORT(R_NO_MEMORY); - if(!(clnt->label=r_strdup(client_label))) + if(!(clnt->label=strdup(client_label))) ABORT(R_NO_MEMORY); - if(!(clnt->username=r_strdup(user))) + if(!(clnt->username=strdup(user))) ABORT(R_NO_MEMORY); if(r=r_data_copy(&clnt->password,pass)) @@ -416,11 +416,11 @@ if (!clnt) return 0; - RFREE(clnt->label); - RFREE(clnt->username); + free(clnt->label); + free(clnt->username); r_data_zfree(&clnt->password); - RFREE(clnt); + free(clnt); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/turn_client_ctx.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/turn_client_ctx.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/turn_client_ctx.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/stun/turn_client_ctx.c 2026-04-29 18:38:20.000000000 +0000 @@ -116,7 +116,7 @@ void nr_transport_addr_listnode_destroy(nr_transport_addr_listnode **listnode) { - RFREE(*listnode); + free(*listnode); *listnode = 0; } @@ -179,8 +179,8 @@ *ctxp = 0; nr_stun_client_ctx_destroy(&ctx->stun); - RFREE(ctx->realm); - RFREE(ctx->nonce); + free(ctx->realm); + free(ctx->nonce); while (!STAILQ_EMPTY(&ctx->addresses_tried)) { nr_transport_addr_listnode *listnode = STAILQ_FIRST(&ctx->addresses_tried); @@ -188,7 +188,7 @@ nr_transport_addr_listnode_destroy(&listnode); } - RFREE(ctx); + free(ctx); return 0; } @@ -198,25 +198,25 @@ { int _status; - RFREE(ctx->realm); - RFREE(ctx->nonce); + free(ctx->realm); + free(ctx->nonce); assert(realm); if (!realm) ABORT(R_BAD_ARGS); - ctx->realm=r_strdup(realm); + ctx->realm=strdup(realm); if (!ctx->realm) ABORT(R_NO_MEMORY); assert(nonce); if (!nonce) ABORT(R_BAD_ARGS); - ctx->nonce=r_strdup(nonce); + ctx->nonce=strdup(nonce); if (!ctx->nonce) ABORT(R_NO_MEMORY); - RFREE(ctx->stun->realm); - ctx->stun->realm = r_strdup(ctx->realm); + free(ctx->stun->realm); + ctx->stun->realm = strdup(ctx->realm); if (!ctx->stun->realm) ABORT(R_NO_MEMORY); @@ -434,15 +434,15 @@ /* Save the realm and nonce */ if (ctx->stun->realm && (!ctx->tctx->realm || strcmp(ctx->stun->realm, ctx->tctx->realm))) { - RFREE(ctx->tctx->realm); - ctx->tctx->realm = r_strdup(ctx->stun->realm); + free(ctx->tctx->realm); + ctx->tctx->realm = strdup(ctx->stun->realm); if (!ctx->tctx->realm) ABORT(R_NO_MEMORY); } if (ctx->stun->nonce && (!ctx->tctx->nonce || strcmp(ctx->stun->nonce, ctx->tctx->nonce))) { - RFREE(ctx->tctx->nonce); - ctx->tctx->nonce = r_strdup(ctx->stun->nonce); + free(ctx->tctx->nonce); + ctx->tctx->nonce = strdup(ctx->stun->nonce); if (!ctx->tctx->nonce) ABORT(R_NO_MEMORY); } @@ -545,11 +545,11 @@ STAILQ_INIT(&ctx->stun_ctxs); STAILQ_INIT(&ctx->permissions); - if(!(ctx->label=r_strdup(label))) + if(!(ctx->label=strdup(label))) ABORT(R_NO_MEMORY); ctx->sock=sock; - ctx->username = r_strdup(username); + ctx->username = strdup(username); if (!ctx->username) ABORT(R_NO_MEMORY); @@ -595,17 +595,17 @@ nr_turn_client_deallocate(ctx); /* Cancel frees the rest of our data */ - RFREE(ctx->label); + free(ctx->label); ctx->label = 0; nr_turn_client_cancel(ctx); - RFREE(ctx->username); + free(ctx->username); ctx->username = 0; r_data_destroy(&ctx->password); - RFREE(ctx->nonce); + free(ctx->nonce); ctx->nonce = 0; - RFREE(ctx->realm); + free(ctx->realm); ctx->realm = 0; /* Destroy the STUN client ctxs */ @@ -622,7 +622,7 @@ nr_turn_permission_destroy(&perm); } - RFREE(ctx); + free(ctx); return(0); } @@ -1269,7 +1269,7 @@ perm = *permp; *permp = 0; - RFREE(perm); + free(perm); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/util/ice_util.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/util/ice_util.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nICEr/src/util/ice_util.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nICEr/src/util/ice_util.c 2026-04-29 18:38:20.000000000 +0000 @@ -49,7 +49,7 @@ va_end(ap); - if(!(out=RMALLOC(len+1))) + if(!(out=(char*)malloc(len+1))) ABORT(R_NO_MEMORY); *outp=out; diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/nrappkit.gyp 2026-04-29 18:38:19.000000000 +0000 @@ -54,7 +54,6 @@ # './src/util/libekr/r_list.c', # './src/util/libekr/r_list.h', './src/util/libekr/r_macros.h', - './src/util/libekr/r_memory.c', './src/util/libekr/r_memory.h', './src/util/libekr/r_replace.c', './src/util/libekr/r_thread.h', diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/log/r_log.c 2026-04-29 18:38:19.000000000 +0000 @@ -183,7 +183,7 @@ i=log_type_ct; /* Initial registration completed, increment log_type_ct */ - log_types[i].facility_name=r_strdup(facility_name); + log_types[i].facility_name=strdup(facility_name); *log_facility=log_type_ct; log_type_ct++; @@ -223,7 +223,7 @@ _status=0; abort: if(_status) - RFREE(buf); + free(buf); return(_status); } @@ -313,7 +313,7 @@ if(!r_logging(facility,level)) return(0); - hex=RMALLOC((len*2)+1); + hex=(char*)malloc((len*2)+1); if (!hex) return(R_FAILED); @@ -325,7 +325,7 @@ else r_log(facility,level,"%s",hex); - RFREE(hex); + free(hex); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/c2ru.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/c2ru.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/c2ru.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/c2ru.c 2026-04-29 18:38:19.000000000 +0000 @@ -170,33 +170,13 @@ return (_status); } -#define NRFREE(func, type) \ -int \ -func(type *in) \ -{ \ - if (in) \ - RFREE(in); \ - return 0; \ -} - -NRFREE(nr_c2ru_free_char, char) -NRFREE(nr_c2ru_free_uchar, UCHAR) -NRFREE(nr_c2ru_free_int2, INT2) -NRFREE(nr_c2ru_free_uint2, UINT2) -NRFREE(nr_c2ru_free_int4, INT4) -NRFREE(nr_c2ru_free_uint4, UINT4) -NRFREE(nr_c2ru_free_int8, INT8) -NRFREE(nr_c2ru_free_uint8, UINT8) -NRFREE(nr_c2ru_free_double, double) - - int nr_c2ru_free_string(char **in) { if (*in) - RFREE(*in); + free(*in); if (in) - RFREE(in); + free(in); return 0; } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.c 2026-04-29 18:38:19.000000000 +0000 @@ -245,7 +245,7 @@ _status=0; abort: - RFREE(children); + free(children); return(_status); } @@ -268,7 +268,7 @@ return(_status); } -// convenience methods, call RFREE on the returned data +// convenience methods, call free on the returned data int NR_reg_alloc_data(NR_registry name, Data *data) { @@ -280,7 +280,7 @@ if ((r=NR_reg_get_length(name, &length))) ABORT(r); - if (!(tmp = (void*)RMALLOC(length))) + if (!(tmp = (UCHAR*)malloc(length))) ABORT(R_NO_MEMORY); if ((r=NR_reg_get_bytes(name, tmp, length, &sanity_check))) @@ -294,7 +294,7 @@ _status=0; abort: if (_status) { - if (tmp) RFREE(tmp); + if (tmp) free(tmp); } return(_status); } @@ -309,7 +309,7 @@ if ((r=NR_reg_get_length(name, &length))) ABORT(r); - if (!(tmp = (void*)RMALLOC(length+1))) + if (!(tmp = (char*)malloc(length+1))) ABORT(R_NO_MEMORY); if ((r=NR_reg_get_string(name, tmp, length+1))) @@ -322,7 +322,7 @@ _status=0; abort: if (_status) { - if (tmp) RFREE(tmp); + if (tmp) free(tmp); } return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry.h 2026-04-29 18:38:19.000000000 +0000 @@ -137,7 +137,7 @@ int NR_reg_dump(void); -/* convenience methods, call RFREE on the returned data */ +/* convenience methods, call free on the returned data */ int NR_reg_alloc_data(NR_registry name, Data *data); int NR_reg_alloc_string(NR_registry name, char **data); diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registry_local.c 2026-04-29 18:38:20.000000000 +0000 @@ -297,7 +297,7 @@ else r_log(NR_LOG_REGISTRY, LOG_INFO, "%s: %s", name, data); if (freeit) - RFREE(data); + free(data); } _status=0; @@ -309,7 +309,7 @@ int nr_reg_rfree(void *ptr) { - RFREE(ptr); + free(ptr); return 0; } @@ -378,7 +378,7 @@ nr_reg_type_name(((nr_registry_node*)node)->type), (_status ? "FAILED" : "succeeded"), data); if (freeit) - RFREE(data); + free(data); } return(_status); } @@ -409,7 +409,7 @@ nr_reg_type_name(((nr_registry_node*)node)->type), (_status ? "FAILED" : "succeeded"), data); if (freeit) - RFREE(data); + free(data); } return(_status); } @@ -440,7 +440,7 @@ } if (alloc > 0) { - s = (void*)RMALLOC(alloc); + s = (char*)malloc(alloc); if (!s) return ""; @@ -517,7 +517,7 @@ _status=0; abort: - if (free_node) RFREE(node); + if (free_node) free(node); return(_status); } @@ -584,7 +584,7 @@ _status=0; abort: - if (node && free_node) RFREE(node); + if (node && free_node) free(node); return(_status); } @@ -661,7 +661,7 @@ _status=0; abort: if (_status) { - if (node && free_node) RFREE(node); + if (node && free_node) free(node); } return(_status); } @@ -735,7 +735,7 @@ char *parent = 0; char *dot = 0; - if ((parent = r_strdup(name)) == 0) + if ((parent = strdup(name)) == 0) ABORT(R_NO_MEMORY); if ((dot = strrchr(parent, '.')) != 0) { @@ -746,7 +746,7 @@ _status=0; abort: - if (parent) RFREE(parent); + if (parent) free(parent); return(_status); } @@ -896,7 +896,7 @@ _status=0; abort: - if (free_node) RFREE(node); + if (free_node) free(node); return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registrycb.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registrycb.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registrycb.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/registry/registrycb.c 2026-04-29 18:38:20.000000000 +0000 @@ -181,7 +181,7 @@ r_log(NR_LOG_REGISTRY, LOG_DEBUG, "register callback %p on '%s' for '%s' %s", cb, name, nr_reg_action_name(action), (_status ? "FAILED" : "succeeded")); if (_status) { - if (create_info && info) RFREE(info); + if (create_info && info) free(info); if (create_assoc && assoc) nr_reg_assoc_destroy(&assoc); } return(_status); @@ -274,7 +274,7 @@ int nr_reg_info_free(void *ptr) { - RFREE(ptr); + free(ptr); return 0; } @@ -293,7 +293,7 @@ int count; if (tmp == 0) { - if (!(tmp = (char*)r_strdup(name))) + if (!(tmp = (char*)strdup(name))) ABORT(R_NO_MEMORY); free_tmp = 1; } @@ -351,7 +351,7 @@ _status=0; abort: - if (free_tmp && tmp != 0) RFREE(tmp); + if (free_tmp && tmp != 0) free(tmp); return(_status); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_assoc.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_assoc.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_assoc.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_assoc.c 2026-04-29 18:38:19.000000000 +0000 @@ -160,8 +160,8 @@ for(i=0;isize;i++) destroy_assoc_chain(assoc->chains[i]); - RFREE(assoc->chains); - RFREE(*assocp); + free(assoc->chains); + free(*assocp); return(0); } @@ -176,9 +176,9 @@ if(chain->destroy) chain->destroy(chain->data); - RFREE(chain->key); + free(chain->key); - RFREE(chain); + free(chain); chain=nxt; } @@ -220,7 +220,7 @@ else ptr->data=old->data; - if(!(ptr->key=(char *)RMALLOC(old->key_len))) + if(!(ptr->key=(char *)malloc(old->key_len))) ABORT(R_NO_MEMORY); memcpy(ptr->key,old->key,ptr->key_len=old->key_len); } @@ -295,7 +295,7 @@ if(!(new_bucket=(r_assoc_el *)RCALLOC(sizeof(r_assoc_el)))) ABORT(R_NO_MEMORY); - if(!(new_bucket->key=(char *)RMALLOC(len))) + if(!(new_bucket->key=(char *)malloc(len))) ABORT(R_NO_MEMORY); memcpy(new_bucket->key,key,len); new_bucket->key_len=len; @@ -323,8 +323,8 @@ _status=0; abort: if(_status && new_bucket){ - RFREE(new_bucket->key); - RFREE(new_bucket); + free(new_bucket->key); + free(new_bucket); } return(_status); } @@ -357,8 +357,8 @@ if(bucket->destroy) bucket->destroy(bucket->data); - RFREE(bucket->key); - RFREE(bucket); + free(bucket->key); + free(bucket); assoc->num_elements--; return(0); @@ -479,8 +479,8 @@ iter->prev->destroy(iter->prev->data); iter->assoc->num_elements--; - RFREE(iter->prev->key); - RFREE(iter->prev); + free(iter->prev->key); + free(iter->prev); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_data.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_data.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_data.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_data.c 2026-04-29 18:38:20.000000000 +0000 @@ -91,7 +91,7 @@ if(!(d_=(Data *)RCALLOC(sizeof(Data)))) ABORT(R_NO_MEMORY); - if(!(d_->data=(UCHAR *)RMALLOC(l))) + if(!(d_->data=(UCHAR *)malloc(l))) ABORT(R_NO_MEMORY); if (d) { @@ -114,7 +114,7 @@ { int _status; - if(!(d->data=(UCHAR *)RMALLOC(l))) + if(!(d->data=(UCHAR *)malloc(l))) ABORT(R_NO_MEMORY); d->len=l; @@ -146,7 +146,7 @@ int r_data_make(Data *dp, const UCHAR *d, size_t l) { - if(!(dp->data=(UCHAR *)RMALLOC(l))) + if(!(dp->data=(UCHAR *)malloc(l))) ERETURN(R_NO_MEMORY); memcpy(dp->data,d,l); @@ -161,9 +161,9 @@ return(0); if((*dp)->data) - RFREE((*dp)->data); + free((*dp)->data); - RFREE(*dp); + free(*dp); *dp=0; return(0); @@ -179,7 +179,7 @@ d=(Data *)v; r_data_zfree(d); - RFREE(d); + free(d); return(0); } @@ -195,14 +195,14 @@ r_data_zfree(d); *v=0; - RFREE(d); + free(d); return(0); } int r_data_copy(Data *dst, Data *src) { - if(!(dst->data=(UCHAR *)RMALLOC(src->len))) + if(!(dst->data=(UCHAR *)malloc(src->len))) ERETURN(R_NO_MEMORY); memcpy(dst->data,src->data,dst->len=src->len); return(0); @@ -215,7 +215,7 @@ if(!d->data) return(0); memset(d->data,0,d->len); - RFREE(d->data); + free(d->data); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_list.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_list.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_list.c 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_list.c 2026-04-29 18:38:19.000000000 +0000 @@ -133,10 +133,10 @@ el->destroy(&el->data); el_t=el; el=el->next; - RFREE(el_t); + free(el_t); } - RFREE(list); + free(list); *listp=0; return(0); diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_memory.h thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_memory.h --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_memory.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/libekr/r_memory.h 2026-04-29 18:38:19.000000000 +0000 @@ -40,62 +40,13 @@ #ifndef _r_memory_h #define _r_memory_h -#define R_MALLOC_X 2 - -#include "r_types.h" - -void *r_malloc(int type, size_t size); -void *r_malloc_compat(size_t size); -void *r_calloc(int type,size_t number,size_t size); -void r_free (void *ptr); -void *r_realloc(void *ptr,size_t size); -char *r_strdup(const char *str); -int r_mem_get_usage(UINT4 *usage); -int r_memory_dump_stats(void); - -#ifdef NO_MALLOC_REPLACE - -#ifndef RMALLOC -#define RMALLOC(a) malloc(a) -#endif - #ifndef RCALLOC #define RCALLOC(a) calloc(1,a) #endif -#ifndef RFREE -#define RFREE(a) if(a) free(a) -#endif - #ifndef RREALLOC #define RREALLOC(a,b) realloc(a,b) #endif -#else - - -#ifndef R_MALLOC_TYPE -#define R_MALLOC_TYPE 0 -#endif - -#ifndef RMALLOC -#define RMALLOC(a) r_malloc(R_MALLOC_TYPE,a) -#endif - -#ifndef RCALLOC -#define RCALLOC(a) r_calloc(R_MALLOC_TYPE,1,a) -#endif - -#ifndef RFREE -#define RFREE(a) if(a) r_free(a) -#endif - -#ifndef RREALLOC -#define RREALLOC(a,b) r_realloc(a,b) -#endif - -#endif - - #endif diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/p_buf.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/p_buf.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/p_buf.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/p_buf.c 2026-04-29 18:38:20.000000000 +0000 @@ -78,7 +78,7 @@ nr_p_buf_destroy_chain(&ctx->free_list); - RFREE(ctx); + free(ctx); *ctxp=0; return(0); @@ -97,7 +97,7 @@ else { if(!(buf=(nr_p_buf *)RCALLOC(sizeof(nr_p_buf)))) ABORT(R_NO_MEMORY); - if(!(buf->data=(UCHAR *)RMALLOC(ctx->buf_size))) + if(!(buf->data=(UCHAR *)malloc(ctx->buf_size))) ABORT(R_NO_MEMORY); buf->size=ctx->buf_size; } @@ -195,8 +195,8 @@ if(!buf) return(0); - RFREE(buf->data); - RFREE(buf); + free(buf->data); + free(buf); return(0); } diff -Nru thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c --- thunderbird-140.10.0esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/media/webrtc/transport/third_party/nrappkit/src/util/util.c 2026-04-29 18:38:20.000000000 +0000 @@ -62,7 +62,7 @@ char *ret=0; int _status; - if(!(ret=(char *)RMALLOC(len))) + if(!(ret=(char *)malloc(len))) ABORT(R_NO_MEMORY); if(base[strlen(base)-1]!='/'){ sprintf(ret,"%s/%s",base,name); diff -Nru thunderbird-140.10.0esr/dom/security/ReferrerInfo.cpp thunderbird-140.10.1esr/dom/security/ReferrerInfo.cpp --- thunderbird-140.10.0esr/dom/security/ReferrerInfo.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/security/ReferrerInfo.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -22,13 +22,16 @@ #include "nsStreamUtils.h" #include "ReferrerInfo.h" +#include "ipc/IPCMessageUtilsSpecializations.h" #include "mozilla/BasePrincipal.h" #include "mozilla/ContentBlockingAllowList.h" #include "mozilla/net/CookieJarSettings.h" #include "mozilla/net/HttpBaseChannel.h" #include "mozilla/dom/Document.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/FetchIPCTypes.h" #include "mozilla/dom/RequestBinding.h" +#include "mozilla/ipc/URIUtils.h" #include "mozilla/StaticPrefs_network.h" #include "mozilla/StorageAccess.h" #include "mozilla/StyleSheet.h" @@ -988,6 +991,62 @@ mOverridePolicyByDefault(rhs.mOverridePolicyByDefault), mComputedReferrer(rhs.mComputedReferrer) {} +void ReferrerInfo::Serialize(IPC::MessageWriter* aWriter) const { + MOZ_ASSERT(mInitialized); + nsCOMPtr originalReferrer = mOriginalReferrer; + WriteParam(aWriter, originalReferrer.get()); + WriteParam(aWriter, mPolicy); + WriteParam(aWriter, mOriginalPolicy); + WriteParam(aWriter, mSendReferrer); + WriteParam(aWriter, mOverridePolicyByDefault); + WriteParam(aWriter, mComputedReferrer); +} + +// static +bool ReferrerInfo::Deserialize(IPC::MessageReader* aReader, + RefPtr* aResult) { + RefPtr originalReferrer; + if (!ReadParam(aReader, &originalReferrer)) { + return false; + } + + ReferrerPolicyEnum policy; + if (!ReadParam(aReader, &policy)) { + return false; + } + + ReferrerPolicyEnum originalPolicy; + if (!ReadParam(aReader, &originalPolicy)) { + return false; + } + + bool sendReferrer; + if (!ReadParam(aReader, &sendReferrer)) { + return false; + } + + bool overridePolicyByDefault; + if (!ReadParam(aReader, &overridePolicyByDefault)) { + return false; + } + + Maybe computedReferrer; + if (!ReadParam(aReader, &computedReferrer)) { + return false; + } + + RefPtr info = new ReferrerInfo(); + info->mOriginalReferrer = originalReferrer; + info->mPolicy = policy; + info->mOriginalPolicy = originalPolicy; + info->mSendReferrer = sendReferrer; + info->mInitialized = true; + info->mOverridePolicyByDefault = overridePolicyByDefault; + info->mComputedReferrer = std::move(computedReferrer); + *aResult = info.forget(); + return true; +} + already_AddRefed ReferrerInfo::Clone() const { RefPtr copy(new ReferrerInfo(*this)); return copy.forget(); diff -Nru thunderbird-140.10.0esr/dom/security/ReferrerInfo.h thunderbird-140.10.1esr/dom/security/ReferrerInfo.h --- thunderbird-140.10.0esr/dom/security/ReferrerInfo.h 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/security/ReferrerInfo.h 2026-04-29 18:38:20.000000000 +0000 @@ -14,6 +14,11 @@ #include "mozilla/HashFunctions.h" #include "mozilla/dom/ReferrerPolicyBinding.h" +namespace IPC { +class MessageReader; +class MessageWriter; +} // namespace IPC + #define REFERRERINFO_CONTRACTID "@mozilla.org/referrer-info;1" // 041a129f-10ce-4bda-a60d-e027a26d5ed0 #define REFERRERINFO_CID \ @@ -74,6 +79,10 @@ // create an exact copy of the ReferrerInfo already_AddRefed Clone() const; + void Serialize(IPC::MessageWriter* aWriter) const; + static bool Deserialize(IPC::MessageReader* aReader, + RefPtr* aResult); + // create an copy of the ReferrerInfo with new referrer policy already_AddRefed CloneWithNewPolicy( ReferrerPolicyEnum aPolicy) const; diff -Nru thunderbird-140.10.0esr/dom/security/trusted-types/TrustedTypeUtils.cpp thunderbird-140.10.1esr/dom/security/trusted-types/TrustedTypeUtils.cpp --- thunderbird-140.10.0esr/dom/security/trusted-types/TrustedTypeUtils.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/security/trusted-types/TrustedTypeUtils.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -231,6 +231,7 @@ AutoTArray arguments = {trustedTypeName, sink}; + SequenceRooter rooter(cx, &arguments); nsString policyValue; if constexpr (std::is_same_v) { diff -Nru thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerOp.cpp thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerOp.cpp --- thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerOp.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerOp.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -1865,10 +1865,14 @@ GetCurrentSerialEventTarget(), __func__, [self, globalObjectAsSupports]( SafeRefPtr&& aPreloadResponse) { - self->mPreloadResponse->MaybeResolve( - MakeRefPtr(globalObjectAsSupports, - std::move(aPreloadResponse), nullptr)); + // let's complete the promise holder before MaybeResolve self->mPreloadResponseAvailablePromiseRequestHolder.Complete(); + RefPtr preloadResponse = self->mPreloadResponse; + if (preloadResponse) { + preloadResponse->MaybeResolve( + MakeRefPtr(globalObjectAsSupports, + std::move(aPreloadResponse), nullptr)); + } }, [self](int) { self->mPreloadResponseAvailablePromiseRequestHolder.Complete(); @@ -1907,10 +1911,14 @@ ->Then( GetCurrentSerialEventTarget(), __func__, [self, globalObjectAsSupports](ResponseEndArgs&& aArgs) { + // let's complete the promise holder before MaybeReject + self->mPreloadResponseEndPromiseRequestHolder.Complete(); if (aArgs.endReason() == FetchDriverObserver::eAborted) { - self->mPreloadResponse->MaybeReject(NS_ERROR_DOM_ABORT_ERR); + RefPtr preloadResponse = self->mPreloadResponse; + if (preloadResponse) { + preloadResponse->MaybeReject(NS_ERROR_DOM_ABORT_ERR); + } } - self->mPreloadResponseEndPromiseRequestHolder.Complete(); }, [self](int) { self->mPreloadResponseEndPromiseRequestHolder.Complete(); diff -Nru thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerPrivate.cpp thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerPrivate.cpp --- thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerPrivate.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerPrivate.cpp 2026-04-29 18:38:19.000000000 +0000 @@ -771,7 +771,7 @@ OriginTrials(), std::move(serviceWorkerData), regInfo->AgentClusterId(), remoteType.unwrap()); - mRemoteWorkerData.referrerInfo() = MakeAndAddRef(); + mRemoteWorkerData.referrerInfo() = MakeAndAddRef(nullptr); // This fills in the rest of mRemoteWorkerData.serviceWorkerData(). RefreshRemoteWorkerData(regInfo); diff -Nru thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp --- thunderbird-140.10.0esr/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/serviceworkers/ServiceWorkerRegistrationParent.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -9,6 +9,7 @@ #include #include "ServiceWorkerRegistrationProxy.h" +#include "nsNetUtil.h" namespace mozilla::dom { @@ -89,6 +90,9 @@ IPCResult ServiceWorkerRegistrationParent::RecvSetNavigationPreloadHeader( const nsACString& aHeader, SetNavigationPreloadHeaderResolver&& aResolver) { + if (!NS_IsReasonableHTTPHeaderValue(aHeader)) { + return IPC_FAIL(this, "Invalid navigation preload header value"); + } if (!mProxy) { aResolver(false); return IPC_OK(); diff -Nru thunderbird-140.10.0esr/dom/workers/loader/CacheLoadHandler.cpp thunderbird-140.10.1esr/dom/workers/loader/CacheLoadHandler.cpp --- thunderbird-140.10.0esr/dom/workers/loader/CacheLoadHandler.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/dom/workers/loader/CacheLoadHandler.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -52,7 +52,8 @@ JS::Handle aValue, ErrorResult& aRv) { AssertIsOnMainThread(); - if (mRequestHandle->IsEmpty()) { + // skip to schedule execution if it has been scheduled already. + if (mRequestHandle->mExecutionScheduled) { return; } WorkerLoadContext* loadContext = mRequestHandle->GetContext(); @@ -75,7 +76,8 @@ JS::Handle aValue, ErrorResult& aRv) { AssertIsOnMainThread(); - if (mRequestHandle->IsEmpty()) { + // skip to schedule execution if it has been scheduled already. + if (mRequestHandle->mExecutionScheduled) { return; } WorkerLoadContext* loadContext = mRequestHandle->GetContext(); @@ -267,6 +269,11 @@ mPump->Cancel(aRv); mPump = nullptr; } + + if (mRequestHandle->mExecutionScheduled) { + return; + } + if (mRequestHandle->IsEmpty()) { return; } @@ -281,7 +288,12 @@ loadContext->mCachePromise = nullptr; - mRequestHandle->LoadingFinished(aRv); + if (loadContext->mLoadingFinished) { + loadContext->mLoadResult = aRv; + mRequestHandle->MaybeExecuteFinishedScripts(); + } else { + mRequestHandle->LoadingFinished(aRv); + } } void CacheLoadHandler::Load(Cache* aCache) { diff -Nru thunderbird-140.10.0esr/gfx/2d/Swizzle.cpp thunderbird-140.10.1esr/gfx/2d/Swizzle.cpp --- thunderbird-140.10.0esr/gfx/2d/Swizzle.cpp 2026-04-21 14:52:52.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/2d/Swizzle.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -868,7 +868,7 @@ } template -static void SwizzleChunkOpaqueCopy(const uint8_t*& aSrc, uint8_t* aDst, +static void SwizzleChunkOpaqueCopy(const uint8_t*& aSrc, uint8_t*& aDst, int32_t aLength) { const uint8_t* end = aSrc + 4 * aLength; do { diff -Nru thunderbird-140.10.0esr/gfx/angle/checkout/src/compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.cpp thunderbird-140.10.1esr/gfx/angle/checkout/src/compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.cpp --- thunderbird-140.10.0esr/gfx/angle/checkout/src/compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/angle/checkout/src/compiler/translator/tree_ops/d3d/AddDefaultReturnStatements.cpp 2026-04-29 18:38:21.000000000 +0000 @@ -29,6 +29,10 @@ } TIntermBlock *bodyNode = node->getBody(); + if (bodyNode->getSequence()->empty()) + { + return true; + } TIntermBranch *returnNode = bodyNode->getSequence()->back()->getAsBranchNode(); if (returnNode != nullptr && returnNode->getFlowOp() == EOpReturn) { diff -Nru thunderbird-140.10.0esr/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp thunderbird-140.10.1esr/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp --- thunderbird-140.10.0esr/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/angle/checkout/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -2064,8 +2064,14 @@ GetLineLoopIndices(indices, type, static_cast(count), glState.isPrimitiveRestartEnabled(), &mScratchIndexDataBuffer); - unsigned int spaceNeeded = - static_cast(sizeof(GLuint) * mScratchIndexDataBuffer.size()); + + uint64_t spaceNeeded64 = sizeof(GLuint) * mScratchIndexDataBuffer.size(); + ANGLE_CHECK(GetImplAs(context), spaceNeeded64 <= std::numeric_limits::max(), + "Failed to create a 32-bit looping index buffer for " + "a GL_LINE_LOOP of <32-bit element type; too many indices required.", + GL_OUT_OF_MEMORY); + int spaceNeeded = static_cast(spaceNeeded64); + ANGLE_TRY( mLineLoopIB->reserveBufferSpace(context, spaceNeeded, gl::DrawElementsType::UnsignedInt)); @@ -2146,8 +2152,12 @@ GetTriFanIndices(indexPointer, type, count, glState.isPrimitiveRestartEnabled(), &mScratchIndexDataBuffer); - const unsigned int spaceNeeded = - static_cast(mScratchIndexDataBuffer.size() * sizeof(unsigned int)); + uint64_t spaceNeeded64 = mScratchIndexDataBuffer.size() * sizeof(unsigned int); + ANGLE_CHECK(GetImplAs(context), spaceNeeded64 <= std::numeric_limits::max(), + "Failed to create a 32-bit looping index buffer for " + "a GL_TRIANGLE_FAN of <32-bit element type; too many indices required.", + GL_OUT_OF_MEMORY); + int spaceNeeded = static_cast(spaceNeeded64); ANGLE_TRY(mTriangleFanIB->reserveBufferSpace(context, spaceNeeded, gl::DrawElementsType::UnsignedInt)); diff -Nru thunderbird-140.10.0esr/gfx/layers/BufferTexture.cpp thunderbird-140.10.1esr/gfx/layers/BufferTexture.cpp --- thunderbird-140.10.0esr/gfx/layers/BufferTexture.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/layers/BufferTexture.cpp 2026-04-29 18:38:21.000000000 +0000 @@ -84,7 +84,7 @@ LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags, - IShmemAllocator* aAllocator); + LayersIPCChannel* aAllocator); virtual TextureData* CreateSimilar( LayersIPCChannel* aAllocator, LayersBackend aLayersBackend, @@ -95,25 +95,55 @@ virtual void Deallocate(LayersIPCChannel* aAllocator) override; + class ShmemHolder final { + public: + NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ShmemHolder) + + ShmemHolder(LayersIPCChannel* aAllocator, mozilla::ipc::Shmem aShmem) + : mAllocator(aAllocator), mShmem(std::move(aShmem)) {} + mozilla::ipc::Shmem& GetShmem() { return mShmem; } + void SetDeallocShmem() { mDeallocShmem = true; } + + const RefPtr mAllocator; + + protected: + ~ShmemHolder() { + if (mDeallocShmem) { + mAllocator->DeallocShmem(mShmem); + } + } + + mozilla::ipc::Shmem mShmem; + mozilla::Atomic mDeallocShmem{false}; + }; + ShmemTextureData(const BufferDescriptor& aDesc, - gfx::BackendType aMoz2DBackend, mozilla::ipc::Shmem aShmem) - : BufferTextureData(aDesc, aMoz2DBackend), mShmem(aShmem) { - MOZ_ASSERT(mShmem.Size()); + gfx::BackendType aMoz2DBackend, RefPtr& aShmemHolder) + : BufferTextureData(aDesc, aMoz2DBackend), mShmemHolder(aShmemHolder) { + MOZ_ASSERT(mShmemHolder); + MOZ_ASSERT(mShmemHolder->GetShmem().Size()); } - virtual uint8_t* GetBuffer() override { return mShmem.get(); } + virtual uint8_t* GetBuffer() override { + return mShmemHolder->GetShmem().get(); + } - virtual size_t GetBufferSize() override { return mShmem.Size(); } + virtual size_t GetBufferSize() override { + return mShmemHolder->GetShmem().Size(); + } + + virtual void OnBorrowDrawTarget(gfx::DrawTarget* aDrawTarget) override; protected: - mozilla::ipc::Shmem mShmem; + const RefPtr mShmemHolder; + gfx::UserDataKey mShmemHolderKey = {0}; }; BufferTextureData* BufferTextureData::Create( gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::BackendType aMoz2DBackend, LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags, - mozilla::ipc::IShmemAllocator* aAllocator, bool aIsSameProcess) { + LayersIPCChannel* aAllocator, bool aIsSameProcess) { if (!aAllocator || aIsSameProcess) { return MemoryTextureData::Create(aSize, aFormat, aMoz2DBackend, aLayersBackend, aFlags, aAllocFlags, @@ -144,7 +174,9 @@ return nullptr; } - return new ShmemTextureData(aDesc, aMoz2DBackend, shm); + RefPtr shmemHolder = + new ShmemTextureData::ShmemHolder(aAllocator, shm); + return new ShmemTextureData(aDesc, aMoz2DBackend, shmemHolder); } } @@ -240,6 +272,35 @@ return ImageDataSerializer::FormatFromBufferDescriptor(mDescriptor); } +struct ShmemHolderUserData { + explicit ShmemHolderUserData(ShmemTextureData::ShmemHolder* aShmemHolder) + : mShmemHolder(aShmemHolder) {} + ~ShmemHolderUserData() {} + RefPtr mShmemHolder; +}; + +void DeleteShmemHolderUserData(void* aClosure) { + ShmemHolderUserData* data = reinterpret_cast(aClosure); + auto* eventTarget = data->mShmemHolder->mAllocator->GetThread(); + + if (!eventTarget->IsOnCurrentThread()) { + RefPtr runnable = + NS_NewRunnableFunction("DeleteShmemHolderUserData::Runnable", + [wrapper = std::move(data->mShmemHolder)]() {}); + eventTarget->Dispatch(runnable.forget()); + } + + delete data; +} + +void ShmemTextureData::OnBorrowDrawTarget(gfx::DrawTarget* aDrawTarget) { + if (!aDrawTarget) { + return; + } + auto* data = new ShmemHolderUserData(mShmemHolder); + aDrawTarget->AddUserData(&mShmemHolderKey, data, DeleteShmemHolderUserData); +} + already_AddRefed BufferTextureData::BorrowDrawTarget() { if (mDescriptor.type() != BufferDescriptor::TRGBDescriptor) { return nullptr; @@ -477,8 +538,8 @@ return false; } - aOutDescriptor = - SurfaceDescriptorBuffer(mDescriptor, MemoryOrShmem(std::move(mShmem))); + aOutDescriptor = SurfaceDescriptorBuffer( + mDescriptor, MemoryOrShmem(mShmemHolder->GetShmem())); return true; } @@ -489,10 +550,11 @@ LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags, - IShmemAllocator* aAllocator) { + LayersIPCChannel* aAllocator) { MOZ_ASSERT(aAllocator); // Should have used CreateForYCbCr. MOZ_ASSERT(aFormat != gfx::SurfaceFormat::YUV420); + MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT)); if (!aAllocator) { return nullptr; @@ -520,8 +582,9 @@ } BufferDescriptor descriptor = RGBDescriptor(aSize, aFormat); - - return new ShmemTextureData(descriptor, aMoz2DBackend, shm); + RefPtr shmemHolder = + new ShmemTextureData::ShmemHolder(aAllocator, shm); + return new ShmemTextureData(descriptor, aMoz2DBackend, shmemHolder); } TextureData* ShmemTextureData::CreateSimilar( @@ -537,7 +600,8 @@ gfxCriticalNote << "No allocator in ShmemTextureData::Deallocate"; return; } - aAllocator->DeallocShmem(mShmem); + MOZ_ASSERT(aAllocator == mShmemHolder->mAllocator); + mShmemHolder->SetDeallocShmem(); } } // namespace layers diff -Nru thunderbird-140.10.0esr/gfx/layers/BufferTexture.h thunderbird-140.10.1esr/gfx/layers/BufferTexture.h --- thunderbird-140.10.0esr/gfx/layers/BufferTexture.h 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/layers/BufferTexture.h 2026-04-29 18:38:20.000000000 +0000 @@ -77,12 +77,14 @@ virtual size_t GetBufferSize() = 0; + virtual void OnBorrowDrawTarget(gfx::DrawTarget* aDrawTarget) {} + protected: static BufferTextureData* Create( gfx::IntSize aSize, gfx::SurfaceFormat aFormat, gfx::BackendType aMoz2DBackend, LayersBackend aLayersBackend, TextureFlags aFlags, TextureAllocationFlags aAllocFlags, - mozilla::ipc::IShmemAllocator* aAllocator, bool aIsSameProcess); + LayersIPCChannel* aAllocator, bool aIsSameProcess); static BufferTextureData* CreateInternal(LayersIPCChannel* aAllocator, const BufferDescriptor& aDesc, diff -Nru thunderbird-140.10.0esr/gfx/layers/ipc/ImageBridgeParent.cpp thunderbird-140.10.1esr/gfx/layers/ipc/ImageBridgeParent.cpp --- thunderbird-140.10.0esr/gfx/layers/ipc/ImageBridgeParent.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/layers/ipc/ImageBridgeParent.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -304,6 +304,12 @@ const SurfaceDescriptor& aSharedData, ReadLockDescriptor& aReadLock, const LayersBackend& aLayersBackend, const TextureFlags& aFlags, const uint64_t& aSerial, const wr::MaybeExternalImageId& aExternalImageId) { + if (aExternalImageId.isSome()) { + uint32_t ns = static_cast(wr::AsUint64(*aExternalImageId) >> 32); + if (ns == 0) { + return nullptr; + } + } return TextureHost::CreateIPDLActor(this, aSharedData, std::move(aReadLock), aLayersBackend, aFlags, mContentId, aSerial, aExternalImageId); diff -Nru thunderbird-140.10.0esr/gfx/thebes/gfxFont.cpp thunderbird-140.10.1esr/gfx/thebes/gfxFont.cpp --- thunderbird-140.10.0esr/gfx/thebes/gfxFont.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/thebes/gfxFont.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -1528,10 +1528,11 @@ } } - if (FontCanSupportGraphite()) { - if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { - return mFontEntry->HasGraphiteSpaceContextuals(); - } + // Note that Graphite shaping is only available on the main thread. + // `UseGraphiteShaping` will always be false in workers. + if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && + FontCanSupportGraphite()) { + return mFontEntry->HasGraphiteSpaceContextuals(); } // We record the presence of space-dependent features in the font entry @@ -1566,6 +1567,9 @@ } bool gfxFont::SupportsFeature(Script aScript, uint32_t aFeatureTag) { + // mGraphiteShaper may be observed non-null on a worker thread, but workers + // shape via harfbuzz regardless, because graphite shaping is only available + // on the main thread. if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) { return GetFontEntry()->SupportsGraphiteFeature(aFeatureTag); } @@ -3448,23 +3452,23 @@ // XXX Currently, we do all vertical shaping through harfbuzz. // Vertical graphite support may be wanted as a future enhancement. // XXX Graphite shaping currently only supported on the main thread! - // Worker-thread shaping (offscreen canvas) will always go via harfbuzz. - if (FontCanSupportGraphite() && !aVertical && NS_IsMainThread()) { - if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) { - gfxGraphiteShaper* shaper = mGraphiteShaper; - if (!shaper) { - shaper = new gfxGraphiteShaper(this); - if (!mGraphiteShaper.compareExchange(nullptr, shaper)) { - delete shaper; - shaper = mGraphiteShaper; - } - } - if (shaper->ShapeText(aDrawTarget, aText, aOffset, aLength, aScript, - aLanguage, aVertical, aRounding, aShapedText)) { - PostShapingFixup(aDrawTarget, aText, aOffset, aLength, aVertical, - aShapedText); - return true; - } + // On workers (offscreen canvas), `UseGraphiteShaping` always returns false, + // and shaping uses harfbuzz. + if (gfxPlatform::GetPlatform()->UseGraphiteShaping() && + FontCanSupportGraphite() && !aVertical) { + gfxGraphiteShaper* shaper = mGraphiteShaper; + if (!shaper) { + shaper = new gfxGraphiteShaper(this); + if (!mGraphiteShaper.compareExchange(nullptr, shaper)) { + delete shaper; + shaper = mGraphiteShaper; + } + } + if (shaper->ShapeText(aDrawTarget, aText, aOffset, aLength, aScript, + aLanguage, aVertical, aRounding, aShapedText)) { + PostShapingFixup(aDrawTarget, aText, aOffset, aLength, aVertical, + aShapedText); + return true; } } diff -Nru thunderbird-140.10.0esr/gfx/thebes/gfxFontEntry.cpp thunderbird-140.10.1esr/gfx/thebes/gfxFontEntry.cpp --- thunderbird-140.10.0esr/gfx/thebes/gfxFontEntry.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/thebes/gfxFontEntry.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -571,13 +571,10 @@ } tainted_opaque_gr gfxFontEntry::GetGrFace() { - if (!mGrFaceInitialized) { - // When possible, the below code will use WASM as a sandboxing mechanism. - // At this time the wasm sandbox does not support threads. - // If Thebes is updated to make callst to the sandbox on multiple threaads, - // we need to make sure the underlying sandbox supports threading. - MOZ_ASSERT(NS_IsMainThread()); + // Graphite shaping is only available on the main thread. + MOZ_RELEASE_ASSERT(NS_IsMainThread()); + if (!mGrFaceInitialized) { mSandboxData = new GrSandboxData(); auto p_faceOps = mSandboxData->sandbox.malloc_in_sandbox(); @@ -646,6 +643,8 @@ } tainted_boolean_hint gfxFontEntry::HasGraphiteSpaceContextuals() { + // Graphite shaping is only available on the main thread. + MOZ_RELEASE_ASSERT(NS_IsMainThread()); LazyFlag flag = mHasGraphiteSpaceContextuals; if (flag == LazyFlag::Uninitialized) { auto face = GetGrFace(); diff -Nru thunderbird-140.10.0esr/gfx/thebes/gfxPlatform.cpp thunderbird-140.10.1esr/gfx/thebes/gfxPlatform.cpp --- thunderbird-140.10.0esr/gfx/thebes/gfxPlatform.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/thebes/gfxPlatform.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -1852,7 +1852,9 @@ } bool gfxPlatform::UseGraphiteShaping() { - return StaticPrefs::gfx_font_rendering_graphite_enabled(); + // Graphite shaping is only available on the main thread. + return StaticPrefs::gfx_font_rendering_graphite_enabled() && + NS_IsMainThread(); } bool gfxPlatform::IsFontFormatSupported( diff -Nru thunderbird-140.10.0esr/gfx/webrender_bindings/RenderThread.cpp thunderbird-140.10.1esr/gfx/webrender_bindings/RenderThread.cpp --- thunderbird-140.10.0esr/gfx/webrender_bindings/RenderThread.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/gfx/webrender_bindings/RenderThread.cpp 2026-04-29 18:38:20.000000000 +0000 @@ -1041,7 +1041,8 @@ if (texture->SyncObjectNeeded()) { mSyncObjectNeededRenderTextures.emplace(aExternalImageId, texture); } - mRenderTextures.emplace(aExternalImageId, texture); + auto [it, inserted] = mRenderTextures.emplace(aExternalImageId, texture); + MOZ_RELEASE_ASSERT(inserted, "ExternalImageId collision"); #ifdef DEBUG int32_t maxAllowedIncrease = diff -Nru thunderbird-140.10.0esr/intl/icu/source/common/ustrcase.cpp thunderbird-140.10.1esr/intl/icu/source/common/ustrcase.cpp --- thunderbird-140.10.0esr/intl/icu/source/common/ustrcase.cpp 2026-04-21 14:52:53.000000000 +0000 +++ thunderbird-140.10.1esr/intl/icu/source/common/ustrcase.cpp 2026-04-29 18:38:21.000000000 +0000 @@ -1713,9 +1713,11 @@ * remember that this simulates bulk text replacement: * the decomposition would replace the entire code point */ - --s2; - --m2; - c2=*(s2-1); + if (start2<=(s2-2)) { + --s2; + --m2; + c2=*(s2-1); + } } } @@ -1759,9 +1761,11 @@ * remember that this simulates bulk text replacement: * the decomposition would replace the entire code point */ - --s1; - --m2; - c1=*(s1-1); + if (start1<=(s1-2)) { + --s1; + --m1; + c1=*(s1-1); + } } } diff -Nru thunderbird-140.10.0esr/intl/icu-patches/bug-2029806-surrogates.diff thunderbird-140.10.1esr/intl/icu-patches/bug-2029806-surrogates.diff --- thunderbird-140.10.0esr/intl/icu-patches/bug-2029806-surrogates.diff 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/intl/icu-patches/bug-2029806-surrogates.diff 2026-04-29 18:38:21.000000000 +0000 @@ -0,0 +1,32 @@ +diff --git a/intl/icu/source/common/ustrcase.cpp b/intl/icu/source/common/ustrcase.cpp +--- a/intl/icu/source/common/ustrcase.cpp ++++ b/intl/icu/source/common/ustrcase.cpp +@@ -1713,8 +1713,10 @@ + * remember that this simulates bulk text replacement: + * the decomposition would replace the entire code point + */ +- --s2; +- --m2; +- c2=*(s2-1); ++ if (start2<=(s2-2)) { ++ --s2; ++ --m2; ++ c2=*(s2-1); ++ } + } + } + +@@ -1759,8 +1761,10 @@ + * remember that this simulates bulk text replacement: + * the decomposition would replace the entire code point + */ +- --s1; +- --m2; +- c1=*(s1-1); ++ if (start1<=(s1-2)) { ++ --s1; ++ --m1; ++ c1=*(s1-1); ++ } + } + } diff -Nru thunderbird-140.10.0esr/js/public/friend/CycleCollector.h thunderbird-140.10.1esr/js/public/friend/CycleCollector.h --- thunderbird-140.10.0esr/js/public/friend/CycleCollector.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/js/public/friend/CycleCollector.h 2026-04-29 18:38:21.000000000 +0000 @@ -0,0 +1,25 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +/* + * APIs for integration with the cycle collector. + */ + +#ifndef js_friend_CycleCollector_h +#define js_friend_CycleCollector_h + +#include "jstypes.h" + +#include "js/HeapAPI.h" // JS::GCCellPtr + +namespace JS { + +using ShouldClearWeakRefTargetCallback = bool (*)(GCCellPtr ptr, void* data); + +extern JS_PUBLIC_API void MaybeClearWeakRefTargets( + JSRuntime* runtime, ShouldClearWeakRefTargetCallback callback, void* data); + +} // namespace JS + +#endif // js_friend_CycleCollector_h diff -Nru thunderbird-140.10.0esr/js/src/gc/FinalizationObservers.cpp thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.cpp --- thunderbird-140.10.0esr/js/src/gc/FinalizationObservers.cpp 2026-04-21 14:52:54.000000000 +0000 +++ thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.cpp 2026-04-29 18:38:21.000000000 +0000 @@ -15,6 +15,7 @@ #include "builtin/FinalizationRegistryObject.h" #include "builtin/WeakRefObject.h" #include "gc/GCRuntime.h" +#include "gc/PublicIterators.h" #include "gc/Zone.h" #include "vm/JSContext.h" @@ -517,3 +518,34 @@ void FinalizationRegistryGlobalData::trace(JSTracer* trc) { recordSet.trace(trc); } + +JS_PUBLIC_API void JS::MaybeClearWeakRefTargets( + JSRuntime* runtime, JS::ShouldClearWeakRefTargetCallback callback, + void* data) { + MOZ_ASSERT(CurrentThreadCanAccessRuntime(runtime)); + AssertHeapIsIdle(); + runtime->gc.maybeClearWeakRefTargets(callback, data); +} + +void GCRuntime::maybeClearWeakRefTargets( + JS::ShouldClearWeakRefTargetCallback callback, void* data) { + for (AllZonesIter zone(this); !zone.done(); zone.next()) { + FinalizationObservers* observers = zone->finalizationObservers(); + if (observers) { + observers->maybeClearWeakRefTargets(callback, data); + } + } +} + +void FinalizationObservers::maybeClearWeakRefTargets( + JS::ShouldClearWeakRefTargetCallback callback, void* data) { + for (auto iter = weakRefMap.modIter(); !iter.done(); iter.next()) { + JSObject* target = iter.get().key(); + if (callback(JS::GCCellPtr(target), data)) { + for (JSObject* obj : iter.get().value()) { + updateForRemovedWeakRef(obj, UnwrapWeakRef(obj)); + } + iter.remove(); + } + } +} diff -Nru thunderbird-140.10.0esr/js/src/gc/FinalizationObservers.h thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.h --- thunderbird-140.10.0esr/js/src/gc/FinalizationObservers.h 2026-04-21 14:52:54.000000000 +0000 +++ thunderbird-140.10.1esr/js/src/gc/FinalizationObservers.h 2026-04-29 18:38:21.000000000 +0000 @@ -10,6 +10,7 @@ #include "gc/Barrier.h" #include "gc/WeakMap.h" #include "gc/ZoneAllocator.h" +#include "js/friend/CycleCollector.h" #include "js/GCHashTable.h" #include "js/GCVector.h" @@ -81,6 +82,8 @@ bool addWeakRefTarget(Handle target, Handle weakRef); void removeWeakRefTarget(Handle target, Handle weakRef); + void maybeClearWeakRefTargets(JS::ShouldClearWeakRefTargetCallback callback, + void* data); void unregisterWeakRefWrapper(JSObject* wrapper, WeakRefObject* weakRef); diff -Nru thunderbird-140.10.0esr/js/src/gc/GCRuntime.h thunderbird-140.10.1esr/js/src/gc/GCRuntime.h --- thunderbird-140.10.0esr/js/src/gc/GCRuntime.h 2026-04-21 14:52:54.000000000 +0000 +++ thunderbird-140.10.1esr/js/src/gc/GCRuntime.h 2026-04-29 18:38:21.000000000 +0000 @@ -24,6 +24,7 @@ #include "gc/Scheduling.h" #include "gc/Statistics.h" #include "gc/StoreBuffer.h" +#include "js/friend/CycleCollector.h" #include "js/friend/PerformanceHint.h" #include "js/GCAnnotations.h" #include "js/UniquePtr.h" @@ -688,6 +689,9 @@ bool registerWeakRef(HandleObject target, HandleObject weakRef); void traceKeptObjects(JSTracer* trc); + void maybeClearWeakRefTargets(JS::ShouldClearWeakRefTargetCallback callback, + void* data); + JS::GCReason lastStartReason() const { return initialReason; } void updateAllocationRates(); diff -Nru thunderbird-140.10.0esr/js/src/jit/MacroAssembler.cpp thunderbird-140.10.1esr/js/src/jit/MacroAssembler.cpp --- thunderbird-140.10.0esr/js/src/jit/MacroAssembler.cpp 2026-04-21 14:52:55.000000000 +0000 +++ thunderbird-140.10.1esr/js/src/jit/MacroAssembler.cpp 2026-04-29 18:38:21.000000000 +0000 @@ -5765,6 +5765,7 @@ masm.loadPtr( Address(masm.getStackPointer(), WasmCallerInstanceOffsetBeforeCall), InstanceReg); + masm.loadWasmPinnedRegsFromInstance(mozilla::Nothing()); masm.switchToWasmInstanceRealm(ABINonArgReturnReg0, ABINonArgReturnReg1); masm.moveToStackPtr(FramePointer); #ifdef JS_CODEGEN_ARM64 diff -Nru thunderbird-140.10.0esr/js/src/moz.build thunderbird-140.10.1esr/js/src/moz.build --- thunderbird-140.10.0esr/js/src/moz.build 2026-04-21 14:52:54.000000000 +0000 +++ thunderbird-140.10.1esr/js/src/moz.build 2026-04-29 18:38:22.000000000 +0000 @@ -259,6 +259,7 @@ # a clean design. Use this only if you absolutely must, and feel free to # propose clean APIs to replace what's here! EXPORTS.js.friend += [ + "../public/friend/CycleCollector.h", "../public/friend/DOMProxy.h", "../public/friend/DumpFunctions.h", "../public/friend/ErrorMessages.h", diff -Nru thunderbird-140.10.0esr/layout/generic/nsInlineFrame.cpp thunderbird-140.10.1esr/layout/generic/nsInlineFrame.cpp --- thunderbird-140.10.0esr/layout/generic/nsInlineFrame.cpp 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/layout/generic/nsInlineFrame.cpp 2026-04-29 18:38:25.000000000 +0000 @@ -936,7 +936,14 @@ } nsIFrame* nextInline = blockFrame->GetProperty(nsIFrame::IBSplitSibling()); - MOZ_ASSERT(nextInline, "There is always a trailing inline in an IB split"); + if (MOZ_UNLIKELY(!nextInline)) { + MOZ_ASSERT_UNREACHABLE("There should always a be trailing inline " + "in an IB split"); + // Gracefully bail so that nextInline usage below doesn't + // null-deref. (We can stop worrying about this when we remove + // IB split siblings in bug 2031448.) + return; + } for (nsIFrame* cont = nextInline; cont; cont = cont->GetNextContinuation()) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/COPYING.LGPLv2.1 thunderbird-140.10.1esr/media/ffvpx/COPYING.LGPLv2.1 --- thunderbird-140.10.0esr/media/ffvpx/COPYING.LGPLv2.1 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/COPYING.LGPLv2.1 2026-04-29 18:38:25.000000000 +0000 @@ -55,7 +55,7 @@ that what they have is not the original version, so that the original author's reputation will not be affected by problems that might be introduced by others. - + Finally, software patents pose a constant threat to the existence of any free program. We wish to make sure that a company cannot effectively restrict the users of a free program by obtaining a @@ -111,7 +111,7 @@ "work based on the library" and a "work that uses the library". The former contains code derived from the library, whereas the latter must be combined with the library in order to run. - + GNU LESSER GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION @@ -158,7 +158,7 @@ You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. - + 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 @@ -216,7 +216,7 @@ ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. - + Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. @@ -267,7 +267,7 @@ distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. - + 6. As an exception to the Sections above, you may also combine or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work @@ -329,7 +329,7 @@ accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. - + 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined @@ -370,7 +370,7 @@ restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties with this License. - + 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or @@ -422,7 +422,7 @@ the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. - + 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is @@ -456,7 +456,7 @@ DAMAGES. END OF TERMS AND CONDITIONS - + How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest diff -Nru thunderbird-140.10.0esr/media/ffvpx/README_MOZILLA thunderbird-140.10.1esr/media/ffvpx/README_MOZILLA --- thunderbird-140.10.0esr/media/ffvpx/README_MOZILLA 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/README_MOZILLA 2026-04-29 18:38:25.000000000 +0000 @@ -3,9 +3,9 @@ This directory contains files used in gecko builds from FFmpeg (http://ffmpeg.org). The current files are from FFmpeg as of revision -252fc2e047297697dea78e63aa908377b47c2136 +6c114bd6fa9fe006bed7dcdb88de4790510080d4 git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg -git checkout 252fc2e047297697dea78e63aa908377b47c2136 +git checkout 6c114bd6fa9fe006bed7dcdb88de4790510080d4 All source files match their path from the library's source archive. diff -Nru thunderbird-140.10.0esr/media/ffvpx/bug1603271-videodsp-pointer-overflow.patch thunderbird-140.10.1esr/media/ffvpx/bug1603271-videodsp-pointer-overflow.patch --- thunderbird-140.10.0esr/media/ffvpx/bug1603271-videodsp-pointer-overflow.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/bug1603271-videodsp-pointer-overflow.patch 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,12 @@ +--- a/media/ffvpx/libavcodec/videodsp_template.c ++++ b/media/ffvpx/libavcodec/videodsp_template.c +@@ -43,8 +43,7 @@ + src += (h - 1) * src_linesize; + src_y = h - 1; + } else if (src_y <= -block_h) { +- src -= src_y * src_linesize; +- src += (1 - block_h) * src_linesize; ++ src += (-src_y + 1 - block_h) * src_linesize; + src_y = 1 - block_h; + } + if (src_x >= w) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/changes.patch thunderbird-140.10.1esr/media/ffvpx/changes.patch --- thunderbird-140.10.0esr/media/ffvpx/changes.patch 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/changes.patch 2026-04-29 18:38:25.000000000 +0000 @@ -1,32 +1,17 @@ ---- a/libavutil/time.c 2024-02-14 14:57:10.389087159 +0100 -+++ b/libavutil/time.c 2024-04-05 14:43:19.097889433 +0200 -@@ -28,17 +28,17 @@ - #endif - #if HAVE_UNISTD_H - #include - #endif - #if HAVE_WINDOWS_H +--- a/media/ffvpx/libavutil/time.c 2026-04-07 19:11:31.943291487 -0400 ++++ b/media/ffvpx/libavutil/time.c 2026-04-09 10:13:16.927011463 -0400 +@@ -33,7 +33,7 @@ #include #endif - + -#include "time.h" +#include "fftime.h" #include "error.h" - + int64_t av_gettime(void) - { - #if HAVE_GETTIMEOFDAY - struct timeval tv; - gettimeofday(&tv, NULL); - return (int64_t)tv.tv_sec * 1000000 + tv.tv_usec; ---- a/libavutil/parseutils.c 2024-03-26 14:03:12.080640731 +0100 -+++ b/libavutil/parseutils.c 2024-04-05 14:44:56.508766832 +0200 -@@ -23,20 +23,20 @@ - - #include - - #include "avstring.h" - #include "avutil.h" +--- a/media/ffvpx/libavutil/parseutils.c 2026-04-07 19:11:31.939291442 -0400 ++++ b/media/ffvpx/libavutil/parseutils.c 2026-04-09 10:13:16.927011463 -0400 +@@ -28,10 +28,10 @@ #include "common.h" #include "eval.h" #include "log.h" @@ -36,41 +21,21 @@ #include "parseutils.h" -#include "time.h" +#include "fftime.h" - + #ifdef TEST - - #define av_get_random_seed av_get_random_seed_deterministic - static uint32_t av_get_random_seed_deterministic(void); - - #define av_gettime() 1331972053200000 - -@@ -370,17 +370,17 @@ - av_strlcpy(color_string2, color_string + hex_offset, - FFMIN(slen-hex_offset+1, sizeof(color_string2))); - if ((tail = strchr(color_string2, ALPHA_SEP))) - *tail++ = 0; - len = strlen(color_string2); + +@@ -378,7 +378,7 @@ rgba_color[3] = 255; - + if (!av_strcasecmp(color_string2, "random") || !av_strcasecmp(color_string2, "bikeshed")) { - int rgba = av_get_random_seed(); + int rgba = 0xffffffff; /* av_get_random_seed(); */ rgba_color[0] = rgba >> 24; rgba_color[1] = rgba >> 16; rgba_color[2] = rgba >> 8; - rgba_color[3] = rgba; - } else if (hex_offset || - strspn(color_string2, "0123456789ABCDEFabcdef") == len) { - char *tail; - unsigned int rgba = strtoul(color_string2, &tail, 16); ---- a/libavutil/eval.c 2024-04-05 14:40:56.917791496 +0200 -+++ b/libavutil/eval.c 2024-04-05 17:39:45.061516936 +0200 -@@ -31,17 +31,17 @@ - #include "avutil.h" - #include "common.h" - #include "eval.h" - #include "ffmath.h" - #include "log.h" +--- a/media/ffvpx/libavutil/eval.c 2026-04-07 19:11:31.939291442 -0400 ++++ b/media/ffvpx/libavutil/eval.c 2026-04-09 10:13:16.927011463 -0400 +@@ -37,7 +37,7 @@ #include "mathematics.h" #include "mem.h" #include "sfc64.h" @@ -78,39 +43,33 @@ +#include "fftime.h" #include "avstring.h" #include "reverse.h" - - typedef struct Parser { - const AVClass *class; - int stack_index; - char *s; - const double *const_values; ---- a/media/ffvpx/libavcodec/dxva2.c -+++ b/media/ffvpx/libavcodec/dxva2.c + +--- a/media/ffvpx/libavcodec/dxva2.c 2026-04-07 19:11:31.851290449 -0400 ++++ b/media/ffvpx/libavcodec/dxva2.c 2026-04-09 10:13:16.923011414 -0400 @@ -27,7 +27,7 @@ #include "libavutil/common.h" #include "libavutil/log.h" #include "libavutil/mem.h" -#include "libavutil/time.h" +#include "libavutil/fftime.h" - + #include "avcodec.h" #include "decode.h" ---- a/media/ffvpx/libavcodec/dxva2_internal.h -+++ b/media/ffvpx/libavcodec/dxva2_internal.h +@@ -647,6 +647,7 @@ + AVD3D11VAFramesContext *frames_hwctx = frames_ctx->hwctx; + + frames_hwctx->BindFlags |= D3D11_BIND_DECODER; ++ frames_hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE; + } + #endif + +--- a/media/ffvpx/libavcodec/dxva2_internal.h 2026-04-07 19:11:31.851290449 -0400 ++++ b/media/ffvpx/libavcodec/dxva2_internal.h 2026-04-09 10:13:16.923011414 -0400 @@ -65,6 +65,7 @@ #endif - + #include "libavutil/hwcontext.h" +#include "libavutil/mem.h" - + #include "avcodec.h" #include "internal.h" ---- a/media/ffvpx/libavcodec/dxva2.c -+++ b/media/ffvpx/libavcodec/dxva2.c -@@ -647,6 +647,7 @@ int ff_dxva2_common_frame_params(AVCodec - AVD3D11VAFramesContext *frames_hwctx = frames_ctx->hwctx; - - frames_hwctx->BindFlags |= D3D11_BIND_DECODER; -+ frames_hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE; - } - #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/compat/w32pthreads.h thunderbird-140.10.1esr/media/ffvpx/compat/w32pthreads.h --- thunderbird-140.10.0esr/media/ffvpx/compat/w32pthreads.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/compat/w32pthreads.h 2026-04-29 18:38:26.000000000 +0000 @@ -44,8 +44,9 @@ #include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/fftime.h" +#include "libavutil/wchar_filename.h" -typedef struct pthread_t { +typedef struct w32pthread_t { void *handle; void *(*func)(void* arg); void *arg; @@ -71,7 +72,7 @@ #define THREADFUNC_RETTYPE unsigned #endif -static av_unused THREADFUNC_RETTYPE +av_unused static THREADFUNC_RETTYPE __stdcall attribute_align_arg win32thread_worker(void *arg) { pthread_t h = (pthread_t)arg; @@ -79,12 +80,12 @@ return 0; } -static av_unused int pthread_create(pthread_t *thread, const void *unused_attr, +av_unused static int pthread_create(pthread_t *thread, const void *unused_attr, void *(*start_routine)(void*), void *arg) { pthread_t ret; - ret = av_mallocz(sizeof(*ret)); + ret = (pthread_t)av_mallocz(sizeof(*ret)); if (!ret) return EAGAIN; @@ -108,7 +109,7 @@ return 0; } -static av_unused int pthread_join(pthread_t thread, void **value_ptr) +av_unused static int pthread_join(pthread_t thread, void **value_ptr) { DWORD ret = WaitForSingleObject(thread->handle, INFINITE); if (ret != WAIT_OBJECT_0) { @@ -148,7 +149,7 @@ typedef INIT_ONCE pthread_once_t; #define PTHREAD_ONCE_INIT INIT_ONCE_STATIC_INIT -static av_unused int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) +av_unused static int pthread_once(pthread_once_t *once_control, void (*init_routine)(void)) { BOOL pending = FALSE; InitOnceBeginInitialize(once_control, 0, &pending, NULL); @@ -209,4 +210,38 @@ return 0; } +static inline int win32_thread_setname(const char *name) +{ +#if !HAVE_UWP + typedef HRESULT (WINAPI *SetThreadDescriptionFn)(HANDLE, PCWSTR); + + // Although SetThreadDescription lives in kernel32.dll, on Windows Server 2016, + // Windows 10 LTSB 2016 and Windows 10 version 1607, it was only available in + // kernelbase.dll. So, load it from there for maximum coverage. + HMODULE kernelbase = GetModuleHandleW(L"kernelbase.dll"); + if (!kernelbase) + return AVERROR(ENOSYS); + + SetThreadDescriptionFn pSetThreadDescription = + (SetThreadDescriptionFn)GetProcAddress(kernelbase, "SetThreadDescription"); + if (!pSetThreadDescription) + return AVERROR(ENOSYS); + + wchar_t *wname; + if (utf8towchar(name, &wname) < 0) + return AVERROR(ENOMEM); + + HRESULT hr = pSetThreadDescription(GetCurrentThread(), wname); + av_free(wname); + return SUCCEEDED(hr) ? 0 : AVERROR(EINVAL); +#else + // UWP is not supported because we cannot use LoadLibrary/GetProcAddress to + // detect the availability of the SetThreadDescription API. There is a small + // gap in Windows builds 1507-1607 where it was not available. UWP allows + // querying the availability of APIs with QueryOptionalDelayLoadedAPI, but it + // requires /DELAYLOAD:kernel32.dll during linking, and we cannot enforce that. + return AVERROR(ENOSYS); +#endif +} + #endif /* COMPAT_W32PTHREADS_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/config.h thunderbird-140.10.1esr/media/ffvpx/config.h --- thunderbird-140.10.0esr/media/ffvpx/config.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config.h 2026-04-29 18:38:26.000000000 +0000 @@ -1,5 +1,3 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -12,6 +10,8 @@ # include "config_android32.h" # elif defined(MOZ_WIDGET_ANDROID) && defined(__aarch64__) # include "config_android64.h" +# elif defined(MOZ_WIDGET_ANDROID) && defined(HAVE_64BIT_BUILD) +# include "config_android_x86_64.h" # elif defined(__aarch64__) # include "config_unix_aarch64.h" # else @@ -49,10 +49,16 @@ # else # include "config_darwin64.h" # endif +# elif defined(MOZ_WIDGET_ANDROID) && defined(__aarch64__) +# include "config_android64.h" +# elif defined(MOZ_WIDGET_ANDROID) && defined(__arm__) +# include "config_android32.h" # elif defined(MOZ_WIDGET_ANDROID) && defined(HAVE_64BIT_BUILD) -# include "config_android_x86_64.h" +# include "config_android_x86_64.h" # elif defined(XP_UNIX) -# if defined(HAVE_64BIT_BUILD) +# if defined(__aarch64__) +# include "config_unix_aarch64.h" +# elif defined(HAVE_64BIT_BUILD) # include "config_unix64.h" # else # include "config_unix32.h" diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_android32.h thunderbird-140.10.1esr/media/ffvpx/config_android32.h --- thunderbird-140.10.0esr/media/ffvpx/config_android32.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_android32.h 2026-04-29 18:38:26.000000000 +0000 @@ -322,7 +322,7 @@ #define HAVE_MPROTECT 1 #define HAVE_NANOSLEEP 1 #define HAVE_PEEKNAMEDPIPE 0 -#define HAVE_POSIX_MEMALIGN 0 +#define HAVE_POSIX_MEMALIGN 1 #define HAVE_PTHREAD_CANCEL 0 #define HAVE_SCHED_GETAFFINITY 1 #define HAVE_SECITEMIMPORT 0 @@ -342,6 +342,7 @@ #define HAVE_BCRYPT 0 #define HAVE_VAAPI_DRM 0 #define HAVE_VAAPI_WIN32 0 +#define HAVE_VAAPI_X11 0 #define HAVE_VDPAU_X11 0 #define HAVE_PTHREADS 1 #define HAVE_OS2THREADS 0 @@ -478,7 +479,7 @@ #define CONFIG_LIBCACA 0 #define CONFIG_LIBCELT 0 #define CONFIG_LIBCODEC2 0 -#define CONFIG_LIBDAV1D 0 +#define CONFIG_LIBDAV1D 1 #define CONFIG_LIBDC1394 0 #define CONFIG_LIBDRM 0 #define CONFIG_LIBFLITE 0 @@ -534,7 +535,8 @@ #define CONFIG_LIBZMQ 0 #define CONFIG_LIBZVBI 0 #define CONFIG_LV2 0 -#define CONFIG_MEDIACODEC 0 +#define CONFIG_MEDIACODEC 1 +#define CONFIG_AAC_MEDIACODEC_DECODER 1 #define CONFIG_OPENAL 0 #define CONFIG_OPENGL 0 #define CONFIG_OPENSSL 0 @@ -589,7 +591,7 @@ #define CONFIG_RUNTIME_CPUDETECT 1 #define CONFIG_SAFE_BITSTREAM_READER 1 #define CONFIG_SHARED 1 -#define CONFIG_SMALL 1 +#define CONFIG_SMALL 0 #define CONFIG_STATIC 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_GPL 0 @@ -620,21 +622,21 @@ #define CONFIG_AUTODETECT 0 #define CONFIG_FONTCONFIG 0 #define CONFIG_LARGE_TESTS 1 -#define CONFIG_LINUX_PERF 1 +#define CONFIG_LINUX_PERF 0 #define CONFIG_MACOS_KPERF 0 #define CONFIG_MEMORY_POISONING 0 #define CONFIG_NEON_CLOBBER_TEST 0 #define CONFIG_OSSFUZZ 0 #define CONFIG_PIC 1 #define CONFIG_PTX_COMPRESSION 0 -#define CONFIG_THUMB 0 +#define CONFIG_THUMB 1 #define CONFIG_VALGRIND_BACKTRACE 0 #define CONFIG_XMM_CLOBBER_TEST 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 -#define CONFIG_ENCODERS 0 -#define CONFIG_HWACCELS 0 -#define CONFIG_PARSERS 0 +#define CONFIG_ENCODERS 1 +#define CONFIG_HWACCELS 1 +#define CONFIG_PARSERS 1 #define CONFIG_INDEVS 0 #define CONFIG_OUTDEVS 0 #define CONFIG_FILTERS 0 @@ -643,7 +645,7 @@ #define CONFIG_PROTOCOLS 0 #define CONFIG_AANDCTTABLES 0 #define CONFIG_AC3DSP 0 -#define CONFIG_ADTS_HEADER 0 +#define CONFIG_ADTS_HEADER 1 #define CONFIG_ATSC_A53 0 #define CONFIG_AUDIO_FRAME_QUEUE 0 #define CONFIG_AUDIODSP 0 @@ -676,7 +678,7 @@ #define CONFIG_H264CHROMA 0 #define CONFIG_H264DSP 0 #define CONFIG_H264PARSE 0 -#define CONFIG_H264PRED 0 +#define CONFIG_H264PRED 1 #define CONFIG_H264QPEL 0 #define CONFIG_HEVCPARSE 0 #define CONFIG_HPELDSP 0 @@ -731,10 +733,10 @@ #define CONFIG_VAAPI_1 0 #define CONFIG_VAAPI_ENCODE 0 #define CONFIG_VC1DSP 0 -#define CONFIG_VIDEODSP 0 +#define CONFIG_VIDEODSP 1 #define CONFIG_VP3DSP 0 #define CONFIG_VP56DSP 0 -#define CONFIG_VP8DSP 0 +#define CONFIG_VP8DSP 1 #define CONFIG_WMA_FREQS 0 #define CONFIG_WMV2DSP 0 #endif /* FFMPEG_CONFIG_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_android64.h thunderbird-140.10.1esr/media/ffvpx/config_android64.h --- thunderbird-140.10.0esr/media/ffvpx/config_android64.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_android64.h 2026-04-29 18:38:26.000000000 +0000 @@ -479,7 +479,7 @@ #define CONFIG_LIBCACA 0 #define CONFIG_LIBCELT 0 #define CONFIG_LIBCODEC2 0 -#define CONFIG_LIBDAV1D 0 +#define CONFIG_LIBDAV1D 1 #define CONFIG_LIBDC1394 0 #define CONFIG_LIBDRM 0 #define CONFIG_LIBFLITE 0 @@ -535,7 +535,8 @@ #define CONFIG_LIBZMQ 0 #define CONFIG_LIBZVBI 0 #define CONFIG_LV2 0 -#define CONFIG_MEDIACODEC 0 +#define CONFIG_MEDIACODEC 1 +#define CONFIG_AAC_MEDIACODEC_DECODER 1 #define CONFIG_OPENAL 0 #define CONFIG_OPENGL 0 #define CONFIG_OPENSSL 0 @@ -590,7 +591,7 @@ #define CONFIG_RUNTIME_CPUDETECT 1 #define CONFIG_SAFE_BITSTREAM_READER 1 #define CONFIG_SHARED 1 -#define CONFIG_SMALL 1 +#define CONFIG_SMALL 0 #define CONFIG_STATIC 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_GPL 0 @@ -621,7 +622,7 @@ #define CONFIG_AUTODETECT 0 #define CONFIG_FONTCONFIG 0 #define CONFIG_LARGE_TESTS 1 -#define CONFIG_LINUX_PERF 1 +#define CONFIG_LINUX_PERF 0 #define CONFIG_MACOS_KPERF 0 #define CONFIG_MEMORY_POISONING 0 #define CONFIG_NEON_CLOBBER_TEST 0 @@ -633,9 +634,9 @@ #define CONFIG_XMM_CLOBBER_TEST 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 -#define CONFIG_ENCODERS 0 -#define CONFIG_HWACCELS 0 -#define CONFIG_PARSERS 0 +#define CONFIG_ENCODERS 1 +#define CONFIG_HWACCELS 1 +#define CONFIG_PARSERS 1 #define CONFIG_INDEVS 0 #define CONFIG_OUTDEVS 0 #define CONFIG_FILTERS 0 @@ -644,7 +645,7 @@ #define CONFIG_PROTOCOLS 0 #define CONFIG_AANDCTTABLES 0 #define CONFIG_AC3DSP 0 -#define CONFIG_ADTS_HEADER 0 +#define CONFIG_ADTS_HEADER 1 #define CONFIG_ATSC_A53 0 #define CONFIG_AUDIO_FRAME_QUEUE 0 #define CONFIG_AUDIODSP 0 @@ -677,7 +678,7 @@ #define CONFIG_H264CHROMA 0 #define CONFIG_H264DSP 0 #define CONFIG_H264PARSE 0 -#define CONFIG_H264PRED 0 +#define CONFIG_H264PRED 1 #define CONFIG_H264QPEL 0 #define CONFIG_HEVCPARSE 0 #define CONFIG_HPELDSP 0 @@ -732,10 +733,10 @@ #define CONFIG_VAAPI_1 0 #define CONFIG_VAAPI_ENCODE 0 #define CONFIG_VC1DSP 0 -#define CONFIG_VIDEODSP 0 +#define CONFIG_VIDEODSP 1 #define CONFIG_VP3DSP 0 #define CONFIG_VP56DSP 0 -#define CONFIG_VP8DSP 0 +#define CONFIG_VP8DSP 1 #define CONFIG_WMA_FREQS 0 #define CONFIG_WMV2DSP 0 #endif /* FFMPEG_CONFIG_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_android_x86_64.h thunderbird-140.10.1esr/media/ffvpx/config_android_x86_64.h --- thunderbird-140.10.0esr/media/ffvpx/config_android_x86_64.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_android_x86_64.h 2026-04-29 18:38:25.000000000 +0000 @@ -535,7 +535,8 @@ #define CONFIG_LIBZMQ 0 #define CONFIG_LIBZVBI 0 #define CONFIG_LV2 0 -#define CONFIG_MEDIACODEC 0 +#define CONFIG_MEDIACODEC 1 +#define CONFIG_AAC_MEDIACODEC_DECODER 1 #define CONFIG_OPENAL 0 #define CONFIG_OPENGL 0 #define CONFIG_OPENSSL 0 @@ -590,7 +591,7 @@ #define CONFIG_RUNTIME_CPUDETECT 1 #define CONFIG_SAFE_BITSTREAM_READER 1 #define CONFIG_SHARED 1 -#define CONFIG_SMALL 1 +#define CONFIG_SMALL 0 #define CONFIG_STATIC 0 #define CONFIG_SWSCALE_ALPHA 1 #define CONFIG_GPL 0 @@ -633,8 +634,8 @@ #define CONFIG_XMM_CLOBBER_TEST 0 #define CONFIG_BSFS 0 #define CONFIG_DECODERS 1 -#define CONFIG_ENCODERS 0 -#define CONFIG_HWACCELS 0 +#define CONFIG_ENCODERS 1 +#define CONFIG_HWACCELS 1 #define CONFIG_PARSERS 1 #define CONFIG_INDEVS 0 #define CONFIG_OUTDEVS 0 @@ -644,7 +645,7 @@ #define CONFIG_PROTOCOLS 0 #define CONFIG_AANDCTTABLES 0 #define CONFIG_AC3DSP 0 -#define CONFIG_ADTS_HEADER 0 +#define CONFIG_ADTS_HEADER 1 #define CONFIG_ATSC_A53 0 #define CONFIG_AUDIO_FRAME_QUEUE 0 #define CONFIG_AUDIODSP 0 diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_components.h thunderbird-140.10.1esr/media/ffvpx/config_components.h --- thunderbird-140.10.0esr/media/ffvpx/config_components.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_components.h 2026-04-29 18:38:25.000000000 +0000 @@ -1,5 +1,3 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_components_audio_only.h thunderbird-140.10.1esr/media/ffvpx/config_components_audio_only.h --- thunderbird-140.10.0esr/media/ffvpx/config_components_audio_only.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_components_audio_only.h 2026-04-29 18:38:25.000000000 +0000 @@ -128,7 +128,6 @@ #define CONFIG_H264_DECODER 0 #define CONFIG_H264_CRYSTALHD_DECODER 0 #define CONFIG_H264_V4L2M2M_DECODER 0 -#define CONFIG_H264_MEDIACODEC_DECODER 0 #define CONFIG_H264_MMAL_DECODER 0 #define CONFIG_H264_QSV_DECODER 0 #define CONFIG_H264_RKMPP_DECODER 0 @@ -586,7 +585,6 @@ #define CONFIG_LIBOPENH264_DECODER 0 #define CONFIG_H264_CUVID_DECODER 0 #define CONFIG_HEVC_CUVID_DECODER 0 -#define CONFIG_HEVC_MEDIACODEC_DECODER 0 #define CONFIG_MJPEG_CUVID_DECODER 0 #define CONFIG_MJPEG_QSV_DECODER 0 #define CONFIG_MPEG1_CUVID_DECODER 0 @@ -595,10 +593,8 @@ #define CONFIG_MPEG4_MEDIACODEC_DECODER 0 #define CONFIG_VC1_CUVID_DECODER 0 #define CONFIG_VP8_CUVID_DECODER 0 -#define CONFIG_VP8_MEDIACODEC_DECODER 0 #define CONFIG_VP8_QSV_DECODER 0 #define CONFIG_VP9_CUVID_DECODER 0 -#define CONFIG_VP9_MEDIACODEC_DECODER 0 #define CONFIG_VP9_QSV_DECODER 0 #define CONFIG_A64MULTI_ENCODER 0 #define CONFIG_A64MULTI5_ENCODER 0 @@ -834,6 +830,7 @@ #define CONFIG_MPEG2_QSV_ENCODER 0 #define CONFIG_MPEG2_VAAPI_ENCODER 0 #define CONFIG_MPEG4_OMX_ENCODER 0 +#define CONFIG_MPEG4_MEDIACODEC_ENCODER 0 #define CONFIG_MPEG4_V4L2M2M_ENCODER 0 #define CONFIG_PRORES_VIDEOTOOLBOX_ENCODER 0 #define CONFIG_VP8_V4L2M2M_ENCODER 0 @@ -897,6 +894,7 @@ #define CONFIG_VP9_VAAPI_HWACCEL 0 #define CONFIG_VP9_VDPAU_HWACCEL 0 #define CONFIG_VP9_VIDEOTOOLBOX_HWACCEL 0 +#define CONFIG_VP9_VULKAN_HWACCEL 0 #define CONFIG_WMV3_D3D11VA_HWACCEL 0 #define CONFIG_WMV3_D3D11VA2_HWACCEL 0 #define CONFIG_WMV3_DXVA2_HWACCEL 0 diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_components_audio_video.h thunderbird-140.10.1esr/media/ffvpx/config_components_audio_video.h --- thunderbird-140.10.0esr/media/ffvpx/config_components_audio_video.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_components_audio_video.h 2026-04-29 18:38:25.000000000 +0000 @@ -1,7 +1,7 @@ /* Automatically generated by configure - do not modify! */ #ifndef FFMPEG_CONFIG_COMPONENTS_H #define FFMPEG_CONFIG_COMPONENTS_H -#define CONFIG_AAC_ADTSTOASC_BSF 0 +#define CONFIG_AAC_ADTSTOASC_BSF 1 #define CONFIG_AV1_FRAME_MERGE_BSF 0 #define CONFIG_AV1_FRAME_SPLIT_BSF 0 #define CONFIG_AV1_METADATA_BSF 0 @@ -130,7 +130,6 @@ #define CONFIG_H264_DECODER 0 #define CONFIG_H264_CRYSTALHD_DECODER 0 #define CONFIG_H264_V4L2M2M_DECODER 0 -#define CONFIG_H264_MEDIACODEC_DECODER 0 #define CONFIG_H264_MMAL_DECODER 0 #define CONFIG_H264_QSV_DECODER 0 #define CONFIG_H264_RKMPP_DECODER 0 @@ -598,12 +597,10 @@ #define CONFIG_LIBAOM_AV1_DECODER 0 #define CONFIG_AV1_DECODER 1 #define CONFIG_AV1_CUVID_DECODER 0 -#define CONFIG_AV1_MEDIACODEC_DECODER 0 #define CONFIG_AV1_QSV_DECODER 0 #define CONFIG_LIBOPENH264_DECODER 0 #define CONFIG_H264_CUVID_DECODER 0 #define CONFIG_HEVC_CUVID_DECODER 0 -#define CONFIG_HEVC_MEDIACODEC_DECODER 0 #define CONFIG_MJPEG_CUVID_DECODER 0 #define CONFIG_MJPEG_QSV_DECODER 0 #define CONFIG_MPEG1_CUVID_DECODER 0 @@ -612,10 +609,8 @@ #define CONFIG_MPEG4_MEDIACODEC_DECODER 0 #define CONFIG_VC1_CUVID_DECODER 0 #define CONFIG_VP8_CUVID_DECODER 0 -#define CONFIG_VP8_MEDIACODEC_DECODER 0 #define CONFIG_VP8_QSV_DECODER 0 #define CONFIG_VP9_CUVID_DECODER 0 -#define CONFIG_VP9_MEDIACODEC_DECODER 0 #define CONFIG_VP9_QSV_DECODER 0 #define CONFIG_VNULL_DECODER 0 #define CONFIG_ANULL_DECODER 0 @@ -649,7 +644,6 @@ #define CONFIG_H261_ENCODER 0 #define CONFIG_H263_ENCODER 0 #define CONFIG_H263P_ENCODER 0 -#define CONFIG_H264_MEDIACODEC_ENCODER 0 #define CONFIG_HAP_ENCODER 0 #define CONFIG_HUFFYUV_ENCODER 0 #define CONFIG_JPEG2000_ENCODER 0 @@ -660,6 +654,7 @@ #define CONFIG_MPEG1VIDEO_ENCODER 0 #define CONFIG_MPEG2VIDEO_ENCODER 0 #define CONFIG_MPEG4_ENCODER 0 +#define CONFIG_MPEG4_MEDIACODEC_ENCODER 0 #define CONFIG_MSMPEG4V2_ENCODER 0 #define CONFIG_MSMPEG4V3_ENCODER 0 #define CONFIG_MSVIDEO1_ENCODER 0 @@ -847,7 +842,6 @@ #define CONFIG_H264_VAAPI_ENCODER 0 #define CONFIG_H264_VIDEOTOOLBOX_ENCODER 0 #define CONFIG_HEVC_AMF_ENCODER 0 -#define CONFIG_HEVC_MEDIACODEC_ENCODER 0 #define CONFIG_HEVC_MF_ENCODER 0 #define CONFIG_HEVC_NVENC_ENCODER 0 #define CONFIG_HEVC_QSV_ENCODER 0 @@ -926,6 +920,7 @@ #define CONFIG_VP9_VAAPI_HWACCEL 0 #define CONFIG_VP9_VDPAU_HWACCEL 0 #define CONFIG_VP9_VIDEOTOOLBOX_HWACCEL 0 +#define CONFIG_VP9_VULKAN_HWACCEL 0 #define CONFIG_WMV3_D3D11VA_HWACCEL 0 #define CONFIG_WMV3_D3D11VA2_HWACCEL 0 #define CONFIG_WMV3_DXVA2_HWACCEL 0 diff -Nru thunderbird-140.10.0esr/media/ffvpx/config_override.h thunderbird-140.10.1esr/media/ffvpx/config_override.h --- thunderbird-140.10.0esr/media/ffvpx/config_override.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/config_override.h 2026-04-29 18:38:26.000000000 +0000 @@ -1,5 +1,21 @@ // This file contains overrides for config.h, that can be platform-specific. +// CBS is required for VP9 and AV1 decoding. +#if !defined(MOZ_FFVPX_AUDIOONLY) +#undef CONFIG_CBS +#define CONFIG_CBS 1 +#undef CONFIG_CBS_VP9 +#define CONFIG_CBS_VP9 1 +#endif + +// libdav1d is the AV1 decoder; only built on video configurations. +#undef CONFIG_LIBDAV1D +#if defined(MOZ_FFVPX_AUDIOONLY) +#define CONFIG_LIBDAV1D 0 +#else +#define CONFIG_LIBDAV1D 1 +#endif + #undef CONFIG_FFT #undef CONFIG_RDFT #define CONFIG_FFT 1 @@ -65,3 +81,51 @@ #undef HAVE_GETAUXVAL #define HAVE_GETAUXVAL 0 #endif + +/** + * Android hardware decoding via MediaCodec NDK +*/ + +#undef CONFIG_MEDIACODEC +#undef CONFIG_AAC_MEDIACODEC_DECODER +#undef CONFIG_H264_MEDIACODEC_DECODER +#undef CONFIG_HEVC_MEDIACODEC_DECODER +#undef CONFIG_VP8_MEDIACODEC_DECODER +#undef CONFIG_VP9_MEDIACODEC_DECODER +#undef CONFIG_AV1_MEDIACODEC_DECODER +#undef CONFIG_H264_MEDIACODEC_ENCODER +#undef CONFIG_HEVC_MEDIACODEC_ENCODER +#undef CONFIG_VP8_MEDIACODEC_ENCODER +#undef CONFIG_VP9_MEDIACODEC_ENCODER +#undef CONFIG_AV1_MEDIACODEC_ENCODER + +#if defined (MOZ_WIDGET_ANDROID) && !defined(MOZ_FFVPX_AUDIOONLY) + #define CONFIG_MEDIACODEC 1 + #define CONFIG_AAC_MEDIACODEC_DECODER 1 + #define CONFIG_H264_MEDIACODEC_DECODER 1 + #define CONFIG_HEVC_MEDIACODEC_DECODER 1 + #define CONFIG_VP8_MEDIACODEC_DECODER 1 + #define CONFIG_VP9_MEDIACODEC_DECODER 1 + #define CONFIG_AV1_MEDIACODEC_DECODER 1 + #define CONFIG_H264_MEDIACODEC_ENCODER 1 + #define CONFIG_HEVC_MEDIACODEC_ENCODER 1 + #define CONFIG_VP8_MEDIACODEC_ENCODER 1 + #define CONFIG_VP9_MEDIACODEC_ENCODER 1 + #define CONFIG_AV1_MEDIACODEC_ENCODER 1 +#else + #define CONFIG_MEDIACODEC 0 + #define CONFIG_AAC_MEDIACODEC_DECODER 0 + #define CONFIG_H264_MEDIACODEC_DECODER 0 + #define CONFIG_HEVC_MEDIACODEC_DECODER 0 + #define CONFIG_VP8_MEDIACODEC_DECODER 0 + #define CONFIG_VP9_MEDIACODEC_DECODER 0 + #define CONFIG_AV1_MEDIACODEC_DECODER 0 + #define CONFIG_H264_MEDIACODEC_ENCODER 0 + #define CONFIG_HEVC_MEDIACODEC_ENCODER 0 + #define CONFIG_VP8_MEDIACODEC_ENCODER 0 + #define CONFIG_VP9_MEDIACODEC_ENCODER 0 + #define CONFIG_AV1_MEDIACODEC_ENCODER 0 +#endif + +#define CONFIG_H264_MEDIACODEC_DECODER_EXTRADATA 0 +#define CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA 0 diff -Nru thunderbird-140.10.0esr/media/ffvpx/flac-alloc-failure.patch thunderbird-140.10.1esr/media/ffvpx/flac-alloc-failure.patch --- thunderbird-140.10.0esr/media/ffvpx/flac-alloc-failure.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/flac-alloc-failure.patch 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,37 @@ +diff --git a/media/ffvpx/libavcodec/flacdec.c b/media/ffvpx/libavcodec/flacdec.c +index 0c88f577a1..e6e6487470 100644 +--- a/media/ffvpx/libavcodec/flacdec.c ++++ b/media/ffvpx/libavcodec/flacdec.c +@@ -148,8 +148,10 @@ + return buf_size; + + av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size); +- if (!s->decoded_buffer) ++ if (!s->decoded_buffer) { ++ memset(s->decoded, 0, sizeof(s->decoded)); + return AVERROR(ENOMEM); ++ } + + ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL, + s->decoded_buffer, +@@ -164,8 +166,10 @@ + return buf_size; + + av_fast_malloc(&s->decoded_buffer_33bps, &s->decoded_buffer_size_33bps, buf_size); +- if (!s->decoded_buffer_33bps) ++ if (!s->decoded_buffer_33bps) { ++ s->decoded_33bps = NULL; + return AVERROR(ENOMEM); ++ } + + ret = av_samples_fill_arrays((uint8_t **)&s->decoded_33bps, NULL, + s->decoded_buffer_33bps, +@@ -665,7 +669,7 @@ + fi.samplerate = s->stream_info.samplerate; + s->stream_info.samplerate = s->avctx->sample_rate = fi.samplerate; + +- if (!s->got_streaminfo) { ++ if (!s->got_streaminfo || !s->decoded_buffer) { + ret = allocate_buffers(s); + if (ret < 0) + return ret; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libaomenc-svc.patch thunderbird-140.10.1esr/media/ffvpx/libaomenc-svc.patch --- thunderbird-140.10.0esr/media/ffvpx/libaomenc-svc.patch 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libaomenc-svc.patch 2026-04-29 18:38:25.000000000 +0000 @@ -119,8 +119,8 @@ #if AOM_ENCODER_ABI_VERSION >= 23 { const AVDictionaryEntry *en = NULL; -@@ -1310,6 +1385,25 @@ FF_ENABLE_DEPRECATION_WARNINGS - +@@ -1395,6 +1395,25 @@ + if (frame->pict_type == AV_PICTURE_TYPE_I) flags |= AOM_EFLAG_FORCE_KF; + @@ -142,9 +142,9 @@ + return res; + } + } - } - - res = aom_codec_encode(&ctx->encoder, rawimg, timestamp, duration, flags); + + res = add_hdr_plus(avctx, rawimg, frame); + if (res < 0) @@ -1538,6 +1632,7 @@ static const AVOption options[] = { { "enable-masked-comp", "Enable masked compound", OFFSET(enable_masked_comp), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, { "enable-interintra-comp", "Enable interintra compound", OFFSET(enable_interintra_comp), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE}, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264dsp_init_aarch64.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264dsp_init_aarch64.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264dsp_init_aarch64.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264dsp_init_aarch64.c 2026-04-29 18:38:26.000000000 +0000 @@ -112,55 +112,55 @@ int cpu_flags = av_get_cpu_flags(); if (have_neon(cpu_flags) && bit_depth == 8) { - c->h264_v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; - c->h264_h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; - c->h264_v_loop_filter_luma_intra= ff_h264_v_loop_filter_luma_intra_neon; - c->h264_h_loop_filter_luma_intra= ff_h264_h_loop_filter_luma_intra_neon; + c->v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; + c->h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; + c->v_loop_filter_luma_intra= ff_h264_v_loop_filter_luma_intra_neon; + c->h_loop_filter_luma_intra= ff_h264_h_loop_filter_luma_intra_neon; - c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; - c->h264_v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon; + c->v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; + c->v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon; if (chroma_format_idc <= 1) { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon; + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; + c->h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon; + c->h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon; } else { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon; - c->h264_h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon; + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon; + c->h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon; + c->h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon; + c->h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon; } - c->weight_h264_pixels_tab[0] = ff_weight_h264_pixels_16_neon; - c->weight_h264_pixels_tab[1] = ff_weight_h264_pixels_8_neon; - c->weight_h264_pixels_tab[2] = ff_weight_h264_pixels_4_neon; - - c->biweight_h264_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; - c->biweight_h264_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; - c->biweight_h264_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; - - c->h264_idct_add = ff_h264_idct_add_neon; - c->h264_idct_dc_add = ff_h264_idct_dc_add_neon; - c->h264_idct_add16 = ff_h264_idct_add16_neon; - c->h264_idct_add16intra = ff_h264_idct_add16intra_neon; + c->weight_pixels_tab[0] = ff_weight_h264_pixels_16_neon; + c->weight_pixels_tab[1] = ff_weight_h264_pixels_8_neon; + c->weight_pixels_tab[2] = ff_weight_h264_pixels_4_neon; + + c->biweight_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; + c->biweight_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; + c->biweight_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; + + c->idct_add = ff_h264_idct_add_neon; + c->idct_dc_add = ff_h264_idct_dc_add_neon; + c->idct_add16 = ff_h264_idct_add16_neon; + c->idct_add16intra = ff_h264_idct_add16intra_neon; if (chroma_format_idc <= 1) - c->h264_idct_add8 = ff_h264_idct_add8_neon; - c->h264_idct8_add = ff_h264_idct8_add_neon; - c->h264_idct8_dc_add = ff_h264_idct8_dc_add_neon; - c->h264_idct8_add4 = ff_h264_idct8_add4_neon; + c->idct_add8 = ff_h264_idct_add8_neon; + c->idct8_add = ff_h264_idct8_add_neon; + c->idct8_dc_add = ff_h264_idct8_dc_add_neon; + c->idct8_add4 = ff_h264_idct8_add4_neon; } else if (have_neon(cpu_flags) && bit_depth == 10) { - c->h264_v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon_10; - c->h264_v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon_10; + c->v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon_10; + c->v_loop_filter_chroma_intra = ff_h264_v_loop_filter_chroma_intra_neon_10; if (chroma_format_idc <= 1) { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon_10; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10; + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon_10; + c->h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; + c->h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_mbaff_intra_neon_10; } else { - c->h264_h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon_10; - c->h264_h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon_10; - c->h264_h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon_10; - c->h264_h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon_10; + c->h_loop_filter_chroma_mbaff = ff_h264_h_loop_filter_chroma_neon_10; + c->h_loop_filter_chroma_intra = ff_h264_h_loop_filter_chroma422_intra_neon_10; + c->h_loop_filter_chroma_mbaff_intra = ff_h264_h_loop_filter_chroma_intra_neon_10; } } } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264pred_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264pred_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_init.c 2026-04-29 18:38:26.000000000 +0000 @@ -25,6 +25,19 @@ #include "libavcodec/avcodec.h" #include "libavcodec/h264pred.h" +/* PERFORMANCE WARNING: + * These assembly optimizations have been identified as "performance regressions." + * Due to advancements in modern CPU micro-architectures and compiler optimization + * the C implementations now consistently outperform these handwritten routines. + * + * Keep them here for historical reference. + * + * New optimizations are highly welcome! If you can provide an optimized + * implementation that demonstrably beats the current C version in rigorous + * benchmarks, please submit a patch. + */ +#define ENABLE_INEFFICIENT_ASM 0 + void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride); void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride); void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride); @@ -69,16 +82,22 @@ { if (bit_depth == 8) { if (chroma_format_idc <= 1) { +#if ENABLE_INEFFICIENT_ASM h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon; h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon; +#endif if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon; +#if ENABLE_INEFFICIENT_ASM h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon; +#endif if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) { +#if ENABLE_INEFFICIENT_ASM h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon; h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon; h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon; +#endif h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon; h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon; h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon; @@ -86,27 +105,37 @@ } } +#if ENABLE_INEFFICIENT_ASM h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_neon; +#endif h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vert_neon; h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_hor_neon; +#if ENABLE_INEFFICIENT_ASM h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon; h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon; h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon; +#endif if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; } if (bit_depth == 10) { if (chroma_format_idc <= 1) { +#if ENABLE_INEFFICIENT_ASM h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon_10; +#endif h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon_10; if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon_10; +#if ENABLE_INEFFICIENT_ASM h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon_10; +#endif if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) { +#if ENABLE_INEFFICIENT_ASM h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon_10; h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon_10; +#endif h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon_10; h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon_10; h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon_10; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264pred_neon.S thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_neon.S --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/h264pred_neon.S 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/h264pred_neon.S 2026-04-29 18:38:26.000000000 +0000 @@ -489,10 +489,10 @@ mul v2.8h, v2.8h, v0.8h mul v3.8h, v3.8h, v0.8h addp v2.8h, v2.8h, v3.8h - addp v2.8h, v2.8h, v2.8h - addp v2.4h, v2.4h, v2.4h - sshll v3.4s, v2.4h, #2 - saddw v2.4s, v3.4s, v2.4h + saddlp v2.4s, v2.8h + addp v2.4s, v2.4s, v2.4s + shl v3.4s, v2.4s, #2 + add v2.4s, v3.4s, v2.4s rshrn v4.4h, v2.4s, #6 trn2 v5.4h, v4.4h, v4.4h add v2.4h, v4.4h, v5.4h @@ -506,14 +506,13 @@ sxtl v6.4s, v5.4h // c mov v0.h[0], wzr - mul v0.8h, v0.8h, v4.h[0] dup v16.4s, v2.s[0] dup v17.4s, v2.s[0] dup v2.8h, v4.h[0] // b dup v3.4s, v6.s[0] // c sshll v2.4s, v2.4h, #3 // b * 8 - saddw v16.4s, v16.4s, v0.4h - saddw2 v17.4s, v17.4s, v0.8h + smlal v16.4s, v0.4h, v4.h[0] + smlal2 v17.4s, v0.8h, v4.h[0] sub v3.4s, v3.4s, v2.4s mov w3, #16 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/hpeldsp_neon.S thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/hpeldsp_neon.S --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/aarch64/hpeldsp_neon.S 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/aarch64/hpeldsp_neon.S 2026-04-29 18:38:25.000000000 +0000 @@ -50,12 +50,13 @@ .endm .macro pixels16_x2 rnd=1, avg=0 -1: ld1 {v0.16b, v1.16b}, [x1], x2 - ld1 {v2.16b, v3.16b}, [x1], x2 +1: + ldur q1, [x1, #1] + ld1 {v0.16b}, [x1], x2 subs w3, w3, #2 - ext v1.16b, v0.16b, v1.16b, #1 + ldur q3, [x1, #1] + ld1 {v2.16b}, [x1], x2 avg v0.16b, v0.16b, v1.16b - ext v3.16b, v2.16b, v3.16b, #1 avg v2.16b, v2.16b, v3.16b .if \avg ld1 {v1.16b}, [x0], x2 @@ -108,20 +109,20 @@ .macro pixels16_xy2 rnd=1, avg=0 sub w3, w3, #2 - ld1 {v0.16b, v1.16b}, [x1], x2 - ld1 {v4.16b, v5.16b}, [x1], x2 + ldur q1, [x1, #1] + ld1 {v0.16b}, [x1], x2 NRND movi v26.8H, #1 - ext v1.16b, v0.16b, v1.16b, #1 - ext v5.16b, v4.16b, v5.16b, #1 + ldur q5, [x1, #1] + ld1 {v4.16b}, [x1], x2 uaddl v16.8h, v0.8b, v1.8b uaddl2 v20.8h, v0.16b, v1.16b uaddl v18.8h, v4.8b, v5.8b uaddl2 v22.8h, v4.16b, v5.16b 1: subs w3, w3, #2 - ld1 {v0.16b, v1.16b}, [x1], x2 + ldur q30, [x1, #1] + ld1 {v0.16b}, [x1], x2 add v24.8h, v16.8h, v18.8h NRND add v24.8H, v24.8H, v26.8H - ext v30.16b, v0.16b, v1.16b, #1 add v1.8h, v20.8h, v22.8h mshrn v28.8b, v24.8h, #2 NRND add v1.8H, v1.8H, v26.8H @@ -131,12 +132,12 @@ urhadd v28.16b, v28.16b, v16.16b .endif uaddl v16.8h, v0.8b, v30.8b - ld1 {v2.16b, v3.16b}, [x1], x2 + ldur q3, [x1, #1] + ld1 {v2.16b}, [x1], x2 uaddl2 v20.8h, v0.16b, v30.16b st1 {v28.16b}, [x0], x2 add v24.8h, v16.8h, v18.8h NRND add v24.8H, v24.8H, v26.8H - ext v3.16b, v2.16b, v3.16b, #1 add v0.8h, v20.8h, v22.8h mshrn v30.8b, v24.8h, #2 NRND add v0.8H, v0.8H, v26.8H @@ -150,10 +151,10 @@ st1 {v30.16b}, [x0], x2 b.gt 1b - ld1 {v0.16b, v1.16b}, [x1], x2 + ldur q30, [x1, #1] + ld1 {v0.16b}, [x1], x2 add v24.8h, v16.8h, v18.8h NRND add v24.8H, v24.8H, v26.8H - ext v30.16b, v0.16b, v1.16b, #1 add v1.8h, v20.8h, v22.8h mshrn v28.8b, v24.8h, #2 NRND add v1.8H, v1.8H, v26.8H @@ -206,10 +207,11 @@ .endm .macro pixels8_x2 rnd=1, avg=0 -1: ld1 {v0.8b, v1.8b}, [x1], x2 - ext v1.8b, v0.8b, v1.8b, #1 - ld1 {v2.8b, v3.8b}, [x1], x2 - ext v3.8b, v2.8b, v3.8b, #1 +1: + ldur d1, [x1, #1] + ld1 {v0.8b}, [x1], x2 + ldur d3, [x1, #1] + ld1 {v2.8b}, [x1], x2 subs w3, w3, #2 avg v0.8b, v0.8b, v1.8b avg v2.8b, v2.8b, v3.8b @@ -263,22 +265,23 @@ .endm .macro pixels8_xy2 rnd=1, avg=0 + ldur d4, [x1, #1] sub w3, w3, #2 - ld1 {v0.16b}, [x1], x2 - ld1 {v1.16b}, [x1], x2 + ld1 {v0.8b}, [x1], x2 NRND movi v19.8H, #1 - ext v4.16b, v0.16b, v4.16b, #1 - ext v6.16b, v1.16b, v6.16b, #1 + ldur d6, [x1, #1] + ld1 {v1.8b}, [x1], x2 uaddl v16.8h, v0.8b, v4.8b uaddl v17.8h, v1.8b, v6.8b 1: subs w3, w3, #2 - ld1 {v0.16b}, [x1], x2 + ldur d4, [x1, #1] + ld1 {v0.8b}, [x1], x2 add v18.8h, v16.8h, v17.8h - ext v4.16b, v0.16b, v4.16b, #1 NRND add v18.8H, v18.8H, v19.8H uaddl v16.8h, v0.8b, v4.8b mshrn v5.8b, v18.8h, #2 - ld1 {v1.16b}, [x1], x2 + ldur d6, [x1, #1] + ld1 {v1.8b}, [x1], x2 add v18.8h, v16.8h, v17.8h .if \avg ld1 {v7.8b}, [x0] @@ -291,14 +294,13 @@ ld1 {v5.8b}, [x0] urhadd v7.8b, v7.8b, v5.8b .endif - ext v6.16b, v1.16b, v6.16b, #1 uaddl v17.8h, v1.8b, v6.8b st1 {v7.8b}, [x0], x2 b.gt 1b - ld1 {v0.16b}, [x1], x2 + ldur d4, [x1, #1] + ld1 {v0.8b}, [x1], x2 add v18.8h, v16.8h, v17.8h - ext v4.16b, v0.16b, v4.16b, #1 NRND add v18.8H, v18.8H, v19.8H uaddl v16.8h, v0.8b, v4.8b mshrn v5.8b, v18.8h, #2 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_header.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_header.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Audio and Video frame extraction + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2003 Michael Niedermayer + * Copyright (c) 2009 Alex Converse + * + * 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 "adts_header.h" +#include "adts_parser.h" +#include "get_bits.h" +#include "mpeg4audio.h" +#include "libavutil/avassert.h" + +int ff_adts_header_parse(GetBitContext *gbc, AACADTSHeaderInfo *hdr) +{ + int size, rdb, ch, sr; + int aot, crc_abs; + + memset(hdr, 0, sizeof(*hdr)); + + if (get_bits(gbc, 12) != 0xfff) + return AAC_PARSE_ERROR_SYNC; + + skip_bits1(gbc); /* id */ + skip_bits(gbc, 2); /* layer */ + crc_abs = get_bits1(gbc); /* protection_absent */ + aot = get_bits(gbc, 2); /* profile_objecttype */ + sr = get_bits(gbc, 4); /* sample_frequency_index */ + if (!ff_mpeg4audio_sample_rates[sr]) + return AAC_PARSE_ERROR_SAMPLE_RATE; + skip_bits1(gbc); /* private_bit */ + ch = get_bits(gbc, 3); /* channel_configuration */ + + skip_bits1(gbc); /* original/copy */ + skip_bits1(gbc); /* home */ + + /* adts_variable_header */ + skip_bits1(gbc); /* copyright_identification_bit */ + skip_bits1(gbc); /* copyright_identification_start */ + size = get_bits(gbc, 13); /* aac_frame_length */ + if (size < AV_AAC_ADTS_HEADER_SIZE) + return AAC_PARSE_ERROR_FRAME_SIZE; + + skip_bits(gbc, 11); /* adts_buffer_fullness */ + rdb = get_bits(gbc, 2); /* number_of_raw_data_blocks_in_frame */ + + hdr->object_type = aot + 1; + hdr->chan_config = ch; + hdr->crc_absent = crc_abs; + hdr->num_aac_frames = rdb + 1; + hdr->sampling_index = sr; + hdr->sample_rate = ff_mpeg4audio_sample_rates[sr]; + hdr->samples = (rdb + 1) * 1024; + hdr->bit_rate = size * 8 * hdr->sample_rate / hdr->samples; + hdr->frame_length = size; + + return size; +} + +int ff_adts_header_parse_buf(const uint8_t buf[AV_AAC_ADTS_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE], + AACADTSHeaderInfo *hdr) +{ + GetBitContext gb; + av_unused int ret = init_get_bits8(&gb, buf, AV_AAC_ADTS_HEADER_SIZE); + av_assert1(ret >= 0); + return ff_adts_header_parse(&gb, hdr); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_header.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_header.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_header.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * AAC ADTS header decoding prototypes and structures + * Copyright (c) 2003 Fabrice Bellard + * Copyright (c) 2003 Michael Niedermayer + * + * 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 + */ + +#ifndef AVCODEC_ADTS_HEADER_H +#define AVCODEC_ADTS_HEADER_H + +#include "adts_parser.h" +#include "defs.h" + +typedef enum { + AAC_PARSE_ERROR_SYNC = -0x1030c0a, + AAC_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a, + AAC_PARSE_ERROR_FRAME_SIZE = -0x4030c0a, +} AACParseError; + +typedef struct AACADTSHeaderInfo { + uint32_t sample_rate; + uint32_t samples; + uint32_t bit_rate; + uint8_t crc_absent; + uint8_t object_type; + uint8_t sampling_index; + uint8_t chan_config; + uint8_t num_aac_frames; + uint32_t frame_length; +} AACADTSHeaderInfo; + +struct GetBitContext; + +/** + * Parse the ADTS frame header to the end of the variable header, which is + * the first 54 bits. + * @param[in] gbc BitContext containing the first 54 bits of the frame. + * @param[out] hdr Pointer to struct where header info is written. + * @return the size in bytes of the header parsed on success and + * AAC_PARSE_ERROR_* values otherwise. + */ +int ff_adts_header_parse(struct GetBitContext *gbc, AACADTSHeaderInfo *hdr); + +/** + * Wrapper around ff_adts_header_parse() for users that don't already have + * a suitable GetBitContext. + */ +int ff_adts_header_parse_buf(const uint8_t buf[AV_AAC_ADTS_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE], + AACADTSHeaderInfo *hdr); + +/** + * Parse the ADTS frame header contained in the buffer, which is + * the first 54 bits. + * @param[in] buf Pointer to buffer containing the first 54 bits of the frame. + * @param[in] size Size of buffer containing the first 54 bits of the frame. + * @param[out] phdr Pointer to pointer to struct AACADTSHeaderInfo for which + * memory is allocated and header info is written into it. After using the header + * information, the allocated memory must be freed by using av_free. + * @return 0 on success, AAC_PARSE_ERROR_* values on invalid input and + * ordinary AVERROR codes otherwise. + */ +int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, size_t size); + +#endif /* AVCODEC_ADTS_HEADER_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_parser.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * 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 "config.h" + +#include +#include +#include + +#include "libavutil/error.h" +#include "libavutil/mem.h" +#include "adts_header.h" +#include "adts_parser.h" + +int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, uint8_t *frames) +{ +#if CONFIG_ADTS_HEADER + uint8_t tmpbuf[AV_AAC_ADTS_HEADER_SIZE + AV_INPUT_BUFFER_PADDING_SIZE]; + AACADTSHeaderInfo hdr; + int err; + if (!buf) + return AVERROR(EINVAL); + memcpy(tmpbuf, buf, AV_AAC_ADTS_HEADER_SIZE); + err = ff_adts_header_parse_buf(tmpbuf, &hdr); + if (err < 0) + return err; + *samples = hdr.samples; + *frames = hdr.num_aac_frames; + return 0; +#else + return AVERROR(ENOSYS); +#endif +} + +int avpriv_adts_header_parse(AACADTSHeaderInfo **phdr, const uint8_t *buf, size_t size) +{ +#if CONFIG_ADTS_HEADER + int ret = 0; + int allocated = 0; + + if (!phdr || !buf || size < AV_AAC_ADTS_HEADER_SIZE) + return AVERROR_INVALIDDATA; + + if (!*phdr) { + allocated = 1; + *phdr = av_mallocz(sizeof(AACADTSHeaderInfo)); + } + if (!*phdr) + return AVERROR(ENOMEM); + + ret = ff_adts_header_parse_buf(buf, *phdr); + if (ret < 0) { + if (allocated) + av_freep(phdr); + return ret; + } + + return 0; +#else + return AVERROR(ENOSYS); +#endif +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_parser.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/adts_parser.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/adts_parser.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * 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 + */ + +#ifndef AVCODEC_ADTS_PARSER_H +#define AVCODEC_ADTS_PARSER_H + +#include +#include + +#define AV_AAC_ADTS_HEADER_SIZE 7 + +/** + * Extract the number of samples and frames from AAC data. + * @param[in] buf pointer to AAC data buffer + * @param[out] samples Pointer to where number of samples is written + * @param[out] frames Pointer to where number of frames is written + * @return Returns 0 on success, error code on failure. + */ +int av_adts_header_parse(const uint8_t *buf, uint32_t *samples, + uint8_t *frames); + +#endif /* AVCODEC_ADTS_PARSER_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/allcodecs.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/allcodecs.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/allcodecs.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/allcodecs.c 2026-04-29 18:38:25.000000000 +0000 @@ -29,10 +29,13 @@ #include "config.h" #include "config_components.h" +#include "libavutil/avassert.h" #include "libavutil/thread.h" +#include "avcodec.h" #include "codec.h" #include "codec_id.h" #include "codec_internal.h" +#include "codec_desc.h" extern const FFCodec ff_a64multi_encoder; extern const FFCodec ff_a64multi5_encoder; @@ -47,6 +50,7 @@ extern const FFCodec ff_ansi_decoder; extern const FFCodec ff_apng_encoder; extern const FFCodec ff_apng_decoder; +extern const FFCodec ff_apv_decoder; extern const FFCodec ff_arbc_decoder; extern const FFCodec ff_argo_decoder; extern const FFCodec ff_asv1_encoder; @@ -155,11 +159,13 @@ extern const FFCodec ff_h264_mmal_decoder; extern const FFCodec ff_h264_qsv_decoder; extern const FFCodec ff_h264_rkmpp_decoder; +extern const FFCodec ff_h264_rkmpp_encoder; extern const FFCodec ff_hap_encoder; extern const FFCodec ff_hap_decoder; extern const FFCodec ff_hevc_decoder; extern const FFCodec ff_hevc_qsv_decoder; extern const FFCodec ff_hevc_rkmpp_decoder; +extern const FFCodec ff_hevc_rkmpp_encoder; extern const FFCodec ff_hevc_v4l2m2m_decoder; extern const FFCodec ff_hnm4_video_decoder; extern const FFCodec ff_hq_hqa_decoder; @@ -247,6 +253,7 @@ extern const FFCodec ff_pbm_decoder; extern const FFCodec ff_pcx_encoder; extern const FFCodec ff_pcx_decoder; +extern const FFCodec ff_pdv_encoder; extern const FFCodec ff_pdv_decoder; extern const FFCodec ff_pfm_encoder; extern const FFCodec ff_pfm_decoder; @@ -268,6 +275,8 @@ extern const FFCodec ff_prores_decoder; extern const FFCodec ff_prores_aw_encoder; extern const FFCodec ff_prores_ks_encoder; +extern const FFCodec ff_prores_ks_vulkan_encoder; +extern const FFCodec ff_prores_raw_decoder; extern const FFCodec ff_prosumer_decoder; extern const FFCodec ff_psd_decoder; extern const FFCodec ff_ptx_decoder; @@ -432,6 +441,7 @@ extern const FFCodec ff_ac3_fixed_encoder; extern const FFCodec ff_ac3_fixed_decoder; extern const FFCodec ff_acelp_kelvin_decoder; +extern const FFCodec ff_ahx_decoder; extern const FFCodec ff_alac_encoder; extern const FFCodec ff_alac_decoder; extern const FFCodec ff_als_decoder; @@ -476,6 +486,7 @@ extern const FFCodec ff_ftr_decoder; extern const FFCodec ff_g723_1_encoder; extern const FFCodec ff_g723_1_decoder; +extern const FFCodec ff_g728_decoder; extern const FFCodec ff_g729_decoder; extern const FFCodec ff_gsm_decoder; extern const FFCodec ff_gsm_ms_decoder; @@ -645,6 +656,7 @@ extern const FFCodec ff_adpcm_aica_decoder; extern const FFCodec ff_adpcm_argo_decoder; extern const FFCodec ff_adpcm_argo_encoder; +extern const FFCodec ff_adpcm_circus_decoder; extern const FFCodec ff_adpcm_ct_decoder; extern const FFCodec ff_adpcm_dtk_decoder; extern const FFCodec ff_adpcm_ea_decoder; @@ -673,10 +685,15 @@ extern const FFCodec ff_adpcm_ima_dk4_decoder; extern const FFCodec ff_adpcm_ima_ea_eacs_decoder; extern const FFCodec ff_adpcm_ima_ea_sead_decoder; +extern const FFCodec ff_adpcm_ima_escape_decoder; +extern const FFCodec ff_adpcm_ima_hvqm2_decoder; +extern const FFCodec ff_adpcm_ima_hvqm4_decoder; extern const FFCodec ff_adpcm_ima_iss_decoder; +extern const FFCodec ff_adpcm_ima_magix_decoder; extern const FFCodec ff_adpcm_ima_moflex_decoder; extern const FFCodec ff_adpcm_ima_mtf_decoder; extern const FFCodec ff_adpcm_ima_oki_decoder; +extern const FFCodec ff_adpcm_ima_pda_decoder; extern const FFCodec ff_adpcm_ima_qt_encoder; extern const FFCodec ff_adpcm_ima_qt_decoder; extern const FFCodec ff_adpcm_ima_rad_decoder; @@ -691,7 +708,10 @@ extern const FFCodec ff_adpcm_ms_encoder; extern const FFCodec ff_adpcm_ms_decoder; extern const FFCodec ff_adpcm_mtaf_decoder; +extern const FFCodec ff_adpcm_n64_decoder; extern const FFCodec ff_adpcm_psx_decoder; +extern const FFCodec ff_adpcm_psxc_decoder; +extern const FFCodec ff_adpcm_sanyo_decoder; extern const FFCodec ff_adpcm_sbpro_2_decoder; extern const FFCodec ff_adpcm_sbpro_3_decoder; extern const FFCodec ff_adpcm_sbpro_4_decoder; @@ -786,6 +806,8 @@ extern const FFCodec ff_liblc3_encoder; extern const FFCodec ff_liblc3_decoder; extern const FFCodec ff_libmp3lame_encoder; +extern const FFCodec ff_libmpeghdec_decoder; +extern const FFCodec ff_liboapv_encoder; extern const FFCodec ff_libopencore_amrnb_encoder; extern const FFCodec ff_libopencore_amrnb_decoder; extern const FFCodec ff_libopencore_amrwb_decoder; @@ -798,6 +820,8 @@ extern const FFCodec ff_libspeex_encoder; extern const FFCodec ff_libspeex_decoder; extern const FFCodec ff_libsvtav1_encoder; +extern const FFCodec ff_libsvtjpegxs_encoder; +extern const FFCodec ff_libsvtjpegxs_decoder; extern const FFCodec ff_libtheora_encoder; extern const FFCodec ff_libtwolame_encoder; extern const FFCodec ff_libuavs3d_decoder; @@ -840,20 +864,27 @@ /* hwaccel hooks only, so prefer external decoders */ extern const FFCodec ff_av1_decoder; extern const FFCodec ff_av1_cuvid_decoder; +extern const FFCodec ff_av1_d3d12va_encoder; extern const FFCodec ff_av1_mediacodec_decoder; extern const FFCodec ff_av1_mediacodec_encoder; extern const FFCodec ff_av1_nvenc_encoder; extern const FFCodec ff_av1_qsv_decoder; extern const FFCodec ff_av1_qsv_encoder; extern const FFCodec ff_av1_amf_encoder; +extern const FFCodec ff_av1_amf_decoder; extern const FFCodec ff_av1_mf_encoder; extern const FFCodec ff_av1_vaapi_encoder; +extern const FFCodec ff_av1_vulkan_encoder; extern const FFCodec ff_libopenh264_encoder; extern const FFCodec ff_libopenh264_decoder; extern const FFCodec ff_h264_amf_encoder; +extern const FFCodec ff_h264_amf_decoder; extern const FFCodec ff_h264_cuvid_decoder; +extern const FFCodec ff_h264_d3d12va_encoder; extern const FFCodec ff_h264_mf_encoder; extern const FFCodec ff_h264_nvenc_encoder; +extern const FFCodec ff_h264_oh_decoder; +extern const FFCodec ff_h264_oh_encoder; extern const FFCodec ff_h264_omx_encoder; extern const FFCodec ff_h264_qsv_encoder; extern const FFCodec ff_h264_v4l2m2m_encoder; @@ -861,12 +892,15 @@ extern const FFCodec ff_h264_videotoolbox_encoder; extern const FFCodec ff_h264_vulkan_encoder; extern const FFCodec ff_hevc_amf_encoder; +extern const FFCodec ff_hevc_amf_decoder; extern const FFCodec ff_hevc_cuvid_decoder; extern const FFCodec ff_hevc_d3d12va_encoder; extern const FFCodec ff_hevc_mediacodec_decoder; extern const FFCodec ff_hevc_mediacodec_encoder; extern const FFCodec ff_hevc_mf_encoder; extern const FFCodec ff_hevc_nvenc_encoder; +extern const FFCodec ff_hevc_oh_decoder; +extern const FFCodec ff_hevc_oh_encoder; extern const FFCodec ff_hevc_qsv_encoder; extern const FFCodec ff_hevc_v4l2m2m_encoder; extern const FFCodec ff_hevc_vaapi_encoder; @@ -896,6 +930,7 @@ extern const FFCodec ff_vp8_qsv_decoder; extern const FFCodec ff_vp8_v4l2m2m_encoder; extern const FFCodec ff_vp8_vaapi_encoder; +extern const FFCodec ff_vp9_amf_decoder; extern const FFCodec ff_vp9_cuvid_decoder; extern const FFCodec ff_vp9_mediacodec_decoder; extern const FFCodec ff_vp9_mediacodec_encoder; @@ -934,14 +969,11 @@ FF_DISABLE_DEPRECATION_WARNINGS switch (codec->p.type) { case AVMEDIA_TYPE_VIDEO: - codec->get_supported_config(NULL, &codec->p, - AV_CODEC_CONFIG_PIX_FORMAT, 0, - (const void **) &codec->p.pix_fmts, - &dummy); - codec->get_supported_config(NULL, &codec->p, - AV_CODEC_CONFIG_FRAME_RATE, 0, - (const void **) &codec->p.supported_framerates, - &dummy); + if (!codec->p.pix_fmts) + codec->get_supported_config(NULL, &codec->p, + AV_CODEC_CONFIG_PIX_FORMAT, 0, + (const void **) &codec->p.pix_fmts, + &dummy); break; case AVMEDIA_TYPE_AUDIO: codec->get_supported_config(NULL, &codec->p, @@ -990,6 +1022,7 @@ static const AVCodec *find_codec(enum AVCodecID id, int (*x)(const AVCodec *)) { const AVCodec *p, *experimental = NULL; + av_unused const AVCodecDescriptor *desc = avcodec_descriptor_get(id); void *i = 0; id = remap_deprecated_codec_id(id); @@ -998,6 +1031,7 @@ if (!x(p)) continue; if (p->id == id) { + av_assert1(!desc || !(desc->props & AV_CODEC_PROP_ENHANCEMENT)); if (p->capabilities & AV_CODEC_CAP_EXPERIMENTAL && !experimental) { experimental = p; } else @@ -1010,12 +1044,12 @@ const AVCodec *avcodec_find_encoder(enum AVCodecID id) { - return find_codec(id, av_codec_is_encoder); + return find_codec(id, ff_codec_is_encoder); } const AVCodec *avcodec_find_decoder(enum AVCodecID id) { - return find_codec(id, av_codec_is_decoder); + return find_codec(id, ff_codec_is_decoder); } static const AVCodec *find_codec_by_name(const char *name, int (*x)(const AVCodec *)) @@ -1038,10 +1072,10 @@ const AVCodec *avcodec_find_encoder_by_name(const char *name) { - return find_codec_by_name(name, av_codec_is_encoder); + return find_codec_by_name(name, ff_codec_is_encoder); } const AVCodec *avcodec_find_decoder_by_name(const char *name) { - return find_codec_by_name(name, av_codec_is_decoder); + return find_codec_by_name(name, ff_codec_is_decoder); } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264chroma_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264chroma_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264chroma_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264chroma_init_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,57 @@ +/* + * ARM NEON optimised H.264 chroma functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/cpu.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264chroma.h" + +void ff_put_h264_chroma_mc8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc4_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_put_h264_chroma_mc2_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +void ff_avg_h264_chroma_mc8_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc4_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); +void ff_avg_h264_chroma_mc2_neon(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, + int h, int x, int y); + +av_cold void ff_h264chroma_init_arm(H264ChromaContext *c, int bit_depth) +{ + const int high_bit_depth = bit_depth > 8; + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags) && !high_bit_depth) { + c->put_h264_chroma_pixels_tab[0] = ff_put_h264_chroma_mc8_neon; + c->put_h264_chroma_pixels_tab[1] = ff_put_h264_chroma_mc4_neon; + c->put_h264_chroma_pixels_tab[2] = ff_put_h264_chroma_mc2_neon; + + c->avg_h264_chroma_pixels_tab[0] = ff_avg_h264_chroma_mc8_neon; + c->avg_h264_chroma_pixels_tab[1] = ff_avg_h264_chroma_mc4_neon; + c->avg_h264_chroma_pixels_tab[2] = ff_avg_h264_chroma_mc2_neon; + } +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264dsp_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264dsp_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264dsp_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264dsp_init_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2010 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/h264dsp.h" +#include "libavcodec/arm/startcode.h" + +void ff_h264_v_loop_filter_luma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_luma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_v_loop_filter_chroma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma_neon(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); +void ff_h264_h_loop_filter_chroma422_neon(uint8_t *pix, ptrdiff_t stride, int alpha, + int beta, int8_t *tc0); + +void ff_weight_h264_pixels_16_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_8_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); +void ff_weight_h264_pixels_4_neon(uint8_t *dst, int stride, int height, + int log2_den, int weight, int offset); + +void ff_biweight_h264_pixels_16_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_8_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); +void ff_biweight_h264_pixels_4_neon(uint8_t *dst, uint8_t *src, int stride, + int height, int log2_den, int weightd, + int weights, int offset); + +void ff_h264_idct_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct_add16_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]); +void ff_h264_idct_add16intra_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]); +void ff_h264_idct_add8_neon(uint8_t **dest, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[15 * 8]); + +void ff_h264_idct8_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_dc_add_neon(uint8_t *dst, int16_t *block, int stride); +void ff_h264_idct8_add4_neon(uint8_t *dst, const int *block_offset, + int16_t *block, int stride, + const uint8_t nnzc[5 * 8]); + +static av_cold void h264dsp_init_neon(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + if (bit_depth == 8) { + c->v_loop_filter_luma = ff_h264_v_loop_filter_luma_neon; + c->h_loop_filter_luma = ff_h264_h_loop_filter_luma_neon; + c->v_loop_filter_chroma = ff_h264_v_loop_filter_chroma_neon; + + if (chroma_format_idc <= 1) + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma_neon; + else + c->h_loop_filter_chroma = ff_h264_h_loop_filter_chroma422_neon; + + c->weight_pixels_tab[0] = ff_weight_h264_pixels_16_neon; + c->weight_pixels_tab[1] = ff_weight_h264_pixels_8_neon; + c->weight_pixels_tab[2] = ff_weight_h264_pixels_4_neon; + + c->biweight_pixels_tab[0] = ff_biweight_h264_pixels_16_neon; + c->biweight_pixels_tab[1] = ff_biweight_h264_pixels_8_neon; + c->biweight_pixels_tab[2] = ff_biweight_h264_pixels_4_neon; + + c->idct_add = ff_h264_idct_add_neon; + c->idct_dc_add = ff_h264_idct_dc_add_neon; + c->idct_add16 = ff_h264_idct_add16_neon; + c->idct_add16intra = ff_h264_idct_add16intra_neon; + if (chroma_format_idc <= 1) + c->idct_add8 = ff_h264_idct_add8_neon; + c->idct8_add = ff_h264_idct8_add_neon; + c->idct8_dc_add = ff_h264_idct8_dc_add_neon; + c->idct8_add4 = ff_h264_idct8_add4_neon; + } +#endif // HAVE_NEON +} + +av_cold void ff_h264dsp_init_arm(H264DSPContext *c, const int bit_depth, + const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + +#if HAVE_ARMV6 + if (have_setend(cpu_flags)) + c->startcode_find_candidate = ff_startcode_find_candidate_armv6; +#endif + if (have_neon(cpu_flags)) + h264dsp_init_neon(c, bit_depth, chroma_format_idc); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264pred_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264pred_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/h264pred_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/h264pred_init_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/avcodec.h" +#include "libavcodec/h264pred.h" + +void ff_pred16x16_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred16x16_top_dc_neon(uint8_t *src, ptrdiff_t stride); + +void ff_pred8x8_vert_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_hor_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_plane_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_128_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_left_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_top_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l0t_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0lt_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_l00_dc_neon(uint8_t *src, ptrdiff_t stride); +void ff_pred8x8_0l0_dc_neon(uint8_t *src, ptrdiff_t stride); + +static av_cold void h264_pred_init_neon(H264PredContext *h, int codec_id, + const int bit_depth, + const int chroma_format_idc) +{ +#if HAVE_NEON + const int high_depth = bit_depth > 8; + + if (high_depth) + return; + + if (chroma_format_idc <= 1) { + h->pred8x8[VERT_PRED8x8 ] = ff_pred8x8_vert_neon; + h->pred8x8[HOR_PRED8x8 ] = ff_pred8x8_hor_neon; + if (codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred8x8[PLANE_PRED8x8] = ff_pred8x8_plane_neon; + h->pred8x8[DC_128_PRED8x8 ] = ff_pred8x8_128_dc_neon; + if (codec_id != AV_CODEC_ID_RV40 && codec_id != AV_CODEC_ID_VP7 && + codec_id != AV_CODEC_ID_VP8) { + h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_neon; + h->pred8x8[LEFT_DC_PRED8x8] = ff_pred8x8_left_dc_neon; + h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_neon; + h->pred8x8[ALZHEIMER_DC_L0T_PRED8x8] = ff_pred8x8_l0t_dc_neon; + h->pred8x8[ALZHEIMER_DC_0LT_PRED8x8] = ff_pred8x8_0lt_dc_neon; + h->pred8x8[ALZHEIMER_DC_L00_PRED8x8] = ff_pred8x8_l00_dc_neon; + h->pred8x8[ALZHEIMER_DC_0L0_PRED8x8] = ff_pred8x8_0l0_dc_neon; + } + } + + h->pred16x16[DC_PRED8x8 ] = ff_pred16x16_dc_neon; + h->pred16x16[VERT_PRED8x8 ] = ff_pred16x16_vert_neon; + h->pred16x16[HOR_PRED8x8 ] = ff_pred16x16_hor_neon; + h->pred16x16[LEFT_DC_PRED8x8] = ff_pred16x16_left_dc_neon; + h->pred16x16[TOP_DC_PRED8x8 ] = ff_pred16x16_top_dc_neon; + h->pred16x16[DC_128_PRED8x8 ] = ff_pred16x16_128_dc_neon; + if (codec_id != AV_CODEC_ID_SVQ3 && codec_id != AV_CODEC_ID_RV40 && + codec_id != AV_CODEC_ID_VP7 && codec_id != AV_CODEC_ID_VP8) + h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_plane_neon; +#endif // HAVE_NEON +} + +av_cold void ff_h264_pred_init_arm(H264PredContext *h, int codec_id, + int bit_depth, const int chroma_format_idc) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) + h264_pred_init_neon(h, codec_id, bit_depth, chroma_format_idc); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_arm.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_arm.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_arm.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_arm.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + */ + +#ifndef AVCODEC_ARM_HPELDSP_ARM_H +#define AVCODEC_ARM_HPELDSP_ARM_H + +#include "libavcodec/hpeldsp.h" + +void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags); +void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags); + +#endif /* AVCODEC_ARM_HPELDSP_ARM_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * ARM-optimized halfpel functions + * Copyright (c) 2001 Lionel Ulmer + * + * 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 "libavutil/arm/cpu.h" +#include "libavutil/attributes.h" +#include "libavcodec/pixels.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels8_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_no_rnd_pixels8_x2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_y2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); +void ff_put_no_rnd_pixels8_xy2_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +void ff_put_pixels16_arm(uint8_t *block, const uint8_t *pixels, ptrdiff_t line_size, int h); + +CALL_2X_PIXELS(ff_put_pixels16_x2_arm, ff_put_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_y2_arm, ff_put_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_pixels16_xy2_arm, ff_put_pixels8_xy2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_x2_arm, ff_put_no_rnd_pixels8_x2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_y2_arm, ff_put_no_rnd_pixels8_y2_arm, 8) +CALL_2X_PIXELS(ff_put_no_rnd_pixels16_xy2_arm, ff_put_no_rnd_pixels8_xy2_arm,8) + +av_cold void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags) +{ + int cpu_flags = av_get_cpu_flags(); + + c->put_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_arm; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_arm; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_arm; + c->put_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_arm; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_arm; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_arm; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_arm; + c->put_no_rnd_pixels_tab[0][1] = ff_put_no_rnd_pixels16_x2_arm; + c->put_no_rnd_pixels_tab[0][2] = ff_put_no_rnd_pixels16_y2_arm; + c->put_no_rnd_pixels_tab[0][3] = ff_put_no_rnd_pixels16_xy2_arm; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_arm; + c->put_no_rnd_pixels_tab[1][1] = ff_put_no_rnd_pixels8_x2_arm; + c->put_no_rnd_pixels_tab[1][2] = ff_put_no_rnd_pixels8_y2_arm; + c->put_no_rnd_pixels_tab[1][3] = ff_put_no_rnd_pixels8_xy2_arm; + + if (have_armv6(cpu_flags)) + ff_hpeldsp_init_armv6(c, flags); + if (have_neon(cpu_flags)) + ff_hpeldsp_init_neon(c, flags); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_armv6.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_armv6.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_armv6.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_armv6.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels16_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_put_pixels8_x2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels8_armv6(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_armv6(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_armv6; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_armv6; +/* c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_armv6; */ + c->put_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_armv6; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_armv6; +/* c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_armv6; */ + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_armv6; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_armv6; */ + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_armv6; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_armv6; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_armv6; +/* c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_armv6; */ + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_armv6; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_armv6; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_neon.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_neon.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/hpeldsp_init_neon.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/hpeldsp_init_neon.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * ARM NEON optimised DSP functions + * Copyright (c) 2008 Mans Rullgard + * + * 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 +#include + +#include "libavutil/attributes.h" +#include "hpeldsp_arm.h" + +void ff_put_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_put_pixels8_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +void ff_avg_pixels16_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_x2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_y2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels8_xy2_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_x2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_y2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); +void ff_avg_pixels16_xy2_no_rnd_neon(uint8_t *, const uint8_t *, ptrdiff_t, int); + +av_cold void ff_hpeldsp_init_neon(HpelDSPContext *c, int flags) +{ + c->put_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_pixels_tab[0][1] = ff_put_pixels16_x2_neon; + c->put_pixels_tab[0][2] = ff_put_pixels16_y2_neon; + c->put_pixels_tab[0][3] = ff_put_pixels16_xy2_neon; + c->put_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_pixels_tab[1][1] = ff_put_pixels8_x2_neon; + c->put_pixels_tab[1][2] = ff_put_pixels8_y2_neon; + c->put_pixels_tab[1][3] = ff_put_pixels8_xy2_neon; + + c->put_no_rnd_pixels_tab[0][0] = ff_put_pixels16_neon; + c->put_no_rnd_pixels_tab[0][1] = ff_put_pixels16_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][2] = ff_put_pixels16_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[0][3] = ff_put_pixels16_xy2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][0] = ff_put_pixels8_neon; + c->put_no_rnd_pixels_tab[1][1] = ff_put_pixels8_x2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][2] = ff_put_pixels8_y2_no_rnd_neon; + c->put_no_rnd_pixels_tab[1][3] = ff_put_pixels8_xy2_no_rnd_neon; + + c->avg_pixels_tab[0][0] = ff_avg_pixels16_neon; + c->avg_pixels_tab[0][1] = ff_avg_pixels16_x2_neon; + c->avg_pixels_tab[0][2] = ff_avg_pixels16_y2_neon; + c->avg_pixels_tab[0][3] = ff_avg_pixels16_xy2_neon; + c->avg_pixels_tab[1][0] = ff_avg_pixels8_neon; + c->avg_pixels_tab[1][1] = ff_avg_pixels8_x2_neon; + c->avg_pixels_tab[1][2] = ff_avg_pixels8_y2_neon; + c->avg_pixels_tab[1][3] = ff_avg_pixels8_xy2_neon; + + c->avg_no_rnd_pixels_tab[0] = ff_avg_pixels16_neon; + c->avg_no_rnd_pixels_tab[1] = ff_avg_pixels16_x2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[2] = ff_avg_pixels16_y2_no_rnd_neon; + c->avg_no_rnd_pixels_tab[3] = ff_avg_pixels16_xy2_no_rnd_neon; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/mathops.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/mathops.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/mathops.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/mathops.h 2026-04-29 18:38:25.000000000 +0000 @@ -81,28 +81,6 @@ #endif -#define mid_pred mid_pred -static inline av_const int mid_pred(int a, int b, int c) -{ - int m; - __asm__ ( - "mov %0, %2 \n\t" - "cmp %1, %2 \n\t" - "itt gt \n\t" - "movgt %0, %1 \n\t" - "movgt %1, %2 \n\t" - "cmp %1, %3 \n\t" - "it le \n\t" - "movle %1, %3 \n\t" - "cmp %0, %1 \n\t" - "it gt \n\t" - "movgt %0, %1 \n\t" - : "=&r"(m), "+r"(a) - : "r"(b), "r"(c) - : "cc"); - return m; -} - #endif /* HAVE_INLINE_ASM */ #endif /* AVCODEC_ARM_MATHOPS_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/startcode.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/startcode.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/startcode.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/startcode.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,26 @@ +/* + * 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 + */ + +#ifndef AVCODEC_ARM_STARTCODE_H +#define AVCODEC_ARM_STARTCODE_H + +#include + +int ff_startcode_find_candidate_armv6(const uint8_t *buf, int size); + +#endif /* AVCODEC_ARM_STARTCODE_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_arm.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_arm.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_arm.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_arm.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2009 Mans Rullgard + * + * 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 + */ + +#ifndef AVCODEC_ARM_VIDEODSP_ARM_H +#define AVCODEC_ARM_VIDEODSP_ARM_H + +#include "libavcodec/avcodec.h" +#include "libavcodec/videodsp.h" + +void ff_videodsp_init_armv5te(VideoDSPContext* ctx, int bpc); + +#endif /* AVCODEC_ARM_VIDEODSP_ARM_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_arm.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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 "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +av_cold void ff_videodsp_init_arm(VideoDSPContext *ctx, int bpc) +{ + int cpu_flags = av_get_cpu_flags(); + if (have_armv5te(cpu_flags)) ff_videodsp_init_armv5te(ctx, bpc); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_init_armv5te.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_armv5te.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/videodsp_init_armv5te.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/videodsp_init_armv5te.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2012 Ronald S. Bultje + * + * 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 "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/videodsp.h" +#include "videodsp_arm.h" + +void ff_prefetch_arm(const uint8_t *mem, ptrdiff_t stride, int h); + +av_cold void ff_videodsp_init_armv5te(VideoDSPContext *ctx, int bpc) +{ +#if HAVE_ARMV5TE_EXTERNAL + ctx->prefetch = ff_prefetch_arm; +#endif +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * 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 + */ + +#ifndef AVCODEC_ARM_VP8_H +#define AVCODEC_ARM_VP8_H + +#include + +#include "config.h" +#include "libavcodec/vpx_rac.h" +#include "libavcodec/vp8.h" + +#if HAVE_ARMV6_EXTERNAL +#define vp8_decode_block_coeffs_internal ff_decode_block_coeffs_armv6 +int ff_decode_block_coeffs_armv6(VPXRangeCoder *rc, int16_t block[16], + uint8_t probs[8][3][NUM_DCT_TOKENS-1], + int i, const uint8_t *token_prob, + const int16_t qmul[2]); +#endif + +#endif /* AVCODEC_ARM_VP8_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,80 @@ +/* + * 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 + */ + +#ifndef AVCODEC_ARM_VP8DSP_H +#define AVCODEC_ARM_VP8DSP_H + +#include "libavcodec/vp8dsp.h" + +void ff_vp78dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp78dsp_init_neon(VP8DSPContext *dsp); +void ff_vp8dsp_init_armv6(VP8DSPContext *dsp); +void ff_vp8dsp_init_neon(VP8DSPContext *dsp); + +#define VP8_LF_Y(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter16##inner##_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_UV(hv, inner, opt) \ + void ff_vp8_##hv##_loop_filter8uv##inner##_##opt(uint8_t *dstU, \ + uint8_t *dstV, \ + ptrdiff_t stride, \ + int flim_E, int flim_I, \ + int hev_thresh) + +#define VP8_LF_SIMPLE(hv, opt) \ + void ff_vp8_##hv##_loop_filter16_simple_##opt(uint8_t *dst, \ + ptrdiff_t stride, \ + int flim) + +#define VP8_LF_HV(inner, opt) \ + VP8_LF_Y(h, inner, opt); \ + VP8_LF_Y(v, inner, opt); \ + VP8_LF_UV(h, inner, opt); \ + VP8_LF_UV(v, inner, opt) + +#define VP8_LF(opt) \ + VP8_LF_HV(, opt); \ + VP8_LF_HV(_inner, opt); \ + VP8_LF_SIMPLE(h, opt); \ + VP8_LF_SIMPLE(v, opt) + +#define VP8_MC(n, opt) \ + void ff_put_vp8_##n##_##opt(uint8_t *dst, ptrdiff_t dststride, \ + const uint8_t *src, ptrdiff_t srcstride,\ + int h, int x, int y) + +#define VP8_EPEL(w, opt) \ + VP8_MC(pixels ## w, opt); \ + VP8_MC(epel ## w ## _h4, opt); \ + VP8_MC(epel ## w ## _h6, opt); \ + VP8_MC(epel ## w ## _v4, opt); \ + VP8_MC(epel ## w ## _h4v4, opt); \ + VP8_MC(epel ## w ## _h6v4, opt); \ + VP8_MC(epel ## w ## _v6, opt); \ + VP8_MC(epel ## w ## _h4v6, opt); \ + VP8_MC(epel ## w ## _h6v6, opt) + +#define VP8_BILIN(w, opt) \ + VP8_MC(bilin ## w ## _h, opt); \ + VP8_MC(bilin ## w ## _v, opt); \ + VP8_MC(bilin ## w ## _hv, opt) + +#endif /* AVCODEC_ARM_VP8DSP_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,44 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +av_cold void ff_vp78dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp78dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp78dsp_init_neon(dsp); +} + +av_cold void ff_vp8dsp_init_arm(VP8DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_armv6(cpu_flags)) + ff_vp8dsp_init_armv6(dsp); + if (have_neon(cpu_flags)) + ff_vp8dsp_init_neon(dsp); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_armv6.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_armv6.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_armv6.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_armv6.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,123 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_armv6(int16_t block[4][4][16], int16_t dc[16]); +void ff_vp8_luma_dc_wht_dc_armv6(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_armv6(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_armv6(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(armv6); + +VP8_EPEL(16, armv6); +VP8_EPEL(8, armv6); +VP8_EPEL(4, armv6); + +VP8_BILIN(16, armv6); +VP8_BILIN(8, armv6); +VP8_BILIN(4, armv6); + +av_cold void ff_vp78dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_armv6; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_armv6; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_armv6; + + dsp->put_vp8_epel_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_armv6; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_armv6; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_armv6; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_armv6; + + dsp->put_vp8_bilinear_pixels_tab[2][0][0] = ff_put_vp8_pixels4_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_armv6; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_armv6; +} + +av_cold void ff_vp8dsp_init_armv6(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_armv6; + dsp->vp8_luma_dc_wht_dc = ff_vp8_luma_dc_wht_dc_armv6; + + dsp->vp8_idct_add = ff_vp8_idct_add_armv6; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_armv6; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_armv6; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_armv6; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_armv6; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_armv6; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_armv6; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_armv6; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_armv6; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_armv6; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_armv6; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_armv6; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_armv6; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_armv6; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_neon.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_neon.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp8dsp_init_neon.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp8dsp_init_neon.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,119 @@ +/* + * 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 + +#include "libavutil/attributes.h" +#include "libavcodec/vp8dsp.h" +#include "vp8dsp.h" + +void ff_vp8_luma_dc_wht_neon(int16_t block[4][4][16], int16_t dc[16]); + +void ff_vp8_idct_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add_neon(uint8_t *dst, int16_t block[16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4y_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); +void ff_vp8_idct_dc_add4uv_neon(uint8_t *dst, int16_t block[4][16], ptrdiff_t stride); + +VP8_LF(neon); + +VP8_EPEL(16, neon); +VP8_EPEL(8, neon); +VP8_EPEL(4, neon); + +VP8_BILIN(16, neon); +VP8_BILIN(8, neon); +VP8_BILIN(4, neon); + +av_cold void ff_vp78dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->put_vp8_epel_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_epel_pixels_tab[0][0][2] = ff_put_vp8_epel16_h6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][0] = ff_put_vp8_epel16_v6_neon; + dsp->put_vp8_epel_pixels_tab[0][2][2] = ff_put_vp8_epel16_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_epel_pixels_tab[1][0][1] = ff_put_vp8_epel8_h4_neon; + dsp->put_vp8_epel_pixels_tab[1][0][2] = ff_put_vp8_epel8_h6_neon; + dsp->put_vp8_epel_pixels_tab[1][1][0] = ff_put_vp8_epel8_v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][1] = ff_put_vp8_epel8_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[1][1][2] = ff_put_vp8_epel8_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[1][2][0] = ff_put_vp8_epel8_v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][1] = ff_put_vp8_epel8_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[1][2][2] = ff_put_vp8_epel8_h6v6_neon; + + dsp->put_vp8_epel_pixels_tab[2][0][1] = ff_put_vp8_epel4_h4_neon; + dsp->put_vp8_epel_pixels_tab[2][0][2] = ff_put_vp8_epel4_h6_neon; + dsp->put_vp8_epel_pixels_tab[2][1][0] = ff_put_vp8_epel4_v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][1] = ff_put_vp8_epel4_h4v4_neon; + dsp->put_vp8_epel_pixels_tab[2][1][2] = ff_put_vp8_epel4_h6v4_neon; + dsp->put_vp8_epel_pixels_tab[2][2][0] = ff_put_vp8_epel4_v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][1] = ff_put_vp8_epel4_h4v6_neon; + dsp->put_vp8_epel_pixels_tab[2][2][2] = ff_put_vp8_epel4_h6v6_neon; + + dsp->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][1] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][0][2] = ff_put_vp8_bilin16_h_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][1][2] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][0] = ff_put_vp8_bilin16_v_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][1] = ff_put_vp8_bilin16_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[0][2][2] = ff_put_vp8_bilin16_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][1] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][0][2] = ff_put_vp8_bilin8_h_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][1][2] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][0] = ff_put_vp8_bilin8_v_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][1] = ff_put_vp8_bilin8_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[1][2][2] = ff_put_vp8_bilin8_hv_neon; + + dsp->put_vp8_bilinear_pixels_tab[2][0][1] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][0][2] = ff_put_vp8_bilin4_h_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][1][2] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][0] = ff_put_vp8_bilin4_v_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][1] = ff_put_vp8_bilin4_hv_neon; + dsp->put_vp8_bilinear_pixels_tab[2][2][2] = ff_put_vp8_bilin4_hv_neon; +} + +av_cold void ff_vp8dsp_init_neon(VP8DSPContext *dsp) +{ + dsp->vp8_luma_dc_wht = ff_vp8_luma_dc_wht_neon; + + dsp->vp8_idct_add = ff_vp8_idct_add_neon; + dsp->vp8_idct_dc_add = ff_vp8_idct_dc_add_neon; + dsp->vp8_idct_dc_add4y = ff_vp8_idct_dc_add4y_neon; + dsp->vp8_idct_dc_add4uv = ff_vp8_idct_dc_add4uv_neon; + + dsp->vp8_v_loop_filter16y = ff_vp8_v_loop_filter16_neon; + dsp->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16_neon; + dsp->vp8_v_loop_filter8uv = ff_vp8_v_loop_filter8uv_neon; + dsp->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_neon; + + dsp->vp8_v_loop_filter16y_inner = ff_vp8_v_loop_filter16_inner_neon; + dsp->vp8_h_loop_filter16y_inner = ff_vp8_h_loop_filter16_inner_neon; + dsp->vp8_v_loop_filter8uv_inner = ff_vp8_v_loop_filter8uv_inner_neon; + dsp->vp8_h_loop_filter8uv_inner = ff_vp8_h_loop_filter8uv_inner_neon; + + dsp->vp8_v_loop_filter_simple = ff_vp8_v_loop_filter16_simple_neon; + dsp->vp8_h_loop_filter_simple = ff_vp8_h_loop_filter16_simple_neon; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + */ + +#ifndef AVCODEC_ARM_VP9DSP_INIT_H +#define AVCODEC_ARM_VP9DSP_INIT_H + +#include "libavcodec/vp9dsp.h" + +void ff_vp9dsp_init_10bpp_arm(VP9DSPContext *dsp); +void ff_vp9dsp_init_12bpp_arm(VP9DSPContext *dsp); + +#endif /* AVCODEC_ARM_VP9DSP_INIT_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_10bpp_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_10bpp_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_10bpp_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_10bpp_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + */ + +#define BPP 10 +#define INIT_FUNC ff_vp9dsp_init_10bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_12bpp_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_12bpp_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_12bpp_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_12bpp_arm.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + */ + +#define BPP 12 +#define INIT_FUNC ff_vp9dsp_init_12bpp_arm +#include "vp9dsp_init_16bpp_arm_template.c" diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_16bpp_arm_template.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,258 @@ +/* + * Copyright (c) 2017 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/mem_internal.h" +#include "libavutil/arm/cpu.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz, suffix) \ +void ff_vp9_##type##sz##suffix##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define decl_mc_func(op, filter, dir, sz, bpp) \ +void ff_vp9_##op##_##filter##sz##_##dir##_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz, bpp) \ +static void op##_##filter##sz##_hv_##bpp##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, \ + ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz * 2]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_##bpp##_neon(temp, 2 * sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_##bpp##_neon(dst, dst_stride, \ + temp + 3 * 2 * sz, 2 * sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz, bpp) \ + decl_mc_func(op, regular, dir, sz, bpp); \ + decl_mc_func(op, sharp, dir, sz, bpp); \ + decl_mc_func(op, smooth, dir, sz, bpp) + +#define decl_mc_funcs(sz, bpp) \ + decl_filter_funcs(put, h, sz, bpp); \ + decl_filter_funcs(avg, h, sz, bpp); \ + decl_filter_funcs(put, v, sz, bpp); \ + decl_filter_funcs(avg, v, sz, bpp); \ + decl_filter_funcs(put, hv, sz, bpp); \ + decl_filter_funcs(avg, hv, sz, bpp) + +declare_fpel(copy, 128, ); +declare_fpel(copy, 64, ); +declare_fpel(copy, 32, ); +declare_fpel(copy, 16, ); +declare_fpel(copy, 8, ); +declare_fpel(avg, 64, _16); +declare_fpel(avg, 32, _16); +declare_fpel(avg, 16, _16); +declare_fpel(avg, 8, _16); +declare_fpel(avg, 4, _16); + +decl_mc_funcs(64, BPP); +decl_mc_funcs(32, BPP); +decl_mc_funcs(16, BPP); +decl_mc_funcs(8, BPP); +decl_mc_funcs(4, BPP); + +#define define_8tap_2d_funcs(sz, bpp) \ + define_8tap_2d_fn(put, regular, sz, bpp) \ + define_8tap_2d_fn(put, sharp, sz, bpp) \ + define_8tap_2d_fn(put, smooth, sz, bpp) \ + define_8tap_2d_fn(avg, regular, sz, bpp) \ + define_8tap_2d_fn(avg, sharp, sz, bpp) \ + define_8tap_2d_fn(avg, smooth, sz, bpp) + +define_8tap_2d_funcs(64, BPP) +define_8tap_2d_funcs(32, BPP) +define_8tap_2d_funcs(16, BPP) +define_8tap_2d_funcs(8, BPP) +define_8tap_2d_funcs(4, BPP) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type, suffix) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##suffix##_neon + +#define init_copy_avg(idx, sz1, sz2) \ + init_fpel(idx, 0, sz2, copy, ); \ + init_fpel(idx, 1, sz1, avg, _16) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx, bpp) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_##bpp##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx, bpp) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx, bpp); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx, bpp) + +#define init_mc_funcs_dirs(idx, sz, bpp) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_, bpp); \ + init_mc_funcs(idx, hv, 1, 1, sz, , bpp) + + init_copy_avg(0, 64, 128); + init_copy_avg(1, 32, 64); + init_copy_avg(2, 16, 32); + init_copy_avg(3, 8, 16); + init_copy_avg(4, 4, 8); + + init_mc_funcs_dirs(0, 64, BPP); + init_mc_funcs_dirs(1, 32, BPP); + init_mc_funcs_dirs(2, 16, BPP); + init_mc_funcs_dirs(3, 8, BPP); + init_mc_funcs_dirs(4, 4, BPP); + } +} + +#define define_itxfm2(type_a, type_b, sz, bpp) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_##bpp##_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) +#define define_itxfm(type_a, type_b, sz, bpp) define_itxfm2(type_a, type_b, sz, bpp) + +#define define_itxfm_funcs(sz, bpp) \ + define_itxfm(idct, idct, sz, bpp); \ + define_itxfm(iadst, idct, sz, bpp); \ + define_itxfm(idct, iadst, sz, bpp); \ + define_itxfm(iadst, iadst, sz, bpp) + +define_itxfm_funcs(4, BPP); +define_itxfm_funcs(8, BPP); +define_itxfm_funcs(16, BPP); +define_itxfm(idct, idct, 32, BPP); +define_itxfm(iwht, iwht, 4, BPP); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm2(tx, sz, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_##bpp##_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_##bpp##_neon +#define init_itxfm(tx, sz, bpp) init_itxfm2(tx, sz, bpp) + +#define init_idct2(tx, nm, bpp) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_##bpp##_neon +#define init_idct(tx, nm, bpp) init_idct2(tx, nm, bpp) + + init_itxfm(TX_4X4, 4x4, BPP); + init_itxfm(TX_8X8, 8x8, BPP); + init_itxfm(TX_16X16, 16x16, BPP); + init_idct(TX_32X32, idct_idct_32x32, BPP); + init_idct(4, iwht_iwht_4x4, BPP); + } +} + +#define define_loop_filter(dir, wd, size, bpp) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_##bpp##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size, bpp) \ + define_loop_filter(h, wd, size, bpp); \ + define_loop_filter(v, wd, size, bpp) + +define_loop_filters(4, 8, BPP); +define_loop_filters(8, 8, BPP); +define_loop_filters(16, 8, BPP); + +define_loop_filters(16, 16, BPP); + +define_loop_filters(44, 16, BPP); +define_loop_filters(48, 16, BPP); +define_loop_filters(84, 16, BPP); +define_loop_filters(88, 16, BPP); + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_lpf_func_8(idx1, idx2, dir, wd, bpp) \ + dsp->loop_filter_8[idx1][idx2] = ff_vp9_loop_filter_##dir##_##wd##_8_##bpp##_neon + +#define init_lpf_func_16(idx, dir, bpp) \ + dsp->loop_filter_16[idx] = ff_vp9_loop_filter_##dir##_16_16_##bpp##_neon + +#define init_lpf_func_mix2(idx1, idx2, idx3, dir, wd, bpp) \ + dsp->loop_filter_mix2[idx1][idx2][idx3] = ff_vp9_loop_filter_##dir##_##wd##_16_##bpp##_neon + +#define init_lpf_funcs_8_wd(idx, wd, bpp) \ + init_lpf_func_8(idx, 0, h, wd, bpp); \ + init_lpf_func_8(idx, 1, v, wd, bpp) + +#define init_lpf_funcs_16(bpp) \ + init_lpf_func_16(0, h, bpp); \ + init_lpf_func_16(1, v, bpp) + +#define init_lpf_funcs_mix2_wd(idx1, idx2, wd, bpp) \ + init_lpf_func_mix2(idx1, idx2, 0, h, wd, bpp); \ + init_lpf_func_mix2(idx1, idx2, 1, v, wd, bpp) + +#define init_lpf_funcs_8(bpp) \ + init_lpf_funcs_8_wd(0, 4, bpp); \ + init_lpf_funcs_8_wd(1, 8, bpp); \ + init_lpf_funcs_8_wd(2, 16, bpp) + +#define init_lpf_funcs_mix2(bpp) \ + init_lpf_funcs_mix2_wd(0, 0, 44, bpp); \ + init_lpf_funcs_mix2_wd(0, 1, 48, bpp); \ + init_lpf_funcs_mix2_wd(1, 0, 84, bpp); \ + init_lpf_funcs_mix2_wd(1, 1, 88, bpp) + + init_lpf_funcs_8(BPP); + init_lpf_funcs_16(BPP); + init_lpf_funcs_mix2(BPP); + } +} + +av_cold void INIT_FUNC(VP9DSPContext *dsp) +{ + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_arm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_arm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vp9dsp_init_arm.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vp9dsp_init_arm.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,259 @@ +/* + * Copyright (c) 2016 Google Inc. + * + * 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 + +#include "libavutil/attributes.h" +#include "libavutil/internal.h" +#include "libavutil/mem_internal.h" +#include "libavutil/arm/cpu.h" +#include "libavcodec/vp9dsp.h" +#include "vp9dsp_init.h" + +#define declare_fpel(type, sz) \ +void ff_vp9_##type##sz##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define declare_copy_avg(sz) \ + declare_fpel(copy, sz); \ + declare_fpel(avg , sz) + +#define decl_mc_func(op, filter, dir, sz) \ +void ff_vp9_##op##_##filter##sz##_##dir##_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) + +#define define_8tap_2d_fn(op, filter, sz) \ +static void op##_##filter##sz##_hv_neon(uint8_t *dst, ptrdiff_t dst_stride, \ + const uint8_t *src, ptrdiff_t src_stride, \ + int h, int mx, int my) \ +{ \ + LOCAL_ALIGNED_16(uint8_t, temp, [((1 + (sz < 64)) * sz + 8) * sz]); \ + /* We only need h + 7 lines, but the horizontal filter assumes an \ + * even number of rows, so filter h + 8 lines here. */ \ + ff_vp9_put_##filter##sz##_h_neon(temp, sz, \ + src - 3 * src_stride, src_stride, \ + h + 8, mx, 0); \ + ff_vp9_##op##_##filter##sz##_v_neon(dst, dst_stride, \ + temp + 3 * sz, sz, \ + h, 0, my); \ +} + +#define decl_filter_funcs(op, dir, sz) \ + decl_mc_func(op, regular, dir, sz); \ + decl_mc_func(op, sharp, dir, sz); \ + decl_mc_func(op, smooth, dir, sz) + +#define decl_mc_funcs(sz) \ + decl_filter_funcs(put, h, sz); \ + decl_filter_funcs(avg, h, sz); \ + decl_filter_funcs(put, v, sz); \ + decl_filter_funcs(avg, v, sz); \ + decl_filter_funcs(put, hv, sz); \ + decl_filter_funcs(avg, hv, sz) + +declare_copy_avg(64); +declare_copy_avg(32); +declare_copy_avg(16); +declare_copy_avg(8); +declare_copy_avg(4); + +decl_mc_funcs(64); +decl_mc_funcs(32); +decl_mc_funcs(16); +decl_mc_funcs(8); +decl_mc_funcs(4); + +#define define_8tap_2d_funcs(sz) \ + define_8tap_2d_fn(put, regular, sz) \ + define_8tap_2d_fn(put, sharp, sz) \ + define_8tap_2d_fn(put, smooth, sz) \ + define_8tap_2d_fn(avg, regular, sz) \ + define_8tap_2d_fn(avg, sharp, sz) \ + define_8tap_2d_fn(avg, smooth, sz) + +define_8tap_2d_funcs(64) +define_8tap_2d_funcs(32) +define_8tap_2d_funcs(16) +define_8tap_2d_funcs(8) +define_8tap_2d_funcs(4) + + +static av_cold void vp9dsp_mc_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_fpel(idx1, idx2, sz, type) \ + dsp->mc[idx1][FILTER_8TAP_SMOOTH ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_REGULAR][idx2][0][0] = \ + dsp->mc[idx1][FILTER_8TAP_SHARP ][idx2][0][0] = \ + dsp->mc[idx1][FILTER_BILINEAR ][idx2][0][0] = ff_vp9_##type##sz##_neon + +#define init_copy_avg(idx, sz) \ + init_fpel(idx, 0, sz, copy); \ + init_fpel(idx, 1, sz, avg) + +#define init_mc_func(idx1, idx2, op, filter, fname, dir, mx, my, sz, pfx) \ + dsp->mc[idx1][filter][idx2][mx][my] = pfx##op##_##fname##sz##_##dir##_neon + +#define init_mc_funcs(idx, dir, mx, my, sz, pfx) \ + init_mc_func(idx, 0, put, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 0, put, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_REGULAR, regular, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SHARP, sharp, dir, mx, my, sz, pfx); \ + init_mc_func(idx, 1, avg, FILTER_8TAP_SMOOTH, smooth, dir, mx, my, sz, pfx) + +#define init_mc_funcs_dirs(idx, sz) \ + init_mc_funcs(idx, h, 1, 0, sz, ff_vp9_); \ + init_mc_funcs(idx, v, 0, 1, sz, ff_vp9_); \ + init_mc_funcs(idx, hv, 1, 1, sz,) + + init_copy_avg(0, 64); + init_copy_avg(1, 32); + init_copy_avg(2, 16); + init_copy_avg(3, 8); + init_copy_avg(4, 4); + + init_mc_funcs_dirs(0, 64); + init_mc_funcs_dirs(1, 32); + init_mc_funcs_dirs(2, 16); + init_mc_funcs_dirs(3, 8); + init_mc_funcs_dirs(4, 4); + } +} + +#define define_itxfm(type_a, type_b, sz) \ +void ff_vp9_##type_a##_##type_b##_##sz##x##sz##_add_neon(uint8_t *_dst, \ + ptrdiff_t stride, \ + int16_t *_block, int eob) + +#define define_itxfm_funcs(sz) \ + define_itxfm(idct, idct, sz); \ + define_itxfm(iadst, idct, sz); \ + define_itxfm(idct, iadst, sz); \ + define_itxfm(iadst, iadst, sz) + +define_itxfm_funcs(4); +define_itxfm_funcs(8); +define_itxfm_funcs(16); +define_itxfm(idct, idct, 32); +define_itxfm(iwht, iwht, 4); + + +static av_cold void vp9dsp_itxfm_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { +#define init_itxfm(tx, sz) \ + dsp->itxfm_add[tx][DCT_DCT] = ff_vp9_idct_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][DCT_ADST] = ff_vp9_iadst_idct_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_DCT] = ff_vp9_idct_iadst_##sz##_add_neon; \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_iadst_iadst_##sz##_add_neon + +#define init_idct(tx, nm) \ + dsp->itxfm_add[tx][DCT_DCT] = \ + dsp->itxfm_add[tx][ADST_DCT] = \ + dsp->itxfm_add[tx][DCT_ADST] = \ + dsp->itxfm_add[tx][ADST_ADST] = ff_vp9_##nm##_add_neon + + init_itxfm(TX_4X4, 4x4); + init_itxfm(TX_8X8, 8x8); + init_itxfm(TX_16X16, 16x16); + init_idct(TX_32X32, idct_idct_32x32); + init_idct(4, iwht_iwht_4x4); + } +} + +#define define_loop_filter(dir, wd, size) \ +void ff_vp9_loop_filter_##dir##_##wd##_##size##_neon(uint8_t *dst, ptrdiff_t stride, int E, int I, int H) + +#define define_loop_filters(wd, size) \ + define_loop_filter(h, wd, size); \ + define_loop_filter(v, wd, size) + +define_loop_filters(4, 8); +define_loop_filters(8, 8); +define_loop_filters(16, 8); +define_loop_filters(16, 16); + +define_loop_filters(44, 16); + +#define lf_mix_fn(dir, wd1, wd2, stridea) \ +static void loop_filter_##dir##_##wd1##wd2##_16_neon(uint8_t *dst, \ + ptrdiff_t stride, \ + int E, int I, int H) \ +{ \ + ff_vp9_loop_filter_##dir##_##wd1##_8_neon(dst, stride, E & 0xff, I & 0xff, H & 0xff); \ + ff_vp9_loop_filter_##dir##_##wd2##_8_neon(dst + 8 * stridea, stride, E >> 8, I >> 8, H >> 8); \ +} + +#define lf_mix_fns(wd1, wd2) \ + lf_mix_fn(h, wd1, wd2, stride) \ + lf_mix_fn(v, wd1, wd2, sizeof(uint8_t)) + +lf_mix_fns(4, 8) +lf_mix_fns(8, 4) +lf_mix_fns(8, 8) + +static av_cold void vp9dsp_loopfilter_init_arm(VP9DSPContext *dsp) +{ + int cpu_flags = av_get_cpu_flags(); + + if (have_neon(cpu_flags)) { + dsp->loop_filter_8[0][1] = ff_vp9_loop_filter_v_4_8_neon; + dsp->loop_filter_8[0][0] = ff_vp9_loop_filter_h_4_8_neon; + dsp->loop_filter_8[1][1] = ff_vp9_loop_filter_v_8_8_neon; + dsp->loop_filter_8[1][0] = ff_vp9_loop_filter_h_8_8_neon; + dsp->loop_filter_8[2][1] = ff_vp9_loop_filter_v_16_8_neon; + dsp->loop_filter_8[2][0] = ff_vp9_loop_filter_h_16_8_neon; + + dsp->loop_filter_16[0] = ff_vp9_loop_filter_h_16_16_neon; + dsp->loop_filter_16[1] = ff_vp9_loop_filter_v_16_16_neon; + + dsp->loop_filter_mix2[0][0][0] = ff_vp9_loop_filter_h_44_16_neon; + dsp->loop_filter_mix2[0][0][1] = ff_vp9_loop_filter_v_44_16_neon; + dsp->loop_filter_mix2[0][1][0] = loop_filter_h_48_16_neon; + dsp->loop_filter_mix2[0][1][1] = loop_filter_v_48_16_neon; + dsp->loop_filter_mix2[1][0][0] = loop_filter_h_84_16_neon; + dsp->loop_filter_mix2[1][0][1] = loop_filter_v_84_16_neon; + dsp->loop_filter_mix2[1][1][0] = loop_filter_h_88_16_neon; + dsp->loop_filter_mix2[1][1][1] = loop_filter_v_88_16_neon; + } +} + +av_cold void ff_vp9dsp_init_arm(VP9DSPContext *dsp, int bpp) +{ + if (bpp == 10) { + ff_vp9dsp_init_10bpp_arm(dsp); + return; + } else if (bpp == 12) { + ff_vp9dsp_init_12bpp_arm(dsp); + return; + } else if (bpp != 8) + return; + + vp9dsp_mc_init_arm(dsp); + vp9dsp_loopfilter_init_arm(dsp); + vp9dsp_itxfm_init_arm(dsp); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vpx_arith.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vpx_arith.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/arm/vpx_arith.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/arm/vpx_arith.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,121 @@ +/* + * Copyright (C) 2010 Mans Rullgard + * + * 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 + */ + +#ifndef AVCODEC_ARM_VPX_ARITH_H +#define AVCODEC_ARM_VPX_ARITH_H + +#if CONFIG_THUMB +# define A(x) +# define T(x) x +#else +# define A(x) x +# define T(x) +#endif + +#if CONFIG_THUMB || defined __clang__ +# define L(x) +# define U(x) x +#else +# define L(x) x +# define U(x) +#endif + +#if HAVE_ARMV6_INLINE + +#define vpx_rac_get_prob vp56_rac_get_prob_armv6 +static inline int vp56_rac_get_prob_armv6(VPXRangeCoder *c, int pr) +{ + unsigned shift = ff_vpx_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned bit; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "cmp %1, %0, lsl #16 \n" + "ittte ge \n" + "subge %1, %1, %0, lsl #16 \n" + "subge %0, %5, %0 \n" + "movge %2, #1 \n" + "movlt %2, #0 \n" + : "=&r"(c->high), "=&r"(c->code_word), "=&r"(bit), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), + "0"(shift), "1"(code_word) + : "cc"); + + return bit; +} + +#define vpx_rac_get_prob_branchy vp56_rac_get_prob_branchy_armv6 +static inline int vp56_rac_get_prob_branchy_armv6(VPXRangeCoder *c, int pr) +{ + unsigned shift = ff_vpx_norm_shift[c->high]; + unsigned code_word = c->code_word << shift; + unsigned high = c->high << shift; + unsigned low; + unsigned tmp; + + __asm__ ("adds %3, %3, %0 \n" + "itt cs \n" + "cmpcs %7, %4 \n" + L("ldrcsh %2, [%4], #2 \n") + U("ldrhcs %2, [%4], #2 \n") + "rsb %0, %6, #256 \n" + "smlabb %0, %5, %6, %0 \n" + T("itttt cs \n") + "rev16cs %2, %2 \n" + T("lslcs %2, %2, %3 \n") + T("orrcs %1, %1, %2 \n") + A("orrcs %1, %1, %2, lsl %3 \n") + "subcs %3, %3, #16 \n" + "lsr %0, %0, #8 \n" + "lsl %2, %0, #16 \n" + : "=&r"(low), "+&r"(code_word), "=&r"(tmp), + "+&r"(c->bits), "+&r"(c->buffer) + : "r"(high), "r"(pr), "r"(c->end - 1), "0"(shift) + : "cc"); + + if (code_word >= tmp) { + c->high = high - low; + c->code_word = code_word - tmp; + return 1; + } + + c->high = low; + c->code_word = code_word; + return 0; +} + +#endif + +#endif /* AVCODEC_ARM_VPX_ARITH_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/audio_frame_queue.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/audio_frame_queue.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/audio_frame_queue.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/audio_frame_queue.c 2026-04-29 18:38:26.000000000 +0000 @@ -33,7 +33,7 @@ afq->frame_count = 0; } -void ff_af_queue_close(AudioFrameQueue *afq) +av_cold void ff_af_queue_close(AudioFrameQueue *afq) { if(afq->frame_count) av_log(afq->avctx, AV_LOG_WARNING, "%d frames left in the queue on closing\n", afq->frame_count); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/av1_parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1_parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/av1_parser.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1_parser.c 2026-04-29 18:38:25.000000000 +0000 @@ -20,12 +20,14 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "av1_parse.h" +#include "avcodec.h" #include "cbs.h" #include "cbs_av1.h" -#include "parser.h" +#include "parser_internal.h" typedef struct AV1ParseContext { CodedBitstreamContext *cbc; @@ -82,7 +84,7 @@ ff_cbs_fragment_reset(td); } - ret = ff_cbs_read(s->cbc, td, data, size); + ret = ff_cbs_read(s->cbc, td, NULL, data, size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to parse temporal unit.\n"); goto end; @@ -132,6 +134,13 @@ break; } ctx->picture_structure = AV_PICTURE_STRUCTURE_FRAME; + + /* Extract SAR from render_height_minus_1 & render_width_minus_1 */ + av_reduce(&avctx->sample_aspect_ratio.num, + &avctx->sample_aspect_ratio.den, + (int64_t)ctx->height * (frame->render_width_minus_1 + 1), + (int64_t)ctx->width * (frame->render_height_minus_1 + 1), + INT_MAX); } switch (av1->bit_depth) { @@ -183,6 +192,7 @@ AV1_OBU_FRAME_HEADER, AV1_OBU_TILE_GROUP, AV1_OBU_FRAME, + AV1_OBU_REDUNDANT_FRAME_HEADER, }; static av_cold int av1_parser_init(AVCodecParserContext *ctx) @@ -200,7 +210,7 @@ return 0; } -static void av1_parser_close(AVCodecParserContext *ctx) +static av_cold void av1_parser_close(AVCodecParserContext *ctx) { AV1ParseContext *s = ctx->priv_data; @@ -208,10 +218,10 @@ ff_cbs_close(&s->cbc); } -const AVCodecParser ff_av1_parser = { - .codec_ids = { AV_CODEC_ID_AV1 }, +const FFCodecParser ff_av1_parser = { + PARSER_CODEC_LIST(AV_CODEC_ID_AV1), .priv_data_size = sizeof(AV1ParseContext), - .parser_init = av1_parser_init, - .parser_close = av1_parser_close, - .parser_parse = av1_parser_parse, + .init = av1_parser_init, + .close = av1_parser_close, + .parse = av1_parser_parse, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/av1dec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1dec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/av1dec.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/av1dec.c 2026-04-29 18:38:25.000000000 +0000 @@ -20,6 +20,7 @@ #include "config_components.h" +#include "libavutil/attributes.h" #include "libavutil/hdr_dynamic_metadata.h" #include "libavutil/film_grain_params.h" #include "libavutil/mastering_display_metadata.h" @@ -41,7 +42,7 @@ #include "progressframe.h" #include "libavutil/refstruct.h" -/**< same with Div_Lut defined in spec 7.11.3.7 */ +/** same with Div_Lut defined in spec 7.11.3.7 */ static const uint16_t div_lut[AV1_DIV_LUT_NUM] = { 16384, 16320, 16257, 16194, 16132, 16070, 16009, 15948, 15888, 15828, 15768, 15709, 15650, 15592, 15534, 15477, 15420, 15364, 15308, 15252, 15197, 15142, @@ -773,11 +774,13 @@ avctx->profile = seq->seq_profile; avctx->level = seq->seq_level_idx[0]; - avctx->color_range = - seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; - avctx->color_primaries = seq->color_config.color_primaries; - avctx->colorspace = seq->color_config.matrix_coefficients; - avctx->color_trc = seq->color_config.transfer_characteristics; + if (seq->color_config.color_description_present_flag) { + avctx->color_range = + seq->color_config.color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; + avctx->color_primaries = seq->color_config.color_primaries; + avctx->colorspace = seq->color_config.matrix_coefficients; + avctx->color_trc = seq->color_config.transfer_characteristics; + } switch (seq->color_config.chroma_sample_position) { case AV1_CSP_VERTICAL: @@ -890,7 +893,8 @@ seq = ((CodedBitstreamAV1Context *)(s->cbc->priv_data))->sequence_header; if (!seq) { - av_log(avctx, AV_LOG_WARNING, "No sequence header available.\n"); + if (!(avctx->extradata[0] & 0x80)) + av_log(avctx, AV_LOG_WARNING, "No sequence header available in extradata.\n"); goto end; } @@ -965,78 +969,109 @@ { GetByteContext gb; AV1DecContext *s = avctx->priv_data; - int ret, provider_code; + int ret, provider_code, country_code; bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size); - provider_code = bytestream2_get_be16(&gb); - switch (provider_code) { - case ITU_T_T35_PROVIDER_CODE_ATSC: { - uint32_t user_identifier = bytestream2_get_be32(&gb); - switch (user_identifier) { - case MKBETAG('G', 'A', '9', '4'): { // closed captions - AVBufferRef *buf = NULL; + country_code = itut_t35->itu_t_t35_country_code ; + switch (country_code) { + case ITU_T_T35_COUNTRY_CODE_US: + provider_code = bytestream2_get_be16(&gb); + + switch (provider_code) { + case ITU_T_T35_PROVIDER_CODE_ATSC: { + uint32_t user_identifier = bytestream2_get_be32(&gb); + switch (user_identifier) { + case MKBETAG('G', 'A', '9', '4'): { // closed captions + AVBufferRef *buf = NULL; + + ret = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb)); + if (ret < 0) + return ret; + if (!ret) + break; + + ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &buf); + if (ret < 0) + return ret; - ret = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb)); - if (ret < 0) - return ret; - if (!ret) +#if FF_API_CODEC_PROPS +FF_DISABLE_DEPRECATION_WARNINGS + avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; +FF_ENABLE_DEPRECATION_WARNINGS +#endif break; + } + default: // ignore unsupported identifiers + break; + } + break; + } + case ITU_T_T35_PROVIDER_CODE_SAMSUNG: { + AVDynamicHDRPlus *hdrplus; + int provider_oriented_code = bytestream2_get_be16(&gb); + int application_identifier = bytestream2_get_byte(&gb); + + if (provider_oriented_code != 1 || application_identifier != 4) + return 0; // ignore + + hdrplus = av_dynamic_hdr_plus_create_side_data(frame); + if (!hdrplus) + return AVERROR(ENOMEM); - ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_A53_CC, &buf); + ret = av_dynamic_hdr_plus_from_t35(hdrplus, gb.buffer, + bytestream2_get_bytes_left(&gb)); if (ret < 0) return ret; + break; + } + case ITU_T_T35_PROVIDER_CODE_DOLBY: { + int provider_oriented_code = bytestream2_get_be32(&gb); + if (provider_oriented_code != 0x800) + return 0; // ignore -#if FF_API_CODEC_PROPS -FF_DISABLE_DEPRECATION_WARNINGS - avctx->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; -FF_ENABLE_DEPRECATION_WARNINGS -#endif + ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, bytestream2_get_bytes_left(&gb), + avctx->err_recognition); + if (ret < 0) { + av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); + return 0; // ignore + } + + ret = ff_dovi_attach_side_data(&s->dovi, frame); + if (ret < 0) + return ret; break; } - default: // ignore unsupported identifiers + default: break; } break; - } - case ITU_T_T35_PROVIDER_CODE_SMTPE: { - AVDynamicHDRPlus *hdrplus; - int provider_oriented_code = bytestream2_get_be16(&gb); - int application_identifier = bytestream2_get_byte(&gb); + case ITU_T_T35_COUNTRY_CODE_UK: + bytestream2_skip(&gb, 1); // t35_uk_country_code_second_octet - if (itut_t35->itu_t_t35_country_code != ITU_T_T35_COUNTRY_CODE_US || - provider_oriented_code != 1 || application_identifier != 4) - break; + provider_code = bytestream2_get_be16(&gb); + switch (provider_code) { + case ITU_T_T35_PROVIDER_CODE_VNOVA: { + AVFrameSideData *sd; + if (bytestream2_get_bytes_left(&gb) < 2) + return AVERROR_INVALIDDATA; - hdrplus = av_dynamic_hdr_plus_create_side_data(frame); - if (!hdrplus) - return AVERROR(ENOMEM); + ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_LCEVC, + bytestream2_get_bytes_left(&gb), &sd); + if (ret < 0) + return ret; + if (!sd) + break; - ret = av_dynamic_hdr_plus_from_t35(hdrplus, gb.buffer, - bytestream2_get_bytes_left(&gb)); - if (ret < 0) - return ret; - break; - } - case ITU_T_T35_PROVIDER_CODE_DOLBY: { - int provider_oriented_code = bytestream2_get_be32(&gb); - if (itut_t35->itu_t_t35_country_code != ITU_T_T35_COUNTRY_CODE_US || - provider_oriented_code != 0x800) + bytestream2_get_bufferu(&gb, sd->data, sd->size); + break; + } + default: break; - - ret = ff_dovi_rpu_parse(&s->dovi, gb.buffer, gb.buffer_end - gb.buffer, - avctx->err_recognition); - if (ret < 0) { - av_log(avctx, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); - break; // ignore } - - ret = ff_dovi_attach_side_data(&s->dovi, frame); - if (ret < 0) - return ret; break; - } - default: // ignore unsupported provider codes + default: + // ignore unsupported provider codes break; } @@ -1196,12 +1231,6 @@ frame->pts = pkt->pts; frame->pkt_dts = pkt->dts; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - frame->pkt_size = pkt->size; - frame->pkt_pos = pkt->pos; -FF_ENABLE_DEPRECATION_WARNINGS -#endif av_packet_unref(pkt); @@ -1317,6 +1346,8 @@ av_refstruct_replace(&s->seq_ref, unit->content_ref); s->raw_seq = &obu->obu.sequence_header; + s->raw_frame_header = NULL; + raw_tile_group = NULL; ret = set_context_with_sequence(avctx, s->raw_seq); if (ret < 0) { @@ -1329,6 +1360,15 @@ s->pix_fmt = AV_PIX_FMT_NONE; + if (FF_HW_HAS_CB(avctx, decode_params)) { + ret = FF_HW_CALL(avctx, decode_params, AV1_OBU_SEQUENCE_HEADER, + s->seq_data_ref->data, s->seq_data_ref->size); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "HW accel decode params fail.\n"); + return ret; + } + } + break; case AV1_OBU_REDUNDANT_FRAME_HEADER: if (s->raw_frame_header) @@ -1344,6 +1384,8 @@ av_refstruct_replace(&s->header_ref, unit->content_ref); + raw_tile_group = NULL; + if (unit->type == AV1_OBU_FRAME) s->raw_frame_header = &obu->obu.frame.header; else @@ -1380,7 +1422,8 @@ s->cur_frame.temporal_id = header->temporal_id; if (avctx->hwaccel && s->cur_frame.f) { - ret = FF_HW_CALL(avctx, start_frame, unit->data, unit->data_size); + ret = FF_HW_CALL(avctx, start_frame, s->pkt->buf, + unit->data, unit->data_size); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, "HW accel start frame fail.\n"); goto end; @@ -1415,8 +1458,11 @@ } } break; - case AV1_OBU_TILE_LIST: case AV1_OBU_TEMPORAL_DELIMITER: + s->raw_frame_header = NULL; + raw_tile_group = NULL; + // fall-through + case AV1_OBU_TILE_LIST: case AV1_OBU_PADDING: break; case AV1_OBU_METADATA: @@ -1450,7 +1496,7 @@ break; default: av_log(avctx, AV_LOG_DEBUG, - "Unknown obu type: %d (%"SIZE_SPECIFIER" bits).\n", + "Unknown obu type: %d (%zu bits).\n", unit->type, unit->data_size); } @@ -1539,7 +1585,7 @@ return ret; } -static void av1_decode_flush(AVCodecContext *avctx) +static av_cold void av1_decode_flush(AVCodecContext *avctx) { AV1DecContext *s = avctx->priv_data; AV1RawMetadataITUTT35 itut_t35; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.c 2026-04-29 18:38:25.000000000 +0000 @@ -23,6 +23,8 @@ * AVCodecContext functions for libavcodec */ +#include + #include "config.h" #include "libavutil/avassert.h" #include "libavutil/avstring.h" @@ -30,7 +32,6 @@ #include "libavutil/channel_layout.h" #include "libavutil/common.h" #include "libavutil/emms.h" -#include "libavutil/fifo.h" #include "libavutil/imgutils.h" #include "libavutil/mem.h" #include "libavutil/opt.h" @@ -41,12 +42,10 @@ #include "codec_desc.h" #include "codec_internal.h" #include "decode.h" -#include "encode.h" #include "frame_thread_encoder.h" #include "hwconfig.h" #include "internal.h" #include "libavutil/refstruct.h" -#include "thread.h" /** * Maximum size in bytes of extradata. @@ -65,6 +64,8 @@ { AV_PKT_DATA_CONTENT_LIGHT_LEVEL, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL }, { AV_PKT_DATA_ICC_PROFILE, AV_FRAME_DATA_ICC_PROFILE }, { AV_PKT_DATA_AMBIENT_VIEWING_ENVIRONMENT,AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT }, + { AV_PKT_DATA_3D_REFERENCE_DISPLAYS, AV_FRAME_DATA_3D_REFERENCE_DISPLAYS }, + { AV_PKT_DATA_EXIF, AV_FRAME_DATA_EXIF }, { AV_PKT_DATA_NB }, }; @@ -190,7 +191,7 @@ return AVERROR(EINVAL); } - avci = av_codec_is_decoder(codec) ? + avci = ff_codec_is_decoder(codec) ? ff_decode_internal_alloc() : ff_encode_internal_alloc(); if (!avci) { @@ -254,7 +255,11 @@ } } - if (avctx->sample_rate < 0) { + /* AV_CODEC_CAP_CHANNEL_CONF is a decoder-only flag; so the code below + * in particular checks that sample_rate is set for all audio encoders. */ + if (avctx->sample_rate < 0 || + avctx->sample_rate == 0 && avctx->codec_type == AVMEDIA_TYPE_AUDIO && + !(codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) { av_log(avctx, AV_LOG_ERROR, "Invalid sample rate: %d\n", avctx->sample_rate); ret = AVERROR(EINVAL); goto free_and_end; @@ -270,7 +275,7 @@ if (avctx->codec_type == AVMEDIA_TYPE_AUDIO && !avctx->ch_layout.nb_channels && !(codec->capabilities & AV_CODEC_CAP_CHANNEL_CONF)) { av_log(avctx, AV_LOG_ERROR, "%s requires channel layout to be set\n", - av_codec_is_decoder(codec) ? "Decoder" : "Encoder"); + ff_codec_is_decoder(codec) ? "Decoder" : "Encoder"); ret = AVERROR(EINVAL); goto free_and_end; } @@ -290,13 +295,13 @@ if ((avctx->codec->capabilities & AV_CODEC_CAP_EXPERIMENTAL) && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { - const char *codec_string = av_codec_is_encoder(codec) ? "encoder" : "decoder"; + const char *codec_string = ff_codec_is_encoder(codec) ? "encoder" : "decoder"; const AVCodec *codec2; av_log(avctx, AV_LOG_ERROR, "The %s '%s' is experimental but experimental codecs are not enabled, " "add '-strict %d' if you want to use it.\n", codec_string, codec->name, FF_COMPLIANCE_EXPERIMENTAL); - codec2 = av_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); + codec2 = ff_codec_is_encoder(codec) ? avcodec_find_encoder(codec->id) : avcodec_find_decoder(codec->id); if (!(codec2->capabilities & AV_CODEC_CAP_EXPERIMENTAL)) av_log(avctx, AV_LOG_ERROR, "Alternatively use the non experimental %s '%s'.\n", codec_string, codec2->name); @@ -310,7 +315,7 @@ avctx->time_base.den = avctx->sample_rate; } - if (av_codec_is_encoder(avctx->codec)) + if (ff_codec_is_encoder(avctx->codec)) ret = ff_encode_preinit(avctx); else ret = ff_decode_preinit(avctx); @@ -345,10 +350,12 @@ ret=0; - if (av_codec_is_decoder(avctx->codec)) { + if (ff_codec_is_decoder(avctx->codec)) { if (!avctx->bit_rate) avctx->bit_rate = get_bit_rate(avctx); + avci->skip_samples = avctx->delay; + /* validate channel layout from the decoder */ if ((avctx->ch_layout.nb_channels && !av_channel_layout_check(&avctx->ch_layout)) || avctx->ch_layout.nb_channels > FF_SANE_NB_CHANNELS) { @@ -429,16 +436,14 @@ { int i; - if (!avctx) - return; - if (avcodec_is_open(avctx)) { AVCodecInternal *avci = avctx->internal; - if (CONFIG_FRAME_THREAD_ENCODER && - avci->frame_thread_encoder && avctx->thread_count > 1) { +#if CONFIG_FRAME_THREAD_ENCODER + if (avci->frame_thread_encoder && avctx->thread_count > 1) { ff_frame_thread_encoder_free(avctx); } +#endif if (HAVE_THREADS && avci->thread_ctx) ff_thread_free(avctx); if (avci->needs_close && ffcodec(avctx->codec)->close) @@ -462,10 +467,6 @@ av_bsf_free(&avci->bsf); -#if FF_API_DROPCHANGED - av_channel_layout_uninit(&avci->initial_ch_layout); -#endif - #if CONFIG_LCMS2 ff_icc_context_uninit(&avci->icc); #endif @@ -497,14 +498,6 @@ avctx->active_thread_type = 0; } -#if FF_API_AVCODEC_CLOSE -int avcodec_close(AVCodecContext *avctx) -{ - ff_codec_close(avctx); - return 0; -} -#endif - static const char *unknown_if_null(const char *str) { return str ? str : "unknown"; @@ -714,48 +707,62 @@ return !!s->internal; } -int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) +int attribute_align_arg avcodec_receive_frame_flags(AVCodecContext *avctx, + AVFrame *frame, unsigned flags) { av_frame_unref(frame); - if (av_codec_is_decoder(avctx->codec)) - return ff_decode_receive_frame(avctx, frame); + if (!avcodec_is_open(avctx) || !avctx->codec) + return AVERROR(EINVAL); + + if (ff_codec_is_decoder(avctx->codec)) + return ff_decode_receive_frame(avctx, frame, flags); return ff_encode_receive_frame(avctx, frame); } -#define WRAP_CONFIG(allowed_type, field, field_type, terminator) \ +int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) +{ + return avcodec_receive_frame_flags(avctx, frame, 0); +} + +#define WRAP_CONFIG(allowed_type, field, var, field_type, sentinel_check) \ do { \ - static const field_type end = terminator; \ if (codec->type != (allowed_type)) \ return AVERROR(EINVAL); \ - *out_configs = (field); \ - if (out_num_configs) { \ + const field_type *ptr = codec->field; \ + *out_configs = ptr; \ + if (ptr) { \ for (int i = 0;; i++) { \ - if (!(field) || !memcmp(&(field)[i], &end, sizeof(end))) { \ + const field_type var = ptr[i]; \ + if (sentinel_check) { \ *out_num_configs = i; \ break; \ } \ } \ - } \ + } else \ + *out_num_configs = 0; \ return 0; \ } while (0) -static const enum AVColorRange color_range_jpeg[] = { - AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED -}; - -static const enum AVColorRange color_range_mpeg[] = { - AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED +static const enum AVColorRange color_range_tab[] = { + AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED, + AVCOL_RANGE_MPEG, AVCOL_RANGE_UNSPECIFIED, }; -static const enum AVColorRange color_range_all[] = { - AVCOL_RANGE_MPEG, AVCOL_RANGE_JPEG, AVCOL_RANGE_UNSPECIFIED +static const enum AVAlphaMode alpha_mode_tab[] = { + AVALPHA_MODE_PREMULTIPLIED, AVALPHA_MODE_STRAIGHT, AVALPHA_MODE_UNSPECIFIED, + AVALPHA_MODE_PREMULTIPLIED, AVALPHA_MODE_UNSPECIFIED }; -static const enum AVColorRange *color_range_table[] = { - [AVCOL_RANGE_MPEG] = color_range_mpeg, - [AVCOL_RANGE_JPEG] = color_range_jpeg, - [AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG] = color_range_all, +static_assert((int)AVCOL_RANGE_MPEG == (int)AVALPHA_MODE_PREMULTIPLIED, "unexpected enum values"); +static_assert((int)AVCOL_RANGE_JPEG == (int)AVALPHA_MODE_STRAIGHT, "unexpected enum values"); +static_assert(AVCOL_RANGE_UNSPECIFIED == 0 && AVALPHA_MODE_UNSPECIFIED == 0, "unexpected enum values"); +static_assert(AVCOL_RANGE_NB == 3 && AVALPHA_MODE_NB == 3, "unexpected enum values"); + +static const uint8_t offset_tab[] = { + [AVCOL_RANGE_MPEG] = 3, + [AVCOL_RANGE_JPEG] = 1, + [AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG] = 0, }; int ff_default_get_supported_config(const AVCodecContext *avctx, @@ -765,33 +772,49 @@ const void **out_configs, int *out_num_configs) { + const FFCodec *codec2 = ffcodec(codec); + switch (config) { FF_DISABLE_DEPRECATION_WARNINGS case AV_CODEC_CONFIG_PIX_FORMAT: - WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->pix_fmts, enum AVPixelFormat, AV_PIX_FMT_NONE); + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, pix_fmts, pix_fmt, enum AVPixelFormat, pix_fmt == AV_PIX_FMT_NONE); case AV_CODEC_CONFIG_FRAME_RATE: - WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, codec->supported_framerates, AVRational, {0}); + WRAP_CONFIG(AVMEDIA_TYPE_VIDEO, supported_framerates, framerate, AVRational, framerate.num == 0); case AV_CODEC_CONFIG_SAMPLE_RATE: - WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->supported_samplerates, int, 0); + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, supported_samplerates, samplerate, int, samplerate == 0); case AV_CODEC_CONFIG_SAMPLE_FORMAT: - WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->sample_fmts, enum AVSampleFormat, AV_SAMPLE_FMT_NONE); + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, sample_fmts, sample_fmt, enum AVSampleFormat, sample_fmt == AV_SAMPLE_FMT_NONE); case AV_CODEC_CONFIG_CHANNEL_LAYOUT: - WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, codec->ch_layouts, AVChannelLayout, {0}); + WRAP_CONFIG(AVMEDIA_TYPE_AUDIO, ch_layouts, ch_layout, AVChannelLayout, ch_layout.nb_channels == 0); FF_ENABLE_DEPRECATION_WARNINGS case AV_CODEC_CONFIG_COLOR_RANGE: if (codec->type != AVMEDIA_TYPE_VIDEO) return AVERROR(EINVAL); - *out_configs = color_range_table[ffcodec(codec)->color_ranges]; - if (out_num_configs) - *out_num_configs = av_popcount(ffcodec(codec)->color_ranges); + unsigned color_ranges = codec2->color_ranges; + if (color_ranges) + *out_configs = color_range_tab + offset_tab[color_ranges]; + else + *out_configs = NULL; + *out_num_configs = av_popcount(color_ranges); return 0; case AV_CODEC_CONFIG_COLOR_SPACE: *out_configs = NULL; - if (out_num_configs) - *out_num_configs = 0; + *out_num_configs = 0; + return 0; + + case AV_CODEC_CONFIG_ALPHA_MODE: + if (codec->type != AVMEDIA_TYPE_VIDEO) + return AVERROR(EINVAL); + unsigned alpha_modes = codec2->alpha_modes; + if (alpha_modes) + *out_configs = alpha_mode_tab + offset_tab[alpha_modes]; + else + *out_configs = NULL; + *out_num_configs = av_popcount(alpha_modes); return 0; + default: return AVERROR(EINVAL); } @@ -815,3 +838,53 @@ return ff_default_get_supported_config(avctx, codec, config, flags, out, out_num); } } + +int av_packet_side_data_from_frame(AVPacketSideData **psd, int *pnb_sd, + const AVFrameSideData *src, unsigned int flags) +{ + AVPacketSideData *sd = NULL; + + for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) { + if (ff_sd_global_map[j].frame != src->type) + continue; + + sd = av_packet_side_data_new(psd, pnb_sd, ff_sd_global_map[j].packet, + src->size, 0); + + if (!sd) + return AVERROR(ENOMEM); + + memcpy(sd->data, src->data, src->size); + break; + } + + if (!sd) + return AVERROR(EINVAL); + + return 0; +} + +int av_packet_side_data_to_frame(AVFrameSideData ***psd, int *pnb_sd, + const AVPacketSideData *src, unsigned int flags) +{ + AVFrameSideData *sd = NULL; + + for (unsigned j = 0; ff_sd_global_map[j].packet < AV_PKT_DATA_NB; j++) { + if (ff_sd_global_map[j].packet != src->type) + continue; + + sd = av_frame_side_data_new(psd, pnb_sd, ff_sd_global_map[j].frame, + src->size, flags); + + if (!sd) + return AVERROR(ENOMEM); + + memcpy(sd->data, src->data, src->size); + break; + } + + if (!sd) + return AVERROR(EINVAL); + + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.h 2026-04-29 18:38:25.000000000 +0000 @@ -187,17 +187,6 @@ * @{ */ -#if FF_API_BUFFER_MIN_SIZE -/** - * @ingroup lavc_encoding - * minimum encoding buffer size - * Used to avoid some checks during header writing. - * @deprecated Unused: avcodec_receive_packet() does not work - * with preallocated packet buffers. - */ -#define AV_INPUT_BUFFER_MIN_SIZE 16384 -#endif - /** * @ingroup lavc_encoding */ @@ -234,18 +223,9 @@ * Use qpel MC. */ #define AV_CODEC_FLAG_QPEL (1 << 4) -#if FF_API_DROPCHANGED -/** - * Don't output frames whose parameters differ from first - * decoded frame in stream. - * - * @deprecated callers should implement this functionality in their own code - */ -#define AV_CODEC_FLAG_DROPCHANGED (1 << 5) -#endif /** * Request the encoder to output reconstructed frames, i.e.\ frames that would - * be produced by decoding the encoded bistream. These frames may be retrieved + * be produced by decoding the encoded bitstream. These frames may be retrieved * by calling avcodec_receive_frame() immediately after a successful call to * avcodec_receive_packet(). * @@ -436,6 +416,14 @@ #define AV_GET_ENCODE_BUFFER_FLAG_REF (1 << 0) /** + * The decoder will bypass frame threading and return the next frame as soon as + * possible. Note that this may deliver frames earlier than the advertised + * `AVCodecContext.delay`. No effect when frame threading is disabled, or on + * encoding. + */ +#define AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS (1 << 0) + +/** * main external API structure. * New fields can be added to the end with minor version bumps. * Removal, reordering and changes to existing fields require a major @@ -530,9 +518,6 @@ * * After being set, the array is owned by the codec and freed in * avcodec_free_context(). - * - * @warning the deprecated avcodec_close() function DOES NOT free this array - * for decoding, it must be freed manually by the caller. */ uint8_t *extradata; int extradata_size; @@ -573,23 +558,6 @@ */ AVRational framerate; -#if FF_API_TICKS_PER_FRAME - /** - * For some codecs, the time base is closer to the field rate than the frame rate. - * Most notably, H.264 and MPEG-2 specify time_base as half of frame duration - * if no telecine is used ... - * - * Set to time_base ticks per frame. Default 1, e.g., H.264/MPEG-2 set it to 2. - * - * @deprecated - * - decoding: Use AVCodecDescriptor.props & AV_CODEC_PROP_FIELDS - * - encoding: Set AVCodecContext.framerate instead - * - */ - attribute_deprecated - int ticks_per_frame; -#endif - /** * Codec delay. * @@ -1003,12 +971,16 @@ */ uint16_t *chroma_intra_matrix; +#if FF_API_INTRA_DC_PRECISION /** * precision of the intra DC coefficient - 8 * - encoding: Set by user. * - decoding: Set by libavcodec + * @deprecated Use the MPEG-2 encoder's private option "intra_dc_precision" instead. */ + attribute_deprecated int intra_dc_precision; +#endif /** * minimum MB Lagrange multiplier @@ -1656,155 +1628,16 @@ * See the AV_PROFILE_* defines in defs.h. */ int profile; -#if FF_API_FF_PROFILE_LEVEL - /** @deprecated The following defines are deprecated; use AV_PROFILE_* - * in defs.h instead. */ -#define FF_PROFILE_UNKNOWN -99 -#define FF_PROFILE_RESERVED -100 - -#define FF_PROFILE_AAC_MAIN 0 -#define FF_PROFILE_AAC_LOW 1 -#define FF_PROFILE_AAC_SSR 2 -#define FF_PROFILE_AAC_LTP 3 -#define FF_PROFILE_AAC_HE 4 -#define FF_PROFILE_AAC_HE_V2 28 -#define FF_PROFILE_AAC_LD 22 -#define FF_PROFILE_AAC_ELD 38 -#define FF_PROFILE_MPEG2_AAC_LOW 128 -#define FF_PROFILE_MPEG2_AAC_HE 131 - -#define FF_PROFILE_DNXHD 0 -#define FF_PROFILE_DNXHR_LB 1 -#define FF_PROFILE_DNXHR_SQ 2 -#define FF_PROFILE_DNXHR_HQ 3 -#define FF_PROFILE_DNXHR_HQX 4 -#define FF_PROFILE_DNXHR_444 5 - -#define FF_PROFILE_DTS 20 -#define FF_PROFILE_DTS_ES 30 -#define FF_PROFILE_DTS_96_24 40 -#define FF_PROFILE_DTS_HD_HRA 50 -#define FF_PROFILE_DTS_HD_MA 60 -#define FF_PROFILE_DTS_EXPRESS 70 -#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_TRUEHD_ATMOS 30 - -#define FF_PROFILE_MPEG2_422 0 -#define FF_PROFILE_MPEG2_HIGH 1 -#define FF_PROFILE_MPEG2_SS 2 -#define FF_PROFILE_MPEG2_SNR_SCALABLE 3 -#define FF_PROFILE_MPEG2_MAIN 4 -#define FF_PROFILE_MPEG2_SIMPLE 5 - -#define FF_PROFILE_H264_CONSTRAINED (1<<9) // 8+1; constraint_set1_flag -#define FF_PROFILE_H264_INTRA (1<<11) // 8+3; constraint_set3_flag - -#define FF_PROFILE_H264_BASELINE 66 -#define FF_PROFILE_H264_CONSTRAINED_BASELINE (66|FF_PROFILE_H264_CONSTRAINED) -#define FF_PROFILE_H264_MAIN 77 -#define FF_PROFILE_H264_EXTENDED 88 -#define FF_PROFILE_H264_HIGH 100 -#define FF_PROFILE_H264_HIGH_10 110 -#define FF_PROFILE_H264_HIGH_10_INTRA (110|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_MULTIVIEW_HIGH 118 -#define FF_PROFILE_H264_HIGH_422 122 -#define FF_PROFILE_H264_HIGH_422_INTRA (122|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_STEREO_HIGH 128 -#define FF_PROFILE_H264_HIGH_444 144 -#define FF_PROFILE_H264_HIGH_444_PREDICTIVE 244 -#define FF_PROFILE_H264_HIGH_444_INTRA (244|FF_PROFILE_H264_INTRA) -#define FF_PROFILE_H264_CAVLC_444 44 - -#define FF_PROFILE_VC1_SIMPLE 0 -#define FF_PROFILE_VC1_MAIN 1 -#define FF_PROFILE_VC1_COMPLEX 2 -#define FF_PROFILE_VC1_ADVANCED 3 - -#define FF_PROFILE_MPEG4_SIMPLE 0 -#define FF_PROFILE_MPEG4_SIMPLE_SCALABLE 1 -#define FF_PROFILE_MPEG4_CORE 2 -#define FF_PROFILE_MPEG4_MAIN 3 -#define FF_PROFILE_MPEG4_N_BIT 4 -#define FF_PROFILE_MPEG4_SCALABLE_TEXTURE 5 -#define FF_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION 6 -#define FF_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE 7 -#define FF_PROFILE_MPEG4_HYBRID 8 -#define FF_PROFILE_MPEG4_ADVANCED_REAL_TIME 9 -#define FF_PROFILE_MPEG4_CORE_SCALABLE 10 -#define FF_PROFILE_MPEG4_ADVANCED_CODING 11 -#define FF_PROFILE_MPEG4_ADVANCED_CORE 12 -#define FF_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE 13 -#define FF_PROFILE_MPEG4_SIMPLE_STUDIO 14 -#define FF_PROFILE_MPEG4_ADVANCED_SIMPLE 15 - -#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_0 1 -#define FF_PROFILE_JPEG2000_CSTREAM_RESTRICTION_1 2 -#define FF_PROFILE_JPEG2000_CSTREAM_NO_RESTRICTION 32768 -#define FF_PROFILE_JPEG2000_DCINEMA_2K 3 -#define FF_PROFILE_JPEG2000_DCINEMA_4K 4 - -#define FF_PROFILE_VP9_0 0 -#define FF_PROFILE_VP9_1 1 -#define FF_PROFILE_VP9_2 2 -#define FF_PROFILE_VP9_3 3 - -#define FF_PROFILE_HEVC_MAIN 1 -#define FF_PROFILE_HEVC_MAIN_10 2 -#define FF_PROFILE_HEVC_MAIN_STILL_PICTURE 3 -#define FF_PROFILE_HEVC_REXT 4 -#define FF_PROFILE_HEVC_SCC 9 - -#define FF_PROFILE_VVC_MAIN_10 1 -#define FF_PROFILE_VVC_MAIN_10_444 33 - -#define FF_PROFILE_AV1_MAIN 0 -#define FF_PROFILE_AV1_HIGH 1 -#define FF_PROFILE_AV1_PROFESSIONAL 2 - -#define FF_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT 0xc0 -#define FF_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT 0xc1 -#define FF_PROFILE_MJPEG_HUFFMAN_PROGRESSIVE_DCT 0xc2 -#define FF_PROFILE_MJPEG_HUFFMAN_LOSSLESS 0xc3 -#define FF_PROFILE_MJPEG_JPEG_LS 0xf7 - -#define FF_PROFILE_SBC_MSBC 1 - -#define FF_PROFILE_PRORES_PROXY 0 -#define FF_PROFILE_PRORES_LT 1 -#define FF_PROFILE_PRORES_STANDARD 2 -#define FF_PROFILE_PRORES_HQ 3 -#define FF_PROFILE_PRORES_4444 4 -#define FF_PROFILE_PRORES_XQ 5 - -#define FF_PROFILE_ARIB_PROFILE_A 0 -#define FF_PROFILE_ARIB_PROFILE_C 1 - -#define FF_PROFILE_KLVA_SYNC 0 -#define FF_PROFILE_KLVA_ASYNC 1 - -#define FF_PROFILE_EVC_BASELINE 0 -#define FF_PROFILE_EVC_MAIN 1 -#endif /** * Encoding level descriptor. * - encoding: Set by user, corresponds to a specific level defined by the * codec, usually corresponding to the profile level, if not specified it - * is set to FF_LEVEL_UNKNOWN. + * is set to AV_LEVEL_UNKNOWN. * - decoding: Set by libavcodec. * See AV_LEVEL_* in defs.h. */ int level; -#if FF_API_FF_PROFILE_LEVEL - /** @deprecated The following define is deprecated; use AV_LEVEL_UNKOWN - * in defs.h instead. */ -#define FF_LEVEL_UNKNOWN -99 -#endif #if FF_API_CODEC_PROPS /** @@ -1913,9 +1746,6 @@ * * After being set, the array is owned by the codec and freed in * avcodec_free_context(). - * - * @warning the deprecated avcodec_close() function DOES NOT free this array - * for encoding, it must be freed manually by the caller. */ int subtitle_header_size; uint8_t *subtitle_header; @@ -2105,6 +1935,17 @@ */ AVFrameSideData **decoded_side_data; int nb_decoded_side_data; + + /** + * Indicates how the alpha channel of the video is represented. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; + + int moz_extradata_offset; + + void* moz_ndk_crypto; } AVCodecContext; /** @@ -2399,24 +2240,6 @@ */ int avcodec_open2(AVCodecContext *avctx, const AVCodec *codec, AVDictionary **options); -#if FF_API_AVCODEC_CLOSE -/** - * Close a given AVCodecContext and free all the data associated with it - * (but not the AVCodecContext itself). - * - * Calling this function on an AVCodecContext that hasn't been opened will free - * the codec-specific data allocated in avcodec_alloc_context3() with a non-NULL - * codec. Subsequent calls will do nothing. - * - * @deprecated Do not use this function. Use avcodec_free_context() to destroy a - * codec context (either open or closed). Opening and closing a codec context - * multiple times is not supported anymore -- use multiple codec contexts - * instead. - */ -attribute_deprecated -int avcodec_close(AVCodecContext *avctx); -#endif - /** * Free all allocated data in the given subtitle struct. * @@ -2553,6 +2376,7 @@ * frame (depending on the decoder type) allocated by the * codec. Note that the function will always call * av_frame_unref(frame) before doing anything else. + * @param flags Combination of AV_CODEC_RECEIVE_FRAME_FLAG_* flags. * * @retval 0 success, a frame was returned * @retval AVERROR(EAGAIN) output is not available in this state - user must @@ -2563,6 +2387,11 @@ * @ref AV_CODEC_FLAG_RECON_FRAME flag enabled * @retval "other negative error code" legitimate decoding errors */ +int avcodec_receive_frame_flags(AVCodecContext *avctx, AVFrame *frame, unsigned flags); + +/** + * Alias for `avcodec_receive_frame_flags(avctx, frame, 0)`. + */ int avcodec_receive_frame(AVCodecContext *avctx, AVFrame *frame); /** @@ -2728,6 +2557,7 @@ AV_CODEC_CONFIG_CHANNEL_LAYOUT, ///< AVChannelLayout, terminated by {0} AV_CODEC_CONFIG_COLOR_RANGE, ///< AVColorRange, terminated by AVCOL_RANGE_UNSPECIFIED AV_CODEC_CONFIG_COLOR_SPACE, ///< AVColorSpace, terminated by AVCOL_SPC_UNSPECIFIED + AV_CODEC_CONFIG_ALPHA_MODE, ///< AVAlphaMode, terminated by AVALPHA_MODE_UNSPECIFIED }; /** @@ -2924,17 +2754,35 @@ } AVCodecParserContext; typedef struct AVCodecParser { +#if FF_API_PARSER_CODECID int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif +#if FF_API_PARSER_PRIVATE + /***************************************************************** + * All fields below this line are not part of the public API. They + * may not be used outside of libavcodec and can be changed and + * removed at will. + * New public fields should be added right above. + ***************************************************************** + */ + attribute_deprecated int priv_data_size; + attribute_deprecated int (*parser_init)(AVCodecParserContext *s); /* This callback never returns an error, a negative value means that * the frame start was in a previous packet. */ + attribute_deprecated int (*parser_parse)(AVCodecParserContext *s, AVCodecContext *avctx, const uint8_t **poutbuf, int *poutbuf_size, const uint8_t *buf, int buf_size); + attribute_deprecated void (*parser_close)(AVCodecParserContext *s); + attribute_deprecated int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); +#endif } AVCodecParser; /** @@ -2948,7 +2796,11 @@ */ const AVCodecParser *av_parser_iterate(void **opaque); +#if FF_API_PARSER_CODECID AVCodecParserContext *av_parser_init(int codec_id); +#else +AVCodecParserContext *av_parser_init(enum AVCodecID codec_id); +#endif /** * Parse a packet. @@ -3100,7 +2952,7 @@ * * @note for encoders, this function will only do something if the encoder * declares support for AV_CODEC_CAP_ENCODER_FLUSH. When called, the encoder - * will drain any remaining packets, and can then be re-used for a different + * will drain any remaining packets, and can then be reused for a different * stream (as opposed to sending a null frame which will leave the encoder * in a permanent EOF state after draining). This can be desirable if the * cost of tearing down and replacing the encoder instance is high. @@ -3135,8 +2987,8 @@ void av_fast_padded_mallocz(void *ptr, unsigned int *size, size_t min_size); /** - * @return a positive value if s is open (i.e. avcodec_open2() was called on it - * with no corresponding avcodec_close()), 0 otherwise. + * @return a positive value if s is open (i.e. avcodec_open2() was called on it), + * 0 otherwise. */ int avcodec_is_open(AVCodecContext *s); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.symbols thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.symbols --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec.symbols 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec.symbols 2026-04-29 18:38:25.000000000 +0000 @@ -25,7 +25,6 @@ avcodec_align_dimensions avcodec_align_dimensions2 avcodec_alloc_context3 -avcodec_close avcodec_configuration avcodec_decode_subtitle2 avcodec_default_execute @@ -64,3 +63,7 @@ ff_thread_progress_destroy ff_thread_progress_init ff_thread_progress_report +#if defined(MOZ_WIDGET_ANDROID) && !defined(MOZ_FFVPX_AUDIOONLY) +av_mediacodec_release_buffer +moz_avcodec_mediacodec_is_eos +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/avcodec_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/avcodec_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -45,7 +45,8 @@ /** * avcodec_receive_frame() implementation for decoders. */ -int ff_decode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame); +int ff_decode_receive_frame(struct AVCodecContext *avctx, struct AVFrame *frame, + unsigned flags); /** * avcodec_receive_frame() implementation for encoders. @@ -91,9 +92,10 @@ * Submit available packets for decoding to worker threads, return a * decoded frame if available. Returns AVERROR(EAGAIN) if none is available. * - * Parameters are the same as FFCodec.receive_frame. + * Parameters are the same as FFCodec.receive_frame, plus flags. */ -int ff_thread_receive_frame(struct AVCodecContext *avctx, AVFrame *frame); +int ff_thread_receive_frame(struct AVCodecContext *avctx, AVFrame *frame, + unsigned flags); /** * Do the actual decoding and obtain a decoded frame from the decoder, if diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/avdct.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/avdct.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/avdct.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/avdct.c 2026-04-29 18:38:26.000000000 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/attributes.h" #include "libavutil/mem.h" #include "avcodec.h" #include "idctdsp.h" @@ -68,12 +69,12 @@ .version = LIBAVUTIL_VERSION_INT, }; -const AVClass *avcodec_dct_get_class(void) +av_cold const AVClass *avcodec_dct_get_class(void) { return &avdct_class; } -AVDCT *avcodec_dct_alloc(void) +av_cold AVDCT *avcodec_dct_alloc(void) { AVDCT *dsp = av_mallocz(sizeof(AVDCT)); @@ -86,7 +87,7 @@ return dsp; } -int avcodec_dct_init(AVDCT *dsp) +av_cold int avcodec_dct_init(AVDCT *dsp) { AVCodecContext *avctx = avcodec_alloc_context3(NULL); @@ -119,7 +120,7 @@ #if CONFIG_PIXBLOCKDSP { PixblockDSPContext pdsp; - ff_pixblockdsp_init(&pdsp, avctx); + ff_pixblockdsp_init(&pdsp, dsp->bits_per_sample); COPY(pdsp, get_pixels); COPY(pdsp, get_pixels_unaligned); } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bit_depth_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/bit_depth_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bit_depth_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bit_depth_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -30,7 +30,6 @@ # undef pixel4 # undef dctcoef # undef idctin -# undef INIT_CLIP # undef no_rnd_avg_pixel4 # undef rnd_avg_pixel4 # undef AV_RN2P @@ -44,11 +43,13 @@ # undef FUNCC # undef av_clip_pixel # undef PIXEL_SPLAT_X4 +# undef PIXELSIZE #else # define AVCODEC_BIT_DEPTH_TEMPLATE_C #endif #if BIT_DEPTH > 8 +# define PIXELSIZE 16 # define pixel uint16_t # define pixel2 uint32_t # define pixel4 uint64_t @@ -64,7 +65,6 @@ # define idctin int16_t #endif -# define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg64 # define rnd_avg_pixel4 rnd_avg64 # define AV_RN2P AV_RN32 @@ -78,13 +78,13 @@ # define av_clip_pixel(a) av_clip_uintp2(a, BIT_DEPTH) # define CLIP(a) av_clip_uintp2(a, BIT_DEPTH) #else +# define PIXELSIZE 8 # define pixel uint8_t # define pixel2 uint16_t # define pixel4 uint32_t # define dctcoef int16_t # define idctin int16_t -# define INIT_CLIP # define no_rnd_avg_pixel4 no_rnd_avg32 # define rnd_avg_pixel4 rnd_avg32 # define AV_RN2P AV_RN16 @@ -103,6 +103,7 @@ #define FUNC2(a, b, c) FUNC3(a, b, c) #define FUNC(a) FUNC2(a, BIT_DEPTH,) #define FUNCC(a) FUNC2(a, BIT_DEPTH, _c) +#define FUNCC2(a) FUNC2(a, PIXELSIZE, _c) #define FUNC4(a, b, c) a ## _int ## b ## _ ## c ## bit #define FUNC5(a, b, c) FUNC4(a, b, c) #define FUNC6(a) FUNC5(a, IN_IDCT_DEPTH, BIT_DEPTH) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bitstream_filters.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/bitstream_filters.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bitstream_filters.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bitstream_filters.c 2026-04-29 18:38:26.000000000 +0000 @@ -25,6 +25,8 @@ #include "bsf_internal.h" extern const FFBitStreamFilter ff_aac_adtstoasc_bsf; +extern const FFBitStreamFilter ff_ahx_to_mp2_bsf; +extern const FFBitStreamFilter ff_apv_metadata_bsf; extern const FFBitStreamFilter ff_av1_frame_merge_bsf; extern const FFBitStreamFilter ff_av1_frame_split_bsf; extern const FFBitStreamFilter ff_av1_metadata_bsf; @@ -35,6 +37,7 @@ extern const FFBitStreamFilter ff_dts2pts_bsf; extern const FFBitStreamFilter ff_dv_error_marker_bsf; extern const FFBitStreamFilter ff_eac3_core_bsf; +extern const FFBitStreamFilter ff_eia608_to_smpte436m_bsf; extern const FFBitStreamFilter ff_evc_frame_merge_bsf; extern const FFBitStreamFilter ff_extract_extradata_bsf; extern const FFBitStreamFilter ff_filter_units_bsf; @@ -45,6 +48,7 @@ extern const FFBitStreamFilter ff_hevc_metadata_bsf; extern const FFBitStreamFilter ff_hevc_mp4toannexb_bsf; extern const FFBitStreamFilter ff_imx_dump_header_bsf; +extern const FFBitStreamFilter ff_lcevc_metadata_bsf; extern const FFBitStreamFilter ff_media100_to_mjpegb_bsf; extern const FFBitStreamFilter ff_mjpeg2jpeg_bsf; extern const FFBitStreamFilter ff_mjpega_dump_header_bsf; @@ -60,6 +64,7 @@ extern const FFBitStreamFilter ff_remove_extradata_bsf; extern const FFBitStreamFilter ff_setts_bsf; extern const FFBitStreamFilter ff_showinfo_bsf; +extern const FFBitStreamFilter ff_smpte436m_to_eia608_bsf; extern const FFBitStreamFilter ff_text2movsub_bsf; extern const FFBitStreamFilter ff_trace_headers_bsf; extern const FFBitStreamFilter ff_truehd_core_bsf; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/blockdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/blockdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/blockdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/blockdsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -38,7 +38,6 @@ void ff_blockdsp_init(BlockDSPContext *c); -void ff_blockdsp_init_alpha(BlockDSPContext *c); void ff_blockdsp_init_arm(BlockDSPContext *c); void ff_blockdsp_init_ppc(BlockDSPContext *c); void ff_blockdsp_init_riscv(BlockDSPContext *c); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf/aac_adtstoasc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/aac_adtstoasc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf/aac_adtstoasc.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/aac_adtstoasc.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * MPEG-2/4 AAC ADTS to MPEG-4 Audio Specific Configuration bitstream filter + * Copyright (c) 2009 Alex Converse + * + * 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 "adts_header.h" +#include "adts_parser.h" +#include "bsf.h" +#include "bsf_internal.h" +#include "put_bits.h" +#include "get_bits.h" +#include "mpeg4audio.h" +#include "mpeg4audio_copy_pce.h" + +typedef struct AACBSFContext { + int first_frame_done; +} AACBSFContext; + +/** + * This filter creates an MPEG-4 AudioSpecificConfig from an MPEG-2/4 + * ADTS header and removes the ADTS header. + */ +static int aac_adtstoasc_filter(AVBSFContext *bsfc, AVPacket *pkt) +{ + AACBSFContext *ctx = bsfc->priv_data; + + PutBitContext pb; + AACADTSHeaderInfo hdr; + int ret; + + ret = ff_bsf_get_packet_ref(bsfc, pkt); + if (ret < 0) + return ret; + + if (bsfc->par_in->extradata && pkt->size >= 2 && (AV_RB16(pkt->data) >> 4) != 0xfff) + return 0; + + if (pkt->size < AV_AAC_ADTS_HEADER_SIZE) + goto packet_too_small; + + if (ff_adts_header_parse_buf(pkt->data, &hdr) < 0) { + av_log(bsfc, AV_LOG_ERROR, "Error parsing ADTS frame header!\n"); + ret = AVERROR_INVALIDDATA; + goto fail; + } + + if (!hdr.crc_absent && hdr.num_aac_frames > 1) { + avpriv_report_missing_feature(bsfc, + "Multiple RDBs per frame with CRC"); + ret = AVERROR_PATCHWELCOME; + goto fail; + } + + pkt->size -= AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; + if (pkt->size <= 0) + goto packet_too_small; + pkt->data += AV_AAC_ADTS_HEADER_SIZE + 2 * !hdr.crc_absent; + + if (!ctx->first_frame_done) { + int pce_size = 0; + uint8_t pce_data[MAX_PCE_SIZE]; + uint8_t *extradata; + + if (!hdr.chan_config) { + GetBitContext gb; + init_get_bits(&gb, pkt->data, pkt->size * 8); + if (get_bits(&gb, 3) != 5) { + avpriv_report_missing_feature(bsfc, + "PCE-based channel configuration " + "without PCE as first syntax " + "element"); + ret = AVERROR_PATCHWELCOME; + goto fail; + } + init_put_bits(&pb, pce_data, MAX_PCE_SIZE); + pce_size = ff_copy_pce_data(&pb, &gb) / 8; + flush_put_bits(&pb); + pkt->size -= get_bits_count(&gb)/8; + pkt->data += get_bits_count(&gb)/8; + } + + extradata = av_packet_new_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, + 2 + pce_size); + if (!extradata) { + ret = AVERROR(ENOMEM); + goto fail; + } + + init_put_bits(&pb, extradata, 2 + pce_size); + put_bits(&pb, 5, hdr.object_type); + put_bits(&pb, 4, hdr.sampling_index); + put_bits(&pb, 4, hdr.chan_config); + put_bits(&pb, 1, 0); //frame length - 1024 samples + put_bits(&pb, 1, 0); //does not depend on core coder + put_bits(&pb, 1, 0); //is not extension + flush_put_bits(&pb); + if (pce_size) { + memcpy(extradata + 2, pce_data, pce_size); + } + + ctx->first_frame_done = 1; + } + + return 0; + +packet_too_small: + av_log(bsfc, AV_LOG_ERROR, "Input packet too small\n"); + ret = AVERROR_INVALIDDATA; +fail: + av_packet_unref(pkt); + return ret; +} + +static int aac_adtstoasc_init(AVBSFContext *ctx) +{ + /* Validate the extradata if the stream is already MPEG-4 AudioSpecificConfig */ + if (ctx->par_in->extradata) { + MPEG4AudioConfig mp4ac; + int ret = avpriv_mpeg4audio_get_config2(&mp4ac, ctx->par_in->extradata, + ctx->par_in->extradata_size, 1, ctx); + if (ret < 0) { + av_log(ctx, AV_LOG_ERROR, "Error parsing AudioSpecificConfig extradata!\n"); + return ret; + } + } + + return 0; +} + +static const enum AVCodecID codec_ids[] = { + AV_CODEC_ID_AAC, AV_CODEC_ID_NONE, +}; + +const FFBitStreamFilter ff_aac_adtstoasc_bsf = { + .p.name = "aac_adtstoasc", + .p.codec_ids = codec_ids, + .priv_data_size = sizeof(AACBSFContext), + .init = aac_adtstoasc_init, + .filter = aac_adtstoasc_filter, +}; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf/moz.build thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/moz.build --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf/moz.build 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf/moz.build 2026-04-29 18:38:25.000000000 +0000 @@ -11,6 +11,7 @@ ] SOURCES += [ + 'aac_adtstoasc.c', 'null.c', ] diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf_list.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf_list.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bsf_list.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bsf_list.c 2026-04-29 18:38:26.000000000 +0000 @@ -7,5 +7,8 @@ #if CONFIG_AV1_VAAPI_HWACCEL &ff_av1_frame_split_bsf, #endif +#if CONFIG_MEDIACODEC + &ff_aac_adtstoasc_bsf, +#endif &ff_null_bsf, NULL }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/bytestream.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/bytestream.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/bytestream.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/bytestream.h 2026-04-29 18:38:26.000000000 +0000 @@ -77,11 +77,11 @@ } \ return bytestream2_get_ ## name ## u(g); \ } \ -static av_always_inline type bytestream2_peek_ ## name ## u(GetByteContext *g) \ +static av_always_inline type bytestream2_peek_ ## name ## u(const GetByteContext *g) \ { \ return read(g->buffer); \ } \ -static av_always_inline type bytestream2_peek_ ## name(GetByteContext *g) \ +static av_always_inline type bytestream2_peek_ ## name(const GetByteContext *g)\ { \ if (g->buffer_end - g->buffer < bytes) \ return 0; \ @@ -138,7 +138,7 @@ const uint8_t *buf, int buf_size) { - av_assert0(buf_size >= 0); + av_assert0(buf && buf_size >= 0); g->buffer = buf; g->buffer_start = buf; g->buffer_end = buf + buf_size; @@ -148,19 +148,19 @@ uint8_t *buf, int buf_size) { - av_assert0(buf_size >= 0); + av_assert0(buf && buf_size >= 0); p->buffer = buf; p->buffer_start = buf; p->buffer_end = buf + buf_size; p->eof = 0; } -static av_always_inline int bytestream2_get_bytes_left(GetByteContext *g) +static av_always_inline int bytestream2_get_bytes_left(const GetByteContext *g) { return g->buffer_end - g->buffer; } -static av_always_inline int bytestream2_get_bytes_left_p(PutByteContext *p) +static av_always_inline int bytestream2_get_bytes_left_p(const PutByteContext *p) { return p->buffer_end - p->buffer; } @@ -189,22 +189,22 @@ p->buffer += size2; } -static av_always_inline int bytestream2_tell(GetByteContext *g) +static av_always_inline int bytestream2_tell(const GetByteContext *g) { return (int)(g->buffer - g->buffer_start); } -static av_always_inline int bytestream2_tell_p(PutByteContext *p) +static av_always_inline int bytestream2_tell_p(const PutByteContext *p) { return (int)(p->buffer - p->buffer_start); } -static av_always_inline int bytestream2_size(GetByteContext *g) +static av_always_inline int bytestream2_size(const GetByteContext *g) { return (int)(g->buffer_end - g->buffer_start); } -static av_always_inline int bytestream2_size_p(PutByteContext *p) +static av_always_inline int bytestream2_size_p(const PutByteContext *p) { return (int)(p->buffer_end - p->buffer_start); } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.c 2026-04-29 18:38:26.000000000 +0000 @@ -18,8 +18,6 @@ #include -#include "config.h" - #include "libavutil/avassert.h" #include "libavutil/buffer.h" #include "libavutil/common.h" @@ -33,61 +31,73 @@ static const CodedBitstreamType *const cbs_type_table[] = { -#if CONFIG_CBS_AV1 - &ff_cbs_type_av1, +#if CBS_APV + &CBS_FUNC(type_apv), +#endif +#if CBS_AV1 + &CBS_FUNC(type_av1), #endif -#if CONFIG_CBS_H264 - &ff_cbs_type_h264, +#if CBS_H264 + &CBS_FUNC(type_h264), #endif -#if CONFIG_CBS_H265 - &ff_cbs_type_h265, +#if CBS_H265 + &CBS_FUNC(type_h265), #endif -#if CONFIG_CBS_H266 - &ff_cbs_type_h266, +#if CBS_H266 + &CBS_FUNC(type_h266), #endif -#if CONFIG_CBS_JPEG - &ff_cbs_type_jpeg, +#if CBS_LCEVC + &CBS_FUNC(type_lcevc), #endif -#if CONFIG_CBS_MPEG2 - &ff_cbs_type_mpeg2, +#if CBS_JPEG + &CBS_FUNC(type_jpeg), #endif -#if CONFIG_CBS_VP8 - &ff_cbs_type_vp8, +#if CBS_MPEG2 + &CBS_FUNC(type_mpeg2), #endif -#if CONFIG_CBS_VP9 - &ff_cbs_type_vp9, +#if CBS_VP8 + &CBS_FUNC(type_vp8), +#endif +#if CBS_VP9 + &CBS_FUNC(type_vp9), #endif }; -const enum AVCodecID ff_cbs_all_codec_ids[] = { -#if CONFIG_CBS_AV1 +const enum AVCodecID CBS_FUNC(all_codec_ids)[] = { +#if CBS_APV + AV_CODEC_ID_APV, +#endif +#if CBS_AV1 AV_CODEC_ID_AV1, #endif -#if CONFIG_CBS_H264 +#if CBS_H264 AV_CODEC_ID_H264, #endif -#if CONFIG_CBS_H265 +#if CBS_H265 AV_CODEC_ID_H265, #endif -#if CONFIG_CBS_H266 +#if CBS_H266 AV_CODEC_ID_H266, #endif -#if CONFIG_CBS_JPEG +#if CBS_LCEVC + AV_CODEC_ID_LCEVC, +#endif +#if CBS_JPEG AV_CODEC_ID_MJPEG, #endif -#if CONFIG_CBS_MPEG2 +#if CBS_MPEG2 AV_CODEC_ID_MPEG2VIDEO, #endif -#if CONFIG_CBS_VP8 +#if CBS_VP8 AV_CODEC_ID_VP8, #endif -#if CONFIG_CBS_VP9 +#if CBS_VP9 AV_CODEC_ID_VP9, #endif AV_CODEC_ID_NONE }; -av_cold int ff_cbs_init(CodedBitstreamContext **ctx_ptr, +av_cold int CBS_FUNC(init)(CodedBitstreamContext **ctx_ptr, enum AVCodecID codec_id, void *log_ctx) { CodedBitstreamContext *ctx; @@ -133,13 +143,13 @@ return 0; } -av_cold void ff_cbs_flush(CodedBitstreamContext *ctx) +av_cold void CBS_FUNC(flush)(CodedBitstreamContext *ctx) { if (ctx->codec->flush) ctx->codec->flush(ctx); } -av_cold void ff_cbs_close(CodedBitstreamContext **ctx_ptr) +av_cold void CBS_FUNC(close)(CodedBitstreamContext **ctx_ptr) { CodedBitstreamContext *ctx = *ctx_ptr; @@ -169,7 +179,7 @@ unit->data_bit_padding = 0; } -void ff_cbs_fragment_reset(CodedBitstreamFragment *frag) +void CBS_FUNC(fragment_reset)(CodedBitstreamFragment *frag) { int i; @@ -183,14 +193,15 @@ frag->data_bit_padding = 0; } -av_cold void ff_cbs_fragment_free(CodedBitstreamFragment *frag) +av_cold void CBS_FUNC(fragment_free)(CodedBitstreamFragment *frag) { - ff_cbs_fragment_reset(frag); + CBS_FUNC(fragment_reset)(frag); av_freep(&frag->units); frag->nb_units_allocated = 0; } +#if CBS_READ static int cbs_read_fragment_content(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { @@ -226,7 +237,8 @@ unit->content = NULL; } else if (err < 0) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Failed to read unit %d " - "(type %"PRIu32").\n", i, unit->type); + "(type %"PRIu32"): %s.\n", + i, unit->type, av_err2str(err)); return err; } } @@ -256,7 +268,7 @@ static int cbs_read_data(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, - AVBufferRef *buf, + const AVBufferRef *buf, const uint8_t *data, size_t size, int header) { @@ -283,7 +295,7 @@ return cbs_read_fragment_content(ctx, frag); } -int ff_cbs_read_extradata(CodedBitstreamContext *ctx, +int CBS_FUNC(read_extradata)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par) { @@ -292,7 +304,7 @@ par->extradata_size, 1); } -int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx, +int CBS_FUNC(read_extradata_from_codec)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecContext *avctx) { @@ -301,7 +313,7 @@ avctx->extradata_size, 1); } -int ff_cbs_read_packet(CodedBitstreamContext *ctx, +int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt) { @@ -309,7 +321,7 @@ pkt->data, pkt->size, 0); } -int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, +int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt) { @@ -322,14 +334,17 @@ side_data, side_data_size, 1); } -int ff_cbs_read(CodedBitstreamContext *ctx, +int CBS_FUNC(read)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, + const AVBufferRef *buf, const uint8_t *data, size_t size) { - return cbs_read_data(ctx, frag, NULL, + return cbs_read_data(ctx, frag, buf, data, size, 0); } +#endif +#if CBS_WRITE /** * Allocate a new internal data buffer of the given size in the unit. * @@ -367,7 +382,7 @@ if (ret < 0) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Unable to allocate a " "sufficiently large write buffer (last attempt " - "%"SIZE_SPECIFIER" bytes).\n", ctx->write_buffer_size); + "%zu bytes).\n", ctx->write_buffer_size); return ret; } } @@ -406,7 +421,7 @@ return 0; } -int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, +int CBS_FUNC(write_fragment_data)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { int err, i; @@ -442,13 +457,13 @@ return 0; } -int ff_cbs_write_extradata(CodedBitstreamContext *ctx, +int CBS_FUNC(write_extradata)(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag) { int err; - err = ff_cbs_write_fragment_data(ctx, frag); + err = CBS_FUNC(write_fragment_data)(ctx, frag); if (err < 0) return err; @@ -471,14 +486,14 @@ return 0; } -int ff_cbs_write_packet(CodedBitstreamContext *ctx, +int CBS_FUNC(write_packet)(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag) { AVBufferRef *buf; int err; - err = ff_cbs_write_fragment_data(ctx, frag); + err = CBS_FUNC(write_fragment_data)(ctx, frag); if (err < 0) return err; @@ -494,22 +509,26 @@ return 0; } +#endif -void ff_cbs_trace_header(CodedBitstreamContext *ctx, +void CBS_FUNC(trace_header)(CodedBitstreamContext *ctx, const char *name) { +#if CBS_TRACE if (!ctx->trace_enable) return; av_log(ctx->log_ctx, ctx->trace_level, "%s\n", name); +#endif } -void ff_cbs_trace_read_log(void *trace_context, +void CBS_FUNC(trace_read_log)(void *trace_context, GetBitContext *gbc, int length, const char *str, const int *subscripts, int64_t value) { +#if CBS_TRACE CodedBitstreamContext *ctx = trace_context; char name[256]; char bits[256]; @@ -561,13 +580,15 @@ av_log(ctx->log_ctx, ctx->trace_level, "%-10d %s%*s = %"PRId64"\n", position, name, pad, bits, value); +#endif } -void ff_cbs_trace_write_log(void *trace_context, +void CBS_FUNC(trace_write_log)(void *trace_context, PutBitContext *pbc, int length, const char *str, const int *subscripts, int64_t value) { +#if CBS_TRACE CodedBitstreamContext *ctx = trace_context; // Ensure that the syntax element is written to the output buffer, @@ -590,9 +611,11 @@ skip_bits_long(&gbc, position - length); - ff_cbs_trace_read_log(ctx, &gbc, length, str, subscripts, value); + CBS_FUNC(trace_read_log)(ctx, &gbc, length, str, subscripts, value); +#endif } +#if CBS_READ static av_always_inline int cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, @@ -628,7 +651,7 @@ return 0; } -int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +int CBS_FUNC(read_unsigned)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max) @@ -637,14 +660,16 @@ write_to, range_min, range_max); } -int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +int CBS_FUNC(read_simple_unsigned)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to) { return cbs_read_unsigned(ctx, gbc, width, name, NULL, write_to, 0, UINT32_MAX); } +#endif -int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, +#if CBS_WRITE +int CBS_FUNC(write_unsigned)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max) @@ -663,24 +688,23 @@ if (put_bits_left(pbc) < width) return AVERROR(ENOSPC); - if (width < 32) - put_bits(pbc, width, value); - else - put_bits32(pbc, value); + put_bits63(pbc, width, value); CBS_TRACE_WRITE_END(); return 0; } -int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, +int CBS_FUNC(write_simple_unsigned)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value) { - return ff_cbs_write_unsigned(ctx, pbc, width, name, NULL, + return CBS_FUNC(write_unsigned)(ctx, pbc, width, name, NULL, value, 0, MAX_UINT_BITS(width)); } +#endif -int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, +#if CBS_READ +int CBS_FUNC(read_signed)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max) @@ -711,8 +735,10 @@ *write_to = value; return 0; } +#endif -int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, +#if CBS_WRITE +int CBS_FUNC(write_signed)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max) @@ -731,15 +757,13 @@ if (put_bits_left(pbc) < width) return AVERROR(ENOSPC); - if (width < 32) - put_sbits(pbc, width, value); - else - put_bits32(pbc, value); + put_bits63(pbc, width, zero_extend(value, width)); CBS_TRACE_WRITE_END(); return 0; } +#endif static int cbs_insert_unit(CodedBitstreamFragment *frag, @@ -766,21 +790,19 @@ if (position < frag->nb_units) memcpy(units + position + 1, frag->units + position, (frag->nb_units - position) * sizeof(*units)); - } - memset(units + position, 0, sizeof(*units)); - - if (units != frag->units) { av_free(frag->units); frag->units = units; } + memset(units + position, 0, sizeof(*units)); + ++frag->nb_units; return 0; } -int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, +int CBS_FUNC(insert_unit_content)(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, @@ -847,7 +869,7 @@ return 0; } -int ff_cbs_append_unit_data(CodedBitstreamFragment *frag, +int CBS_FUNC(append_unit_data)(CodedBitstreamFragment *frag, CodedBitstreamUnitType type, uint8_t *data, size_t data_size, AVBufferRef *data_buf) @@ -857,7 +879,7 @@ frag->nb_units); } -void ff_cbs_delete_unit(CodedBitstreamFragment *frag, +void CBS_FUNC(delete_unit)(CodedBitstreamFragment *frag, int position) { av_assert0(0 <= position && position < frag->nb_units @@ -875,7 +897,7 @@ static void cbs_default_free_unit_content(AVRefStructOpaque opaque, void *content) { - const CodedBitstreamUnitTypeDescriptor *desc = opaque.c; + CodedBitstreamUnitTypeDescriptor *desc = opaque.c; for (int i = 0; i < desc->type.ref.nb_offsets; i++) { void **ptr = (void**)((char*)content + desc->type.ref.offsets[i]); @@ -883,11 +905,11 @@ } } -static const CodedBitstreamUnitTypeDescriptor +static CodedBitstreamUnitTypeDescriptor *cbs_find_unit_type_desc(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { - const CodedBitstreamUnitTypeDescriptor *desc; + CodedBitstreamUnitTypeDescriptor *desc; int i, j; if (!ctx->codec->unit_types) @@ -911,7 +933,7 @@ return NULL; } -static void *cbs_alloc_content(const CodedBitstreamUnitTypeDescriptor *desc) +static void *cbs_alloc_content(CodedBitstreamUnitTypeDescriptor *desc) { return av_refstruct_alloc_ext_c(desc->content_size, 0, (AVRefStructOpaque){ .c = desc }, @@ -920,10 +942,10 @@ : cbs_default_free_unit_content); } -int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, +int CBS_FUNC(alloc_unit_content)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { - const CodedBitstreamUnitTypeDescriptor *desc; + CodedBitstreamUnitTypeDescriptor *desc; av_assert0(!unit->content && !unit->content_ref); @@ -941,11 +963,11 @@ static int cbs_clone_noncomplex_unit_content(void **clonep, const CodedBitstreamUnit *unit, - const CodedBitstreamUnitTypeDescriptor *desc) + CodedBitstreamUnitTypeDescriptor *desc) { const uint8_t *src; uint8_t *copy; - int err, i; + int err; av_assert0(unit->content); src = unit->content; @@ -960,7 +982,7 @@ *(ptr + 1) = NULL; } - for (i = 0; i < desc->type.ref.nb_offsets; i++) { + for (int i = 0; i < desc->type.ref.nb_offsets; i++) { const uint8_t *const *src_ptr = (const uint8_t* const*)(src + desc->type.ref.offsets[i]); const AVBufferRef *src_buf = *(AVBufferRef**)(src_ptr + 1); uint8_t **copy_ptr = (uint8_t**)(copy + desc->type.ref.offsets[i]); @@ -1001,7 +1023,7 @@ static int cbs_clone_unit_content(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { - const CodedBitstreamUnitTypeDescriptor *desc; + CodedBitstreamUnitTypeDescriptor *desc; void *new_content; int err; @@ -1032,7 +1054,7 @@ return 0; } -int ff_cbs_make_unit_refcounted(CodedBitstreamContext *ctx, +int CBS_FUNC(make_unit_refcounted)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { av_assert0(unit->content); @@ -1041,7 +1063,7 @@ return cbs_clone_unit_content(ctx, unit); } -int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, +int CBS_FUNC(make_unit_writable)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { void *ref = unit->content_ref; @@ -1058,7 +1080,7 @@ return 0; } -void ff_cbs_discard_units(CodedBitstreamContext *ctx, +void CBS_FUNC(discard_units)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, enum AVDiscard skip, int flags) @@ -1070,11 +1092,11 @@ if (ctx->codec->discarded_unit(ctx, &frag->units[i], skip)) { // discard all units if (!(flags & DISCARD_FLAG_KEEP_NON_VCL)) { - ff_cbs_fragment_free(frag); + CBS_FUNC(fragment_free)(frag); return; } - ff_cbs_delete_unit(frag, i); + CBS_FUNC(delete_unit)(frag, i); } } } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs.h 2026-04-29 18:38:26.000000000 +0000 @@ -29,6 +29,13 @@ #include "defs.h" #include "packet.h" +#ifndef CBS_PREFIX +#define CBS_PREFIX cbs +#endif + +#define CBS_FUNC_PREFIX_NAME(prefix, name) ff_ ## prefix ## _ ## name +#define CBS_FUNC_NAME(prefix, name) CBS_FUNC_PREFIX_NAME(prefix, name) +#define CBS_FUNC(name) CBS_FUNC_NAME(CBS_PREFIX, name) /* * This defines a framework for converting between a coded bitstream @@ -294,24 +301,24 @@ * * Terminated by AV_CODEC_ID_NONE. */ -extern const enum AVCodecID ff_cbs_all_codec_ids[]; +extern const enum AVCodecID CBS_FUNC(all_codec_ids)[]; /** * Create and initialise a new context for the given codec. */ -int ff_cbs_init(CodedBitstreamContext **ctx, +int CBS_FUNC(init)(CodedBitstreamContext **ctx, enum AVCodecID codec_id, void *log_ctx); /** * Reset all internal state in a context. */ -void ff_cbs_flush(CodedBitstreamContext *ctx); +void CBS_FUNC(flush)(CodedBitstreamContext *ctx); /** * Close a context and free all internal state. */ -void ff_cbs_close(CodedBitstreamContext **ctx); +void CBS_FUNC(close)(CodedBitstreamContext **ctx); /** @@ -325,7 +332,7 @@ * The fragment must have been zeroed or reset via ff_cbs_fragment_reset * before use. */ -int ff_cbs_read_extradata(CodedBitstreamContext *ctx, +int CBS_FUNC(read_extradata)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVCodecParameters *par); @@ -336,11 +343,11 @@ * This acts identical to ff_cbs_read_extradata() for the case where * you already have a codec context. */ -int ff_cbs_read_extradata_from_codec(CodedBitstreamContext *ctx, +int CBS_FUNC(read_extradata_from_codec)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const struct AVCodecContext *avctx); -int ff_cbs_read_packet_side_data(CodedBitstreamContext *ctx, +int CBS_FUNC(read_packet_side_data)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt); @@ -355,7 +362,7 @@ * The fragment must have been zeroed or reset via ff_cbs_fragment_reset * before use. */ -int ff_cbs_read_packet(CodedBitstreamContext *ctx, +int CBS_FUNC(read_packet)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, const AVPacket *pkt); @@ -370,8 +377,9 @@ * The fragment must have been zeroed or reset via ff_cbs_fragment_reset * before use. */ -int ff_cbs_read(CodedBitstreamContext *ctx, +int CBS_FUNC(read)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, + const AVBufferRef *buf, const uint8_t *data, size_t size); @@ -387,7 +395,7 @@ * with any persistent data from the fragment which may be required to * write following fragments (e.g. parameter sets). */ -int ff_cbs_write_fragment_data(CodedBitstreamContext *ctx, +int CBS_FUNC(write_fragment_data)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag); /** @@ -396,7 +404,7 @@ * Modifies context and fragment as ff_cbs_write_fragment_data does and * replaces any existing extradata in the structure. */ -int ff_cbs_write_extradata(CodedBitstreamContext *ctx, +int CBS_FUNC(write_extradata)(CodedBitstreamContext *ctx, AVCodecParameters *par, CodedBitstreamFragment *frag); @@ -410,7 +418,7 @@ * fragment; other fields are not touched. On failure, the packet is not * touched at all. */ -int ff_cbs_write_packet(CodedBitstreamContext *ctx, +int CBS_FUNC(write_packet)(CodedBitstreamContext *ctx, AVPacket *pkt, CodedBitstreamFragment *frag); @@ -419,20 +427,20 @@ * Free the units contained in a fragment as well as the fragment's * own data buffer, but not the units array itself. */ -void ff_cbs_fragment_reset(CodedBitstreamFragment *frag); +void CBS_FUNC(fragment_reset)(CodedBitstreamFragment *frag); /** * Free the units array of a fragment in addition to what * ff_cbs_fragment_reset does. */ -void ff_cbs_fragment_free(CodedBitstreamFragment *frag); +void CBS_FUNC(fragment_free)(CodedBitstreamFragment *frag); /** * Allocate a new internal content buffer matching the type of the unit. * * The content will be zeroed. */ -int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, +int CBS_FUNC(alloc_unit_content)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); /** @@ -443,7 +451,7 @@ * The content structure continues to be owned by the caller if * content_ref is not supplied. */ -int ff_cbs_insert_unit_content(CodedBitstreamFragment *frag, +int CBS_FUNC(insert_unit_content)(CodedBitstreamFragment *frag, int position, CodedBitstreamUnitType type, void *content, @@ -456,7 +464,7 @@ * av_malloc() and will on success become owned by the unit after this * call or freed on error. */ -int ff_cbs_append_unit_data(CodedBitstreamFragment *frag, +int CBS_FUNC(append_unit_data)(CodedBitstreamFragment *frag, CodedBitstreamUnitType type, uint8_t *data, size_t data_size, AVBufferRef *data_buf); @@ -466,7 +474,7 @@ * * Requires position to be >= 0 and < frag->nb_units. */ -void ff_cbs_delete_unit(CodedBitstreamFragment *frag, +void CBS_FUNC(delete_unit)(CodedBitstreamFragment *frag, int position); @@ -479,7 +487,7 @@ * It is not valid to call this function on a unit which does not have * decomposed content. */ -int ff_cbs_make_unit_refcounted(CodedBitstreamContext *ctx, +int CBS_FUNC(make_unit_refcounted)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); /** @@ -495,7 +503,7 @@ * It is not valid to call this function on a unit which does not have * decomposed content. */ -int ff_cbs_make_unit_writable(CodedBitstreamContext *ctx, +int CBS_FUNC(make_unit_writable)(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit); enum CbsDiscardFlags { @@ -508,9 +516,9 @@ }; /** - * Discard units accroding to 'skip'. + * Discard units according to 'skip'. */ -void ff_cbs_discard_units(CodedBitstreamContext *ctx, +void CBS_FUNC(discard_units)(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, enum AVDiscard skip, int flags); @@ -522,7 +530,7 @@ * * Trace context should be set to the CodedBitstreamContext. */ -void ff_cbs_trace_read_log(void *trace_context, +void CBS_FUNC(trace_read_log)(void *trace_context, struct GetBitContext *gbc, int length, const char *str, const int *subscripts, int64_t value); @@ -533,7 +541,7 @@ * * Trace context should be set to the CodedBitstreamContext. */ -void ff_cbs_trace_write_log(void *trace_context, +void CBS_FUNC(trace_write_log)(void *trace_context, struct PutBitContext *pbc, int length, const char *str, const int *subscripts, int64_t value); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.c 2026-04-29 18:38:26.000000000 +0000 @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/opt.h" #include "libavutil/pixfmt.h" @@ -27,6 +28,7 @@ #include "libavutil/refstruct.h" +#if CBS_READ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, uint32_t *write_to, uint32_t range_min, uint32_t range_max) @@ -84,7 +86,9 @@ *write_to = value; return 0; } +#endif +#if CBS_WRITE static int cbs_av1_write_uvlc(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, uint32_t value, uint32_t range_min, uint32_t range_max) @@ -115,7 +119,9 @@ return 0; } +#endif +#if CBS_READ static int cbs_av1_read_leb128(CodedBitstreamContext *ctx, GetBitContext *gbc, const char *name, uint64_t *write_to) { @@ -146,7 +152,9 @@ *write_to = value; return 0; } +#endif +#if CBS_WRITE static int cbs_av1_write_leb128(CodedBitstreamContext *ctx, PutBitContext *pbc, const char *name, uint64_t value, int fixed_length) { @@ -182,7 +190,9 @@ return 0; } +#endif +#if CBS_READ static int cbs_av1_read_ns(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t n, const char *name, const int *subscripts, uint32_t *write_to) @@ -220,7 +230,9 @@ *write_to = value; return 0; } +#endif +#if CBS_WRITE static int cbs_av1_write_ns(CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t n, const char *name, const int *subscripts, uint32_t value) @@ -256,7 +268,9 @@ return 0; } +#endif +#if CBS_READ static int cbs_av1_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t *write_to) @@ -284,7 +298,9 @@ *write_to = value; return 0; } +#endif +#if CBS_WRITE static int cbs_av1_write_increment(CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t range_min, uint32_t range_max, const char *name, uint32_t value) @@ -315,7 +331,9 @@ return 0; } +#endif +#if CBS_READ static int cbs_av1_read_subexp(CodedBitstreamContext *ctx, GetBitContext *gbc, uint32_t range_max, const char *name, const int *subscripts, uint32_t *write_to) @@ -342,7 +360,7 @@ } if (len < max_len) { - err = ff_cbs_read_simple_unsigned(ctx, gbc, range_bits, + err = CBS_FUNC(read_simple_unsigned)(ctx, gbc, range_bits, "subexp_bits", &value); if (err < 0) return err; @@ -360,7 +378,9 @@ *write_to = value; return err; } +#endif +#if CBS_WRITE static int cbs_av1_write_subexp(CodedBitstreamContext *ctx, PutBitContext *pbc, uint32_t range_max, const char *name, const int *subscripts, uint32_t value) @@ -402,7 +422,7 @@ return err; if (len < max_len) { - err = ff_cbs_write_simple_unsigned(ctx, pbc, range_bits, + err = CBS_FUNC(write_simple_unsigned)(ctx, pbc, range_bits, "subexp_bits", value - range_offset); if (err < 0) @@ -420,6 +440,7 @@ return err; } +#endif static int cbs_av1_tile_log2(int blksize, int target) @@ -441,7 +462,7 @@ return diff; } -static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) +av_unused static size_t cbs_av1_get_payload_bytes_left(GetBitContext *gbc) { GetBitContext tmp = *gbc; size_t size = 0; @@ -454,7 +475,7 @@ #define HEADER(name) do { \ - ff_cbs_trace_header(ctx, name); \ + CBS_FUNC(trace_header)(ctx, name); \ } while (0) #define CHECK(call) do { \ @@ -469,6 +490,7 @@ #define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) +#if CBS_READ #define fc(width, name, range_min, range_max) \ xf(width, name, current->name, range_min, range_max, 0, ) #define flag(name) fb(1, name) @@ -496,14 +518,14 @@ #define fb(width, name) do { \ uint32_t value; \ - CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, \ + CHECK(CBS_FUNC(read_simple_unsigned)(ctx, rw, width, \ #name, &value)); \ current->name = value; \ } while (0) #define xf(width, name, var, range_min, range_max, subs, ...) do { \ uint32_t value; \ - CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ + CHECK(CBS_FUNC(read_unsigned)(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ &value, range_min, range_max)); \ var = value; \ @@ -511,7 +533,7 @@ #define xsu(width, name, var, subs, ...) do { \ int32_t value; \ - CHECK(ff_cbs_read_signed(ctx, rw, width, #name, \ + CHECK(CBS_FUNC(read_signed)(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), &value, \ MIN_INT_BITS(width), \ MAX_INT_BITS(width))); \ @@ -584,25 +606,27 @@ #undef leb128 #undef infer #undef byte_alignment +#endif // CBS_READ +#if CBS_WRITE #define WRITE #define READWRITE write #define RWContext PutBitContext #define fb(width, name) do { \ - CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ + CHECK(CBS_FUNC(write_simple_unsigned)(ctx, rw, width, #name, \ current->name)); \ } while (0) #define xf(width, name, var, range_min, range_max, subs, ...) do { \ - CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + CHECK(CBS_FUNC(write_unsigned)(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), \ var, range_min, range_max)); \ } while (0) #define xsu(width, name, var, subs, ...) do { \ - CHECK(ff_cbs_write_signed(ctx, rw, width, #name, \ + CHECK(CBS_FUNC(write_signed)(ctx, rw, width, #name, \ SUBSCRIPTS(subs, __VA_ARGS__), var, \ MIN_INT_BITS(width), \ MAX_INT_BITS(width))); \ @@ -668,12 +692,13 @@ #undef leb128 #undef infer #undef byte_alignment - +#endif // CBS_WRITE static int cbs_av1_split_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag, int header) { +#if CBS_READ GetBitContext gbc; uint8_t *data; size_t size; @@ -689,7 +714,7 @@ if (INT_MAX / 8 < size) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid fragment: " - "too large (%"SIZE_SPECIFIER" bytes).\n", size); + "too large (%zu bytes).\n", size); err = AVERROR_INVALIDDATA; goto fail; } @@ -740,7 +765,7 @@ if (obu_header.obu_has_size_field) { if (get_bits_left(&gbc) < 8) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU: fragment " - "too short (%"SIZE_SPECIFIER" bytes).\n", size); + "too short (%zu bytes).\n", size); err = AVERROR_INVALIDDATA; goto fail; } @@ -757,13 +782,13 @@ if (size < obu_length) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: " - "%"PRIu64", but only %"SIZE_SPECIFIER" bytes remaining in fragment.\n", + "%"PRIu64", but only %zu bytes remaining in fragment.\n", obu_length, size); err = AVERROR_INVALIDDATA; goto fail; } - err = ff_cbs_append_unit_data(frag, obu_header.obu_type, + err = CBS_FUNC(append_unit_data)(frag, obu_header.obu_type, data, obu_length, frag->data_ref); if (err < 0) goto fail; @@ -777,12 +802,17 @@ fail: ctx->trace_enable = trace; return err; +#else + return AVERROR(ENOSYS); +#endif } +#if CBS_READ static int cbs_av1_ref_tile_data(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, GetBitContext *gbc, - AV1RawTileData *td) + AVBufferRef **data_ref, + uint8_t **data, size_t *data_size) { int pos; @@ -795,25 +825,27 @@ // Must be byte-aligned at this point. av_assert0(pos % 8 == 0); - td->data_ref = av_buffer_ref(unit->data_ref); - if (!td->data_ref) + *data_ref = av_buffer_ref(unit->data_ref); + if (!*data_ref) return AVERROR(ENOMEM); - td->data = unit->data + pos / 8; - td->data_size = unit->data_size - pos / 8; + *data = unit->data + pos / 8; + *data_size = unit->data_size - pos / 8; return 0; } +#endif static int cbs_av1_read_unit(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit) { +#if CBS_READ CodedBitstreamAV1Context *priv = ctx->priv_data; AV1RawOBU *obu; GetBitContext gbc; int err, start_pos, end_pos; - err = ff_cbs_alloc_unit_content(ctx, unit); + err = CBS_FUNC(alloc_unit_content)(ctx, unit); if (err < 0) return err; obu = unit->content; @@ -836,7 +868,7 @@ } else { if (unit->data_size < 1 + obu->header.obu_extension_flag) { av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid OBU length: " - "unit too short (%"SIZE_SPECIFIER").\n", unit->data_size); + "unit too short (%zu).\n", unit->data_size); return AVERROR_INVALIDDATA; } obu->obu_size = unit->data_size - 1 - obu->header.obu_extension_flag; @@ -901,32 +933,36 @@ return err; } break; - case AV1_OBU_TILE_GROUP: - { - err = cbs_av1_read_tile_group_obu(ctx, &gbc, - &obu->obu.tile_group); + case AV1_OBU_FRAME: + err = cbs_av1_read_frame_obu(ctx, &gbc, &obu->obu.frame, + unit->data_ref); if (err < 0) return err; - + // fall-through + case AV1_OBU_TILE_GROUP: + { + AV1RawTileGroup *tile_group = obu->header.obu_type == AV1_OBU_FRAME ? &obu->obu.frame.tile_group + : &obu->obu.tile_group; err = cbs_av1_ref_tile_data(ctx, unit, &gbc, - &obu->obu.tile_group.tile_data); + &tile_group->data_ref, + &tile_group->data, + &tile_group->data_size); if (err < 0) return err; - } - break; - case AV1_OBU_FRAME: - { - err = cbs_av1_read_frame_obu(ctx, &gbc, &obu->obu.frame, - unit->data_ref); + + err = cbs_av1_read_tile_group_obu(ctx, &gbc, tile_group); if (err < 0) return err; err = cbs_av1_ref_tile_data(ctx, unit, &gbc, - &obu->obu.frame.tile_group.tile_data); + &tile_group->tile_data.data_ref, + &tile_group->tile_data.data, + &tile_group->tile_data.data_size); if (err < 0) return err; } break; +#if CBS_AV1_OBU_TILE_LIST case AV1_OBU_TILE_LIST: { err = cbs_av1_read_tile_list_obu(ctx, &gbc, @@ -935,11 +971,15 @@ return err; err = cbs_av1_ref_tile_data(ctx, unit, &gbc, - &obu->obu.tile_list.tile_data); + &obu->obu.tile_list.tile_data.data_ref, + &obu->obu.tile_list.tile_data.data, + &obu->obu.tile_list.tile_data.data_size); if (err < 0) return err; } break; +#endif +#if CBS_AV1_OBU_METADATA case AV1_OBU_METADATA: { err = cbs_av1_read_metadata_obu(ctx, &gbc, &obu->obu.metadata); @@ -947,6 +987,8 @@ return err; } break; +#endif +#if CBS_AV1_OBU_PADDING case AV1_OBU_PADDING: { err = cbs_av1_read_padding_obu(ctx, &gbc, &obu->obu.padding); @@ -954,6 +996,7 @@ return err; } break; +#endif default: return AVERROR(ENOSYS); } @@ -976,12 +1019,16 @@ } return 0; +#else + return AVERROR(ENOSYS); +#endif } static int cbs_av1_write_obu(CodedBitstreamContext *ctx, CodedBitstreamUnit *unit, PutBitContext *pbc) { +#if CBS_WRITE CodedBitstreamAV1Context *priv = ctx->priv_data; AV1RawOBU *obu = unit->content; PutBitContext pbc_tmp; @@ -1038,7 +1085,7 @@ av_refstruct_unref(&priv->sequence_header_ref); priv->sequence_header = NULL; - err = ff_cbs_make_unit_refcounted(ctx, unit); + err = CBS_FUNC(make_unit_refcounted)(ctx, unit); if (err < 0) goto error; @@ -1065,25 +1112,23 @@ goto error; } break; - case AV1_OBU_TILE_GROUP: - { - err = cbs_av1_write_tile_group_obu(ctx, pbc, - &obu->obu.tile_group); + case AV1_OBU_FRAME: + err = cbs_av1_write_frame_obu(ctx, pbc, &obu->obu.frame, NULL); if (err < 0) goto error; - - td = &obu->obu.tile_group.tile_data; - } - break; - case AV1_OBU_FRAME: + // fall-through + case AV1_OBU_TILE_GROUP: { - err = cbs_av1_write_frame_obu(ctx, pbc, &obu->obu.frame, NULL); + AV1RawTileGroup *tile_group = obu->header.obu_type == AV1_OBU_FRAME ? &obu->obu.frame.tile_group + : &obu->obu.tile_group; + err = cbs_av1_write_tile_group_obu(ctx, pbc, tile_group); if (err < 0) goto error; - td = &obu->obu.frame.tile_group.tile_data; + td = &tile_group->tile_data; } break; +#if CBS_AV1_OBU_TILE_LIST case AV1_OBU_TILE_LIST: { err = cbs_av1_write_tile_list_obu(ctx, pbc, &obu->obu.tile_list); @@ -1093,6 +1138,8 @@ td = &obu->obu.tile_list.tile_data; } break; +#endif +#if CBS_AV1_OBU_METADATA case AV1_OBU_METADATA: { err = cbs_av1_write_metadata_obu(ctx, pbc, &obu->obu.metadata); @@ -1100,6 +1147,8 @@ goto error; } break; +#endif +#if CBS_AV1_OBU_PADDING case AV1_OBU_PADDING: { err = cbs_av1_write_padding_obu(ctx, pbc, &obu->obu.padding); @@ -1107,6 +1156,7 @@ goto error; } break; +#endif default: err = AVERROR(ENOSYS); goto error; @@ -1179,11 +1229,15 @@ av_buffer_unref(&av1ctx.frame_header_ref); return err; +#else + return AVERROR(ENOSYS); +#endif } static int cbs_av1_assemble_fragment(CodedBitstreamContext *ctx, CodedBitstreamFragment *frag) { +#if CBS_WRITE size_t size, pos; int i; @@ -1207,9 +1261,12 @@ frag->data_size = size; return 0; +#else + return AVERROR(ENOSYS); +#endif } -static void cbs_av1_flush(CodedBitstreamContext *ctx) +static av_cold void cbs_av1_flush(CodedBitstreamContext *ctx) { CodedBitstreamAV1Context *priv = ctx->priv_data; @@ -1223,7 +1280,7 @@ priv->tile_num = 0; } -static void cbs_av1_close(CodedBitstreamContext *ctx) +static av_cold void cbs_av1_close(CodedBitstreamContext *ctx) { CodedBitstreamAV1Context *priv = ctx->priv_data; @@ -1231,6 +1288,7 @@ av_buffer_unref(&priv->frame_header_ref); } +#if CBS_AV1_OBU_METADATA static void cbs_av1_free_metadata(AVRefStructOpaque unused, void *content) { AV1RawOBU *obu = content; @@ -1252,24 +1310,49 @@ av_buffer_unref(&md->metadata.unknown.payload_ref); } } +#endif -static const CodedBitstreamUnitTypeDescriptor cbs_av1_unit_types[] = { +static CodedBitstreamUnitTypeDescriptor cbs_av1_unit_types[] = { CBS_UNIT_TYPE_POD(AV1_OBU_SEQUENCE_HEADER, AV1RawOBU), CBS_UNIT_TYPE_POD(AV1_OBU_TEMPORAL_DELIMITER, AV1RawOBU), CBS_UNIT_TYPE_POD(AV1_OBU_FRAME_HEADER, AV1RawOBU), CBS_UNIT_TYPE_POD(AV1_OBU_REDUNDANT_FRAME_HEADER, AV1RawOBU), - - CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_TILE_GROUP, AV1RawOBU, - obu.tile_group.tile_data.data), - CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_FRAME, AV1RawOBU, - obu.frame.tile_group.tile_data.data), + { + .nb_unit_types = 1, + .unit_type.list[0] = AV1_OBU_TILE_GROUP, + .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, + .content_size = sizeof(AV1RawOBU), + .type.ref = { + .nb_offsets = 2, + .offsets = { offsetof(AV1RawOBU, obu.tile_group.data), + offsetof(AV1RawOBU, obu.tile_group.tile_data.data) } + }, + }, + + { + .nb_unit_types = 1, + .unit_type.list[0] = AV1_OBU_FRAME, + .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, + .content_size = sizeof(AV1RawOBU), + .type.ref = { + .nb_offsets = 2, + .offsets = { offsetof(AV1RawOBU, obu.frame.tile_group.data), + offsetof(AV1RawOBU, obu.frame.tile_group.tile_data.data) } + }, + }, +#if CBS_AV1_OBU_TILE_LIST CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_TILE_LIST, AV1RawOBU, obu.tile_list.tile_data.data), +#endif +#if CBS_AV1_OBU_PADDING CBS_UNIT_TYPE_INTERNAL_REF(AV1_OBU_PADDING, AV1RawOBU, obu.padding.payload), +#endif +#if CBS_AV1_OBU_METADATA CBS_UNIT_TYPE_COMPLEX(AV1_OBU_METADATA, AV1RawOBU, &cbs_av1_free_metadata), +#endif CBS_UNIT_TYPE_END_OF_LIST }; @@ -1290,7 +1373,7 @@ .version = LIBAVUTIL_VERSION_INT, }; -const CodedBitstreamType ff_cbs_type_av1 = { +const CodedBitstreamType CBS_FUNC(type_av1) = { .codec_id = AV_CODEC_ID_AV1, .priv_class = &cbs_av1_class, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1.h 2026-04-29 18:38:26.000000000 +0000 @@ -25,6 +25,15 @@ #include "av1.h" #include "cbs.h" +#ifndef CBS_AV1_OBU_METADATA +#define CBS_AV1_OBU_METADATA 1 +#endif +#ifndef CBS_AV1_OBU_TILE_LIST +#define CBS_AV1_OBU_TILE_LIST 1 +#endif +#ifndef CBS_AV1_OBU_PADDING +#define CBS_AV1_OBU_PADDING 1 +#endif typedef struct AV1RawOBUHeader { uint8_t obu_forbidden_bit; @@ -295,6 +304,10 @@ } AV1RawTileData; typedef struct AV1RawTileGroup { + uint8_t *data; + AVBufferRef *data_ref; + size_t data_size; + uint8_t tile_start_and_end_present_flag; uint16_t tg_start; uint16_t tg_end; @@ -407,9 +420,15 @@ AV1RawFrameHeader frame_header; AV1RawFrame frame; AV1RawTileGroup tile_group; +#if CBS_AV1_OBU_TILE_LIST AV1RawTileList tile_list; +#endif +#if CBS_AV1_OBU_METADATA AV1RawMetadata metadata; +#endif +#if CBS_AV1_OBU_PADDING AV1RawPadding padding; +#endif } obu; } AV1RawOBU; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1_syntax_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1_syntax_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_av1_syntax_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_av1_syntax_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -595,7 +595,7 @@ int max_tile_width_sb, max_tile_height_sb, max_tile_area_sb; int min_log2_tile_cols, max_log2_tile_cols, max_log2_tile_rows; int min_log2_tiles, min_log2_tile_rows; - int i, err; + int err; mi_cols = 2 * ((priv->frame_width + 7) >> 3); mi_rows = 2 * ((priv->frame_height + 7) >> 3); @@ -627,8 +627,8 @@ tile_width_sb = (sb_cols + (1 << current->tile_cols_log2) - 1) >> current->tile_cols_log2; - for (int off = 0, i = 0; off < sb_cols; off += tile_width_sb) - current->tile_start_col_sb[i++] = off; + for (int off = 0, j = 0; off < sb_cols; off += tile_width_sb) + current->tile_start_col_sb[j++] = off; current->tile_cols = (sb_cols + tile_width_sb - 1) / tile_width_sb; @@ -639,11 +639,12 @@ tile_height_sb = (sb_rows + (1 << current->tile_rows_log2) - 1) >> current->tile_rows_log2; - for (int off = 0, i = 0; off < sb_rows; off += tile_height_sb) - current->tile_start_row_sb[i++] = off; + for (int off = 0, j = 0; off < sb_rows; off += tile_height_sb) + current->tile_start_row_sb[j++] = off; current->tile_rows = (sb_rows + tile_height_sb - 1) / tile_height_sb; + int i; for (i = 0; i < current->tile_cols - 1; i++) infer(width_in_sbs_minus_1[i], tile_width_sb - 1); infer(width_in_sbs_minus_1[i], @@ -654,7 +655,7 @@ sb_rows - (current->tile_rows - 1) * tile_height_sb - 1); } else { - int widest_tile_sb, start_sb, size_sb, max_width, max_height; + int widest_tile_sb, start_sb, size_sb, max_width, max_height, i; widest_tile_sb = 0; @@ -1758,7 +1759,15 @@ } } else { if (redundant) +#ifdef READ HEADER("Redundant Frame Header (used as Frame Header)"); +#else + { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid redundant " + "frame header OBU.\n"); + return AVERROR_INVALIDDATA; + } +#endif else HEADER("Frame Header"); @@ -1865,11 +1874,10 @@ CHECK(FUNC(byte_alignment)(ctx, rw)); - CHECK(FUNC(tile_group_obu)(ctx, rw, ¤t->tile_group)); - return 0; } +#if CBS_AV1_OBU_TILE_LIST static int FUNC(tile_list_obu)(CodedBitstreamContext *ctx, RWContext *rw, AV1RawTileList *current) { @@ -1884,7 +1892,9 @@ return 0; } +#endif +#if CBS_AV1_OBU_METADATA static int FUNC(metadata_hdr_cll)(CodedBitstreamContext *ctx, RWContext *rw, AV1RawMetadataHDRCLL *current) { @@ -2103,7 +2113,9 @@ return 0; } +#endif +#if CBS_AV1_OBU_PADDING static int FUNC(padding_obu)(CodedBitstreamContext *ctx, RWContext *rw, AV1RawPadding *current) { @@ -2127,3 +2139,4 @@ return 0; } +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -22,6 +22,8 @@ #include #include +#include "config.h" + #include "libavutil/log.h" #include "cbs.h" @@ -30,6 +32,46 @@ #include "put_bits.h" #include "libavutil/refstruct.h" +#ifndef CBS_READ +#define CBS_READ 1 +#endif +#ifndef CBS_WRITE +#define CBS_WRITE 1 +#endif +#ifndef CBS_TRACE +#define CBS_TRACE 1 +#endif + +#ifndef CBS_APV +#define CBS_APV CONFIG_CBS_APV +#endif +#ifndef CBS_AV1 +#define CBS_AV1 CONFIG_CBS_AV1 +#endif +#ifndef CBS_H264 +#define CBS_H264 CONFIG_CBS_H264 +#endif +#ifndef CBS_H265 +#define CBS_H265 CONFIG_CBS_H265 +#endif +#ifndef CBS_H266 +#define CBS_H266 CONFIG_CBS_H266 +#endif +#ifndef CBS_LCEVC +#define CBS_LCEVC CONFIG_CBS_LCEVC +#endif +#ifndef CBS_JPEG +#define CBS_JPEG CONFIG_CBS_JPEG +#endif +#ifndef CBS_MPEG2 +#define CBS_MPEG2 CONFIG_CBS_MPEG2 +#endif +#ifndef CBS_VP8 +#define CBS_VP8 CONFIG_CBS_VP8 +#endif +#ifndef CBS_VP9 +#define CBS_VP9 CONFIG_CBS_VP9 +#endif enum CBSContentType { // Unit content may contain some references to other structures, but all @@ -112,7 +154,7 @@ // List of unit type descriptors for this codec. // Terminated by a descriptor with nb_unit_types equal to zero. - const CodedBitstreamUnitTypeDescriptor *unit_types; + CodedBitstreamUnitTypeDescriptor *unit_types; // Split frag->data into coded bitstream units, creating the // frag->units array. Fill data but not content on each unit. @@ -155,7 +197,7 @@ // Helper functions for trace output. -void ff_cbs_trace_header(CodedBitstreamContext *ctx, +void CBS_FUNC(trace_header)(CodedBitstreamContext *ctx, const char *name); @@ -165,28 +207,28 @@ // (i.e. only limited by the amount of bits used) and they lack // the ability to use subscripts. -int ff_cbs_read_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +int CBS_FUNC(read_unsigned)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, uint32_t *write_to, uint32_t range_min, uint32_t range_max); -int ff_cbs_read_simple_unsigned(CodedBitstreamContext *ctx, GetBitContext *gbc, +int CBS_FUNC(read_simple_unsigned)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, uint32_t *write_to); -int ff_cbs_write_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, +int CBS_FUNC(write_unsigned)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, uint32_t value, uint32_t range_min, uint32_t range_max); -int ff_cbs_write_simple_unsigned(CodedBitstreamContext *ctx, PutBitContext *pbc, +int CBS_FUNC(write_simple_unsigned)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, uint32_t value); -int ff_cbs_read_signed(CodedBitstreamContext *ctx, GetBitContext *gbc, +int CBS_FUNC(read_signed)(CodedBitstreamContext *ctx, GetBitContext *gbc, int width, const char *name, const int *subscripts, int32_t *write_to, int32_t range_min, int32_t range_max); -int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, +int CBS_FUNC(write_signed)(CodedBitstreamContext *ctx, PutBitContext *pbc, int width, const char *name, const int *subscripts, int32_t value, int32_t range_min, int32_t range_max); @@ -204,6 +246,7 @@ #define MIN_INT_BITS(length) (-(INT64_C(1) << ((length) - 1))) +#if CBS_TRACE // Start of a syntax element during read tracing. #define CBS_TRACE_READ_START() \ GetBitContext trace_start; \ @@ -233,7 +276,7 @@ } while (0) // End of a syntax element which is made up of subelements which -// are aleady traced, so we are only showing the value. +// are already traced, so we are only showing the value. #define CBS_TRACE_READ_END_VALUE_ONLY() \ do { \ if (ctx->trace_enable) { \ @@ -270,7 +313,7 @@ } while (0) // End of a syntax element which is made up of subelements which are -// aleady traced, so we are only showing the value. This forges a +// already traced, so we are only showing the value. This forges a // PutBitContext to point to the position of the start of the syntax // element, but the other state doesn't matter because length is zero. #define CBS_TRACE_WRITE_END_VALUE_ONLY() \ @@ -284,6 +327,17 @@ } \ } while (0) +#else // CBS_TRACE +#define CBS_TRACE_READ_START() do { } while (0) +#define CBS_TRACE_READ_END() do { } while (0) +#define CBS_TRACE_READ_END_NO_SUBSCRIPTS() do { } while (0) +#define CBS_TRACE_READ_END_VALUE_ONLY() do { } while (0) +#define CBS_TRACE_WRITE_START() do { } while (0) +#define CBS_TRACE_WRITE_END() do { } while (0) +#define CBS_TRACE_WRITE_END_NO_SUBSCRIPTS() do { } while (0) +#define CBS_TRACE_WRITE_END_VALUE_ONLY() do { } while (0) +#endif // CBS_TRACE + #define TYPE_LIST(...) { __VA_ARGS__ } #define CBS_UNIT_TYPE_POD(type_, structure) { \ .nb_unit_types = 1, \ @@ -335,14 +389,16 @@ #define CBS_UNIT_TYPE_END_OF_LIST { .nb_unit_types = 0 } -extern const CodedBitstreamType ff_cbs_type_av1; -extern const CodedBitstreamType ff_cbs_type_h264; -extern const CodedBitstreamType ff_cbs_type_h265; -extern const CodedBitstreamType ff_cbs_type_h266; -extern const CodedBitstreamType ff_cbs_type_jpeg; -extern const CodedBitstreamType ff_cbs_type_mpeg2; -extern const CodedBitstreamType ff_cbs_type_vp8; -extern const CodedBitstreamType ff_cbs_type_vp9; +extern const CodedBitstreamType CBS_FUNC(type_apv); +extern const CodedBitstreamType CBS_FUNC(type_av1); +extern const CodedBitstreamType CBS_FUNC(type_h264); +extern const CodedBitstreamType CBS_FUNC(type_h265); +extern const CodedBitstreamType CBS_FUNC(type_h266); +extern const CodedBitstreamType CBS_FUNC(type_lcevc); +extern const CodedBitstreamType CBS_FUNC(type_jpeg); +extern const CodedBitstreamType CBS_FUNC(type_mpeg2); +extern const CodedBitstreamType CBS_FUNC(type_vp8); +extern const CodedBitstreamType CBS_FUNC(type_vp9); #endif /* AVCODEC_CBS_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,616 @@ +/* + * 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 "libavutil/avassert.h" + +#include "cbs.h" +#include "cbs_internal.h" +#include "cbs_vp9.h" + + +static int cbs_vp9_read_s(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, int32_t *write_to) +{ + uint32_t magnitude; + int sign; + int32_t value; + + CBS_TRACE_READ_START(); + + if (get_bits_left(gbc) < width + 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid signed value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } + + magnitude = get_bits(gbc, width); + sign = get_bits1(gbc); + value = sign ? -(int32_t)magnitude : magnitude; + + CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +} + +static int cbs_vp9_write_s(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, int32_t value) +{ + uint32_t magnitude; + int sign; + + CBS_TRACE_WRITE_START(); + + if (put_bits_left(pbc) < width + 1) + return AVERROR(ENOSPC); + + sign = value < 0; + magnitude = sign ? -value : value; + + put_bits(pbc, width, magnitude); + put_bits(pbc, 1, sign); + + CBS_TRACE_WRITE_END(); + + return 0; +} + +static int cbs_vp9_read_increment(CodedBitstreamContext *ctx, GetBitContext *gbc, + uint32_t range_min, uint32_t range_max, + const char *name, uint32_t *write_to) +{ + uint32_t value; + + CBS_TRACE_READ_START(); + + av_assert0(range_min <= range_max && range_max - range_min < 32); + + for (value = range_min; value < range_max;) { + if (get_bits_left(gbc) < 1) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid increment value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } + if (get_bits1(gbc)) + ++value; + else + break; + } + + CBS_TRACE_READ_END_NO_SUBSCRIPTS(); + + *write_to = value; + return 0; +} + +static int cbs_vp9_write_increment(CodedBitstreamContext *ctx, PutBitContext *pbc, + uint32_t range_min, uint32_t range_max, + const char *name, uint32_t value) +{ + int len; + + CBS_TRACE_WRITE_START(); + + av_assert0(range_min <= range_max && range_max - range_min < 8); + if (value < range_min || value > range_max) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "%s out of range: " + "%"PRIu32", but must be in [%"PRIu32",%"PRIu32"].\n", + name, value, range_min, range_max); + return AVERROR_INVALIDDATA; + } + + if (value == range_max) + len = range_max - range_min; + else + len = value - range_min + 1; + if (put_bits_left(pbc) < len) + return AVERROR(ENOSPC); + + if (len > 0) + put_bits(pbc, len, (1 << len) - 1 - (value != range_max)); + + CBS_TRACE_WRITE_END_NO_SUBSCRIPTS(); + + return 0; +} + +static int cbs_vp9_read_le(CodedBitstreamContext *ctx, GetBitContext *gbc, + int width, const char *name, + const int *subscripts, uint32_t *write_to) +{ + uint32_t value; + int b; + + CBS_TRACE_READ_START(); + + av_assert0(width % 8 == 0); + + if (get_bits_left(gbc) < width) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid le value at " + "%s: bitstream ended.\n", name); + return AVERROR_INVALIDDATA; + } + + value = 0; + for (b = 0; b < width; b += 8) + value |= get_bits(gbc, 8) << b; + + CBS_TRACE_READ_END(); + + *write_to = value; + return 0; +} + +static int cbs_vp9_write_le(CodedBitstreamContext *ctx, PutBitContext *pbc, + int width, const char *name, + const int *subscripts, uint32_t value) +{ + int b; + + CBS_TRACE_WRITE_START(); + + av_assert0(width % 8 == 0); + + if (put_bits_left(pbc) < width) + return AVERROR(ENOSPC); + + for (b = 0; b < width; b += 8) + put_bits(pbc, 8, value >> b & 0xff); + + CBS_TRACE_WRITE_END(); + + return 0; +} + +#define HEADER(name) do { \ + ff_cbs_trace_header(ctx, name); \ + } while (0) + +#define CHECK(call) do { \ + err = (call); \ + if (err < 0) \ + return err; \ + } while (0) + +#define FUNC_NAME(rw, codec, name) cbs_ ## codec ## _ ## rw ## _ ## name +#define FUNC_VP9(rw, name) FUNC_NAME(rw, vp9, name) +#define FUNC(name) FUNC_VP9(READWRITE, name) + +#define SUBSCRIPTS(subs, ...) (subs > 0 ? ((int[subs + 1]){ subs, __VA_ARGS__ }) : NULL) + +#define s(width, name) \ + xs(width, name, current->name, 0, ) +#define fs(width, name, subs, ...) \ + xf(width, name, current->name, subs, __VA_ARGS__) +#define ss(width, name, subs, ...) \ + xs(width, name, current->name, subs, __VA_ARGS__) + +#define READ +#define READWRITE read +#define RWContext GetBitContext + +#define f(width, name) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_simple_unsigned(ctx, rw, width, #name, \ + &value)); \ + current->name = value; \ + } while (0) +#define xf(width, name, var, subs, ...) do { \ + uint32_t value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ + &value, 0, (1 << width) - 1)); \ + var = value; \ + } while (0) +#define xs(width, name, var, subs, ...) do { \ + int32_t value; \ + CHECK(cbs_vp9_read_s(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), &value)); \ + var = value; \ + } while (0) + + +#define increment(name, min, max) do { \ + uint32_t value; \ + CHECK(cbs_vp9_read_increment(ctx, rw, min, max, #name, &value)); \ + current->name = value; \ + } while (0) + +#define fle(width, name, subs, ...) do { \ + CHECK(cbs_vp9_read_le(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), ¤t->name)); \ + } while (0) + +#define delta_q(name) do { \ + uint8_t delta_coded; \ + int8_t delta_q; \ + xf(1, name.delta_coded, delta_coded, 0, ); \ + if (delta_coded) \ + xs(4, name.delta_q, delta_q, 0, ); \ + else \ + delta_q = 0; \ + current->name = delta_q; \ + } while (0) + +#define prob(name, subs, ...) do { \ + uint8_t prob_coded; \ + uint8_t prob; \ + xf(1, name.prob_coded, prob_coded, subs, __VA_ARGS__); \ + if (prob_coded) \ + xf(8, name.prob, prob, subs, __VA_ARGS__); \ + else \ + prob = 255; \ + current->name = prob; \ + } while (0) + +#define fixed(width, name, value) do { \ + av_unused uint32_t fixed_value; \ + CHECK(ff_cbs_read_unsigned(ctx, rw, width, #name, \ + 0, &fixed_value, value, value)); \ + } while (0) + +#define infer(name, value) do { \ + current->name = value; \ + } while (0) + +#define byte_alignment(rw) (get_bits_count(rw) % 8) + +#include "cbs_vp9_syntax_template.c" + +#undef READ +#undef READWRITE +#undef RWContext +#undef f +#undef xf +#undef xs +#undef increment +#undef fle +#undef delta_q +#undef prob +#undef fixed +#undef infer +#undef byte_alignment + + +#define WRITE +#define READWRITE write +#define RWContext PutBitContext + +#define f(width, name) do { \ + CHECK(ff_cbs_write_simple_unsigned(ctx, rw, width, #name, \ + current->name)); \ + } while (0) +#define xf(width, name, var, subs, ...) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), \ + var, 0, (1 << width) - 1)); \ + } while (0) +#define xs(width, name, var, subs, ...) do { \ + CHECK(cbs_vp9_write_s(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), var)); \ + } while (0) + +#define increment(name, min, max) do { \ + CHECK(cbs_vp9_write_increment(ctx, rw, min, max, #name, current->name)); \ + } while (0) + +#define fle(width, name, subs, ...) do { \ + CHECK(cbs_vp9_write_le(ctx, rw, width, #name, \ + SUBSCRIPTS(subs, __VA_ARGS__), current->name)); \ + } while (0) + +#define delta_q(name) do { \ + xf(1, name.delta_coded, !!current->name, 0, ); \ + if (current->name) \ + xs(4, name.delta_q, current->name, 0, ); \ + } while (0) + +#define prob(name, subs, ...) do { \ + xf(1, name.prob_coded, current->name != 255, subs, __VA_ARGS__); \ + if (current->name != 255) \ + xf(8, name.prob, current->name, subs, __VA_ARGS__); \ + } while (0) + +#define fixed(width, name, value) do { \ + CHECK(ff_cbs_write_unsigned(ctx, rw, width, #name, \ + 0, value, value, value)); \ + } while (0) + +#define infer(name, value) do { \ + if (current->name != (value)) { \ + av_log(ctx->log_ctx, AV_LOG_WARNING, "Warning: " \ + "%s does not match inferred value: " \ + "%"PRId64", but should be %"PRId64".\n", \ + #name, (int64_t)current->name, (int64_t)(value)); \ + } \ + } while (0) + +#define byte_alignment(rw) (put_bits_count(rw) % 8) + +#include "cbs_vp9_syntax_template.c" + +#undef WRITE +#undef READWRITE +#undef RWContext +#undef f +#undef xf +#undef xs +#undef increment +#undef fle +#undef delta_q +#undef prob +#undef fixed +#undef infer +#undef byte_alignment + + +static int cbs_vp9_split_fragment(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag, + int header) +{ + uint8_t superframe_header; + int err; + + if (frag->data_size == 0) + return AVERROR_INVALIDDATA; + + // Last byte in the packet. + superframe_header = frag->data[frag->data_size - 1]; + + if ((superframe_header & 0xe0) == 0xc0) { + VP9RawSuperframeIndex sfi = {0}; + GetBitContext gbc; + size_t index_size, pos; + int i; + + index_size = 2 + (((superframe_header & 0x18) >> 3) + 1) * + ((superframe_header & 0x07) + 1); + + if (index_size > frag->data_size) + return AVERROR_INVALIDDATA; + + err = init_get_bits(&gbc, frag->data + frag->data_size - index_size, + 8 * index_size); + if (err < 0) + return err; + + err = cbs_vp9_read_superframe_index(ctx, &gbc, &sfi); + if (err < 0) + return err; + + pos = 0; + for (i = 0; i <= sfi.frames_in_superframe_minus_1; i++) { + if (pos + sfi.frame_sizes[i] + index_size > frag->data_size) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Frame %d too large " + "in superframe: %"PRIu32" bytes.\n", + i, sfi.frame_sizes[i]); + return AVERROR_INVALIDDATA; + } + + err = ff_cbs_append_unit_data(frag, 0, + frag->data + pos, + sfi.frame_sizes[i], + frag->data_ref); + if (err < 0) + return err; + + pos += sfi.frame_sizes[i]; + } + if (pos + index_size != frag->data_size) { + av_log(ctx->log_ctx, AV_LOG_WARNING, "Extra padding at " + "end of superframe: %zu bytes.\n", + frag->data_size - (pos + index_size)); + } + + return 0; + + } else { + err = ff_cbs_append_unit_data(frag, 0, + frag->data, frag->data_size, + frag->data_ref); + if (err < 0) + return err; + } + + return 0; +} + +static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit) +{ + VP9RawFrame *frame; + GetBitContext gbc; + int err, pos; + + err = init_get_bits(&gbc, unit->data, 8 * unit->data_size); + if (err < 0) + return err; + + err = ff_cbs_alloc_unit_content(ctx, unit); + if (err < 0) + return err; + frame = unit->content; + + err = cbs_vp9_read_frame(ctx, &gbc, frame); + if (err < 0) + return err; + + pos = get_bits_count(&gbc); + av_assert0(pos % 8 == 0); + pos /= 8; + av_assert0(pos <= unit->data_size); + + if (pos == unit->data_size) { + // No data (e.g. a show-existing-frame frame). + } else { + frame->data_ref = av_buffer_ref(unit->data_ref); + if (!frame->data_ref) + return AVERROR(ENOMEM); + + frame->data = unit->data + pos; + frame->data_size = unit->data_size - pos; + } + + return 0; +} + +static int cbs_vp9_write_unit(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit, + PutBitContext *pbc) +{ + VP9RawFrame *frame = unit->content; + int err; + + err = cbs_vp9_write_frame(ctx, pbc, frame); + if (err < 0) + return err; + + // Frame must be byte-aligned. + av_assert0(put_bits_count(pbc) % 8 == 0); + + if (frame->data) { + if (frame->data_size > put_bits_left(pbc) / 8) + return AVERROR(ENOSPC); + + flush_put_bits(pbc); + memcpy(put_bits_ptr(pbc), frame->data, frame->data_size); + skip_put_bytes(pbc, frame->data_size); + } + + return 0; +} + +static int cbs_vp9_assemble_fragment(CodedBitstreamContext *ctx, + CodedBitstreamFragment *frag) +{ + int err; + + if (frag->nb_units == 1) { + // Output is just the content of the single frame. + + CodedBitstreamUnit *frame = &frag->units[0]; + + frag->data_ref = av_buffer_ref(frame->data_ref); + if (!frag->data_ref) + return AVERROR(ENOMEM); + + frag->data = frame->data; + frag->data_size = frame->data_size; + + } else { + // Build superframe out of frames. + + VP9RawSuperframeIndex sfi; + PutBitContext pbc; + AVBufferRef *ref; + uint8_t *data; + size_t size, max, pos; + int i, size_len; + + if (frag->nb_units > 8) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Too many frames to " + "make superframe: %d.\n", frag->nb_units); + return AVERROR(EINVAL); + } + + max = 0; + for (i = 0; i < frag->nb_units; i++) + if (max < frag->units[i].data_size) + max = frag->units[i].data_size; + + if (max < 2) + size_len = 1; + else + size_len = av_log2(max) / 8 + 1; + av_assert0(size_len <= 4); + + sfi.superframe_marker = VP9_SUPERFRAME_MARKER; + sfi.bytes_per_framesize_minus_1 = size_len - 1; + sfi.frames_in_superframe_minus_1 = frag->nb_units - 1; + + size = 2; + for (i = 0; i < frag->nb_units; i++) { + size += size_len + frag->units[i].data_size; + sfi.frame_sizes[i] = frag->units[i].data_size; + } + + ref = av_buffer_alloc(size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!ref) + return AVERROR(ENOMEM); + data = ref->data; + memset(data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE); + + pos = 0; + for (i = 0; i < frag->nb_units; i++) { + av_assert0(size - pos > frag->units[i].data_size); + memcpy(data + pos, frag->units[i].data, + frag->units[i].data_size); + pos += frag->units[i].data_size; + } + av_assert0(size - pos == 2 + frag->nb_units * size_len); + + init_put_bits(&pbc, data + pos, size - pos); + + err = cbs_vp9_write_superframe_index(ctx, &pbc, &sfi); + if (err < 0) { + av_log(ctx->log_ctx, AV_LOG_ERROR, "Failed to write " + "superframe index.\n"); + av_buffer_unref(&ref); + return err; + } + + av_assert0(put_bits_left(&pbc) == 0); + flush_put_bits(&pbc); + + frag->data_ref = ref; + frag->data = data; + frag->data_size = size; + } + + return 0; +} + +static av_cold void cbs_vp9_flush(CodedBitstreamContext *ctx) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + + memset(vp9->ref, 0, sizeof(vp9->ref)); +} + +static CodedBitstreamUnitTypeDescriptor cbs_vp9_unit_types[] = { + CBS_UNIT_TYPE_INTERNAL_REF(0, VP9RawFrame, data), + CBS_UNIT_TYPE_END_OF_LIST +}; + +const CodedBitstreamType ff_cbs_type_vp9 = { + .codec_id = AV_CODEC_ID_VP9, + + .priv_data_size = sizeof(CodedBitstreamVP9Context), + + .unit_types = cbs_vp9_unit_types, + + .split_fragment = &cbs_vp9_split_fragment, + .read_unit = &cbs_vp9_read_unit, + .write_unit = &cbs_vp9_write_unit, + + .flush = &cbs_vp9_flush, + + .assemble_fragment = &cbs_vp9_assemble_fragment, +}; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,221 @@ +/* + * 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 + */ + +#ifndef AVCODEC_CBS_VP9_H +#define AVCODEC_CBS_VP9_H + +#include +#include + +#include "cbs.h" + + +// Miscellaneous constants (section 3). +enum { + VP9_REFS_PER_FRAME = 3, + + VP9_MIN_TILE_WIDTH_B64 = 4, + VP9_MAX_TILE_WIDTH_B64 = 64, + + VP9_NUM_REF_FRAMES = 8, + VP9_MAX_REF_FRAMES = 4, + + VP9_MAX_SEGMENTS = 8, + VP9_SEG_LVL_MAX = 4, +}; + +// Frame types (section 7.2). +enum { + VP9_KEY_FRAME = 0, + VP9_NON_KEY_FRAME = 1, +}; + +// Frame sync bytes (section 7.2.1). +enum { + VP9_FRAME_SYNC_0 = 0x49, + VP9_FRAME_SYNC_1 = 0x83, + VP9_FRAME_SYNC_2 = 0x42, +}; + +// Color space values (section 7.2.2). +enum { + VP9_CS_UNKNOWN = 0, + VP9_CS_BT_601 = 1, + VP9_CS_BT_709 = 2, + VP9_CS_SMPTE_170 = 3, + VP9_CS_SMPTE_240 = 4, + VP9_CS_BT_2020 = 5, + VP9_CS_RESERVED = 6, + VP9_CS_RGB = 7, +}; + +// Reference frame types (section 7.4.12). +enum { + VP9_INTRA_FRAME = 0, + VP9_LAST_FRAME = 1, + VP9_GOLDEN_FRAME = 2, + VP9_ALTREF_FRAME = 3, +}; + +// Superframe properties (section B.3). +enum { + VP9_MAX_FRAMES_IN_SUPERFRAME = 8, + + VP9_SUPERFRAME_MARKER = 6, +}; + + +typedef struct VP9RawFrameHeader { + uint8_t frame_marker; + uint8_t profile_low_bit; + uint8_t profile_high_bit; + + uint8_t show_existing_frame; + uint8_t frame_to_show_map_idx; + + uint8_t frame_type; + uint8_t show_frame; + uint8_t error_resilient_mode; + + // Color config. + uint8_t ten_or_twelve_bit; + uint8_t color_space; + uint8_t color_range; + uint8_t subsampling_x; + uint8_t subsampling_y; + + uint8_t refresh_frame_flags; + + uint8_t intra_only; + uint8_t reset_frame_context; + + uint8_t ref_frame_idx[VP9_REFS_PER_FRAME]; + uint8_t ref_frame_sign_bias[VP9_MAX_REF_FRAMES]; + + uint8_t allow_high_precision_mv; + + uint8_t refresh_frame_context; + uint8_t frame_parallel_decoding_mode; + + uint8_t frame_context_idx; + + // Frame/render size. + uint8_t found_ref[VP9_REFS_PER_FRAME]; + uint16_t frame_width_minus_1; + uint16_t frame_height_minus_1; + uint8_t render_and_frame_size_different; + uint16_t render_width_minus_1; + uint16_t render_height_minus_1; + + // Interpolation filter. + uint8_t is_filter_switchable; + uint8_t raw_interpolation_filter_type; + + // Loop filter params. + uint8_t loop_filter_level; + uint8_t loop_filter_sharpness; + uint8_t loop_filter_delta_enabled; + uint8_t loop_filter_delta_update; + uint8_t update_ref_delta[VP9_MAX_REF_FRAMES]; + int8_t loop_filter_ref_deltas[VP9_MAX_REF_FRAMES]; + uint8_t update_mode_delta[2]; + int8_t loop_filter_mode_deltas[2]; + + // Quantization params. + uint8_t base_q_idx; + int8_t delta_q_y_dc; + int8_t delta_q_uv_dc; + int8_t delta_q_uv_ac; + + // Segmentation params. + uint8_t segmentation_enabled; + uint8_t segmentation_update_map; + uint8_t segmentation_tree_probs[7]; + uint8_t segmentation_temporal_update; + uint8_t segmentation_pred_prob[3]; + uint8_t segmentation_update_data; + uint8_t segmentation_abs_or_delta_update; + uint8_t feature_enabled[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + uint8_t feature_value[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + uint8_t feature_sign[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + + // Tile info. + uint8_t tile_cols_log2; + uint8_t tile_rows_log2; + + uint16_t header_size_in_bytes; +} VP9RawFrameHeader; + +typedef struct VP9RawFrame { + VP9RawFrameHeader header; + + uint8_t *data; + AVBufferRef *data_ref; + size_t data_size; +} VP9RawFrame; + +typedef struct VP9RawSuperframeIndex { + uint8_t superframe_marker; + uint8_t bytes_per_framesize_minus_1; + uint8_t frames_in_superframe_minus_1; + uint32_t frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME]; +} VP9RawSuperframeIndex; + +typedef struct VP9RawSuperframe { + VP9RawFrame frames[VP9_MAX_FRAMES_IN_SUPERFRAME]; + VP9RawSuperframeIndex index; +} VP9RawSuperframe; + +typedef struct VP9ReferenceFrameState { + int frame_width; // RefFrameWidth + int frame_height; // RefFrameHeight + int subsampling_x; // RefSubsamplingX + int subsampling_y; // RefSubsamplingY + int bit_depth; // RefBitDepth +} VP9ReferenceFrameState; + +typedef struct CodedBitstreamVP9Context { + int profile; + + // Frame dimensions in 8x8 mode info blocks. + uint16_t mi_cols; + uint16_t mi_rows; + // Frame dimensions in 64x64 superblocks. + uint16_t sb64_cols; + uint16_t sb64_rows; + + int frame_width; + int frame_height; + + uint8_t subsampling_x; + uint8_t subsampling_y; + int bit_depth; + + int8_t loop_filter_ref_deltas[VP9_MAX_REF_FRAMES]; + int8_t loop_filter_mode_deltas[2]; + uint8_t segmentation_tree_probs[7]; + uint8_t segmentation_pred_prob[3]; + uint8_t feature_enabled[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + uint8_t feature_value[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + uint8_t feature_sign[VP9_MAX_SEGMENTS][VP9_SEG_LVL_MAX]; + + VP9ReferenceFrameState ref[VP9_NUM_REF_FRAMES]; +} CodedBitstreamVP9Context; + + +#endif /* AVCODEC_CBS_VP9_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9_syntax_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9_syntax_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/cbs_vp9_syntax_template.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/cbs_vp9_syntax_template.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,484 @@ +/* + * 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 + */ + +static int FUNC(frame_sync_code)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + int err; + + fixed(8, frame_sync_byte_0, VP9_FRAME_SYNC_0); + fixed(8, frame_sync_byte_1, VP9_FRAME_SYNC_1); + fixed(8, frame_sync_byte_2, VP9_FRAME_SYNC_2); + + return 0; +} + +static int FUNC(color_config)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current, int profile) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + int err; + + if (profile >= 2) { + f(1, ten_or_twelve_bit); + vp9->bit_depth = current->ten_or_twelve_bit ? 12 : 10; + } else + vp9->bit_depth = 8; + + f(3, color_space); + + if (current->color_space != VP9_CS_RGB) { + f(1, color_range); + if (profile == 1 || profile == 3) { + f(1, subsampling_x); + f(1, subsampling_y); + fixed(1, reserved_zero, 0); + } else { + infer(subsampling_x, 1); + infer(subsampling_y, 1); + } + } else { + infer(color_range, 1); + if (profile == 1 || profile == 3) { + infer(subsampling_x, 0); + infer(subsampling_y, 0); + fixed(1, reserved_zero, 0); + } + } + + vp9->subsampling_x = current->subsampling_x; + vp9->subsampling_y = current->subsampling_y; + + return 0; +} + +static int FUNC(frame_size)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + int err; + + f(16, frame_width_minus_1); + f(16, frame_height_minus_1); + + vp9->frame_width = current->frame_width_minus_1 + 1; + vp9->frame_height = current->frame_height_minus_1 + 1; + + vp9->mi_cols = (vp9->frame_width + 7) >> 3; + vp9->mi_rows = (vp9->frame_height + 7) >> 3; + vp9->sb64_cols = (vp9->mi_cols + 7) >> 3; + vp9->sb64_rows = (vp9->mi_rows + 7) >> 3; + + return 0; +} + +static int FUNC(render_size)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + int err; + + f(1, render_and_frame_size_different); + + if (current->render_and_frame_size_different) { + f(16, render_width_minus_1); + f(16, render_height_minus_1); + } + + return 0; +} + +static int FUNC(frame_size_with_refs)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + int err, i; + + for (i = 0; i < VP9_REFS_PER_FRAME; i++) { + fs(1, found_ref[i], 1, i); + if (current->found_ref[i]) { + VP9ReferenceFrameState *ref = + &vp9->ref[current->ref_frame_idx[i]]; + + vp9->frame_width = ref->frame_width; + vp9->frame_height = ref->frame_height; + + vp9->subsampling_x = ref->subsampling_x; + vp9->subsampling_y = ref->subsampling_y; + vp9->bit_depth = ref->bit_depth; + + break; + } + } + if (i >= VP9_REFS_PER_FRAME) + CHECK(FUNC(frame_size)(ctx, rw, current)); + else { + vp9->mi_cols = (vp9->frame_width + 7) >> 3; + vp9->mi_rows = (vp9->frame_height + 7) >> 3; + vp9->sb64_cols = (vp9->mi_cols + 7) >> 3; + vp9->sb64_rows = (vp9->mi_rows + 7) >> 3; + } + CHECK(FUNC(render_size)(ctx, rw, current)); + + return 0; +} + +static int FUNC(interpolation_filter)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + int err; + + f(1, is_filter_switchable); + if (!current->is_filter_switchable) + f(2, raw_interpolation_filter_type); + + return 0; +} + +static int FUNC(loop_filter_params)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + int err, i; + + f(6, loop_filter_level); + f(3, loop_filter_sharpness); + + f(1, loop_filter_delta_enabled); + if (current->loop_filter_delta_enabled) { + f(1, loop_filter_delta_update); + if (current->loop_filter_delta_update) { + for (i = 0; i < VP9_MAX_REF_FRAMES; i++) { + fs(1, update_ref_delta[i], 1, i); + if (current->update_ref_delta[i]) + ss(6, loop_filter_ref_deltas[i], 1, i); + } + for (i = 0; i < 2; i++) { + fs(1, update_mode_delta[i], 1, i); + if (current->update_mode_delta[i]) + ss(6, loop_filter_mode_deltas[i], 1, i); + } + } + } else { + infer(loop_filter_delta_update, 0); + } + + return 0; +} + +static int FUNC(quantization_params)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + int err; + + f(8, base_q_idx); + + delta_q(delta_q_y_dc); + delta_q(delta_q_uv_dc); + delta_q(delta_q_uv_ac); + + return 0; +} + +static int FUNC(segmentation_params)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + static const uint8_t segmentation_feature_bits[VP9_SEG_LVL_MAX] = { 8, 6, 2, 0 }; + static const uint8_t segmentation_feature_signed[VP9_SEG_LVL_MAX] = { 1, 1, 0, 0 }; + int err, i, j; + + f(1, segmentation_enabled); + + if (current->segmentation_enabled) { + f(1, segmentation_update_map); + if (current->segmentation_update_map) { + for (i = 0; i < 7; i++) + prob(segmentation_tree_probs[i], 1, i); + f(1, segmentation_temporal_update); + for (i = 0; i < 3; i++) { + if (current->segmentation_temporal_update) + prob(segmentation_pred_prob[i], 1, i); + else + infer(segmentation_pred_prob[i], 255); + } + } + + f(1, segmentation_update_data); + if (current->segmentation_update_data) { + f(1, segmentation_abs_or_delta_update); + for (i = 0; i < VP9_MAX_SEGMENTS; i++) { + for (j = 0; j < VP9_SEG_LVL_MAX; j++) { + fs(1, feature_enabled[i][j], 2, i, j); + if (current->feature_enabled[i][j] && + segmentation_feature_bits[j]) { + fs(segmentation_feature_bits[j], + feature_value[i][j], 2, i, j); + if (segmentation_feature_signed[j]) + fs(1, feature_sign[i][j], 2, i, j); + else + infer(feature_sign[i][j], 0); + } else { + infer(feature_value[i][j], 0); + infer(feature_sign[i][j], 0); + } + } + } + } + } else { + infer(segmentation_update_data, 0); + } + + return 0; +} + +static int FUNC(tile_info)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + int min_log2_tile_cols, max_log2_tile_cols; + int err; + + min_log2_tile_cols = 0; + while ((VP9_MAX_TILE_WIDTH_B64 << min_log2_tile_cols) < vp9->sb64_cols) + ++min_log2_tile_cols; + max_log2_tile_cols = 0; + while ((vp9->sb64_cols >> (max_log2_tile_cols + 1)) >= VP9_MIN_TILE_WIDTH_B64) + ++max_log2_tile_cols; + + increment(tile_cols_log2, min_log2_tile_cols, max_log2_tile_cols); + + increment(tile_rows_log2, 0, 2); + + return 0; +} + +static int FUNC(uncompressed_header)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrameHeader *current) +{ + CodedBitstreamVP9Context *vp9 = ctx->priv_data; + int err, i; + + f(2, frame_marker); + + f(1, profile_low_bit); + f(1, profile_high_bit); + vp9->profile = (current->profile_high_bit << 1) + current->profile_low_bit; + if (vp9->profile == 3) + fixed(1, reserved_zero, 0); + + f(1, show_existing_frame); + if (current->show_existing_frame) { + f(3, frame_to_show_map_idx); + infer(header_size_in_bytes, 0); + infer(refresh_frame_flags, 0x00); + infer(loop_filter_level, 0); + return 0; + } + + f(1, frame_type); + f(1, show_frame); + f(1, error_resilient_mode); + + if (current->frame_type == VP9_KEY_FRAME) { + CHECK(FUNC(frame_sync_code)(ctx, rw, current)); + CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile)); + CHECK(FUNC(frame_size)(ctx, rw, current)); + CHECK(FUNC(render_size)(ctx, rw, current)); + + infer(refresh_frame_flags, 0xff); + + } else { + if (current->show_frame == 0) + f(1, intra_only); + else + infer(intra_only, 0); + + if (current->error_resilient_mode == 0) + f(2, reset_frame_context); + else + infer(reset_frame_context, 0); + + if (current->intra_only == 1) { + CHECK(FUNC(frame_sync_code)(ctx, rw, current)); + + if (vp9->profile > 0) { + CHECK(FUNC(color_config)(ctx, rw, current, vp9->profile)); + } else { + infer(color_space, 1); + infer(subsampling_x, 1); + infer(subsampling_y, 1); + vp9->bit_depth = 8; + + vp9->subsampling_x = current->subsampling_x; + vp9->subsampling_y = current->subsampling_y; + } + + f(8, refresh_frame_flags); + + CHECK(FUNC(frame_size)(ctx, rw, current)); + CHECK(FUNC(render_size)(ctx, rw, current)); + } else { + f(8, refresh_frame_flags); + + for (i = 0; i < VP9_REFS_PER_FRAME; i++) { + fs(3, ref_frame_idx[i], 1, i); + fs(1, ref_frame_sign_bias[VP9_LAST_FRAME + i], + 1, VP9_LAST_FRAME + i); + } + + CHECK(FUNC(frame_size_with_refs)(ctx, rw, current)); + f(1, allow_high_precision_mv); + CHECK(FUNC(interpolation_filter)(ctx, rw, current)); + } + } + + if (current->error_resilient_mode == 0) { + f(1, refresh_frame_context); + f(1, frame_parallel_decoding_mode); + } else { + infer(refresh_frame_context, 0); + infer(frame_parallel_decoding_mode, 1); + } + + f(2, frame_context_idx); + + CHECK(FUNC(loop_filter_params)(ctx, rw, current)); + CHECK(FUNC(quantization_params)(ctx, rw, current)); + CHECK(FUNC(segmentation_params)(ctx, rw, current)); + CHECK(FUNC(tile_info)(ctx, rw, current)); + + f(16, header_size_in_bytes); + + for (i = 0; i < VP9_NUM_REF_FRAMES; i++) { + if (current->refresh_frame_flags & (1 << i)) { + vp9->ref[i] = (VP9ReferenceFrameState) { + .frame_width = vp9->frame_width, + .frame_height = vp9->frame_height, + .subsampling_x = vp9->subsampling_x, + .subsampling_y = vp9->subsampling_y, + .bit_depth = vp9->bit_depth, + }; + } + } + + // Update top-level loop filter and segmentation state with changes + // from this frame. + if (current->frame_type == VP9_KEY_FRAME || + current->intra_only || + current->error_resilient_mode) { + // setup_past_independence() - fill with the initial values. + + vp9->loop_filter_ref_deltas[VP9_INTRA_FRAME] = 1; + vp9->loop_filter_ref_deltas[VP9_LAST_FRAME] = 0; + vp9->loop_filter_ref_deltas[VP9_GOLDEN_FRAME] = -1; + vp9->loop_filter_ref_deltas[VP9_ALTREF_FRAME] = -1; + + vp9->loop_filter_mode_deltas[0] = 0; + vp9->loop_filter_mode_deltas[1] = 0; + + memset(vp9->feature_enabled, 0, sizeof(vp9->feature_enabled)); + memset(vp9->feature_value, 0, sizeof(vp9->feature_value)); + memset(vp9->feature_sign, 0, sizeof(vp9->feature_sign)); + } + + // Modify previous state based on updates in this frame. + if (current->loop_filter_delta_update) { + for (i = 0; i < 4; i++) { + if (current->update_ref_delta[i]) + vp9->loop_filter_ref_deltas[i] = + current->loop_filter_ref_deltas[i]; + } + for (i = 0; i < 2; i++) { + if (current->update_mode_delta[i]) + vp9->loop_filter_mode_deltas[i] = + current->loop_filter_mode_deltas[i]; + } + } + + if (current->segmentation_update_data) { + memcpy(vp9->feature_enabled, current->feature_enabled, + sizeof(vp9->feature_enabled)); + memcpy(vp9->feature_value, current->feature_value, + sizeof(vp9->feature_value)); + memcpy(vp9->feature_sign, current->feature_sign, + sizeof(vp9->feature_sign)); + + if (current->segmentation_update_map) { + memcpy(vp9->segmentation_tree_probs, + current->segmentation_tree_probs, + sizeof(vp9->segmentation_tree_probs)); + memcpy(vp9->segmentation_pred_prob, + current->segmentation_pred_prob, + sizeof(vp9->segmentation_pred_prob)); + } + } + + av_log(ctx->log_ctx, AV_LOG_DEBUG, "Frame: size %dx%d " + "subsample %dx%d bit_depth %d tiles %dx%d.\n", + vp9->frame_width, vp9->frame_height, + vp9->subsampling_x, vp9->subsampling_y, + vp9->bit_depth, 1 << current->tile_cols_log2, + 1 << current->tile_rows_log2); + + return 0; +} + +static int FUNC(trailing_bits)(CodedBitstreamContext *ctx, RWContext *rw) +{ + int err; + while (byte_alignment(rw) != 0) + fixed(1, zero_bit, 0); + + return 0; +} + +static int FUNC(frame)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawFrame *current) +{ + int err; + + HEADER("Frame"); + + CHECK(FUNC(uncompressed_header)(ctx, rw, ¤t->header)); + + CHECK(FUNC(trailing_bits)(ctx, rw)); + + return 0; +} + +static int FUNC(superframe_index)(CodedBitstreamContext *ctx, RWContext *rw, + VP9RawSuperframeIndex *current) +{ + int err, i; + + HEADER("Superframe Index"); + + f(3, superframe_marker); + f(2, bytes_per_framesize_minus_1); + f(3, frames_in_superframe_minus_1); + + for (i = 0; i <= current->frames_in_superframe_minus_1; i++) { + // Surprise little-endian! + fle(8 * (current->bytes_per_framesize_minus_1 + 1), + frame_sizes[i], 1, i); + } + + f(3, superframe_marker); + f(2, bytes_per_framesize_minus_1); + f(3, frames_in_superframe_minus_1); + + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec.h 2026-04-29 18:38:25.000000000 +0000 @@ -80,21 +80,6 @@ */ #define AV_CODEC_CAP_SMALL_LAST_FRAME (1 << 6) -#if FF_API_SUBFRAMES -/** - * Codec can output multiple frames per AVPacket - * Normally demuxers return one frame at a time, demuxers which do not do - * are connected to a parser to split what they return into proper frames. - * This flag is reserved to the very rare category of codecs which have a - * bitstream that cannot be split into frames without timeconsuming - * operations like full decoding. Demuxers carrying such bitstreams thus - * may return multiple frames in a packet. This has many disadvantages like - * prohibiting stream copy in many cases thus it should only be considered - * as a last resort. - */ -#define AV_CODEC_CAP_SUBFRAMES (1 << 8) -#endif - /** * Codec is experimental and is thus avoided in favor of non experimental * encoders diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_desc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_desc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.c 2026-04-29 18:38:25.000000000 +0000 @@ -1277,7 +1277,7 @@ .type = AVMEDIA_TYPE_VIDEO, .name = "hevc", .long_name = NULL_IF_CONFIG_SMALL("H.265 / HEVC (High Efficiency Video Coding)"), - .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_REORDER, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS | AV_CODEC_PROP_REORDER, .profiles = NULL_IF_CONFIG_SMALL(ff_hevc_profiles), }, { @@ -1648,7 +1648,7 @@ .type = AVMEDIA_TYPE_VIDEO, .name = "av1", .long_name = NULL_IF_CONFIG_SMALL("Alliance for Open Media AV1"), - .props = AV_CODEC_PROP_LOSSY, + .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, .profiles = NULL_IF_CONFIG_SMALL(ff_av1_profiles), }, { @@ -1985,6 +1985,30 @@ .props = AV_CODEC_PROP_LOSSY | AV_CODEC_PROP_LOSSLESS, .mime_types= MT("image/jxl"), }, + { + .id = AV_CODEC_ID_APV, + .type = AVMEDIA_TYPE_VIDEO, + .name = "apv", + .long_name = NULL_IF_CONFIG_SMALL("Advanced Professional Video"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_PRORES_RAW, + .type = AVMEDIA_TYPE_VIDEO, + .name = "prores_raw", + .long_name = NULL_IF_CONFIG_SMALL("Apple ProRes RAW"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + .profiles = NULL_IF_CONFIG_SMALL(ff_prores_raw_profiles), + }, + { + .id = AV_CODEC_ID_JPEGXS, + .type = AVMEDIA_TYPE_VIDEO, + .name = "jpegxs", + .long_name = NULL_IF_CONFIG_SMALL("JPEG XS"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY | + AV_CODEC_PROP_LOSSLESS, + .mime_types= MT("image/jxs"), + }, /* various PCM "codecs" */ { @@ -2612,6 +2636,69 @@ .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Xbox"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_ADPCM_SANYO, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_sanyo", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Sanyo"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_IMA_HVQM4, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_ima_hvqm4", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA HVQM4"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_IMA_PDA, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_ima_pda", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA PlayDate"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_N64, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_n64", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Silicon Graphics N64"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_IMA_HVQM2, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_ima_hvqm2", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA HVQM2"), + .props = AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_IMA_MAGIX, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_ima_magix", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Magix"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_PSXC, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_psxc", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Playstation C"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_CIRCUS, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_circus", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM Circus"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_ADPCM_IMA_ESCAPE, + .type = AVMEDIA_TYPE_AUDIO, + .name = "adpcm_ima_escape", + .long_name = NULL_IF_CONFIG_SMALL("ADPCM IMA Acorn Escape"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, /* AMR */ { @@ -3466,6 +3553,20 @@ .long_name = NULL_IF_CONFIG_SMALL("LC3 (Low Complexity Communication Codec)"), .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, }, + { + .id = AV_CODEC_ID_G728, + .type = AVMEDIA_TYPE_AUDIO, + .name = "g728", + .long_name = NULL_IF_CONFIG_SMALL("G.728"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, + { + .id = AV_CODEC_ID_AHX, + .type = AVMEDIA_TYPE_AUDIO, + .name = "ahx", + .long_name = NULL_IF_CONFIG_SMALL("CRI AHX"), + .props = AV_CODEC_PROP_INTRA_ONLY | AV_CODEC_PROP_LOSSY, + }, /* subtitle codecs */ { @@ -3649,6 +3750,12 @@ .long_name = NULL_IF_CONFIG_SMALL("ARIB STD-B24 caption"), .profiles = NULL_IF_CONFIG_SMALL(ff_arib_caption_profiles), }, + { + .id = AV_CODEC_ID_IVTV_VBI, + .type = AVMEDIA_TYPE_SUBTITLE, + .name = "ivtv_vbi", + .long_name = NULL_IF_CONFIG_SMALL("ivtv VBI captions"), + }, /* other kind of codecs and pseudo-codecs */ { @@ -3731,9 +3838,16 @@ }, { .id = AV_CODEC_ID_LCEVC, - .type = AVMEDIA_TYPE_DATA, + .type = AVMEDIA_TYPE_VIDEO, .name = "lcevc", .long_name = NULL_IF_CONFIG_SMALL("LCEVC (Low Complexity Enhancement Video Coding) / MPEG-5 LCEVC / MPEG-5 part 2"), + .props = AV_CODEC_PROP_ENHANCEMENT, + }, + { + .id = AV_CODEC_ID_SMPTE_436M_ANC, + .type = AVMEDIA_TYPE_DATA, + .name = "smpte_436m_anc", + .long_name = NULL_IF_CONFIG_SMALL("MXF SMPTE-436M ANC"), }, { .id = AV_CODEC_ID_MPEG2TS, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_desc.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_desc.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_desc.h 2026-04-29 18:38:25.000000000 +0000 @@ -97,6 +97,14 @@ #define AV_CODEC_PROP_FIELDS (1 << 4) /** + * Video codec contains enhancement information meant to be applied to other + * existing frames, and can't generate usable image data on its own. + * A standalone decoder is unlikely to be available for it and should not + * be expected. + */ +#define AV_CODEC_PROP_ENHANCEMENT (1 << 5) + +/** * Subtitle codec is bitmap based * Decoded AVSubtitle data can be read from the AVSubtitleRect->pict field. */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_id.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_id.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_id.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_id.h 2026-04-29 18:38:25.000000000 +0000 @@ -329,6 +329,9 @@ AV_CODEC_ID_DNXUC, AV_CODEC_ID_RV60, AV_CODEC_ID_JPEGXL_ANIM, + AV_CODEC_ID_APV, + AV_CODEC_ID_PRORES_RAW, + AV_CODEC_ID_JPEGXS, /* various PCM "codecs" */ AV_CODEC_ID_FIRST_AUDIO = 0x10000, ///< A dummy id pointing at the start of audio codecs @@ -424,6 +427,15 @@ AV_CODEC_ID_ADPCM_IMA_ACORN, AV_CODEC_ID_ADPCM_XMD, AV_CODEC_ID_ADPCM_IMA_XBOX, + AV_CODEC_ID_ADPCM_SANYO, + AV_CODEC_ID_ADPCM_IMA_HVQM4, + AV_CODEC_ID_ADPCM_IMA_PDA, + AV_CODEC_ID_ADPCM_N64, + AV_CODEC_ID_ADPCM_IMA_HVQM2, + AV_CODEC_ID_ADPCM_IMA_MAGIX, + AV_CODEC_ID_ADPCM_PSXC, + AV_CODEC_ID_ADPCM_CIRCUS, + AV_CODEC_ID_ADPCM_IMA_ESCAPE, /* AMR */ AV_CODEC_ID_AMR_NB = 0x12000, @@ -552,6 +564,8 @@ AV_CODEC_ID_OSQ, AV_CODEC_ID_QOA, AV_CODEC_ID_LC3, + AV_CODEC_ID_G728, + AV_CODEC_ID_AHX, /* subtitle codecs */ AV_CODEC_ID_FIRST_SUBTITLE = 0x17000, ///< A dummy ID pointing at the start of subtitle codecs. @@ -581,6 +595,7 @@ AV_CODEC_ID_HDMV_TEXT_SUBTITLE, AV_CODEC_ID_TTML, AV_CODEC_ID_ARIB_CAPTION, + AV_CODEC_ID_IVTV_VBI, /* other specific kind of codecs (generally used for attachments) */ AV_CODEC_ID_FIRST_UNKNOWN = 0x18000, ///< A dummy ID pointing at the start of various fake codecs. @@ -598,6 +613,7 @@ AV_CODEC_ID_BIN_DATA, AV_CODEC_ID_SMPTE_2038, AV_CODEC_ID_LCEVC, + AV_CODEC_ID_SMPTE_436M_ANC, AV_CODEC_ID_PROBE = 0x19000, ///< codec_id is not known (like AV_CODEC_ID_NONE) but lavf should attempt to identify it diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_internal.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -22,7 +22,6 @@ #include #include "libavutil/attributes.h" -#include "avcodec.h" #include "codec.h" #include "config.h" @@ -102,6 +101,7 @@ struct AVCodecContext; struct AVSubtitle; struct AVPacket; +enum AVCodecConfig; enum FFCodecType { /* The codec is a decoder using the decode callback; @@ -133,7 +133,12 @@ /** * Internal codec capabilities FF_CODEC_CAP_*. */ - unsigned caps_internal:27; + unsigned caps_internal:24; + + /** + * Is this a decoder? + */ + unsigned is_decoder:1; /** * This field determines the video color ranges supported by an encoder. @@ -142,6 +147,12 @@ unsigned color_ranges:2; /** + * This field determines the alpha modes supported by an encoder. + * Should be set to a bitmask of AVALPHA_MODE_PREMULTIPLIED and AVALPHA_MODE_STRAIGHT. + */ + unsigned alpha_modes:2; + + /** * This field determines the type of the codec (decoder/encoder) * and also the exact callback cb implemented by the codec. * cb_type uses enum FFCodecType values. @@ -268,7 +279,7 @@ * ff_default_get_supported_config() will be used. `out_num_configs` will * always be set to a valid pointer. */ - int (*get_supported_config)(const AVCodecContext *avctx, + int (*get_supported_config)(const struct AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, @@ -276,6 +287,31 @@ int *out_num_configs); } FFCodec; +static av_always_inline const FFCodec *ffcodec(const AVCodec *codec) +{ + return (const FFCodec*)codec; +} + +/** + * Internal version of av_codec_is_encoder(). Must not be called with + * a NULL AVCodec*. + */ +static inline int ff_codec_is_encoder(const AVCodec *avcodec) +{ + const FFCodec *const codec = ffcodec(avcodec); + return !codec->is_decoder; +} + +/** + * Internal version of av_codec_is_decoder(). Must not be called with + * a NULL AVCodec*. + */ +static inline int ff_codec_is_decoder(const AVCodec *avcodec) +{ + const FFCodec *const codec = ffcodec(avcodec); + return codec->is_decoder; +} + /** * Default implementation for avcodec_get_supported_config(). Will return the * relevant fields from AVCodec if present, or NULL otherwise. @@ -283,7 +319,7 @@ * For AVCODEC_CONFIG_COLOR_RANGE, the output will depend on the bitmask in * FFCodec.color_ranges, with a value of 0 returning NULL. */ -int ff_default_get_supported_config(const AVCodecContext *avctx, +int ff_default_get_supported_config(const struct AVCodecContext *avctx, const AVCodec *codec, enum AVCodecConfig config, unsigned flags, @@ -309,27 +345,56 @@ #endif #define FF_CODEC_DECODE_CB(func) \ + .is_decoder = 1, \ .cb_type = FF_CODEC_CB_TYPE_DECODE, \ .cb.decode = (func) #define FF_CODEC_DECODE_SUB_CB(func) \ + .is_decoder = 1, \ .cb_type = FF_CODEC_CB_TYPE_DECODE_SUB, \ .cb.decode_sub = (func) #define FF_CODEC_RECEIVE_FRAME_CB(func) \ + .is_decoder = 1, \ .cb_type = FF_CODEC_CB_TYPE_RECEIVE_FRAME, \ .cb.receive_frame = (func) #define FF_CODEC_ENCODE_CB(func) \ + .is_decoder = 0, \ .cb_type = FF_CODEC_CB_TYPE_ENCODE, \ .cb.encode = (func) #define FF_CODEC_ENCODE_SUB_CB(func) \ + .is_decoder = 0, \ .cb_type = FF_CODEC_CB_TYPE_ENCODE_SUB, \ .cb.encode_sub = (func) #define FF_CODEC_RECEIVE_PACKET_CB(func) \ + .is_decoder = 0, \ .cb_type = FF_CODEC_CB_TYPE_RECEIVE_PACKET, \ .cb.receive_packet = (func) -static av_always_inline const FFCodec *ffcodec(const AVCodec *codec) -{ - return (const FFCodec*)codec; -} +#ifdef __clang__ +#define DISABLE_DEPRECATION_WARNINGS FF_DISABLE_DEPRECATION_WARNINGS +#define ENABLE_DEPRECATION_WARNINGS FF_ENABLE_DEPRECATION_WARNINGS +#else +#define DISABLE_DEPRECATION_WARNINGS +#define ENABLE_DEPRECATION_WARNINGS +#endif + +#define CODEC_CH_LAYOUTS(...) CODEC_CH_LAYOUTS_ARRAY(((const AVChannelLayout[]) { __VA_ARGS__, { 0 } })) +#define CODEC_CH_LAYOUTS_ARRAY(array) CODEC_ARRAY(ch_layouts, (array)) + +#define CODEC_SAMPLERATES(...) CODEC_SAMPLERATES_ARRAY(((const int[]) { __VA_ARGS__, 0 })) +#define CODEC_SAMPLERATES_ARRAY(array) CODEC_ARRAY(supported_samplerates, (array)) + +#define CODEC_SAMPLEFMTS(...) CODEC_SAMPLEFMTS_ARRAY(((const enum AVSampleFormat[]) { __VA_ARGS__, AV_SAMPLE_FMT_NONE })) +#define CODEC_SAMPLEFMTS_ARRAY(array) CODEC_ARRAY(sample_fmts, (array)) + +#define CODEC_FRAMERATES(...) CODEC_FRAMERATES_ARRAY(((const AVRational[]) { __VA_ARGS__, { 0, 0 } })) +#define CODEC_FRAMERATES_ARRAY(array) CODEC_ARRAY(supported_framerates, (array)) + +#define CODEC_PIXFMTS(...) CODEC_PIXFMTS_ARRAY(((const enum AVPixelFormat[]) { __VA_ARGS__, AV_PIX_FMT_NONE })) +#define CODEC_PIXFMTS_ARRAY(array) CODEC_ARRAY(pix_fmts, (array)) + +#define CODEC_ARRAY(field, array) \ + DISABLE_DEPRECATION_WARNINGS \ + .p.field = (array) \ + ENABLE_DEPRECATION_WARNINGS #endif /* AVCODEC_CODEC_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_list.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_list.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_list.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_list.c 2026-04-29 18:38:26.000000000 +0000 @@ -65,4 +65,37 @@ #if CONFIG_LIBAOM_AV1_ENCODER &ff_libaom_av1_encoder, #endif +#if CONFIG_AAC_MEDIACODEC_DECODER + &ff_aac_mediacodec_decoder, +#endif +#if CONFIG_AV1_MEDIACODEC_DECODER + &ff_av1_mediacodec_decoder, +#endif +#if CONFIG_VP8_MEDIACODEC_DECODER + &ff_vp8_mediacodec_decoder, +#endif +#if CONFIG_VP9_MEDIACODEC_DECODER + &ff_vp9_mediacodec_decoder, +#endif +#if CONFIG_H264_MEDIACODEC_DECODER + &ff_h264_mediacodec_decoder, +#endif +#if CONFIG_HEVC_MEDIACODEC_DECODER + &ff_hevc_mediacodec_decoder, +#endif +#if CONFIG_AV1_MEDIACODEC_ENCODER + &ff_av1_mediacodec_encoder, +#endif +#if CONFIG_VP8_MEDIACODEC_ENCODER + &ff_vp8_mediacodec_encoder, +#endif +#if CONFIG_VP9_MEDIACODEC_ENCODER + &ff_vp9_mediacodec_encoder, +#endif +#if CONFIG_H264_MEDIACODEC_ENCODER + &ff_h264_mediacodec_encoder, +#endif +#if CONFIG_HEVC_MEDIACODEC_ENCODER + &ff_hevc_mediacodec_encoder, +#endif NULL }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_par.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_par.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.c 2026-04-29 18:38:26.000000000 +0000 @@ -51,6 +51,7 @@ par->framerate = (AVRational){ 0, 1 }; par->profile = AV_PROFILE_UNKNOWN; par->level = AV_LEVEL_UNKNOWN; + par->alpha_mode = AVALPHA_MODE_UNSPECIFIED; } AVCodecParameters *avcodec_parameters_alloc(void) @@ -165,6 +166,7 @@ par->sample_aspect_ratio = codec->sample_aspect_ratio; par->video_delay = codec->has_b_frames; par->framerate = codec->framerate; + par->alpha_mode = codec->alpha_mode; break; case AVMEDIA_TYPE_AUDIO: par->format = codec->sample_fmt; @@ -229,6 +231,7 @@ codec->sample_aspect_ratio = par->sample_aspect_ratio; codec->has_b_frames = par->video_delay; codec->framerate = par->framerate; + codec->alpha_mode = par->alpha_mode; break; case AVMEDIA_TYPE_AUDIO: codec->sample_fmt = par->format; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_par.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/codec_par.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/codec_par.h 2026-04-29 18:38:26.000000000 +0000 @@ -148,7 +148,7 @@ * durations. Should be set to { 0, 1 } when some frames have differing * durations or if the value is not known. * - * @note This field correponds to values that are stored in codec-level + * @note This field corresponds to values that are stored in codec-level * headers and is typically overridden by container/transport-layer * timestamps, when available. It should thus be used only as a last resort, * when no higher-level timing information is available. @@ -212,6 +212,11 @@ * Audio only. Number of samples to skip after a discontinuity. */ int seek_preroll; + + /** + * Video with alpha channel only. Alpha channel handling + */ + enum AVAlphaMode alpha_mode; } AVCodecParameters; /** diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/dct.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/dct.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/dct.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/dct.h 2026-04-29 18:38:26.000000000 +0000 @@ -27,11 +27,11 @@ #include #include -void ff_j_rev_dct(int16_t *data); -void ff_j_rev_dct4(int16_t *data); -void ff_j_rev_dct2(int16_t *data); -void ff_j_rev_dct1(int16_t *data); -void ff_jref_idct_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block); -void ff_jref_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block); +void ff_j_rev_dct(int16_t data[64]); +void ff_j_rev_dct4(int16_t data[64]); +void ff_j_rev_dct2(int16_t data[64]); +void ff_j_rev_dct1(int16_t data[64]); +void ff_jref_idct_put(uint8_t *dest, ptrdiff_t line_size, int16_t block[64]); +void ff_jref_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t block[64]); #endif /* AVCODEC_DCT_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/decode.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/decode.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.c 2026-04-29 18:38:25.000000000 +0000 @@ -47,6 +47,9 @@ #include "codec_desc.h" #include "codec_internal.h" #include "decode.h" +#if CONFIG_EXIF +#include "exif.h" +#endif #include "hwaccel_internal.h" #include "hwconfig.h" #include "internal.h" @@ -93,10 +96,17 @@ */ uint64_t side_data_pref_mask; - FFLCEVCContext *lcevc; - int lcevc_frame; - int width; - int height; +#if CONFIG_LIBLCEVC_DEC + struct { + FFLCEVCContext *ctx; + int frame; + enum AVPixelFormat format; + int base_width; + int base_height; + int width; + int height; + } lcevc; +#endif } DecodeContext; static DecodeContext *decode_ctx(AVCodecInternal *avci) @@ -172,10 +182,6 @@ av_packet_unref(avci->last_pkt_props); if (pkt) { ret = av_packet_copy_props(avci->last_pkt_props, pkt); -#if FF_API_FRAME_PKT - if (!ret) - avci->last_pkt_props->stream_index = pkt->size; // Needed for ff_decode_frame_props(). -#endif } return ret; } @@ -217,7 +223,7 @@ #if !HAVE_THREADS #define ff_thread_get_packet(avctx, pkt) (AVERROR_BUG) -#define ff_thread_receive_frame(avctx, frame) (AVERROR_BUG) +#define ff_thread_receive_frame(avctx, frame, flags) (AVERROR_BUG) #endif static int decode_get_packet(AVCodecContext *avctx, AVPacket *pkt) @@ -444,14 +450,6 @@ if (!(codec->caps_internal & FF_CODEC_CAP_SETS_PKT_DTS)) frame->pkt_dts = pkt->dts; - if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - if(!avctx->has_b_frames) - frame->pkt_pos = pkt->pos; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - } emms_c(); if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { @@ -507,10 +505,6 @@ pkt->pts = AV_NOPTS_VALUE; pkt->dts = AV_NOPTS_VALUE; if (!(codec->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) { -#if FF_API_FRAME_PKT - // See extract_packet_props() comment. - avci->last_pkt_props->stream_index = avci->last_pkt_props->stream_index - consumed; -#endif avci->last_pkt_props->pts = AV_NOPTS_VALUE; avci->last_pkt_props->dts = AV_NOPTS_VALUE; } @@ -583,6 +577,8 @@ frame->color_range = avctx->color_range; if (frame->chroma_location == AVCHROMA_LOC_UNSPECIFIED) frame->chroma_location = avctx->chroma_sample_location; + if (frame->alpha_mode == AVALPHA_MODE_UNSPECIFIED) + frame->alpha_mode = avctx->alpha_mode; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { if (!frame->sample_aspect_ratio.num) frame->sample_aspect_ratio = avctx->sample_aspect_ratio; @@ -654,14 +650,15 @@ return ret; } -static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame) +static int decode_receive_frame_internal(AVCodecContext *avctx, AVFrame *frame, + unsigned flags) { AVCodecInternal *avci = avctx->internal; DecodeContext *dc = decode_ctx(avci); int ret, ok; if (avctx->active_thread_type & FF_THREAD_FRAME) - ret = ff_thread_receive_frame(avctx, frame); + ret = ff_thread_receive_frame(avctx, frame, flags); else ret = ff_decode_receive_frame_internal(avctx, frame); @@ -686,28 +683,25 @@ return ret; } -#if FF_API_FRAME_KEY -FF_DISABLE_DEPRECATION_WARNINGS - frame->key_frame = !!(frame->flags & AV_FRAME_FLAG_KEY); -FF_ENABLE_DEPRECATION_WARNINGS -#endif -#if FF_API_INTERLACED_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - frame->interlaced_frame = !!(frame->flags & AV_FRAME_FLAG_INTERLACED); - frame->top_field_first = !!(frame->flags & AV_FRAME_FLAG_TOP_FIELD_FIRST); -FF_ENABLE_DEPRECATION_WARNINGS -#endif frame->best_effort_timestamp = guess_correct_pts(dc, frame->pts, frame->pkt_dts); /* the only case where decode data is not set should be decoders * that do not call ff_get_buffer() */ - av_assert0((frame->private_ref && frame->private_ref->size == sizeof(FrameDecodeData)) || + av_assert0(frame->private_ref || !(avctx->codec->capabilities & AV_CODEC_CAP_DR1)); if (frame->private_ref) { - FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; + FrameDecodeData *fdd = frame->private_ref; + + if (fdd->hwaccel_priv_post_process) { + ret = fdd->hwaccel_priv_post_process(avctx, frame); + if (ret < 0) { + av_frame_unref(frame); + return ret; + } + } if (fdd->post_process) { ret = fdd->post_process(avctx, frame); @@ -720,7 +714,7 @@ } /* free the per-frame decode data */ - av_buffer_unref(&frame->private_ref); + av_refstruct_unref(&frame->private_ref); return ret; } @@ -750,7 +744,7 @@ dc->draining_started = 1; if (!avci->buffer_frame->buf[0] && !dc->draining_started) { - ret = decode_receive_frame_internal(avctx, avci->buffer_frame); + ret = decode_receive_frame_internal(avctx, avci->buffer_frame, 0); if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) return ret; } @@ -767,8 +761,8 @@ (frame->crop_top + frame->crop_bottom) >= frame->height) { av_log(avctx, AV_LOG_WARNING, "Invalid cropping information set by a decoder: " - "%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER"/%"SIZE_SPECIFIER" " - "(frame size %dx%d). This is a bug, please report it\n", + "%zu/%zu/%zu/%zu (frame size %dx%d). " + "This is a bug, please report it\n", frame->crop_left, frame->crop_right, frame->crop_top, frame->crop_bottom, frame->width, frame->height); frame->crop_left = 0; @@ -812,18 +806,15 @@ return AVERROR_BUG; } -int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame) +int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame, unsigned flags) { AVCodecInternal *avci = avctx->internal; int ret; - if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec)) - return AVERROR(EINVAL); - if (avci->buffer_frame->buf[0]) { av_frame_move_ref(frame, avci->buffer_frame); } else { - ret = decode_receive_frame_internal(avctx, frame); + ret = decode_receive_frame_internal(avctx, frame, flags); if (ret < 0) return ret; } @@ -840,53 +831,6 @@ avctx->frame_num++; -#if FF_API_DROPCHANGED - if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) { - - if (avctx->frame_num == 1) { - avci->initial_format = frame->format; - switch(avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - avci->initial_width = frame->width; - avci->initial_height = frame->height; - break; - case AVMEDIA_TYPE_AUDIO: - avci->initial_sample_rate = frame->sample_rate ? frame->sample_rate : - avctx->sample_rate; - ret = av_channel_layout_copy(&avci->initial_ch_layout, &frame->ch_layout); - if (ret < 0) - goto fail; - break; - } - } - - if (avctx->frame_num > 1) { - int changed = avci->initial_format != frame->format; - - switch(avctx->codec_type) { - case AVMEDIA_TYPE_VIDEO: - changed |= avci->initial_width != frame->width || - avci->initial_height != frame->height; - break; - case AVMEDIA_TYPE_AUDIO: - changed |= avci->initial_sample_rate != frame->sample_rate || - avci->initial_sample_rate != avctx->sample_rate || - av_channel_layout_compare(&avci->initial_ch_layout, &frame->ch_layout); - break; - } - - if (changed) { - avci->changed_frames_dropped++; - av_log(avctx, AV_LOG_INFO, "dropped changed frame #%"PRId64" pts %"PRId64 - " drop count: %d \n", - avctx->frame_num, frame->pts, - avci->changed_frames_dropped); - ret = AVERROR_INPUT_CHANGED; - goto fail; - } - } - } -#endif return 0; fail: av_frame_unref(frame); @@ -1054,7 +998,6 @@ enum AVPixelFormat avcodec_default_get_format(struct AVCodecContext *avctx, const enum AVPixelFormat *fmt) { - const AVPixFmtDescriptor *desc; const AVCodecHWConfig *config; int i, n; @@ -1081,12 +1024,13 @@ // No device or other setup, so we have to choose from things which // don't any other external information. - // If the last element of the list is a software format, choose it + // Choose the first software format // (this should be best software format if any exist). - for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++); - desc = av_pix_fmt_desc_get(fmt[n - 1]); - if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) - return fmt[n - 1]; + for (n = 0; fmt[n] != AV_PIX_FMT_NONE; n++) { + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(fmt[n]); + if (!(desc->flags & AV_PIX_FMT_FLAG_HWACCEL)) + return fmt[n]; + } // Finally, traverse the list in order and choose the first entry // with no external dependencies (if there is no hardware configuration @@ -1465,6 +1409,80 @@ return 0; } +#if CONFIG_EXIF +static int side_data_exif_parse(AVFrame *dst, const AVPacketSideData *sd_pkt) +{ + AVExifMetadata ifd = { 0 }; + AVExifEntry *entry = NULL; + AVBufferRef *buf = NULL; + AVFrameSideData *sd_frame; + int ret; + + ret = av_exif_parse_buffer(NULL, sd_pkt->data, sd_pkt->size, &ifd, + AV_EXIF_TIFF_HEADER); + if (ret < 0) + return ret; + + ret = av_exif_get_entry(NULL, &ifd, av_exif_get_tag_id("Orientation"), 0, &entry); + if (ret < 0) + goto end; + + if (!entry) { + ret = av_exif_ifd_to_dict(NULL, &ifd, &dst->metadata); + if (ret < 0) + goto end; + + sd_frame = av_frame_side_data_new(&dst->side_data, &dst->nb_side_data, AV_FRAME_DATA_EXIF, + sd_pkt->size, 0); + if (sd_frame) + memcpy(sd_frame->data, sd_pkt->data, sd_pkt->size); + ret = sd_frame ? 0 : AVERROR(ENOMEM); + + goto end; + } else if (entry->count <= 0 || entry->type != AV_TIFF_SHORT) { + ret = AVERROR_INVALIDDATA; + goto end; + } + + // If a display matrix already exists in the frame, give it priority + if (av_frame_side_data_get(dst->side_data, dst->nb_side_data, AV_FRAME_DATA_DISPLAYMATRIX)) + goto finish; + + sd_frame = av_frame_side_data_new(&dst->side_data, &dst->nb_side_data, AV_FRAME_DATA_DISPLAYMATRIX, + sizeof(int32_t) * 9, 0); + if (!sd_frame) { + ret = AVERROR(ENOMEM); + goto end; + } + + ret = av_exif_orientation_to_matrix((int32_t *)sd_frame->data, entry->value.uint[0]); + if (ret < 0) + goto end; + +finish: + av_exif_remove_entry(NULL, &ifd, entry->id, 0); + + ret = av_exif_ifd_to_dict(NULL, &ifd, &dst->metadata); + if (ret < 0) + goto end; + + ret = av_exif_write(NULL, &ifd, &buf, AV_EXIF_TIFF_HEADER); + if (ret < 0) + goto end; + + if (!av_frame_side_data_add(&dst->side_data, &dst->nb_side_data, AV_FRAME_DATA_EXIF, &buf, 0)) { + ret = AVERROR(ENOMEM); + goto end; + } + + ret = 0; +end: + av_buffer_unref(&buf); + av_exif_free(&ifd); + return ret; +} +#endif + static int side_data_map(AVFrame *dst, const AVPacketSideData *sd_src, int nb_sd_src, const SideDataMap *map) @@ -1491,11 +1509,23 @@ continue; } - sd_frame = av_frame_new_side_data(dst, type_frame, sd_pkt->size); - if (!sd_frame) - return AVERROR(ENOMEM); + switch (type_pkt) { +#if CONFIG_EXIF + case AV_PKT_DATA_EXIF: { + int ret = side_data_exif_parse(dst, sd_pkt); + if (ret < 0) + return ret; + break; + } +#endif + default: + sd_frame = av_frame_new_side_data(dst, type_frame, sd_pkt->size); + if (!sd_frame) + return AVERROR(ENOMEM); - memcpy(sd_frame->data, sd_pkt->data, sd_pkt->size); + memcpy(sd_frame->data, sd_pkt->data, sd_pkt->size); + break; + } } return 0; @@ -1530,12 +1560,6 @@ frame->pts = pkt->pts; frame->duration = pkt->duration; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - frame->pkt_pos = pkt->pos; - frame->pkt_size = pkt->size; -FF_ENABLE_DEPRECATION_WARNINGS -#endif ret = side_data_map(frame, pkt->side_data, pkt->side_data_elems, ff_sd_global_map); if (ret < 0) @@ -1570,17 +1594,21 @@ if (ret < 0) return ret; + for (int i = 0; i < avctx->nb_decoded_side_data; i++) { + const AVFrameSideData *src = avctx->decoded_side_data[i]; + if (av_frame_get_side_data(frame, src->type)) + continue; + ret = av_frame_side_data_clone(&frame->side_data, &frame->nb_side_data, src, 0); + if (ret < 0) + return ret; + } + if (!(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SETS_FRAME_PROPS)) { const AVPacket *pkt = avctx->internal->last_pkt_props; ret = ff_decode_frame_props_from_pkt(avctx, frame, pkt); if (ret < 0) return ret; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - frame->pkt_size = pkt->stream_index; -FF_ENABLE_DEPRECATION_WARNINGS -#endif } ret = fill_frame_props(avctx, frame); @@ -1599,6 +1627,33 @@ } break; } + +#if CONFIG_LIBLCEVC_DEC + AVCodecInternal *avci = avctx->internal; + DecodeContext *dc = decode_ctx(avci); + + dc->lcevc.frame = dc->lcevc.ctx && avctx->codec_type == AVMEDIA_TYPE_VIDEO && + av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC); + + if (dc->lcevc.frame) { + int ret = ff_lcevc_parse_frame(dc->lcevc.ctx, frame, &dc->lcevc.format, + &dc->lcevc.width, &dc->lcevc.height, avctx); + if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) + return ret; + + // force get_buffer2() to allocate the base frame using the same dimensions + // as the final enhanced frame, in order to prevent reinitializing the buffer + // pools unnecessarely + if (!ret && dc->lcevc.width && dc->lcevc.height) { + dc->lcevc.base_width = frame->width; + dc->lcevc.base_height = frame->height; + frame->width = dc->lcevc.width; + frame->height = dc->lcevc.height; + } else + dc->lcevc.frame = 0; + } +#endif + return 0; } @@ -1623,75 +1678,95 @@ } } -static void decode_data_free(void *opaque, uint8_t *data) +static void decode_data_free(AVRefStructOpaque unused, void *obj) { - FrameDecodeData *fdd = (FrameDecodeData*)data; + FrameDecodeData *fdd = obj; if (fdd->post_process_opaque_free) fdd->post_process_opaque_free(fdd->post_process_opaque); if (fdd->hwaccel_priv_free) fdd->hwaccel_priv_free(fdd->hwaccel_priv); - - av_freep(&fdd); } -int ff_attach_decode_data(AVFrame *frame) +int ff_attach_decode_data(AVCodecContext *avctx, AVFrame *frame) { - AVBufferRef *fdd_buf; FrameDecodeData *fdd; av_assert1(!frame->private_ref); - av_buffer_unref(&frame->private_ref); + av_refstruct_unref(&frame->private_ref); - fdd = av_mallocz(sizeof(*fdd)); + fdd = av_refstruct_alloc_ext(sizeof(*fdd), 0, NULL, decode_data_free); if (!fdd) return AVERROR(ENOMEM); - fdd_buf = av_buffer_create((uint8_t*)fdd, sizeof(*fdd), decode_data_free, - NULL, AV_BUFFER_FLAG_READONLY); - if (!fdd_buf) { - av_freep(&fdd); - return AVERROR(ENOMEM); - } - - frame->private_ref = fdd_buf; - - return 0; -} + frame->private_ref = fdd; -static void update_frame_props(AVCodecContext *avctx, AVFrame *frame) -{ +#if CONFIG_LIBLCEVC_DEC AVCodecInternal *avci = avctx->internal; DecodeContext *dc = decode_ctx(avci); - dc->lcevc_frame = dc->lcevc && avctx->codec_type == AVMEDIA_TYPE_VIDEO && - av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC); + if (!dc->lcevc.frame) { + dc->lcevc.frame = dc->lcevc.ctx && avctx->codec_type == AVMEDIA_TYPE_VIDEO && + av_frame_get_side_data(frame, AV_FRAME_DATA_LCEVC); + + if (dc->lcevc.frame) { + int ret = ff_lcevc_parse_frame(dc->lcevc.ctx, frame, &dc->lcevc.format, + &dc->lcevc.width, &dc->lcevc.height, avctx); + if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) + return ret; - if (dc->lcevc_frame) { - dc->width = frame->width; - dc->height = frame->height; - frame->width = frame->width * 2 / FFMAX(frame->sample_aspect_ratio.den, 1); - frame->height = frame->height * 2 / FFMAX(frame->sample_aspect_ratio.num, 1); + if (!ret && dc->lcevc.width && dc->lcevc.height) { + dc->lcevc.base_width = frame->width; + dc->lcevc.base_height = frame->height; + } else + dc->lcevc.frame = 0; + } } -} + if (dc->lcevc.frame) { + FFLCEVCFrame *frame_ctx; + int ret; -static void attach_post_process_data(AVCodecContext *avctx, AVFrame *frame) -{ - AVCodecInternal *avci = avctx->internal; - DecodeContext *dc = decode_ctx(avci); + if (fdd->post_process || !dc->lcevc.width || !dc->lcevc.height) { + dc->lcevc.frame = 0; + return 0; + } + + frame_ctx = av_mallocz(sizeof(*frame_ctx)); + if (!frame_ctx) + return AVERROR(ENOMEM); + + frame_ctx->frame = av_frame_alloc(); + if (!frame_ctx->frame) { + av_free(frame_ctx); + return AVERROR(ENOMEM); + } - if (dc->lcevc_frame) { - FrameDecodeData *fdd = (FrameDecodeData*)frame->private_ref->data; + frame_ctx->lcevc = av_refstruct_ref(dc->lcevc.ctx); + frame_ctx->frame->width = dc->lcevc.width; + frame_ctx->frame->height = dc->lcevc.height; + frame_ctx->frame->format = dc->lcevc.format; + avctx->bits_per_raw_sample = av_pix_fmt_desc_get(dc->lcevc.format)->comp[0].depth; - fdd->post_process_opaque = av_refstruct_ref(dc->lcevc); + frame->width = dc->lcevc.base_width; + frame->height = dc->lcevc.base_height; + + ret = avctx->get_buffer2(avctx, frame_ctx->frame, 0); + if (ret < 0) { + ff_lcevc_unref(frame_ctx); + return ret; + } + + validate_avframe_allocation(avctx, frame_ctx->frame); + + fdd->post_process_opaque = frame_ctx; fdd->post_process_opaque_free = ff_lcevc_unref; fdd->post_process = ff_lcevc_process; - - frame->width = dc->width; - frame->height = dc->height; } - dc->lcevc_frame = 0; + dc->lcevc.frame = 0; +#endif + + return 0; } int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) @@ -1700,7 +1775,7 @@ int override_dimensions = 1; int ret; - av_assert0(av_codec_is_decoder(avctx->codec)); + av_assert0(ff_codec_is_decoder(avctx->codec)); if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { if ((unsigned)avctx->width > INT_MAX - STRIDE_ALIGN || @@ -1739,7 +1814,6 @@ } } else { avctx->sw_pix_fmt = avctx->pix_fmt; - update_frame_props(avctx, frame); } ret = avctx->get_buffer2(avctx, frame, flags); @@ -1748,12 +1822,10 @@ validate_avframe_allocation(avctx, frame); - ret = ff_attach_decode_data(frame); + ret = ff_attach_decode_data(avctx, frame); if (ret < 0) goto fail; - attach_post_process_data(avctx, frame); - end: if (avctx->codec_type == AVMEDIA_TYPE_VIDEO && !override_dimensions && !(ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_EXPORTS_CROPPING)) { @@ -1847,14 +1919,9 @@ int ff_progress_frame_get_buffer(AVCodecContext *avctx, ProgressFrame *f, int flags) { - int ret; - - check_progress_consistency(f); - if (!f->f) { - ret = ff_progress_frame_alloc(avctx, f); - if (ret < 0) - return ret; - } + int ret = ff_progress_frame_alloc(avctx, f); + if (ret < 0) + return ret; ret = ff_thread_get_buffer(avctx, f->progress->f, flags); if (ret < 0) { @@ -1940,7 +2007,7 @@ av_frame_free(&progress->f); } -int ff_decode_preinit(AVCodecContext *avctx) +av_cold int ff_decode_preinit(AVCodecContext *avctx) { AVCodecInternal *avci = avctx->internal; DecodeContext *dc = decode_ctx(avci); @@ -2060,15 +2127,14 @@ return ret; if (!(avctx->export_side_data & AV_CODEC_EXPORT_DATA_ENHANCEMENTS)) { - ret = ff_lcevc_alloc(&dc->lcevc); - if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) - return ret; - } - -#if FF_API_DROPCHANGED - if (avctx->flags & AV_CODEC_FLAG_DROPCHANGED) - av_log(avctx, AV_LOG_WARNING, "The dropchanged flag is deprecated.\n"); + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { +#if CONFIG_LIBLCEVC_DEC + ret = ff_lcevc_alloc(&dc->lcevc.ctx, avctx); + if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) + return ret; #endif + } + } return 0; } @@ -2243,7 +2309,7 @@ return 1; } else if (pal) { av_log(logctx, AV_LOG_ERROR, - "Palette size %"SIZE_SPECIFIER" is wrong\n", size); + "Palette size %zu is wrong\n", size); } return 0; } @@ -2277,7 +2343,7 @@ return 0; } -void ff_decode_flush_buffers(AVCodecContext *avctx) +av_cold void ff_decode_flush_buffers(AVCodecContext *avctx) { AVCodecInternal *avci = avctx->internal; DecodeContext *dc = decode_ctx(avci); @@ -2295,23 +2361,136 @@ dc->draining_started = 0; } -AVCodecInternal *ff_decode_internal_alloc(void) +av_cold AVCodecInternal *ff_decode_internal_alloc(void) { return av_mallocz(sizeof(DecodeContext)); } -void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src) +av_cold void ff_decode_internal_sync(AVCodecContext *dst, const AVCodecContext *src) { const DecodeContext *src_dc = decode_ctx(src->internal); DecodeContext *dst_dc = decode_ctx(dst->internal); - av_refstruct_replace(&dst_dc->lcevc, src_dc->lcevc); + dst_dc->initial_pict_type = src_dc->initial_pict_type; + dst_dc->intra_only_flag = src_dc->intra_only_flag; + dst_dc->side_data_pref_mask = src_dc->side_data_pref_mask; +#if CONFIG_LIBLCEVC_DEC + av_refstruct_replace(&dst_dc->lcevc.ctx, src_dc->lcevc.ctx); + dst_dc->lcevc.width = src_dc->lcevc.width; + dst_dc->lcevc.height = src_dc->lcevc.height; + dst_dc->lcevc.format = src_dc->lcevc.format; +#endif } -void ff_decode_internal_uninit(AVCodecContext *avctx) +av_cold void ff_decode_internal_uninit(AVCodecContext *avctx) { +#if CONFIG_LIBLCEVC_DEC AVCodecInternal *avci = avctx->internal; DecodeContext *dc = decode_ctx(avci); - av_refstruct_unref(&dc->lcevc); + av_refstruct_unref(&dc->lcevc.ctx); +#endif } + +#if CONFIG_EXIF +static int attach_displaymatrix(AVCodecContext *avctx, AVFrame *frame, int orientation) +{ + AVFrameSideData *sd = NULL; + int32_t *matrix; + int ret; + /* invalid orientation */ + if (orientation < 1 || orientation > 8) + return AVERROR_INVALIDDATA; + ret = ff_frame_new_side_data(avctx, frame, AV_FRAME_DATA_DISPLAYMATRIX, sizeof(int32_t) * 9, &sd); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Could not allocate frame side data: %s\n", av_err2str(ret)); + return ret; + } + if (sd) { + matrix = (int32_t *) sd->data; + ret = av_exif_orientation_to_matrix(matrix, orientation); + } + + return ret; +} + +static int exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExifMetadata *ifd, AVBufferRef **pbuf) +{ + const AVExifEntry *orient = NULL; + AVExifMetadata *cloned = NULL; + int ret; + + for (size_t i = 0; i < ifd->count; i++) { + const AVExifEntry *entry = &ifd->entries[i]; + if (entry->id == av_exif_get_tag_id("Orientation") && + entry->count > 0 && entry->type == AV_TIFF_SHORT) { + orient = entry; + break; + } + } + + if (orient) { + av_log(avctx, AV_LOG_DEBUG, "found EXIF orientation: %" PRIu64 "\n", orient->value.uint[0]); + ret = attach_displaymatrix(avctx, frame, orient->value.uint[0]); + if (ret < 0) { + av_log(avctx, AV_LOG_WARNING, "unable to attach displaymatrix from EXIF\n"); + } else { + cloned = av_exif_clone_ifd(ifd); + if (!cloned) { + ret = AVERROR(ENOMEM); + goto end; + } + av_exif_remove_entry(avctx, cloned, orient->id, 0); + ifd = cloned; + } + } + + ret = av_exif_ifd_to_dict(avctx, ifd, &frame->metadata); + if (ret < 0) + goto end; + + if (cloned || !*pbuf) { + av_buffer_unref(pbuf); + ret = av_exif_write(avctx, ifd, pbuf, AV_EXIF_TIFF_HEADER); + if (ret < 0) + goto end; + } + + ret = ff_frame_new_side_data_from_buf(avctx, frame, AV_FRAME_DATA_EXIF, pbuf); + if (ret < 0) + goto end; + + ret = 0; + +end: + av_buffer_unref(pbuf); + av_exif_free(cloned); + av_free(cloned); + return ret; +} + +int ff_decode_exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, const AVExifMetadata *ifd) +{ + AVBufferRef *dummy = NULL; + return exif_attach_ifd(avctx, frame, ifd, &dummy); +} + +int ff_decode_exif_attach_buffer(AVCodecContext *avctx, AVFrame *frame, AVBufferRef **pbuf, + enum AVExifHeaderMode header_mode) +{ + int ret; + AVBufferRef *data = *pbuf; + AVExifMetadata ifd = { 0 }; + + ret = av_exif_parse_buffer(avctx, data->data, data->size, &ifd, header_mode); + if (ret < 0) + goto end; + + ret = exif_attach_ifd(avctx, frame, &ifd, pbuf); + +end: + av_buffer_unref(pbuf); + av_exif_free(&ifd); + return ret; +} +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/decode.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/decode.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/decode.h 2026-04-29 18:38:25.000000000 +0000 @@ -47,7 +47,11 @@ /** * Per-frame private data for hwaccels. + * + * Same as @ref post_process, but used only by some hwaccels to retrieve or + * finalize frames, and executed first. */ + int (*hwaccel_priv_post_process)(void *logctx, AVFrame *frame); void *hwaccel_priv; void (*hwaccel_priv_free)(void *priv); } FrameDecodeData; @@ -82,7 +86,7 @@ int ff_decode_get_hw_frames_ctx(AVCodecContext *avctx, enum AVHWDeviceType dev_type); -int ff_attach_decode_data(AVFrame *frame); +int ff_attach_decode_data(AVCodecContext *avctx, AVFrame *frame); /** * Check whether the side-data of src contains a palette of @@ -111,8 +115,10 @@ * instead of calling get_format() directly. * * The list of pixel formats must contain at least one valid entry, and is - * terminated with AV_PIX_FMT_NONE. If it is possible to decode to software, - * the last entry in the list must be the most accurate software format. + * terminated with AV_PIX_FMT_NONE. If it is possible to decode to software, + * the first entry after the last hwaccel one in the list must be the most + * accurate software format, followed by less accurate ones in order of + * preference. * If it is not possible to decode to software, AVCodecContext.sw_pix_fmt * must be set before calling this function. */ @@ -220,4 +226,34 @@ int ff_decode_content_light_new_ext(const AVCodecContext *avctx, AVFrameSideData ***sd, int *nb_sd, struct AVContentLightMetadata **clm); + +enum AVExifHeaderMode; + +/** + * Attach the data buffer to the frame. This is mostly a wrapper for + * av_side_data_new_from_buffer, but it checks if the orientation tag is + * present in the provided EXIF buffer. If it is, it zeroes it out and + * attaches that information as an AV_FRAME_DATA_DISPLAYMATRIX instead + * of including it in the AV_FRAME_DATA_EXIF side data buffer. + * + * *buf is ALWAYS consumed by this function and NULL written in its place, even + * on failure. + */ +int ff_decode_exif_attach_buffer(AVCodecContext *avctx, AVFrame *frame, AVBufferRef **buf, + enum AVExifHeaderMode header_mode); + +struct AVExifMetadata; + +/** + * Attach an already-parsed EXIF metadata struct to the frame as a side data + * buffer. It writes the EXIF IFD into the buffer and attaches the buffer to + * the frame. + * + * If the metadata struct contains an orientation tag, it will be zeroed before + * writing, and instead, an AV_FRAME_DATA_DISPLAYMATRIX will be attached in + * addition to the AV_FRAME_DATA_EXIF side data. + */ +int ff_decode_exif_attach_ifd(AVCodecContext *avctx, AVFrame *frame, + const struct AVExifMetadata *ifd); + #endif /* AVCODEC_DECODE_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/defs.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/defs.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/defs.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/defs.h 2026-04-29 18:38:25.000000000 +0000 @@ -185,6 +185,9 @@ #define AV_PROFILE_PRORES_4444 4 #define AV_PROFILE_PRORES_XQ 5 +#define AV_PROFILE_PRORES_RAW 0 +#define AV_PROFILE_PRORES_RAW_HQ 1 + #define AV_PROFILE_ARIB_PROFILE_A 0 #define AV_PROFILE_ARIB_PROFILE_C 1 @@ -194,6 +197,14 @@ #define AV_PROFILE_EVC_BASELINE 0 #define AV_PROFILE_EVC_MAIN 1 +#define AV_PROFILE_APV_422_10 33 +#define AV_PROFILE_APV_422_12 44 +#define AV_PROFILE_APV_444_10 55 +#define AV_PROFILE_APV_444_12 66 +#define AV_PROFILE_APV_4444_10 77 +#define AV_PROFILE_APV_4444_12 88 +#define AV_PROFILE_APV_400_10 99 + #define AV_LEVEL_UNKNOWN -99 @@ -326,6 +337,20 @@ } AVProducerReferenceTime; /** + * RTCP SR (Sender Report) information + * + * The received sender report information for an RTSP + * stream, exposed as AV_PKT_DATA_RTCP_SR side data. + */ +typedef struct AVRTCPSenderReport { + uint32_t ssrc; ///< Synchronization source identifier + uint64_t ntp_timestamp; ///< NTP time when the report was sent + uint32_t rtp_timestamp; ///< RTP time when the report was sent + uint32_t sender_nb_packets; ///< Total number of packets sent + uint32_t sender_nb_bytes; ///< Total number of bytes sent (excluding headers or padding) +} AVRTCPSenderReport; + +/** * Encode extradata length to a buffer. Used by xiph codecs. * * @param s buffer to write to; must be at least (v/255+1) bytes long diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/dovi_rpu.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/dovi_rpu.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/dovi_rpu.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/dovi_rpu.h 2026-04-29 18:38:25.000000000 +0000 @@ -1,5 +1,3 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2.c 2026-04-29 18:38:25.000000000 +0000 @@ -774,7 +774,6 @@ int curr) { void *surface = get_surface(avctx, frame); - unsigned i; #if CONFIG_D3D12VA if (avctx->pix_fmt == AV_PIX_FMT_D3D12) { @@ -791,7 +790,7 @@ } #endif #if CONFIG_DXVA2 - for (i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) { + for (unsigned i = 0; i < DXVA_CONTEXT_COUNT(avctx, ctx); i++) { if (avctx->pix_fmt == AV_PIX_FMT_DXVA2_VLD && ctx->dxva2.surface[i] == surface) return i; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2_av1.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_av1.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2_av1.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_av1.c 2026-04-29 18:38:26.000000000 +0000 @@ -272,6 +272,7 @@ } static int dxva2_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { @@ -450,7 +451,7 @@ return ret; } -static int dxva2_av1_uninit(AVCodecContext *avctx) +static av_cold int dxva2_av1_uninit(AVCodecContext *avctx) { struct AV1DXVAContext *ctx = avctx->internal->hwaccel_priv_data; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2_vp9.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_vp9.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/dxva2_vp9.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/dxva2_vp9.c 2026-04-29 18:38:26.000000000 +0000 @@ -254,6 +254,7 @@ static int dxva2_vp9_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/encode.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/encode.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.c 2026-04-29 18:38:26.000000000 +0000 @@ -18,13 +18,12 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/emms.h" #include "libavutil/frame.h" -#include "libavutil/imgutils.h" #include "libavutil/internal.h" +#include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/pixdesc.h" #include "libavutil/samplefmt.h" @@ -214,21 +213,6 @@ av_frame_move_ref(frame, avci->buffer_frame); -#if FF_API_FRAME_KEY -FF_DISABLE_DEPRECATION_WARNINGS - if (frame->key_frame) - frame->flags |= AV_FRAME_FLAG_KEY; -FF_ENABLE_DEPRECATION_WARNINGS -#endif -#if FF_API_INTERLACED_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - if (frame->interlaced_frame) - frame->flags |= AV_FRAME_FLAG_INTERLACED; - if (frame->top_field_first) - frame->flags |= AV_FRAME_FLAG_TOP_FIELD_FIRST; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - return 0; } @@ -252,7 +236,7 @@ int ret; ret = codec->cb.encode(avctx, avpkt, frame, got_packet); - emms_c(); + ff_assert1_fpu(); av_assert0(ret <= 0); if (!ret && *got_packet) { @@ -333,12 +317,13 @@ av_assert0(codec->cb_type == FF_CODEC_CB_TYPE_ENCODE); - if (CONFIG_FRAME_THREAD_ENCODER && avci->frame_thread_encoder) +#if CONFIG_FRAME_THREAD_ENCODER + if (avci->frame_thread_encoder) /* This will unref frame. */ ret = ff_thread_video_encode_frame(avctx, avpkt, frame, &got_packet); - else { + else +#endif ret = ff_encode_encode_cb(avctx, avpkt, frame, &got_packet); - } if (avci->draining && !got_packet) avci->draining_done = 1; @@ -372,8 +357,6 @@ if (avctx->codec->type == AVMEDIA_TYPE_VIDEO) { if ((avctx->flags & AV_CODEC_FLAG_PASS1) && avctx->stats_out) avctx->stats_out[0] = '\0'; - if (av_image_check_size2(avctx->width, avctx->height, avctx->max_pixels, AV_PIX_FMT_NONE, 0, avctx)) - return AVERROR(EINVAL); } if (ffcodec(avctx->codec)->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET) { @@ -566,7 +549,7 @@ const enum AVPixelFormat *pix_fmts; int ret, i, num_pix_fmts; - if (!av_get_pix_fmt_name(avctx->pix_fmt)) { + if (!pixdesc) { av_log(avctx, AV_LOG_ERROR, "Invalid video pixel format: %d\n", avctx->pix_fmt); return AVERROR(EINVAL); @@ -602,6 +585,33 @@ avctx->color_range = AVCOL_RANGE_JPEG; } + if (pixdesc->flags & AV_PIX_FMT_FLAG_ALPHA) { + const enum AVAlphaMode *alpha_modes; + int num_alpha_modes; + ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_ALPHA_MODE, + 0, (const void **) &alpha_modes, &num_alpha_modes); + if (ret < 0) + return ret; + + if (avctx->alpha_mode != AVALPHA_MODE_UNSPECIFIED && alpha_modes) { + for (i = 0; i < num_alpha_modes; i++) { + if (avctx->alpha_mode == alpha_modes[i]) + break; + } + if (i == num_alpha_modes) { + av_log(avctx, AV_LOG_ERROR, + "Specified alpha mode '%s' is not supported by the %s encoder.\n", + av_alpha_mode_name(avctx->alpha_mode), c->name); + av_log(avctx, AV_LOG_ERROR, "Supported alpha modes:\n"); + for (int p = 0; alpha_modes[p] != AVALPHA_MODE_UNSPECIFIED; p++) { + av_log(avctx, AV_LOG_ERROR, " %s\n", + av_alpha_mode_name(alpha_modes[p])); + } + return AVERROR(EINVAL); + } + } + } + if ( avctx->bits_per_raw_sample < 0 || (avctx->bits_per_raw_sample > 8 && pixdesc->comp[0].depth <= 8)) { av_log(avctx, AV_LOG_WARNING, "Specified bit depth %d not possible with the specified pixel formats depth %d\n", @@ -613,20 +623,6 @@ return AVERROR(EINVAL); } -#if FF_API_TICKS_PER_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - if (avctx->ticks_per_frame && avctx->time_base.num && - avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) { - av_log(avctx, AV_LOG_ERROR, - "ticks_per_frame %d too large for the timebase %d/%d.", - avctx->ticks_per_frame, - avctx->time_base.num, - avctx->time_base.den); - return AVERROR(EINVAL); - } -FF_ENABLE_DEPRECATION_WARNINGS -#endif - if (avctx->hw_frames_ctx) { AVHWFramesContext *frames_ctx = (AVHWFramesContext*)avctx->hw_frames_ctx->data; if (frames_ctx->format != avctx->pix_fmt) { @@ -662,11 +658,6 @@ avctx->sample_fmt); return AVERROR(EINVAL); } - if (avctx->sample_rate <= 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid audio sample rate: %d\n", - avctx->sample_rate); - return AVERROR(EINVAL); - } ret = avcodec_get_supported_config(avctx, NULL, AV_CODEC_CONFIG_SAMPLE_FORMAT, 0, (const void **) &sample_fmts, @@ -835,11 +826,11 @@ memcpy(sd_packet->data, sd_frame->data, sd_frame->size); } - if (CONFIG_FRAME_THREAD_ENCODER) { - ret = ff_frame_thread_encoder_init(avctx); - if (ret < 0) - return ret; - } +#if CONFIG_FRAME_THREAD_ENCODER + ret = ff_frame_thread_encoder_init(avctx); + if (ret < 0) + return ret; +#endif return 0; } @@ -848,24 +839,12 @@ { int ret; - switch (avctx->codec->type) { - case AVMEDIA_TYPE_VIDEO: - frame->format = avctx->pix_fmt; - if (frame->width <= 0 || frame->height <= 0) { - frame->width = FFMAX(avctx->width, avctx->coded_width); - frame->height = FFMAX(avctx->height, avctx->coded_height); - } + av_assert1(avctx->codec_type == AVMEDIA_TYPE_VIDEO); - break; - case AVMEDIA_TYPE_AUDIO: - frame->sample_rate = avctx->sample_rate; - frame->format = avctx->sample_fmt; - if (!frame->ch_layout.nb_channels) { - ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout); - if (ret < 0) - return ret; - } - break; + frame->format = avctx->pix_fmt; + if (frame->width <= 0 || frame->height <= 0) { + frame->width = avctx->width; + frame->height = avctx->height; } ret = avcodec_default_get_buffer2(avctx, frame, 0); @@ -936,3 +915,47 @@ return props; } + +int ff_encode_add_stats_side_data(AVPacket *pkt, int quality, const int64_t error[], + int error_count, enum AVPictureType pict_type) +{ + uint8_t *side_data; + size_t side_data_size; + + side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size); + if (!side_data) { + side_data_size = 4+4+8*error_count; + side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, + side_data_size); + } + + if (!side_data || side_data_size < 4+4+8*error_count) + return AVERROR(ENOMEM); + + AV_WL32(side_data, quality); + side_data[4] = pict_type; + side_data[5] = error_count; + for (int i = 0; i < error_count; ++i) + AV_WL64(side_data+8 + 8*i , error[i]); + + return 0; +} + +int ff_check_codec_matrices(AVCodecContext *avctx, unsigned types, uint16_t min, uint16_t max) +{ + uint16_t *matrices[] = {avctx->intra_matrix, avctx->inter_matrix, avctx->chroma_intra_matrix}; + const char *names[] = {"Intra", "Inter", "Chroma Intra"}; + static_assert(FF_ARRAY_ELEMS(matrices) == FF_ARRAY_ELEMS(names), "matrix count mismatch"); + for (int m = 0; m < FF_ARRAY_ELEMS(matrices); m++) { + uint16_t *matrix = matrices[m]; + if (matrix && (types & (1U << m))) { + for (int i = 0; i < 64; i++) { + if (matrix[i] < min || matrix[i] > max) { + av_log(avctx, AV_LOG_ERROR, "%s matrix[%d] is %d which is out of the allowed range [%"PRIu16"-%"PRIu16"].\n", names[m], i, matrix[i], min, max); + return AVERROR(EINVAL); + } + } + } + } + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/encode.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/encode.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/encode.h 2026-04-29 18:38:26.000000000 +0000 @@ -84,6 +84,9 @@ */ AVCPBProperties *ff_encode_add_cpb_side_data(AVCodecContext *avctx); +int ff_encode_add_stats_side_data(AVPacket *pkt, int quality, const int64_t error[], + int error_count, enum AVPictureType pict_type); + /** * Rescale from sample rate to AVCodecContext.time_base. */ @@ -96,4 +99,25 @@ avctx->time_base); } +/** + * Rescale from time base to AVCodecContext.sample_rate. + */ +static av_always_inline int64_t ff_samples_from_time_base(const AVCodecContext *avctx, + int64_t duration) +{ + if (!duration) + return duration; + return av_rescale_q(duration, avctx->time_base, + (AVRational){ 1, avctx->sample_rate }); +} + +/** + * Check if the elements of codec context matrices (intra_matrix, inter_matrix or + * chroma_intra_matrix) are within the specified range. + */ +#define FF_MATRIX_TYPE_INTRA (1U << 0) +#define FF_MATRIX_TYPE_INTER (1U << 1) +#define FF_MATRIX_TYPE_CHROMA_INTRA (1U << 2) +int ff_check_codec_matrices(AVCodecContext *avctx, unsigned types, uint16_t min, uint16_t max); + #endif /* AVCODEC_ENCODE_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/error_resilience.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/error_resilience.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/error_resilience.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/error_resilience.h 2026-04-29 18:38:26.000000000 +0000 @@ -23,9 +23,8 @@ #include #include "avcodec.h" -#include "me_cmp.h" -///< current MB is the first after a resync marker +/// current MB is the first after a resync marker #define VP_START 1 #define ER_AC_ERROR 2 #define ER_DC_ERROR 4 @@ -37,6 +36,8 @@ #define ER_MB_ERROR (ER_AC_ERROR|ER_DC_ERROR|ER_MV_ERROR) #define ER_MB_END (ER_AC_END|ER_DC_END|ER_MV_END) +typedef struct MPVEncContext MPVEncContext; + typedef struct ERPicture { AVFrame *f; const struct ThreadFrame *tf; @@ -53,8 +54,8 @@ typedef struct ERContext { AVCodecContext *avctx; - me_cmp_func sad; - int mecc_inited; + int (*sad)(MPVEncContext *unused, const uint8_t *blk1, + const uint8_t *blk2, ptrdiff_t stride, int h); int *mb_index2xy; int mb_num; @@ -89,6 +90,8 @@ void *opaque; } ERContext; +int ff_er_init(ERContext *const s); + void ff_er_frame_start(ERContext *s); /** diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/fffjni.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/fffjni.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,124 @@ +/* + * JNI public API functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 "config.h" + +#include + +#include "libavutil/error.h" +#include "jni.h" + +#if CONFIG_JNI +#include +#include + +#include "libavutil/log.h" +#include "ffjni.h" + +static void *java_vm; +static void *android_app_ctx; +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +int av_jni_set_java_vm(void *vm, void *log_ctx) +{ + int ret = 0; + + pthread_mutex_lock(&lock); + if (java_vm == NULL) { + java_vm = vm; + } else if (java_vm != vm) { + ret = AVERROR(EINVAL); + av_log(log_ctx, AV_LOG_ERROR, "A Java virtual machine has already been set"); + } + pthread_mutex_unlock(&lock); + + return ret; +} + +void *av_jni_get_java_vm(void *log_ctx) +{ + void *vm; + + pthread_mutex_lock(&lock); + vm = java_vm; + pthread_mutex_unlock(&lock); + + return vm; +} + +#else + +int av_jni_set_java_vm(void *vm, void *log_ctx) +{ + return AVERROR(ENOSYS); +} + +void *av_jni_get_java_vm(void *log_ctx) +{ + return NULL; +} + +#endif + +#if defined(__ANDROID__) + +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx) +{ +#if CONFIG_JNI + jobjectRefType type; + + JNIEnv *env = ff_jni_get_env(log_ctx); + if (!env) + return AVERROR(EINVAL); + + type = (*env)->GetObjectRefType(env, app_ctx); + if (type != JNIGlobalRefType) { + av_log(log_ctx, AV_LOG_ERROR, "Application context must be passed as a global reference"); + return AVERROR(EINVAL); + } + + pthread_mutex_lock(&lock); + android_app_ctx = app_ctx; + pthread_mutex_unlock(&lock); + + return 0; +#else + return AVERROR(ENOSYS); +#endif +} + +void *av_jni_get_android_app_ctx(void) +{ +#if CONFIG_JNI + void *ctx; + + pthread_mutex_lock(&lock); + ctx = android_app_ctx; + pthread_mutex_unlock(&lock); + + return ctx; +#else + return NULL; +#endif +} + +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/fffjni.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/fffjni.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/fffjni.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * JNI public API functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_JNI_H +#define AVCODEC_JNI_H + +/* + * Manually set a Java virtual machine which will be used to retrieve the JNI + * environment. Once a Java VM is set it cannot be changed afterwards, meaning + * you can call multiple times av_jni_set_java_vm with the same Java VM pointer + * however it will error out if you try to set a different Java VM. + * + * @param vm Java virtual machine + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +int av_jni_set_java_vm(void *vm, void *log_ctx); + +/* + * Get the Java virtual machine which has been set with av_jni_set_java_vm. + * + * @param vm Java virtual machine + * @return a pointer to the Java virtual machine + */ +void *av_jni_get_java_vm(void *log_ctx); + +/* + * Set the Android application context which will be used to retrieve the Android + * content resolver to handle content uris. + * + * This function is only available on Android. + * + * @param app_ctx global JNI reference to the Android application context + * @return 0 on success, < 0 otherwise + */ +int av_jni_set_android_app_ctx(void *app_ctx, void *log_ctx); + +/* + * Get the Android application context that has been set with + * av_jni_set_android_app_ctx. + * + * This function is only available on Android. + * + * @return a pointer the the Android application context + */ +void *av_jni_get_android_app_ctx(void); + +#endif /* AVCODEC_JNI_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/ffjni.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/ffjni.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,413 @@ +/* + * JNI utility functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 +#include +#include + +#include "libavutil/bprint.h" +#include "libavutil/error.h" +#include "libavutil/log.h" +#include "libavutil/mem.h" + +#include "config.h" +#include "jni.h" +#include "fffjni.h" +#include "ffjni.h" + +static JavaVM *java_vm; +static pthread_key_t current_env; +static pthread_once_t once = PTHREAD_ONCE_INIT; +static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; + +static void jni_detach_env(void *data) +{ + if (java_vm) { + (*java_vm)->DetachCurrentThread(java_vm); + } +} + +static void jni_create_pthread_key(void) +{ + pthread_key_create(¤t_env, jni_detach_env); +} + +JNIEnv *ff_jni_get_env(void *log_ctx) +{ + int ret = 0; + JNIEnv *env = NULL; + + pthread_mutex_lock(&lock); + if (java_vm == NULL) { + java_vm = av_jni_get_java_vm(log_ctx); + } + + if (!java_vm) { + av_log(log_ctx, AV_LOG_ERROR, "No Java virtual machine has been registered\n"); + goto done; + } + + pthread_once(&once, jni_create_pthread_key); + + if ((env = pthread_getspecific(current_env)) != NULL) { + goto done; + } + + ret = (*java_vm)->GetEnv(java_vm, (void **)&env, JNI_VERSION_1_6); + switch(ret) { + case JNI_EDETACHED: + if ((*java_vm)->AttachCurrentThread(java_vm, &env, NULL) != 0) { + av_log(log_ctx, AV_LOG_ERROR, "Failed to attach the JNI environment to the current thread\n"); + env = NULL; + } else { + pthread_setspecific(current_env, env); + } + break; + case JNI_OK: + break; + case JNI_EVERSION: + av_log(log_ctx, AV_LOG_ERROR, "The specified JNI version is not supported\n"); + break; + default: + av_log(log_ctx, AV_LOG_ERROR, "Failed to get the JNI environment attached to this thread\n"); + break; + } + +done: + pthread_mutex_unlock(&lock); + return env; +} + +char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx) +{ + char *ret = NULL; + const char *utf_chars = NULL; + + jboolean copy = 0; + + if (!string) { + return NULL; + } + + utf_chars = (*env)->GetStringUTFChars(env, string, ©); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "String.getStringUTFChars() threw an exception\n"); + return NULL; + } + + ret = av_strdup(utf_chars); + + (*env)->ReleaseStringUTFChars(env, string, utf_chars); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "String.releaseStringUTFChars() threw an exception\n"); + return NULL; + } + + return ret; +} + +jstring ff_jni_utf_chars_to_jstring(JNIEnv *env, const char *utf_chars, void *log_ctx) +{ + jstring ret; + + ret = (*env)->NewStringUTF(env, utf_chars); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "NewStringUTF() threw an exception\n"); + return NULL; + } + + return ret; +} + +int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx) +{ + int ret = 0; + + AVBPrint bp; + + char *name = NULL; + char *message = NULL; + + jclass class_class = NULL; + jmethodID get_name_id = NULL; + + jclass exception_class = NULL; + jmethodID get_message_id = NULL; + + jstring string = NULL; + + av_bprint_init(&bp, 0, AV_BPRINT_SIZE_AUTOMATIC); + + exception_class = (*env)->GetObjectClass(env, exception); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + class_class = (*env)->GetObjectClass(env, exception_class); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Could not find Throwable class's class\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + get_name_id = (*env)->GetMethodID(env, class_class, "getName", "()Ljava/lang/String;"); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Could not find method Class.getName()\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + string = (*env)->CallObjectMethod(env, exception_class, get_name_id); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Class.getName() threw an exception\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + if (string) { + name = ff_jni_jstring_to_utf_chars(env, string, log_ctx); + (*env)->DeleteLocalRef(env, string); + string = NULL; + } + + get_message_id = (*env)->GetMethodID(env, exception_class, "getMessage", "()Ljava/lang/String;"); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Could not find method java/lang/Throwable.getMessage()\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + string = (*env)->CallObjectMethod(env, exception, get_message_id); + if ((*env)->ExceptionCheck(env)) { + (*env)->ExceptionClear(env); + av_log(log_ctx, AV_LOG_ERROR, "Throwable.getMessage() threw an exception\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + if (string) { + message = ff_jni_jstring_to_utf_chars(env, string, log_ctx); + (*env)->DeleteLocalRef(env, string); + string = NULL; + } + + if (name && message) { + av_bprintf(&bp, "%s: %s", name, message); + } else if (name && !message) { + av_bprintf(&bp, "%s occurred", name); + } else if (!name && message) { + av_bprintf(&bp, "Exception: %s", message); + } else { + av_log(log_ctx, AV_LOG_WARNING, "Could not retrieve exception name and message\n"); + av_bprintf(&bp, "Exception occurred"); + } + + ret = av_bprint_finalize(&bp, error); +done: + + av_free(name); + av_free(message); + + (*env)->DeleteLocalRef(env, class_class); + (*env)->DeleteLocalRef(env, exception_class); + (*env)->DeleteLocalRef(env, string); + + return ret; +} + +int ff_jni_exception_check(JNIEnv *env, int log, void *log_ctx) +{ + int ret; + + jthrowable exception; + + char *message = NULL; + + if (!(*(env))->ExceptionCheck((env))) { + return 0; + } + + if (!log) { + (*(env))->ExceptionClear((env)); + return -1; + } + + exception = (*env)->ExceptionOccurred(env); + (*(env))->ExceptionClear((env)); + + if ((ret = ff_jni_exception_get_summary(env, exception, &message, log_ctx)) < 0) { + (*env)->DeleteLocalRef(env, exception); + return ret; + } + + (*env)->DeleteLocalRef(env, exception); + + av_log(log_ctx, AV_LOG_ERROR, "%s\n", message); + av_free(message); + + return -1; +} + +int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx) +{ + int i, ret = 0; + jclass last_clazz = NULL; + + for (i = 0; jfields_mapping[i].name; i++) { + int mandatory = jfields_mapping[i].mandatory; + enum FFJniFieldType type = jfields_mapping[i].type; + + if (type == FF_JNI_CLASS) { + jclass clazz; + + last_clazz = NULL; + + clazz = (*env)->FindClass(env, jfields_mapping[i].name); + if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { + goto done; + } + + last_clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) = + global ? (*env)->NewGlobalRef(env, clazz) : clazz; + + if (global) { + (*env)->DeleteLocalRef(env, clazz); + } + + } else { + + if (!last_clazz) { + ret = AVERROR_EXTERNAL; + break; + } + + switch(type) { + case FF_JNI_FIELD: { + jfieldID field_id = (*env)->GetFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); + if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { + goto done; + } + + *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = field_id; + break; + } + case FF_JNI_STATIC_FIELD: { + jfieldID field_id = (*env)->GetStaticFieldID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); + if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { + goto done; + } + + *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = field_id; + break; + } + case FF_JNI_METHOD: { + jmethodID method_id = (*env)->GetMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); + if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { + goto done; + } + + *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = method_id; + break; + } + case FF_JNI_STATIC_METHOD: { + jmethodID method_id = (*env)->GetStaticMethodID(env, last_clazz, jfields_mapping[i].method, jfields_mapping[i].signature); + if ((ret = ff_jni_exception_check(env, mandatory, log_ctx)) < 0 && mandatory) { + goto done; + } + + *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = method_id; + break; + } + default: + av_log(log_ctx, AV_LOG_ERROR, "Unknown JNI field type\n"); + ret = AVERROR(EINVAL); + goto done; + } + + ret = 0; + } + } + +done: + if (ret < 0) { + /* reset jfields in case of failure so it does not leak references */ + ff_jni_reset_jfields(env, jfields, jfields_mapping, global, log_ctx); + } + + return ret; +} + +int ff_jni_reset_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx) +{ + int i; + + for (i = 0; jfields_mapping[i].name; i++) { + enum FFJniFieldType type = jfields_mapping[i].type; + + switch(type) { + case FF_JNI_CLASS: { + jclass clazz = *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset); + if (!clazz) + continue; + + if (global) { + (*env)->DeleteGlobalRef(env, clazz); + } else { + (*env)->DeleteLocalRef(env, clazz); + } + + *(jclass*)((uint8_t*)jfields + jfields_mapping[i].offset) = NULL; + break; + } + case FF_JNI_FIELD: { + *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = NULL; + break; + } + case FF_JNI_STATIC_FIELD: { + *(jfieldID*)((uint8_t*)jfields + jfields_mapping[i].offset) = NULL; + break; + } + case FF_JNI_METHOD: { + *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = NULL; + break; + } + case FF_JNI_STATIC_METHOD: { + *(jmethodID*)((uint8_t*)jfields + jfields_mapping[i].offset) = NULL; + break; + } + default: + av_log(log_ctx, AV_LOG_ERROR, "Unknown JNI field type\n"); + } + } + + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/ffjni.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/ffjni.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/ffjni.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,146 @@ +/* + * JNI utility functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_FFJNI_H +#define AVCODEC_FFJNI_H + +#include +#include + +/* + * Attach permanently a JNI environment to the current thread and retrieve it. + * + * If successfully attached, the JNI environment will automatically be detached + * at thread destruction. + * + * @param attached pointer to an integer that will be set to 1 if the + * environment has been attached to the current thread or 0 if it is + * already attached. + * @param log_ctx context used for logging, can be NULL + * @return the JNI environment on success, NULL otherwise + */ +JNIEnv *ff_jni_get_env(void *log_ctx); + +/* + * Convert a jstring to its utf characters equivalent. + * + * @param env JNI environment + * @param string Java string to convert + * @param log_ctx context used for logging, can be NULL + * @return a pointer to an array of unicode characters on success, NULL + * otherwise + */ +char *ff_jni_jstring_to_utf_chars(JNIEnv *env, jstring string, void *log_ctx); + +/* + * Convert utf chars to its jstring equivalent. + * + * @param env JNI environment + * @param utf_chars a pointer to an array of unicode characters + * @param log_ctx context used for logging, can be NULL + * @return a Java string object on success, NULL otherwise + */ +jstring ff_jni_utf_chars_to_jstring(JNIEnv *env, const char *utf_chars, void *log_ctx); + +/* + * Extract the error summary from a jthrowable in the form of "className: errorMessage" + * + * @param env JNI environment + * @param exception exception to get the summary from + * @param error address pointing to the error, the value is updated if a + * summary can be extracted + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +int ff_jni_exception_get_summary(JNIEnv *env, jthrowable exception, char **error, void *log_ctx); + +/* + * Check if an exception has occurred,log it using av_log and clear it. + * + * @param env JNI environment + * @param log value used to enable logging if an exception has occurred, + * 0 disables logging, != 0 enables logging + * @param log_ctx context used for logging, can be NULL + */ +int ff_jni_exception_check(JNIEnv *env, int log, void *log_ctx); + +/* + * Jni field type. + */ +enum FFJniFieldType { + + FF_JNI_CLASS, + FF_JNI_FIELD, + FF_JNI_STATIC_FIELD, + FF_JNI_METHOD, + FF_JNI_STATIC_METHOD + +}; + +/* + * Jni field describing a class, a field or a method to be retrieved using + * the ff_jni_init_jfields method. + */ +struct FFJniField { + + const char *name; + const char *method; + const char *signature; + enum FFJniFieldType type; + size_t offset; + int mandatory; + +}; + +/* + * Retrieve class references, field ids and method ids to an arbitrary structure. + * + * @param env JNI environment + * @param jfields a pointer to an arbitrary structure where the different + * fields are declared and where the FFJNIField mapping table offsets are + * pointing to + * @param jfields_mapping null terminated array of FFJNIFields describing + * the class/field/method to be retrieved + * @param global make the classes references global. It is the caller + * responsibility to properly release global references. + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +int ff_jni_init_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx); + +/* + * Delete class references, field ids and method ids of an arbitrary structure. + * + * @param env JNI environment + * @param jfields a pointer to an arbitrary structure where the different + * fields are declared and where the FFJNIField mapping table offsets are + * pointing to + * @param jfields_mapping null terminated array of FFJNIFields describing + * the class/field/method to be deleted + * @param global threat the classes references as global and delete them + * accordingly + * @param log_ctx context used for logging, can be NULL + * @return 0 on success, < 0 otherwise + */ +int ff_jni_reset_jfields(JNIEnv *env, void *jfields, const struct FFJniField *jfields_mapping, int global, void *log_ctx); + +#endif /* AVCODEC_FFJNI_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/flac_parse.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/flac_parse.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/flac_parse.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/flac_parse.h 2026-04-29 18:38:26.000000000 +0000 @@ -58,7 +58,7 @@ * @param[out] s where parsed information is stored * @param[in] buffer pointer to start of 34-byte streaminfo data * - * @return negative error code on faiure or >= 0 on success + * @return negative error code on failure or >= 0 on success */ int ff_flac_parse_streaminfo(AVCodecContext *avctx, struct FLACStreaminfo *s, const uint8_t *buffer); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdec.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdec.c 2026-04-29 18:38:26.000000000 +0000 @@ -148,8 +148,10 @@ return buf_size; av_fast_malloc(&s->decoded_buffer, &s->decoded_buffer_size, buf_size); - if (!s->decoded_buffer) + if (!s->decoded_buffer) { + memset(s->decoded, 0, sizeof(s->decoded)); return AVERROR(ENOMEM); + } ret = av_samples_fill_arrays((uint8_t **)s->decoded, NULL, s->decoded_buffer, @@ -164,8 +166,10 @@ return buf_size; av_fast_malloc(&s->decoded_buffer_33bps, &s->decoded_buffer_size_33bps, buf_size); - if (!s->decoded_buffer_33bps) + if (!s->decoded_buffer_33bps) { + s->decoded_33bps = NULL; return AVERROR(ENOMEM); + } ret = av_samples_fill_arrays((uint8_t **)&s->decoded_33bps, NULL, s->decoded_buffer_33bps, @@ -665,7 +669,7 @@ fi.samplerate = s->stream_info.samplerate; s->stream_info.samplerate = s->avctx->sample_rate = fi.samplerate; - if (!s->got_streaminfo) { + if (!s->got_streaminfo || !s->decoded_buffer) { ret = allocate_buffers(s); if (ret < 0) return ret; @@ -827,10 +831,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1 | AV_CODEC_CAP_FRAME_THREADS, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S32, - AV_SAMPLE_FMT_S32P, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_S16P, + AV_SAMPLE_FMT_S32, AV_SAMPLE_FMT_S32P), .p.priv_class = &flac_decoder_class, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdsp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.c 2026-04-29 18:38:26.000000000 +0000 @@ -94,7 +94,7 @@ int64_t sum = 0; for (j = 0; j < pred_order; j++) sum += (int64_t)coeffs[j] * (uint64_t)decoded[j]; - decoded[j] = residual[i] + (sum >> qlevel); + decoded[j] = (uint64_t)residual[i] + (uint64_t)(sum >> qlevel); } } @@ -154,7 +154,7 @@ ff_flacdsp_init_arm(c, fmt, channels); #elif ARCH_RISCV ff_flacdsp_init_riscv(c, fmt, channels); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_flacdsp_init_x86(c, fmt, channels); #endif } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/flacdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/flacdsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -35,10 +35,6 @@ void (*wasted32)(int32_t *decoded, int wasted, int len); void (*wasted33)(int64_t *decoded, const int32_t *residual, int wasted, int len); - void (*lpc16_encode)(int32_t *res, const int32_t *smp, int len, int order, - const int32_t coefs[32], int shift); - void (*lpc32_encode)(int32_t *res, const int32_t *smp, int len, int order, - const int32_t coefs[32], int shift); } FLACDSPContext; void ff_flacdsp_init(FLACDSPContext *c, enum AVSampleFormat fmt, int channels); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/get_bits.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/get_bits.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/get_bits.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/get_bits.h 2026-04-29 18:38:25.000000000 +0000 @@ -76,6 +76,7 @@ typedef BitstreamContext GetBitContext; #define get_bits_count bits_tell +#define get_bits_bytesize bits_bytesize #define get_bits_left bits_left #define skip_bits_long bits_skip #define skip_bits bits_skip @@ -106,7 +107,7 @@ #else // CACHED_BITSTREAM_READER typedef struct GetBitContext { - const uint8_t *buffer, *buffer_end; + const uint8_t *buffer; int index; int size_in_bits; int size_in_bits_plus8; @@ -163,24 +164,24 @@ * For examples see get_bits, show_bits, skip_bits, get_vlc. */ -#if defined LONG_BITSTREAM_READER -# define MIN_CACHE_BITS 32 -#else -# define MIN_CACHE_BITS 25 -#endif +#define MIN_CACHE_BITS 25 + +#define OPEN_READER_NOSIZE_NOCACHE(name, gb) \ + unsigned int name ## _index = (gb)->index #define OPEN_READER_NOSIZE(name, gb) \ - unsigned int name ## _index = (gb)->index; \ - unsigned int av_unused name ## _cache + OPEN_READER_NOSIZE_NOCACHE(name, gb); \ + unsigned int name ## _cache #if UNCHECKED_BITSTREAM_READER #define OPEN_READER(name, gb) OPEN_READER_NOSIZE(name, gb) - +#define OPEN_READER_SIZE(name, gb) ((void)0) #define BITS_AVAILABLE(name, gb) 1 #else +#define OPEN_READER_SIZE(name, gb) unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8 #define OPEN_READER(name, gb) \ OPEN_READER_NOSIZE(name, gb); \ - unsigned int name ## _size_plus8 = (gb)->size_in_bits_plus8 + OPEN_READER_SIZE(name, gb) #define BITS_AVAILABLE(name, gb) name ## _index < name ## _size_plus8 #endif @@ -195,24 +196,11 @@ /* Using these two macros ensures that 32 bits are available. */ # define UPDATE_CACHE_LE_32(name, gb) UPDATE_CACHE_LE_EXT(name, (gb), 64, 32) - # define UPDATE_CACHE_BE_32(name, gb) UPDATE_CACHE_BE_EXT(name, (gb), 64, 32) -# ifdef LONG_BITSTREAM_READER - -# define UPDATE_CACHE_LE(name, gb) UPDATE_CACHE_LE_32(name, (gb)) - -# define UPDATE_CACHE_BE(name, gb) UPDATE_CACHE_BE_32(name, (gb)) - -#else - # define UPDATE_CACHE_LE(name, gb) UPDATE_CACHE_LE_EXT(name, (gb), 32, 32) - # define UPDATE_CACHE_BE(name, gb) UPDATE_CACHE_BE_EXT(name, (gb), 32, 32) -#endif - - #ifdef BITSTREAM_READER_LE # define UPDATE_CACHE(name, gb) UPDATE_CACHE_LE(name, gb) @@ -269,6 +257,20 @@ } /** + * Get the size of the GetBitContext's buffer in bytes. + * + * @param s the GetBitContext + * @param round_up If set, the number of bits will be rounded up to full bytes; + * this does not matter if the number of bits is known to be + * a multiple of eight, e.g. if the GetBitContext has been + * initialized with init_get_bits8. + */ +static inline int get_bits_bytesize(const GetBitContext *s, int round_up) +{ + return (s->size_in_bits + (round_up ? 7 : 0)) >> 3; +} + +/** * Skips the specified number of bits. * @param n the number of bits to skip, * For the UNCHECKED_BITSTREAM_READER this must not cause the distance @@ -380,7 +382,8 @@ static inline void skip_bits(GetBitContext *s, int n) { - OPEN_READER(re, s); + OPEN_READER_NOSIZE_NOCACHE(re, s); + OPEN_READER_SIZE(re, s); LAST_SKIP_BITS(re, s, n); CLOSE_READER(re, s); } @@ -514,7 +517,6 @@ static inline int init_get_bits(GetBitContext *s, const uint8_t *buffer, int bit_size) { - int buffer_size; int ret = 0; if (bit_size >= INT_MAX - FFMAX(7, AV_INPUT_BUFFER_PADDING_SIZE*8) || bit_size < 0 || !buffer) { @@ -523,12 +525,9 @@ ret = AVERROR_INVALIDDATA; } - buffer_size = (bit_size + 7) >> 3; - s->buffer = buffer; s->size_in_bits = bit_size; s->size_in_bits_plus8 = bit_size + 8; - s->buffer_end = buffer + buffer_size; s->index = 0; return ret; @@ -573,71 +572,65 @@ */ #define GET_VLC(code, name, gb, table, bits, max_depth) \ do { \ - int n, nb_bits; \ - unsigned int index; \ - \ - index = SHOW_UBITS(name, gb, bits); \ - code = table[index].sym; \ - n = table[index].len; \ + unsigned idx_ = SHOW_UBITS(name, gb, bits); \ + code = table[idx_].sym; \ + int n_ = table[idx_].len; \ \ - if (max_depth > 1 && n < 0) { \ + if (max_depth > 1 && n_ < 0) { \ LAST_SKIP_BITS(name, gb, bits); \ UPDATE_CACHE(name, gb); \ \ - nb_bits = -n; \ + int nb__bits = -n_; \ \ - index = SHOW_UBITS(name, gb, nb_bits) + code; \ - code = table[index].sym; \ - n = table[index].len; \ - if (max_depth > 2 && n < 0) { \ - LAST_SKIP_BITS(name, gb, nb_bits); \ + idx_ = SHOW_UBITS(name, gb, nb__bits) + code; \ + code = table[idx_].sym; \ + n_ = table[idx_].len; \ + if (max_depth > 2 && n_ < 0) { \ + LAST_SKIP_BITS(name, gb, nb__bits); \ UPDATE_CACHE(name, gb); \ \ - nb_bits = -n; \ + nb__bits = -n_; \ \ - index = SHOW_UBITS(name, gb, nb_bits) + code; \ - code = table[index].sym; \ - n = table[index].len; \ + idx_ = SHOW_UBITS(name, gb, nb__bits) + code; \ + code = table[idx_].sym; \ + n_ = table[idx_].len; \ } \ } \ - SKIP_BITS(name, gb, n); \ + SKIP_BITS(name, gb, n_); \ } while (0) #define GET_RL_VLC(level, run, name, gb, table, bits, \ max_depth, need_update) \ do { \ - int n, nb_bits; \ - unsigned int index; \ - \ - index = SHOW_UBITS(name, gb, bits); \ - level = table[index].level; \ - n = table[index].len; \ + unsigned idx_ = SHOW_UBITS(name, gb, bits); \ + level = table[idx_].level; \ + int n_ = table[idx_].len8; \ \ - if (max_depth > 1 && n < 0) { \ + if (max_depth > 1 && n_ < 0) { \ SKIP_BITS(name, gb, bits); \ if (need_update) { \ UPDATE_CACHE(name, gb); \ } \ \ - nb_bits = -n; \ + int nb__bits = -n_; \ \ - index = SHOW_UBITS(name, gb, nb_bits) + level; \ - level = table[index].level; \ - n = table[index].len; \ - if (max_depth > 2 && n < 0) { \ - LAST_SKIP_BITS(name, gb, nb_bits); \ + idx_ = SHOW_UBITS(name, gb, nb__bits) + level; \ + level = table[idx_].level; \ + n_ = table[idx_].len8; \ + if (max_depth > 2 && n_ < 0) { \ + LAST_SKIP_BITS(name, gb, nb__bits); \ if (need_update) { \ UPDATE_CACHE(name, gb); \ } \ - nb_bits = -n; \ + nb__bits = -n_; \ \ - index = SHOW_UBITS(name, gb, nb_bits) + level; \ - level = table[index].level; \ - n = table[index].len; \ + idx_ = SHOW_UBITS(name, gb, nb__bits) + level; \ + level = table[idx_].level; \ + n_ = table[idx_].len8; \ } \ } \ - run = table[index].run; \ - SKIP_BITS(name, gb, n); \ + run = table[idx_].run; \ + SKIP_BITS(name, gb, n_); \ } while (0) /** @@ -665,10 +658,10 @@ } static inline int get_vlc_multi(GetBitContext *s, uint8_t *dst, - const VLC_MULTI_ELEM *const Jtable, + av_unused const VLC_MULTI_ELEM *const Jtable, const VLCElem *const table, const int bits, const int max_depth, - const int symbols_size) + av_unused const int symbols_size) { dst[0] = get_vlc2(s, table, bits, max_depth); return 1; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/golomb.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/golomb.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/golomb.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/golomb.h 2026-04-29 18:38:25.000000000 +0000 @@ -455,7 +455,7 @@ buf = get_bits_long(gb, k); return buf + (i << k); - } else if (i == limit - 1) { + } else if (esc_len && i == limit - 1) { buf = get_bits_long(gb, esc_len); return buf + 1; @@ -512,7 +512,7 @@ } buf += ((SUINT)i << k); - } else if (i == limit - 1) { + } else if (esc_len && i == limit - 1) { buf = SHOW_UBITS(re, gb, esc_len); LAST_SKIP_BITS(re, gb, esc_len); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264dsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264dsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264dsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -41,71 +41,71 @@ */ typedef struct H264DSPContext { /* weighted MC */ - h264_weight_func weight_h264_pixels_tab[4]; - h264_biweight_func biweight_h264_pixels_tab[4]; + h264_weight_func weight_pixels_tab[4]; + h264_biweight_func biweight_pixels_tab[4]; /* loop filter */ - void (*h264_v_loop_filter_luma)(uint8_t *pix /*align 16*/, ptrdiff_t stride, - int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_luma)(uint8_t *pix /*align 4 */, ptrdiff_t stride, - int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_luma_mbaff)(uint8_t *pix /*align 16*/, ptrdiff_t stride, - int alpha, int beta, int8_t *tc0); + void (*v_loop_filter_luma)(uint8_t *pix /*align 16*/, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); + void (*h_loop_filter_luma)(uint8_t *pix /*align 4 */, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); + void (*h_loop_filter_luma_mbaff)(uint8_t *pix /*align 16*/, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); /* v/h_loop_filter_luma_intra: align 16 */ - void (*h264_v_loop_filter_luma_intra)(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); - void (*h264_h_loop_filter_luma_intra)(uint8_t *pix, ptrdiff_t stride, - int alpha, int beta); - void (*h264_h_loop_filter_luma_mbaff_intra)(uint8_t *pix /*align 16*/, - ptrdiff_t stride, int alpha, int beta); - void (*h264_v_loop_filter_chroma)(uint8_t *pix /*align 8*/, ptrdiff_t stride, - int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_chroma)(uint8_t *pix /*align 4*/, ptrdiff_t stride, - int alpha, int beta, int8_t *tc0); - void (*h264_h_loop_filter_chroma_mbaff)(uint8_t *pix /*align 8*/, - ptrdiff_t stride, int alpha, int beta, - int8_t *tc0); - void (*h264_v_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, - ptrdiff_t stride, int alpha, int beta); - void (*h264_h_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, - ptrdiff_t stride, int alpha, int beta); - void (*h264_h_loop_filter_chroma_mbaff_intra)(uint8_t *pix /*align 8*/, - ptrdiff_t stride, int alpha, int beta); - // h264_loop_filter_strength: simd only. the C version is inlined in h264_loopfilter.c - void (*h264_loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], - int8_t ref[2][40], int16_t mv[2][40][2], - int bidir, int edges, int step, - int mask_mv0, int mask_mv1, int field); + void (*v_loop_filter_luma_intra)(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); + void (*h_loop_filter_luma_intra)(uint8_t *pix, ptrdiff_t stride, + int alpha, int beta); + void (*h_loop_filter_luma_mbaff_intra)(uint8_t *pix /*align 16*/, + ptrdiff_t stride, int alpha, int beta); + void (*v_loop_filter_chroma)(uint8_t *pix /*align 8*/, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); + void (*h_loop_filter_chroma)(uint8_t *pix /*align 4*/, ptrdiff_t stride, + int alpha, int beta, int8_t *tc0); + void (*h_loop_filter_chroma_mbaff)(uint8_t *pix /*align 8*/, + ptrdiff_t stride, int alpha, int beta, + int8_t *tc0); + void (*v_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, + ptrdiff_t stride, int alpha, int beta); + void (*h_loop_filter_chroma_intra)(uint8_t *pix /*align 8*/, + ptrdiff_t stride, int alpha, int beta); + void (*h_loop_filter_chroma_mbaff_intra)(uint8_t *pix /*align 8*/, + ptrdiff_t stride, int alpha, int beta); + // loop_filter_strength: simd only. the C version is inlined in h264_loopfilter.c + void (*loop_filter_strength)(int16_t bS[2][4][4], uint8_t nnz[40], + int8_t ref[2][40], int16_t mv[2][40][2], + int bidir, int edges, int step, + int mask_mv0, int mask_mv1, int field); /* IDCT */ - void (*h264_idct_add)(uint8_t *dst /*align 4*/, - int16_t *block /*align 16*/, int stride); - void (*h264_idct8_add)(uint8_t *dst /*align 8*/, - int16_t *block /*align 16*/, int stride); - void (*h264_idct_dc_add)(uint8_t *dst /*align 4*/, - int16_t *block /*align 16*/, int stride); - void (*h264_idct8_dc_add)(uint8_t *dst /*align 8*/, - int16_t *block /*align 16*/, int stride); + void (*idct_add)(uint8_t *dst /*align 4*/, + int16_t *block /*align 16*/, int stride); + void (*idct8_add)(uint8_t *dst /*align 8*/, + int16_t *block /*align 16*/, int stride); + void (*idct_dc_add)(uint8_t *dst /*align 4*/, + int16_t *block /*align 16*/, int stride); + void (*idct8_dc_add)(uint8_t *dst /*align 8*/, + int16_t *block /*align 16*/, int stride); - void (*h264_idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset, - int16_t *block /*align 16*/, int stride, - const uint8_t nnzc[5 * 8]); - void (*h264_idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset, - int16_t *block /*align 16*/, int stride, - const uint8_t nnzc[5 * 8]); - void (*h264_idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset, - int16_t *block /*align 16*/, int stride, - const uint8_t nnzc[15 * 8]); - void (*h264_idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset, - int16_t *block /*align 16*/, - int stride, const uint8_t nnzc[5 * 8]); - void (*h264_luma_dc_dequant_idct)(int16_t *output, - int16_t *input /*align 16*/, int qmul); - void (*h264_chroma_dc_dequant_idct)(int16_t *block, int qmul); + void (*idct_add16)(uint8_t *dst /*align 16*/, const int *blockoffset, + int16_t *block /*align 16*/, int stride, + const uint8_t nnzc[5 * 8]); + void (*idct8_add4)(uint8_t *dst /*align 16*/, const int *blockoffset, + int16_t *block /*align 16*/, int stride, + const uint8_t nnzc[5 * 8]); + void (*idct_add8)(uint8_t **dst /*align 16*/, const int *blockoffset, + int16_t *block /*align 16*/, int stride, + const uint8_t nnzc[15 * 8]); + void (*idct_add16intra)(uint8_t *dst /*align 16*/, const int *blockoffset, + int16_t *block /*align 16*/, + int stride, const uint8_t nnzc[5 * 8]); + void (*luma_dc_dequant_idct)(int16_t *output, + int16_t *input /*align 16*/, int qmul); + void (*chroma_dc_dequant_idct)(int16_t *block, int qmul); /* bypass-transform */ - void (*h264_add_pixels8_clear)(uint8_t *dst, int16_t *block, int stride); - void (*h264_add_pixels4_clear)(uint8_t *dst, int16_t *block, int stride); + void (*add_pixels8_clear)(uint8_t *dst, int16_t *block, int stride); + void (*add_pixels4_clear)(uint8_t *dst, int16_t *block, int stride); /** * Search buf from the start for up to size bytes. Return the index diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264pred.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264pred.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred.c 2026-04-29 18:38:26.000000000 +0000 @@ -592,7 +592,7 @@ ff_h264_pred_init_aarch64(h, codec_id, bit_depth, chroma_format_idc); #elif ARCH_ARM ff_h264_pred_init_arm(h, codec_id, bit_depth, chroma_format_idc); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_h264_pred_init_x86(h, codec_id, bit_depth, chroma_format_idc); #elif ARCH_MIPS ff_h264_pred_init_mips(h, codec_id, bit_depth, chroma_format_idc); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264pred_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/h264pred_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/h264pred_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -113,28 +113,28 @@ #define LOAD_TOP_RIGHT_EDGE\ - const unsigned av_unused t4 = topright[0];\ - const unsigned av_unused t5 = topright[1];\ - const unsigned av_unused t6 = topright[2];\ - const unsigned av_unused t7 = topright[3];\ + av_unused const unsigned t4 = topright[0];\ + av_unused const unsigned t5 = topright[1];\ + av_unused const unsigned t6 = topright[2];\ + av_unused const unsigned t7 = topright[3];\ #define LOAD_DOWN_LEFT_EDGE\ - const unsigned av_unused l4 = src[-1+4*stride];\ - const unsigned av_unused l5 = src[-1+5*stride];\ - const unsigned av_unused l6 = src[-1+6*stride];\ - const unsigned av_unused l7 = src[-1+7*stride];\ + av_unused const unsigned l4 = src[-1+4*stride];\ + av_unused const unsigned l5 = src[-1+5*stride];\ + av_unused const unsigned l6 = src[-1+6*stride];\ + av_unused const unsigned l7 = src[-1+7*stride];\ #define LOAD_LEFT_EDGE\ - const unsigned av_unused l0 = src[-1+0*stride];\ - const unsigned av_unused l1 = src[-1+1*stride];\ - const unsigned av_unused l2 = src[-1+2*stride];\ - const unsigned av_unused l3 = src[-1+3*stride];\ + av_unused const unsigned l0 = src[-1+0*stride];\ + av_unused const unsigned l1 = src[-1+1*stride];\ + av_unused const unsigned l2 = src[-1+2*stride];\ + av_unused const unsigned l3 = src[-1+3*stride];\ #define LOAD_TOP_EDGE\ - const unsigned av_unused t0 = src[ 0-1*stride];\ - const unsigned av_unused t1 = src[ 1-1*stride];\ - const unsigned av_unused t2 = src[ 2-1*stride];\ - const unsigned av_unused t3 = src[ 3-1*stride];\ + av_unused const unsigned t0 = src[ 0-1*stride];\ + av_unused const unsigned t1 = src[ 1-1*stride];\ + av_unused const unsigned t2 = src[ 2-1*stride];\ + av_unused const unsigned t3 = src[ 3-1*stride];\ static void FUNCC(pred4x4_down_right)(uint8_t *_src, const uint8_t *topright, ptrdiff_t _stride) @@ -414,7 +414,6 @@ { int i, j, k; int a; - INIT_CLIP pixel *src = (pixel*)_src; int stride = _stride>>(sizeof(pixel)-1); const pixel * const src0 = src +7-stride; @@ -748,7 +747,6 @@ { int j, k; int a; - INIT_CLIP pixel *src = (pixel*)_src; int stride = _stride>>(sizeof(pixel)-1); const pixel * const src0 = src +3-stride; @@ -784,7 +782,6 @@ { int j, k; int a; - INIT_CLIP pixel *src = (pixel*)_src; int stride = _stride>>(sizeof(pixel)-1); const pixel * const src0 = src +3-stride; @@ -829,7 +826,7 @@ const int l0 = ((has_topleft ? SRC(-1,-1) : SRC(-1,0)) \ + 2*SRC(-1,0) + SRC(-1,1) + 2) >> 2; \ PL(1) PL(2) PL(3) PL(4) PL(5) PL(6) \ - const int l7 av_unused = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2 + av_unused const int l7 = (SRC(-1,6) + 3*SRC(-1,7) + 2) >> 2 #define PT(x) \ const int t##x = (SRC(x-1,-1) + 2*SRC(x,-1) + SRC(x+1,-1) + 2) >> 2; @@ -837,7 +834,7 @@ const int t0 = ((has_topleft ? SRC(-1,-1) : SRC(0,-1)) \ + 2*SRC(0,-1) + SRC(1,-1) + 2) >> 2; \ PT(1) PT(2) PT(3) PT(4) PT(5) PT(6) \ - const int t7 av_unused = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \ + av_unused const int t7 = ((has_topright ? SRC(8,-1) : SRC(7,-1)) \ + 2*SRC(7,-1) + SRC(6,-1) + 2) >> 2 #define PTR(x) \ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/hpeldsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/hpeldsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/hpeldsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/hpeldsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -31,11 +31,12 @@ #include #include -/* add and put pixel (decoding) */ -// blocksizes for hpel_pixels_func are 8x4,8x8 16x8 16x16 -// h for hpel_pixels_func is limited to {width/2, width} but never larger -// than 16 and never smaller than 4 -typedef void (*op_pixels_func)(uint8_t *block /*align width (8 or 16)*/, +/** + * Average and put pixel + * Widths can be 16, 8, 4 or 2. For for widths 2 and 4, h is always a positive + * multiple of 2; otherwise, it is a positive multiple of 4. + */ +typedef void (*op_pixels_func)(uint8_t *block /* align width */, const uint8_t *pixels /*align 1*/, ptrdiff_t line_size, int h); @@ -46,8 +47,8 @@ /** * Halfpel motion compensation with rounding (a+b+1)>>1. * this is an array[4][4] of motion compensation functions for 4 - * horizontal blocksizes (8,16) and the 4 halfpel positions
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] + * horizontal blocksizes (2,4,8,16) and the 4 halfpel positions
+ * *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ] * @param block destination where the result is stored * @param pixels source * @param line_size number of bytes in a horizontal line of block @@ -58,8 +59,8 @@ /** * Halfpel motion compensation with rounding (a+b+1)>>1. * This is an array[4][4] of motion compensation functions for 4 - * horizontal blocksizes (8,16) and the 4 halfpel positions
- * *pixels_tab[ 0->16xH 1->8xH ][ xhalfpel + 2*yhalfpel ] + * horizontal blocksizes (2,4,8,16) and the 4 halfpel positions
+ * *pixels_tab[ 0->16xH 1->8xH 2->4xH 3->2xH ][ xhalfpel + 2*yhalfpel ] * @param block destination into which the result is averaged (a+b+1)>>1 * @param pixels source * @param line_size number of bytes in a horizontal line of block @@ -76,16 +77,16 @@ * @param pixels source * @param line_size number of bytes in a horizontal line of block * @param h height - * @note The size is kept at [4][4] to match the above pixel_tabs and avoid - * out of bounds reads in the motion estimation code. + * @note The size is kept at [3][4] to avoid out of bounds accesses + * in the motion estimation code. */ - op_pixels_func put_no_rnd_pixels_tab[4][4]; + op_pixels_func put_no_rnd_pixels_tab[3][4]; /** * Halfpel motion compensation with no rounding (a+b)>>1. * this is an array[4] of motion compensation functions for 1 * horizontal blocksize (16) and the 4 halfpel positions
- * *pixels_tab[0][ xhalfpel + 2*yhalfpel ] + * *pixels_tab[ xhalfpel + 2*yhalfpel ] * @param block destination into which the result is averaged (a+b)>>1 * @param pixels source * @param line_size number of bytes in a horizontal line of block @@ -97,7 +98,6 @@ void ff_hpeldsp_init(HpelDSPContext *c, int flags); void ff_hpeldsp_init_aarch64(HpelDSPContext *c, int flags); -void ff_hpeldsp_init_alpha(HpelDSPContext *c, int flags); void ff_hpeldsp_init_arm(HpelDSPContext *c, int flags); void ff_hpeldsp_init_ppc(HpelDSPContext *c, int flags); void ff_hpeldsp_init_x86(HpelDSPContext *c, int flags); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/hwaccel_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccel_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/hwaccel_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccel_internal.h 2026-04-29 18:38:26.000000000 +0000 @@ -52,11 +52,13 @@ * Otherwise, this means the whole frame is available at this point. * * @param avctx the codec context + * @param buf_ref the frame data buffer reference (optional) * @param buf the frame data buffer base * @param buf_size the size of the frame in bytes * @return zero if successful, a negative value otherwise */ - int (*start_frame)(AVCodecContext *avctx, const uint8_t *buf, uint32_t buf_size); + int (*start_frame)(AVCodecContext *avctx, const AVBufferRef *buf_ref, + const uint8_t *buf, uint32_t buf_size); /** * Callback for parameter data (SPS/PPS/VPS etc). diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/hwaccels.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccels.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/hwaccels.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/hwaccels.h 2026-04-29 18:38:25.000000000 +0000 @@ -28,6 +28,8 @@ extern const struct FFHWAccel ff_av1_vdpau_hwaccel; extern const struct FFHWAccel ff_av1_videotoolbox_hwaccel; extern const struct FFHWAccel ff_av1_vulkan_hwaccel; +extern const struct FFHWAccel ff_dpx_vulkan_hwaccel; +extern const struct FFHWAccel ff_ffv1_vulkan_hwaccel; extern const struct FFHWAccel ff_h263_vaapi_hwaccel; extern const struct FFHWAccel ff_h263_videotoolbox_hwaccel; extern const struct FFHWAccel ff_h264_d3d11va_hwaccel; @@ -66,6 +68,8 @@ extern const struct FFHWAccel ff_mpeg4_vdpau_hwaccel; extern const struct FFHWAccel ff_mpeg4_videotoolbox_hwaccel; extern const struct FFHWAccel ff_prores_videotoolbox_hwaccel; +extern const struct FFHWAccel ff_prores_vulkan_hwaccel; +extern const struct FFHWAccel ff_prores_raw_vulkan_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va_hwaccel; extern const struct FFHWAccel ff_vc1_d3d11va2_hwaccel; extern const struct FFHWAccel ff_vc1_d3d12va_hwaccel; @@ -83,6 +87,7 @@ extern const struct FFHWAccel ff_vp9_vaapi_hwaccel; extern const struct FFHWAccel ff_vp9_vdpau_hwaccel; extern const struct FFHWAccel ff_vp9_videotoolbox_hwaccel; +extern const struct FFHWAccel ff_vp9_vulkan_hwaccel; extern const struct FFHWAccel ff_vvc_vaapi_hwaccel; extern const struct FFHWAccel ff_wmv3_d3d11va_hwaccel; extern const struct FFHWAccel ff_wmv3_d3d11va2_hwaccel; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/idctdsp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/idctdsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.c 2026-04-29 18:38:25.000000000 +0000 @@ -41,7 +41,7 @@ { int i; -#if ARCH_X86 +#if ARCH_X86 && HAVE_X86ASM if (ff_init_scantable_permutation_x86(idct_permutation, perm_type)) return; @@ -276,6 +276,10 @@ c->idct = ff_faanidct; c->perm_type = FF_IDCT_PERM_NONE; #endif /* CONFIG_FAANIDCT */ +#if CONFIG_MPEG4_DECODER + } else if (avctx->idct_algo == FF_IDCT_XVID) { + ff_xvid_idct_init(c); +#endif } else { // accurate/default c->idct_put = ff_simple_idct_put_int16_8bit; c->idct_add = ff_simple_idct_add_int16_8bit; @@ -289,9 +293,6 @@ c->put_signed_pixels_clamped = put_signed_pixels_clamped_c; c->add_pixels_clamped = ff_add_pixels_clamped_c; - if (CONFIG_MPEG4_DECODER && avctx->idct_algo == FF_IDCT_XVID) - ff_xvid_idct_init(c, avctx); - #if ARCH_AARCH64 ff_idctdsp_init_aarch64(c, avctx, high_bit_depth); #elif ARCH_ARM @@ -300,7 +301,7 @@ ff_idctdsp_init_ppc(c, avctx, high_bit_depth); #elif ARCH_RISCV ff_idctdsp_init_riscv(c, avctx, high_bit_depth); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_idctdsp_init_x86(c, avctx, high_bit_depth); #elif ARCH_MIPS ff_idctdsp_init_mips(c, avctx, high_bit_depth); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/idctdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/idctdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/idctdsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -98,8 +98,6 @@ void ff_idctdsp_init_aarch64(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth); -void ff_idctdsp_init_alpha(IDCTDSPContext *c, struct AVCodecContext *avctx, - unsigned high_bit_depth); void ff_idctdsp_init_arm(IDCTDSPContext *c, struct AVCodecContext *avctx, unsigned high_bit_depth); void ff_idctdsp_init_ppc(IDCTDSPContext *c, struct AVCodecContext *avctx, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/imgconvert.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/imgconvert.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/imgconvert.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/imgconvert.c 2026-04-29 18:38:25.000000000 +0000 @@ -45,4 +45,3 @@ *loss_ptr = loss; return best; } - diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -145,15 +145,6 @@ AVFrame *buffer_frame; int draining_done; -#if FF_API_DROPCHANGED - /* used when avctx flag AV_CODEC_FLAG_DROPCHANGED is set */ - int changed_frames_dropped; - int initial_format; - int initial_width, initial_height; - int initial_sample_rate; - AVChannelLayout initial_ch_layout; -#endif - #if CONFIG_LCMS2 FFIccContext icc; /* used to read and write embedded ICC profiles */ #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/itut35.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/itut35.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/itut35.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/itut35.h 2026-04-29 18:38:25.000000000 +0000 @@ -23,10 +23,19 @@ #define ITU_T_T35_COUNTRY_CODE_UK 0xB4 #define ITU_T_T35_COUNTRY_CODE_US 0xB5 -#define ITU_T_T35_PROVIDER_CODE_ATSC 0x31 -#define ITU_T_T35_PROVIDER_CODE_CUVA 0x04 -#define ITU_T_T35_PROVIDER_CODE_DOLBY 0x3B -#define ITU_T_T35_PROVIDER_CODE_LCEVC 0x50 -#define ITU_T_T35_PROVIDER_CODE_SMTPE 0x3C +// The Terminal Provider Code (or "Manufacturer Code") identifies the +// manufacturer within a country. An Assignment Authority appointed by the +// national body assigns this code nationally. The manufacturer code is always +// used in conjunction with a country code. +// - CN providers +#define ITU_T_T35_PROVIDER_CODE_HDR_VIVID 0x0004 +// - UK providers +// https://www.cix.co.uk/~bpechey/H221/h221code.htm +#define ITU_T_T35_PROVIDER_CODE_VNOVA 0x5000 +// - US providers +#define ITU_T_T35_PROVIDER_CODE_ATSC 0x0031 +#define ITU_T_T35_PROVIDER_CODE_DOLBY 0x003B +#define ITU_T_T35_PROVIDER_CODE_AOM 0x5890 +#define ITU_T_T35_PROVIDER_CODE_SAMSUNG 0x003C #endif /* AVCODEC_ITUT35_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/jrevdct.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/jrevdct.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/jrevdct.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/jrevdct.c 2026-04-29 18:38:26.000000000 +0000 @@ -1159,13 +1159,13 @@ #undef FIX #undef CONST_BITS -void ff_jref_idct_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block) +void ff_jref_idct_put(uint8_t *dest, ptrdiff_t line_size, int16_t block[64]) { ff_j_rev_dct(block); ff_put_pixels_clamped_c(block, dest, line_size); } -void ff_jref_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block) +void ff_jref_idct_add(uint8_t *dest, ptrdiff_t line_size, int16_t block[64]) { ff_j_rev_dct(block); ff_add_pixels_clamped_c(block, dest, line_size); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/lcevcdec.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/lcevcdec.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/lcevcdec.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/lcevcdec.h 2026-04-29 18:38:26.000000000 +0000 @@ -1,33 +1,53 @@ -/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* vim:set ts=2 sw=2 sts=2 et cindent: */ -/* This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +/* + * 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 + */ -/* Stubs for lcevcdec.{c,h} */ #ifndef AVCODEC_LCEVCDEC_H #define AVCODEC_LCEVCDEC_H -#include "config_components.h" +#include "config.h" #include +#if CONFIG_LIBLCEVC_DEC +#include +#else typedef uintptr_t LCEVC_DecoderHandle; +#endif + +struct CodedBitstreamContext; +struct CodedBitstreamFragment; typedef struct FFLCEVCContext { LCEVC_DecoderHandle decoder; + struct CodedBitstreamContext *cbc; + struct CodedBitstreamFragment *frag; int initialized; } FFLCEVCContext; struct AVFrame; -static int ff_lcevc_alloc(FFLCEVCContext **plcevc) { - return 0; -} - -static int ff_lcevc_process(void *logctx, struct AVFrame *frame) { - return 0; -} - -static void ff_lcevc_unref(void *opaque) {} - +typedef struct FFLCEVCFrame { + FFLCEVCContext *lcevc; + struct AVFrame *frame; +} FFLCEVCFrame; + +int ff_lcevc_alloc(FFLCEVCContext **plcevc, void *logctx); +int ff_lcevc_process(void *logctx, struct AVFrame *frame); +int ff_lcevc_parse_frame(FFLCEVCContext *lcevc, const struct AVFrame *frame, + enum AVPixelFormat *format, int *width, int *height, void *logctx); +void ff_lcevc_unref(void *opaque); #endif /* AVCODEC_LCEVCDEC_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libaomenc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libaomenc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libaomenc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libaomenc.c 2026-04-29 18:38:26.000000000 +0000 @@ -32,8 +32,8 @@ #include "libavutil/avassert.h" #include "libavutil/avstring.h" #include "libavutil/base64.h" -#include "libavutil/common.h" #include "libavutil/cpu.h" +#include "libavutil/hdr_dynamic_metadata.h" #include "libavutil/imgutils.h" #include "libavutil/mathematics.h" #include "libavutil/mem.h" @@ -43,12 +43,13 @@ #include "av1.h" #include "avcodec.h" #include "bsf.h" +#include "bytestream.h" #include "codec_internal.h" #include "dovi_rpu.h" #include "encode.h" #include "internal.h" +#include "itut35.h" #include "libaom.h" -#include "packet_internal.h" #include "profiles.h" /* @@ -142,6 +143,8 @@ AVDictionary *aom_params; } AOMContext; +#define OFFSET(x) offsetof(AOMContext, x) + static const char *const ctlidstr[] = { [AOME_SET_CPUUSED] = "AOME_SET_CPUUSED", [AOME_SET_CQ_LEVEL] = "AOME_SET_CQ_LEVEL", @@ -240,7 +243,7 @@ width, "g_pass:", cfg->g_pass, width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" - " %*s%u\n %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", + " %*s%u\n %*s%d\n %*s%p(%zu)\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_end_usage:", cfg->rc_end_usage, width, "rc_twopass_stats_in:", cfg->rc_twopass_stats_in.buf, cfg->rc_twopass_stats_in.sz, @@ -303,11 +306,7 @@ } static av_cold int codecctl_int(AVCodecContext *avctx, -#ifdef UENUM1BYTE - aome_enc_control_id id, -#else - enum aome_enc_control_id id, -#endif + int id, int val) { AOMContext *ctx = avctx->priv_data; @@ -329,15 +328,58 @@ return 0; } +static int add_hdr_plus(AVCodecContext *avctx, struct aom_image *img, const AVFrame *frame) +{ + // Check for HDR10+ + AVFrameSideData *side_data = + av_frame_get_side_data(frame, AV_FRAME_DATA_DYNAMIC_HDR_PLUS); + if (!side_data) + return 0; + + size_t payload_size; + AVDynamicHDRPlus *hdr_plus = (AVDynamicHDRPlus *)side_data->buf->data; + int res = av_dynamic_hdr_plus_to_t35(hdr_plus, NULL, &payload_size); + if (res < 0) { + log_encoder_error(avctx, "Error finding the size of HDR10+"); + return res; + } + + uint8_t *hdr_plus_buf; + // Extra bytes for the country code, provider code, provider oriented code and app id. + const size_t hdr_plus_buf_size = payload_size + 6; + hdr_plus_buf = av_malloc(hdr_plus_buf_size); + if (!hdr_plus_buf) + return AVERROR(ENOMEM); + + uint8_t *payload = hdr_plus_buf; + // See "HDR10+ AV1 Metadata Handling Specification" v1.0.1, Section 2.1. + bytestream_put_byte(&payload, ITU_T_T35_COUNTRY_CODE_US); + bytestream_put_be16(&payload, ITU_T_T35_PROVIDER_CODE_SAMSUNG); + bytestream_put_be16(&payload, 0x0001); // provider_oriented_code + bytestream_put_byte(&payload, 0x04); // application_identifier + + res = av_dynamic_hdr_plus_to_t35(hdr_plus, &payload, &payload_size); + if (res < 0) { + av_free(hdr_plus_buf); + log_encoder_error(avctx, "Error encoding HDR10+ from side data"); + return res; + } + + res = aom_img_add_metadata(img, OBU_METADATA_TYPE_ITUT_T35, + hdr_plus_buf, hdr_plus_buf_size, AOM_MIF_ANY_FRAME); + av_free(hdr_plus_buf); + if (res < 0) { + log_encoder_error(avctx, "Error adding HDR10+ to aom_img"); + return res; + } + return 0; +} + #if defined(AOM_CTRL_AV1E_GET_NUM_OPERATING_POINTS) && \ defined(AOM_CTRL_AV1E_GET_SEQ_LEVEL_IDX) && \ defined(AOM_CTRL_AV1E_GET_TARGET_SEQ_LEVEL_IDX) static av_cold int codecctl_intp(AVCodecContext *avctx, -#ifdef UENUM1BYTE - aome_enc_control_id id, -#else - enum aome_enc_control_id id, -#endif + int id, int* ptr) { AOMContext *ctx = avctx->priv_data; @@ -345,27 +387,23 @@ int width = -30; int res; - snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]); - av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr); - res = aom_codec_control(&ctx->encoder, id, ptr); if (res != AOM_CODEC_OK) { - snprintf(buf, sizeof(buf), "Failed to set %s codec control", + snprintf(buf, sizeof(buf), "Failed to get %s codec control", ctlidstr[id]); log_encoder_error(avctx, buf); return AVERROR(EINVAL); } + snprintf(buf, sizeof(buf), "%s:", ctlidstr[id]); + av_log(avctx, AV_LOG_DEBUG, " %*s%d\n", width, buf, *ptr); + return 0; } #endif static av_cold int codecctl_imgp(AVCodecContext *avctx, -#ifdef UENUM1BYTE - aome_enc_control_id id, -#else - enum aome_enc_control_id id, -#endif + int id, struct aom_image *img) { AOMContext *ctx = avctx->priv_data; @@ -472,7 +510,6 @@ struct aom_codec_enc_cfg *enccfg, aom_codec_flags_t *flags, aom_img_fmt_t *img_fmt) { - AOMContext av_unused *ctx = avctx->priv_data; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); enccfg->g_bit_depth = enccfg->g_input_bit_depth = desc->comp[0].depth; switch (avctx->pix_fmt) { @@ -713,6 +750,46 @@ return 0; } + +static const struct { + int aom_enum; + unsigned offset; +} option_map[] = { + { AOME_SET_ENABLEAUTOALTREF, OFFSET(auto_alt_ref) }, + { AOME_SET_ARNR_MAXFRAMES, OFFSET(arnr_max_frames) }, + { AOME_SET_ARNR_STRENGTH, OFFSET(arnr_strength) }, + { AV1E_SET_ENABLE_CDEF, OFFSET(enable_cdef) }, + { AV1E_SET_ENABLE_RESTORATION, OFFSET(enable_restoration) }, + { AV1E_SET_ENABLE_RECT_PARTITIONS, OFFSET(enable_rect_partitions) }, + { AV1E_SET_ENABLE_1TO4_PARTITIONS, OFFSET(enable_1to4_partitions) }, + { AV1E_SET_ENABLE_AB_PARTITIONS, OFFSET(enable_ab_partitions) }, + { AV1E_SET_ENABLE_ANGLE_DELTA, OFFSET(enable_angle_delta) }, + { AV1E_SET_ENABLE_CFL_INTRA, OFFSET(enable_cfl_intra) }, + { AV1E_SET_ENABLE_FILTER_INTRA, OFFSET(enable_filter_intra) }, + { AV1E_SET_ENABLE_INTRA_EDGE_FILTER, OFFSET(enable_intra_edge_filter) }, + { AV1E_SET_ENABLE_PAETH_INTRA, OFFSET(enable_paeth_intra) }, + { AV1E_SET_ENABLE_SMOOTH_INTRA, OFFSET(enable_smooth_intra) }, + { AV1E_SET_ENABLE_PALETTE, OFFSET(enable_palette) }, + { AV1E_SET_ENABLE_TX64, OFFSET(enable_tx64) }, + { AV1E_SET_ENABLE_FLIP_IDTX, OFFSET(enable_flip_idtx) }, + { AV1E_SET_INTRA_DCT_ONLY, OFFSET(use_intra_dct_only) }, + { AV1E_SET_INTER_DCT_ONLY, OFFSET(use_inter_dct_only) }, + { AV1E_SET_INTRA_DEFAULT_TX_ONLY, OFFSET(use_intra_default_tx_only) }, + { AV1E_SET_REDUCED_TX_TYPE_SET, OFFSET(reduced_tx_type_set) }, + { AV1E_SET_ENABLE_REF_FRAME_MVS, OFFSET(enable_ref_frame_mvs) }, + { AV1E_SET_REDUCED_REFERENCE_SET, OFFSET(enable_reduced_reference_set) }, + { AV1E_SET_ENABLE_DIFF_WTD_COMP, OFFSET(enable_diff_wtd_comp) }, + { AV1E_SET_ENABLE_DIST_WTD_COMP, OFFSET(enable_dist_wtd_comp) }, + { AV1E_SET_ENABLE_DUAL_FILTER, OFFSET(enable_dual_filter) }, + { AV1E_SET_ENABLE_INTERINTER_WEDGE, OFFSET(enable_interinter_wedge) }, + { AV1E_SET_ENABLE_MASKED_COMP, OFFSET(enable_masked_comp) }, + { AV1E_SET_ENABLE_INTERINTRA_COMP, OFFSET(enable_interintra_comp) }, + { AV1E_SET_ENABLE_INTERINTRA_WEDGE, OFFSET(enable_interintra_wedge) }, + { AV1E_SET_ENABLE_OBMC, OFFSET(enable_obmc) }, + { AV1E_SET_ENABLE_ONESIDED_COMP, OFFSET(enable_onesided_comp) }, + { AV1E_SET_ENABLE_SMOOTH_INTERINTRA, OFFSET(enable_smooth_interintra) }, +}; + static av_cold int aom_init(AVCodecContext *avctx, const struct aom_codec_iface *iface) { @@ -721,7 +798,6 @@ struct aom_codec_enc_cfg enccfg = { 0 }; aom_codec_flags_t flags = (avctx->flags & AV_CODEC_FLAG_PSNR) ? AOM_CODEC_USE_PSNR : 0; - AVCPBProperties *cpb_props; int res; aom_img_fmt_t img_fmt; aom_codec_caps_t codec_caps = aom_codec_get_caps(iface); @@ -848,7 +924,7 @@ ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, - "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", + "Stat buffer alloc (%zu bytes) failed\n", ctx->twopass_stats.sz); ctx->twopass_stats.sz = 0; return ret; @@ -900,73 +976,12 @@ // codec control failures are currently treated only as warnings av_log(avctx, AV_LOG_DEBUG, "aom_codec_control\n"); codecctl_int(avctx, AOME_SET_CPUUSED, ctx->cpu_used); - if (ctx->auto_alt_ref >= 0) - codecctl_int(avctx, AOME_SET_ENABLEAUTOALTREF, ctx->auto_alt_ref); - if (ctx->arnr_max_frames >= 0) - codecctl_int(avctx, AOME_SET_ARNR_MAXFRAMES, ctx->arnr_max_frames); - if (ctx->arnr_strength >= 0) - codecctl_int(avctx, AOME_SET_ARNR_STRENGTH, ctx->arnr_strength); - if (ctx->enable_cdef >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_CDEF, ctx->enable_cdef); - if (ctx->enable_restoration >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_RESTORATION, ctx->enable_restoration); - if (ctx->enable_rect_partitions >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_RECT_PARTITIONS, ctx->enable_rect_partitions); - if (ctx->enable_1to4_partitions >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_1TO4_PARTITIONS, ctx->enable_1to4_partitions); - if (ctx->enable_ab_partitions >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_AB_PARTITIONS, ctx->enable_ab_partitions); - if (ctx->enable_angle_delta >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_ANGLE_DELTA, ctx->enable_angle_delta); - if (ctx->enable_cfl_intra >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_CFL_INTRA, ctx->enable_cfl_intra); - if (ctx->enable_filter_intra >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_FILTER_INTRA, ctx->enable_filter_intra); - if (ctx->enable_intra_edge_filter >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_INTRA_EDGE_FILTER, ctx->enable_intra_edge_filter); - if (ctx->enable_paeth_intra >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_PAETH_INTRA, ctx->enable_paeth_intra); - if (ctx->enable_smooth_intra >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTRA, ctx->enable_smooth_intra); - if (ctx->enable_palette >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_PALETTE, ctx->enable_palette); - if (ctx->enable_tx64 >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_TX64, ctx->enable_tx64); - if (ctx->enable_flip_idtx >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_FLIP_IDTX, ctx->enable_flip_idtx); - if (ctx->use_intra_dct_only >= 0) - codecctl_int(avctx, AV1E_SET_INTRA_DCT_ONLY, ctx->use_intra_dct_only); - if (ctx->use_inter_dct_only >= 0) - codecctl_int(avctx, AV1E_SET_INTER_DCT_ONLY, ctx->use_inter_dct_only); - if (ctx->use_intra_default_tx_only >= 0) - codecctl_int(avctx, AV1E_SET_INTRA_DEFAULT_TX_ONLY, ctx->use_intra_default_tx_only); - if (ctx->reduced_tx_type_set >= 0) - codecctl_int(avctx, AV1E_SET_REDUCED_TX_TYPE_SET, ctx->reduced_tx_type_set); - if (ctx->enable_ref_frame_mvs >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_REF_FRAME_MVS, ctx->enable_ref_frame_mvs); - if (ctx->enable_reduced_reference_set >= 0) - codecctl_int(avctx, AV1E_SET_REDUCED_REFERENCE_SET, ctx->enable_reduced_reference_set); - if (ctx->enable_diff_wtd_comp >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_DIFF_WTD_COMP, ctx->enable_diff_wtd_comp); - if (ctx->enable_dist_wtd_comp >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_DIST_WTD_COMP, ctx->enable_dist_wtd_comp); - if (ctx->enable_dual_filter >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_DUAL_FILTER, ctx->enable_dual_filter); - if (ctx->enable_interinter_wedge >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_INTERINTER_WEDGE, ctx->enable_interinter_wedge); - if (ctx->enable_masked_comp >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_MASKED_COMP, ctx->enable_masked_comp); - if (ctx->enable_interintra_comp >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_INTERINTRA_COMP, ctx->enable_interintra_comp); - if (ctx->enable_interintra_wedge >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_INTERINTRA_WEDGE, ctx->enable_interintra_wedge); - if (ctx->enable_obmc >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_OBMC, ctx->enable_obmc); - if (ctx->enable_onesided_comp >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_ONESIDED_COMP, ctx->enable_onesided_comp); - if (ctx->enable_smooth_interintra >= 0) - codecctl_int(avctx, AV1E_SET_ENABLE_SMOOTH_INTERINTRA, ctx->enable_smooth_interintra); + for (size_t i = 0; i < FF_ARRAY_ELEMS(option_map); ++i) { + int val = *(int*)((char*)ctx + option_map[i].offset); + if (val >= 0) + codecctl_int(avctx, option_map[i].aom_enum, val); + } codecctl_int(avctx, AOME_SET_STATIC_THRESHOLD, ctx->static_thresh); if (ctx->crf >= 0) codecctl_int(avctx, AOME_SET_CQ_LEVEL, ctx->crf); @@ -1064,10 +1079,6 @@ if (codec_caps & AOM_CODEC_CAP_HIGHBITDEPTH) ctx->rawimg.bit_depth = enccfg.g_bit_depth; - cpb_props = ff_encode_add_cpb_side_data(avctx); - if (!cpb_props) - return AVERROR(ENOMEM); - ctx->dovi.logctx = avctx; if ((res = ff_dovi_configure(&ctx->dovi, avctx)) < 0) return res; @@ -1094,6 +1105,10 @@ return ret; } + AVCPBProperties *cpb_props = ff_encode_add_cpb_side_data(avctx); + if (!cpb_props) + return AVERROR(ENOMEM); + if (enccfg.rc_end_usage == AOM_CBR || enccfg.g_pass != AOM_RC_ONE_PASS) { cpb_props->max_bitrate = avctx->rc_max_rate; @@ -1135,11 +1150,11 @@ AVPacket *pkt) { AOMContext *ctx = avctx->priv_data; - int av_unused pict_type; + enum AVPictureType pict_type; int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, - "Error getting output packet of size %"SIZE_SPECIFIER".\n", cx_frame->sz); + "Error getting output packet of size %zu.\n", cx_frame->sz); return ret; } memcpy(pkt->data, cx_frame->buf, pkt->size); @@ -1155,8 +1170,8 @@ pict_type = AV_PICTURE_TYPE_P; } - ff_side_data_set_encoder_stats(pkt, 0, cx_frame->sse + 1, - cx_frame->have_sse ? 3 : 0, pict_type); + ff_encode_add_stats_side_data(pkt, 0, cx_frame->sse + 1, + cx_frame->have_sse ? 3 : 0, pict_type); if (cx_frame->have_sse) { int i; @@ -1238,7 +1253,7 @@ if (!cx_frame->buf) { av_log(avctx, AV_LOG_ERROR, - "Data buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", + "Data buffer alloc (%zu bytes) failed\n", cx_frame->sz); av_freep(&cx_frame); return AVERROR(ENOMEM); @@ -1329,6 +1344,7 @@ if (frame) { rawimg = &ctx->rawimg; + aom_img_remove_metadata(rawimg); rawimg->planes[AOM_PLANE_Y] = frame->data[0]; rawimg->planes[AOM_PLANE_U] = frame->data[1]; rawimg->planes[AOM_PLANE_V] = frame->data[2]; @@ -1345,13 +1361,7 @@ else if (avctx->framerate.num > 0 && avctx->framerate.den > 0) duration = av_rescale_q(1, av_inv_q(avctx->framerate), avctx->time_base); else { -FF_DISABLE_DEPRECATION_WARNINGS - duration = -#if FF_API_TICKS_PER_FRAME - avctx->ticks_per_frame ? avctx->ticks_per_frame : -#endif - 1; -FF_ENABLE_DEPRECATION_WARNINGS + duration = 1; } switch (frame->color_range) { @@ -1404,6 +1414,10 @@ return res; } } + + res = add_hdr_plus(avctx, rawimg, frame); + if (res < 0) + return res; } res = aom_codec_encode(&ctx->encoder, rawimg, timestamp, duration, flags); @@ -1420,7 +1434,7 @@ avctx->stats_out = av_malloc(b64_size); if (!avctx->stats_out) { - av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", + av_log(avctx, AV_LOG_ERROR, "Stat buffer alloc (%zu bytes) failed\n", b64_size); return AVERROR(ENOMEM); } @@ -1558,7 +1572,6 @@ return aom_init(avctx, aom_codec_av1_cx()); } -#define OFFSET(x) offsetof(AOMContext, x) #define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM static const AVOption options[] = { { "cpu-used", "Quality/Speed ratio modifier", OFFSET(cpu_used), AV_OPT_TYPE_INT, {.i64 = 1}, 0, 8, VE}, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libdav1d.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libdav1d.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libdav1d.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libdav1d.c 2026-04-29 18:38:25.000000000 +0000 @@ -50,8 +50,6 @@ int pool_size; Dav1dData data; - int tile_threads; - int frame_threads; int max_frame_delay; int apply_grain; int operating_point; @@ -145,15 +143,14 @@ c->chroma_sample_location = AVCHROMA_LOC_TOPLEFT; break; } - c->colorspace = (enum AVColorSpace) seq->mtrx; - c->color_primaries = (enum AVColorPrimaries) seq->pri; - c->color_trc = (enum AVColorTransferCharacteristic) seq->trc; + if (seq->color_description_present) { + c->colorspace = (enum AVColorSpace) seq->mtrx; + c->color_primaries = (enum AVColorPrimaries) seq->pri; + c->color_trc = (enum AVColorTransferCharacteristic) seq->trc; + } c->color_range = seq->color_range ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG; - if (seq->layout == DAV1D_PIXEL_LAYOUT_I444 && - seq->mtrx == DAV1D_MC_IDENTITY && - seq->pri == DAV1D_COLOR_PRI_BT709 && - seq->trc == DAV1D_TRC_SRGB) + if (seq->layout == DAV1D_PIXEL_LAYOUT_I444 && c->colorspace == AVCOL_SPC_RGB) c->pix_fmt = pix_fmt_rgb[seq->hbd]; else c->pix_fmt = pix_fmt[seq->layout][seq->hbd]; @@ -215,11 +212,7 @@ { Libdav1dContext *dav1d = c->priv_data; Dav1dSettings s; -#if FF_DAV1D_VERSION_AT_LEAST(6,0) int threads = c->thread_count; -#else - int threads = (c->thread_count ? c->thread_count : av_cpu_count()) * 3 / 2; -#endif const AVPacketSideData *sd; int res; @@ -240,32 +233,14 @@ s.all_layers = dav1d->all_layers; if (dav1d->operating_point >= 0) s.operating_point = dav1d->operating_point; -#if FF_DAV1D_VERSION_AT_LEAST(6,2) s.strict_std_compliance = c->strict_std_compliance > 0; -#endif -#if FF_DAV1D_VERSION_AT_LEAST(6,0) - if (dav1d->frame_threads || dav1d->tile_threads) - s.n_threads = FFMAX(dav1d->frame_threads, dav1d->tile_threads); - else - s.n_threads = FFMIN(threads, DAV1D_MAX_THREADS); + s.n_threads = FFMIN(threads, DAV1D_MAX_THREADS); if (dav1d->max_frame_delay > 0 && (c->flags & AV_CODEC_FLAG_LOW_DELAY)) av_log(c, AV_LOG_WARNING, "Low delay mode requested, forcing max_frame_delay 1\n"); s.max_frame_delay = (c->flags & AV_CODEC_FLAG_LOW_DELAY) ? 1 : dav1d->max_frame_delay; av_log(c, AV_LOG_DEBUG, "Using %d threads, %d max_frame_delay\n", s.n_threads, s.max_frame_delay); -#else - s.n_tile_threads = dav1d->tile_threads - ? dav1d->tile_threads - : FFMIN(floor(sqrt(threads)), DAV1D_MAX_TILE_THREADS); - s.n_frame_threads = dav1d->frame_threads - ? dav1d->frame_threads - : FFMIN(ceil(threads / s.n_tile_threads), DAV1D_MAX_FRAME_THREADS); - if (dav1d->max_frame_delay > 0) - s.n_frame_threads = FFMIN(s.n_frame_threads, dav1d->max_frame_delay); - av_log(c, AV_LOG_DEBUG, "Using %d frame threads, %d tile threads\n", - s.n_frame_threads, s.n_tile_threads); -#endif #if FF_DAV1D_VERSION_AT_LEAST(6,8) if (c->skip_frame >= AVDISCARD_NONKEY) @@ -386,14 +361,130 @@ return res; } +static int parse_itut_t35_metadata(Libdav1dContext *dav1d, Dav1dPicture *p, + const Dav1dITUTT35 *itut_t35, AVCodecContext *c, + AVFrame *frame) { + GetByteContext gb; + int provider_code, country_code; + int res; + + bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size); + + country_code = itut_t35->country_code; + switch (country_code) { + case ITU_T_T35_COUNTRY_CODE_US: + if (bytestream2_get_bytes_left(&gb) < 2) + return AVERROR_INVALIDDATA; + provider_code = bytestream2_get_be16u(&gb); + + switch (provider_code) { + case ITU_T_T35_PROVIDER_CODE_ATSC: { + uint32_t user_identifier = bytestream2_get_be32(&gb); + switch (user_identifier) { + case MKBETAG('G', 'A', '9', '4'): { // closed captions + AVBufferRef *buf = NULL; + + res = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb)); + if (res < 0) + return res; + if (!res) + return 0; // no cc found, ignore + + res = ff_frame_new_side_data_from_buf(c, frame, AV_FRAME_DATA_A53_CC, &buf); + if (res < 0) + return res; + +#if FF_API_CODEC_PROPS +FF_DISABLE_DEPRECATION_WARNINGS + c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; +FF_ENABLE_DEPRECATION_WARNINGS +#endif + break; + } + default: // ignore unsupported identifiers + break; + } + break; + } + case ITU_T_T35_PROVIDER_CODE_SAMSUNG: { + AVDynamicHDRPlus *hdrplus; + int provider_oriented_code = bytestream2_get_be16(&gb); + int application_identifier = bytestream2_get_byte(&gb); + + if (provider_oriented_code != 1 || application_identifier != 4) + return 0; // ignore + + hdrplus = av_dynamic_hdr_plus_create_side_data(frame); + if (!hdrplus) + return AVERROR(ENOMEM); + + res = av_dynamic_hdr_plus_from_t35(hdrplus, gb.buffer, + bytestream2_get_bytes_left(&gb)); + if (res < 0) + return res; + break; + } + case ITU_T_T35_PROVIDER_CODE_DOLBY: { + int provider_oriented_code = bytestream2_get_be32(&gb); + if (provider_oriented_code != 0x800) + return 0; // ignore + + res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, bytestream2_get_bytes_left(&gb), + c->err_recognition); + if (res < 0) { + av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); + return 0; // ignore + } + + res = ff_dovi_attach_side_data(&dav1d->dovi, frame); + if (res < 0) + return res; + break; + } + default: + break; + } + break; + case ITU_T_T35_COUNTRY_CODE_UK: + bytestream2_skipu(&gb, 1); // t35_uk_country_code_second_octet + if (bytestream2_get_bytes_left(&gb) < 2) + return AVERROR_INVALIDDATA; + + provider_code = bytestream2_get_be16u(&gb); + switch (provider_code) { + case ITU_T_T35_PROVIDER_CODE_VNOVA: { + AVFrameSideData *sd; + if (bytestream2_get_bytes_left(&gb) < 2) + return AVERROR_INVALIDDATA; + + res = ff_frame_new_side_data(c, frame, AV_FRAME_DATA_LCEVC, + bytestream2_get_bytes_left(&gb), &sd); + if (res < 0) + return res; + if (!sd) + break; + + bytestream2_get_bufferu(&gb, sd->data, sd->size); + break; + } + default: + break; + } + break; + + default: + // ignore unsupported provider codes + break; + } + return 0; +} + static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame) { Libdav1dContext *dav1d = c->priv_data; Dav1dPicture pic = { 0 }, *p = &pic; const AVPacket *pkt; -#if FF_DAV1D_VERSION_AT_LEAST(5,1) enum Dav1dEventFlags event_flags = 0; -#endif int res; do { @@ -419,12 +510,10 @@ frame->linesize[1] = p->stride[1]; frame->linesize[2] = p->stride[1]; -#if FF_DAV1D_VERSION_AT_LEAST(5,1) dav1d_get_event_flags(dav1d->c, &event_flags); - if (c->pix_fmt == AV_PIX_FMT_NONE || - event_flags & DAV1D_EVENT_FLAG_NEW_SEQUENCE) -#endif - libdav1d_init_params(c, p->seq_hdr); + if (c->pix_fmt == AV_PIX_FMT_NONE || event_flags & DAV1D_EVENT_FLAG_NEW_SEQUENCE) + libdav1d_init_params(c, p->seq_hdr); + res = ff_decode_frame_props(c, frame); if (res < 0) goto fail; @@ -514,83 +603,9 @@ #else const Dav1dITUTT35 *itut_t35 = p->itut_t35; #endif - GetByteContext gb; - int provider_code; - - bytestream2_init(&gb, itut_t35->payload, itut_t35->payload_size); - - provider_code = bytestream2_get_be16(&gb); - switch (provider_code) { - case ITU_T_T35_PROVIDER_CODE_ATSC: { - uint32_t user_identifier = bytestream2_get_be32(&gb); - switch (user_identifier) { - case MKBETAG('G', 'A', '9', '4'): { // closed captions - AVBufferRef *buf = NULL; - - res = ff_parse_a53_cc(&buf, gb.buffer, bytestream2_get_bytes_left(&gb)); - if (res < 0) - goto fail; - if (!res) - break; - - res = ff_frame_new_side_data_from_buf(c, frame, AV_FRAME_DATA_A53_CC, &buf); - if (res < 0) - goto fail; - -#if FF_API_CODEC_PROPS -FF_DISABLE_DEPRECATION_WARNINGS - c->properties |= FF_CODEC_PROPERTY_CLOSED_CAPTIONS; -FF_ENABLE_DEPRECATION_WARNINGS -#endif - break; - } - default: // ignore unsupported identifiers - break; - } - break; - } - case ITU_T_T35_PROVIDER_CODE_SMTPE: { - AVDynamicHDRPlus *hdrplus; - int provider_oriented_code = bytestream2_get_be16(&gb); - int application_identifier = bytestream2_get_byte(&gb); - - if (itut_t35->country_code != ITU_T_T35_COUNTRY_CODE_US || - provider_oriented_code != 1 || application_identifier != 4) - break; - - hdrplus = av_dynamic_hdr_plus_create_side_data(frame); - if (!hdrplus) { - res = AVERROR(ENOMEM); - goto fail; - } - - res = av_dynamic_hdr_plus_from_t35(hdrplus, gb.buffer, - bytestream2_get_bytes_left(&gb)); - if (res < 0) - goto fail; - break; - } - case ITU_T_T35_PROVIDER_CODE_DOLBY: { - int provider_oriented_code = bytestream2_get_be32(&gb); - if (itut_t35->country_code != ITU_T_T35_COUNTRY_CODE_US || - provider_oriented_code != 0x800) - break; - - res = ff_dovi_rpu_parse(&dav1d->dovi, gb.buffer, gb.buffer_end - gb.buffer, - c->err_recognition); - if (res < 0) { - av_log(c, AV_LOG_WARNING, "Error parsing DOVI OBU.\n"); - break; // ignore - } - - res = ff_dovi_attach_side_data(&dav1d->dovi, frame); - if (res < 0) - goto fail; - break; - } - default: // ignore unsupported provider codes - break; - } + res = parse_itut_t35_metadata(dav1d, p, itut_t35, c, frame); + if (res < 0) + goto fail; #if FF_DAV1D_VERSION_AT_LEAST(6,9) } #endif @@ -644,6 +659,10 @@ sizeof(fgp->codec.aom.uv_offset)); } + res = ff_attach_decode_data(c, frame); + if (res < 0) + return res; + res = 0; fail: dav1d_picture_unref(p); @@ -677,8 +696,6 @@ #define OFFSET(x) offsetof(Libdav1dContext, x) #define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM static const AVOption libdav1d_options[] = { - { "tilethreads", "Tile threads", OFFSET(tile_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_TILE_THREADS, VD | AV_OPT_FLAG_DEPRECATED }, - { "framethreads", "Frame threads", OFFSET(frame_threads), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_THREADS, VD | AV_OPT_FLAG_DEPRECATED }, { "max_frame_delay", "Max frame delay", OFFSET(max_frame_delay), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, DAV1D_MAX_FRAME_DELAY, VD }, { "filmgrain", "Apply Film Grain", OFFSET(apply_grain), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, VD | AV_OPT_FLAG_DEPRECATED }, { "oppoint", "Select an operating point of the scalable bitstream", OFFSET(operating_point), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 31, VD }, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libopusdec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusdec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libopusdec.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusdec.c 2026-04-29 18:38:25.000000000 +0000 @@ -139,7 +139,7 @@ #endif /* Decoder delay (in samples) at 48kHz */ - avc->delay = avc->internal->skip_samples = opus->pre_skip; + avc->delay = opus->pre_skip; return 0; } @@ -244,9 +244,7 @@ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_CHANNEL_CONF, .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP, - .p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_FLT, AV_SAMPLE_FMT_S16), .p.priv_class = &libopusdec_class, .p.wrapper_name = "libopus", }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libopusenc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusenc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libopusenc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libopusenc.c 2026-04-29 18:38:25.000000000 +0000 @@ -519,7 +519,7 @@ ff_af_queue_remove(&opus->afq, opus->opts.packet_size, &avpkt->pts, &avpkt->duration); - discard_padding = opus->opts.packet_size - avpkt->duration; + discard_padding = opus->opts.packet_size - ff_samples_from_time_base(avctx, avpkt->duration); // Check if subtraction resulted in an overflow if ((discard_padding < opus->opts.packet_size) != (avpkt->duration > 0)) return AVERROR(EINVAL); @@ -601,10 +601,8 @@ .init = libopus_encode_init, FF_CODEC_ENCODE_CB(libopus_encode), .close = libopus_encode_close, - .p.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_FLT, - AV_SAMPLE_FMT_NONE }, - .p.supported_samplerates = libopus_sample_rates, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_FLT), + CODEC_SAMPLERATES_ARRAY(libopus_sample_rates), .p.priv_class = &libopus_class, .defaults = libopus_defaults, .p.wrapper_name = "libopus", diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvorbisdec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisdec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvorbisdec.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisdec.c 2026-04-29 18:38:25.000000000 +0000 @@ -18,6 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include #include "avcodec.h" @@ -35,7 +36,8 @@ static int oggvorbis_decode_close(AVCodecContext *avccontext); -static int oggvorbis_decode_init(AVCodecContext *avccontext) { +static av_cold int oggvorbis_decode_init(AVCodecContext *avccontext) +{ OggVorbisDecContext *context = avccontext->priv_data ; uint8_t *p= avccontext->extradata; int i, hsizes[3], ret; @@ -113,11 +115,17 @@ } } + if (context->vi.rate <= 0 || context->vi.rate > INT_MAX) { + av_log(avccontext, AV_LOG_ERROR, "vorbis rate is invalid\n"); + ret = AVERROR_INVALIDDATA; + goto error; + } + av_channel_layout_uninit(&avccontext->ch_layout); avccontext->ch_layout.order = AV_CHANNEL_ORDER_UNSPEC; avccontext->ch_layout.nb_channels = context->vi.channels; avccontext->sample_rate = context->vi.rate; - avccontext->sample_fmt = AV_SAMPLE_FMT_S16; + avccontext->sample_fmt = AV_SAMPLE_FMT_FLTP; avccontext->time_base= (AVRational){1, avccontext->sample_rate}; vorbis_synthesis_init(&context->vd, &context->vi); @@ -131,33 +139,14 @@ } -static inline int conv(int samples, float **pcm, char *buf, int channels) { - int i, j; - ogg_int16_t *ptr, *data = (ogg_int16_t*)buf ; - float *mono ; - - for(i = 0 ; i < channels ; i++){ - ptr = &data[i]; - mono = pcm[i] ; - - for(j = 0 ; j < samples ; j++) { - *ptr = av_clip_int16(mono[j] * 32767.f); - ptr += channels; - } - } - - return 0 ; -} - static int oggvorbis_decode_frame(AVCodecContext *avccontext, AVFrame *frame, int *got_frame_ptr, AVPacket *avpkt) { OggVorbisDecContext *context = avccontext->priv_data ; float **pcm ; ogg_packet *op= &context->op; - int samples, total_samples, total_bytes; + int samples, total_samples; int ret; - int16_t *output; if(!avpkt->size){ //FIXME flush @@ -167,8 +156,6 @@ frame->nb_samples = 8192*4; if ((ret = ff_get_buffer(avccontext, frame, 0)) < 0) return ret; - output = (int16_t *)frame->data[0]; - op->packet = avpkt->data; op->bytes = avpkt->size; @@ -183,11 +170,10 @@ vorbis_synthesis_blockin(&context->vd, &context->vb) ; total_samples = 0 ; - total_bytes = 0 ; while((samples = vorbis_synthesis_pcmout(&context->vd, &pcm)) > 0) { - conv(samples, pcm, (char*)output + total_bytes, context->vi.channels) ; - total_bytes += samples * 2 * context->vi.channels ; + for (int ch = 0; ch < context->vi.channels; ch++) + memcpy((float *)frame->extended_data[ch] + total_samples, pcm[ch], samples * sizeof(float)); total_samples += samples ; vorbis_synthesis_read(&context->vd, samples) ; } @@ -198,7 +184,8 @@ } -static int oggvorbis_decode_close(AVCodecContext *avccontext) { +static av_cold int oggvorbis_decode_close(AVCodecContext *avccontext) +{ OggVorbisDecContext *context = avccontext->priv_data ; vorbis_block_clear(&context->vb); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvorbisenc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisenc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvorbisenc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvorbisenc.c 2026-04-29 18:38:25.000000000 +0000 @@ -23,6 +23,7 @@ #include "libavutil/avassert.h" #include "libavutil/channel_layout.h" #include "libavutil/fifo.h" +#include "libavutil/intreadwrite.h" #include "libavutil/mem.h" #include "libavutil/opt.h" #include "avcodec.h" @@ -179,6 +180,62 @@ return vorbis_error_to_averror(ret); } +static av_cold int libvorbis_get_priming_samples(vorbis_info *vi, AVCodecContext *avctx) +{ + LibvorbisEncContext *s = avctx->priv_data; + vorbis_dsp_state vd; + vorbis_block vb; + ogg_packet op; + int ret; + + if ((ret = vorbis_analysis_init(&vd, vi))) { + av_log(avctx, AV_LOG_ERROR, "analysis init failed\n"); + return vorbis_error_to_averror(ret); + } + if ((ret = vorbis_block_init(&vd, &vb))) { + av_log(avctx, AV_LOG_ERROR, "dsp init failed\n"); + vorbis_dsp_clear(&vd); + return vorbis_error_to_averror(ret); + } + + if ((ret = vorbis_analysis_wrote(&vd, 0)) < 0) { + av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_wrote() during init\n"); + ret = vorbis_error_to_averror(ret); + goto error; + } + + /* retrieve available packets from libvorbis */ + if ((ret = vorbis_analysis_blockout(&vd, &vb)) == 1) { + if ((ret = vorbis_analysis(&vb, NULL)) < 0) { + av_log(avctx, AV_LOG_ERROR, "error in vorbis_analysis_blockout() during init\n"); + ret = vorbis_error_to_averror(ret); + goto error; + } + if ((ret = vorbis_bitrate_addblock(&vb)) < 0) { + av_log(avctx, AV_LOG_ERROR, "error in vorbis_bitrate_addblock() during init\n"); + ret = vorbis_error_to_averror(ret); + goto error; + } + + /* add any available packets to the output packet buffer */ + ret = vorbis_bitrate_flushpacket(&vd, &op); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "error in vorbis_bitrate_flushpacket() during init\n"); + ret = vorbis_error_to_averror(ret); + goto error; + } + } + + avctx->initial_padding = av_vorbis_parse_frame(s->vp, op.packet, op.bytes); + + ret = 0; +error: + vorbis_block_clear(&vb); + vorbis_dsp_clear(&vd); + + return ret; +} + /* How many bytes are needed for a buffer of length 'l' */ static int xiph_len(int l) { @@ -269,6 +326,9 @@ vorbis_comment_clear(&s->vc); + if ((ret = libvorbis_get_priming_samples(&s->vi, avctx))) + return ret; + avctx->frame_size = LIBVORBIS_FRAME_SIZE; ff_af_queue_init(avctx, &s->afq); @@ -357,17 +417,19 @@ duration = av_vorbis_parse_frame(s->vp, avpkt->data, avpkt->size); if (duration > 0) { - /* we do not know encoder delay until we get the first packet from - * libvorbis, so we have to update the AudioFrameQueue counts */ - if (!avctx->initial_padding && s->afq.frames) { - avctx->initial_padding = duration; - av_assert0(!s->afq.remaining_delay); - s->afq.frames->duration += duration; - if (s->afq.frames->pts != AV_NOPTS_VALUE) - s->afq.frames->pts -= duration; - s->afq.remaining_samples += duration; - } + int discard_padding; + ff_af_queue_remove(&s->afq, duration, &avpkt->pts, &avpkt->duration); + + discard_padding = duration - ff_samples_from_time_base(avctx, avpkt->duration); + if (discard_padding > 0) { + uint8_t *side_data = av_packet_new_side_data(avpkt, + AV_PKT_DATA_SKIP_SAMPLES, + 10); + if (!side_data) + return AVERROR(ENOMEM); + AV_WL32(side_data + 4, discard_padding); + } } *got_packet_ptr = 1; @@ -386,8 +448,7 @@ .init = libvorbis_encode_init, FF_CODEC_ENCODE_CB(libvorbis_encode_frame), .close = libvorbis_encode_close, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_FLTP, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_FLTP), .p.priv_class = &vorbis_class, .defaults = defaults, .p.wrapper_name = "libvorbis", diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvpxdec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxdec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvpxdec.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxdec.c 2026-04-29 18:38:25.000000000 +0000 @@ -41,6 +41,7 @@ #include "profiles.h" typedef struct VPxDecoderContext { + const struct vpx_codec_iface *iface; struct vpx_codec_ctx decoder; struct vpx_codec_ctx decoder_alpha; AVBufferPool *pool; @@ -84,9 +85,9 @@ } static av_cold int vpx_init(AVCodecContext *avctx, - struct vpx_codec_ctx* decoder, - const struct vpx_codec_iface *iface) + struct vpx_codec_ctx* decoder) { + VPxContext *ctx = avctx->priv_data; struct vpx_codec_dec_cfg deccfg = { .threads = FFMIN(avctx->thread_count ? avctx->thread_count : av_cpu_count(), MAX_VPX_THREADS) }; @@ -94,15 +95,20 @@ av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); - if (vpx_codec_dec_init(decoder, iface, &deccfg, 0) != VPX_CODEC_OK) { + if (vpx_codec_dec_init(decoder, ctx->iface, &deccfg, 0) != VPX_CODEC_OK) { const char *error = vpx_codec_error(decoder); av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder: %s\n", error); return AVERROR(EINVAL); } - if (avctx->codec_id == AV_CODEC_ID_VP9) - vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, release_frame_buffer, avctx->priv_data); + if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) { + if (vpx_codec_set_frame_buffer_functions(decoder, get_frame_buffer, release_frame_buffer, avctx->priv_data)) { + vpx_codec_destroy(decoder); + av_log(avctx, AV_LOG_ERROR, "Failed to set frame buffer.\n"); + return AVERROR_EXTERNAL; + } + } return 0; } @@ -134,23 +140,28 @@ #if CONFIG_LIBVPX_VP9_DECODER case VPX_IMG_FMT_I422: avctx->profile = AV_PROFILE_VP9_1; - avctx->pix_fmt = AV_PIX_FMT_YUV422P; + avctx->pix_fmt = + has_alpha_channel ? AV_PIX_FMT_YUVA422P : AV_PIX_FMT_YUV422P; return 0; case VPX_IMG_FMT_I440: + //TODO: Add alpha support once the pixel format becomes available avctx->profile = AV_PROFILE_VP9_1; avctx->pix_fmt = AV_PIX_FMT_YUV440P; return 0; case VPX_IMG_FMT_I444: avctx->profile = AV_PROFILE_VP9_1; avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP : AV_PIX_FMT_YUV444P; + (has_alpha_channel ? AV_PIX_FMT_GBRAP : AV_PIX_FMT_GBRP) : + (has_alpha_channel ? AV_PIX_FMT_YUVA444P : AV_PIX_FMT_YUV444P); return 0; case VPX_IMG_FMT_I42016: avctx->profile = AV_PROFILE_VP9_2; if (img->bit_depth == 10) { - avctx->pix_fmt = AV_PIX_FMT_YUV420P10; + avctx->pix_fmt = + has_alpha_channel ? AV_PIX_FMT_YUVA420P10 : AV_PIX_FMT_YUV420P10; return 0; } else if (img->bit_depth == 12) { + //TODO: Add alpha support once the pixel format becomes available avctx->pix_fmt = AV_PIX_FMT_YUV420P12; return 0; } else { @@ -159,15 +170,18 @@ case VPX_IMG_FMT_I42216: avctx->profile = AV_PROFILE_VP9_3; if (img->bit_depth == 10) { - avctx->pix_fmt = AV_PIX_FMT_YUV422P10; + avctx->pix_fmt = + has_alpha_channel ? AV_PIX_FMT_YUVA422P10 : AV_PIX_FMT_YUV422P10; return 0; } else if (img->bit_depth == 12) { + //TODO: Add alpha support once the pixel format becomes available avctx->pix_fmt = AV_PIX_FMT_YUV422P12; return 0; } else { return AVERROR_INVALIDDATA; } case VPX_IMG_FMT_I44016: + //TODO: Add alpha support once the pixel format becomes available avctx->profile = AV_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = AV_PIX_FMT_YUV440P10; @@ -182,11 +196,13 @@ avctx->profile = AV_PROFILE_VP9_3; if (img->bit_depth == 10) { avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP10 : AV_PIX_FMT_YUV444P10; + (has_alpha_channel ? AV_PIX_FMT_GBRAP10 : AV_PIX_FMT_GBRP10) : + (has_alpha_channel ? AV_PIX_FMT_YUVA444P10 : AV_PIX_FMT_YUV444P10); return 0; } else if (img->bit_depth == 12) { avctx->pix_fmt = avctx->colorspace == AVCOL_SPC_RGB ? - AV_PIX_FMT_GBRP12 : AV_PIX_FMT_YUV444P12; + (has_alpha_channel ? AV_PIX_FMT_GBRAP12 : AV_PIX_FMT_GBRP12) : + (has_alpha_channel ? AV_PIX_FMT_YUVA444P12 : AV_PIX_FMT_YUV444P12); return 0; } else { return AVERROR_INVALIDDATA; @@ -239,17 +255,7 @@ if (additional_id == 1) { // 1 stands for alpha channel data. if (!ctx->has_alpha_channel) { ctx->has_alpha_channel = 1; - ret = vpx_init(avctx, - &ctx->decoder_alpha, -#if CONFIG_LIBVPX_VP8_DECODER && CONFIG_LIBVPX_VP9_DECODER - (avctx->codec_id == AV_CODEC_ID_VP8) ? - vpx_codec_vp8_dx() : vpx_codec_vp9_dx() -#elif CONFIG_LIBVPX_VP8_DECODER - vpx_codec_vp8_dx() -#else - vpx_codec_vp9_dx() -#endif - ); + ret = vpx_init(avctx, &ctx->decoder_alpha); if (ret) return ret; } @@ -308,7 +314,7 @@ linesizes[3] = ctx->has_alpha_channel ? img_alpha->stride[VPX_PLANE_Y] : 0; - if (img->fb_priv && (!ctx->has_alpha_channel || img_alpha->fb_priv)) { + if (vpx_codec_get_caps(ctx->iface) & VPX_CODEC_CAP_EXTERNAL_FRAME_BUFFER) { ret = ff_decode_frame_props(avctx, picture); if (ret < 0) return ret; @@ -349,7 +355,8 @@ static av_cold int vp8_init(AVCodecContext *avctx) { VPxContext *ctx = avctx->priv_data; - return vpx_init(avctx, &ctx->decoder, vpx_codec_vp8_dx()); + ctx->iface = vpx_codec_vp8_dx(); + return vpx_init(avctx, &ctx->decoder); } const FFCodec ff_libvpx_vp8_decoder = { @@ -372,7 +379,8 @@ static av_cold int vp9_init(AVCodecContext *avctx) { VPxContext *ctx = avctx->priv_data; - return vpx_init(avctx, &ctx->decoder, vpx_codec_vp9_dx()); + ctx->iface = vpx_codec_vp9_dx(); + return vpx_init(avctx, &ctx->decoder); } const FFCodec ff_libvpx_vp9_decoder = { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvpxenc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxenc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/libvpxenc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/libvpxenc.c 2026-04-29 18:38:26.000000000 +0000 @@ -36,7 +36,6 @@ #include "libavutil/avassert.h" #include "libavutil/mem.h" #include "libvpx.h" -#include "packet_internal.h" #include "profiles.h" #include "libavutil/avstring.h" #include "libavutil/base64.h" @@ -203,15 +202,14 @@ #endif }; -static av_cold void log_encoder_error(AVCodecContext *avctx, const char *desc) +static av_cold void log_encoder_error(void *logctx, struct vpx_codec_ctx *encoder, const char *desc) { - VPxContext *ctx = avctx->priv_data; - const char *error = vpx_codec_error(&ctx->encoder); - const char *detail = vpx_codec_error_detail(&ctx->encoder); + const char *error = vpx_codec_error(encoder); + const char *detail = vpx_codec_error_detail(encoder); - av_log(avctx, AV_LOG_ERROR, "%s: %s\n", desc, error); + av_log(logctx, AV_LOG_ERROR, "%s: %s\n", desc, error); if (detail) - av_log(avctx, AV_LOG_ERROR, " Additional information: %s\n", detail); + av_log(logctx, AV_LOG_ERROR, " Additional information: %s\n", detail); } static av_cold void dump_enc_cfg(AVCodecContext *avctx, @@ -243,7 +241,7 @@ width, "g_lag_in_frames:", cfg->g_lag_in_frames); av_log(avctx, level, "rate control settings\n" " %*s%u\n %*s%u\n %*s%u\n %*s%u\n" - " %*s%d\n %*s%p(%"SIZE_SPECIFIER")\n %*s%u\n", + " %*s%d\n %*s%p(%zu)\n %*s%u\n", width, "rc_dropframe_thresh:", cfg->rc_dropframe_thresh, width, "rc_resize_allowed:", cfg->rc_resize_allowed, width, "rc_resize_up_thresh:", cfg->rc_resize_up_thresh, @@ -353,6 +351,13 @@ av_fifo_freep2(fifo); } +static int encoder_can_drop_frames(AVCodecContext *avctx) +{ + VPxContext *ctx = avctx->priv_data; + + return (ctx->drop_threshold > 0) || (ctx->screen_content_mode == 2); +} + static int frame_data_submit(AVCodecContext *avctx, AVFifo *fifo, const AVFrame *frame) { @@ -384,6 +389,18 @@ } ret = av_fifo_write(fifo, &fd, 1); + if (ret == AVERROR(ENOSPC)) { + FrameData fd2; + + av_log(avctx, AV_LOG_WARNING, "FIFO full, will drop a front element\n"); + + ret = av_fifo_read(fifo, &fd2, 1); + if (ret >= 0) { + frame_data_uninit(&fd2); + ret = av_fifo_write(fifo, &fd, 1); + } + } + if (ret < 0) goto fail; @@ -399,13 +416,25 @@ uint8_t *data; int ret = 0; - if (av_fifo_peek(fifo, &fd, 1, 0) < 0) - return 0; - if (fd.pts != pkt->pts) { - av_log(avctx, AV_LOG_WARNING, - "Mismatching timestamps: libvpx %"PRId64" queued %"PRId64"; " - "this is a bug, please report it\n", pkt->pts, fd.pts); - goto skip; + while (1) { + if (av_fifo_peek(fifo, &fd, 1, 0) < 0) + return 0; + + if (fd.pts == pkt->pts) { + break; + } + + if (!encoder_can_drop_frames(avctx)) { + av_log(avctx, AV_LOG_WARNING, + "Mismatching timestamps: libvpx %"PRId64" queued %"PRId64"; " + "this is a bug, please report it\n", pkt->pts, fd.pts); + goto skip; + } + + av_log(avctx, AV_LOG_DEBUG, "Dropped frame with pts %"PRId64"\n", + fd.pts); + av_fifo_drain2(fifo, 1); + frame_data_uninit(&fd); } pkt->duration = fd.duration; @@ -447,16 +476,16 @@ if (res != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder, buf); return AVERROR(EINVAL); } - if (ctx->is_alpha) { + if (ctx->is_alpha && id != VP9E_SET_COLOR_SPACE) { int res_alpha = vpx_codec_control(&ctx->encoder_alpha, id, val); if (res_alpha != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder_alpha, buf); return AVERROR(EINVAL); } } @@ -480,7 +509,7 @@ if (res != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder, buf); return AVERROR(EINVAL); } @@ -489,7 +518,7 @@ if (res_alpha != VPX_CODEC_OK) { snprintf(buf, sizeof(buf), "Failed to set %s alpha codec control", ctlidstr[id]); - log_encoder_error(avctx, buf); + log_encoder_error(avctx, &ctx->encoder_alpha, buf); return AVERROR(EINVAL); } } @@ -796,6 +825,7 @@ *img_fmt = VPX_IMG_FMT_I420; return 0; case AV_PIX_FMT_YUV422P: + case AV_PIX_FMT_YUVA422P: enccfg->g_profile = 1; *img_fmt = VPX_IMG_FMT_I422; return 0; @@ -804,12 +834,17 @@ *img_fmt = VPX_IMG_FMT_I440; return 0; case AV_PIX_FMT_GBRP: + case AV_PIX_FMT_GBRAP: ctx->vpx_cs = VPX_CS_SRGB; case AV_PIX_FMT_YUV444P: + case AV_PIX_FMT_YUVA444P: + if (avctx->colorspace == AVCOL_SPC_RGB) + ctx->vpx_cs = VPX_CS_SRGB; enccfg->g_profile = 1; *img_fmt = VPX_IMG_FMT_I444; return 0; case AV_PIX_FMT_YUV420P10: + case AV_PIX_FMT_YUVA420P10: case AV_PIX_FMT_YUV420P12: if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { enccfg->g_profile = 2; @@ -819,6 +854,7 @@ } break; case AV_PIX_FMT_YUV422P10: + case AV_PIX_FMT_YUVA422P10: case AV_PIX_FMT_YUV422P12: if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { enccfg->g_profile = 3; @@ -837,10 +873,16 @@ } break; case AV_PIX_FMT_GBRP10: + case AV_PIX_FMT_GBRAP10: case AV_PIX_FMT_GBRP12: + case AV_PIX_FMT_GBRAP12: ctx->vpx_cs = VPX_CS_SRGB; case AV_PIX_FMT_YUV444P10: + case AV_PIX_FMT_YUVA444P10: case AV_PIX_FMT_YUV444P12: + case AV_PIX_FMT_YUVA444P12: + if (avctx->colorspace == AVCOL_SPC_RGB) + ctx->vpx_cs = VPX_CS_SRGB; if (codec_caps & VPX_CODEC_CAP_HIGHBITDEPTH) { enccfg->g_profile = 3; *img_fmt = VPX_IMG_FMT_I44416; @@ -855,7 +897,7 @@ return AVERROR_INVALIDDATA; } -static void set_colorspace(AVCodecContext *avctx) +static int set_colorspace(AVCodecContext *avctx) { enum vpx_color_space vpx_cs; VPxContext *ctx = avctx->priv_data; @@ -864,7 +906,11 @@ vpx_cs = ctx->vpx_cs; } else { switch (avctx->colorspace) { - case AVCOL_SPC_RGB: vpx_cs = VPX_CS_SRGB; break; + case AVCOL_SPC_RGB: + av_log(avctx, AV_LOG_ERROR, + "RGB colorspace is not compatible with pixel format %s.\n", + av_get_pix_fmt_name(avctx->pix_fmt)); + return AVERROR(EINVAL); case AVCOL_SPC_BT709: vpx_cs = VPX_CS_BT_709; break; case AVCOL_SPC_UNSPECIFIED: vpx_cs = VPX_CS_UNKNOWN; break; case AVCOL_SPC_RESERVED: vpx_cs = VPX_CS_RESERVED; break; @@ -875,10 +921,11 @@ default: av_log(avctx, AV_LOG_WARNING, "Unsupported colorspace (%d)\n", avctx->colorspace); - return; + return 0; } } codecctl_int(avctx, VP9E_SET_COLOR_SPACE, vpx_cs); + return 0; } #if VPX_ENCODER_ABI_VERSION >= 11 @@ -975,12 +1022,21 @@ vpx_svc_extra_cfg_t svc_params; #endif const AVDictionaryEntry* en = NULL; + const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(avctx->pix_fmt); av_log(avctx, AV_LOG_INFO, "%s\n", vpx_codec_version_str()); av_log(avctx, AV_LOG_VERBOSE, "%s\n", vpx_codec_build_config()); - if (avctx->pix_fmt == AV_PIX_FMT_YUVA420P) + if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA)) { ctx->is_alpha = 1; + if (avctx->pix_fmt != AV_PIX_FMT_YUVA420P && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { + av_log(avctx, AV_LOG_ERROR, + "Pixel format '%s' is not widely supported. " + "Use -strict experimental to use it anyway, or use 'yuva420p' pixel format instead.\n", + av_get_pix_fmt_name(avctx->pix_fmt)); + return AVERROR(EINVAL); + } + } if ((res = vpx_codec_enc_config_default(iface, &enccfg, 0)) != VPX_CODEC_OK) { av_log(avctx, AV_LOG_ERROR, "Failed to get config: %s\n", @@ -1118,7 +1174,7 @@ ret = av_reallocp(&ctx->twopass_stats.buf, ctx->twopass_stats.sz); if (ret < 0) { av_log(avctx, AV_LOG_ERROR, - "Stat buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", + "Stat buffer alloc (%zu bytes) failed\n", ctx->twopass_stats.sz); ctx->twopass_stats.sz = 0; return ret; @@ -1153,7 +1209,7 @@ res = vpx_codec_enc_init(&ctx->encoder, iface, &enccfg, flags); if (res != VPX_CODEC_OK) { dump_enc_cfg(avctx, &enccfg, AV_LOG_WARNING); - log_encoder_error(avctx, "Failed to initialize encoder"); + log_encoder_error(avctx, &ctx->encoder, "Failed to initialize encoder"); return AVERROR(EINVAL); } dump_enc_cfg(avctx, &enccfg, AV_LOG_DEBUG); @@ -1175,9 +1231,10 @@ #endif if (ctx->is_alpha) { enccfg_alpha = enccfg; + enccfg_alpha.g_profile = (flags & VPX_CODEC_USE_HIGHBITDEPTH) ? 2 : 0; res = vpx_codec_enc_init(&ctx->encoder_alpha, iface, &enccfg_alpha, flags); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Failed to initialize alpha encoder"); + log_encoder_error(avctx, &ctx->encoder_alpha, "Failed to initialize alpha encoder"); return AVERROR(EINVAL); } } @@ -1229,7 +1286,9 @@ codecctl_int(avctx, VP9E_SET_FRAME_PARALLEL_DECODING, ctx->frame_parallel); if (ctx->aq_mode >= 0) codecctl_int(avctx, VP9E_SET_AQ_MODE, ctx->aq_mode); - set_colorspace(avctx); + res = set_colorspace(avctx); + if (res < 0) + return res; #if VPX_ENCODER_ABI_VERSION >= 11 set_color_range(avctx); #endif @@ -1324,7 +1383,7 @@ VPxContext *ctx = avctx->priv_data; int ret = ff_get_encode_buffer(avctx, pkt, cx_frame->sz, 0); uint8_t *side_data; - int pict_type; + enum AVPictureType pict_type; int quality; if (ret < 0) @@ -1343,8 +1402,8 @@ ret = vpx_codec_control(&ctx->encoder, VP8E_GET_LAST_QUANTIZER_64, &quality); if (ret != VPX_CODEC_OK) quality = 0; - ff_side_data_set_encoder_stats(pkt, quality * FF_QP2LAMBDA, cx_frame->sse + 1, - cx_frame->have_sse ? 3 : 0, pict_type); + ff_encode_add_stats_side_data(pkt, quality * FF_QP2LAMBDA, cx_frame->sse + 1, + cx_frame->have_sse ? 3 : 0, pict_type); if (cx_frame->have_sse) { /* Beware of the Y/U/V/all order! */ @@ -1424,7 +1483,7 @@ if (!cx_frame->buf) { av_log(avctx, AV_LOG_ERROR, - "Data buffer alloc (%"SIZE_SPECIFIER" bytes) failed\n", + "Data buffer alloc (%zu bytes) failed\n", cx_frame->sz); av_freep(&cx_frame); return AVERROR(ENOMEM); @@ -1607,14 +1666,14 @@ ret = set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt); if (ret) { - log_encoder_error(avctx, "Failed to set_roi_map.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set_roi_map.\n"); return ret; } memset(roi_map.ref_frame, -1, sizeof(roi_map.ref_frame)); if (vpx_codec_control(&ctx->encoder, VP9E_SET_ROI_MAP, &roi_map)) { - log_encoder_error(avctx, "Failed to set VP9E_SET_ROI_MAP codec control.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set VP9E_SET_ROI_MAP codec control.\n"); ret = AVERROR_INVALIDDATA; } av_freep(&roi_map.roi_map); @@ -1639,12 +1698,12 @@ int ret = set_roi_map(avctx, sd, frame_width, frame_height, &roi_map, block_size, segment_cnt); if (ret) { - log_encoder_error(avctx, "Failed to set_roi_map.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set_roi_map.\n"); return ret; } if (vpx_codec_control(&ctx->encoder, VP8E_SET_ROI_MAP, &roi_map)) { - log_encoder_error(avctx, "Failed to set VP8E_SET_ROI_MAP codec control.\n"); + log_encoder_error(avctx, &ctx->encoder, "Failed to set VP8E_SET_ROI_MAP codec control.\n"); ret = AVERROR_INVALIDDATA; } @@ -1663,18 +1722,28 @@ !planes[VPX_PLANE_V] || width != (int)rawimg_alpha->d_w || height != (int)rawimg_alpha->d_h) { + vpx_img_fmt_t alpha_fmt = ctx->rawimg.bit_depth > 8 ? + VPX_IMG_FMT_I42016 : VPX_IMG_FMT_I420; av_freep(&planes[VPX_PLANE_U]); av_freep(&planes[VPX_PLANE_V]); - vpx_img_wrap(rawimg_alpha, VPX_IMG_FMT_I420, width, height, 1, + vpx_img_wrap(rawimg_alpha, alpha_fmt, width, height, 1, (unsigned char*)1); planes[VPX_PLANE_U] = av_malloc_array(stride[VPX_PLANE_U], height); planes[VPX_PLANE_V] = av_malloc_array(stride[VPX_PLANE_V], height); if (!planes[VPX_PLANE_U] || !planes[VPX_PLANE_V]) return AVERROR(ENOMEM); - memset(planes[VPX_PLANE_U], 0x80, stride[VPX_PLANE_U] * height); - memset(planes[VPX_PLANE_V], 0x80, stride[VPX_PLANE_V] * height); + if (ctx->rawimg.bit_depth > 8) { + int val = 0x80 << (ctx->rawimg.bit_depth - 8); + AV_WN16(planes[VPX_PLANE_U], val); + AV_WN16(planes[VPX_PLANE_V], val); + av_memcpy_backptr(planes[VPX_PLANE_U] + 2, 2, stride[VPX_PLANE_U] * height - 2); + av_memcpy_backptr(planes[VPX_PLANE_V] + 2, 2, stride[VPX_PLANE_V] * height - 2); + } else { + memset(planes[VPX_PLANE_U], 0x80, stride[VPX_PLANE_U] * height); + memset(planes[VPX_PLANE_V], 0x80, stride[VPX_PLANE_V] * height); + } } return 0; @@ -1699,7 +1768,7 @@ cfg.rc_max_quantizer = avctx->qmax; res = vpx_codec_enc_config_set(&ctx->encoder, &cfg); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error reconfiguring encoder"); + log_encoder_error(avctx, &ctx->encoder, "Error reconfiguring encoder"); return AVERROR_INVALIDDATA; } } @@ -1831,19 +1900,13 @@ else if (avctx->framerate.num > 0 && avctx->framerate.den > 0) duration = av_rescale_q(1, av_inv_q(avctx->framerate), avctx->time_base); else { -FF_DISABLE_DEPRECATION_WARNINGS - duration = -#if FF_API_TICKS_PER_FRAME - avctx->ticks_per_frame ? avctx->ticks_per_frame : -#endif - 1; -FF_ENABLE_DEPRECATION_WARNINGS + duration = 1; } res = vpx_codec_encode(&ctx->encoder, rawimg, timestamp, duration, flags, ctx->deadline); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error encoding frame"); + log_encoder_error(avctx, &ctx->encoder, "Error encoding frame"); return AVERROR_INVALIDDATA; } @@ -1851,7 +1914,7 @@ res = vpx_codec_encode(&ctx->encoder_alpha, rawimg_alpha, timestamp, duration, flags, ctx->deadline); if (res != VPX_CODEC_OK) { - log_encoder_error(avctx, "Error encoding alpha frame"); + log_encoder_error(avctx, &ctx->encoder_alpha, "Error encoding alpha frame"); return AVERROR_INVALIDDATA; } } @@ -2044,7 +2107,7 @@ .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE | FF_CODEC_CAP_INIT_CLEANUP | FF_CODEC_CAP_AUTO_THREADS, - .p.pix_fmts = (const enum AVPixelFormat[]){ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_NONE }, + CODEC_PIXFMTS(AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P), .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, .p.priv_class = &class_vp8, .defaults = defaults, @@ -2062,9 +2125,12 @@ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUVA444P, AV_PIX_FMT_GBRP, + AV_PIX_FMT_GBRAP, AV_PIX_FMT_NONE }; @@ -2072,19 +2138,28 @@ AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV422P, + AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV440P, AV_PIX_FMT_YUV444P, + AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV420P10, + AV_PIX_FMT_YUVA420P10, AV_PIX_FMT_YUV422P10, + AV_PIX_FMT_YUVA422P10, AV_PIX_FMT_YUV440P10, AV_PIX_FMT_YUV444P10, + AV_PIX_FMT_YUVA444P10, AV_PIX_FMT_YUV420P12, AV_PIX_FMT_YUV422P12, AV_PIX_FMT_YUV440P12, AV_PIX_FMT_YUV444P12, + AV_PIX_FMT_YUVA444P12, AV_PIX_FMT_GBRP, + AV_PIX_FMT_GBRAP, AV_PIX_FMT_GBRP10, + AV_PIX_FMT_GBRAP10, AV_PIX_FMT_GBRP12, + AV_PIX_FMT_GBRAP12, AV_PIX_FMT_NONE }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mathops.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathops.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mathops.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathops.h 2026-04-29 18:38:26.000000000 +0000 @@ -32,8 +32,9 @@ extern const uint32_t ff_inverse[257]; extern const uint8_t ff_log2_run[41]; +EXTERN const uint32_t ff_square_tab[512]; extern const uint8_t ff_sqrt_tab[256]; -extern const uint8_t attribute_visibility_hidden ff_crop_tab[256 + 2 * MAX_NEG_CROP]; +EXTERN const uint8_t ff_crop_tab[256 + 2 * MAX_NEG_CROP]; extern const uint8_t ff_zigzag_direct[64]; extern const uint8_t ff_zigzag_scan[16+1]; @@ -43,6 +44,8 @@ # include "mips/mathops.h" #elif ARCH_PPC # include "ppc/mathops.h" +#elif ARCH_RISCV +# include "riscv/mathops.h" #elif ARCH_X86 # include "x86/mathops.h" #endif @@ -92,23 +95,24 @@ #endif /* median of 3 */ -#ifndef mid_pred -#define mid_pred mid_pred -static inline av_const int mid_pred(int a, int b, int c) +static inline av_const int median3_c(int a, int b, int c) { - if(a>b){ - if(c>b){ - if(c>a) b=a; - else b=c; - } - }else{ - if(b>c){ - if(c>a) b=c; - else b=a; - } + int max2, min2, m; + + if (a >= b) { + max2 = a; + min2 = b; + } else { + max2 = b; + min2 = a; } - return b; + m = (c >= max2) ? max2 : c; + + return (m >= min2) ? m : min2; } + +#ifndef mid_pred +#define mid_pred median3_c #endif #ifndef median4 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mathtables.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathtables.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mathtables.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mathtables.c 2026-04-29 18:38:26.000000000 +0000 @@ -20,8 +20,47 @@ #include +#include "config.h" #include "mathops.h" +#if CONFIG_ME_CMP || CONFIG_MPEGVIDEOENCDSP +/* (i - 256) * (i - 256) */ +const uint32_t ff_square_tab[512] = { + 65536, 65025, 64516, 64009, 63504, 63001, 62500, 62001, 61504, 61009, 60516, 60025, 59536, 59049, 58564, 58081, + 57600, 57121, 56644, 56169, 55696, 55225, 54756, 54289, 53824, 53361, 52900, 52441, 51984, 51529, 51076, 50625, + 50176, 49729, 49284, 48841, 48400, 47961, 47524, 47089, 46656, 46225, 45796, 45369, 44944, 44521, 44100, 43681, + 43264, 42849, 42436, 42025, 41616, 41209, 40804, 40401, 40000, 39601, 39204, 38809, 38416, 38025, 37636, 37249, + 36864, 36481, 36100, 35721, 35344, 34969, 34596, 34225, 33856, 33489, 33124, 32761, 32400, 32041, 31684, 31329, + 30976, 30625, 30276, 29929, 29584, 29241, 28900, 28561, 28224, 27889, 27556, 27225, 26896, 26569, 26244, 25921, + 25600, 25281, 24964, 24649, 24336, 24025, 23716, 23409, 23104, 22801, 22500, 22201, 21904, 21609, 21316, 21025, + 20736, 20449, 20164, 19881, 19600, 19321, 19044, 18769, 18496, 18225, 17956, 17689, 17424, 17161, 16900, 16641, + 16384, 16129, 15876, 15625, 15376, 15129, 14884, 14641, 14400, 14161, 13924, 13689, 13456, 13225, 12996, 12769, + 12544, 12321, 12100, 11881, 11664, 11449, 11236, 11025, 10816, 10609, 10404, 10201, 10000, 9801, 9604, 9409, + 9216, 9025, 8836, 8649, 8464, 8281, 8100, 7921, 7744, 7569, 7396, 7225, 7056, 6889, 6724, 6561, + 6400, 6241, 6084, 5929, 5776, 5625, 5476, 5329, 5184, 5041, 4900, 4761, 4624, 4489, 4356, 4225, + 4096, 3969, 3844, 3721, 3600, 3481, 3364, 3249, 3136, 3025, 2916, 2809, 2704, 2601, 2500, 2401, + 2304, 2209, 2116, 2025, 1936, 1849, 1764, 1681, 1600, 1521, 1444, 1369, 1296, 1225, 1156, 1089, + 1024, 961, 900, 841, 784, 729, 676, 625, 576, 529, 484, 441, 400, 361, 324, 289, + 256, 225, 196, 169, 144, 121, 100, 81, 64, 49, 36, 25, 16, 9, 4, 1, + 0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100, 121, 144, 169, 196, 225, + 256, 289, 324, 361, 400, 441, 484, 529, 576, 625, 676, 729, 784, 841, 900, 961, + 1024, 1089, 1156, 1225, 1296, 1369, 1444, 1521, 1600, 1681, 1764, 1849, 1936, 2025, 2116, 2209, + 2304, 2401, 2500, 2601, 2704, 2809, 2916, 3025, 3136, 3249, 3364, 3481, 3600, 3721, 3844, 3969, + 4096, 4225, 4356, 4489, 4624, 4761, 4900, 5041, 5184, 5329, 5476, 5625, 5776, 5929, 6084, 6241, + 6400, 6561, 6724, 6889, 7056, 7225, 7396, 7569, 7744, 7921, 8100, 8281, 8464, 8649, 8836, 9025, + 9216, 9409, 9604, 9801, 10000, 10201, 10404, 10609, 10816, 11025, 11236, 11449, 11664, 11881, 12100, 12321, + 12544, 12769, 12996, 13225, 13456, 13689, 13924, 14161, 14400, 14641, 14884, 15129, 15376, 15625, 15876, 16129, + 16384, 16641, 16900, 17161, 17424, 17689, 17956, 18225, 18496, 18769, 19044, 19321, 19600, 19881, 20164, 20449, + 20736, 21025, 21316, 21609, 21904, 22201, 22500, 22801, 23104, 23409, 23716, 24025, 24336, 24649, 24964, 25281, + 25600, 25921, 26244, 26569, 26896, 27225, 27556, 27889, 28224, 28561, 28900, 29241, 29584, 29929, 30276, 30625, + 30976, 31329, 31684, 32041, 32400, 32761, 33124, 33489, 33856, 34225, 34596, 34969, 35344, 35721, 36100, 36481, + 36864, 37249, 37636, 38025, 38416, 38809, 39204, 39601, 40000, 40401, 40804, 41209, 41616, 42025, 42436, 42849, + 43264, 43681, 44100, 44521, 44944, 45369, 45796, 46225, 46656, 47089, 47524, 47961, 48400, 48841, 49284, 49729, + 50176, 50625, 51076, 51529, 51984, 52441, 52900, 53361, 53824, 54289, 54756, 55225, 55696, 56169, 56644, 57121, + 57600, 58081, 58564, 59049, 59536, 60025, 60516, 61009, 61504, 62001, 62500, 63001, 63504, 64009, 64516, 65025, +}; +#endif + /* a*inverse[b]>>32 == a/b for all 0<=a<=16909558 && 2<=b<=256 * for a>16909558, is an overestimate by less than 1 part in 1<<24 */ const uint32_t ff_inverse[257]={ @@ -72,10 +111,10 @@ }; #define times4(x) x, x, x, x -#define times256(x) times4(times4(times4(times4(times4(x))))) +#define times1024(x) times4(times4(times4(times4(times4(x))))) const uint8_t ff_crop_tab[256 + 2 * MAX_NEG_CROP] = { -times256(0x00), +times1024(0x00), 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F, 0x10,0x11,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19,0x1A,0x1B,0x1C,0x1D,0x1E,0x1F, 0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2A,0x2B,0x2C,0x2D,0x2E,0x2F, @@ -92,7 +131,7 @@ 0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF, 0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF, 0xF0,0xF1,0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB,0xFC,0xFD,0xFE,0xFF, -times256(0xFF) +times1024(0xFF) }; const uint8_t ff_zigzag_direct[64] = { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/me_cmp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/me_cmp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/me_cmp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/me_cmp.h 2026-04-29 18:38:26.000000000 +0000 @@ -21,13 +21,8 @@ #include -#include "libavutil/attributes_internal.h" - #include "avcodec.h" -extern const uint32_t attribute_visibility_hidden ff_square_tab[512]; - - /* minimum alignment rules ;) * If you notice errors in the align stuff, need more alignment for some ASM code * for some CPU or need to use a function with less aligned data then send a mail @@ -41,13 +36,13 @@ * !future video codecs might need functions with less strict alignment */ -struct MpegEncContext; +typedef struct MPVEncContext MPVEncContext; /* Motion estimation: * h is limited to { width / 2, width, 2 * width }, * but never larger than 16 and never smaller than 2. * Although currently h < 4 is not used as functions with * width < 8 are neither used nor implemented. */ -typedef int (*me_cmp_func)(struct MpegEncContext *c, +typedef int (*me_cmp_func)(MPVEncContext *c, const uint8_t *blk1 /* align width (8 or 16) */, const uint8_t *blk2 /* align 1 */, ptrdiff_t stride, int h); @@ -76,7 +71,6 @@ void ff_me_cmp_init(MECmpContext *c, AVCodecContext *avctx); void ff_me_cmp_init_aarch64(MECmpContext *c, AVCodecContext *avctx); -void ff_me_cmp_init_alpha(MECmpContext *c, AVCodecContext *avctx); void ff_me_cmp_init_arm(MECmpContext *c, AVCodecContext *avctx); void ff_me_cmp_init_ppc(MECmpContext *c, AVCodecContext *avctx); void ff_me_cmp_init_riscv(MECmpContext *c, AVCodecContext *avctx); @@ -87,7 +81,7 @@ * Fill the function pointer array cmp[6] with me_cmp_funcs from * c based upon type. If mpvenc is not set, an error is returned * if the type of comparison functions requires an initialized - * MpegEncContext. + * MPVEncContext. */ int ff_set_cmp(const MECmpContext *c, me_cmp_func *cmp, int type, int mpvenc); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,148 @@ +/* + * Android MediaCodec public API functions + * + * Copyright (c) 2016 Matthieu Bouron + * + * 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 "config.h" + +#include "libavutil/error.h" + +#include "mediacodec.h" + +#if CONFIG_MEDIACODEC + +#include + +#include "libavcodec/avcodec.h" +#include "libavutil/mem.h" + +#include "ffjni.h" +#include "mediacodecdec_common.h" + +AVMediaCodecContext *av_mediacodec_alloc_context(void) +{ + return av_mallocz(sizeof(AVMediaCodecContext)); +} + +int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface) +{ + int ret = 0; + JNIEnv *env = NULL; + + env = ff_jni_get_env(avctx); + if (!env) { + return AVERROR_EXTERNAL; + } + + ctx->surface = (*env)->NewGlobalRef(env, surface); + if (ctx->surface) { + avctx->hwaccel_context = ctx; + } else { + av_log(avctx, AV_LOG_ERROR, "Could not create new global reference\n"); + ret = AVERROR_EXTERNAL; + } + + return ret; +} + +void av_mediacodec_default_free(AVCodecContext *avctx) +{ + JNIEnv *env = NULL; + + AVMediaCodecContext *ctx = avctx->hwaccel_context; + + if (!ctx) { + return; + } + + env = ff_jni_get_env(avctx); + if (!env) { + return; + } + + if (ctx->surface) { + (*env)->DeleteGlobalRef(env, ctx->surface); + ctx->surface = NULL; + } + + av_freep(&avctx->hwaccel_context); +} + +int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render) +{ + MediaCodecDecContext *ctx = buffer->ctx; + int released = atomic_fetch_add(&buffer->released, 1); + + if (!released && (ctx->delay_flush || buffer->serial == atomic_load(&ctx->serial))) { + atomic_fetch_sub(&ctx->hw_buffer_count, 1); + av_log(ctx->avctx, AV_LOG_DEBUG, + "Releasing output buffer %zd (%p) ts=%"PRId64" with render=%d [%d pending]\n", + buffer->index, buffer, buffer->pts, render, atomic_load(&ctx->hw_buffer_count)); + return ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, render); + } + + return 0; +} + +int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time) +{ + MediaCodecDecContext *ctx = buffer->ctx; + int released = atomic_fetch_add(&buffer->released, 1); + + if (!released && (ctx->delay_flush || buffer->serial == atomic_load(&ctx->serial))) { + atomic_fetch_sub(&ctx->hw_buffer_count, 1); + av_log(ctx->avctx, AV_LOG_DEBUG, + "Rendering output buffer %zd (%p) ts=%"PRId64" with time=%"PRId64" [%d pending]\n", + buffer->index, buffer, buffer->pts, time, atomic_load(&ctx->hw_buffer_count)); + return ff_AMediaCodec_releaseOutputBufferAtTime(ctx->codec, buffer->index, time); + } + + return 0; +} + +#else + +#include + +AVMediaCodecContext *av_mediacodec_alloc_context(void) +{ + return NULL; +} + +int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface) +{ + return AVERROR(ENOSYS); +} + +void av_mediacodec_default_free(AVCodecContext *avctx) +{ +} + +int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render) +{ + return AVERROR(ENOSYS); +} + +int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time) +{ + return AVERROR(ENOSYS); +} + +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,103 @@ +/* + * Android MediaCodec public API + * + * Copyright (c) 2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_MEDIACODEC_H +#define AVCODEC_MEDIACODEC_H + +#include "libavcodec/avcodec.h" + +/** + * This structure holds a reference to a android/view/Surface object that will + * be used as output by the decoder. + * + */ +typedef struct AVMediaCodecContext { + + /** + * android/view/Surface object reference. + */ + void *surface; + +} AVMediaCodecContext; + +/** + * Allocate and initialize a MediaCodec context. + * + * When decoding with MediaCodec is finished, the caller must free the + * MediaCodec context with av_mediacodec_default_free. + * + * @return a pointer to a newly allocated AVMediaCodecContext on success, NULL otherwise + */ +AVMediaCodecContext *av_mediacodec_alloc_context(void); + +/** + * Convenience function that sets up the MediaCodec context. + * + * @param avctx codec context + * @param ctx MediaCodec context to initialize + * @param surface reference to an android/view/Surface + * @return 0 on success, < 0 otherwise + */ +int av_mediacodec_default_init(AVCodecContext *avctx, AVMediaCodecContext *ctx, void *surface); + +/** + * This function must be called to free the MediaCodec context initialized with + * av_mediacodec_default_init(). + * + * @param avctx codec context + */ +void av_mediacodec_default_free(AVCodecContext *avctx); + +/** + * Opaque structure representing a MediaCodec buffer to render. + */ +typedef struct MediaCodecBuffer AVMediaCodecBuffer; + +/** + * Release a MediaCodec buffer and render it to the surface that is associated + * with the decoder. This function should only be called once on a given + * buffer, once released the underlying buffer returns to the codec, thus + * subsequent calls to this function will have no effect. + * + * @param buffer the buffer to render + * @param render 1 to release and render the buffer to the surface or 0 to + * discard the buffer + * @return 0 on success, < 0 otherwise + */ +int av_mediacodec_release_buffer(AVMediaCodecBuffer *buffer, int render); + +/** + * Release a MediaCodec buffer and render it at the given time to the surface + * that is associated with the decoder. The timestamp must be within one second + * of the current `java/lang/System#nanoTime()` (which is implemented using + * `CLOCK_MONOTONIC` on Android). See the Android MediaCodec documentation + * of [`android/media/MediaCodec#releaseOutputBuffer(int,long)`][0] for more details. + * + * @param buffer the buffer to render + * @param time timestamp in nanoseconds of when to render the buffer + * @return 0 on success, < 0 otherwise + * + * [0]: https://developer.android.com/reference/android/media/MediaCodec#releaseOutputBuffer(int,%20long) + */ +int av_mediacodec_render_buffer_at_time(AVMediaCodecBuffer *buffer, int64_t time); + +#endif /* AVCODEC_MEDIACODEC_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_surface.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_surface.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * Android MediaCodec Surface functions + * + * Copyright (c) 2016 Matthieu Bouron + * + * 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 +#include + +#include "libavutil/mem.h" +#include "ffjni.h" +#include "mediacodec_surface.h" + +FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *native_window, void *log_ctx) +{ + FFANativeWindow *ret; + + ret = av_mallocz(sizeof(*ret)); + if (!ret) + return NULL; + + if (surface) { + JNIEnv *env = NULL; + + env = ff_jni_get_env(log_ctx); + if (env) + ret->surface = (*env)->NewGlobalRef(env, surface); + } + + if (native_window) { + ANativeWindow_acquire(native_window); + ret->native_window = native_window; + } + + if (!ret->surface && !ret->native_window) { + av_log(log_ctx, AV_LOG_ERROR, "Both surface and native_window are NULL\n"); + av_freep(&ret); + } + + return ret; +} + +int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx) +{ + if (!window) + return 0; + + if (window->surface) { + JNIEnv *env = NULL; + + env = ff_jni_get_env(log_ctx); + if (env) + (*env)->DeleteGlobalRef(env, window->surface); + } + + if (window->native_window) + ANativeWindow_release(window->native_window); + + av_free(window); + + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_surface.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_surface.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_surface.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,36 @@ +/* + * Android MediaCodec Surface functions + * + * Copyright (c) 2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_MEDIACODEC_SURFACE_H +#define AVCODEC_MEDIACODEC_SURFACE_H + +#include "libavcodec/avcodec.h" + +typedef struct FFANativeWindow { + void *surface; + void *native_window; +} FFANativeWindow; + +FFANativeWindow *ff_mediacodec_surface_ref(void *surface, void *native_window, void *log_ctx); +int ff_mediacodec_surface_unref(FFANativeWindow *window, void *log_ctx); + +#endif /* AVCODEC_MEDIACODEC_SURFACE_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,339 @@ +/* + * Android MediaCodec software buffer copy functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 +#include + +#include "libavutil/frame.h" +#include "libavutil/mem.h" + +#include "avcodec.h" +#include "mediacodec_wrapper.h" +#include "mediacodec_sw_buffer.h" +#include "mediacodecdec_common.h" + +#define QCOM_TILE_WIDTH 64 +#define QCOM_TILE_HEIGHT 32 +#define QCOM_TILE_SIZE (QCOM_TILE_WIDTH * QCOM_TILE_HEIGHT) +#define QCOM_TILE_GROUP_SIZE (4 * QCOM_TILE_SIZE) + +/** + * The code handling the various YUV color formats is taken from the + * GStreamer project. + * + * Gstreamer reference: + * https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/androidmedia/ + * + * Copyright (C) 2012, Collabora Ltd. + * Author: Sebastian Dröge + * + * Copyright (C) 2012, Rafaël Carré + * + * Copyright (C) 2015, Sebastian Dröge + * + * Copyright (C) 2014-2015, Collabora Ltd. + * Author: Matthieu Bouron + * + * Copyright (C) 2015, Edward Hervey + * Author: Edward Hervey + * + * Copyright (C) 2015, Matthew Waters + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ +void ff_mediacodec_sw_buffer_copy_yuv420_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int i; + uint8_t *src = NULL; + + for (i = 0; i < 3; i++) { + int stride = s->stride; + int height; + + src = data + info->offset; + if (i == 0) { + height = avctx->height; + + src += s->crop_top * s->stride; + src += s->crop_left; + } else { + height = avctx->height / 2; + stride = (s->stride + 1) / 2; + + src += s->slice_height * s->stride; + + if (i == 2) { + src += ((s->slice_height + 1) / 2) * stride; + } + + src += s->crop_top * stride; + src += (s->crop_left / 2); + } + + if (frame->linesize[i] == stride) { + memcpy(frame->data[i], src, height * stride); + } else { + int j, width; + uint8_t *dst = frame->data[i]; + + if (i == 0) { + width = avctx->width; + } else if (i >= 1) { + width = FFMIN(frame->linesize[i], FFALIGN(avctx->width, 2) / 2); + } + + for (j = 0; j < height; j++) { + memcpy(dst, src, width); + src += stride; + dst += frame->linesize[i]; + } + } + } +} + +void ff_mediacodec_sw_buffer_copy_yuv420_semi_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int i; + uint8_t *src = NULL; + + for (i = 0; i < 2; i++) { + int height; + + src = data + info->offset; + if (i == 0) { + height = avctx->height; + + src += s->crop_top * s->stride; + src += s->crop_left; + } else if (i == 1) { + height = avctx->height / 2; + + src += s->slice_height * s->stride; + src += s->crop_top * s->stride; + src += s->crop_left; + } + + if (frame->linesize[i] == s->stride) { + memcpy(frame->data[i], src, height * s->stride); + } else { + int j, width; + uint8_t *dst = frame->data[i]; + + if (i == 0) { + width = avctx->width; + } else if (i == 1) { + width = FFMIN(frame->linesize[i], FFALIGN(avctx->width, 2)); + } + + for (j = 0; j < height; j++) { + memcpy(dst, src, width); + src += s->stride; + dst += frame->linesize[i]; + } + } + } +} + + + +void ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int i; + uint8_t *src = NULL; + + for (i = 0; i < 2; i++) { + int height; + + src = data + info->offset; + if (i == 0) { + height = avctx->height; + } else if (i == 1) { + height = avctx->height / 2; + + src += (s->slice_height - s->crop_top / 2) * s->stride; + + src += s->crop_top * s->stride; + src += s->crop_left; + } + + if (frame->linesize[i] == s->stride) { + memcpy(frame->data[i], src, height * s->stride); + } else { + int j, width; + uint8_t *dst = frame->data[i]; + + if (i == 0) { + width = avctx->width; + } else if (i == 1) { + width = FFMIN(frame->linesize[i], FFALIGN(avctx->width, 2)); + } + + for (j = 0; j < height; j++) { + memcpy(dst, src, width); + src += s->stride; + dst += frame->linesize[i]; + } + } + } +} + +/** + * The code handling the QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka + * color format is taken from the VLC project. + * + * VLC reference: + * http://git.videolan.org/?p=vlc.git;a=blob;f=modules/codec/omxil/qcom.c;hb=HEAD + * + * VLC copyright notice: + * + ***************************************************************************** + * qcom.c : pixel format translation for Qualcomm tiled nv12 + ***************************************************************************** + * Copyright © 2012 Rafaël Carré + * + * Authors: Rafaël Carré + * + * This program 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. + * + * This program 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 this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. + * + */ + +static size_t qcom_tile_pos(size_t x, size_t y, size_t w, size_t h) +{ + size_t flim = x + (y & ~1) * w; + + if (y & 1) { + flim += (x & ~3) + 2; + } else if ((h & 1) == 0 || y != (h - 1)) { + flim += (x + 2) & ~3; + } + + return flim; +} + +void ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar_64x32Tile2m8ka(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + size_t width = frame->width; + size_t linesize = frame->linesize[0]; + size_t height = frame->height; + + const size_t tile_w = (width - 1) / QCOM_TILE_WIDTH + 1; + const size_t tile_w_align = (tile_w + 1) & ~1; + const size_t tile_h_luma = (height - 1) / QCOM_TILE_HEIGHT + 1; + const size_t tile_h_chroma = (height / 2 - 1) / QCOM_TILE_HEIGHT + 1; + + size_t luma_size = tile_w_align * tile_h_luma * QCOM_TILE_SIZE; + if((luma_size % QCOM_TILE_GROUP_SIZE) != 0) + luma_size = (((luma_size - 1) / QCOM_TILE_GROUP_SIZE) + 1) * QCOM_TILE_GROUP_SIZE; + + for(size_t y = 0; y < tile_h_luma; y++) { + size_t row_width = width; + for(size_t x = 0; x < tile_w; x++) { + size_t tile_width = row_width; + size_t tile_height = height; + /* dest luma memory index for this tile */ + size_t luma_idx = y * QCOM_TILE_HEIGHT * linesize + x * QCOM_TILE_WIDTH; + /* dest chroma memory index for this tile */ + /* XXX: remove divisions */ + size_t chroma_idx = (luma_idx / linesize) * linesize / 2 + (luma_idx % linesize); + + /* luma source pointer for this tile */ + const uint8_t *src_luma = data + + qcom_tile_pos(x, y,tile_w_align, tile_h_luma) * QCOM_TILE_SIZE; + + /* chroma source pointer for this tile */ + const uint8_t *src_chroma = data + luma_size + + qcom_tile_pos(x, y/2, tile_w_align, tile_h_chroma) * QCOM_TILE_SIZE; + if (y & 1) + src_chroma += QCOM_TILE_SIZE/2; + + /* account for right columns */ + if (tile_width > QCOM_TILE_WIDTH) + tile_width = QCOM_TILE_WIDTH; + + /* account for bottom rows */ + if (tile_height > QCOM_TILE_HEIGHT) + tile_height = QCOM_TILE_HEIGHT; + + tile_height /= 2; + while (tile_height--) { + memcpy(frame->data[0] + luma_idx, src_luma, tile_width); + src_luma += QCOM_TILE_WIDTH; + luma_idx += linesize; + + memcpy(frame->data[0] + luma_idx, src_luma, tile_width); + src_luma += QCOM_TILE_WIDTH; + luma_idx += linesize; + + memcpy(frame->data[1] + chroma_idx, src_chroma, tile_width); + src_chroma += QCOM_TILE_WIDTH; + chroma_idx += linesize; + } + row_width -= QCOM_TILE_WIDTH; + } + height -= QCOM_TILE_HEIGHT; + } +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_sw_buffer.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * Android MediaCodec software buffer copy functions + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_MEDIACODEC_SW_BUFFER_H +#define AVCODEC_MEDIACODEC_SW_BUFFER_H + +#include + +#include "libavutil/frame.h" + +#include "avcodec.h" +#include "mediacodec_wrapper.h" +#include "mediacodecdec_common.h" + +void ff_mediacodec_sw_buffer_copy_yuv420_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame); + +void ff_mediacodec_sw_buffer_copy_yuv420_semi_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame); + +void ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame); + +void ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar_64x32Tile2m8ka(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + FFAMediaCodecBufferInfo *info, + AVFrame *frame); + +#endif /* AVCODEC_MEDIACODEC_SW_BUFFER_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_wrapper.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_wrapper.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,2724 @@ +/* + * Android MediaCodec Wrapper + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 +#include +#include +#include +#include +#include + +#include "libavutil/avassert.h" +#include "libavutil/mem.h" +#include "libavutil/avstring.h" + +#include "avcodec.h" +#include "ffjni.h" +#include "mediacodec_wrapper.h" + +struct JNIAMediaCodecListFields { + + jclass mediacodec_list_class; + jmethodID init_id; + jmethodID find_decoder_for_format_id; + + jmethodID get_codec_count_id; + jmethodID get_codec_info_at_id; + + jclass mediacodec_info_class; + jmethodID get_name_id; + jmethodID get_codec_capabilities_id; + jmethodID get_supported_types_id; + jmethodID is_encoder_id; + jmethodID is_software_only_id; + + jclass codec_capabilities_class; + jfieldID color_formats_id; + jfieldID profile_levels_id; + + jclass codec_profile_level_class; + jfieldID profile_id; + jfieldID level_id; +}; + +#define OFFSET(x) offsetof(struct JNIAMediaCodecListFields, x) +static const struct FFJniField jni_amediacodeclist_mapping[] = { + { "android/media/MediaCodecList", NULL, NULL, FF_JNI_CLASS, OFFSET(mediacodec_list_class), 1 }, + { "android/media/MediaCodecList", "", "(I)V", FF_JNI_METHOD, OFFSET(init_id), 0 }, + { "android/media/MediaCodecList", "findDecoderForFormat", "(Landroid/media/MediaFormat;)Ljava/lang/String;", FF_JNI_METHOD, OFFSET(find_decoder_for_format_id), 0 }, + + { "android/media/MediaCodecList", "getCodecCount", "()I", FF_JNI_STATIC_METHOD, OFFSET(get_codec_count_id), 1 }, + { "android/media/MediaCodecList", "getCodecInfoAt", "(I)Landroid/media/MediaCodecInfo;", FF_JNI_STATIC_METHOD, OFFSET(get_codec_info_at_id), 1 }, + + { "android/media/MediaCodecInfo", NULL, NULL, FF_JNI_CLASS, OFFSET(mediacodec_info_class), 1 }, + { "android/media/MediaCodecInfo", "getName", "()Ljava/lang/String;", FF_JNI_METHOD, OFFSET(get_name_id), 1 }, + { "android/media/MediaCodecInfo", "getCapabilitiesForType", "(Ljava/lang/String;)Landroid/media/MediaCodecInfo$CodecCapabilities;", FF_JNI_METHOD, OFFSET(get_codec_capabilities_id), 1 }, + { "android/media/MediaCodecInfo", "getSupportedTypes", "()[Ljava/lang/String;", FF_JNI_METHOD, OFFSET(get_supported_types_id), 1 }, + { "android/media/MediaCodecInfo", "isEncoder", "()Z", FF_JNI_METHOD, OFFSET(is_encoder_id), 1 }, + { "android/media/MediaCodecInfo", "isSoftwareOnly", "()Z", FF_JNI_METHOD, OFFSET(is_software_only_id), 0 }, + + { "android/media/MediaCodecInfo$CodecCapabilities", NULL, NULL, FF_JNI_CLASS, OFFSET(codec_capabilities_class), 1 }, + { "android/media/MediaCodecInfo$CodecCapabilities", "colorFormats", "[I", FF_JNI_FIELD, OFFSET(color_formats_id), 1 }, + { "android/media/MediaCodecInfo$CodecCapabilities", "profileLevels", "[Landroid/media/MediaCodecInfo$CodecProfileLevel;", FF_JNI_FIELD, OFFSET(profile_levels_id), 1 }, + + { "android/media/MediaCodecInfo$CodecProfileLevel", NULL, NULL, FF_JNI_CLASS, OFFSET(codec_profile_level_class), 1 }, + { "android/media/MediaCodecInfo$CodecProfileLevel", "profile", "I", FF_JNI_FIELD, OFFSET(profile_id), 1 }, + { "android/media/MediaCodecInfo$CodecProfileLevel", "level", "I", FF_JNI_FIELD, OFFSET(level_id), 1 }, + + { NULL } +}; +#undef OFFSET + +struct JNIAMediaFormatFields { + + jclass mediaformat_class; + + jmethodID init_id; + + jmethodID contains_key_id; + + jmethodID get_integer_id; + jmethodID get_long_id; + jmethodID get_float_id; + jmethodID get_bytebuffer_id; + jmethodID get_string_id; + + jmethodID set_integer_id; + jmethodID set_long_id; + jmethodID set_float_id; + jmethodID set_bytebuffer_id; + jmethodID set_string_id; + + jmethodID to_string_id; + +}; + +#define OFFSET(x) offsetof(struct JNIAMediaFormatFields, x) +static const struct FFJniField jni_amediaformat_mapping[] = { + { "android/media/MediaFormat", NULL, NULL, FF_JNI_CLASS, OFFSET(mediaformat_class), 1 }, + + { "android/media/MediaFormat", "", "()V", FF_JNI_METHOD, OFFSET(init_id), 1 }, + + { "android/media/MediaFormat", "containsKey", "(Ljava/lang/String;)Z", FF_JNI_METHOD, OFFSET(contains_key_id), 1 }, + + { "android/media/MediaFormat", "getInteger", "(Ljava/lang/String;)I", FF_JNI_METHOD, OFFSET(get_integer_id), 1 }, + { "android/media/MediaFormat", "getLong", "(Ljava/lang/String;)J", FF_JNI_METHOD, OFFSET(get_long_id), 1 }, + { "android/media/MediaFormat", "getFloat", "(Ljava/lang/String;)F", FF_JNI_METHOD, OFFSET(get_float_id), 1 }, + { "android/media/MediaFormat", "getByteBuffer", "(Ljava/lang/String;)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, OFFSET(get_bytebuffer_id), 1 }, + { "android/media/MediaFormat", "getString", "(Ljava/lang/String;)Ljava/lang/String;", FF_JNI_METHOD, OFFSET(get_string_id), 1 }, + + { "android/media/MediaFormat", "setInteger", "(Ljava/lang/String;I)V", FF_JNI_METHOD, OFFSET(set_integer_id), 1 }, + { "android/media/MediaFormat", "setLong", "(Ljava/lang/String;J)V", FF_JNI_METHOD, OFFSET(set_long_id), 1 }, + { "android/media/MediaFormat", "setFloat", "(Ljava/lang/String;F)V", FF_JNI_METHOD, OFFSET(set_float_id), 1 }, + { "android/media/MediaFormat", "setByteBuffer", "(Ljava/lang/String;Ljava/nio/ByteBuffer;)V", FF_JNI_METHOD, OFFSET(set_bytebuffer_id), 1 }, + { "android/media/MediaFormat", "setString", "(Ljava/lang/String;Ljava/lang/String;)V", FF_JNI_METHOD, OFFSET(set_string_id), 1 }, + + { "android/media/MediaFormat", "toString", "()Ljava/lang/String;", FF_JNI_METHOD, OFFSET(to_string_id), 1 }, + + { NULL } +}; +#undef OFFSET + +static const AVClass amediaformat_class = { + .class_name = "amediaformat", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, +}; + +typedef struct FFAMediaFormatJni { + FFAMediaFormat api; + + struct JNIAMediaFormatFields jfields; + jobject object; +} FFAMediaFormatJni; + +static const FFAMediaFormat media_format_jni; + +struct JNIAMediaCodecFields { + + jclass mediacodec_class; + + jfieldID info_try_again_later_id; + jfieldID info_output_buffers_changed_id; + jfieldID info_output_format_changed_id; + + jfieldID buffer_flag_codec_config_id; + jfieldID buffer_flag_end_of_stream_id; + jfieldID buffer_flag_key_frame_id; + + jfieldID configure_flag_encode_id; + + jmethodID create_by_codec_name_id; + jmethodID create_decoder_by_type_id; + jmethodID create_encoder_by_type_id; + + jmethodID get_name_id; + + jmethodID configure_id; + jmethodID start_id; + jmethodID flush_id; + jmethodID stop_id; + jmethodID release_id; + + jmethodID get_output_format_id; + + jmethodID dequeue_input_buffer_id; + jmethodID queue_input_buffer_id; + jmethodID get_input_buffer_id; + jmethodID get_input_buffers_id; + + jmethodID dequeue_output_buffer_id; + jmethodID get_output_buffer_id; + jmethodID get_output_buffers_id; + jmethodID release_output_buffer_id; + jmethodID release_output_buffer_at_time_id; + + jmethodID set_input_surface_id; + jmethodID signal_end_of_input_stream_id; + + jclass mediainfo_class; + + jmethodID init_id; + + jfieldID flags_id; + jfieldID offset_id; + jfieldID presentation_time_us_id; + jfieldID size_id; + +}; + +#define OFFSET(x) offsetof(struct JNIAMediaCodecFields, x) +static const struct FFJniField jni_amediacodec_mapping[] = { + { "android/media/MediaCodec", NULL, NULL, FF_JNI_CLASS, OFFSET(mediacodec_class), 1 }, + + { "android/media/MediaCodec", "INFO_TRY_AGAIN_LATER", "I", FF_JNI_STATIC_FIELD, OFFSET(info_try_again_later_id), 1 }, + { "android/media/MediaCodec", "INFO_OUTPUT_BUFFERS_CHANGED", "I", FF_JNI_STATIC_FIELD, OFFSET(info_output_buffers_changed_id), 1 }, + { "android/media/MediaCodec", "INFO_OUTPUT_FORMAT_CHANGED", "I", FF_JNI_STATIC_FIELD, OFFSET(info_output_format_changed_id), 1 }, + + { "android/media/MediaCodec", "BUFFER_FLAG_CODEC_CONFIG", "I", FF_JNI_STATIC_FIELD, OFFSET(buffer_flag_codec_config_id), 1 }, + { "android/media/MediaCodec", "BUFFER_FLAG_END_OF_STREAM", "I", FF_JNI_STATIC_FIELD, OFFSET(buffer_flag_end_of_stream_id), 1 }, + { "android/media/MediaCodec", "BUFFER_FLAG_KEY_FRAME", "I", FF_JNI_STATIC_FIELD, OFFSET(buffer_flag_key_frame_id), 0 }, + + { "android/media/MediaCodec", "CONFIGURE_FLAG_ENCODE", "I", FF_JNI_STATIC_FIELD, OFFSET(configure_flag_encode_id), 1 }, + + { "android/media/MediaCodec", "createByCodecName", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, OFFSET(create_by_codec_name_id), 1 }, + { "android/media/MediaCodec", "createDecoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, OFFSET(create_decoder_by_type_id), 1 }, + { "android/media/MediaCodec", "createEncoderByType", "(Ljava/lang/String;)Landroid/media/MediaCodec;", FF_JNI_STATIC_METHOD, OFFSET(create_encoder_by_type_id), 1 }, + + { "android/media/MediaCodec", "getName", "()Ljava/lang/String;", FF_JNI_METHOD, OFFSET(get_name_id), 1 }, + + { "android/media/MediaCodec", "configure", "(Landroid/media/MediaFormat;Landroid/view/Surface;Landroid/media/MediaCrypto;I)V", FF_JNI_METHOD, OFFSET(configure_id), 1 }, + { "android/media/MediaCodec", "start", "()V", FF_JNI_METHOD, OFFSET(start_id), 1 }, + { "android/media/MediaCodec", "flush", "()V", FF_JNI_METHOD, OFFSET(flush_id), 1 }, + { "android/media/MediaCodec", "stop", "()V", FF_JNI_METHOD, OFFSET(stop_id), 1 }, + { "android/media/MediaCodec", "release", "()V", FF_JNI_METHOD, OFFSET(release_id), 1 }, + + { "android/media/MediaCodec", "getOutputFormat", "()Landroid/media/MediaFormat;", FF_JNI_METHOD, OFFSET(get_output_format_id), 1 }, + + { "android/media/MediaCodec", "dequeueInputBuffer", "(J)I", FF_JNI_METHOD, OFFSET(dequeue_input_buffer_id), 1 }, + { "android/media/MediaCodec", "queueInputBuffer", "(IIIJI)V", FF_JNI_METHOD, OFFSET(queue_input_buffer_id), 1 }, + { "android/media/MediaCodec", "getInputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, OFFSET(get_input_buffer_id), 0 }, + { "android/media/MediaCodec", "getInputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, OFFSET(get_input_buffers_id), 1 }, + + { "android/media/MediaCodec", "dequeueOutputBuffer", "(Landroid/media/MediaCodec$BufferInfo;J)I", FF_JNI_METHOD, OFFSET(dequeue_output_buffer_id), 1 }, + { "android/media/MediaCodec", "getOutputBuffer", "(I)Ljava/nio/ByteBuffer;", FF_JNI_METHOD, OFFSET(get_output_buffer_id), 0 }, + { "android/media/MediaCodec", "getOutputBuffers", "()[Ljava/nio/ByteBuffer;", FF_JNI_METHOD, OFFSET(get_output_buffers_id), 1 }, + { "android/media/MediaCodec", "releaseOutputBuffer", "(IZ)V", FF_JNI_METHOD, OFFSET(release_output_buffer_id), 1 }, + { "android/media/MediaCodec", "releaseOutputBuffer", "(IJ)V", FF_JNI_METHOD, OFFSET(release_output_buffer_at_time_id), 0 }, + + { "android/media/MediaCodec", "setInputSurface", "(Landroid/view/Surface;)V", FF_JNI_METHOD, OFFSET(set_input_surface_id), 0 }, + { "android/media/MediaCodec", "signalEndOfInputStream", "()V", FF_JNI_METHOD, OFFSET(signal_end_of_input_stream_id), 0 }, + + { "android/media/MediaCodec$BufferInfo", NULL, NULL, FF_JNI_CLASS, OFFSET(mediainfo_class), 1 }, + + { "android/media/MediaCodec.BufferInfo", "", "()V", FF_JNI_METHOD, OFFSET(init_id), 1 }, + { "android/media/MediaCodec.BufferInfo", "flags", "I", FF_JNI_FIELD, OFFSET(flags_id), 1 }, + { "android/media/MediaCodec.BufferInfo", "offset", "I", FF_JNI_FIELD, OFFSET(offset_id), 1 }, + { "android/media/MediaCodec.BufferInfo", "presentationTimeUs", "J", FF_JNI_FIELD, OFFSET(presentation_time_us_id), 1 }, + { "android/media/MediaCodec.BufferInfo", "size", "I", FF_JNI_FIELD, OFFSET(size_id), 1 }, + + { NULL } +}; +#undef OFFSET + +static const AVClass amediacodec_class = { + .class_name = "amediacodec", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, +}; + +typedef struct FFAMediaCodecJni { + FFAMediaCodec api; + + struct JNIAMediaCodecFields jfields; + + jobject object; + jobject buffer_info; + + jobject input_buffers; + jobject output_buffers; + + int INFO_TRY_AGAIN_LATER; + int INFO_OUTPUT_BUFFERS_CHANGED; + int INFO_OUTPUT_FORMAT_CHANGED; + + int BUFFER_FLAG_CODEC_CONFIG; + int BUFFER_FLAG_END_OF_STREAM; + int BUFFER_FLAG_KEY_FRAME; + + int CONFIGURE_FLAG_ENCODE; + + int has_get_i_o_buffer; +} FFAMediaCodecJni; + +static const FFAMediaCodec media_codec_jni; + +#define JNI_GET_ENV_OR_RETURN(env, log_ctx, ret) do { \ + (env) = ff_jni_get_env(log_ctx); \ + if (!(env)) { \ + return ret; \ + } \ +} while (0) + +#define JNI_GET_ENV_OR_RETURN_VOID(env, log_ctx) do { \ + (env) = ff_jni_get_env(log_ctx); \ + if (!(env)) { \ + return; \ + } \ +} while (0) + +int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx) +{ + // Copy and modified from MediaCodecInfo.java + static const int AVCProfileBaseline = 0x01; + static const int AVCProfileMain = 0x02; + static const int AVCProfileExtended = 0x04; + static const int AVCProfileHigh = 0x08; + static const int AVCProfileHigh10 = 0x10; + static const int AVCProfileHigh422 = 0x20; + static const int AVCProfileHigh444 = 0x40; + static const int AVCProfileConstrainedBaseline = 0x10000; + static const int AVCProfileConstrainedHigh = 0x80000; + + static const int HEVCProfileMain = 0x01; + static const int HEVCProfileMain10 = 0x02; + static const int HEVCProfileMainStill = 0x04; + static const int HEVCProfileMain10HDR10 = 0x1000; + static const int HEVCProfileMain10HDR10Plus = 0x2000; + + static const int VP9Profile0 = 0x01; + static const int VP9Profile1 = 0x02; + static const int VP9Profile2 = 0x04; + static const int VP9Profile3 = 0x08; + static const int VP9Profile2HDR = 0x1000; + static const int VP9Profile3HDR = 0x2000; + static const int VP9Profile2HDR10Plus = 0x4000; + static const int VP9Profile3HDR10Plus = 0x8000; + + static const int MPEG4ProfileSimple = 0x01; + static const int MPEG4ProfileSimpleScalable = 0x02; + static const int MPEG4ProfileCore = 0x04; + static const int MPEG4ProfileMain = 0x08; + static const int MPEG4ProfileNbit = 0x10; + static const int MPEG4ProfileScalableTexture = 0x20; + static const int MPEG4ProfileSimpleFBA = 0x80; + static const int MPEG4ProfileSimpleFace = 0x40; + static const int MPEG4ProfileBasicAnimated = 0x100; + static const int MPEG4ProfileHybrid = 0x200; + static const int MPEG4ProfileAdvancedRealTime = 0x400; + static const int MPEG4ProfileCoreScalable = 0x800; + static const int MPEG4ProfileAdvancedCoding = 0x1000; + static const int MPEG4ProfileAdvancedCore = 0x2000; + static const int MPEG4ProfileAdvancedScalable = 0x4000; + static const int MPEG4ProfileAdvancedSimple = 0x8000; + + + static const int AV1ProfileMain8 = 0x1; + static const int AV1ProfileMain10 = 0x2; + static const int AV1ProfileMain10HDR10 = 0x1000; + static const int AV1ProfileMain10HDR10Plus = 0x2000; + + // Unused yet. + (void)AVCProfileConstrainedHigh; + (void)HEVCProfileMain10HDR10; + (void)HEVCProfileMain10HDR10Plus; + (void)VP9Profile2HDR; + (void)VP9Profile3HDR; + (void)VP9Profile2HDR10Plus; + (void)VP9Profile3HDR10Plus; + (void)MPEG4ProfileSimpleFace; + (void)AV1ProfileMain10; + (void)AV1ProfileMain10HDR10; + (void)AV1ProfileMain10HDR10Plus; + + if (avctx->codec_id == AV_CODEC_ID_H264) { + switch(avctx->profile) { + case AV_PROFILE_H264_BASELINE: + return AVCProfileBaseline; + case AV_PROFILE_H264_CONSTRAINED_BASELINE: + return AVCProfileConstrainedBaseline; + case AV_PROFILE_H264_MAIN: + return AVCProfileMain; + break; + case AV_PROFILE_H264_EXTENDED: + return AVCProfileExtended; + case AV_PROFILE_H264_HIGH: + return AVCProfileHigh; + case AV_PROFILE_H264_HIGH_10: + case AV_PROFILE_H264_HIGH_10_INTRA: + return AVCProfileHigh10; + case AV_PROFILE_H264_HIGH_422: + case AV_PROFILE_H264_HIGH_422_INTRA: + return AVCProfileHigh422; + case AV_PROFILE_H264_HIGH_444: + case AV_PROFILE_H264_HIGH_444_INTRA: + case AV_PROFILE_H264_HIGH_444_PREDICTIVE: + return AVCProfileHigh444; + } + } else if (avctx->codec_id == AV_CODEC_ID_HEVC) { + switch (avctx->profile) { + case AV_PROFILE_HEVC_MAIN: + return HEVCProfileMain; + case AV_PROFILE_HEVC_MAIN_STILL_PICTURE: + return HEVCProfileMainStill; + case AV_PROFILE_HEVC_MAIN_10: + return HEVCProfileMain10; + } + } else if (avctx->codec_id == AV_CODEC_ID_VP9) { + switch (avctx->profile) { + case AV_PROFILE_VP9_0: + return VP9Profile0; + case AV_PROFILE_VP9_1: + return VP9Profile1; + case AV_PROFILE_VP9_2: + return VP9Profile2; + case AV_PROFILE_VP9_3: + return VP9Profile3; + } + } else if(avctx->codec_id == AV_CODEC_ID_MPEG4) { + switch (avctx->profile) + { + case AV_PROFILE_MPEG4_SIMPLE: + return MPEG4ProfileSimple; + case AV_PROFILE_MPEG4_SIMPLE_SCALABLE: + return MPEG4ProfileSimpleScalable; + case AV_PROFILE_MPEG4_CORE: + return MPEG4ProfileCore; + case AV_PROFILE_MPEG4_MAIN: + return MPEG4ProfileMain; + case AV_PROFILE_MPEG4_N_BIT: + return MPEG4ProfileNbit; + case AV_PROFILE_MPEG4_SCALABLE_TEXTURE: + return MPEG4ProfileScalableTexture; + case AV_PROFILE_MPEG4_SIMPLE_FACE_ANIMATION: + return MPEG4ProfileSimpleFBA; + case AV_PROFILE_MPEG4_BASIC_ANIMATED_TEXTURE: + return MPEG4ProfileBasicAnimated; + case AV_PROFILE_MPEG4_HYBRID: + return MPEG4ProfileHybrid; + case AV_PROFILE_MPEG4_ADVANCED_REAL_TIME: + return MPEG4ProfileAdvancedRealTime; + case AV_PROFILE_MPEG4_CORE_SCALABLE: + return MPEG4ProfileCoreScalable; + case AV_PROFILE_MPEG4_ADVANCED_CODING: + return MPEG4ProfileAdvancedCoding; + case AV_PROFILE_MPEG4_ADVANCED_CORE: + return MPEG4ProfileAdvancedCore; + case AV_PROFILE_MPEG4_ADVANCED_SCALABLE_TEXTURE: + return MPEG4ProfileAdvancedScalable; + case AV_PROFILE_MPEG4_ADVANCED_SIMPLE: + return MPEG4ProfileAdvancedSimple; + case AV_PROFILE_MPEG4_SIMPLE_STUDIO: + // Studio profiles are not supported by mediacodec. + default: + break; + } + } else if(avctx->codec_id == AV_CODEC_ID_AV1) { + switch (avctx->profile) + { + case AV_PROFILE_AV1_MAIN: + return AV1ProfileMain8; + case AV_PROFILE_AV1_HIGH: + case AV_PROFILE_AV1_PROFESSIONAL: + default: + break; + } + } + + return -1; +} + +char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int encoder, void *log_ctx) +{ + int ret; + int i; + int codec_count; + int found_codec = 0; + char *name = NULL; + char *supported_type = NULL; + + JNIEnv *env = NULL; + struct JNIAMediaCodecListFields jfields = { 0 }; + struct JNIAMediaFormatFields mediaformat_jfields = { 0 }; + + jobject codec_name = NULL; + + jobject info = NULL; + jobject type = NULL; + jobjectArray types = NULL; + + jobject capabilities = NULL; + jobject profile_level = NULL; + jobjectArray profile_levels = NULL; + + JNI_GET_ENV_OR_RETURN(env, log_ctx, NULL); + + if ((ret = ff_jni_init_jfields(env, &jfields, jni_amediacodeclist_mapping, 0, log_ctx)) < 0) { + goto done; + } + + if ((ret = ff_jni_init_jfields(env, &mediaformat_jfields, jni_amediaformat_mapping, 0, log_ctx)) < 0) { + goto done; + } + + codec_count = (*env)->CallStaticIntMethod(env, jfields.mediacodec_list_class, jfields.get_codec_count_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + for(i = 0; i < codec_count; i++) { + int j; + int type_count; + int is_encoder; + + info = (*env)->CallStaticObjectMethod(env, jfields.mediacodec_list_class, jfields.get_codec_info_at_id, i); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + types = (*env)->CallObjectMethod(env, info, jfields.get_supported_types_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + is_encoder = (*env)->CallBooleanMethod(env, info, jfields.is_encoder_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + if (is_encoder != encoder) { + goto done_with_info; + } + + if (jfields.is_software_only_id) { + int is_software_only = (*env)->CallBooleanMethod(env, info, jfields.is_software_only_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + if (is_software_only) { + goto done_with_info; + } + } + + codec_name = (*env)->CallObjectMethod(env, info, jfields.get_name_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + name = ff_jni_jstring_to_utf_chars(env, codec_name, log_ctx); + if (!name) { + goto done; + } + + (*env)->DeleteLocalRef(env, codec_name); + codec_name = NULL; + + /* Skip software decoders */ + if ( + strstr(name, "OMX.google") || + strstr(name, "OMX.ffmpeg") || + (strstr(name, "OMX.SEC") && strstr(name, ".sw.")) || + !strcmp(name, "OMX.qcom.video.decoder.hevcswvdec")) { + goto done_with_info; + } + + type_count = (*env)->GetArrayLength(env, types); + for (j = 0; j < type_count; j++) { + int k; + int profile_count; + + type = (*env)->GetObjectArrayElement(env, types, j); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + supported_type = ff_jni_jstring_to_utf_chars(env, type, log_ctx); + if (!supported_type) { + goto done; + } + + if (av_strcasecmp(supported_type, mime)) { + goto done_with_type; + } + + capabilities = (*env)->CallObjectMethod(env, info, jfields.get_codec_capabilities_id, type); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + profile_levels = (*env)->GetObjectField(env, capabilities, jfields.profile_levels_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + profile_count = (*env)->GetArrayLength(env, profile_levels); + if (!profile_count) { + found_codec = 1; + } + for (k = 0; k < profile_count; k++) { + int supported_profile = 0; + + if (profile < 0) { + found_codec = 1; + break; + } + + profile_level = (*env)->GetObjectArrayElement(env, profile_levels, k); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + supported_profile = (*env)->GetIntField(env, profile_level, jfields.profile_id); + if (ff_jni_exception_check(env, 1, log_ctx) < 0) { + goto done; + } + + found_codec = profile == supported_profile; + + (*env)->DeleteLocalRef(env, profile_level); + profile_level = NULL; + + if (found_codec) { + break; + } + } + +done_with_type: + (*env)->DeleteLocalRef(env, profile_levels); + profile_levels = NULL; + + (*env)->DeleteLocalRef(env, capabilities); + capabilities = NULL; + + (*env)->DeleteLocalRef(env, type); + type = NULL; + + av_freep(&supported_type); + + if (found_codec) { + break; + } + } + +done_with_info: + (*env)->DeleteLocalRef(env, info); + info = NULL; + + (*env)->DeleteLocalRef(env, types); + types = NULL; + + if (found_codec) { + break; + } + + av_freep(&name); + } + +done: + (*env)->DeleteLocalRef(env, codec_name); + (*env)->DeleteLocalRef(env, info); + (*env)->DeleteLocalRef(env, type); + (*env)->DeleteLocalRef(env, types); + (*env)->DeleteLocalRef(env, capabilities); + (*env)->DeleteLocalRef(env, profile_level); + (*env)->DeleteLocalRef(env, profile_levels); + + av_freep(&supported_type); + + ff_jni_reset_jfields(env, &jfields, jni_amediacodeclist_mapping, 0, log_ctx); + ff_jni_reset_jfields(env, &mediaformat_jfields, jni_amediaformat_mapping, 0, log_ctx); + + if (!found_codec) { + av_freep(&name); + } + + return name; +} + +static FFAMediaFormat *mediaformat_jni_new(void) +{ + JNIEnv *env = NULL; + FFAMediaFormatJni *format = NULL; + jobject object = NULL; + + format = av_mallocz(sizeof(*format)); + if (!format) { + return NULL; + } + format->api = media_format_jni; + + env = ff_jni_get_env(format); + if (!env) { + av_freep(&format); + return NULL; + } + + if (ff_jni_init_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format) < 0) { + goto fail; + } + + object = (*env)->NewObject(env, format->jfields.mediaformat_class, format->jfields.init_id); + if (!object) { + goto fail; + } + + format->object = (*env)->NewGlobalRef(env, object); + if (!format->object) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, object); + + if (!format->object) { + ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); + av_freep(&format); + } + + return (FFAMediaFormat *)format; +} + +static FFAMediaFormat *mediaformat_jni_newFromObject(void *object) +{ + JNIEnv *env = NULL; + FFAMediaFormatJni *format = NULL; + + format = av_mallocz(sizeof(*format)); + if (!format) { + return NULL; + } + format->api = media_format_jni; + + env = ff_jni_get_env(format); + if (!env) { + av_freep(&format); + return NULL; + } + + if (ff_jni_init_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format) < 0) { + goto fail; + } + + format->object = (*env)->NewGlobalRef(env, object); + if (!format->object) { + goto fail; + } + + return (FFAMediaFormat *)format; +fail: + ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); + + av_freep(&format); + + return NULL; +} + +static int mediaformat_jni_delete(FFAMediaFormat* ctx) +{ + int ret = 0; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + + if (!format) { + return 0; + } + + JNI_GET_ENV_OR_RETURN(env, format, AVERROR_EXTERNAL); + + (*env)->DeleteGlobalRef(env, format->object); + format->object = NULL; + + ff_jni_reset_jfields(env, &format->jfields, jni_amediaformat_mapping, 1, format); + + av_freep(&format); + + return ret; +} + +static char* mediaformat_jni_toString(FFAMediaFormat* ctx) +{ + char *ret = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring description = NULL; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, NULL); + + description = (*env)->CallObjectMethod(env, format->object, format->jfields.to_string_id); + if (ff_jni_exception_check(env, 1, NULL) < 0) { + goto fail; + } + + ret = ff_jni_jstring_to_utf_chars(env, description, format); +fail: + (*env)->DeleteLocalRef(env, description); + + return ret; +} + +static int mediaformat_jni_getInt32(FFAMediaFormat* ctx, const char *name, int32_t *out) +{ + int ret = 1; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring key = NULL; + jboolean contains_key; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, 0); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + ret = 0; + goto fail; + } + + contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); + if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + *out = (*env)->CallIntMethod(env, format->object, format->jfields.get_integer_id, key); + if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + ret = 1; +fail: + (*env)->DeleteLocalRef(env, key); + + return ret; +} + +static int mediaformat_jni_getInt64(FFAMediaFormat* ctx, const char *name, int64_t *out) +{ + int ret = 1; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring key = NULL; + jboolean contains_key; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, 0); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + ret = 0; + goto fail; + } + + contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); + if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + *out = (*env)->CallLongMethod(env, format->object, format->jfields.get_long_id, key); + if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + ret = 1; +fail: + (*env)->DeleteLocalRef(env, key); + + return ret; +} + +static int mediaformat_jni_getFloat(FFAMediaFormat* ctx, const char *name, float *out) +{ + int ret = 1; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring key = NULL; + jboolean contains_key; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, 0); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + ret = 0; + goto fail; + } + + contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); + if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + *out = (*env)->CallFloatMethod(env, format->object, format->jfields.get_float_id, key); + if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + ret = 1; +fail: + (*env)->DeleteLocalRef(env, key); + + return ret; +} + +static int mediaformat_jni_getBuffer(FFAMediaFormat* ctx, const char *name, void** data, size_t *size) +{ + int ret = 1; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring key = NULL; + jboolean contains_key; + jobject result = NULL; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, 0); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + ret = 0; + goto fail; + } + + contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); + if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + result = (*env)->CallObjectMethod(env, format->object, format->jfields.get_bytebuffer_id, key); + if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + *data = (*env)->GetDirectBufferAddress(env, result); + *size = (*env)->GetDirectBufferCapacity(env, result); + + if (*data && *size) { + void *src = *data; + *data = av_malloc(*size); + if (!*data) { + ret = 0; + goto fail; + } + + memcpy(*data, src, *size); + } + + ret = 1; +fail: + (*env)->DeleteLocalRef(env, key); + (*env)->DeleteLocalRef(env, result); + + return ret; +} + +static int mediaformat_jni_getString(FFAMediaFormat* ctx, const char *name, const char **out) +{ + int ret = 1; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + JNIEnv *env = NULL; + jstring key = NULL; + jboolean contains_key; + jstring result = NULL; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN(env, format, 0); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + ret = 0; + goto fail; + } + + contains_key = (*env)->CallBooleanMethod(env, format->object, format->jfields.contains_key_id, key); + if (!contains_key || (ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + result = (*env)->CallObjectMethod(env, format->object, format->jfields.get_string_id, key); + if ((ret = ff_jni_exception_check(env, 1, format)) < 0) { + ret = 0; + goto fail; + } + + *out = ff_jni_jstring_to_utf_chars(env, result, format); + if (!*out) { + ret = 0; + goto fail; + } + + ret = 1; +fail: + (*env)->DeleteLocalRef(env, key); + (*env)->DeleteLocalRef(env, result); + + return ret; +} + +static void mediaformat_jni_setInt32(FFAMediaFormat* ctx, const char* name, int32_t value) +{ + JNIEnv *env = NULL; + jstring key = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN_VOID(env, format); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + goto fail; + } + + (*env)->CallVoidMethod(env, format->object, format->jfields.set_integer_id, key, value); + if (ff_jni_exception_check(env, 1, format) < 0) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, key); +} + +static void mediaformat_jni_setInt64(FFAMediaFormat* ctx, const char* name, int64_t value) +{ + JNIEnv *env = NULL; + jstring key = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN_VOID(env, format); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + goto fail; + } + + (*env)->CallVoidMethod(env, format->object, format->jfields.set_long_id, key, value); + if (ff_jni_exception_check(env, 1, format) < 0) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, key); +} + +static void mediaformat_jni_setFloat(FFAMediaFormat* ctx, const char* name, float value) +{ + JNIEnv *env = NULL; + jstring key = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN_VOID(env, format); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + goto fail; + } + + (*env)->CallVoidMethod(env, format->object, format->jfields.set_float_id, key, value); + if (ff_jni_exception_check(env, 1, format) < 0) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, key); +} + +static void mediaformat_jni_setString(FFAMediaFormat* ctx, const char* name, const char* value) +{ + JNIEnv *env = NULL; + jstring key = NULL; + jstring string = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN_VOID(env, format); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + goto fail; + } + + string = ff_jni_utf_chars_to_jstring(env, value, format); + if (!string) { + goto fail; + } + + (*env)->CallVoidMethod(env, format->object, format->jfields.set_string_id, key, string); + if (ff_jni_exception_check(env, 1, format) < 0) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, key); + (*env)->DeleteLocalRef(env, string); +} + +static void mediaformat_jni_setBuffer(FFAMediaFormat* ctx, const char* name, void* data, size_t size) +{ + JNIEnv *env = NULL; + jstring key = NULL; + jobject buffer = NULL; + void *buffer_data = NULL; + FFAMediaFormatJni *format = (FFAMediaFormatJni *)ctx; + + av_assert0(format != NULL); + + JNI_GET_ENV_OR_RETURN_VOID(env, format); + + key = ff_jni_utf_chars_to_jstring(env, name, format); + if (!key) { + goto fail; + } + + if (!data || !size) { + goto fail; + } + + buffer_data = av_malloc(size); + if (!buffer_data) { + goto fail; + } + + memcpy(buffer_data, data, size); + + buffer = (*env)->NewDirectByteBuffer(env, buffer_data, size); + if (!buffer) { + goto fail; + } + + (*env)->CallVoidMethod(env, format->object, format->jfields.set_bytebuffer_id, key, buffer); + if (ff_jni_exception_check(env, 1, format) < 0) { + goto fail; + } + +fail: + (*env)->DeleteLocalRef(env, key); + (*env)->DeleteLocalRef(env, buffer); +} + +static int codec_init_static_fields(FFAMediaCodecJni *codec) +{ + int ret = 0; + JNIEnv *env = NULL; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + codec->INFO_TRY_AGAIN_LATER = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.info_try_again_later_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + codec->BUFFER_FLAG_CODEC_CONFIG = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.buffer_flag_codec_config_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + codec->BUFFER_FLAG_END_OF_STREAM = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.buffer_flag_end_of_stream_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + if (codec->jfields.buffer_flag_key_frame_id) { + codec->BUFFER_FLAG_KEY_FRAME = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.buffer_flag_key_frame_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + } + + codec->CONFIGURE_FLAG_ENCODE = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.configure_flag_encode_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + codec->INFO_TRY_AGAIN_LATER = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.info_try_again_later_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + codec->INFO_OUTPUT_BUFFERS_CHANGED = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.info_output_buffers_changed_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + + codec->INFO_OUTPUT_FORMAT_CHANGED = (*env)->GetStaticIntField(env, codec->jfields.mediacodec_class, codec->jfields.info_output_format_changed_id); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + goto fail; + } + +fail: + + return ret; +} + +#define CREATE_CODEC_BY_NAME 0 +#define CREATE_DECODER_BY_TYPE 1 +#define CREATE_ENCODER_BY_TYPE 2 + +static inline FFAMediaCodec *codec_create(int method, const char *arg) +{ + int ret = -1; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = NULL; + jstring jarg = NULL; + jobject object = NULL; + jobject buffer_info = NULL; + jmethodID create_id = NULL; + + codec = av_mallocz(sizeof(*codec)); + if (!codec) { + return NULL; + } + codec->api = media_codec_jni; + + env = ff_jni_get_env(codec); + if (!env) { + av_freep(&codec); + return NULL; + } + + if (ff_jni_init_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec) < 0) { + goto fail; + } + + jarg = ff_jni_utf_chars_to_jstring(env, arg, codec); + if (!jarg) { + goto fail; + } + + switch (method) { + case CREATE_CODEC_BY_NAME: create_id = codec->jfields.create_by_codec_name_id; break; + case CREATE_DECODER_BY_TYPE: create_id = codec->jfields.create_decoder_by_type_id; break; + case CREATE_ENCODER_BY_TYPE: create_id = codec->jfields.create_encoder_by_type_id; break; + default: + av_assert0(0); + } + + object = (*env)->CallStaticObjectMethod(env, + codec->jfields.mediacodec_class, + create_id, + jarg); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + codec->object = (*env)->NewGlobalRef(env, object); + if (!codec->object) { + goto fail; + } + + if (codec_init_static_fields(codec) < 0) { + goto fail; + } + + if (codec->jfields.get_input_buffer_id && codec->jfields.get_output_buffer_id) { + codec->has_get_i_o_buffer = 1; + } + + buffer_info = (*env)->NewObject(env, codec->jfields.mediainfo_class, codec->jfields.init_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + codec->buffer_info = (*env)->NewGlobalRef(env, buffer_info); + if (!codec->buffer_info) { + goto fail; + } + + ret = 0; +fail: + (*env)->DeleteLocalRef(env, jarg); + (*env)->DeleteLocalRef(env, object); + (*env)->DeleteLocalRef(env, buffer_info); + + if (ret < 0) { + (*env)->DeleteGlobalRef(env, codec->object); + (*env)->DeleteGlobalRef(env, codec->buffer_info); + + ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); + av_freep(&codec); + } + + return (FFAMediaCodec *)codec; +} + +#define DECLARE_FF_AMEDIACODEC_CREATE_FUNC(name, method) \ +static FFAMediaCodec *mediacodec_jni_##name(const char *arg) \ +{ \ + return codec_create(method, arg); \ +} \ + +DECLARE_FF_AMEDIACODEC_CREATE_FUNC(createCodecByName, CREATE_CODEC_BY_NAME) +DECLARE_FF_AMEDIACODEC_CREATE_FUNC(createDecoderByType, CREATE_DECODER_BY_TYPE) +DECLARE_FF_AMEDIACODEC_CREATE_FUNC(createEncoderByType, CREATE_ENCODER_BY_TYPE) + +static int mediacodec_jni_delete(FFAMediaCodec* ctx) +{ + int ret = 0; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + JNIEnv *env = NULL; + + if (!codec) { + return 0; + } + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.release_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + } + + (*env)->DeleteGlobalRef(env, codec->input_buffers); + codec->input_buffers = NULL; + + (*env)->DeleteGlobalRef(env, codec->output_buffers); + codec->output_buffers = NULL; + + (*env)->DeleteGlobalRef(env, codec->object); + codec->object = NULL; + + (*env)->DeleteGlobalRef(env, codec->buffer_info); + codec->buffer_info = NULL; + + ff_jni_reset_jfields(env, &codec->jfields, jni_amediacodec_mapping, 1, codec); + + av_freep(&codec); + + return ret; +} + +static char *mediacodec_jni_getName(FFAMediaCodec *ctx) +{ + char *ret = NULL; + JNIEnv *env = NULL; + jobject *name = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, NULL); + + name = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_name_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + ret = ff_jni_jstring_to_utf_chars(env, name, codec); + +fail: + if (name) { + (*env)->DeleteLocalRef(env, name); + } + + return ret; +} + +static int mediacodec_jni_configure(FFAMediaCodec *ctx, + const FFAMediaFormat* format_ctx, + FFANativeWindow* window, + void *crypto, + uint32_t flags) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + const FFAMediaFormatJni *format = (FFAMediaFormatJni *)format_ctx; + jobject *surface = window ? window->surface : NULL; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + if (flags & codec->CONFIGURE_FLAG_ENCODE) { + if (surface && !codec->jfields.set_input_surface_id) { + av_log(ctx, AV_LOG_ERROR, "System doesn't support setInputSurface\n"); + return AVERROR_EXTERNAL; + } + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.configure_id, format->object, NULL, NULL, flags); + if (ff_jni_exception_check(env, 1, codec) < 0) + return AVERROR_EXTERNAL; + + if (!surface) + return 0; + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.set_input_surface_id, surface); + if (ff_jni_exception_check(env, 1, codec) < 0) + return AVERROR_EXTERNAL; + return 0; + } else { + (*env)->CallVoidMethod(env, codec->object, codec->jfields.configure_id, format->object, surface, NULL, flags); + } + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_setParameters(FFAMediaCodec *ctx, + const FFAMediaFormat* format_ctx) +{ + return AVERROR_PATCHWELCOME; +} + +static int mediacodec_jni_start(FFAMediaCodec* ctx) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.start_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_stop(FFAMediaCodec* ctx) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.stop_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_flush(FFAMediaCodec* ctx) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.flush_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_releaseOutputBuffer(FFAMediaCodec* ctx, size_t idx, int render) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_id, (jint)idx, (jboolean)render); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_releaseOutputBufferAtTime(FFAMediaCodec *ctx, size_t idx, int64_t timestampNs) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.release_output_buffer_at_time_id, (jint)idx, (jlong)timestampNs); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static ssize_t mediacodec_jni_dequeueInputBuffer(FFAMediaCodec* ctx, int64_t timeoutUs) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + ret = (*env)->CallIntMethod(env, codec->object, codec->jfields.dequeue_input_buffer_id, timeoutUs); + if (ff_jni_exception_check(env, 1, codec) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static int mediacodec_jni_queueInputBuffer(FFAMediaCodec* ctx, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.queue_input_buffer_id, (jint)idx, (jint)offset, (jint)size, time, flags); + if ((ret = ff_jni_exception_check(env, 1, codec)) < 0) { + ret = AVERROR_EXTERNAL; + goto fail; + } + +fail: + return ret; +} + +static ssize_t mediacodec_jni_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) +{ + int ret = 0; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + ret = (*env)->CallIntMethod(env, codec->object, codec->jfields.dequeue_output_buffer_id, codec->buffer_info, timeoutUs); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + info->flags = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.flags_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + info->offset = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.offset_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + info->presentationTimeUs = (*env)->GetLongField(env, codec->buffer_info, codec->jfields.presentation_time_us_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + info->size = (*env)->GetIntField(env, codec->buffer_info, codec->jfields.size_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + return ret; +} + +static uint8_t* mediacodec_jni_getInputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) +{ + uint8_t *ret = NULL; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + jobject buffer = NULL; + jobject input_buffers = NULL; + + JNI_GET_ENV_OR_RETURN(env, codec, NULL); + + if (codec->has_get_i_o_buffer) { + buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffer_id, (jint)idx); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } else { + if (!codec->input_buffers) { + input_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_input_buffers_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + codec->input_buffers = (*env)->NewGlobalRef(env, input_buffers); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } + + buffer = (*env)->GetObjectArrayElement(env, codec->input_buffers, idx); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } + + ret = (*env)->GetDirectBufferAddress(env, buffer); + *out_size = (*env)->GetDirectBufferCapacity(env, buffer); +fail: + (*env)->DeleteLocalRef(env, buffer); + (*env)->DeleteLocalRef(env, input_buffers); + + return ret; +} + +static uint8_t* mediacodec_jni_getOutputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) +{ + uint8_t *ret = NULL; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + jobject buffer = NULL; + jobject output_buffers = NULL; + + JNI_GET_ENV_OR_RETURN(env, codec, NULL); + + if (codec->has_get_i_o_buffer) { + buffer = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffer_id, (jint)idx); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } else { + if (!codec->output_buffers) { + output_buffers = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_buffers_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + codec->output_buffers = (*env)->NewGlobalRef(env, output_buffers); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } + + buffer = (*env)->GetObjectArrayElement(env, codec->output_buffers, idx); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + } + + ret = (*env)->GetDirectBufferAddress(env, buffer); + *out_size = (*env)->GetDirectBufferCapacity(env, buffer); +fail: + (*env)->DeleteLocalRef(env, buffer); + (*env)->DeleteLocalRef(env, output_buffers); + + return ret; +} + +static FFAMediaFormat* mediacodec_jni_getOutputFormat(FFAMediaCodec* ctx) +{ + FFAMediaFormat *ret = NULL; + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + jobject mediaformat = NULL; + + JNI_GET_ENV_OR_RETURN(env, codec, NULL); + + mediaformat = (*env)->CallObjectMethod(env, codec->object, codec->jfields.get_output_format_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + goto fail; + } + + ret = mediaformat_jni_newFromObject(mediaformat); +fail: + (*env)->DeleteLocalRef(env, mediaformat); + + return ret; +} + +static int mediacodec_jni_infoTryAgainLater(FFAMediaCodec *ctx, ssize_t idx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return idx == codec->INFO_TRY_AGAIN_LATER; +} + +static int mediacodec_jni_infoOutputBuffersChanged(FFAMediaCodec *ctx, ssize_t idx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return idx == codec->INFO_OUTPUT_BUFFERS_CHANGED; +} + +static int mediacodec_jni_infoOutputFormatChanged(FFAMediaCodec *ctx, ssize_t idx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return idx == codec->INFO_OUTPUT_FORMAT_CHANGED; +} + +static int mediacodec_jni_getBufferFlagCodecConfig(FFAMediaCodec *ctx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return codec->BUFFER_FLAG_CODEC_CONFIG; +} + +static int mediacodec_jni_getBufferFlagEndOfStream(FFAMediaCodec *ctx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return codec->BUFFER_FLAG_END_OF_STREAM; +} + +static int mediacodec_jni_getBufferFlagKeyFrame(FFAMediaCodec *ctx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return codec->BUFFER_FLAG_KEY_FRAME; +} + +static int mediacodec_jni_getConfigureFlagEncode(FFAMediaCodec *ctx) +{ + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + return codec->CONFIGURE_FLAG_ENCODE; +} + +static int mediacodec_jni_cleanOutputBuffers(FFAMediaCodec *ctx) +{ + int ret = 0; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + if (!codec->has_get_i_o_buffer) { + if (codec->output_buffers) { + JNIEnv *env = NULL; + + env = ff_jni_get_env(codec); + if (!env) { + ret = AVERROR_EXTERNAL; + goto fail; + } + + (*env)->DeleteGlobalRef(env, codec->output_buffers); + codec->output_buffers = NULL; + } + } + +fail: + return ret; +} + +static int mediacodec_jni_signalEndOfInputStream(FFAMediaCodec *ctx) +{ + JNIEnv *env = NULL; + FFAMediaCodecJni *codec = (FFAMediaCodecJni *)ctx; + + JNI_GET_ENV_OR_RETURN(env, codec, AVERROR_EXTERNAL); + + (*env)->CallVoidMethod(env, codec->object, codec->jfields.signal_end_of_input_stream_id); + if (ff_jni_exception_check(env, 1, codec) < 0) { + return AVERROR_EXTERNAL; + } + + return 0; +} + +static int mediacodec_jni_setAsyncNotifyCallback(FFAMediaCodec *codec, + const FFAMediaCodecOnAsyncNotifyCallback *callback, + void *userdata) +{ + av_log(codec, AV_LOG_ERROR, "Doesn't support aync mode with JNI, please try ndk_codec=1\n"); + return AVERROR(ENOSYS); +} + +static const FFAMediaFormat media_format_jni = { + .class = &amediaformat_class, + + .create = mediaformat_jni_new, + .delete = mediaformat_jni_delete, + + .toString = mediaformat_jni_toString, + + .getInt32 = mediaformat_jni_getInt32, + .getInt64 = mediaformat_jni_getInt64, + .getFloat = mediaformat_jni_getFloat, + .getBuffer = mediaformat_jni_getBuffer, + .getString = mediaformat_jni_getString, + + .setInt32 = mediaformat_jni_setInt32, + .setInt64 = mediaformat_jni_setInt64, + .setFloat = mediaformat_jni_setFloat, + .setString = mediaformat_jni_setString, + .setBuffer = mediaformat_jni_setBuffer, +}; + +static const FFAMediaCodec media_codec_jni = { + .class = &amediacodec_class, + + .getName = mediacodec_jni_getName, + + .createCodecByName = mediacodec_jni_createCodecByName, + .createDecoderByType = mediacodec_jni_createDecoderByType, + .createEncoderByType = mediacodec_jni_createEncoderByType, + .delete = mediacodec_jni_delete, + + .configure = mediacodec_jni_configure, + .setParameters = mediacodec_jni_setParameters, + .start = mediacodec_jni_start, + .stop = mediacodec_jni_stop, + .flush = mediacodec_jni_flush, + + .getInputBuffer = mediacodec_jni_getInputBuffer, + .getOutputBuffer = mediacodec_jni_getOutputBuffer, + + .dequeueInputBuffer = mediacodec_jni_dequeueInputBuffer, + .queueInputBuffer = mediacodec_jni_queueInputBuffer, + + .dequeueOutputBuffer = mediacodec_jni_dequeueOutputBuffer, + .getOutputFormat = mediacodec_jni_getOutputFormat, + + .releaseOutputBuffer = mediacodec_jni_releaseOutputBuffer, + .releaseOutputBufferAtTime = mediacodec_jni_releaseOutputBufferAtTime, + + .infoTryAgainLater = mediacodec_jni_infoTryAgainLater, + .infoOutputBuffersChanged = mediacodec_jni_infoOutputBuffersChanged, + .infoOutputFormatChanged = mediacodec_jni_infoOutputFormatChanged, + + .getBufferFlagCodecConfig = mediacodec_jni_getBufferFlagCodecConfig, + .getBufferFlagEndOfStream = mediacodec_jni_getBufferFlagEndOfStream, + .getBufferFlagKeyFrame = mediacodec_jni_getBufferFlagKeyFrame, + + .getConfigureFlagEncode = mediacodec_jni_getConfigureFlagEncode, + .cleanOutputBuffers = mediacodec_jni_cleanOutputBuffers, + .signalEndOfInputStream = mediacodec_jni_signalEndOfInputStream, + .setAsyncNotifyCallback = mediacodec_jni_setAsyncNotifyCallback, +}; + +typedef struct FFAMediaFormatNdk { + FFAMediaFormat api; + + void *libmedia; + AMediaFormat *impl; + + bool (*getRect)(AMediaFormat *, const char *name, + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); + void (*setRect)(AMediaFormat *, const char *name, + int32_t left, int32_t top, int32_t right, int32_t bottom); +} FFAMediaFormatNdk; + +typedef struct FFAMediaCodecNdk { + FFAMediaCodec api; + + void *libmedia; + AMediaCodec *impl; + ANativeWindow *window; + + FFAMediaCodecOnAsyncNotifyCallback async_cb; + void *async_userdata; + + // Available since API level 28. + media_status_t (*getName)(AMediaCodec*, char** out_name); + void (*releaseName)(AMediaCodec*, char* name); + + // Available since API level 26. + media_status_t (*setInputSurface)(AMediaCodec*, ANativeWindow *); + media_status_t (*signalEndOfInputStream)(AMediaCodec *); + media_status_t (*setAsyncNotifyCallback)(AMediaCodec *, + struct AMediaCodecOnAsyncNotifyCallback callback, void *userdata); +} FFAMediaCodecNdk; + +static const FFAMediaFormat media_format_ndk; +static const FFAMediaCodec media_codec_ndk; + +static const AVClass amediaformat_ndk_class = { + .class_name = "amediaformat_ndk", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, +}; + +static const AVClass amediacodec_ndk_class = { + .class_name = "amediacodec_ndk", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, +}; + +static int media_status_to_error(media_status_t status) +{ + switch (status) { + case AMEDIA_OK: + return 0; + case AMEDIACODEC_ERROR_INSUFFICIENT_RESOURCE: + return AVERROR(ENOMEM); + case AMEDIA_ERROR_MALFORMED: + return AVERROR_INVALIDDATA; + case AMEDIA_ERROR_UNSUPPORTED: + return AVERROR(ENOTSUP); + case AMEDIA_ERROR_INVALID_PARAMETER: + return AVERROR(EINVAL); + case AMEDIA_ERROR_INVALID_OPERATION: + return AVERROR(EOPNOTSUPP); + case AMEDIA_ERROR_END_OF_STREAM: + return AVERROR_EOF; + case AMEDIA_ERROR_IO: + return AVERROR(EIO); + case AMEDIA_ERROR_WOULD_BLOCK: + return AVERROR(EWOULDBLOCK); + default: + return AVERROR_EXTERNAL; + } +} + +static FFAMediaFormat *mediaformat_ndk_create(AMediaFormat *impl) +{ + FFAMediaFormatNdk *format = av_mallocz(sizeof(*format)); + if (!format) + return NULL; + + format->api = media_format_ndk; + + format->libmedia = dlopen("libmediandk.so", RTLD_NOW); + if (!format->libmedia) + goto error; + +#define GET_OPTIONAL_SYMBOL(sym) \ + format->sym = dlsym(format->libmedia, "AMediaFormat_" #sym); + + GET_OPTIONAL_SYMBOL(getRect) + GET_OPTIONAL_SYMBOL(setRect) + +#undef GET_OPTIONAL_SYMBOL + + if (impl) { + format->impl = impl; + } else { + format->impl = AMediaFormat_new(); + if (!format->impl) + goto error; + } + + return (FFAMediaFormat *)format; + +error: + if (format->libmedia) + dlclose(format->libmedia); + av_freep(&format); + return NULL; +} + +static FFAMediaFormat *mediaformat_ndk_new(void) +{ + return mediaformat_ndk_create(NULL); +} + +static int mediaformat_ndk_delete(FFAMediaFormat* ctx) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + int ret = 0; + if (!format) + return 0; + + av_assert0(format->api.class == &amediaformat_ndk_class); + + if (format->impl && (AMediaFormat_delete(format->impl) != AMEDIA_OK)) + ret = AVERROR_EXTERNAL; + if (format->libmedia) + dlclose(format->libmedia); + av_free(format); + + return ret; +} + +static char* mediaformat_ndk_toString(FFAMediaFormat* ctx) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + const char *str = AMediaFormat_toString(format->impl); + return av_strdup(str); +} + +static int mediaformat_ndk_getInt32(FFAMediaFormat* ctx, const char *name, int32_t *out) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + return AMediaFormat_getInt32(format->impl, name, out); +} + +static int mediaformat_ndk_getInt64(FFAMediaFormat* ctx, const char *name, int64_t *out) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + return AMediaFormat_getInt64(format->impl, name, out); +} + +static int mediaformat_ndk_getFloat(FFAMediaFormat* ctx, const char *name, float *out) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + return AMediaFormat_getFloat(format->impl, name, out); +} + +static int mediaformat_ndk_getBuffer(FFAMediaFormat* ctx, const char *name, void** data, size_t *size) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + return AMediaFormat_getBuffer(format->impl, name, data, size); +} + +static int mediaformat_ndk_getString(FFAMediaFormat* ctx, const char *name, const char **out) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + const char *tmp = NULL; + int ret = AMediaFormat_getString(format->impl, name, &tmp); + + if (tmp) + *out = av_strdup(tmp); + return ret; +} + +static int mediaformat_ndk_getRect(FFAMediaFormat *ctx, const char *name, + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + if (!format->getRect) + return AVERROR_EXTERNAL; + return format->getRect(format->impl, name, left, top, right, bottom); +} + +static void mediaformat_ndk_setInt32(FFAMediaFormat* ctx, const char* name, int32_t value) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + AMediaFormat_setInt32(format->impl, name, value); +} + +static void mediaformat_ndk_setInt64(FFAMediaFormat* ctx, const char* name, int64_t value) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + AMediaFormat_setInt64(format->impl, name, value); +} + +static void mediaformat_ndk_setFloat(FFAMediaFormat* ctx, const char* name, float value) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + AMediaFormat_setFloat(format->impl, name, value); +} + +static void mediaformat_ndk_setString(FFAMediaFormat* ctx, const char* name, const char* value) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + AMediaFormat_setString(format->impl, name, value); +} + +static void mediaformat_ndk_setBuffer(FFAMediaFormat* ctx, const char* name, void* data, size_t size) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + AMediaFormat_setBuffer(format->impl, name, data, size); +} + +static void mediaformat_ndk_setRect(FFAMediaFormat *ctx, const char *name, + int32_t left, int32_t top, int32_t right, int32_t bottom) +{ + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)ctx; + if (!format->setRect) { + av_log(ctx, AV_LOG_WARNING, "Doesn't support setRect\n"); + return; + } + format->setRect(format->impl, name, left, top, right, bottom); +} + +static char *mediacodec_ndk_getName(FFAMediaCodec *ctx) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + char *ret = NULL; + char *name = NULL; + + if (!codec->getName || !codec->releaseName) { + av_log(ctx, AV_LOG_DEBUG, "getName() unavailable\n"); + return ret; + } + + codec->getName(codec->impl, &name); + if (name) { + ret = av_strdup(name); + codec->releaseName(codec->impl, name); + } + + return ret; +} + +static inline FFAMediaCodec *ndk_codec_create(int method, const char *arg) { + FFAMediaCodecNdk *codec = av_mallocz(sizeof(*codec)); + const char *lib_name = "libmediandk.so"; + + if (!codec) + return NULL; + + codec->api = media_codec_ndk; + codec->libmedia = dlopen(lib_name, RTLD_NOW); + if (!codec->libmedia) + goto error; + +#define GET_SYMBOL(sym) \ + codec->sym = dlsym(codec->libmedia, "AMediaCodec_" #sym); \ + if (!codec->sym) \ + av_log(codec, AV_LOG_INFO, #sym "() unavailable from %s\n", lib_name); + + GET_SYMBOL(getName) + GET_SYMBOL(releaseName) + + GET_SYMBOL(setInputSurface) + GET_SYMBOL(signalEndOfInputStream) + GET_SYMBOL(setAsyncNotifyCallback) + +#undef GET_SYMBOL + + switch (method) { + case CREATE_CODEC_BY_NAME: + codec->impl = AMediaCodec_createCodecByName(arg); + break; + case CREATE_DECODER_BY_TYPE: + codec->impl = AMediaCodec_createDecoderByType(arg); + break; + case CREATE_ENCODER_BY_TYPE: + codec->impl = AMediaCodec_createEncoderByType(arg); + break; + default: + av_assert0(0); + } + if (!codec->impl) + goto error; + + return (FFAMediaCodec *)codec; + +error: + if (codec->libmedia) + dlclose(codec->libmedia); + av_freep(&codec); + return NULL; +} + +#define DECLARE_NDK_AMEDIACODEC_CREATE_FUNC(name, method) \ +static FFAMediaCodec *mediacodec_ndk_##name(const char *arg) \ +{ \ + return ndk_codec_create(method, arg); \ +} \ + +DECLARE_NDK_AMEDIACODEC_CREATE_FUNC(createCodecByName, CREATE_CODEC_BY_NAME) +DECLARE_NDK_AMEDIACODEC_CREATE_FUNC(createDecoderByType, CREATE_DECODER_BY_TYPE) +DECLARE_NDK_AMEDIACODEC_CREATE_FUNC(createEncoderByType, CREATE_ENCODER_BY_TYPE) + +static int mediacodec_ndk_delete(FFAMediaCodec* ctx) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + int ret = 0; + + if (!codec) + return 0; + + av_assert0(codec->api.class == &amediacodec_ndk_class); + + if (codec->impl && (AMediaCodec_delete(codec->impl) != AMEDIA_OK)) + ret = AVERROR_EXTERNAL; + if (codec->window) + ANativeWindow_release(codec->window); + if (codec->libmedia) + dlclose(codec->libmedia); + av_free(codec); + + return ret; +} + +static int mediacodec_ndk_configure(FFAMediaCodec* ctx, + const FFAMediaFormat* format_ctx, + FFANativeWindow* window, + void *crypto, + uint32_t flags) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)format_ctx; + media_status_t status; + ANativeWindow *native_window = NULL; + + if (window) { + if (window->surface) { + JNIEnv *env = NULL; + JNI_GET_ENV_OR_RETURN(env, ctx, -1); + native_window = ANativeWindow_fromSurface(env, window->surface); + // Save for release + codec->window = native_window; + } else if (window->native_window) { + native_window = window->native_window; + } + } + + if (format_ctx->class != &amediaformat_ndk_class) { + av_log(ctx, AV_LOG_ERROR, "invalid media format\n"); + return AVERROR(EINVAL); + } + + if (flags & AMEDIACODEC_CONFIGURE_FLAG_ENCODE) { + if (native_window && !codec->setInputSurface) { + av_log(ctx, AV_LOG_ERROR, "System doesn't support setInputSurface\n"); + return AVERROR_EXTERNAL; + } + + status = AMediaCodec_configure(codec->impl, format->impl, NULL, NULL, flags); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "Encoder configure failed, %d\n", status); + return AVERROR_EXTERNAL; + } + + if (!native_window) + return 0; + + status = codec->setInputSurface(codec->impl, native_window); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "Encoder set input surface failed, %d\n", status); + return AVERROR_EXTERNAL; + } + } else { + status = AMediaCodec_configure(codec->impl, format->impl, native_window, NULL, flags); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "Decoder configure failed, %d\n", status); + return AVERROR_EXTERNAL; + } + } + + return 0; +} + +static int mediacodec_ndk_setParameters(FFAMediaCodec *ctx, + const FFAMediaFormat* format_ctx) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)format_ctx; + media_status_t status; + + if (format_ctx->class != &amediaformat_ndk_class) { + av_log(ctx, AV_LOG_ERROR, "invalid media format\n"); + return AVERROR(EINVAL); + } + + if (__builtin_available(android 26, *)) { + status = AMediaCodec_setParameters(codec->impl, format->impl); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "setParameters failed, %d\n", status); + return AVERROR_EXTERNAL; + } + return 0; + } + + return AVERROR(ENOSYS); +} + +#define MEDIACODEC_NDK_WRAPPER(method) \ +static int mediacodec_ndk_ ## method(FFAMediaCodec* ctx) \ +{ \ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; \ + media_status_t status = AMediaCodec_ ## method (codec->impl); \ + \ + if (status != AMEDIA_OK) { \ + av_log(codec, AV_LOG_ERROR, #method " failed, %d\n", status); \ + return AVERROR_EXTERNAL; \ + } \ + \ + return 0; \ +} \ + +MEDIACODEC_NDK_WRAPPER(start) +MEDIACODEC_NDK_WRAPPER(stop) +MEDIACODEC_NDK_WRAPPER(flush) + +static uint8_t* mediacodec_ndk_getInputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + return AMediaCodec_getInputBuffer(codec->impl, idx, out_size); +} + +static uint8_t* mediacodec_ndk_getOutputBuffer(FFAMediaCodec* ctx, size_t idx, size_t *out_size) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + return AMediaCodec_getOutputBuffer(codec->impl, idx, out_size); +} + +static ssize_t mediacodec_ndk_dequeueInputBuffer(FFAMediaCodec* ctx, int64_t timeoutUs) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + return AMediaCodec_dequeueInputBuffer(codec->impl, timeoutUs); +} + +static int mediacodec_ndk_queueInputBuffer(FFAMediaCodec *ctx, size_t idx, + off_t offset, size_t size, + uint64_t time, uint32_t flags) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + return AMediaCodec_queueInputBuffer(codec->impl, idx, offset, size, time, flags); +} + +static ssize_t mediacodec_ndk_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + AMediaCodecBufferInfo buf_info = {0}; + ssize_t ret; + + ret = AMediaCodec_dequeueOutputBuffer(codec->impl, &buf_info, timeoutUs); + info->offset = buf_info.offset; + info->size = buf_info.size; + info->presentationTimeUs = buf_info.presentationTimeUs; + info->flags = buf_info.flags; + + return ret; +} + +static FFAMediaFormat* mediacodec_ndk_getOutputFormat(FFAMediaCodec* ctx) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + AMediaFormat *format = AMediaCodec_getOutputFormat(codec->impl); + + if (!format) + return NULL; + return mediaformat_ndk_create(format); +} + +static int mediacodec_ndk_releaseOutputBuffer(FFAMediaCodec* ctx, size_t idx, int render) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + media_status_t status; + + status = AMediaCodec_releaseOutputBuffer(codec->impl, idx, render); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "release output buffer failed, %d\n", status); + return AVERROR_EXTERNAL; + } + + return 0; +} + +static int mediacodec_ndk_releaseOutputBufferAtTime(FFAMediaCodec *ctx, size_t idx, int64_t timestampNs) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + media_status_t status; + + status = AMediaCodec_releaseOutputBufferAtTime(codec->impl, idx, timestampNs); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "releaseOutputBufferAtTime failed, %d\n", status); + return AVERROR_EXTERNAL; + } + + return 0; +} + +static int mediacodec_ndk_infoTryAgainLater(FFAMediaCodec *ctx, ssize_t idx) +{ + return idx == AMEDIACODEC_INFO_TRY_AGAIN_LATER; +} + +static int mediacodec_ndk_infoOutputBuffersChanged(FFAMediaCodec *ctx, ssize_t idx) +{ + return idx == AMEDIACODEC_INFO_OUTPUT_BUFFERS_CHANGED; +} + +static int mediacodec_ndk_infoOutputFormatChanged(FFAMediaCodec *ctx, ssize_t idx) +{ + return idx == AMEDIACODEC_INFO_OUTPUT_FORMAT_CHANGED; +} + +static int mediacodec_ndk_getBufferFlagCodecConfig(FFAMediaCodec *ctx) +{ + return AMEDIACODEC_BUFFER_FLAG_CODEC_CONFIG; +} + +static int mediacodec_ndk_getBufferFlagEndOfStream(FFAMediaCodec *ctx) +{ + return AMEDIACODEC_BUFFER_FLAG_END_OF_STREAM; +} + +static int mediacodec_ndk_getBufferFlagKeyFrame(FFAMediaCodec *ctx) +{ + return 1; +} + +static int mediacodec_ndk_getConfigureFlagEncode(FFAMediaCodec *ctx) +{ + return AMEDIACODEC_CONFIGURE_FLAG_ENCODE; +} + +static int mediacodec_ndk_cleanOutputBuffers(FFAMediaCodec *ctx) +{ + return 0; +} + +static int mediacodec_ndk_signalEndOfInputStream(FFAMediaCodec *ctx) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + media_status_t status; + + if (!codec->signalEndOfInputStream) { + av_log(codec, AV_LOG_ERROR, "signalEndOfInputStream unavailable\n"); + return AVERROR_EXTERNAL; + } + + status = codec->signalEndOfInputStream(codec->impl); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "signalEndOfInputStream failed, %d\n", status); + return AVERROR_EXTERNAL; + } + av_log(codec, AV_LOG_DEBUG, "signalEndOfInputStream success\n"); + + return 0; +} + +static void mediacodec_ndk_onInputAvailable(AMediaCodec *impl, void *userdata, + int32_t index) +{ + FFAMediaCodecNdk *codec = userdata; + codec->async_cb.onAsyncInputAvailable((FFAMediaCodec *) codec, + codec->async_userdata, index); +} + +static void mediacodec_ndk_onOutputAvailable(AMediaCodec *impl, + void *userdata, + int32_t index, + AMediaCodecBufferInfo *buffer_info) +{ + FFAMediaCodecNdk *codec = userdata; + FFAMediaCodecBufferInfo info = { + .offset = buffer_info->offset, + .size = buffer_info->size, + .presentationTimeUs = buffer_info->presentationTimeUs, + .flags = buffer_info->flags, + }; + + codec->async_cb.onAsyncOutputAvailable(&codec->api, codec->async_userdata, + index, &info); +} + +static void mediacodec_ndk_onFormatChanged(AMediaCodec *impl, void *userdata, + AMediaFormat *format) +{ + FFAMediaCodecNdk *codec = userdata; + FFAMediaFormat *media_format = mediaformat_ndk_create(format); + if (!media_format) + return; + + codec->async_cb.onAsyncFormatChanged(&codec->api, codec->async_userdata, + media_format); + ff_AMediaFormat_delete(media_format); +} + +static void mediacodec_ndk_onError(AMediaCodec *impl, void *userdata, + media_status_t status, + int32_t actionCode, + const char *detail) +{ + FFAMediaCodecNdk *codec = userdata; + int error = media_status_to_error(status); + + codec->async_cb.onAsyncError(&codec->api, codec->async_userdata, error, + detail); +} + +static int mediacodec_ndk_setAsyncNotifyCallback(FFAMediaCodec *ctx, + const FFAMediaCodecOnAsyncNotifyCallback *callback, + void *userdata) +{ + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; + struct AMediaCodecOnAsyncNotifyCallback cb = { + .onAsyncInputAvailable = mediacodec_ndk_onInputAvailable, + .onAsyncOutputAvailable = mediacodec_ndk_onOutputAvailable, + .onAsyncFormatChanged = mediacodec_ndk_onFormatChanged, + .onAsyncError = mediacodec_ndk_onError, + }; + media_status_t status; + + if (!codec->setAsyncNotifyCallback) { + av_log(codec, AV_LOG_ERROR, "setAsyncNotifyCallback unavailable\n"); + return AVERROR(ENOSYS); + } + + if (!callback || + !callback->onAsyncInputAvailable || + !callback->onAsyncOutputAvailable || + !callback->onAsyncFormatChanged || + !callback->onAsyncError) + return AVERROR(EINVAL); + + codec->async_cb = *callback; + codec->async_userdata = userdata; + + status = codec->setAsyncNotifyCallback(codec->impl, cb, codec); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "setAsyncNotifyCallback failed, %d\n", + status); + return AVERROR_EXTERNAL; + } + + return 0; +} + +static const FFAMediaFormat media_format_ndk = { + .class = &amediaformat_ndk_class, + + .create = mediaformat_ndk_new, + .delete = mediaformat_ndk_delete, + + .toString = mediaformat_ndk_toString, + + .getInt32 = mediaformat_ndk_getInt32, + .getInt64 = mediaformat_ndk_getInt64, + .getFloat = mediaformat_ndk_getFloat, + .getBuffer = mediaformat_ndk_getBuffer, + .getString = mediaformat_ndk_getString, + .getRect = mediaformat_ndk_getRect, + + .setInt32 = mediaformat_ndk_setInt32, + .setInt64 = mediaformat_ndk_setInt64, + .setFloat = mediaformat_ndk_setFloat, + .setString = mediaformat_ndk_setString, + .setBuffer = mediaformat_ndk_setBuffer, + .setRect = mediaformat_ndk_setRect, +}; + +static const FFAMediaCodec media_codec_ndk = { + .class = &amediacodec_ndk_class, + + .getName = mediacodec_ndk_getName, + + .createCodecByName = mediacodec_ndk_createCodecByName, + .createDecoderByType = mediacodec_ndk_createDecoderByType, + .createEncoderByType = mediacodec_ndk_createEncoderByType, + .delete = mediacodec_ndk_delete, + + .configure = mediacodec_ndk_configure, + .setParameters = mediacodec_ndk_setParameters, + .start = mediacodec_ndk_start, + .stop = mediacodec_ndk_stop, + .flush = mediacodec_ndk_flush, + + .getInputBuffer = mediacodec_ndk_getInputBuffer, + .getOutputBuffer = mediacodec_ndk_getOutputBuffer, + + .dequeueInputBuffer = mediacodec_ndk_dequeueInputBuffer, + .queueInputBuffer = mediacodec_ndk_queueInputBuffer, + + .dequeueOutputBuffer = mediacodec_ndk_dequeueOutputBuffer, + .getOutputFormat = mediacodec_ndk_getOutputFormat, + + .releaseOutputBuffer = mediacodec_ndk_releaseOutputBuffer, + .releaseOutputBufferAtTime = mediacodec_ndk_releaseOutputBufferAtTime, + + .infoTryAgainLater = mediacodec_ndk_infoTryAgainLater, + .infoOutputBuffersChanged = mediacodec_ndk_infoOutputBuffersChanged, + .infoOutputFormatChanged = mediacodec_ndk_infoOutputFormatChanged, + + .getBufferFlagCodecConfig = mediacodec_ndk_getBufferFlagCodecConfig, + .getBufferFlagEndOfStream = mediacodec_ndk_getBufferFlagEndOfStream, + .getBufferFlagKeyFrame = mediacodec_ndk_getBufferFlagKeyFrame, + + .getConfigureFlagEncode = mediacodec_ndk_getConfigureFlagEncode, + .cleanOutputBuffers = mediacodec_ndk_cleanOutputBuffers, + .signalEndOfInputStream = mediacodec_ndk_signalEndOfInputStream, + .setAsyncNotifyCallback = mediacodec_ndk_setAsyncNotifyCallback, +}; + +FFAMediaFormat *ff_AMediaFormat_new(int ndk) +{ + if (ndk) + return media_format_ndk.create(); + return media_format_jni.create(); +} + +FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name, int ndk) +{ + if (ndk) + return media_codec_ndk.createCodecByName(name); + return media_codec_jni.createCodecByName(name); +} + +FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime_type, int ndk) +{ + if (ndk) + return media_codec_ndk.createDecoderByType(mime_type); + return media_codec_jni.createDecoderByType(mime_type); +} + +FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime_type, int ndk) +{ + if (ndk) + return media_codec_ndk.createEncoderByType(mime_type); + return media_codec_jni.createEncoderByType(mime_type); +} + +int ff_Build_SDK_INT(AVCodecContext *avctx) +{ + int ret = -1; + +#if __ANDROID_API__ >= 24 + // android_get_device_api_level() is a static inline before API level 29. + // dlsym() might doesn't work. + // + // We can implement android_get_device_api_level() by + // __system_property_get(), but __system_property_get() has created a lot of + // troubles and is deprecated. So avoid using __system_property_get() for + // now. + // + // Hopy we can remove the conditional compilation finally by bumping the + // required API level. + // + ret = android_get_device_api_level(); +#else + JNIEnv *env = NULL; + jclass versionClass; + jfieldID sdkIntFieldID; + JNI_GET_ENV_OR_RETURN(env, avctx, -1); + + versionClass = (*env)->FindClass(env, "android/os/Build$VERSION"); + sdkIntFieldID = (*env)->GetStaticFieldID(env, versionClass, "SDK_INT", "I"); + ret = (*env)->GetStaticIntField(env, versionClass, sdkIntFieldID); + (*env)->DeleteLocalRef(env, versionClass); +#endif + av_log(avctx, AV_LOG_DEBUG, "device api level %d\n", ret); + + return ret; +} + +static struct { + enum FFAMediaFormatColorRange mf_range; + enum AVColorRange range; +} color_range_map[] = { + { COLOR_RANGE_FULL, AVCOL_RANGE_JPEG }, + { COLOR_RANGE_LIMITED, AVCOL_RANGE_MPEG }, +}; + +static struct { + enum FFAMediaFormatColorStandard mf_standard; + enum AVColorSpace space; +} color_space_map[] = { + { COLOR_STANDARD_BT709, AVCOL_SPC_BT709 }, + { COLOR_STANDARD_BT601_PAL, AVCOL_SPC_BT470BG }, + { COLOR_STANDARD_BT601_NTSC, AVCOL_SPC_SMPTE170M }, + { COLOR_STANDARD_BT2020, AVCOL_SPC_BT2020_NCL }, +}; + +static struct { + enum FFAMediaFormatColorStandard mf_standard; + enum AVColorPrimaries primaries; +} color_primaries_map[] = { + { COLOR_STANDARD_BT709, AVCOL_PRI_BT709 }, + { COLOR_STANDARD_BT601_PAL, AVCOL_PRI_BT470BG }, + { COLOR_STANDARD_BT601_NTSC, AVCOL_PRI_SMPTE170M }, + { COLOR_STANDARD_BT2020, AVCOL_PRI_BT2020 }, +}; + +static struct { + enum FFAMediaFormatColorTransfer mf_transfer; + enum AVColorTransferCharacteristic transfer; +} color_transfer_map[] = { + { COLOR_TRANSFER_LINEAR, AVCOL_TRC_LINEAR }, + { COLOR_TRANSFER_SDR_VIDEO, AVCOL_TRC_SMPTE170M }, + { COLOR_TRANSFER_ST2084, AVCOL_TRC_SMPTEST2084 }, + { COLOR_TRANSFER_HLG, AVCOL_TRC_ARIB_STD_B67 }, +}; + +enum AVColorRange ff_AMediaFormatColorRange_to_AVColorRange(int color_range) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_range_map); i++) + if (color_range_map[i].mf_range == color_range) + return color_range_map[i].range; + + return AVCOL_RANGE_UNSPECIFIED; +} + +int ff_AMediaFormatColorRange_from_AVColorRange(enum AVColorRange color_range) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_range_map); i++) + if (color_range_map[i].range == color_range) + return color_range_map[i].mf_range; + return COLOR_RANGE_UNSPECIFIED; +} + +enum AVColorSpace ff_AMediaFormatColorStandard_to_AVColorSpace(int color_standard) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_space_map); i++) + if (color_space_map[i].mf_standard == color_standard) + return color_space_map[i].space; + + return AVCOL_SPC_UNSPECIFIED; +} + +int ff_AMediaFormatColorStandard_from_AVColorSpace(enum AVColorSpace color_space) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_space_map); i++) + if (color_space_map[i].space == color_space) + return color_space_map[i].mf_standard; + + return COLOR_STANDARD_UNSPECIFIED; +} + +enum AVColorPrimaries ff_AMediaFormatColorStandard_to_AVColorPrimaries(int color_standard) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_primaries_map); i++) + if (color_primaries_map[i].mf_standard == color_standard) + return color_primaries_map[i].primaries; + + return AVCOL_PRI_UNSPECIFIED; +} + +enum AVColorTransferCharacteristic +ff_AMediaFormatColorTransfer_to_AVColorTransfer(int color_transfer) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_transfer_map); i++) + if (color_transfer_map[i].mf_transfer == color_transfer) + return color_transfer_map[i].transfer; + + return AVCOL_TRC_UNSPECIFIED; +} + +int ff_AMediaFormatColorTransfer_from_AVColorTransfer( + enum AVColorTransferCharacteristic color_transfer) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(color_transfer_map); i++) + if (color_transfer_map[i].transfer == color_transfer) + return color_transfer_map[i].mf_transfer; + + return COLOR_TRANSFER_UNSPECIFIED; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_wrapper.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodec_wrapper.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodec_wrapper.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,456 @@ +/* + * Android MediaCodec Wrapper + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_MEDIACODEC_WRAPPER_H +#define AVCODEC_MEDIACODEC_WRAPPER_H + +#include +#include + +#include "avcodec.h" +#include "mediacodec_surface.h" + +/** + * The following API around MediaCodec and MediaFormat is based on the + * NDK one provided by Google since Android 5.0. + * + * Differences from the NDK API: + * + * Buffers returned by ff_AMediaFormat_toString and ff_AMediaFormat_getString + * are newly allocated buffer and must be freed by the user after use. + * + * The MediaCrypto API is not implemented. + * + * ff_AMediaCodec_infoTryAgainLater, ff_AMediaCodec_infoOutputBuffersChanged, + * ff_AMediaCodec_infoOutputFormatChanged, ff_AMediaCodec_cleanOutputBuffers + * ff_AMediaCodec_getName and ff_AMediaCodec_getBufferFlagEndOfStream are not + * part of the original NDK API and are convenience functions to hide JNI + * implementation. + * + * The API around MediaCodecList is not part of the NDK (and is lacking as + * we still need to retrieve the codec name to work around faulty decoders + * and encoders). + * + * For documentation, please refers to NdkMediaCodec.h NdkMediaFormat.h and + * http://developer.android.com/reference/android/media/MediaCodec.html. + * + */ + +int ff_AMediaCodecProfile_getProfileFromAVCodecContext(AVCodecContext *avctx); + +char *ff_AMediaCodecList_getCodecNameByType(const char *mime, int profile, int encoder, void *log_ctx); + +typedef struct FFAMediaFormat FFAMediaFormat; +struct FFAMediaFormat { + const AVClass *class; + + FFAMediaFormat *(*create)(void); + int (*delete)(FFAMediaFormat *); + + char* (*toString)(FFAMediaFormat* format); + + int (*getInt32)(FFAMediaFormat* format, const char *name, int32_t *out); + int (*getInt64)(FFAMediaFormat* format, const char *name, int64_t *out); + int (*getFloat)(FFAMediaFormat* format, const char *name, float *out); + int (*getBuffer)(FFAMediaFormat* format, const char *name, void** data, size_t *size); + int (*getString)(FFAMediaFormat* format, const char *name, const char **out); + // NDK only, introduced in API level 28 + int (*getRect)(FFAMediaFormat *, const char *name, + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom); + + void (*setInt32)(FFAMediaFormat* format, const char* name, int32_t value); + void (*setInt64)(FFAMediaFormat* format, const char* name, int64_t value); + void (*setFloat)(FFAMediaFormat* format, const char* name, float value); + void (*setString)(FFAMediaFormat* format, const char* name, const char* value); + void (*setBuffer)(FFAMediaFormat* format, const char* name, void* data, size_t size); + // NDK only, introduced in API level 28 + void (*setRect)(FFAMediaFormat*, const char* name, + int32_t left, int32_t top, int32_t right, int32_t bottom); +}; + +FFAMediaFormat *ff_AMediaFormat_new(int ndk); + +static inline int ff_AMediaFormat_delete(FFAMediaFormat* format) +{ + return format->delete(format); +} + +static inline char* ff_AMediaFormat_toString(FFAMediaFormat* format) +{ + return format->toString(format); +} + +static inline int ff_AMediaFormat_getInt32(FFAMediaFormat* format, const char *name, int32_t *out) +{ + return format->getInt32(format, name, out); +} + +static inline int ff_AMediaFormat_getInt64(FFAMediaFormat* format, const char *name, int64_t *out) +{ + return format->getInt64(format, name, out); +} + +static inline int ff_AMediaFormat_getFloat(FFAMediaFormat* format, const char *name, float *out) +{ + return format->getFloat(format, name, out); +} + +static inline int ff_AMediaFormat_getBuffer(FFAMediaFormat* format, const char *name, void** data, size_t *size) +{ + return format->getBuffer(format, name, data, size); +} + +static inline int ff_AMediaFormat_getString(FFAMediaFormat* format, const char *name, const char **out) +{ + return format->getString(format, name, out); +} + +static inline int ff_AMediaFormat_getRect(FFAMediaFormat *format, const char *name, + int32_t *left, int32_t *top, int32_t *right, int32_t *bottom) +{ + if (!format->getRect) + return AVERROR_EXTERNAL; + return format->getRect(format, name, left, top, right, bottom); +} + +static inline void ff_AMediaFormat_setInt32(FFAMediaFormat* format, const char* name, int32_t value) +{ + format->setInt32(format, name, value); +} + +static inline void ff_AMediaFormat_setInt64(FFAMediaFormat* format, const char* name, int64_t value) +{ + format->setInt64(format, name, value); +} + +static inline void ff_AMediaFormat_setFloat(FFAMediaFormat* format, const char* name, float value) +{ + format->setFloat(format, name, value); +} + +static inline void ff_AMediaFormat_setString(FFAMediaFormat* format, const char* name, const char* value) +{ + format->setString(format, name, value); +} + +static inline void ff_AMediaFormat_setBuffer(FFAMediaFormat* format, const char* name, void* data, size_t size) +{ + format->setBuffer(format, name, data, size); +} + +static inline void ff_AMediaFormat_setRect(FFAMediaFormat* format, const char* name, + int32_t left, int32_t top, int32_t right, int32_t bottom) +{ + if (!format->setRect) { + av_log(format, AV_LOG_WARNING, "Doesn't support setRect\n"); + return; + } + format->setRect(format, name, left, top, right, bottom); +} + +typedef struct FFAMediaCodecCryptoInfo FFAMediaCodecCryptoInfo; + +struct FFAMediaCodecBufferInfo { + int32_t offset; + int32_t size; + int64_t presentationTimeUs; + uint32_t flags; +}; +typedef struct FFAMediaCodecBufferInfo FFAMediaCodecBufferInfo; + +typedef struct FFAMediaCodec FFAMediaCodec; + +typedef struct FFAMediaCodecOnAsyncNotifyCallback { + void (*onAsyncInputAvailable)(FFAMediaCodec *codec, void *userdata, + int32_t index); + + void (*onAsyncOutputAvailable)(FFAMediaCodec *codec, void *userdata, + int32_t index, + FFAMediaCodecBufferInfo *buffer_info); + + void (*onAsyncFormatChanged)(FFAMediaCodec *codec, void *userdata, + FFAMediaFormat *format); + + void (*onAsyncError)(FFAMediaCodec *codec, void *userdata, int error, + const char *detail); +} FFAMediaCodecOnAsyncNotifyCallback; + +struct FFAMediaCodec { + const AVClass *class; + + char *(*getName)(FFAMediaCodec *codec); + + FFAMediaCodec* (*createCodecByName)(const char *name); + FFAMediaCodec* (*createDecoderByType)(const char *mime_type); + FFAMediaCodec* (*createEncoderByType)(const char *mime_type); + int (*delete)(FFAMediaCodec* codec); + + int (*configure)(FFAMediaCodec* codec, const FFAMediaFormat* format, FFANativeWindow* surface, void *crypto, uint32_t flags); + int (*setParameters)(FFAMediaCodec* codec, const FFAMediaFormat* format); + int (*start)(FFAMediaCodec* codec); + int (*stop)(FFAMediaCodec* codec); + int (*flush)(FFAMediaCodec* codec); + + uint8_t* (*getInputBuffer)(FFAMediaCodec* codec, size_t idx, size_t *out_size); + uint8_t* (*getOutputBuffer)(FFAMediaCodec* codec, size_t idx, size_t *out_size); + + ssize_t (*dequeueInputBuffer)(FFAMediaCodec* codec, int64_t timeoutUs); + int (*queueInputBuffer)(FFAMediaCodec* codec, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags); + + ssize_t (*dequeueOutputBuffer)(FFAMediaCodec* codec, FFAMediaCodecBufferInfo *info, int64_t timeoutUs); + FFAMediaFormat* (*getOutputFormat)(FFAMediaCodec* codec); + + int (*releaseOutputBuffer)(FFAMediaCodec* codec, size_t idx, int render); + int (*releaseOutputBufferAtTime)(FFAMediaCodec *codec, size_t idx, int64_t timestampNs); + + int (*infoTryAgainLater)(FFAMediaCodec *codec, ssize_t idx); + int (*infoOutputBuffersChanged)(FFAMediaCodec *codec, ssize_t idx); + int (*infoOutputFormatChanged)(FFAMediaCodec *codec, ssize_t indx); + + int (*getBufferFlagCodecConfig)(FFAMediaCodec *codec); + int (*getBufferFlagEndOfStream)(FFAMediaCodec *codec); + int (*getBufferFlagKeyFrame)(FFAMediaCodec *codec); + + int (*getConfigureFlagEncode)(FFAMediaCodec *codec); + + int (*cleanOutputBuffers)(FFAMediaCodec *codec); + + // For encoder with FFANativeWindow as input. + int (*signalEndOfInputStream)(FFAMediaCodec *); + + // Introduced in Android API 28 + int (*setAsyncNotifyCallback)(FFAMediaCodec *codec, + const FFAMediaCodecOnAsyncNotifyCallback *callback, + void *userdata); +}; + +static inline char *ff_AMediaCodec_getName(FFAMediaCodec *codec) +{ + return codec->getName(codec); +} + +FFAMediaCodec* ff_AMediaCodec_createCodecByName(const char *name, int ndk); +FFAMediaCodec* ff_AMediaCodec_createDecoderByType(const char *mime_type, int ndk); +FFAMediaCodec* ff_AMediaCodec_createEncoderByType(const char *mime_type, int ndk); + +static inline int ff_AMediaCodec_configure(FFAMediaCodec *codec, + const FFAMediaFormat *format, + FFANativeWindow *surface, + void *crypto, uint32_t flags) +{ + return codec->configure(codec, format, surface, crypto, flags); +} + +static inline int ff_AMediaCodec_setParameters(FFAMediaCodec *codec, + const FFAMediaFormat *format) +{ + return codec->setParameters(codec, format); +} + +static inline int ff_AMediaCodec_start(FFAMediaCodec* codec) +{ + return codec->start(codec); +} + +static inline int ff_AMediaCodec_stop(FFAMediaCodec* codec) +{ + return codec->stop(codec); +} + +static inline int ff_AMediaCodec_flush(FFAMediaCodec* codec) +{ + return codec->flush(codec); +} + +static inline int ff_AMediaCodec_delete(FFAMediaCodec* codec) +{ + return codec->delete(codec); +} + +static inline uint8_t* ff_AMediaCodec_getInputBuffer(FFAMediaCodec* codec, size_t idx, size_t *out_size) +{ + return codec->getInputBuffer(codec, idx, out_size); +} + +static inline uint8_t* ff_AMediaCodec_getOutputBuffer(FFAMediaCodec* codec, size_t idx, size_t *out_size) +{ + return codec->getOutputBuffer(codec, idx, out_size); +} + +static inline ssize_t ff_AMediaCodec_dequeueInputBuffer(FFAMediaCodec* codec, int64_t timeoutUs) +{ + return codec->dequeueInputBuffer(codec, timeoutUs); +} + +static inline int ff_AMediaCodec_queueInputBuffer(FFAMediaCodec *codec, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags) +{ + return codec->queueInputBuffer(codec, idx, offset, size, time, flags); +} + +static inline ssize_t ff_AMediaCodec_dequeueOutputBuffer(FFAMediaCodec* codec, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) +{ + return codec->dequeueOutputBuffer(codec, info, timeoutUs); +} + +static inline FFAMediaFormat* ff_AMediaCodec_getOutputFormat(FFAMediaCodec* codec) +{ + return codec->getOutputFormat(codec); +} + +static inline int ff_AMediaCodec_releaseOutputBuffer(FFAMediaCodec* codec, size_t idx, int render) +{ + return codec->releaseOutputBuffer(codec, idx, render); +} + +static inline int ff_AMediaCodec_releaseOutputBufferAtTime(FFAMediaCodec *codec, size_t idx, int64_t timestampNs) +{ + return codec->releaseOutputBufferAtTime(codec, idx, timestampNs); +} + +static inline int ff_AMediaCodec_infoTryAgainLater(FFAMediaCodec *codec, ssize_t idx) +{ + return codec->infoTryAgainLater(codec, idx); +} + +static inline int ff_AMediaCodec_infoOutputBuffersChanged(FFAMediaCodec *codec, ssize_t idx) +{ + return codec->infoOutputBuffersChanged(codec, idx); +} + +static inline int ff_AMediaCodec_infoOutputFormatChanged(FFAMediaCodec *codec, ssize_t idx) +{ + return codec->infoOutputFormatChanged(codec, idx); +} + +static inline int ff_AMediaCodec_getBufferFlagCodecConfig(FFAMediaCodec *codec) +{ + return codec->getBufferFlagCodecConfig(codec); +} + +static inline int ff_AMediaCodec_getBufferFlagEndOfStream(FFAMediaCodec *codec) +{ + return codec->getBufferFlagEndOfStream(codec); +} + +static inline int ff_AMediaCodec_getBufferFlagKeyFrame(FFAMediaCodec *codec) +{ + return codec->getBufferFlagKeyFrame(codec); +} + +static inline int ff_AMediaCodec_getConfigureFlagEncode(FFAMediaCodec *codec) +{ + return codec->getConfigureFlagEncode(codec); +} + +static inline int ff_AMediaCodec_cleanOutputBuffers(FFAMediaCodec *codec) +{ + return codec->cleanOutputBuffers(codec); +} + +static inline int ff_AMediaCodec_signalEndOfInputStream(FFAMediaCodec *codec) +{ + return codec->signalEndOfInputStream(codec); +} + +static inline int ff_AMediaCodec_setAsyncNotifyCallback(FFAMediaCodec *codec, + const FFAMediaCodecOnAsyncNotifyCallback *callback, + void *userdata) +{ + return codec->setAsyncNotifyCallback(codec, callback, userdata); +} + +int ff_Build_SDK_INT(AVCodecContext *avctx); + +enum FFAMediaFormatColorRange { + COLOR_RANGE_UNSPECIFIED = 0x0, + COLOR_RANGE_FULL = 0x1, + COLOR_RANGE_LIMITED = 0x2, +}; + +enum FFAMediaFormatColorStandard { + COLOR_STANDARD_UNSPECIFIED = 0x0, + COLOR_STANDARD_BT709 = 0x1, + COLOR_STANDARD_BT601_PAL = 0x2, + COLOR_STANDARD_BT601_NTSC = 0x4, + COLOR_STANDARD_BT2020 = 0x6, +}; + +enum FFAMediaFormatColorTransfer { + COLOR_TRANSFER_UNSPECIFIED = 0x0, + COLOR_TRANSFER_LINEAR = 0x1, + COLOR_TRANSFER_SDR_VIDEO = 0x3, + COLOR_TRANSFER_ST2084 = 0x6, + COLOR_TRANSFER_HLG = 0x7, +}; + +/** + * Map MediaFormat color range to AVColorRange. + * + * return AVCOL_RANGE_UNSPECIFIED when failed. + */ +enum AVColorRange ff_AMediaFormatColorRange_to_AVColorRange(int color_range); + +/** + * Map AVColorRange to MediaFormat color range. + * + * return COLOR_RANGE_UNSPECIFIED when failed. + */ +int ff_AMediaFormatColorRange_from_AVColorRange(enum AVColorRange color_range); + +/** + * Map MediaFormat color standard to AVColorSpace. + * + * return AVCOL_SPC_UNSPECIFIED when failed. + */ +enum AVColorSpace ff_AMediaFormatColorStandard_to_AVColorSpace(int color_standard); + +/** + * Map AVColorSpace to MediaFormat color standard. + * + * return COLOR_STANDARD_UNSPECIFIED when failed. + */ +int ff_AMediaFormatColorStandard_from_AVColorSpace(enum AVColorSpace color_space); + +/** + * Map MediaFormat color standard to AVColorPrimaries. + * + * return AVCOL_PRI_UNSPECIFIED when failed. + */ +enum AVColorPrimaries ff_AMediaFormatColorStandard_to_AVColorPrimaries(int color_standard); + +/** + * Map MediaFormat color transfer to AVColorTransferCharacteristic. + * + * return AVCOL_TRC_UNSPECIFIED when failed. + */ +enum AVColorTransferCharacteristic +ff_AMediaFormatColorTransfer_to_AVColorTransfer(int color_transfer); + +/** + * Map AVColorTransferCharacteristic to MediaFormat color transfer. + * + * return COLOR_TRANSFER_UNSPECIFIED when failed. + */ +int ff_AMediaFormatColorTransfer_from_AVColorTransfer( + enum AVColorTransferCharacteristic color_transfer); + +#endif /* AVCODEC_MEDIACODEC_WRAPPER_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,745 @@ +/* + * Android MediaCodec MPEG-2 / H.264 / H.265 / MPEG-4 / VP8 / VP9 decoders + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 "config_components.h" + +#include +#include + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/intreadwrite.h" +#include "libavutil/pixfmt.h" +#include "libavutil/internal.h" + +#include "avcodec.h" +#include "codec_internal.h" +#include "decode.h" +#if CONFIG_H264_MEDIACODEC_DECODER_EXTRADATA +#include "h264_parse.h" +#include "h264_ps.h" +#endif +#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA +#include "hevc/parse.h" +#endif +#include "hwconfig.h" +#include "internal.h" +#include "fffjni.h" +#include "mediacodec_wrapper.h" +#include "mediacodecdec_common.h" + +typedef struct MediaCodecH264DecContext { + + AVClass *avclass; + + MediaCodecDecContext *ctx; + + AVPacket buffered_pkt; + + int delay_flush; + int amlogic_mpeg2_api23_workaround; + + int use_ndk_codec; + // Ref. MediaFormat KEY_OPERATING_RATE + int operating_rate; +} MediaCodecH264DecContext; + +static av_cold int mediacodec_decode_close(AVCodecContext *avctx) +{ + MediaCodecH264DecContext *s = avctx->priv_data; + + ff_mediacodec_dec_close(avctx, s->ctx); + s->ctx = NULL; + + av_packet_unref(&s->buffered_pkt); + + return 0; +} + +#if CONFIG_H264_MEDIACODEC_DECODER || CONFIG_HEVC_MEDIACODEC_DECODER +static int h2645_ps_to_nalu(const uint8_t *src, int src_size, uint8_t **out, int *out_size) +{ + int i; + int ret = 0; + uint8_t *p = NULL; + static const uint8_t nalu_header[] = { 0x00, 0x00, 0x00, 0x01 }; + + if (!out || !out_size) { + return AVERROR(EINVAL); + } + + p = av_malloc(sizeof(nalu_header) + src_size); + if (!p) { + return AVERROR(ENOMEM); + } + + *out = p; + *out_size = sizeof(nalu_header) + src_size; + + memcpy(p, nalu_header, sizeof(nalu_header)); + memcpy(p + sizeof(nalu_header), src, src_size); + + /* Escape 0x00, 0x00, 0x0{0-3} pattern */ + for (i = 4; i < *out_size; i++) { + if (i < *out_size - 3 && + p[i + 0] == 0 && + p[i + 1] == 0 && + p[i + 2] <= 3) { + uint8_t *new; + + *out_size += 1; + new = av_realloc(*out, *out_size); + if (!new) { + ret = AVERROR(ENOMEM); + goto done; + } + *out = p = new; + + i = i + 2; + memmove(p + i + 1, p + i, *out_size - (i + 1)); + p[i] = 0x03; + } + } +done: + if (ret < 0) { + av_freep(out); + *out_size = 0; + } + + return ret; +} +#endif + +static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) +{ +#if CONFIG_H264_MEDIACODEC_DECODER_EXTRADATA + int i; + int ret; + + H264ParamSets ps = {0}; + const PPS *pps = NULL; + const SPS *sps = NULL; + int is_avc = 0; + int nal_length_size = 0; + + ret = ff_h264_decode_extradata(avctx->extradata, avctx->extradata_size, + &ps, &is_avc, &nal_length_size, 0, avctx); + if (ret < 0) { + goto done; + } + + for (i = 0; i < MAX_PPS_COUNT; i++) { + if (ps.pps_list[i]) { + pps = ps.pps_list[i]; + break; + } + } + + if (pps) { + if (ps.sps_list[pps->sps_id]) { + sps = ps.sps_list[pps->sps_id]; + } + } + + if (pps && sps) { + uint8_t *data = NULL; + int data_size = 0; + + avctx->profile = ff_h264_get_profile(sps); + avctx->level = sps->level_idc; + + if ((ret = h2645_ps_to_nalu(sps->data, sps->data_size, &data, &data_size)) < 0) { + goto done; + } + ff_AMediaFormat_setBuffer(format, "csd-0", (void*)data, data_size); + av_freep(&data); + + if ((ret = h2645_ps_to_nalu(pps->data, pps->data_size, &data, &data_size)) < 0) { + goto done; + } + ff_AMediaFormat_setBuffer(format, "csd-1", (void*)data, data_size); + av_freep(&data); + } else { + const int warn = is_avc && (avctx->codec_tag == MKTAG('a','v','c','1') || + avctx->codec_tag == MKTAG('a','v','c','2')); + av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract PPS/SPS from extradata\n"); + ret = 0; + } + +done: + ff_h264_ps_uninit(&ps); + + return ret; +#else + const uint8_t* ed = avctx->extradata; + int edsize = avctx->extradata_size; + int edoffset = avctx->moz_extradata_offset; + + if (ed) { + if (edoffset > 0 && edoffset < edsize) { + ff_AMediaFormat_setBuffer(format, "csd-0", ed, edoffset); + ff_AMediaFormat_setBuffer(format, "csd-1", ed + edoffset, edsize - edoffset); + } else { + ff_AMediaFormat_setBuffer(format, "csd-0", ed, edsize); + } + } + + return 0; +#endif +} + +#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA +static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) +{ + int i; + int ret; + + HEVCParamSets ps = {0}; + HEVCSEI sei = {0}; + + const HEVCVPS *vps = NULL; + const HEVCPPS *pps = NULL; + const HEVCSPS *sps = NULL; + int is_nalff = 0; + int nal_length_size = 0; + + uint8_t *vps_data = NULL; + uint8_t *sps_data = NULL; + uint8_t *pps_data = NULL; + int vps_data_size = 0; + int sps_data_size = 0; + int pps_data_size = 0; + + ret = ff_hevc_decode_extradata(avctx->extradata, avctx->extradata_size, + &ps, &sei, &is_nalff, &nal_length_size, 0, 1, avctx); + if (ret < 0) { + goto done; + } + + for (i = 0; i < HEVC_MAX_VPS_COUNT; i++) { + if (ps.vps_list[i]) { + vps = ps.vps_list[i]; + break; + } + } + + for (i = 0; i < HEVC_MAX_PPS_COUNT; i++) { + if (ps.pps_list[i]) { + pps = ps.pps_list[i]; + break; + } + } + + if (pps) { + if (ps.sps_list[pps->sps_id]) { + sps = ps.sps_list[pps->sps_id]; + } + } + + if (vps && pps && sps) { + uint8_t *data; + int data_size; + + avctx->profile = sps->ptl.general_ptl.profile_idc; + avctx->level = sps->ptl.general_ptl.level_idc; + + if ((ret = h2645_ps_to_nalu(vps->data, vps->data_size, &vps_data, &vps_data_size)) < 0 || + (ret = h2645_ps_to_nalu(sps->data, sps->data_size, &sps_data, &sps_data_size)) < 0 || + (ret = h2645_ps_to_nalu(pps->data, pps->data_size, &pps_data, &pps_data_size)) < 0) { + goto done; + } + + data_size = vps_data_size + sps_data_size + pps_data_size; + data = av_mallocz(data_size); + if (!data) { + ret = AVERROR(ENOMEM); + goto done; + } + + memcpy(data , vps_data, vps_data_size); + memcpy(data + vps_data_size , sps_data, sps_data_size); + memcpy(data + vps_data_size + sps_data_size, pps_data, pps_data_size); + + ff_AMediaFormat_setBuffer(format, "csd-0", data, data_size); + + av_freep(&data); + } else { + const int warn = is_nalff && avctx->codec_tag == MKTAG('h','v','c','1'); + av_log(avctx, warn ? AV_LOG_WARNING : AV_LOG_DEBUG, + "Could not extract VPS/PPS/SPS from extradata\n"); + ret = 0; + } + +done: + ff_hevc_ps_uninit(&ps); + + av_freep(&vps_data); + av_freep(&sps_data); + av_freep(&pps_data); + + return ret; +} +#endif + +#if CONFIG_MPEG2_MEDIACODEC_DECODER || \ + CONFIG_MPEG4_MEDIACODEC_DECODER || \ + CONFIG_VP8_MEDIACODEC_DECODER || \ + CONFIG_VP9_MEDIACODEC_DECODER || \ + CONFIG_AV1_MEDIACODEC_DECODER || \ + CONFIG_AAC_MEDIACODEC_DECODER || \ + CONFIG_AMRNB_MEDIACODEC_DECODER || \ + CONFIG_AMRWB_MEDIACODEC_DECODER || \ + CONFIG_MP3_MEDIACODEC_DECODER || \ + !CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA +static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) +{ + int ret = 0; + + if (avctx->extradata) { + ff_AMediaFormat_setBuffer(format, "csd-0", avctx->extradata, avctx->extradata_size); + } + + return ret; +} +#endif + +static av_cold int mediacodec_decode_init(AVCodecContext *avctx) +{ + int ret; + int sdk_int; + + const char *codec_mime = NULL; + + FFAMediaFormat *format = NULL; + MediaCodecH264DecContext *s = avctx->priv_data; + + if (s->use_ndk_codec < 0) + s->use_ndk_codec = !av_jni_get_java_vm(avctx); + + format = ff_AMediaFormat_new(s->use_ndk_codec); + if (!format) { + av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); + ret = AVERROR_EXTERNAL; + goto done; + } + + switch (avctx->codec_id) { +#if CONFIG_AV1_MEDIACODEC_DECODER + case AV_CODEC_ID_AV1: + codec_mime = "video/av01"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_H264_MEDIACODEC_DECODER + case AV_CODEC_ID_H264: + codec_mime = "video/avc"; + + ret = h264_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_HEVC_MEDIACODEC_DECODER + case AV_CODEC_ID_HEVC: + codec_mime = "video/hevc"; + +#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA + ret = hevc_set_extradata(avctx, format); +#else + ret = common_set_extradata(avctx, format); +#endif + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_MPEG2_MEDIACODEC_DECODER + case AV_CODEC_ID_MPEG2VIDEO: + codec_mime = "video/mpeg2"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_MPEG4_MEDIACODEC_DECODER + case AV_CODEC_ID_MPEG4: + codec_mime = "video/mp4v-es", + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_VP8_MEDIACODEC_DECODER + case AV_CODEC_ID_VP8: + codec_mime = "video/x-vnd.on2.vp8"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_VP9_MEDIACODEC_DECODER + case AV_CODEC_ID_VP9: + codec_mime = "video/x-vnd.on2.vp9"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_AAC_MEDIACODEC_DECODER + case AV_CODEC_ID_AAC: + codec_mime = "audio/mp4a-latm"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_AMRNB_MEDIACODEC_DECODER + case AV_CODEC_ID_AMR_NB: + codec_mime = "audio/3gpp"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_AMRWB_MEDIACODEC_DECODER + case AV_CODEC_ID_AMR_WB: + codec_mime = "audio/amr-wb"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif +#if CONFIG_MP3_MEDIACODEC_DECODER + case AV_CODEC_ID_MP3: + codec_mime = "audio/mpeg"; + + ret = common_set_extradata(avctx, format); + if (ret < 0) + goto done; + break; +#endif + default: + av_assert0(0); + } + + ff_AMediaFormat_setString(format, "mime", codec_mime); + + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + ff_AMediaFormat_setInt32(format, "width", avctx->width); + ff_AMediaFormat_setInt32(format, "height", avctx->height); + } else { + ff_AMediaFormat_setInt32(format, "channel-count", avctx->ch_layout.nb_channels); + ff_AMediaFormat_setInt32(format, "sample-rate", avctx->sample_rate); + } + if (avctx->flags & AV_CODEC_FLAG_LOW_DELAY) { + ff_AMediaFormat_setInt32(format, "low-latency", 1); + } + if (s->operating_rate > 0) + ff_AMediaFormat_setInt32(format, "operating-rate", s->operating_rate); + + s->ctx = av_mallocz(sizeof(*s->ctx)); + if (!s->ctx) { + av_log(avctx, AV_LOG_ERROR, "Failed to allocate MediaCodecDecContext\n"); + ret = AVERROR(ENOMEM); + goto done; + } + + s->ctx->delay_flush = s->delay_flush; + s->ctx->use_ndk_codec = s->use_ndk_codec; + + if ((ret = ff_mediacodec_dec_init(avctx, s->ctx, codec_mime, format)) < 0) { + s->ctx = NULL; + goto done; + } + + av_log(avctx, AV_LOG_INFO, + "MediaCodec started successfully: codec = %s, ret = %d\n", + s->ctx->codec_name, ret); + + sdk_int = ff_Build_SDK_INT(avctx); + /* ff_Build_SDK_INT can fail when target API < 24 and JVM isn't available. + * If we don't check sdk_int > 0, the workaround might be enabled by + * mistake. + * JVM is required to make the workaround works reliably. On the other hand, + * missing a workaround should not be a serious issue, we do as best we can. + */ + if (sdk_int > 0 && sdk_int <= 23 && + strcmp(s->ctx->codec_name, "OMX.amlogic.mpeg2.decoder.awesome") == 0) { + av_log(avctx, AV_LOG_INFO, "Enabling workaround for %s on API=%d\n", + s->ctx->codec_name, sdk_int); + s->amlogic_mpeg2_api23_workaround = 1; + } + +done: + if (format) { + ff_AMediaFormat_delete(format); + } + + if (ret < 0) { + mediacodec_decode_close(avctx); + } + + return ret; +} + +static int mediacodec_receive_frame(AVCodecContext *avctx, AVFrame *frame) +{ + MediaCodecH264DecContext *s = avctx->priv_data; + int ret; + ssize_t index; + + /* In delay_flush mode, wait until the user has released or rendered + all retained frames. */ + if (s->delay_flush && ff_mediacodec_dec_is_flushing(avctx, s->ctx)) { + if (!ff_mediacodec_dec_flush(avctx, s->ctx)) { + return AVERROR(EAGAIN); + } + } + + /* poll for new frame */ + ret = ff_mediacodec_dec_receive(avctx, s->ctx, frame, false); + if (ret != AVERROR(EAGAIN)) + return ret; + + /* feed decoder */ + while (1) { + if (s->ctx->current_input_buffer < 0 && !s->ctx->draining) { + /* poll for input space */ + index = ff_AMediaCodec_dequeueInputBuffer(s->ctx->codec, 0); + if (index < 0) { + /* no space, block for an output frame to appear */ + ret = ff_mediacodec_dec_receive(avctx, s->ctx, frame, true); + /* Try again if both input port and output port return EAGAIN. + * If no data is consumed and no frame in output, it can make + * both avcodec_send_packet() and avcodec_receive_frame() + * return EAGAIN, which violate the design. + */ + if (ff_AMediaCodec_infoTryAgainLater(s->ctx->codec, index) && + ret == AVERROR(EAGAIN)) + continue; + return ret; + } + s->ctx->current_input_buffer = index; + } + + /* try to flush any buffered packet data */ + if (s->buffered_pkt.size > 0) { + ret = ff_mediacodec_dec_send(avctx, s->ctx, &s->buffered_pkt, false); + if (ret >= 0) { + s->buffered_pkt.size -= ret; + s->buffered_pkt.data += ret; + if (s->buffered_pkt.size <= 0) { + av_packet_unref(&s->buffered_pkt); + } else { + av_log(avctx, AV_LOG_WARNING, + "could not send entire packet in single input buffer (%d < %d)\n", + ret, s->buffered_pkt.size+ret); + } + } else if (ret < 0 && ret != AVERROR(EAGAIN)) { + return ret; + } + + if (s->amlogic_mpeg2_api23_workaround && s->buffered_pkt.size <= 0) { + /* fallthrough to fetch next packet regardless of input buffer space */ + } else { + /* poll for space again */ + continue; + } + } + + /* fetch new packet or eof */ + ret = ff_decode_get_packet(avctx, &s->buffered_pkt); + if (ret == AVERROR_EOF) { + AVPacket null_pkt = { 0 }; + ret = ff_mediacodec_dec_send(avctx, s->ctx, &null_pkt, true); + if (ret < 0) + return ret; + return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true); + } else if (ret == AVERROR(EAGAIN) && s->ctx->current_input_buffer < 0) { + return ff_mediacodec_dec_receive(avctx, s->ctx, frame, true); + } else if (ret < 0) { + return ret; + } + } + + return AVERROR(EAGAIN); +} + +static void mediacodec_decode_flush(AVCodecContext *avctx) +{ + MediaCodecH264DecContext *s = avctx->priv_data; + + av_packet_unref(&s->buffered_pkt); + + ff_mediacodec_dec_flush(avctx, s->ctx); +} + +static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = { + &(const AVCodecHWConfigInternal) { + .public = { + .pix_fmt = AV_PIX_FMT_MEDIACODEC, + .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC | + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX, + .device_type = AV_HWDEVICE_TYPE_MEDIACODEC, + }, + .hwaccel = NULL, + }, + NULL +}; + +#define OFFSET(x) offsetof(MediaCodecH264DecContext, x) +#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption ff_mediacodec_vdec_options[] = { + { "delay_flush", "Delay flush until hw output buffers are returned to the decoder", + OFFSET(delay_flush), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VD }, + { "ndk_codec", "Use MediaCodec from NDK", + OFFSET(use_ndk_codec), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VD }, + { "operating_rate", "The desired operating rate that the codec will need to operate at, zero for unspecified", + OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VD }, + { NULL } +}; + +#define DECLARE_MEDIACODEC_VCLASS(short_name) \ +static const AVClass ff_##short_name##_mediacodec_dec_class = { \ + .class_name = #short_name "_mediacodec", \ + .item_name = av_default_item_name, \ + .option = ff_mediacodec_vdec_options, \ + .version = LIBAVUTIL_VERSION_INT, \ +}; + +#define DECLARE_MEDIACODEC_VDEC(short_name, full_name, codec_id, bsf) \ +DECLARE_MEDIACODEC_VCLASS(short_name) \ +const FFCodec ff_ ## short_name ## _mediacodec_decoder = { \ + .p.name = #short_name "_mediacodec", \ + CODEC_LONG_NAME(full_name " Android MediaCodec decoder"), \ + .p.type = AVMEDIA_TYPE_VIDEO, \ + .p.id = codec_id, \ + .p.priv_class = &ff_##short_name##_mediacodec_dec_class, \ + .priv_data_size = sizeof(MediaCodecH264DecContext), \ + .init = mediacodec_decode_init, \ + FF_CODEC_RECEIVE_FRAME_CB(mediacodec_receive_frame), \ + .flush = mediacodec_decode_flush, \ + .close = mediacodec_decode_close, \ + .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_AVOID_PROBING | AV_CODEC_CAP_HARDWARE, \ + .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \ + .bsfs = bsf, \ + .hw_configs = mediacodec_hw_configs, \ + .p.wrapper_name = "mediacodec", \ +}; \ + +#if CONFIG_H264_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, NULL) +#endif + +#if CONFIG_HEVC_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, NULL) +#endif + +#if CONFIG_MPEG2_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(mpeg2, "MPEG-2", AV_CODEC_ID_MPEG2VIDEO, NULL) +#endif + +#if CONFIG_MPEG4_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(mpeg4, "MPEG-4", AV_CODEC_ID_MPEG4, NULL) +#endif + +#if CONFIG_VP8_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(vp8, "VP8", AV_CODEC_ID_VP8, NULL) +#endif + +#if CONFIG_VP9_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(vp9, "VP9", AV_CODEC_ID_VP9, NULL) +#endif + +#if CONFIG_AV1_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_VDEC(av1, "AV1", AV_CODEC_ID_AV1, NULL) +#endif + +#define AD AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_DECODING_PARAM +static const AVOption ff_mediacodec_adec_options[] = { + { "ndk_codec", "Use MediaCodec from NDK", + OFFSET(use_ndk_codec), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, AD }, + { "operating_rate", "The desired operating rate that the codec will need to operate at, zero for unspecified", + OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, AD }, + { NULL } +}; + +#define DECLARE_MEDIACODEC_ACLASS(short_name) \ +static const AVClass ff_##short_name##_mediacodec_dec_class = { \ + .class_name = #short_name "_mediacodec", \ + .item_name = av_default_item_name, \ + .option = ff_mediacodec_adec_options, \ + .version = LIBAVUTIL_VERSION_INT, \ +}; + +#define DECLARE_MEDIACODEC_ADEC(short_name, full_name, codec_id, bsf) \ +DECLARE_MEDIACODEC_VCLASS(short_name) \ +const FFCodec ff_ ## short_name ## _mediacodec_decoder = { \ + .p.name = #short_name "_mediacodec", \ + CODEC_LONG_NAME(full_name " Android MediaCodec decoder"), \ + .p.type = AVMEDIA_TYPE_AUDIO, \ + .p.id = codec_id, \ + .p.priv_class = &ff_##short_name##_mediacodec_dec_class, \ + .priv_data_size = sizeof(MediaCodecH264DecContext), \ + .init = mediacodec_decode_init, \ + FF_CODEC_RECEIVE_FRAME_CB(mediacodec_receive_frame), \ + .flush = mediacodec_decode_flush, \ + .close = mediacodec_decode_close, \ + .p.capabilities = AV_CODEC_CAP_DELAY | AV_CODEC_CAP_HARDWARE, \ + .caps_internal = FF_CODEC_CAP_NOT_INIT_THREADSAFE, \ + .bsfs = bsf, \ + .p.wrapper_name = "mediacodec", \ +}; \ + +#if CONFIG_AAC_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_ADEC(aac, "AAC", AV_CODEC_ID_AAC, "aac_adtstoasc") +#endif + +#if CONFIG_AMRNB_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_ADEC(amrnb, "AMR-NB", AV_CODEC_ID_AMR_NB, NULL) +#endif + +#if CONFIG_AMRWB_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_ADEC(amrwb, "AMR-WB", AV_CODEC_ID_AMR_WB, NULL) +#endif + +#if CONFIG_MP3_MEDIACODEC_DECODER +DECLARE_MEDIACODEC_ADEC(mp3, "MP3", AV_CODEC_ID_MP3, NULL) +#endif + +int moz_avcodec_mediacodec_is_eos(AVCodecContext* avctx) { + // Note that MediaCodecH264DecContext is used by all codec types. + MediaCodecH264DecContext *s = avctx->priv_data; + return s->ctx->eos; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec_common.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec_common.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,1153 @@ +/* + * Android MediaCodec decoder + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 +#include + +#include "libavutil/avassert.h" +#include "libavutil/common.h" +#include "libavutil/hwcontext_mediacodec.h" +#include "libavutil/mem.h" +#include "libavutil/log.h" +#include "libavutil/pixfmt.h" +#include "libavutil/fftime.h" +#include "libavutil/timestamp.h" +#include "libavutil/channel_layout.h" + +#include "avcodec.h" +#include "decode.h" + +#include "mediacodec.h" +#include "mediacodec_surface.h" +#include "mediacodec_sw_buffer.h" +#include "mediacodec_wrapper.h" +#include "mediacodecdec_common.h" + +/** + * OMX.k3.video.decoder.avc, OMX.NVIDIA.* OMX.SEC.avc.dec and OMX.google + * codec workarounds used in various place are taken from the Gstreamer + * project. + * + * Gstreamer references: + * https://cgit.freedesktop.org/gstreamer/gst-plugins-bad/tree/sys/androidmedia/ + * + * Gstreamer copyright notice: + * + * Copyright (C) 2012, Collabora Ltd. + * Author: Sebastian Dröge + * + * Copyright (C) 2012, Rafaël Carré + * + * Copyright (C) 2015, Sebastian Dröge + * + * Copyright (C) 2014-2015, Collabora Ltd. + * Author: Matthieu Bouron + * + * Copyright (C) 2015, Edward Hervey + * Author: Edward Hervey + * + * Copyright (C) 2015, Matthew Waters + * + * This library 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 + * version 2.1 of the License. + * + * This library 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 this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#define INPUT_DEQUEUE_TIMEOUT_US 8000 +#define OUTPUT_DEQUEUE_TIMEOUT_US 8000 +#define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US 8000 + +enum { + ENCODING_PCM_16BIT = 0x00000002, + ENCODING_PCM_8BIT = 0x00000003, + ENCODING_PCM_FLOAT = 0x00000004, + ENCODING_PCM_24BIT_PACKED = 0x00000015, + ENCODING_PCM_32BIT = 0x00000016, +}; + +static const struct { + + int pcm_format; + enum AVSampleFormat sample_format; + +} sample_formats[] = { + + { ENCODING_PCM_16BIT, AV_SAMPLE_FMT_S16 }, + { ENCODING_PCM_8BIT, AV_SAMPLE_FMT_U8 }, + { ENCODING_PCM_FLOAT, AV_SAMPLE_FMT_FLT }, + { ENCODING_PCM_32BIT, AV_SAMPLE_FMT_S32 }, + { 0 } +}; + +static enum AVSampleFormat mcdec_map_pcm_format(AVCodecContext *avctx, + MediaCodecDecContext *s, + int pcm_format) +{ + enum AVSampleFormat ret = AV_SAMPLE_FMT_NONE; + + for (int i = 0; i < FF_ARRAY_ELEMS(sample_formats); i++) { + if (sample_formats[i].pcm_format == pcm_format) { + return sample_formats[i].sample_format; + } + } + + av_log(avctx, AV_LOG_ERROR, "Output sample format 0x%x (value=%d) is not supported\n", + pcm_format, pcm_format); + + return ret; +} + +enum +{ + CHANNEL_OUT_FRONT_LEFT = 0x4, + CHANNEL_OUT_FRONT_RIGHT = 0x8, + CHANNEL_OUT_FRONT_CENTER = 0x10, + CHANNEL_OUT_LOW_FREQUENCY = 0x20, + CHANNEL_OUT_BACK_LEFT = 0x40, + CHANNEL_OUT_BACK_RIGHT = 0x80, + CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 0x100, + CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 0x200, + CHANNEL_OUT_BACK_CENTER = 0x400, + CHANNEL_OUT_SIDE_LEFT = 0x800, + CHANNEL_OUT_SIDE_RIGHT = 0x1000, + CHANNEL_OUT_TOP_CENTER = 0x2000, + CHANNEL_OUT_TOP_FRONT_LEFT = 0x4000, + CHANNEL_OUT_TOP_FRONT_CENTER = 0x8000, + CHANNEL_OUT_TOP_FRONT_RIGHT = 0x10000, + CHANNEL_OUT_TOP_BACK_LEFT = 0x20000, + CHANNEL_OUT_TOP_BACK_CENTER = 0x40000, + CHANNEL_OUT_TOP_BACK_RIGHT = 0x80000, +}; + +static const struct { + + int mask; + uint64_t layout; + +} channel_masks[] = { + { CHANNEL_OUT_FRONT_LEFT, AV_CH_FRONT_LEFT }, + { CHANNEL_OUT_FRONT_RIGHT, AV_CH_FRONT_RIGHT }, + { CHANNEL_OUT_FRONT_CENTER, AV_CH_FRONT_CENTER }, + { CHANNEL_OUT_LOW_FREQUENCY, AV_CH_LOW_FREQUENCY }, + { CHANNEL_OUT_BACK_LEFT, AV_CH_BACK_LEFT }, + { CHANNEL_OUT_BACK_RIGHT, AV_CH_BACK_RIGHT }, + { CHANNEL_OUT_FRONT_LEFT_OF_CENTER, AV_CH_FRONT_LEFT_OF_CENTER }, + { CHANNEL_OUT_FRONT_RIGHT_OF_CENTER, AV_CH_FRONT_RIGHT_OF_CENTER }, + { CHANNEL_OUT_BACK_CENTER, AV_CH_BACK_CENTER }, + { CHANNEL_OUT_SIDE_LEFT, AV_CH_SIDE_LEFT }, + { CHANNEL_OUT_SIDE_RIGHT, AV_CH_SIDE_RIGHT }, + { CHANNEL_OUT_TOP_CENTER, AV_CH_TOP_CENTER }, + { CHANNEL_OUT_TOP_FRONT_LEFT, AV_CH_TOP_FRONT_LEFT }, + { CHANNEL_OUT_TOP_FRONT_CENTER, AV_CH_TOP_FRONT_CENTER }, + { CHANNEL_OUT_TOP_FRONT_RIGHT, AV_CH_TOP_FRONT_RIGHT }, + { CHANNEL_OUT_TOP_BACK_LEFT, AV_CH_TOP_BACK_LEFT }, + { CHANNEL_OUT_TOP_BACK_CENTER, AV_CH_TOP_BACK_CENTER }, + { CHANNEL_OUT_TOP_BACK_RIGHT, AV_CH_TOP_BACK_RIGHT }, +}; + +static uint64_t mcdec_map_channel_mask(AVCodecContext *avctx, + int channel_mask) +{ + uint64_t channel_layout = 0; + + for (int i = 0; i < FF_ARRAY_ELEMS(channel_masks); i++) { + if (channel_mask & channel_masks[i].mask) + channel_layout |= channel_masks[i].layout; + } + + return channel_layout; +} + +enum { + COLOR_FormatYUV420Planar = 0x13, + COLOR_FormatYUV420SemiPlanar = 0x15, + COLOR_FormatYCbYCr = 0x19, + COLOR_FormatAndroidOpaque = 0x7F000789, + COLOR_QCOM_FormatYUV420SemiPlanar = 0x7fa30c00, + COLOR_QCOM_FormatYUV420SemiPlanar32m = 0x7fa30c04, + COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7fa30c03, + COLOR_TI_FormatYUV420PackedSemiPlanar = 0x7f000100, + COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced = 0x7f000001, +}; + +static const struct { + + int color_format; + enum AVPixelFormat pix_fmt; + +} color_formats[] = { + + { COLOR_FormatYUV420Planar, AV_PIX_FMT_YUV420P }, + { COLOR_FormatYUV420SemiPlanar, AV_PIX_FMT_NV12 }, + { COLOR_QCOM_FormatYUV420SemiPlanar, AV_PIX_FMT_NV12 }, + { COLOR_QCOM_FormatYUV420SemiPlanar32m, AV_PIX_FMT_NV12 }, + { COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka, AV_PIX_FMT_NV12 }, + { COLOR_TI_FormatYUV420PackedSemiPlanar, AV_PIX_FMT_NV12 }, + { COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced, AV_PIX_FMT_NV12 }, + { 0 } +}; + +static enum AVPixelFormat mcdec_map_color_format(AVCodecContext *avctx, + MediaCodecDecContext *s, + int color_format) +{ + int i; + enum AVPixelFormat ret = AV_PIX_FMT_NONE; + + if (s->surface) { + return AV_PIX_FMT_MEDIACODEC; + } + + if (!strcmp(s->codec_name, "OMX.k3.video.decoder.avc") && color_format == COLOR_FormatYCbYCr) { + s->color_format = color_format = COLOR_TI_FormatYUV420PackedSemiPlanar; + } + + for (i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) { + if (color_formats[i].color_format == color_format) { + return color_formats[i].pix_fmt; + } + } + + av_log(avctx, AV_LOG_ERROR, "Output color format 0x%x (value=%d) is not supported\n", + color_format, color_format); + + return ret; +} + +static void ff_mediacodec_dec_ref(MediaCodecDecContext *s) +{ + atomic_fetch_add(&s->refcount, 1); +} + +static void ff_mediacodec_dec_unref(MediaCodecDecContext *s) +{ + if (!s) + return; + + if (atomic_fetch_sub(&s->refcount, 1) == 1) { + if (s->codec) { + ff_AMediaCodec_delete(s->codec); + s->codec = NULL; + } + + if (s->format) { + ff_AMediaFormat_delete(s->format); + s->format = NULL; + } + + if (s->surface) { + ff_mediacodec_surface_unref(s->surface, NULL); + s->surface = NULL; + } + + av_freep(&s->codec_name); + av_freep(&s); + } +} + +static void mediacodec_buffer_release(void *opaque, uint8_t *data) +{ + AVMediaCodecBuffer *buffer = opaque; + MediaCodecDecContext *ctx = buffer->ctx; + int released = atomic_load(&buffer->released); + + if (!released && (ctx->delay_flush || buffer->serial == atomic_load(&ctx->serial))) { + atomic_fetch_sub(&ctx->hw_buffer_count, 1); + av_log(ctx->avctx, AV_LOG_DEBUG, + "Releasing output buffer %zd (%p) ts=%"PRId64" on free() [%d pending]\n", + buffer->index, buffer, buffer->pts, atomic_load(&ctx->hw_buffer_count)); + ff_AMediaCodec_releaseOutputBuffer(ctx->codec, buffer->index, 0); + } + + ff_mediacodec_dec_unref(ctx); + av_freep(&buffer); +} + +static int mediacodec_wrap_hw_buffer(AVCodecContext *avctx, + MediaCodecDecContext *s, + ssize_t index, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int ret = 0; + int status = 0; + AVMediaCodecBuffer *buffer = NULL; + + frame->buf[0] = NULL; + frame->width = avctx->width; + frame->height = avctx->height; + frame->format = avctx->pix_fmt; + frame->sample_aspect_ratio = avctx->sample_aspect_ratio; + + if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) { + frame->pts = av_rescale_q(info->presentationTimeUs, + AV_TIME_BASE_Q, + avctx->pkt_timebase); + } else { + frame->pts = info->presentationTimeUs; + } + frame->pkt_dts = AV_NOPTS_VALUE; + frame->color_range = avctx->color_range; + frame->color_primaries = avctx->color_primaries; + frame->color_trc = avctx->color_trc; + frame->colorspace = avctx->colorspace; + + buffer = av_mallocz(sizeof(AVMediaCodecBuffer)); + if (!buffer) { + ret = AVERROR(ENOMEM); + goto fail; + } + + atomic_init(&buffer->released, 0); + + frame->buf[0] = av_buffer_create(NULL, + 0, + mediacodec_buffer_release, + buffer, + AV_BUFFER_FLAG_READONLY); + + if (!frame->buf[0]) { + ret = AVERROR(ENOMEM); + goto fail; + + } + + buffer->ctx = s; + buffer->serial = atomic_load(&s->serial); + ff_mediacodec_dec_ref(s); + + buffer->index = index; + buffer->pts = info->presentationTimeUs; + + frame->data[3] = (uint8_t *)buffer; + + atomic_fetch_add(&s->hw_buffer_count, 1); + av_log(avctx, AV_LOG_DEBUG, + "Wrapping output buffer %zd (%p) ts=%"PRId64" [%d pending]\n", + buffer->index, buffer, buffer->pts, atomic_load(&s->hw_buffer_count)); + + return 0; +fail: + av_freep(&buffer); + status = ff_AMediaCodec_releaseOutputBuffer(s->codec, index, 0); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n"); + ret = AVERROR_EXTERNAL; + } + + return ret; +} + +static int mediacodec_wrap_sw_audio_buffer(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + ssize_t index, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int ret = 0; + int status = 0; + const int sample_size = av_get_bytes_per_sample(avctx->sample_fmt); + if (!sample_size) { + av_log(avctx, AV_LOG_ERROR, "Could not get bytes per sample\n"); + ret = AVERROR(ENOSYS); + goto done; + } + + if (info->size % (sample_size * avctx->ch_layout.nb_channels)) { + av_log(avctx, AV_LOG_ERROR, "input is not a multiple of channels * sample_size\n"); + ret = AVERROR(EINVAL); + goto done; + } + + frame->format = avctx->sample_fmt; + frame->sample_rate = avctx->sample_rate; + frame->nb_samples = info->size / (sample_size * avctx->ch_layout.nb_channels); + + ret = av_channel_layout_copy(&frame->ch_layout, &avctx->ch_layout); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Could not copy channel layout\n"); + goto done; + } + + /* MediaCodec buffers needs to be copied to our own refcounted buffers + * because the flush command invalidates all input and output buffers. + */ + ret = ff_get_buffer(avctx, frame, 0); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer\n"); + goto done; + } + + /* Override frame->pts as ff_get_buffer will override its value based + * on the last avpacket received which is not in sync with the frame: + * * N avpackets can be pushed before 1 frame is actually returned + * * 0-sized avpackets are pushed to flush remaining frames at EOS */ + if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) { + frame->pts = av_rescale_q(info->presentationTimeUs, + AV_TIME_BASE_Q, + avctx->pkt_timebase); + } else { + frame->pts = info->presentationTimeUs; + } + frame->pkt_dts = AV_NOPTS_VALUE; + frame->flags |= AV_FRAME_FLAG_KEY; + + av_log(avctx, AV_LOG_TRACE, + "Frame: format=%d channels=%d sample_rate=%d nb_samples=%d", + avctx->sample_fmt, avctx->ch_layout.nb_channels, avctx->sample_rate, frame->nb_samples); + + memcpy(frame->data[0], data, info->size); + + ret = 0; +done: + status = ff_AMediaCodec_releaseOutputBuffer(s->codec, index, 0); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n"); + ret = AVERROR_EXTERNAL; + } + + return ret; +} + +static int mediacodec_wrap_sw_video_buffer(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + ssize_t index, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + int ret = 0; + int status = 0; + + frame->width = avctx->width; + frame->height = avctx->height; + frame->format = avctx->pix_fmt; + + /* MediaCodec buffers needs to be copied to our own refcounted buffers + * because the flush command invalidates all input and output buffers. + */ + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { + av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer\n"); + goto done; + } + + /* Override frame->pkt_pts as ff_get_buffer will override its value based + * on the last avpacket received which is not in sync with the frame: + * * N avpackets can be pushed before 1 frame is actually returned + * * 0-sized avpackets are pushed to flush remaining frames at EOS */ + if (avctx->pkt_timebase.num && avctx->pkt_timebase.den) { + frame->pts = av_rescale_q(info->presentationTimeUs, + AV_TIME_BASE_Q, + avctx->pkt_timebase); + } else { + frame->pts = info->presentationTimeUs; + } + frame->pkt_dts = AV_NOPTS_VALUE; + + av_log(avctx, AV_LOG_TRACE, + "Frame: width=%d stride=%d height=%d slice-height=%d " + "crop-top=%d crop-bottom=%d crop-left=%d crop-right=%d encoder=%s " + "destination linesizes=%d,%d,%d\n" , + avctx->width, s->stride, avctx->height, s->slice_height, + s->crop_top, s->crop_bottom, s->crop_left, s->crop_right, s->codec_name, + frame->linesize[0], frame->linesize[1], frame->linesize[2]); + + switch (s->color_format) { + case COLOR_FormatYUV420Planar: + ff_mediacodec_sw_buffer_copy_yuv420_planar(avctx, s, data, size, info, frame); + break; + case COLOR_FormatYUV420SemiPlanar: + case COLOR_QCOM_FormatYUV420SemiPlanar: + case COLOR_QCOM_FormatYUV420SemiPlanar32m: + ff_mediacodec_sw_buffer_copy_yuv420_semi_planar(avctx, s, data, size, info, frame); + break; + case COLOR_TI_FormatYUV420PackedSemiPlanar: + case COLOR_TI_FormatYUV420PackedSemiPlanarInterlaced: + ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar(avctx, s, data, size, info, frame); + break; + case COLOR_QCOM_FormatYUV420PackedSemiPlanar64x32Tile2m8ka: + ff_mediacodec_sw_buffer_copy_yuv420_packed_semi_planar_64x32Tile2m8ka(avctx, s, data, size, info, frame); + break; + default: + av_log(avctx, AV_LOG_ERROR, "Unsupported color format 0x%x (value=%d)\n", + s->color_format, s->color_format); + ret = AVERROR(EINVAL); + goto done; + } + + ret = 0; +done: + status = ff_AMediaCodec_releaseOutputBuffer(s->codec, index, 0); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n"); + ret = AVERROR_EXTERNAL; + } + + return ret; +} + +static int mediacodec_wrap_sw_buffer(AVCodecContext *avctx, + MediaCodecDecContext *s, + uint8_t *data, + size_t size, + ssize_t index, + FFAMediaCodecBufferInfo *info, + AVFrame *frame) +{ + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) + return mediacodec_wrap_sw_audio_buffer(avctx, s, data, size, index, info, frame); + else if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) + return mediacodec_wrap_sw_video_buffer(avctx, s, data, size, index, info, frame); + else + av_assert0(0); +} + +#define AMEDIAFORMAT_GET_INT32(name, key, mandatory) do { \ + int32_t value = 0; \ + if (ff_AMediaFormat_getInt32(s->format, key, &value)) { \ + (name) = value; \ + } else if (mandatory) { \ + av_log(avctx, AV_LOG_ERROR, "Could not get %s from format %s\n", key, format); \ + ret = AVERROR_EXTERNAL; \ + goto fail; \ + } else { \ + (name) = 0; \ + } \ +} while (0) \ + +static int mediacodec_dec_parse_video_format(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + int ret = 0; + int width = 0; + int height = 0; + int color_range = 0; + int color_standard = 0; + int color_transfer = 0; + char *format = NULL; + + if (!s->format) { + av_log(avctx, AV_LOG_ERROR, "Output MediaFormat is not set\n"); + return AVERROR(EINVAL); + } + + format = ff_AMediaFormat_toString(s->format); + if (!format) { + return AVERROR_EXTERNAL; + } + av_log(avctx, AV_LOG_DEBUG, "Parsing MediaFormat %s\n", format); + + /* Mandatory fields */ + AMEDIAFORMAT_GET_INT32(s->width, "width", 1); + AMEDIAFORMAT_GET_INT32(s->height, "height", 1); + + AMEDIAFORMAT_GET_INT32(s->stride, "stride", 0); + s->stride = s->stride > 0 ? s->stride : s->width; + + AMEDIAFORMAT_GET_INT32(s->slice_height, "slice-height", 0); + + if (strstr(s->codec_name, "OMX.Nvidia.") && s->slice_height == 0) { + s->slice_height = FFALIGN(s->height, 16); + } else if (strstr(s->codec_name, "OMX.SEC.avc.dec")) { + s->slice_height = avctx->height; + s->stride = avctx->width; + } else if (strstr(s->codec_name, "OMX.MTK.VIDEO.DECODER.MPEG2")) { + s->slice_height = s->height; + } else if (s->slice_height == 0) { + s->slice_height = s->height; + } + + AMEDIAFORMAT_GET_INT32(s->color_format, "color-format", 1); + avctx->pix_fmt = mcdec_map_color_format(avctx, s, s->color_format); + if (avctx->pix_fmt == AV_PIX_FMT_NONE) { + av_log(avctx, AV_LOG_ERROR, "Output color format is not supported\n"); + ret = AVERROR(EINVAL); + goto fail; + } + + /* Optional fields */ + AMEDIAFORMAT_GET_INT32(s->crop_top, "crop-top", 0); + AMEDIAFORMAT_GET_INT32(s->crop_bottom, "crop-bottom", 0); + AMEDIAFORMAT_GET_INT32(s->crop_left, "crop-left", 0); + AMEDIAFORMAT_GET_INT32(s->crop_right, "crop-right", 0); + + // Try "crop" for NDK + // MediaTek SOC return some default value like Rect(0, 0, 318, 238) + if (!(s->crop_right && s->crop_bottom) && s->use_ndk_codec && !strstr(s->codec_name, ".mtk.")) + ff_AMediaFormat_getRect(s->format, "crop", &s->crop_left, &s->crop_top, &s->crop_right, &s->crop_bottom); + + if (s->crop_right && s->crop_bottom) { + width = s->crop_right + 1 - s->crop_left; + height = s->crop_bottom + 1 - s->crop_top; + } else { + /* TODO: NDK MediaFormat should try getRect() first. + * Try crop-width/crop-height, it works on NVIDIA Shield. + */ + AMEDIAFORMAT_GET_INT32(width, "crop-width", 0); + AMEDIAFORMAT_GET_INT32(height, "crop-height", 0); + } + if (!width || !height) { + width = s->width; + height = s->height; + } + + AMEDIAFORMAT_GET_INT32(s->display_width, "display-width", 0); + AMEDIAFORMAT_GET_INT32(s->display_height, "display-height", 0); + + if (s->display_width && s->display_height) { + AVRational sar = av_div_q( + (AVRational){ s->display_width, s->display_height }, + (AVRational){ width, height }); + ff_set_sar(avctx, sar); + } + + AMEDIAFORMAT_GET_INT32(color_range, "color-range", 0); + if (color_range) + avctx->color_range = ff_AMediaFormatColorRange_to_AVColorRange(color_range); + + AMEDIAFORMAT_GET_INT32(color_standard, "color-standard", 0); + if (color_standard) { + avctx->colorspace = ff_AMediaFormatColorStandard_to_AVColorSpace(color_standard); + avctx->color_primaries = ff_AMediaFormatColorStandard_to_AVColorPrimaries(color_standard); + } + + AMEDIAFORMAT_GET_INT32(color_transfer, "color-transfer", 0); + if (color_transfer) + avctx->color_trc = ff_AMediaFormatColorTransfer_to_AVColorTransfer(color_transfer); + + av_log(avctx, AV_LOG_INFO, + "Output crop parameters top=%d bottom=%d left=%d right=%d, " + "resulting dimensions width=%d height=%d\n", + s->crop_top, s->crop_bottom, s->crop_left, s->crop_right, + width, height); + + av_freep(&format); + return ff_set_dimensions(avctx, width, height); +fail: + av_freep(&format); + return ret; +} + +static int mediacodec_dec_parse_audio_format(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + int ret = 0; + int sample_rate = 0; + int channel_count = 0; + int channel_mask = 0; + int pcm_encoding = 0; + char *format = NULL; + + if (!s->format) { + av_log(avctx, AV_LOG_ERROR, "Output MediaFormat is not set\n"); + return AVERROR(EINVAL); + } + + format = ff_AMediaFormat_toString(s->format); + if (!format) { + return AVERROR_EXTERNAL; + } + av_log(avctx, AV_LOG_DEBUG, "Parsing MediaFormat %s\n", format); + + /* Mandatory fields */ + AMEDIAFORMAT_GET_INT32(channel_count, "channel-count", 1); + AMEDIAFORMAT_GET_INT32(sample_rate, "sample-rate", 1); + + AMEDIAFORMAT_GET_INT32(pcm_encoding, "pcm-encoding", 0); + if (pcm_encoding) + avctx->sample_fmt = mcdec_map_pcm_format(avctx, s, pcm_encoding); + else + avctx->sample_fmt = AV_SAMPLE_FMT_S16; + + avctx->sample_rate = sample_rate; + + AMEDIAFORMAT_GET_INT32(channel_mask, "channel-mask", 0); + if (channel_mask) + av_channel_layout_from_mask(&avctx->ch_layout, mcdec_map_channel_mask(avctx, channel_mask)); + else + av_channel_layout_default(&avctx->ch_layout, channel_count); + + av_log(avctx, AV_LOG_INFO, + "Output parameters channel-count=%d channel-layout=%x sample-rate=%d\n", + channel_count, channel_mask, sample_rate); + +fail: + av_freep(&format); + return ret; +} + +static int mediacodec_dec_parse_format(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) + return mediacodec_dec_parse_audio_format(avctx, s); + else if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) + return mediacodec_dec_parse_video_format(avctx, s); + else + av_assert0(0); +} + +static int mediacodec_dec_flush_codec(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + FFAMediaCodec *codec = s->codec; + int status; + + s->output_buffer_count = 0; + + s->draining = 0; + s->flushing = 0; + s->eos = 0; + atomic_fetch_add(&s->serial, 1); + atomic_init(&s->hw_buffer_count, 0); + s->current_input_buffer = -1; + + status = ff_AMediaCodec_flush(codec); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to flush codec\n"); + return AVERROR_EXTERNAL; + } + + return 0; +} + +static int mediacodec_dec_get_video_codec(AVCodecContext *avctx, MediaCodecDecContext *s, + const char *mime, FFAMediaFormat *format) +{ + int profile; + + enum AVPixelFormat pix_fmt; + static const enum AVPixelFormat pix_fmts[] = { + AV_PIX_FMT_MEDIACODEC, + AV_PIX_FMT_NONE, + }; + + pix_fmt = ff_get_format(avctx, pix_fmts); + if (pix_fmt == AV_PIX_FMT_MEDIACODEC) { + AVMediaCodecContext *user_ctx = avctx->hwaccel_context; + + if (avctx->hw_device_ctx) { + AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)(avctx->hw_device_ctx->data); + if (device_ctx->type == AV_HWDEVICE_TYPE_MEDIACODEC) { + if (device_ctx->hwctx) { + AVMediaCodecDeviceContext *mediacodec_ctx = (AVMediaCodecDeviceContext *)device_ctx->hwctx; + s->surface = ff_mediacodec_surface_ref(mediacodec_ctx->surface, mediacodec_ctx->native_window, avctx); + av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface); + } + } + } + + if (!s->surface && user_ctx && user_ctx->surface) { + s->surface = ff_mediacodec_surface_ref(user_ctx->surface, NULL, avctx); + av_log(avctx, AV_LOG_INFO, "Using surface %p\n", s->surface); + } + } + + profile = ff_AMediaCodecProfile_getProfileFromAVCodecContext(avctx); + if (profile < 0) { + av_log(avctx, AV_LOG_WARNING, "Unsupported or unknown profile\n"); + } + + s->codec_name = ff_AMediaCodecList_getCodecNameByType(mime, profile, 0, avctx); + if (!s->codec_name) { + // getCodecNameByType() can fail due to missing JVM, while NDK + // mediacodec can be used without JVM. + if (!s->use_ndk_codec) { + return AVERROR_EXTERNAL; + } + av_log(avctx, AV_LOG_INFO, "Failed to getCodecNameByType\n"); + } else { + av_log(avctx, AV_LOG_DEBUG, "Found decoder %s\n", s->codec_name); + } + + if (s->codec_name) + s->codec = ff_AMediaCodec_createCodecByName(s->codec_name, s->use_ndk_codec); + else { + s->codec = ff_AMediaCodec_createDecoderByType(mime, s->use_ndk_codec); + if (s->codec) { + s->codec_name = ff_AMediaCodec_getName(s->codec); + if (!s->codec_name) + s->codec_name = av_strdup(mime); + } + } + if (!s->codec) { + av_log(avctx, AV_LOG_ERROR, "Failed to create media decoder for type %s and name %s\n", mime, s->codec_name); + return AVERROR_EXTERNAL; + } + + return 0; +} + +static int mediacodec_dec_get_audio_codec(AVCodecContext *avctx, MediaCodecDecContext *s, + const char *mime, FFAMediaFormat *format) +{ + s->codec = ff_AMediaCodec_createDecoderByType(mime, s->use_ndk_codec); + if (!s->codec) { + av_log(avctx, AV_LOG_ERROR, "Failed to create media decoder for mime %s\n", mime); + return AVERROR_EXTERNAL; + } + + s->codec_name = ff_AMediaCodec_getName(s->codec); + if (!s->codec_name) { + s->codec_name = av_strdup(mime); + if (!s->codec_name) + return AVERROR(ENOMEM); + } + + return 0; +} + +int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, + const char *mime, FFAMediaFormat *format) +{ + int ret; + int status; + + s->avctx = avctx; + atomic_init(&s->refcount, 1); + atomic_init(&s->hw_buffer_count, 0); + atomic_init(&s->serial, 1); + s->current_input_buffer = -1; + + if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) + ret = mediacodec_dec_get_audio_codec(avctx, s, mime, format); + else if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) + ret = mediacodec_dec_get_video_codec(avctx, s, mime, format); + else + av_assert0(0); + if (ret < 0) + goto fail; + + status = ff_AMediaCodec_configure(s->codec, format, s->surface, NULL, 0); + if (status < 0) { + char *desc = ff_AMediaFormat_toString(format); + av_log(avctx, AV_LOG_ERROR, + "Failed to configure codec %s (status = %d) with format %s\n", + s->codec_name, status, desc); + av_freep(&desc); + + ret = AVERROR_EXTERNAL; + goto fail; + } + + status = ff_AMediaCodec_start(s->codec); + if (status < 0) { + char *desc = ff_AMediaFormat_toString(format); + av_log(avctx, AV_LOG_ERROR, + "Failed to start codec %s (status = %d) with format %s\n", + s->codec_name, status, desc); + av_freep(&desc); + ret = AVERROR_EXTERNAL; + goto fail; + } + + if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { + s->format = ff_AMediaCodec_getOutputFormat(s->codec); + if (s->format) { + if ((ret = mediacodec_dec_parse_format(avctx, s)) < 0) { + av_log(avctx, AV_LOG_ERROR, + "Failed to configure context\n"); + goto fail; + } + } + } + + av_log(avctx, AV_LOG_DEBUG, "MediaCodec %p started successfully\n", s->codec); + + return 0; + +fail: + av_log(avctx, AV_LOG_ERROR, "MediaCodec %p failed to start\n", s->codec); + ff_mediacodec_dec_close(avctx, s); + return ret; +} + +int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, + AVPacket *pkt, bool wait) +{ + int offset = 0; + int need_draining = 0; + uint8_t *data; + size_t size; + FFAMediaCodec *codec = s->codec; + int status; + int64_t input_dequeue_timeout_us = wait ? INPUT_DEQUEUE_TIMEOUT_US : 0; + int64_t pts; + + if (s->flushing) { + av_log(avctx, AV_LOG_ERROR, "Decoder is flushing and cannot accept new buffer " + "until all output buffers have been released\n"); + return AVERROR_EXTERNAL; + } + + if (pkt->size == 0) { + need_draining = 1; + } + + if (s->draining && s->eos) { + return AVERROR_EOF; + } + + while (offset < pkt->size || (need_draining && !s->draining)) { + ssize_t index = s->current_input_buffer; + if (index < 0) { + index = ff_AMediaCodec_dequeueInputBuffer(codec, input_dequeue_timeout_us); + if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { + av_log(avctx, AV_LOG_TRACE, "No input buffer available, try again later\n"); + break; + } + + if (index < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to dequeue input buffer (status=%zd)\n", index); + return AVERROR_EXTERNAL; + } + } + s->current_input_buffer = -1; + + data = ff_AMediaCodec_getInputBuffer(codec, index, &size); + if (!data) { + av_log(avctx, AV_LOG_ERROR, "Failed to get input buffer\n"); + return AVERROR_EXTERNAL; + } + + pts = pkt->pts; + if (pts == AV_NOPTS_VALUE) { + av_log(avctx, AV_LOG_WARNING, "Input packet is missing PTS\n"); + pts = 0; + } + if (pts && avctx->pkt_timebase.num && avctx->pkt_timebase.den) { + pts = av_rescale_q(pts, avctx->pkt_timebase, AV_TIME_BASE_Q); + } + + if (need_draining) { + uint32_t flags = ff_AMediaCodec_getBufferFlagEndOfStream(codec); + + av_log(avctx, AV_LOG_DEBUG, "Sending End Of Stream signal\n"); + + status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, 0, pts, flags); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to queue input empty buffer (status = %d)\n", status); + return AVERROR_EXTERNAL; + } + + av_log(avctx, AV_LOG_TRACE, + "Queued empty EOS input buffer %zd with flags=%d\n", index, flags); + + s->draining = 1; + return 0; + } + + size = FFMIN(pkt->size - offset, size); + memcpy(data, pkt->data + offset, size); + offset += size; + + status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer (status = %d)\n", status); + return AVERROR_EXTERNAL; + } + + av_log(avctx, AV_LOG_TRACE, + "Queued input buffer %zd size=%zd ts=%"PRIi64"\n", index, size, pts); + } + + if (offset == 0) + return AVERROR(EAGAIN); + return offset; +} + +int ff_mediacodec_dec_receive(AVCodecContext *avctx, MediaCodecDecContext *s, + AVFrame *frame, bool wait) +{ + int ret; + uint8_t *data; + ssize_t index; + size_t size; + FFAMediaCodec *codec = s->codec; + FFAMediaCodecBufferInfo info = { 0 }; + int status; + int64_t output_dequeue_timeout_us = OUTPUT_DEQUEUE_TIMEOUT_US; + + if (s->draining && s->eos) { + return AVERROR_EOF; + } + + if (s->draining) { + /* If the codec is flushing or need to be flushed, block for a fair + * amount of time to ensure we got a frame */ + output_dequeue_timeout_us = OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US; + } else if (s->output_buffer_count == 0 || !wait) { + /* If the codec hasn't produced any frames, do not block so we + * can push data to it as fast as possible, and get the first + * frame */ + output_dequeue_timeout_us = 0; + } + + index = ff_AMediaCodec_dequeueOutputBuffer(codec, &info, output_dequeue_timeout_us); + if (index >= 0) { + av_log(avctx, AV_LOG_TRACE, "Got output buffer %zd" + " offset=%" PRIi32 " size=%" PRIi32 " ts=%" PRIi64 + " flags=%" PRIu32 "\n", index, info.offset, info.size, + info.presentationTimeUs, info.flags); + + if (info.flags & ff_AMediaCodec_getBufferFlagEndOfStream(codec)) { + s->eos = 1; + } + + if (info.size) { + if (s->surface) { + if ((ret = mediacodec_wrap_hw_buffer(avctx, s, index, &info, frame)) < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to wrap MediaCodec buffer\n"); + return ret; + } + } else { + data = ff_AMediaCodec_getOutputBuffer(codec, index, &size); + if (!data) { + av_log(avctx, AV_LOG_ERROR, "Failed to get output buffer\n"); + return AVERROR_EXTERNAL; + } + + if ((ret = mediacodec_wrap_sw_buffer(avctx, s, data, size, index, &info, frame)) < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to wrap MediaCodec buffer\n"); + return ret; + } + } + + s->output_buffer_count++; + return 0; + } else { + status = ff_AMediaCodec_releaseOutputBuffer(codec, index, 0); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to release output buffer\n"); + } + } + + } else if (ff_AMediaCodec_infoOutputFormatChanged(codec, index)) { + char *format = NULL; + + if (s->format) { + status = ff_AMediaFormat_delete(s->format); + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to delete MediaFormat %p\n", s->format); + } + } + + s->format = ff_AMediaCodec_getOutputFormat(codec); + if (!s->format) { + av_log(avctx, AV_LOG_ERROR, "Failed to get output format\n"); + return AVERROR_EXTERNAL; + } + + format = ff_AMediaFormat_toString(s->format); + if (!format) { + return AVERROR_EXTERNAL; + } + av_log(avctx, AV_LOG_INFO, "Output MediaFormat changed to %s\n", format); + av_freep(&format); + + if ((ret = mediacodec_dec_parse_format(avctx, s)) < 0) { + return ret; + } + + } else if (ff_AMediaCodec_infoOutputBuffersChanged(codec, index)) { + ff_AMediaCodec_cleanOutputBuffers(codec); + } else if (ff_AMediaCodec_infoTryAgainLater(codec, index)) { + if (s->draining) { + av_log(avctx, AV_LOG_ERROR, "Failed to dequeue output buffer within %" PRIi64 "ms " + "while draining remaining frames, output will probably lack frames\n", + output_dequeue_timeout_us / 1000); + } else { + av_log(avctx, AV_LOG_TRACE, "No output buffer available, try again later\n"); + } + } else { + av_log(avctx, AV_LOG_ERROR, "Failed to dequeue output buffer (status=%zd)\n", index); + return AVERROR_EXTERNAL; + } + + if (s->draining && s->eos) + return AVERROR_EOF; + return AVERROR(EAGAIN); +} + +/* +* ff_mediacodec_dec_flush returns 0 if the flush cannot be performed on +* the codec (because the user retains frames). The codec stays in the +* flushing state. +* +* ff_mediacodec_dec_flush returns 1 if the flush can actually be +* performed on the codec. The codec leaves the flushing state and can +* process again packets. +* +* ff_mediacodec_dec_flush returns a negative value if an error has +* occurred. +*/ +int ff_mediacodec_dec_flush(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + if (!s->surface || !s->delay_flush || atomic_load(&s->refcount) == 1) { + int ret; + + /* No frames (holding a reference to the codec) are retained by the + * user, thus we can flush the codec and returns accordingly */ + if ((ret = mediacodec_dec_flush_codec(avctx, s)) < 0) { + return ret; + } + + return 1; + } + + s->flushing = 1; + return 0; +} + +int ff_mediacodec_dec_close(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + if (!s) + return 0; + + if (s->codec) { + if (atomic_load(&s->hw_buffer_count) == 0) { + ff_AMediaCodec_stop(s->codec); + av_log(avctx, AV_LOG_DEBUG, "MediaCodec %p stopped\n", s->codec); + } else { + av_log(avctx, AV_LOG_DEBUG, "Not stopping MediaCodec (there are buffers pending)\n"); + } + } + + ff_mediacodec_dec_unref(s); + + return 0; +} + +int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, MediaCodecDecContext *s) +{ + return s->flushing; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec_common.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecdec_common.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecdec_common.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,110 @@ +/* + * Android MediaCodec decoder + * + * Copyright (c) 2015-2016 Matthieu Bouron + * + * 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 + */ + +#ifndef AVCODEC_MEDIACODECDEC_COMMON_H +#define AVCODEC_MEDIACODECDEC_COMMON_H + +#include +#include +#include +#include + +#include "libavutil/frame.h" +#include "libavutil/pixfmt.h" + +#include "avcodec.h" +#include "mediacodec_wrapper.h" + +typedef struct MediaCodecDecContext { + + AVCodecContext *avctx; + atomic_int refcount; + atomic_int hw_buffer_count; + + char *codec_name; + + FFAMediaCodec *codec; + FFAMediaFormat *format; + + void *surface; + + int started; + int draining; + int flushing; + int eos; + + int width; + int height; + int stride; + int slice_height; + int color_format; + int crop_top; + int crop_bottom; + int crop_left; + int crop_right; + int display_width; + int display_height; + + uint64_t output_buffer_count; + ssize_t current_input_buffer; + + bool delay_flush; + atomic_int serial; + + bool use_ndk_codec; +} MediaCodecDecContext; + +int ff_mediacodec_dec_init(AVCodecContext *avctx, + MediaCodecDecContext *s, + const char *mime, + FFAMediaFormat *format); + +int ff_mediacodec_dec_send(AVCodecContext *avctx, + MediaCodecDecContext *s, + AVPacket *pkt, + bool wait); + +int ff_mediacodec_dec_receive(AVCodecContext *avctx, + MediaCodecDecContext *s, + AVFrame *frame, + bool wait); + +int ff_mediacodec_dec_flush(AVCodecContext *avctx, + MediaCodecDecContext *s); + +int ff_mediacodec_dec_close(AVCodecContext *avctx, + MediaCodecDecContext *s); + +int ff_mediacodec_dec_is_flushing(AVCodecContext *avctx, + MediaCodecDecContext *s); + +typedef struct MediaCodecBuffer { + + MediaCodecDecContext *ctx; + ssize_t index; + int64_t pts; + atomic_int released; + int serial; + +} MediaCodecBuffer; + +#endif /* AVCODEC_MEDIACODECDEC_COMMON_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecenc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecenc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mediacodecenc.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mediacodecenc.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,1514 @@ +/* + * Android MediaCodec encoders + * + * Copyright (c) 2022 Zhao Zhili + * + * 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 "config_components.h" + +#include "libavutil/avassert.h" +#include "libavutil/fifo.h" +#include "libavutil/avstring.h" +#include "libavutil/hwcontext_mediacodec.h" +#include "libavutil/imgutils.h" +#include "libavutil/mem.h" +#include "libavutil/opt.h" +#include "libavutil/thread.h" + +#include "avcodec.h" +#include "bsf.h" +#include "codec_internal.h" +#include "encode.h" +#include "hwconfig.h" +#include "jni.h" +#include "fffjni.h" +#include "mediacodec.h" +#include "mediacodec_wrapper.h" +#include "mediacodecdec_common.h" +#include "profiles.h" + +#define INPUT_DEQUEUE_TIMEOUT_US 8000 +#define OUTPUT_DEQUEUE_TIMEOUT_US 8000 + +enum BitrateMode { + /* Constant quality mode */ + BITRATE_MODE_CQ = 0, + /* Variable bitrate mode */ + BITRATE_MODE_VBR = 1, + /* Constant bitrate mode */ + BITRATE_MODE_CBR = 2, + /* Constant bitrate mode with frame drops */ + BITRATE_MODE_CBR_FD = 3, +}; + +typedef struct MediaCodecAsyncOutput { + int32_t index; + FFAMediaCodecBufferInfo buf_info; +} MediaCodecAsyncOutput; + +typedef struct MediaCodecEncContext { + AVClass *avclass; + FFAMediaCodec *codec; + int use_ndk_codec; + const char *name; + FFANativeWindow *window; + + int fps; + int width; + int height; + + uint8_t *extradata; + int extradata_size; + int eof_sent; + + AVFrame *frame; + AVBSFContext *bsf; + + int bitrate_mode; + int level; + int pts_as_dts; + int extract_extradata; + // Ref. MediaFormat KEY_OPERATING_RATE + int operating_rate; + int async_mode; + + AVMutex input_mutex; + AVCond input_cond; + AVFifo *input_index; + + AVMutex output_mutex; + AVCond output_cond; + int encode_status; + AVFifo *async_output; + + int qp_i_min; + int qp_p_min; + int qp_b_min; + int qp_i_max; + int qp_p_max; + int qp_b_max; +} MediaCodecEncContext; + +enum { + COLOR_FormatYUV420Planar = 0x13, + COLOR_FormatYUV420SemiPlanar = 0x15, + COLOR_FormatSurface = 0x7F000789, +}; + +static const struct { + int color_format; + enum AVPixelFormat pix_fmt; +} color_formats[] = { + { COLOR_FormatYUV420Planar, AV_PIX_FMT_YUV420P }, + { COLOR_FormatYUV420SemiPlanar, AV_PIX_FMT_NV12 }, + { COLOR_FormatSurface, AV_PIX_FMT_MEDIACODEC }, +}; + +static const enum AVPixelFormat avc_pix_fmts[] = { + AV_PIX_FMT_MEDIACODEC, + AV_PIX_FMT_YUV420P, + AV_PIX_FMT_NV12, + AV_PIX_FMT_NONE +}; + +static void mediacodec_dump_format(AVCodecContext *avctx, + FFAMediaFormat *out_format) +{ + MediaCodecEncContext *s = avctx->priv_data; + const char *name = s->name; + char *str = ff_AMediaFormat_toString(out_format); + + av_log(avctx, AV_LOG_DEBUG, "MediaCodec encoder %s output format %s\n", + name ? name : "unknown", str); + av_free(str); +} + +static void mediacodec_output_format(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaFormat *out_format = ff_AMediaCodec_getOutputFormat(s->codec); + + if (!s->name) + s->name = ff_AMediaCodec_getName(s->codec); + mediacodec_dump_format(avctx, out_format); + ff_AMediaFormat_delete(out_format); +} + +static int extract_extradata_support(AVCodecContext *avctx) +{ + const AVBitStreamFilter *bsf = av_bsf_get_by_name("extract_extradata"); + + if (!bsf) { + av_log(avctx, AV_LOG_WARNING, "extract_extradata bsf not found\n"); + return 0; + } + + for (int i = 0; bsf->codec_ids[i] != AV_CODEC_ID_NONE; i++) { + if (bsf->codec_ids[i] == avctx->codec_id) + return 1; + } + + return 0; +} + +static int mediacodec_init_bsf(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + char str[128] = {0}; + int ret; + int crop_right = s->width - avctx->width; + int crop_bottom = s->height - avctx->height; + + /* Nothing can be done for this format now */ + if (avctx->pix_fmt == AV_PIX_FMT_MEDIACODEC) + return 0; + + s->extract_extradata = (avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER) && + extract_extradata_support(avctx); + if (!crop_right && !crop_bottom && !s->extract_extradata) + return 0; + + ret = 0; + if (crop_right || crop_bottom) { + if (avctx->codec_id == AV_CODEC_ID_H264) + ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", + crop_right, crop_bottom); + else if (avctx->codec_id == AV_CODEC_ID_HEVC) + /* Encoder can use CTU size larger than 16x16, so the real crop + * margin can be larger than crop_right/crop_bottom. Let bsf figure + * out the real crop margin. + */ + ret = snprintf(str, sizeof(str), "hevc_metadata=width=%d:height=%d", + avctx->width, avctx->height); + if (ret >= sizeof(str)) + return AVERROR_BUFFER_TOO_SMALL; + } + + if (s->extract_extradata) { + ret = av_strlcatf(str, sizeof(str), "%sextract_extradata", ret ? "," : ""); + if (ret >= sizeof(str)) + return AVERROR_BUFFER_TOO_SMALL; + } + + ret = av_bsf_list_parse_str(str, &s->bsf); + if (ret < 0) + return ret; + + ret = avcodec_parameters_from_context(s->bsf->par_in, avctx); + if (ret < 0) + return ret; + s->bsf->time_base_in = avctx->time_base; + ret = av_bsf_init(s->bsf); + + return ret; +} + +static void copy_frame_to_buffer(AVCodecContext *avctx, const AVFrame *frame, + uint8_t *dst, size_t size) +{ + MediaCodecEncContext *s = avctx->priv_data; + uint8_t *dst_data[4] = {}; + int dst_linesize[4] = {}; + + if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) { + dst_data[0] = dst; + dst_data[1] = dst + s->width * s->height; + dst_data[2] = dst_data[1] + s->width * s->height / 4; + + dst_linesize[0] = s->width; + dst_linesize[1] = dst_linesize[2] = s->width / 2; + } else if (avctx->pix_fmt == AV_PIX_FMT_NV12) { + dst_data[0] = dst; + dst_data[1] = dst + s->width * s->height; + + dst_linesize[0] = s->width; + dst_linesize[1] = s->width; + } else { + av_assert0(0); + } + + av_image_copy2(dst_data, dst_linesize, frame->data, frame->linesize, + avctx->pix_fmt, avctx->width, avctx->height); +} + + +static void on_error(FFAMediaCodec *codec, void *userdata, int error, + const char *detail) +{ + AVCodecContext *avctx = userdata; + MediaCodecEncContext *s = avctx->priv_data; + + if (error == AVERROR(EAGAIN)) + return; + + av_log(avctx, AV_LOG_ERROR, "On error, %s, %s\n", av_err2str(error), detail); + + ff_mutex_lock(&s->input_mutex); + ff_mutex_lock(&s->output_mutex); + s->encode_status = error; + ff_mutex_unlock(&s->output_mutex); + ff_mutex_unlock(&s->input_mutex); + + ff_cond_signal(&s->output_cond); + ff_cond_signal(&s->input_cond); +} + +static void on_input_available(FFAMediaCodec *codec, void *userdata, + int32_t index) +{ + AVCodecContext *avctx = userdata; + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + ff_mutex_lock(&s->input_mutex); + ret = av_fifo_write(s->input_index, &index, 1); + if (ret >= 0) + ff_cond_signal(&s->input_cond); + ff_mutex_unlock(&s->input_mutex); + + if (ret < 0) + on_error(codec, userdata, ret, "av_fifo_write failed"); +} + +static void on_output_available(FFAMediaCodec *codec, void *userdata, + int32_t index, + FFAMediaCodecBufferInfo *out_info) +{ + AVCodecContext *avctx = userdata; + MediaCodecEncContext *s = avctx->priv_data; + MediaCodecAsyncOutput output = { + .index = index, + .buf_info = *out_info, + }; + int ret; + + ff_mutex_lock(&s->output_mutex); + ret = av_fifo_write(s->async_output, &output, 1); + if (ret >= 0) + ff_cond_signal(&s->output_cond); + ff_mutex_unlock(&s->output_mutex); + + if (ret < 0) + on_error(codec, userdata, ret, "av_fifo_write failed"); +} + +static void on_format_changed(FFAMediaCodec *codec, void *userdata, + FFAMediaFormat *format) +{ + mediacodec_dump_format(userdata, format); +} + +static int mediacodec_init_async_state(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + size_t fifo_size = 16; + + if (!s->async_mode) + return 0; + + ff_mutex_init(&s->input_mutex, NULL); + ff_cond_init(&s->input_cond, NULL); + + ff_mutex_init(&s->output_mutex, NULL); + ff_cond_init(&s->output_cond, NULL); + + s->input_index = av_fifo_alloc2(fifo_size, sizeof(int32_t), AV_FIFO_FLAG_AUTO_GROW); + s->async_output = av_fifo_alloc2(fifo_size, sizeof(MediaCodecAsyncOutput), + AV_FIFO_FLAG_AUTO_GROW); + + if (!s->input_index || !s->async_output) + return AVERROR(ENOMEM); + + return 0; +} + +static void mediacodec_uninit_async_state(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + + if (!s->async_mode) + return; + + ff_mutex_destroy(&s->input_mutex); + ff_cond_destroy(&s->input_cond); + + ff_mutex_destroy(&s->output_mutex); + ff_cond_destroy(&s->output_cond); + + av_fifo_freep2(&s->input_index); + av_fifo_freep2(&s->async_output); + + s->async_mode = 0; +} + +static int mediacodec_generate_extradata(AVCodecContext *avctx); + +static void mediacodec_set_qp_range(AVCodecContext *avctx, + FFAMediaFormat *format) +{ + MediaCodecEncContext *s = avctx->priv_data; + + // Handle common options in AVCodecContext first. + if (avctx->qmin >= 0) { + ff_AMediaFormat_setInt32(format, "video-qp-i-min", avctx->qmin); + ff_AMediaFormat_setInt32(format, "video-qp-p-min", avctx->qmin); + ff_AMediaFormat_setInt32(format, "video-qp-b-min", avctx->qmin); + } + + if (avctx->qmax >= 0) { + ff_AMediaFormat_setInt32(format, "video-qp-i-max", avctx->qmax); + ff_AMediaFormat_setInt32(format, "video-qp-p-max", avctx->qmax); + ff_AMediaFormat_setInt32(format, "video-qp-b-max", avctx->qmax); + } + + if (s->qp_i_min >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-i-min", s->qp_i_min); + if (s->qp_p_min >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-p-min", s->qp_p_min); + if (s->qp_b_min >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-b-min", s->qp_b_min); + + if (s->qp_i_max >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-i-max", s->qp_i_max); + if (s->qp_p_max >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-p-max", s->qp_p_max); + if (s->qp_b_max >= 0) + ff_AMediaFormat_setInt32(format, "video-qp-b-max", s->qp_b_max); +} + +static av_cold int mediacodec_init(AVCodecContext *avctx) +{ + const char *codec_mime = NULL; + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaFormat *format = NULL; + int ret; + int gop; + + // Init async state first, so we can do cleanup safely on error path. + ret = mediacodec_init_async_state(avctx); + if (ret < 0) + return ret; + + if (s->use_ndk_codec < 0) + s->use_ndk_codec = !av_jni_get_java_vm(avctx); + + switch (avctx->codec_id) { + case AV_CODEC_ID_H264: + codec_mime = "video/avc"; + break; + case AV_CODEC_ID_HEVC: + codec_mime = "video/hevc"; + break; + case AV_CODEC_ID_VP8: + codec_mime = "video/x-vnd.on2.vp8"; + break; + case AV_CODEC_ID_VP9: + codec_mime = "video/x-vnd.on2.vp9"; + break; + case AV_CODEC_ID_MPEG4: + codec_mime = "video/mp4v-es"; + break; + case AV_CODEC_ID_AV1: + codec_mime = "video/av01"; + break; + default: + av_assert0(0); + } + + if (s->name) + s->codec = ff_AMediaCodec_createCodecByName(s->name, s->use_ndk_codec); + else + s->codec = ff_AMediaCodec_createEncoderByType(codec_mime, s->use_ndk_codec); + if (!s->codec) { + av_log(avctx, AV_LOG_ERROR, "Failed to create encoder for type %s\n", + codec_mime); + return AVERROR_EXTERNAL; + } + + format = ff_AMediaFormat_new(s->use_ndk_codec); + if (!format) { + av_log(avctx, AV_LOG_ERROR, "Failed to create media format\n"); + return AVERROR_EXTERNAL; + } + + ff_AMediaFormat_setString(format, "mime", codec_mime); + // Workaround the alignment requirement of mediacodec. We can't do it + // silently for AV_PIX_FMT_MEDIACODEC. + if (avctx->pix_fmt != AV_PIX_FMT_MEDIACODEC && + (avctx->codec_id == AV_CODEC_ID_H264 || + avctx->codec_id == AV_CODEC_ID_HEVC)) { + s->width = FFALIGN(avctx->width, 16); + s->height = FFALIGN(avctx->height, 16); + } else { + s->width = avctx->width; + s->height = avctx->height; + if (s->width % 16 || s->height % 16) + av_log(avctx, AV_LOG_WARNING, + "Video size %dx%d isn't align to 16, it may have device compatibility issue\n", + s->width, s->height); + } + ff_AMediaFormat_setInt32(format, "width", s->width); + ff_AMediaFormat_setInt32(format, "height", s->height); + + if (avctx->pix_fmt == AV_PIX_FMT_MEDIACODEC) { + AVMediaCodecContext *user_ctx = avctx->hwaccel_context; + if (avctx->hw_device_ctx) { + AVHWDeviceContext *device_ctx = (AVHWDeviceContext*)(avctx->hw_device_ctx->data); + AVMediaCodecDeviceContext *dev_ctx; + + if (device_ctx->type != AV_HWDEVICE_TYPE_MEDIACODEC || !device_ctx->hwctx) { + ret = AVERROR(EINVAL); + goto bailout; + } + dev_ctx = device_ctx->hwctx; + s->window = ff_mediacodec_surface_ref(dev_ctx->surface, dev_ctx->native_window, avctx); + } + + if (!s->window && user_ctx && user_ctx->surface) + s->window = ff_mediacodec_surface_ref(user_ctx->surface, NULL, avctx); + + if (!s->window) { + ret = AVERROR(EINVAL); + av_log(avctx, AV_LOG_ERROR, "Missing hw_device_ctx or hwaccel_context for AV_PIX_FMT_MEDIACODEC\n"); + goto bailout; + } + /* Although there is a method ANativeWindow_toSurface() introduced in + * API level 26, it's easier and safe to always require a Surface for + * Java MediaCodec. + */ + if (!s->use_ndk_codec && !s->window->surface) { + ret = AVERROR(EINVAL); + av_log(avctx, AV_LOG_ERROR, "Missing jobject Surface for AV_PIX_FMT_MEDIACODEC. " + "Please note that Java MediaCodec doesn't work with ANativeWindow.\n"); + goto bailout; + } + } + + for (int i = 0; i < FF_ARRAY_ELEMS(color_formats); i++) { + if (avctx->pix_fmt == color_formats[i].pix_fmt) { + ff_AMediaFormat_setInt32(format, "color-format", + color_formats[i].color_format); + break; + } + } + + ret = ff_AMediaFormatColorRange_from_AVColorRange(avctx->color_range); + if (ret != COLOR_RANGE_UNSPECIFIED) + ff_AMediaFormat_setInt32(format, "color-range", ret); + ret = ff_AMediaFormatColorStandard_from_AVColorSpace(avctx->colorspace); + if (ret != COLOR_STANDARD_UNSPECIFIED) + ff_AMediaFormat_setInt32(format, "color-standard", ret); + ret = ff_AMediaFormatColorTransfer_from_AVColorTransfer(avctx->color_trc); + if (ret != COLOR_TRANSFER_UNSPECIFIED) + ff_AMediaFormat_setInt32(format, "color-transfer", ret); + + if (avctx->bit_rate) + ff_AMediaFormat_setInt32(format, "bitrate", avctx->bit_rate); + if (s->bitrate_mode >= 0) { + ff_AMediaFormat_setInt32(format, "bitrate-mode", s->bitrate_mode); + if (s->bitrate_mode == BITRATE_MODE_CQ && avctx->global_quality > 0) + ff_AMediaFormat_setInt32(format, "quality", avctx->global_quality); + } + mediacodec_set_qp_range(avctx, format); + + // frame-rate and i-frame-interval are required to configure codec + if (avctx->framerate.num >= avctx->framerate.den && avctx->framerate.den > 0) { + s->fps = avctx->framerate.num / avctx->framerate.den; + } else { + s->fps = 30; + av_log(avctx, AV_LOG_INFO, "Use %d as the default MediaFormat frame-rate\n", s->fps); + } + gop = round(avctx->gop_size / s->fps); + if (gop == 0) { + gop = 1; + av_log(avctx, AV_LOG_INFO, + "Use %d as the default MediaFormat i-frame-interval, " + "please set gop_size properly (>= fps)\n", gop); + } else { + av_log(avctx, AV_LOG_DEBUG, "Set i-frame-interval to %d\n", gop); + } + + ff_AMediaFormat_setInt32(format, "frame-rate", s->fps); + ff_AMediaFormat_setInt32(format, "i-frame-interval", gop); + + ret = ff_AMediaCodecProfile_getProfileFromAVCodecContext(avctx); + if (ret > 0) { + av_log(avctx, AV_LOG_DEBUG, "set profile to 0x%x\n", ret); + ff_AMediaFormat_setInt32(format, "profile", ret); + } + if (s->level > 0) { + av_log(avctx, AV_LOG_DEBUG, "set level to 0x%x\n", s->level); + ff_AMediaFormat_setInt32(format, "level", s->level); + } + if (avctx->max_b_frames > 0) { + if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { + av_log(avctx, AV_LOG_ERROR, + "Enabling B frames will produce packets with no DTS. " + "Use -strict experimental to use it anyway.\n"); + ret = AVERROR(EINVAL); + goto bailout; + } + ff_AMediaFormat_setInt32(format, "max-bframes", avctx->max_b_frames); + } + if (s->pts_as_dts == -1) + s->pts_as_dts = avctx->max_b_frames <= 0; + if (s->operating_rate > 0) + ff_AMediaFormat_setInt32(format, "operating-rate", s->operating_rate); + + ret = ff_AMediaCodec_getConfigureFlagEncode(s->codec); + ret = ff_AMediaCodec_configure(s->codec, format, s->window, NULL, ret); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "MediaCodec configure failed, %s\n", av_err2str(ret)); + if (avctx->pix_fmt == AV_PIX_FMT_YUV420P) + av_log(avctx, AV_LOG_ERROR, "Please try -pix_fmt nv12, some devices don't " + "support yuv420p as encoder input format.\n"); + goto bailout; + } + + if (s->async_mode) { + FFAMediaCodecOnAsyncNotifyCallback cb = { + .onAsyncInputAvailable = on_input_available, + .onAsyncOutputAvailable = on_output_available, + .onAsyncFormatChanged = on_format_changed, + .onAsyncError = on_error, + }; + + ret = ff_AMediaCodec_setAsyncNotifyCallback(s->codec, &cb, avctx); + if (ret < 0) { + av_log(avctx, AV_LOG_WARNING, + "Try MediaCodec async mode failed, %s, switch to sync mode\n", + av_err2str(ret)); + mediacodec_uninit_async_state(avctx); + } + } + + ret = mediacodec_init_bsf(avctx); + if (ret) + goto bailout; + + mediacodec_output_format(avctx); + + s->frame = av_frame_alloc(); + if (!s->frame) { + ret = AVERROR(ENOMEM); + goto bailout; + } + + ret = ff_AMediaCodec_start(s->codec); + if (ret) { + av_log(avctx, AV_LOG_ERROR, "MediaCodec failed to start, %s\n", + av_err2str(ret)); + goto bailout; + } + + ret = mediacodec_generate_extradata(avctx); + +bailout: + if (format) + ff_AMediaFormat_delete(format); + return ret; +} + +static int mediacodec_get_output_index(AVCodecContext *avctx, ssize_t *index, + FFAMediaCodecBufferInfo *out_info) +{ + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaCodec *codec = s->codec; + int64_t timeout_us = s->eof_sent ? OUTPUT_DEQUEUE_TIMEOUT_US : 0; + MediaCodecAsyncOutput output = { .index = -1 }; + int ret; + + if (!s->async_mode) { + *index = ff_AMediaCodec_dequeueOutputBuffer(codec, out_info, timeout_us); + return 0; + } + + ff_mutex_lock(&s->output_mutex); + + while (!s->encode_status) { + if (av_fifo_read(s->async_output, &output, 1) >= 0) + break; + + // Only wait after signalEndOfInputStream + if (s->eof_sent && !s->encode_status) + ff_cond_wait(&s->output_cond, &s->output_mutex); + else + break; + } + + ret = s->encode_status; + ff_mutex_unlock(&s->output_mutex); + + // Get output index success + if (output.index >= 0) { + *index = output.index; + *out_info = output.buf_info; + return 0; + } + + return ret ? ret : AVERROR(EAGAIN); +} + +static int mediacodec_receive(AVCodecContext *avctx, AVPacket *pkt) +{ + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaCodec *codec = s->codec; + ssize_t index; + FFAMediaCodecBufferInfo out_info = {0}; + uint8_t *out_buf; + size_t out_size = 0; + int ret; + int extradata_size = 0; + + ret = mediacodec_get_output_index(avctx, &index, &out_info); + if (ret < 0) + return ret; + + if (ff_AMediaCodec_infoTryAgainLater(codec, index)) + return AVERROR(EAGAIN); + + if (ff_AMediaCodec_infoOutputFormatChanged(codec, index)) { + mediacodec_output_format(avctx); + return AVERROR(EAGAIN); + } + + if (ff_AMediaCodec_infoOutputBuffersChanged(codec, index)) { + ff_AMediaCodec_cleanOutputBuffers(codec); + return AVERROR(EAGAIN); + } + + if (index < 0) + return AVERROR_EXTERNAL; + + if (out_info.flags & ff_AMediaCodec_getBufferFlagEndOfStream(codec)) + return AVERROR_EOF; + + out_buf = ff_AMediaCodec_getOutputBuffer(codec, index, &out_size); + if (!out_buf) { + ret = AVERROR_EXTERNAL; + goto bailout; + } + + if (out_info.flags & ff_AMediaCodec_getBufferFlagCodecConfig(codec)) { + if (avctx->codec_id == AV_CODEC_ID_AV1) { + // Skip AV1CodecConfigurationRecord without configOBUs + if (out_info.size <= 4) { + ff_AMediaCodec_releaseOutputBuffer(codec, index, false); + return mediacodec_receive(avctx, pkt); + } + out_info.size -= 4; + out_info.offset += 4; + } + + ret = av_reallocp(&s->extradata, out_info.size); + if (ret) + goto bailout; + + s->extradata_size = out_info.size; + memcpy(s->extradata, out_buf + out_info.offset, out_info.size); + ff_AMediaCodec_releaseOutputBuffer(codec, index, false); + // try immediately + return mediacodec_receive(avctx, pkt); + } + + ret = ff_get_encode_buffer(avctx, pkt, out_info.size + s->extradata_size, 0); + if (ret < 0) + goto bailout; + + if (s->extradata_size) { + extradata_size = s->extradata_size; + s->extradata_size = 0; + memcpy(pkt->data, s->extradata, extradata_size); + } + memcpy(pkt->data + extradata_size, out_buf + out_info.offset, out_info.size); + pkt->pts = av_rescale_q(out_info.presentationTimeUs, AV_TIME_BASE_Q, avctx->time_base); + if (s->pts_as_dts) + pkt->dts = pkt->pts; + if (out_info.flags & ff_AMediaCodec_getBufferFlagKeyFrame(codec)) + pkt->flags |= AV_PKT_FLAG_KEY; + ret = 0; + + av_log(avctx, AV_LOG_TRACE, "receive packet pts %" PRId64 " dts %" PRId64 + " flags %d extradata %d\n", + pkt->pts, pkt->dts, pkt->flags, extradata_size); + +bailout: + ff_AMediaCodec_releaseOutputBuffer(codec, index, false); + return ret; +} + +static int mediacodec_get_input_index(AVCodecContext *avctx, ssize_t *index) +{ + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaCodec *codec = s->codec; + int ret = 0; + int32_t n; + + if (!s->async_mode) { + *index = ff_AMediaCodec_dequeueInputBuffer(codec, INPUT_DEQUEUE_TIMEOUT_US); + return 0; + } + + ff_mutex_lock(&s->input_mutex); + + n = -1; + while (n < 0 && !s->encode_status) { + if (av_fifo_can_read(s->input_index) > 0) { + av_fifo_read(s->input_index, &n, 1); + break; + } + + if (n < 0 && !s->encode_status) + ff_cond_wait(&s->input_cond, &s->input_mutex); + } + + ret = s->encode_status; + *index = n; + ff_mutex_unlock(&s->input_mutex); + + return ret; +} + + +static int mediacodec_send(AVCodecContext *avctx, + const AVFrame *frame) { + MediaCodecEncContext *s = avctx->priv_data; + FFAMediaCodec *codec = s->codec; + ssize_t index; + uint8_t *input_buf = NULL; + size_t input_size = 0; + int64_t pts = 0; + uint32_t flags = 0; + int ret; + + if (s->eof_sent) + return 0; + + if (s->window) { + if (!frame) { + s->eof_sent = 1; + return ff_AMediaCodec_signalEndOfInputStream(codec); + } + + if (frame->data[3]) + av_mediacodec_release_buffer((AVMediaCodecBuffer *)frame->data[3], 1); + return 0; + } + + ret = mediacodec_get_input_index(avctx, &index); + if (ret < 0) + return ret; + + if (ff_AMediaCodec_infoTryAgainLater(codec, index)) + return AVERROR(EAGAIN); + + if (index < 0) { + av_log(avctx, AV_LOG_ERROR, "dequeue input buffer failed, %zd", index); + return AVERROR_EXTERNAL; + } + + if (frame) { + input_buf = ff_AMediaCodec_getInputBuffer(codec, index, &input_size); + copy_frame_to_buffer(avctx, frame, input_buf, input_size); + + pts = av_rescale_q(frame->pts, avctx->time_base, AV_TIME_BASE_Q); + + if (frame->pict_type == AV_PICTURE_TYPE_I) { + FFAMediaFormat *format = ff_AMediaFormat_new(s->use_ndk_codec); + if (format) { + ff_AMediaFormat_setInt32(format, "request-sync", 0); + ff_AMediaCodec_setParameters(codec, format); + ff_AMediaFormat_delete(format); + } + } + } else { + flags |= ff_AMediaCodec_getBufferFlagEndOfStream(codec); + s->eof_sent = 1; + } + + ff_AMediaCodec_queueInputBuffer(codec, index, 0, input_size, pts, flags); + return 0; +} + +static int mediacodec_encode(AVCodecContext *avctx, AVPacket *pkt) +{ + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + // Return on three case: + // 1. Serious error + // 2. Got a packet success + // 3. No AVFrame is available yet (don't return if get_frame return EOF) + while (1) { + if (s->bsf) { + ret = av_bsf_receive_packet(s->bsf, pkt); + if (!ret) + return 0; + if (ret != AVERROR(EAGAIN)) + return ret; + } + + ret = mediacodec_receive(avctx, pkt); + if (s->bsf) { + if (!ret || ret == AVERROR_EOF) + ret = av_bsf_send_packet(s->bsf, pkt); + } else { + if (!ret) + return 0; + } + + if (ret < 0 && ret != AVERROR(EAGAIN)) + return ret; + + if (!s->frame->buf[0]) { + ret = ff_encode_get_frame(avctx, s->frame); + if (ret && ret != AVERROR_EOF) + return ret; + } + + ret = mediacodec_send(avctx, s->frame->buf[0] ? s->frame : NULL); + if (!ret) + av_frame_unref(s->frame); + else if (ret != AVERROR(EAGAIN)) + return ret; + } + + return 0; +} + +static int mediacodec_send_dummy_frame(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + s->frame->width = avctx->width; + s->frame->height = avctx->height; + s->frame->format = avctx->pix_fmt; + s->frame->pts = 0; + + ret = av_frame_get_buffer(s->frame, 0); + if (ret < 0) + return ret; + + do { + ret = mediacodec_send(avctx, s->frame); + } while (ret == AVERROR(EAGAIN)); + av_frame_unref(s->frame); + + if (ret < 0) + return ret; + + ret = mediacodec_send(avctx, NULL); + if (ret < 0) { + av_log(avctx, AV_LOG_ERROR, "Flush failed: %s\n", av_err2str(ret)); + return ret; + } + + return 0; +} + +static int mediacodec_receive_dummy_pkt(AVCodecContext *avctx, AVPacket *pkt) +{ + MediaCodecEncContext *s = avctx->priv_data; + int ret; + + do { + ret = mediacodec_receive(avctx, pkt); + } while (ret == AVERROR(EAGAIN)); + + if (ret < 0) + return ret; + + do { + ret = av_bsf_send_packet(s->bsf, pkt); + if (ret < 0) + return ret; + ret = av_bsf_receive_packet(s->bsf, pkt); + } while (ret == AVERROR(EAGAIN)); + + return ret; +} + +static int mediacodec_generate_extradata(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + AVPacket *pkt = NULL; + int ret; + size_t side_size; + uint8_t *side; + + if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER)) + return 0; + + // Send dummy frame and receive a packet doesn't work in async mode + if (s->async_mode || !s->extract_extradata) { + av_log(avctx, AV_LOG_WARNING, + "Mediacodec encoder doesn't support AV_CODEC_FLAG_GLOBAL_HEADER. " + "Use extract_extradata bsf when necessary.\n"); + return 0; + } + + pkt = av_packet_alloc(); + if (!pkt) + return AVERROR(ENOMEM); + + ret = mediacodec_send_dummy_frame(avctx); + if (ret < 0) + goto bailout; + ret = mediacodec_receive_dummy_pkt(avctx, pkt); + if (ret < 0) + goto bailout; + + side = av_packet_get_side_data(pkt, AV_PKT_DATA_NEW_EXTRADATA, &side_size); + if (side && side_size > 0) { + avctx->extradata = av_mallocz(side_size + AV_INPUT_BUFFER_PADDING_SIZE); + if (!avctx->extradata) { + ret = AVERROR(ENOMEM); + goto bailout; + } + + memcpy(avctx->extradata, side, side_size); + avctx->extradata_size = side_size; + } + +bailout: + if (s->eof_sent) { + s->eof_sent = 0; + ff_AMediaCodec_flush(s->codec); + } + av_bsf_flush(s->bsf); + av_packet_free(&pkt); + return ret; +} + +static av_cold int mediacodec_close(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + if (s->codec) { + ff_AMediaCodec_stop(s->codec); + ff_AMediaCodec_delete(s->codec); + s->codec = NULL; + } + + if (s->window) { + ff_mediacodec_surface_unref(s->window, avctx); + s->window = NULL; + } + + av_bsf_free(&s->bsf); + av_frame_free(&s->frame); + + mediacodec_uninit_async_state(avctx); + + return 0; +} + +static av_cold void mediacodec_flush(AVCodecContext *avctx) +{ + MediaCodecEncContext *s = avctx->priv_data; + if (s->bsf) + av_bsf_flush(s->bsf); + av_frame_unref(s->frame); + ff_AMediaCodec_flush(s->codec); +} + +static const AVCodecHWConfigInternal *const mediacodec_hw_configs[] = { + &(const AVCodecHWConfigInternal) { + .public = { + .pix_fmt = AV_PIX_FMT_MEDIACODEC, + .methods = AV_CODEC_HW_CONFIG_METHOD_AD_HOC | + AV_CODEC_HW_CONFIG_METHOD_HW_DEVICE_CTX, + .device_type = AV_HWDEVICE_TYPE_MEDIACODEC, + }, + .hwaccel = NULL, + }, + NULL +}; + +static const FFCodecDefault mediacodec_defaults[] = { + {"qmin", "-1"}, + {"qmax", "-1"}, + {NULL}, +}; + +#define OFFSET(x) offsetof(MediaCodecEncContext, x) +#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM +#define COMMON_OPTION \ + { "ndk_codec", "Use MediaCodec from NDK", \ + OFFSET(use_ndk_codec), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE }, \ + { "ndk_async", "Try NDK MediaCodec in async mode", \ + OFFSET(async_mode), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, VE }, \ + { "codec_name", "Select codec by name", \ + OFFSET(name), AV_OPT_TYPE_STRING, {0}, 0, 0, VE }, \ + { "bitrate_mode", "Bitrate control method", \ + OFFSET(bitrate_mode), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE, .unit = "bitrate_mode" }, \ + { "cq", "Constant quality mode", \ + 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CQ}, 0, 0, VE, .unit = "bitrate_mode" }, \ + { "vbr", "Variable bitrate mode", \ + 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_VBR}, 0, 0, VE, .unit = "bitrate_mode" }, \ + { "cbr", "Constant bitrate mode", \ + 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CBR}, 0, 0, VE, .unit = "bitrate_mode" }, \ + { "cbr_fd", "Constant bitrate mode with frame drops", \ + 0, AV_OPT_TYPE_CONST, {.i64 = BITRATE_MODE_CBR_FD}, 0, 0, VE, .unit = "bitrate_mode" }, \ + { "pts_as_dts", "Use PTS as DTS. It is enabled automatically if avctx max_b_frames <= 0, " \ + "since most of Android devices don't output B frames by default.", \ + OFFSET(pts_as_dts), AV_OPT_TYPE_BOOL, {.i64 = -1}, -1, 1, VE }, \ + { "operating_rate", "The desired operating rate that the codec will need to operate at, zero for unspecified", \ + OFFSET(operating_rate), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE }, \ + { "qp_i_min", "minimum quantization parameter for I frame", \ + OFFSET(qp_i_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + { "qp_p_min", "minimum quantization parameter for P frame", \ + OFFSET(qp_p_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + { "qp_b_min", "minimum quantization parameter for B frame", \ + OFFSET(qp_b_min), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + { "qp_i_max", "maximum quantization parameter for I frame", \ + OFFSET(qp_i_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + { "qp_p_max", "maximum quantization parameter for P frame", \ + OFFSET(qp_p_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + { "qp_b_max", "maximum quantization parameter for B frame", \ + OFFSET(qp_b_max), AV_OPT_TYPE_INT, {.i64 = -1}, -1, INT_MAX, VE }, \ + + +#define MEDIACODEC_ENCODER_CLASS(name) \ +static const AVClass name ## _mediacodec_class = { \ + .class_name = #name "_mediacodec", \ + .item_name = av_default_item_name, \ + .option = name ## _options, \ + .version = LIBAVUTIL_VERSION_INT, \ +}; \ + +#define DECLARE_MEDIACODEC_ENCODER(short_name, long_name, codec_id) \ +MEDIACODEC_ENCODER_CLASS(short_name) \ +const FFCodec ff_ ## short_name ## _mediacodec_encoder = { \ + .p.name = #short_name "_mediacodec", \ + CODEC_LONG_NAME(long_name " Android MediaCodec encoder"), \ + .p.type = AVMEDIA_TYPE_VIDEO, \ + .p.id = codec_id, \ + .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY | \ + AV_CODEC_CAP_HARDWARE | \ + AV_CODEC_CAP_ENCODER_FLUSH, \ + .priv_data_size = sizeof(MediaCodecEncContext), \ + CODEC_PIXFMTS_ARRAY(avc_pix_fmts), \ + .color_ranges = AVCOL_RANGE_MPEG | AVCOL_RANGE_JPEG, \ + .defaults = mediacodec_defaults, \ + .init = mediacodec_init, \ + FF_CODEC_RECEIVE_PACKET_CB(mediacodec_encode), \ + .close = mediacodec_close, \ + .flush = mediacodec_flush, \ + .p.priv_class = &short_name ## _mediacodec_class, \ + .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, \ + .p.wrapper_name = "mediacodec", \ + .hw_configs = mediacodec_hw_configs, \ +}; \ + +#if CONFIG_H264_MEDIACODEC_ENCODER + +enum MediaCodecAvcLevel { + AVCLevel1 = 0x01, + AVCLevel1b = 0x02, + AVCLevel11 = 0x04, + AVCLevel12 = 0x08, + AVCLevel13 = 0x10, + AVCLevel2 = 0x20, + AVCLevel21 = 0x40, + AVCLevel22 = 0x80, + AVCLevel3 = 0x100, + AVCLevel31 = 0x200, + AVCLevel32 = 0x400, + AVCLevel4 = 0x800, + AVCLevel41 = 0x1000, + AVCLevel42 = 0x2000, + AVCLevel5 = 0x4000, + AVCLevel51 = 0x8000, + AVCLevel52 = 0x10000, + AVCLevel6 = 0x20000, + AVCLevel61 = 0x40000, + AVCLevel62 = 0x80000, +}; + +static const AVOption h264_options[] = { + COMMON_OPTION + + FF_AVCTX_PROFILE_OPTION("baseline", NULL, VIDEO, AV_PROFILE_H264_BASELINE) + FF_AVCTX_PROFILE_OPTION("constrained_baseline", NULL, VIDEO, AV_PROFILE_H264_CONSTRAINED_BASELINE) + FF_AVCTX_PROFILE_OPTION("main", NULL, VIDEO, AV_PROFILE_H264_MAIN) + FF_AVCTX_PROFILE_OPTION("extended", NULL, VIDEO, AV_PROFILE_H264_EXTENDED) + FF_AVCTX_PROFILE_OPTION("high", NULL, VIDEO, AV_PROFILE_H264_HIGH) + FF_AVCTX_PROFILE_OPTION("high10", NULL, VIDEO, AV_PROFILE_H264_HIGH_10) + FF_AVCTX_PROFILE_OPTION("high422", NULL, VIDEO, AV_PROFILE_H264_HIGH_422) + FF_AVCTX_PROFILE_OPTION("high444", NULL, VIDEO, AV_PROFILE_H264_HIGH_444) + + { "level", "Specify level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel1 }, 0, 0, VE, .unit = "level" }, + { "1b", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel1b }, 0, 0, VE, .unit = "level" }, + { "1.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel11 }, 0, 0, VE, .unit = "level" }, + { "1.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel12 }, 0, 0, VE, .unit = "level" }, + { "1.3", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel13 }, 0, 0, VE, .unit = "level" }, + { "2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel2 }, 0, 0, VE, .unit = "level" }, + { "2.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel21 }, 0, 0, VE, .unit = "level" }, + { "2.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel22 }, 0, 0, VE, .unit = "level" }, + { "3", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel3 }, 0, 0, VE, .unit = "level" }, + { "3.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel31 }, 0, 0, VE, .unit = "level" }, + { "3.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel32 }, 0, 0, VE, .unit = "level" }, + { "4", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel4 }, 0, 0, VE, .unit = "level" }, + { "4.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel41 }, 0, 0, VE, .unit = "level" }, + { "4.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel42 }, 0, 0, VE, .unit = "level" }, + { "5", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel5 }, 0, 0, VE, .unit = "level" }, + { "5.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel51 }, 0, 0, VE, .unit = "level" }, + { "5.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel52 }, 0, 0, VE, .unit = "level" }, + { "6.0", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel6 }, 0, 0, VE, .unit = "level" }, + { "6.1", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel61 }, 0, 0, VE, .unit = "level" }, + { "6.2", "", 0, AV_OPT_TYPE_CONST, { .i64 = AVCLevel62 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(h264, "H.264", AV_CODEC_ID_H264) + +#endif // CONFIG_H264_MEDIACODEC_ENCODER + +#if CONFIG_HEVC_MEDIACODEC_ENCODER + +enum MediaCodecHevcLevel { + HEVCMainTierLevel1 = 0x1, + HEVCHighTierLevel1 = 0x2, + HEVCMainTierLevel2 = 0x4, + HEVCHighTierLevel2 = 0x8, + HEVCMainTierLevel21 = 0x10, + HEVCHighTierLevel21 = 0x20, + HEVCMainTierLevel3 = 0x40, + HEVCHighTierLevel3 = 0x80, + HEVCMainTierLevel31 = 0x100, + HEVCHighTierLevel31 = 0x200, + HEVCMainTierLevel4 = 0x400, + HEVCHighTierLevel4 = 0x800, + HEVCMainTierLevel41 = 0x1000, + HEVCHighTierLevel41 = 0x2000, + HEVCMainTierLevel5 = 0x4000, + HEVCHighTierLevel5 = 0x8000, + HEVCMainTierLevel51 = 0x10000, + HEVCHighTierLevel51 = 0x20000, + HEVCMainTierLevel52 = 0x40000, + HEVCHighTierLevel52 = 0x80000, + HEVCMainTierLevel6 = 0x100000, + HEVCHighTierLevel6 = 0x200000, + HEVCMainTierLevel61 = 0x400000, + HEVCHighTierLevel61 = 0x800000, + HEVCMainTierLevel62 = 0x1000000, + HEVCHighTierLevel62 = 0x2000000, +}; + +static const AVOption hevc_options[] = { + COMMON_OPTION + + FF_AVCTX_PROFILE_OPTION("main", NULL, VIDEO, AV_PROFILE_HEVC_MAIN) + FF_AVCTX_PROFILE_OPTION("main10", NULL, VIDEO, AV_PROFILE_HEVC_MAIN_10) + + { "level", "Specify tier and level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "m1", "Main tier level 1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel1 }, 0, 0, VE, .unit = "level" }, + { "h1", "High tier level 1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel1 }, 0, 0, VE, .unit = "level" }, + { "m2", "Main tier level 2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel2 }, 0, 0, VE, .unit = "level" }, + { "h2", "High tier level 2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel2 }, 0, 0, VE, .unit = "level" }, + { "m2.1", "Main tier level 2.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel21 }, 0, 0, VE, .unit = "level" }, + { "h2.1", "High tier level 2.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel21 }, 0, 0, VE, .unit = "level" }, + { "m3", "Main tier level 3", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel3 }, 0, 0, VE, .unit = "level" }, + { "h3", "High tier level 3", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel3 }, 0, 0, VE, .unit = "level" }, + { "m3.1", "Main tier level 3.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel31 }, 0, 0, VE, .unit = "level" }, + { "h3.1", "High tier level 3.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel31 }, 0, 0, VE, .unit = "level" }, + { "m4", "Main tier level 4", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel4 }, 0, 0, VE, .unit = "level" }, + { "h4", "High tier level 4", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel4 }, 0, 0, VE, .unit = "level" }, + { "m4.1", "Main tier level 4.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel41 }, 0, 0, VE, .unit = "level" }, + { "h4.1", "High tier level 4.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel41 }, 0, 0, VE, .unit = "level" }, + { "m5", "Main tier level 5", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel5 }, 0, 0, VE, .unit = "level" }, + { "h5", "High tier level 5", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel5 }, 0, 0, VE, .unit = "level" }, + { "m5.1", "Main tier level 5.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel51 }, 0, 0, VE, .unit = "level" }, + { "h5.1", "High tier level 5.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel51 }, 0, 0, VE, .unit = "level" }, + { "m5.2", "Main tier level 5.2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel52 }, 0, 0, VE, .unit = "level" }, + { "h5.2", "High tier level 5.2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel52 }, 0, 0, VE, .unit = "level" }, + { "m6", "Main tier level 6", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel6 }, 0, 0, VE, .unit = "level" }, + { "h6", "High tier level 6", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel6 }, 0, 0, VE, .unit = "level" }, + { "m6.1", "Main tier level 6.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel61 }, 0, 0, VE, .unit = "level" }, + { "h6.1", "High tier level 6.1", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel61 }, 0, 0, VE, .unit = "level" }, + { "m6.2", "Main tier level 6.2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCMainTierLevel62 }, 0, 0, VE, .unit = "level" }, + { "h6.2", "High tier level 6.2", + 0, AV_OPT_TYPE_CONST, { .i64 = HEVCHighTierLevel62 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(hevc, "H.265", AV_CODEC_ID_HEVC) + +#endif // CONFIG_HEVC_MEDIACODEC_ENCODER + +#if CONFIG_VP8_MEDIACODEC_ENCODER + +enum MediaCodecVP8Level { + VP8Level_Version0 = 0x01, + VP8Level_Version1 = 0x02, + VP8Level_Version2 = 0x04, + VP8Level_Version3 = 0x08, +}; + +static const AVOption vp8_options[] = { + COMMON_OPTION + { "level", "Specify tier and level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "V0", "Level Version 0", + 0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version0 }, 0, 0, VE, .unit = "level" }, + { "V1", "Level Version 1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version1 }, 0, 0, VE, .unit = "level" }, + { "V2", "Level Version 2", + 0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version2 }, 0, 0, VE, .unit = "level" }, + { "V3", "Level Version 3", + 0, AV_OPT_TYPE_CONST, { .i64 = VP8Level_Version3 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(vp8, "VP8", AV_CODEC_ID_VP8) + +#endif // CONFIG_VP8_MEDIACODEC_ENCODER + +#if CONFIG_VP9_MEDIACODEC_ENCODER + +enum MediaCodecVP9Level { + VP9Level1 = 0x1, + VP9Level11 = 0x2, + VP9Level2 = 0x4, + VP9Level21 = 0x8, + VP9Level3 = 0x10, + VP9Level31 = 0x20, + VP9Level4 = 0x40, + VP9Level41 = 0x80, + VP9Level5 = 0x100, + VP9Level51 = 0x200, + VP9Level52 = 0x400, + VP9Level6 = 0x800, + VP9Level61 = 0x1000, + VP9Level62 = 0x2000, +}; + +static const AVOption vp9_options[] = { + COMMON_OPTION + + FF_AVCTX_PROFILE_OPTION("profile0", NULL, VIDEO, AV_PROFILE_VP9_0) + FF_AVCTX_PROFILE_OPTION("profile1", NULL, VIDEO, AV_PROFILE_VP9_1) + FF_AVCTX_PROFILE_OPTION("profile2", NULL, VIDEO, AV_PROFILE_VP9_2) + FF_AVCTX_PROFILE_OPTION("profile3", NULL, VIDEO, AV_PROFILE_VP9_3) + + { "level", "Specify tier and level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "1", "Level 1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level1 }, 0, 0, VE, .unit = "level" }, + { "1.1", "Level 1.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level11 }, 0, 0, VE, .unit = "level" }, + { "2", "Level 2", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level2 }, 0, 0, VE, .unit = "level" }, + { "2.1", "Level 2.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level21 }, 0, 0, VE, .unit = "level" }, + { "3", "Level 3", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level3 }, 0, 0, VE, .unit = "level" }, + { "3.1", "Level 3.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level31 }, 0, 0, VE, .unit = "level" }, + { "4", "Level 4", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level4 }, 0, 0, VE, .unit = "level" }, + { "4.1", "Level 4.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level41 }, 0, 0, VE, .unit = "level" }, + { "5", "Level 5", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level5 }, 0, 0, VE, .unit = "level" }, + { "5.1", "Level 5.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level51 }, 0, 0, VE, .unit = "level" }, + { "5.2", "Level 5.2", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level52 }, 0, 0, VE, .unit = "level" }, + { "6", "Level 6", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level6 }, 0, 0, VE, .unit = "level" }, + { "6.1", "Level 6.1", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level61 }, 0, 0, VE, .unit = "level" }, + { "6.2", "Level 6.2", + 0, AV_OPT_TYPE_CONST, { .i64 = VP9Level62 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(vp9, "VP9", AV_CODEC_ID_VP9) + +#endif // CONFIG_VP9_MEDIACODEC_ENCODER + +#if CONFIG_MPEG4_MEDIACODEC_ENCODER + +enum MediaCodecMpeg4Level { + MPEG4Level0 = 0x01, + MPEG4Level0b = 0x02, + MPEG4Level1 = 0x04, + MPEG4Level2 = 0x08, + MPEG4Level3 = 0x10, + MPEG4Level3b = 0x18, + MPEG4Level4 = 0x20, + MPEG4Level4a = 0x40, + MPEG4Level5 = 0x80, + MPEG4Level6 = 0x100, +}; + +static const AVOption mpeg4_options[] = { + COMMON_OPTION + + FF_MPEG4_PROFILE_OPTS + + { "level", "Specify tier and level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "0", "Level 0", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level0 }, 0, 0, VE, .unit = "level" }, + { "0b", "Level 0b", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level0b }, 0, 0, VE, .unit = "level" }, + { "1", "Level 1", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level1 }, 0, 0, VE, .unit = "level" }, + { "2", "Level 2", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level2 }, 0, 0, VE, .unit = "level" }, + { "3", "Level 3", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level3 }, 0, 0, VE, .unit = "level" }, + { "3b", "Level 3b", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level3b }, 0, 0, VE, .unit = "level" }, + { "4", "Level 4", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level4 }, 0, 0, VE, .unit = "level" }, + { "4a", "Level 4a", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level4a }, 0, 0, VE, .unit = "level" }, + { "5", "Level 5", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level5 }, 0, 0, VE, .unit = "level" }, + { "6", "Level 6", + 0, AV_OPT_TYPE_CONST, { .i64 = MPEG4Level6 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(mpeg4, "MPEG-4", AV_CODEC_ID_MPEG4) + +#endif // CONFIG_MPEG4_MEDIACODEC_ENCODER + +#if CONFIG_AV1_MEDIACODEC_ENCODER + +enum MediaCodecAV1Level { + AV1Level2 = 0x1, + AV1Level21 = 0x2, + AV1Level22 = 0x4, + AV1Level23 = 0x8, + AV1Level3 = 0x10, + AV1Level31 = 0x20, + AV1Level32 = 0x40, + AV1Level33 = 0x80, + AV1Level4 = 0x100, + AV1Level41 = 0x200, + AV1Level42 = 0x400, + AV1Level43 = 0x800, + AV1Level5 = 0x1000, + AV1Level51 = 0x2000, + AV1Level52 = 0x4000, + AV1Level53 = 0x8000, + AV1Level6 = 0x10000, + AV1Level61 = 0x20000, + AV1Level62 = 0x40000, + AV1Level63 = 0x80000, + AV1Level7 = 0x100000, + AV1Level71 = 0x200000, + AV1Level72 = 0x400000, + AV1Level73 = 0x800000, +}; + +static const AVOption av1_options[] = { + COMMON_OPTION + + FF_AV1_PROFILE_OPTS + + { "level", "Specify tier and level", + OFFSET(level), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, VE, .unit = "level" }, + { "2", "Level 2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level2 }, 0, 0, VE, .unit = "level" }, + { "2.1", "Level 2.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level21 }, 0, 0, VE, .unit = "level" }, + { "2.2", "Level 2.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level22 }, 0, 0, VE, .unit = "level" }, + { "2.3", "Level 2.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level23 }, 0, 0, VE, .unit = "level" }, + { "3", "Level 3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level3 }, 0, 0, VE, .unit = "level" }, + { "3.1", "Level 3.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level31 }, 0, 0, VE, .unit = "level" }, + { "3.2", "Level 3.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level32 }, 0, 0, VE, .unit = "level" }, + { "3.3", "Level 3.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level33 }, 0, 0, VE, .unit = "level" }, + { "4", "Level 4", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level4 }, 0, 0, VE, .unit = "level" }, + { "4.1", "Level 4.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level41 }, 0, 0, VE, .unit = "level" }, + { "4.2", "Level 4.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level42 }, 0, 0, VE, .unit = "level" }, + { "4.3", "Level 4.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level43 }, 0, 0, VE, .unit = "level" }, + { "5", "Level 5", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level5 }, 0, 0, VE, .unit = "level" }, + { "5.1", "Level 5.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level51 }, 0, 0, VE, .unit = "level" }, + { "5.2", "Level 5.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level52 }, 0, 0, VE, .unit = "level" }, + { "5.3", "Level 5.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level53 }, 0, 0, VE, .unit = "level" }, + { "6", "Level 6", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level6 }, 0, 0, VE, .unit = "level" }, + { "6.1", "Level 6.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level61 }, 0, 0, VE, .unit = "level" }, + { "6.2", "Level 6.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level62 }, 0, 0, VE, .unit = "level" }, + { "6.3", "Level 6.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level63 }, 0, 0, VE, .unit = "level" }, + { "7", "Level 7", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level7 }, 0, 0, VE, .unit = "level" }, + { "7.1", "Level 7.1", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level71 }, 0, 0, VE, .unit = "level" }, + { "7.2", "Level 7.2", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level72 }, 0, 0, VE, .unit = "level" }, + { "7.3", "Level 7.3", + 0, AV_OPT_TYPE_CONST, { .i64 = AV1Level73 }, 0, 0, VE, .unit = "level" }, + { NULL, } +}; + +DECLARE_MEDIACODEC_ENCODER(av1, "AV1", AV_CODEC_ID_AV1) + +#endif // CONFIG_AV1_MEDIACODEC_ENCODER diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/motion_est.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/motion_est.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/motion_est.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/motion_est.h 2026-04-29 18:38:26.000000000 +0000 @@ -28,7 +28,8 @@ #include "me_cmp.h" #include "qpeldsp.h" -struct MpegEncContext; +typedef struct MPVEncContext MPVEncContext; +typedef struct MPVMainEncContext MPVMainEncContext; #if ARCH_IA64 // Limit static arrays to avoid gcc failing "short data segment overflowed" #define MAX_MV 1024 @@ -47,14 +48,13 @@ */ typedef struct MotionEstContext { AVCodecContext *avctx; + int motion_est; ///< ME algorithm int skip; ///< set if ME is skipped for the current MB int co_located_mv[4][2]; ///< mv from last P-frame for direct mode ME int direct_basis_mv[4][2]; uint8_t *scratchpad; /**< data area for the ME algo, so that * the ME does not need to malloc/free. */ uint8_t *temp; - uint32_t *map; ///< map to avoid duplicate evaluations - uint32_t *score_map; ///< map to store the scores unsigned map_generation; int pre_penalty_factor; int penalty_factor; /**< an estimate of the bits required to @@ -69,6 +69,7 @@ int mb_flags; int pre_pass; ///< = 1 for the pre pass int dia_size; + int unrestricted_mv; ///< mv can point outside of the coded picture int xmin; int xmax; int ymin; @@ -98,21 +99,14 @@ qpel_mc_func(*qpel_avg)[16]; const uint8_t (*mv_penalty)[MAX_DMV * 2 + 1]; ///< bit amount needed to encode a MV const uint8_t *current_mv_penalty; - int (*sub_motion_search)(struct MpegEncContext *s, + int (*sub_motion_search)(MPVEncContext *s, int *mx_ptr, int *my_ptr, int dmin, int src_index, int ref_index, int size, int h); -} MotionEstContext; -static inline int ff_h263_round_chroma(int x) -{ - //FIXME static or not? - static const uint8_t h263_chroma_roundtab[16] = { - // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 - 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, - }; - return h263_chroma_roundtab[x & 0xf] + (x >> 3); -} + uint32_t map[ME_MAP_SIZE]; ///< map to avoid duplicate evaluations + uint32_t score_map[ME_MAP_SIZE];///< map to store the scores +} MotionEstContext; /** * Performs one-time initialization of the MotionEstContext. @@ -120,27 +114,27 @@ int ff_me_init(MotionEstContext *c, struct AVCodecContext *avctx, const struct MECmpContext *mecc, int mpvenc); -void ff_me_init_pic(struct MpegEncContext *s); +void ff_me_init_pic(MPVEncContext *s); -void ff_estimate_p_frame_motion(struct MpegEncContext *s, int mb_x, int mb_y); -void ff_estimate_b_frame_motion(struct MpegEncContext *s, int mb_x, int mb_y); +void ff_estimate_p_frame_motion(MPVEncContext *s, int mb_x, int mb_y); +void ff_estimate_b_frame_motion(MPVEncContext *s, int mb_x, int mb_y); -int ff_pre_estimate_p_frame_motion(struct MpegEncContext *s, +int ff_pre_estimate_p_frame_motion(MPVEncContext *s, int mb_x, int mb_y); -int ff_epzs_motion_search(struct MpegEncContext *s, int *mx_ptr, int *my_ptr, +int ff_epzs_motion_search(MPVEncContext *s, int *mx_ptr, int *my_ptr, int P[10][2], int src_index, int ref_index, const int16_t (*last_mv)[2], int ref_mv_scale, int size, int h); -int ff_get_mb_score(struct MpegEncContext *s, int mx, int my, int src_index, +int ff_get_mb_score(MPVEncContext *s, int mx, int my, int src_index, int ref_index, int size, int h, int add_rate); -int ff_get_best_fcode(struct MpegEncContext *s, +int ff_get_best_fcode(MPVMainEncContext *m, const int16_t (*mv_table)[2], int type); -void ff_fix_long_p_mvs(struct MpegEncContext *s, int type); -void ff_fix_long_mvs(struct MpegEncContext *s, uint8_t *field_select_table, +void ff_fix_long_p_mvs(MPVEncContext *s, int type); +void ff_fix_long_mvs(MPVEncContext *s, uint8_t *field_select_table, int field_select, int16_t (*mv_table)[2], int f_code, int type, int truncate); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/moz.build thunderbird-140.10.1esr/media/ffvpx/libavcodec/moz.build --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/moz.build 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/moz.build 2026-04-29 18:38:26.000000000 +0000 @@ -21,6 +21,8 @@ SharedLibrary('mozavcodec') SOURCES += [ + 'adts_header.c', + 'adts_parser.c', 'allcodecs.c', 'audio_frame_queue.c', 'avcodec.c', @@ -52,6 +54,8 @@ 'libvorbisdec.c', 'libvorbisenc.c', 'log2_tab.c', + 'mpeg4audio.c', + 'mpeg4audio_sample_rates.c', 'mpegaudio.c', 'mpegaudiodata.c', 'mpegaudiodec_common.c', @@ -89,6 +93,7 @@ 'av1dec.c', 'cbs.c', 'cbs_av1.c', + 'cbs_vp9.c', 'golomb.c', 'h264pred.c', 'imgconvert.c', @@ -142,6 +147,18 @@ USE_LIBS += [ 'mozva' ] + elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + SOURCES += [ + 'fffjni.c', + 'ffjni.c', + 'mediacodec.c', + 'mediacodec_surface.c', + 'mediacodec_sw_buffer.c', + 'mediacodec_wrapper.c', + 'mediacodecdec.c', + 'mediacodecdec_common.c', + 'mediacodecenc.c', + ] elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": SOURCES += [ 'd3d11va.c', @@ -150,6 +167,11 @@ 'dxva2_vp9.c', ] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + EXPORTS.ffvpx += [ + "mediacodec.h" + ] + LOCAL_INCLUDES += [ '/media/libopus/include', '/media/libvorbis', @@ -172,4 +194,7 @@ if CONFIG['OS_TARGET'] != 'WINNT': OS_LIBS += ['m'] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + OS_LIBS += ['android', 'mediandk'] + include("../ffvpxcommon.mozbuild") diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,179 @@ +/* + * MPEG-4 Audio common code + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * 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 "get_bits.h" +#include "mpeg4audio.h" + +/** + * Parse MPEG-4 audio configuration for ALS object type. + * @param[in] gb bit reader context + * @param[in] c MPEG4AudioConfig structure to fill + * @return on success 0 is returned, otherwise a value < 0 + */ +static int parse_config_ALS(GetBitContext *gb, MPEG4AudioConfig *c, void *logctx) +{ + if (get_bits_left(gb) < 112) + return AVERROR_INVALIDDATA; + + if (get_bits_long(gb, 32) != MKBETAG('A','L','S','\0')) + return AVERROR_INVALIDDATA; + + // override AudioSpecificConfig channel configuration and sample rate + // which are buggy in old ALS conformance files + c->sample_rate = get_bits_long(gb, 32); + + if (c->sample_rate <= 0) { + av_log(logctx, AV_LOG_ERROR, "Invalid sample rate %d\n", c->sample_rate); + return AVERROR_INVALIDDATA; + } + + // skip number of samples + skip_bits_long(gb, 32); + + // read number of channels + c->chan_config = 0; + c->channels = get_bits(gb, 16) + 1; + + return 0; +} + +const uint8_t ff_mpeg4audio_channels[15] = { + 0, + 1, // mono (1/0) + 2, // stereo (2/0) + 3, // 3/0 + 4, // 3/1 + 5, // 3/2 + 6, // 3/2.1 + 8, // 5/2.1 + 0, + 0, + 0, + 7, // 3/3.1 + 8, // 3/2/2.1 + 24, // 3/3/3 - 5/2/3 - 3/0/0.2 + 8, // 3/2.1 - 2/0 +}; + +static inline int get_object_type(GetBitContext *gb) +{ + int object_type = get_bits(gb, 5); + if (object_type == AOT_ESCAPE) + object_type = 32 + get_bits(gb, 6); + return object_type; +} + +static inline int get_sample_rate(GetBitContext *gb, int *index) +{ + *index = get_bits(gb, 4); + return *index == 0x0f ? get_bits(gb, 24) : + ff_mpeg4audio_sample_rates[*index]; +} + +int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, + int sync_extension, void *logctx) +{ + int specific_config_bitindex, ret; + int start_bit_index = get_bits_count(gb); + c->object_type = get_object_type(gb); + c->sample_rate = get_sample_rate(gb, &c->sampling_index); + c->chan_config = get_bits(gb, 4); + if (c->chan_config < FF_ARRAY_ELEMS(ff_mpeg4audio_channels)) + c->channels = ff_mpeg4audio_channels[c->chan_config]; + else { + av_log(logctx, AV_LOG_ERROR, "Invalid chan_config %d\n", c->chan_config); + return AVERROR_INVALIDDATA; + } + c->sbr = -1; + c->ps = -1; + if (c->object_type == AOT_SBR || (c->object_type == AOT_PS && + // check for W6132 Annex YYYY draft MP3onMP4 + !(show_bits(gb, 3) & 0x03 && !(show_bits(gb, 9) & 0x3F)))) { + if (c->object_type == AOT_PS) + c->ps = 1; + c->ext_object_type = AOT_SBR; + c->sbr = 1; + c->ext_sample_rate = get_sample_rate(gb, &c->ext_sampling_index); + c->object_type = get_object_type(gb); + if (c->object_type == AOT_ER_BSAC) + c->ext_chan_config = get_bits(gb, 4); + } else { + c->ext_object_type = AOT_NULL; + c->ext_sample_rate = 0; + } + specific_config_bitindex = get_bits_count(gb); + + if (c->object_type == AOT_ALS) { + skip_bits(gb, 5); + if (show_bits(gb, 24) != MKBETAG('\0','A','L','S')) + skip_bits(gb, 24); + + specific_config_bitindex = get_bits_count(gb); + + ret = parse_config_ALS(gb, c, logctx); + if (ret < 0) + return ret; + } + + if (c->ext_object_type != AOT_SBR && sync_extension) { + while (get_bits_left(gb) > 15) { + if (show_bits(gb, 11) == 0x2b7) { // sync extension + get_bits(gb, 11); + c->ext_object_type = get_object_type(gb); + if (c->ext_object_type == AOT_SBR && (c->sbr = get_bits1(gb)) == 1) { + c->ext_sample_rate = get_sample_rate(gb, &c->ext_sampling_index); + if (c->ext_sample_rate == c->sample_rate) + c->sbr = -1; + } + if (get_bits_left(gb) > 11 && get_bits(gb, 11) == 0x548) + c->ps = get_bits1(gb); + break; + } else + get_bits1(gb); // skip 1 bit + } + } + + //PS requires SBR + if (!c->sbr) + c->ps = 0; + //Limit implicit PS to the HE-AACv2 Profile + if ((c->ps == -1 && c->object_type != AOT_AAC_LC) || c->channels & ~0x01) + c->ps = 0; + + return specific_config_bitindex - start_bit_index; +} + +int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, + int size, int sync_extension, void *logctx) +{ + GetBitContext gb; + int ret; + + if (size <= 0) + return AVERROR_INVALIDDATA; + + ret = init_get_bits8(&gb, buf, size); + if (ret < 0) + return ret; + + return ff_mpeg4audio_get_config_gb(c, &gb, sync_extension, logctx); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,121 @@ +/* + * MPEG-4 Audio common header + * Copyright (c) 2008 Baptiste Coudurier + * + * 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 + */ + +#ifndef AVCODEC_MPEG4AUDIO_H +#define AVCODEC_MPEG4AUDIO_H + +#include + +#include "get_bits.h" + +typedef struct MPEG4AudioConfig { + int object_type; + int sampling_index; + int sample_rate; + int chan_config; + int sbr; ///< -1 implicit, 1 presence + int ext_object_type; + int ext_sampling_index; + int ext_sample_rate; + int ext_chan_config; + int channels; + int ps; ///< -1 implicit, 1 presence + int frame_length_short; +} MPEG4AudioConfig; + +extern const int ff_mpeg4audio_sample_rates[16]; +extern const uint8_t ff_mpeg4audio_channels[15]; + +/** + * Parse MPEG-4 systems extradata from a potentially unaligned GetBitContext to retrieve audio configuration. + * @param[in] c MPEG4AudioConfig structure to fill. + * @param[in] gb Extradata from container. + * @param[in] sync_extension look for a sync extension after config if true. + * @param[in] logctx opaque struct starting with an AVClass element, used for logging. + * @return negative AVERROR code on error, on success AudioSpecificConfig bit index in extradata. + */ +int ff_mpeg4audio_get_config_gb(MPEG4AudioConfig *c, GetBitContext *gb, + int sync_extension, void *logctx); + +/** + * Parse MPEG-4 systems extradata from a raw buffer to retrieve audio configuration. + * @param[in] c MPEG4AudioConfig structure to fill. + * @param[in] buf Extradata from container. + * @param[in] size Extradata size in bytes. + * @param[in] sync_extension look for a sync extension after config if true. + * @param[in] logctx opaque struct starting with an AVClass element, used for logging. + * @return negative AVERROR code on error, AudioSpecificConfig bit index in extradata on success. + */ +int avpriv_mpeg4audio_get_config2(MPEG4AudioConfig *c, const uint8_t *buf, + int size, int sync_extension, void *logctx); + +enum AudioObjectType { + AOT_NULL = 0, + // Support? Name + AOT_AAC_MAIN = 1, ///< Y Main + AOT_AAC_LC = 2, ///< Y Low Complexity + AOT_AAC_SSR = 3, ///< N (code in SoC repo) Scalable Sample Rate + AOT_AAC_LTP = 4, ///< Y Long Term Prediction + AOT_SBR = 5, ///< Y Spectral Band Replication + AOT_AAC_SCALABLE = 6, ///< N Scalable + AOT_TWINVQ = 7, ///< N Twin Vector Quantizer + AOT_CELP = 8, ///< N Code Excited Linear Prediction + AOT_HVXC = 9, ///< N Harmonic Vector eXcitation Coding + + AOT_TTSI = 12, ///< N Text-To-Speech Interface + AOT_MAINSYNTH = 13, ///< N Main Synthesis + AOT_WAVESYNTH = 14, ///< N Wavetable Synthesis + AOT_MIDI = 15, ///< N General MIDI + AOT_SAFX = 16, ///< N Algorithmic Synthesis and Audio Effects + AOT_ER_AAC_LC = 17, ///< N Error Resilient Low Complexity + + AOT_ER_AAC_LTP = 19, ///< N Error Resilient Long Term Prediction + AOT_ER_AAC_SCALABLE = 20, ///< N Error Resilient Scalable + AOT_ER_TWINVQ = 21, ///< N Error Resilient Twin Vector Quantizer + AOT_ER_BSAC = 22, ///< N Error Resilient Bit-Sliced Arithmetic Coding + AOT_ER_AAC_LD = 23, ///< N Error Resilient Low Delay + AOT_ER_CELP = 24, ///< N Error Resilient Code Excited Linear Prediction + AOT_ER_HVXC = 25, ///< N Error Resilient Harmonic Vector eXcitation Coding + AOT_ER_HILN = 26, ///< N Error Resilient Harmonic and Individual Lines plus Noise + AOT_ER_PARAM = 27, ///< N Error Resilient Parametric + AOT_SSC = 28, ///< N SinuSoidal Coding + AOT_PS = 29, ///< N Parametric Stereo + AOT_SURROUND = 30, ///< N MPEG Surround + AOT_ESCAPE = 31, ///< Y Escape Value + AOT_L1 = 32, ///< Y Layer 1 + AOT_L2 = 33, ///< Y Layer 2 + AOT_L3 = 34, ///< Y Layer 3 + AOT_DST = 35, ///< N Direct Stream Transfer + AOT_ALS = 36, ///< Y Audio LosslesS + AOT_SLS = 37, ///< N Scalable LosslesS + AOT_SLS_NON_CORE = 38, ///< N Scalable LosslesS (non core) + AOT_ER_AAC_ELD = 39, ///< N Error Resilient Enhanced Low Delay + AOT_SMR_SIMPLE = 40, ///< N Symbolic Music Representation Simple + AOT_SMR_MAIN = 41, ///< N Symbolic Music Representation Main + AOT_USAC = 42, ///< Y Unified Speech and Audio Coding + AOT_SAOC = 43, ///< N Spatial Audio Object Coding + AOT_LD_SURROUND = 44, ///< N Low Delay MPEG Surround +}; + +#define MAX_PCE_SIZE 320 /// 16; bits -= 16) + ff_pce_copy_bits(pb, gb, 16); + if (bits) + ff_pce_copy_bits(pb, gb, bits); + align_put_bits(pb); + align_get_bits(gb); + comment_size = ff_pce_copy_bits(pb, gb, 8); + for (; comment_size > 0; comment_size--) + ff_pce_copy_bits(pb, gb, 8); + + return put_bits_count(pb) - offset; +} + +#endif /* AVCODEC_MPEG4AUDIO_COPY_PCE_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,23 @@ +/* + * MPEG-4 Audio sample rates + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * 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 "mpeg4audio_sample_rates.h" diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpeg4audio_sample_rates.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,34 @@ +/* + * MPEG-4 Audio sample rates + * Copyright (c) 2008 Baptiste Coudurier + * Copyright (c) 2009 Alex Converse + * + * 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 + */ + +#ifndef AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H +#define AVCODEC_MPEG4AUDIO_SAMPLE_RATES_H + +// This table contains only 13 real elements and is padded with zeroes. +// It is used by the AAC encoder as sample rate table, so the encoder +// needs to actually support all of these rates and it needs to have +// a trailing zero. +const int ff_mpeg4audio_sample_rates[16] = { + 96000, 88200, 64000, 48000, 44100, 32000, + 24000, 22050, 16000, 12000, 11025, 8000, 7350 +}; +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodec_fixed.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_fixed.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodec_fixed.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_fixed.c 2026-04-29 18:38:26.000000000 +0000 @@ -72,9 +72,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .flush = flush, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16), }; #endif #if CONFIG_MP2_DECODER @@ -89,9 +87,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .flush = flush, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16), }; #endif #if CONFIG_MP3_DECODER @@ -106,9 +102,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .flush = flush, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16), }; #endif #if CONFIG_MP3ADU_DECODER @@ -123,9 +117,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .flush = flush, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_S16, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P, AV_SAMPLE_FMT_S16), }; #endif #if CONFIG_MP3ON4_DECODER @@ -141,8 +133,7 @@ .p.capabilities = AV_CODEC_CAP_CHANNEL_CONF | AV_CODEC_CAP_DR1, .flush = flush_mp3on4, - .p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16P, - AV_SAMPLE_FMT_NONE }, + CODEC_SAMPLEFMTS(AV_SAMPLE_FMT_S16P), .caps_internal = FF_CODEC_CAP_INIT_CLEANUP, }; #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodec_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodec_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodec_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -280,10 +280,9 @@ ff_mpegaudiodec_common_init_static(); } -static av_cold int decode_init(AVCodecContext * avctx) +static av_cold int decode_ctx_init(AVCodecContext *avctx, MPADecodeContext *s) { static AVOnce init_static_once = AV_ONCE_INIT; - MPADecodeContext *s = avctx->priv_data; s->avctx = avctx; @@ -315,6 +314,11 @@ return 0; } +static av_cold int decode_init(AVCodecContext *avctx) +{ + return decode_ctx_init(avctx, avctx->priv_data); +} + #define C3 FIXHR(0.86602540378443864676/2) #define C4 FIXHR(0.70710678118654752439/2) //0.5 / cos(pi*(9)/36) #define C5 FIXHR(0.51763809020504152469/2) //0.5 / cos(pi*(5)/36) @@ -381,7 +385,7 @@ crc_val = av_crc(crc_tab, crc_val, tmp_buf, 3); if (crc_val) { - av_log(s->avctx, AV_LOG_ERROR, "CRC mismatch %X!\n", crc_val); + av_log(s->avctx, AV_LOG_ERROR, "CRC mismatch %"PRIX32"!\n", crc_val); if (s->err_recognition & AV_EF_EXPLODE) return AVERROR_INVALIDDATA; } @@ -1604,7 +1608,8 @@ if (ret >= 0) { s->frame->nb_samples = avctx->frame_size; *got_frame_ptr = 1; - avctx->sample_rate = s->sample_rate; + if (avctx->codec_id != AV_CODEC_ID_AHX) + avctx->sample_rate = s->sample_rate; //FIXME maybe move the other codec info stuff from above here too } else { av_log(avctx, AV_LOG_ERROR, "Error while decoding MPEG audio frame.\n"); @@ -1621,7 +1626,7 @@ return buf_size + skipped; } -static void mp_flush(MPADecodeContext *ctx) +static av_cold void mp_flush(MPADecodeContext *ctx) { memset(ctx->synth_buf, 0, sizeof(ctx->synth_buf)); memset(ctx->mdct_buf, 0, sizeof(ctx->mdct_buf)); @@ -1629,7 +1634,7 @@ ctx->dither_state = 0; } -static void flush(AVCodecContext *avctx) +static av_cold void flush(AVCodecContext *avctx) { mp_flush(avctx->priv_data); } @@ -1734,10 +1739,8 @@ static av_cold int decode_close_mp3on4(AVCodecContext * avctx) { MP3On4DecodeContext *s = avctx->priv_data; - int i; - for (i = 0; i < s->frames; i++) - av_freep(&s->mp3decctx[i]); + av_freep(&s->mp3decctx[0]); return 0; } @@ -1770,20 +1773,14 @@ else s->syncword = 0xfff00000; - /* Init the first mp3 decoder in standard way, so that all tables get builded - * We replace avctx->priv_data with the context of the first decoder so that - * decode_init() does not have to be changed. + /* Init the first mp3 decoder in standard way, so that all tables get built * Other decoders will be initialized here copying data from the first context */ - // Allocate zeroed memory for the first decoder context - s->mp3decctx[0] = av_mallocz(sizeof(MPADecodeContext)); + // Allocate zeroed memory for the decoder contexts + s->mp3decctx[0] = av_calloc(s->frames, sizeof(*s->mp3decctx[0])); if (!s->mp3decctx[0]) return AVERROR(ENOMEM); - // Put decoder context in place to make init_decode() happy - avctx->priv_data = s->mp3decctx[0]; - ret = decode_init(avctx); - // Restore mp3on4 context pointer - avctx->priv_data = s; + ret = decode_ctx_init(avctx, s->mp3decctx[0]); if (ret < 0) return ret; s->mp3decctx[0]->adu_mode = 1; // Set adu mode @@ -1792,20 +1789,20 @@ * Each frame is 1 or 2 channels - up to 5 frames allowed */ for (i = 1; i < s->frames; i++) { - s->mp3decctx[i] = av_mallocz(sizeof(MPADecodeContext)); - if (!s->mp3decctx[i]) - return AVERROR(ENOMEM); + s->mp3decctx[i] = s->mp3decctx[0] + i; s->mp3decctx[i]->adu_mode = 1; s->mp3decctx[i]->avctx = avctx; s->mp3decctx[i]->mpadsp = s->mp3decctx[0]->mpadsp; +#if USE_FLOATS s->mp3decctx[i]->butterflies_float = s->mp3decctx[0]->butterflies_float; +#endif } return 0; } -static void flush_mp3on4(AVCodecContext *avctx) +static av_cold void flush_mp3on4(AVCodecContext *avctx) { int i; MP3On4DecodeContext *s = avctx->priv_data; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodsp_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodsp_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegaudiodsp_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegaudiodsp_template.c 2026-04-29 18:38:25.000000000 +0000 @@ -369,4 +369,3 @@ out++; } } - diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegutils.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegutils.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegutils.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegutils.h 2026-04-29 18:38:25.000000000 +0000 @@ -33,7 +33,6 @@ #define PICT_FRAME 3 #define MAX_MB_BYTES (30 * 16 * 16 * 3 / 8 + 120) -#define MAX_FCODE 7 /* MB types */ #define MB_TYPE_INTRA4x4 (1 << 0) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegvideo.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideo.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegvideo.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideo.h 2026-04-29 18:38:26.000000000 +0000 @@ -30,25 +30,17 @@ #include "blockdsp.h" #include "error_resilience.h" -#include "fdctdsp.h" -#include "get_bits.h" #include "h264chroma.h" #include "h263dsp.h" #include "hpeldsp.h" #include "idctdsp.h" -#include "me_cmp.h" -#include "motion_est.h" #include "mpegpicture.h" -#include "mpegvideoencdsp.h" -#include "pixblockdsp.h" -#include "put_bits.h" -#include "ratecontrol.h" #include "qpeldsp.h" #include "videodsp.h" -#define MAX_THREADS 32 +#include "libavutil/mem_internal.h" -#define MAX_B_FRAMES 16 +#define MAX_THREADS 32 /** * Scantable. @@ -67,6 +59,8 @@ FMT_SPEEDHQ, }; +typedef struct MpegEncContext MPVContext; + /** * MpegEncContext. */ @@ -80,47 +74,25 @@ /* scantables */ ScanTable inter_scantable; ///< if inter == intra then intra should be used to reduce the cache usage + ScanTable intra_scantable; /* WARNING: changes above this line require updates to hardcoded * offsets used in ASM. */ - ScanTable intra_scantable; - uint8_t permutated_intra_h_scantable[64]; - uint8_t permutated_intra_v_scantable[64]; - struct AVCodecContext *avctx; - /* The following pointer is intended for codecs sharing code - * between decoder and encoder and in need of a common context to do so. */ - void *private_ctx; /* the following parameters must be initialized before encoding */ int width, height;///< picture size. must be a multiple of 16 - int gop_size; - int intra_only; ///< if true, only intra pictures are generated - int64_t bit_rate; ///< wanted bit rate enum OutputFormat out_format; ///< output format int h263_pred; ///< use MPEG-4/H.263 ac/dc predictions - int pb_frame; ///< PB-frame mode (0 = none, 1 = base, 2 = improved) - -/* the following codec id fields are deprecated in favor of codec_id */ - int h263_plus; ///< H.263+ headers - int h263_flv; ///< use flv H.263 header enum AVCodecID codec_id; /* see AV_CODEC_ID_xxx */ - int fixed_qscale; ///< fixed qscale if non zero int encoding; ///< true if we are encoding (vs decoding) - int max_b_frames; ///< max number of B-frames for encoding - int luma_elim_threshold; - int chroma_elim_threshold; int workaround_bugs; ///< workaround bugs in encoders which cannot be detected automatically int codec_tag; ///< internal codec_tag upper case converted from avctx codec_tag /* the following fields are managed internally by the encoder */ /* sequence parameters */ int context_initialized; - int input_picture_number; ///< used to set pic->display_picture_number, should not be used for/by anything else - int coded_picture_number; ///< used to set pic->coded_picture_number, should not be used for/by anything else - int picture_number; //FIXME remove, unclear definition - int picture_in_gop_number; ///< 0-> first pic in gop, ... int mb_width, mb_height; ///< number of MBs horizontally & vertically int mb_stride; ///< mb_width+1 used for some arrays to allow simple addressing of left & top MBs without sig11 int b8_stride; ///< 2*mb_width+1 used for some 8x8 block arrays to allow simple addressing @@ -129,27 +101,16 @@ ptrdiff_t linesize; ///< line size, in bytes, may be different from width ptrdiff_t uvlinesize; ///< line size, for chroma in bytes, may be different from width struct AVRefStructPool *picture_pool; ///< Pool for MPVPictures - MPVPicture **input_picture;///< next pictures on display order for encoding - MPVPicture **reordered_input_picture; ///< pointer to the next pictures in coded order for encoding BufferPoolContext buffer_pools; - int64_t user_specified_pts; ///< last non-zero pts from AVFrame which was passed into avcodec_send_frame() - /** - * pts difference between the first and second input frame, used for - * calculating dts of the first frame when there's a delay */ - int64_t dts_delta; - /** - * reordered pts to be used as dts for the next output frame when there's - * a delay */ - int64_t reordered_pts; - - /** bit output */ - PutBitContext pb; - int start_mb_y; ///< start mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) int end_mb_y; ///< end mb_y of this thread (so current thread should process start_mb_y <= row < end_mb_y) - struct MpegEncContext *thread_context[MAX_THREADS]; + union { + struct MpegEncContext *thread_context[MAX_THREADS]; + struct Mpeg12SliceContext *mpeg12_contexts[MAX_THREADS]; + struct MPVEncContext *enc_contexts[MAX_THREADS]; + }; int slice_context_count; ///< number of used thread_contexts /** @@ -165,28 +126,20 @@ MPVWorkPicture next_pic; /** - * Reference to the source picture for encoding. - * note, linesize & data, might not match the source picture (for field pictures) - */ - AVFrame *new_pic; - - /** * copy of the current picture structure. * note, linesize & data, might not match the current picture (for field pictures) */ MPVWorkPicture cur_pic; - int skipped_last_frame; - int last_dc[3]; ///< last DC values for MPEG-1 int16_t *dc_val_base; - int16_t *dc_val[3]; ///< used for MPEG-4 DC prediction, all 3 arrays must be continuous const uint8_t *y_dc_scale_table; ///< qscale -> y_dc_scale table const uint8_t *c_dc_scale_table; ///< qscale -> c_dc_scale table const uint8_t *chroma_qscale_table; ///< qscale -> chroma_qscale (H.263) uint8_t *coded_block_base; uint8_t *coded_block; ///< used for coded block pattern prediction (msmpeg4v3, wmv1) int16_t (*ac_val_base)[16]; - int16_t (*ac_val[3])[16]; ///< used for MPEG-4 AC prediction, all 3 arrays must be continuous + int16_t *dc_val; ///< used for H.263 AIC/MPEG-4 DC prediction and ER + int16_t (*ac_val)[16]; ///< used for H.263 AIC, MPEG-4 AC prediction int mb_skipped; ///< MUST BE SET only during DECODING uint8_t *mbskip_table; /**< used to avoid copy if macroblock skipped (for black regions for example) and used for B-frame encoding & decoding (contains skip table of next P-frame) */ @@ -198,65 +151,19 @@ int qscale; ///< QP int chroma_qscale; ///< chroma QP - unsigned int lambda; ///< Lagrange multiplier used in rate distortion - unsigned int lambda2; ///< (lambda*lambda) >> FF_LAMBDA_SHIFT - int *lambda_table; - int adaptive_quant; ///< use adaptive quantization - int dquant; ///< qscale difference to prev qscale - int pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... - int vbv_delay; - int last_pict_type; //FIXME removes - int last_non_b_pict_type; ///< used for MPEG-4 gmc B-frames & ratecontrol + enum AVPictureType pict_type; ///< AV_PICTURE_TYPE_I, AV_PICTURE_TYPE_P, AV_PICTURE_TYPE_B, ... int droppable; - int last_lambda_for[5]; ///< last lambda for a specific pict type - int skipdct; ///< skip dct and code zero residual - - /* motion compensation */ - int unrestricted_mv; ///< mv can point outside of the coded picture - int h263_long_vectors; ///< use horrible H.263v1 long vector mode BlockDSPContext bdsp; - FDCTDSPContext fdsp; H264ChromaContext h264chroma; HpelDSPContext hdsp; IDCTDSPContext idsp; - MpegvideoEncDSPContext mpvencdsp; - PixblockDSPContext pdsp; QpelDSPContext qdsp; VideoDSPContext vdsp; H263DSPContext h263dsp; - int f_code; ///< forward MV resolution - int b_code; ///< backward MV resolution for B-frames (MPEG-4) - int16_t (*p_mv_table_base)[2]; - int16_t (*b_forw_mv_table_base)[2]; - int16_t (*b_back_mv_table_base)[2]; - int16_t (*b_bidir_forw_mv_table_base)[2]; - int16_t (*b_bidir_back_mv_table_base)[2]; - int16_t (*b_direct_mv_table_base)[2]; int16_t (*p_field_mv_table_base)[2]; - int16_t (*b_field_mv_table_base)[2]; - int16_t (*p_mv_table)[2]; ///< MV table (1MV per MB) P-frame encoding - int16_t (*b_forw_mv_table)[2]; ///< MV table (1MV per MB) forward mode B-frame encoding - int16_t (*b_back_mv_table)[2]; ///< MV table (1MV per MB) backward mode B-frame encoding - int16_t (*b_bidir_forw_mv_table)[2]; ///< MV table (1MV per MB) bidir mode B-frame encoding - int16_t (*b_bidir_back_mv_table)[2]; ///< MV table (1MV per MB) bidir mode B-frame encoding - int16_t (*b_direct_mv_table)[2]; ///< MV table (1MV per MB) direct mode B-frame encoding int16_t (*p_field_mv_table[2][2])[2]; ///< MV table (2MV per MB) interlaced P-frame encoding - int16_t (*b_field_mv_table[2][2][2])[2];///< MV table (4MV per MB) interlaced B-frame encoding - uint8_t (*p_field_select_table[2]); ///< Only the first element is allocated - uint8_t (*b_field_select_table[2][2]); ///< Only the first element is allocated - - /* The following fields are encoder-only */ - uint16_t *mb_var; ///< Table for MB variances - uint16_t *mc_mb_var; ///< Table for motion compensated MB variances - uint8_t *mb_mean; ///< Table for MB luminance - int64_t mb_var_sum; ///< sum of MB variance for current frame - int64_t mc_mb_var_sum; ///< motion compensated MB variance for current frame - uint64_t encoding_error[MPV_MAX_PLANES]; - - int motion_est; ///< ME algorithm - int me_penalty_compensation; - int me_pre; ///< prepass for motion estimation + int mv_dir; #define MV_DIR_FORWARD 1 #define MV_DIR_BACKWARD 2 @@ -275,19 +182,14 @@ int mv[2][4][2]; int field_select[2][2]; int last_mv[2][2][2]; ///< last MV, used for MV prediction in MPEG-1 & B-frame MPEG-4 - const uint8_t *fcode_tab; ///< smallest fcode needed for each MV int16_t direct_scale_mv[2][64]; ///< precomputed to avoid divisions in ff_mpeg4_set_direct_mv - MotionEstContext me; - int no_rounding; /**< apply no rounding to motion compensation (MPEG-4, msmpeg4, ...) for B-frames rounding mode is always 0 */ /* macroblock layer */ int mb_x, mb_y; - int mb_skip_run; int mb_intra; - uint16_t *mb_type; ///< Table for candidate MB types for encoding (defines in mpegvideoenc.h) int block_index[6]; ///< index to current MB in block based arrays with edges int block_wrap[6]; @@ -296,85 +198,26 @@ int *mb_index2xy; ///< mb_index -> mb_x + mb_y*mb_stride /** matrix transmitted in the bitstream */ - uint16_t intra_matrix[64]; - uint16_t chroma_intra_matrix[64]; - uint16_t inter_matrix[64]; - uint16_t chroma_inter_matrix[64]; - - int intra_quant_bias; ///< bias for the quantizer - int inter_quant_bias; ///< bias for the quantizer - int min_qcoeff; ///< minimum encodable coefficient - int max_qcoeff; ///< maximum encodable coefficient - int ac_esc_length; ///< num of bits needed to encode the longest esc - uint8_t *intra_ac_vlc_length; - uint8_t *intra_ac_vlc_last_length; - uint8_t *intra_chroma_ac_vlc_length; - uint8_t *intra_chroma_ac_vlc_last_length; - uint8_t *inter_ac_vlc_length; - uint8_t *inter_ac_vlc_last_length; - uint8_t *luma_dc_vlc_length; - - int coded_score[12]; - - /** precomputed matrix (combine qscale and DCT renorm) */ - int (*q_intra_matrix)[64]; - int (*q_chroma_intra_matrix)[64]; - int (*q_inter_matrix)[64]; - /** identical to the above but for MMX & these are not permutated, second 64 entries are bias*/ - uint16_t (*q_intra_matrix16)[2][64]; - uint16_t (*q_chroma_intra_matrix16)[2][64]; - uint16_t (*q_inter_matrix16)[2][64]; - - /* noise reduction */ - int (*dct_error_sum)[64]; - int dct_count[2]; - uint16_t (*dct_offset)[64]; - - /* bit rate control */ - int64_t total_bits; - int frame_bits; ///< bits used for the current frame - int stuffing_bits; ///< bits used for stuffing - int next_lambda; ///< next lambda used for retrying to encode a frame - RateControlContext rc_context; ///< contains stuff only accessed in ratecontrol.c - - /* statistics, used for 2-pass encoding */ - int mv_bits; - int header_bits; - int i_tex_bits; - int p_tex_bits; - int i_count; - int misc_bits; ///< cbp, mb_type - int last_bits; ///< temp var used for calculating the above vars + DECLARE_ALIGNED(16, uint16_t, intra_matrix)[64]; + DECLARE_ALIGNED(16, uint16_t, chroma_intra_matrix)[64]; + DECLARE_ALIGNED(16, uint16_t, inter_matrix)[64]; + DECLARE_ALIGNED(16, uint16_t, chroma_inter_matrix)[64]; /* error concealment / resync */ int resync_mb_x; ///< x position of last resync marker int resync_mb_y; ///< y position of last resync marker - GetBitContext last_resync_gb; ///< used to search for the next resync marker - int mb_num_left; ///< number of MBs left in this video packet (for partitioned Slices only) + + /* H.261 specific */ + int mtype; /* H.263 specific */ - int gob_index; int obmc; ///< overlapped block motion compensation - int mb_info; ///< interval for outputting info about mb offsets as side data - int prev_mb_info, last_mb_info; - uint8_t *mb_info_ptr; - int mb_info_size; - int ehc_mode; /* H.263+ specific */ - int umvplus; ///< == H.263+ && unrestricted_mv int h263_aic_dir; ///< AIC direction: 0 = left, 1 = top - int h263_slice_structured; - int alt_inter_vlc; ///< alternative inter vlc - int modified_quant; - int loop_filter; - int custom_pcf; /* MPEG-4 specific */ int studio_profile; - int dct_precision; - ///< number of bits to represent the fractional part of time (encoder only) - int time_increment_bits; int last_time_base; int time_base; ///< time in seconds of last I,P,S Frame int64_t time; ///< time of current frame @@ -385,37 +228,10 @@ uint16_t pb_field_time; ///< like above, just for interlaced int mcsel; int quarter_sample; ///< 1->qpel, 0->half pel ME/MC - int data_partitioning; ///< data partitioning flag from header - int partitioned_frame; ///< is current frame partitioned int low_delay; ///< no reordering needed / has no B-frames - PutBitContext tex_pb; ///< used for data partitioned VOPs - PutBitContext pb2; ///< used for data partitioned VOPs - int mpeg_quant; - int padding_bug_score; ///< used to detect the VERY common padding bug in MPEG-4 - - /* divx specific, used to workaround (many) bugs in divx5 */ - int divx_packed; - uint8_t *bitstream_buffer; //Divx 5.01 puts several frames in a single one, this is used to reorder them - int bitstream_buffer_size; - unsigned int allocated_bitstream_buffer_size; - - /* RV10 specific */ - int rv10_version; ///< RV10 version: 0 or 3 - int rv10_first_dc_coded[3]; - - /* MJPEG specific */ - struct MJpegContext *mjpeg_ctx; - int esc_pos; /* MSMPEG4 specific */ - int mv_table_index; - int rl_table_index; - int rl_chroma_table_index; - int dc_table_index; - int use_skip_mb_code; - int slice_height; ///< in macroblocks int first_slice_line; ///< used in MPEG-4 too to handle resync markers - int flipflop_rounding; enum { MSMP4_UNUSED, MSMP4_V1, @@ -425,19 +241,9 @@ MSMP4_WMV2, MSMP4_VC1, ///< for VC1 (image), WMV3 (image) and MSS2. } msmpeg4_version; - int per_mb_rl_table; - int esc3_level_length; - int esc3_run_length; int inter_intra_pred; int mspel; - /* decompression specific */ - GetBitContext gb; - - /* MPEG-1 specific */ - int last_mv_dir; ///< last mv_dir, used for B-frame encoding - int vbv_delay_pos; ///< offset of vbv_delay in the bitstream - /* MPEG-2-specific - I wished not to have to support this mess. */ int progressive_sequence; int mpeg_f_code[2][2]; @@ -450,7 +256,6 @@ int top_field_first; int concealment_motion_vectors; int q_scale_type; - int brd_scale; int intra_vlc_format; int alternate_scan; int repeat_first_field; @@ -467,94 +272,21 @@ int interlaced_dct; int first_field; ///< is 1 for the first field of a field picture 0 otherwise - /* RTP specific */ - int rtp_mode; - int rtp_payload_size; - - uint8_t *ptr_lastgob; - - int16_t (*block)[64]; ///< points to one of the following blocks - int16_t (*blocks)[12][64]; // for HQ mode we need to keep the best block - int (*decode_mb)(struct MpegEncContext *s, int16_t block[12][64]); // used by some codecs to avoid a switch() - -#define SLICE_OK 0 -#define SLICE_ERROR -1 -#define SLICE_END -2 /// clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax. - */ - float rc_qsquish; - float rc_qmod_amp; - int rc_qmod_freq; - float rc_initial_cplx; - float rc_buffer_aggressivity; - float border_masking; - int lmin, lmax; - int vbv_ignore_qmax; - - char *rc_eq; - - /* temp buffers for rate control */ - float *cplx_tab, *bits_tab; + void (*dct_unquantize_intra)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both) + int16_t *block/*align 16*/, int n, int qscale); + void (*dct_unquantize_inter)(const MPVContext *s, // unquantizer to use (MPEG-4 can use both) + int16_t *block/*align 16*/, int n, int qscale); /* flag to indicate a reinitialization is required, e.g. after * a frame size change */ int context_reinit; - ERContext er; - - int error_rate; - - /* temporary frames used by b_frame_strategy = 2 */ - AVFrame *tmp_frames[MAX_B_FRAMES + 2]; - int b_frame_strategy; - int b_sensitivity; - - /* frame skip options for encoding */ - int frame_skip_threshold; - int frame_skip_factor; - int frame_skip_exp; - int frame_skip_cmp; - me_cmp_func frame_skip_cmp_fn; + /// If set, ff_mpv_common_init() will allocate slice contexts of this size + unsigned slice_ctx_size; - int scenechange_threshold; - int noise_reduction; - - int intra_penalty; + ERContext er; } MpegEncContext; - /** * Set the given MpegEncContext to common defaults (same for encoding * and decoding). The changed fields will not depend upon the prior @@ -563,12 +295,6 @@ void ff_mpv_common_defaults(MpegEncContext *s); int ff_mpv_common_init(MpegEncContext *s); -void ff_mpv_common_init_arm(MpegEncContext *s); -void ff_mpv_common_init_axp(MpegEncContext *s); -void ff_mpv_common_init_neon(MpegEncContext *s); -void ff_mpv_common_init_ppc(MpegEncContext *s); -void ff_mpv_common_init_x86(MpegEncContext *s); -void ff_mpv_common_init_mips(MpegEncContext *s); /** * Initialize an MpegEncContext's thread contexts. Presumes that * slice_context_count is already set and that all the fields diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegvideoencdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideoencdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/mpegvideoencdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/mpegvideoencdsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -30,6 +30,9 @@ #define EDGE_BOTTOM 2 typedef struct MpegvideoEncDSPContext { + void (*denoise_dct)(int16_t block[64], int dct_error_sum[64], + const uint16_t dct_offset[64]); + int (*try_8x8basis)(const int16_t rem[64], const int16_t weight[64], const int16_t basis[64], int scale); void (*add_8x8basis)(int16_t rem[64], const int16_t basis[64], int scale); @@ -37,8 +40,9 @@ int (*pix_sum)(const uint8_t *pix, ptrdiff_t line_size); int (*pix_norm1)(const uint8_t *pix, ptrdiff_t line_size); - void (*shrink[4])(uint8_t *dst, ptrdiff_t dst_wrap, const uint8_t *src, - ptrdiff_t src_wrap, int width, int height); + void (*shrink[4])(uint8_t *restrict dst, ptrdiff_t dst_wrap, + const uint8_t *restrict src, ptrdiff_t src_wrap, + int width, int height); void (*draw_edges)(uint8_t *buf, ptrdiff_t wrap, int width, int height, int w, int h, int sides); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/options.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/options.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/options.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/options.c 2026-04-29 18:38:26.000000000 +0000 @@ -69,7 +69,7 @@ static AVClassCategory get_category(void *ptr) { AVCodecContext* avctx = ptr; - if (avctx->codec && av_codec_is_decoder(avctx->codec)) + if (avctx->codec && ff_codec_is_decoder(avctx->codec)) return AV_CLASS_CATEGORY_DECODER; else return AV_CLASS_CATEGORY_ENCODER; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/options_table.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/options_table.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/options_table.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/options_table.h 2026-04-29 18:38:26.000000000 +0000 @@ -47,7 +47,7 @@ #define AV_CODEC_DEFAULT_BITRATE 200*1000 static const AVOption avcodec_options[] = { -{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, INT64_MAX, A|V|E}, +{"b", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = AV_CODEC_DEFAULT_BITRATE }, 0, (double)INT64_MAX, A|V|E}, {"ab", "set bitrate (in bits/s)", OFFSET(bit_rate), AV_OPT_TYPE_INT64, {.i64 = 128*1000 }, 0, INT_MAX, A|E}, {"bt", "Set video bitrate tolerance (in bits/s). In 1-pass mode, bitrate tolerance specifies how far " "ratecontrol is willing to deviate from the target average bitrate value. This is not related " @@ -74,9 +74,6 @@ {"ilme", "interlaced motion estimation", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_INTERLACED_ME }, INT_MIN, INT_MAX, V|E, .unit = "flags"}, {"cgop", "closed GOP", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_CLOSED_GOP }, INT_MIN, INT_MAX, V|E, .unit = "flags"}, {"output_corrupt", "Output even potentially corrupted frames", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_OUTPUT_CORRUPT }, INT_MIN, INT_MAX, V|D, .unit = "flags"}, -#if FF_API_DROPCHANGED -{"drop_changed", "Drop frames whose parameters differ from first decoded frame", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG_DROPCHANGED }, INT_MIN, INT_MAX, A|V|D | AV_OPT_FLAG_DEPRECATED, .unit = "flags"}, -#endif {"flags2", NULL, OFFSET(flags2), AV_OPT_TYPE_FLAGS, {.i64 = DEFAULT}, 0, UINT_MAX, V|A|E|D|S, .unit = "flags2"}, {"fast", "allow non-spec-compliant speedup tricks", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_FAST }, INT_MIN, INT_MAX, V|E, .unit = "flags2"}, {"noout", "skip bitstream encoding", 0, AV_OPT_TYPE_CONST, {.i64 = AV_CODEC_FLAG2_NO_OUTPUT }, INT_MIN, INT_MAX, V|E, .unit = "flags2"}, @@ -217,15 +214,17 @@ {"rc_init_occupancy", "number of bits which should be loaded into the rc buffer before decoding starts", OFFSET(rc_initial_buffer_occupancy), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E}, {"threads", "set the number of threads", OFFSET(thread_count), AV_OPT_TYPE_INT, {.i64 = 1 }, 0, INT_MAX, V|A|E|D, .unit = "threads"}, {"auto", "autodetect a suitable number of threads to use", 0, AV_OPT_TYPE_CONST, {.i64 = 0 }, INT_MIN, INT_MAX, V|E|D, .unit = "threads"}, -{"dc", "intra_dc_precision", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, -8, 16, V|E}, +#if FF_API_INTRA_DC_PRECISION +{"dc", "deprecated; use intra_dc_precision for MPEG-2 instead", OFFSET(intra_dc_precision), AV_OPT_TYPE_INT, {.i64 = 0 }, -8, 16, AV_OPT_FLAG_DEPRECATED|V|E}, +#endif {"nssew", "nsse weight", OFFSET(nsse_weight), AV_OPT_TYPE_INT, {.i64 = 8 }, INT_MIN, INT_MAX, V|E}, {"skip_top", "number of macroblock rows at the top which are skipped", OFFSET(skip_top), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D}, {"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|D}, {"profile", NULL, OFFSET(profile), AV_OPT_TYPE_INT, {.i64 = AV_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, .unit = "avctx.profile"}, {"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_PROFILE_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, .unit = "avctx.profile"}, {"main10", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_PROFILE_HEVC_MAIN_10 }, INT_MIN, INT_MAX, V|E, .unit = "avctx.profile"}, -{"level", "encoding level, usually corresponding to the profile level, codec-specific", OFFSET(level), AV_OPT_TYPE_INT, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, .unit = "avctx.level"}, -{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = FF_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, .unit = "avctx.level"}, +{"level", "encoding level, usually corresponding to the profile level, codec-specific", OFFSET(level), AV_OPT_TYPE_INT, {.i64 = AV_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E|CC, .unit = "avctx.level"}, +{"unknown", NULL, 0, AV_OPT_TYPE_CONST, {.i64 = AV_LEVEL_UNKNOWN }, INT_MIN, INT_MAX, V|A|E, .unit = "avctx.level"}, {"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|A|D}, {"cmp", "full-pel ME compare function", OFFSET(me_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, .unit = "cmp_func"}, {"subcmp", "sub-pel ME compare function", OFFSET(me_sub_cmp), AV_OPT_TYPE_INT, {.i64 = DEFAULT }, INT_MIN, INT_MAX, V|E, .unit = "cmp_func"}, @@ -272,9 +271,6 @@ {"ch_layout", NULL, OFFSET(ch_layout), AV_OPT_TYPE_CHLAYOUT, {.str = NULL }, 0, 0, A|E|D, .unit = "ch_layout"}, {"rc_max_vbv_use", NULL, OFFSET(rc_max_available_vbv_use), AV_OPT_TYPE_FLOAT, {.dbl = 0 }, 0.0, FLT_MAX, V|E}, {"rc_min_vbv_use", NULL, OFFSET(rc_min_vbv_overflow_use), AV_OPT_TYPE_FLOAT, {.dbl = 3 }, 0.0, FLT_MAX, V|E}, -#if FF_API_TICKS_PER_FRAME -{"ticks_per_frame", NULL, OFFSET(ticks_per_frame), AV_OPT_TYPE_INT, {.i64 = 1 }, 1, INT_MAX, A|V|E|D}, -#endif {"color_primaries", "color primaries", OFFSET(color_primaries), AV_OPT_TYPE_INT, {.i64 = AVCOL_PRI_UNSPECIFIED }, 1, INT_MAX, V|E|D, .unit = "color_primaries_type"}, {"bt709", "BT.709", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_BT709 }, INT_MIN, INT_MAX, V|E|D, .unit = "color_primaries_type"}, {"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCOL_PRI_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "color_primaries_type"}, @@ -358,6 +354,11 @@ {"bottomleft", "Bottom-left", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOMLEFT }, INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"}, {"bottom", "Bottom", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_BOTTOM }, INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"}, {"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVCHROMA_LOC_UNSPECIFIED }, INT_MIN, INT_MAX, V|E|D, .unit = "chroma_sample_location_type"}, +{"alpha_mode", "alpha mode", OFFSET(alpha_mode), AV_OPT_TYPE_INT, {.i64 = AVALPHA_MODE_UNSPECIFIED }, 0, INT_MAX, V|E|D, .unit = "alpha_mode_type"}, +{"unknown", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED }, 0, 0, V|E|D, .unit = "alpha_mode_type"}, +{"unspecified", "Unspecified", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_UNSPECIFIED }, 0, 0, V|E|D, .unit = "alpha_mode_type"}, +{"premultiplied", "Premultiplied", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_PREMULTIPLIED }, 0, 0, V|E|D, .unit = "alpha_mode_type"}, +{"straight", "Straight", 0, AV_OPT_TYPE_CONST, {.i64 = AVALPHA_MODE_STRAIGHT }, 0, 0, V|E|D, .unit = "alpha_mode_type"}, {"log_level_offset", "set the log level offset", OFFSET(log_level_offset), AV_OPT_TYPE_INT, {.i64 = 0 }, INT_MIN, INT_MAX }, {"slices", "set the number of slices, used in parallelized encoding", OFFSET(slices), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, V|E}, {"thread_type", "select multithreading type", OFFSET(thread_type), AV_OPT_TYPE_FLAGS, {.i64 = FF_THREAD_SLICE|FF_THREAD_FRAME }, 0, INT_MAX, V|A|E|D, .unit = "thread_type"}, @@ -412,6 +413,7 @@ {"mastering_display_metadata", .default_val.i64 = AV_PKT_DATA_MASTERING_DISPLAY_METADATA, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, {"content_light_level", .default_val.i64 = AV_PKT_DATA_CONTENT_LIGHT_LEVEL, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, {"icc_profile", .default_val.i64 = AV_PKT_DATA_ICC_PROFILE, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, + {"exif", .default_val.i64 = AV_PKT_DATA_EXIF, .type = AV_OPT_TYPE_CONST, .flags = A|D, .unit = "side_data_pkt" }, {NULL}, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/packet.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/packet.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet.c 2026-04-29 18:38:26.000000000 +0000 @@ -24,7 +24,6 @@ #include "libavutil/avassert.h" #include "libavutil/avutil.h" #include "libavutil/container_fifo.h" -#include "libavutil/intreadwrite.h" #include "libavutil/mathematics.h" #include "libavutil/mem.h" #include "libavutil/rational.h" @@ -308,6 +307,9 @@ case AV_PKT_DATA_IAMF_RECON_GAIN_INFO_PARAM: return "IAMF Recon Gain Info Parameter Data"; case AV_PKT_DATA_FRAME_CROPPING: return "Frame Cropping"; case AV_PKT_DATA_LCEVC: return "LCEVC NAL data"; + case AV_PKT_DATA_3D_REFERENCE_DISPLAYS: return "3D Reference Displays Info"; + case AV_PKT_DATA_RTCP_SR: return "RTCP Sender Report"; + case AV_PKT_DATA_EXIF: return "EXIF metadata"; } return NULL; } @@ -390,6 +392,32 @@ return AVERROR(ENOENT); } +static void av_packet_free_moz_crypto_info(AVPacket *pkt) { + if (pkt->moz_crypto_info_release && pkt->moz_crypto_info) { + (*pkt->moz_crypto_info_release)(pkt->moz_crypto_info); + } + pkt->moz_ndk_crypto_info = NULL; + pkt->moz_crypto_info = NULL; + pkt->moz_crypto_info_addref = NULL; + pkt->moz_crypto_info_release = NULL; +} + +static int av_packet_copy_moz_crypto_info(AVPacket *dst, const AVPacket *src) { + av_packet_free_moz_crypto_info(dst); + if (!src->moz_ndk_crypto_info) { + return 0; + } + if (!src->moz_crypto_info || !src->moz_crypto_info_addref || !src->moz_crypto_info_release) { + return AVERROR(EINVAL); + } + dst->moz_ndk_crypto_info = src->moz_ndk_crypto_info; + dst->moz_crypto_info = src->moz_crypto_info; + dst->moz_crypto_info_addref = src->moz_crypto_info_addref; + dst->moz_crypto_info_release = src->moz_crypto_info_release; + (*dst->moz_crypto_info_addref)(dst->moz_crypto_info); + return 0; +} + int av_packet_copy_props(AVPacket *dst, const AVPacket *src) { int i, ret; @@ -406,10 +434,16 @@ dst->side_data = NULL; dst->side_data_elems = 0; - ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); + ret = av_packet_copy_moz_crypto_info(dst, src); if (ret < 0) return ret; + ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); + if (ret < 0) { + av_packet_free_moz_crypto_info(dst); + return ret; + } + for (i = 0; i < src->side_data_elems; i++) { enum AVPacketSideDataType type = src->side_data[i].type; size_t size = src->side_data[i].size; @@ -417,6 +451,7 @@ uint8_t *dst_data = av_packet_new_side_data(dst, type, size); if (!dst_data) { + av_packet_free_moz_crypto_info(dst); av_buffer_unref(&dst->opaque_ref); av_packet_free_side_data(dst); return AVERROR(ENOMEM); @@ -429,6 +464,7 @@ void av_packet_unref(AVPacket *pkt) { + av_packet_free_moz_crypto_info(pkt); av_packet_free_side_data(pkt); av_buffer_unref(&pkt->opaque_ref); av_buffer_unref(&pkt->buf); @@ -547,6 +583,7 @@ int flags) { PacketListEntry *pktl = av_malloc(sizeof(*pktl)); + unsigned int update_end_point = 1; int ret; if (!pktl) @@ -570,13 +607,22 @@ pktl->next = NULL; - if (packet_buffer->head) - packet_buffer->tail->next = pktl; - else + if (packet_buffer->head) { + if (flags & FF_PACKETLIST_FLAG_PREPEND) { + pktl->next = packet_buffer->head; + packet_buffer->head = pktl; + update_end_point = 0; + } else { + packet_buffer->tail->next = pktl; + } + } else packet_buffer->head = pktl; - /* Add the packet in the buffered packet list. */ - packet_buffer->tail = pktl; + if (update_end_point) { + /* Add the packet in the buffered packet list. */ + packet_buffer->tail = pktl; + } + return 0; } @@ -607,31 +653,6 @@ pkt_buf->head = pkt_buf->tail = NULL; } -int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type) -{ - uint8_t *side_data; - size_t side_data_size; - int i; - - side_data = av_packet_get_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, &side_data_size); - if (!side_data) { - side_data_size = 4+4+8*error_count; - side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_QUALITY_STATS, - side_data_size); - } - - if (!side_data || side_data_size < 4+4+8*error_count) - return AVERROR(ENOMEM); - - AV_WL32(side_data , quality ); - side_data[4] = pict_type; - side_data[5] = error_count; - for (i = 0; i= 0 Success + * @retval AVERROR(EINVAL) The frame side data type does not have a matching + * packet side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_from_frame(AVPacketSideData **sd, int *nb_sd, + const struct AVFrameSideData *src, unsigned int flags); +/** + * Add a new frame side data entry to an array based on existing packet + * side data, if a matching type exists for frame side data. + * + * @param flags Some combination of AV_FRAME_SIDE_DATA_FLAG_* flags, + * or 0. + * @retval >= 0 Success + * @retval AVERROR(EINVAL) The packet side data type does not have a matching + * frame side data type. + * @retval AVERROR(ENOMEM) Failed to add a side data entry to the array, or + * similar. + */ +int av_packet_side_data_to_frame(struct AVFrameSideData ***sd, int *nb_sd, + const AVPacketSideData *src, unsigned int flags); + const char *av_packet_side_data_name(enum AVPacketSideDataType type); /** @@ -581,6 +630,15 @@ * or muxers. */ AVRational time_base; + + /** + * Mozilla extensions to manage AMediaCryptoInfo for encrypted packets on + * Android. Must provide all parameters if any are given. + */ + void* moz_ndk_crypto_info; + void* moz_crypto_info; + void (*moz_crypto_info_addref)(void*); + void (*moz_crypto_info_release)(void*); } AVPacket; #if FF_API_INIT_PACKET diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/packet_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/packet_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/packet_internal.h 2026-04-29 18:38:26.000000000 +0000 @@ -34,6 +34,8 @@ PacketListEntry *head, *tail; } PacketList; +#define FF_PACKETLIST_FLAG_PREPEND (1 << 0) /**< Prepend created AVPacketList instead of appending */ + /** * Append an AVPacket to the list. * @@ -68,8 +70,6 @@ */ void avpriv_packet_list_free(PacketList *list); -int ff_side_data_set_encoder_stats(AVPacket *pkt, int quality, int64_t *error, int error_count, int pict_type); - int ff_side_data_set_prft(AVPacket *pkt, int64_t timestamp); #endif // AVCODEC_PACKET_INTERNAL_H diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/parser.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser.c 2026-04-29 18:38:25.000000000 +0000 @@ -24,15 +24,23 @@ #include #include +#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/mem.h" +#include "codec_desc.h" #include "parser.h" +#include "parser_internal.h" -AVCodecParserContext *av_parser_init(int codec_id) +#if FF_API_PARSER_CODECID +av_cold AVCodecParserContext *av_parser_init(int codec_id) +#else +av_cold AVCodecParserContext *av_parser_init(enum AVCodecID codec_id) +#endif { AVCodecParserContext *s = NULL; const AVCodecParser *parser; + const FFCodecParser *ffparser; void *i = 0; int ret; @@ -52,17 +60,18 @@ return NULL; found: + ffparser = ffcodecparser(parser); s = av_mallocz(sizeof(AVCodecParserContext)); if (!s) goto err_out; s->parser = parser; - s->priv_data = av_mallocz(parser->priv_data_size); + s->priv_data = av_mallocz(ffparser->priv_data_size); if (!s->priv_data) goto err_out; s->fetch_timestamp=1; s->pict_type = AV_PICTURE_TYPE_I; - if (parser->parser_init) { - ret = parser->parser_init(s); + if (ffparser->init) { + ret = ffparser->init(s); if (ret != 0) goto err_out; } @@ -117,6 +126,7 @@ const uint8_t *buf, int buf_size, int64_t pts, int64_t dts, int64_t pos) { + const AVCodecDescriptor *desc; int index, i; uint8_t dummy_buf[AV_INPUT_BUFFER_PADDING_SIZE]; @@ -131,6 +141,8 @@ avctx->codec_id == s->parser->codec_ids[5] || avctx->codec_id == s->parser->codec_ids[6]); + desc = avcodec_descriptor_get(avctx->codec_id); + if (!(s->flags & PARSER_FLAG_FETCHED_OFFSET)) { s->next_frame_offset = s->cur_offset = pos; @@ -160,8 +172,8 @@ ff_fetch_timestamp(s, 0, 0, 0); } /* WARNING: the returned index can be negative */ - index = s->parser->parser_parse(s, avctx, (const uint8_t **) poutbuf, - poutbuf_size, buf, buf_size); + index = ffcodecparser(s->parser)->parse(s, avctx, (const uint8_t **) poutbuf, + poutbuf_size, buf, buf_size); av_assert0(index > -0x20000000); // The API does not allow returning AVERROR codes #define FILL(name) if(s->name > 0 && avctx->name <= 0) avctx->name = s->name if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { @@ -170,6 +182,8 @@ FILL(coded_height); FILL(width); FILL(height); + if (desc && (desc->props & AV_CODEC_PROP_ENHANCEMENT) && + s->format >= 0 && avctx->pix_fmt < 0) avctx->pix_fmt = s->format; } /* update the file pointer */ @@ -190,11 +204,11 @@ return index; } -void av_parser_close(AVCodecParserContext *s) +av_cold void av_parser_close(AVCodecParserContext *s) { if (s) { - if (s->parser->parser_close) - s->parser->parser_close(s); + if (ffcodecparser(s->parser)->close) + ffcodecparser(s->parser)->close(s); av_freep(&s->priv_data); av_free(s); } @@ -287,7 +301,7 @@ return 0; } -void ff_parse_close(AVCodecParserContext *s) +av_cold void ff_parse_close(AVCodecParserContext *s) { ParseContext *pc = s->priv_data; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/parser_internal.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/parser_internal.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/parser_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * 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 + */ + +#ifndef AVCODEC_PARSER_INTERNAL_H +#define AVCODEC_PARSER_INTERNAL_H + +#include + +#include "libavutil/macros.h" +#include "avcodec.h" +#include "codec_id.h" + +#if FF_API_PARSER_PRIVATE +typedef union FFCodecParser { + struct { +#if FF_API_PARSER_CODECID + int codec_ids[7]; /* several codec IDs are permitted */ +#else + enum AVCodecID codec_ids[7]; /* several codec IDs are permitted */ +#endif + int priv_data_size; + int (*init)(AVCodecParserContext *s); + int (*parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*close)(AVCodecParserContext *s); + int (*split)(AVCodecContext *avctx, const uint8_t *buf, int buf_size); + }; + AVCodecParser p; +#else +typedef struct FFCodecParser { + AVCodecParser p; + unsigned priv_data_size; + int (*init)(AVCodecParserContext *s); + int (*parse)(AVCodecParserContext *s, + AVCodecContext *avctx, + const uint8_t **poutbuf, int *poutbuf_size, + const uint8_t *buf, int buf_size); + void (*close)(AVCodecParserContext *s); +#endif +} FFCodecParser; + +static inline const FFCodecParser *ffcodecparser(const AVCodecParser *parser) +{ + return (const FFCodecParser*)parser; +} + +#define EIGTH_ARG(a,b,c,d,e,f,g,h,...) h +#define NO_FAIL +// Expands to nothing if <= 7 args; induces compilation failure if not. +#define CHECK_FOR_TOO_MANY_IDS(...) AV_JOIN(EIGTH_ARG(__VA_ARGS__, NO, NO, NO, NO, NO, NO, NO, NO), _FAIL) + +// For compatibility with MSVC's old, spec-incompliant preprocessor. +#define FF_MSVC_EXPAND(...) __VA_ARGS__ +#define FIRST_SEVEN2(a,b,c,d,e,f,g,...) a,b,c,d,e,f,g +#define FIRST_SEVEN(...) FF_MSVC_EXPAND(FIRST_SEVEN2(__VA_ARGS__)) +#define TIMES_SEVEN(a) a,a,a,a,a,a,a + +#if FF_API_PARSER_PRIVATE +#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \ + .codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) } +#else +#define PARSER_CODEC_LIST(...) CHECK_FOR_TOO_MANY_IDS(__VA_ARGS__) \ + .p.codec_ids = { FIRST_SEVEN(__VA_ARGS__, TIMES_SEVEN(AV_CODEC_ID_NONE)) } +#endif + +#endif /* AVCODEC_PARSER_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/parsers.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/parsers.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/parsers.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/parsers.c 2026-04-29 18:38:25.000000000 +0000 @@ -19,78 +19,104 @@ #include #include "avcodec.h" +#include "parser_internal.h" -extern const AVCodecParser ff_aac_parser; -extern const AVCodecParser ff_aac_latm_parser; -extern const AVCodecParser ff_ac3_parser; -extern const AVCodecParser ff_adx_parser; -extern const AVCodecParser ff_amr_parser; -extern const AVCodecParser ff_av1_parser; -extern const AVCodecParser ff_avs2_parser; -extern const AVCodecParser ff_avs3_parser; -extern const AVCodecParser ff_bmp_parser; -extern const AVCodecParser ff_cavsvideo_parser; -extern const AVCodecParser ff_cook_parser; -extern const AVCodecParser ff_cri_parser; -extern const AVCodecParser ff_dca_parser; -extern const AVCodecParser ff_dirac_parser; -extern const AVCodecParser ff_dnxhd_parser; -extern const AVCodecParser ff_dnxuc_parser; -extern const AVCodecParser ff_dolby_e_parser; -extern const AVCodecParser ff_dpx_parser; -extern const AVCodecParser ff_dvaudio_parser; -extern const AVCodecParser ff_dvbsub_parser; -extern const AVCodecParser ff_dvdsub_parser; -extern const AVCodecParser ff_dvd_nav_parser; -extern const AVCodecParser ff_evc_parser; -extern const AVCodecParser ff_flac_parser; -extern const AVCodecParser ff_ftr_parser; -extern const AVCodecParser ff_g723_1_parser; -extern const AVCodecParser ff_g729_parser; -extern const AVCodecParser ff_gif_parser; -extern const AVCodecParser ff_gsm_parser; -extern const AVCodecParser ff_h261_parser; -extern const AVCodecParser ff_h263_parser; -extern const AVCodecParser ff_h264_parser; -extern const AVCodecParser ff_hevc_parser; -extern const AVCodecParser ff_hdr_parser; -extern const AVCodecParser ff_ipu_parser; -extern const AVCodecParser ff_jpeg2000_parser; -extern const AVCodecParser ff_jpegxl_parser; -extern const AVCodecParser ff_misc4_parser; -extern const AVCodecParser ff_mjpeg_parser; -extern const AVCodecParser ff_mlp_parser; -extern const AVCodecParser ff_mpeg4video_parser; -extern const AVCodecParser ff_mpegaudio_parser; -extern const AVCodecParser ff_mpegvideo_parser; -extern const AVCodecParser ff_opus_parser; -extern const AVCodecParser ff_png_parser; -extern const AVCodecParser ff_pnm_parser; -extern const AVCodecParser ff_qoi_parser; -extern const AVCodecParser ff_rv34_parser; -extern const AVCodecParser ff_sbc_parser; -extern const AVCodecParser ff_sipr_parser; -extern const AVCodecParser ff_tak_parser; -extern const AVCodecParser ff_vc1_parser; -extern const AVCodecParser ff_vorbis_parser; -extern const AVCodecParser ff_vp3_parser; -extern const AVCodecParser ff_vp8_parser; -extern const AVCodecParser ff_vp9_parser; -extern const AVCodecParser ff_vvc_parser; -extern const AVCodecParser ff_webp_parser; -extern const AVCodecParser ff_xbm_parser; -extern const AVCodecParser ff_xma_parser; -extern const AVCodecParser ff_xwd_parser; +#if FF_API_PARSER_PRIVATE +#include "libavutil/internal.h" +#include +#include + +FF_DISABLE_DEPRECATION_WARNINGS +#define CHECK_OFFSET(field, public_prefix) static_assert(offsetof(FFCodecParser, field) == offsetof(FFCodecParser, p.public_prefix ## field), "Wrong offsets") +CHECK_OFFSET(codec_ids,); +CHECK_OFFSET(priv_data_size,); +CHECK_OFFSET(init, parser_); +CHECK_OFFSET(parse, parser_); +CHECK_OFFSET(close, parser_); +CHECK_OFFSET(split,); +FF_ENABLE_DEPRECATION_WARNINGS +#endif + +extern const FFCodecParser ff_aac_parser; +extern const FFCodecParser ff_aac_latm_parser; +extern const FFCodecParser ff_ac3_parser; +extern const FFCodecParser ff_adx_parser; +extern const FFCodecParser ff_ahx_parser; +extern const FFCodecParser ff_amr_parser; +extern const FFCodecParser ff_apv_parser; +extern const FFCodecParser ff_av1_parser; +extern const FFCodecParser ff_avs2_parser; +extern const FFCodecParser ff_avs3_parser; +extern const FFCodecParser ff_bmp_parser; +extern const FFCodecParser ff_cavsvideo_parser; +extern const FFCodecParser ff_cook_parser; +extern const FFCodecParser ff_cri_parser; +extern const FFCodecParser ff_dca_parser; +extern const FFCodecParser ff_dirac_parser; +extern const FFCodecParser ff_dnxhd_parser; +extern const FFCodecParser ff_dnxuc_parser; +extern const FFCodecParser ff_dolby_e_parser; +extern const FFCodecParser ff_dpx_parser; +extern const FFCodecParser ff_dvaudio_parser; +extern const FFCodecParser ff_dvbsub_parser; +extern const FFCodecParser ff_dvdsub_parser; +extern const FFCodecParser ff_dvd_nav_parser; +extern const FFCodecParser ff_evc_parser; +extern const FFCodecParser ff_flac_parser; +extern const FFCodecParser ff_ftr_parser; +extern const FFCodecParser ff_ffv1_parser; +extern const FFCodecParser ff_g723_1_parser; +extern const FFCodecParser ff_g729_parser; +extern const FFCodecParser ff_gif_parser; +extern const FFCodecParser ff_gsm_parser; +extern const FFCodecParser ff_h261_parser; +extern const FFCodecParser ff_h263_parser; +extern const FFCodecParser ff_h264_parser; +extern const FFCodecParser ff_hevc_parser; +extern const FFCodecParser ff_hdr_parser; +extern const FFCodecParser ff_ipu_parser; +extern const FFCodecParser ff_jpeg2000_parser; +extern const FFCodecParser ff_jpegxl_parser; +extern const FFCodecParser ff_jpegxs_parser; +extern const FFCodecParser ff_lcevc_parser; +extern const FFCodecParser ff_misc4_parser; +extern const FFCodecParser ff_mjpeg_parser; +extern const FFCodecParser ff_mlp_parser; +extern const FFCodecParser ff_mpeg4video_parser; +extern const FFCodecParser ff_mpegaudio_parser; +extern const FFCodecParser ff_mpegvideo_parser; +extern const FFCodecParser ff_opus_parser; +extern const FFCodecParser ff_prores_parser; +extern const FFCodecParser ff_png_parser; +extern const FFCodecParser ff_pnm_parser; +extern const FFCodecParser ff_prores_raw_parser; +extern const FFCodecParser ff_qoi_parser; +extern const FFCodecParser ff_rv34_parser; +extern const FFCodecParser ff_sbc_parser; +extern const FFCodecParser ff_sipr_parser; +extern const FFCodecParser ff_tak_parser; +extern const FFCodecParser ff_vc1_parser; +extern const FFCodecParser ff_vorbis_parser; +extern const FFCodecParser ff_vp3_parser; +extern const FFCodecParser ff_vp8_parser; +extern const FFCodecParser ff_vp9_parser; +extern const FFCodecParser ff_vvc_parser; +extern const FFCodecParser ff_webp_parser; +extern const FFCodecParser ff_xbm_parser; +extern const FFCodecParser ff_xma_parser; +extern const FFCodecParser ff_xwd_parser; #include "libavcodec/parser_list.c" const AVCodecParser *av_parser_iterate(void **opaque) { uintptr_t i = (uintptr_t)*opaque; - const AVCodecParser *p = parser_list[i]; + const FFCodecParser *p = parser_list[i]; - if (p) + if (p) { *opaque = (void*)(i + 1); + return &p->p; + } - return p; + return NULL; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pcm.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pcm.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm.c 2026-04-29 18:38:25.000000000 +0000 @@ -38,21 +38,32 @@ #include "encode.h" #include "pcm_tablegen.h" -static av_cold int pcm_encode_init(AVCodecContext *avctx) +av_unused av_cold static int pcm_encode_init(AVCodecContext *avctx) { avctx->frame_size = 0; #if !CONFIG_HARDCODED_TABLES switch (avctx->codec->id) { -#define INIT_ONCE(id, name) \ - case AV_CODEC_ID_PCM_ ## id: \ - if (CONFIG_PCM_ ## id ## _ENCODER) { \ - static AVOnce init_static_once = AV_ONCE_INIT; \ - ff_thread_once(&init_static_once, pcm_ ## name ## _tableinit); \ - } \ - break - INIT_ONCE(ALAW, alaw); - INIT_ONCE(MULAW, ulaw); - INIT_ONCE(VIDC, vidc); +#if CONFIG_PCM_ALAW_ENCODER + case AV_CODEC_ID_PCM_ALAW: { + static AVOnce once_alaw = AV_ONCE_INIT; + ff_thread_once(&once_alaw, pcm_alaw_tableinit); + break; + } +#endif +#if CONFIG_PCM_MULAW_ENCODER + case AV_CODEC_ID_PCM_MULAW: { + static AVOnce once_mulaw = AV_ONCE_INIT; + ff_thread_once(&once_mulaw, pcm_ulaw_tableinit); + break; + } +#endif +#if CONFIG_PCM_VIDC_ENCODER + case AV_CODEC_ID_PCM_VIDC: { + static AVOnce once_vidc = AV_ONCE_INIT; + ff_thread_once(&once_vidc, pcm_vidc_tableinit); + break; + } +#endif default: break; } @@ -93,10 +104,10 @@ } \ } -static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, - const AVFrame *frame, int *got_packet_ptr) +av_unused static int pcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, + const AVFrame *frame, int *got_packet_ptr) { - int n, c, sample_size, v, ret; + int n, c, sample_size, ret; const short *samples; unsigned char *dst; const uint8_t *samples_uint8_t; @@ -216,24 +227,30 @@ bytestream_put_buffer(&dst, src, n * sample_size); } break; +#if CONFIG_PCM_ALAW_ENCODER case AV_CODEC_ID_PCM_ALAW: for (; n > 0; n--) { - v = *samples++; + int v = *samples++; *dst++ = linear_to_alaw[(v + 32768) >> 2]; } break; +#endif +#if CONFIG_PCM_MULAW_ENCODER case AV_CODEC_ID_PCM_MULAW: for (; n > 0; n--) { - v = *samples++; + int v = *samples++; *dst++ = linear_to_ulaw[(v + 32768) >> 2]; } break; +#endif +#if CONFIG_PCM_VIDC_ENCODER case AV_CODEC_ID_PCM_VIDC: for (; n > 0; n--) { - v = *samples++; + int v = *samples++; *dst++ = linear_to_vidc[(v + 32768) >> 2]; } break; +#endif default: return -1; } @@ -243,51 +260,114 @@ } typedef struct PCMDecode { - short table[256]; + int sample_size; +} PCMDecode; + +av_unused av_cold static int pcm_decode_init(AVCodecContext *avctx) +{ + PCMDecode *s = avctx->priv_data; + static const struct { + enum AVCodecID codec_id; + int8_t sample_fmt; + uint8_t sample_size; + uint8_t bits_per_sample; + } codec_id_to_samplefmt[] = { + #define ENTRY(CODEC_ID, SAMPLE_FMT, BITS_PER_SAMPLE) \ + { AV_CODEC_ID_PCM_ ## CODEC_ID, AV_SAMPLE_FMT_ ## SAMPLE_FMT, \ + BITS_PER_SAMPLE / 8, BITS_PER_SAMPLE } + ENTRY(S8, U8, 8), ENTRY(S8_PLANAR, U8P, 8), + ENTRY(S16BE, S16, 16), ENTRY(S16BE_PLANAR, S16P, 16), + ENTRY(S16LE, S16, 16), ENTRY(S16LE_PLANAR, S16P, 16), + ENTRY(S24DAUD, S16, 24), ENTRY(S24BE, S32, 24), + ENTRY(S24LE, S32, 24), ENTRY(S24LE_PLANAR, S32P, 24), + ENTRY(S32BE, S32, 32), ENTRY(S32LE, S32, 32), + ENTRY(S32LE_PLANAR, S32P, 32), + ENTRY(S64BE, S64, 64), ENTRY(S64LE, S64, 64), + ENTRY(SGA, U8, 8), ENTRY(U8, U8, 8), + ENTRY(U16BE, S16, 16), ENTRY(U16LE, S16, 16), + ENTRY(U24BE, S32, 24), ENTRY(U24LE, S32, 24), + ENTRY(U32BE, S32, 32), ENTRY(U32LE, S32, 32), + ENTRY(F32BE, FLT, 32), ENTRY(F32LE, FLT, 32), + ENTRY(F64BE, DBL, 64), ENTRY(F64LE, DBL, 64), + { .codec_id = AV_CODEC_ID_PCM_LXF, .sample_fmt = AV_SAMPLE_FMT_S32P, .sample_size = 5 }, + }; + + for (unsigned i = 0; i < FF_ARRAY_ELEMS(codec_id_to_samplefmt); ++i) { + if (codec_id_to_samplefmt[i].codec_id == avctx->codec_id) { + s->sample_size = codec_id_to_samplefmt[i].sample_size; + avctx->sample_fmt = codec_id_to_samplefmt[i].sample_fmt; + if (avctx->sample_fmt == AV_SAMPLE_FMT_S32) + avctx->bits_per_raw_sample = codec_id_to_samplefmt[i].bits_per_sample; + break; + } + av_assert1(i + 1 < FF_ARRAY_ELEMS(codec_id_to_samplefmt)); + } + + return 0; +} + +typedef struct PCMScaleDecode { + PCMDecode base; void (*vector_fmul_scalar)(float *dst, const float *src, float mul, int len); float scale; -} PCMDecode; +} PCMScaleDecode; -static av_cold int pcm_decode_init(AVCodecContext *avctx) +av_unused av_cold static int pcm_scale_decode_init(AVCodecContext *avctx) { - PCMDecode *s = avctx->priv_data; + PCMScaleDecode *s = avctx->priv_data; AVFloatDSPContext *fdsp; - int i; + + avctx->sample_fmt = AV_SAMPLE_FMT_FLT; + s->base.sample_size = 4; + + if (avctx->bits_per_coded_sample < 1 || avctx->bits_per_coded_sample > 24) + return AVERROR_INVALIDDATA; + + s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1)); + fdsp = avpriv_float_dsp_alloc(0); + if (!fdsp) + return AVERROR(ENOMEM); + s->vector_fmul_scalar = fdsp->vector_fmul_scalar; + av_free(fdsp); + + return 0; +} + +typedef struct PCMLUTDecode { + PCMDecode base; + int16_t table[256]; +} PCMLUTDecode; + +av_unused av_cold static int pcm_lut_decode_init(AVCodecContext *avctx) +{ + PCMLUTDecode *s = avctx->priv_data; switch (avctx->codec_id) { + default: + av_unreachable("pcm_lut_decode_init() only used with alaw, mulaw and vidc"); +#if CONFIG_PCM_ALAW_DECODER case AV_CODEC_ID_PCM_ALAW: - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) s->table[i] = alaw2linear(i); break; +#endif +#if CONFIG_PCM_MULAW_DECODER case AV_CODEC_ID_PCM_MULAW: - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) s->table[i] = ulaw2linear(i); break; +#endif +#if CONFIG_PCM_VIDC_DECODER case AV_CODEC_ID_PCM_VIDC: - for (i = 0; i < 256; i++) + for (int i = 0; i < 256; i++) s->table[i] = vidc2linear(i); break; - case AV_CODEC_ID_PCM_F16LE: - case AV_CODEC_ID_PCM_F24LE: - if (avctx->bits_per_coded_sample < 1 || avctx->bits_per_coded_sample > 24) - return AVERROR_INVALIDDATA; - - s->scale = 1. / (1 << (avctx->bits_per_coded_sample - 1)); - fdsp = avpriv_float_dsp_alloc(0); - if (!fdsp) - return AVERROR(ENOMEM); - s->vector_fmul_scalar = fdsp->vector_fmul_scalar; - av_free(fdsp); - break; - default: - break; +#endif } - avctx->sample_fmt = avctx->codec->sample_fmts[0]; - - if (avctx->sample_fmt == AV_SAMPLE_FMT_S32) - avctx->bits_per_raw_sample = av_get_bits_per_sample(avctx->codec_id); + avctx->sample_fmt = AV_SAMPLE_FMT_S16; + s->base.sample_size = 1; return 0; } @@ -328,23 +408,15 @@ int buf_size = avpkt->size; PCMDecode *s = avctx->priv_data; int channels = avctx->ch_layout.nb_channels; - int sample_size, c, n, ret, samples_per_block; + int sample_size = s->sample_size; + int c, n, ret, samples_per_block; uint8_t *samples; int32_t *dst_int32_t; - sample_size = av_get_bits_per_sample(avctx->codec_id) / 8; - - /* av_get_bits_per_sample returns 0 for AV_CODEC_ID_PCM_DVD */ samples_per_block = 1; if (avctx->codec_id == AV_CODEC_ID_PCM_LXF) { /* we process 40-bit blocks per channel for LXF */ samples_per_block = 2; - sample_size = 5; - } - - if (sample_size == 0) { - av_log(avctx, AV_LOG_ERROR, "Invalid sample_size\n"); - return AVERROR(EINVAL); } if (channels == 0) { @@ -498,14 +570,19 @@ bytestream_get_buffer(&src, samples, n * sample_size); } break; +#if CONFIG_PCM_ALAW_DECODER || CONFIG_PCM_MULAW_DECODER || \ + CONFIG_PCM_VIDC_DECODER case AV_CODEC_ID_PCM_ALAW: case AV_CODEC_ID_PCM_MULAW: - case AV_CODEC_ID_PCM_VIDC: - for (; n > 0; n--) { - AV_WN16A(samples, s->table[*src++]); - samples += 2; - } + case AV_CODEC_ID_PCM_VIDC: { + const int16_t *const lut = ((PCMLUTDecode*)avctx->priv_data)->table; + int16_t *restrict samples_16 = (int16_t*)samples; + + for (; n > 0; n--) + *samples_16++ = lut[*src++]; break; + } +#endif case AV_CODEC_ID_PCM_LXF: { int i; @@ -536,9 +613,10 @@ if (avctx->codec_id == AV_CODEC_ID_PCM_F16LE || avctx->codec_id == AV_CODEC_ID_PCM_F24LE) { - s->vector_fmul_scalar((float *)frame->extended_data[0], - (const float *)frame->extended_data[0], - s->scale, FFALIGN(frame->nb_samples * avctx->ch_layout.nb_channels, 4)); + PCMScaleDecode *s2 = avctx->priv_data; + s2->vector_fmul_scalar((float *)frame->extended_data[0], + (const float *)frame->extended_data[0], + s2->scale, FFALIGN(frame->nb_samples * avctx->ch_layout.nb_channels, 4)); } *got_frame_ptr = 1; @@ -552,13 +630,12 @@ .p.name = #name_, \ CODEC_LONG_NAME(long_name_), \ .p.type = AVMEDIA_TYPE_AUDIO, \ - .p.id = AV_CODEC_ID_ ## id_, \ + .p.id = id_, \ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_VARIABLE_FRAME_SIZE | \ AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE, \ .init = pcm_encode_init, \ FF_CODEC_ENCODE_CB(pcm_encode_frame), \ - .p.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \ - AV_SAMPLE_FMT_NONE }, \ + CODEC_SAMPLEFMTS(sample_fmt_), \ } #define PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) \ @@ -566,65 +643,76 @@ #define PCM_ENCODER_3(cf, id, sample_fmt, name, long_name) \ PCM_ENCODER_2(cf, id, sample_fmt, name, long_name) #define PCM_ENCODER(id, sample_fmt, name, long_name) \ - PCM_ENCODER_3(CONFIG_ ## id ## _ENCODER, id, sample_fmt, name, long_name) + PCM_ENCODER_3(CONFIG_PCM_ ## id ## _ENCODER, AV_CODEC_ID_PCM_ ## id, \ + AV_SAMPLE_FMT_ ## sample_fmt, pcm_ ## name, long_name) -#define PCM_DECODER_0(id, sample_fmt, name, long_name) -#define PCM_DECODER_1(id_, sample_fmt_, name_, long_name_) \ +#define PCM_DECODER_0(id, sample_fmt, name, long_name, Context, init_func) +#define PCM_DECODER_1(id_, sample_fmt, name_, long_name, Context, init_func)\ const FFCodec ff_ ## name_ ## _decoder = { \ .p.name = #name_, \ - CODEC_LONG_NAME(long_name_), \ + CODEC_LONG_NAME(long_name), \ .p.type = AVMEDIA_TYPE_AUDIO, \ - .p.id = AV_CODEC_ID_ ## id_, \ - .priv_data_size = sizeof(PCMDecode), \ - .init = pcm_decode_init, \ + .p.id = id_, \ + .priv_data_size = sizeof(Context), \ + .init = init_func, \ FF_CODEC_DECODE_CB(pcm_decode_frame), \ .p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_PARAM_CHANGE, \ - .p.sample_fmts = (const enum AVSampleFormat[]){ sample_fmt_, \ - AV_SAMPLE_FMT_NONE }, \ } -#define PCM_DECODER_2(cf, id, sample_fmt, name, long_name) \ - PCM_DECODER_ ## cf(id, sample_fmt, name, long_name) -#define PCM_DECODER_3(cf, id, sample_fmt, name, long_name) \ - PCM_DECODER_2(cf, id, sample_fmt, name, long_name) -#define PCM_DECODER(id, sample_fmt, name, long_name) \ - PCM_DECODER_3(CONFIG_ ## id ## _DECODER, id, sample_fmt, name, long_name) +#define PCM_DECODER_2(cf, id, sample_fmt, name, long_name, Context, init_func) \ + PCM_DECODER_ ## cf(id, sample_fmt, name, long_name, Context, init_func) +#define PCM_DECODER_3(cf, id, sample_fmt, name, long_name, Context, init_func) \ + PCM_DECODER_2(cf, id, sample_fmt, name, long_name, Context, init_func) +#define PCM_DEC_EXT(id, sample_fmt, name, long_name, Context, init_func) \ + PCM_DECODER_3(CONFIG_PCM_ ## id ## _DECODER, AV_CODEC_ID_PCM_ ## id, \ + AV_SAMPLE_FMT_ ## sample_fmt, pcm_ ## name, long_name, \ + Context, init_func) + +#define PCM_DECODER(id, sample_fmt, name, long_name) \ + PCM_DEC_EXT(id, sample_fmt, name, long_name, PCMDecode, pcm_decode_init) #define PCM_CODEC(id, sample_fmt_, name, long_name_) \ PCM_ENCODER(id, sample_fmt_, name, long_name_); \ PCM_DECODER(id, sample_fmt_, name, long_name_) -/* Note: Do not forget to add new entries to the Makefile as well. */ -PCM_CODEC (PCM_ALAW, AV_SAMPLE_FMT_S16, pcm_alaw, "PCM A-law / G.711 A-law"); -PCM_DECODER(PCM_F16LE, AV_SAMPLE_FMT_FLT, pcm_f16le, "PCM 16.8 floating point little-endian"); -PCM_DECODER(PCM_F24LE, AV_SAMPLE_FMT_FLT, pcm_f24le, "PCM 24.0 floating point little-endian"); -PCM_CODEC (PCM_F32BE, AV_SAMPLE_FMT_FLT, pcm_f32be, "PCM 32-bit floating point big-endian"); -PCM_CODEC (PCM_F32LE, AV_SAMPLE_FMT_FLT, pcm_f32le, "PCM 32-bit floating point little-endian"); -PCM_CODEC (PCM_F64BE, AV_SAMPLE_FMT_DBL, pcm_f64be, "PCM 64-bit floating point big-endian"); -PCM_CODEC (PCM_F64LE, AV_SAMPLE_FMT_DBL, pcm_f64le, "PCM 64-bit floating point little-endian"); -PCM_DECODER(PCM_LXF, AV_SAMPLE_FMT_S32P,pcm_lxf, "PCM signed 20-bit little-endian planar"); -PCM_CODEC (PCM_MULAW, AV_SAMPLE_FMT_S16, pcm_mulaw, "PCM mu-law / G.711 mu-law"); -PCM_CODEC (PCM_S8, AV_SAMPLE_FMT_U8, pcm_s8, "PCM signed 8-bit"); -PCM_CODEC (PCM_S8_PLANAR, AV_SAMPLE_FMT_U8P, pcm_s8_planar, "PCM signed 8-bit planar"); -PCM_CODEC (PCM_S16BE, AV_SAMPLE_FMT_S16, pcm_s16be, "PCM signed 16-bit big-endian"); -PCM_CODEC (PCM_S16BE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16be_planar, "PCM signed 16-bit big-endian planar"); -PCM_CODEC (PCM_S16LE, AV_SAMPLE_FMT_S16, pcm_s16le, "PCM signed 16-bit little-endian"); -PCM_CODEC (PCM_S16LE_PLANAR, AV_SAMPLE_FMT_S16P,pcm_s16le_planar, "PCM signed 16-bit little-endian planar"); -PCM_CODEC (PCM_S24BE, AV_SAMPLE_FMT_S32, pcm_s24be, "PCM signed 24-bit big-endian"); -PCM_CODEC (PCM_S24DAUD, AV_SAMPLE_FMT_S16, pcm_s24daud, "PCM D-Cinema audio signed 24-bit"); -PCM_CODEC (PCM_S24LE, AV_SAMPLE_FMT_S32, pcm_s24le, "PCM signed 24-bit little-endian"); -PCM_CODEC (PCM_S24LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s24le_planar, "PCM signed 24-bit little-endian planar"); -PCM_CODEC (PCM_S32BE, AV_SAMPLE_FMT_S32, pcm_s32be, "PCM signed 32-bit big-endian"); -PCM_CODEC (PCM_S32LE, AV_SAMPLE_FMT_S32, pcm_s32le, "PCM signed 32-bit little-endian"); -PCM_CODEC (PCM_S32LE_PLANAR, AV_SAMPLE_FMT_S32P,pcm_s32le_planar, "PCM signed 32-bit little-endian planar"); -PCM_CODEC (PCM_U8, AV_SAMPLE_FMT_U8, pcm_u8, "PCM unsigned 8-bit"); -PCM_CODEC (PCM_U16BE, AV_SAMPLE_FMT_S16, pcm_u16be, "PCM unsigned 16-bit big-endian"); -PCM_CODEC (PCM_U16LE, AV_SAMPLE_FMT_S16, pcm_u16le, "PCM unsigned 16-bit little-endian"); -PCM_CODEC (PCM_U24BE, AV_SAMPLE_FMT_S32, pcm_u24be, "PCM unsigned 24-bit big-endian"); -PCM_CODEC (PCM_U24LE, AV_SAMPLE_FMT_S32, pcm_u24le, "PCM unsigned 24-bit little-endian"); -PCM_CODEC (PCM_U32BE, AV_SAMPLE_FMT_S32, pcm_u32be, "PCM unsigned 32-bit big-endian"); -PCM_CODEC (PCM_U32LE, AV_SAMPLE_FMT_S32, pcm_u32le, "PCM unsigned 32-bit little-endian"); -PCM_CODEC (PCM_S64BE, AV_SAMPLE_FMT_S64, pcm_s64be, "PCM signed 64-bit big-endian"); -PCM_CODEC (PCM_S64LE, AV_SAMPLE_FMT_S64, pcm_s64le, "PCM signed 64-bit little-endian"); -PCM_CODEC (PCM_VIDC, AV_SAMPLE_FMT_S16, pcm_vidc, "PCM Archimedes VIDC"); -PCM_DECODER(PCM_SGA, AV_SAMPLE_FMT_U8, pcm_sga, "PCM SGA"); +#define PCM_CODEC_EXT(id, sample_fmt, name, long_name, DecContext, dec_init_func) \ + PCM_DEC_EXT(id, sample_fmt, name, long_name, DecContext, dec_init_func); \ + PCM_ENCODER(id, sample_fmt, name, long_name) + +/* Note: Do not forget to add new entries to the Makefile and + * to the table in pcm_decode_init() as well. */ +// AV_CODEC_ID_* pcm_* name +// AV_SAMPLE_FMT_* long name DecodeContext decode init func +PCM_CODEC_EXT(ALAW, S16, alaw, "PCM A-law / G.711 A-law", PCMLUTDecode, pcm_lut_decode_init); +PCM_DEC_EXT (F16LE, FLT, f16le, "PCM 16.8 floating point little-endian", PCMScaleDecode, pcm_scale_decode_init); +PCM_DEC_EXT (F24LE, FLT, f24le, "PCM 24.0 floating point little-endian", PCMScaleDecode, pcm_scale_decode_init); +PCM_CODEC (F32BE, FLT, f32be, "PCM 32-bit floating point big-endian"); +PCM_CODEC (F32LE, FLT, f32le, "PCM 32-bit floating point little-endian"); +PCM_CODEC (F64BE, DBL, f64be, "PCM 64-bit floating point big-endian"); +PCM_CODEC (F64LE, DBL, f64le, "PCM 64-bit floating point little-endian"); +PCM_DECODER (LXF, S32P,lxf, "PCM signed 20-bit little-endian planar"); +PCM_CODEC_EXT(MULAW, S16, mulaw, "PCM mu-law / G.711 mu-law", PCMLUTDecode, pcm_lut_decode_init); +PCM_CODEC (S8, U8, s8, "PCM signed 8-bit"); +PCM_CODEC (S8_PLANAR, U8P, s8_planar, "PCM signed 8-bit planar"); +PCM_CODEC (S16BE, S16, s16be, "PCM signed 16-bit big-endian"); +PCM_CODEC (S16BE_PLANAR, S16P,s16be_planar, "PCM signed 16-bit big-endian planar"); +PCM_CODEC (S16LE, S16, s16le, "PCM signed 16-bit little-endian"); +PCM_CODEC (S16LE_PLANAR, S16P,s16le_planar, "PCM signed 16-bit little-endian planar"); +PCM_CODEC (S24BE, S32, s24be, "PCM signed 24-bit big-endian"); +PCM_CODEC (S24DAUD, S16, s24daud, "PCM D-Cinema audio signed 24-bit"); +PCM_CODEC (S24LE, S32, s24le, "PCM signed 24-bit little-endian"); +PCM_CODEC (S24LE_PLANAR, S32P,s24le_planar, "PCM signed 24-bit little-endian planar"); +PCM_CODEC (S32BE, S32, s32be, "PCM signed 32-bit big-endian"); +PCM_CODEC (S32LE, S32, s32le, "PCM signed 32-bit little-endian"); +PCM_CODEC (S32LE_PLANAR, S32P,s32le_planar, "PCM signed 32-bit little-endian planar"); +PCM_CODEC (U8, U8, u8, "PCM unsigned 8-bit"); +PCM_CODEC (U16BE, S16, u16be, "PCM unsigned 16-bit big-endian"); +PCM_CODEC (U16LE, S16, u16le, "PCM unsigned 16-bit little-endian"); +PCM_CODEC (U24BE, S32, u24be, "PCM unsigned 24-bit big-endian"); +PCM_CODEC (U24LE, S32, u24le, "PCM unsigned 24-bit little-endian"); +PCM_CODEC (U32BE, S32, u32be, "PCM unsigned 32-bit big-endian"); +PCM_CODEC (U32LE, S32, u32le, "PCM unsigned 32-bit little-endian"); +PCM_CODEC (S64BE, S64, s64be, "PCM signed 64-bit big-endian"); +PCM_CODEC (S64LE, S64, s64le, "PCM signed 64-bit little-endian"); +PCM_CODEC_EXT(VIDC, S16, vidc, "PCM Archimedes VIDC", PCMLUTDecode, pcm_lut_decode_init); +PCM_DECODER (SGA, U8, sga, "PCM SGA"); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pcm_tablegen.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm_tablegen.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pcm_tablegen.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pcm_tablegen.h 2026-04-29 18:38:25.000000000 +0000 @@ -24,6 +24,7 @@ #define AVCODEC_PCM_TABLEGEN_H #include +#include "config_components.h" #include "libavutil/attributes.h" /* from g711.c by SUN microsystems (unrestricted use) */ @@ -42,6 +43,7 @@ #define VIDC_SEG_SHIFT (5) #define VIDC_SEG_MASK (0xE0) +#if CONFIG_PCM_ALAW_DECODER || CONFIG_PCM_ALAW_ENCODER /* alaw2linear() - Convert an A-law value to 16-bit linear PCM */ static av_cold int alaw2linear(unsigned char a_val) { @@ -57,7 +59,9 @@ return (a_val & SIGN_BIT) ? t : -t; } +#endif +#if CONFIG_PCM_MULAW_DECODER || CONFIG_PCM_MULAW_ENCODER static av_cold int ulaw2linear(unsigned char u_val) { int t; @@ -74,7 +78,9 @@ return (u_val & SIGN_BIT) ? (BIAS - t) : (t - BIAS); } +#endif +#if CONFIG_PCM_VIDC_DECODER || CONFIG_PCM_VIDC_ENCODER static av_cold int vidc2linear(unsigned char u_val) { int t; @@ -88,6 +94,7 @@ return (u_val & VIDC_SIGN_BIT) ? (BIAS - t) : (t - BIAS); } +#endif #if CONFIG_HARDCODED_TABLES #define pcm_alaw_tableinit() @@ -95,11 +102,9 @@ #define pcm_vidc_tableinit() #include "libavcodec/pcm_tables.h" #else -/* 16384 entries per table */ -static uint8_t linear_to_alaw[16384]; -static uint8_t linear_to_ulaw[16384]; -static uint8_t linear_to_vidc[16384]; +#if CONFIG_PCM_ALAW_ENCODER || CONFIG_PCM_MULAW_ENCODER || \ + CONFIG_PCM_VIDC_ENCODER static av_cold void build_xlaw_table(uint8_t *linear_to_xlaw, int (*xlaw2linear)(unsigned char), int mask) @@ -123,21 +128,31 @@ } linear_to_xlaw[0] = linear_to_xlaw[1]; } +#endif +#if CONFIG_PCM_ALAW_ENCODER +static uint8_t linear_to_alaw[16384]; static void pcm_alaw_tableinit(void) { build_xlaw_table(linear_to_alaw, alaw2linear, 0xd5); } +#endif +#if CONFIG_PCM_MULAW_ENCODER +static uint8_t linear_to_ulaw[16384]; static void pcm_ulaw_tableinit(void) { build_xlaw_table(linear_to_ulaw, ulaw2linear, 0xff); } +#endif +#if CONFIG_PCM_VIDC_ENCODER +static uint8_t linear_to_vidc[16384]; static void pcm_vidc_tableinit(void) { build_xlaw_table(linear_to_vidc, vidc2linear, 0xff); } +#endif #endif /* CONFIG_HARDCODED_TABLES */ #endif /* AVCODEC_PCM_TABLEGEN_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pixblockdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixblockdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pixblockdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixblockdsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -19,13 +19,17 @@ #ifndef AVCODEC_PIXBLOCKDSP_H #define AVCODEC_PIXBLOCKDSP_H +#include #include -#include "avcodec.h" +#define PIXBLOCKDSP_8BPP_GET_PIXELS_SUPPORTS_UNALIGNED \ + !(ARCH_ARM || ARCH_MIPS || ARCH_PPC || ARCH_RISCV) typedef struct PixblockDSPContext { void (*get_pixels)(int16_t *restrict block /* align 16 */, - const uint8_t *pixels /* align 8 */, + /* align 16 for > 8 bits; align 8 for <= 8 bits + * (or 1 if PIXBLOCKDSP_8BPP_GET_PIXELS_SUPPORTS_UNALIGNED is set) */ + const uint8_t *pixels, ptrdiff_t stride); void (*get_pixels_unaligned)(int16_t *restrict block /* align 16 */, const uint8_t *pixels, @@ -41,20 +45,18 @@ } PixblockDSPContext; -void ff_pixblockdsp_init(PixblockDSPContext *c, AVCodecContext *avctx); -void ff_pixblockdsp_init_aarch64(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init(PixblockDSPContext *c, int bits_per_raw_sample); +void ff_pixblockdsp_init_aarch64(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_alpha(PixblockDSPContext *c, AVCodecContext *avctx, - unsigned high_bit_depth); -void ff_pixblockdsp_init_arm(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init_arm(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_ppc(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init_ppc(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init_riscv(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_x86(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init_x86(PixblockDSPContext *c, unsigned high_bit_depth); -void ff_pixblockdsp_init_mips(PixblockDSPContext *c, AVCodecContext *avctx, +void ff_pixblockdsp_init_mips(PixblockDSPContext *c, unsigned high_bit_depth); #endif /* AVCODEC_PIXBLOCKDSP_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pixels.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixels.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pixels.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pixels.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * 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 + */ + +#ifndef AVCODEC_PIXELS_H +#define AVCODEC_PIXELS_H + +#include +#include + +/* pixel operations */ +#define CALL_2X_PIXELS_MACRO(STATIC, a, b, n) \ +STATIC void a(uint8_t *block, const uint8_t *pixels, \ + ptrdiff_t line_size, int h) \ +{ \ + b(block, pixels, line_size, h); \ + b(block + n, pixels + n, line_size, h); \ +} + +#define CALL_2X_PIXELS(a, b, n) CALL_2X_PIXELS_MACRO(static, a, b, n) +#define CALL_2X_PIXELS_EXPORT(a, b, n) CALL_2X_PIXELS_MACRO(, a, b, n) + +#endif /* AVCODEC_PIXELS_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/profiles.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/profiles.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.c 2026-04-29 18:38:26.000000000 +0000 @@ -182,6 +182,12 @@ { AV_PROFILE_UNKNOWN } }; +const AVProfile ff_prores_raw_profiles[] = { + { AV_PROFILE_PRORES_RAW, "RAW" }, + { AV_PROFILE_PRORES_RAW_HQ, "RAW HQ" }, + { AV_PROFILE_UNKNOWN } +}; + const AVProfile ff_mjpeg_profiles[] = { { AV_PROFILE_MJPEG_HUFFMAN_BASELINE_DCT, "Baseline" }, { AV_PROFILE_MJPEG_HUFFMAN_EXTENDED_SEQUENTIAL_DCT, "Sequential" }, @@ -203,4 +209,15 @@ { AV_PROFILE_UNKNOWN }, }; +const AVProfile ff_apv_profiles[] = { + { AV_PROFILE_APV_422_10, "422-10" }, + { AV_PROFILE_APV_422_12, "422-12" }, + { AV_PROFILE_APV_444_10, "444-10" }, + { AV_PROFILE_APV_444_12, "444-12" }, + { AV_PROFILE_APV_4444_10, "4444-10" }, + { AV_PROFILE_APV_4444_12, "4444-12" }, + { AV_PROFILE_APV_400_10, "400-10" }, + { AV_PROFILE_UNKNOWN }, +}; + #endif /* !CONFIG_SMALL */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/profiles.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/profiles.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/profiles.h 2026-04-29 18:38:26.000000000 +0000 @@ -74,8 +74,10 @@ extern const AVProfile ff_av1_profiles[]; extern const AVProfile ff_sbc_profiles[]; extern const AVProfile ff_prores_profiles[]; +extern const AVProfile ff_prores_raw_profiles[]; extern const AVProfile ff_mjpeg_profiles[]; extern const AVProfile ff_arib_caption_profiles[]; extern const AVProfile ff_evc_profiles[]; +extern const AVProfile ff_apv_profiles[]; #endif /* AVCODEC_PROFILES_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/progressframe.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/progressframe.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/progressframe.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/progressframe.h 2026-04-29 18:38:26.000000000 +0000 @@ -102,10 +102,9 @@ void ff_progress_frame_await(const ProgressFrame *f, int progress); /** - * This function allocates ProgressFrame.f - * May be called before ff_progress_frame_get_buffer() in the cases where the - * AVFrame needs to be accessed before the ff_thread_get_buffer() call in - * ff_progress_frame_alloc(). + * This function sets up the ProgressFrame, i.e. ProgressFrame.f + * and ProgressFrame.progress. ProgressFrame.f will be blank + * (as if from av_frame_alloc() or av_frame_unref()) on success. * * @note: This must only be called by codecs with the * FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap. @@ -113,8 +112,7 @@ int ff_progress_frame_alloc(struct AVCodecContext *avctx, ProgressFrame *f); /** - * This function sets up the ProgressFrame, i.e. allocates ProgressFrame.f - * if needed, and also calls ff_thread_get_buffer() on the frame. + * Wrapper around ff_progress_frame_alloc() and ff_thread_get_buffer(). * * @note: This must only be called by codecs with the * FF_CODEC_CAP_USES_PROGRESSFRAMES internal cap. diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread.c 2026-04-29 18:38:26.000000000 +0000 @@ -29,13 +29,13 @@ * @see doc/multithreading.txt */ +#include "libavutil/attributes.h" #include "libavutil/thread.h" #include "avcodec.h" #include "avcodec_internal.h" #include "codec_internal.h" #include "pthread_internal.h" -#include "thread.h" /** * Set the threading algorithms used. @@ -46,7 +46,7 @@ * * @param avctx The context. */ -static void validate_thread_parameters(AVCodecContext *avctx) +static av_cold void validate_thread_parameters(AVCodecContext *avctx) { int frame_threading_supported = (avctx->codec->capabilities & AV_CODEC_CAP_FRAME_THREADS) && !(avctx->flags & AV_CODEC_FLAG_LOW_DELAY) @@ -69,7 +69,7 @@ avctx->thread_count, MAX_AUTO_THREADS); } -int ff_thread_init(AVCodecContext *avctx) +av_cold int ff_thread_init(AVCodecContext *avctx) { validate_thread_parameters(avctx); @@ -81,7 +81,7 @@ return 0; } -void ff_thread_free(AVCodecContext *avctx) +av_cold void ff_thread_free(AVCodecContext *avctx) { if (avctx->active_thread_type&FF_THREAD_FRAME) ff_frame_thread_free(avctx, avctx->thread_count); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread_frame.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_frame.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread_frame.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_frame.c 2026-04-29 18:38:26.000000000 +0000 @@ -115,10 +115,6 @@ int hwaccel_threadsafe; atomic_int debug_threads; ///< Set if the FF_DEBUG_THREADS option is set. - - /// The following two fields have the same semantics as the DecodeContext field - int intra_only_flag; - enum AVPictureType initial_pict_type; } PerThreadContext; /** @@ -378,13 +374,10 @@ dst->level = src->level; dst->bits_per_raw_sample = src->bits_per_raw_sample; -#if FF_API_TICKS_PER_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - dst->ticks_per_frame = src->ticks_per_frame; -FF_ENABLE_DEPRECATION_WARNINGS -#endif dst->color_primaries = src->color_primaries; + dst->alpha_mode = src->alpha_mode; + dst->color_trc = src->color_trc; dst->colorspace = src->colorspace; dst->color_range = src->color_range; @@ -567,7 +560,7 @@ return 0; } -int ff_thread_receive_frame(AVCodecContext *avctx, AVFrame *frame) +int ff_thread_receive_frame(AVCodecContext *avctx, AVFrame *frame, unsigned flags) { FrameThreadContext *fctx = avctx->internal->thread_ctx; int ret = 0; @@ -580,6 +573,10 @@ while (!fctx->df.nb_f && !fctx->result) { PerThreadContext *p; + if (fctx->next_decoding != fctx->next_finished && + (flags & AV_CODEC_RECEIVE_FRAME_FLAG_SYNCHRONOUS)) + goto wait_for_result; + /* get a packet to be submitted to the next thread */ av_packet_unref(fctx->next_pkt); ret = ff_decode_get_packet(avctx, fctx->next_pkt); @@ -596,6 +593,7 @@ !avctx->internal->draining) continue; + wait_for_result: p = &fctx->threads[fctx->next_finished]; fctx->next_finished = (fctx->next_finished + 1) % avctx->thread_count; @@ -718,7 +716,7 @@ } /// Waits for all threads to finish. -static void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count) +static av_cold void park_frame_worker_threads(FrameThreadContext *fctx, int thread_count) { int i; @@ -750,7 +748,7 @@ (OFF(input_cond), OFF(progress_cond), OFF(output_cond))); #undef OFF -void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) +av_cold void ff_frame_thread_free(AVCodecContext *avctx, int thread_count) { FrameThreadContext *fctx = avctx->internal->thread_ctx; const FFCodec *codec = ffcodec(avctx->codec); @@ -825,13 +823,6 @@ AVCodecContext *copy; int err; - p->initial_pict_type = AV_PICTURE_TYPE_NONE; - if (avctx->codec_descriptor->props & AV_CODEC_PROP_INTRA_ONLY) { - p->intra_only_flag = AV_FRAME_FLAG_KEY; - if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) - p->initial_pict_type = AV_PICTURE_TYPE_I; - } - atomic_init(&p->state, STATE_INPUT_READY); copy = av_memdup(avctx, sizeof(*avctx)); @@ -922,7 +913,7 @@ return 0; } -int ff_frame_thread_init(AVCodecContext *avctx) +av_cold int ff_frame_thread_init(AVCodecContext *avctx) { int thread_count = avctx->thread_count; const FFCodec *codec = ffcodec(avctx->codec); @@ -985,7 +976,7 @@ return err; } -void ff_thread_flush(AVCodecContext *avctx) +av_cold void ff_thread_flush(AVCodecContext *avctx) { int i; FrameThreadContext *fctx = avctx->internal->thread_ctx; @@ -1087,7 +1078,7 @@ av_frame_unref(f->f); } -enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset) +av_cold enum ThreadingStatus ff_thread_sync_ref(AVCodecContext *avctx, size_t offset) { PerThreadContext *p; const void *ref; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread_slice.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_slice.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/pthread_slice.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/pthread_slice.c 2026-04-29 18:38:26.000000000 +0000 @@ -22,19 +22,16 @@ * @see doc/multithreading.txt */ -#include "config.h" - #include "avcodec.h" #include "codec_internal.h" #include "internal.h" #include "pthread_internal.h" #include "thread.h" -#include "libavutil/avassert.h" -#include "libavutil/common.h" +#include "libavutil/attributes.h" #include "libavutil/cpu.h" +#include "libavutil/macros.h" #include "libavutil/mem.h" -#include "libavutil/thread.h" #include "libavutil/slicethread.h" typedef int (action_func)(AVCodecContext *c, void *arg); @@ -69,7 +66,7 @@ c->rets[jobnr] = ret; } -void ff_slice_thread_free(AVCodecContext *avctx) +av_cold void ff_slice_thread_free(AVCodecContext *avctx) { SliceThreadContext *c = avctx->internal->thread_ctx; @@ -112,18 +109,12 @@ return thread_execute(avctx, NULL, arg, ret, job_count, 0); } -int ff_slice_thread_init(AVCodecContext *avctx) +av_cold int ff_slice_thread_init(AVCodecContext *avctx) { SliceThreadContext *c; int thread_count = avctx->thread_count; void (*mainfunc)(void *); - // We cannot do this in the encoder init as the threads are created before - if (av_codec_is_encoder(avctx->codec) && - avctx->codec_id == AV_CODEC_ID_MPEG1VIDEO && - avctx->height > 2800) - thread_count = avctx->thread_count = 1; - if (!thread_count) { int nb_cpus = av_cpu_count(); if (avctx->height) @@ -141,14 +132,16 @@ } avctx->internal->thread_ctx = c = av_mallocz(sizeof(*c)); + if (!c) + return AVERROR(ENOMEM); mainfunc = ffcodec(avctx->codec)->caps_internal & FF_CODEC_CAP_SLICE_THREAD_HAS_MF ? &main_function : NULL; - if (!c || (thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, mainfunc, thread_count)) <= 1) { - if (c) - avpriv_slicethread_free(&c->thread); - av_freep(&avctx->internal->thread_ctx); + thread_count = avpriv_slicethread_create(&c->thread, avctx, worker_func, + mainfunc, thread_count); + if (thread_count <= 1) { + ff_slice_thread_free(avctx); avctx->thread_count = 1; avctx->active_thread_type = 0; - return 0; + return thread_count < 0 ? thread_count : 0; } avctx->thread_count = thread_count; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/put_bits.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/put_bits.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/put_bits.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/put_bits.h 2026-04-29 18:38:25.000000000 +0000 @@ -39,14 +39,14 @@ typedef uint64_t BitBuf; #define AV_WBBUF AV_WB64 #define AV_WLBUF AV_WL64 +#define BUF_BITS 64 #else typedef uint32_t BitBuf; #define AV_WBBUF AV_WB32 #define AV_WLBUF AV_WL32 +#define BUF_BITS 32 #endif -static const int BUF_BITS = 8 * sizeof(BitBuf); - typedef struct PutBitContext { BitBuf bit_buf; int bit_left; @@ -75,6 +75,16 @@ } /** + * Inform the compiler that a PutBitContext is flushed (i.e. if it has just + * been initialized or flushed). Undefined behaviour occurs if this is used + * with a PutBitContext for which this is not true. + */ +static inline void put_bits_assume_flushed(const PutBitContext *s) +{ + av_assume(s->bit_left == BUF_BITS); +} + +/** * @return the total number of bits written to the bitstream. */ static inline int put_bits_count(PutBitContext *s) @@ -246,7 +256,7 @@ */ static inline void put_bits(PutBitContext *s, int n, BitBuf value) { - av_assert2(n <= 31 && value < (1UL << n)); + av_assert2(n <= 31 && value < (BitBuf)(1U << n)); put_bits_no_assert(s, n, value); } @@ -255,7 +265,7 @@ BitBuf bit_buf; int bit_left; - av_assert2(n <= 31 && value < (1UL << n)); + av_assert2(n <= 31 && value < (BitBuf)(1U << n)); bit_buf = s->bit_buf; bit_left = s->bit_left; @@ -288,7 +298,7 @@ /** * Write exactly 32 bits into a bitstream. */ -static void av_unused put_bits32(PutBitContext *s, uint32_t value) +av_unused static void put_bits32(PutBitContext *s, uint32_t value) { BitBuf bit_buf; int bit_left; @@ -329,12 +339,15 @@ } /** - * Write up to 64 bits into a bitstream. + * Write up to 63 bits into a bitstream. */ -static inline void put_bits64(PutBitContext *s, int n, uint64_t value) +static inline void put_bits63(PutBitContext *s, int n, uint64_t value) { - av_assert2((n == 64) || (n < 64 && value < (UINT64_C(1) << n))); + av_assert2(n < 64U && value < (UINT64_C(1) << n)); +#if BUF_BITS >= 64 + put_bits_no_assert(s, n, value); +#else if (n < 32) put_bits(s, n, value); else if (n == 32) @@ -349,6 +362,19 @@ put_bits(s, n - 32, hi); put_bits32(s, lo); #endif + } +#endif +} + +/** + * Write up to 64 bits into a bitstream. + */ +static inline void put_bits64(PutBitContext *s, int n, uint64_t value) +{ + av_assert2((n == 64) || (n < 64 && value < (UINT64_C(1) << n))); + + if (n < 64) { + put_bits63(s, n, value); } else { uint32_t lo = value & 0xffffffff; uint32_t hi = value >> 32; @@ -359,7 +385,6 @@ put_bits32(s, hi); put_bits32(s, lo); #endif - } } @@ -367,7 +392,7 @@ { av_assert2(n >= 0 && n < 64); - put_bits64(pb, n, (uint64_t)(value) & (~(UINT64_MAX << n))); + put_bits63(pb, n, (uint64_t)(value) & (~(UINT64_MAX << n))); } /** diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/ratecontrol.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/ratecontrol.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/ratecontrol.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/ratecontrol.h 2026-04-29 18:38:25.000000000 +0000 @@ -77,17 +77,30 @@ int frame_count[5]; int last_non_b_pict_type; + /** + * ratecontrol qmin qmax limiting method + * 0-> clipping, 1-> use a nice continuous function to limit qscale within qmin/qmax. + */ + float qsquish; + float qmod_amp; + int qmod_freq; + float initial_cplx; + float buffer_aggressivity; + + char *rc_eq; struct AVExpr *rc_eq_eval; + + float *cplx_tab, *bits_tab; }RateControlContext; -struct MpegEncContext; +typedef struct MPVMainEncContext MPVMainEncContext; /* rate control */ -int ff_rate_control_init(struct MpegEncContext *s); -float ff_rate_estimate_qscale(struct MpegEncContext *s, int dry_run); -void ff_write_pass1_stats(struct MpegEncContext *s); -int ff_vbv_update(struct MpegEncContext *s, int frame_size); -void ff_get_2pass_fcode(struct MpegEncContext *s); +int ff_rate_control_init(MPVMainEncContext *m); +float ff_rate_estimate_qscale(MPVMainEncContext *m, int dry_run); +void ff_write_pass1_stats(MPVMainEncContext *m); +int ff_vbv_update(MPVMainEncContext *m, int frame_size); +void ff_get_2pass_fcode(MPVMainEncContext *m); void ff_rate_control_uninit(RateControlContext *rcc); #endif /* AVCODEC_RATECONTROL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.c 2026-04-29 18:38:25.000000000 +0000 @@ -24,294 +24,9 @@ * Raw Video Codec */ -#include "libavutil/macros.h" #include "avcodec.h" #include "raw.h" - -static const PixelFormatTag raw_pix_fmt_tags[] = { - { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ - { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, - { AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') }, - { AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') }, - { AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, - { AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') }, - { AV_PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, - { AV_PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, - { AV_PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') }, - { AV_PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') }, - /* yuvjXXX formats are deprecated hacks specific to libav*, - they are identical to yuvXXX */ - { AV_PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ - { AV_PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') }, - { AV_PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') }, - { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, - { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') }, - - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */ - { AV_PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') }, - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') }, - { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', 'V') }, - { AV_PIX_FMT_YVYU422, MKTAG('Y', 'V', 'Y', 'U') }, /* Philips */ - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, - { AV_PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') }, - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') }, - { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') }, - { AV_PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') }, - { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') }, - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */ - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */ - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') }, - { AV_PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */ - { AV_PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') }, - { AV_PIX_FMT_UYVY422, MKTAG('c', 'y', 'u', 'v') }, /* CYUV is also Creative YUV */ - { AV_PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') }, - { AV_PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, - { AV_PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') }, - { AV_PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') }, - { AV_PIX_FMT_VUYA, MKTAG('A', 'Y', 'U', 'V') }, /* MS 4:4:4:4 */ - { AV_PIX_FMT_XV30LE, MKTAG('Y', '4', '1', '0') }, - { AV_PIX_FMT_XV48LE, MKTAG('Y', '4', '1', '6') }, - { AV_PIX_FMT_Y210LE, MKTAG('Y', '2', '1', '0') }, - { AV_PIX_FMT_Y216LE, MKTAG('Y', '2', '1', '6') }, - - /* nut */ - { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) }, - { AV_PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) }, - { AV_PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) }, - { AV_PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) }, - { AV_PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) }, - { AV_PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) }, - { AV_PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') }, - { AV_PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGBA64LE, MKTAG('R', 'B', 'A', 64 ) }, - { AV_PIX_FMT_BGRA64LE, MKTAG('B', 'R', 'A', 64 ) }, - { AV_PIX_FMT_RGBA64BE, MKTAG(64 , 'R', 'B', 'A') }, - { AV_PIX_FMT_BGRA64BE, MKTAG(64 , 'B', 'R', 'A') }, - { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, - { AV_PIX_FMT_RGB0, MKTAG('R', 'G', 'B', 0 ) }, - { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, - { AV_PIX_FMT_BGR0, MKTAG('B', 'G', 'R', 0 ) }, - { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, - { AV_PIX_FMT_0BGR, MKTAG( 0 , 'B', 'G', 'R') }, - { AV_PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') }, - { AV_PIX_FMT_0RGB, MKTAG( 0 , 'R', 'G', 'B') }, - { AV_PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) }, - { AV_PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) }, - { AV_PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') }, - { AV_PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') }, - { AV_PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') }, - { AV_PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') }, - { AV_PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') }, - { AV_PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') }, - { AV_PIX_FMT_MONOWHITE,MKTAG('B', '1', 'W', '0') }, - { AV_PIX_FMT_MONOBLACK,MKTAG('B', '0', 'W', '1') }, - { AV_PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) }, - { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) }, - { AV_PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) }, - { AV_PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) }, - { AV_PIX_FMT_RGB4_BYTE,MKTAG('B', '4', 'B', 'Y') }, - { AV_PIX_FMT_BGR4_BYTE,MKTAG('R', '4', 'B', 'Y') }, - { AV_PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) }, - { AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') }, - { AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) }, - { AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') }, - { AV_PIX_FMT_GRAY9LE, MKTAG('Y', '1', 0 , 9 ) }, - { AV_PIX_FMT_GRAY9BE, MKTAG( 9 , 0 , '1', 'Y') }, - { AV_PIX_FMT_GRAY10LE, MKTAG('Y', '1', 0 , 10 ) }, - { AV_PIX_FMT_GRAY10BE, MKTAG(10 , 0 , '1', 'Y') }, - { AV_PIX_FMT_GRAY12LE, MKTAG('Y', '1', 0 , 12 ) }, - { AV_PIX_FMT_GRAY12BE, MKTAG(12 , 0 , '1', 'Y') }, - { AV_PIX_FMT_GRAY14LE, MKTAG('Y', '1', 0 , 14 ) }, - { AV_PIX_FMT_GRAY14BE, MKTAG(14 , 0 , '1', 'Y') }, - { AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) }, - { AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') }, - { AV_PIX_FMT_YUV420P9LE, MKTAG('Y', '3', 11 , 9 ) }, - { AV_PIX_FMT_YUV420P9BE, MKTAG( 9 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P9LE, MKTAG('Y', '3', 10 , 9 ) }, - { AV_PIX_FMT_YUV422P9BE, MKTAG( 9 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P9LE, MKTAG('Y', '3', 0 , 9 ) }, - { AV_PIX_FMT_YUV444P9BE, MKTAG( 9 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) }, - { AV_PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) }, - { AV_PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) }, - { AV_PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P12LE, MKTAG('Y', '3', 11 , 12 ) }, - { AV_PIX_FMT_YUV420P12BE, MKTAG(12 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P12LE, MKTAG('Y', '3', 10 , 12 ) }, - { AV_PIX_FMT_YUV422P12BE, MKTAG(12 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P12LE, MKTAG('Y', '3', 0 , 12 ) }, - { AV_PIX_FMT_YUV444P12BE, MKTAG(12 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P14LE, MKTAG('Y', '3', 11 , 14 ) }, - { AV_PIX_FMT_YUV420P14BE, MKTAG(14 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P14LE, MKTAG('Y', '3', 10 , 14 ) }, - { AV_PIX_FMT_YUV422P14BE, MKTAG(14 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P14LE, MKTAG('Y', '3', 0 , 14 ) }, - { AV_PIX_FMT_YUV444P14BE, MKTAG(14 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) }, - { AV_PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') }, - { AV_PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) }, - { AV_PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') }, - { AV_PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) }, - { AV_PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') }, - { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) }, - { AV_PIX_FMT_YUVA422P, MKTAG('Y', '4', 10 , 8 ) }, - { AV_PIX_FMT_YUVA444P, MKTAG('Y', '4', 0 , 8 ) }, - { AV_PIX_FMT_YA8, MKTAG('Y', '2', 0 , 8 ) }, - { AV_PIX_FMT_PAL8, MKTAG('P', 'A', 'L', 8 ) }, - - { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) }, - { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) }, - { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) }, - { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) }, - { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) }, - { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) }, - { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P12LE, MKTAG('Y', '4', 10 , 12 ) }, - { AV_PIX_FMT_YUVA422P12BE, MKTAG(12 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P12LE, MKTAG('Y', '4', 0 , 12 ) }, - { AV_PIX_FMT_YUVA444P12BE, MKTAG(12 , 0 , '4', 'Y') }, - { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) }, - { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') }, - { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) }, - { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') }, - { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) }, - { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') }, - - { AV_PIX_FMT_GBRP, MKTAG('G', '3', 00 , 8 ) }, - { AV_PIX_FMT_GBRP9LE, MKTAG('G', '3', 00 , 9 ) }, - { AV_PIX_FMT_GBRP9BE, MKTAG( 9 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP10LE, MKTAG('G', '3', 00 , 10 ) }, - { AV_PIX_FMT_GBRP10BE, MKTAG(10 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP12LE, MKTAG('G', '3', 00 , 12 ) }, - { AV_PIX_FMT_GBRP12BE, MKTAG(12 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP14LE, MKTAG('G', '3', 00 , 14 ) }, - { AV_PIX_FMT_GBRP14BE, MKTAG(14 , 00 , '3', 'G') }, - { AV_PIX_FMT_GBRP16LE, MKTAG('G', '3', 00 , 16 ) }, - { AV_PIX_FMT_GBRP16BE, MKTAG(16 , 00 , '3', 'G') }, - - { AV_PIX_FMT_GBRAP, MKTAG('G', '4', 00 , 8 ) }, - { AV_PIX_FMT_GBRAP10LE, MKTAG('G', '4', 00 , 10 ) }, - { AV_PIX_FMT_GBRAP10BE, MKTAG(10 , 00 , '4', 'G') }, - { AV_PIX_FMT_GBRAP12LE, MKTAG('G', '4', 00 , 12 ) }, - { AV_PIX_FMT_GBRAP12BE, MKTAG(12 , 00 , '4', 'G') }, - { AV_PIX_FMT_GBRAP14LE, MKTAG('G', '4', 00 , 14 ) }, - { AV_PIX_FMT_GBRAP14BE, MKTAG(14 , 00 , '4', 'G') }, - { AV_PIX_FMT_GBRAP16LE, MKTAG('G', '4', 00 , 16 ) }, - { AV_PIX_FMT_GBRAP16BE, MKTAG(16 , 00 , '4', 'G') }, - - { AV_PIX_FMT_XYZ12LE, MKTAG('X', 'Y', 'Z' , 36 ) }, - { AV_PIX_FMT_XYZ12BE, MKTAG(36 , 'Z' , 'Y', 'X') }, - - { AV_PIX_FMT_BAYER_BGGR8, MKTAG(0xBA, 'B', 'G', 8 ) }, - { AV_PIX_FMT_BAYER_BGGR16LE, MKTAG(0xBA, 'B', 'G', 16 ) }, - { AV_PIX_FMT_BAYER_BGGR16BE, MKTAG(16 , 'G', 'B', 0xBA) }, - { AV_PIX_FMT_BAYER_RGGB8, MKTAG(0xBA, 'R', 'G', 8 ) }, - { AV_PIX_FMT_BAYER_RGGB16LE, MKTAG(0xBA, 'R', 'G', 16 ) }, - { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG(16 , 'G', 'R', 0xBA) }, - { AV_PIX_FMT_BAYER_GBRG8, MKTAG(0xBA, 'G', 'B', 8 ) }, - { AV_PIX_FMT_BAYER_GBRG16LE, MKTAG(0xBA, 'G', 'B', 16 ) }, - { AV_PIX_FMT_BAYER_GBRG16BE, MKTAG(16, 'B', 'G', 0xBA) }, - { AV_PIX_FMT_BAYER_GRBG8, MKTAG(0xBA, 'G', 'R', 8 ) }, - { AV_PIX_FMT_BAYER_GRBG16LE, MKTAG(0xBA, 'G', 'R', 16 ) }, - { AV_PIX_FMT_BAYER_GRBG16BE, MKTAG(16, 'R', 'G', 0xBA) }, - - /* quicktime */ - { AV_PIX_FMT_YUV420P, MKTAG('R', '4', '2', '0') }, /* Radius DV YUV PAL */ - { AV_PIX_FMT_YUV411P, MKTAG('R', '4', '1', '1') }, /* Radius DV YUV NTSC */ - { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') }, - { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') }, - { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */ - { AV_PIX_FMT_UYVY422, MKTAG('b', 'x', 'y', 'v') }, - { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') }, - { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') }, - { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */ - { AV_PIX_FMT_VYU444, MKTAG('v', '3', '0', '8') }, - { AV_PIX_FMT_UYVA, MKTAG('v', '4', '0', '8') }, - { AV_PIX_FMT_V30XLE, MKTAG('v', '4', '1', '0') }, - { AV_PIX_FMT_AYUV, MKTAG('y', '4', '0', '8') }, - { AV_PIX_FMT_RGB555LE,MKTAG('L', '5', '5', '5') }, - { AV_PIX_FMT_RGB565LE,MKTAG('L', '5', '6', '5') }, - { AV_PIX_FMT_RGB565BE,MKTAG('B', '5', '6', '5') }, - { AV_PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') }, - { AV_PIX_FMT_BGR24, MKTAG('b', 'x', 'b', 'g') }, - { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, - { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, - { AV_PIX_FMT_RGB24, MKTAG('b', 'x', 'r', 'g') }, - { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, - { AV_PIX_FMT_GRAY16BE,MKTAG('b', '1', '6', 'g') }, - { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') }, - { AV_PIX_FMT_RGBA64BE,MKTAG('b', '6', '4', 'a') }, - { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG('B', 'G', 'G', 'R') }, - - /* vlc */ - { AV_PIX_FMT_YUV410P, MKTAG('I', '4', '1', '0') }, - { AV_PIX_FMT_YUV411P, MKTAG('I', '4', '1', '1') }, - { AV_PIX_FMT_YUV422P, MKTAG('I', '4', '2', '2') }, - { AV_PIX_FMT_YUV440P, MKTAG('I', '4', '4', '0') }, - { AV_PIX_FMT_YUV444P, MKTAG('I', '4', '4', '4') }, - { AV_PIX_FMT_YUVJ420P, MKTAG('J', '4', '2', '0') }, - { AV_PIX_FMT_YUVJ422P, MKTAG('J', '4', '2', '2') }, - { AV_PIX_FMT_YUVJ440P, MKTAG('J', '4', '4', '0') }, - { AV_PIX_FMT_YUVJ444P, MKTAG('J', '4', '4', '4') }, - { AV_PIX_FMT_YUVA444P, MKTAG('Y', 'U', 'V', 'A') }, - { AV_PIX_FMT_YUVA420P, MKTAG('I', '4', '0', 'A') }, - { AV_PIX_FMT_YUVA422P, MKTAG('I', '4', '2', 'A') }, - { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', '2') }, - { AV_PIX_FMT_RGB555LE, MKTAG('R', 'V', '1', '5') }, - { AV_PIX_FMT_RGB565LE, MKTAG('R', 'V', '1', '6') }, - { AV_PIX_FMT_BGR24, MKTAG('R', 'V', '2', '4') }, - { AV_PIX_FMT_BGR0, MKTAG('R', 'V', '3', '2') }, - { AV_PIX_FMT_RGBA, MKTAG('A', 'V', '3', '2') }, - { AV_PIX_FMT_YUV420P9LE, MKTAG('I', '0', '9', 'L') }, - { AV_PIX_FMT_YUV420P9BE, MKTAG('I', '0', '9', 'B') }, - { AV_PIX_FMT_YUV422P9LE, MKTAG('I', '2', '9', 'L') }, - { AV_PIX_FMT_YUV422P9BE, MKTAG('I', '2', '9', 'B') }, - { AV_PIX_FMT_YUV444P9LE, MKTAG('I', '4', '9', 'L') }, - { AV_PIX_FMT_YUV444P9BE, MKTAG('I', '4', '9', 'B') }, - { AV_PIX_FMT_YUV420P10LE, MKTAG('I', '0', 'A', 'L') }, - { AV_PIX_FMT_YUV420P10BE, MKTAG('I', '0', 'A', 'B') }, - { AV_PIX_FMT_YUV422P10LE, MKTAG('I', '2', 'A', 'L') }, - { AV_PIX_FMT_YUV422P10BE, MKTAG('I', '2', 'A', 'B') }, - { AV_PIX_FMT_YUV444P10LE, MKTAG('I', '4', 'A', 'L') }, - { AV_PIX_FMT_YUV444P10BE, MKTAG('I', '4', 'A', 'B') }, - { AV_PIX_FMT_YUV420P12LE, MKTAG('I', '0', 'C', 'L') }, - { AV_PIX_FMT_YUV420P12BE, MKTAG('I', '0', 'C', 'B') }, - { AV_PIX_FMT_YUV422P12LE, MKTAG('I', '2', 'C', 'L') }, - { AV_PIX_FMT_YUV422P12BE, MKTAG('I', '2', 'C', 'B') }, - { AV_PIX_FMT_YUV444P12LE, MKTAG('I', '4', 'C', 'L') }, - { AV_PIX_FMT_YUV444P12BE, MKTAG('I', '4', 'C', 'B') }, - { AV_PIX_FMT_YUV420P16LE, MKTAG('I', '0', 'F', 'L') }, - { AV_PIX_FMT_YUV420P16BE, MKTAG('I', '0', 'F', 'B') }, - { AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') }, - { AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') }, - - /* special */ - { AV_PIX_FMT_RGB565LE,MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */ - { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */ - - { AV_PIX_FMT_NONE, 0 }, -}; - -const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void) -{ - return raw_pix_fmt_tags; -} +#include "raw_pix_fmt_tags.h" unsigned int avcodec_pix_fmt_to_codec_tag(enum AVPixelFormat fmt) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw.h 2026-04-29 18:38:25.000000000 +0000 @@ -34,8 +34,6 @@ unsigned int fourcc; } PixelFormatTag; -const struct PixelFormatTag *avpriv_get_raw_pix_fmt_tags(void); - enum PixelFormatTagLists { PIX_FMT_LIST_RAW, PIX_FMT_LIST_AVI, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw_pix_fmt_tags.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw_pix_fmt_tags.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/raw_pix_fmt_tags.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/raw_pix_fmt_tags.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,316 @@ +/* + * Raw Video Codec + * Copyright (c) 2001 Fabrice Bellard + * + * 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 + */ + +#ifndef AVCODEC_RAW_PIX_FMT_TAGS_H +#define AVCODEC_RAW_PIX_FMT_TAGS_H + +#include "raw.h" +#include "libavutil/macros.h" + +static const PixelFormatTag raw_pix_fmt_tags[] = { + { AV_PIX_FMT_YUV420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ + { AV_PIX_FMT_YUV420P, MKTAG('I', 'Y', 'U', 'V') }, + { AV_PIX_FMT_YUV420P, MKTAG('y', 'v', '1', '2') }, + { AV_PIX_FMT_YUV420P, MKTAG('Y', 'V', '1', '2') }, + { AV_PIX_FMT_YUV410P, MKTAG('Y', 'U', 'V', '9') }, + { AV_PIX_FMT_YUV410P, MKTAG('Y', 'V', 'U', '9') }, + { AV_PIX_FMT_YUV411P, MKTAG('Y', '4', '1', 'B') }, + { AV_PIX_FMT_YUV422P, MKTAG('Y', '4', '2', 'B') }, + { AV_PIX_FMT_YUV422P, MKTAG('P', '4', '2', '2') }, + { AV_PIX_FMT_YUV422P, MKTAG('Y', 'V', '1', '6') }, + /* yuvjXXX formats are deprecated hacks specific to libav*, + they are identical to yuvXXX */ + { AV_PIX_FMT_YUVJ420P, MKTAG('I', '4', '2', '0') }, /* Planar formats */ + { AV_PIX_FMT_YUVJ420P, MKTAG('I', 'Y', 'U', 'V') }, + { AV_PIX_FMT_YUVJ420P, MKTAG('Y', 'V', '1', '2') }, + { AV_PIX_FMT_YUVJ422P, MKTAG('Y', '4', '2', 'B') }, + { AV_PIX_FMT_YUVJ422P, MKTAG('P', '4', '2', '2') }, + { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', '0', '0') }, + { AV_PIX_FMT_GRAY8, MKTAG('Y', '8', ' ', ' ') }, + + { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', '2') }, /* Packed formats */ + { AV_PIX_FMT_YUYV422, MKTAG('Y', '4', '2', '2') }, + { AV_PIX_FMT_YUYV422, MKTAG('V', '4', '2', '2') }, + { AV_PIX_FMT_YUYV422, MKTAG('V', 'Y', 'U', 'Y') }, + { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'N', 'V') }, + { AV_PIX_FMT_YUYV422, MKTAG('Y', 'U', 'Y', 'V') }, + { AV_PIX_FMT_YVYU422, MKTAG('Y', 'V', 'Y', 'U') }, /* Philips */ + { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'V', 'Y') }, + { AV_PIX_FMT_UYVY422, MKTAG('H', 'D', 'Y', 'C') }, + { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'V') }, + { AV_PIX_FMT_UYVY422, MKTAG('U', 'Y', 'N', 'Y') }, + { AV_PIX_FMT_UYVY422, MKTAG('u', 'y', 'v', '1') }, + { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', '1') }, + { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'R', 'n') }, /* Avid AVI Codec 1:1 */ + { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', '1', 'x') }, /* Avid 1:1x */ + { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'u', 'p') }, + { AV_PIX_FMT_UYVY422, MKTAG('V', 'D', 'T', 'Z') }, /* SoftLab-NSK VideoTizer */ + { AV_PIX_FMT_UYVY422, MKTAG('a', 'u', 'v', '2') }, + { AV_PIX_FMT_UYVY422, MKTAG('c', 'y', 'u', 'v') }, /* CYUV is also Creative YUV */ + { AV_PIX_FMT_UYYVYY411, MKTAG('Y', '4', '1', '1') }, + { AV_PIX_FMT_GRAY8, MKTAG('G', 'R', 'E', 'Y') }, + { AV_PIX_FMT_NV12, MKTAG('N', 'V', '1', '2') }, + { AV_PIX_FMT_NV21, MKTAG('N', 'V', '2', '1') }, + { AV_PIX_FMT_VUYA, MKTAG('A', 'Y', 'U', 'V') }, /* MS 4:4:4:4 */ + { AV_PIX_FMT_XV30LE, MKTAG('Y', '4', '1', '0') }, + { AV_PIX_FMT_XV48LE, MKTAG('Y', '4', '1', '6') }, + { AV_PIX_FMT_Y210LE, MKTAG('Y', '2', '1', '0') }, + { AV_PIX_FMT_Y216LE, MKTAG('Y', '2', '1', '6') }, + + /* nut */ + { AV_PIX_FMT_RGB555LE, MKTAG('R', 'G', 'B', 15) }, + { AV_PIX_FMT_BGR555LE, MKTAG('B', 'G', 'R', 15) }, + { AV_PIX_FMT_RGB565LE, MKTAG('R', 'G', 'B', 16) }, + { AV_PIX_FMT_BGR565LE, MKTAG('B', 'G', 'R', 16) }, + { AV_PIX_FMT_RGB555BE, MKTAG(15 , 'B', 'G', 'R') }, + { AV_PIX_FMT_BGR555BE, MKTAG(15 , 'R', 'G', 'B') }, + { AV_PIX_FMT_RGB565BE, MKTAG(16 , 'B', 'G', 'R') }, + { AV_PIX_FMT_BGR565BE, MKTAG(16 , 'R', 'G', 'B') }, + { AV_PIX_FMT_RGB444LE, MKTAG('R', 'G', 'B', 12) }, + { AV_PIX_FMT_BGR444LE, MKTAG('B', 'G', 'R', 12) }, + { AV_PIX_FMT_RGB444BE, MKTAG(12 , 'B', 'G', 'R') }, + { AV_PIX_FMT_BGR444BE, MKTAG(12 , 'R', 'G', 'B') }, + { AV_PIX_FMT_RGBA64LE, MKTAG('R', 'B', 'A', 64 ) }, + { AV_PIX_FMT_BGRA64LE, MKTAG('B', 'R', 'A', 64 ) }, + { AV_PIX_FMT_RGBA64BE, MKTAG(64 , 'R', 'B', 'A') }, + { AV_PIX_FMT_BGRA64BE, MKTAG(64 , 'B', 'R', 'A') }, + { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, + { AV_PIX_FMT_RGB0, MKTAG('R', 'G', 'B', 0 ) }, + { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, + { AV_PIX_FMT_BGR0, MKTAG('B', 'G', 'R', 0 ) }, + { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, + { AV_PIX_FMT_0BGR, MKTAG( 0 , 'B', 'G', 'R') }, + { AV_PIX_FMT_ARGB, MKTAG('A', 'R', 'G', 'B') }, + { AV_PIX_FMT_0RGB, MKTAG( 0 , 'R', 'G', 'B') }, + { AV_PIX_FMT_RGB24, MKTAG('R', 'G', 'B', 24 ) }, + { AV_PIX_FMT_BGR24, MKTAG('B', 'G', 'R', 24 ) }, + { AV_PIX_FMT_YUV411P, MKTAG('4', '1', '1', 'P') }, + { AV_PIX_FMT_YUV422P, MKTAG('4', '2', '2', 'P') }, + { AV_PIX_FMT_YUVJ422P, MKTAG('4', '2', '2', 'P') }, + { AV_PIX_FMT_YUV440P, MKTAG('4', '4', '0', 'P') }, + { AV_PIX_FMT_YUVJ440P, MKTAG('4', '4', '0', 'P') }, + { AV_PIX_FMT_YUV444P, MKTAG('4', '4', '4', 'P') }, + { AV_PIX_FMT_YUVJ444P, MKTAG('4', '4', '4', 'P') }, + { AV_PIX_FMT_MONOWHITE, MKTAG('B', '1', 'W', '0') }, + { AV_PIX_FMT_MONOBLACK, MKTAG('B', '0', 'W', '1') }, + { AV_PIX_FMT_BGR8, MKTAG('B', 'G', 'R', 8 ) }, + { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', 8 ) }, + { AV_PIX_FMT_BGR4, MKTAG('B', 'G', 'R', 4 ) }, + { AV_PIX_FMT_RGB4, MKTAG('R', 'G', 'B', 4 ) }, + { AV_PIX_FMT_RGB4_BYTE, MKTAG('B', '4', 'B', 'Y') }, + { AV_PIX_FMT_BGR4_BYTE, MKTAG('R', '4', 'B', 'Y') }, + { AV_PIX_FMT_RGB48LE, MKTAG('R', 'G', 'B', 48 ) }, + { AV_PIX_FMT_RGB48BE, MKTAG( 48, 'R', 'G', 'B') }, + { AV_PIX_FMT_BGR48LE, MKTAG('B', 'G', 'R', 48 ) }, + { AV_PIX_FMT_BGR48BE, MKTAG( 48, 'B', 'G', 'R') }, + { AV_PIX_FMT_GRAY9LE, MKTAG('Y', '1', 0 , 9 ) }, + { AV_PIX_FMT_GRAY9BE, MKTAG( 9 , 0 , '1', 'Y') }, + { AV_PIX_FMT_GRAY10LE, MKTAG('Y', '1', 0 , 10 ) }, + { AV_PIX_FMT_GRAY10BE, MKTAG(10 , 0 , '1', 'Y') }, + { AV_PIX_FMT_GRAY12LE, MKTAG('Y', '1', 0 , 12 ) }, + { AV_PIX_FMT_GRAY12BE, MKTAG(12 , 0 , '1', 'Y') }, + { AV_PIX_FMT_GRAY14LE, MKTAG('Y', '1', 0 , 14 ) }, + { AV_PIX_FMT_GRAY14BE, MKTAG(14 , 0 , '1', 'Y') }, + { AV_PIX_FMT_GRAY16LE, MKTAG('Y', '1', 0 , 16 ) }, + { AV_PIX_FMT_GRAY16BE, MKTAG(16 , 0 , '1', 'Y') }, + { AV_PIX_FMT_YUV420P9LE, MKTAG('Y', '3', 11 , 9 ) }, + { AV_PIX_FMT_YUV420P9BE, MKTAG( 9 , 11 , '3', 'Y') }, + { AV_PIX_FMT_YUV422P9LE, MKTAG('Y', '3', 10 , 9 ) }, + { AV_PIX_FMT_YUV422P9BE, MKTAG( 9 , 10 , '3', 'Y') }, + { AV_PIX_FMT_YUV444P9LE, MKTAG('Y', '3', 0 , 9 ) }, + { AV_PIX_FMT_YUV444P9BE, MKTAG( 9 , 0 , '3', 'Y') }, + { AV_PIX_FMT_YUV420P10LE, MKTAG('Y', '3', 11 , 10 ) }, + { AV_PIX_FMT_YUV420P10BE, MKTAG(10 , 11 , '3', 'Y') }, + { AV_PIX_FMT_YUV422P10LE, MKTAG('Y', '3', 10 , 10 ) }, + { AV_PIX_FMT_YUV422P10BE, MKTAG(10 , 10 , '3', 'Y') }, + { AV_PIX_FMT_YUV444P10LE, MKTAG('Y', '3', 0 , 10 ) }, + { AV_PIX_FMT_YUV444P10BE, MKTAG(10 , 0 , '3', 'Y') }, + { AV_PIX_FMT_YUV420P12LE, MKTAG('Y', '3', 11 , 12 ) }, + { AV_PIX_FMT_YUV420P12BE, MKTAG(12 , 11 , '3', 'Y') }, + { AV_PIX_FMT_YUV422P12LE, MKTAG('Y', '3', 10 , 12 ) }, + { AV_PIX_FMT_YUV422P12BE, MKTAG(12 , 10 , '3', 'Y') }, + { AV_PIX_FMT_YUV444P12LE, MKTAG('Y', '3', 0 , 12 ) }, + { AV_PIX_FMT_YUV444P12BE, MKTAG(12 , 0 , '3', 'Y') }, + { AV_PIX_FMT_YUV420P14LE, MKTAG('Y', '3', 11 , 14 ) }, + { AV_PIX_FMT_YUV420P14BE, MKTAG(14 , 11 , '3', 'Y') }, + { AV_PIX_FMT_YUV422P14LE, MKTAG('Y', '3', 10 , 14 ) }, + { AV_PIX_FMT_YUV422P14BE, MKTAG(14 , 10 , '3', 'Y') }, + { AV_PIX_FMT_YUV444P14LE, MKTAG('Y', '3', 0 , 14 ) }, + { AV_PIX_FMT_YUV444P14BE, MKTAG(14 , 0 , '3', 'Y') }, + { AV_PIX_FMT_YUV420P16LE, MKTAG('Y', '3', 11 , 16 ) }, + { AV_PIX_FMT_YUV420P16BE, MKTAG(16 , 11 , '3', 'Y') }, + { AV_PIX_FMT_YUV422P16LE, MKTAG('Y', '3', 10 , 16 ) }, + { AV_PIX_FMT_YUV422P16BE, MKTAG(16 , 10 , '3', 'Y') }, + { AV_PIX_FMT_YUV444P16LE, MKTAG('Y', '3', 0 , 16 ) }, + { AV_PIX_FMT_YUV444P16BE, MKTAG(16 , 0 , '3', 'Y') }, + { AV_PIX_FMT_YUVA420P, MKTAG('Y', '4', 11 , 8 ) }, + { AV_PIX_FMT_YUVA422P, MKTAG('Y', '4', 10 , 8 ) }, + { AV_PIX_FMT_YUVA444P, MKTAG('Y', '4', 0 , 8 ) }, + { AV_PIX_FMT_YA8, MKTAG('Y', '2', 0 , 8 ) }, + { AV_PIX_FMT_PAL8, MKTAG('P', 'A', 'L', 8 ) }, + + { AV_PIX_FMT_YUVA420P9LE, MKTAG('Y', '4', 11 , 9 ) }, + { AV_PIX_FMT_YUVA420P9BE, MKTAG( 9 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P9LE, MKTAG('Y', '4', 10 , 9 ) }, + { AV_PIX_FMT_YUVA422P9BE, MKTAG( 9 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P9LE, MKTAG('Y', '4', 0 , 9 ) }, + { AV_PIX_FMT_YUVA444P9BE, MKTAG( 9 , 0 , '4', 'Y') }, + { AV_PIX_FMT_YUVA420P10LE, MKTAG('Y', '4', 11 , 10 ) }, + { AV_PIX_FMT_YUVA420P10BE, MKTAG(10 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P10LE, MKTAG('Y', '4', 10 , 10 ) }, + { AV_PIX_FMT_YUVA422P10BE, MKTAG(10 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P10LE, MKTAG('Y', '4', 0 , 10 ) }, + { AV_PIX_FMT_YUVA444P10BE, MKTAG(10 , 0 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P12LE, MKTAG('Y', '4', 10 , 12 ) }, + { AV_PIX_FMT_YUVA422P12BE, MKTAG(12 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P12LE, MKTAG('Y', '4', 0 , 12 ) }, + { AV_PIX_FMT_YUVA444P12BE, MKTAG(12 , 0 , '4', 'Y') }, + { AV_PIX_FMT_YUVA420P16LE, MKTAG('Y', '4', 11 , 16 ) }, + { AV_PIX_FMT_YUVA420P16BE, MKTAG(16 , 11 , '4', 'Y') }, + { AV_PIX_FMT_YUVA422P16LE, MKTAG('Y', '4', 10 , 16 ) }, + { AV_PIX_FMT_YUVA422P16BE, MKTAG(16 , 10 , '4', 'Y') }, + { AV_PIX_FMT_YUVA444P16LE, MKTAG('Y', '4', 0 , 16 ) }, + { AV_PIX_FMT_YUVA444P16BE, MKTAG(16 , 0 , '4', 'Y') }, + + { AV_PIX_FMT_GBRP, MKTAG('G', '3', 00 , 8 ) }, + { AV_PIX_FMT_GBRP9LE, MKTAG('G', '3', 00 , 9 ) }, + { AV_PIX_FMT_GBRP9BE, MKTAG( 9 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRP10LE, MKTAG('G', '3', 00 , 10 ) }, + { AV_PIX_FMT_GBRP10BE, MKTAG(10 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRP12LE, MKTAG('G', '3', 00 , 12 ) }, + { AV_PIX_FMT_GBRP12BE, MKTAG(12 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRP14LE, MKTAG('G', '3', 00 , 14 ) }, + { AV_PIX_FMT_GBRP14BE, MKTAG(14 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRP16LE, MKTAG('G', '3', 00 , 16 ) }, + { AV_PIX_FMT_GBRP16BE, MKTAG(16 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRPF16LE, MKTAG('G', '3', 00 , 17 ) }, + { AV_PIX_FMT_GBRPF16BE, MKTAG(17 , 00 , '3', 'G') }, + { AV_PIX_FMT_GBRPF32LE, MKTAG('G', '3', 00 , 33 ) }, + { AV_PIX_FMT_GBRPF32BE, MKTAG(33 , 00 , '3', 'G') }, + + { AV_PIX_FMT_GBRAP, MKTAG('G', '4', 00 , 8 ) }, + { AV_PIX_FMT_GBRAP10LE, MKTAG('G', '4', 00 , 10 ) }, + { AV_PIX_FMT_GBRAP10BE, MKTAG(10 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAP12LE, MKTAG('G', '4', 00 , 12 ) }, + { AV_PIX_FMT_GBRAP12BE, MKTAG(12 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAP14LE, MKTAG('G', '4', 00 , 14 ) }, + { AV_PIX_FMT_GBRAP14BE, MKTAG(14 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAP16LE, MKTAG('G', '4', 00 , 16 ) }, + { AV_PIX_FMT_GBRAP16BE, MKTAG(16 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAPF16LE, MKTAG('G', '4', 00 , 17 ) }, + { AV_PIX_FMT_GBRAPF16BE, MKTAG(17 , 00 , '4', 'G') }, + { AV_PIX_FMT_GBRAPF32LE, MKTAG('G', '4', 00 , 33 ) }, + { AV_PIX_FMT_GBRAPF32BE, MKTAG(33 , 00 , '4', 'G') }, + + { AV_PIX_FMT_XYZ12LE, MKTAG('X', 'Y', 'Z' , 36 ) }, + { AV_PIX_FMT_XYZ12BE, MKTAG(36 , 'Z' , 'Y', 'X') }, + + { AV_PIX_FMT_BAYER_BGGR8, MKTAG(0xBA, 'B', 'G', 8 ) }, + { AV_PIX_FMT_BAYER_BGGR16LE, MKTAG(0xBA, 'B', 'G', 16 ) }, + { AV_PIX_FMT_BAYER_BGGR16BE, MKTAG(16 , 'G', 'B', 0xBA) }, + { AV_PIX_FMT_BAYER_RGGB8, MKTAG(0xBA, 'R', 'G', 8 ) }, + { AV_PIX_FMT_BAYER_RGGB16LE, MKTAG(0xBA, 'R', 'G', 16 ) }, + { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG(16 , 'G', 'R', 0xBA) }, + { AV_PIX_FMT_BAYER_GBRG8, MKTAG(0xBA, 'G', 'B', 8 ) }, + { AV_PIX_FMT_BAYER_GBRG16LE, MKTAG(0xBA, 'G', 'B', 16 ) }, + { AV_PIX_FMT_BAYER_GBRG16BE, MKTAG(16, 'B', 'G', 0xBA) }, + { AV_PIX_FMT_BAYER_GRBG8, MKTAG(0xBA, 'G', 'R', 8 ) }, + { AV_PIX_FMT_BAYER_GRBG16LE, MKTAG(0xBA, 'G', 'R', 16 ) }, + { AV_PIX_FMT_BAYER_GRBG16BE, MKTAG(16, 'R', 'G', 0xBA) }, + + /* quicktime */ + { AV_PIX_FMT_YUV420P, MKTAG('R', '4', '2', '0') }, /* Radius DV YUV PAL */ + { AV_PIX_FMT_YUV411P, MKTAG('R', '4', '1', '1') }, /* Radius DV YUV NTSC */ + { AV_PIX_FMT_UYVY422, MKTAG('2', 'v', 'u', 'y') }, + { AV_PIX_FMT_UYVY422, MKTAG('2', 'V', 'u', 'y') }, + { AV_PIX_FMT_UYVY422, MKTAG('A', 'V', 'U', 'I') }, /* FIXME merge both fields */ + { AV_PIX_FMT_UYVY422, MKTAG('b', 'x', 'y', 'v') }, + { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', '2') }, + { AV_PIX_FMT_YUYV422, MKTAG('y', 'u', 'v', 's') }, + { AV_PIX_FMT_YUYV422, MKTAG('D', 'V', 'O', 'O') }, /* Digital Voodoo SD 8 Bit */ + { AV_PIX_FMT_VYU444, MKTAG('v', '3', '0', '8') }, + { AV_PIX_FMT_UYVA, MKTAG('v', '4', '0', '8') }, + { AV_PIX_FMT_V30XLE, MKTAG('v', '4', '1', '0') }, + { AV_PIX_FMT_AYUV, MKTAG('y', '4', '0', '8') }, + { AV_PIX_FMT_RGB555LE, MKTAG('L', '5', '5', '5') }, + { AV_PIX_FMT_RGB565LE, MKTAG('L', '5', '6', '5') }, + { AV_PIX_FMT_RGB565BE, MKTAG('B', '5', '6', '5') }, + { AV_PIX_FMT_BGR24, MKTAG('2', '4', 'B', 'G') }, + { AV_PIX_FMT_BGR24, MKTAG('b', 'x', 'b', 'g') }, + { AV_PIX_FMT_BGRA, MKTAG('B', 'G', 'R', 'A') }, + { AV_PIX_FMT_RGBA, MKTAG('R', 'G', 'B', 'A') }, + { AV_PIX_FMT_RGB24, MKTAG('b', 'x', 'r', 'g') }, + { AV_PIX_FMT_ABGR, MKTAG('A', 'B', 'G', 'R') }, + { AV_PIX_FMT_GRAY16BE, MKTAG('b', '1', '6', 'g') }, + { AV_PIX_FMT_RGB48BE, MKTAG('b', '4', '8', 'r') }, + { AV_PIX_FMT_RGBA64BE, MKTAG('b', '6', '4', 'a') }, + { AV_PIX_FMT_BAYER_RGGB16BE, MKTAG('B', 'G', 'G', 'R') }, + + /* vlc */ + { AV_PIX_FMT_YUV410P, MKTAG('I', '4', '1', '0') }, + { AV_PIX_FMT_YUV411P, MKTAG('I', '4', '1', '1') }, + { AV_PIX_FMT_YUV422P, MKTAG('I', '4', '2', '2') }, + { AV_PIX_FMT_YUV440P, MKTAG('I', '4', '4', '0') }, + { AV_PIX_FMT_YUV444P, MKTAG('I', '4', '4', '4') }, + { AV_PIX_FMT_YUVJ420P, MKTAG('J', '4', '2', '0') }, + { AV_PIX_FMT_YUVJ422P, MKTAG('J', '4', '2', '2') }, + { AV_PIX_FMT_YUVJ440P, MKTAG('J', '4', '4', '0') }, + { AV_PIX_FMT_YUVJ444P, MKTAG('J', '4', '4', '4') }, + { AV_PIX_FMT_YUVA444P, MKTAG('Y', 'U', 'V', 'A') }, + { AV_PIX_FMT_YUVA420P, MKTAG('I', '4', '0', 'A') }, + { AV_PIX_FMT_YUVA422P, MKTAG('I', '4', '2', 'A') }, + { AV_PIX_FMT_RGB8, MKTAG('R', 'G', 'B', '2') }, + { AV_PIX_FMT_RGB555LE, MKTAG('R', 'V', '1', '5') }, + { AV_PIX_FMT_RGB565LE, MKTAG('R', 'V', '1', '6') }, + { AV_PIX_FMT_BGR24, MKTAG('R', 'V', '2', '4') }, + { AV_PIX_FMT_BGR0, MKTAG('R', 'V', '3', '2') }, + { AV_PIX_FMT_RGBA, MKTAG('A', 'V', '3', '2') }, + { AV_PIX_FMT_YUV420P9LE, MKTAG('I', '0', '9', 'L') }, + { AV_PIX_FMT_YUV420P9BE, MKTAG('I', '0', '9', 'B') }, + { AV_PIX_FMT_YUV422P9LE, MKTAG('I', '2', '9', 'L') }, + { AV_PIX_FMT_YUV422P9BE, MKTAG('I', '2', '9', 'B') }, + { AV_PIX_FMT_YUV444P9LE, MKTAG('I', '4', '9', 'L') }, + { AV_PIX_FMT_YUV444P9BE, MKTAG('I', '4', '9', 'B') }, + { AV_PIX_FMT_YUV420P10LE, MKTAG('I', '0', 'A', 'L') }, + { AV_PIX_FMT_YUV420P10BE, MKTAG('I', '0', 'A', 'B') }, + { AV_PIX_FMT_YUV422P10LE, MKTAG('I', '2', 'A', 'L') }, + { AV_PIX_FMT_YUV422P10BE, MKTAG('I', '2', 'A', 'B') }, + { AV_PIX_FMT_YUV444P10LE, MKTAG('I', '4', 'A', 'L') }, + { AV_PIX_FMT_YUV444P10BE, MKTAG('I', '4', 'A', 'B') }, + { AV_PIX_FMT_YUV420P12LE, MKTAG('I', '0', 'C', 'L') }, + { AV_PIX_FMT_YUV420P12BE, MKTAG('I', '0', 'C', 'B') }, + { AV_PIX_FMT_YUV422P12LE, MKTAG('I', '2', 'C', 'L') }, + { AV_PIX_FMT_YUV422P12BE, MKTAG('I', '2', 'C', 'B') }, + { AV_PIX_FMT_YUV444P12LE, MKTAG('I', '4', 'C', 'L') }, + { AV_PIX_FMT_YUV444P12BE, MKTAG('I', '4', 'C', 'B') }, + { AV_PIX_FMT_YUV420P16LE, MKTAG('I', '0', 'F', 'L') }, + { AV_PIX_FMT_YUV420P16BE, MKTAG('I', '0', 'F', 'B') }, + { AV_PIX_FMT_YUV444P16LE, MKTAG('I', '4', 'F', 'L') }, + { AV_PIX_FMT_YUV444P16BE, MKTAG('I', '4', 'F', 'B') }, + + /* special */ + { AV_PIX_FMT_RGB565LE, MKTAG( 3 , 0 , 0 , 0 ) }, /* flipped RGB565LE */ + { AV_PIX_FMT_YUV444P, MKTAG('Y', 'V', '2', '4') }, /* YUV444P, swapped UV */ + + { AV_PIX_FMT_NONE, 0 }, +}; + +#endif /* AVCODEC_RAW_PIX_FMT_TAGS_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/rectangle.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/rectangle.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/rectangle.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/rectangle.h 2026-04-29 18:38:25.000000000 +0000 @@ -46,7 +46,7 @@ w *= size; stride *= size; - av_assert2((((long)vp)&(FFMIN(w, 8<<(HAVE_NEON|ARCH_PPC|HAVE_MMX))-1)) == 0); + av_assert2((((uintptr_t)vp)&(FFMIN(w, 8<<(HAVE_NEON|ARCH_PPC|HAVE_MMX))-1)) == 0); av_assert2((stride&(w-1))==0); if(w==2){ const uint16_t v= size==4 ? val : val*0x0101; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/rl.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/rl.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/rl.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/rl.h 2026-04-29 18:38:26.000000000 +0000 @@ -100,13 +100,9 @@ static inline int get_rl_index(const RLTable *rl, int last, int run, int level) { - int index; - index = rl->index_run[last][run]; - if (index >= rl->n) - return rl->n; if (level > rl->max_level[last][run]) return rl->n; - return index + level - 1; + return rl->index_run[last][run] + level - 1; } #endif /* AVCODEC_RL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.c 2026-04-29 18:38:26.000000000 +0000 @@ -37,11 +37,6 @@ #define BIT_DEPTH 10 #include "simple_idct_template.c" - -#define EXTRA_SHIFT 2 -#include "simple_idct_template.c" - -#undef EXTRA_SHIFT #undef BIT_DEPTH #define BIT_DEPTH 12 @@ -235,35 +230,3 @@ idct4col_add(dest + i, line_size, block + i); } } - -void ff_prores_idct_10(int16_t *block, const int16_t *qmat) -{ - int i; - - for (i = 0; i < 64; i++) - block[i] *= qmat[i]; - - for (i = 0; i < 8; i++) - idctRowCondDC_extrashift_10(block + i*8, 2); - - for (i = 0; i < 8; i++) { - block[i] += 8192; - idctSparseCol_extrashift_10(block + i); - } -} - -void ff_prores_idct_12(int16_t *block, const int16_t *qmat) -{ - int i; - - for (i = 0; i < 64; i++) - block[i] *= qmat[i]; - - for (i = 0; i < 8; i++) - idctRowCondDC_int16_12bit(block + i*8, 0); - - for (i = 0; i < 8; i++) { - block[i] += 8192; - idctSparseCol_int16_12bit(block + i); - } -} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct.h 2026-04-29 18:38:26.000000000 +0000 @@ -47,14 +47,6 @@ void ff_simple_idct_add_int16_12bit(uint8_t *dest, ptrdiff_t line_size, int16_t *block); void ff_simple_idct_int16_12bit(int16_t *block); -/** - * Special version of ff_simple_idct_int16_10bit() which does dequantization - * and scales by a factor of 2 more between the two IDCTs to account - * for larger scale of input coefficients. - */ -void ff_prores_idct_10(int16_t *block, const int16_t *qmat); -void ff_prores_idct_12(int16_t *block, const int16_t *qmat); - void ff_simple_idct248_put(uint8_t *dest, ptrdiff_t line_size, int16_t *block); void ff_simple_idct84_add(uint8_t *dest, ptrdiff_t line_size, int16_t *block); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/simple_idct_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/simple_idct_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -28,8 +28,6 @@ /* Based upon some commented-out C code from mpeg2dec (idct_mmx.c * written by Aaron Holtzman ). */ -#include "simple_idct.h" - #include "bit_depth_template.c" #undef W1 @@ -261,6 +259,25 @@ #ifdef EXTRA_SHIFT static inline void FUNC(idctSparseCol_extrashift)(int16_t *col) #else +static inline void FUNC6(idctSparseCol)(idctin *col) +#endif +{ + unsigned a0, a1, a2, a3, b0, b1, b2, b3; + + IDCT_COLS; + + col[0 ] = ((int)(a0 + b0) >> COL_SHIFT); + col[8 ] = ((int)(a1 + b1) >> COL_SHIFT); + col[16] = ((int)(a2 + b2) >> COL_SHIFT); + col[24] = ((int)(a3 + b3) >> COL_SHIFT); + col[32] = ((int)(a3 - b3) >> COL_SHIFT); + col[40] = ((int)(a2 - b2) >> COL_SHIFT); + col[48] = ((int)(a1 - b1) >> COL_SHIFT); + col[56] = ((int)(a0 - b0) >> COL_SHIFT); +} + +#ifndef PRORES_ONLY +#ifndef EXTRA_SHIFT static inline void FUNC6(idctSparseColPut)(pixel *dest, ptrdiff_t line_size, idctin *col) { @@ -309,24 +326,6 @@ dest[0] = av_clip_pixel(dest[0] + ((int)(a0 - b0) >> COL_SHIFT)); } -static inline void FUNC6(idctSparseCol)(idctin *col) -#endif -{ - unsigned a0, a1, a2, a3, b0, b1, b2, b3; - - IDCT_COLS; - - col[0 ] = ((int)(a0 + b0) >> COL_SHIFT); - col[8 ] = ((int)(a1 + b1) >> COL_SHIFT); - col[16] = ((int)(a2 + b2) >> COL_SHIFT); - col[24] = ((int)(a3 + b3) >> COL_SHIFT); - col[32] = ((int)(a3 - b3) >> COL_SHIFT); - col[40] = ((int)(a2 - b2) >> COL_SHIFT); - col[48] = ((int)(a1 - b1) >> COL_SHIFT); - col[56] = ((int)(a0 - b0) >> COL_SHIFT); -} - -#ifndef EXTRA_SHIFT void FUNC6(ff_simple_idct_put)(uint8_t *dest_, ptrdiff_t line_size, int16_t *block_) { idctin *block = (idctin *)block_; @@ -369,3 +368,4 @@ } #endif #endif +#endif /* PRORES_ONLY */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/utils.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/utils.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/utils.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/utils.c 2026-04-29 18:38:25.000000000 +0000 @@ -33,6 +33,7 @@ #include "libavutil/pixdesc.h" #include "libavutil/imgutils.h" #include "libavutil/pixfmt.h" +/* #include "libavutil/timecode_internal.h" */ #include "avcodec.h" #include "codec.h" #include "codec_desc.h" @@ -78,17 +79,13 @@ int av_codec_is_encoder(const AVCodec *avcodec) { const FFCodec *const codec = ffcodec(avcodec); - return codec && (codec->cb_type == FF_CODEC_CB_TYPE_ENCODE || - codec->cb_type == FF_CODEC_CB_TYPE_ENCODE_SUB || - codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_PACKET); + return codec && !codec->is_decoder; } int av_codec_is_decoder(const AVCodec *avcodec) { const FFCodec *const codec = ffcodec(avcodec); - return codec && (codec->cb_type == FF_CODEC_CB_TYPE_DECODE || - codec->cb_type == FF_CODEC_CB_TYPE_DECODE_SUB || - codec->cb_type == FF_CODEC_CB_TYPE_RECEIVE_FRAME); + return codec && codec->is_decoder; } int ff_set_dimensions(AVCodecContext *s, int width, int height) @@ -339,7 +336,7 @@ // H.264 uses edge emulation for out of frame motion vectors, for this // it requires a temporary area large enough to hold a 21x21 block, - // increasing witdth ensure that the temporary area is large enough, + // increasing width ensure that the temporary area is large enough, // the next rounded up width is 32 *width = FFMAX(*width, 32); } @@ -468,6 +465,7 @@ case AV_CODEC_ID_ADPCM_IMA_APC: case AV_CODEC_ID_ADPCM_IMA_APM: case AV_CODEC_ID_ADPCM_IMA_EA_SEAD: + case AV_CODEC_ID_ADPCM_IMA_MAGIX: case AV_CODEC_ID_ADPCM_IMA_OKI: case AV_CODEC_ID_ADPCM_IMA_WS: case AV_CODEC_ID_ADPCM_IMA_SSI: @@ -490,6 +488,7 @@ case AV_CODEC_ID_CBD2_DPCM: case AV_CODEC_ID_DERF_DPCM: case AV_CODEC_ID_WADY_DPCM: + case AV_CODEC_ID_ADPCM_CIRCUS: return 8; case AV_CODEC_ID_PCM_S16BE: case AV_CODEC_ID_PCM_S16BE_PLANAR: @@ -553,6 +552,7 @@ case AV_CODEC_ID_DFPWM: return 1; case AV_CODEC_ID_ADPCM_SBPRO_2: + case AV_CODEC_ID_G728: return 2; case AV_CODEC_ID_ADPCM_SBPRO_3: return 3; @@ -641,16 +641,16 @@ if (frame_bytes > 0) { /* calc from frame_bytes only */ - if (id == AV_CODEC_ID_TRUESPEECH) - return 240 * (frame_bytes / 32); - if (id == AV_CODEC_ID_NELLYMOSER) - return 256 * (frame_bytes / 64); - if (id == AV_CODEC_ID_RA_144) - return 160 * (frame_bytes / 20); - if (id == AV_CODEC_ID_APTX) - return 4 * (frame_bytes / 4); - if (id == AV_CODEC_ID_APTX_HD) - return 4 * (frame_bytes / 6); + int64_t d = INT64_MIN; + switch(id) { + case AV_CODEC_ID_TRUESPEECH : d = 240LL * (frame_bytes / 32); break; + case AV_CODEC_ID_NELLYMOSER : d = 256LL * (frame_bytes / 64); break; + case AV_CODEC_ID_RA_144 : d = 160LL * (frame_bytes / 20); break; + case AV_CODEC_ID_APTX : d = 4LL * (frame_bytes / 4); break; + case AV_CODEC_ID_APTX_HD : d = 4LL * (frame_bytes / 6); break; + } + if (d > INT64_MIN) + return ((int)d == d && d > 0) ? d : 0; if (bps > 0) { /* calc from frame_bytes and bits_per_coded_sample */ @@ -667,16 +667,27 @@ return (frame_bytes - 4 * ch) / (128 * ch) * 256; case AV_CODEC_ID_ADPCM_AFC: return frame_bytes / (9 * ch) * 16; + case AV_CODEC_ID_ADPCM_N64: + frame_bytes /= 9 * ch; + if (frame_bytes > INT_MAX / 16) + return 0; + return frame_bytes * 16; case AV_CODEC_ID_ADPCM_PSX: case AV_CODEC_ID_ADPCM_DTK: frame_bytes /= 16 * ch; if (frame_bytes > INT_MAX / 28) return 0; return frame_bytes * 28; + case AV_CODEC_ID_ADPCM_PSXC: + frame_bytes = (frame_bytes - 1) / ch; + if (frame_bytes > INT_MAX / 2) + return 0; + return frame_bytes * 2; case AV_CODEC_ID_ADPCM_4XM: case AV_CODEC_ID_ADPCM_IMA_ACORN: case AV_CODEC_ID_ADPCM_IMA_DAT4: case AV_CODEC_ID_ADPCM_IMA_ISS: + case AV_CODEC_ID_ADPCM_IMA_PDA: return (frame_bytes - 4 * ch) * 2 / ch; case AV_CODEC_ID_ADPCM_IMA_SMJPEG: return (frame_bytes - 4) * 2 / ch; @@ -968,76 +979,12 @@ return props; } -static unsigned bcd2uint(uint8_t bcd) -{ - unsigned low = bcd & 0xf; - unsigned high = bcd >> 4; - if (low > 9 || high > 9) - return 0; - return low + 10*high; -} - int ff_alloc_timecode_sei(const AVFrame *frame, AVRational rate, size_t prefix_len, void **data, size_t *sei_size) { - AVFrameSideData *sd = NULL; - uint8_t *sei_data; - PutBitContext pb; - uint32_t *tc; - int m; - - if (frame) - sd = av_frame_get_side_data(frame, AV_FRAME_DATA_S12M_TIMECODE); - - if (!sd) { - *data = NULL; - return 0; - } - tc = (uint32_t*)sd->data; - m = tc[0] & 3; - - *sei_size = sizeof(uint32_t) * 4; - *data = av_mallocz(*sei_size + prefix_len); - if (!*data) - return AVERROR(ENOMEM); - sei_data = (uint8_t*)*data + prefix_len; - - init_put_bits(&pb, sei_data, *sei_size); - put_bits(&pb, 2, m); // num_clock_ts - - for (int j = 1; j <= m; j++) { - uint32_t tcsmpte = tc[j]; - unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours - unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes - unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds - unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames - unsigned drop = tcsmpte & 1<<30 && !0; // 1-bit drop if not arbitrary bit - - /* Calculate frame number of HEVC by SMPTE ST 12-1:2014 Sec 12.2 if rate > 30FPS */ - if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { - unsigned pc; - ff *= 2; - if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) - pc = !!(tcsmpte & 1 << 7); - else - pc = !!(tcsmpte & 1 << 23); - ff = (ff + pc) & 0x7f; - } - - put_bits(&pb, 1, 1); // clock_timestamp_flag - put_bits(&pb, 1, 1); // units_field_based_flag - put_bits(&pb, 5, 0); // counting_type - put_bits(&pb, 1, 1); // full_timestamp_flag - put_bits(&pb, 1, 0); // discontinuity_flag - put_bits(&pb, 1, drop); - put_bits(&pb, 9, ff); - put_bits(&pb, 6, ss); - put_bits(&pb, 6, mm); - put_bits(&pb, 5, hh); - put_bits(&pb, 5, 0); - } - flush_put_bits(&pb); - + // Stubbed: requires ff_timecode_set_smpte from libavutil internals, + // which cannot be called cross-library. Not used by any ffvpx codec. + *data = NULL; return 0; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_av1.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_av1.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_av1.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_av1.c 2026-04-29 18:38:25.000000000 +0000 @@ -74,7 +74,7 @@ return bit_depth == 8 ? 0 : bit_depth == 10 ? 1 : 2; } -static int vaapi_av1_decode_init(AVCodecContext *avctx) +static av_cold int vaapi_av1_decode_init(AVCodecContext *avctx) { VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data; @@ -92,7 +92,7 @@ return ff_vaapi_decode_init(avctx); } -static int vaapi_av1_decode_uninit(AVCodecContext *avctx) +static av_cold int vaapi_av1_decode_uninit(AVCodecContext *avctx) { VAAPIAV1DecContext *ctx = avctx->internal->hwaccel_priv_data; @@ -108,6 +108,7 @@ static int vaapi_av1_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_vp8.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp8.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_vp8.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp8.c 2026-04-29 18:38:26.000000000 +0000 @@ -32,6 +32,7 @@ } static int vaapi_vp8_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_vp9.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp9.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vaapi_vp9.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vaapi_vp9.c 2026-04-29 18:38:26.000000000 +0000 @@ -35,6 +35,7 @@ } static int vaapi_vp9_start_frame(AVCodecContext *avctx, + av_unused const AVBufferRef *buffer_ref, av_unused const uint8_t *buffer, av_unused uint32_t size) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/version.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/version.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.c 2026-04-29 18:38:26.000000000 +0000 @@ -31,13 +31,13 @@ unsigned avcodec_version(void) { - static_assert(AV_CODEC_ID_DNXUC == 270 && + static_assert(AV_CODEC_ID_PRORES_RAW == 274 && AV_CODEC_ID_PCM_SGA == 65572 && - AV_CODEC_ID_ADPCM_XMD == 69683 && + AV_CODEC_ID_ADPCM_SANYO == 69685 && AV_CODEC_ID_CBD2_DPCM == 81928 && - AV_CODEC_ID_QOA == 86121 && - AV_CODEC_ID_ARIB_CAPTION == 94233 && - AV_CODEC_ID_SMPTE_2038 == 98315, + AV_CODEC_ID_G728 == 86123 && + AV_CODEC_ID_IVTV_VBI == 94234 && + AV_CODEC_ID_SMPTE_436M_ANC == 98317, "Don't insert new codec ids in the middle of a list"); static_assert(LIBAVCODEC_VERSION_MICRO >= 100, "micro version starts at 100"); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/version.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/version.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/version.h 2026-04-29 18:38:26.000000000 +0000 @@ -29,8 +29,8 @@ #include "version_major.h" -#define LIBAVCODEC_VERSION_MINOR 31 -#define LIBAVCODEC_VERSION_MICRO 100 +#define LIBAVCODEC_VERSION_MINOR 29 +#define LIBAVCODEC_VERSION_MICRO 101 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \ LIBAVCODEC_VERSION_MINOR, \ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/version_major.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/version_major.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/version_major.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/version_major.h 2026-04-29 18:38:26.000000000 +0000 @@ -25,7 +25,7 @@ * Libavcodec version macros. */ -#define LIBAVCODEC_VERSION_MAJOR 61 +#define LIBAVCODEC_VERSION_MAJOR 62 /** * FF_API_* defines may be placed below to indicate public API that will be @@ -37,25 +37,27 @@ * at once through the bump. This improves the git bisect-ability of the change. */ -#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_SUBFRAMES (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_TICKS_PER_FRAME (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_DROPCHANGED (LIBAVCODEC_VERSION_MAJOR < 62) - -#define FF_API_AVFFT (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_FF_PROFILE_LEVEL (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_AVCODEC_CLOSE (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_BUFFER_MIN_SIZE (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_VDPAU_ALLOC_GET_SET (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_QUALITY_FACTOR (LIBAVCODEC_VERSION_MAJOR < 62) -#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 62) +#define FF_API_INIT_PACKET (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_V408_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) #define FF_API_CODEC_PROPS (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_EXR_GAMMA (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_INTRA_DC_PRECISION (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_NVDEC_OLD_PIX_FMTS (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_PARSER_PRIVATE (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_PARSER_CODECID (LIBAVCODEC_VERSION_MAJOR < 63) + +#define FF_API_MJPEG_EXTERN_HUFF (LIBAVCODEC_VERSION_MAJOR < 63) // reminder to remove the OMX encoder on next major bump -#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 62) +#define FF_CODEC_OMX (LIBAVCODEC_VERSION_MAJOR < 63) // reminder to remove Sonic Lossy/Lossless encoders on next major bump -#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 62) +#define FF_CODEC_SONIC_ENC (LIBAVCODEC_VERSION_MAJOR < 63) // reminder to remove Sonic decoder on next-next major bump #define FF_CODEC_SONIC_DEC (LIBAVCODEC_VERSION_MAJOR < 63) +#define FF_API_NVENC_H264_MAIN (LIBAVCODEC_VERSION_MAJOR < 63) + #endif /* AVCODEC_VERSION_MAJOR_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.c 2026-04-29 18:38:26.000000000 +0000 @@ -40,9 +40,9 @@ { ctx->prefetch = just_return; if (bpc <= 8) { - ctx->emulated_edge_mc = ff_emulated_edge_mc_8; + ctx->emulated_edge_mc = emulated_edge_mc_8; } else { - ctx->emulated_edge_mc = ff_emulated_edge_mc_16; + ctx->emulated_edge_mc = emulated_edge_mc_16; } #if ARCH_AARCH64 @@ -53,7 +53,7 @@ ff_videodsp_init_ppc(ctx, bpc); #elif ARCH_RISCV ff_videodsp_init_riscv(ctx, bpc); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_videodsp_init_x86(ctx, bpc); #elif ARCH_MIPS ff_videodsp_init_mips(ctx, bpc); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -29,14 +29,6 @@ #include #include -#define EMULATED_EDGE(depth) \ -void ff_emulated_edge_mc_ ## depth(uint8_t *dst, const uint8_t *src, \ - ptrdiff_t dst_stride, ptrdiff_t src_stride, \ - int block_w, int block_h,\ - int src_x, int src_y, int w, int h); - -EMULATED_EDGE(8) - typedef struct VideoDSPContext { /** * Copy a rectangular area of samples to a temporary buffer and replicate diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp_template.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/videodsp_template.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/videodsp_template.c 2026-04-29 18:38:25.000000000 +0000 @@ -20,15 +20,12 @@ */ #include "bit_depth_template.c" -#if BIT_DEPTH != 8 -// ff_emulated_edge_mc_8 is used by the x86 MpegVideoDSP API. -static -#endif -void FUNC(ff_emulated_edge_mc)(uint8_t *buf, const uint8_t *src, - ptrdiff_t buf_linesize, - ptrdiff_t src_linesize, - int block_w, int block_h, - int src_x, int src_y, int w, int h) + +static void FUNC(emulated_edge_mc)(uint8_t *buf, const uint8_t *src, + ptrdiff_t buf_linesize, + ptrdiff_t src_linesize, + int block_w, int block_h, + int src_x, int src_y, int w, int h) { int x, y; int start_y, start_x, end_y, end_x; @@ -43,8 +40,7 @@ src += (h - 1) * src_linesize; src_y = h - 1; } else if (src_y <= -block_h) { - src -= src_y * src_linesize; - src += (1 - block_h) * src_linesize; + src += (-src_y + 1 - block_h) * src_linesize; src_y = 1 - block_h; } if (src_x >= w) { diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vlc.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vlc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.c 2026-04-29 18:38:25.000000000 +0000 @@ -42,6 +42,8 @@ { \ const uint8_t *ptr = (const uint8_t *)table + i * wrap; \ switch(size) { \ + default: \ + av_unreachable("Only uint8/16/32_t are used"); \ case 1: \ v = *(const uint8_t *)ptr; \ break; \ @@ -49,8 +51,6 @@ v = *(const uint16_t *)ptr; \ break; \ case 4: \ - default: \ - av_assert1(size == 4); \ v = *(const uint32_t *)ptr; \ break; \ } \ @@ -155,7 +155,7 @@ int n = codes[i].bits; uint32_t code = codes[i].code; int symbol = codes[i].symbol; - ff_dlog(NULL, "i=%d n=%d code=0x%"PRIx32"\n", i, n, code); + ff_tlog(NULL, "i=%d n=%d code=0x%"PRIx32"\n", i, n, code); if (n <= table_nb_bits) { /* no need to add another table */ int j = code >> (32 - table_nb_bits); @@ -169,7 +169,7 @@ for (int k = 0; k < nb; k++) { int bits = table[j].len; int oldsym = table[j].sym; - ff_dlog(NULL, "%4x: code=%d n=%d\n", j, i, n); + ff_tlog(NULL, "%4x: code=%d n=%d\n", j, i, n); if ((bits || oldsym) && (bits != n || oldsym != symbol)) { av_log(NULL, AV_LOG_ERROR, "incorrect codes\n"); return AVERROR_INVALIDDATA; @@ -260,7 +260,7 @@ if (ret < 0) return ret; - av_assert0(symbols_size <= 2 || !symbols); + av_assert0(symbols_size <= 2U); j = 0; #define COPY(condition)\ for (int i = 0; i < nb_codes; i++) { \ @@ -491,7 +491,7 @@ // We can only add a code that fits with the shortest other code into the table // We assume the table is sorted by bits and we skip subtables which from our // point of view are basically random corrupted entries - // If we have not a single useable vlc we end with max = nb_codes + // If we have not a single usable vlc we end with max = nb_codes if (buf[max - 1].bits+minbits > numbits) break; } @@ -527,7 +527,7 @@ if (ret < 0) return ret; - multi->table = av_malloc(sizeof(*multi->table) << nb_bits); + multi->table = av_mallocz(sizeof(*multi->table) << nb_bits); if (!multi->table) goto fail; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vlc.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vlc.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vlc.h 2026-04-29 18:38:25.000000000 +0000 @@ -30,9 +30,23 @@ typedef int16_t VLCBaseType; typedef struct VLCElem { - VLCBaseType sym, len; + union { + /// The struct is for use as ordinary VLC (with get_vlc2()) + struct { + VLCBaseType sym; + VLCBaseType len; + }; + /// This struct is for use as run-length VLC (with GET_RL_VLC) + struct { + int16_t level; + int8_t len8; + uint8_t run; + }; + }; } VLCElem; +typedef VLCElem RL_VLC_ELEM; + typedef struct VLC { int bits; VLCElem *table; @@ -53,12 +67,6 @@ int table_size, table_allocated; } VLC_MULTI; -typedef struct RL_VLC_ELEM { - int16_t level; - int8_t len; - uint8_t run; -} RL_VLC_ELEM; - #define vlc_init(vlc, nb_bits, nb_codes, \ bits, bits_wrap, bits_size, \ codes, codes_wrap, codes_size, \ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vorbis_parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vorbis_parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vorbis_parser.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vorbis_parser.c 2026-04-29 18:38:25.000000000 +0000 @@ -31,6 +31,7 @@ #include "libavutil/mem.h" #include "get_bits.h" +#include "parser_internal.h" #include "xiph.h" #include "vorbis_parser_internal.h" @@ -329,16 +330,16 @@ return buf_size; } -static void vorbis_parser_close(AVCodecParserContext *ctx) +static av_cold void vorbis_parser_close(AVCodecParserContext *ctx) { VorbisParseContext *s = ctx->priv_data; av_vorbis_parse_free(&s->vp); } -const AVCodecParser ff_vorbis_parser = { - .codec_ids = { AV_CODEC_ID_VORBIS }, +const FFCodecParser ff_vorbis_parser = { + PARSER_CODEC_LIST(AV_CODEC_ID_VORBIS), .priv_data_size = sizeof(VorbisParseContext), - .parser_parse = vorbis_parse, - .parser_close = vorbis_parser_close, + .parse = vorbis_parse, + .close = vorbis_parser_close, }; #endif /* CONFIG_VORBIS_PARSER */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp3dsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp3dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp3dsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp3dsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -22,6 +22,10 @@ #include #include +// If this is one, {v,h}_loop_filter expect src to be aligned on eight bytes; +// otherwise they don't have any alignment requirements for src. +#define VP3_LOOP_FILTER_NO_UNALIGNED_SUPPORT (ARCH_ARM || ARCH_MIPS) + typedef struct VP3DSPContext { /** * Copy 8xH pixels from source to destination buffer using a bilinear @@ -53,11 +57,11 @@ void ff_vp3dsp_idct10_put(uint8_t *dest, ptrdiff_t stride, int16_t *block); void ff_vp3dsp_idct10_add(uint8_t *dest, ptrdiff_t stride, int16_t *block); -void ff_vp3dsp_init(VP3DSPContext *c, int flags); -void ff_vp3dsp_init_arm(VP3DSPContext *c, int flags); -void ff_vp3dsp_init_ppc(VP3DSPContext *c, int flags); -void ff_vp3dsp_init_x86(VP3DSPContext *c, int flags); -void ff_vp3dsp_init_mips(VP3DSPContext *c, int flags); +void ff_vp3dsp_init(VP3DSPContext *c); +void ff_vp3dsp_init_arm(VP3DSPContext *c); +void ff_vp3dsp_init_ppc(VP3DSPContext *c); +void ff_vp3dsp_init_x86(VP3DSPContext *c); +void ff_vp3dsp_init_mips(VP3DSPContext *c); void ff_vp3dsp_set_bounding_values(int * bound_values_array, int filter_limit); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp56.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp56.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56.h 2026-04-29 18:38:26.000000000 +0000 @@ -118,7 +118,10 @@ HpelDSPContext hdsp; VideoDSPContext vdsp; VP3DSPContext vp3dsp; - VP56DSPContext vp56dsp; + union { + VP5DSPContext vp5dsp; + VP6DSPContext vp6dsp; + }; uint8_t idct_scantable[64]; AVFrame *frames[4]; uint8_t *edge_emu_buffer_alloc; @@ -203,7 +206,7 @@ GetBitContext gb; VLC dccv_vlc[2]; VLC runv_vlc[2]; - VLC ract_vlc[2][3][6]; + VLC ract_vlc[2][3][4]; unsigned int nb_null[2][2]; /* number of consecutive NULL DC/AC */ int have_undamaged_frame; @@ -239,7 +242,7 @@ } // P(7) -static av_unused int vp56_rac_gets_nn(VPXRangeCoder *c, int bits) +av_unused static int vp56_rac_gets_nn(VPXRangeCoder *c, int bits) { int v = vp56_rac_gets(c, 7) << 1; return v + !v; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp56dsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp56dsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp56dsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -24,21 +24,19 @@ #include #include -typedef struct VP56DSPContext { +typedef struct VP5DSPContext { void (*edge_filter_hor)(uint8_t *yuv, ptrdiff_t stride, int t); void (*edge_filter_ver)(uint8_t *yuv, ptrdiff_t stride, int t); +} VP5DSPContext; - void (*vp6_filter_diag4)(uint8_t *dst, uint8_t *src, ptrdiff_t stride, +typedef struct VP6DSPContext { + void (*vp6_filter_diag4)(uint8_t *dst, const uint8_t *src, ptrdiff_t stride, const int16_t *h_weights,const int16_t *v_weights); -} VP56DSPContext; +} VP6DSPContext; -void ff_vp6_filter_diag4_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride, - const int16_t *h_weights, const int16_t *v_weights); +void ff_vp5dsp_init(VP5DSPContext *s); -void ff_vp5dsp_init(VP56DSPContext *s); -void ff_vp6dsp_init(VP56DSPContext *s); - -void ff_vp6dsp_init_arm(VP56DSPContext *s); -void ff_vp6dsp_init_x86(VP56DSPContext *s); +void ff_vp6dsp_init(VP6DSPContext *s); +void ff_vp6dsp_init_x86(VP6DSPContext *s); #endif /* AVCODEC_VP56DSP_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8.c 2026-04-29 18:38:26.000000000 +0000 @@ -541,9 +541,12 @@ /* preserve the golden frame, write a new previous frame */ if (s->framep[VP8_FRAME_GOLDEN] == s->framep[VP8_FRAME_PREVIOUS]) { - s->framep[VP8_FRAME_PREVIOUS] = vp8_find_free_buffer(s); - if ((ret = vp8_alloc_frame(s, s->framep[VP8_FRAME_PREVIOUS], 1)) < 0) + VP8Frame *prev_frame = vp8_find_free_buffer(s); + + ret = vp8_alloc_frame(s, prev_frame, 1); + if (ret < 0) return ret; + s->framep[VP8_FRAME_PREVIOUS] = prev_frame; dst = s->framep[VP8_FRAME_PREVIOUS]->tf.f; @@ -730,7 +733,7 @@ int height = s->avctx->height; if (buf_size < 3) { - av_log(s->avctx, AV_LOG_ERROR, "Insufficent data (%d) for header\n", buf_size); + av_log(s->avctx, AV_LOG_ERROR, "Insufficient data (%d) for header\n", buf_size); return AVERROR_INVALIDDATA; } @@ -2413,7 +2416,7 @@ mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); else { // Make sure the previous frame has read its segmentation map, - // if we re-use the same map. + // if we reuse the same map. if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_progress_frame_await(&prev_frame->tf, mb_y); @@ -2512,18 +2515,6 @@ return 0; } -static int vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, - int jobnr, int threadnr) -{ - return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1); -} - -static int vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, - int jobnr, int threadnr) -{ - return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0); -} - static av_always_inline void filter_mb_row(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) { @@ -2531,7 +2522,6 @@ VP8ThreadData *td = &s->thread_data[threadnr]; int mb_x, mb_y = atomic_load(&td->thread_mb_pos) >> 16, num_jobs = s->num_jobs; AVFrame *curframe = s->curframe->tf.f; - VP8Macroblock *mb; VP8ThreadData *prev_td, *next_td; uint8_t *dst[3] = { curframe->data[0] + 16 * mb_y * s->linesize, @@ -2539,11 +2529,6 @@ curframe->data[2] + 8 * mb_y * s->uvlinesize }; - if (s->mb_layout == 1) - mb = s->macroblocks_base + ((s->mb_width + 1) * (mb_y + 1) + 1); - else - mb = s->macroblocks + (s->mb_height - mb_y - 1) * 2; - if (mb_y == 0) prev_td = td; else @@ -2553,7 +2538,7 @@ else next_td = &s->thread_data[(jobnr + 1) % num_jobs]; - for (mb_x = 0; mb_x < s->mb_width; mb_x++, mb++) { + for (mb_x = 0; mb_x < s->mb_width; mb_x++) { const VP8FilterStrength *f = &td->filter_strength[mb_x]; if (prev_td != td) check_thread_pos(td, prev_td, @@ -2583,18 +2568,6 @@ } } -static void vp7_filter_mb_row(AVCodecContext *avctx, void *tdata, - int jobnr, int threadnr) -{ - filter_mb_row(avctx, tdata, jobnr, threadnr, 1); -} - -static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, - int jobnr, int threadnr) -{ - filter_mb_row(avctx, tdata, jobnr, threadnr, 0); -} - static av_always_inline int vp78_decode_mb_row_sliced(AVCodecContext *avctx, void *tdata, int jobnr, int threadnr, int is_vp7) @@ -2699,8 +2672,6 @@ &s->frames[i] != s->framep[VP8_FRAME_ALTREF]) vp8_release_frame(&s->frames[i]); - curframe = s->framep[VP8_FRAME_CURRENT] = vp8_find_free_buffer(s); - if (!s->colorspace) avctx->colorspace = AVCOL_SPC_BT470BG; if (s->fullrange) @@ -2721,8 +2692,10 @@ goto err; } + curframe = vp8_find_free_buffer(s); if ((ret = vp8_alloc_frame(s, curframe, referenced)) < 0) goto err; + s->framep[VP8_FRAME_CURRENT] = curframe; if (s->keyframe) curframe->tf.f->flags |= AV_FRAME_FLAG_KEY; else @@ -2751,9 +2724,9 @@ if (!is_vp7 && !s->actually_webp) ff_thread_finish_setup(avctx); - if (avctx->hwaccel) { + if (!is_vp7 && avctx->hwaccel) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); - ret = hwaccel->start_frame(avctx, avpkt->data, avpkt->size); + ret = hwaccel->start_frame(avctx, avpkt->buf, avpkt->data, avpkt->size); if (ret < 0) goto err; @@ -2782,7 +2755,7 @@ if (s->mb_layout == 1) { // Make sure the previous frame has read its segmentation map, - // if we re-use the same map. + // if we reuse the same map. if (prev_frame && s->segmentation.enabled && !s->segmentation.update_map) ff_progress_frame_await(&prev_frame->tf, 1); @@ -2837,20 +2810,6 @@ return ret; } -int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame, - int *got_frame, AVPacket *avpkt) -{ - return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP8); -} - -#if CONFIG_VP7_DECODER -static int vp7_decode_frame(AVCodecContext *avctx, AVFrame *frame, - int *got_frame, AVPacket *avpkt) -{ - return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP7); -} -#endif /* CONFIG_VP7_DECODER */ - av_cold int ff_vp8_decode_free(AVCodecContext *avctx) { vp8_decode_flush_impl(avctx, 1); @@ -2858,8 +2817,7 @@ return 0; } -static av_always_inline -int vp78_decode_init(AVCodecContext *avctx, int is_vp7) +static av_cold void vp78_decode_init(AVCodecContext *avctx) { VP8Context *s = avctx->priv_data; @@ -2870,37 +2828,43 @@ ff_videodsp_init(&s->vdsp, 8); ff_vp78dsp_init(&s->vp8dsp); - if (CONFIG_VP7_DECODER && is_vp7) { - ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1); - ff_vp7dsp_init(&s->vp8dsp); - s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter; - s->filter_mb_row = vp7_filter_mb_row; - } else if (CONFIG_VP8_DECODER && !is_vp7) { - ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1); - ff_vp8dsp_init(&s->vp8dsp); - s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter; - s->filter_mb_row = vp8_filter_mb_row; - } /* does not change for VP8 */ memcpy(s->prob[0].scan, ff_zigzag_scan, sizeof(s->prob[0].scan)); +} - return 0; +#if CONFIG_VP8_DECODER +static int vp8_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, + int jobnr, int threadnr) +{ + return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 0); } -#if CONFIG_VP7_DECODER -static int vp7_decode_init(AVCodecContext *avctx) +static void vp8_filter_mb_row(AVCodecContext *avctx, void *tdata, + int jobnr, int threadnr) { - return vp78_decode_init(avctx, IS_VP7); + filter_mb_row(avctx, tdata, jobnr, threadnr, 0); +} + +int ff_vp8_decode_frame(AVCodecContext *avctx, AVFrame *frame, + int *got_frame, AVPacket *avpkt) +{ + return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP8); } -#endif /* CONFIG_VP7_DECODER */ av_cold int ff_vp8_decode_init(AVCodecContext *avctx) { - return vp78_decode_init(avctx, IS_VP8); + VP8Context *s = avctx->priv_data; + + vp78_decode_init(avctx); + ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP8, 8, 1); + ff_vp8dsp_init(&s->vp8dsp); + s->decode_mb_row_no_filter = vp8_decode_mb_row_no_filter; + s->filter_mb_row = vp8_filter_mb_row; + + return 0; } -#if CONFIG_VP8_DECODER #if HAVE_THREADS static void vp8_replace_frame(VP8Frame *dst, const VP8Frame *src) { @@ -2944,6 +2908,37 @@ #endif /* CONFIG_VP8_DECODER */ #if CONFIG_VP7_DECODER +static int vp7_decode_mb_row_no_filter(AVCodecContext *avctx, void *tdata, + int jobnr, int threadnr) +{ + return decode_mb_row_no_filter(avctx, tdata, jobnr, threadnr, 1); +} + +static void vp7_filter_mb_row(AVCodecContext *avctx, void *tdata, + int jobnr, int threadnr) +{ + filter_mb_row(avctx, tdata, jobnr, threadnr, 1); +} + +static int vp7_decode_frame(AVCodecContext *avctx, AVFrame *frame, + int *got_frame, AVPacket *avpkt) +{ + return vp78_decode_frame(avctx, frame, got_frame, avpkt, IS_VP7); +} + +av_cold static int vp7_decode_init(AVCodecContext *avctx) +{ + VP8Context *s = avctx->priv_data; + + vp78_decode_init(avctx); + ff_h264_pred_init(&s->hpc, AV_CODEC_ID_VP7, 8, 1); + ff_vp7dsp_init(&s->vp8dsp); + s->decode_mb_row_no_filter = vp7_decode_mb_row_no_filter; + s->filter_mb_row = vp7_filter_mb_row; + + return 0; +} + const FFCodec ff_vp7_decoder = { .p.name = "vp7", CODEC_LONG_NAME("On2 VP7"), @@ -2984,4 +2979,4 @@ NULL }, }; -#endif /* CONFIG_VP7_DECODER */ +#endif /* CONFIG_VP8_DECODER */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp89_rac.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp89_rac.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp89_rac.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp89_rac.h 2026-04-29 18:38:26.000000000 +0000 @@ -38,7 +38,7 @@ return vpx_rac_get_prob(c, 128); } -static av_unused int vp89_rac_get_uint(VPXRangeCoder *c, int bits) +av_unused static int vp89_rac_get_uint(VPXRangeCoder *c, int bits) { int value = 0; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8_parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8_parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8_parser.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8_parser.c 2026-04-29 18:38:26.000000000 +0000 @@ -19,6 +19,7 @@ #include "libavutil/intreadwrite.h" #include "avcodec.h" +#include "parser_internal.h" static int parse(AVCodecParserContext *s, AVCodecContext *avctx, @@ -73,7 +74,7 @@ return buf_size; } -const AVCodecParser ff_vp8_parser = { - .codec_ids = { AV_CODEC_ID_VP8 }, - .parser_parse = parse, +const FFCodecParser ff_vp8_parser = { + PARSER_CODEC_LIST(AV_CODEC_ID_VP8), + .parse = parse, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8dsp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8dsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp8dsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp8dsp.c 2026-04-29 18:38:25.000000000 +0000 @@ -249,14 +249,14 @@ // because I like only having two parameters to pass functions... #define LOAD_PIXELS \ - int av_unused p3 = p[-4 * stride]; \ - int av_unused p2 = p[-3 * stride]; \ - int av_unused p1 = p[-2 * stride]; \ - int av_unused p0 = p[-1 * stride]; \ - int av_unused q0 = p[ 0 * stride]; \ - int av_unused q1 = p[ 1 * stride]; \ - int av_unused q2 = p[ 2 * stride]; \ - int av_unused q3 = p[ 3 * stride]; + av_unused int p3 = p[-4 * stride]; \ + av_unused int p2 = p[-3 * stride]; \ + av_unused int p1 = p[-2 * stride]; \ + av_unused int p0 = p[-1 * stride]; \ + av_unused int q0 = p[ 0 * stride]; \ + av_unused int q1 = p[ 1 * stride]; \ + av_unused int q2 = p[ 2 * stride]; \ + av_unused int q3 = p[ 3 * stride]; #define clip_int8(n) (cm[(n) + 0x80] - 0x80) @@ -558,26 +558,21 @@ } \ } -VP8_EPEL_H(16, 4) VP8_EPEL_H(8, 4) VP8_EPEL_H(4, 4) VP8_EPEL_H(16, 6) VP8_EPEL_H(8, 6) VP8_EPEL_H(4, 6) -VP8_EPEL_V(16, 4) VP8_EPEL_V(8, 4) VP8_EPEL_V(4, 4) VP8_EPEL_V(16, 6) VP8_EPEL_V(8, 6) VP8_EPEL_V(4, 6) -VP8_EPEL_HV(16, 4, 4) VP8_EPEL_HV(8, 4, 4) VP8_EPEL_HV(4, 4, 4) -VP8_EPEL_HV(16, 4, 6) VP8_EPEL_HV(8, 4, 6) VP8_EPEL_HV(4, 4, 6) -VP8_EPEL_HV(16, 6, 4) VP8_EPEL_HV(8, 6, 4) VP8_EPEL_HV(4, 6, 4) VP8_EPEL_HV(16, 6, 6) @@ -667,7 +662,11 @@ av_cold void ff_vp78dsp_init(VP8DSPContext *dsp) { - VP78_MC_FUNC(0, 16); + dsp->put_vp8_epel_pixels_tab[0][0][0] = put_vp8_pixels16_c; + dsp->put_vp8_epel_pixels_tab[0][0][2] = put_vp8_epel16_h6_c; + dsp->put_vp8_epel_pixels_tab[0][2][0] = put_vp8_epel16_v6_c; + dsp->put_vp8_epel_pixels_tab[0][2][2] = put_vp8_epel16_h6v6_c; + VP78_MC_FUNC(1, 8); VP78_MC_FUNC(2, 4); @@ -683,7 +682,7 @@ ff_vp78dsp_init_ppc(dsp); #elif ARCH_RISCV ff_vp78dsp_init_riscv(dsp); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_vp78dsp_init_x86(dsp); #endif } @@ -750,7 +749,7 @@ ff_vp8dsp_init_arm(dsp); #elif ARCH_RISCV ff_vp8dsp_init_riscv(dsp); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_vp8dsp_init_x86(dsp); #elif ARCH_MIPS ff_vp8dsp_init_mips(dsp); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9.c 2026-04-29 18:38:25.000000000 +0000 @@ -41,6 +41,7 @@ #include "vp9data.h" #include "vp9dec.h" #include "vpx_rac.h" +#include "libavutil/attributes.h" #include "libavutil/avassert.h" #include "libavutil/mem.h" #include "libavutil/pixdesc.h" @@ -97,6 +98,7 @@ static void vp9_frame_unref(VP9Frame *f) { ff_progress_frame_unref(&f->tf); + av_refstruct_unref(&f->header_ref); av_refstruct_unref(&f->extradata); av_refstruct_unref(&f->hwaccel_picture_private); f->segmentation_map = NULL; @@ -145,6 +147,9 @@ static void vp9_frame_replace(VP9Frame *dst, const VP9Frame *src) { + av_refstruct_replace(&dst->header_ref, src->header_ref); + dst->frame_header = src->frame_header; + ff_progress_frame_replace(&dst->tf, &src->tf); av_refstruct_replace(&dst->extradata, src->extradata); @@ -165,16 +170,19 @@ CONFIG_VP9_NVDEC_HWACCEL + \ CONFIG_VP9_VAAPI_HWACCEL + \ CONFIG_VP9_VDPAU_HWACCEL + \ - CONFIG_VP9_VIDEOTOOLBOX_HWACCEL) + CONFIG_VP9_VIDEOTOOLBOX_HWACCEL + \ + CONFIG_VP9_VULKAN_HWACCEL) enum AVPixelFormat pix_fmts[HWACCEL_MAX + 2], *fmtp = pix_fmts; VP9Context *s = avctx->priv_data; uint8_t *p; int bytesperpixel = s->bytesperpixel, ret, cols, rows; int lflvl_len, i; + int changed = 0; av_assert0(w > 0 && h > 0); if (!(s->pix_fmt == s->gf_fmt && w == s->w && h == s->h)) { + changed = 1; if ((ret = ff_set_dimensions(avctx, w, h)) < 0) return ret; @@ -203,6 +211,9 @@ #if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL *fmtp++ = AV_PIX_FMT_VIDEOTOOLBOX; #endif +#if CONFIG_VP9_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; +#endif break; case AV_PIX_FMT_YUV420P12: #if CONFIG_VP9_NVDEC_HWACCEL @@ -214,6 +225,9 @@ #if CONFIG_VP9_VDPAU_HWACCEL *fmtp++ = AV_PIX_FMT_VDPAU; #endif +#if CONFIG_VP9_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; +#endif break; case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_YUV444P10: @@ -221,6 +235,9 @@ #if CONFIG_VP9_VAAPI_HWACCEL *fmtp++ = AV_PIX_FMT_VAAPI; #endif +#if CONFIG_VP9_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; +#endif break; case AV_PIX_FMT_GBRP: case AV_PIX_FMT_GBRP10: @@ -228,6 +245,9 @@ #if CONFIG_VP9_VAAPI_HWACCEL *fmtp++ = AV_PIX_FMT_VAAPI; #endif +#if CONFIG_VP9_VULKAN_HWACCEL + *fmtp++ = AV_PIX_FMT_VULKAN; +#endif break; } @@ -250,7 +270,7 @@ rows = (h + 7) >> 3; if (s->intra_pred_data[0] && cols == s->cols && rows == s->rows && s->pix_fmt == s->last_fmt) - return 0; + return changed; s->last_fmt = s->pix_fmt; s->sb_cols = (w + 63) >> 6; @@ -295,9 +315,10 @@ ff_vp9dsp_init(&s->dsp, s->s.h.bpp, avctx->flags & AV_CODEC_FLAG_BITEXACT); ff_videodsp_init(&s->vdsp, s->s.h.bpp); s->last_bpp = s->s.h.bpp; + changed = 1; } - return 0; + return changed; } static int update_block_buffers(AVCodecContext *avctx) @@ -504,6 +525,7 @@ int c, i, j, k, l, m, n, w, h, max, size2, ret, sharp; int last_invisible; const uint8_t *data2; + int changed; /* general header */ if ((ret = init_get_bits8(&s->gb, data, size)) < 0) { @@ -773,10 +795,10 @@ } /* tiling info */ - if ((ret = update_size(avctx, w, h)) < 0) { + if ((changed = update_size(avctx, w, h)) < 0) { av_log(avctx, AV_LOG_ERROR, "Failed to initialize decoder for %dx%d @ %d\n", w, h, s->pix_fmt); - return ret; + return changed; } for (s->s.h.tiling.log2_tile_cols = 0; s->sb_cols > (64 << s->s.h.tiling.log2_tile_cols); @@ -791,7 +813,7 @@ } s->s.h.tiling.log2_tile_rows = decode012(&s->gb); s->s.h.tiling.tile_rows = 1 << s->s.h.tiling.log2_tile_rows; - if (s->s.h.tiling.tile_cols != (1 << s->s.h.tiling.log2_tile_cols)) { + if (s->s.h.tiling.tile_cols != (1 << s->s.h.tiling.log2_tile_cols) || changed) { int n_range_coders; VPXRangeCoder *rc; @@ -1142,7 +1164,8 @@ uvoff + (8 * hbs * bytesperpixel >> s->ss_h), bl + 1); break; default: - av_assert0(0); + av_unreachable("ff_vp9_partition_tree only has " + "the four PARTITION_* terminal codes"); } } else if (vpx_rac_get_prob_branchy(td->c, p[1])) { bp = PARTITION_SPLIT; @@ -1249,6 +1272,7 @@ for (i = 0; i < 8; i++) { ff_progress_frame_unref(&s->s.refs[i]); ff_progress_frame_unref(&s->next_refs[i]); + vp9_frame_unref(&s->s.ref_frames[i]); } free_buffers(s); @@ -1256,6 +1280,11 @@ av_freep(&s->entries); ff_pthread_free(s, vp9_context_offsets); #endif + + av_refstruct_unref(&s->header_ref); + ff_cbs_fragment_free(&s->current_frag); + ff_cbs_close(&s->cbc); + av_freep(&s->td); return 0; } @@ -1558,22 +1587,41 @@ int size = pkt->size; VP9Context *s = avctx->priv_data; int ret, i, j, ref; + CodedBitstreamUnit *unit; + VP9RawFrame *rf; + int retain_segmap_ref = s->s.frames[REF_FRAME_SEGMAP].segmentation_map && (!s->s.h.segmentation.enabled || !s->s.h.segmentation.update_map); const VP9Frame *src; AVFrame *f; + ret = ff_cbs_read_packet(s->cbc, &s->current_frag, pkt); + if (ret < 0) { + ff_cbs_fragment_reset(&s->current_frag); + av_log(avctx, AV_LOG_ERROR, "Failed to read frame header.\n"); + return ret; + } + + unit = &s->current_frag.units[0]; + rf = unit->content; + + av_refstruct_replace(&s->header_ref, unit->content_ref); + s->frame_header = &rf->header; + if ((ret = decode_frame_header(avctx, data, size, &ref)) < 0) { + ff_cbs_fragment_reset(&s->current_frag); return ret; } else if (ret == 0) { if (!s->s.refs[ref].f) { av_log(avctx, AV_LOG_ERROR, "Requested reference %d not available\n", ref); + ff_cbs_fragment_reset(&s->current_frag); return AVERROR_INVALIDDATA; } for (int i = 0; i < 8; i++) ff_progress_frame_replace(&s->next_refs[i], &s->s.refs[i]); ff_thread_finish_setup(avctx); ff_progress_frame_await(&s->s.refs[ref], INT_MAX); + ff_cbs_fragment_reset(&s->current_frag); if ((ret = av_frame_ref(frame, s->s.refs[ref].f)) < 0) return ret; @@ -1591,8 +1639,14 @@ vp9_frame_replace(&s->s.frames[REF_FRAME_SEGMAP], src); vp9_frame_replace(&s->s.frames[REF_FRAME_MVPAIR], src); vp9_frame_unref(&s->s.frames[CUR_FRAME]); - if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0) + if ((ret = vp9_frame_alloc(avctx, &s->s.frames[CUR_FRAME])) < 0) { + ff_cbs_fragment_reset(&s->current_frag); return ret; + } + + s->s.frames[CUR_FRAME].header_ref = av_refstruct_ref(s->header_ref); + s->s.frames[CUR_FRAME].frame_header = s->frame_header; + f = s->s.frames[CUR_FRAME].tf.f; if (s->s.h.keyframe) f->flags |= AV_FRAME_FLAG_KEY; @@ -1620,7 +1674,7 @@ if (avctx->hwaccel) { const FFHWAccel *hwaccel = ffhwaccel(avctx->hwaccel); - ret = hwaccel->start_frame(avctx, NULL, 0); + ret = hwaccel->start_frame(avctx, pkt->buf, pkt->data, pkt->size); if (ret < 0) return ret; ret = hwaccel->decode_slice(avctx, pkt->data, pkt->size); @@ -1629,6 +1683,13 @@ ret = hwaccel->end_frame(avctx); if (ret < 0) return ret; + + for (i = 0; i < 8; i++) { + vp9_frame_replace(&s->s.ref_frames[i], + s->s.h.refreshrefmask & (1 << i) ? + &s->s.frames[CUR_FRAME] : &s->s.ref_frames[i]); + } + goto finish; } @@ -1753,6 +1814,8 @@ } finish: + ff_cbs_fragment_reset(&s->current_frag); + ff_progress_frame_report(&s->s.frames[CUR_FRAME].tf, INT_MAX); // ref frame setup for (int i = 0; i < 8; i++) @@ -1766,19 +1829,26 @@ return pkt->size; fail: + ff_cbs_fragment_reset(&s->current_frag); ff_progress_frame_report(&s->s.frames[CUR_FRAME].tf, INT_MAX); return ret; } -static void vp9_decode_flush(AVCodecContext *avctx) +static av_cold void vp9_decode_flush(AVCodecContext *avctx) { VP9Context *s = avctx->priv_data; int i; for (i = 0; i < 3; i++) vp9_frame_unref(&s->s.frames[i]); - for (i = 0; i < 8; i++) + + for (i = 0; i < 8; i++) { ff_progress_frame_unref(&s->s.refs[i]); + vp9_frame_unref(&s->s.ref_frames[i]); + } + + ff_cbs_fragment_reset(&s->current_frag); + ff_cbs_flush(s->cbc); if (FF_HW_HAS_CB(avctx, flush)) FF_HW_SIMPLE_CALL(avctx, flush); @@ -1792,6 +1862,10 @@ s->last_bpp = 0; s->s.h.filter.sharpness = -1; + ret = ff_cbs_init(&s->cbc, AV_CODEC_ID_VP9, avctx); + if (ret < 0) + return ret; + #if HAVE_THREADS if (avctx->active_thread_type & FF_THREAD_SLICE) { ret = ff_pthread_init(s, vp9_context_offsets); @@ -1815,6 +1889,13 @@ av_refstruct_replace(&s->frame_extradata_pool, ssrc->frame_extradata_pool); s->frame_extradata_pool_size = ssrc->frame_extradata_pool_size; + av_refstruct_replace(&s->header_ref, ssrc->header_ref); + for (int i = 0; i < 8; i++) + vp9_frame_replace(&s->s.ref_frames[i], &ssrc->s.ref_frames[i]); + + s->frame_header = ssrc->frame_header; + memcpy(s->cbc->priv_data, ssrc->cbc->priv_data, sizeof(CodedBitstreamVP9Context)); + s->s.h.invisible = ssrc->s.h.invisible; s->s.h.keyframe = ssrc->s.h.keyframe; s->s.h.intraonly = ssrc->s.h.intraonly; @@ -1881,6 +1962,9 @@ #if CONFIG_VP9_VIDEOTOOLBOX_HWACCEL HWACCEL_VIDEOTOOLBOX(vp9), #endif +#if CONFIG_VP9_VULKAN_HWACCEL + HWACCEL_VULKAN(vp9), +#endif NULL }, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9_parser.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9_parser.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9_parser.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9_parser.c 2026-04-29 18:38:25.000000000 +0000 @@ -21,9 +21,9 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "libavutil/intreadwrite.h" -#include "libavcodec/get_bits.h" -#include "parser.h" +#include "avcodec.h" +#include "get_bits.h" +#include "parser_internal.h" static int parse(AVCodecParserContext *ctx, AVCodecContext *avctx, @@ -64,7 +64,7 @@ return size; } -const AVCodecParser ff_vp9_parser = { - .codec_ids = { AV_CODEC_ID_VP9 }, - .parser_parse = parse, +const FFCodecParser ff_vp9_parser = { + PARSER_CODEC_LIST(AV_CODEC_ID_VP9), + .parse = parse, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dec.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dec.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dec.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dec.h 2026-04-29 18:38:26.000000000 +0000 @@ -38,6 +38,7 @@ #include "vp9dsp.h" #include "vp9shared.h" #include "vpx_rac.h" +#include "cbs_vp9.h" #define REF_INVALID_SCALE 0xFFFF @@ -97,6 +98,11 @@ VP9SharedContext s; VP9TileData *td; + CodedBitstreamContext *cbc; + CodedBitstreamFragment current_frag; + VP9RawFrame *header_ref; ///< RefStruct reference backing frame_header + VP9RawFrameHeader *frame_header; + VP9DSPContext dsp; VideoDSPContext vdsp; GetBitContext gb; @@ -220,8 +226,8 @@ DECLARE_ALIGNED(8, uint8_t, left_ref_ctx)[8]; DECLARE_ALIGNED(8, uint8_t, left_filter_ctx)[8]; // block reconstruction intermediates - DECLARE_ALIGNED(32, uint8_t, tmp_y)[64 * 64 * 2]; - DECLARE_ALIGNED(32, uint8_t, tmp_uv)[2][64 * 64 * 2]; + DECLARE_ALIGNED(64, uint8_t, tmp_y)[64 * 64 * 2]; + DECLARE_ALIGNED(64, uint8_t, tmp_uv)[2][64 * 64 * 2]; struct { int x, y; } min_mv, max_mv; int16_t *block_base, *block, *uvblock_base[2], *uvblock[2]; uint8_t *eob_base, *uveob_base[2], *eob, *uveob[2]; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dsp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.c 2026-04-29 18:38:26.000000000 +0000 @@ -102,7 +102,7 @@ ff_vp9dsp_init_arm(dsp, bpp); #elif ARCH_RISCV ff_vp9dsp_init_riscv(dsp, bpp, bitexact); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_vp9dsp_init_x86(dsp, bpp, bitexact); #elif ARCH_MIPS ff_vp9dsp_init_mips(dsp, bpp); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9dsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9dsp.h 2026-04-29 18:38:26.000000000 +0000 @@ -121,7 +121,7 @@ vp9_scaled_mc_func smc[5][N_FILTERS][2]; } VP9DSPContext; -extern const int16_t attribute_visibility_hidden ff_vp9_subpel_filters[3][16][8]; +EXTERN const int16_t ff_vp9_subpel_filters[3][16][8]; void ff_vp9dsp_init(VP9DSPContext *dsp, int bpp, int bitexact); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9shared.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9shared.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/vp9shared.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/vp9shared.h 2026-04-29 18:38:25.000000000 +0000 @@ -30,6 +30,7 @@ #include "libavutil/mem_internal.h" #include "progressframe.h" +#include "cbs_vp9.h" #include "vp9.h" enum BlockPartition { @@ -63,6 +64,9 @@ } VP9mvrefPair; typedef struct VP9Frame { + VP9RawFrame *header_ref; ///< RefStruct reference backing frame_header + VP9RawFrameHeader *frame_header; + ProgressFrame tf; void *extradata; ///< RefStruct reference uint8_t *segmentation_map; @@ -170,6 +174,7 @@ #define REF_FRAME_SEGMAP 2 #define BLANK_FRAME 3 VP9Frame frames[4]; + VP9Frame ref_frames[8]; } VP9SharedContext; #endif /* AVCODEC_VP9SHARED_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/constants.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/constants.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.c 2026-04-29 18:38:26.000000000 +0000 @@ -30,6 +30,7 @@ DECLARE_ASM_ALIGNED(32, const ymm_reg, ff_pw_4) = { 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL, 0x0004000400040004ULL }; DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_5) = { 0x0005000500050005ULL, 0x0005000500050005ULL }; +DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_7) = { 0x0007000700070007ULL, 0x0007000700070007ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_8) = { 0x0008000800080008ULL, 0x0008000800080008ULL }; DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_9) = { 0x0009000900090009ULL, 0x0009000900090009ULL }; DECLARE_ALIGNED(8, const uint64_t, ff_pw_15) = 0x000F000F000F000FULL; @@ -37,10 +38,8 @@ DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_18) = { 0x0012001200120012ULL, 0x0012001200120012ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_20) = { 0x0014001400140014ULL, 0x0014001400140014ULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_pw_32) = { 0x0020002000200020ULL, 0x0020002000200020ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_42) = 0x002A002A002A002AULL; DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_53) = 0x0035003500350035ULL; DECLARE_ASM_ALIGNED(16, const xmm_reg, ff_pw_64) = { 0x0040004000400040ULL, 0x0040004000400040ULL }; -DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_96) = 0x0060006000600060ULL; DECLARE_ASM_ALIGNED(8, const uint64_t, ff_pw_128) = 0x0080008000800080ULL; DECLARE_ALIGNED(32, const ymm_reg, ff_pw_255) = { 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL, 0x00ff00ff00ff00ffULL }; @@ -77,7 +76,7 @@ 0x8080808080808080ULL, 0x8080808080808080ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pb_FE) = { 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL, 0xFEFEFEFEFEFEFEFEULL }; -DECLARE_ALIGNED(8, const uint64_t, ff_pb_FC) = 0xFCFCFCFCFCFCFCFCULL; +DECLARE_ALIGNED(16, const xmm_reg, ff_pb_FC) = { 0xFCFCFCFCFCFCFCFCULL, 0xFCFCFCFCFCFCFCFCULL }; DECLARE_ALIGNED(16, const xmm_reg, ff_ps_neg) = { 0x8000000080000000ULL, 0x8000000080000000ULL }; @@ -87,6 +86,8 @@ 0x0000001000000010ULL, 0x0000001000000010ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pd_32) = { 0x0000002000000020ULL, 0x0000002000000020ULL, 0x0000002000000020ULL, 0x0000002000000020ULL }; +DECLARE_ALIGNED(32, const ymm_reg, ff_pd_64) = { 0x0000004000000040ULL, 0x0000004000000040ULL, + 0x0000004000000040ULL, 0x0000004000000040ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pd_8192) = { 0x0000200000002000ULL, 0x0000200000002000ULL, 0x0000200000002000ULL, 0x0000200000002000ULL }; DECLARE_ALIGNED(32, const ymm_reg, ff_pd_65535)= { 0x0000ffff0000ffffULL, 0x0000ffff0000ffffULL, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/constants.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/constants.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/constants.h 2026-04-29 18:38:26.000000000 +0000 @@ -30,6 +30,7 @@ extern const xmm_reg ff_pw_3; extern const ymm_reg ff_pw_4; extern const xmm_reg ff_pw_5; +extern const xmm_reg ff_pw_7; extern const xmm_reg ff_pw_8; extern const xmm_reg ff_pw_9; extern const uint64_t ff_pw_15; @@ -37,10 +38,8 @@ extern const xmm_reg ff_pw_18; extern const xmm_reg ff_pw_20; extern const xmm_reg ff_pw_32; -extern const uint64_t ff_pw_42; extern const uint64_t ff_pw_53; extern const xmm_reg ff_pw_64; -extern const uint64_t ff_pw_96; extern const uint64_t ff_pw_128; extern const ymm_reg ff_pw_255; extern const ymm_reg ff_pw_256; @@ -58,14 +57,15 @@ extern const ymm_reg ff_pb_2; extern const ymm_reg ff_pb_3; extern const ymm_reg ff_pb_80; +extern const xmm_reg ff_pb_FC; extern const ymm_reg ff_pb_FE; -extern const uint64_t ff_pb_FC; extern const xmm_reg ff_ps_neg; extern const ymm_reg ff_pd_1; extern const ymm_reg ff_pd_16; extern const ymm_reg ff_pd_32; +extern const ymm_reg ff_pd_64; extern const ymm_reg ff_pd_8192; extern const ymm_reg ff_pd_65535; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/fdct.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdct.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/fdct.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdct.c 2026-04-29 18:38:26.000000000 +0000 @@ -44,10 +44,6 @@ // constants for the forward DCT // ----------------------------- // -// Be sure to check that your compiler is aligning all constants to QWORD -// (8-byte) memory boundaries! Otherwise the unaligned memory access will -// severely stall MMX execution. -// ////////////////////////////////////////////////////////////////////// #define BITS_FRW_ACC 3 //; 2 or 3 for accuracy diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/fdctdsp_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdctdsp_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/fdctdsp_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/fdctdsp_init.c 2026-04-29 18:38:26.000000000 +0000 @@ -26,6 +26,7 @@ av_cold void ff_fdctdsp_init_x86(FDCTDSPContext *c, AVCodecContext *avctx, unsigned high_bit_depth) { +#if HAVE_SSE2_INLINE int cpu_flags = av_get_cpu_flags(); const int dct_algo = avctx->dct_algo; @@ -35,4 +36,5 @@ c->fdct = ff_fdct_sse2; } } +#endif } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/flacdsp_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/flacdsp_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/flacdsp_init.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/flacdsp_init.c 2026-04-29 18:38:26.000000000 +0000 @@ -62,7 +62,6 @@ av_cold void ff_flacdsp_init_x86(FLACDSPContext *c, enum AVSampleFormat fmt, int channels) { -#if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_SSE2(cpu_flags)) { @@ -85,8 +84,10 @@ c->decorrelate[0] = ff_flac_decorrelate_indep4_16_ssse3; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_16_ssse3; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_16_ssse3; +#endif } else if (fmt == AV_SAMPLE_FMT_S32) { if (channels == 2) c->decorrelate[0] = ff_flac_decorrelate_indep2_32_ssse3; @@ -94,8 +95,10 @@ c->decorrelate[0] = ff_flac_decorrelate_indep4_32_ssse3; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_32_ssse3; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_32_ssse3; +#endif } } if (EXTERNAL_SSE4(cpu_flags)) { @@ -105,19 +108,22 @@ } if (EXTERNAL_AVX(cpu_flags)) { if (fmt == AV_SAMPLE_FMT_S16) { - if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_16_avx; +#endif } else if (fmt == AV_SAMPLE_FMT_S32) { if (channels == 4) c->decorrelate[0] = ff_flac_decorrelate_indep4_32_avx; else if (channels == 6) c->decorrelate[0] = ff_flac_decorrelate_indep6_32_avx; - else if (ARCH_X86_64 && channels == 8) +#if ARCH_X86_64 + else if (channels == 8) c->decorrelate[0] = ff_flac_decorrelate_indep8_32_avx; +#endif } } if (EXTERNAL_XOP(cpu_flags)) { c->lpc32 = ff_flac_lpc_32_xop; } -#endif /* HAVE_X86ASM */ } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/h264_intrapred.asm thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred.asm --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/h264_intrapred.asm 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred.asm 2026-04-29 18:38:25.000000000 +0000 @@ -606,37 +606,31 @@ PRED8x8_H ;----------------------------------------------------------------------------- -; void ff_pred8x8_top_dc_8_mmxext(uint8_t *src, ptrdiff_t stride) +; void ff_pred8x8_top_dc_8_sse2(uint8_t *src, ptrdiff_t stride) ;----------------------------------------------------------------------------- -INIT_MMX mmxext +INIT_XMM sse2 cglobal pred8x8_top_dc_8, 2,5 sub r0, r1 - movq mm0, [r0] - pxor mm1, mm1 - pxor mm2, mm2 + movq xmm0, [r0] + pxor xmm1, xmm1 lea r2, [r0+r1*2] - punpckhbw mm1, mm0 - punpcklbw mm0, mm2 - psadbw mm1, mm2 ; s1 + punpcklbw xmm0, xmm1 + psadbw xmm0, xmm1 ; s0,0,0,0,s1,0,0,0 (w) lea r3, [r2+r1*2] - psadbw mm0, mm2 ; s0 - psrlw mm1, 1 - psrlw mm0, 1 - pavgw mm1, mm2 - lea r4, [r3+r1*2] - pavgw mm0, mm2 - pshufw mm1, mm1, 0 - pshufw mm0, mm0, 0 ; dc0 (w) - packuswb mm0, mm1 ; dc0,dc1 (b) - movq [r0+r1*1], mm0 - movq [r0+r1*2], mm0 + psrlw xmm0, 1 + pavgw xmm0, xmm1 + pshuflw xmm0, xmm0, 0 ; dc0,dc0,dc0,dc0,dc1,0,0,0 + pshufhw xmm0, xmm0, 0 ; dc0,dc1 (w) + packuswb xmm0, xmm1 ; dc0,dc1 (b) + movq [r0+r1*1], xmm0 + movq [r0+r1*2], xmm0 lea r0, [r3+r1*2] - movq [r2+r1*1], mm0 - movq [r2+r1*2], mm0 - movq [r3+r1*1], mm0 - movq [r3+r1*2], mm0 - movq [r0+r1*1], mm0 - movq [r0+r1*2], mm0 + movq [r2+r1*1], xmm0 + movq [r2+r1*2], xmm0 + movq [r3+r1*1], xmm0 + movq [r3+r1*2], xmm0 + movq [r0+r1*1], xmm0 + movq [r0+r1*2], xmm0 RET ;----------------------------------------------------------------------------- diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/h264_intrapred_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/h264_intrapred_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/h264_intrapred_init.c 2026-04-29 18:38:25.000000000 +0000 @@ -113,7 +113,7 @@ PRED16x16(tm_vp8, 8, sse2) PRED16x16(tm_vp8, 8, avx2) -PRED8x8(top_dc, 8, mmxext) +PRED8x8(top_dc, 8, sse2) PRED8x8(dc_rv40, 8, mmxext) PRED8x8(dc, 8, mmxext) PRED8x8(vertical, 8, sse2) @@ -187,7 +187,6 @@ } if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { if (chroma_format_idc <= 1) { - h->pred8x8[TOP_DC_PRED8x8 ] = ff_pred8x8_top_dc_8_mmxext; h->pred8x8[DC_PRED8x8 ] = ff_pred8x8_dc_8_mmxext; } } @@ -210,8 +209,12 @@ h->pred8x8l [VERT_RIGHT_PRED ] = ff_pred8x8l_vertical_right_8_sse2; h->pred8x8l [VERT_LEFT_PRED ] = ff_pred8x8l_vertical_left_8_sse2; h->pred8x8l [HOR_DOWN_PRED ] = ff_pred8x8l_horizontal_down_8_sse2; - if (chroma_format_idc <= 1) + if (chroma_format_idc <= 1) { h->pred8x8 [VERT_PRED8x8 ] = ff_pred8x8_vertical_8_sse2; + if (codec_id == AV_CODEC_ID_SVQ3 || codec_id == AV_CODEC_ID_H264) { + h->pred8x8 [TOP_DC_PRED8x8] = ff_pred8x8_top_dc_8_sse2; + } + } if (codec_id == AV_CODEC_ID_VP7 || codec_id == AV_CODEC_ID_VP8) { h->pred16x16[PLANE_PRED8x8 ] = ff_pred16x16_tm_vp8_8_sse2; h->pred8x8 [PLANE_PRED8x8 ] = ff_pred8x8_tm_vp8_8_sse2; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/idctdsp.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/idctdsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -22,11 +22,11 @@ #include #include -void ff_add_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, +void ff_add_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size); -void ff_put_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, +void ff_put_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size); -void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *pixels, +void ff_put_signed_pixels_clamped_sse2(const int16_t *block, uint8_t *restrict pixels, ptrdiff_t line_size); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/idctdsp_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/idctdsp_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/idctdsp_init.c 2026-04-29 18:38:25.000000000 +0000 @@ -65,18 +65,6 @@ { int cpu_flags = av_get_cpu_flags(); -#if ARCH_X86_32 - if (EXTERNAL_MMX(cpu_flags)) { - if (!high_bit_depth && - avctx->lowres == 0 && - (avctx->idct_algo == FF_IDCT_AUTO || - avctx->idct_algo == FF_IDCT_SIMPLEAUTO || - avctx->idct_algo == FF_IDCT_SIMPLEMMX)) { - c->idct = ff_simple_idct_mmx; - } - } -#endif - if (EXTERNAL_SSE2(cpu_flags)) { c->put_signed_pixels_clamped = ff_put_signed_pixels_clamped_sse2; c->put_pixels_clamped = ff_put_pixels_clamped_sse2; @@ -88,14 +76,15 @@ (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEAUTO || avctx->idct_algo == FF_IDCT_SIMPLEMMX)) { + c->idct = ff_simple_idct_sse2; c->idct_put = ff_simple_idct_put_sse2; c->idct_add = ff_simple_idct_add_sse2; c->perm_type = FF_IDCT_PERM_SIMPLE; } #endif - if (ARCH_X86_64 && - !high_bit_depth && +#if ARCH_X86_64 + if (!high_bit_depth && avctx->lowres == 0 && (avctx->idct_algo == FF_IDCT_AUTO || avctx->idct_algo == FF_IDCT_SIMPLEAUTO || @@ -106,9 +95,11 @@ c->idct_add = ff_simple_idct8_add_sse2; c->perm_type = FF_IDCT_PERM_TRANSPOSE; } +#endif } - if (ARCH_X86_64 && avctx->lowres == 0) { +#if ARCH_X86_64 + if (avctx->lowres == 0) { if (EXTERNAL_AVX(cpu_flags) && !high_bit_depth && (avctx->idct_algo == FF_IDCT_AUTO || @@ -158,4 +149,5 @@ } } } +#endif } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/simple_idct.asm thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.asm --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/simple_idct.asm 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.asm 2026-04-29 18:38:26.000000000 +0000 @@ -1,5 +1,5 @@ ; -; Simple IDCT MMX +; Simple IDCT SSE2 ; ; Copyright (c) 2001, 2002 Michael Niedermayer ; @@ -30,8 +30,8 @@ %if ARCH_X86_32 cextern pb_80 +d40000: dd 4 << 16, 0 ; must be 16-byte aligned wm1010: dw 0, 0xffff, 0, 0xffff -d40000: dd 4 << 16, 0 ; 23170.475006 ; 22725.260826 @@ -57,650 +57,675 @@ coeffs: dw 1 << (ROW_SHIFT - 1), 0 dw 1 << (ROW_SHIFT - 1), 0 + dw 1 << (ROW_SHIFT - 1), 0 + dw 1 << (ROW_SHIFT - 1), 0 + dw 1 << (ROW_SHIFT - 1), 1 + dw 1 << (ROW_SHIFT - 1), 0 dw 1 << (ROW_SHIFT - 1), 1 dw 1 << (ROW_SHIFT - 1), 0 - dw C4, C4, C4, C4 - dw C4, -C4, C4, -C4 + dw C4, C4, C4, C4, C4, C4, C4, C4 + dw C4, -C4, C4, -C4, C4, -C4, C4, -C4 - dw C2, C6, C2, C6 - dw C6, -C2, C6, -C2 + dw C2, C6, C2, C6, C2, C6, C2, C6 + dw C6, -C2, C6, -C2, C6, -C2, C6, -C2 - dw C1, C3, C1, C3 - dw C5, C7, C5, C7 + dw C1, C3, C1, C3, C1, C3, C1, C3 + dw C5, C7, C5, C7, C5, C7, C5, C7 - dw C3, -C7, C3, -C7 - dw -C1, -C5, -C1, -C5 + dw C3, -C7, C3, -C7, C3, -C7, C3, -C7 + dw -C1, -C5, -C1, -C5, -C1, -C5, -C1, -C5 - dw C5, -C1, C5, -C1 - dw C7, C3, C7, C3 + dw C5, -C1, C5, -C1, C5, -C1, C5, -C1 + dw C7, C3, C7, C3, C7, C3, C7, C3 - dw C7, -C5, C7, -C5 - dw C3, -C1, C3, -C1 + dw C7, -C5, C7, -C5, C7, -C5, C7, -C5 + dw C3, -C1, C3, -C1, C3, -C1, C3, -C1 SECTION .text %macro DC_COND_IDCT 7 - movq mm0, [blockq + %1] ; R4 R0 r4 r0 - movq mm1, [blockq + %2] ; R6 R2 r6 r2 - movq mm2, [blockq + %3] ; R3 R1 r3 r1 - movq mm3, [blockq + %4] ; R7 R5 r7 r5 - movq mm4, [wm1010] - pand mm4, mm0 - por mm4, mm1 - por mm4, mm2 - por mm4, mm3 - packssdw mm4, mm4 - movd t0d, mm4 + movq m0, [blockq + %1] ; R4 R0 r4 r0 + movq m1, [blockq + %2] ; R6 R2 r6 r2 + movq m2, [blockq + %3] ; R3 R1 r3 r1 + movq m3, [blockq + %4] ; R7 R5 r7 r5 + movq m4, [wm1010] + pand m4, m0 + por m4, m1 + por m4, m2 + por m4, m3 + packssdw m4, m4 + movd t0d, m4 or t0d, t0d jz %%1 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - paddd mm4, [coeffs + 8] - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm5, mm3 ; C7R7+C5R5 C7r7+C5r5 - paddd mm0, [coeffs + 8] - paddd mm1, mm0 ; A1 a1 - paddd mm0, mm0 - psubd mm0, mm1 ; A2 a2 - pmaddwd mm2, [coeffs + 64] ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm5 ; B0 b0 - movq mm5, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm5, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - paddd mm5, mm2 ; B1 b1 - psrad mm7, %7 - psrad mm4, %7 - movq mm2, mm1 ; A1 a1 - paddd mm1, mm5 ; A1+B1 a1+b1 - psubd mm2, mm5 ; A1-B1 a1-b1 - psrad mm1, %7 - psrad mm2, %7 - packssdw mm7, mm1 ; A1+B1 a1+b1 A0+B0 a0+b0 - packssdw mm2, mm4 ; A0-B0 a0-b0 A1-B1 a1-b1 - movq [%5], mm7 - movq mm1, [blockq + %3] ; R3 R1 r3 r1 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - movq [24 + %5], mm2 - pmaddwd mm4, mm1 ; -C1R3+C5R1 -C1r3+C5r1 - movq mm7, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm1, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - pmaddwd mm7, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm0 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm4, mm7 ; B2 b2 - paddd mm2, mm4 ; A2+B2 a2+b2 - psubd mm0, mm4 ; a2-B2 a2-b2 - psrad mm2, %7 - psrad mm0, %7 - movq mm4, mm6 ; A3 a3 - paddd mm3, mm1 ; B3 b3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm4, mm3 ; a3-B3 a3-b3 - psrad mm6, %7 - packssdw mm2, mm6 ; A3+B3 a3+b3 A2+B2 a2+b2 - movq [8 + %5], mm2 - psrad mm4, %7 - packssdw mm4, mm0 ; A2-B2 a2-b2 A3-B3 a3-b3 - movq [16 + %5], mm4 + movq m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + movq m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + movq m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + movq m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + movq m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + paddd m4, [coeffs + 16] + movq m6, m4 ; C4R4+C4R0 C4r4+C4r0 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + movq m5, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m5, m3 ; C7R7+C5R5 C7r7+C5r5 + paddd m0, [coeffs + 16] + paddd m1, m0 ; A1 a1 + paddd m0, m0 + psubd m0, m1 ; A2 a2 + pmaddwd m2, [coeffs + 128] ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m5 ; B0 b0 + movq m5, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m5, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + paddd m5, m2 ; B1 b1 + psrad m7, %7 + psrad m4, %7 + movq m2, m1 ; A1 a1 + paddd m1, m5 ; A1+B1 a1+b1 + psubd m2, m5 ; A1-B1 a1-b1 + psrad m1, %7 + psrad m2, %7 + packssdw m7, m1 ; A1+B1 a1+b1 A0+B0 a0+b0 + pshufd m7, m7, 0xD8 + packssdw m2, m4 ; A0-B0 a0-b0 A1-B1 a1-b1 + pshufd m2, m2, 0xD8 + movq [%5], m7 + movq m1, [blockq + %3] ; R3 R1 r3 r1 + movq m4, [coeffs + 160] ; -C1 C5 -C1 C5 + movq [24 + %5], m2 + pmaddwd m4, m1 ; -C1R3+C5R1 -C1r3+C5r1 + movq m7, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m1, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + pmaddwd m7, m3 ; C3R7+C7R5 C3r7+C7r5 + movq m2, m0 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m4, m7 ; B2 b2 + paddd m2, m4 ; A2+B2 a2+b2 + psubd m0, m4 ; a2-B2 a2-b2 + psrad m2, %7 + psrad m0, %7 + movq m4, m6 ; A3 a3 + paddd m3, m1 ; B3 b3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m4, m3 ; a3-B3 a3-b3 + psrad m6, %7 + packssdw m2, m6 ; A3+B3 a3+b3 A2+B2 a2+b2 + pshufd m2, m2, 0xD8 + movq [8 + %5], m2 + psrad m4, %7 + packssdw m4, m0 ; A2-B2 a2-b2 A3-B3 a3-b3 + pshufd m4, m4, 0xD8 + movq [16 + %5], m4 jmp %%2 %%1: - pslld mm0, 16 - paddd mm0, [d40000] - psrad mm0, 13 - packssdw mm0, mm0 - movq [%5], mm0 - movq [8 + %5], mm0 - movq [16 + %5], mm0 - movq [24 + %5], mm0 + pslld m0, 16 + ; d40000 is only eight bytes long, so this will clobber + ; the upper half of m0 with wm1010. It doesn't matter due to pshufd below. + paddd m0, [d40000] + psrad m0, 13 + packssdw m0, m0 + pshufd m0, m0, 0x0 + mova [%5], m0 + mova [16 + %5], m0 %%2: %endmacro %macro Z_COND_IDCT 8 - movq mm0, [blockq + %1] ; R4 R0 r4 r0 - movq mm1, [blockq + %2] ; R6 R2 r6 r2 - movq mm2, [blockq + %3] ; R3 R1 r3 r1 - movq mm3, [blockq + %4] ; R7 R5 r7 r5 - movq mm4, mm0 - por mm4, mm1 - por mm4, mm2 - por mm4, mm3 - packssdw mm4, mm4 - movd t0d, mm4 + movq m0, [blockq + %1] ; R4 R0 r4 r0 + movq m1, [blockq + %2] ; R6 R2 r6 r2 + movq m2, [blockq + %3] ; R3 R1 r3 r1 + movq m3, [blockq + %4] ; R7 R5 r7 r5 + movq m4, m0 + por m4, m1 + por m4, m2 + por m4, m3 + packssdw m4, m4 + movd t0d, m4 or t0d, t0d jz %8 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - paddd mm4, [coeffs] - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm5, mm3 ; C7R7+C5R5 C7r7+C5r5 - paddd mm0, [coeffs] - paddd mm1, mm0 ; A1 a1 - paddd mm0, mm0 - psubd mm0, mm1 ; A2 a2 - pmaddwd mm2, [coeffs + 64] ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm5 ; B0 b0 - movq mm5, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm5, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - paddd mm5, mm2 ; B1 b1 - psrad mm7, %7 - psrad mm4, %7 - movq mm2, mm1 ; A1 a1 - paddd mm1, mm5 ; A1+B1 a1+b1 - psubd mm2, mm5 ; A1-B1 a1-b1 - psrad mm1, %7 - psrad mm2, %7 - packssdw mm7, mm1 ; A1+B1 a1+b1 A0+B0 a0+b0 - packssdw mm2, mm4 ; A0-B0 a0-b0 A1-B1 a1-b1 - movq [%5], mm7 - movq mm1, [blockq + %3] ; R3 R1 r3 r1 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - movq [24 + %5], mm2 - pmaddwd mm4, mm1 ; -C1R3+C5R1 -C1r3+C5r1 - movq mm7, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm1, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - pmaddwd mm7, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm0 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm4, mm7 ; B2 b2 - paddd mm2, mm4 ; A2+B2 a2+b2 - psubd mm0, mm4 ; a2-B2 a2-b2 - psrad mm2, %7 - psrad mm0, %7 - movq mm4, mm6 ; A3 a3 - paddd mm3, mm1 ; B3 b3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm4, mm3 ; a3-B3 a3-b3 - psrad mm6, %7 - packssdw mm2, mm6 ; A3+B3 a3+b3 A2+B2 a2+b2 - movq [8 + %5], mm2 - psrad mm4, %7 - packssdw mm4, mm0 ; A2-B2 a2-b2 A3-B3 a3-b3 - movq [16 + %5], mm4 + movq m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + movq m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + movq m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + movq m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + movq m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + paddd m4, [coeffs] + movq m6, m4 ; C4R4+C4R0 C4r4+C4r0 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + movq m5, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m5, m3 ; C7R7+C5R5 C7r7+C5r5 + paddd m0, [coeffs] + paddd m1, m0 ; A1 a1 + paddd m0, m0 + psubd m0, m1 ; A2 a2 + pmaddwd m2, [coeffs + 128] ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m5 ; B0 b0 + movq m5, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m5, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + paddd m5, m2 ; B1 b1 + psrad m7, %7 + psrad m4, %7 + movq m2, m1 ; A1 a1 + paddd m1, m5 ; A1+B1 a1+b1 + psubd m2, m5 ; A1-B1 a1-b1 + psrad m1, %7 + psrad m2, %7 + packssdw m7, m1 ; A1+B1 a1+b1 A0+B0 a0+b0 + pshufd m7, m7, 0xD8 + packssdw m2, m4 ; A0-B0 a0-b0 A1-B1 a1-b1 + pshufd m2, m2, 0xD8 + movq [%5], m7 + movq m1, [blockq + %3] ; R3 R1 r3 r1 + movq m4, [coeffs + 160] ; -C1 C5 -C1 C5 + movq [24 + %5], m2 + pmaddwd m4, m1 ; -C1R3+C5R1 -C1r3+C5r1 + movq m7, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m1, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + pmaddwd m7, m3 ; C3R7+C7R5 C3r7+C7r5 + movq m2, m0 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m4, m7 ; B2 b2 + paddd m2, m4 ; A2+B2 a2+b2 + psubd m0, m4 ; a2-B2 a2-b2 + psrad m2, %7 + psrad m0, %7 + movq m4, m6 ; A3 a3 + paddd m3, m1 ; B3 b3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m4, m3 ; a3-B3 a3-b3 + psrad m6, %7 + packssdw m2, m6 ; A3+B3 a3+b3 A2+B2 a2+b2 + pshufd m2, m2, 0xD8 + movq [8 + %5], m2 + psrad m4, %7 + packssdw m4, m0 ; A2-B2 a2-b2 A3-B3 a3-b3 + pshufd m4, m4, 0xD8 + movq [16 + %5], m4 %endmacro %macro IDCT1 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm1, %2 ; R6 R2 r6 r2 - movq mm2, %3 ; R3 R1 r3 r1 - movq mm3, %4 ; R7 R5 r7 r5 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - paddd mm0, mm1 ; A1 a1 - psubd mm5, mm1 ; A2 a2 - movq mm1, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm1, mm3 ; C7R7+C5R5 C7r7+C5r5 - pmaddwd mm2, [coeffs + 64] ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm1 ; B0 b0 - movq mm1, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm1, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - paddd mm1, mm2 ; B1 b1 - psrad mm7, %6 - psrad mm4, %6 - movq mm2, mm0 ; A1 a1 - paddd mm0, mm1 ; A1+B1 a1+b1 - psubd mm2, mm1 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm2, %6 - packssdw mm7, mm7 ; A0+B0 a0+b0 - movd [%5], mm7 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm2, mm2 ; A1-B1 a1-b1 - movd [96 + %5], mm2 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm0, %3 ; R3 R1 r3 r1 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - pmaddwd mm4, mm0 ; -C1R3+C5R1 -C1r3+C5r1 - movq mm7, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm0, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - pmaddwd mm7, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm5 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm4, mm7 ; B2 b2 - paddd mm2, mm4 ; A2+B2 a2+b2 - psubd mm5, mm4 ; a2-B2 a2-b2 - psrad mm2, %6 - psrad mm5, %6 - movq mm4, mm6 ; A3 a3 - paddd mm3, mm0 ; B3 b3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm4, mm3 ; a3-B3 a3-b3 - psrad mm6, %6 - psrad mm4, %6 - packssdw mm2, mm2 ; A2+B2 a2+b2 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [32 + %5], mm2 - packssdw mm4, mm4 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [48 + %5], mm6 - movd [64 + %5], mm4 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m1, %2 ; R6 R2 r6 r2 + mova m2, %3 ; R3 R1 r3 r1 + mova m3, %4 ; R7 R5 r7 r5 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + mova m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + paddd m0, m1 ; A1 a1 + psubd m5, m1 ; A2 a2 + mova m1, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m1, m3 ; C7R7+C5R5 C7r7+C5r5 + pmaddwd m2, [coeffs + 128] ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m1 ; B0 b0 + mova m1, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m1, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + paddd m1, m2 ; B1 b1 + psrad m7, %6 + psrad m4, %6 + mova m2, m0 ; A1 a1 + paddd m0, m1 ; A1+B1 a1+b1 + psubd m2, m1 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m2, %6 + packssdw m7, m7 ; A0+B0 a0+b0 + movq [%5], m7 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m2, m2 ; A1-B1 a1-b1 + movq [96 + %5], m2 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m0, %3 ; R3 R1 r3 r1 + mova m4, [coeffs + 160] ; -C1 C5 -C1 C5 + pmaddwd m4, m0 ; -C1R3+C5R1 -C1r3+C5r1 + mova m7, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m0, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + pmaddwd m7, m3 ; C3R7+C7R5 C3r7+C7r5 + mova m2, m5 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m4, m7 ; B2 b2 + paddd m2, m4 ; A2+B2 a2+b2 + psubd m5, m4 ; a2-B2 a2-b2 + psrad m2, %6 + psrad m5, %6 + mova m4, m6 ; A3 a3 + paddd m3, m0 ; B3 b3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m4, m3 ; a3-B3 a3-b3 + psrad m6, %6 + psrad m4, %6 + packssdw m2, m2 ; A2+B2 a2+b2 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [32 + %5], m2 + packssdw m4, m4 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [48 + %5], m6 + movq [64 + %5], m4 + movq [80 + %5], m5 %endmacro %macro IDCT2 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm1, %2 ; R6 R2 r6 r2 - movq mm3, %4 ; R7 R5 r7 r5 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - paddd mm0, mm1 ; A1 a1 - psubd mm5, mm1 ; A2 a2 - movq mm1, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm1, mm3 ; C7R7+C5R5 C7r7+C5r5 - movq mm7, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm7, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm1, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm1 ; A0-B0 a0-b0 - psrad mm1, %6 - psrad mm4, %6 - movq mm2, mm0 ; A1 a1 - paddd mm0, mm7 ; A1+B1 a1+b1 - psubd mm2, mm7 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm2, %6 - packssdw mm1, mm1 ; A0+B0 a0+b0 - movd [%5], mm1 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm2, mm2 ; A1-B1 a1-b1 - movd [96 + %5], mm2 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm1, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm1, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm5 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm2, mm1 ; A2+B2 a2+b2 - psubd mm5, mm1 ; a2-B2 a2-b2 - psrad mm2, %6 - psrad mm5, %6 - movq mm1, mm6 ; A3 a3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm1, mm3 ; a3-B3 a3-b3 - psrad mm6, %6 - psrad mm1, %6 - packssdw mm2, mm2 ; A2+B2 a2+b2 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [32 + %5], mm2 - packssdw mm1, mm1 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [48 + %5], mm6 - movd [64 + %5], mm1 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m1, %2 ; R6 R2 r6 r2 + mova m3, %4 ; R7 R5 r7 r5 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + mova m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + paddd m0, m1 ; A1 a1 + psubd m5, m1 ; A2 a2 + mova m1, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m1, m3 ; C7R7+C5R5 C7r7+C5r5 + mova m7, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m7, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m1, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m1 ; A0-B0 a0-b0 + psrad m1, %6 + psrad m4, %6 + mova m2, m0 ; A1 a1 + paddd m0, m7 ; A1+B1 a1+b1 + psubd m2, m7 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m2, %6 + packssdw m1, m1 ; A0+B0 a0+b0 + movq [%5], m1 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m2, m2 ; A1-B1 a1-b1 + movq [96 + %5], m2 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m1, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m1, m3 ; C3R7+C7R5 C3r7+C7r5 + mova m2, m5 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m2, m1 ; A2+B2 a2+b2 + psubd m5, m1 ; a2-B2 a2-b2 + psrad m2, %6 + psrad m5, %6 + mova m1, m6 ; A3 a3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m1, m3 ; a3-B3 a3-b3 + psrad m6, %6 + psrad m1, %6 + packssdw m2, m2 ; A2+B2 a2+b2 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [32 + %5], m2 + packssdw m1, m1 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [48 + %5], m6 + movq [64 + %5], m1 + movq [80 + %5], m5 %endmacro %macro IDCT3 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm3, %4 ; R7 R5 r7 r5 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm1, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm1, mm3 ; C7R7+C5R5 C7r7+C5r5 - movq mm7, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm7, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm1, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm1 ; A0-B0 a0-b0 - psrad mm1, %6 - psrad mm4, %6 - movq mm2, mm0 ; A1 a1 - paddd mm0, mm7 ; A1+B1 a1+b1 - psubd mm2, mm7 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm2, %6 - packssdw mm1, mm1 ; A0+B0 a0+b0 - movd [%5], mm1 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm2, mm2 ; A1-B1 a1-b1 - movd [96 + %5], mm2 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm1, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm1, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm5 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm2, mm1 ; A2+B2 a2+b2 - psubd mm5, mm1 ; a2-B2 a2-b2 - psrad mm2, %6 - psrad mm5, %6 - movq mm1, mm6 ; A3 a3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm1, mm3 ; a3-B3 a3-b3 - psrad mm6, %6 - psrad mm1, %6 - packssdw mm2, mm2 ; A2+B2 a2+b2 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [32 + %5], mm2 - packssdw mm1, mm1 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [48 + %5], mm6 - movd [64 + %5], mm1 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m3, %4 ; R7 R5 r7 r5 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + mova m1, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m1, m3 ; C7R7+C5R5 C7r7+C5r5 + mova m7, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m7, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m1, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m1 ; A0-B0 a0-b0 + psrad m1, %6 + psrad m4, %6 + mova m2, m0 ; A1 a1 + paddd m0, m7 ; A1+B1 a1+b1 + psubd m2, m7 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m2, %6 + packssdw m1, m1 ; A0+B0 a0+b0 + movq [%5], m1 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m2, m2 ; A1-B1 a1-b1 + movq [96 + %5], m2 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m1, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m1, m3 ; C3R7+C7R5 C3r7+C7r5 + mova m2, m5 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m2, m1 ; A2+B2 a2+b2 + psubd m5, m1 ; a2-B2 a2-b2 + psrad m2, %6 + psrad m5, %6 + mova m1, m6 ; A3 a3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m1, m3 ; a3-B3 a3-b3 + psrad m6, %6 + psrad m1, %6 + packssdw m2, m2 ; A2+B2 a2+b2 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [32 + %5], m2 + packssdw m1, m1 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [48 + %5], m6 + movq [64 + %5], m1 + movq [80 + %5], m5 %endmacro %macro IDCT4 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm2, %3 ; R3 R1 r3 r1 - movq mm3, %4 ; R7 R5 r7 r5 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm1, [coeffs + 56] ; C7 C5 C7 C5 - pmaddwd mm1, mm3 ; C7R7+C5R5 C7r7+C5r5 - pmaddwd mm2, [coeffs + 64] ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm1 ; B0 b0 - movq mm1, [coeffs + 72] ; -C5 -C1 -C5 -C1 - pmaddwd mm1, mm3 ; -C5R7-C1R5 -C5r7-C1r5 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - paddd mm1, mm2 ; B1 b1 - psrad mm7, %6 - psrad mm4, %6 - movq mm2, mm0 ; A1 a1 - paddd mm0, mm1 ; A1+B1 a1+b1 - psubd mm2, mm1 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm2, %6 - packssdw mm7, mm7 ; A0+B0 a0+b0 - movd [%5], mm7 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm2, mm2 ; A1-B1 a1-b1 - movd [96 + %5], mm2 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm0, %3 ; R3 R1 r3 r1 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - pmaddwd mm4, mm0 ; -C1R3+C5R1 -C1r3+C5r1 - movq mm7, [coeffs + 88] ; C3 C7 C3 C7 - pmaddwd mm0, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - pmaddwd mm7, mm3 ; C3R7+C7R5 C3r7+C7r5 - movq mm2, mm5 ; A2 a2 - pmaddwd mm3, [coeffs + 104] ; -C1R7+C3R5 -C1r7+C3r5 - paddd mm4, mm7 ; B2 b2 - paddd mm2, mm4 ; A2+B2 a2+b2 - psubd mm5, mm4 ; a2-B2 a2-b2 - psrad mm2, %6 - psrad mm5, %6 - movq mm4, mm6 ; A3 a3 - paddd mm3, mm0 ; B3 b3 - paddd mm6, mm3 ; A3+B3 a3+b3 - psubd mm4, mm3 ; a3-B3 a3-b3 - psrad mm6, %6 - psrad mm4, %6 - packssdw mm2, mm2 ; A2+B2 a2+b2 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [32 + %5], mm2 - packssdw mm4, mm4 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [48 + %5], mm6 - movd [64 + %5], mm4 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m2, %3 ; R3 R1 r3 r1 + mova m3, %4 ; R7 R5 r7 r5 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + mova m1, [coeffs + 112] ; C7 C5 C7 C5 + pmaddwd m1, m3 ; C7R7+C5R5 C7r7+C5r5 + pmaddwd m2, [coeffs + 128] ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m1 ; B0 b0 + mova m1, [coeffs + 144] ; -C5 -C1 -C5 -C1 + pmaddwd m1, m3 ; -C5R7-C1R5 -C5r7-C1r5 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + paddd m1, m2 ; B1 b1 + psrad m7, %6 + psrad m4, %6 + mova m2, m0 ; A1 a1 + paddd m0, m1 ; A1+B1 a1+b1 + psubd m2, m1 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m2, %6 + packssdw m7, m7 ; A0+B0 a0+b0 + movq [%5], m7 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m2, m2 ; A1-B1 a1-b1 + movq [96 + %5], m2 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m0, %3 ; R3 R1 r3 r1 + mova m4, [coeffs + 160] ; -C1 C5 -C1 C5 + pmaddwd m4, m0 ; -C1R3+C5R1 -C1r3+C5r1 + mova m7, [coeffs + 176] ; C3 C7 C3 C7 + pmaddwd m0, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + pmaddwd m7, m3 ; C3R7+C7R5 C3r7+C7r5 + mova m2, m5 ; A2 a2 + pmaddwd m3, [coeffs + 208] ; -C1R7+C3R5 -C1r7+C3r5 + paddd m4, m7 ; B2 b2 + paddd m2, m4 ; A2+B2 a2+b2 + psubd m5, m4 ; a2-B2 a2-b2 + psrad m2, %6 + psrad m5, %6 + mova m4, m6 ; A3 a3 + paddd m3, m0 ; B3 b3 + paddd m6, m3 ; A3+B3 a3+b3 + psubd m4, m3 ; a3-B3 a3-b3 + psrad m6, %6 + psrad m4, %6 + packssdw m2, m2 ; A2+B2 a2+b2 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [32 + %5], m2 + packssdw m4, m4 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [48 + %5], m6 + movq [64 + %5], m4 + movq [80 + %5], m5 %endmacro %macro IDCT5 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm2, %3 ; R3 R1 r3 r1 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm3, [coeffs + 64] - pmaddwd mm3, mm2 ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - psrad mm7, %6 - psrad mm4, %6 - movq mm1, mm0 ; A1 a1 - paddd mm0, mm3 ; A1+B1 a1+b1 - psubd mm1, mm3 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm1, %6 - packssdw mm7, mm7 ; A0+B0 a0+b0 - movd [%5], mm7 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm1, mm1 ; A1-B1 a1-b1 - movd [96 + %5], mm1 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - pmaddwd mm4, mm2 ; -C1R3+C5R1 -C1r3+C5r1 - pmaddwd mm2, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - movq mm1, mm5 ; A2 a2 - paddd mm1, mm4 ; A2+B2 a2+b2 - psubd mm5, mm4 ; a2-B2 a2-b2 - psrad mm1, %6 - psrad mm5, %6 - movq mm4, mm6 ; A3 a3 - paddd mm6, mm2 ; A3+B3 a3+b3 - psubd mm4, mm2 ; a3-B3 a3-b3 - psrad mm6, %6 - psrad mm4, %6 - packssdw mm1, mm1 ; A2+B2 a2+b2 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [32 + %5], mm1 - packssdw mm4, mm4 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [48 + %5], mm6 - movd [64 + %5], mm4 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m2, %3 ; R3 R1 r3 r1 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + mova m3, [coeffs + 128] + pmaddwd m3, m2 ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + psrad m7, %6 + psrad m4, %6 + mova m1, m0 ; A1 a1 + paddd m0, m3 ; A1+B1 a1+b1 + psubd m1, m3 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m1, %6 + packssdw m7, m7 ; A0+B0 a0+b0 + movq [%5], m7 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m1, m1 ; A1-B1 a1-b1 + movq [96 + %5], m1 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m4, [coeffs + 160] ; -C1 C5 -C1 C5 + pmaddwd m4, m2 ; -C1R3+C5R1 -C1r3+C5r1 + pmaddwd m2, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + mova m1, m5 ; A2 a2 + paddd m1, m4 ; A2+B2 a2+b2 + psubd m5, m4 ; a2-B2 a2-b2 + psrad m1, %6 + psrad m5, %6 + mova m4, m6 ; A3 a3 + paddd m6, m2 ; A3+B3 a3+b3 + psubd m4, m2 ; a3-B3 a3-b3 + psrad m6, %6 + psrad m4, %6 + packssdw m1, m1 ; A2+B2 a2+b2 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [32 + %5], m1 + packssdw m4, m4 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [48 + %5], m6 + movq [64 + %5], m4 + movq [80 + %5], m5 %endmacro %macro IDCT6 6 - movq mm0, [%1] ; R4 R0 r4 r0 - movq mm1, [%2] ; R6 R2 r6 r2 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - paddd mm0, mm1 ; A1 a1 - psubd mm5, mm1 ; A2 a2 - movq mm2, [8 + %1] ; R4 R0 r4 r0 - movq mm3, [8 + %2] ; R6 R2 r6 r2 - movq mm1, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm1, mm2 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm2, mm7 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm7, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm7, mm3 ; C6R6+C2R2 C6r6+C2r2 - pmaddwd mm3, [coeffs + 40] ; -C2R6+C6R2 -C2r6+C6r2 - paddd mm7, mm1 ; A0 a0 - paddd mm1, mm1 ; 2C0 2c0 - psubd mm1, mm7 ; A3 a3 - paddd mm3, mm2 ; A1 a1 - paddd mm2, mm2 ; 2C1 2c1 - psubd mm2, mm3 ; A2 a2 - psrad mm4, %6 - psrad mm7, %6 - psrad mm3, %6 - packssdw mm4, mm7 ; A0 a0 - movq [%5], mm4 - psrad mm0, %6 - packssdw mm0, mm3 ; A1 a1 - movq [16 + %5], mm0 - movq [96 + %5], mm0 - movq [112 + %5], mm4 - psrad mm5, %6 - psrad mm6, %6 - psrad mm2, %6 - packssdw mm5, mm2 ; A2-B2 a2-b2 - movq [32 + %5], mm5 - psrad mm1, %6 - packssdw mm6, mm1 ; A3+B3 a3+b3 - movq [48 + %5], mm6 - movq [64 + %5], mm6 - movq [80 + %5], mm5 + movq m0, [%1] ; R4 R0 r4 r0 + movhps m0, [%1 + 16] + movq m1, [%2] ; R6 R2 r6 r2 + movhps m1, [%2 + 16] + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + mova m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + paddd m0, m1 ; A1 a1 + psubd m5, m1 ; A2 a2 + movq m2, [%1 + 8] ; R4 R0 r4 r0 + movhps m2, [%1 + 24] + movq m3, [%2 + 8] ; R6 R2 r6 r2 + movhps m3, [%2 + 24] + mova m1, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m1, m2 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m2, m7 ; -C4R4+C4R0 -C4r4+C4r0 + mova m7, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m7, m3 ; C6R6+C2R2 C6r6+C2r2 + pmaddwd m3, [coeffs + 80] ; -C2R6+C6R2 -C2r6+C6r2 + paddd m7, m1 ; A0 a0 + paddd m1, m1 ; 2C0 2c0 + psubd m1, m7 ; A3 a3 + paddd m3, m2 ; A1 a1 + paddd m2, m2 ; 2C1 2c1 + psubd m2, m3 ; A2 a2 + psrad m4, %6 + psrad m7, %6 + psrad m3, %6 + packssdw m4, m7 ; A0 a0 + pshufd m4, m4, 0xD8 + mova [%5], m4 + psrad m0, %6 + packssdw m0, m3 ; A1 a1 + pshufd m0, m0, 0xD8 + mova [16 + %5], m0 + mova [96 + %5], m0 + mova [112 + %5], m4 + psrad m5, %6 + psrad m6, %6 + psrad m2, %6 + packssdw m5, m2 ; A2-B2 a2-b2 + pshufd m5, m5, 0xD8 + mova [32 + %5], m5 + psrad m1, %6 + packssdw m6, m1 ; A3+B3 a3+b3 + pshufd m6, m6, 0xD8 + mova [48 + %5], m6 + mova [64 + %5], m6 + mova [80 + %5], m5 %endmacro %macro IDCT7 6 - movq mm0, %1 ; R4 R0 r4 r0 - movq mm1, %2 ; R6 R2 r6 r2 - movq mm2, %3 ; R3 R1 r3 r1 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm5, [coeffs + 32] ; C6 C2 C6 C2 - pmaddwd mm5, mm1 ; C6R6+C2R2 C6r6+C2r2 - movq mm6, [coeffs + 40] ; -C2 C6 -C2 C6 - pmaddwd mm1, mm6 ; -C2R6+C6R2 -C2r6+C6r2 - movq mm6, mm4 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 48] ; C3 C1 C3 C1 - pmaddwd mm7, mm2 ; C3R3+C1R1 C3r3+C1r1 - paddd mm4, mm5 ; A0 a0 - psubd mm6, mm5 ; A3 a3 - movq mm5, mm0 ; -C4R4+C4R0 -C4r4+C4r0 - paddd mm0, mm1 ; A1 a1 - psubd mm5, mm1 ; A2 a2 - movq mm1, [coeffs + 64] - pmaddwd mm1, mm2 ; -C7R3+C3R1 -C7r3+C3r1 - paddd mm7, mm4 ; A0+B0 a0+b0 - paddd mm4, mm4 ; 2A0 2a0 - psubd mm4, mm7 ; A0-B0 a0-b0 - psrad mm7, %6 - psrad mm4, %6 - movq mm3, mm0 ; A1 a1 - paddd mm0, mm1 ; A1+B1 a1+b1 - psubd mm3, mm1 ; A1-B1 a1-b1 - psrad mm0, %6 - psrad mm3, %6 - packssdw mm7, mm7 ; A0+B0 a0+b0 - movd [%5], mm7 - packssdw mm0, mm0 ; A1+B1 a1+b1 - movd [16 + %5], mm0 - packssdw mm3, mm3 ; A1-B1 a1-b1 - movd [96 + %5], mm3 - packssdw mm4, mm4 ; A0-B0 a0-b0 - movd [112 + %5], mm4 - movq mm4, [coeffs + 80] ; -C1 C5 -C1 C5 - pmaddwd mm4, mm2 ; -C1R3+C5R1 -C1r3+C5r1 - pmaddwd mm2, [coeffs + 96] ; -C5R3+C7R1 -C5r3+C7r1 - movq mm3, mm5 ; A2 a2 - paddd mm3, mm4 ; A2+B2 a2+b2 - psubd mm5, mm4 ; a2-B2 a2-b2 - psrad mm3, %6 - psrad mm5, %6 - movq mm4, mm6 ; A3 a3 - paddd mm6, mm2 ; A3+B3 a3+b3 - psubd mm4, mm2 ; a3-B3 a3-b3 - psrad mm6, %6 - packssdw mm3, mm3 ; A2+B2 a2+b2 - movd [32 + %5], mm3 - psrad mm4, %6 - packssdw mm6, mm6 ; A3+B3 a3+b3 - movd [48 + %5], mm6 - packssdw mm4, mm4 ; A3-B3 a3-b3 - packssdw mm5, mm5 ; A2-B2 a2-b2 - movd [64 + %5], mm4 - movd [80 + %5], mm5 + mova m0, %1 ; R4 R0 r4 r0 + mova m1, %2 ; R6 R2 r6 r2 + mova m2, %3 ; R3 R1 r3 r1 + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + mova m5, [coeffs + 64] ; C6 C2 C6 C2 + pmaddwd m5, m1 ; C6R6+C2R2 C6r6+C2r2 + mova m6, [coeffs + 80] ; -C2 C6 -C2 C6 + pmaddwd m1, m6 ; -C2R6+C6R2 -C2r6+C6r2 + mova m6, m4 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 96] ; C3 C1 C3 C1 + pmaddwd m7, m2 ; C3R3+C1R1 C3r3+C1r1 + paddd m4, m5 ; A0 a0 + psubd m6, m5 ; A3 a3 + mova m5, m0 ; -C4R4+C4R0 -C4r4+C4r0 + paddd m0, m1 ; A1 a1 + psubd m5, m1 ; A2 a2 + mova m1, [coeffs + 128] + pmaddwd m1, m2 ; -C7R3+C3R1 -C7r3+C3r1 + paddd m7, m4 ; A0+B0 a0+b0 + paddd m4, m4 ; 2A0 2a0 + psubd m4, m7 ; A0-B0 a0-b0 + psrad m7, %6 + psrad m4, %6 + mova m3, m0 ; A1 a1 + paddd m0, m1 ; A1+B1 a1+b1 + psubd m3, m1 ; A1-B1 a1-b1 + psrad m0, %6 + psrad m3, %6 + packssdw m7, m7 ; A0+B0 a0+b0 + movq [%5], m7 + packssdw m0, m0 ; A1+B1 a1+b1 + movq [16 + %5], m0 + packssdw m3, m3 ; A1-B1 a1-b1 + movq [96 + %5], m3 + packssdw m4, m4 ; A0-B0 a0-b0 + movq [112 + %5], m4 + mova m4, [coeffs + 160] ; -C1 C5 -C1 C5 + pmaddwd m4, m2 ; -C1R3+C5R1 -C1r3+C5r1 + pmaddwd m2, [coeffs + 192] ; -C5R3+C7R1 -C5r3+C7r1 + mova m3, m5 ; A2 a2 + paddd m3, m4 ; A2+B2 a2+b2 + psubd m5, m4 ; a2-B2 a2-b2 + psrad m3, %6 + psrad m5, %6 + mova m4, m6 ; A3 a3 + paddd m6, m2 ; A3+B3 a3+b3 + psubd m4, m2 ; a3-B3 a3-b3 + psrad m6, %6 + packssdw m3, m3 ; A2+B2 a2+b2 + movq [32 + %5], m3 + psrad m4, %6 + packssdw m6, m6 ; A3+B3 a3+b3 + movq [48 + %5], m6 + packssdw m4, m4 ; A3-B3 a3-b3 + packssdw m5, m5 ; A2-B2 a2-b2 + movq [64 + %5], m4 + movq [80 + %5], m5 %endmacro %macro IDCT8 6 - movq mm0, [%1] ; R4 R0 r4 r0 - movq mm4, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm4, mm0 ; C4R4+C4R0 C4r4+C4r0 - movq mm5, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm0, mm5 ; -C4R4+C4R0 -C4r4+C4r0 - psrad mm4, %6 - psrad mm0, %6 - movq mm2, [8 + %1] ; R4 R0 r4 r0 - movq mm1, [coeffs + 16] ; C4 C4 C4 C4 - pmaddwd mm1, mm2 ; C4R4+C4R0 C4r4+C4r0 - movq mm7, [coeffs + 24] ; -C4 C4 -C4 C4 - pmaddwd mm2, mm7 ; -C4R4+C4R0 -C4r4+C4r0 - movq mm7, [coeffs + 32] ; C6 C2 C6 C2 - psrad mm1, %6 - packssdw mm4, mm1 ; A0 a0 - movq [%5], mm4 - psrad mm2, %6 - packssdw mm0, mm2 ; A1 a1 - movq [16 + %5], mm0 - movq [96 + %5], mm0 - movq [112 + %5], mm4 - movq [32 + %5], mm0 - movq [48 + %5], mm4 - movq [64 + %5], mm4 - movq [80 + %5], mm0 + movq m0, [%1] ; R4 R0 r4 r0 + movhps m0, [%1 + 16] + mova m4, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m4, m0 ; C4R4+C4R0 C4r4+C4r0 + mova m5, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m0, m5 ; -C4R4+C4R0 -C4r4+C4r0 + psrad m4, %6 + psrad m0, %6 + movq m2, [%1 + 8] ; R4 R0 r4 r0 + movhps m2, [%1 + 24] + mova m1, [coeffs + 32] ; C4 C4 C4 C4 + pmaddwd m1, m2 ; C4R4+C4R0 C4r4+C4r0 + mova m7, [coeffs + 48] ; -C4 C4 -C4 C4 + pmaddwd m2, m7 ; -C4R4+C4R0 -C4r4+C4r0 + mova m7, [coeffs + 64] ; C6 C2 C6 C2 + psrad m1, %6 + packssdw m4, m1 ; A0 a0 + pshufd m4, m4, 0xD8 + mova [%5], m4 + psrad m2, %6 + packssdw m0, m2 ; A1 a1 + pshufd m0, m0, 0xD8 + mova [16 + %5], m0 + mova [96 + %5], m0 + mova [112 + %5], m4 + mova [32 + %5], m0 + mova [48 + %5], m4 + mova [64 + %5], m4 + mova [80 + %5], m0 %endmacro %macro IDCT 0 @@ -710,9 +735,7 @@ Z_COND_IDCT 96, 104, 112, 120, rsp + 96, null, 11, %%1 IDCT1 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT1 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT1 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT1 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 @@ -721,9 +744,7 @@ Z_COND_IDCT 96, 104, 112, 120, rsp + 96, null, 11, %%5 IDCT2 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT2 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT2 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT2 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 @@ -731,9 +752,7 @@ Z_COND_IDCT 96, 104, 112, 120, rsp + 96, null, 11, %%7 IDCT3 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT3 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT3 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT3 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 @@ -741,41 +760,33 @@ Z_COND_IDCT 96, 104, 112, 120, rsp + 96, null, 11, %%3 IDCT4 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT4 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT4 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT4 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 %%3: IDCT5 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT5 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT5 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT5 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 %%5: IDCT6 rsp + 0, rsp + 64, rsp + 32, rsp + 96, blockq + 0, 20 - IDCT6 rsp + 16, rsp + 80, rsp + 48, rsp + 112, blockq + 8, 20 jmp %%9 ALIGN 16 %%1: IDCT7 [rsp + 0], [rsp + 64], [rsp + 32], [rsp + 96], blockq + 0, 20 - IDCT7 [rsp + 8], [rsp + 72], [rsp + 40], [rsp + 104], blockq + 4, 20 IDCT7 [rsp + 16], [rsp + 80], [rsp + 48], [rsp + 112], blockq + 8, 20 - IDCT7 [rsp + 24], [rsp + 88], [rsp + 56], [rsp + 120], blockq + 12, 20 jmp %%9 ALIGN 16 %%7: IDCT8 rsp + 0, rsp + 64, rsp + 32, rsp + 96, blockq + 0, 20 - IDCT8 rsp + 16, rsp + 80, rsp + 48, rsp + 112, blockq + 8, 20 %%9: %endmacro @@ -805,15 +816,12 @@ movhps [pixelsq+lsizeq], m0 %endmacro -INIT_MMX mmx +INIT_XMM sse2 cglobal simple_idct, 1, 2, 8, 128, block, t0 IDCT - emms RET -INIT_XMM sse2 - cglobal simple_idct_put, 3, 5, 8, 128, pixels, lsize, block, lsize3, t0 IDCT lea lsize3q, [lsizeq*3] diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/simple_idct.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/simple_idct.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/simple_idct.h 2026-04-29 18:38:26.000000000 +0000 @@ -22,10 +22,7 @@ #include #include -void ff_simple_idct_mmx(int16_t *block); -void ff_simple_idct_add_mmx(uint8_t *dest, ptrdiff_t line_size, int16_t *block); -void ff_simple_idct_put_mmx(uint8_t *dest, ptrdiff_t line_size, int16_t *block); - +void ff_simple_idct_sse2(int16_t *block); void ff_simple_idct_add_sse2(uint8_t *dest, ptrdiff_t line_size, int16_t *block); void ff_simple_idct_put_sse2(uint8_t *dest, ptrdiff_t line_size, int16_t *block); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/videodsp_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/videodsp_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/videodsp_init.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/videodsp_init.c 2026-04-29 18:38:26.000000000 +0000 @@ -27,8 +27,8 @@ #include "libavutil/x86/asm.h" #include "libavutil/x86/cpu.h" #include "libavcodec/videodsp.h" +#include "videodsp.h" -#if HAVE_X86ASM typedef void emu_edge_vfix_func(uint8_t *dst, x86_reg dst_stride, const uint8_t *src, x86_reg src_stride, x86_reg start_y, x86_reg end_y, x86_reg bh); @@ -188,12 +188,12 @@ } } -static av_noinline void emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src, - ptrdiff_t buf_stride, - ptrdiff_t src_stride, - int block_w, int block_h, - int src_x, int src_y, int w, - int h) +void ff_emulated_edge_mc_sse2(uint8_t *buf, const uint8_t *src, + ptrdiff_t buf_stride, + ptrdiff_t src_stride, + int block_w, int block_h, + int src_x, int src_y, int w, + int h) { emulated_edge_mc(buf, src, buf_stride, src_stride, block_w, block_h, src_x, src_y, w, h, vfixtbl_sse2, &ff_emu_edge_vvar_sse, @@ -213,25 +213,22 @@ hfixtbl_avx2, &ff_emu_edge_hvar_avx2); } #endif /* HAVE_AVX2_EXTERNAL */ -#endif /* HAVE_X86ASM */ void ff_prefetch_mmxext(const uint8_t *buf, ptrdiff_t stride, int h); av_cold void ff_videodsp_init_x86(VideoDSPContext *ctx, int bpc) { -#if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMXEXT(cpu_flags)) { ctx->prefetch = ff_prefetch_mmxext; } if (EXTERNAL_SSE2(cpu_flags) && bpc <= 8) { - ctx->emulated_edge_mc = emulated_edge_mc_sse2; + ctx->emulated_edge_mc = ff_emulated_edge_mc_sse2; } #if HAVE_AVX2_EXTERNAL if (EXTERNAL_AVX2(cpu_flags) && bpc <= 8) { ctx->emulated_edge_mc = emulated_edge_mc_avx2; } #endif -#endif /* HAVE_X86ASM */ } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp.asm thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp.asm --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp.asm 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp.asm 2026-04-29 18:38:25.000000000 +0000 @@ -1,5 +1,5 @@ ;****************************************************************************** -;* VP8 MMXEXT optimizations +;* VP8 ASM optimizations ;* Copyright (c) 2010 Ronald S. Bultje ;* Copyright (c) 2010 Fiona Glaser ;* @@ -24,43 +24,43 @@ SECTION_RODATA -fourtap_filter_hw_m: times 4 dw -6, 123 - times 4 dw 12, -1 - times 4 dw -9, 93 - times 4 dw 50, -6 - times 4 dw -6, 50 - times 4 dw 93, -9 - times 4 dw -1, 12 - times 4 dw 123, -6 - -sixtap_filter_hw_m: times 4 dw 2, -11 - times 4 dw 108, 36 - times 4 dw -8, 1 - times 4 dw 3, -16 - times 4 dw 77, 77 - times 4 dw -16, 3 - times 4 dw 1, -8 - times 4 dw 36, 108 - times 4 dw -11, 2 - -fourtap_filter_hb_m: times 8 db -6, 123 - times 8 db 12, -1 - times 8 db -9, 93 - times 8 db 50, -6 - times 8 db -6, 50 - times 8 db 93, -9 - times 8 db -1, 12 - times 8 db 123, -6 - -sixtap_filter_hb_m: times 8 db 2, 1 - times 8 db -11, 108 - times 8 db 36, -8 - times 8 db 3, 3 - times 8 db -16, 77 - times 8 db 77, -16 - times 8 db 1, 2 - times 8 db -8, 36 - times 8 db 108, -11 +fourtap_filter4_b_m: times 4 db -6, 123 + times 4 db 12, -1 + times 4 db -9, 93 + times 4 db 50, -6 + times 4 db -6, 50 + times 4 db 93, -9 + times 4 db -1, 12 + times 4 db 123, -6 + +sixtap_filter4_hb_m: times 8 db 2, -11 + times 4 db 108, -8 + times 4 db 36, 1 + times 8 db 3, -16 + times 4 db 77, -16 + times 4 db 77, 3 + times 8 db 1, -8 + times 4 db 36, -11 + times 4 db 108, 2 + +fourtap_filter_b_m: times 8 db -6, 12 + times 8 db 123, -1 + times 8 db -9, 50 + times 8 db 93, -6 + times 8 db -6, 93 + times 8 db 50, -9 + times 8 db -1, 123 + times 8 db 12, -6 + +sixtap_filter_b_m: times 8 db 2, 36 + times 8 db -11, -8 + times 8 db 108, 1 + times 8 db 3, 77 + times 8 db -16, -16 + times 8 db 77, 3 + times 8 db 1, 108 + times 8 db -8, -11 + times 8 db 36, 2 fourtap_filter_v_m: times 8 dw -6 times 8 dw 123 @@ -115,20 +115,20 @@ times 8 db 1, 7 %if PIC -%define fourtap_filter_hw picregq -%define sixtap_filter_hw picregq -%define fourtap_filter_hb picregq -%define sixtap_filter_hb picregq +%define fourtap_filter_b picregq +%define fourtap_filter4_b picregq +%define sixtap_filter_b picregq +%define sixtap_filter4_hb picregq %define fourtap_filter_v picregq %define sixtap_filter_v picregq %define bilinear_filter_vw picregq %define bilinear_filter_vb picregq %define npicregs 1 %else -%define fourtap_filter_hw fourtap_filter_hw_m -%define sixtap_filter_hw sixtap_filter_hw_m -%define fourtap_filter_hb fourtap_filter_hb_m -%define sixtap_filter_hb sixtap_filter_hb_m +%define fourtap_filter_b fourtap_filter_b_m +%define fourtap_filter4_b fourtap_filter4_b_m +%define sixtap_filter_b sixtap_filter_b_m +%define sixtap_filter4_hb sixtap_filter4_hb_m %define fourtap_filter_v fourtap_filter_v_m %define sixtap_filter_v sixtap_filter_v_m %define bilinear_filter_vw bilinear_filter_vw_m @@ -136,12 +136,17 @@ %define npicregs 0 %endif -filter_h2_shuf: db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 -filter_h4_shuf: db 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10 +filter4_h4_shuf: db 0, 1, 1, 2, 2, 3, 3, 4, 2, 3, 3, 4, 4, 5, 5, 6 +filter4_h6_shuf: db 1, 3, 2, 4, 3, 5, 4, 6, 2, 4, 3, 5, 4, 6, 5, 7 -filter_h6_shuf1: db 0, 5, 1, 6, 2, 7, 3, 8, 4, 9, 5, 10, 6, 11, 7, 12 -filter_h6_shuf2: db 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9 -filter_h6_shuf3: db 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11 +filter_h4_shuf1: db 0, 2, 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9 +filter_h4_shuf2: db 1, 3, 2, 4, 3, 5, 4, 6, 5, 7, 6, 8, 7, 9, 8, 10 + +filter_h6_shuf1: db 0, 3, 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10 +filter_h6_shuf2: db 1, 4, 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10, 8, 11 +filter_h6_shuf3: db 2, 5, 3, 6, 4, 7, 5, 8, 6, 9, 7, 10, 8, 11, 9, 12 + +filter_h2_shuf: db 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8 pw_20091: times 4 dw 20091 pw_17734: times 4 dw 17734 @@ -162,72 +167,117 @@ ;------------------------------------------------------------------------------- %macro FILTER_SSSE3 1 +%if %1 == 4 +%define MOV movd +%else +%define MOV movq +%endif + +%if %1 == 8 cglobal put_vp8_epel%1_h6, 6, 6 + npicregs, 8, dst, dststride, src, srcstride, height, mx, picreg +%else +cglobal put_vp8_epel%1_h6, 6, 6 + npicregs, 6, dst, dststride, src, srcstride, height, mx, picreg +%endif +%if %1 == 4 + mova m3, [filter4_h6_shuf] +%if PIC + lea picregq, [sixtap_filter4_hb_m] +%endif + shl mxd, 4 + mova m4, [sixtap_filter4_hb+mxq-32] + mova m5, [sixtap_filter4_hb+mxq-16] +%else lea mxd, [mxq*3] mova m3, [filter_h6_shuf2] mova m4, [filter_h6_shuf3] %if PIC - lea picregq, [sixtap_filter_hb_m] + lea picregq, [sixtap_filter_b_m] +%endif + mova m5, [sixtap_filter_b+mxq*8-48] ; set up 6tap filter in bytes + mova m6, [sixtap_filter_b+mxq*8-32] + mova m7, [sixtap_filter_b+mxq*8-16] %endif - mova m5, [sixtap_filter_hb+mxq*8-48] ; set up 6tap filter in bytes - mova m6, [sixtap_filter_hb+mxq*8-32] - mova m7, [sixtap_filter_hb+mxq*8-16] .nextrow: +%if %1 == 4 + ; we need nine bytes, so two loads + movq m1, [srcq-1] + movq m0, [srcq-2] + punpcklbw m0, m1 + pshufb m1, m3 + pmaddubsw m1, m5 + pmaddubsw m0, m4 + movhlps m2, m1 +%else movu m0, [srcq-2] mova m1, m0 mova m2, m0 -%if mmsize == 8 -; For epel4, we need 9 bytes, but only 8 get loaded; to compensate, do the -; shuffle with a memory operand - punpcklbw m0, [srcq+3] -%else pshufb m0, [filter_h6_shuf1] -%endif pshufb m1, m3 pshufb m2, m4 pmaddubsw m0, m5 pmaddubsw m1, m6 pmaddubsw m2, m7 - paddsw m0, m1 +%endif + add srcq, srcstrideq + paddw m0, m1 paddsw m0, m2 pmulhrsw m0, [pw_256] packuswb m0, m0 - movh [dstq], m0 ; store + MOV [dstq], m0 ; store ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET +%if %1 == 8 cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 7, dst, dststride, src, srcstride, height, mx, picreg - shl mxd, 4 +%else +cglobal put_vp8_epel%1_h4, 6, 6 + npicregs, 6, dst, dststride, src, srcstride, height, mx, picreg +%endif mova m2, [pw_256] - mova m3, [filter_h2_shuf] - mova m4, [filter_h4_shuf] +%if %1 == 8 + shl mxd, 4 + mova m3, [filter_h4_shuf1] + mova m4, [filter_h4_shuf2] %if PIC - lea picregq, [fourtap_filter_hb_m] + lea picregq, [fourtap_filter_b_m] +%endif + mova m5, [fourtap_filter_b+mxq-16] ; set up 4tap filter in bytes + mova m6, [fourtap_filter_b+mxq] +%else + shl mxd, 3 + mova m3, [filter4_h4_shuf] +%if PIC + lea picregq, [fourtap_filter4_b_m] +%endif + mova m5, [fourtap_filter4_b+mxq-8] %endif - mova m5, [fourtap_filter_hb+mxq-16] ; set up 4tap filter in bytes - mova m6, [fourtap_filter_hb+mxq] .nextrow: +%if %1 == 4 + movq m0, [srcq-1] + pshufb m0, m3 + pmaddubsw m0, m5 + movhlps m1, m0 +%else movu m0, [srcq-1] mova m1, m0 pshufb m0, m3 pshufb m1, m4 pmaddubsw m0, m5 pmaddubsw m1, m6 +%endif + add srcq, srcstrideq paddsw m0, m1 pmulhrsw m0, m2 packuswb m0, m0 - movh [dstq], m0 ; store + MOV [dstq], m0 ; store ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET @@ -235,71 +285,124 @@ cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my shl myd, 4 %if PIC - lea picregq, [fourtap_filter_hb_m] + lea picregq, [fourtap_filter_b_m] %endif - mova m5, [fourtap_filter_hb+myq-16] - mova m6, [fourtap_filter_hb+myq] + mova m5, [fourtap_filter_b+myq-16] + mova m6, [fourtap_filter_b+myq] mova m7, [pw_256] ; read 3 lines - sub srcq, srcstrideq - movh m0, [srcq] - movh m1, [srcq+ srcstrideq] - movh m2, [srcq+2*srcstrideq] - add srcq, srcstrideq - + mov picregq, srcstrideq + neg picregq + MOV m0, [srcq+picregq] + MOV m1, [srcq] + MOV m2, [srcq+srcstrideq] + lea srcq, [srcq+2*srcstrideq] + punpcklbw m0, m2 + +%if %1 == 4 +.next2rows: + movd m3, [srcq] + movd m4, [srcq+srcstrideq] + punpcklbw m1, m3 + punpcklqdq m0, m1 + punpcklbw m2, m4 + pmaddubsw m0, m5 + punpcklqdq m1, m2 + pmaddubsw m1, m6 + lea srcq, [srcq+2*srcstrideq] + paddsw m1, m0 + pmulhrsw m1, m7 + mova m0, m2 + packuswb m1, m1 + movd [dstq], m1 + mova m2, m4 + psrldq m1, 4 + movd [dstq+dststrideq], m1 + mova m1, m3 + lea dstq, [dstq+2*dststrideq] + sub heightd, 2 + jg .next2rows +%else .nextrow: - movh m3, [srcq+2*srcstrideq] ; read new row - mova m4, m0 + movh m3, [srcq] ; read new row + pmaddubsw m0, m5 + punpcklbw m1, m3 + pmaddubsw m4, m1, m6 + add srcq, srcstrideq + paddsw m4, m0 mova m0, m1 - punpcklbw m4, m1 - mova m1, m2 - punpcklbw m2, m3 - pmaddubsw m4, m5 - pmaddubsw m2, m6 - paddsw m4, m2 - mova m2, m3 pmulhrsw m4, m7 + mova m1, m2 packuswb m4, m4 + mova m2, m3 movh [dstq], m4 ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow +%endif RET cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my lea myd, [myq*3] %if PIC - lea picregq, [sixtap_filter_hb_m] + lea picregq, [sixtap_filter_b_m] %endif - lea myq, [sixtap_filter_hb+myq*8] + lea myq, [sixtap_filter_b+myq*8] ; read 5 lines - sub srcq, srcstrideq - sub srcq, srcstrideq - movh m0, [srcq] - movh m1, [srcq+srcstrideq] - movh m2, [srcq+srcstrideq*2] + mov picregq, srcstrideq + neg picregq + MOV m0, [srcq+2*picregq] + MOV m1, [srcq+picregq] + MOV m2, [srcq] + MOV m3, [srcq+srcstrideq] + MOV m4, [srcq+2*srcstrideq] lea srcq, [srcq+srcstrideq*2] - add srcq, srcstrideq - movh m3, [srcq] - movh m4, [srcq+srcstrideq] + punpcklbw m0, m3 + punpcklbw m1, m4 +%if %1 == 4 + punpcklqdq m0, m1 + +.next2rows: + movd m5, [srcq+srcstrideq] + movd m6, [srcq+2*srcstrideq] + pmaddubsw m0, [myq-48] + punpcklbw m2, m5 + punpcklqdq m1, m2 + pmaddubsw m1, [myq-32] + punpcklbw m3, m6 + punpcklqdq m2, m3 + paddw m0, m1 + pmaddubsw m1, m2, [myq-16] + lea srcq, [srcq+2*srcstrideq] + paddsw m1, m0 + mova m0, m2 + pmulhrsw m1, [pw_256] + mova m2, m4 + packuswb m1, m1 + movd [dstq], m1 + mova m4, m6 + psrldq m1, 4 + movd [dstq+dststrideq], m1 + lea dstq, [dstq+2*dststrideq] + mova m1, m3 + mova m3, m5 + sub heightd, 2 + jg .next2rows +%else .nextrow: - movh m5, [srcq+2*srcstrideq] ; read new row - mova m6, m0 - punpcklbw m6, m5 + movh m5, [srcq+srcstrideq] ; read new row + pmaddubsw m0, [myq-48] + punpcklbw m2, m5 + pmaddubsw m6, m1, [myq-32] + pmaddubsw m7, m2, [myq-16] + add srcq, srcstrideq + paddw m6, m0 mova m0, m1 - punpcklbw m1, m2 - mova m7, m3 - punpcklbw m7, m4 - pmaddubsw m6, [myq-48] - pmaddubsw m1, [myq-32] - pmaddubsw m7, [myq-16] - paddsw m6, m1 paddsw m6, m7 mova m1, m2 mova m2, m3 @@ -311,123 +414,16 @@ ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow +%endif RET %endmacro -INIT_MMX ssse3 -FILTER_SSSE3 4 INIT_XMM ssse3 +FILTER_SSSE3 4 FILTER_SSSE3 8 -; 4x4 block, H-only 4-tap filter -INIT_MMX mmxext -cglobal put_vp8_epel4_h4, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg - shl mxd, 4 -%if PIC - lea picregq, [fourtap_filter_hw_m] -%endif - movq mm4, [fourtap_filter_hw+mxq-16] ; set up 4tap filter in words - movq mm5, [fourtap_filter_hw+mxq] - movq mm7, [pw_64] - pxor mm6, mm6 - -.nextrow: - movq mm1, [srcq-1] ; (ABCDEFGH) load 8 horizontal pixels - - ; first set of 2 pixels - movq mm2, mm1 ; byte ABCD.. - punpcklbw mm1, mm6 ; byte->word ABCD - pshufw mm0, mm2, 9 ; byte CDEF.. - punpcklbw mm0, mm6 ; byte->word CDEF - pshufw mm3, mm1, 0x94 ; word ABBC - pshufw mm1, mm0, 0x94 ; word CDDE - pmaddwd mm3, mm4 ; multiply 2px with F0/F1 - movq mm0, mm1 ; backup for second set of pixels - pmaddwd mm1, mm5 ; multiply 2px with F2/F3 - paddd mm3, mm1 ; finish 1st 2px - - ; second set of 2 pixels, use backup of above - punpckhbw mm2, mm6 ; byte->word EFGH - pmaddwd mm0, mm4 ; multiply backed up 2px with F0/F1 - pshufw mm1, mm2, 0x94 ; word EFFG - pmaddwd mm1, mm5 ; multiply 2px with F2/F3 - paddd mm0, mm1 ; finish 2nd 2px - - ; merge two sets of 2 pixels into one set of 4, round/clip/store - packssdw mm3, mm0 ; merge dword->word (4px) - paddsw mm3, mm7 ; rounding - psraw mm3, 7 - packuswb mm3, mm6 ; clip and word->bytes - movd [dstq], mm3 ; store - - ; go to next line - add dstq, dststrideq - add srcq, srcstrideq - dec heightd ; next row - jg .nextrow - RET - -; 4x4 block, H-only 6-tap filter -INIT_MMX mmxext -cglobal put_vp8_epel4_h6, 6, 6 + npicregs, 0, dst, dststride, src, srcstride, height, mx, picreg - lea mxd, [mxq*3] -%if PIC - lea picregq, [sixtap_filter_hw_m] -%endif - movq mm4, [sixtap_filter_hw+mxq*8-48] ; set up 4tap filter in words - movq mm5, [sixtap_filter_hw+mxq*8-32] - movq mm6, [sixtap_filter_hw+mxq*8-16] - movq mm7, [pw_64] - pxor mm3, mm3 - -.nextrow: - movq mm1, [srcq-2] ; (ABCDEFGH) load 8 horizontal pixels - - ; first set of 2 pixels - movq mm2, mm1 ; byte ABCD.. - punpcklbw mm1, mm3 ; byte->word ABCD - pshufw mm0, mm2, 0x9 ; byte CDEF.. - punpckhbw mm2, mm3 ; byte->word EFGH - punpcklbw mm0, mm3 ; byte->word CDEF - pshufw mm1, mm1, 0x94 ; word ABBC - pshufw mm2, mm2, 0x94 ; word EFFG - pmaddwd mm1, mm4 ; multiply 2px with F0/F1 - pshufw mm3, mm0, 0x94 ; word CDDE - movq mm0, mm3 ; backup for second set of pixels - pmaddwd mm3, mm5 ; multiply 2px with F2/F3 - paddd mm1, mm3 ; add to 1st 2px cache - movq mm3, mm2 ; backup for second set of pixels - pmaddwd mm2, mm6 ; multiply 2px with F4/F5 - paddd mm1, mm2 ; finish 1st 2px - - ; second set of 2 pixels, use backup of above - movd mm2, [srcq+3] ; byte FGHI (prevent overreads) - pmaddwd mm0, mm4 ; multiply 1st backed up 2px with F0/F1 - pmaddwd mm3, mm5 ; multiply 2nd backed up 2px with F2/F3 - paddd mm0, mm3 ; add to 2nd 2px cache - pxor mm3, mm3 - punpcklbw mm2, mm3 ; byte->word FGHI - pshufw mm2, mm2, 0xE9 ; word GHHI - pmaddwd mm2, mm6 ; multiply 2px with F4/F5 - paddd mm0, mm2 ; finish 2nd 2px - - ; merge two sets of 2 pixels into one set of 4, round/clip/store - packssdw mm1, mm0 ; merge dword->word (4px) - paddsw mm1, mm7 ; rounding - psraw mm1, 7 - packuswb mm1, mm3 ; clip and word->bytes - movd [dstq], mm1 ; store - - ; go to next line - add dstq, dststrideq - add srcq, srcstrideq - dec heightd ; next row - jg .nextrow - RET - INIT_XMM sse2 cglobal put_vp8_epel8_h4, 6, 6 + npicregs, 10, dst, dststride, src, srcstride, height, mx, picreg shl mxd, 5 @@ -461,17 +457,17 @@ pmullw m2, [mxq+32] pmullw m3, [mxq+48] %endif - paddsw m0, m1 - paddsw m2, m3 + add srcq, srcstrideq + paddw m0, m1 + paddw m2, m3 + paddw m0, m4 paddsw m0, m2 - paddsw m0, m4 psraw m0, 7 packuswb m0, m7 movh [dstq], m0 ; store ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET @@ -522,26 +518,26 @@ pmullw m4, [mxq+64] pmullw m5, [mxq+80] %endif - paddsw m1, m4 - paddsw m0, m5 - paddsw m1, m2 - paddsw m0, m3 + add srcq, srcstrideq + paddw m1, m4 + paddw m0, m5 + paddw m1, m2 + paddw m0, m3 + paddw m1, m6 paddsw m0, m1 - paddsw m0, m6 psraw m0, 7 packuswb m0, m7 movh [dstq], m0 ; store ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET -%macro FILTER_V 1 +INIT_XMM sse2 ; 4x4 block, V-only 4-tap filter -cglobal put_vp8_epel%1_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my +cglobal put_vp8_epel8_v4, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my shl myd, 5 %if PIC lea picregq, [fourtap_filter_v_m] @@ -568,33 +564,33 @@ mova m3, m4 pmullw m0, [myq+0] pmullw m4, m5 - paddsw m4, m0 + paddw m4, m0 ; then calculate positive taps mova m0, m1 pmullw m1, [myq+16] - paddsw m4, m1 + paddw m4, m1 mova m1, m2 pmullw m2, [myq+32] + paddw m4, m6 + add srcq, srcstrideq paddsw m4, m2 mova m2, m3 ; round/clip/store - paddsw m4, m6 psraw m4, 7 packuswb m4, m7 movh [dstq], m4 ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET ; 4x4 block, V-only 6-tap filter -cglobal put_vp8_epel%1_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my +cglobal put_vp8_epel8_v6, 7, 7, 8, dst, dststride, src, srcstride, height, picreg, my shl myd, 4 lea myq, [myq*3] %if PIC @@ -604,15 +600,14 @@ pxor m7, m7 ; read 5 lines - sub srcq, srcstrideq - sub srcq, srcstrideq - movh m0, [srcq] - movh m1, [srcq+srcstrideq] - movh m2, [srcq+srcstrideq*2] + mov picregq, srcstrideq + neg picregq + movh m0, [srcq+2*picregq] + movh m1, [srcq+picregq] + movh m2, [srcq] + movh m3, [srcq+srcstrideq] + movh m4, [srcq+2*srcstrideq] lea srcq, [srcq+srcstrideq*2] - add srcq, srcstrideq - movh m3, [srcq] - movh m4, [srcq+srcstrideq] punpcklbw m0, m7 punpcklbw m1, m7 punpcklbw m2, m7 @@ -625,19 +620,21 @@ pmullw m5, [myq+16] mova m6, m4 pmullw m6, [myq+64] - paddsw m6, m5 + paddw m6, m5 ; then calculate positive taps - movh m5, [srcq+2*srcstrideq] ; read new row + movh m5, [srcq+srcstrideq] ; read new row punpcklbw m5, m7 pmullw m0, [myq+0] - paddsw m6, m0 + paddw m6, [pw_64] + paddw m6, m0 mova m0, m1 mova m1, m2 pmullw m2, [myq+32] - paddsw m6, m2 + paddw m6, m2 mova m2, m3 pmullw m3, [myq+48] + add srcq, srcstrideq paddsw m6, m3 mova m3, m4 mova m4, m5 @@ -645,23 +642,15 @@ paddsw m6, m5 ; round/clip/store - paddsw m6, [pw_64] psraw m6, 7 packuswb m6, m7 movh [dstq], m6 ; go to next line add dstq, dststrideq - add srcq, srcstrideq dec heightd ; next row jg .nextrow RET -%endmacro - -INIT_MMX mmxext -FILTER_V 4 -INIT_XMM sse2 -FILTER_V 8 %macro FILTER_BILINEAR 1 %if cpuflag(ssse3) @@ -672,14 +661,15 @@ %endif pxor m4, m4 mova m3, [bilinear_filter_vb+myq-16] -.nextrow: movh m0, [srcq+srcstrideq*0] +.nextrow: movh m1, [srcq+srcstrideq*1] movh m2, [srcq+srcstrideq*2] punpcklbw m0, m1 punpcklbw m1, m2 pmaddubsw m0, m3 pmaddubsw m1, m3 + lea srcq, [srcq+srcstrideq*2] psraw m0, 2 psraw m1, 2 pavgw m0, m4 @@ -694,6 +684,7 @@ movh [dstq+dststrideq*0], m0 movhps [dstq+dststrideq*1], m0 %endif + mova m0, m2 %else ; cpuflag(ssse3) cglobal put_vp8_bilinear%1_v, 7, 7, 7, dst, dststride, src, srcstride, height, picreg, my shl myd, 4 @@ -716,26 +707,19 @@ pmullw m1, m5 pmullw m2, m4 pmullw m3, m5 - paddsw m0, m1 - paddsw m2, m3 + lea srcq, [srcq+srcstrideq*2] + paddw m0, m1 + paddw m2, m3 psraw m0, 2 psraw m2, 2 pavgw m0, m6 pavgw m2, m6 -%if mmsize == 8 - packuswb m0, m0 - packuswb m2, m2 - movh [dstq+dststrideq*0], m0 - movh [dstq+dststrideq*1], m2 -%else packuswb m0, m2 movh [dstq+dststrideq*0], m0 movhps [dstq+dststrideq*1], m0 -%endif %endif ; cpuflag(ssse3) lea dstq, [dstq+dststrideq*2] - lea srcq, [srcq+srcstrideq*2] sub heightd, 2 jg .nextrow RET @@ -756,6 +740,7 @@ pshufb m1, m2 pmaddubsw m0, m3 pmaddubsw m1, m3 + lea srcq, [srcq+srcstrideq*2] psraw m0, 2 psraw m1, 2 pavgw m0, m4 @@ -793,33 +778,24 @@ pmullw m1, m5 pmullw m2, m4 pmullw m3, m5 - paddsw m0, m1 - paddsw m2, m3 + lea srcq, [srcq+srcstrideq*2] + paddw m0, m1 + paddw m2, m3 psraw m0, 2 psraw m2, 2 pavgw m0, m6 pavgw m2, m6 -%if mmsize == 8 - packuswb m0, m0 - packuswb m2, m2 - movh [dstq+dststrideq*0], m0 - movh [dstq+dststrideq*1], m2 -%else packuswb m0, m2 movh [dstq+dststrideq*0], m0 movhps [dstq+dststrideq*1], m0 -%endif %endif ; cpuflag(ssse3) lea dstq, [dstq+dststrideq*2] - lea srcq, [srcq+srcstrideq*2] sub heightd, 2 jg .nextrow RET %endmacro -INIT_MMX mmxext -FILTER_BILINEAR 4 INIT_XMM sse2 FILTER_BILINEAR 8 INIT_MMX ssse3 @@ -827,14 +803,22 @@ INIT_XMM ssse3 FILTER_BILINEAR 8 -INIT_MMX mmx -cglobal put_vp8_pixels8, 5, 5, 0, dst, dststride, src, srcstride, height +INIT_XMM sse2 +cglobal put_vp8_pixels8, 5, 5+2*ARCH_X86_64, 2, dst, dststride, src, srcstride, height .nextrow: - movq mm0, [srcq+srcstrideq*0] - movq mm1, [srcq+srcstrideq*1] +%if ARCH_X86_64 + mov r5q, [srcq+srcstrideq*0] + mov r6q, [srcq+srcstrideq*1] lea srcq, [srcq+srcstrideq*2] - movq [dstq+dststrideq*0], mm0 - movq [dstq+dststrideq*1], mm1 + mov [dstq+dststrideq*0], r5q + mov [dstq+dststrideq*1], r6q +%else + movq m0, [srcq+srcstrideq*0] + movq m1, [srcq+srcstrideq*1] + lea srcq, [srcq+srcstrideq*2] + movq [dstq+dststrideq*0], m0 + movq [dstq+dststrideq*1], m1 +%endif lea dstq, [dstq+dststrideq*2] sub heightd, 2 jg .nextrow diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp_init.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_init.c 2026-04-29 18:38:25.000000000 +0000 @@ -26,24 +26,9 @@ #include "libavutil/x86/cpu.h" #include "libavcodec/vp8dsp.h" -#if HAVE_X86ASM - /* * MC functions */ -void ff_put_vp8_epel4_h4_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); -void ff_put_vp8_epel4_h6_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); -void ff_put_vp8_epel4_v4_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); -void ff_put_vp8_epel4_v6_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); - void ff_put_vp8_epel8_h4_sse2 (uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); @@ -82,9 +67,6 @@ const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); -void ff_put_vp8_bilinear4_h_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); void ff_put_vp8_bilinear8_h_sse2 (uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); @@ -95,9 +77,6 @@ const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); -void ff_put_vp8_bilinear4_v_mmxext(uint8_t *dst, ptrdiff_t dststride, - const uint8_t *src, ptrdiff_t srcstride, - int height, int mx, int my); void ff_put_vp8_bilinear8_v_sse2 (uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); @@ -109,7 +88,7 @@ int height, int mx, int my); -void ff_put_vp8_pixels8_mmx (uint8_t *dst, ptrdiff_t dststride, +void ff_put_vp8_pixels8_sse2(uint8_t *dst, ptrdiff_t dststride, const uint8_t *src, ptrdiff_t srcstride, int height, int mx, int my); void ff_put_vp8_pixels16_sse(uint8_t *dst, ptrdiff_t dststride, @@ -126,16 +105,6 @@ ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \ dst + 8, dststride, src + 8, srcstride, height, mx, my); \ } -#define TAP_W8(OPT, FILTERTYPE, TAPTYPE) \ -static void ff_put_vp8_ ## FILTERTYPE ## 8_ ## TAPTYPE ## _ ## OPT( \ - uint8_t *dst, ptrdiff_t dststride, uint8_t *src, \ - ptrdiff_t srcstride, int height, int mx, int my) \ -{ \ - ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \ - dst, dststride, src, srcstride, height, mx, my); \ - ff_put_vp8_ ## FILTERTYPE ## 4_ ## TAPTYPE ## _ ## OPT( \ - dst + 4, dststride, src + 4, srcstride, height, mx, my); \ -} TAP_W16(sse2, epel, h6) TAP_W16(sse2, epel, v6) @@ -161,14 +130,6 @@ dst, dststride, tmpptr, SIZE, height, mx, my); \ } -#define HVTAPMMX(x, y) \ -HVTAP(mmxext, 8, x, y, 4, 8) - -HVTAPMMX(4, 4) -HVTAPMMX(4, 6) -HVTAPMMX(6, 4) -HVTAPMMX(6, 6) - #define HVTAPSSE2(x, y, w) \ HVTAP(sse2, 16, x, y, w, 16) \ HVTAP(ssse3, 16, x, y, w, 16) @@ -196,7 +157,6 @@ dst, dststride, tmp, SIZE, height, mx, my); \ } -HVBILIN(mmxext, 8, 4, 8) HVBILIN(sse2, 8, 8, 16) HVBILIN(sse2, 8, 16, 16) HVBILIN(ssse3, 8, 4, 8) @@ -254,8 +214,6 @@ DECLARE_LOOP_FILTER(ssse3) DECLARE_LOOP_FILTER(sse4) -#endif /* HAVE_X86ASM */ - #define VP8_LUMA_MC_FUNC(IDX, SIZE, OPT) \ c->put_vp8_epel_pixels_tab[IDX][0][2] = ff_put_vp8_epel ## SIZE ## _h6_ ## OPT; \ c->put_vp8_epel_pixels_tab[IDX][2][0] = ff_put_vp8_epel ## SIZE ## _v6_ ## OPT; \ @@ -282,33 +240,24 @@ av_cold void ff_vp78dsp_init_x86(VP8DSPContext *c) { -#if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); - if (EXTERNAL_MMX(cpu_flags)) { - c->put_vp8_epel_pixels_tab[1][0][0] = - c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_mmx; - } - - /* note that 4-tap width=16 functions are missing because w=16 - * is only used for luma, and luma is always a copy or sixtap. */ - if (EXTERNAL_MMXEXT(cpu_flags)) { - VP8_MC_FUNC(2, 4, mmxext); - VP8_BILINEAR_MC_FUNC(2, 4, mmxext); - } - if (EXTERNAL_SSE(cpu_flags)) { c->put_vp8_epel_pixels_tab[0][0][0] = c->put_vp8_bilinear_pixels_tab[0][0][0] = ff_put_vp8_pixels16_sse; } if (EXTERNAL_SSE2_SLOW(cpu_flags)) { + c->put_vp8_epel_pixels_tab[1][0][0] = + c->put_vp8_bilinear_pixels_tab[1][0][0] = ff_put_vp8_pixels8_sse2; VP8_LUMA_MC_FUNC(0, 16, sse2); VP8_MC_FUNC(1, 8, sse2); VP8_BILINEAR_MC_FUNC(0, 16, sse2); VP8_BILINEAR_MC_FUNC(1, 8, sse2); } + /* note that 4-tap width=16 functions are missing because w=16 + * is only used for luma, and luma is always a copy or sixtap. */ if (EXTERNAL_SSSE3(cpu_flags)) { VP8_LUMA_MC_FUNC(0, 16, ssse3); VP8_MC_FUNC(1, 8, ssse3); @@ -317,12 +266,10 @@ VP8_BILINEAR_MC_FUNC(1, 8, ssse3); VP8_BILINEAR_MC_FUNC(2, 4, ssse3); } -#endif /* HAVE_X86ASM */ } av_cold void ff_vp8dsp_init_x86(VP8DSPContext *c) { -#if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(cpu_flags)) { @@ -379,5 +326,4 @@ c->vp8_h_loop_filter16y = ff_vp8_h_loop_filter16y_mbedge_sse4; c->vp8_h_loop_filter8uv = ff_vp8_h_loop_filter8uv_mbedge_sse4; } -#endif /* HAVE_X86ASM */ } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp8dsp_loopfilter.asm 2026-04-29 18:38:25.000000000 +0000 @@ -1,5 +1,5 @@ ;****************************************************************************** -;* VP8 MMXEXT optimizations +;* VP8 ASM optimizations ;* Copyright (c) 2010 Ronald S. Bultje ;* Copyright (c) 2010 Fiona Glaser ;* @@ -381,7 +381,7 @@ ; read lea dst2q, [dst1q+strideq] %ifidn %1, v -%if %2 == 8 && mmsize == 16 +%if %2 == 8 %define movrow movh %else %define movrow mova @@ -392,7 +392,7 @@ movrow m5, [dst2q] ; q1 movrow m6, [dst2q+ strideq*1] ; q2 movrow m7, [dst2q+ strideq*2] ; q3 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m0, [dst8q+mstrideq*4] movhps m2, [dst8q+mstrideq*2] add dst8q, strideq @@ -498,7 +498,7 @@ SWAP 7, 3 ; now m7 is zero %ifidn %1, v movrow m3, [dst1q+mstrideq ] ; p0 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m3, [dst8q+mstrideq ] %endif %elifdef m12 @@ -520,7 +520,7 @@ SWAP 6, 4 ; now m6 is I %ifidn %1, v movrow m4, [dst1q] ; q0 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m4, [dst8q] %endif %elifdef m8 @@ -574,10 +574,10 @@ pand m0, m7 ; normal_limit result ; filter_common; at this point, m2-m5=p1-q1 and m0 is filter_mask -%ifdef m8 ; x86-64 && sse2 +%ifdef m8 ; x86-64 mova m8, [pb_80] %define m_pb_80 m8 -%else ; x86-32 or mmx/mmxext +%else ; x86-32 %define m_pb_80 [pb_80] %endif mova m1, m4 @@ -648,7 +648,7 @@ movrow [dst1q+mstrideq ], m3 movrow [dst1q], m4 movrow [dst1q+ strideq ], m5 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps [dst8q+mstrideq*2], m2 movhps [dst8q+mstrideq ], m3 movhps [dst8q], m4 @@ -688,14 +688,11 @@ %macro MBEDGE_LOOPFILTER 2 %define stack_size 0 %ifndef m8 ; stack layout: [0]=E, [1]=I, [2]=hev_thr -%if mmsize == 16 ; [3]=hev() result + ; [3]=hev() result ; [4]=filter tmp result ; [5]/[6] = p2/q2 backup ; [7]=lim_res sign result %define stack_size mmsize * -7 -%else ; 8 ; extra storage space for transposes -%define stack_size mmsize * -8 -%endif %endif %if %2 == 8 ; chroma @@ -723,11 +720,7 @@ %define m_q0backup [rsp+mmsize*4] %define m_p2backup [rsp+mmsize*5] %define m_q2backup [rsp+mmsize*6] -%if mmsize == 16 %define m_limsign [rsp] -%else -%define m_limsign [rsp+mmsize*7] -%endif mova m_flimE, m0 mova m_flimI, m1 @@ -767,7 +760,7 @@ ; read lea dst2q, [dst1q+ strideq ] %ifidn %1, v -%if %2 == 8 && mmsize == 16 +%if %2 == 8 %define movrow movh %else %define movrow mova @@ -778,7 +771,7 @@ movrow m5, [dst2q] ; q1 movrow m6, [dst2q+ strideq ] ; q2 movrow m7, [dst2q+ strideq*2] ; q3 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m0, [dst8q+mstrideq*4] movhps m2, [dst8q+mstrideq*2] add dst8q, strideq @@ -886,7 +879,7 @@ SWAP 7, 3 ; now m7 is zero %ifidn %1, v movrow m3, [dst1q+mstrideq ] ; p0 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m3, [dst8q+mstrideq ] %endif %elifdef m12 @@ -908,7 +901,7 @@ SWAP 6, 4 ; now m6 is I %ifidn %1, v movrow m4, [dst1q] ; q0 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 movhps m4, [dst8q] %endif %elifdef m8 @@ -962,10 +955,10 @@ pand m0, m7 ; normal_limit result ; filter_common; at this point, m2-m5=p1-q1 and m0 is filter_mask -%ifdef m8 ; x86-64 && sse2 +%ifdef m8 ; x86-64 mova m8, [pb_80] %define m_pb_80 m8 -%else ; x86-32 or mmx/mmxext +%else ; x86-32 %define m_pb_80 [pb_80] %endif mova m1, m4 @@ -1182,7 +1175,7 @@ movrow [dst1q], m4 movrow [dst2q], m5 movrow [dst2q+ strideq ], m6 -%if mmsize == 16 && %2 == 8 +%if %2 == 8 add dst8q, mstrideq movhps [dst8q+mstrideq*2], m1 movhps [dst8q+mstrideq ], m2 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/x86/vp9dsp_init_16bpp.c 2026-04-29 18:38:25.000000000 +0000 @@ -26,8 +26,6 @@ #include "libavcodec/vp9dsp.h" #include "libavcodec/x86/vp9dsp_init.h" -#if HAVE_X86ASM - decl_fpel_func(put, 8, , mmx); decl_fpel_func(avg, 8, _16, mmxext); decl_fpel_func(put, 16, , sse); @@ -68,11 +66,9 @@ decl_ipred_dir_funcs(vr); decl_ipred_dir_funcs(hu); decl_ipred_dir_funcs(hd); -#endif /* HAVE_X86ASM */ av_cold void ff_vp9dsp_init_16bpp_x86(VP9DSPContext *dsp) { -#if HAVE_X86ASM int cpu_flags = av_get_cpu_flags(); if (EXTERNAL_MMX(cpu_flags)) { @@ -147,6 +143,4 @@ init_ipred_func(dr, DIAG_DOWN_RIGHT, 32, 16, avx2); #endif } - -#endif /* HAVE_X86ASM */ } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavcodec/xvididct.h thunderbird-140.10.1esr/media/ffvpx/libavcodec/xvididct.h --- thunderbird-140.10.0esr/media/ffvpx/libavcodec/xvididct.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavcodec/xvididct.h 2026-04-29 18:38:25.000000000 +0000 @@ -21,16 +21,13 @@ #include -#include "avcodec.h" #include "idctdsp.h" void ff_xvid_idct(int16_t *const in); -void ff_xvid_idct_init(IDCTDSPContext *c, AVCodecContext *avctx); +void ff_xvid_idct_init(IDCTDSPContext *c); -void ff_xvid_idct_init_x86(IDCTDSPContext *c, AVCodecContext *avctx, - unsigned high_bit_depth); -void ff_xvid_idct_init_mips(IDCTDSPContext *c, AVCodecContext *avctx, - unsigned high_bit_depth); +void ff_xvid_idct_init_x86(IDCTDSPContext *c); +void ff_xvid_idct_init_mips(IDCTDSPContext *c); #endif /* AVCODEC_XVIDIDCT_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/asm.S thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/asm.S --- thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/asm.S 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/asm.S 2026-04-29 18:38:25.000000000 +0000 @@ -40,6 +40,14 @@ .arch AS_ARCH_LEVEL #endif +#if HAVE_AS_ARCHEXT_CRC_DIRECTIVE +#define ENABLE_ARM_CRC .arch_extension crc +#define DISABLE_ARM_CRC .arch_extension nocrc +#else +#define ENABLE_ARM_CRC +#define DISABLE_ARM_CRC +#endif + #if HAVE_AS_ARCHEXT_DOTPROD_DIRECTIVE #define ENABLE_DOTPROD .arch_extension dotprod #define DISABLE_DOTPROD .arch_extension nodotprod @@ -56,6 +64,22 @@ #define DISABLE_I8MM #endif +#if HAVE_AS_ARCHEXT_AES_DIRECTIVE +#define ENABLE_PMULL .arch_extension aes +#define DISABLE_PMULL .arch_extension noaes +#else +#define ENABLE_PMULL +#define DISABLE_PMULL +#endif + +#if HAVE_AS_ARCHEXT_SHA3_DIRECTIVE +#define ENABLE_EOR3 .arch_extension sha3 +#define DISABLE_EOR3 .arch_extension nosha3 +#else +#define ENABLE_EOR3 +#define DISABLE_EOR3 +#endif + #if HAVE_AS_ARCHEXT_SVE_DIRECTIVE #define ENABLE_SVE .arch_extension sve #define DISABLE_SVE .arch_extension nosve @@ -72,10 +96,40 @@ #define DISABLE_SVE2 #endif +#if HAVE_AS_ARCHEXT_SME_DIRECTIVE +#define ENABLE_SME .arch_extension sme +#define DISABLE_SME .arch_extension nosme +#else +#define ENABLE_SME +#define DISABLE_SME +#endif + +#if HAVE_AS_ARCHEXT_SME_I16I64_DIRECTIVE +#define ENABLE_SME_I16I64 .arch_extension sme-i16i64 +#define DISABLE_SME_I16I64 .arch_extension nosme-i16i64 +#else +#define ENABLE_SME_I16I64 +#define DISABLE_SME_I16I64 +#endif + +#if HAVE_AS_ARCHEXT_SME2_DIRECTIVE +#define ENABLE_SME2 .arch_extension sme2 +#define DISABLE_SME2 .arch_extension nosme2 +#else +#define ENABLE_SME2 +#define DISABLE_SME2 +#endif + +DISABLE_ARM_CRC +DISABLE_PMULL +DISABLE_EOR3 DISABLE_DOTPROD DISABLE_I8MM DISABLE_SVE DISABLE_SVE2 +DISABLE_SME +DISABLE_SME_I16I64 +DISABLE_SME2 /* Support macros for @@ -147,16 +201,18 @@ * * References: * - "ELF for the Arm® 64-bit Architecture" - * https: *github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst + * https://github.com/ARM-software/abi-aa/blob/master/aaelf64/aaelf64.rst * - "Providing protection for complex software" * https://developer.arm.com/architectures/learn-the-architecture/providing-protection-for-complex-software */ #if defined(__ARM_FEATURE_BTI_DEFAULT) && (__ARM_FEATURE_BTI_DEFAULT == 1) # define GNU_PROPERTY_AARCH64_BTI (1 << 0) // Has BTI -# define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c' -# define AARCH64_VALID_JUMP_TARGET hint #38 // BTI 'j' +# define AARCH64_VALID_JUMP_CALL_TARGET hint #38 // BTI 'jc' +# define AARCH64_VALID_CALL_TARGET hint #34 // BTI 'c' +# define AARCH64_VALID_JUMP_TARGET hint #38 // BTI 'j' #else # define GNU_PROPERTY_AARCH64_BTI 0 // No BTI +# define AARCH64_VALID_JUMP_CALL_TARGET # define AARCH64_VALID_CALL_TARGET # define AARCH64_VALID_JUMP_TARGET #endif @@ -181,8 +237,14 @@ # define AARCH64_VALIDATE_LINK_REGISTER #endif +#if defined(__ARM_FEATURE_GCS_DEFAULT) && __ARM_FEATURE_GCS_DEFAULT == 1 +#define GNU_PROPERTY_AARCH64_GCS (1 << 2) +#else +#define GNU_PROPERTY_AARCH64_GCS 0 /* No GCS */ +#endif + -#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0) && defined(__ELF__) +#if (GNU_PROPERTY_AARCH64_BTI != 0 || GNU_PROPERTY_AARCH64_PAC != 0 || GNU_PROPERTY_AARCH64_GCS != 0) && defined(__ELF__) .pushsection .note.gnu.property, "a" .balign 8 .long 4 @@ -191,12 +253,12 @@ .asciz "GNU" .long 0xc0000000 /* GNU_PROPERTY_AARCH64_FEATURE_1_AND */ .long 4 - .long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC) + .long (GNU_PROPERTY_AARCH64_BTI | GNU_PROPERTY_AARCH64_PAC | GNU_PROPERTY_AARCH64_GCS) .long 0 .popsection #endif -.macro function name, export=0, align=2 +.macro function name, export=0, jumpable=0, align=4 .macro endfunc ELF .size \name, . - \name FUNC .endfunc @@ -209,7 +271,11 @@ ELF .type EXTERN_ASM\name, %function FUNC .func EXTERN_ASM\name EXTERN_ASM\name: + .if \jumpable + AARCH64_VALID_JUMP_TARGET + .else AARCH64_VALID_CALL_TARGET + .endif .else ELF .type \name, %function FUNC .func \name @@ -217,7 +283,7 @@ .endif .endm -.macro const name, align=2, relocate=0 +.macro const name, align=4, relocate=0 .macro endconst ELF .size \name, . - \name .purgem endconst @@ -276,3 +342,26 @@ #define x18 do_not_use_x18 #define w18 do_not_use_w18 + +#if HAVE_SME +.macro sme_entry + AARCH64_SIGN_LINK_REGISTER + stp x29, x30, [sp, #-80]! + mov x29, sp + stp d8, d9, [sp, #16] + stp d10, d11, [sp, #32] + stp d12, d13, [sp, #48] + stp d14, d15, [sp, #64] + smstart +.endm + +.macro sme_exit + smstop + ldp d8, d9, [sp, #16] + ldp d10, d11, [sp, #32] + ldp d12, d13, [sp, #48] + ldp d14, d15, [sp, #64] + ldp x29, x30, [sp], #80 + AARCH64_VALIDATE_LINK_REGISTER +.endm +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/cpu.c thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/cpu.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.c 2026-04-29 18:38:26.000000000 +0000 @@ -24,10 +24,16 @@ #include #include +#define HWCAP_AARCH64_PMULL (1 << 4) +#define HWCAP_AARCH64_CRC32 (1 << 7) +#define HWCAP_AARCH64_SHA3 (1 << 17) #define HWCAP_AARCH64_ASIMDDP (1 << 20) #define HWCAP_AARCH64_SVE (1 << 22) #define HWCAP2_AARCH64_SVE2 (1 << 1) #define HWCAP2_AARCH64_I8MM (1 << 13) +#define HWCAP2_AARCH64_SME (1 << 23) +#define HWCAP2_AARCH64_SME_I16I64 (1 << 24) +#define HWCAP2_AARCH64_SME2 (1ULL << 37) static int detect_flags(void) { @@ -36,6 +42,12 @@ unsigned long hwcap = ff_getauxval(AT_HWCAP); unsigned long hwcap2 = ff_getauxval(AT_HWCAP2); + if (hwcap & HWCAP_AARCH64_PMULL) + flags |= AV_CPU_FLAG_PMULL; + if (hwcap & HWCAP_AARCH64_SHA3) + flags |= AV_CPU_FLAG_EOR3; + if (hwcap & HWCAP_AARCH64_CRC32) + flags |= AV_CPU_FLAG_ARM_CRC; if (hwcap & HWCAP_AARCH64_ASIMDDP) flags |= AV_CPU_FLAG_DOTPROD; if (hwcap & HWCAP_AARCH64_SVE) @@ -44,6 +56,12 @@ flags |= AV_CPU_FLAG_SVE2; if (hwcap2 & HWCAP2_AARCH64_I8MM) flags |= AV_CPU_FLAG_I8MM; + if (hwcap2 & HWCAP2_AARCH64_SME) + flags |= AV_CPU_FLAG_SME; + if (hwcap2 & HWCAP2_AARCH64_SME_I16I64) + flags |= AV_CPU_FLAG_SME_I16I64; + if (hwcap2 & HWCAP2_AARCH64_SME2) + flags |= AV_CPU_FLAG_SME2; return flags; } @@ -67,6 +85,18 @@ flags |= AV_CPU_FLAG_DOTPROD; if (have_feature("hw.optional.arm.FEAT_I8MM")) flags |= AV_CPU_FLAG_I8MM; + if (have_feature("hw.optional.arm.FEAT_SME")) + flags |= AV_CPU_FLAG_SME; + if (have_feature("hw.optional.arm.FEAT_SME_I16I64")) + flags |= AV_CPU_FLAG_SME_I16I64; + if (have_feature("hw.optional.armv8_crc32")) + flags |= AV_CPU_FLAG_ARM_CRC; + if (have_feature("hw.optional.arm.FEAT_PMULL")) + flags |= AV_CPU_FLAG_PMULL; + if (have_feature("hw.optional.armv8_2_sha3")) + flags |= AV_CPU_FLAG_EOR3; + if (have_feature("hw.optional.arm.FEAT_SME2")) + flags |= AV_CPU_FLAG_SME2; return flags; } @@ -93,6 +123,12 @@ if (sysctl(mib, 2, &isar0, &len, NULL, 0) != -1) { if (ID_AA64ISAR0_DP(isar0) >= ID_AA64ISAR0_DP_IMPL) flags |= AV_CPU_FLAG_DOTPROD; + if (ID_AA64ISAR0_CRC32(isar0) >= ID_AA64ISAR0_CRC32_BASE) + flags |= AV_CPU_FLAG_ARM_CRC; + if (ID_AA64ISAR0_AES(isar0) >= ID_AA64ISAR0_AES_PMULL) + flags |= AV_CPU_FLAG_PMULL; + if (ID_AA64ISAR0_SHA3(isar0) >= ID_AA64ISAR0_SHA3_IMPL) + flags |= AV_CPU_FLAG_EOR3; } mib[0] = CTL_MACHDEP; @@ -115,15 +151,24 @@ static int detect_flags(void) { int flags = 0; +#ifdef PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_ARM_CRC; +#endif +#ifdef PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_PMULL; +#endif +#ifdef PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_SHA3_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_EOR3; +#endif #ifdef PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE if (IsProcessorFeaturePresent(PF_ARM_V82_DP_INSTRUCTIONS_AVAILABLE)) flags |= AV_CPU_FLAG_DOTPROD; #endif -#ifdef PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE - /* There's no PF_* flag that indicates whether plain I8MM is available - * or not. But if SVE_I8MM is available, that also implies that - * regular I8MM is available. */ - if (IsProcessorFeaturePresent(PF_ARM_SVE_I8MM_INSTRUCTIONS_AVAILABLE)) +#ifdef PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_V82_I8MM_INSTRUCTIONS_AVAILABLE)) flags |= AV_CPU_FLAG_I8MM; #endif #ifdef PF_ARM_SVE_INSTRUCTIONS_AVAILABLE @@ -134,6 +179,18 @@ if (IsProcessorFeaturePresent(PF_ARM_SVE2_INSTRUCTIONS_AVAILABLE)) flags |= AV_CPU_FLAG_SVE2; #endif +#ifdef PF_ARM_SME_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_SME_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_SME; +#endif +#ifdef PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_SME_I16I64_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_SME_I16I64; +#endif +#ifdef PF_ARM_SME2_INSTRUCTIONS_AVAILABLE + if (IsProcessorFeaturePresent(PF_ARM_SME2_INSTRUCTIONS_AVAILABLE)) + flags |= AV_CPU_FLAG_SME2; +#endif return flags; } #else @@ -162,6 +219,24 @@ #ifdef __ARM_FEATURE_SVE2 flags |= AV_CPU_FLAG_SVE2; #endif +#ifdef __ARM_FEATURE_SME + flags |= AV_CPU_FLAG_SME; +#endif +#ifdef __ARM_FEATURE_CRC32 + flags |= AV_CPU_FLAG_ARM_CRC; +#endif +#ifdef __ARM_FEATURE_AES + flags |= AV_CPU_FLAG_PMULL; +#endif +#ifdef __ARM_FEATURE_SHA3 + flags |= AV_CPU_FLAG_EOR3; +#endif +#ifdef __ARM_FEATURE_SME_I16I64 + flags |= AV_CPU_FLAG_SME_I16I64; +#endif +#ifdef __ARM_FEATURE_SME2 + flags |= AV_CPU_FLAG_SME2; +#endif flags |= detect_flags(); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/cpu.h thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/cpu.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/cpu.h 2026-04-29 18:38:26.000000000 +0000 @@ -22,16 +22,26 @@ #include "libavutil/cpu.h" #include "libavutil/cpu_internal.h" -#define have_armv8(flags) CPUEXT(flags, ARMV8) -#define have_neon(flags) CPUEXT(flags, NEON) -#define have_vfp(flags) CPUEXT(flags, VFP) +#define have_armv8(flags) CPUEXT(flags, ARMV8) +#define have_neon(flags) CPUEXT(flags, NEON) +#define have_vfp(flags) CPUEXT(flags, VFP) +#define have_arm_crc(flags) CPUEXT(flags, ARM_CRC) +#define have_pmull(flags) CPUEXT(flags, PMULL) +#define have_eor3(flags) CPUEXT(flags, EOR3) #define have_dotprod(flags) CPUEXT(flags, DOTPROD) #define have_i8mm(flags) CPUEXT(flags, I8MM) #define have_sve(flags) CPUEXT(flags, SVE) #define have_sve2(flags) CPUEXT(flags, SVE2) +#define have_sme(flags) CPUEXT(flags, SME) +#define have_sme_i16i64(flags) CPUEXT(flags, SME_I16I64) +#define have_sme2(flags) CPUEXT(flags, SME2) #if HAVE_SVE int ff_aarch64_sve_length(void); #endif +#if HAVE_SME +int ff_aarch64_sme_length(void); +#endif + #endif /* AVUTIL_AARCH64_CPU_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/tx_float_neon.S thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/tx_float_neon.S --- thunderbird-140.10.0esr/media/ffvpx/libavutil/aarch64/tx_float_neon.S 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/aarch64/tx_float_neon.S 2026-04-29 18:38:25.000000000 +0000 @@ -119,13 +119,6 @@ .endif .endm -const shuf_4pt_x2, align=4 - .byte 24, 25, 26, 27 // reg2, 3 - .byte 12, 13, 14, 15 // reg1, 4 - .byte 8, 9, 10, 11 // reg1, 3 - .byte 28, 29, 30, 31 // reg2, 4 -endconst - // Identical to FFT4, but does 2 transforms in parallel, with no deinterleaving .macro FFT4_X2 e0, o0, e1, o1, \ t0=v16, t1=v17, t2=v18, t3=v19, t4=v20, t5=v21, t6=v22 @@ -135,18 +128,17 @@ fsub \e0\().4s, \e0\().4s, \o0\().4s // t1234 fsub \e1\().4s, \e1\().4s, \o1\().4s // t1234 - movrel x5, shuf_4pt_x2 - rev64 \t4\().4s, \e0\().4s rev64 \t5\().4s, \e1\().4s - zip2 \o0\().2d, \t0\().2d, \e0\().2d // t3,4 r3,4 - zip2 \o1\().2d, \t2\().2d, \e1\().2d // t3,4 r3,4 + zip2 \o0\().2d, \t0\().2d, \t4\().2d // t3,4 r3,4 + zip2 \o1\().2d, \t2\().2d, \t5\().2d // t3,4 r3,4 - ld1 { \t6\().16b }, [x5] + fneg \t3\().4s, \t4\().4s + fneg \t4\().4s, \t5\().4s - mov \o0\().d[1], \t4\().d[1] - mov \o1\().d[1], \t5\().d[1] + mov \o0\().s[3], \t3\().s[3] + mov \o1\().s[3], \t4\().s[3] zip1 \t1\().2d, \t0\().2d, \e0\().2d // t1,2 r1,2 zip1 \t3\().2d, \t2\().2d, \e1\().2d // t1,2 r1,2 @@ -156,18 +148,10 @@ fsub \t2\().4s, \t3\().4s, \o1\().4s // a34 b32 fadd \t3\().4s, \t3\().4s, \o1\().4s // a12 b14 - // TODO: experiment with movs instead of tables here - tbl \o0\().16b, { \t4\().16b, \t5\().16b }, \t6\().16b // b1234 - tbl \o1\().16b, { \t2\().16b, \t3\().16b }, \t6\().16b // b1234 - zip1 \e0\().2d, \t5\().2d, \t4\().2d // a1234 -// zip2 \o0\().2d, \t5\().2d, \t4\().2d // b1432 + zip2 \o0\().2d, \t5\().2d, \t4\().2d // b1432 zip1 \e1\().2d, \t3\().2d, \t2\().2d // a1234 -// zip2 \o1\().2d, \t3\().2d, \t2\().2d // b1432 -// rev64 \o0\().4s, \o0\().4s // b4123 -// rev64 \o1\().4s, \o1\().4s // b4123 -// ext \o0\().16b, \o0\().16b, \o0\().16b, #4 // b1234 -// ext \o1\().16b, \o1\().16b, \o1\().16b, #4 // b1234 + zip2 \o1\().2d, \t3\().2d, \t2\().2d // b1432 .endm const tab_8pt, align=4 @@ -933,6 +917,7 @@ .macro SR_TRANSFORM_DEF len, next=0 \len: + AARCH64_SIGN_LINK_REGISTER stp x20, x30, [sp, #-16]! mov w20, #(\len/4) mov x5, #((\len*4) - (\len/1)) @@ -942,6 +927,7 @@ add x1, x1, x5 bl 32b ldp x20, x30, [sp], #16 + AARCH64_VALIDATE_LINK_REGISTER ldr w5, =(\len*6 + \len/2) sub x1, x1, x5 @@ -1077,6 +1063,7 @@ b.gt 128f ret 128: + AARCH64_SIGN_LINK_REGISTER stp x20, x30, [sp, #-16]! mov w20, #32 add x1, x1, #16*32 @@ -1084,6 +1071,7 @@ add x1, x1, #8*32 bl 32b ldp x20, x30, [sp], #16 + AARCH64_VALIDATE_LINK_REGISTER sub x1, x1, #24*32 SETUP_SR_RECOMB 128, x7, x8, x9 @@ -1097,6 +1085,7 @@ b.gt 256f ret 256: + AARCH64_SIGN_LINK_REGISTER stp x20, x30, [sp, #-16]! mov w20, #64 add x1, x1, #32*32 @@ -1104,6 +1093,7 @@ add x1, x1, #16*32 bl 32b ldp x20, x30, [sp], #16 + AARCH64_VALIDATE_LINK_REGISTER sub x1, x1, #48*32 SETUP_SR_RECOMB 256, x7, x8, x9 @@ -1118,6 +1108,7 @@ b.gt 512f ret 512: + AARCH64_SIGN_LINK_REGISTER stp x20, x30, [sp, #-16]! mov w20, #128 add x1, x1, #64*32 @@ -1125,6 +1116,7 @@ add x1, x1, #32*32 bl 32b ldp x20, x30, [sp], #16 + AARCH64_VALIDATE_LINK_REGISTER sub x1, x1, #96*32 SETUP_SR_RECOMB 512, x7, x8, x9 @@ -1144,6 +1136,7 @@ ret 1024: + AARCH64_SIGN_LINK_REGISTER stp x20, x30, [sp, #-16]! mov w20, #256 add x1, x1, #96*32 @@ -1151,6 +1144,7 @@ add x1, x1, #64*32 bl 32b ldp x20, x30, [sp], #16 + AARCH64_VALIDATE_LINK_REGISTER mov x5, #192*32 sub x1, x1, x5 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/arm/cpu.c thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/cpu.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/arm/cpu.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/cpu.c 2026-04-29 18:38:25.000000000 +0000 @@ -31,30 +31,32 @@ CORE_FLAG(VFPV3) | \ CORE_FLAG(NEON)) -#if defined __linux__ || defined __ANDROID__ +#if defined __linux__ || defined __ANDROID__ || HAVE_ELF_AUX_INFO #include #include #include #include "libavutil/avstring.h" -#if HAVE_GETAUXVAL +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO #include #endif +#ifndef AT_HWCAP #define AT_HWCAP 16 +#endif /* Relevant HWCAP values from kernel headers */ -#define HWCAP_VFP (1 << 6) -#define HWCAP_EDSP (1 << 7) -#define HWCAP_THUMBEE (1 << 11) -#define HWCAP_NEON (1 << 12) -#define HWCAP_VFPv3 (1 << 13) -#define HWCAP_TLS (1 << 15) +#define HWCAP_ARM_VFP (1 << 6) +#define HWCAP_ARM_EDSP (1 << 7) +#define HWCAP_ARM_THUMBEE (1 << 11) +#define HWCAP_ARM_NEON (1 << 12) +#define HWCAP_ARM_VFPv3 (1 << 13) +#define HWCAP_ARM_TLS (1 << 15) static int get_auxval(uint32_t *hwcap) { -#if HAVE_GETAUXVAL +#if HAVE_GETAUXVAL || HAVE_ELF_AUX_INFO unsigned long ret = ff_getauxval(AT_HWCAP); if (ret == 0) return -1; @@ -65,6 +67,7 @@ #endif } +#if defined __linux__ || defined __ANDROID__ static int get_hwcap(uint32_t *hwcap) { struct { uint32_t a_type; uint32_t a_val; } auxv; @@ -98,25 +101,26 @@ while (fgets(buf, sizeof(buf), f)) { if (av_strstart(buf, "Features", NULL)) { if (strstr(buf, " edsp ")) - *hwcap |= HWCAP_EDSP; + *hwcap |= HWCAP_ARM_EDSP; if (strstr(buf, " tls ")) - *hwcap |= HWCAP_TLS; + *hwcap |= HWCAP_ARM_TLS; if (strstr(buf, " thumbee ")) - *hwcap |= HWCAP_THUMBEE; + *hwcap |= HWCAP_ARM_THUMBEE; if (strstr(buf, " vfp ")) - *hwcap |= HWCAP_VFP; + *hwcap |= HWCAP_ARM_VFP; if (strstr(buf, " vfpv3 ")) - *hwcap |= HWCAP_VFPv3; + *hwcap |= HWCAP_ARM_VFPv3; if (strstr(buf, " neon ") || strstr(buf, " asimd ")) - *hwcap |= HWCAP_NEON; + *hwcap |= HWCAP_ARM_NEON; if (strstr(buf, " fp ")) // Listed on 64 bit ARMv8 kernels - *hwcap |= HWCAP_VFP | HWCAP_VFPv3; + *hwcap |= HWCAP_ARM_VFP | HWCAP_ARM_VFPv3; break; } } fclose(f); return 0; } +#endif int ff_get_cpu_flags_arm(void) { @@ -124,12 +128,14 @@ uint32_t hwcap; if (get_auxval(&hwcap) < 0) +#if defined __linux__ || defined __ANDROID__ if (get_hwcap(&hwcap) < 0) if (get_cpuinfo(&hwcap) < 0) +#endif return flags; #define check_cap(cap, flag) do { \ - if (hwcap & HWCAP_ ## cap) \ + if (hwcap & HWCAP_ARM_ ## cap) \ flags |= AV_CPU_FLAG_ ## flag; \ } while (0) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/arm/timer.h thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/timer.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/arm/timer.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/arm/timer.h 2026-04-29 18:38:25.000000000 +0000 @@ -30,7 +30,7 @@ #define AV_READ_TIME mach_absolute_time -#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__) +#elif HAVE_INLINE_ASM && defined(__ARM_ARCH_7A__) && !defined(__ANDROID__) #define AV_READ_TIME read_time diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/attributes.h thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/attributes.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes.h 2026-04-29 18:38:25.000000000 +0000 @@ -40,8 +40,27 @@ # define AV_HAS_BUILTIN(x) 0 #endif +#ifdef __has_attribute +# define AV_HAS_ATTRIBUTE(x) __has_attribute(x) +#else +# define AV_HAS_ATTRIBUTE(x) 0 +#endif + +#if defined(__cplusplus) && \ + defined(__has_cpp_attribute) && \ + __cplusplus >= 201103L +# define AV_HAS_STD_ATTRIBUTE(x) __has_cpp_attribute(x) +#elif !defined(__cplusplus) && \ + defined(__has_c_attribute) && \ + defined(__STDC_VERSION__) && \ + __STDC_VERSION__ >= 202311L +# define AV_HAS_STD_ATTRIBUTE(x) __has_c_attribute(x) +#else +# define AV_HAS_STD_ATTRIBUTE(x) 0 +#endif + #ifndef av_always_inline -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define av_always_inline __attribute__((always_inline)) inline #elif defined(_MSC_VER) # define av_always_inline __forceinline @@ -58,13 +77,15 @@ #endif #endif -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_HAS_STD_ATTRIBUTE(nodiscard) +# define av_warn_unused_result [[nodiscard]] +#elif AV_GCC_VERSION_AT_LEAST(3,4) || defined(__clang__) # define av_warn_unused_result __attribute__((warn_unused_result)) #else # define av_warn_unused_result #endif -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define av_noinline __attribute__((noinline)) #elif defined(_MSC_VER) # define av_noinline __declspec(noinline) @@ -90,13 +111,15 @@ # define av_cold #endif -#if AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__llvm__) +#if (AV_GCC_VERSION_AT_LEAST(4,1) && !defined(__clang__ )) || AV_HAS_ATTRIBUTE(flatten) # define av_flatten __attribute__((flatten)) #else # define av_flatten #endif -#if AV_GCC_VERSION_AT_LEAST(3,1) +#if AV_HAS_STD_ATTRIBUTE(deprecated) +# define attribute_deprecated [[deprecated]] +#elif AV_GCC_VERSION_AT_LEAST(3,1) || defined(__clang__) # define attribute_deprecated __attribute__((deprecated)) #elif defined(_MSC_VER) # define attribute_deprecated __declspec(deprecated) @@ -127,7 +150,9 @@ #endif #endif -#if defined(__GNUC__) || defined(__clang__) +#if AV_HAS_STD_ATTRIBUTE(maybe_unused) +# define av_unused [[maybe_unused]] +#elif defined(__GNUC__) || defined(__clang__) # define av_unused __attribute__((unused)) #else # define av_unused @@ -158,13 +183,42 @@ #if defined(__GNUC__) || defined(__clang__) # define av_builtin_constant_p __builtin_constant_p -# define av_printf_format(fmtpos, attrpos) __attribute__((__format__(__printf__, fmtpos, attrpos))) #else # define av_builtin_constant_p(x) 0 +#endif + +// for __MINGW_PRINTF_FORMAT and __MINGW_SCANF_FORMAT +#ifdef __MINGW32__ +# include +#endif + +#ifdef __MINGW_PRINTF_FORMAT +# define AV_PRINTF_FMT __MINGW_PRINTF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_PRINTF_FMT __printf__ +#endif + +#ifdef __MINGW_SCANF_FORMAT +# define AV_SCANF_FMT __MINGW_SCANF_FORMAT +#elif AV_HAS_ATTRIBUTE(format) +# define AV_SCANF_FMT __scanf__ +#endif + +#ifdef AV_PRINTF_FMT +# define av_printf_format(fmtpos, attrpos) __attribute__((format(AV_PRINTF_FMT, fmtpos, attrpos))) +#else # define av_printf_format(fmtpos, attrpos) #endif -#if AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) +#ifdef AV_SCANF_FMT +# define av_scanf_format(fmtpos, attrpos) __attribute__((format(AV_SCANF_FMT, fmtpos, attrpos))) +#else +# define av_scanf_format(fmtpos, attrpos) +#endif + +#if AV_HAS_STD_ATTRIBUTE(noreturn) +# define av_noreturn [[noreturn]] +#elif AV_GCC_VERSION_AT_LEAST(2,5) || defined(__clang__) # define av_noreturn __attribute__((noreturn)) #else # define av_noreturn diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/attributes_internal.h thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/attributes_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/attributes_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -31,4 +31,15 @@ # define FF_VISIBILITY_POP_HIDDEN #endif +#define EXTERN extern attribute_visibility_hidden + +#if (AV_HAS_ATTRIBUTE(nonstring) && (AV_GCC_VERSION_AT_LEAST(15,1) || defined(__clang__))) +// Attribute to mark a variable initialized via a string literal as not +// containing string data to suppress warnings about unterminated strings +// in situations like char fourcc[4] = "TALB". +#define attribute_nonstring __attribute__((nonstring)) +#else +#define attribute_nonstring +#endif + #endif /* AVUTIL_ATTRIBUTES_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avassert.h thunderbird-140.10.1esr/media/ffvpx/libavutil/avassert.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avassert.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avassert.h 2026-04-29 18:38:25.000000000 +0000 @@ -31,8 +31,10 @@ #ifdef HAVE_AV_CONFIG_H # include "config.h" #endif +#include "attributes.h" #include "log.h" #include "macros.h" +#include "version.h" /** * assert() equivalent, that is always enabled. @@ -62,17 +64,62 @@ */ #if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 #define av_assert2(cond) av_assert0(cond) -#define av_assert2_fpu() av_assert0_fpu() #else #define av_assert2(cond) ((void)0) -#define av_assert2_fpu() ((void)0) #endif +#if FF_API_ASSERT_FPU +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL > 1 +#define av_assert2_fpu() av_assert0_fpu() +#else +#define av_assert2_fpu() ((void)0) +#endif /** * Assert that floating point operations can be executed. * * This will av_assert0() that the cpu is not in MMX state on X86 + * @deprecated without replacement */ +attribute_deprecated void av_assert0_fpu(void); +#endif + +/** + * Asserts that are used as compiler optimization hints depending + * upon ASSERT_LEVEL and NBDEBUG. + * + * Undefined behaviour occurs if execution reaches a point marked + * with av_unreachable() or if a condition used with av_assume() + * is false. + * + * The condition used with av_assume() should not have side-effects + * and should be visible to the compiler. + */ +#if defined(ASSERT_LEVEL) ? ASSERT_LEVEL > 0 : !defined(HAVE_AV_CONFIG_H) && !defined(NDEBUG) +#define av_unreachable(msg) \ +do { \ + av_log(NULL, AV_LOG_PANIC, \ + "Reached supposedly unreachable code at %s:%d: %s\n", \ + __FILE__, __LINE__, msg); \ + abort(); \ +} while (0) +#define av_assume(cond) av_assert0(cond) +#else +#if AV_GCC_VERSION_AT_LEAST(4, 5) || AV_HAS_BUILTIN(__builtin_unreachable) +#define av_unreachable(msg) __builtin_unreachable() +#elif defined(_MSC_VER) +#define av_unreachable(msg) __assume(0) +#elif __STDC_VERSION__ >= 202311L +#include +#define av_unreachable(msg) unreachable() +#else +#define av_unreachable(msg) ((void)0) +#endif + +#define av_assume(cond) do { \ + if (!(cond)) \ + av_unreachable(); \ +} while (0) +#endif #endif /* AVUTIL_AVASSERT_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avconfig.h thunderbird-140.10.1esr/media/ffvpx/libavutil/avconfig.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avconfig.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avconfig.h 2026-04-29 18:38:25.000000000 +0000 @@ -2,5 +2,5 @@ #ifndef AVUTIL_AVCONFIG_H #define AVUTIL_AVCONFIG_H #define AV_HAVE_BIGENDIAN 0 -#define AV_HAVE_FAST_UNALIGNED 1 +#define AV_HAVE_FAST_UNALIGNED 0 #endif /* AVUTIL_AVCONFIG_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avstring.c thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avstring.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.c 2026-04-29 18:38:25.000000000 +0000 @@ -142,7 +142,7 @@ char *av_get_token(const char **buf, const char *term) { - char *out = av_malloc(strlen(*buf) + 1); + char *out = av_realloc(NULL, strlen(*buf) + 1); char *ret = out, *end = out; const char *p = *buf; if (!out) @@ -172,7 +172,8 @@ *buf = p; - return ret; + char *small_ret = av_realloc(ret, out - ret + 2); + return small_ret ? small_ret : ret; } char *av_strtok(char *s, const char *delim, char **saveptr) @@ -452,10 +453,12 @@ if (k && (!p[k] || p[k] == separator)) return 1; q = strchr(q, separator); - q += !!q; + if(q) + q++; } p = strchr(p, separator); - p += !!p; + if (p) + p++; } return 0; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avstring.h thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avstring.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avstring.h 2026-04-29 18:38:25.000000000 +0000 @@ -419,7 +419,7 @@ * See libc sscanf manual for more information. * Locale-independent sscanf implementation. */ -int av_sscanf(const char *string, const char *format, ...); +int av_sscanf(const char *string, const char *format, ...) av_scanf_format(2, 3); /** * @} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avutil.h thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avutil.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.h 2026-04-29 18:38:26.000000000 +0000 @@ -41,7 +41,6 @@ * @li @ref lavd "libavdevice" special devices muxing/demuxing library * @li @ref lavu "libavutil" common utility library * @li @ref lswr "libswresample" audio resampling, format conversion and mixing - * @li @ref lpp "libpostproc" post processing library * @li @ref libsws "libswscale" color conversion and scaling library * * @section ffmpeg_versioning Versioning and compatibility diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/avutil.symbols thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.symbols --- thunderbird-140.10.0esr/media/ffvpx/libavutil/avutil.symbols 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/avutil.symbols 2026-04-29 18:38:26.000000000 +0000 @@ -1,5 +1,6 @@ av_add_q av_add_stable +av_alpha_mode_name av_append_path_component av_asprintf av_basename @@ -72,8 +73,9 @@ av_dirname av_div_q #ifndef MOZ_FFVPX_AUDIOONLY -av_dynamic_hdr_plus_from_t35 av_dynamic_hdr_plus_create_side_data +av_dynamic_hdr_plus_from_t35 +av_dynamic_hdr_plus_to_t35 #endif av_dynarray2_add av_dynarray_add @@ -109,6 +111,7 @@ av_frame_copy_props av_frame_side_data_free av_frame_side_data_get_c +av_frame_side_data_new av_frame_free av_frame_get_buffer av_frame_get_plane_buffer @@ -308,7 +311,6 @@ avpriv_float_dsp_alloc avpriv_report_missing_feature avpriv_request_sample -avpriv_scalarproduct_float_c avpriv_set_systematic_pal2 #if defined(XP_WIN) && !defined(_ARM64_) avpriv_emms_asm diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/bprint.c thunderbird-140.10.1esr/media/ffvpx/libavutil/bprint.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/bprint.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/bprint.c 2026-04-29 18:38:26.000000000 +0000 @@ -96,17 +96,17 @@ *buf->str = 0; } -void av_bprintf(AVBPrint *buf, const char *fmt, ...) +void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg) { unsigned room; char *dst; - va_list vl; int extra_len; + va_list vl; while (1) { room = av_bprint_room(buf); dst = room ? buf->str + buf->len : NULL; - va_start(vl, fmt); + va_copy(vl, vl_arg); extra_len = vsnprintf(dst, room, fmt, vl); va_end(vl); if (extra_len <= 0) @@ -119,27 +119,12 @@ av_bprint_grow(buf, extra_len); } -void av_vbprintf(AVBPrint *buf, const char *fmt, va_list vl_arg) +void av_bprintf(AVBPrint *buf, const char *fmt, ...) { - unsigned room; - char *dst; - int extra_len; va_list vl; - - while (1) { - room = av_bprint_room(buf); - dst = room ? buf->str + buf->len : NULL; - va_copy(vl, vl_arg); - extra_len = vsnprintf(dst, room, fmt, vl); - va_end(vl); - if (extra_len <= 0) - return; - if (extra_len < room) - break; - if (av_bprint_alloc(buf, extra_len)) - break; - } - av_bprint_grow(buf, extra_len); + va_start(vl, fmt); + av_vbprintf(buf, fmt, vl); + va_end(vl); } void av_bprint_chars(AVBPrint *buf, char c, unsigned n) @@ -182,6 +167,7 @@ { unsigned room; size_t l; + size_t fmt_len = strlen(fmt); if (!*fmt) return; @@ -189,9 +175,18 @@ room = av_bprint_room(buf); if (room && (l = strftime(buf->str + buf->len, room, fmt, tm))) break; + + /* Due to the limitations of strftime() it is not possible to know if + * the output buffer is too small or the output is empty. + * However, a 256x output space requirement compared to the format + * string length is so unlikely we can safely assume empty output. This + * allows supporting possibly empty format strings like "%p". */ + if (room >> 8 > fmt_len) + break; + /* strftime does not tell us how much room it would need: let us retry with twice as much until the buffer is large enough */ - room = !room ? strlen(fmt) + 1 : + room = !room ? fmt_len + 1 : room <= INT_MAX / 2 ? room * 2 : INT_MAX; if (av_bprint_alloc(buf, room)) { /* impossible to grow, try to manage something useful anyway */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/bswap.h thunderbird-140.10.1esr/media/ffvpx/libavutil/bswap.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/bswap.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/bswap.h 2026-04-29 18:38:26.000000000 +0000 @@ -68,7 +68,7 @@ #ifndef av_bswap64 static inline uint64_t av_const av_bswap64(uint64_t x) { - return (uint64_t)av_bswap32(x) << 32 | av_bswap32(x >> 32); + return (uint64_t)av_bswap32((uint32_t)x) << 32 | av_bswap32((uint32_t)(x >> 32)); } #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/channel_layout.c thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/channel_layout.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.c 2026-04-29 18:38:25.000000000 +0000 @@ -271,7 +271,7 @@ while (*str) { char *channel, *chname; - int ret = av_opt_get_key_value(&str, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname); + ret = av_opt_get_key_value(&str, "@", "+", AV_OPT_FLAG_IMPLICIT_KEY, &channel, &chname); if (ret < 0) { av_freep(&map); return ret; @@ -345,7 +345,7 @@ channel_layout->nb_channels = (order + 1) * (order + 1); if (*endptr) { - int ret = av_channel_layout_from_string(&extra, endptr + 1); + ret = av_channel_layout_from_string(&extra, endptr + 1); if (ret < 0) return ret; if (extra.nb_channels >= INT_MAX - channel_layout->nb_channels) { @@ -953,10 +953,10 @@ if (channel_layout->order == AV_CHANNEL_ORDER_CUSTOM) { int64_t mask; int nb_channels = channel_layout->nb_channels; - int order = av_channel_layout_ambisonic_order(channel_layout); - if (order < 0) + int amb_order = av_channel_layout_ambisonic_order(channel_layout); + if (amb_order < 0) return AVERROR(ENOSYS); - mask = masked_description(channel_layout, (order + 1) * (order + 1)); + mask = masked_description(channel_layout, (amb_order + 1) * (amb_order + 1)); if (mask < 0) return AVERROR(ENOSYS); lossy = has_channel_names(channel_layout); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/channel_layout.h thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/channel_layout.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/channel_layout.h 2026-04-29 18:38:25.000000000 +0000 @@ -45,7 +45,7 @@ */ enum AVChannel { - ///< Invalid channel index + /// Invalid channel index AV_CHAN_NONE = -1, AV_CHAN_FRONT_LEFT, AV_CHAN_FRONT_RIGHT, @@ -307,7 +307,7 @@ * - with a constructor function, such as av_channel_layout_default(), * av_channel_layout_from_mask() or av_channel_layout_from_string(). * - * The channel layout must be unitialized with av_channel_layout_uninit() + * The channel layout must be uninitialized with av_channel_layout_uninit() * * Copying an AVChannelLayout via assigning is forbidden, * av_channel_layout_copy() must be used instead (and its return value should @@ -365,7 +365,7 @@ * * map[i].name may be filled with a 0-terminated string, in which case * it will be used for the purpose of identifying the channel with the - * convenience functions below. Otherise it must be zeroed. + * convenience functions below. Otherwise it must be zeroed. */ AVChannelCustom *map; } u; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/common.h thunderbird-140.10.1esr/media/ffvpx/libavutil/common.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/common.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/common.h 2026-04-29 18:38:25.000000000 +0000 @@ -486,13 +486,13 @@ * to prevent undefined results. */ #define GET_UTF8(val, GET_BYTE, ERROR)\ - val= (GET_BYTE);\ + val= (uint8_t)(GET_BYTE);\ {\ uint32_t top = (val & 128) >> 1;\ if ((val & 0xc0) == 0x80 || val >= 0xFE)\ {ERROR}\ while (val & top) {\ - unsigned int tmp = (GET_BYTE) - 128;\ + unsigned int tmp = (uint8_t)(GET_BYTE) - 128;\ if(tmp>>6)\ {ERROR}\ val= (val<<6) + tmp;\ @@ -511,11 +511,11 @@ * typically a goto statement. */ #define GET_UTF16(val, GET_16BIT, ERROR)\ - val = (GET_16BIT);\ + val = (uint16_t)(GET_16BIT);\ {\ unsigned int hi = val - 0xD800;\ if (hi < 0x800) {\ - val = (GET_16BIT) - 0xDC00;\ + val = (uint16_t)(GET_16BIT) - 0xDC00;\ if (val > 0x3FFU || hi > 0x3FFU)\ {ERROR}\ val += (hi<<10) + 0x10000;\ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/cpu.c thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/cpu.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.c 2026-04-29 18:38:26.000000000 +0000 @@ -149,6 +149,7 @@ { "3dnowext", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_3DNOWEXT }, .unit = "flags" }, { "cmov", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CMOV }, .unit = "flags" }, { "aesni", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AESNI }, .unit = "flags" }, + { "clmul", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_CLMUL }, .unit = "flags" }, { "avx512" , NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX512 }, .unit = "flags" }, { "avx512icl", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_AVX512ICL }, .unit = "flags" }, { "slowgather", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SLOW_GATHER }, .unit = "flags" }, @@ -186,6 +187,12 @@ { "i8mm", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_I8MM }, .unit = "flags" }, { "sve", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SVE }, .unit = "flags" }, { "sve2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SVE2 }, .unit = "flags" }, + { "sme", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME }, .unit = "flags" }, + { "crc", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_ARM_CRC }, .unit = "flags" }, + { "sme_i16i64", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME_I16I64 }, .unit = "flags" }, + { "sme2", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_SME2 }, .unit = "flags" }, + { "pmull", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_PMULL }, .unit = "flags" }, + { "eor3", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_EOR3 }, .unit = "flags" }, #elif ARCH_MIPS { "mmi", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MMI }, .unit = "flags" }, { "msa", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AV_CPU_FLAG_MSA }, .unit = "flags" }, @@ -298,6 +305,7 @@ return 8; } +#if !ARCH_X86 unsigned long ff_getauxval(unsigned long type) { #if HAVE_GETAUXVAL @@ -314,3 +322,4 @@ return 0; #endif } +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/cpu.h thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/cpu.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/cpu.h 2026-04-29 18:38:26.000000000 +0000 @@ -24,7 +24,9 @@ #include #include "version.h" -#define AV_CPU_FLAG_FORCE 0x80000000 /* force usage of selected flags (OR) */ +#if FF_API_CPU_FLAG_FORCE +#define AV_CPU_FLAG_FORCE 0x80000000 /* @deprecated, should not be used */ +#endif /* lower 16 bits - CPU features */ #define AV_CPU_FLAG_MMX 0x0001 ///< standard MMX @@ -45,6 +47,7 @@ #define AV_CPU_FLAG_SSE4 0x0100 ///< Penryn SSE4.1 functions #define AV_CPU_FLAG_SSE42 0x0200 ///< Nehalem SSE4.2 functions #define AV_CPU_FLAG_AESNI 0x80000 ///< Advanced Encryption Standard functions +#define AV_CPU_FLAG_CLMUL 0x400000 ///< Carry-less Multiplication instruction #define AV_CPU_FLAG_AVX 0x4000 ///< AVX functions: requires OS support even if YMM registers aren't used #define AV_CPU_FLAG_AVXSLOW 0x8000000 ///< AVX supported, but slow when using YMM registers (e.g. Bulldozer) #define AV_CPU_FLAG_XOP 0x0400 ///< Bulldozer XOP functions @@ -74,7 +77,13 @@ #define AV_CPU_FLAG_I8MM (1 << 9) #define AV_CPU_FLAG_SVE (1 <<10) #define AV_CPU_FLAG_SVE2 (1 <<11) +#define AV_CPU_FLAG_SME (1 <<12) +#define AV_CPU_FLAG_ARM_CRC (1 <<13) +#define AV_CPU_FLAG_SME2 (1 <<14) +#define AV_CPU_FLAG_SME_I16I64 (1 <<15) #define AV_CPU_FLAG_SETEND (1 <<16) +#define AV_CPU_FLAG_PMULL (1 <<17) +#define AV_CPU_FLAG_EOR3 (1 <<18) #define AV_CPU_FLAG_MMI (1 << 0) #define AV_CPU_FLAG_MSA (1 << 1) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/csp.h thunderbird-140.10.1esr/media/ffvpx/libavutil/csp.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/csp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/csp.h 2026-04-29 18:38:26.000000000 +0000 @@ -114,7 +114,7 @@ * @see enum AVColorPrimaries * @param prm A description of the colorspace gamut * @return The enum constant associated with this gamut, or - * AVCOL_PRI_UNSPECIFIED if no clear match can be idenitified. + * AVCOL_PRI_UNSPECIFIED if no clear match can be identified. */ enum AVColorPrimaries av_csp_primaries_id_from_desc(const AVColorPrimariesDesc *prm); @@ -134,6 +134,22 @@ double av_csp_approximate_trc_gamma(enum AVColorTransferCharacteristic trc); /** + * Determine a suitable EOTF 'gamma' value to match the supplied + * AVColorTransferCharacteristic. + * + * This function returns the gamma value (exponent) for a simple pure power + * function approximation of the supplied AVColorTransferCharacteristic, or 0. + * if no reasonable approximation exists. + * + * EOTF(v) = (L_w - L_b) * v^gamma + L_b + * + * @return Will return an approximation to the simple gamma function matching + * the supplied Transfer Characteristic EOTF, Will return 0.0 for any + * we cannot reasonably match against. + */ +double av_csp_approximate_eotf_gamma(enum AVColorTransferCharacteristic trc); + +/** * Determine the function needed to apply the given * AVColorTransferCharacteristic to linear input. * diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/dict.c thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/dict.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.c 2026-04-29 18:38:26.000000000 +0000 @@ -25,10 +25,8 @@ #include "avassert.h" #include "avstring.h" #include "dict.h" -#include "dict_internal.h" #include "error.h" #include "mem.h" -#include "time_internal.h" #include "bprint.h" struct AVDictionary { @@ -101,16 +99,28 @@ err = AVERROR(EINVAL); goto err_out; } - if (!(flags & AV_DICT_MULTIKEY)) { - tag = av_dict_get(m, key, NULL, flags); - } if (flags & AV_DICT_DONT_STRDUP_KEY) copy_key = (void *)key; else copy_key = av_strdup(key); + if (!copy_key || (value && !copy_value)) + goto enomem; + + if (!(flags & AV_DICT_MULTIKEY)) { + tag = av_dict_get(m, key, NULL, flags); + } else if (flags & AV_DICT_DEDUP) { + while ((tag = av_dict_get(m, key, tag, flags))) { + if ((!value && !tag->value) || + (value && tag->value && !strcmp(value, tag->value))) { + av_free(copy_key); + av_free(copy_value); + return 0; + } + } + } if (!m) m = *pm = av_mallocz(sizeof(*m)); - if (!m || !copy_key || (value && !copy_value)) + if (!m) goto enomem; if (tag) { @@ -274,19 +284,3 @@ } return av_bprint_finalize(&bprint, buffer); } - -int avpriv_dict_set_timestamp(AVDictionary **dict, const char *key, int64_t timestamp) -{ - time_t seconds = timestamp / 1000000; - struct tm *ptm, tmbuf; - ptm = gmtime_r(&seconds, &tmbuf); - if (ptm) { - char buf[32]; - if (!strftime(buf, sizeof(buf), "%Y-%m-%dT%H:%M:%S", ptm)) - return AVERROR_EXTERNAL; - av_strlcatf(buf, sizeof(buf), ".%06dZ", (int)(timestamp % 1000000)); - return av_dict_set(dict, key, buf, 0); - } else { - return AVERROR_EXTERNAL; - } -} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/dict.h thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/dict.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/dict.h 2026-04-29 18:38:25.000000000 +0000 @@ -82,6 +82,7 @@ #define AV_DICT_APPEND 32 /**< If the entry already exists, append to it. Note that no delimiter is added, the strings are simply concatenated. */ #define AV_DICT_MULTIKEY 64 /**< Allow to store several equal keys in the dictionary */ +#define AV_DICT_DEDUP 128 /**< If inserting a value that already exists for a key, do nothing. Only relevant with AV_DICT_MULTIKEY. */ /** * @} */ @@ -224,7 +225,7 @@ * @warning Separators cannot be neither '\\' nor '\0'. They also cannot be the same. * * @param[in] m The dictionary - * @param[out] buffer Pointer to buffer that will be allocated with string containg entries. + * @param[out] buffer Pointer to buffer that will be allocated with string containing entries. * Buffer must be freed by the caller when is no longer needed. * @param[in] key_val_sep Character used to separate key from value * @param[in] pairs_sep Character used to separate two pairs from each other diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/emms.h thunderbird-140.10.1esr/media/ffvpx/libavutil/emms.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/emms.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/emms.h 2026-04-29 18:38:25.000000000 +0000 @@ -19,8 +19,12 @@ #ifndef AVUTIL_EMMS_H #define AVUTIL_EMMS_H +#include +#include + #include "config.h" #include "libavutil/attributes.h" +#include "libavutil/log.h" #if ARCH_X86 @@ -50,6 +54,28 @@ #endif __asm__ volatile ("emms" ::: "memory"); } + +static inline void ff_assert0_fpu(const char *file, int line_number) +{ + uint16_t state[14]; + __asm__ volatile ( + "fstenv %0 \n\t" + : "+m" (state) + : + : "memory" + ); + if ((state[4] & 3) != 3) { + emms_c(); + av_log(NULL, AV_LOG_PANIC, + "Invalid floating point state assertion " + "triggered at line %u in file %s\n", + line_number, file); + abort(); + } +} + +#define ff_assert0_fpu() ff_assert0_fpu(__FILE__, __LINE__) + #elif HAVE_MMX && HAVE_MM_EMPTY # include # define emms_c _mm_empty @@ -63,4 +89,14 @@ # define emms_c() do {} while(0) #endif +#ifndef ff_assert0_fpu +#define ff_assert0_fpu() ((void)0) +#endif + +#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 1 +#define ff_assert1_fpu() ff_assert0_fpu() +#else +#define ff_assert1_fpu() ((void)0) +#endif + #endif /* AVUTIL_EMMS_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/error.c thunderbird-140.10.1esr/media/ffvpx/libavutil/error.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/error.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/error.c 2026-04-29 18:38:25.000000000 +0000 @@ -25,109 +25,127 @@ #include "error.h" #include "macros.h" -struct error_entry { - int num; - const char *tag; - const char *str; +#define AVERROR_INPUT_AND_OUTPUT_CHANGED (AVERROR_INPUT_CHANGED | AVERROR_OUTPUT_CHANGED) + +#define AVERROR_LIST(E, E2) \ + E(BSF_NOT_FOUND, "Bitstream filter not found") \ + E(BUG, "Internal bug, should not have happened") \ + E2(BUG2, BUG, "Internal bug, should not have happened") \ + E(BUFFER_TOO_SMALL, "Buffer too small") \ + E(DECODER_NOT_FOUND, "Decoder not found") \ + E(DEMUXER_NOT_FOUND, "Demuxer not found") \ + E(ENCODER_NOT_FOUND, "Encoder not found") \ + E(EOF, "End of file") \ + E(EXIT, "Immediate exit requested") \ + E(EXTERNAL, "Generic error in an external library") \ + E(FILTER_NOT_FOUND, "Filter not found") \ + E(INPUT_CHANGED, "Input changed") \ + E(INVALIDDATA, "Invalid data found when processing input") \ + E(MUXER_NOT_FOUND, "Muxer not found") \ + E(OPTION_NOT_FOUND, "Option not found") \ + E(OUTPUT_CHANGED, "Output changed") \ + E(PATCHWELCOME, "Not yet implemented in FFmpeg, patches welcome") \ + E(PROTOCOL_NOT_FOUND, "Protocol not found") \ + E(STREAM_NOT_FOUND, "Stream not found") \ + E(UNKNOWN, "Unknown error occurred") \ + E(EXPERIMENTAL, "Experimental feature") \ + E(INPUT_AND_OUTPUT_CHANGED, "Input and output changed") \ + E(HTTP_BAD_REQUEST, "Server returned 400 Bad Request") \ + E(HTTP_UNAUTHORIZED, "Server returned 401 Unauthorized (authorization failed)") \ + E(HTTP_FORBIDDEN, "Server returned 403 Forbidden (access denied)") \ + E(HTTP_NOT_FOUND, "Server returned 404 Not Found") \ + E(HTTP_TOO_MANY_REQUESTS, "Server returned 429 Too Many Requests") \ + E(HTTP_OTHER_4XX, "Server returned 4XX Client Error, but not one of 40{0,1,3,4}") \ + E(HTTP_SERVER_ERROR, "Server returned 5XX Server Error reply") \ + +#define STRERROR_LIST(E) \ + E(E2BIG, "Argument list too long") \ + E(EACCES, "Permission denied") \ + E(EAGAIN, "Resource temporarily unavailable") \ + E(EBADF, "Bad file descriptor") \ + E(EBUSY, "Device or resource busy") \ + E(ECHILD, "No child processes") \ + E(EDEADLK, "Resource deadlock avoided") \ + E(EDOM, "Numerical argument out of domain") \ + E(EEXIST, "File exists") \ + E(EFAULT, "Bad address") \ + E(EFBIG, "File too large") \ + E(EILSEQ, "Illegal byte sequence") \ + E(EINTR, "Interrupted system call") \ + E(EINVAL, "Invalid argument") \ + E(EIO, "I/O error") \ + E(EISDIR, "Is a directory") \ + E(EMFILE, "Too many open files") \ + E(EMLINK, "Too many links") \ + E(ENAMETOOLONG, "File name too long") \ + E(ENFILE, "Too many open files in system") \ + E(ENODEV, "No such device") \ + E(ENOENT, "No such file or directory") \ + E(ENOEXEC, "Exec format error") \ + E(ENOLCK, "No locks available") \ + E(ENOMEM, "Cannot allocate memory") \ + E(ENOSPC, "No space left on device") \ + E(ENOSYS, "Function not implemented") \ + E(ENOTDIR, "Not a directory") \ + E(ENOTEMPTY, "Directory not empty") \ + E(ENOTTY, "Inappropriate I/O control operation") \ + E(ENXIO, "No such device or address") \ + E(EPERM, "Operation not permitted") \ + E(EPIPE, "Broken pipe") \ + E(ERANGE, "Result too large") \ + E(EROFS, "Read-only file system") \ + E(ESPIPE, "Illegal seek") \ + E(ESRCH, "No such process") \ + E(EXDEV, "Cross-device link") \ + +enum { +#define OFFSET(CODE, DESC) \ + ERROR_ ## CODE ## _OFFSET, \ + ERROR_ ## CODE ## _END_OFFSET = ERROR_ ## CODE ## _OFFSET + sizeof(DESC) - 1, +#define NOTHING(CODE, CODE2, DESC) + AVERROR_LIST(OFFSET, NOTHING) +#if !HAVE_STRERROR_R + STRERROR_LIST(OFFSET) +#endif }; -#define ERROR_TAG(tag) AVERROR_##tag, #tag -#define EERROR_TAG(tag) AVERROR(tag), #tag -#define AVERROR_INPUT_AND_OUTPUT_CHANGED (AVERROR_INPUT_CHANGED | AVERROR_OUTPUT_CHANGED) -static const struct error_entry error_entries[] = { - { ERROR_TAG(BSF_NOT_FOUND), "Bitstream filter not found" }, - { ERROR_TAG(BUG), "Internal bug, should not have happened" }, - { ERROR_TAG(BUG2), "Internal bug, should not have happened" }, - { ERROR_TAG(BUFFER_TOO_SMALL), "Buffer too small" }, - { ERROR_TAG(DECODER_NOT_FOUND), "Decoder not found" }, - { ERROR_TAG(DEMUXER_NOT_FOUND), "Demuxer not found" }, - { ERROR_TAG(ENCODER_NOT_FOUND), "Encoder not found" }, - { ERROR_TAG(EOF), "End of file" }, - { ERROR_TAG(EXIT), "Immediate exit requested" }, - { ERROR_TAG(EXTERNAL), "Generic error in an external library" }, - { ERROR_TAG(FILTER_NOT_FOUND), "Filter not found" }, - { ERROR_TAG(INPUT_CHANGED), "Input changed" }, - { ERROR_TAG(INVALIDDATA), "Invalid data found when processing input" }, - { ERROR_TAG(MUXER_NOT_FOUND), "Muxer not found" }, - { ERROR_TAG(OPTION_NOT_FOUND), "Option not found" }, - { ERROR_TAG(OUTPUT_CHANGED), "Output changed" }, - { ERROR_TAG(PATCHWELCOME), "Not yet implemented in FFmpeg, patches welcome" }, - { ERROR_TAG(PROTOCOL_NOT_FOUND), "Protocol not found" }, - { ERROR_TAG(STREAM_NOT_FOUND), "Stream not found" }, - { ERROR_TAG(UNKNOWN), "Unknown error occurred" }, - { ERROR_TAG(EXPERIMENTAL), "Experimental feature" }, - { ERROR_TAG(INPUT_AND_OUTPUT_CHANGED), "Input and output changed" }, - { ERROR_TAG(HTTP_BAD_REQUEST), "Server returned 400 Bad Request" }, - { ERROR_TAG(HTTP_UNAUTHORIZED), "Server returned 401 Unauthorized (authorization failed)" }, - { ERROR_TAG(HTTP_FORBIDDEN), "Server returned 403 Forbidden (access denied)" }, - { ERROR_TAG(HTTP_NOT_FOUND), "Server returned 404 Not Found" }, - { ERROR_TAG(HTTP_TOO_MANY_REQUESTS), "Server returned 429 Too Many Requests" }, - { ERROR_TAG(HTTP_OTHER_4XX), "Server returned 4XX Client Error, but not one of 40{0,1,3,4}" }, - { ERROR_TAG(HTTP_SERVER_ERROR), "Server returned 5XX Server Error reply" }, +#define STRING(CODE, DESC) DESC "\0" +static const char error_stringtable[] = + AVERROR_LIST(STRING, NOTHING) #if !HAVE_STRERROR_R - { EERROR_TAG(E2BIG), "Argument list too long" }, - { EERROR_TAG(EACCES), "Permission denied" }, - { EERROR_TAG(EAGAIN), "Resource temporarily unavailable" }, - { EERROR_TAG(EBADF), "Bad file descriptor" }, - { EERROR_TAG(EBUSY), "Device or resource busy" }, - { EERROR_TAG(ECHILD), "No child processes" }, - { EERROR_TAG(EDEADLK), "Resource deadlock avoided" }, - { EERROR_TAG(EDOM), "Numerical argument out of domain" }, - { EERROR_TAG(EEXIST), "File exists" }, - { EERROR_TAG(EFAULT), "Bad address" }, - { EERROR_TAG(EFBIG), "File too large" }, - { EERROR_TAG(EILSEQ), "Illegal byte sequence" }, - { EERROR_TAG(EINTR), "Interrupted system call" }, - { EERROR_TAG(EINVAL), "Invalid argument" }, - { EERROR_TAG(EIO), "I/O error" }, - { EERROR_TAG(EISDIR), "Is a directory" }, - { EERROR_TAG(EMFILE), "Too many open files" }, - { EERROR_TAG(EMLINK), "Too many links" }, - { EERROR_TAG(ENAMETOOLONG), "File name too long" }, - { EERROR_TAG(ENFILE), "Too many open files in system" }, - { EERROR_TAG(ENODEV), "No such device" }, - { EERROR_TAG(ENOENT), "No such file or directory" }, - { EERROR_TAG(ENOEXEC), "Exec format error" }, - { EERROR_TAG(ENOLCK), "No locks available" }, - { EERROR_TAG(ENOMEM), "Cannot allocate memory" }, - { EERROR_TAG(ENOSPC), "No space left on device" }, - { EERROR_TAG(ENOSYS), "Function not implemented" }, - { EERROR_TAG(ENOTDIR), "Not a directory" }, - { EERROR_TAG(ENOTEMPTY), "Directory not empty" }, - { EERROR_TAG(ENOTTY), "Inappropriate I/O control operation" }, - { EERROR_TAG(ENXIO), "No such device or address" }, - { EERROR_TAG(EPERM), "Operation not permitted" }, - { EERROR_TAG(EPIPE), "Broken pipe" }, - { EERROR_TAG(ERANGE), "Result too large" }, - { EERROR_TAG(EROFS), "Read-only file system" }, - { EERROR_TAG(ESPIPE), "Illegal seek" }, - { EERROR_TAG(ESRCH), "No such process" }, - { EERROR_TAG(EXDEV), "Cross-device link" }, + STRERROR_LIST(STRING) +#endif +; + +static const struct ErrorEntry { + int num; + unsigned offset; +} error_entries[] = { +#define ENTRY(CODE, DESC) { .num = AVERROR_ ## CODE, .offset = ERROR_ ## CODE ## _OFFSET }, +#define ENTRY2(CODE, CODE2, DESC) { .num = AVERROR_ ## CODE, .offset = ERROR_ ## CODE2 ## _OFFSET }, + AVERROR_LIST(ENTRY, ENTRY2) +#if !HAVE_STRERROR_R +#undef ENTRY +#define ENTRY(CODE, DESC) { .num = AVERROR(CODE), .offset = ERROR_ ## CODE ## _OFFSET }, + STRERROR_LIST(ENTRY) #endif }; int av_strerror(int errnum, char *errbuf, size_t errbuf_size) { - int ret = 0, i; - const struct error_entry *entry = NULL; - - for (i = 0; i < FF_ARRAY_ELEMS(error_entries); i++) { + for (size_t i = 0; i < FF_ARRAY_ELEMS(error_entries); ++i) { if (errnum == error_entries[i].num) { - entry = &error_entries[i]; - break; + av_strlcpy(errbuf, error_stringtable + error_entries[i].offset, errbuf_size); + return 0; } } - if (entry) { - av_strlcpy(errbuf, entry->str, errbuf_size); - } else { #if HAVE_STRERROR_R - ret = AVERROR(strerror_r(AVUNERROR(errnum), errbuf, errbuf_size)); + int ret = AVERROR(strerror_r(AVUNERROR((unsigned)errnum), errbuf, errbuf_size)); #else - ret = -1; + int ret = -1; #endif - if (ret < 0) - snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum); - } + if (ret < 0) + snprintf(errbuf, errbuf_size, "Error number %d occurred", errnum); return ret; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/eval.c thunderbird-140.10.1esr/media/ffvpx/libavutil/eval.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/eval.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/eval.c 2026-04-29 18:38:25.000000000 +0000 @@ -28,6 +28,7 @@ #include #include "attributes.h" +#include "avassert.h" #include "avutil.h" #include "common.h" #include "eval.h" @@ -40,6 +41,8 @@ #include "avstring.h" #include "reverse.h" +#define MAX_DEPTH 100 + typedef struct Parser { const AVClass *class; int stack_index; @@ -155,28 +158,35 @@ return !IS_IDENTIFIER_CHAR(s[i]); } +enum { + e_value, e_const, e_func0, e_func1, e_func2, + e_squish, e_gauss, e_ld, e_isnan, e_isinf, + e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_lte, e_lt, + e_pow, e_mul, e_div, e_add, + e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc, e_round, + e_sqrt, e_not, e_random, e_hypot, e_gcd, + e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between, e_clip, e_atan2, e_lerp, + e_sgn, e_randomi +}; struct AVExpr { - enum { - e_value, e_const, e_func0, e_func1, e_func2, - e_squish, e_gauss, e_ld, e_isnan, e_isinf, - e_mod, e_max, e_min, e_eq, e_gt, e_gte, e_lte, e_lt, - e_pow, e_mul, e_div, e_add, - e_last, e_st, e_while, e_taylor, e_root, e_floor, e_ceil, e_trunc, e_round, - e_sqrt, e_not, e_random, e_hypot, e_gcd, - e_if, e_ifnot, e_print, e_bitand, e_bitor, e_between, e_clip, e_atan2, e_lerp, - e_sgn, e_randomi - } type; - double value; // is sign in other types + unsigned char type; + unsigned char root; + short depth; int const_index; + double value; // is sign in other types union { double (*func0)(double); double (*func1)(void *, double); double (*func2)(void *, double, double); - } a; + } ; struct AVExpr *param[3]; +}; + +typedef struct { + AVExpr avexpr; double *var; FFSFC64 *prng_state; -}; +} AVExprRoot; static double etime(double v) { @@ -188,9 +198,9 @@ switch (e->type) { case e_value: return e->value; case e_const: return e->value * p->const_values[e->const_index]; - case e_func0: return e->value * e->a.func0(eval_expr(p, e->param[0])); - case e_func1: return e->value * e->a.func1(p->opaque, eval_expr(p, e->param[0])); - case e_func2: return e->value * e->a.func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); + case e_func0: return e->value * e->func0(eval_expr(p, e->param[0])); + case e_func1: return e->value * e->func1(p->opaque, eval_expr(p, e->param[0])); + case e_func2: return e->value * e->func2(p->opaque, eval_expr(p, e->param[0]), eval_expr(p, e->param[1])); case e_squish: return 1/(1+exp(4*eval_expr(p, e->param[0]))); case e_gauss: { double d = eval_expr(p, e->param[0]); return exp(-d*d/2)/sqrt(2*M_PI); } case e_ld: return e->value * p->var[av_clip(eval_expr(p, e->param[0]), 0, VARS-1)]; @@ -361,8 +371,11 @@ av_expr_free(e->param[0]); av_expr_free(e->param[1]); av_expr_free(e->param[2]); - av_freep(&e->var); - av_freep(&e->prng_state); + if (e->root) { + AVExprRoot *r = (AVExprRoot*)e; + av_freep(&r->var); + av_freep(&r->prng_state); + } av_freep(&e); } @@ -445,20 +458,28 @@ } p->s++; // ")" + for (int i = 0; i<3; i++) + if (d->param[i]) + d->depth = FFMAX(d->depth, d->param[i]->depth+1); + if (d->depth > MAX_DEPTH) { + av_expr_free(d); + return AVERROR(EINVAL); + } + d->type = e_func0; - if (strmatch(next, "sinh" )) d->a.func0 = sinh; - else if (strmatch(next, "cosh" )) d->a.func0 = cosh; - else if (strmatch(next, "tanh" )) d->a.func0 = tanh; - else if (strmatch(next, "sin" )) d->a.func0 = sin; - else if (strmatch(next, "cos" )) d->a.func0 = cos; - else if (strmatch(next, "tan" )) d->a.func0 = tan; - else if (strmatch(next, "atan" )) d->a.func0 = atan; - else if (strmatch(next, "asin" )) d->a.func0 = asin; - else if (strmatch(next, "acos" )) d->a.func0 = acos; - else if (strmatch(next, "exp" )) d->a.func0 = exp; - else if (strmatch(next, "log" )) d->a.func0 = log; - else if (strmatch(next, "abs" )) d->a.func0 = fabs; - else if (strmatch(next, "time" )) d->a.func0 = etime; + if (strmatch(next, "sinh" )) d->func0 = sinh; + else if (strmatch(next, "cosh" )) d->func0 = cosh; + else if (strmatch(next, "tanh" )) d->func0 = tanh; + else if (strmatch(next, "sin" )) d->func0 = sin; + else if (strmatch(next, "cos" )) d->func0 = cos; + else if (strmatch(next, "tan" )) d->func0 = tan; + else if (strmatch(next, "atan" )) d->func0 = atan; + else if (strmatch(next, "asin" )) d->func0 = asin; + else if (strmatch(next, "acos" )) d->func0 = acos; + else if (strmatch(next, "exp" )) d->func0 = exp; + else if (strmatch(next, "log" )) d->func0 = log; + else if (strmatch(next, "abs" )) d->func0 = fabs; + else if (strmatch(next, "time" )) d->func0 = etime; else if (strmatch(next, "squish")) d->type = e_squish; else if (strmatch(next, "gauss" )) d->type = e_gauss; else if (strmatch(next, "mod" )) d->type = e_mod; @@ -500,7 +521,7 @@ else { for (i=0; p->func1_names && p->func1_names[i]; i++) { if (strmatch(next, p->func1_names[i])) { - d->a.func1 = p->funcs1[i]; + d->func1 = p->funcs1[i]; d->type = e_func1; d->const_index = i; *e = d; @@ -510,7 +531,7 @@ for (i=0; p->func2_names && p->func2_names[i]; i++) { if (strmatch(next, p->func2_names[i])) { - d->a.func2 = p->funcs2[i]; + d->func2 = p->funcs2[i]; d->type = e_func2; d->const_index = i; *e = d; @@ -529,6 +550,9 @@ static AVExpr *make_eval_expr(int type, int value, AVExpr *p0, AVExpr *p1) { + int depth = FFMAX(p0->depth, p1->depth) + 1; + if (depth > MAX_DEPTH) + return NULL; AVExpr *e = av_mallocz(sizeof(AVExpr)); if (!e) return NULL; @@ -536,6 +560,7 @@ e->value =value ; e->param[0] =p0 ; e->param[1] =p1 ; + e->depth = depth; return e; } @@ -552,7 +577,7 @@ for example, -3dB is not the same as -(3dB) */ if (*p->s == '-') { char *next; - double av_unused ignored = strtod(p->s, &next); + av_unused double ignored = strtod(p->s, &next); if (next != p->s && next[0] == 'd' && next[1] == 'B') { *sign = 0; return parse_primary(e, p); @@ -749,9 +774,16 @@ ret = AVERROR(EINVAL); goto end; } - e->var= av_mallocz(sizeof(double) *VARS); - e->prng_state = av_mallocz(sizeof(*e->prng_state) *VARS); - if (!e->var || !e->prng_state) { + AVExprRoot *r = av_realloc(e, sizeof(*r)); + if (!r) { + ret = AVERROR(ENOMEM); + goto end; + } + e = (AVExpr*)r; + e->root = 1; + r->var= av_mallocz(sizeof(double) *VARS); + r->prng_state = av_mallocz(sizeof(*r->prng_state) *VARS); + if (!r->var || !r->prng_state) { ret = AVERROR(ENOMEM); goto end; } @@ -791,12 +823,16 @@ double av_expr_eval(AVExpr *e, const double *const_values, void *opaque) { - Parser p = { 0 }; - p.var= e->var; - p.prng_state= e->prng_state; + av_assert1(e->root); + AVExprRoot *r = (AVExprRoot *)e; + Parser p = { + .class = &eval_class, + .const_values = const_values, + .opaque = opaque, + .var = r->var, + .prng_state = r->prng_state, + }; - p.const_values = const_values; - p.opaque = opaque; return eval_expr(&p, e); } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/film_grain_params.h thunderbird-140.10.1esr/media/ffvpx/libavutil/film_grain_params.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/film_grain_params.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/film_grain_params.h 2026-04-29 18:38:26.000000000 +0000 @@ -124,7 +124,7 @@ /** * This structure describes how to handle film grain synthesis for codecs using - * the ITU-T H.274 Versatile suplemental enhancement information message. + * the ITU-T H.274 Versatile supplemental enhancement information message. * * @note The struct must be allocated as part of AVFilmGrainParams using * av_film_grain_params_alloc(). Its size is not a part of the public ABI. @@ -136,43 +136,6 @@ */ int model_id; -#if FF_API_H274_FILM_GRAIN_VCS - /** - * TODO: On this ABI bump, please also re-order the fields in - * AVFilmGrainParams (see below) - */ - - /** - * Specifies the bit depth used for the luma component. - * - * @deprecated use AVFilmGrainParams.bit_depth_luma. - */ - attribute_deprecated - int bit_depth_luma; - - /** - * Specifies the bit depth used for the chroma components. - * - * @deprecated use AVFilmGrainParams.bit_depth_chroma. - */ - attribute_deprecated - int bit_depth_chroma; - - /** - * Specifies the video signal characteristics. - * - * @deprecated use AVFilmGrainParams.color_{range,primaries,trc,space}. - */ - attribute_deprecated - enum AVColorRange color_range; - attribute_deprecated - enum AVColorPrimaries color_primaries; - attribute_deprecated - enum AVColorTransferCharacteristic color_trc; - attribute_deprecated - enum AVColorSpace color_space; -#endif - /** * Specifies the blending mode used to blend the simulated film grain * with the decoded images. @@ -250,18 +213,6 @@ uint64_t seed; /** - * Additional fields may be added both here and in any structure included. - * If a codec's film grain structure differs slightly over another - * codec's, fields within may change meaning depending on the type. - * - * TODO: Move this to the end of the structure, at the next ABI bump. - */ - union { - AVFilmGrainAOMParams aom; - AVFilmGrainH274Params h274; - } codec; - - /** * Intended display resolution. May be 0 if the codec does not specify * any restrictions. */ @@ -287,6 +238,15 @@ int bit_depth_luma; int bit_depth_chroma; + /** + * Additional fields may be added both here and in any structure included. + * If a codec's film grain structure differs slightly over another + * codec's, fields within may change meaning depending on the type. + */ + union { + AVFilmGrainAOMParams aom; + AVFilmGrainH274Params h274; + } codec; } AVFilmGrainParams; /** diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/fixed_dsp.c thunderbird-140.10.1esr/media/ffvpx/libavutil/fixed_dsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/fixed_dsp.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/fixed_dsp.c 2026-04-29 18:38:26.000000000 +0000 @@ -165,7 +165,7 @@ #if ARCH_RISCV ff_fixed_dsp_init_riscv(fdsp); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_fixed_dsp_init_x86(fdsp); #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/float_dsp.c thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/float_dsp.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.c 2026-04-29 18:38:25.000000000 +0000 @@ -121,17 +121,6 @@ } } -float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len) -{ - float p = 0.0; - int i; - - for (i = 0; i < len; i++) - p += v1[i] * v2[i]; - - return p; -} - double ff_scalarproduct_double_c(const double *v1, const double *v2, size_t len) { @@ -159,7 +148,7 @@ fdsp->vector_fmul_add = vector_fmul_add_c; fdsp->vector_fmul_reverse = vector_fmul_reverse_c; fdsp->butterflies_float = butterflies_float_c; - fdsp->scalarproduct_float = avpriv_scalarproduct_float_c; + fdsp->scalarproduct_float = ff_scalarproduct_float_c; fdsp->scalarproduct_double = ff_scalarproduct_double_c; #if ARCH_AARCH64 @@ -170,7 +159,7 @@ ff_float_dsp_init_ppc(fdsp, bit_exact); #elif ARCH_RISCV ff_float_dsp_init_riscv(fdsp); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_float_dsp_init_x86(fdsp); #elif ARCH_MIPS ff_float_dsp_init_mips(fdsp); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/float_dsp.h thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/float_dsp.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/float_dsp.h 2026-04-29 18:38:25.000000000 +0000 @@ -215,7 +215,7 @@ * * @return sum of elementwise products */ -float avpriv_scalarproduct_float_c(const float *v1, const float *v2, int len); +float ff_scalarproduct_float_c(const float *v1, const float *v2, int len); /** * Return the scalar product of two vectors of doubles. diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/float_scalarproduct.c thunderbird-140.10.1esr/media/ffvpx/libavutil/float_scalarproduct.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/float_scalarproduct.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/float_scalarproduct.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * Copyright 2005 Balatoni Denes + * Copyright 2006 Loren Merritt + * + * 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 "float_dsp.h" + +float ff_scalarproduct_float_c(const float *v1, const float *v2, int len) +{ + float p = 0.0; + + for (int i = 0; i < len; i++) + p += v1[i] * v2[i]; + + return p; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/frame.c thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/frame.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.c 2026-04-29 18:38:25.000000000 +0000 @@ -19,48 +19,15 @@ #include "channel_layout.h" #include "avassert.h" #include "buffer.h" -#include "common.h" -#include "cpu.h" #include "dict.h" #include "frame.h" #include "imgutils.h" #include "mem.h" +#include "refstruct.h" #include "samplefmt.h" +#include "side_data.h" #include "hwcontext.h" -static const AVSideDataDescriptor sd_props[] = { - [AV_FRAME_DATA_PANSCAN] = { "AVPanScan", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_A53_CC] = { "ATSC A53 Part 4 Closed Captions" }, - [AV_FRAME_DATA_MATRIXENCODING] = { "AVMatrixEncoding" }, - [AV_FRAME_DATA_DOWNMIX_INFO] = { "Metadata relevant to a downmix procedure" }, - [AV_FRAME_DATA_AFD] = { "Active format description" }, - [AV_FRAME_DATA_MOTION_VECTORS] = { "Motion vectors", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_SKIP_SAMPLES] = { "Skip samples" }, - [AV_FRAME_DATA_GOP_TIMECODE] = { "GOP timecode" }, - [AV_FRAME_DATA_S12M_TIMECODE] = { "SMPTE 12-1 timecode" }, - [AV_FRAME_DATA_DYNAMIC_HDR_PLUS] = { "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_DYNAMIC_HDR_VIVID] = { "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_REGIONS_OF_INTEREST] = { "Regions Of Interest", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_VIDEO_ENC_PARAMS] = { "Video encoding parameters" }, - [AV_FRAME_DATA_FILM_GRAIN_PARAMS] = { "Film grain parameters" }, - [AV_FRAME_DATA_DETECTION_BBOXES] = { "Bounding boxes for object detection and classification", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_DOVI_RPU_BUFFER] = { "Dolby Vision RPU Data", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_DOVI_METADATA] = { "Dolby Vision Metadata", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_LCEVC] = { "LCEVC NAL data", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_VIEW_ID] = { "View ID" }, - [AV_FRAME_DATA_STEREO3D] = { "Stereo 3D", AV_SIDE_DATA_PROP_GLOBAL }, - [AV_FRAME_DATA_REPLAYGAIN] = { "AVReplayGain", AV_SIDE_DATA_PROP_GLOBAL }, - [AV_FRAME_DATA_DISPLAYMATRIX] = { "3x3 displaymatrix", AV_SIDE_DATA_PROP_GLOBAL }, - [AV_FRAME_DATA_AUDIO_SERVICE_TYPE] = { "Audio service type", AV_SIDE_DATA_PROP_GLOBAL }, - [AV_FRAME_DATA_MASTERING_DISPLAY_METADATA] = { "Mastering display metadata", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_CONTENT_LIGHT_LEVEL] = { "Content light level metadata", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT] = { "Ambient viewing environment", AV_SIDE_DATA_PROP_GLOBAL }, - [AV_FRAME_DATA_SPHERICAL] = { "Spherical Mapping", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, - [AV_FRAME_DATA_ICC_PROFILE] = { "ICC profile", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, - [AV_FRAME_DATA_SEI_UNREGISTERED] = { "H.26[45] User Data Unregistered SEI message", AV_SIDE_DATA_PROP_MULTI }, - [AV_FRAME_DATA_VIDEO_HINT] = { "Encoding video hint", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, -}; - static void get_frame_defaults(AVFrame *frame) { memset(frame, 0, sizeof(*frame)); @@ -69,12 +36,6 @@ frame->pkt_dts = AV_NOPTS_VALUE; frame->best_effort_timestamp = AV_NOPTS_VALUE; frame->duration = 0; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - frame->pkt_pos = -1; - frame->pkt_size = -1; -FF_ENABLE_DEPRECATION_WARNINGS -#endif frame->time_base = (AVRational){ 0, 1 }; frame->sample_aspect_ratio = (AVRational){ 0, 1 }; frame->format = -1; /* unknown */ @@ -84,70 +45,10 @@ frame->colorspace = AVCOL_SPC_UNSPECIFIED; frame->color_range = AVCOL_RANGE_UNSPECIFIED; frame->chroma_location = AVCHROMA_LOC_UNSPECIFIED; + frame->alpha_mode = AVALPHA_MODE_UNSPECIFIED; frame->flags = 0; } -static void free_side_data(AVFrameSideData **ptr_sd) -{ - AVFrameSideData *sd = *ptr_sd; - - av_buffer_unref(&sd->buf); - av_dict_free(&sd->metadata); - av_freep(ptr_sd); -} - -static void wipe_side_data(AVFrameSideData ***sd, int *nb_side_data) -{ - for (int i = 0; i < *nb_side_data; i++) { - free_side_data(&((*sd)[i])); - } - *nb_side_data = 0; - - av_freep(sd); -} - -static void frame_side_data_wipe(AVFrame *frame) -{ - wipe_side_data(&frame->side_data, &frame->nb_side_data); -} - -void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd) -{ - wipe_side_data(sd, nb_sd); -} - -static void remove_side_data(AVFrameSideData ***sd, int *nb_side_data, - const enum AVFrameSideDataType type) -{ - for (int i = *nb_side_data - 1; i >= 0; i--) { - AVFrameSideData *entry = ((*sd)[i]); - if (entry->type != type) - continue; - - free_side_data(&entry); - - ((*sd)[i]) = ((*sd)[*nb_side_data - 1]); - (*nb_side_data)--; - } -} - -static void remove_side_data_by_entry(AVFrameSideData ***sd, int *nb_sd, - const AVFrameSideData *target) -{ - for (int i = *nb_sd - 1; i >= 0; i--) { - AVFrameSideData *entry = ((*sd)[i]); - if (entry != target) - continue; - - free_side_data(&entry); - - ((*sd)[i]) = ((*sd)[*nb_sd - 1]); - (*nb_sd)--; - - return; - } -} - AVFrame *av_frame_alloc(void) { AVFrame *frame = av_malloc(sizeof(*frame)); @@ -318,13 +219,6 @@ static int frame_copy_props(AVFrame *dst, const AVFrame *src, int force_copy) { - int ret; - -#if FF_API_FRAME_KEY -FF_DISABLE_DEPRECATION_WARNINGS - dst->key_frame = src->key_frame; -FF_ENABLE_DEPRECATION_WARNINGS -#endif dst->pict_type = src->pict_type; dst->sample_aspect_ratio = src->sample_aspect_ratio; dst->crop_top = src->crop_top; @@ -334,26 +228,9 @@ dst->pts = src->pts; dst->duration = src->duration; dst->repeat_pict = src->repeat_pict; -#if FF_API_INTERLACED_FRAME -FF_DISABLE_DEPRECATION_WARNINGS - dst->interlaced_frame = src->interlaced_frame; - dst->top_field_first = src->top_field_first; -FF_ENABLE_DEPRECATION_WARNINGS -#endif -#if FF_API_PALETTE_HAS_CHANGED -FF_DISABLE_DEPRECATION_WARNINGS - dst->palette_has_changed = src->palette_has_changed; -FF_ENABLE_DEPRECATION_WARNINGS -#endif dst->sample_rate = src->sample_rate; dst->opaque = src->opaque; dst->pkt_dts = src->pkt_dts; -#if FF_API_FRAME_PKT -FF_DISABLE_DEPRECATION_WARNINGS - dst->pkt_pos = src->pkt_pos; - dst->pkt_size = src->pkt_size; -FF_ENABLE_DEPRECATION_WARNINGS -#endif dst->time_base = src->time_base; dst->quality = src->quality; dst->best_effort_timestamp = src->best_effort_timestamp; @@ -364,6 +241,7 @@ dst->colorspace = src->colorspace; dst->color_range = src->color_range; dst->chroma_location = src->chroma_location; + dst->alpha_mode = src->alpha_mode; av_dict_copy(&dst->metadata, src->metadata, 0); @@ -377,7 +255,7 @@ sd_dst = av_frame_new_side_data(dst, sd_src->type, sd_src->size); if (!sd_dst) { - frame_side_data_wipe(dst); + av_frame_side_data_free(&dst->side_data, &dst->nb_side_data); return AVERROR(ENOMEM); } memcpy(sd_dst->data, sd_src->data, sd_src->size); @@ -386,16 +264,15 @@ sd_dst = av_frame_new_side_data_from_buf(dst, sd_src->type, ref); if (!sd_dst) { av_buffer_unref(&ref); - frame_side_data_wipe(dst); + av_frame_side_data_free(&dst->side_data, &dst->nb_side_data); return AVERROR(ENOMEM); } } av_dict_copy(&sd_dst->metadata, sd_src->metadata, 0); } - ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); - ret |= av_buffer_replace(&dst->private_ref, src->private_ref); - return ret; + av_refstruct_replace(&dst->private_ref, src->private_ref); + return av_buffer_replace(&dst->opaque_ref, src->opaque_ref); } int av_frame_ref(AVFrame *dst, const AVFrame *src) @@ -473,17 +350,16 @@ if (src->extended_data != src->data) { int ch = dst->ch_layout.nb_channels; - if (!ch) { + if (ch <= 0 || ch > SIZE_MAX / sizeof(*dst->extended_data)) { ret = AVERROR(EINVAL); goto fail; } - dst->extended_data = av_malloc_array(sizeof(*dst->extended_data), ch); + dst->extended_data = av_memdup(src->extended_data, sizeof(*dst->extended_data) * ch); if (!dst->extended_data) { ret = AVERROR(ENOMEM); goto fail; } - memcpy(dst->extended_data, src->extended_data, sizeof(*src->extended_data) * ch); } else dst->extended_data = dst->data; @@ -526,7 +402,7 @@ if (ret < 0) goto fail; - frame_side_data_wipe(dst); + av_frame_side_data_free(&dst->side_data, &dst->nb_side_data); av_dict_free(&dst->metadata); ret = frame_copy_props(dst, src, 0); if (ret < 0) @@ -547,8 +423,8 @@ for (int i = nb_extended_buf; i < dst->nb_extended_buf; i++) av_buffer_unref(&dst->extended_buf[i]); - tmp = av_realloc_array(dst->extended_buf, sizeof(*dst->extended_buf), - src->nb_extended_buf); + tmp = av_realloc_array(dst->extended_buf, src->nb_extended_buf, + sizeof(*dst->extended_buf)); if (!tmp) { ret = AVERROR(ENOMEM); goto fail; @@ -581,14 +457,11 @@ if (src->extended_data != src->data) { int ch = dst->ch_layout.nb_channels; - if (!ch) { + if (ch <= 0 || ch > SIZE_MAX / sizeof(*dst->extended_data)) { ret = AVERROR(EINVAL); goto fail; } - if (ch > SIZE_MAX / sizeof(*dst->extended_data)) - goto fail; - dst->extended_data = av_memdup(src->extended_data, sizeof(*dst->extended_data) * ch); if (!dst->extended_data) { ret = AVERROR(ENOMEM); @@ -625,7 +498,7 @@ if (!frame) return; - frame_side_data_wipe(frame); + av_frame_side_data_free(&frame->side_data, &frame->nb_side_data); for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf); i++) av_buffer_unref(&frame->buf[i]); @@ -637,7 +510,7 @@ av_buffer_unref(&frame->hw_frames_ctx); av_buffer_unref(&frame->opaque_ref); - av_buffer_unref(&frame->private_ref); + av_refstruct_unref(&frame->private_ref); if (frame->extended_data != frame->data) av_freep(&frame->extended_data); @@ -730,7 +603,7 @@ AVBufferRef *av_frame_get_plane_buffer(const AVFrame *frame, int plane) { - uint8_t *data; + uintptr_t data; int planes; if (frame->nb_samples) { @@ -743,69 +616,31 @@ if (plane < 0 || plane >= planes || !frame->extended_data[plane]) return NULL; - data = frame->extended_data[plane]; + data = (uintptr_t)frame->extended_data[plane]; for (int i = 0; i < FF_ARRAY_ELEMS(frame->buf) && frame->buf[i]; i++) { AVBufferRef *buf = frame->buf[i]; - if (data >= buf->data && data < buf->data + buf->size) + uintptr_t buf_begin = (uintptr_t)buf->data; + + if (data >= buf_begin && data < buf_begin + buf->size) return buf; } for (int i = 0; i < frame->nb_extended_buf; i++) { AVBufferRef *buf = frame->extended_buf[i]; - if (data >= buf->data && data < buf->data + buf->size) + uintptr_t buf_begin = (uintptr_t)buf->data; + + if (data >= buf_begin && data < buf_begin + buf->size) return buf; } return NULL; } -static AVFrameSideData *add_side_data_from_buf_ext(AVFrameSideData ***sd, - int *nb_sd, - enum AVFrameSideDataType type, - AVBufferRef *buf, uint8_t *data, - size_t size) -{ - AVFrameSideData *ret, **tmp; - - // *nb_sd + 1 needs to fit into an int and a size_t. - if ((unsigned)*nb_sd >= FFMIN(INT_MAX, SIZE_MAX)) - return NULL; - - tmp = av_realloc_array(*sd, sizeof(**sd), *nb_sd + 1); - if (!tmp) - return NULL; - *sd = tmp; - - ret = av_mallocz(sizeof(*ret)); - if (!ret) - return NULL; - - ret->buf = buf; - ret->data = data; - ret->size = size; - ret->type = type; - - (*sd)[(*nb_sd)++] = ret; - - return ret; -} - -static AVFrameSideData *add_side_data_from_buf(AVFrameSideData ***sd, - int *nb_sd, - enum AVFrameSideDataType type, - AVBufferRef *buf) -{ - if (!buf) - return NULL; - - return add_side_data_from_buf_ext(sd, nb_sd, type, buf, buf->data, buf->size); -} - AVFrameSideData *av_frame_new_side_data_from_buf(AVFrame *frame, enum AVFrameSideDataType type, AVBufferRef *buf) { return - add_side_data_from_buf( + ff_frame_side_data_add_from_buf( &frame->side_data, &frame->nb_side_data, type, buf); } @@ -821,162 +656,6 @@ return ret; } -static AVFrameSideData *replace_side_data_from_buf(AVFrameSideData *dst, - AVBufferRef *buf, int flags) -{ - if (!(flags & AV_FRAME_SIDE_DATA_FLAG_REPLACE)) - return NULL; - - av_dict_free(&dst->metadata); - av_buffer_unref(&dst->buf); - dst->buf = buf; - dst->data = buf->data; - dst->size = buf->size; - return dst; -} - -AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, - enum AVFrameSideDataType type, - size_t size, unsigned int flags) -{ - const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); - AVBufferRef *buf = av_buffer_alloc(size); - AVFrameSideData *ret = NULL; - - if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) - remove_side_data(sd, nb_sd, type); - if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && - (ret = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { - ret = replace_side_data_from_buf(ret, buf, flags); - if (!ret) - av_buffer_unref(&buf); - return ret; - } - - ret = add_side_data_from_buf(sd, nb_sd, type, buf); - if (!ret) - av_buffer_unref(&buf); - - return ret; -} - -AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, - enum AVFrameSideDataType type, - AVBufferRef **pbuf, unsigned int flags) -{ - const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); - AVFrameSideData *sd_dst = NULL; - AVBufferRef *buf = *pbuf; - - if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) - remove_side_data(sd, nb_sd, type); - if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && - (sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { - sd_dst = replace_side_data_from_buf(sd_dst, buf, flags); - if (sd_dst) - *pbuf = NULL; - return sd_dst; - } - - sd_dst = add_side_data_from_buf(sd, nb_sd, type, buf); - if (!sd_dst) - return NULL; - - *pbuf = NULL; - return sd_dst; -} - -int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, - const AVFrameSideData *src, unsigned int flags) -{ - const AVSideDataDescriptor *desc; - AVBufferRef *buf = NULL; - AVFrameSideData *sd_dst = NULL; - int ret = AVERROR_BUG; - - if (!sd || !src || !nb_sd || (*nb_sd && !*sd)) - return AVERROR(EINVAL); - - desc = av_frame_side_data_desc(src->type); - if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) - remove_side_data(sd, nb_sd, src->type); - if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && - (sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, src->type))) { - AVDictionary *dict = NULL; - - if (!(flags & AV_FRAME_SIDE_DATA_FLAG_REPLACE)) - return AVERROR(EEXIST); - - ret = av_dict_copy(&dict, src->metadata, 0); - if (ret < 0) - return ret; - - ret = av_buffer_replace(&sd_dst->buf, src->buf); - if (ret < 0) { - av_dict_free(&dict); - return ret; - } - - av_dict_free(&sd_dst->metadata); - sd_dst->metadata = dict; - sd_dst->data = src->data; - sd_dst->size = src->size; - return 0; - } - - buf = av_buffer_ref(src->buf); - if (!buf) - return AVERROR(ENOMEM); - - sd_dst = add_side_data_from_buf_ext(sd, nb_sd, src->type, buf, - src->data, src->size); - if (!sd_dst) { - av_buffer_unref(&buf); - return AVERROR(ENOMEM); - } - - ret = av_dict_copy(&sd_dst->metadata, src->metadata, 0); - if (ret < 0) { - remove_side_data_by_entry(sd, nb_sd, sd_dst); - return ret; - } - - return 0; -} - -const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd, - const int nb_sd, - enum AVFrameSideDataType type) -{ - for (int i = 0; i < nb_sd; i++) { - if (sd[i]->type == type) - return sd[i]; - } - return NULL; -} - -void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd, - enum AVFrameSideDataType type) -{ - remove_side_data(sd, nb_sd, type); -} - -void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, - int props) -{ - for (int i = *nb_sd - 1; i >= 0; i--) { - AVFrameSideData *entry = ((*sd)[i]); - const AVSideDataDescriptor *desc = av_frame_side_data_desc(entry->type); - if (!desc || !(desc->props & props)) - continue; - - free_side_data(&entry); - - ((*sd)[i]) = ((*sd)[*nb_sd - 1]); - (*nb_sd)--; - } -} - AVFrameSideData *av_frame_get_side_data(const AVFrame *frame, enum AVFrameSideDataType type) { @@ -1045,21 +724,7 @@ void av_frame_remove_side_data(AVFrame *frame, enum AVFrameSideDataType type) { - remove_side_data(&frame->side_data, &frame->nb_side_data, type); -} - -const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type) -{ - unsigned t = type; - if (t < FF_ARRAY_ELEMS(sd_props) && sd_props[t].name) - return &sd_props[t]; - return NULL; -} - -const char *av_frame_side_data_name(enum AVFrameSideDataType type) -{ - const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); - return desc ? desc->name : NULL; + av_frame_side_data_remove(&frame->side_data, &frame->nb_side_data, type); } static int calc_cropping_offsets(size_t offsets[4], const AVFrame *frame, @@ -1096,6 +761,7 @@ { const AVPixFmtDescriptor *desc; size_t offsets[4]; + int ret; if (!(frame->width > 0 && frame->height > 0)) return AVERROR(EINVAL); @@ -1123,7 +789,9 @@ } /* calculate the offsets for each plane */ - calc_cropping_offsets(offsets, frame, desc); + ret = calc_cropping_offsets(offsets, frame, desc); + if (ret < 0) + return ret; /* adjust the offsets to avoid breaking alignment */ if (!(flags & AV_FRAME_CROP_UNALIGNED)) { @@ -1142,7 +810,9 @@ if (min_log2_align < 5 && log2_crop_align != INT_MAX) { frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1); - calc_cropping_offsets(offsets, frame, desc); + ret = calc_cropping_offsets(offsets, frame, desc); + if (ret < 0) + return ret; } } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/frame.h thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/frame.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/frame.h 2026-04-29 18:38:25.000000000 +0000 @@ -96,7 +96,7 @@ */ AV_FRAME_DATA_MOTION_VECTORS, /** - * Recommmends skipping the specified number of samples. This is exported + * Recommends skipping the specified number of samples. This is exported * only if the "skip_manual" AVOption is set in libavcodec. * This has the same format as AV_PKT_DATA_SKIP_SAMPLES. * @code @@ -243,6 +243,30 @@ * The data is an int storing the view ID. */ AV_FRAME_DATA_VIEW_ID, + + /** + * This side data contains information about the reference display width(s) + * and reference viewing distance(s) as well as information about the + * corresponding reference stereo pair(s), i.e., the pair(s) of views to be + * displayed for the viewer's left and right eyes on the reference display + * at the reference viewing distance. + * The payload is the AV3DReferenceDisplaysInfo struct defined in + * libavutil/tdrdi.h. + */ + AV_FRAME_DATA_3D_REFERENCE_DISPLAYS, + + /** + * Extensible image file format metadata. The payload is a buffer containing + * EXIF metadata, starting with either 49 49 2a 00, or 4d 4d 00 2a. + */ + AV_FRAME_DATA_EXIF, + + /** + * HDR dynamic metadata associated with a video frame. The payload is + * an AVDynamicHDRSmpte2094App5 type and contains information for color + * volume transform as specified in the SMPTE 2094-50 standard. + */ + AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5, }; enum AVActiveFormatDescription { @@ -297,6 +321,13 @@ * adapting to a different set of primaries or transfer characteristics. */ AV_SIDE_DATA_PROP_COLOR_DEPENDENT = (1 << 3), + + /** + * Side data depends on the channel layout. Side data with this property + * loses its meaning when downmixing or upmixing, unless either recomputed + * or adjusted to the new layout. + */ + AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT = (1 << 4), }; /** @@ -489,16 +520,6 @@ */ int format; -#if FF_API_FRAME_KEY - /** - * 1 -> keyframe, 0-> not - * - * @deprecated Use AV_FRAME_FLAG_KEY instead - */ - attribute_deprecated - int key_frame; -#endif - /** * Picture type of the frame. */ @@ -570,32 +591,6 @@ */ int repeat_pict; -#if FF_API_INTERLACED_FRAME - /** - * The content of the picture is interlaced. - * - * @deprecated Use AV_FRAME_FLAG_INTERLACED instead - */ - attribute_deprecated - int interlaced_frame; - - /** - * If the content is interlaced, is top field displayed first. - * - * @deprecated Use AV_FRAME_FLAG_TOP_FIELD_FIRST instead - */ - attribute_deprecated - int top_field_first; -#endif - -#if FF_API_PALETTE_HAS_CHANGED - /** - * Tell user application that palette has changed from previous frame. - */ - attribute_deprecated - int palette_has_changed; -#endif - /** * Sample rate of the audio data. */ @@ -666,7 +661,11 @@ */ #define AV_FRAME_FLAG_TOP_FIELD_FIRST (1 << 4) /** - * A flag to mark frames which were encoded losslessly from the input. + * A decoder can use this flag to mark frames which were originally encoded losslessly. + * + * For coding bitstream formats which support both lossless and lossy + * encoding, it is sometimes possible for a decoder to determine which method + * was used when the bitstream was encoded. */ #define AV_FRAME_FLAG_LOSSLESS (1 << 5) /** @@ -705,18 +704,6 @@ */ int64_t best_effort_timestamp; -#if FF_API_FRAME_PKT - /** - * reordered pos from the last AVPacket that has been input into the decoder - * - encoding: unused - * - decoding: Read by user. - * @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user - * data from packets to frames - */ - attribute_deprecated - int64_t pkt_pos; -#endif - /** * metadata. * - encoding: Set by user. @@ -737,20 +724,6 @@ #define FF_DECODE_ERROR_CONCEALMENT_ACTIVE 4 #define FF_DECODE_ERROR_DECODE_SLICES 8 -#if FF_API_FRAME_PKT - /** - * size of the corresponding packet containing the compressed - * frame. - * It is set to a negative value if unknown. - * - encoding: unused - * - decoding: set by libavcodec, read by user. - * @deprecated use AV_CODEC_FLAG_COPY_OPAQUE to pass through arbitrary user - * data from packets to frames - */ - attribute_deprecated - int pkt_size; -#endif - /** * For hwaccel-format frames, this should be a reference to the * AVHWFramesContext describing the frame. @@ -776,7 +749,7 @@ /** * @anchor cropping * @name Cropping - * Video frames only. The number of pixels to discard from the the + * Video frames only. The number of pixels to discard from the * top/bottom/left/right border of the frame to obtain the sub-rectangle of * the frame intended for presentation. * @{ @@ -790,17 +763,13 @@ */ /** - * AVBufferRef for internal use by a single libav* library. + * RefStruct reference for internal use by a single libav* library. * Must not be used to transfer data between libraries. * Has to be NULL when ownership of the frame leaves the respective library. * - * Code outside the FFmpeg libs should never check or change the contents of the buffer ref. - * - * FFmpeg calls av_buffer_unref() on it when the frame is unreferenced. - * av_frame_copy_props() calls create a new reference with av_buffer_ref() - * for the target frame's private_ref field. + * Code outside the FFmpeg libs must never check or change private_ref. */ - AVBufferRef *private_ref; + void *private_ref; /** * Channel layout of the audio data. @@ -811,6 +780,13 @@ * Duration of the frame, in the same units as pts. 0 if unknown. */ int64_t duration; + + /** + * Indicates how the alpha channel of the video is to be handled. + * - encoding: Set by user + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; } AVFrame; @@ -856,7 +832,7 @@ * Ensure the destination frame refers to the same data described by the source * frame, either by creating a new reference for each AVBufferRef from src if * they differ from those in dst, by allocating new buffers and copying data if - * src is not reference counted, or by unrefencing it if src is empty. + * src is not reference counted, or by unreferencing it if src is empty. * * Frame properties on dst will be replaced by those from src. * @@ -1082,6 +1058,11 @@ * Applies only for side data types without the AV_SIDE_DATA_PROP_MULTI prop. */ #define AV_FRAME_SIDE_DATA_FLAG_REPLACE (1 << 1) +/** + * Create a new reference to the passed in buffer instead of taking ownership + * of it. + */ +#define AV_FRAME_SIDE_DATA_FLAG_NEW_REF (1 << 2) /** * Add new side data entry to an array. diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hdr_dynamic_metadata.c thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hdr_dynamic_metadata.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.c 2026-04-29 18:38:25.000000000 +0000 @@ -395,3 +395,313 @@ *size = size_bytes; return 0; } + +AVDynamicHDRSmpte2094App5 *av_dynamic_hdr_smpte2094_app5_alloc(size_t *size) +{ + AVDynamicHDRSmpte2094App5 *smpte2094_app5 = av_mallocz(sizeof(AVDynamicHDRSmpte2094App5)); + if (!smpte2094_app5) + return NULL; + + if (size) + *size = sizeof(*smpte2094_app5); + + return smpte2094_app5; +} + +AVDynamicHDRSmpte2094App5 *av_dynamic_hdr_smpte2094_app5_create_side_data(AVFrame *frame) +{ + AVFrameSideData *side_data = av_frame_new_side_data(frame, + AV_FRAME_DATA_DYNAMIC_HDR_SMPTE_2094_APP5, + sizeof(AVDynamicHDRSmpte2094App5)); + if (!side_data) + return NULL; + + memset(side_data->data, 0, sizeof(AVDynamicHDRSmpte2094App5)); + + return (AVDynamicHDRSmpte2094App5 *)side_data->data; +} + +#define GET_BITS_OR_FAIL(var, n) \ + do { \ + if (get_bits_left(gb) < n) { \ + ret = AVERROR_INVALIDDATA; \ + goto end; \ + } \ + var = get_bits(gb, n); \ + } while (0) + +int av_dynamic_hdr_smpte2094_app5_from_t35(AVDynamicHDRSmpte2094App5 *s, const uint8_t *data, + size_t size) +{ + GetBitContext gbc, *gb = &gbc; + int ret, reserved_zero; + size_t padded_size = size + AV_INPUT_BUFFER_PADDING_SIZE; + + if (!s) + return AVERROR(ENOMEM); + + uint8_t *padded_data = av_mallocz(padded_size); + memcpy(padded_data, data, size); + ret = init_get_bits8(gb, padded_data, size); + if (ret < 0) + goto end; + + // Table C.1 + GET_BITS_OR_FAIL(s->application_version, 3); + GET_BITS_OR_FAIL(s->minimum_application_version, 3); + GET_BITS_OR_FAIL(reserved_zero, 2); + if (reserved_zero) { + ret = AVERROR_INVALIDDATA; + goto end; + } + + // Table C.2 + GET_BITS_OR_FAIL(s->has_custom_hdr_reference_white_flag, 1); + GET_BITS_OR_FAIL(s->has_adaptive_tone_map_flag, 1); + GET_BITS_OR_FAIL(reserved_zero, 6); + if (reserved_zero) { + ret = AVERROR_INVALIDDATA; + goto end; + } + if (s->has_custom_hdr_reference_white_flag) + GET_BITS_OR_FAIL(s->hdr_reference_white, 16); + if (!s->has_adaptive_tone_map_flag) { + ret = 0; + goto end; + } + + // Table C.3 + GET_BITS_OR_FAIL(s->baseline_hdr_headroom, 16); + GET_BITS_OR_FAIL(s->use_reference_white_tone_mapping_flag, 1); + if (s->use_reference_white_tone_mapping_flag) { + GET_BITS_OR_FAIL(reserved_zero, 7); + ret = reserved_zero ? AVERROR_INVALIDDATA : 0; + goto end; + } + GET_BITS_OR_FAIL(s->num_alternate_images, 3); + if (s->num_alternate_images > 4) { + ret = AVERROR_INVALIDDATA; + goto end; + } + GET_BITS_OR_FAIL(s->gain_application_space_chromaticities_flag, 2); + GET_BITS_OR_FAIL(s->has_common_component_mix_params_flag, 1); + GET_BITS_OR_FAIL(s->has_common_curve_params_flag, 1); + if (s->gain_application_space_chromaticities_flag == 3) + for (int r = 0; r < 8; r++) + GET_BITS_OR_FAIL(s->gain_application_space_chromaticities[r], 16); + + for (int a = 0; a < s->num_alternate_images; a++) { + GET_BITS_OR_FAIL(s->alternate_hdr_headrooms[a], 16); + + // Table C.4 + if (!a || !s->has_common_component_mix_params_flag) { + GET_BITS_OR_FAIL(s->component_mixing_type[a], 2); + if (s->component_mixing_type[a] != 3) { + GET_BITS_OR_FAIL(reserved_zero, 6); + if (reserved_zero) { + ret = AVERROR_INVALIDDATA; + goto end; + } + } else { + for (int k = 0; k < 6; k++) + GET_BITS_OR_FAIL(s->has_component_mixing_coefficient_flag[a][k], 1); + for (int k = 0; k < 6; k++) { + if (s->has_component_mixing_coefficient_flag[a][k]) { + GET_BITS_OR_FAIL(s->component_mixing_coefficient[a][k], 16); + } else { + s->component_mixing_coefficient[a][k] = 0; + } + } + } + } else { + s->component_mixing_type[a] = s->component_mixing_type[0]; + if (s->component_mixing_type[a] == 3) { + for (int k = 0; k < 6; k++) { + s->has_component_mixing_coefficient_flag[a][k] = + s->has_component_mixing_coefficient_flag[0][k]; + s->component_mixing_coefficient[a][k] = s->component_mixing_coefficient[0][k]; + } + } + } + + // Table C.5 + if (!a || !s->has_common_curve_params_flag) { + GET_BITS_OR_FAIL(s->gain_curve_num_control_points_minus_1[a], 5); + if (s->gain_curve_num_control_points_minus_1[a] > 31) { + ret = AVERROR_INVALIDDATA; + goto end; + } + GET_BITS_OR_FAIL(s->gain_curve_use_pchip_slope_flag[a], 1); + GET_BITS_OR_FAIL(reserved_zero, 2); + if (reserved_zero) { + ret = AVERROR_INVALIDDATA; + goto end; + } + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) { + GET_BITS_OR_FAIL(s->gain_curve_control_points_x[a][c], 16); + } + } else { + s->gain_curve_num_control_points_minus_1[a] = + s->gain_curve_num_control_points_minus_1[0]; + s->gain_curve_use_pchip_slope_flag[a] = s->gain_curve_use_pchip_slope_flag[0]; + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) { + s->gain_curve_control_points_x[a][c] = s->gain_curve_control_points_x[0][c]; + } + } + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) + GET_BITS_OR_FAIL(s->gain_curve_control_points_y[a][c], 16); + if (!s->gain_curve_use_pchip_slope_flag[a]) { + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) + GET_BITS_OR_FAIL(s->gain_curve_control_points_theta[a][c], 16); + } + } + ret = 0; +end: + av_free(padded_data); + return ret; +} + +int av_dynamic_hdr_smpte2094_app5_to_t35(const AVDynamicHDRSmpte2094App5 *s, uint8_t **data, + size_t *size) +{ + uint8_t *buf; + size_t size_bytes, size_bits; + PutBitContext pbc, *pb = &pbc; + + if (!s) + return AVERROR(EINVAL); + if ((!data || *data) && !size) + return AVERROR(EINVAL); + + if (s->application_version >= 8 || s->minimum_application_version >= 3) + return AVERROR_INVALIDDATA; + size_bits = 0; + size_bits += 3 + 3 + 2; + size_bits += 1 + 1 + 6; + if (s->has_custom_hdr_reference_white_flag) + size_bits += 16; + if (s->has_adaptive_tone_map_flag) { + size_bits += 16 + 1; + if (s->use_reference_white_tone_mapping_flag) { + size_bits += 7; + } else { + size_bits += 3 + 2 + 1 + 1; + if (s->gain_application_space_chromaticities_flag == 3) + size_bits += 16 * 8; + if (s->num_alternate_images > 4) + return AVERROR_INVALIDDATA; + for (int a = 0; a < s->num_alternate_images; a++) { + size_bits += 16; + if (!a || !s->has_common_component_mix_params_flag) { + size_bits += 2; + if (s->component_mixing_type[a] != 3) { + size_bits += 6; + } else { + size_bits += 6; + for (int k = 0; k < 6; k++) + if (s->has_component_mixing_coefficient_flag[a][k]) + size_bits += 16; + } + } + if (!a || !s->has_common_curve_params_flag) { + size_bits += 5 + 1 + 2; + if (s->gain_curve_num_control_points_minus_1[a] > 31) + return AVERROR_INVALIDDATA; + size_bits += 16 * (s->gain_curve_num_control_points_minus_1[a] + 1); + } + size_bits += 16 * (s->gain_curve_num_control_points_minus_1[a] + 1); + if (!s->gain_curve_use_pchip_slope_flag[a]) + size_bits += 16 * (s->gain_curve_num_control_points_minus_1[a] + 1); + } + } + } + if (size_bits % 8) + return AVERROR_INVALIDDATA; + size_bytes = size_bits >> 3; + + if (!data) { + *size = size_bytes; + return 0; + } else if (*data) { + if (*size < size_bytes) + return AVERROR_BUFFER_TOO_SMALL; + buf = *data; + } else { + buf = av_malloc(size_bytes); + if (!buf) + return AVERROR(ENOMEM); + } + + init_put_bits(pb, buf, size_bytes); + + // Table C.1 + put_bits(pb, 3, s->application_version); + put_bits(pb, 3, s->minimum_application_version); + put_bits(pb, 2, 0); // reserved_zero + + // Table C.2 + put_bits(pb, 1, s->has_custom_hdr_reference_white_flag); + put_bits(pb, 1, s->has_adaptive_tone_map_flag); + put_bits(pb, 6, 0); // reserved_zero + + if (s->has_custom_hdr_reference_white_flag) + put_bits(pb, 16, s->hdr_reference_white); + + if (s->has_adaptive_tone_map_flag) { + // Table C.3 + put_bits(pb, 16, s->baseline_hdr_headroom); + put_bits(pb, 1, s->use_reference_white_tone_mapping_flag); + if (s->use_reference_white_tone_mapping_flag) { + put_bits(pb, 7, 0); // reserved_zero + } else { + put_bits(pb, 3, s->num_alternate_images); + put_bits(pb, 2, s->gain_application_space_chromaticities_flag); + put_bits(pb, 1, s->has_common_component_mix_params_flag); + put_bits(pb, 1, s->has_common_curve_params_flag); + + if (s->gain_application_space_chromaticities_flag == 3) + for (int r = 0; r < 8; r++) + put_bits(pb, 16, s->gain_application_space_chromaticities[r]); + + for (int a = 0; a < s->num_alternate_images; a++) { + put_bits(pb, 16, s->alternate_hdr_headrooms[a]); + + // Table C.4 + if (!a || !s->has_common_component_mix_params_flag) { + put_bits(pb, 2, s->component_mixing_type[a]); + if (s->component_mixing_type[a] != 3) { + put_bits(pb, 6, 0); // reserved_zero + } else { + for (int k = 0; k < 6; k++) + put_bits(pb, 1, s->has_component_mixing_coefficient_flag[a][k]); + for (int k = 0; k < 6; k++) + if (s->has_component_mixing_coefficient_flag[a][k]) + put_bits(pb, 16, s->component_mixing_coefficient[a][k]); + } + } + + // Table C.5 + if (!a || !s->has_common_curve_params_flag) { + put_bits(pb, 5, s->gain_curve_num_control_points_minus_1[a]); + put_bits(pb, 1, s->gain_curve_use_pchip_slope_flag[a]); + put_bits(pb, 2, 0); // reserved_zero + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) + put_bits(pb, 16, s->gain_curve_control_points_x[a][c]); + } + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) + put_bits(pb, 16, s->gain_curve_control_points_y[a][c]); + if (!s->gain_curve_use_pchip_slope_flag[a]) { + for (int c = 0; c <= s->gain_curve_num_control_points_minus_1[a]; c++) + put_bits(pb, 16, s->gain_curve_control_points_theta[a][c]); + } + } + } + } + + flush_put_bits(pb); + + *data = buf; + if (size) + *size = size_bytes; + return 0; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hdr_dynamic_metadata.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hdr_dynamic_metadata.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hdr_dynamic_metadata.h 2026-04-29 18:38:25.000000000 +0000 @@ -373,4 +373,108 @@ */ int av_dynamic_hdr_plus_to_t35(const AVDynamicHDRPlus *s, uint8_t **data, size_t *size); +/** + * This struct represents dynamic metadata for color volume transform as + * specified in the SMPTE 2094-50 standard. + * + * To be used as payload of a AVFrameSideData or AVPacketSideData with the + * appropriate type. + * + * @note The struct should be allocated with + * av_dynamic_smpte2094_app5_alloc() and its size is not a part of + * the public ABI. + */ +typedef struct AVDynamicHDRSmpte2094App5 { + /** + * Section C.2.1. smpte_st_2094_50_application_info() + */ + uint8_t application_version; + uint8_t minimum_application_version; + + /** + * Section C.2.2 smpte_st_2094_50_color_volume_transform() + */ + uint8_t has_custom_hdr_reference_white_flag; + uint8_t has_adaptive_tone_map_flag; + uint16_t hdr_reference_white; + + /** + * Section C.2.3 smpte_st_2094_50_adaptive_tone_map() + */ + uint16_t baseline_hdr_headroom; + uint8_t use_reference_white_tone_mapping_flag; + uint8_t num_alternate_images; + uint8_t gain_application_space_chromaticities_flag; + uint8_t has_common_component_mix_params_flag; + uint8_t has_common_curve_params_flag; + uint16_t gain_application_space_chromaticities[8]; + uint16_t alternate_hdr_headrooms[4]; + + /** + * Section C.2.4 smpte_st_2094_50_component_mixing() + */ + uint8_t component_mixing_type[4]; + uint8_t has_component_mixing_coefficient_flag[4][6]; + uint16_t component_mixing_coefficient[4][6]; + + /** + * Section C.2.5 smpte_st_2094_50_gain_curve() + */ + uint8_t gain_curve_num_control_points_minus_1[4]; + uint8_t gain_curve_use_pchip_slope_flag[4]; + uint16_t gain_curve_control_points_x[4][32]; + uint16_t gain_curve_control_points_y[4][32]; + uint16_t gain_curve_control_points_theta[4][32]; +} AVDynamicHDRSmpte2094App5; + +/** + * Allocate an AVDynamicHDRSmpte2094App5 structure and set its fields to + * default values. The resulting struct can be freed using av_freep(). + * + * @return An AVDynamicHDRSmpte2094App5 filled with default values or NULL + * on failure. + */ +AVDynamicHDRSmpte2094App5* av_dynamic_hdr_smpte2094_app5_alloc(size_t* size); + +/** + * Allocate a complete AVDynamicHDRSmpte2094App5 and add it to the frame. + * + * @param frame The frame which side data is added to. + * + * @return The AVDynamicHDRSmpte2094App5 structure to be filled by caller or + * NULL on failure. + */ +AVDynamicHDRSmpte2094App5* av_dynamic_hdr_smpte2094_app5_create_side_data(AVFrame* frame); + +/** + * Parse the user data formatted as ITU-T T.35 message to AVDynamicHDRSmpte2094App5. + * + * @param s A pointer containing the decoded AVDynamicHDRSmpte2094App5 structure. + * @param data The byte array containing the raw ITU-T T.35 data. + * @param size Size of the data array in bytes. + * + * @return >= 0 on success. Otherwise, returns the appropriate AVERROR. + */ +int av_dynamic_hdr_smpte2094_app5_from_t35(AVDynamicHDRSmpte2094App5* s, const uint8_t* data, + size_t size); + +/** + * Serialize dynamic SMPTE-2094-50 metadata to a ITU-T T.35 message. Excluding + * the country_code, provider_code and provider_oriented_code. + * + * @param s A pointer containing the AVDynamicHDRSmpte2094App5 data. + * @param[in,out] data A pointer to pointer to a byte buffer to be filled with + * the serialized metadata. If *data is NULL, a buffer be will be allocated and + * a pointer to it stored in its place. The caller assumes ownership of the + * buffer. May be NULL, in which case the function will only store the required + * buffer size in *size. + * @param[in,out] size A pointer to a size to be set to the returned buffer's + * size. If *data is not NULL, *size must contain the size of the input buffer. + * May be NULL only if *data is NULL. + * + * @return >= 0 on success. Otherwise, returns the appropriate AVERROR. + */ +int av_dynamic_hdr_smpte2094_app5_to_t35(const AVDynamicHDRSmpte2094App5* s, uint8_t** data, + size_t* size); + #endif /* AVUTIL_HDR_DYNAMIC_METADATA_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext.c thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.c 2026-04-29 18:38:26.000000000 +0000 @@ -66,6 +66,12 @@ #if CONFIG_VULKAN &ff_hwcontext_type_vulkan, #endif +#if CONFIG_AMF + &ff_hwcontext_type_amf, +#endif +#if CONFIG_OHCODEC + &ff_hwcontext_type_oh, +#endif NULL, }; @@ -82,6 +88,8 @@ [AV_HWDEVICE_TYPE_VIDEOTOOLBOX] = "videotoolbox", [AV_HWDEVICE_TYPE_MEDIACODEC] = "mediacodec", [AV_HWDEVICE_TYPE_VULKAN] = "vulkan", + [AV_HWDEVICE_TYPE_AMF] = "amf", + [AV_HWDEVICE_TYPE_OHCODEC] = "ohcodec", }; typedef struct FFHWDeviceContext { @@ -133,9 +141,16 @@ return set ? next : AV_HWDEVICE_TYPE_NONE; } +static const char *hwdevice_ctx_get_name(void *ptr) +{ + FFHWDeviceContext *ctx = ptr; + return ctx->hw_type->name; +} + static const AVClass hwdevice_ctx_class = { .class_name = "AVHWDeviceContext", - .item_name = av_default_item_name, + .item_name = hwdevice_ctx_get_name, + .category = AV_CLASS_CATEGORY_HWDEVICE, .version = LIBAVUTIL_VERSION_INT, }; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext.h 2026-04-29 18:38:26.000000000 +0000 @@ -38,6 +38,9 @@ AV_HWDEVICE_TYPE_MEDIACODEC, AV_HWDEVICE_TYPE_VULKAN, AV_HWDEVICE_TYPE_D3D12VA, + AV_HWDEVICE_TYPE_AMF, + /* OpenHarmony Codec device */ + AV_HWDEVICE_TYPE_OHCODEC, }; /** @@ -560,7 +563,7 @@ * values indicate that it failed somehow. * * On failure, the destination frame will be left blank, except for the - * hw_frames_ctx/format fields thay may have been set by the caller - those will + * hw_frames_ctx/format fields they may have been set by the caller - those will * be preserved as they were. * * @param dst Destination frame, to contain the mapping. diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_d3d11va.c thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_d3d11va.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.c 2026-04-29 18:38:26.000000000 +0000 @@ -42,6 +42,8 @@ #include "thread.h" #include "compat/w32dlfcn.h" +#define MAX_ARRAY_SIZE 64 // Driver specification limits ArraySize to 64 for decoder-bound resources + typedef HRESULT(WINAPI *PFN_CREATE_DXGI_FACTORY)(REFIID riid, void **ppFactory); static AVOnce functions_loaded = AV_ONCE_INIT; @@ -288,6 +290,11 @@ return AVERROR(EINVAL); } + hwctx->BindFlags |= device_hwctx->BindFlags; + hwctx->MiscFlags |= device_hwctx->MiscFlags; + + ctx->initial_pool_size = FFMIN(ctx->initial_pool_size, MAX_ARRAY_SIZE); + texDesc = (D3D11_TEXTURE2D_DESC){ .Width = ctx->width, .Height = ctx->height, @@ -314,7 +321,7 @@ ctx->initial_pool_size = texDesc2.ArraySize; hwctx->BindFlags = texDesc2.BindFlags; hwctx->MiscFlags = texDesc2.MiscFlags; - } else if (!(texDesc.BindFlags & D3D11_BIND_RENDER_TARGET) && texDesc.ArraySize > 0) { + } else if (texDesc.ArraySize > 0) { hr = ID3D11Device_CreateTexture2D(device_hwctx->device, &texDesc, NULL, &hwctx->texture); if (FAILED(hr)) { av_log(ctx, AV_LOG_ERROR, "Could not create the texture (%lx)\n", (long)hr); @@ -706,6 +713,18 @@ } #endif + if (av_dict_get(opts, "SHADER", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_SHADER_RESOURCE; + + if (av_dict_get(opts, "UAV", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_UNORDERED_ACCESS; + + if (av_dict_get(opts, "RTV", NULL, 0)) + device_hwctx->BindFlags |= D3D11_BIND_RENDER_TARGET; + + if (av_dict_get(opts, "SHARED", NULL, 0)) + device_hwctx->MiscFlags |= D3D11_RESOURCE_MISC_SHARED; + return 0; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_d3d11va.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_d3d11va.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_d3d11va.h 2026-04-29 18:38:26.000000000 +0000 @@ -94,6 +94,20 @@ void (*lock)(void *lock_ctx); void (*unlock)(void *lock_ctx); void *lock_ctx; + /** + * D3D11_TEXTURE2D_DESC.BindFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT BindFlags; + /** + * D3D11_TEXTURE2D_DESC.MiscFlags to be applied to D3D11 resources allocated + * for frames using this device context. + * + * It applies globally to all AVD3D11VAFramesContext allocated from this device context. + */ + UINT MiscFlags; } AVD3D11VADeviceContext; /** diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_internal.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_internal.h 2026-04-29 18:38:26.000000000 +0000 @@ -163,5 +163,7 @@ extern const HWContextType ff_hwcontext_type_videotoolbox; extern const HWContextType ff_hwcontext_type_mediacodec; extern const HWContextType ff_hwcontext_type_vulkan; +extern const HWContextType ff_hwcontext_type_amf; +extern const HWContextType ff_hwcontext_type_oh; #endif /* AVUTIL_HWCONTEXT_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_mediacodec.c thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_mediacodec.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,121 @@ +/* + * 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 "config.h" + +#include +#include +#include + +#include "buffer.h" +#include "common.h" +#include "hwcontext.h" +#include "hwcontext_internal.h" +#include "hwcontext_mediacodec.h" + +typedef struct MediaCodecDeviceContext { + AVMediaCodecDeviceContext ctx; + + void *libmedia; + media_status_t (*create_surface)(ANativeWindow **surface); +} MediaCodecDeviceContext; + + +static int mc_device_create(AVHWDeviceContext *ctx, const char *device, + AVDictionary *opts, int flags) +{ + const AVDictionaryEntry *entry = NULL; + MediaCodecDeviceContext *s = ctx->hwctx; + AVMediaCodecDeviceContext *dev = &s->ctx; + + if (device && device[0]) { + av_log(ctx, AV_LOG_ERROR, "Device selection unsupported.\n"); + return AVERROR_UNKNOWN; + } + + while ((entry = av_dict_iterate(opts, entry))) { + if (!strcmp(entry->key, "create_window")) + dev->create_window = atoi(entry->value); + } + + av_log(ctx, AV_LOG_DEBUG, "%s createPersistentInputSurface\n", + dev->create_window ? "Enable" : "Disable"); + + return 0; +} + +static int mc_device_init(AVHWDeviceContext *ctx) +{ + MediaCodecDeviceContext *s = ctx->hwctx; + AVMediaCodecDeviceContext *dev = (AVMediaCodecDeviceContext *)s; + ANativeWindow *native_window = NULL; + + if (dev->surface) + return 0; + + if (dev->native_window) + return 0; + + // For backward compatibility, don't return error for a dummy + // AVHWDeviceContext without surface or native_window. + if (!dev->create_window) + return 0; + + s->libmedia = dlopen("libmediandk.so", RTLD_NOW); + if (!s->libmedia) + return AVERROR_UNKNOWN; + + s->create_surface = dlsym(s->libmedia, "AMediaCodec_createPersistentInputSurface"); + if (!s->create_surface) + return AVERROR_UNKNOWN; + + s->create_surface(&native_window); + dev->native_window = native_window; + return 0; +} + +static void mc_device_uninit(AVHWDeviceContext *ctx) +{ + MediaCodecDeviceContext *s = ctx->hwctx; + AVMediaCodecDeviceContext *dev = ctx->hwctx; + if (!s->libmedia) + return; + + if (dev->native_window) { + ANativeWindow_release(dev->native_window); + dev->native_window = NULL; + } + dlclose(s->libmedia); + s->libmedia = NULL; +} + +const HWContextType ff_hwcontext_type_mediacodec = { + .type = AV_HWDEVICE_TYPE_MEDIACODEC, + .name = "mediacodec", + + .device_hwctx_size = sizeof(MediaCodecDeviceContext), + + .device_create = mc_device_create, + .device_init = mc_device_init, + .device_uninit = mc_device_uninit, + + .pix_fmts = (const enum AVPixelFormat[]){ + AV_PIX_FMT_MEDIACODEC, + AV_PIX_FMT_NONE + }, +}; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_mediacodec.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_mediacodec.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_mediacodec.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * 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 + */ + +#ifndef AVUTIL_HWCONTEXT_MEDIACODEC_H +#define AVUTIL_HWCONTEXT_MEDIACODEC_H + +/** + * MediaCodec details. + * + * Allocated as AVHWDeviceContext.hwctx + */ +typedef struct AVMediaCodecDeviceContext { + /** + * android/view/Surface handle, to be filled by the user. + * + * This is the default surface used by decoders on this device. + */ + void *surface; + + /** + * Pointer to ANativeWindow. + * + * It both surface and native_window is NULL, try to create it + * automatically if create_window is true and OS support + * createPersistentInputSurface. + * + * It can be used as output surface for decoder and input surface for + * encoder. + */ + void *native_window; + + /** + * Enable createPersistentInputSurface automatically. + * + * Disabled by default. + * + * It can be enabled by setting this flag directly, or by setting + * AVDictionary of av_hwdevice_ctx_create(), with "create_window" as key. + * The second method is useful for ffmpeg cmdline, e.g., we can enable it + * via: + * -init_hw_device mediacodec=mediacodec,create_window=1 + */ + int create_window; +} AVMediaCodecDeviceContext; + +#endif /* AVUTIL_HWCONTEXT_MEDIACODEC_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_vaapi.c thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_vaapi.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.c 2026-04-29 18:38:25.000000000 +0000 @@ -37,7 +37,7 @@ #if CONFIG_LIBDRM # include # include -# include +# include # ifndef DRM_FORMAT_MOD_INVALID # define DRM_FORMAT_MOD_INVALID ((1ULL << 56) - 1) # endif @@ -72,6 +72,7 @@ typedef struct VAAPISurfaceFormat { enum AVPixelFormat pix_fmt; VAImageFormat image_format; + unsigned int fourcc; } VAAPISurfaceFormat; typedef struct VAAPIDeviceContext { @@ -194,12 +195,17 @@ } static const VAAPIFormatDescriptor * - vaapi_format_from_pix_fmt(enum AVPixelFormat pix_fmt) + vaapi_format_from_pix_fmt(enum AVPixelFormat pix_fmt, const VAAPIFormatDescriptor *prev) { - int i; - for (i = 0; i < FF_ARRAY_ELEMS(vaapi_format_map); i++) - if (vaapi_format_map[i].pix_fmt == pix_fmt) - return &vaapi_format_map[i]; + const VAAPIFormatDescriptor *end = &vaapi_format_map[FF_ARRAY_ELEMS(vaapi_format_map)]; + if (!prev) + prev = vaapi_format_map; + else + prev++; + + for (; prev < end; prev++) + if (prev->pix_fmt == pix_fmt) + return prev; return NULL; } @@ -213,23 +219,39 @@ return AV_PIX_FMT_NONE; } -static int vaapi_get_image_format(AVHWDeviceContext *hwdev, +static int vaapi_get_img_desc_and_format(AVHWDeviceContext *hwdev, enum AVPixelFormat pix_fmt, + const VAAPIFormatDescriptor **_desc, VAImageFormat **image_format) { VAAPIDeviceContext *ctx = hwdev->hwctx; + const VAAPIFormatDescriptor *desc = NULL; int i; - for (i = 0; i < ctx->nb_formats; i++) { - if (ctx->formats[i].pix_fmt == pix_fmt) { - if (image_format) - *image_format = &ctx->formats[i].image_format; - return 0; + while ((desc = vaapi_format_from_pix_fmt(pix_fmt, desc))) { + for (i = 0; i < ctx->nb_formats; i++) { + if (ctx->formats[i].fourcc == desc->fourcc) { + if (_desc) + *_desc = desc; + if (image_format) + *image_format = &ctx->formats[i].image_format; + return 0; + } } } + return AVERROR(ENOSYS); } +static int vaapi_get_image_format(AVHWDeviceContext *hwdev, + enum AVPixelFormat pix_fmt, + VAImageFormat **image_format) +{ + if (!image_format) + return AVERROR(EINVAL); + return vaapi_get_img_desc_and_format(hwdev, pix_fmt, NULL, image_format); +} + static int vaapi_frames_get_constraints(AVHWDeviceContext *hwdev, const void *hwconfig, AVHWFramesConstraints *constraints) @@ -435,6 +457,7 @@ av_log(hwdev, AV_LOG_DEBUG, "Format %#x -> %s.\n", fourcc, av_get_pix_fmt_name(pix_fmt)); ctx->formats[ctx->nb_formats].pix_fmt = pix_fmt; + ctx->formats[ctx->nb_formats].fourcc = fourcc; ctx->formats[ctx->nb_formats].image_format = image_list[i]; ++ctx->nb_formats; } @@ -554,19 +577,23 @@ VAAPIFramesContext *ctx = hwfc->hwctx; AVVAAPIFramesContext *avfc = &ctx->p; AVVAAPIDeviceContext *hwctx = hwfc->device_ctx->hwctx; - const VAAPIFormatDescriptor *desc; - VAImageFormat *expected_format; + const VAAPIFormatDescriptor *desc = NULL; + VAImageFormat *expected_format = NULL; AVBufferRef *test_surface = NULL; VASurfaceID test_surface_id; VAImage test_image; VAStatus vas; int err, i; - desc = vaapi_format_from_pix_fmt(hwfc->sw_format); - if (!desc) { - av_log(hwfc, AV_LOG_ERROR, "Unsupported format: %s.\n", - av_get_pix_fmt_name(hwfc->sw_format)); - return AVERROR(EINVAL); + err = vaapi_get_img_desc_and_format(hwfc->device_ctx, hwfc->sw_format, + &desc, &expected_format); + if (err < 0) { + // Use a relaxed check when pool exist. It can be an external pool. + if (!hwfc->pool || !vaapi_format_from_pix_fmt(hwfc->sw_format, NULL)) { + av_log(hwfc, AV_LOG_ERROR, "Unsupported format: %s.\n", + av_get_pix_fmt_name(hwfc->sw_format)); + return AVERROR(EINVAL); + } } if (!hwfc->pool) { @@ -665,10 +692,7 @@ test_surface_id = (VASurfaceID)(uintptr_t)test_surface->data; ctx->derive_works = 0; - - err = vaapi_get_image_format(hwfc->device_ctx, - hwfc->sw_format, &expected_format); - if (err == 0) { + if (expected_format) { vas = vaDeriveImage(hwctx->display, test_surface_id, &test_image); if (vas == VA_STATUS_SUCCESS) { if (expected_format->fourcc == test_image.format.fourcc) { @@ -1011,12 +1035,6 @@ { int err; - if (dst->format != AV_PIX_FMT_NONE) { - err = vaapi_get_image_format(hwfc->device_ctx, dst->format, NULL); - if (err < 0) - return err; - } - err = vaapi_map_frame(hwfc, dst, src, flags); if (err) return err; @@ -1697,7 +1715,7 @@ VAAPIDevicePriv *priv; VADisplay display = NULL; const AVDictionaryEntry *ent; - int try_drm, try_x11, try_win32, try_all; + int try_drm, try_x11, try_win32, try_all av_unused; priv = av_mallocz(sizeof(*priv)); if (!priv) @@ -1813,6 +1831,7 @@ "Failed to get DRM device info for device %d.\n", n); close(priv->drm_fd); priv->drm_fd = -1; + drmFreeVersion(info); continue; } @@ -1824,6 +1843,7 @@ drmFreeDevice(&device); close(priv->drm_fd); priv->drm_fd = -1; + drmFreeVersion(info); continue; } av_log(ctx, AV_LOG_VERBOSE, "Trying to use " @@ -1831,6 +1851,7 @@ "with matching vendor id (%s).\n", n, vendor_id->value); drmFreeDevice(&device); + drmFreeVersion(info); break; } drmFreeVersion(info); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_vaapi.h thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/hwcontext_vaapi.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/hwcontext_vaapi.h 2026-04-29 18:38:25.000000000 +0000 @@ -26,7 +26,7 @@ * API-specific header for AV_HWDEVICE_TYPE_VAAPI. * * Dynamic frame pools are supported, but note that any pool used as a render - * target is required to be of fixed size in order to be be usable as an + * target is required to be of fixed size in order to be usable as an * argument to vaCreateContext(). * * For user-allocated pools, AVHWFramesContext.pool must return AVBufferRefs diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/imgutils.c thunderbird-140.10.1esr/media/ffvpx/libavutil/imgutils.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/imgutils.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/imgutils.c 2026-04-29 18:38:25.000000000 +0000 @@ -63,7 +63,7 @@ if (width < 0) return AVERROR(EINVAL); s = (max_step_comp == 1 || max_step_comp == 2) ? desc->log2_chroma_w : 0; - shifted_w = ((width + (1 << s) - 1)) >> s; + shifted_w = AV_CEIL_RSHIFT(width, s); if (shifted_w && max_step > INT_MAX / shifted_w) return AVERROR(EINVAL); linesize = max_step * shifted_w; @@ -133,7 +133,7 @@ for (i = 1; i < 4 && has_plane[i]; i++) { int h, s = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; - h = (height + (1 << s) - 1) >> s; + h = AV_CEIL_RSHIFT(height, s); if (linesizes[i] > SIZE_MAX / h) return AVERROR(EINVAL); sizes[i] = (size_t)h * linesizes[i]; @@ -362,7 +362,7 @@ { int ret = -1; -#if ARCH_X86 +#if ARCH_X86 && HAVE_X86ASM ret = ff_image_copy_plane_uc_from_x86(dst, dst_linesize, src, src_linesize, bytewidth, height); #endif @@ -523,7 +523,7 @@ for (i = 0; i < nb_planes; i++) { int h, shift = (i == 1 || i == 2) ? desc->log2_chroma_h : 0; const uint8_t *src = src_data[i]; - h = (height + (1 << shift) - 1) >> shift; + h = AV_CEIL_RSHIFT(height, shift); for (j = 0; j < h; j++) { memcpy(dst, src, linesize[i]); @@ -646,7 +646,7 @@ size_t bytewidth = plane_line_bytes[plane]; uint8_t *data = dst_data[plane]; int chroma_div = plane == 1 || plane == 2 ? desc->log2_chroma_h : 0; - int plane_h = ((height + ( 1 << chroma_div) - 1)) >> chroma_div; + int plane_h = AV_CEIL_RSHIFT(height, chroma_div); for (; plane_h > 0; plane_h--) { memset_bytes(data, bytewidth, &clear_block[plane][0], clear_block_size[plane]); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/internal.h thunderbird-140.10.1esr/media/ffvpx/libavutil/internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -115,20 +115,6 @@ void avpriv_request_sample(void *avc, const char *msg, ...) av_printf_format(2, 3); -#if HAVE_LIBC_MSVCRT -#include -#if defined(_VC_CRT_MAJOR_VERSION) && _VC_CRT_MAJOR_VERSION < 14 -#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_strtod") -#pragma comment(linker, "/include:" EXTERN_PREFIX "avpriv_snprintf") -#endif - -#define PTRDIFF_SPECIFIER "Id" -#define SIZE_SPECIFIER "Iu" -#else -#define PTRDIFF_SPECIFIER "td" -#define SIZE_SPECIFIER "zu" -#endif - #ifdef DEBUG # define ff_dlog(ctx, ...) av_log(ctx, AV_LOG_DEBUG, __VA_ARGS__) #else @@ -141,7 +127,7 @@ # define ff_tlog(ctx, ...) do { } while(0) #endif -// For debuging we use signed operations so overflows can be detected (by ubsan) +// For debugging we use signed operations so overflows can be detected (by ubsan) // For production we use unsigned so there are no undefined operations #ifdef CHECKED #define SUINT int diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/intmath.h thunderbird-140.10.1esr/media/ffvpx/libavutil/intmath.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/intmath.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/intmath.h 2026-04-29 18:38:26.000000000 +0000 @@ -35,7 +35,7 @@ #endif #if HAVE_FAST_CLZ -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz) #ifndef ff_log2 # define ff_log2(x) (31 - __builtin_clz((x)|1)) # ifndef ff_log2_16bit @@ -90,18 +90,16 @@ */ #if HAVE_FAST_CLZ -#if AV_GCC_VERSION_AT_LEAST(3,4) -#ifndef ff_ctz +#if !defined(ff_ctz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctz)) #define ff_ctz(v) __builtin_ctz(v) #endif -#ifndef ff_ctzll +#if !defined(ff_ctzll) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_ctzll)) #define ff_ctzll(v) __builtin_ctzll(v) #endif -#ifndef ff_clz +#if !defined(ff_clz) && (AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_clz)) #define ff_clz(v) __builtin_clz(v) #endif #endif -#endif #ifndef ff_ctz #define ff_ctz ff_ctz_c @@ -154,7 +152,7 @@ } #endif -#if AV_GCC_VERSION_AT_LEAST(3,4) +#if AV_GCC_VERSION_AT_LEAST(3,4) || AV_HAS_BUILTIN(__builtin_parity) #ifndef av_parity #define av_parity __builtin_parity #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/libm.h thunderbird-140.10.1esr/media/ffvpx/libavutil/libm.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/libm.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/libm.h 2026-04-29 18:38:26.000000000 +0000 @@ -28,7 +28,9 @@ #include #include "config.h" #include "attributes.h" +#if !(HAVE_COPYSIGN && HAVE_HYPOT && HAVE_ISFINITE && HAVE_ISINF && HAVE_ISNAN) #include "intfloat.h" +#endif #include "mathematics.h" #if HAVE_MIPSFPU && HAVE_INLINE_ASM diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/lls.c thunderbird-140.10.1esr/media/ffvpx/libavutil/lls.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/lls.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/lls.c 2026-04-29 18:38:26.000000000 +0000 @@ -114,7 +114,7 @@ m->evaluate_lls = evaluate_lls; #if ARCH_RISCV ff_init_lls_riscv(m); -#elif ARCH_X86 +#elif ARCH_X86 && HAVE_X86ASM ff_init_lls_x86(m); #endif } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/log.c thunderbird-140.10.1esr/media/ffvpx/libavutil/log.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/log.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/log.c 2026-04-29 18:38:26.000000000 +0000 @@ -34,6 +34,7 @@ #endif #include #include +#include #include #include #include @@ -42,6 +43,8 @@ #include "internal.h" #include "log.h" #include "thread.h" +#include "fftime.h" +#include "time_internal.h" static AVMutex mutex = AV_MUTEX_INITIALIZER; @@ -53,8 +56,8 @@ #define BACKTRACE_LOGLEVEL AV_LOG_ERROR #endif -static int av_log_level = AV_LOG_INFO; -static int flags; +static atomic_int av_log_level = AV_LOG_INFO; +static atomic_int av_log_flags = 0; #define NB_LEVELS 8 #if defined(_WIN32) && HAVE_SETCONSOLETEXTATTRIBUTE && HAVE_GETSTDHANDLE @@ -79,6 +82,7 @@ [16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 9, [16+AV_CLASS_CATEGORY_SWSCALER ] = 7, [16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 7, + [16+AV_CLASS_CATEGORY_HWDEVICE ] = 6, [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 13, [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 5, [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 13, @@ -111,6 +115,7 @@ [16+AV_CLASS_CATEGORY_BITSTREAM_FILTER] = 192 << 8 | 0x14, [16+AV_CLASS_CATEGORY_SWSCALER ] = 153 << 8 | 0x14, [16+AV_CLASS_CATEGORY_SWRESAMPLER ] = 147 << 8 | 0x14, + [16+AV_CLASS_CATEGORY_HWDEVICE ] = 214 << 8 | 0x13, [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT ] = 213 << 8 | 0x15, [16+AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT ] = 207 << 8 | 0x05, [16+AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT ] = 213 << 8 | 0x15, @@ -296,14 +301,33 @@ return (cls->item_name ? cls->item_name : av_default_item_name)(obj); } +static void format_date_now(AVBPrint* bp_time, int include_date) +{ + struct tm *ptm, tmbuf; + const int64_t time_us = av_gettime(); + const int64_t time_ms = time_us / 1000; + const time_t time_s = time_ms / 1000; + const int millisec = time_ms - (time_s * 1000); + ptm = localtime_r(&time_s, &tmbuf); + if (ptm) { + if (include_date) + av_bprint_strftime(bp_time, "%Y-%m-%d ", ptm); + + av_bprint_strftime(bp_time, "%H:%M:%S", ptm); + av_bprintf(bp_time, ".%03d ", millisec); + } +} + static void format_line(void *avcl, int level, const char *fmt, va_list vl, - AVBPrint part[4], int *print_prefix, int type[2]) + AVBPrint part[5], int *print_prefix, int type[2]) { AVClass* avc = avcl ? *(AVClass **) avcl : NULL; av_bprint_init(part+0, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(part+1, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(part+2, 0, AV_BPRINT_SIZE_AUTOMATIC); av_bprint_init(part+3, 0, 65536); + av_bprint_init(part+4, 0, AV_BPRINT_SIZE_AUTOMATIC); + int flags = atomic_load_explicit(&av_log_flags, memory_order_relaxed); if(type) type[0] = type[1] = AV_CLASS_CATEGORY_NA + 16; if (*print_prefix && avc) { @@ -321,6 +345,9 @@ if(type) type[1] = get_category(avcl); } + if (*print_prefix && (level > AV_LOG_QUIET) && (flags & (AV_LOG_PRINT_TIME | AV_LOG_PRINT_DATETIME))) + format_date_now(&part[4], flags & AV_LOG_PRINT_DATETIME); + if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL)) av_bprintf(part+2, "[%s] ", get_level_str(level)); @@ -341,7 +368,7 @@ int av_log_format_line2(void *ptr, int level, const char *fmt, va_list vl, char *line, int line_size, int *print_prefix) { - AVBPrint part[4]; + AVBPrint part[5]; int ret; format_line(ptr, level, fmt, vl, part, print_prefix, NULL); @@ -355,7 +382,7 @@ static int print_prefix = 1; static int count; static char prev[LINE_SZ]; - AVBPrint part[4]; + AVBPrint part[5]; char line[LINE_SZ]; static int is_atty; int type[2]; @@ -366,7 +393,7 @@ level &= 0xff; } - if (level > av_log_level) + if (level > atomic_load_explicit(&av_log_level, memory_order_relaxed)) return; ff_mutex_lock(&mutex); @@ -378,7 +405,7 @@ is_atty = isatty(2) ? 1 : -1; #endif - if (print_prefix && (flags & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) && + if (print_prefix && (atomic_load_explicit(&av_log_flags, memory_order_relaxed) & AV_LOG_SKIP_REPEATED) && !strcmp(line, prev) && *line && line[strlen(line) - 1] != '\r'){ count++; if (is_atty == 1) @@ -390,6 +417,9 @@ count = 0; } strcpy(prev, line); + + sanitize(part[4].str); + colored_fputs(7, 0, part[4].str); sanitize(part[0].str); colored_fputs(type[0], 0, part[0].str); sanitize(part[1].str); @@ -408,8 +438,7 @@ ff_mutex_unlock(&mutex); } -static void (*av_log_callback)(void*, int, const char*, va_list) = - av_log_default_callback; +static atomic_uintptr_t av_log_callback = (uintptr_t)av_log_default_callback; void av_log(void* avcl, int level, const char *fmt, ...) { @@ -431,7 +460,8 @@ void av_vlog(void* avcl, int level, const char *fmt, va_list vl) { AVClass* avc = avcl ? *(AVClass **) avcl : NULL; - void (*log_callback)(void*, int, const char*, va_list) = av_log_callback; + void (*log_callback)(void*, int, const char*, va_list) = + (void *)atomic_load_explicit(&av_log_callback, memory_order_relaxed); if (avc && avc->version >= (50 << 16 | 15 << 8 | 2) && avc->log_level_offset_offset && level >= AV_LOG_FATAL) level += *(int *) (((uint8_t *) avcl) + avc->log_level_offset_offset); @@ -441,27 +471,27 @@ int av_log_get_level(void) { - return av_log_level; + return atomic_load_explicit(&av_log_level, memory_order_relaxed); } void av_log_set_level(int level) { - av_log_level = level; + atomic_store_explicit(&av_log_level, level, memory_order_relaxed); } void av_log_set_flags(int arg) { - flags = arg; + atomic_store_explicit(&av_log_flags, arg, memory_order_relaxed); } int av_log_get_flags(void) { - return flags; + return atomic_load_explicit(&av_log_flags, memory_order_relaxed); } void av_log_set_callback(void (*callback)(void*, int, const char*, va_list)) { - av_log_callback = callback; + atomic_store_explicit(&av_log_callback, (uintptr_t)callback, memory_order_relaxed); } static void missing_feature_sample(int sample, void *avc, const char *msg, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/log.h thunderbird-140.10.1esr/media/ffvpx/libavutil/log.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/log.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/log.h 2026-04-29 18:38:25.000000000 +0000 @@ -37,6 +37,7 @@ AV_CLASS_CATEGORY_BITSTREAM_FILTER, AV_CLASS_CATEGORY_SWSCALER, AV_CLASS_CATEGORY_SWRESAMPLER, + AV_CLASS_CATEGORY_HWDEVICE, AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT = 40, AV_CLASS_CATEGORY_DEVICE_VIDEO_INPUT, AV_CLASS_CATEGORY_DEVICE_AUDIO_OUTPUT, @@ -276,9 +277,9 @@ * @param avcl A pointer to an arbitrary struct of which the first field is a * pointer to an AVClass struct or NULL if general log. * @param initial_level importance level of the message expressed using a @ref - * lavu_log_constants "Logging Constant" for the first occurance. + * lavu_log_constants "Logging Constant" for the first occurrence. * @param subsequent_level importance level of the message expressed using a @ref - * lavu_log_constants "Logging Constant" after the first occurance. + * lavu_log_constants "Logging Constant" after the first occurrence. * @param fmt The format string (printf-compatible) that specifies how * subsequent arguments are converted to output. * @param state a variable to keep trak of if a message has already been printed @@ -406,6 +407,16 @@ */ #define AV_LOG_PRINT_LEVEL 2 +/** + * Include system time in log output. + */ +#define AV_LOG_PRINT_TIME 4 + +/** + * Include system date and time in log output. + */ +#define AV_LOG_PRINT_DATETIME 8 + void av_log_set_flags(int arg); int av_log_get_flags(void); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/mathematics.h thunderbird-140.10.1esr/media/ffvpx/libavutil/mathematics.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/mathematics.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/mathematics.h 2026-04-29 18:38:25.000000000 +0000 @@ -278,7 +278,7 @@ /** * Add a value to a timestamp. * - * This function guarantees that when the same value is repeatly added that + * This function guarantees that when the same value is repeatedly added that * no accumulation of rounding errors occurs. * * @param[in] ts Input timestamp diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/mem_internal.h thunderbird-140.10.1esr/media/ffvpx/libavutil/mem_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/mem_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/mem_internal.h 2026-04-29 18:38:26.000000000 +0000 @@ -82,8 +82,8 @@ #define DECLARE_ASM_CONST(n,t,v) alignas(FFMIN(n, 16)) static const t av_used v #elif defined(_MSC_VER) #define DECLARE_ALIGNED_T(n,t,v) __declspec(align(n)) t v - #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t v - #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t v + #define DECLARE_ASM_ALIGNED(n,t,v) __declspec(align(n)) t av_used v + #define DECLARE_ASM_CONST(n,t,v) __declspec(align(n)) static const t av_used v #else #define DECLARE_ALIGNED_T(n,t,v) alignas(n) t v #define DECLARE_ASM_ALIGNED(n,t,v) alignas(n) t av_used v @@ -131,4 +131,6 @@ #define LOCAL_ALIGNED_32(t, v, ...) E1(LOCAL_ALIGNED_D(32, t, v, __VA_ARGS__,,)) +#define LOCAL_ALIGNED_64(t, v, ...) E1(LOCAL_ALIGNED_D(64, t, v, __VA_ARGS__,,)) + #endif /* AVUTIL_MEM_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/moz.build thunderbird-140.10.1esr/media/ffvpx/libavutil/moz.build --- thunderbird-140.10.0esr/media/ffvpx/libavutil/moz.build 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/moz.build 2026-04-29 18:38:26.000000000 +0000 @@ -31,6 +31,7 @@ 'fifo.c', 'fixed_dsp.c', 'float_dsp.c', + 'float_scalarproduct.c', 'frame.c', 'hwcontext.c', 'imgutils.c', @@ -46,8 +47,10 @@ 'refstruct.c', 'reverse.c', 'samplefmt.c', + 'side_data.c', 'slicethread.c', 'time.c', + 'timecode_internal.c', 'tx.c', 'tx_double.c', 'tx_float.c', @@ -75,6 +78,10 @@ 'hwcontext_vaapi.c', ] USE_LIBS += ['mozva'] + elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + SOURCES += [ + 'hwcontext_mediacodec.c', + ] elif CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": SOURCES += [ 'hwcontext_d3d11va.c', @@ -84,11 +91,19 @@ "tx.h" ] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + EXPORTS.ffvpx += [ + "hwcontext_mediacodec.h" + ] + if CONFIG["MOZ_WIDGET_TOOLKIT"] == "windows": EXPORTS.ffvpx += [ "hwcontext_d3d11va.h" ] +if CONFIG["MOZ_WIDGET_TOOLKIT"] == "android": + OS_LIBS += ['android'] + SYMBOLS_FILE = 'avutil.symbols' NoVisibilityFlags() diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/opt.c thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/opt.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.c 2026-04-29 18:38:26.000000000 +0000 @@ -191,20 +191,12 @@ // try state flags first from the target (child), then from its parent class = *(const AVClass**)tgt; - if ( -#if LIBAVUTIL_VERSION_MAJOR < 60 - class->version >= AV_VERSION_INT(59, 41, 100) && -#endif - class->state_flags_offset) + if (class->state_flags_offset) state_flags = (unsigned*)((uint8_t*)tgt + class->state_flags_offset); if (!state_flags && obj != tgt) { class = *(const AVClass**)obj; - if ( -#if LIBAVUTIL_VERSION_MAJOR < 60 - class->version >= AV_VERSION_INT(59, 41, 100) && -#endif - class->state_flags_offset) + if (class->state_flags_offset) state_flags = (unsigned*)((uint8_t*)obj + class->state_flags_offset); } @@ -212,9 +204,7 @@ av_log(obj, AV_LOG_ERROR, "Option '%s' is not a runtime option and " "so cannot be set after the object has been initialized\n", o->name); -#if LIBAVUTIL_VERSION_MAJOR >= 60 return AVERROR(EINVAL); -#endif } } @@ -490,7 +480,7 @@ res = av_expr_parse_and_eval(&d, i ? buf : val, const_names, const_values, NULL, NULL, NULL, NULL, NULL, 0, obj); if (res < 0) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\"\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\"\n", o->name, val); return res; } } @@ -522,7 +512,7 @@ } ret = av_parse_video_size(dst, dst + 1, val); if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as image size\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as image size\n", o->name, val); return ret; } @@ -530,7 +520,7 @@ { int ret = av_parse_video_rate(dst, val); if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as video rate\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as video rate\n", o->name, val); return ret; } @@ -543,7 +533,7 @@ } else { ret = av_parse_color(dst, val, -1, obj); if (ret < 0) - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as color\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as color\n", o->name, val); return ret; } return 0; @@ -583,7 +573,7 @@ return 0; fail: - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as boolean\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as boolean\n", o->name, val); return AVERROR(EINVAL); } @@ -601,7 +591,7 @@ fmt = strtol(val, &tail, 0); if (*tail || (unsigned)fmt >= fmt_nb) { av_log(obj, AV_LOG_ERROR, - "Unable to parse option value \"%s\" as %s\n", val, desc); + "Unable to parse \"%s\" option value \"%s\" as %s\n", o->name, val, desc); return AVERROR(EINVAL); } } @@ -724,7 +714,7 @@ int64_t usecs = 0; if (val) { if ((ret = av_parse_time(&usecs, val, 1)) < 0) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as duration\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as duration\n", o->name, val); return ret; } } @@ -741,7 +731,7 @@ case AV_OPT_TYPE_CHLAYOUT: ret = set_string_channel_layout(obj, o, val, dst); if (ret < 0) { - av_log(obj, AV_LOG_ERROR, "Unable to parse option value \"%s\" as channel layout\n", val); + av_log(obj, AV_LOG_ERROR, "Unable to parse \"%s\" option value \"%s\" as channel layout\n", o->name, val); ret = AVERROR(EINVAL); } return ret; @@ -1336,7 +1326,7 @@ return av_opt_get_q(obj, name, search_flags, out_val); } -static int get_format(void *obj, const char *name, int search_flags, int *out_fmt, +static int get_format(void *obj, const char *name, int search_flags, void *out_fmt, enum AVOptionType type, const char *desc) { void *dst, *target_obj; @@ -1350,7 +1340,11 @@ } dst = ((uint8_t*)target_obj) + o->offset; - *out_fmt = *(int *)dst; + if (type == AV_OPT_TYPE_PIXEL_FMT) + *(enum AVPixelFormat *)out_fmt = *(enum AVPixelFormat *)dst; + else + *(enum AVSampleFormat*)out_fmt = *(enum AVSampleFormat*)dst; + return 0; } @@ -1498,7 +1492,7 @@ { const enum AVOptionType type = TYPE_BASE(o->type); - if (o->type == AV_OPT_TYPE_CONST && TYPE_BASE(parent_type) == AV_OPT_TYPE_INT) + if (o->type == AV_OPT_TYPE_CONST && (TYPE_BASE(parent_type) == AV_OPT_TYPE_INT || TYPE_BASE(parent_type) == AV_OPT_TYPE_INT64)) av_log(av_log_obj, AV_LOG_INFO, "%-12"PRId64" ", o->default_val.i64); else if (type < FF_ARRAY_ELEMS(opt_type_desc) && opt_type_desc[type].name) { if (o->type & AV_OPT_TYPE_FLAG_ARRAY) @@ -2602,6 +2596,8 @@ ret = 0; else if (val) ret = !strcmp(val, def); + else + ret = 1; av_freep(&val); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/opt.h thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/opt.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/opt.h 2026-04-29 18:38:26.000000000 +0000 @@ -542,7 +542,7 @@ */ int nb_ranges; /** - * Number of componentes. + * Number of components. */ int nb_components; } AVOptionRanges; @@ -1137,7 +1137,7 @@ * @param[in] obj AVClass object to serialize * @param[in] opt_flags serialize options with all the specified flags set (AV_OPT_FLAG) * @param[in] flags combination of AV_OPT_SERIALIZE_* flags - * @param[out] buffer Pointer to buffer that will be allocated with string containg serialized options. + * @param[out] buffer Pointer to buffer that will be allocated with string containing serialized options. * Buffer must be freed by the caller when is no longer needed. * @param[in] key_val_sep character used to separate key from value * @param[in] pairs_sep character used to separate two pairs from each other @@ -1167,7 +1167,7 @@ * * The result must be freed with av_opt_freep_ranges. * - * @return number of compontents returned on success, a negative errro code otherwise + * @return number of components returned on success, a negative error code otherwise */ int av_opt_query_ranges(AVOptionRanges **, void *obj, const char *key, int flags); @@ -1183,7 +1183,7 @@ * * The result must be freed with av_opt_free_ranges. * - * @return number of compontents returned on success, a negative errro code otherwise + * @return number of components returned on success, a negative error code otherwise */ int av_opt_query_ranges_default(AVOptionRanges **, void *obj, const char *key, int flags); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/pixdesc.c thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/pixdesc.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.c 2026-04-29 18:38:26.000000000 +0000 @@ -797,6 +797,27 @@ }, .alias = "y16le", }, + [AV_PIX_FMT_GRAY32BE] = { + .name = "gray32be", + .nb_components = 1, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32 }, /* Y */ + }, + .flags = AV_PIX_FMT_FLAG_BE, + .alias = "y32be", + }, + [AV_PIX_FMT_GRAY32LE] = { + .name = "gray32le", + .nb_components = 1, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 32 }, /* Y */ + }, + .alias = "y32le", + }, [AV_PIX_FMT_YUV440P] = { .name = "yuv440p", .nb_components = 3, @@ -1680,6 +1701,30 @@ }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV444P10MSBLE] = { + .name = "yuv444p10msble", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 2, 0, 6, 10 }, /* U */ + { 2, 2, 0, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P10MSBBE] = { + .name = "yuv444p10msbbe", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 6, 10 }, /* Y */ + { 1, 2, 0, 6, 10 }, /* U */ + { 2, 2, 0, 6, 10 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_YUV444P9LE] = { .name = "yuv444p9le", .nb_components = 3, @@ -1728,6 +1773,30 @@ }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, }, + [AV_PIX_FMT_YUV444P12MSBLE] = { + .name = "yuv444p12msble", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 4, 12 }, /* Y */ + { 1, 2, 0, 4, 12 }, /* U */ + { 2, 2, 0, 4, 12 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR, + }, + [AV_PIX_FMT_YUV444P12MSBBE] = { + .name = "yuv444p12msbbe", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 4, 12 }, /* Y */ + { 1, 2, 0, 4, 12 }, /* U */ + { 2, 2, 0, 4, 12 }, /* V */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR, + }, [AV_PIX_FMT_YUV444P14LE] = { .name = "yuv444p14le", .nb_components = 3, @@ -1856,6 +1925,30 @@ }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, }, + [AV_PIX_FMT_GBRP10MSBLE] = { + .name = "gbrp10msble", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 6, 10 }, /* R */ + { 0, 2, 0, 6, 10 }, /* G */ + { 1, 2, 0, 6, 10 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_GBRP10MSBBE] = { + .name = "gbrp10msbbe", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 6, 10 }, /* R */ + { 0, 2, 0, 6, 10 }, /* G */ + { 1, 2, 0, 6, 10 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, + }, [AV_PIX_FMT_GBRP12LE] = { .name = "gbrp12le", .nb_components = 3, @@ -1880,6 +1973,30 @@ }, .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, }, + [AV_PIX_FMT_GBRP12MSBLE] = { + .name = "gbrp12msble", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 4, 12 }, /* R */ + { 0, 2, 0, 4, 12 }, /* G */ + { 1, 2, 0, 4, 12 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_GBRP12MSBBE] = { + .name = "gbrp12msbbe", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 4, 12 }, /* R */ + { 0, 2, 0, 4, 12 }, /* G */ + { 1, 2, 0, 4, 12 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB, + }, [AV_PIX_FMT_GBRP14LE] = { .name = "gbrp14le", .nb_components = 3, @@ -1970,6 +2087,34 @@ .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, }, + [AV_PIX_FMT_GBRAP32LE] = { + .name = "gbrap32le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 4, 0, 0, 32 }, /* R */ + { 0, 4, 0, 0, 32 }, /* G */ + { 1, 4, 0, 0, 32 }, /* B */ + { 3, 4, 0, 0, 32 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_GBRAP32BE] = { + .name = "gbrap32be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 4, 0, 0, 32 }, /* R */ + { 0, 4, 0, 0, 32 }, /* G */ + { 1, 4, 0, 0, 32 }, /* B */ + { 3, 4, 0, 0, 32 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | + AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_ALPHA, + }, [AV_PIX_FMT_VDPAU] = { .name = "vdpau", .log2_chroma_w = 1, @@ -2133,6 +2278,10 @@ .name = "cuda", .flags = AV_PIX_FMT_FLAG_HWACCEL, }, + [AV_PIX_FMT_AMF_SURFACE] = { + .name = "amf", + .flags = AV_PIX_FMT_FLAG_HWACCEL, + }, [AV_PIX_FMT_VYU444] = { .name = "vyu444", .nb_components = 3, @@ -2414,6 +2563,60 @@ .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT, }, + [AV_PIX_FMT_GBRPF16BE] = { + .name = "gbrpf16be", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 0, 16 }, /* R */ + { 0, 2, 0, 0, 16 }, /* G */ + { 1, 2, 0, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | + AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_GBRPF16LE] = { + .name = "gbrpf16le", + .nb_components = 3, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 0, 16 }, /* R */ + { 0, 2, 0, 0, 16 }, /* G */ + { 1, 2, 0, 0, 16 }, /* B */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_RGB, + }, + [AV_PIX_FMT_GBRAPF16BE] = { + .name = "gbrapf16be", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 0, 16 }, /* R */ + { 0, 2, 0, 0, 16 }, /* G */ + { 1, 2, 0, 0, 16 }, /* B */ + { 3, 2, 0, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_PLANAR | + AV_PIX_FMT_FLAG_ALPHA | AV_PIX_FMT_FLAG_RGB | + AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_GBRAPF16LE] = { + .name = "gbrapf16le", + .nb_components = 4, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 2, 2, 0, 0, 16 }, /* R */ + { 0, 2, 0, 0, 16 }, /* G */ + { 1, 2, 0, 0, 16 }, /* B */ + { 3, 2, 0, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_PLANAR | AV_PIX_FMT_FLAG_ALPHA | + AV_PIX_FMT_FLAG_RGB | AV_PIX_FMT_FLAG_FLOAT, + }, [AV_PIX_FMT_DRM_PRIME] = { .name = "drm_prime", .flags = AV_PIX_FMT_FLAG_HWACCEL, @@ -2444,6 +2647,70 @@ .flags = AV_PIX_FMT_FLAG_FLOAT, .alias = "yf32le", }, + [AV_PIX_FMT_GRAYF16BE] = { + .name = "grayf16be", + .nb_components = 1, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_GRAYF16LE] = { + .name = "grayf16le", + .nb_components = 1, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 2, 0, 0, 16 }, /* Y */ + }, + .flags = AV_PIX_FMT_FLAG_FLOAT, + }, + [AV_PIX_FMT_YAF32BE] = { + .name = "yaf32be", + .nb_components = 2, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 32 }, /* Y */ + { 0, 8, 4, 0, 32 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YAF32LE] = { + .name = "yaf32le", + .nb_components = 2, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 8, 0, 0, 32 }, /* Y */ + { 0, 8, 4, 0, 32 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YAF16BE] = { + .name = "yaf16be", + .nb_components = 2, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 4, 2, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_BE | AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, + [AV_PIX_FMT_YAF16LE] = { + .name = "yaf16le", + .nb_components = 2, + .log2_chroma_w = 0, + .log2_chroma_h = 0, + .comp = { + { 0, 4, 0, 0, 16 }, /* Y */ + { 0, 4, 2, 0, 16 }, /* A */ + }, + .flags = AV_PIX_FMT_FLAG_FLOAT | AV_PIX_FMT_FLAG_ALPHA, + }, [AV_PIX_FMT_YUVA422P12BE] = { .name = "yuva422p12be", .nb_components = 4, @@ -2996,6 +3263,10 @@ }, .flags = AV_PIX_FMT_FLAG_BE, }, + [AV_PIX_FMT_OHCODEC] = { + .name = "ohcodec", + .flags = AV_PIX_FMT_FLAG_HWACCEL, + }, }; static const char * const color_range_names[] = { @@ -3021,6 +3292,11 @@ [AVCOL_PRI_EBU3213] = "ebu3213", }; +static const char * const color_primaries_names_ext[AVCOL_PRI_EXT_NB - + AVCOL_PRI_EXT_BASE] = { + [AVCOL_PRI_V_GAMUT - AVCOL_PRI_EXT_BASE] = "vgamut", +}; + static const char * const color_transfer_names[] = { [AVCOL_TRC_RESERVED0] = "reserved", [AVCOL_TRC_BT709] = "bt709", @@ -3043,6 +3319,10 @@ [AVCOL_TRC_ARIB_STD_B67] = "arib-std-b67", }; +static const char * const color_transfer_names_ext[] = { + [AVCOL_TRC_V_LOG - AVCOL_TRC_EXT_BASE] = "vlog", +}; + static const char * const color_space_names[] = { [AVCOL_SPC_RGB] = "gbr", [AVCOL_SPC_BT709] = "bt709", @@ -3074,6 +3354,12 @@ [AVCHROMA_LOC_BOTTOM] = "bottom", }; +static const char * const alpha_mode_names[] = { + [AVALPHA_MODE_UNSPECIFIED] = "unspecified", + [AVALPHA_MODE_PREMULTIPLIED] = "premultiplied", + [AVALPHA_MODE_STRAIGHT] = "straight", +}; + static enum AVPixelFormat get_pix_fmt_internal(const char *name) { enum AVPixelFormat pix_fmt; @@ -3503,8 +3789,12 @@ const char *av_color_primaries_name(enum AVColorPrimaries primaries) { - return (unsigned) primaries < AVCOL_PRI_NB ? - color_primaries_names[primaries] : NULL; + if ((unsigned)primaries < AVCOL_PRI_NB) + return color_primaries_names[primaries]; + else if (((unsigned)primaries >= AVCOL_PRI_EXT_BASE) && + ((unsigned)primaries < AVCOL_PRI_EXT_NB)) + return color_primaries_names_ext[primaries - AVCOL_TRC_EXT_BASE]; + return NULL; } int av_color_primaries_from_name(const char *name) @@ -3519,13 +3809,25 @@ return i; } + for (i = 0; i < FF_ARRAY_ELEMS(color_primaries_names_ext); i++) { + if (!color_primaries_names_ext[i]) + continue; + + if (av_strstart(name, color_primaries_names_ext[i], NULL)) + return AVCOL_PRI_EXT_BASE + i; + } + return AVERROR(EINVAL); } const char *av_color_transfer_name(enum AVColorTransferCharacteristic transfer) { - return (unsigned) transfer < AVCOL_TRC_NB ? - color_transfer_names[transfer] : NULL; + if ((unsigned)transfer < AVCOL_TRC_NB) + return color_transfer_names[transfer]; + else if (((unsigned)transfer >= AVCOL_TRC_EXT_BASE) && + ((unsigned)transfer < AVCOL_TRC_EXT_NB)) + return color_transfer_names_ext[transfer - AVCOL_TRC_EXT_BASE]; + return NULL; } int av_color_transfer_from_name(const char *name) @@ -3540,6 +3842,14 @@ return i; } + for (i = 0; i < FF_ARRAY_ELEMS(color_transfer_names_ext); i++) { + if (!color_transfer_names_ext[i]) + continue; + + if (av_strstart(name, color_transfer_names_ext[i], NULL)) + return AVCOL_TRC_EXT_BASE + i; + } + return AVERROR(EINVAL); } @@ -3607,3 +3917,22 @@ } return AVCHROMA_LOC_UNSPECIFIED; } + +const char *av_alpha_mode_name(enum AVAlphaMode mode) +{ + return (unsigned) mode < AVALPHA_MODE_NB ? + alpha_mode_names[mode] : NULL; +} + +enum AVAlphaMode av_alpha_mode_from_name(const char *name) +{ + for (int i = 0; i < FF_ARRAY_ELEMS(alpha_mode_names); i++) { + if (!alpha_mode_names[i]) + continue; + + if (av_strstart(name, alpha_mode_names[i], NULL)) + return i; + } + + return AVERROR(EINVAL); +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/pixdesc.h thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/pixdesc.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/pixdesc.h 2026-04-29 18:38:25.000000000 +0000 @@ -292,6 +292,16 @@ enum AVChromaLocation av_chroma_location_pos_to_enum(int xpos, int ypos); /** + * @return the name for provided alpha mode or NULL if unknown. + */ +const char *av_alpha_mode_name(enum AVAlphaMode mode); + +/** + * @return the AVAlphaMode value for name or an AVError if not found. + */ +enum AVAlphaMode av_alpha_mode_from_name(const char *name); + +/** * Return the pixel format corresponding to name. * * If there is no pixel format with name name, then looks for a diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/pixelutils.c thunderbird-140.10.1esr/media/ffvpx/libavutil/pixelutils.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/pixelutils.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/pixelutils.c 2026-04-29 18:38:25.000000000 +0000 @@ -28,7 +28,17 @@ #include "attributes.h" #include "macros.h" +#if ARCH_AARCH64 && HAVE_NEON +#include "aarch64/pixelutils.h" +#elif ARCH_ARM && HAVE_ARMV6 +#include "arm/pixelutils.h" +#elif ARCH_MIPS && HAVE_MSA +#include "mips/pixelutils.h" +#elif ARCH_RISCV +#include "riscv/pixelutils.h" +#elif ARCH_X86 && HAVE_X86ASM #include "x86/pixelutils.h" +#endif static av_always_inline int sad_wxh(const uint8_t *src1, ptrdiff_t stride1, const uint8_t *src2, ptrdiff_t stride2, @@ -86,7 +96,15 @@ if (w_bits != h_bits) // only squared sad for now return NULL; -#if ARCH_X86 +#if ARCH_AARCH64 && HAVE_NEON + ff_pixelutils_sad_init_aarch64(sad, aligned); +#elif ARCH_ARM + ff_pixelutils_sad_init_arm(sad, aligned); +#elif ARCH_MIPS && HAVE_MSA + ff_pixelutils_sad_init_mips(sad, aligned); +#elif ARCH_RISCV + ff_pixelutils_init_riscv(sad, aligned); +#elif ARCH_X86 && HAVE_X86ASM ff_pixelutils_sad_init_x86(sad, aligned); #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/pixfmt.h thunderbird-140.10.1esr/media/ffvpx/libavutil/pixfmt.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/pixfmt.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/pixfmt.h 2026-04-29 18:38:25.000000000 +0000 @@ -463,6 +463,42 @@ AV_PIX_FMT_XV48BE, ///< packed XVYU 4:4:4, 64bpp, big-endian, variant of Y416 where alpha channel is left undefined AV_PIX_FMT_XV48LE, ///< packed XVYU 4:4:4, 64bpp, little-endian, variant of Y416 where alpha channel is left undefined + AV_PIX_FMT_GBRPF16BE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, big-endian + AV_PIX_FMT_GBRPF16LE, ///< IEEE-754 half precision planer GBR 4:4:4, 48bpp, little-endian + AV_PIX_FMT_GBRAPF16BE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, big-endian + AV_PIX_FMT_GBRAPF16LE, ///< IEEE-754 half precision planar GBRA 4:4:4:4, 64bpp, little-endian + + AV_PIX_FMT_GRAYF16BE, ///< IEEE-754 half precision Y, 16bpp, big-endian + AV_PIX_FMT_GRAYF16LE, ///< IEEE-754 half precision Y, 16bpp, little-endian + + /** + * HW acceleration through AMF. data[0] contain AMFSurface pointer + */ + AV_PIX_FMT_AMF_SURFACE, + + AV_PIX_FMT_GRAY32BE, ///< Y , 32bpp, big-endian + AV_PIX_FMT_GRAY32LE, ///< Y , 32bpp, little-endian + + AV_PIX_FMT_YAF32BE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, big-endian + AV_PIX_FMT_YAF32LE, ///< IEEE-754 single precision packed YA, 32 bits gray, 32 bits alpha, 64bpp, little-endian + + AV_PIX_FMT_YAF16BE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, big-endian + AV_PIX_FMT_YAF16LE, ///< IEEE-754 half precision packed YA, 16 bits gray, 16 bits alpha, 32bpp, little-endian + + AV_PIX_FMT_GBRAP32BE, ///< planar GBRA 4:4:4:4 128bpp, big-endian + AV_PIX_FMT_GBRAP32LE, ///< planar GBRA 4:4:4:4 128bpp, little-endian + + AV_PIX_FMT_YUV444P10MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian + AV_PIX_FMT_YUV444P10MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian + AV_PIX_FMT_YUV444P12MSBBE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, big-endian + AV_PIX_FMT_YUV444P12MSBLE, ///< planar YUV 4:4:4, 30bpp, (1 Cr & Cb sample per 1x1 Y samples), lowest bits zero, little-endian + AV_PIX_FMT_GBRP10MSBBE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, big-endian + AV_PIX_FMT_GBRP10MSBLE, ///< planar GBR 4:4:4 30bpp, lowest bits zero, little-endian + AV_PIX_FMT_GBRP12MSBBE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, big-endian + AV_PIX_FMT_GBRP12MSBLE, ///< planar GBR 4:4:4 36bpp, lowest bits zero, little-endian + + AV_PIX_FMT_OHCODEC, /// hardware decoding through openharmony + AV_PIX_FMT_NB ///< number of pixel formats, DO NOT USE THIS if you want to link with shared libav* because the number of formats might differ between versions }; @@ -484,6 +520,7 @@ #define AV_PIX_FMT_GRAY12 AV_PIX_FMT_NE(GRAY12BE, GRAY12LE) #define AV_PIX_FMT_GRAY14 AV_PIX_FMT_NE(GRAY14BE, GRAY14LE) #define AV_PIX_FMT_GRAY16 AV_PIX_FMT_NE(GRAY16BE, GRAY16LE) +#define AV_PIX_FMT_GRAY32 AV_PIX_FMT_NE(GRAY32BE, GRAY32LE) #define AV_PIX_FMT_YA16 AV_PIX_FMT_NE(YA16BE, YA16LE) #define AV_PIX_FMT_RGB48 AV_PIX_FMT_NE(RGB48BE, RGB48LE) #define AV_PIX_FMT_RGB565 AV_PIX_FMT_NE(RGB565BE, RGB565LE) @@ -514,6 +551,9 @@ #define AV_PIX_FMT_YUV422P16 AV_PIX_FMT_NE(YUV422P16BE, YUV422P16LE) #define AV_PIX_FMT_YUV444P16 AV_PIX_FMT_NE(YUV444P16BE, YUV444P16LE) +#define AV_PIX_FMT_YUV444P10MSB AV_PIX_FMT_NE(YUV444P10MSBBE, YUV444P10MSBLE) +#define AV_PIX_FMT_YUV444P12MSB AV_PIX_FMT_NE(YUV444P12MSBBE, YUV444P12MSBLE) + #define AV_PIX_FMT_GBRP9 AV_PIX_FMT_NE(GBRP9BE , GBRP9LE) #define AV_PIX_FMT_GBRP10 AV_PIX_FMT_NE(GBRP10BE, GBRP10LE) #define AV_PIX_FMT_GBRP12 AV_PIX_FMT_NE(GBRP12BE, GBRP12LE) @@ -523,17 +563,27 @@ #define AV_PIX_FMT_GBRAP12 AV_PIX_FMT_NE(GBRAP12BE, GBRAP12LE) #define AV_PIX_FMT_GBRAP14 AV_PIX_FMT_NE(GBRAP14BE, GBRAP14LE) #define AV_PIX_FMT_GBRAP16 AV_PIX_FMT_NE(GBRAP16BE, GBRAP16LE) +#define AV_PIX_FMT_GBRAP32 AV_PIX_FMT_NE(GBRAP32BE, GBRAP32LE) + +#define AV_PIX_FMT_GBRP10MSB AV_PIX_FMT_NE(GBRP10MSBBE, GBRP10MSBLE) +#define AV_PIX_FMT_GBRP12MSB AV_PIX_FMT_NE(GBRP12MSBBE, GBRP12MSBLE) #define AV_PIX_FMT_BAYER_BGGR16 AV_PIX_FMT_NE(BAYER_BGGR16BE, BAYER_BGGR16LE) #define AV_PIX_FMT_BAYER_RGGB16 AV_PIX_FMT_NE(BAYER_RGGB16BE, BAYER_RGGB16LE) #define AV_PIX_FMT_BAYER_GBRG16 AV_PIX_FMT_NE(BAYER_GBRG16BE, BAYER_GBRG16LE) #define AV_PIX_FMT_BAYER_GRBG16 AV_PIX_FMT_NE(BAYER_GRBG16BE, BAYER_GRBG16LE) +#define AV_PIX_FMT_GBRPF16 AV_PIX_FMT_NE(GBRPF16BE, GBRPF16LE) +#define AV_PIX_FMT_GBRAPF16 AV_PIX_FMT_NE(GBRAPF16BE, GBRAPF16LE) #define AV_PIX_FMT_GBRPF32 AV_PIX_FMT_NE(GBRPF32BE, GBRPF32LE) #define AV_PIX_FMT_GBRAPF32 AV_PIX_FMT_NE(GBRAPF32BE, GBRAPF32LE) +#define AV_PIX_FMT_GRAYF16 AV_PIX_FMT_NE(GRAYF16BE, GRAYF16LE) #define AV_PIX_FMT_GRAYF32 AV_PIX_FMT_NE(GRAYF32BE, GRAYF32LE) +#define AV_PIX_FMT_YAF16 AV_PIX_FMT_NE(YAF16BE, YAF16LE) +#define AV_PIX_FMT_YAF32 AV_PIX_FMT_NE(YAF32BE, YAF32LE) + #define AV_PIX_FMT_YUVA420P9 AV_PIX_FMT_NE(YUVA420P9BE , YUVA420P9LE) #define AV_PIX_FMT_YUVA422P9 AV_PIX_FMT_NE(YUVA422P9BE , YUVA422P9LE) #define AV_PIX_FMT_YUVA444P9 AV_PIX_FMT_NE(YUVA444P9BE , YUVA444P9LE) @@ -601,7 +651,12 @@ AVCOL_PRI_SMPTE432 = 12, ///< SMPTE ST 432-1 (2010) / P3 D65 / Display P3 AVCOL_PRI_EBU3213 = 22, ///< EBU Tech. 3213-E (nothing there) / one of JEDEC P22 group phosphors AVCOL_PRI_JEDEC_P22 = AVCOL_PRI_EBU3213, - AVCOL_PRI_NB ///< Not part of ABI + AVCOL_PRI_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_PRI_EXT_BASE = 256, + AVCOL_PRI_V_GAMUT = AVCOL_PRI_EXT_BASE, + AVCOL_PRI_EXT_NB ///< Not part of ABI }; /** @@ -630,7 +685,12 @@ AVCOL_TRC_SMPTE428 = 17, ///< SMPTE ST 428-1 AVCOL_TRC_SMPTEST428_1 = AVCOL_TRC_SMPTE428, AVCOL_TRC_ARIB_STD_B67 = 18, ///< ARIB STD-B67, known as "Hybrid log-gamma" - AVCOL_TRC_NB ///< Not part of ABI + AVCOL_TRC_NB, ///< Not part of ABI + + /* The following entries are not part of H.273, but custom extensions */ + AVCOL_TRC_EXT_BASE = 256, + AVCOL_TRC_V_LOG = AVCOL_TRC_EXT_BASE, + AVCOL_TRC_EXT_NB ///< Not part of ABI }; /** @@ -744,4 +804,14 @@ AVCHROMA_LOC_NB ///< Not part of ABI }; +/** + * Correlation between the alpha channel and color values. + */ +enum AVAlphaMode { + AVALPHA_MODE_UNSPECIFIED = 0, ///< Unknown alpha handling, or no alpha channel + AVALPHA_MODE_PREMULTIPLIED = 1, ///< Alpha channel is multiplied into color values + AVALPHA_MODE_STRAIGHT = 2, ///< Alpha channel is independent of color values + AVALPHA_MODE_NB ///< Not part of ABI +}; + #endif /* AVUTIL_PIXFMT_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/random_seed.c thunderbird-140.10.1esr/media/ffvpx/libavutil/random_seed.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/random_seed.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/random_seed.c 2026-04-29 18:38:25.000000000 +0000 @@ -83,6 +83,7 @@ static uint32_t buffer[512] = { 0 }; unsigned char digest[20]; uint64_t last_i = i; + int repeats[3] = { 0 }; av_assert0(sizeof(tmp) >= av_sha_size); @@ -98,17 +99,45 @@ for (;;) { clock_t t = clock(); - if (last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) >= t) { - last_td = t - last_t; - buffer[i & 511] = 1664525*buffer[i & 511] + 1013904223 + (last_td % 3294638521U); + int incremented_i = 0; + int cur_td = t - last_t; + if (last_t + 2*last_td + (CLOCKS_PER_SEC > 1000) < t) { + // If the timer incremented by more than 2*last_td at once, + // we may e.g. have had a context switch. If the timer resolution + // is high (CLOCKS_PER_SEC > 1000), require that the timer + // incremented by more than 1. If the timer resolution is low, + // it is enough that the timer incremented at all. + buffer[++i & 511] += cur_td % 3294638521U; + incremented_i = 1; + } else if (t != last_t && repeats[0] > 0 && repeats[1] > 0 && + repeats[2] > 0 && repeats[0] != repeats[1] && + repeats[0] != repeats[2]) { + // If the timer resolution is high, and we get the same timer + // value multiple times, use variances in the number of repeats + // of each timer value as entropy. If we get a different number of + // repeats than the last two unique cases, count that as entropy + // and proceed to the next index. + buffer[++i & 511] += (repeats[0] + repeats[1] + repeats[2]) % 3294638521U; + incremented_i = 1; } else { - last_td = t - last_t; - buffer[++i & 511] += last_td % 3294638521U; - if ((t - init_t) >= CLOCKS_PER_SEC>>5) - if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i - last_i > 8) - break; + buffer[i & 511] = 1664525*buffer[i & 511] + 1013904223 + (cur_td % 3294638521U); + } + if (incremented_i && (t - init_t) >= CLOCKS_PER_SEC>>5) { + if (last_i && i - last_i > 4 || i - last_i > 64 || TEST && i - last_i > 8) + break; + } + if (t == last_t) { + repeats[0]++; + } else { + // If we got a new unique number of repeats, update the history. + if (repeats[0] != repeats[1]) { + repeats[2] = repeats[1]; + repeats[1] = repeats[0]; + } + repeats[0] = 0; } last_t = t; + last_td = cur_td; if (!init_t) init_t = t; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/rational.h thunderbird-140.10.1esr/media/ffvpx/libavutil/rational.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/rational.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/rational.h 2026-04-29 18:38:26.000000000 +0000 @@ -22,7 +22,7 @@ /** * @file * @ingroup lavu_math_rational - * Utilties for rational number calculation. + * Utilities for rational number calculation. * @author Michael Niedermayer */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/refstruct.c thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/refstruct.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.c 2026-04-29 18:38:26.000000000 +0000 @@ -45,7 +45,7 @@ #define REFSTRUCT_COOKIE AV_NE((uint64_t)MKBETAG('R', 'e', 'f', 'S') << 32 | MKBETAG('t', 'r', 'u', 'c'), \ MKTAG('R', 'e', 'f', 'S') | (uint64_t)MKTAG('t', 'r', 'u', 'c') << 32) -#if __STDC_VERSION__ >= 201112L && !defined(_MSC_VER) +#ifndef _MSC_VER #define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), FFMAX(ALIGN_64, _Alignof(max_align_t))) #else #define REFCOUNT_OFFSET FFALIGN(sizeof(RefCount), ALIGN_64) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/refstruct.h thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/refstruct.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/refstruct.h 2026-04-29 18:38:26.000000000 +0000 @@ -74,7 +74,7 @@ * the returned object is initially zeroed. * * @param size Desired usable size of the returned object. - * @param flags A bitwise combination of av_refstruct_FLAG_* flags. + * @param flags A bitwise combination of AV_REFSTRUCT_FLAG_* flags. * @param opaque A pointer that will be passed to the free_cb callback. * @param free_cb A callback for freeing this object's content * when its reference count reaches zero; @@ -161,7 +161,7 @@ * * Frequently allocating and freeing large or complicated objects may be slow * and wasteful. This API is meant to solve this in cases when the caller - * needs a set of interchangable objects. + * needs a set of interchangeable objects. * * At the beginning, the user must call allocate the pool via * av_refstruct_pool_alloc() or its analogue av_refstruct_pool_alloc_ext(). @@ -205,7 +205,7 @@ * provided, then free_cb will be called if init_cb fails. * * It will be called after reset_cb in case reset_cb and the - * av_refstruct_POOL_FLAG_RESET_ON_INIT_ERROR flag are also set. + * AV_REFSTRUCT_POOL_FLAG_RESET_ON_INIT_ERROR flag are also set. * * The object passed to free_cb will be in the state left by * the callbacks applied earlier (init_cb potentially followed by reset_cb). @@ -215,7 +215,7 @@ * If this flag is set, the entries will be zeroed before * being returned to the user (after the init or reset callbacks * have been called (if provided)). Furthermore, to avoid zeroing twice - * it also makes the pool behave as if the av_refstruct_POOL_FLAG_NO_ZEROING + * it also makes the pool behave as if the AV_REFSTRUCT_POOL_FLAG_NO_ZEROING * flag had been provided. */ #define AV_REFSTRUCT_POOL_FLAG_ZERO_EVERY_TIME (1 << 18) @@ -229,11 +229,11 @@ * Allocate an AVRefStructPool, potentially using complex callbacks. * * @param size size of the entries of the pool - * @param flags a bitwise combination of av_refstruct_POOL_FLAG_* flags + * @param flags a bitwise combination of AV_REFSTRUCT_POOL_FLAG_* flags * @param opaque A pointer that will be passed to the callbacks below. * @param init A callback that will be called directly after a new entry * has been allocated. obj has already been zeroed unless - * the av_refstruct_POOL_FLAG_NO_ZEROING flag is in use. + * the AV_REFSTRUCT_POOL_FLAG_NO_ZEROING flag is in use. * @param reset A callback that will be called after an entry has been * returned to the pool and before it is reused. * @param free_entry A callback that will be called when an entry is freed diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/samplefmt.h thunderbird-140.10.1esr/media/ffvpx/libavutil/samplefmt.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/samplefmt.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/samplefmt.h 2026-04-29 18:38:26.000000000 +0000 @@ -122,8 +122,7 @@ * @param sample_fmt the number of the sample format to print the * corresponding info string, or a negative value to print the * corresponding header. - * @return the pointer to the filled buffer or NULL if sample_fmt is - * unknown or in case of other errors + * @return the pointer to the filled buffer or NULL in case of other errors */ char *av_get_sample_fmt_string(char *buf, int buf_size, enum AVSampleFormat sample_fmt); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/side_data.c thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/side_data.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.c 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,315 @@ +/* + * 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 "avassert.h" +#include "buffer.h" +#include "common.h" +#include "dict.h" +#include "frame.h" +#include "mem.h" +#include "side_data.h" + +static const AVSideDataDescriptor sd_props[] = { + [AV_FRAME_DATA_PANSCAN] = { "AVPanScan", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_A53_CC] = { "ATSC A53 Part 4 Closed Captions" }, + [AV_FRAME_DATA_MATRIXENCODING] = { "AVMatrixEncoding", AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT }, + [AV_FRAME_DATA_DOWNMIX_INFO] = { "Metadata relevant to a downmix procedure", AV_SIDE_DATA_PROP_CHANNEL_DEPENDENT }, + [AV_FRAME_DATA_AFD] = { "Active format description" }, + [AV_FRAME_DATA_MOTION_VECTORS] = { "Motion vectors", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_SKIP_SAMPLES] = { "Skip samples" }, + [AV_FRAME_DATA_GOP_TIMECODE] = { "GOP timecode" }, + [AV_FRAME_DATA_S12M_TIMECODE] = { "SMPTE 12-1 timecode" }, + [AV_FRAME_DATA_DYNAMIC_HDR_PLUS] = { "HDR Dynamic Metadata SMPTE2094-40 (HDR10+)", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_DYNAMIC_HDR_VIVID] = { "HDR Dynamic Metadata CUVA 005.1 2021 (Vivid)", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_REGIONS_OF_INTEREST] = { "Regions Of Interest", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_VIDEO_ENC_PARAMS] = { "Video encoding parameters" }, + [AV_FRAME_DATA_FILM_GRAIN_PARAMS] = { "Film grain parameters" }, + [AV_FRAME_DATA_DETECTION_BBOXES] = { "Bounding boxes for object detection and classification", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_DOVI_RPU_BUFFER] = { "Dolby Vision RPU Data", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_DOVI_METADATA] = { "Dolby Vision Metadata", AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_LCEVC] = { "LCEVC NAL data", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_VIEW_ID] = { "View ID" }, + [AV_FRAME_DATA_STEREO3D] = { "Stereo 3D", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_REPLAYGAIN] = { "AVReplayGain", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_DISPLAYMATRIX] = { "3x3 displaymatrix", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_AUDIO_SERVICE_TYPE] = { "Audio service type", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_MASTERING_DISPLAY_METADATA] = { "Mastering display metadata", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_CONTENT_LIGHT_LEVEL] = { "Content light level metadata", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_AMBIENT_VIEWING_ENVIRONMENT] = { "Ambient viewing environment", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_SPHERICAL] = { "Spherical Mapping", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_ICC_PROFILE] = { "ICC profile", AV_SIDE_DATA_PROP_GLOBAL | AV_SIDE_DATA_PROP_COLOR_DEPENDENT }, + [AV_FRAME_DATA_EXIF] = { "EXIF metadata", AV_SIDE_DATA_PROP_GLOBAL }, + [AV_FRAME_DATA_SEI_UNREGISTERED] = { "H.26[45] User Data Unregistered SEI message", AV_SIDE_DATA_PROP_MULTI }, + [AV_FRAME_DATA_VIDEO_HINT] = { "Encoding video hint", AV_SIDE_DATA_PROP_SIZE_DEPENDENT }, + [AV_FRAME_DATA_3D_REFERENCE_DISPLAYS] = { "3D Reference Displays Information", AV_SIDE_DATA_PROP_GLOBAL }, +}; + +const AVSideDataDescriptor *av_frame_side_data_desc(enum AVFrameSideDataType type) +{ + unsigned t = type; + if (t < FF_ARRAY_ELEMS(sd_props) && sd_props[t].name) + return &sd_props[t]; + return NULL; +} + +const char *av_frame_side_data_name(enum AVFrameSideDataType type) +{ + const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); + return desc ? desc->name : NULL; +} + +static void free_side_data_entry(AVFrameSideData **ptr_sd) +{ + AVFrameSideData *sd = *ptr_sd; + + av_buffer_unref(&sd->buf); + av_dict_free(&sd->metadata); + av_freep(ptr_sd); +} + +static void remove_side_data_by_entry(AVFrameSideData ***sd, int *nb_sd, + const AVFrameSideData *target) +{ + for (int i = *nb_sd - 1; i >= 0; i--) { + AVFrameSideData *entry = ((*sd)[i]); + if (entry != target) + continue; + + free_side_data_entry(&entry); + + ((*sd)[i]) = ((*sd)[*nb_sd - 1]); + (*nb_sd)--; + + return; + } +} + +void av_frame_side_data_remove(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type) +{ + for (int i = *nb_sd - 1; i >= 0; i--) { + AVFrameSideData *entry = ((*sd)[i]); + if (entry->type != type) + continue; + + free_side_data_entry(&entry); + + ((*sd)[i]) = ((*sd)[*nb_sd - 1]); + (*nb_sd)--; + } +} + +void av_frame_side_data_remove_by_props(AVFrameSideData ***sd, int *nb_sd, + int props) +{ + for (int i = *nb_sd - 1; i >= 0; i--) { + AVFrameSideData *entry = ((*sd)[i]); + const AVSideDataDescriptor *desc = av_frame_side_data_desc(entry->type); + if (!desc || !(desc->props & props)) + continue; + + free_side_data_entry(&entry); + + ((*sd)[i]) = ((*sd)[*nb_sd - 1]); + (*nb_sd)--; + } +} + +void av_frame_side_data_free(AVFrameSideData ***sd, int *nb_sd) +{ + for (int i = 0; i < *nb_sd; i++) + free_side_data_entry(&((*sd)[i])); + *nb_sd = 0; + + av_freep(sd); +} + +static AVFrameSideData *add_side_data_from_buf_ext(AVFrameSideData ***sd, + int *nb_sd, + enum AVFrameSideDataType type, + AVBufferRef *buf, uint8_t *data, + size_t size) +{ + AVFrameSideData *ret, **tmp; + + // *nb_sd + 1 needs to fit into an int and a size_t. + if ((unsigned)*nb_sd >= FFMIN(INT_MAX, SIZE_MAX)) + return NULL; + + tmp = av_realloc_array(*sd, *nb_sd + 1, sizeof(**sd)); + if (!tmp) + return NULL; + *sd = tmp; + + ret = av_mallocz(sizeof(*ret)); + if (!ret) + return NULL; + + ret->buf = buf; + ret->data = data; + ret->size = size; + ret->type = type; + + (*sd)[(*nb_sd)++] = ret; + + return ret; +} + +AVFrameSideData *ff_frame_side_data_add_from_buf(AVFrameSideData ***sd, + int *nb_sd, + enum AVFrameSideDataType type, + AVBufferRef *buf) +{ + if (!buf) + return NULL; + + return add_side_data_from_buf_ext(sd, nb_sd, type, buf, buf->data, buf->size); +} + +static AVFrameSideData *replace_side_data_from_buf(AVFrameSideData *dst, + AVBufferRef *buf, int flags) +{ + if (!(flags & AV_FRAME_SIDE_DATA_FLAG_REPLACE)) + return NULL; + + av_dict_free(&dst->metadata); + av_buffer_unref(&dst->buf); + dst->buf = buf; + dst->data = buf->data; + dst->size = buf->size; + return dst; +} + +AVFrameSideData *av_frame_side_data_new(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type, + size_t size, unsigned int flags) +{ + const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); + AVBufferRef *buf = av_buffer_alloc(size); + AVFrameSideData *ret = NULL; + + if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) + av_frame_side_data_remove(sd, nb_sd, type); + if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && + (ret = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { + ret = replace_side_data_from_buf(ret, buf, flags); + if (!ret) + av_buffer_unref(&buf); + return ret; + } + + ret = ff_frame_side_data_add_from_buf(sd, nb_sd, type, buf); + if (!ret) + av_buffer_unref(&buf); + + return ret; +} + +AVFrameSideData *av_frame_side_data_add(AVFrameSideData ***sd, int *nb_sd, + enum AVFrameSideDataType type, + AVBufferRef **pbuf, unsigned int flags) +{ + const AVSideDataDescriptor *desc = av_frame_side_data_desc(type); + AVFrameSideData *sd_dst = NULL; + AVBufferRef *buf = *pbuf; + + if ((flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF) && !(buf = av_buffer_ref(*pbuf))) + return NULL; + if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) + av_frame_side_data_remove(sd, nb_sd, type); + if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && + (sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, type))) { + sd_dst = replace_side_data_from_buf(sd_dst, buf, flags); + } else + sd_dst = ff_frame_side_data_add_from_buf(sd, nb_sd, type, buf); + + if (sd_dst && !(flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) + *pbuf = NULL; + else if (!sd_dst && (flags & AV_FRAME_SIDE_DATA_FLAG_NEW_REF)) + av_buffer_unref(&buf); + return sd_dst; +} + +int av_frame_side_data_clone(AVFrameSideData ***sd, int *nb_sd, + const AVFrameSideData *src, unsigned int flags) +{ + const AVSideDataDescriptor *desc; + AVBufferRef *buf = NULL; + AVFrameSideData *sd_dst = NULL; + int ret = AVERROR_BUG; + + if (!sd || !src || !nb_sd || (*nb_sd && !*sd)) + return AVERROR(EINVAL); + + desc = av_frame_side_data_desc(src->type); + if (flags & AV_FRAME_SIDE_DATA_FLAG_UNIQUE) + av_frame_side_data_remove(sd, nb_sd, src->type); + if ((!desc || !(desc->props & AV_SIDE_DATA_PROP_MULTI)) && + (sd_dst = (AVFrameSideData *)av_frame_side_data_get(*sd, *nb_sd, src->type))) { + AVDictionary *dict = NULL; + + if (!(flags & AV_FRAME_SIDE_DATA_FLAG_REPLACE)) + return AVERROR(EEXIST); + + ret = av_dict_copy(&dict, src->metadata, 0); + if (ret < 0) + return ret; + + ret = av_buffer_replace(&sd_dst->buf, src->buf); + if (ret < 0) { + av_dict_free(&dict); + return ret; + } + + av_dict_free(&sd_dst->metadata); + sd_dst->metadata = dict; + sd_dst->data = src->data; + sd_dst->size = src->size; + return 0; + } + + buf = av_buffer_ref(src->buf); + if (!buf) + return AVERROR(ENOMEM); + + sd_dst = add_side_data_from_buf_ext(sd, nb_sd, src->type, buf, + src->data, src->size); + if (!sd_dst) { + av_buffer_unref(&buf); + return AVERROR(ENOMEM); + } + + ret = av_dict_copy(&sd_dst->metadata, src->metadata, 0); + if (ret < 0) { + remove_side_data_by_entry(sd, nb_sd, sd_dst); + return ret; + } + + return 0; +} + +const AVFrameSideData *av_frame_side_data_get_c(const AVFrameSideData * const *sd, + const int nb_sd, + enum AVFrameSideDataType type) +{ + for (int i = 0; i < nb_sd; i++) { + if (sd[i]->type == type) + return sd[i]; + } + return NULL; +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/side_data.h thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/side_data.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/side_data.h 2026-04-29 18:38:25.000000000 +0000 @@ -0,0 +1,30 @@ +/* + * 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 + */ + +#ifndef AVUTIL_SIDE_DATA_H +#define AVUTIL_SIDE_DATA_H + +#include "buffer.h" +#include "frame.h" + +AVFrameSideData *ff_frame_side_data_add_from_buf(AVFrameSideData ***sd, + int *nb_sd, + enum AVFrameSideDataType type, + AVBufferRef *buf); + +#endif // AVUTIL_SIDE_DATA_H diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/slicethread.c thunderbird-140.10.1esr/media/ffvpx/libavutil/slicethread.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/slicethread.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/slicethread.c 2026-04-29 18:38:25.000000000 +0000 @@ -95,6 +95,7 @@ } } +av_cold int avpriv_slicethread_create(AVSliceThread **pctx, void *priv, void (*worker_func)(void *priv, int jobnr, int threadnr, int nb_jobs, int nb_threads), void (*main_func)(void *priv), @@ -152,7 +153,6 @@ for (i = 0; i < nb_workers; i++) { WorkerContext *w = &ctx->workers[i]; - int ret; w->ctx = ctx; ret = pthread_mutex_init(&w->mutex, NULL); if (ret) { @@ -222,15 +222,14 @@ } } -void avpriv_slicethread_free(AVSliceThread **pctx) +av_cold void avpriv_slicethread_free(AVSliceThread **pctx) { - AVSliceThread *ctx; + AVSliceThread *ctx = *pctx; int nb_workers, i; - if (!pctx || !*pctx) + if (!ctx) return; - ctx = *pctx; nb_workers = ctx->nb_threads; if (!ctx->main_func) nb_workers--; diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/stereo3d.c thunderbird-140.10.1esr/media/ffvpx/libavutil/stereo3d.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/stereo3d.c 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/stereo3d.c 2026-04-29 18:38:25.000000000 +0000 @@ -20,7 +20,6 @@ #include -#include "avstring.h" #include "frame.h" #include "macros.h" #include "mem.h" @@ -103,7 +102,7 @@ int i; for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_type_names); i++) { - if (av_strstart(name, stereo3d_type_names[i], NULL)) + if (!strcmp(name, stereo3d_type_names[i])) return i; } @@ -123,7 +122,7 @@ int i; for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_view_names); i++) { - if (av_strstart(name, stereo3d_view_names[i], NULL)) + if (!strcmp(name, stereo3d_view_names[i])) return i; } @@ -143,7 +142,7 @@ int i; for (i = 0; i < FF_ARRAY_ELEMS(stereo3d_primary_eye_names); i++) { - if (av_strstart(name, stereo3d_primary_eye_names[i], NULL)) + if (!strcmp(name, stereo3d_primary_eye_names[i])) return i; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/thread.h thunderbird-140.10.1esr/media/ffvpx/libavutil/thread.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/thread.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/thread.h 2026-04-29 18:38:25.000000000 +0000 @@ -229,6 +229,8 @@ #endif #elif HAVE_PTHREAD_SET_NAME_NP pthread_set_name_np(pthread_self(), name); +#elif HAVE_W32THREADS + ret = win32_thread_setname(name); #else ret = AVERROR(ENOSYS); #endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode.c thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode.c 2026-04-29 18:38:26.000000000 +0000 @@ -29,6 +29,7 @@ #include #include "common.h" #include "timecode.h" +#include "timecode_internal.h" #include "log.h" #include "error.h" @@ -102,7 +103,7 @@ char *av_timecode_make_string(const AVTimecode *tc, char *buf, int framenum_arg) { - int fps = tc->fps; + unsigned fps = tc->fps; int drop = tc->flags & AV_TIMECODE_FLAG_DROPFRAME; int hh, mm, ss, ff, ff_len, neg = 0; int64_t framenum = framenum_arg; @@ -127,32 +128,10 @@ return buf; } -static unsigned bcd2uint(uint8_t bcd) -{ - unsigned low = bcd & 0xf; - unsigned high = bcd >> 4; - if (low > 9 || high > 9) - return 0; - return low + 10*high; -} - char *av_timecode_make_smpte_tc_string2(char *buf, AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field) { - unsigned hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours - unsigned mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes - unsigned ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds - unsigned ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames - unsigned drop = tcsmpte & 1<<30 && !prevent_df; // 1-bit drop if not arbitrary bit - - if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { - ff <<= 1; - if (!skip_field) { - if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) - ff += !!(tcsmpte & 1 << 7); - else - ff += !!(tcsmpte & 1 << 23); - } - } + unsigned hh, mm, ss, ff, drop; + ff_timecode_set_smpte(&drop, &hh, &mm, &ss, &ff, rate, tcsmpte, prevent_df, skip_field); snprintf(buf, AV_TIMECODE_STR_SIZE, "%02u:%02u:%02u%c%02u", hh, mm, ss, drop ? ';' : ':', ff); @@ -232,6 +211,7 @@ int av_timecode_init_from_components(AVTimecode *tc, AVRational rate, int flags, int hh, int mm, int ss, int ff, void *log_ctx) { int ret; + int64_t s; memset(tc, 0, sizeof(*tc)); tc->flags = flags; @@ -242,7 +222,15 @@ if (ret < 0) return ret; - tc->start = (hh*3600 + mm*60 + ss) * tc->fps + ff; + s = hh*3600LL + mm*60LL + ss; + if (s != (int32_t)s) + return AVERROR(EINVAL); + + s = s * tc->fps + ff; + if (s != (int32_t)s) + return AVERROR(EINVAL); + tc->start = s; + if (tc->flags & AV_TIMECODE_FLAG_DROPFRAME) { /* adjust frame number */ int tmins = 60*hh + mm; tc->start -= (tc->fps / 30 * 2) * (tmins - tmins/10); diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode_internal.c thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode_internal.c 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.c 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier + * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch + * + * 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 "timecode_internal.h" + +static unsigned bcd2uint(uint8_t bcd) +{ + unsigned low = bcd & 0xf; + unsigned high = bcd >> 4; + if (low > 9 || high > 9) + return 0; + return low + 10*high; +} + +void ff_timecode_set_smpte(unsigned *drop, unsigned *hh, unsigned *mm, unsigned *ss, unsigned *ff, + AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field) +{ + *hh = bcd2uint(tcsmpte & 0x3f); // 6-bit hours + *mm = bcd2uint(tcsmpte>>8 & 0x7f); // 7-bit minutes + *ss = bcd2uint(tcsmpte>>16 & 0x7f); // 7-bit seconds + *ff = bcd2uint(tcsmpte>>24 & 0x3f); // 6-bit frames + *drop = tcsmpte & 1<<30 && !prevent_df; // 1-bit drop if not arbitrary bit + + if (av_cmp_q(rate, (AVRational) {30, 1}) == 1) { + *ff <<= 1; + if (!skip_field) { + if (av_cmp_q(rate, (AVRational) {50, 1}) == 0) + *ff += !!(tcsmpte & 1 << 7); + else + *ff += !!(tcsmpte & 1 << 23); + } + } +} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode_internal.h thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/timecode_internal.h 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/timecode_internal.h 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2006 Smartjog S.A.S, Baptiste Coudurier + * Copyright (c) 2011-2012 Smartjog S.A.S, Clément Bœsch + * + * 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 + */ + +/** + * @file + * Timecode helpers header + */ + +#ifndef AVUTIL_TIMECODE_INTERNAL_H +#define AVUTIL_TIMECODE_INTERNAL_H + +#include +#include "rational.h" + +/** + * Convert SMPTE 12M binary representation to sei info. + * + * @param drop drop flag output + * @param hh hour output + * @param mm minute output + * @param ss second output + * @param ff frame number output + * @param rate frame rate of the timecode + * @param tcsmpte the 32-bit SMPTE timecode + * @param prevent_df prevent the use of a drop flag when it is known the DF bit + * is arbitrary + * @param skip_field prevent the use of a field flag when it is known the field + * bit is arbitrary (e.g. because it is used as PC flag) + */ +void ff_timecode_set_smpte(unsigned *drop, unsigned *hh, unsigned *mm, unsigned *ss, unsigned *ff, + AVRational rate, uint32_t tcsmpte, int prevent_df, int skip_field); + +#endif /* AVUTIL_TIMECODE_INTERNAL_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/tx.c thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/tx.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.c 2026-04-29 18:38:25.000000000 +0000 @@ -284,7 +284,7 @@ * ff_tx_init_subtx() call is made. */ s->nb_sub = 0; s->opaque = NULL; - memset(s->fn, 0, sizeof(*s->fn)); + memset(s->fn, 0, sizeof(s->fn)); } void ff_tx_clear_ctx(AVTXContext *s) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/tx.h thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/tx.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/tx.h 2026-04-29 18:38:25.000000000 +0000 @@ -50,7 +50,7 @@ /** * Standard MDCT with a sample data type of float, double or int32_t, - * respecively. For the float and int32 variants, the scale type is + * respectively. For the float and int32 variants, the scale type is * 'float', while for the double variant, it's 'double'. * If scale is NULL, 1.0 will be used as a default. * diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/tx_template.c thunderbird-140.10.1esr/media/ffvpx/libavutil/tx_template.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/tx_template.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/tx_template.c 2026-04-29 18:38:26.000000000 +0000 @@ -45,10 +45,6 @@ SR_TABLE(32768) \ SR_TABLE(65536) \ SR_TABLE(131072) \ - SR_TABLE(262144) \ - SR_TABLE(524288) \ - SR_TABLE(1048576) \ - SR_TABLE(2097152) \ #define SR_TABLE(len) \ TABLE_DEF(len, len/4 + 1); @@ -724,10 +720,6 @@ DECL_SR_CODELET(32768,16384,8192) DECL_SR_CODELET(65536,32768,16384) DECL_SR_CODELET(131072,65536,32768) -DECL_SR_CODELET(262144,131072,65536) -DECL_SR_CODELET(524288,262144,131072) -DECL_SR_CODELET(1048576,524288,262144) -DECL_SR_CODELET(2097152,1048576,524288) static av_cold int TX_NAME(ff_tx_fft_init)(AVTXContext *s, const FFTXCodelet *cd, @@ -1031,7 +1023,7 @@ break; } - /* If nothing was sucessful, error out */ + /* If nothing was successful, error out */ if (ret < 0) return ret; @@ -2160,10 +2152,6 @@ &TX_NAME(ff_tx_fft32768_ns_def), &TX_NAME(ff_tx_fft65536_ns_def), &TX_NAME(ff_tx_fft131072_ns_def), - &TX_NAME(ff_tx_fft262144_ns_def), - &TX_NAME(ff_tx_fft524288_ns_def), - &TX_NAME(ff_tx_fft1048576_ns_def), - &TX_NAME(ff_tx_fft2097152_ns_def), /* Prime factor codelets */ &TX_NAME(ff_tx_fft3_ns_def), diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/utils.c thunderbird-140.10.1esr/media/ffvpx/libavutil/utils.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/utils.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/utils.c 2026-04-29 18:38:26.000000000 +0000 @@ -99,7 +99,7 @@ { return (AVRational){1, AV_TIME_BASE}; } - +#if FF_API_ASSERT_FPU void av_assert0_fpu(void) { #if HAVE_MMX_INLINE uint16_t state[14]; @@ -112,3 +112,4 @@ av_assert0((state[4] & 3) == 3); #endif } +#endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/version.h thunderbird-140.10.1esr/media/ffvpx/libavutil/version.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/version.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/version.h 2026-04-29 18:38:26.000000000 +0000 @@ -35,7 +35,7 @@ * Useful to check and match library version in order to maintain * backward compatibility. * - * The FFmpeg libraries follow a versioning sheme very similar to + * The FFmpeg libraries follow a versioning scheme very similar to * Semantic Versioning (http://semver.org/) * The difference is that the component called PATCH is called MICRO in FFmpeg * and its value is reset to 100 instead of 0 to keep it above or equal to 100. @@ -72,15 +72,15 @@ /** * @defgroup lavu_ver Version and Build diagnostics * - * Macros and function useful to check at compiletime and at runtime + * Macros and function useful to check at compile time and at runtime * which version of libavutil is in use. * * @{ */ -#define LIBAVUTIL_VERSION_MAJOR 59 -#define LIBAVUTIL_VERSION_MINOR 54 -#define LIBAVUTIL_VERSION_MICRO 101 +#define LIBAVUTIL_VERSION_MAJOR 60 +#define LIBAVUTIL_VERSION_MINOR 30 +#define LIBAVUTIL_VERSION_MICRO 100 #define LIBAVUTIL_VERSION_INT AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ LIBAVUTIL_VERSION_MINOR, \ @@ -105,18 +105,15 @@ * @{ */ -#define FF_API_HDR_VIVID_THREE_SPLINE (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_FRAME_PKT (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_INTERLACED_FRAME (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_FRAME_KEY (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_PALETTE_HAS_CHANGED (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_VULKAN_CONTIGUOUS_MEMORY (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_H274_FILM_GRAIN_VCS (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 60) -#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 60) +#define FF_API_MOD_UINTP2 (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_RISCV_FD_ZBA (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_FIXED_QUEUES (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_OPT_INT_LIST (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_OPT_PTR (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_CPU_FLAG_FORCE (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_DOVI_L11_INVALID_PROPS (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_ASSERT_FPU (LIBAVUTIL_VERSION_MAJOR < 61) +#define FF_API_VULKAN_SYNC_QUEUES (LIBAVUTIL_VERSION_MAJOR < 62) /** * @} diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/asm.h thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/asm.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/asm.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/asm.h 2026-04-29 18:38:26.000000000 +0000 @@ -38,8 +38,7 @@ # define FF_PTR_SIZE "8" typedef int64_t x86_reg; -/* FF_REG_SP is defined in Solaris sys headers, so use FF_REG_sp */ -# define FF_REG_sp "rsp" +# define FF_REG_SP "rsp" # define FF_REG_BP "rbp" # define FF_REGBP rbp # define FF_REGa rax @@ -60,7 +59,7 @@ # define FF_PTR_SIZE "4" typedef int32_t x86_reg; -# define FF_REG_sp "esp" +# define FF_REG_SP "esp" # define FF_REG_BP "ebp" # define FF_REGBP ebp # define FF_REGa eax diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/cpu.c thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/cpu.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.c 2026-04-29 18:38:25.000000000 +0000 @@ -121,6 +121,8 @@ rval |= AV_CPU_FLAG_SSE2; if (ecx & 1) rval |= AV_CPU_FLAG_SSE3; + if (ecx & 0x2) + rval |= AV_CPU_FLAG_CLMUL; if (ecx & 0x00000200 ) rval |= AV_CPU_FLAG_SSSE3; if (ecx & 0x00080000 ) @@ -244,8 +246,9 @@ family == 6 && model < 23) rval |= AV_CPU_FLAG_SSSE3SLOW; - /* Haswell has slow gather */ - if ((rval & AV_CPU_FLAG_AVX2) && family == 6 && model < 70) + /* Ice Lake and below have slow gather due to Gather Data Sampling + * mitigation. */ + if ((rval & AV_CPU_FLAG_AVX2) && family == 6 && model < 143) rval |= AV_CPU_FLAG_SLOW_GATHER; } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/cpu.h thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/cpu.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/cpu.h 2026-04-29 18:38:25.000000000 +0000 @@ -22,11 +22,6 @@ #include "libavutil/cpu.h" #include "libavutil/cpu_internal.h" -#define AV_CPU_FLAG_AMD3DNOW AV_CPU_FLAG_3DNOW -#define AV_CPU_FLAG_AMD3DNOWEXT AV_CPU_FLAG_3DNOWEXT - -#define X86_AMD3DNOW(flags) CPUEXT(flags, AMD3DNOW) -#define X86_AMD3DNOWEXT(flags) CPUEXT(flags, AMD3DNOWEXT) #define X86_MMX(flags) CPUEXT(flags, MMX) #define X86_MMXEXT(flags) CPUEXT(flags, MMXEXT) #define X86_SSE(flags) CPUEXT(flags, SSE) @@ -49,10 +44,9 @@ #define X86_FMA4(flags) CPUEXT(flags, FMA4) #define X86_AVX2(flags) CPUEXT(flags, AVX2) #define X86_AESNI(flags) CPUEXT(flags, AESNI) +#define X86_CLMUL(flags) CPUEXT(flags, CLMUL) #define X86_AVX512(flags) CPUEXT(flags, AVX512) -#define EXTERNAL_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOW) -#define EXTERNAL_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AMD3DNOWEXT) #define EXTERNAL_MMX(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMX) #define EXTERNAL_MMXEXT(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, MMXEXT) #define EXTERNAL_SSE(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, SSE) @@ -79,11 +73,10 @@ #define EXTERNAL_AVX2_FAST(flags) CPUEXT_SUFFIX_FAST2(flags, _EXTERNAL, AVX2, AVX) #define EXTERNAL_AVX2_SLOW(flags) CPUEXT_SUFFIX_SLOW2(flags, _EXTERNAL, AVX2, AVX) #define EXTERNAL_AESNI(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AESNI) +#define EXTERNAL_CLMUL(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, CLMUL) #define EXTERNAL_AVX512(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX512) #define EXTERNAL_AVX512ICL(flags) CPUEXT_SUFFIX(flags, _EXTERNAL, AVX512ICL) -#define INLINE_AMD3DNOW(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOW) -#define INLINE_AMD3DNOWEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, AMD3DNOWEXT) #define INLINE_MMX(flags) CPUEXT_SUFFIX(flags, _INLINE, MMX) #define INLINE_MMXEXT(flags) CPUEXT_SUFFIX(flags, _INLINE, MMXEXT) #define INLINE_SSE(flags) CPUEXT_SUFFIX(flags, _INLINE, SSE) diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/intmath.h thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/intmath.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/intmath.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/intmath.h 2026-04-29 18:38:26.000000000 +0000 @@ -66,7 +66,7 @@ #endif /* HAVE_FAST_CLZ */ -#if defined(__GNUC__) +#if defined(__GNUC__) || defined(__clang__) /* Our generic version of av_popcount is faster than GCC's built-in on * CPUs that don't support the popcnt instruction. @@ -81,7 +81,7 @@ #if defined(__BMI2__) -#if AV_GCC_VERSION_AT_LEAST(5,1) +#if AV_GCC_VERSION_AT_LEAST(5,1) || AV_HAS_BUILTIN(__builtin_ia32_bzhi_si) #if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 #define av_zero_extend av_zero_extend_bmi2 static av_always_inline av_const unsigned av_zero_extend_bmi2(unsigned a, unsigned p) @@ -114,68 +114,6 @@ #endif /* __BMI2__ */ -#if defined(__SSE2__) && !defined(__INTEL_COMPILER) - -#define av_clipd av_clipd_sse2 -static av_always_inline av_const double av_clipd_sse2(double a, double amin, double amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("maxsd %1, %0 \n\t" - "minsd %2, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __SSE2__ */ - -#if defined(__SSE__) && !defined(__INTEL_COMPILER) - -#define av_clipf av_clipf_sse -static av_always_inline av_const float av_clipf_sse(float a, float amin, float amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("maxss %1, %0 \n\t" - "minss %2, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __SSE__ */ - -#if defined(__AVX__) && !defined(__INTEL_COMPILER) - -#undef av_clipd -#define av_clipd av_clipd_avx -static av_always_inline av_const double av_clipd_avx(double a, double amin, double amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("vmaxsd %1, %0, %0 \n\t" - "vminsd %2, %0, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#undef av_clipf -#define av_clipf av_clipf_avx -static av_always_inline av_const float av_clipf_avx(float a, float amin, float amax) -{ -#if defined(ASSERT_LEVEL) && ASSERT_LEVEL >= 2 - if (amin > amax) abort(); -#endif - __asm__ ("vmaxss %1, %0, %0 \n\t" - "vminss %2, %0, %0 \n\t" - : "+&x"(a) : "xm"(amin), "xm"(amax)); - return a; -} - -#endif /* __AVX__ */ - #endif /* __GNUC__ */ #endif /* AVUTIL_X86_INTMATH_H */ diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/pixelutils.asm thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils.asm --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/pixelutils.asm 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils.asm 2026-04-29 18:38:26.000000000 +0000 @@ -241,70 +241,24 @@ ; const uint8_t *src2, ptrdiff_t stride2); ;------------------------------------------------------------------------------- INIT_YMM avx2 -cglobal pixelutils_sad_32x32, 4,7,5, src1, stride1, src2, stride2 - pxor m0, m0 - mov r4d, 32/4 - lea r5, [stride1q * 3] - lea r6, [stride2q * 3] - -.loop: - movu m1, [src1q] ; row 0 of pix0 - movu m2, [src2q] ; row 0 of pix1 - movu m3, [src1q + stride1q] ; row 1 of pix0 - movu m4, [src2q + stride2q] ; row 1 of pix1 - - psadbw m1, m2 - psadbw m3, m4 - paddd m0, m1 - paddd m0, m3 - - movu m1, [src1q + 2 * stride1q] ; row 2 of pix0 - movu m2, [src2q + 2 * stride2q] ; row 2 of pix1 - movu m3, [src1q + r5] ; row 3 of pix0 - movu m4, [src2q + r6] ; row 3 of pix1 - - psadbw m1, m2 - psadbw m3, m4 - paddd m0, m1 - paddd m0, m3 - - lea src2q, [src2q + 4 * stride2q] - lea src1q, [src1q + 4 * stride1q] - - dec r4d - jnz .loop - - vextracti128 xm1, m0, 1 - paddd xm0, xm1 - pshufd xm1, xm0, 2 - paddd xm0, xm1 - movd eax, xm0 - RET - -;------------------------------------------------------------------------------- -; int ff_pixelutils_sad_[au]_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1, -; const uint8_t *src2, ptrdiff_t stride2); -;------------------------------------------------------------------------------- -%macro SAD_AVX2_32x32 1 -INIT_YMM avx2 -cglobal pixelutils_sad_%1_32x32, 4,7,3, src1, stride1, src2, stride2 +cglobal pixelutils_sad_32x32, 4,7,3, src1, stride1, src2, stride2 pxor m0, m0 mov r4d, 32/4 lea r5, [stride1q * 3] lea r6, [stride2q * 3] .loop: - mov%1 m1, [src2q] ; row 0 of pix1 + movu m1, [src2q] ; row 0 of pix1 psadbw m1, [src1q] - mov%1 m2, [src2q + stride2q] ; row 1 of pix1 + movu m2, [src2q + stride2q] ; row 1 of pix1 psadbw m2, [src1q + stride1q] paddd m0, m1 paddd m0, m2 - mov%1 m1, [src2q + 2 * stride2q] ; row 2 of pix1 + movu m1, [src2q + 2 * stride2q] ; row 2 of pix1 psadbw m1, [src1q + 2 * stride1q] - mov%1 m2, [src2q + r6] ; row 3 of pix1 + movu m2, [src2q + r6] ; row 3 of pix1 psadbw m2, [src1q + r5] paddd m0, m1 @@ -322,8 +276,4 @@ paddd xm0, xm1 movd eax, xm0 RET -%endmacro - -SAD_AVX2_32x32 a -SAD_AVX2_32x32 u %endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/pixelutils_init.c thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/pixelutils_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/pixelutils_init.c 2026-04-29 18:38:25.000000000 +0000 @@ -40,10 +40,6 @@ int ff_pixelutils_sad_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1, const uint8_t *src2, ptrdiff_t stride2); -int ff_pixelutils_sad_a_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1, - const uint8_t *src2, ptrdiff_t stride2); -int ff_pixelutils_sad_u_32x32_avx2(const uint8_t *src1, ptrdiff_t stride1, - const uint8_t *src2, ptrdiff_t stride2); void ff_pixelutils_sad_init_x86(av_pixelutils_sad_fn *sad, int aligned) { @@ -75,11 +71,9 @@ } } +#if HAVE_AVX2_EXTERNAL if (EXTERNAL_AVX2_FAST(cpu_flags)) { - switch (aligned) { - case 0: sad[4] = ff_pixelutils_sad_32x32_avx2; break; // src1 unaligned, src2 unaligned - case 1: sad[4] = ff_pixelutils_sad_u_32x32_avx2; break; // src1 aligned, src2 unaligned - case 2: sad[4] = ff_pixelutils_sad_a_32x32_avx2; break; // src1 aligned, src2 aligned - } + sad[4] = ff_pixelutils_sad_32x32_avx2; } +#endif } diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/tx_float.asm thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float.asm --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/tx_float.asm 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float.asm 2026-04-29 18:38:25.000000000 +0000 @@ -46,7 +46,7 @@ %endif %assign i 16 -%rep 18 +%rep 14 cextern tab_ %+ i %+ _float ; ff_tab_i_float... %assign i (i << 1) %endrep @@ -1385,11 +1385,7 @@ FFT_SPLIT_RADIX_DEF 16384, .32768pt FFT_SPLIT_RADIX_DEF 32768, .65536pt FFT_SPLIT_RADIX_DEF 65536, .131072pt -FFT_SPLIT_RADIX_DEF 131072, .262144pt -FFT_SPLIT_RADIX_DEF 262144, .524288pt -FFT_SPLIT_RADIX_DEF 524288, .1048576pt -FFT_SPLIT_RADIX_DEF 1048576, .2097152pt -FFT_SPLIT_RADIX_DEF 2097152 +FFT_SPLIT_RADIX_DEF 131072 ;=============================================================================== ; Final synthesis + deinterleaving code diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/tx_float_init.c thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float_init.c --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/tx_float_init.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/tx_float_init.c 2026-04-29 18:38:25.000000000 +0000 @@ -271,15 +271,15 @@ AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), TX_DEF(fft32_ns, FFT, 32, 32, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 256, b8_i2, avx, AVX, 0, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx, AVX, + TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 256, b8_i2, avx, AVX, 0, AV_CPU_FLAG_AVXSLOW), + TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 320, b8_i2, avx, AVX, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 288, b8_i2, fma3, FMA3, 0, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 352, b8_i2, fma3, FMA3, + TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 288, b8_i2, fma3, FMA3, 0, AV_CPU_FLAG_AVXSLOW), + TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 352, b8_i2, fma3, FMA3, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), TX_DEF(fft15, FFT, 15, 15, 15, 0, 320, factor_init, avx2, AVX2, @@ -287,11 +287,11 @@ TX_DEF(fft15_ns, FFT, 15, 15, 15, 0, 384, factor_init, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW), - TX_DEF(fft_sr, FFT, 64, 2097152, 2, 0, 320, b8_i2, avx2, AVX2, 0, + TX_DEF(fft_sr, FFT, 64, 131072, 2, 0, 320, b8_i2, avx2, AVX2, 0, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), - TX_DEF(fft_sr_asm, FFT, 64, 2097152, 2, 0, 384, b8_i2, avx2, AVX2, + TX_DEF(fft_sr_asm, FFT, 64, 131072, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE | FF_TX_ASM_CALL, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), - TX_DEF(fft_sr_ns, FFT, 64, 2097152, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, + TX_DEF(fft_sr_ns, FFT, 64, 131072, 2, 0, 384, b8_i2, avx2, AVX2, AV_TX_INPLACE | FF_TX_PRESHUFFLE, AV_CPU_FLAG_AVXSLOW | AV_CPU_FLAG_SLOW_GATHER), TX_DEF(fft_pfa_15xM, FFT, 60, TX_LEN_UNLIMITED, 15, 2, 320, fft_pfa_init, avx2, AVX2, diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/x86inc.asm thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86inc.asm --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/x86inc.asm 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86inc.asm 2026-04-29 18:38:25.000000000 +0000 @@ -609,7 +609,7 @@ RESET_STACK_STATE %endmacro -%define has_epilogue regs_used > 7 || stack_size > 0 || vzeroupper_required || xmm_regs_used > 6+high_mm_regs +%define has_epilogue (regs_used > 7 || stack_size > 0 || vzeroupper_required || xmm_regs_used > 6+high_mm_regs) %macro RET 0 WIN64_RESTORE_XMM_INTERNAL @@ -658,7 +658,7 @@ %endif %endmacro -%define has_epilogue regs_used > 9 || stack_size > 0 || vzeroupper_required +%define has_epilogue (regs_used > 9 || stack_size > 0 || vzeroupper_required) %macro RET 0 %if stack_size_padded > 0 @@ -722,7 +722,7 @@ %endif %endmacro -%define has_epilogue regs_used > 3 || stack_size > 0 || vzeroupper_required +%define has_epilogue (regs_used > 3 || stack_size > 0 || vzeroupper_required) %macro RET 0 %if stack_size_padded > 0 diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/x86util.asm thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86util.asm --- thunderbird-140.10.0esr/media/ffvpx/libavutil/x86/x86util.asm 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil/x86/x86util.asm 2026-04-29 18:38:25.000000000 +0000 @@ -1022,3 +1022,15 @@ pxor %1, %2 %endif %endmacro + +; NASM panics when emitting CodeView debug info for an empty translation unit. +; GNU binutils `strip` and some other tools such as older MSVC linker also fail +; on such files. Emit a dummy byte in a section with IMAGE_SCN_LNK_REMOVE flag +; to work around these issues. Sections like that are dropped by the linker. +%ifidn __OUTPUT_FORMAT__,win64 + section .x86util info + db 0 +%elifidn __OUTPUT_FORMAT__,win32 + section .x86util info + db 0 +%endif diff -Nru thunderbird-140.10.0esr/media/ffvpx/libavutil_visibility.h thunderbird-140.10.1esr/media/ffvpx/libavutil_visibility.h --- thunderbird-140.10.0esr/media/ffvpx/libavutil_visibility.h 2026-04-21 14:52:57.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/libavutil_visibility.h 2026-04-29 18:38:25.000000000 +0000 @@ -13,6 +13,7 @@ // We need av_log() to be visible so we can enable assertions in libavcodec. #include "libavutil/log.h" +#include "libavutil/internal.h" #include "libavcodec/packet.h" #pragma GCC visibility pop diff -Nru thunderbird-140.10.0esr/media/ffvpx/mediacodec_drm.patch thunderbird-140.10.1esr/media/ffvpx/mediacodec_drm.patch --- thunderbird-140.10.0esr/media/ffvpx/mediacodec_drm.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/mediacodec_drm.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,217 @@ +diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h +--- a/media/ffvpx/libavcodec/avcodec.h ++++ b/media/ffvpx/libavcodec/avcodec.h +@@ -1942,6 +1942,8 @@ typedef struct AVCodecContext { + * - decoding: Set by libavcodec + */ + enum AVAlphaMode alpha_mode; ++ ++ void* moz_ndk_crypto; + } AVCodecContext; + + /** +diff --git a/media/ffvpx/libavcodec/mediacodec_wrapper.c b/media/ffvpx/libavcodec/mediacodec_wrapper.c +--- a/media/ffvpx/libavcodec/mediacodec_wrapper.c ++++ b/media/ffvpx/libavcodec/mediacodec_wrapper.c +@@ -1537,6 +1537,11 @@ fail: + return ret; + } + ++static int mediacodec_jni_queueSecureInputBuffer(FFAMediaCodec* ctx, size_t idx, off_t offset, void* cryptoInfo, uint64_t time, uint32_t flags) ++{ ++ return AVERROR_PATCHWELCOME; ++} ++ + static ssize_t mediacodec_jni_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) + { + int ret = 0; +@@ -1811,6 +1816,7 @@ static const FFAMediaCodec media_codec_jni = { + + .dequeueInputBuffer = mediacodec_jni_dequeueInputBuffer, + .queueInputBuffer = mediacodec_jni_queueInputBuffer, ++ .queueSecureInputBuffer = mediacodec_jni_queueSecureInputBuffer, + + .dequeueOutputBuffer = mediacodec_jni_dequeueOutputBuffer, + .getOutputFormat = mediacodec_jni_getOutputFormat, +@@ -2209,7 +2215,7 @@ static int mediacodec_ndk_configure(FFAMediaCodec* ctx, + return AVERROR_EXTERNAL; + } + } else { +- status = AMediaCodec_configure(codec->impl, format->impl, native_window, NULL, flags); ++ status = AMediaCodec_configure(codec->impl, format->impl, native_window, (AMediaCrypto*)crypto, flags); + if (status != AMEDIA_OK) { + av_log(codec, AV_LOG_ERROR, "Decoder configure failed, %d\n", status); + return AVERROR_EXTERNAL; +@@ -2263,6 +2269,14 @@ static int mediacodec_ndk_queueInputBuffer(FFAMediaCodec *ctx, size_t idx, + return AMediaCodec_queueInputBuffer(codec->impl, idx, offset, size, time, flags); + } + ++static int mediacodec_ndk_queueSecureInputBuffer(FFAMediaCodec *ctx, size_t idx, ++ off_t offset, void* cryptoInfo, ++ uint64_t time, uint32_t flags) ++{ ++ FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; ++ return AMediaCodec_queueSecureInputBuffer(codec->impl, idx, offset, (AMediaCodecCryptoInfo*)cryptoInfo, time, flags); ++} ++ + static ssize_t mediacodec_ndk_dequeueOutputBuffer(FFAMediaCodec* ctx, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) + { + FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; +@@ -2507,6 +2521,7 @@ static const FFAMediaCodec media_codec_ndk = { + + .dequeueInputBuffer = mediacodec_ndk_dequeueInputBuffer, + .queueInputBuffer = mediacodec_ndk_queueInputBuffer, ++ .queueSecureInputBuffer = mediacodec_ndk_queueSecureInputBuffer, + + .dequeueOutputBuffer = mediacodec_ndk_dequeueOutputBuffer, + .getOutputFormat = mediacodec_ndk_getOutputFormat, +diff --git a/media/ffvpx/libavcodec/mediacodec_wrapper.h b/media/ffvpx/libavcodec/mediacodec_wrapper.h +--- a/media/ffvpx/libavcodec/mediacodec_wrapper.h ++++ b/media/ffvpx/libavcodec/mediacodec_wrapper.h +@@ -214,6 +214,7 @@ struct FFAMediaCodec { + + ssize_t (*dequeueInputBuffer)(FFAMediaCodec* codec, int64_t timeoutUs); + int (*queueInputBuffer)(FFAMediaCodec* codec, size_t idx, off_t offset, size_t size, uint64_t time, uint32_t flags); ++ int (*queueSecureInputBuffer)(FFAMediaCodec* codec, size_t idx, off_t offset, void* cryptoInfo, uint64_t time, uint32_t flags); + + ssize_t (*dequeueOutputBuffer)(FFAMediaCodec* codec, FFAMediaCodecBufferInfo *info, int64_t timeoutUs); + FFAMediaFormat* (*getOutputFormat)(FFAMediaCodec* codec); +@@ -299,6 +300,11 @@ static inline int ff_AMediaCodec_queueInputBuffer(FFAMediaCodec *codec, size_t i + return codec->queueInputBuffer(codec, idx, offset, size, time, flags); + } + ++static inline int ff_AMediaCodec_queueSecureInputBuffer(FFAMediaCodec *codec, size_t idx, off_t offset, void* cryptoInfo, uint64_t time, uint32_t flags) ++{ ++ return codec->queueSecureInputBuffer(codec, idx, offset, cryptoInfo, time, flags); ++} ++ + static inline ssize_t ff_AMediaCodec_dequeueOutputBuffer(FFAMediaCodec* codec, FFAMediaCodecBufferInfo *info, int64_t timeoutUs) + { + return codec->dequeueOutputBuffer(codec, info, timeoutUs); +diff --git a/media/ffvpx/libavcodec/mediacodecdec_common.c b/media/ffvpx/libavcodec/mediacodecdec_common.c +--- a/media/ffvpx/libavcodec/mediacodecdec_common.c ++++ b/media/ffvpx/libavcodec/mediacodecdec_common.c +@@ -837,7 +837,7 @@ int ff_mediacodec_dec_init(AVCodecContext *avctx, MediaCodecDecContext *s, + if (ret < 0) + goto fail; + +- status = ff_AMediaCodec_configure(s->codec, format, s->surface, NULL, 0); ++ status = ff_AMediaCodec_configure(s->codec, format, s->surface, avctx->moz_ndk_crypto, 0); + if (status < 0) { + char *desc = ff_AMediaFormat_toString(format); + av_log(avctx, AV_LOG_ERROR, +@@ -943,7 +943,11 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, + + av_log(avctx, AV_LOG_DEBUG, "Sending End Of Stream signal\n"); + +- status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, 0, pts, flags); ++ if (pkt->moz_ndk_crypto_info) { ++ status = ff_AMediaCodec_queueSecureInputBuffer(codec, index, 0, pkt->moz_ndk_crypto_info, pts, flags); ++ } else { ++ status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, 0, pts, flags); ++ } + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to queue input empty buffer (status = %d)\n", status); + return AVERROR_EXTERNAL; +@@ -960,7 +964,11 @@ int ff_mediacodec_dec_send(AVCodecContext *avctx, MediaCodecDecContext *s, + memcpy(data, pkt->data + offset, size); + offset += size; + +- status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0); ++ if (pkt->moz_ndk_crypto_info) { ++ status = ff_AMediaCodec_queueSecureInputBuffer(codec, index, 0, pkt->moz_ndk_crypto_info, pts, 0); ++ } else { ++ status = ff_AMediaCodec_queueInputBuffer(codec, index, 0, size, pts, 0); ++ } + if (status < 0) { + av_log(avctx, AV_LOG_ERROR, "Failed to queue input buffer (status = %d)\n", status); + return AVERROR_EXTERNAL; +diff --git a/media/ffvpx/libavcodec/packet.c b/media/ffvpx/libavcodec/packet.c +--- a/media/ffvpx/libavcodec/packet.c ++++ b/media/ffvpx/libavcodec/packet.c +@@ -390,6 +390,32 @@ int av_packet_shrink_side_data(AVPacket *pkt, enum AVPacketSideDataType type, + return AVERROR(ENOENT); + } + ++static void av_packet_free_moz_crypto_info(AVPacket *pkt) { ++ if (pkt->moz_crypto_info_release && pkt->moz_crypto_info) { ++ (*pkt->moz_crypto_info_release)(pkt->moz_crypto_info); ++ } ++ pkt->moz_ndk_crypto_info = NULL; ++ pkt->moz_crypto_info = NULL; ++ pkt->moz_crypto_info_addref = NULL; ++ pkt->moz_crypto_info_release = NULL; ++} ++ ++static int av_packet_copy_moz_crypto_info(AVPacket *dst, const AVPacket *src) { ++ av_packet_free_moz_crypto_info(dst); ++ if (!src->moz_ndk_crypto_info) { ++ return 0; ++ } ++ if (!src->moz_crypto_info || !src->moz_crypto_info_addref || !src->moz_crypto_info_release) { ++ return AVERROR(EINVAL); ++ } ++ dst->moz_ndk_crypto_info = src->moz_ndk_crypto_info; ++ dst->moz_crypto_info = src->moz_crypto_info; ++ dst->moz_crypto_info_addref = src->moz_crypto_info_addref; ++ dst->moz_crypto_info_release = src->moz_crypto_info_release; ++ (*dst->moz_crypto_info_addref)(dst->moz_crypto_info); ++ return 0; ++} ++ + int av_packet_copy_props(AVPacket *dst, const AVPacket *src) + { + int i, ret; +@@ -406,10 +432,16 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) + dst->side_data = NULL; + dst->side_data_elems = 0; + +- ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); ++ ret = av_packet_copy_moz_crypto_info(dst, src); + if (ret < 0) + return ret; + ++ ret = av_buffer_replace(&dst->opaque_ref, src->opaque_ref); ++ if (ret < 0) { ++ av_packet_free_moz_crypto_info(dst); ++ return ret; ++ } ++ + for (i = 0; i < src->side_data_elems; i++) { + enum AVPacketSideDataType type = src->side_data[i].type; + size_t size = src->side_data[i].size; +@@ -417,6 +449,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) + uint8_t *dst_data = av_packet_new_side_data(dst, type, size); + + if (!dst_data) { ++ av_packet_free_moz_crypto_info(dst); + av_buffer_unref(&dst->opaque_ref); + av_packet_free_side_data(dst); + return AVERROR(ENOMEM); +@@ -429,6 +462,7 @@ int av_packet_copy_props(AVPacket *dst, const AVPacket *src) + + void av_packet_unref(AVPacket *pkt) + { ++ av_packet_free_moz_crypto_info(pkt); + av_packet_free_side_data(pkt); + av_buffer_unref(&pkt->opaque_ref); + av_buffer_unref(&pkt->buf); +diff --git a/media/ffvpx/libavcodec/packet.h b/media/ffvpx/libavcodec/packet.h +--- a/media/ffvpx/libavcodec/packet.h ++++ b/media/ffvpx/libavcodec/packet.h +@@ -581,6 +581,15 @@ typedef struct AVPacket { + * or muxers. + */ + AVRational time_base; ++ ++ /** ++ * Mozilla extensions to manage AMediaCryptoInfo for encrypted packets on ++ * Android. Must provide all parameters if any are given. ++ */ ++ void* moz_ndk_crypto_info; ++ void* moz_crypto_info; ++ void (*moz_crypto_info_addref)(void*); ++ void (*moz_crypto_info_release)(void*); + } AVPacket; + + #if FF_API_INIT_PACKET diff -Nru thunderbird-140.10.0esr/media/ffvpx/mediacodec_eos.patch thunderbird-140.10.1esr/media/ffvpx/mediacodec_eos.patch --- thunderbird-140.10.0esr/media/ffvpx/mediacodec_eos.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/mediacodec_eos.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,25 @@ +diff --git a/media/ffvpx/libavcodec/mediacodecdec.c b/media/ffvpx/libavcodec/mediacodecdec.c +--- a/media/ffvpx/libavcodec/mediacodecdec.c ++++ b/media/ffvpx/libavcodec/mediacodecdec.c +@@ -727,3 +727,9 @@ DECLARE_MEDIACODEC_ADEC(amrwb, "AMR-WB", AV_CODEC_ID_AMR_WB, NULL) + #if CONFIG_MP3_MEDIACODEC_DECODER + DECLARE_MEDIACODEC_ADEC(mp3, "MP3", AV_CODEC_ID_MP3, NULL) + #endif ++ ++int moz_avcodec_mediacodec_is_eos(AVCodecContext* avctx) { ++ // Note that MediaCodecH264DecContext is used by all codec types. ++ MediaCodecH264DecContext *s = avctx->priv_data; ++ return s->ctx->eos; ++} +diff --git a/media/ffvpx/libavcodec/mediacodecdec_common.c b/media/ffvpx/libavcodec/mediacodecdec_common.c +--- a/media/ffvpx/libavcodec/mediacodecdec_common.c ++++ b/media/ffvpx/libavcodec/mediacodecdec_common.c +@@ -85,7 +85,7 @@ + + #define INPUT_DEQUEUE_TIMEOUT_US 8000 + #define OUTPUT_DEQUEUE_TIMEOUT_US 8000 +-#define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US 1000000 ++#define OUTPUT_DEQUEUE_BLOCK_TIMEOUT_US 8000 + + enum { + ENCODING_PCM_16BIT = 0x00000002, diff -Nru thunderbird-140.10.0esr/media/ffvpx/mediacodec_force_key_frames.patch thunderbird-140.10.1esr/media/ffvpx/mediacodec_force_key_frames.patch --- thunderbird-140.10.0esr/media/ffvpx/mediacodec_force_key_frames.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/mediacodec_force_key_frames.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,103 @@ +diff --git a/media/ffvpx/libavcodec/mediacodec_wrapper.c b/media/ffvpx/libavcodec/mediacodec_wrapper.c +--- a/media/ffvpx/libavcodec/mediacodec_wrapper.c ++++ b/media/ffvpx/libavcodec/mediacodec_wrapper.c +@@ -1411,6 +1411,12 @@ fail: + return ret; + } + ++static int mediacodec_jni_setParameters(FFAMediaCodec *ctx, ++ const FFAMediaFormat* format_ctx) ++{ ++ return AVERROR_PATCHWELCOME; ++} ++ + static int mediacodec_jni_start(FFAMediaCodec* ctx) + { + int ret = 0; +@@ -1807,6 +1813,7 @@ static const FFAMediaCodec media_codec_jni = { + .delete = mediacodec_jni_delete, + + .configure = mediacodec_jni_configure, ++ .setParameters = mediacodec_jni_setParameters, + .start = mediacodec_jni_start, + .stop = mediacodec_jni_stop, + .flush = mediacodec_jni_flush, +@@ -2225,6 +2232,27 @@ static int mediacodec_ndk_configure(FFAMediaCodec* ctx, + return 0; + } + ++static int mediacodec_ndk_setParameters(FFAMediaCodec *ctx, ++ const FFAMediaFormat* format_ctx) ++{ ++ FFAMediaCodecNdk *codec = (FFAMediaCodecNdk *)ctx; ++ FFAMediaFormatNdk *format = (FFAMediaFormatNdk *)format_ctx; ++ media_status_t status; ++ ++ if (format_ctx->class != &amediaformat_ndk_class) { ++ av_log(ctx, AV_LOG_ERROR, "invalid media format\n"); ++ return AVERROR(EINVAL); ++ } ++ ++ status = AMediaCodec_setParameters(codec->impl, format->impl); ++ if (status != AMEDIA_OK) { ++ av_log(codec, AV_LOG_ERROR, "setParameters failed, %d\n", status); ++ return AVERROR_EXTERNAL; ++ } ++ ++ return 0; ++} ++ + #define MEDIACODEC_NDK_WRAPPER(method) \ + static int mediacodec_ndk_ ## method(FFAMediaCodec* ctx) \ + { \ +@@ -2512,6 +2540,7 @@ static const FFAMediaCodec media_codec_ndk = { + .delete = mediacodec_ndk_delete, + + .configure = mediacodec_ndk_configure, ++ .setParameters = mediacodec_ndk_setParameters, + .start = mediacodec_ndk_start, + .stop = mediacodec_ndk_stop, + .flush = mediacodec_ndk_flush, +diff --git a/media/ffvpx/libavcodec/mediacodec_wrapper.h b/media/ffvpx/libavcodec/mediacodec_wrapper.h +--- a/media/ffvpx/libavcodec/mediacodec_wrapper.h ++++ b/media/ffvpx/libavcodec/mediacodec_wrapper.h +@@ -205,6 +205,7 @@ struct FFAMediaCodec { + int (*delete)(FFAMediaCodec* codec); + + int (*configure)(FFAMediaCodec* codec, const FFAMediaFormat* format, FFANativeWindow* surface, void *crypto, uint32_t flags); ++ int (*setParameters)(FFAMediaCodec* codec, const FFAMediaFormat* format); + int (*start)(FFAMediaCodec* codec); + int (*stop)(FFAMediaCodec* codec); + int (*flush)(FFAMediaCodec* codec); +@@ -260,6 +261,12 @@ static inline int ff_AMediaCodec_configure(FFAMediaCodec *codec, + return codec->configure(codec, format, surface, crypto, flags); + } + ++static inline int ff_AMediaCodec_setParameters(FFAMediaCodec *codec, ++ const FFAMediaFormat *format) ++{ ++ return codec->setParameters(codec, format); ++} ++ + static inline int ff_AMediaCodec_start(FFAMediaCodec* codec) + { + return codec->start(codec); +diff --git a/media/ffvpx/libavcodec/mediacodecenc.c b/media/ffvpx/libavcodec/mediacodecenc.c +--- a/media/ffvpx/libavcodec/mediacodecenc.c ++++ b/media/ffvpx/libavcodec/mediacodecenc.c +@@ -785,6 +785,13 @@ static int mediacodec_send(AVCodecContext *avctx, + copy_frame_to_buffer(avctx, frame, input_buf, input_size); + + pts = av_rescale_q(frame->pts, avctx->time_base, AV_TIME_BASE_Q); ++ ++ if (frame->pict_type == AV_PICTURE_TYPE_I) { ++ FFAMediaFormat *format = ff_AMediaFormat_new(s->use_ndk_codec); ++ if (format) { ++ ff_AMediaFormat_setInt32(format, "request-sync", 0); ++ ff_AMediaCodec_setParameters(codec, format); ++ ff_AMediaFormat_delete(format); ++ } ++ } + } else { + flags |= ff_AMediaCodec_getBufferFlagEndOfStream(codec); + s->eof_sent = 1; diff -Nru thunderbird-140.10.0esr/media/ffvpx/mediacodec_h264.patch thunderbird-140.10.1esr/media/ffvpx/mediacodec_h264.patch --- thunderbird-140.10.0esr/media/ffvpx/mediacodec_h264.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/mediacodec_h264.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,104 @@ +diff --git a/media/ffvpx/libavcodec/avcodec.h b/media/ffvpx/libavcodec/avcodec.h +--- a/media/ffvpx/libavcodec/avcodec.h ++++ b/media/ffvpx/libavcodec/avcodec.h +@@ -2106,6 +2106,8 @@ typedef struct AVCodecContext { + AVFrameSideData **decoded_side_data; + int nb_decoded_side_data; + ++ int moz_extradata_offset; ++ + void* moz_ndk_crypto; + } AVCodecContext; + +diff --git a/media/ffvpx/libavcodec/mediacodecdec.c b/media/ffvpx/libavcodec/mediacodecdec.c +--- a/media/ffvpx/libavcodec/mediacodecdec.c ++++ b/media/ffvpx/libavcodec/mediacodecdec.c +@@ -36,9 +36,13 @@ + #include "avcodec.h" + #include "codec_internal.h" + #include "decode.h" ++#if CONFIG_H264_MEDIACODEC_DECODER_EXTRADATA + #include "h264_parse.h" + #include "h264_ps.h" ++#endif ++#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA + #include "hevc/parse.h" ++#endif + #include "hwconfig.h" + #include "internal.h" + #include "fffjni.h" +@@ -127,9 +131,9 @@ done: + } + #endif + +-#if CONFIG_H264_MEDIACODEC_DECODER + static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) + { ++#if CONFIG_H264_MEDIACODEC_DECODER_EXTRADATA + int i; + int ret; + +@@ -190,10 +194,25 @@ done: + ff_h264_ps_uninit(&ps); + + return ret; +-} ++#else ++ const uint8_t* ed = avctx->extradata; ++ int edsize = avctx->extradata_size; ++ int edoffset = avctx->moz_extradata_offset; ++ ++ if (ed) { ++ if (edoffset > 0 && edoffset < edsize) { ++ ff_AMediaFormat_setBuffer(format, "csd-0", ed, edoffset); ++ ff_AMediaFormat_setBuffer(format, "csd-1", ed + edoffset, edsize - edoffset); ++ } else { ++ ff_AMediaFormat_setBuffer(format, "csd-0", ed, edsize); ++ } ++ } ++ ++ return 0; + #endif ++} + +-#if CONFIG_HEVC_MEDIACODEC_DECODER ++#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA + static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) + { + int i; +@@ -297,7 +316,8 @@ done: + CONFIG_AAC_MEDIACODEC_DECODER || \ + CONFIG_AMRNB_MEDIACODEC_DECODER || \ + CONFIG_AMRWB_MEDIACODEC_DECODER || \ +- CONFIG_MP3_MEDIACODEC_DECODER ++ CONFIG_MP3_MEDIACODEC_DECODER || \ ++ !CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA + static int common_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format) + { + int ret = 0; +@@ -353,7 +373,11 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) + case AV_CODEC_ID_HEVC: + codec_mime = "video/hevc"; + ++#if CONFIG_HEVC_MEDIACODEC_DECODER_EXTRADATA + ret = hevc_set_extradata(avctx, format); ++#else ++ ret = common_set_extradata(avctx, format); ++#endif + if (ret < 0) + goto done; + break; +@@ -637,11 +661,11 @@ const FFCodec ff_ ## short_name ## _mediacodec_decoder = { + }; \ + + #if CONFIG_H264_MEDIACODEC_DECODER +-DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, "h264_mp4toannexb") ++DECLARE_MEDIACODEC_VDEC(h264, "H.264", AV_CODEC_ID_H264, NULL) + #endif + + #if CONFIG_HEVC_MEDIACODEC_DECODER +-DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, "hevc_mp4toannexb") ++DECLARE_MEDIACODEC_VDEC(hevc, "H.265", AV_CODEC_ID_HEVC, NULL) + #endif + + diff -Nru thunderbird-140.10.0esr/media/ffvpx/mediacodec_low_latency.patch thunderbird-140.10.1esr/media/ffvpx/mediacodec_low_latency.patch --- thunderbird-140.10.0esr/media/ffvpx/mediacodec_low_latency.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/mediacodec_low_latency.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,13 @@ +diff --git a/media/ffvpx/libavcodec/mediacodecdec.c b/media/ffvpx/libavcodec/mediacodecdec.c +--- a/media/ffvpx/libavcodec/mediacodecdec.c ++++ b/media/ffvpx/libavcodec/mediacodecdec.c +@@ -467,6 +467,9 @@ static av_cold int mediacodec_decode_init(AVCodecContext *avctx) + ff_AMediaFormat_setInt32(format, "channel-count", avctx->ch_layout.nb_channels); + ff_AMediaFormat_setInt32(format, "sample-rate", avctx->sample_rate); + } ++ if (avctx->flags & AV_CODEC_FLAG_LOW_DELAY) { ++ ff_AMediaFormat_setInt32(format, "low-latency", 1); ++ } + if (s->operating_rate > 0) + ff_AMediaFormat_setInt32(format, "operating-rate", s->operating_rate); + diff -Nru thunderbird-140.10.0esr/media/ffvpx/vp9-get-format-rollback.patch thunderbird-140.10.1esr/media/ffvpx/vp9-get-format-rollback.patch --- thunderbird-140.10.0esr/media/ffvpx/vp9-get-format-rollback.patch 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/ffvpx/vp9-get-format-rollback.patch 2026-04-29 18:38:25.000000000 +0000 @@ -14,3 +14,4 @@ avctx->pix_fmt = ret; s->gf_fmt = s->pix_fmt; + diff -Nru thunderbird-140.10.0esr/media/libcubeb/frame-sample.patch thunderbird-140.10.1esr/media/libcubeb/frame-sample.patch --- thunderbird-140.10.0esr/media/libcubeb/frame-sample.patch 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/media/libcubeb/frame-sample.patch 2026-04-29 18:38:26.000000000 +0000 @@ -0,0 +1,19 @@ +diff --git a/src/cubeb_resampler_internal.h b/src/cubeb_resampler_internal.h +index 08e019c610..dfc93f15b4 100644 +--- a/src/cubeb_resampler_internal.h ++++ b/src/cubeb_resampler_internal.h +@@ -211,9 +211,11 @@ + const size_t LATENCY_SAMPLES = 8192; + T input_buffer[LATENCY_SAMPLES] = {}; + T output_buffer[LATENCY_SAMPLES] = {}; +- uint32_t input_frame_count = input_latency; +- uint32_t output_frame_count = LATENCY_SAMPLES; +- assert(input_latency * channels <= LATENCY_SAMPLES); ++ const uint32_t latency_frames = ++ LATENCY_SAMPLES / std::max(channels, 1); ++ uint32_t input_frame_count = std::min(input_latency, latency_frames); ++ uint32_t output_frame_count = latency_frames; ++ assert(output_frame_count * channels <= LATENCY_SAMPLES); + speex_resample(input_buffer, &input_frame_count, output_buffer, + &output_frame_count); + } diff -Nru thunderbird-140.10.0esr/media/libcubeb/moz.yaml thunderbird-140.10.1esr/media/libcubeb/moz.yaml --- thunderbird-140.10.0esr/media/libcubeb/moz.yaml 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libcubeb/moz.yaml 2026-04-29 18:38:25.000000000 +0000 @@ -22,6 +22,7 @@ - 0003-audiounit-ios-compile-fixes.patch - 0004-disable-cubeb_one_duplex_one_input-macos10.15.patch - 0005-increase-aaudio-powersaving-buffering.patch + - frame-sample.patch skip-vendoring-steps: - update-moz-build exclude: diff -Nru thunderbird-140.10.0esr/media/libcubeb/src/cubeb_resampler_internal.h thunderbird-140.10.1esr/media/libcubeb/src/cubeb_resampler_internal.h --- thunderbird-140.10.0esr/media/libcubeb/src/cubeb_resampler_internal.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libcubeb/src/cubeb_resampler_internal.h 2026-04-29 18:38:25.000000000 +0000 @@ -211,9 +211,11 @@ const size_t LATENCY_SAMPLES = 8192; T input_buffer[LATENCY_SAMPLES] = {}; T output_buffer[LATENCY_SAMPLES] = {}; - uint32_t input_frame_count = input_latency; - uint32_t output_frame_count = LATENCY_SAMPLES; - assert(input_latency * channels <= LATENCY_SAMPLES); + const uint32_t latency_frames = + LATENCY_SAMPLES / std::max(channels, 1); + uint32_t input_frame_count = std::min(input_latency, latency_frames); + uint32_t output_frame_count = latency_frames; + assert(output_frame_count * channels <= LATENCY_SAMPLES); speex_resample(input_buffer, &input_frame_count, output_buffer, &output_frame_count); } diff -Nru thunderbird-140.10.0esr/media/libpng/ANNOUNCE thunderbird-140.10.1esr/media/libpng/ANNOUNCE --- thunderbird-140.10.0esr/media/libpng/ANNOUNCE 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/ANNOUNCE 2026-04-29 18:38:25.000000000 +0000 @@ -1,5 +1,5 @@ -libpng 1.6.57 - April 8, 2026 -============================= +libpng 1.6.58 - April 15, 2026 +============================== This is a public release of libpng, intended for use in production code. @@ -9,10 +9,10 @@ Source files: - * libpng-1.6.57.tar.xz (LZMA-compressed, recommended) - * libpng-1.6.57.tar.gz (deflate-compressed) - * lpng1657.7z (LZMA-compressed) - * lpng1657.zip (deflate-compressed) + * libpng-1.6.58.tar.xz (LZMA-compressed, recommended) + * libpng-1.6.58.tar.gz (deflate-compressed) + * lpng1658.7z (LZMA-compressed) + * lpng1658.zip (deflate-compressed) Other information: @@ -22,18 +22,13 @@ * TRADEMARK.md -Changes from version 1.6.56 to version 1.6.57 +Changes from version 1.6.57 to version 1.6.58 --------------------------------------------- - * Fixed CVE-2026-34757 (medium severity): - Use-after-free in `png_set_PLTE`, `png_set_tRNS` and `png_set_hIST` - leading to corrupted chunk data and potential heap information disclosure. - Also hardened the append-style setters (`png_set_text`, `png_set_sPLT`, - `png_set_unknown_chunks`) against a theoretical variant of the same - aliasing pattern. - (Reported by Iv4n .) - * Fixed integer overflow in rowbytes computation in read transforms. - (Contributed by Mohammad Seet.) + * Fixed a regression introduced in version 1.6.56 that caused `png_get_PLTE` + to return stale palette data after applying gamma and background transforms + in-place. + (Reported by ralfjunker .) Send comments/corrections/commendations to png-mng-implement at lists.sf.net. diff -Nru thunderbird-140.10.0esr/media/libpng/CHANGES thunderbird-140.10.1esr/media/libpng/CHANGES --- thunderbird-140.10.0esr/media/libpng/CHANGES 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/CHANGES 2026-04-29 18:38:25.000000000 +0000 @@ -6379,6 +6379,13 @@ Fixed integer overflow in rowbytes computation in read transforms. (Contributed by Mohammad Seet.) +Version 1.6.58 [April 15, 2026] + Fixed a regression introduced in version 1.6.56 that caused `png_get_PLTE` + to return stale palette data after applying gamma and background transforms + in-place. + (Reported by ralfjunker .) + + Send comments/corrections/commendations to png-mng-implement at lists.sf.net. Subscription is required; visit diff -Nru thunderbird-140.10.0esr/media/libpng/README thunderbird-140.10.1esr/media/libpng/README --- thunderbird-140.10.0esr/media/libpng/README 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/README 2026-04-29 18:38:26.000000000 +0000 @@ -1,4 +1,4 @@ -README for libpng version 1.6.57 +README for libpng version 1.6.58 ================================ See the note about version numbers near the top of `png.h`. diff -Nru thunderbird-140.10.0esr/media/libpng/libpng-manual.txt thunderbird-140.10.1esr/media/libpng/libpng-manual.txt --- thunderbird-140.10.0esr/media/libpng/libpng-manual.txt 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/libpng-manual.txt 2026-04-29 18:38:25.000000000 +0000 @@ -9,7 +9,7 @@ Based on: - libpng version 1.6.36, December 2018, through 1.6.57 - April 2026 + libpng version 1.6.36, December 2018, through 1.6.58 - April 2026 Updated and distributed by Cosmin Truta Copyright (c) 2018-2026 Cosmin Truta diff -Nru thunderbird-140.10.0esr/media/libpng/moz.yaml thunderbird-140.10.1esr/media/libpng/moz.yaml --- thunderbird-140.10.0esr/media/libpng/moz.yaml 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/moz.yaml 2026-04-29 18:38:26.000000000 +0000 @@ -11,9 +11,9 @@ url: "http://www.libpng.org/pub/png/libpng.html" license: libpng - release: v1.6.57 (2026-04-08T23:49:24+03:00). + release: v1.6.58 (2026-04-15T20:23:26+03:00). - revision: "v1.6.57" + revision: "v1.6.58" license-file: LICENSE diff -Nru thunderbird-140.10.0esr/media/libpng/png.c thunderbird-140.10.1esr/media/libpng/png.c --- thunderbird-140.10.0esr/media/libpng/png.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/png.c 2026-04-29 18:38:26.000000000 +0000 @@ -13,7 +13,7 @@ #include "pngpriv.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef png_libpng_version_1_6_57 Your_png_h_is_not_version_1_6_57; +typedef png_libpng_version_1_6_58 Your_png_h_is_not_version_1_6_58; /* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the * corresponding macro definitions. This causes a compile time failure if @@ -820,7 +820,7 @@ return PNG_STRING_COPYRIGHT #else return PNG_STRING_NEWLINE \ - "libpng version 1.6.57" PNG_STRING_NEWLINE \ + "libpng version 1.6.58" PNG_STRING_NEWLINE \ "Copyright (c) 2018-2026 Cosmin Truta" PNG_STRING_NEWLINE \ "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \ PNG_STRING_NEWLINE \ diff -Nru thunderbird-140.10.0esr/media/libpng/png.h thunderbird-140.10.1esr/media/libpng/png.h --- thunderbird-140.10.0esr/media/libpng/png.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/png.h 2026-04-29 18:38:25.000000000 +0000 @@ -1,6 +1,6 @@ /* png.h - header file for PNG reference library * - * libpng version 1.6.57 + * libpng version 1.6.58 * * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson @@ -14,7 +14,7 @@ * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger * libpng versions 0.97, January 1998, through 1.6.35, July 2018: * Glenn Randers-Pehrson - * libpng versions 1.6.36, December 2018, through 1.6.57, April 2026: + * libpng versions 1.6.36, December 2018, through 1.6.58, April 2026: * Cosmin Truta * See also "Contributing Authors", below. */ @@ -238,7 +238,7 @@ * ... * 1.5.30 15 10530 15.so.15.30[.0] * ... - * 1.6.57 16 10657 16.so.16.57[.0] + * 1.6.58 16 10658 16.so.16.58[.0] * * Henceforth the source version will match the shared-library major and * minor numbers; the shared-library major version number will be used for @@ -274,7 +274,7 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.6.57" +#define PNG_LIBPNG_VER_STRING "1.6.58" #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n" /* The versions of shared library builds should stay in sync, going forward */ @@ -285,7 +285,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 -#define PNG_LIBPNG_VER_RELEASE 57 +#define PNG_LIBPNG_VER_RELEASE 58 /* This should be zero for a public release, or non-zero for a * development version. @@ -316,7 +316,7 @@ * From version 1.0.1 it is: * XXYYZZ, where XX=major, YY=minor, ZZ=release */ -#define PNG_LIBPNG_VER 10657 /* 1.6.57 */ +#define PNG_LIBPNG_VER 10658 /* 1.6.58 */ /* Library configuration: these options cannot be changed after * the library has been built. @@ -441,7 +441,7 @@ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef char *png_libpng_version_1_6_57; +typedef char *png_libpng_version_1_6_58; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * diff -Nru thunderbird-140.10.0esr/media/libpng/pngconf.h thunderbird-140.10.1esr/media/libpng/pngconf.h --- thunderbird-140.10.0esr/media/libpng/pngconf.h 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/pngconf.h 2026-04-29 18:38:25.000000000 +0000 @@ -1,6 +1,6 @@ /* pngconf.h - machine-configurable file for libpng * - * libpng version 1.6.57 + * libpng version 1.6.58 * * Copyright (c) 2018-2026 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson diff -Nru thunderbird-140.10.0esr/media/libpng/pngrtran.c thunderbird-140.10.1esr/media/libpng/pngrtran.c --- thunderbird-140.10.0esr/media/libpng/pngrtran.c 2026-04-21 14:52:58.000000000 +0000 +++ thunderbird-140.10.1esr/media/libpng/pngrtran.c 2026-04-29 18:38:26.000000000 +0000 @@ -2070,19 +2070,15 @@ { png_debug(1, "in png_read_transform_info"); - if (png_ptr->transformations != 0) + if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE && + info_ptr->palette != NULL && png_ptr->palette != NULL) { - if (info_ptr->color_type == PNG_COLOR_TYPE_PALETTE && - info_ptr->palette != NULL && png_ptr->palette != NULL) - { - /* Sync info_ptr->palette with png_ptr->palette. - * The function png_init_read_transformations may have modified - * png_ptr->palette in place (e.g. for gamma correction or for - * background compositing). - */ - memcpy(info_ptr->palette, png_ptr->palette, - PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))); - } + /* Sync info_ptr->palette with png_ptr->palette, which may + * have been modified by png_init_read_transformations + * (e.g. for gamma correction or background compositing). + */ + memcpy(info_ptr->palette, png_ptr->palette, + PNG_MAX_PALETTE_LENGTH * (sizeof (png_color))); } #ifdef PNG_READ_EXPAND_SUPPORTED diff -Nru thunderbird-140.10.0esr/modules/libpref/init/StaticPrefList.yaml thunderbird-140.10.1esr/modules/libpref/init/StaticPrefList.yaml --- thunderbird-140.10.0esr/modules/libpref/init/StaticPrefList.yaml 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/modules/libpref/init/StaticPrefList.yaml 2026-04-29 18:38:27.000000000 +0000 @@ -18224,6 +18224,11 @@ value: false mirror: always +- name: webgl.max-bytes-per-row + type: RelaxedAtomicUint32 + value: 2147483647 # 0 => no limit, >0 => max valid bytes per row + mirror: always + - name: webgl.max-contexts type: RelaxedAtomicUint32 value: 1000 diff -Nru thunderbird-140.10.0esr/netwerk/base/nsStandardURL.cpp thunderbird-140.10.1esr/netwerk/base/nsStandardURL.cpp --- thunderbird-140.10.0esr/netwerk/base/nsStandardURL.cpp 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/netwerk/base/nsStandardURL.cpp 2026-04-29 18:38:26.000000000 +0000 @@ -272,6 +272,16 @@ return false; } + // mSpec must not contain embedded NULs + if (NS_WARN_IF(mSpec.FindChar('\0') != -1)) { + return false; + } + + // The character immediately after the scheme must be ':', e.g. "http:". + if (mScheme.mLen > 0 && NS_WARN_IF(mSpec.CharAt(mScheme.mLen) != ':')) { + return false; + } + return true; } @@ -797,15 +807,14 @@ if (seg.mLen < 0) { return false; } - // if the first |seg.mLen| chars of |val| match, then |val| must - // also be null terminated at |seg.mLen|. + size_t vlen = strlen(val); + if (static_cast(seg.mLen) != vlen) { + return false; + } if (ignoreCase) { - return !nsCRT::strncasecmp(mSpec.get() + seg.mPos, val, seg.mLen) && - (val[seg.mLen] == '\0'); + return !nsCRT::strncasecmp(mSpec.get() + seg.mPos, val, vlen); } - - return !strncmp(mSpec.get() + seg.mPos, val, seg.mLen) && - (val[seg.mLen] == '\0'); + return !strncmp(mSpec.get() + seg.mPos, val, vlen); } bool nsStandardURL::SegmentIs(const char* spec, const URLSegment& seg, @@ -817,14 +826,14 @@ if (seg.mLen < 0) { return false; } - // if the first |seg.mLen| chars of |val| match, then |val| must - // also be null terminated at |seg.mLen|. + size_t vlen = strlen(val); + if (static_cast(seg.mLen) != vlen) { + return false; + } if (ignoreCase) { - return !nsCRT::strncasecmp(spec + seg.mPos, val, seg.mLen) && - (val[seg.mLen] == '\0'); + return !nsCRT::strncasecmp(spec + seg.mPos, val, vlen); } - - return !strncmp(spec + seg.mPos, val, seg.mLen) && (val[seg.mLen] == '\0'); + return !strncmp(spec + seg.mPos, val, vlen); } bool nsStandardURL::SegmentIs(const URLSegment& seg1, const char* val, @@ -3682,6 +3691,21 @@ mRef.mLen == -1 || (mRef.mPos > 0 && mSpec.CharAt(mRef.mPos - 1) == '#'), false); + // mDirectory, mBasename, mExtension must be sub-ranges of mFilepath, + // which must be a sub-range of mPath. + auto isSubSegment = [](const URLSegment& inner, const URLSegment& outer) { + if (inner.mLen == -1) return true; + return inner.mPos >= outer.mPos && + inner.mPos + inner.mLen <= outer.mPos + outer.mLen; + }; + NS_ENSURE_TRUE(isSubSegment(mFilepath, mPath), false); + NS_ENSURE_TRUE(isSubSegment(mDirectory, mFilepath), false); + NS_ENSURE_TRUE(isSubSegment(mBasename, mFilepath), false); + NS_ENSURE_TRUE(isSubSegment(mExtension, mFilepath), false); + NS_ENSURE_TRUE(isSubSegment(mHost, mAuthority), false); + NS_ENSURE_TRUE(isSubSegment(mUsername, mAuthority), false); + NS_ENSURE_TRUE(isSubSegment(mPassword, mAuthority), false); + if (!IsValid()) { return false; } diff -Nru thunderbird-140.10.0esr/netwerk/protocol/res/MozSrcProtocolHandler.cpp thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.cpp --- thunderbird-140.10.0esr/netwerk/protocol/res/MozSrcProtocolHandler.cpp 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.cpp 2026-04-29 18:38:27.000000000 +0000 @@ -6,6 +6,7 @@ #include "mozilla/ModuleUtils.h" #include "mozilla/ClearOnShutdown.h" #include "mozilla/Omnijar.h" +#include "nsThreadUtils.h" #include "MozSrcProtocolHandler.h" @@ -19,16 +20,31 @@ NS_IMPL_ADDREF_INHERITED(MozSrcProtocolHandler, SubstitutingProtocolHandler) NS_IMPL_RELEASE_INHERITED(MozSrcProtocolHandler, SubstitutingProtocolHandler) +mozilla::StaticMutex MozSrcProtocolHandler::sMutex; mozilla::StaticRefPtr MozSrcProtocolHandler::sSingleton; already_AddRefed MozSrcProtocolHandler::GetSingleton() { + StaticMutexAutoLock lock(sMutex); if (!sSingleton) { RefPtr handler = new MozSrcProtocolHandler(); if (NS_WARN_IF(NS_FAILED(handler->Init()))) { return nullptr; } sSingleton = handler; - ClearOnShutdown(&sSingleton); + auto prevent_shutdown_race = [] { + StaticMutexAutoLock lock(sMutex); + sSingleton = nullptr; + }; + if (NS_IsMainThread()) { + RunOnShutdown(std::move(prevent_shutdown_race)); + } else { + NS_DispatchToMainThread(NS_NewRunnableFunction( + "MozSrcProtocolHandler::RunOnShutdown", + [prevent_shutdown_race = + std::move(prevent_shutdown_race)]() mutable { + RunOnShutdown(std::move(prevent_shutdown_race)); + })); + } } return do_AddRef(sSingleton); } diff -Nru thunderbird-140.10.0esr/netwerk/protocol/res/MozSrcProtocolHandler.h thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.h --- thunderbird-140.10.0esr/netwerk/protocol/res/MozSrcProtocolHandler.h 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/netwerk/protocol/res/MozSrcProtocolHandler.h 2026-04-29 18:38:26.000000000 +0000 @@ -8,6 +8,7 @@ #include "nsIProtocolHandler.h" #include "nsISubstitutingProtocolHandler.h" +#include "mozilla/StaticMutex.h" #include "SubstitutingProtocolHandler.h" namespace mozilla { @@ -37,7 +38,9 @@ nsIURI** aResult) override; private: - static mozilla::StaticRefPtr sSingleton; + static mozilla::StaticMutex sMutex; + static mozilla::StaticRefPtr sSingleton + MOZ_GUARDED_BY(sMutex); nsresult Init(); nsCString mGREURI; diff -Nru thunderbird-140.10.0esr/netwerk/protocol/res/nsResProtocolHandler.cpp thunderbird-140.10.1esr/netwerk/protocol/res/nsResProtocolHandler.cpp --- thunderbird-140.10.0esr/netwerk/protocol/res/nsResProtocolHandler.cpp 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/netwerk/protocol/res/nsResProtocolHandler.cpp 2026-04-29 18:38:27.000000000 +0000 @@ -27,6 +27,7 @@ mozilla::StaticRefPtr nsResProtocolHandler::sSingleton; already_AddRefed nsResProtocolHandler::GetSingleton() { + MOZ_ASSERT(NS_IsMainThread() || sSingleton); if (!sSingleton) { RefPtr handler = new nsResProtocolHandler(); if (NS_WARN_IF(NS_FAILED(handler->Init()))) { diff -Nru thunderbird-140.10.0esr/security/manager/tools/PreloadedHPKPins.json thunderbird-140.10.1esr/security/manager/tools/PreloadedHPKPins.json --- thunderbird-140.10.0esr/security/manager/tools/PreloadedHPKPins.json 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/security/manager/tools/PreloadedHPKPins.json 2026-04-29 18:38:27.000000000 +0000 @@ -33,16 +33,12 @@ "google": "google_root_pems" }, "production_pinsets": [ - "google_root_pems", - "facebook", - "ncsccs" + "google_root_pems" ], "production_domains": [ // Chrome's test domains. "pinningtest.appspot.com", - "pinning-test.badssl.com", - // SpiderOak - "spideroak.com" + "pinning-test.badssl.com" ], "exclude_domains" : [] }, @@ -85,11 +81,6 @@ { "name": "google_root_pems", "sha256_hashes": [ - "AffirmTrust Commercial", - "AffirmTrust Networking", - "AffirmTrust Premium", - "AffirmTrust Premium ECC", - "Baltimore CyberTrust Root", "Comodo AAA Services root", "COMODO Certification Authority", "COMODO ECC Certification Authority", @@ -102,10 +93,6 @@ "DigiCert Global Root G3", "DigiCert High Assurance EV Root CA", "DigiCert Trusted Root G4", - "Entrust Root Certification Authority", - "Entrust Root Certification Authority - EC1", - "Entrust Root Certification Authority - G2", - "Entrust.net Premium 2048 Secure Server CA", "GlobalSign ECC Root CA - R4", "GlobalSign ECC Root CA - R5", "GlobalSign Root CA", diff -Nru thunderbird-140.10.0esr/security/nss/TAG-INFO thunderbird-140.10.1esr/security/nss/TAG-INFO --- thunderbird-140.10.0esr/security/nss/TAG-INFO 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/TAG-INFO 2026-04-29 18:38:27.000000000 +0000 @@ -0,0 +1 @@ +NSS_3_112_5_RTM \ No newline at end of file diff -Nru thunderbird-140.10.0esr/security/nss/doc/rst/releases/nss_3_112_5.rst thunderbird-140.10.1esr/security/nss/doc/rst/releases/nss_3_112_5.rst --- thunderbird-140.10.0esr/security/nss/doc/rst/releases/nss_3_112_5.rst 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/doc/rst/releases/nss_3_112_5.rst 2026-04-29 18:38:27.000000000 +0000 @@ -0,0 +1,36 @@ +.. _mozilla_projects_nss_nss_3_112_5_release_notes: + +NSS 3.112.5 release notes +========================= + +`Introduction <#introduction>`__ +-------------------------------- + +.. container:: + + Network Security Services (NSS) 3.112.5 was released on *23 April 2026*. + +`Distribution Information <#distribution_information>`__ +-------------------------------------------------------- + +.. container:: + + The HG tag is NSS_3_112_5_RTM. NSS 3.112.5 requires NSPR 4.38.2 or newer. + + NSS 3.112.5 source distributions are available on ftp.mozilla.org for secure HTTPS download: + + - Source tarballs: + https://ftp.mozilla.org/pub/mozilla.org/security/nss/releases/NSS_3_112_5_RTM/src/ + + Other releases are available :ref:`mozilla_projects_nss_releases`. + +.. _changes_in_nss_3.112.5: + +`Changes in NSS 3.112.5 <#changes_in_nss_3.112.5>`__ +------------------------------------------------------------------ + +.. container:: + + - Bug 2033783 - reject DTLS 1.3 Server Hello after HVR without capping ss->vrange.max. + - Bug 2034185 - update to version 2.84 of builtins module. + diff -Nru thunderbird-140.10.0esr/security/nss/lib/ckfw/builtins/certdata.txt thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/certdata.txt --- thunderbird-140.10.0esr/security/nss/lib/ckfw/builtins/certdata.txt 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/certdata.txt 2026-04-29 18:38:27.000000000 +0000 @@ -372,140 +372,6 @@ CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "Baltimore CyberTrust Root" -# -# Issuer: CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE -# Serial Number: 33554617 (0x20000b9) -# Subject: CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE -# Not Valid Before: Fri May 12 18:46:00 2000 -# Not Valid After : Mon May 12 23:59:00 2025 -# Fingerprint (SHA-256): 16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB -# Fingerprint (SHA1): D4:DE:20:D0:5E:66:FC:53:FE:1A:50:88:2C:78:DB:28:52:CA:E4:74 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Baltimore CyberTrust Root" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\111\105\061 -\022\060\020\006\003\125\004\012\023\011\102\141\154\164\151\155 -\157\162\145\061\023\060\021\006\003\125\004\013\023\012\103\171 -\142\145\162\124\162\165\163\164\061\042\060\040\006\003\125\004 -\003\023\031\102\141\154\164\151\155\157\162\145\040\103\171\142 -\145\162\124\162\165\163\164\040\122\157\157\164 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\111\105\061 -\022\060\020\006\003\125\004\012\023\011\102\141\154\164\151\155 -\157\162\145\061\023\060\021\006\003\125\004\013\023\012\103\171 -\142\145\162\124\162\165\163\164\061\042\060\040\006\003\125\004 -\003\023\031\102\141\154\164\151\155\157\162\145\040\103\171\142 -\145\162\124\162\165\163\164\040\122\157\157\164 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\004\002\000\000\271 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\003\167\060\202\002\137\240\003\002\001\002\002\004\002 -\000\000\271\060\015\006\011\052\206\110\206\367\015\001\001\005 -\005\000\060\132\061\013\060\011\006\003\125\004\006\023\002\111 -\105\061\022\060\020\006\003\125\004\012\023\011\102\141\154\164 -\151\155\157\162\145\061\023\060\021\006\003\125\004\013\023\012 -\103\171\142\145\162\124\162\165\163\164\061\042\060\040\006\003 -\125\004\003\023\031\102\141\154\164\151\155\157\162\145\040\103 -\171\142\145\162\124\162\165\163\164\040\122\157\157\164\060\036 -\027\015\060\060\060\065\061\062\061\070\064\066\060\060\132\027 -\015\062\065\060\065\061\062\062\063\065\071\060\060\132\060\132 -\061\013\060\011\006\003\125\004\006\023\002\111\105\061\022\060 -\020\006\003\125\004\012\023\011\102\141\154\164\151\155\157\162 -\145\061\023\060\021\006\003\125\004\013\023\012\103\171\142\145 -\162\124\162\165\163\164\061\042\060\040\006\003\125\004\003\023 -\031\102\141\154\164\151\155\157\162\145\040\103\171\142\145\162 -\124\162\165\163\164\040\122\157\157\164\060\202\001\042\060\015 -\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\001 -\017\000\060\202\001\012\002\202\001\001\000\243\004\273\042\253 -\230\075\127\350\046\162\232\265\171\324\051\342\341\350\225\200 -\261\260\343\133\216\053\051\232\144\337\241\135\355\260\011\005 -\155\333\050\056\316\142\242\142\376\264\210\332\022\353\070\353 -\041\235\300\101\053\001\122\173\210\167\323\034\217\307\272\271 -\210\265\152\011\347\163\350\021\100\247\321\314\312\142\215\055 -\345\217\013\246\120\322\250\120\303\050\352\365\253\045\207\212 -\232\226\034\251\147\270\077\014\325\367\371\122\023\057\302\033 -\325\160\160\360\217\300\022\312\006\313\232\341\331\312\063\172 -\167\326\370\354\271\361\150\104\102\110\023\322\300\302\244\256 -\136\140\376\266\246\005\374\264\335\007\131\002\324\131\030\230 -\143\365\245\143\340\220\014\175\135\262\006\172\363\205\352\353 -\324\003\256\136\204\076\137\377\025\355\151\274\371\071\066\162 -\165\317\167\122\115\363\311\220\054\271\075\345\311\043\123\077 -\037\044\230\041\134\007\231\051\275\306\072\354\347\156\206\072 -\153\227\164\143\063\275\150\030\061\360\170\215\166\277\374\236 -\216\135\052\206\247\115\220\334\047\032\071\002\003\001\000\001 -\243\105\060\103\060\035\006\003\125\035\016\004\026\004\024\345 -\235\131\060\202\107\130\314\254\372\010\124\066\206\173\072\265 -\004\115\360\060\022\006\003\125\035\023\001\001\377\004\010\060 -\006\001\001\377\002\001\003\060\016\006\003\125\035\017\001\001 -\377\004\004\003\002\001\006\060\015\006\011\052\206\110\206\367 -\015\001\001\005\005\000\003\202\001\001\000\205\014\135\216\344 -\157\121\150\102\005\240\335\273\117\047\045\204\003\275\367\144 -\375\055\327\060\343\244\020\027\353\332\051\051\266\171\077\166 -\366\031\023\043\270\020\012\371\130\244\324\141\160\275\004\141 -\152\022\212\027\325\012\275\305\274\060\174\326\351\014\045\215 -\206\100\117\354\314\243\176\070\306\067\021\117\355\335\150\061 -\216\114\322\263\001\164\356\276\165\136\007\110\032\177\160\377 -\026\134\204\300\171\205\270\005\375\177\276\145\021\243\017\300 -\002\264\370\122\067\071\004\325\251\061\172\030\277\240\052\364 -\022\231\367\243\105\202\343\074\136\365\235\236\265\310\236\174 -\056\310\244\236\116\010\024\113\155\375\160\155\153\032\143\275 -\144\346\037\267\316\360\362\237\056\273\033\267\362\120\210\163 -\222\302\342\343\026\215\232\062\002\253\216\030\335\351\020\021 -\356\176\065\253\220\257\076\060\224\172\320\063\075\247\145\017 -\365\374\216\236\142\317\107\104\054\001\135\273\035\265\062\322 -\107\322\070\056\320\376\201\334\062\152\036\265\356\074\325\374 -\347\201\035\031\303\044\102\352\143\071\251 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "Baltimore CyberTrust Root" -# Issuer: CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE -# Serial Number: 33554617 (0x20000b9) -# Subject: CN=Baltimore CyberTrust Root,OU=CyberTrust,O=Baltimore,C=IE -# Not Valid Before: Fri May 12 18:46:00 2000 -# Not Valid After : Mon May 12 23:59:00 2025 -# Fingerprint (SHA-256): 16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB -# Fingerprint (SHA1): D4:DE:20:D0:5E:66:FC:53:FE:1A:50:88:2C:78:DB:28:52:CA:E4:74 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Baltimore CyberTrust Root" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\324\336\040\320\136\146\374\123\376\032\120\210\054\170\333\050 -\122\312\344\164 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\254\266\224\245\234\027\340\327\221\122\233\261\227\006\246\344 -END -CKA_ISSUER MULTILINE_OCTAL -\060\132\061\013\060\011\006\003\125\004\006\023\002\111\105\061 -\022\060\020\006\003\125\004\012\023\011\102\141\154\164\151\155 -\157\162\145\061\023\060\021\006\003\125\004\013\023\012\103\171 -\142\145\162\124\162\165\163\164\061\042\060\040\006\003\125\004 -\003\023\031\102\141\154\164\151\155\157\162\145\040\103\171\142 -\145\162\124\162\165\163\164\040\122\157\157\164 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\004\002\000\000\271 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# # Certificate "Entrust Root Certification Authority" # # Issuer: CN=Entrust Root Certification Authority,OU="(c) 2006 Entrust, Inc.",OU=www.entrust.net/CPS is incorporated by reference,O="Entrust, Inc.",C=US @@ -3323,7 +3189,10 @@ \201\370\021\234 END CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +# For Server Distrust After: Tue Apr 15 23:59:59 2025 +CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL +\062\065\060\064\061\065\062\063\065\071\065\071\132 +END CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE # Trust for "ePKI Root Certification Authority" @@ -5371,175 +5240,6 @@ CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "Explicitly Distrust DigiNotar Root CA" -# -# Issuer: E=info@diginotar.nl,CN=DigiNotar Root CA,O=DigiNotar,C=NL -# Serial Number:0f:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff -# Subject: E=info@diginotar.nl,CN=DigiNotar Root CA,O=DigiNotar,C=NL -# Not Valid Before: Fri Jul 27 17:19:37 2007 -# Not Valid After : Mon Mar 31 18:19:22 2025 -# Fingerprint (MD5): 0A:A4:D5:CC:BA:B4:FB:A3:59:E3:E6:01:DD:53:D9:4E -# Fingerprint (SHA1): C1:77:CB:4B:E0:B4:26:8E:F5:C7:CF:45:99:22:B9:B0:CE:BA:21:2F -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Root CA" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157 -\164\141\162\061\032\060\030\006\003\125\004\003\023\021\104\151 -\147\151\116\157\164\141\162\040\122\157\157\164\040\103\101\061 -\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026\021 -\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056\156 -\154 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157 -\164\141\162\061\032\060\030\006\003\125\004\003\023\021\104\151 -\147\151\116\157\164\141\162\040\122\157\157\164\040\103\101\061 -\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026\021 -\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056\156 -\154 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\017\377\377\377\377\377\377\377\377\377\377\377\377\377 -\377\377 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\005\212\060\202\003\162\240\003\002\001\002\002\020\017 -\377\377\377\377\377\377\377\377\377\377\377\377\377\377\377\060 -\015\006\011\052\206\110\206\367\015\001\001\005\005\000\060\137 -\061\013\060\011\006\003\125\004\006\023\002\116\114\061\022\060 -\020\006\003\125\004\012\023\011\104\151\147\151\116\157\164\141 -\162\061\032\060\030\006\003\125\004\003\023\021\104\151\147\151 -\116\157\164\141\162\040\122\157\157\164\040\103\101\061\040\060 -\036\006\011\052\206\110\206\367\015\001\011\001\026\021\151\156 -\146\157\100\144\151\147\151\156\157\164\141\162\056\156\154\060 -\036\027\015\060\067\060\067\062\067\061\067\061\071\063\067\132 -\027\015\062\065\060\063\063\061\061\070\061\071\062\062\132\060 -\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061\022 -\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157\164 -\141\162\061\032\060\030\006\003\125\004\003\023\021\104\151\147 -\151\116\157\164\141\162\040\122\157\157\164\040\103\101\061\040 -\060\036\006\011\052\206\110\206\367\015\001\011\001\026\021\151 -\156\146\157\100\144\151\147\151\156\157\164\141\162\056\156\154 -\060\202\002\042\060\015\006\011\052\206\110\206\367\015\001\001 -\001\005\000\003\202\002\017\000\060\202\002\012\002\202\002\001 -\000\254\260\130\301\000\275\330\041\010\013\053\232\376\156\126 -\060\005\237\033\167\220\020\101\134\303\015\207\021\167\216\201 -\361\312\174\351\214\152\355\070\164\065\273\332\337\371\273\300 -\011\067\264\226\163\201\175\063\032\230\071\367\223\157\225\177 -\075\271\261\165\207\272\121\110\350\213\160\076\225\004\305\330 -\266\303\026\331\210\260\261\207\035\160\332\206\264\017\024\213 -\172\317\020\321\164\066\242\022\173\167\206\112\171\346\173\337 -\002\021\150\245\116\206\256\064\130\233\044\023\170\126\042\045 -\036\001\213\113\121\161\373\202\314\131\226\151\210\132\150\123 -\305\271\015\002\067\313\113\274\146\112\220\176\052\013\005\007 -\355\026\137\125\220\165\330\106\311\033\203\342\010\276\361\043 -\314\231\035\326\052\017\203\040\025\130\047\202\056\372\342\042 -\302\111\261\271\001\201\152\235\155\235\100\167\150\166\116\041 -\052\155\204\100\205\116\166\231\174\202\363\363\267\002\131\324 -\046\001\033\216\337\255\123\006\321\256\030\335\342\262\072\313 -\327\210\070\216\254\133\051\271\031\323\230\371\030\003\317\110 -\202\206\146\013\033\151\017\311\353\070\210\172\046\032\005\114 -\222\327\044\324\226\362\254\122\055\243\107\325\122\366\077\376 -\316\204\006\160\246\252\076\242\362\266\126\064\030\127\242\344 -\201\155\347\312\360\152\323\307\221\153\002\203\101\174\025\357 -\153\232\144\136\343\320\074\345\261\353\173\135\206\373\313\346 -\167\111\315\243\145\334\367\271\234\270\344\013\137\223\317\314 -\060\032\062\034\316\034\143\225\245\371\352\341\164\213\236\351 -\053\251\060\173\240\030\037\016\030\013\345\133\251\323\321\154 -\036\007\147\217\221\113\251\212\274\322\146\252\223\001\210\262 -\221\372\061\134\325\246\301\122\010\011\315\012\143\242\323\042 -\246\350\241\331\071\006\227\365\156\215\002\220\214\024\173\077 -\200\315\033\234\272\304\130\162\043\257\266\126\237\306\172\102 -\063\051\007\077\202\311\346\037\005\015\315\114\050\066\213\323 -\310\076\034\306\210\357\136\356\211\144\351\035\353\332\211\176 -\062\246\151\321\335\314\210\237\321\320\311\146\041\334\006\147 -\305\224\172\232\155\142\114\175\314\340\144\200\262\236\107\216 -\243\002\003\001\000\001\243\102\060\100\060\017\006\003\125\035 -\023\001\001\377\004\005\060\003\001\001\377\060\016\006\003\125 -\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003\125 -\035\016\004\026\004\024\210\150\277\340\216\065\304\073\070\153 -\142\367\050\073\204\201\310\014\327\115\060\015\006\011\052\206 -\110\206\367\015\001\001\005\005\000\003\202\002\001\000\073\002 -\215\313\074\060\350\156\240\255\362\163\263\137\236\045\023\004 -\005\323\366\343\213\273\013\171\316\123\336\344\226\305\321\257 -\163\274\325\303\320\100\125\174\100\177\315\033\137\011\325\362 -\174\237\150\035\273\135\316\172\071\302\214\326\230\173\305\203 -\125\250\325\175\100\312\340\036\367\211\136\143\135\241\023\302 -\135\212\266\212\174\000\363\043\303\355\205\137\161\166\360\150 -\143\252\105\041\071\110\141\170\066\334\361\103\223\324\045\307 -\362\200\145\341\123\002\165\121\374\172\072\357\067\253\204\050 -\127\014\330\324\324\231\126\154\343\242\376\131\204\264\061\350 -\063\370\144\224\224\121\227\253\071\305\113\355\332\335\200\013 -\157\174\051\015\304\216\212\162\015\347\123\024\262\140\101\075 -\204\221\061\150\075\047\104\333\345\336\364\372\143\105\310\114 -\076\230\365\077\101\272\116\313\067\015\272\146\230\361\335\313 -\237\134\367\124\066\202\153\054\274\023\141\227\102\370\170\273 -\314\310\242\237\312\360\150\275\153\035\262\337\215\157\007\235 -\332\216\147\307\107\036\312\271\277\052\102\221\267\143\123\146 -\361\102\243\341\364\132\115\130\153\265\344\244\063\255\134\160 -\035\334\340\362\353\163\024\221\232\003\301\352\000\145\274\007 -\374\317\022\021\042\054\256\240\275\072\340\242\052\330\131\351 -\051\323\030\065\244\254\021\137\031\265\265\033\377\042\112\134 -\306\172\344\027\357\040\251\247\364\077\255\212\247\232\004\045 -\235\016\312\067\346\120\375\214\102\051\004\232\354\271\317\113 -\162\275\342\010\066\257\043\057\142\345\312\001\323\160\333\174 -\202\043\054\026\061\014\306\066\007\220\172\261\037\147\130\304 -\073\130\131\211\260\214\214\120\263\330\206\313\150\243\304\012 -\347\151\113\040\316\301\036\126\113\225\251\043\150\330\060\330 -\303\353\260\125\121\315\345\375\053\270\365\273\021\237\123\124 -\366\064\031\214\171\011\066\312\141\027\045\027\013\202\230\163 -\014\167\164\303\325\015\307\250\022\114\307\247\124\161\107\056 -\054\032\175\311\343\053\073\110\336\047\204\247\143\066\263\175 -\217\240\144\071\044\015\075\173\207\257\146\134\164\033\113\163 -\262\345\214\360\206\231\270\345\305\337\204\301\267\353 -END - -# Trust for Certificate "Explicitly Distrust DigiNotar Root CA" -# Issuer: E=info@diginotar.nl,CN=DigiNotar Root CA,O=DigiNotar,C=NL -# Serial Number:0f:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff:ff -# Subject: E=info@diginotar.nl,CN=DigiNotar Root CA,O=DigiNotar,C=NL -# Not Valid Before: Fri Jul 27 17:19:37 2007 -# Not Valid After : Mon Mar 31 18:19:22 2025 -# Fingerprint (MD5): 0A:A4:D5:CC:BA:B4:FB:A3:59:E3:E6:01:DD:53:D9:4E -# Fingerprint (SHA1): C1:77:CB:4B:E0:B4:26:8E:F5:C7:CF:45:99:22:B9:B0:CE:BA:21:2F -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "Explicitly Distrust DigiNotar Root CA" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\301\167\313\113\340\264\046\216\365\307\317\105\231\042\271\260 -\316\272\041\057 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\012\244\325\314\272\264\373\243\131\343\346\001\335\123\331\116 -END -CKA_ISSUER MULTILINE_OCTAL -\060\137\061\013\060\011\006\003\125\004\006\023\002\116\114\061 -\022\060\020\006\003\125\004\012\023\011\104\151\147\151\116\157 -\164\141\162\061\032\060\030\006\003\125\004\003\023\021\104\151 -\147\151\116\157\164\141\162\040\122\157\157\164\040\103\101\061 -\040\060\036\006\011\052\206\110\206\367\015\001\011\001\026\021 -\151\156\146\157\100\144\151\147\151\156\157\164\141\162\056\156 -\154 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\020\017\377\377\377\377\377\377\377\377\377\377\377\377\377 -\377\377 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_NOT_TRUSTED -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# # Certificate "Security Communication RootCA2" # # Issuer: OU=Security Communication RootCA2,O="SECOM Trust Systems CO.,LTD.",C=JP @@ -23497,557 +23197,6 @@ CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # -# Certificate "CommScope Public Trust ECC Root-01" -# -# Issuer: CN=CommScope Public Trust ECC Root-01,O=CommScope,C=US -# Serial Number:43:70:82:77:cf:4d:5d:34:f1:ca:ae:32:2f:37:f7:f4:7f:75:a0:9e -# Subject: CN=CommScope Public Trust ECC Root-01,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:35:43 2021 -# Not Valid After : Sat Apr 28 17:35:42 2046 -# Fingerprint (SHA-256): 11:43:7C:DA:7B:B4:5E:41:36:5F:45:B3:9A:38:98:6B:0D:E0:0D:EF:34:8E:0C:7B:B0:87:36:33:80:0B:C3:8B -# Fingerprint (SHA1): 07:86:C0:D8:DD:8E:C0:80:98:06:98:D0:58:7A:EF:DE:A6:CC:A2:5D -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust ECC Root-01" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\061 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\061 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\103\160\202\167\317\115\135\064\361\312\256\062\057\067 -\367\364\177\165\240\236 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\002\035\060\202\001\243\240\003\002\001\002\002\024\103 -\160\202\167\317\115\135\064\361\312\256\062\057\067\367\364\177 -\165\240\236\060\012\006\010\052\206\110\316\075\004\003\003\060 -\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061\022 -\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143\157 -\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157\155 -\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124\162 -\165\163\164\040\105\103\103\040\122\157\157\164\055\060\061\060 -\036\027\015\062\061\060\064\062\070\061\067\063\065\064\063\132 -\027\015\064\066\060\064\062\070\061\067\063\065\064\062\132\060 -\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061\022 -\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143\157 -\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157\155 -\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124\162 -\165\163\164\040\105\103\103\040\122\157\157\164\055\060\061\060 -\166\060\020\006\007\052\206\110\316\075\002\001\006\005\053\201 -\004\000\042\003\142\000\004\113\066\351\256\127\136\250\160\327 -\320\217\164\142\167\303\136\172\252\345\266\242\361\170\375\002 -\176\127\335\221\171\234\154\271\122\210\124\274\057\004\276\270 -\315\366\020\321\051\354\265\320\240\303\360\211\160\031\273\121 -\145\305\103\234\303\233\143\235\040\203\076\006\013\246\102\104 -\205\021\247\112\072\055\351\326\150\057\110\116\123\053\007\077 -\115\275\271\254\167\071\127\243\102\060\100\060\017\006\003\125 -\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006\003 -\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003 -\125\035\016\004\026\004\024\216\007\142\300\120\335\306\031\006 -\000\106\164\004\367\363\256\175\165\115\060\060\012\006\010\052 -\206\110\316\075\004\003\003\003\150\000\060\145\002\061\000\234 -\063\337\101\343\043\250\102\066\046\227\065\134\173\353\333\113 -\370\252\213\163\125\025\134\254\170\051\017\272\041\330\304\240 -\330\321\003\335\155\321\071\075\304\223\140\322\343\162\262\002 -\060\174\305\176\210\323\120\365\036\045\350\372\116\165\346\130 -\226\244\065\137\033\145\352\141\232\160\043\265\015\243\233\222 -\122\157\151\240\214\215\112\320\356\213\016\313\107\216\320\215 -\021 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "CommScope Public Trust ECC Root-01" -# Issuer: CN=CommScope Public Trust ECC Root-01,O=CommScope,C=US -# Serial Number:43:70:82:77:cf:4d:5d:34:f1:ca:ae:32:2f:37:f7:f4:7f:75:a0:9e -# Subject: CN=CommScope Public Trust ECC Root-01,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:35:43 2021 -# Not Valid After : Sat Apr 28 17:35:42 2046 -# Fingerprint (SHA-256): 11:43:7C:DA:7B:B4:5E:41:36:5F:45:B3:9A:38:98:6B:0D:E0:0D:EF:34:8E:0C:7B:B0:87:36:33:80:0B:C3:8B -# Fingerprint (SHA1): 07:86:C0:D8:DD:8E:C0:80:98:06:98:D0:58:7A:EF:DE:A6:CC:A2:5D -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust ECC Root-01" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\007\206\300\330\335\216\300\200\230\006\230\320\130\172\357\336 -\246\314\242\135 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\072\100\247\374\003\214\234\070\171\057\072\242\154\266\012\026 -END -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\061 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\103\160\202\167\317\115\135\064\361\312\256\062\057\067 -\367\364\177\165\240\236 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "CommScope Public Trust ECC Root-02" -# -# Issuer: CN=CommScope Public Trust ECC Root-02,O=CommScope,C=US -# Serial Number:28:fd:99:60:41:47:a6:01:3a:ca:14:7b:1f:ef:f9:68:08:83:5d:7d -# Subject: CN=CommScope Public Trust ECC Root-02,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:44:54 2021 -# Not Valid After : Sat Apr 28 17:44:53 2046 -# Fingerprint (SHA-256): 2F:FB:7F:81:3B:BB:B3:C8:9A:B4:E8:16:2D:0F:16:D7:15:09:A8:30:CC:9D:73:C2:62:E5:14:08:75:D1:AD:4A -# Fingerprint (SHA1): 3C:3F:EF:57:0F:FE:65:93:86:9E:A0:FE:B0:F6:ED:8E:D1:13:C7:E5 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust ECC Root-02" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\062 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\050\375\231\140\101\107\246\001\072\312\024\173\037\357 -\371\150\010\203\135\175 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\002\034\060\202\001\243\240\003\002\001\002\002\024\050 -\375\231\140\101\107\246\001\072\312\024\173\037\357\371\150\010 -\203\135\175\060\012\006\010\052\206\110\316\075\004\003\003\060 -\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061\022 -\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143\157 -\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157\155 -\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124\162 -\165\163\164\040\105\103\103\040\122\157\157\164\055\060\062\060 -\036\027\015\062\061\060\064\062\070\061\067\064\064\065\064\132 -\027\015\064\066\060\064\062\070\061\067\064\064\065\063\132\060 -\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061\022 -\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143\157 -\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157\155 -\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124\162 -\165\163\164\040\105\103\103\040\122\157\157\164\055\060\062\060 -\166\060\020\006\007\052\206\110\316\075\002\001\006\005\053\201 -\004\000\042\003\142\000\004\170\060\201\350\143\036\345\353\161 -\121\017\367\007\007\312\071\231\174\116\325\017\314\060\060\013 -\217\146\223\076\317\275\305\206\275\371\261\267\264\076\264\007 -\310\363\226\061\363\355\244\117\370\243\116\215\051\025\130\270 -\325\157\177\356\154\042\265\260\257\110\105\012\275\250\111\224 -\277\204\103\260\333\204\112\003\043\031\147\152\157\301\156\274 -\006\071\067\321\210\042\367\243\102\060\100\060\017\006\003\125 -\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006\003 -\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006\003 -\125\035\016\004\026\004\024\346\030\165\377\357\140\336\204\244 -\365\106\307\336\112\125\343\062\066\171\365\060\012\006\010\052 -\206\110\316\075\004\003\003\003\147\000\060\144\002\060\046\163 -\111\172\266\253\346\111\364\175\122\077\324\101\004\256\200\103 -\203\145\165\271\205\200\070\073\326\157\344\223\206\253\217\347 -\211\310\177\233\176\153\012\022\125\141\252\021\340\171\002\060 -\167\350\061\161\254\074\161\003\326\204\046\036\024\270\363\073 -\073\336\355\131\374\153\114\060\177\131\316\105\351\163\140\025 -\232\114\360\346\136\045\042\025\155\302\207\131\320\262\216\152 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "CommScope Public Trust ECC Root-02" -# Issuer: CN=CommScope Public Trust ECC Root-02,O=CommScope,C=US -# Serial Number:28:fd:99:60:41:47:a6:01:3a:ca:14:7b:1f:ef:f9:68:08:83:5d:7d -# Subject: CN=CommScope Public Trust ECC Root-02,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:44:54 2021 -# Not Valid After : Sat Apr 28 17:44:53 2046 -# Fingerprint (SHA-256): 2F:FB:7F:81:3B:BB:B3:C8:9A:B4:E8:16:2D:0F:16:D7:15:09:A8:30:CC:9D:73:C2:62:E5:14:08:75:D1:AD:4A -# Fingerprint (SHA1): 3C:3F:EF:57:0F:FE:65:93:86:9E:A0:FE:B0:F6:ED:8E:D1:13:C7:E5 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust ECC Root-02" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\074\077\357\127\017\376\145\223\206\236\240\376\260\366\355\216 -\321\023\307\345 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\131\260\104\325\145\115\270\134\125\031\222\002\266\321\224\262 -END -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\105\103\103\040\122\157\157\164\055\060\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\050\375\231\140\101\107\246\001\072\312\024\173\037\357 -\371\150\010\203\135\175 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "CommScope Public Trust RSA Root-01" -# -# Issuer: CN=CommScope Public Trust RSA Root-01,O=CommScope,C=US -# Serial Number:3e:03:49:81:75:16:74:31:8e:4c:ab:d5:c5:90:29:96:c5:39:10:dd -# Subject: CN=CommScope Public Trust RSA Root-01,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 16:45:54 2021 -# Not Valid After : Sat Apr 28 16:45:53 2046 -# Fingerprint (SHA-256): 02:BD:F9:6E:2A:45:DD:9B:F1:8F:C7:E1:DB:DF:21:A0:37:9B:A3:C9:C2:61:03:44:CF:D8:D6:06:FE:C1:ED:81 -# Fingerprint (SHA1): 6D:0A:5F:F7:B4:23:06:B4:85:B3:B7:97:64:FC:AC:75:F5:33:F2:93 -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust RSA Root-01" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\061 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\061 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\076\003\111\201\165\026\164\061\216\114\253\325\305\220 -\051\226\305\071\020\335 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\005\154\060\202\003\124\240\003\002\001\002\002\024\076 -\003\111\201\165\026\164\061\216\114\253\325\305\220\051\226\305 -\071\020\335\060\015\006\011\052\206\110\206\367\015\001\001\013 -\005\000\060\116\061\013\060\011\006\003\125\004\006\023\002\125 -\123\061\022\060\020\006\003\125\004\012\014\011\103\157\155\155 -\123\143\157\160\145\061\053\060\051\006\003\125\004\003\014\042 -\103\157\155\155\123\143\157\160\145\040\120\165\142\154\151\143 -\040\124\162\165\163\164\040\122\123\101\040\122\157\157\164\055 -\060\061\060\036\027\015\062\061\060\064\062\070\061\066\064\065 -\065\064\132\027\015\064\066\060\064\062\070\061\066\064\065\065 -\063\132\060\116\061\013\060\011\006\003\125\004\006\023\002\125 -\123\061\022\060\020\006\003\125\004\012\014\011\103\157\155\155 -\123\143\157\160\145\061\053\060\051\006\003\125\004\003\014\042 -\103\157\155\155\123\143\157\160\145\040\120\165\142\154\151\143 -\040\124\162\165\163\164\040\122\123\101\040\122\157\157\164\055 -\060\061\060\202\002\042\060\015\006\011\052\206\110\206\367\015 -\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202 -\002\001\000\260\110\145\243\015\035\102\343\221\155\235\204\244 -\141\226\022\302\355\303\332\043\064\031\166\366\352\375\125\132 -\366\125\001\123\017\362\314\214\227\117\271\120\313\263\001\104 -\126\226\375\233\050\354\173\164\013\347\102\153\125\316\311\141 -\262\350\255\100\074\272\271\101\012\005\117\033\046\205\217\103 -\265\100\265\205\321\324\161\334\203\101\363\366\105\307\200\242 -\204\120\227\106\316\240\014\304\140\126\004\035\007\133\106\245 -\016\262\113\244\016\245\174\356\370\324\142\003\271\223\152\212 -\024\270\160\370\056\202\106\070\043\016\164\307\153\101\267\320 -\051\243\235\200\260\176\167\223\143\102\373\064\203\073\163\243 -\132\041\066\353\107\372\030\027\331\272\146\302\223\244\217\374 -\135\244\255\374\120\152\225\254\274\044\063\321\275\210\177\206 -\365\365\262\163\052\217\174\257\010\362\032\230\077\251\201\145 -\077\301\214\211\305\226\060\232\012\317\364\324\310\064\355\235 -\057\274\215\070\206\123\356\227\237\251\262\143\224\027\215\017 -\334\146\052\174\122\121\165\313\231\216\350\075\134\277\236\073 -\050\215\203\002\017\251\237\162\342\054\053\263\334\146\227\000 -\100\320\244\124\216\233\135\173\105\066\046\326\162\103\353\317 -\300\352\015\334\316\022\346\175\070\237\005\047\250\227\076\351 -\121\306\154\005\050\301\002\017\351\030\155\354\275\234\006\324 -\247\111\364\124\005\153\154\060\361\353\003\325\352\075\152\166 -\302\313\032\050\111\115\177\144\340\372\053\332\163\203\201\377 -\221\003\275\224\273\344\270\216\234\062\143\315\237\273\150\201 -\261\204\133\257\066\277\167\356\035\177\367\111\233\122\354\322 -\167\132\175\221\235\115\302\071\055\344\272\202\370\157\362\116 -\036\017\116\346\077\131\245\043\334\075\207\250\050\130\050\321 -\361\033\066\333\117\304\377\341\214\133\162\214\307\046\003\047 -\243\071\012\001\252\300\262\061\140\203\042\241\117\022\011\001 -\021\257\064\324\317\327\256\142\323\005\007\264\061\165\340\015 -\155\127\117\151\207\371\127\251\272\025\366\310\122\155\241\313 -\234\037\345\374\170\250\065\232\237\101\024\316\245\264\316\224 -\010\034\011\255\126\345\332\266\111\232\112\352\143\030\123\234 -\054\056\303\002\003\001\000\001\243\102\060\100\060\017\006\003 -\125\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006 -\003\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006 -\003\125\035\016\004\026\004\024\067\135\246\232\164\062\302\302 -\371\307\246\025\020\131\270\344\375\345\270\155\060\015\006\011 -\052\206\110\206\367\015\001\001\013\005\000\003\202\002\001\000 -\257\247\317\336\377\340\275\102\215\115\345\042\226\337\150\352 -\175\115\052\175\320\255\075\026\134\103\347\175\300\206\350\172 -\065\143\361\314\201\310\306\013\350\056\122\065\244\246\111\220 -\143\121\254\064\254\005\073\127\000\351\323\142\323\331\051\325 -\124\276\034\020\221\234\262\155\376\131\375\171\367\352\126\320 -\236\150\124\102\217\046\122\342\114\337\057\227\246\057\322\007 -\230\250\363\140\135\113\232\130\127\210\357\202\345\372\257\154 -\201\113\222\217\100\232\223\106\131\313\137\170\026\261\147\076 -\102\013\337\050\331\260\255\230\040\276\103\174\321\136\032\011 -\027\044\215\173\135\225\351\253\301\140\253\133\030\144\200\373 -\255\340\006\175\035\312\131\270\363\170\051\147\306\126\035\257 -\266\265\164\052\166\241\077\373\165\060\237\224\136\073\245\140 -\363\313\134\014\342\016\311\140\370\311\037\026\212\046\335\347 -\047\177\353\045\246\212\275\270\055\066\020\232\261\130\115\232 -\150\117\140\124\345\366\106\023\216\210\254\274\041\102\022\255 -\306\112\211\175\233\301\330\055\351\226\003\364\242\164\014\274 -\000\035\277\326\067\045\147\264\162\213\257\205\275\352\052\003 -\217\314\373\074\104\044\202\342\001\245\013\131\266\064\215\062 -\013\022\015\353\047\302\375\101\327\100\074\162\106\051\300\214 -\352\272\017\361\006\223\056\367\234\250\364\140\076\243\361\070 -\136\216\023\301\263\072\227\207\077\222\312\170\251\034\257\320 -\260\033\046\036\276\160\354\172\365\063\230\352\134\377\053\013 -\004\116\103\335\143\176\016\247\116\170\003\225\076\324\055\060 -\225\021\020\050\056\277\240\002\076\377\136\131\323\005\016\225 -\137\123\105\357\153\207\325\110\315\026\246\226\203\341\337\263 -\006\363\301\024\333\247\354\034\213\135\220\220\015\162\121\347 -\141\371\024\312\257\203\217\277\257\261\012\131\135\334\134\327 -\344\226\255\133\140\035\332\256\227\262\071\331\006\365\166\000 -\023\370\150\114\041\260\065\304\334\125\262\311\301\101\132\034 -\211\300\214\157\164\240\153\063\115\265\001\050\375\255\255\211 -\027\073\246\232\204\274\353\214\352\304\161\044\250\272\051\371 -\010\262\047\126\065\062\137\352\071\373\061\232\325\031\314\360 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "CommScope Public Trust RSA Root-01" -# Issuer: CN=CommScope Public Trust RSA Root-01,O=CommScope,C=US -# Serial Number:3e:03:49:81:75:16:74:31:8e:4c:ab:d5:c5:90:29:96:c5:39:10:dd -# Subject: CN=CommScope Public Trust RSA Root-01,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 16:45:54 2021 -# Not Valid After : Sat Apr 28 16:45:53 2046 -# Fingerprint (SHA-256): 02:BD:F9:6E:2A:45:DD:9B:F1:8F:C7:E1:DB:DF:21:A0:37:9B:A3:C9:C2:61:03:44:CF:D8:D6:06:FE:C1:ED:81 -# Fingerprint (SHA1): 6D:0A:5F:F7:B4:23:06:B4:85:B3:B7:97:64:FC:AC:75:F5:33:F2:93 -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust RSA Root-01" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\155\012\137\367\264\043\006\264\205\263\267\227\144\374\254\165 -\365\063\362\223 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\016\264\025\274\207\143\135\135\002\163\324\046\070\150\163\330 -END -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\061 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\076\003\111\201\165\026\164\061\216\114\253\325\305\220 -\051\226\305\071\020\335 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# -# Certificate "CommScope Public Trust RSA Root-02" -# -# Issuer: CN=CommScope Public Trust RSA Root-02,O=CommScope,C=US -# Serial Number:54:16:bf:3b:7e:39:95:71:8d:d1:aa:00:a5:86:0d:2b:8f:7a:05:4e -# Subject: CN=CommScope Public Trust RSA Root-02,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:16:43 2021 -# Not Valid After : Sat Apr 28 17:16:42 2046 -# Fingerprint (SHA-256): FF:E9:43:D7:93:42:4B:4F:7C:44:0C:1C:3D:64:8D:53:63:F3:4B:82:DC:87:AA:7A:9F:11:8F:C5:DE:E1:01:F1 -# Fingerprint (SHA1): EA:B0:E2:52:1B:89:93:4C:11:68:F2:D8:9A:AC:22:4C:A3:8A:57:AE -CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust RSA Root-02" -CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 -CKA_SUBJECT MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\062 -END -CKA_ID UTF8 "0" -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\124\026\277\073\176\071\225\161\215\321\252\000\245\206 -\015\053\217\172\005\116 -END -CKA_VALUE MULTILINE_OCTAL -\060\202\005\154\060\202\003\124\240\003\002\001\002\002\024\124 -\026\277\073\176\071\225\161\215\321\252\000\245\206\015\053\217 -\172\005\116\060\015\006\011\052\206\110\206\367\015\001\001\013 -\005\000\060\116\061\013\060\011\006\003\125\004\006\023\002\125 -\123\061\022\060\020\006\003\125\004\012\014\011\103\157\155\155 -\123\143\157\160\145\061\053\060\051\006\003\125\004\003\014\042 -\103\157\155\155\123\143\157\160\145\040\120\165\142\154\151\143 -\040\124\162\165\163\164\040\122\123\101\040\122\157\157\164\055 -\060\062\060\036\027\015\062\061\060\064\062\070\061\067\061\066 -\064\063\132\027\015\064\066\060\064\062\070\061\067\061\066\064 -\062\132\060\116\061\013\060\011\006\003\125\004\006\023\002\125 -\123\061\022\060\020\006\003\125\004\012\014\011\103\157\155\155 -\123\143\157\160\145\061\053\060\051\006\003\125\004\003\014\042 -\103\157\155\155\123\143\157\160\145\040\120\165\142\154\151\143 -\040\124\162\165\163\164\040\122\123\101\040\122\157\157\164\055 -\060\062\060\202\002\042\060\015\006\011\052\206\110\206\367\015 -\001\001\001\005\000\003\202\002\017\000\060\202\002\012\002\202 -\002\001\000\341\372\016\373\150\000\022\310\115\325\254\042\304 -\065\001\073\305\124\345\131\166\143\245\177\353\301\304\152\230 -\275\062\215\027\200\353\135\272\321\142\075\045\043\031\065\024 -\351\177\211\247\033\142\074\326\120\347\064\225\003\062\261\264 -\223\042\075\247\342\261\355\346\173\116\056\207\233\015\063\165 -\012\336\252\065\347\176\345\066\230\242\256\045\236\225\263\062 -\226\244\053\130\036\357\077\376\142\064\110\121\321\264\215\102 -\255\140\332\111\152\225\160\335\322\000\342\314\127\143\002\173 -\226\335\111\227\133\222\116\225\323\371\313\051\037\030\112\370 -\001\052\322\143\011\156\044\351\211\322\345\307\042\114\334\163 -\206\107\000\252\015\210\216\256\205\175\112\351\273\063\117\016 -\122\160\235\225\343\174\155\226\133\055\075\137\241\203\106\135 -\266\343\045\270\174\247\031\200\034\352\145\103\334\221\171\066 -\054\164\174\362\147\006\311\211\311\333\277\332\150\277\043\355 -\334\153\255\050\203\171\057\354\070\245\015\067\001\147\047\232 -\351\063\331\063\137\067\241\305\360\253\075\372\170\260\347\054 -\237\366\076\237\140\340\357\110\351\220\105\036\005\121\170\032 -\054\022\054\134\050\254\015\242\043\236\064\217\005\346\242\063 -\316\021\167\023\324\016\244\036\102\037\206\315\160\376\331\056 -\025\075\035\273\270\362\123\127\333\314\306\164\051\234\030\263 -\066\165\070\056\017\124\241\370\222\037\211\226\117\273\324\356 -\235\351\073\066\102\265\012\073\052\324\144\171\066\020\341\371 -\221\003\053\173\040\124\315\015\031\032\310\101\062\064\321\260 -\231\341\220\036\001\100\066\265\267\372\251\345\167\165\244\042 -\201\135\260\213\344\047\022\017\124\210\306\333\205\164\346\267 -\300\327\246\051\372\333\336\363\223\227\047\004\125\057\012\157 -\067\305\075\023\257\012\000\251\054\213\034\201\050\327\357\206 -\061\251\256\362\156\270\312\152\054\124\107\330\052\210\056\257 -\301\007\020\170\254\021\242\057\102\360\067\305\362\270\126\335 -\016\142\055\316\055\126\176\125\362\247\104\366\053\062\364\043 -\250\107\350\324\052\001\170\317\152\303\067\250\236\145\322\054 -\345\372\272\063\301\006\104\366\346\317\245\015\247\146\010\064 -\212\054\363\002\003\001\000\001\243\102\060\100\060\017\006\003 -\125\035\023\001\001\377\004\005\060\003\001\001\377\060\016\006 -\003\125\035\017\001\001\377\004\004\003\002\001\006\060\035\006 -\003\125\035\016\004\026\004\024\107\320\347\261\042\377\235\054 -\365\331\127\140\263\261\261\160\225\357\141\172\060\015\006\011 -\052\206\110\206\367\015\001\001\013\005\000\003\202\002\001\000 -\206\151\261\115\057\351\237\117\042\223\150\216\344\041\231\243 -\316\105\123\033\163\104\123\000\201\141\315\061\343\010\272\201 -\050\050\172\222\271\266\250\310\103\236\307\023\046\115\302\330 -\345\125\234\222\135\120\330\302\053\333\376\346\250\227\317\122 -\072\044\303\145\144\134\107\061\243\145\065\023\303\223\271\367 -\371\121\227\273\244\360\142\207\305\326\006\323\227\203\040\251 -\176\273\266\041\302\245\015\204\000\341\362\047\020\203\272\335 -\003\201\325\335\150\303\146\020\310\321\166\264\263\157\051\236 -\000\371\302\051\365\261\223\031\122\151\032\054\114\240\213\340 -\025\232\061\057\323\210\225\131\156\345\304\263\120\310\024\010 -\112\233\213\023\203\261\244\162\262\073\166\063\101\334\334\252 -\246\007\157\035\044\022\237\310\166\275\057\331\216\364\054\356 -\267\322\070\020\044\066\121\057\343\134\135\201\041\247\332\273 -\116\377\346\007\250\376\271\015\047\154\273\160\132\125\172\023 -\351\361\052\111\151\307\137\207\127\114\103\171\155\072\145\351 -\060\134\101\356\353\167\245\163\022\210\350\277\175\256\345\304 -\250\037\015\216\034\155\120\002\117\046\030\103\336\217\125\205 -\261\013\067\005\140\311\125\071\022\004\241\052\317\161\026\237 -\066\121\111\277\160\073\236\147\234\373\173\171\311\071\034\170 -\254\167\221\124\232\270\165\012\201\122\227\343\146\141\153\355 -\076\070\036\226\141\125\341\221\124\214\355\214\044\037\201\311 -\020\232\163\231\053\026\116\162\000\077\124\033\370\215\272\213 -\347\024\326\266\105\117\140\354\226\256\303\057\002\116\135\235 -\226\111\162\000\262\253\165\134\017\150\133\035\145\302\137\063 -\017\036\017\360\073\206\365\260\116\273\234\367\352\045\005\334 -\255\242\233\113\027\001\276\102\337\065\041\035\255\253\256\364 -\277\256\037\033\323\342\073\374\263\162\163\034\233\050\220\211 -\023\075\035\301\000\107\011\226\232\070\033\335\261\317\015\302 -\264\104\363\226\225\316\062\072\217\064\234\340\027\307\136\316 -\256\015\333\207\070\345\077\133\375\233\031\341\061\101\172\160 -\252\043\153\001\341\105\114\315\224\316\073\236\055\347\210\002 -\042\364\156\350\310\354\326\074\363\271\262\327\167\172\254\173 -END -CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE -CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE -CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE - -# Trust for "CommScope Public Trust RSA Root-02" -# Issuer: CN=CommScope Public Trust RSA Root-02,O=CommScope,C=US -# Serial Number:54:16:bf:3b:7e:39:95:71:8d:d1:aa:00:a5:86:0d:2b:8f:7a:05:4e -# Subject: CN=CommScope Public Trust RSA Root-02,O=CommScope,C=US -# Not Valid Before: Wed Apr 28 17:16:43 2021 -# Not Valid After : Sat Apr 28 17:16:42 2046 -# Fingerprint (SHA-256): FF:E9:43:D7:93:42:4B:4F:7C:44:0C:1C:3D:64:8D:53:63:F3:4B:82:DC:87:AA:7A:9F:11:8F:C5:DE:E1:01:F1 -# Fingerprint (SHA1): EA:B0:E2:52:1B:89:93:4C:11:68:F2:D8:9A:AC:22:4C:A3:8A:57:AE -CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST -CKA_TOKEN CK_BBOOL CK_TRUE -CKA_PRIVATE CK_BBOOL CK_FALSE -CKA_MODIFIABLE CK_BBOOL CK_FALSE -CKA_LABEL UTF8 "CommScope Public Trust RSA Root-02" -CKA_CERT_SHA1_HASH MULTILINE_OCTAL -\352\260\342\122\033\211\223\114\021\150\362\330\232\254\042\114 -\243\212\127\256 -END -CKA_CERT_MD5_HASH MULTILINE_OCTAL -\341\051\371\142\173\166\342\226\155\363\324\327\017\256\037\252 -END -CKA_ISSUER MULTILINE_OCTAL -\060\116\061\013\060\011\006\003\125\004\006\023\002\125\123\061 -\022\060\020\006\003\125\004\012\014\011\103\157\155\155\123\143 -\157\160\145\061\053\060\051\006\003\125\004\003\014\042\103\157 -\155\155\123\143\157\160\145\040\120\165\142\154\151\143\040\124 -\162\165\163\164\040\122\123\101\040\122\157\157\164\055\060\062 -END -CKA_SERIAL_NUMBER MULTILINE_OCTAL -\002\024\124\026\277\073\176\071\225\161\215\321\252\000\245\206 -\015\053\217\172\005\116 -END -CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR -CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST -CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE - -# # Certificate "D-Trust SBR Root CA 1 2022" # # Issuer: CN=D-Trust SBR Root CA 1 2022,O=D-Trust GmbH,C=DE @@ -25972,6 +25121,576 @@ CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE # +# Certificate "TrustAsia SMIME ECC Root CA" +# +# Issuer: CN=TrustAsia SMIME ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:5a:c2:f8:29:4f:e3:7d:c5:5e:1d:18:6f:3b:93:20:1f:ff:7b:ba:2d +# Subject: CN=TrustAsia SMIME ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:59 2024 +# Not Valid After : Sun May 15 05:41:58 2044 +# Fingerprint (SHA-256): 43:64:72:C1:00:9A:32:5C:54:F1:A5:BB:B5:46:8A:7B:AE:EC:CB:E0:5D:E5:F0:99:CB:70:D3:FE:41:E1:3C:16 +# Fingerprint (SHA1): 8C:0D:AA:FE:13:FA:59:F2:DB:9D:0C:97:DA:12:A2:45:1A:02:13:54 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia SMIME ECC Root CA" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\105\103\103\040\122\157\157\164\040\103\101 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\105\103\103\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\132\302\370\051\117\343\175\305\136\035\030\157\073\223 +\040\037\377\173\272\055 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\066\060\202\001\273\240\003\002\001\002\002\024\132 +\302\370\051\117\343\175\305\136\035\030\157\073\223\040\037\377 +\173\272\055\060\012\006\010\052\206\110\316\075\004\003\003\060 +\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061\045 +\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101\163 +\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163\054 +\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023\033 +\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105\040 +\105\103\103\040\122\157\157\164\040\103\101\060\036\027\015\062 +\064\060\065\061\065\060\065\064\061\065\071\132\027\015\064\064 +\060\065\061\065\060\065\064\061\065\070\132\060\132\061\013\060 +\011\006\003\125\004\006\023\002\103\116\061\045\060\043\006\003 +\125\004\012\023\034\124\162\165\163\164\101\163\151\141\040\124 +\145\143\150\156\157\154\157\147\151\145\163\054\040\111\156\143 +\056\061\044\060\042\006\003\125\004\003\023\033\124\162\165\163 +\164\101\163\151\141\040\123\115\111\115\105\040\105\103\103\040 +\122\157\157\164\040\103\101\060\166\060\020\006\007\052\206\110 +\316\075\002\001\006\005\053\201\004\000\042\003\142\000\004\315 +\331\373\047\275\151\354\206\311\220\103\261\160\027\224\247\311 +\167\043\072\077\043\145\323\034\243\035\036\102\124\040\353\320 +\102\273\131\271\213\254\362\206\215\113\216\035\252\226\042\043 +\071\166\155\222\233\353\042\313\172\103\242\163\375\163\113\302 +\045\017\052\261\151\306\377\105\337\251\074\225\200\273\251\036 +\112\223\057\354\034\035\210\364\021\222\067\237\067\230\162\243 +\102\060\100\060\017\006\003\125\035\023\001\001\377\004\005\060 +\003\001\001\377\060\035\006\003\125\035\016\004\026\004\024\061 +\147\346\162\262\015\346\042\240\254\317\176\042\247\131\062\343 +\146\043\245\060\016\006\003\125\035\017\001\001\377\004\004\003 +\002\001\006\060\012\006\010\052\206\110\316\075\004\003\003\003 +\151\000\060\146\002\061\000\335\072\114\215\244\306\177\355\275 +\245\306\117\076\375\061\113\050\326\212\126\337\145\026\167\207 +\115\373\272\062\010\201\340\236\063\110\213\237\224\206\357\001 +\053\224\346\214\326\324\216\002\061\000\237\201\234\260\046\375 +\053\326\362\365\161\204\236\250\307\212\214\326\130\021\122\265 +\270\004\313\314\161\165\143\342\306\031\070\331\155\154\031\161 +\244\026\031\041\223\272\006\104\050\154 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "TrustAsia SMIME ECC Root CA" +# Issuer: CN=TrustAsia SMIME ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:5a:c2:f8:29:4f:e3:7d:c5:5e:1d:18:6f:3b:93:20:1f:ff:7b:ba:2d +# Subject: CN=TrustAsia SMIME ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:59 2024 +# Not Valid After : Sun May 15 05:41:58 2044 +# Fingerprint (SHA-256): 43:64:72:C1:00:9A:32:5C:54:F1:A5:BB:B5:46:8A:7B:AE:EC:CB:E0:5D:E5:F0:99:CB:70:D3:FE:41:E1:3C:16 +# Fingerprint (SHA1): 8C:0D:AA:FE:13:FA:59:F2:DB:9D:0C:97:DA:12:A2:45:1A:02:13:54 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia SMIME ECC Root CA" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\214\015\252\376\023\372\131\362\333\235\014\227\332\022\242\105 +\032\002\023\124 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\225\175\377\225\115\114\152\373\215\014\017\317\102\333\357\040 +END +CKA_ISSUER MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\105\103\103\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\132\302\370\051\117\343\175\305\136\035\030\157\073\223 +\040\037\377\173\272\055 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "TrustAsia SMIME RSA Root CA" +# +# Issuer: CN=TrustAsia SMIME RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:5a:ee:71:df:de:0c:57:85:b5:bb:36:22:d7:b8:76:46:02:73:ca:ff +# Subject: CN=TrustAsia SMIME RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:42:01 2024 +# Not Valid After : Sun May 15 05:42:00 2044 +# Fingerprint (SHA-256): C7:79:6B:EB:62:C1:01:BB:14:3D:26:2A:7C:96:A0:C6:16:81:83:22:3E:F5:0D:69:96:32:D8:6E:03:B8:CC:9B +# Fingerprint (SHA1): 8C:69:21:7C:CE:49:73:36:5A:5C:EF:2B:B0:86:97:50:E3:E3:33:65 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia SMIME RSA Root CA" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\122\123\101\040\122\157\157\164\040\103\101 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\122\123\101\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\132\356\161\337\336\014\127\205\265\273\066\042\327\270 +\166\106\002\163\312\377 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\204\060\202\003\154\240\003\002\001\002\002\024\132 +\356\161\337\336\014\127\205\265\273\066\042\327\270\166\106\002 +\163\312\377\060\015\006\011\052\206\110\206\367\015\001\001\014 +\005\000\060\132\061\013\060\011\006\003\125\004\006\023\002\103 +\116\061\045\060\043\006\003\125\004\012\023\034\124\162\165\163 +\164\101\163\151\141\040\124\145\143\150\156\157\154\157\147\151 +\145\163\054\040\111\156\143\056\061\044\060\042\006\003\125\004 +\003\023\033\124\162\165\163\164\101\163\151\141\040\123\115\111 +\115\105\040\122\123\101\040\122\157\157\164\040\103\101\060\036 +\027\015\062\064\060\065\061\065\060\065\064\062\060\061\132\027 +\015\064\064\060\065\061\065\060\065\064\062\060\060\132\060\132 +\061\013\060\011\006\003\125\004\006\023\002\103\116\061\045\060 +\043\006\003\125\004\012\023\034\124\162\165\163\164\101\163\151 +\141\040\124\145\143\150\156\157\154\157\147\151\145\163\054\040 +\111\156\143\056\061\044\060\042\006\003\125\004\003\023\033\124 +\162\165\163\164\101\163\151\141\040\123\115\111\115\105\040\122 +\123\101\040\122\157\157\164\040\103\101\060\202\002\042\060\015 +\006\011\052\206\110\206\367\015\001\001\001\005\000\003\202\002 +\017\000\060\202\002\012\002\202\002\001\000\230\225\234\255\074 +\131\163\323\223\166\246\110\124\246\034\210\162\114\115\341\202 +\377\032\023\037\120\336\214\331\220\102\321\274\231\323\067\243 +\327\161\072\312\335\136\033\220\141\102\156\217\100\001\163\175 +\037\061\272\324\035\156\004\322\252\220\204\112\063\012\104\237 +\132\031\037\264\156\055\150\374\257\300\237\112\020\022\277\076 +\202\302\202\260\057\347\220\157\220\144\020\203\354\354\066\224 +\014\174\117\340\002\015\075\207\171\102\115\000\345\060\256\160 +\037\025\375\372\317\122\045\066\115\171\040\273\361\020\230\340 +\140\207\311\365\170\014\042\355\002\346\021\154\361\233\132\221 +\021\164\206\320\376\170\222\226\004\303\230\357\306\160\257\251 +\220\252\026\366\042\355\330\372\106\050\161\342\311\010\300\120 +\274\166\243\272\055\226\362\021\371\244\275\020\126\370\047\155 +\053\113\144\210\334\027\135\317\000\010\212\222\256\032\314\022 +\327\337\360\020\050\363\315\072\352\072\022\214\033\347\141\011 +\103\152\344\070\351\376\164\071\333\315\012\073\303\117\123\326 +\256\161\325\070\203\207\037\316\347\114\363\021\125\207\337\267 +\257\367\353\032\206\020\155\250\355\110\335\062\320\333\252\052 +\013\162\167\051\167\375\172\350\077\170\040\052\150\276\336\157 +\010\346\265\205\107\200\067\371\161\226\213\245\230\126\227\174 +\021\145\026\216\324\316\330\047\324\371\132\305\247\215\273\321 +\067\015\245\253\145\135\332\164\223\210\136\333\165\366\177\233 +\302\232\261\155\010\002\014\230\112\273\315\060\257\166\065\002 +\205\126\043\121\011\100\011\005\367\360\075\036\302\310\172\032 +\272\305\101\025\271\015\166\264\264\244\270\105\375\215\243\073 +\075\003\052\315\263\225\177\064\173\335\241\117\331\072\377\047 +\365\015\302\001\234\377\131\165\132\032\311\347\322\375\177\117 +\017\265\376\015\074\346\240\326\373\265\166\134\264\060\115\020 +\077\376\342\353\132\016\261\117\117\120\176\010\063\002\221\127 +\062\111\211\247\100\020\120\027\153\237\143\272\262\262\126\230 +\166\364\377\162\351\004\234\324\247\114\117\366\072\037\132\124 +\061\157\313\272\062\255\370\155\257\105\307\173\143\104\337\302 +\375\170\350\112\212\260\164\165\026\336\217\002\003\001\000\001 +\243\102\060\100\060\017\006\003\125\035\023\001\001\377\004\005 +\060\003\001\001\377\060\035\006\003\125\035\016\004\026\004\024 +\200\032\252\103\301\311\177\213\032\226\105\274\075\273\153\110 +\122\154\133\253\060\016\006\003\125\035\017\001\001\377\004\004 +\003\002\001\006\060\015\006\011\052\206\110\206\367\015\001\001 +\014\005\000\003\202\002\001\000\052\165\201\241\202\040\352\177 +\126\256\011\060\227\020\170\364\331\100\024\122\244\356\152\177 +\360\011\050\326\020\143\340\116\173\311\061\307\010\245\027\353 +\257\206\342\227\007\117\251\016\242\205\314\355\244\200\201\035 +\132\123\006\074\114\032\251\267\204\206\317\174\365\205\012\160 +\231\320\355\066\221\215\347\167\056\316\204\234\050\206\055\045 +\065\214\114\001\346\175\333\141\135\342\167\204\323\001\321\142 +\335\014\242\012\144\244\374\360\355\072\110\362\071\354\065\326 +\241\172\027\161\354\323\322\354\270\046\373\255\025\160\126\112 +\317\144\300\271\140\133\367\346\315\240\302\003\053\371\262\345 +\332\272\245\067\034\330\215\332\171\164\052\147\344\242\172\307 +\054\215\245\301\152\201\154\314\365\251\071\152\042\175\242\342 +\010\315\351\223\333\272\313\037\165\167\236\367\230\257\024\344 +\073\240\114\247\162\347\265\136\123\111\314\377\222\127\361\131 +\053\011\272\351\122\223\300\017\105\013\141\326\154\131\163\013 +\330\371\001\057\332\003\117\067\034\364\337\203\136\013\101\240 +\261\174\071\000\241\154\320\330\264\221\162\053\033\077\242\232 +\321\304\337\053\325\310\225\175\204\315\166\033\334\344\044\306 +\077\025\042\075\205\247\102\053\355\176\161\131\141\110\302\075 +\221\143\100\174\051\263\200\026\012\045\374\030\140\016\123\255 +\016\052\316\374\101\072\315\261\344\152\153\314\071\155\310\115 +\145\270\252\223\210\170\156\017\002\213\340\226\216\164\037\320 +\176\341\164\267\366\201\152\344\043\254\216\375\217\065\035\232 +\161\012\117\052\125\057\376\030\301\000\367\173\110\212\145\257 +\157\010\035\103\347\132\270\037\244\350\003\353\375\114\265\264 +\223\250\061\336\103\235\022\275\347\351\244\322\337\157\374\157 +\106\243\357\061\116\215\027\253\033\251\340\370\251\064\126\241 +\016\347\164\354\250\207\205\330\167\065\113\215\076\156\162\174 +\110\314\037\162\263\161\164\324\044\206\274\310\300\343\171\024 +\001\316\331\372\201\306\134\263\371\135\014\070\276\316\362\216 +\215\137\075\045\341\121\071\043\250\352\000\216\004\263\277\162 +\240\302\272\203\373\315\244\227\165\040\232\277\247\120\342\335 +\255\054\037\364\077\243\310\061 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "TrustAsia SMIME RSA Root CA" +# Issuer: CN=TrustAsia SMIME RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:5a:ee:71:df:de:0c:57:85:b5:bb:36:22:d7:b8:76:46:02:73:ca:ff +# Subject: CN=TrustAsia SMIME RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:42:01 2024 +# Not Valid After : Sun May 15 05:42:00 2044 +# Fingerprint (SHA-256): C7:79:6B:EB:62:C1:01:BB:14:3D:26:2A:7C:96:A0:C6:16:81:83:22:3E:F5:0D:69:96:32:D8:6E:03:B8:CC:9B +# Fingerprint (SHA1): 8C:69:21:7C:CE:49:73:36:5A:5C:EF:2B:B0:86:97:50:E3:E3:33:65 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia SMIME RSA Root CA" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\214\151\041\174\316\111\163\066\132\134\357\053\260\206\227\120 +\343\343\063\145 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\151\206\230\353\337\305\241\132\301\244\153\324\074\243\373\266 +END +CKA_ISSUER MULTILINE_OCTAL +\060\132\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\044\060\042\006\003\125\004\003\023 +\033\124\162\165\163\164\101\163\151\141\040\123\115\111\115\105 +\040\122\123\101\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\132\356\161\337\336\014\127\205\265\273\066\042\327\270 +\166\106\002\163\312\377 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "TrustAsia TLS ECC Root CA" +# +# Issuer: CN=TrustAsia TLS ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:36:74:e1:4d:7c:65:13:c9:ac:83:55:25:a0:3e:52:7e:2f:50:68:c7 +# Subject: CN=TrustAsia TLS ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:56 2024 +# Not Valid After : Sun May 15 05:41:55 2044 +# Fingerprint (SHA-256): C0:07:6B:9E:F0:53:1F:B1:A6:56:D6:7C:4E:BE:97:CD:5D:BA:A4:1E:F4:45:98:AC:C2:48:98:78:C9:2D:87:11 +# Fingerprint (SHA1): B5:EC:39:F3:A1:66:37:AE:C3:05:94:57:E2:BE:11:BE:B7:A1:7F:36 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia TLS ECC Root CA" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\105 +\103\103\040\122\157\157\164\040\103\101 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\105 +\103\103\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\066\164\341\115\174\145\023\311\254\203\125\045\240\076 +\122\176\057\120\150\307 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\061\060\202\001\267\240\003\002\001\002\002\024\066 +\164\341\115\174\145\023\311\254\203\125\045\240\076\122\176\057 +\120\150\307\060\012\006\010\052\206\110\316\075\004\003\003\060 +\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061\045 +\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101\163 +\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163\054 +\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023\031 +\124\162\165\163\164\101\163\151\141\040\124\114\123\040\105\103 +\103\040\122\157\157\164\040\103\101\060\036\027\015\062\064\060 +\065\061\065\060\065\064\061\065\066\132\027\015\064\064\060\065 +\061\065\060\065\064\061\065\065\132\060\130\061\013\060\011\006 +\003\125\004\006\023\002\103\116\061\045\060\043\006\003\125\004 +\012\023\034\124\162\165\163\164\101\163\151\141\040\124\145\143 +\150\156\157\154\157\147\151\145\163\054\040\111\156\143\056\061 +\042\060\040\006\003\125\004\003\023\031\124\162\165\163\164\101 +\163\151\141\040\124\114\123\040\105\103\103\040\122\157\157\164 +\040\103\101\060\166\060\020\006\007\052\206\110\316\075\002\001 +\006\005\053\201\004\000\042\003\142\000\004\270\177\245\133\077 +\001\076\175\360\210\155\256\051\230\341\233\134\123\231\333\367 +\010\377\325\152\340\216\313\104\246\360\301\214\275\117\324\316 +\324\210\123\350\136\127\327\116\276\054\077\363\022\247\000\351 +\202\343\052\133\062\174\113\233\024\051\236\370\055\203\265\353 +\216\061\111\075\046\141\351\035\162\213\211\266\012\273\234\063 +\065\017\332\354\336\251\112\037\311\063\261\243\102\060\100\060 +\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001\377 +\060\035\006\003\125\035\016\004\026\004\024\054\205\123\273\261 +\103\315\062\352\236\243\207\376\242\230\250\246\223\351\020\060 +\016\006\003\125\035\017\001\001\377\004\004\003\002\001\006\060 +\012\006\010\052\206\110\316\075\004\003\003\003\150\000\060\145 +\002\060\124\107\327\303\055\141\206\110\364\171\132\125\015\065 +\057\137\015\366\147\154\167\100\032\106\347\370\150\133\116\047 +\035\270\230\175\177\223\277\010\115\304\332\105\060\241\017\136 +\112\170\002\061\000\243\221\207\362\021\063\203\303\301\212\221 +\072\114\053\120\261\275\042\224\135\065\211\163\203\305\233\031 +\376\264\241\351\324\241\146\266\001\245\066\371\330\150\141\050 +\267\164\341\242\061 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "TrustAsia TLS ECC Root CA" +# Issuer: CN=TrustAsia TLS ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:36:74:e1:4d:7c:65:13:c9:ac:83:55:25:a0:3e:52:7e:2f:50:68:c7 +# Subject: CN=TrustAsia TLS ECC Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:56 2024 +# Not Valid After : Sun May 15 05:41:55 2044 +# Fingerprint (SHA-256): C0:07:6B:9E:F0:53:1F:B1:A6:56:D6:7C:4E:BE:97:CD:5D:BA:A4:1E:F4:45:98:AC:C2:48:98:78:C9:2D:87:11 +# Fingerprint (SHA1): B5:EC:39:F3:A1:66:37:AE:C3:05:94:57:E2:BE:11:BE:B7:A1:7F:36 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia TLS ECC Root CA" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\265\354\071\363\241\146\067\256\303\005\224\127\342\276\021\276 +\267\241\177\066 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\011\110\004\167\322\374\145\223\161\146\261\021\225\117\006\214 +END +CKA_ISSUER MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\105 +\103\103\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\066\164\341\115\174\145\023\311\254\203\125\045\240\076 +\122\176\057\120\150\307 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "TrustAsia TLS RSA Root CA" +# +# Issuer: CN=TrustAsia TLS RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:1c:18:d8:cf:e5:53:3f:22:35:46:53:54:24:3c:6c:47:d1:5c:4a:9c +# Subject: CN=TrustAsia TLS RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:57 2024 +# Not Valid After : Sun May 15 05:41:56 2044 +# Fingerprint (SHA-256): 06:C0:8D:7D:AF:D8:76:97:1E:B1:12:4F:E6:7F:84:7E:C0:C7:A1:58:D3:EA:53:CB:E9:40:E2:EA:97:91:F4:C3 +# Fingerprint (SHA1): A5:46:50:C5:62:EA:95:9A:1A:A7:04:6F:17:58:C7:29:53:3D:03:FA +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia TLS RSA Root CA" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\122 +\123\101\040\122\157\157\164\040\103\101 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\122 +\123\101\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\034\030\330\317\345\123\077\042\065\106\123\124\044\074 +\154\107\321\134\112\234 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\200\060\202\003\150\240\003\002\001\002\002\024\034 +\030\330\317\345\123\077\042\065\106\123\124\044\074\154\107\321 +\134\112\234\060\015\006\011\052\206\110\206\367\015\001\001\014 +\005\000\060\130\061\013\060\011\006\003\125\004\006\023\002\103 +\116\061\045\060\043\006\003\125\004\012\023\034\124\162\165\163 +\164\101\163\151\141\040\124\145\143\150\156\157\154\157\147\151 +\145\163\054\040\111\156\143\056\061\042\060\040\006\003\125\004 +\003\023\031\124\162\165\163\164\101\163\151\141\040\124\114\123 +\040\122\123\101\040\122\157\157\164\040\103\101\060\036\027\015 +\062\064\060\065\061\065\060\065\064\061\065\067\132\027\015\064 +\064\060\065\061\065\060\065\064\061\065\066\132\060\130\061\013 +\060\011\006\003\125\004\006\023\002\103\116\061\045\060\043\006 +\003\125\004\012\023\034\124\162\165\163\164\101\163\151\141\040 +\124\145\143\150\156\157\154\157\147\151\145\163\054\040\111\156 +\143\056\061\042\060\040\006\003\125\004\003\023\031\124\162\165 +\163\164\101\163\151\141\040\124\114\123\040\122\123\101\040\122 +\157\157\164\040\103\101\060\202\002\042\060\015\006\011\052\206 +\110\206\367\015\001\001\001\005\000\003\202\002\017\000\060\202 +\002\012\002\202\002\001\000\303\026\270\033\152\244\104\163\345 +\326\116\364\271\317\133\013\301\321\232\201\365\143\260\217\103 +\301\273\010\132\032\172\341\007\166\046\037\217\151\126\276\376 +\066\140\320\014\203\315\224\352\347\305\055\134\057\005\026\002 +\236\012\250\057\345\140\046\124\226\370\230\100\035\254\256\235 +\164\147\057\124\373\224\143\230\343\046\112\203\306\225\266\011 +\103\120\315\015\175\336\104\016\140\022\117\133\065\275\277\231 +\070\155\175\154\332\342\150\163\037\371\061\245\031\020\163\005 +\052\303\062\031\205\352\064\252\335\102\036\060\215\077\236\265 +\036\141\325\157\275\000\162\162\255\022\077\252\246\111\163\362 +\206\025\225\014\020\137\121\144\316\377\167\270\311\155\254\345 +\325\230\361\231\056\154\343\311\104\371\265\103\047\010\115\366 +\176\336\104\171\273\262\214\034\332\323\113\154\056\326\303\170 +\267\114\325\244\344\332\334\212\216\016\377\017\303\246\140\046 +\050\317\066\277\372\127\012\354\133\077\351\060\026\173\304\333 +\304\324\144\240\060\373\345\375\035\161\222\335\051\217\101\130 +\336\000\255\072\375\075\174\032\250\261\027\360\116\064\170\130 +\045\326\205\041\353\171\035\320\334\253\317\142\074\260\307\227 +\213\326\320\237\323\376\074\336\305\343\374\072\203\160\204\041 +\035\011\302\241\374\273\050\041\145\123\140\172\220\155\226\070 +\133\377\361\327\172\133\155\323\311\160\111\112\272\035\072\320 +\120\332\062\040\031\344\213\077\353\325\026\046\067\074\373\165 +\236\260\007\160\270\024\140\167\334\366\017\134\122\012\274\135 +\155\215\121\012\332\305\030\310\233\155\334\260\203\263\177\243 +\116\170\114\230\045\253\362\176\056\040\136\202\025\246\326\330 +\217\254\345\315\062\206\310\371\344\332\211\342\073\076\223\305 +\023\152\377\307\367\030\374\147\265\357\030\054\124\253\100\323 +\154\115\355\305\310\267\070\117\144\304\224\114\117\240\315\256 +\245\306\047\045\165\047\155\306\332\234\216\260\005\231\325\050 +\021\305\041\324\270\374\307\226\253\112\144\131\141\153\023\374 +\113\314\222\246\017\244\121\277\016\130\220\331\202\203\071\246 +\137\263\372\156\222\263\315\063\016\205\250\361\051\323\253\131 +\255\326\333\336\324\053\201\002\003\001\000\001\243\102\060\100 +\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001\001 +\377\060\035\006\003\125\035\016\004\026\004\024\270\007\221\171 +\134\006\364\106\375\173\131\312\132\046\221\247\105\053\370\123 +\060\016\006\003\125\035\017\001\001\377\004\004\003\002\001\006 +\060\015\006\011\052\206\110\206\367\015\001\001\014\005\000\003 +\202\002\001\000\041\233\152\005\040\135\030\026\247\022\244\367 +\107\077\315\312\073\256\216\300\202\316\334\110\045\170\027\154 +\340\340\160\304\326\226\331\331\366\277\172\234\023\273\123\225 +\222\377\317\222\340\363\305\047\065\127\250\073\242\031\353\370 +\212\243\004\336\151\213\344\074\074\275\345\257\320\022\033\345 +\211\153\163\233\157\045\002\113\220\202\257\100\302\255\272\232 +\140\044\132\201\115\005\030\243\342\063\171\172\013\037\223\355 +\354\071\112\365\023\004\354\215\164\235\201\012\250\157\350\166 +\376\213\117\053\151\022\206\012\064\066\335\202\233\157\117\340 +\163\335\111\177\050\076\311\073\243\127\004\330\223\331\074\051 +\333\022\020\150\341\304\211\270\006\040\347\033\172\274\261\223 +\141\232\031\100\021\265\152\205\127\001\361\266\132\055\046\163 +\047\226\371\271\077\133\320\210\235\344\240\375\272\116\225\011 +\203\177\167\334\121\005\224\235\040\161\166\261\354\372\211\265 +\234\056\205\361\271\133\044\132\261\011\253\332\312\032\007\315 +\206\337\333\151\333\264\110\030\000\055\274\242\304\211\105\043 +\245\016\341\104\145\076\212\301\152\060\035\342\140\370\072\252 +\207\011\102\271\201\222\334\045\210\230\211\361\174\065\361\142 +\312\356\171\370\031\057\376\137\370\333\207\316\352\250\017\014 +\246\350\013\240\074\340\153\224\230\234\177\255\006\346\034\352 +\102\020\137\342\046\025\074\067\071\367\327\274\356\270\345\357 +\003\356\275\042\373\050\206\064\130\304\132\177\141\242\170\017 +\136\363\312\235\274\033\074\247\310\055\366\247\042\021\312\003 +\330\347\147\012\212\016\313\065\216\064\071\330\310\352\215\237 +\144\340\067\260\154\327\305\217\301\220\141\046\333\044\214\036 +\112\300\210\337\065\220\316\077\002\364\144\141\336\307\310\007 +\225\336\062\030\072\217\242\102\100\044\345\326\063\135\174\256 +\357\261\115\117\324\127\220\065\152\334\256\004\227\111\211\064 +\227\056\060\004\347\230\367\333\013\001\220\301\037\012\077\370 +\302\376\116\372\333\232\163\163\026\274\005\270\171\330\131\257 +\006\347\077\147\070\071\261\174\253\224\340\051\024\246\050\362 +\337\155\342\232\333\124\103\370\107\130\243\135\164\025\234\301 +\253\260\307\064 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "TrustAsia TLS RSA Root CA" +# Issuer: CN=TrustAsia TLS RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Serial Number:1c:18:d8:cf:e5:53:3f:22:35:46:53:54:24:3c:6c:47:d1:5c:4a:9c +# Subject: CN=TrustAsia TLS RSA Root CA,O="TrustAsia Technologies, Inc.",C=CN +# Not Valid Before: Wed May 15 05:41:57 2024 +# Not Valid After : Sun May 15 05:41:56 2044 +# Fingerprint (SHA-256): 06:C0:8D:7D:AF:D8:76:97:1E:B1:12:4F:E6:7F:84:7E:C0:C7:A1:58:D3:EA:53:CB:E9:40:E2:EA:97:91:F4:C3 +# Fingerprint (SHA1): A5:46:50:C5:62:EA:95:9A:1A:A7:04:6F:17:58:C7:29:53:3D:03:FA +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "TrustAsia TLS RSA Root CA" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\245\106\120\305\142\352\225\232\032\247\004\157\027\130\307\051 +\123\075\003\372 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\073\236\303\206\017\064\074\153\305\106\304\216\035\347\031\022 +END +CKA_ISSUER MULTILINE_OCTAL +\060\130\061\013\060\011\006\003\125\004\006\023\002\103\116\061 +\045\060\043\006\003\125\004\012\023\034\124\162\165\163\164\101 +\163\151\141\040\124\145\143\150\156\157\154\157\147\151\145\163 +\054\040\111\156\143\056\061\042\060\040\006\003\125\004\003\023 +\031\124\162\165\163\164\101\163\151\141\040\124\114\123\040\122 +\123\101\040\122\157\157\164\040\103\101 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\034\030\330\317\345\123\077\042\065\106\123\124\044\074 +\154\107\321\134\112\234 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# # Certificate "D-TRUST EV Root CA 2 2023" # # Issuer: CN=D-TRUST EV Root CA 2 2023,O=D-Trust GmbH,C=DE @@ -26136,5 +25855,1033 @@ END CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "SwissSign RSA SMIME Root CA 2022 - 1" +# +# Issuer: CN=SwissSign RSA SMIME Root CA 2022 - 1,O=SwissSign AG,C=CH +# Serial Number:46:0e:d4:01:71:90:a0:1a:83:2c:4a:42:10:28:15:d2:61:1b:ad:32 +# Subject: CN=SwissSign RSA SMIME Root CA 2022 - 1,O=SwissSign AG,C=CH +# Not Valid Before: Wed Jun 08 10:53:13 2022 +# Not Valid After : Sat Jun 08 10:53:13 2047 +# Fingerprint (SHA-256): 9A:12:C3:92:BF:E5:78:91:A0:C5:45:30:9D:4D:9F:D5:67:E4:80:CB:61:3D:63:42:27:8B:19:5C:79:A7:93:1F +# Fingerprint (SHA1): 14:D7:65:62:74:10:50:47:9F:8B:32:C6:86:8A:18:FA:E1:19:99:B0 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "SwissSign RSA SMIME Root CA 2022 - 1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\123\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\055\060\053\006\003\125\004\003\023 +\044\123\167\151\163\163\123\151\147\156\040\122\123\101\040\123 +\115\111\115\105\040\122\157\157\164\040\103\101\040\062\060\062 +\062\040\055\040\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\123\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\055\060\053\006\003\125\004\003\023 +\044\123\167\151\163\163\123\151\147\156\040\122\123\101\040\123 +\115\111\115\105\040\122\157\157\164\040\103\101\040\062\060\062 +\062\040\055\040\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\106\016\324\001\161\220\240\032\203\054\112\102\020\050 +\025\322\141\033\255\062 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\227\060\202\003\177\240\003\002\001\002\002\024\106 +\016\324\001\161\220\240\032\203\054\112\102\020\050\025\322\141 +\033\255\062\060\015\006\011\052\206\110\206\367\015\001\001\013 +\005\000\060\123\061\013\060\011\006\003\125\004\006\023\002\103 +\110\061\025\060\023\006\003\125\004\012\023\014\123\167\151\163 +\163\123\151\147\156\040\101\107\061\055\060\053\006\003\125\004 +\003\023\044\123\167\151\163\163\123\151\147\156\040\122\123\101 +\040\123\115\111\115\105\040\122\157\157\164\040\103\101\040\062 +\060\062\062\040\055\040\061\060\036\027\015\062\062\060\066\060 +\070\061\060\065\063\061\063\132\027\015\064\067\060\066\060\070 +\061\060\065\063\061\063\132\060\123\061\013\060\011\006\003\125 +\004\006\023\002\103\110\061\025\060\023\006\003\125\004\012\023 +\014\123\167\151\163\163\123\151\147\156\040\101\107\061\055\060 +\053\006\003\125\004\003\023\044\123\167\151\163\163\123\151\147 +\156\040\122\123\101\040\123\115\111\115\105\040\122\157\157\164 +\040\103\101\040\062\060\062\062\040\055\040\061\060\202\002\042 +\060\015\006\011\052\206\110\206\367\015\001\001\001\005\000\003 +\202\002\017\000\060\202\002\012\002\202\002\001\000\324\373\372 +\077\206\242\231\160\011\072\311\326\241\116\001\316\106\265\055 +\044\110\015\105\351\254\311\032\327\062\200\244\346\323\312\326 +\362\051\067\354\232\054\326\201\316\346\033\235\261\017\101\337 +\130\323\137\252\240\171\131\013\214\255\371\305\371\034\373\303 +\351\065\100\164\303\301\014\313\147\373\234\136\014\043\371\320 +\057\372\114\202\105\034\265\365\037\370\031\156\332\223\267\116 +\150\203\176\142\055\035\214\225\037\160\331\316\132\214\041\135 +\250\276\010\251\126\155\331\367\271\220\231\307\073\327\275\236 +\056\311\147\127\056\041\316\360\062\203\373\004\001\371\267\202 +\104\015\262\313\172\011\241\110\076\117\300\013\152\033\033\354 +\317\035\236\177\006\220\254\050\005\013\250\346\124\073\242\247 +\054\071\023\231\250\373\064\353\365\360\275\001\330\210\021\310 +\256\272\031\002\111\002\334\212\054\264\275\141\140\354\235\170 +\134\152\213\057\027\206\136\362\117\223\000\153\135\305\262\251 +\245\030\352\346\155\176\127\005\373\007\374\274\174\241\103\261 +\146\034\250\147\373\253\067\366\252\252\270\172\101\367\071\325 +\214\237\256\162\066\047\344\142\306\103\231\361\241\101\351\377 +\211\237\017\111\257\311\024\006\027\047\144\071\015\245\264\052 +\133\354\074\373\237\305\137\306\073\135\046\031\362\204\051\270 +\225\104\011\122\375\154\060\320\142\217\050\245\201\226\053\224 +\057\046\165\344\011\214\012\337\070\363\176\135\070\216\202\232 +\214\334\236\256\316\022\102\072\042\362\065\215\117\322\032\310 +\111\063\013\372\066\077\377\054\153\152\040\161\114\315\255\020 +\077\151\062\204\216\134\356\123\210\104\342\335\314\003\060\222 +\206\171\220\052\113\165\373\122\142\304\364\157\115\367\333\043 +\241\030\335\105\123\027\232\143\044\110\211\042\315\176\233\001 +\034\200\050\003\217\133\053\372\037\343\174\031\275\346\217\261 +\100\166\240\362\307\067\262\062\224\020\062\315\247\023\227\361 +\073\054\172\064\042\173\164\072\100\342\257\202\370\301\301\170 +\374\137\344\065\177\300\364\114\360\114\262\352\207\003\162\045 +\131\203\052\010\244\121\336\317\356\250\347\350\100\077\210\360 +\066\253\011\116\330\240\250\177\363\341\011\333\271\002\003\001 +\000\001\243\143\060\141\060\017\006\003\125\035\023\001\001\377 +\004\005\060\003\001\001\377\060\016\006\003\125\035\017\001\001 +\377\004\004\003\002\001\006\060\037\006\003\125\035\043\004\030 +\060\026\200\024\314\056\255\211\214\203\343\100\243\045\151\245 +\352\222\175\322\067\072\307\306\060\035\006\003\125\035\016\004 +\026\004\024\314\056\255\211\214\203\343\100\243\045\151\245\352 +\222\175\322\067\072\307\306\060\015\006\011\052\206\110\206\367 +\015\001\001\013\005\000\003\202\002\001\000\000\007\146\026\245 +\355\307\271\277\274\310\221\255\130\355\136\022\005\263\366\106 +\233\173\344\204\020\057\007\261\132\136\062\156\155\000\360\136 +\307\232\142\071\207\115\344\074\363\276\366\272\152\123\154\204 +\155\007\324\141\312\147\146\276\233\076\105\060\235\121\322\327 +\132\102\256\235\222\016\043\253\320\025\224\076\250\232\312\233 +\355\301\302\137\041\243\231\200\374\271\246\141\016\120\200\200 +\047\307\350\175\240\324\224\172\230\003\347\356\102\213\363\122 +\120\134\357\276\260\166\132\034\011\241\277\203\300\036\166\145 +\320\045\101\133\151\221\223\167\371\214\113\360\054\333\233\006 +\000\027\203\372\132\224\264\206\211\357\274\012\013\022\370\006 +\115\322\163\342\221\070\135\271\152\113\117\247\257\332\046\045 +\222\043\032\174\037\047\015\221\204\357\027\162\366\106\353\153 +\073\067\251\324\325\232\143\272\136\171\214\052\265\233\242\064 +\265\314\226\047\371\171\010\074\177\155\340\377\174\334\305\046 +\257\303\241\172\151\026\335\207\065\163\306\153\061\153\126\001 +\055\117\231\331\356\312\341\320\203\336\266\205\347\026\370\321 +\256\063\110\373\032\317\135\137\212\204\141\164\007\157\031\260 +\121\041\262\241\004\261\173\123\217\357\242\105\255\037\230\335 +\371\152\004\154\252\066\305\257\214\352\051\111\112\347\377\127 +\263\306\074\021\111\030\027\346\146\205\341\350\043\362\213\016 +\074\223\304\077\166\116\176\142\242\051\313\026\060\336\054\151 +\257\221\247\342\127\345\063\114\277\330\216\007\242\177\241\065 +\106\151\112\250\040\051\377\353\336\040\225\131\261\256\115\060 +\153\330\232\264\003\037\302\070\344\040\325\016\326\032\060\114 +\150\234\214\340\355\241\017\216\102\135\353\200\052\022\171\246 +\027\027\264\225\052\216\064\221\247\275\321\254\250\032\103\041 +\213\336\357\340\254\106\045\145\012\306\053\241\233\076\042\350 +\030\070\265\046\366\054\312\010\040\336\060\321\255\124\375\334 +\110\025\237\315\247\101\327\067\070\205\060\117\022\210\103\064 +\203\327\052\115\324\000\127\134\345\312\360\335\341\222\050\053 +\030\165\275\107\244\102\023\351\126\132\215\112\136\316\016\165 +\065\200\163\031\017\054\051\213\273\225\270 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "SwissSign RSA SMIME Root CA 2022 - 1" +# Issuer: CN=SwissSign RSA SMIME Root CA 2022 - 1,O=SwissSign AG,C=CH +# Serial Number:46:0e:d4:01:71:90:a0:1a:83:2c:4a:42:10:28:15:d2:61:1b:ad:32 +# Subject: CN=SwissSign RSA SMIME Root CA 2022 - 1,O=SwissSign AG,C=CH +# Not Valid Before: Wed Jun 08 10:53:13 2022 +# Not Valid After : Sat Jun 08 10:53:13 2047 +# Fingerprint (SHA-256): 9A:12:C3:92:BF:E5:78:91:A0:C5:45:30:9D:4D:9F:D5:67:E4:80:CB:61:3D:63:42:27:8B:19:5C:79:A7:93:1F +# Fingerprint (SHA1): 14:D7:65:62:74:10:50:47:9F:8B:32:C6:86:8A:18:FA:E1:19:99:B0 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "SwissSign RSA SMIME Root CA 2022 - 1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\024\327\145\142\164\020\120\107\237\213\062\306\206\212\030\372 +\341\031\231\260 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\232\063\065\330\302\042\023\366\370\153\226\000\022\032\110\141 +END +CKA_ISSUER MULTILINE_OCTAL +\060\123\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\055\060\053\006\003\125\004\003\023 +\044\123\167\151\163\163\123\151\147\156\040\122\123\101\040\123 +\115\111\115\105\040\122\157\157\164\040\103\101\040\062\060\062 +\062\040\055\040\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\106\016\324\001\161\220\240\032\203\054\112\102\020\050 +\025\322\141\033\255\062 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "SwissSign RSA TLS Root CA 2022 - 1" +# +# Issuer: CN=SwissSign RSA TLS Root CA 2022 - 1,O=SwissSign AG,C=CH +# Serial Number:43:fa:0c:5f:4e:1b:80:18:44:ef:d1:b4:4f:35:1f:44:f4:80:ed:cb +# Subject: CN=SwissSign RSA TLS Root CA 2022 - 1,O=SwissSign AG,C=CH +# Not Valid Before: Wed Jun 08 11:08:22 2022 +# Not Valid After : Sat Jun 08 11:08:22 2047 +# Fingerprint (SHA-256): 19:31:44:F4:31:E0:FD:DB:74:07:17:D4:DE:92:6A:57:11:33:88:4B:43:60:D3:0E:27:29:13:CB:E6:60:CE:41 +# Fingerprint (SHA1): 81:34:0A:BE:4C:CD:CE:CC:E7:7D:CC:8A:D4:57:E2:45:A0:77:5D:CE +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "SwissSign RSA TLS Root CA 2022 - 1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\121\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\053\060\051\006\003\125\004\003\023 +\042\123\167\151\163\163\123\151\147\156\040\122\123\101\040\124 +\114\123\040\122\157\157\164\040\103\101\040\062\060\062\062\040 +\055\040\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\121\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\053\060\051\006\003\125\004\003\023 +\042\123\167\151\163\163\123\151\147\156\040\122\123\101\040\124 +\114\123\040\122\157\157\164\040\103\101\040\062\060\062\062\040 +\055\040\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\103\372\014\137\116\033\200\030\104\357\321\264\117\065 +\037\104\364\200\355\313 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\223\060\202\003\173\240\003\002\001\002\002\024\103 +\372\014\137\116\033\200\030\104\357\321\264\117\065\037\104\364 +\200\355\313\060\015\006\011\052\206\110\206\367\015\001\001\013 +\005\000\060\121\061\013\060\011\006\003\125\004\006\023\002\103 +\110\061\025\060\023\006\003\125\004\012\023\014\123\167\151\163 +\163\123\151\147\156\040\101\107\061\053\060\051\006\003\125\004 +\003\023\042\123\167\151\163\163\123\151\147\156\040\122\123\101 +\040\124\114\123\040\122\157\157\164\040\103\101\040\062\060\062 +\062\040\055\040\061\060\036\027\015\062\062\060\066\060\070\061 +\061\060\070\062\062\132\027\015\064\067\060\066\060\070\061\061 +\060\070\062\062\132\060\121\061\013\060\011\006\003\125\004\006 +\023\002\103\110\061\025\060\023\006\003\125\004\012\023\014\123 +\167\151\163\163\123\151\147\156\040\101\107\061\053\060\051\006 +\003\125\004\003\023\042\123\167\151\163\163\123\151\147\156\040 +\122\123\101\040\124\114\123\040\122\157\157\164\040\103\101\040 +\062\060\062\062\040\055\040\061\060\202\002\042\060\015\006\011 +\052\206\110\206\367\015\001\001\001\005\000\003\202\002\017\000 +\060\202\002\012\002\202\002\001\000\313\052\150\342\013\303\127 +\274\065\143\274\160\245\073\363\214\074\116\127\226\156\303\116 +\066\244\366\002\312\036\252\256\270\336\250\257\035\166\332\272 +\065\320\221\160\007\337\263\006\362\212\362\056\125\121\173\273 +\054\044\313\177\222\046\200\243\264\224\366\202\241\244\350\372 +\165\035\131\363\007\152\141\144\342\306\214\225\257\243\273\216 +\157\126\317\161\314\136\201\141\015\155\362\253\002\056\244\227 +\345\161\374\212\260\221\040\133\234\164\122\155\256\025\047\131 +\170\362\011\312\145\016\177\313\364\353\347\334\251\114\167\366 +\053\026\004\225\256\234\161\245\077\052\332\101\102\347\074\204 +\020\364\341\075\214\153\342\053\221\107\125\117\270\126\276\105 +\336\042\121\115\116\050\331\137\031\101\006\217\016\115\006\340 +\160\100\043\001\152\344\313\023\233\163\254\115\024\110\222\055 +\376\155\247\370\207\153\171\165\341\276\020\261\252\210\100\131 +\124\327\317\304\320\233\104\263\070\151\144\214\201\321\043\176 +\252\071\074\073\017\237\112\173\202\312\153\157\312\042\076\061 +\320\260\320\052\034\222\212\217\330\031\234\107\344\076\014\271 +\302\315\276\101\014\370\244\107\005\333\301\027\060\070\072\151 +\334\315\303\151\043\375\232\017\002\316\020\152\316\312\370\271 +\051\243\066\211\206\256\013\300\117\143\271\006\131\111\136\016 +\301\151\263\012\363\167\176\056\235\214\263\047\230\322\231\215 +\045\247\037\206\263\246\124\160\070\374\175\135\350\117\203\014 +\321\223\345\022\344\124\332\076\362\255\072\336\076\074\105\360 +\050\017\006\271\341\333\227\173\231\105\236\335\376\225\131\004 +\057\165\077\323\256\211\231\206\254\024\264\250\204\372\310\135 +\073\033\130\223\301\027\224\125\310\013\343\202\171\204\237\363 +\000\204\064\356\334\061\325\217\362\372\117\226\114\006\252\170 +\373\336\144\242\043\315\037\076\305\214\274\067\124\016\273\132 +\162\125\357\310\133\265\162\370\170\337\067\040\114\127\221\163 +\222\163\254\030\167\103\202\040\151\354\351\254\051\106\345\013 +\116\370\067\163\211\226\212\034\155\275\357\276\330\266\364\312 +\300\375\107\360\256\013\130\040\305\310\035\066\256\227\215\120 +\203\046\044\051\367\235\073\017\005\002\003\001\000\001\243\143 +\060\141\060\017\006\003\125\035\023\001\001\377\004\005\060\003 +\001\001\377\060\016\006\003\125\035\017\001\001\377\004\004\003 +\002\001\006\060\037\006\003\125\035\043\004\030\060\026\200\024 +\157\216\142\213\223\103\260\341\100\366\247\303\375\361\017\270 +\017\025\070\245\060\035\006\003\125\035\016\004\026\004\024\157 +\216\142\213\223\103\260\341\100\366\247\303\375\361\017\270\017 +\025\070\245\060\015\006\011\052\206\110\206\367\015\001\001\013 +\005\000\003\202\002\001\000\254\054\051\101\175\372\134\365\032 +\225\030\277\054\251\212\251\044\124\165\365\270\100\253\313\250 +\044\121\053\030\077\143\251\256\230\126\053\005\103\042\243\267 +\327\106\236\300\052\022\075\216\226\226\100\337\014\063\213\153 +\067\221\072\225\273\071\051\155\300\002\154\212\224\013\007\002 +\115\030\076\373\373\173\365\166\075\233\366\136\060\006\130\063 +\036\252\170\325\346\124\004\072\262\202\011\215\316\026\063\131 +\105\050\361\245\243\227\016\103\043\375\013\040\200\220\377\343 +\046\317\270\144\221\345\005\217\023\240\166\015\327\067\014\020 +\210\226\364\076\276\225\275\361\303\175\360\243\303\171\107\013 +\134\222\025\143\355\122\165\212\347\106\151\313\121\125\013\052 +\114\365\362\144\117\251\134\377\147\062\216\125\055\062\202\034 +\200\057\152\221\370\313\274\176\030\242\046\250\056\243\123\050 +\207\355\127\345\145\172\116\000\112\133\116\123\311\142\066\275 +\302\216\133\353\314\156\047\201\030\131\213\104\143\237\325\014 +\145\364\051\145\177\221\054\345\177\176\350\211\317\217\040\313 +\155\007\102\021\121\046\062\212\056\072\107\023\270\215\275\107 +\015\011\360\026\244\355\226\206\056\031\330\276\214\072\350\105 +\056\021\272\256\132\347\271\277\261\314\217\340\240\377\270\263 +\321\205\173\171\146\243\071\265\073\146\330\100\276\317\267\147 +\213\110\311\031\045\125\374\275\215\317\136\332\116\246\362\151 +\316\375\177\114\167\320\301\106\065\230\134\043\233\002\105\103 +\224\132\335\274\107\255\042\376\272\136\057\221\051\051\206\173 +\041\336\156\144\267\313\015\217\067\133\243\010\152\353\364\335 +\002\217\120\003\002\261\270\067\150\226\120\353\270\137\324\050 +\212\245\042\014\212\204\360\131\056\325\067\321\141\345\102\163 +\130\052\201\367\166\333\342\342\115\015\137\366\267\276\005\264 +\256\116\015\336\026\075\003\201\263\046\136\113\270\113\000\317 +\377\214\027\272\154\140\055\047\207\067\044\346\172\140\057\265 +\323\203\004\252\117\103\165\242\301\203\262\047\230\053\261\016 +\200\272\300\205\136\102\271\337\261\140\221\323\353\030\176\160 +\170\256\166\203\276\161\132\320\220\343\312\301\026\045\147\112 +\360\266\173\272\341\234\331 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "SwissSign RSA TLS Root CA 2022 - 1" +# Issuer: CN=SwissSign RSA TLS Root CA 2022 - 1,O=SwissSign AG,C=CH +# Serial Number:43:fa:0c:5f:4e:1b:80:18:44:ef:d1:b4:4f:35:1f:44:f4:80:ed:cb +# Subject: CN=SwissSign RSA TLS Root CA 2022 - 1,O=SwissSign AG,C=CH +# Not Valid Before: Wed Jun 08 11:08:22 2022 +# Not Valid After : Sat Jun 08 11:08:22 2047 +# Fingerprint (SHA-256): 19:31:44:F4:31:E0:FD:DB:74:07:17:D4:DE:92:6A:57:11:33:88:4B:43:60:D3:0E:27:29:13:CB:E6:60:CE:41 +# Fingerprint (SHA1): 81:34:0A:BE:4C:CD:CE:CC:E7:7D:CC:8A:D4:57:E2:45:A0:77:5D:CE +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "SwissSign RSA TLS Root CA 2022 - 1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\201\064\012\276\114\315\316\314\347\175\314\212\324\127\342\105 +\240\167\135\316 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\026\056\344\031\166\201\205\272\216\221\130\361\025\357\162\071 +END +CKA_ISSUER MULTILINE_OCTAL +\060\121\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\025\060\023\006\003\125\004\012\023\014\123\167\151\163\163\123 +\151\147\156\040\101\107\061\053\060\051\006\003\125\004\003\023 +\042\123\167\151\163\163\123\151\147\156\040\122\123\101\040\124 +\114\123\040\122\157\157\164\040\103\101\040\062\060\062\062\040 +\055\040\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\024\103\372\014\137\116\033\200\030\104\357\321\264\117\065 +\037\104\364\200\355\313 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "OISTE Client Root ECC G1" +# +# Issuer: CN=OISTE Client Root ECC G1,O=OISTE Foundation,C=CH +# Serial Number:54:ec:97:d6:8b:b4:c4:0b:21:6e:0e:b2:d0:53:c8:7a +# Subject: CN=OISTE Client Root ECC G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:31:40 2023 +# Not Valid After : Sun May 24 14:31:39 2048 +# Fingerprint (SHA-256): D9:A3:24:85:A8:CC:A8:55:39:CE:F1:2F:FF:FF:71:13:78:A1:78:51:D7:3D:A2:73:2A:B4:30:2D:76:3B:D6:2B +# Fingerprint (SHA1): C0:2B:13:F9:1D:77:56:ED:6C:92:83:F1:86:DF:2A:D5:1E:6E:F2:BC +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Client Root ECC G1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\124\354\227\326\213\264\304\013\041\156\016\262\320\123 +\310\172 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\064\060\202\001\272\240\003\002\001\002\002\020\124 +\354\227\326\213\264\304\013\041\156\016\262\320\123\310\172\060 +\012\006\010\052\206\110\316\075\004\003\003\060\113\061\013\060 +\011\006\003\125\004\006\023\002\103\110\061\031\060\027\006\003 +\125\004\012\014\020\117\111\123\124\105\040\106\157\165\156\144 +\141\164\151\157\156\061\041\060\037\006\003\125\004\003\014\030 +\117\111\123\124\105\040\103\154\151\145\156\164\040\122\157\157 +\164\040\105\103\103\040\107\061\060\036\027\015\062\063\060\065 +\063\061\061\064\063\061\064\060\132\027\015\064\070\060\065\062 +\064\061\064\063\061\063\071\132\060\113\061\013\060\011\006\003 +\125\004\006\023\002\103\110\061\031\060\027\006\003\125\004\012 +\014\020\117\111\123\124\105\040\106\157\165\156\144\141\164\151 +\157\156\061\041\060\037\006\003\125\004\003\014\030\117\111\123 +\124\105\040\103\154\151\145\156\164\040\122\157\157\164\040\105 +\103\103\040\107\061\060\166\060\020\006\007\052\206\110\316\075 +\002\001\006\005\053\201\004\000\042\003\142\000\004\210\116\150 +\037\311\236\276\072\004\133\025\303\065\364\314\120\305\010\255 +\070\156\250\074\322\002\272\314\253\045\375\165\100\375\147\031 +\237\033\012\135\366\313\026\173\371\134\036\202\334\025\104\324 +\234\074\155\141\223\105\364\117\317\142\271\337\076\123\215\232 +\324\112\336\210\252\013\246\361\324\141\326\036\164\325\030\262 +\305\115\114\357\200\173\354\015\353\203\071\124\226\243\143\060 +\141\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001 +\001\377\060\037\006\003\125\035\043\004\030\060\026\200\024\231 +\127\073\071\261\055\000\214\041\146\214\225\151\234\155\165\354 +\214\077\372\060\035\006\003\125\035\016\004\026\004\024\231\127 +\073\071\261\055\000\214\041\146\214\225\151\234\155\165\354\214 +\077\372\060\016\006\003\125\035\017\001\001\377\004\004\003\002 +\001\206\060\012\006\010\052\206\110\316\075\004\003\003\003\150 +\000\060\145\002\061\000\226\377\344\202\116\026\042\133\240\205 +\030\074\075\072\217\040\006\010\045\347\365\221\066\031\255\173 +\264\337\133\146\022\067\163\160\355\315\005\050\007\136\010\316 +\015\102\137\031\221\002\002\060\147\111\207\256\006\101\035\040 +\323\061\246\252\046\067\361\047\212\141\015\376\232\006\103\247 +\056\236\046\107\243\062\030\213\350\136\120\005\361\260\172\110 +\166\336\333\241\142\112\272\167 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "OISTE Client Root ECC G1" +# Issuer: CN=OISTE Client Root ECC G1,O=OISTE Foundation,C=CH +# Serial Number:54:ec:97:d6:8b:b4:c4:0b:21:6e:0e:b2:d0:53:c8:7a +# Subject: CN=OISTE Client Root ECC G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:31:40 2023 +# Not Valid After : Sun May 24 14:31:39 2048 +# Fingerprint (SHA-256): D9:A3:24:85:A8:CC:A8:55:39:CE:F1:2F:FF:FF:71:13:78:A1:78:51:D7:3D:A2:73:2A:B4:30:2D:76:3B:D6:2B +# Fingerprint (SHA1): C0:2B:13:F9:1D:77:56:ED:6C:92:83:F1:86:DF:2A:D5:1E:6E:F2:BC +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Client Root ECC G1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\300\053\023\371\035\167\126\355\154\222\203\361\206\337\052\325 +\036\156\362\274 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\121\257\341\070\170\021\354\345\310\237\135\233\065\362\114\054 +END +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\124\354\227\326\213\264\304\013\041\156\016\262\320\123 +\310\172 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "OISTE Client Root RSA G1" +# +# Issuer: CN=OISTE Client Root RSA G1,O=OISTE Foundation,C=CH +# Serial Number:34:17:6f:59:01:88:1b:aa:a5:dd:c8:48:bb:b4:3b:73 +# Subject: CN=OISTE Client Root RSA G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:23:29 2023 +# Not Valid After : Sun May 24 14:23:28 2048 +# Fingerprint (SHA-256): D0:2A:0F:99:4A:86:8C:66:39:5F:2E:7A:88:0D:F5:09:BD:0C:29:C9:6D:E1:60:15:A0:FD:50:1E:DA:4F:96:A9 +# Fingerprint (SHA1): BD:A8:13:20:E0:BF:97:ED:A2:8E:9E:18:5F:F2:D5:FE:E5:2B:13:D5 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Client Root RSA G1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\064\027\157\131\001\210\033\252\245\335\310\110\273\264 +\073\163 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\203\060\202\003\153\240\003\002\001\002\002\020\064 +\027\157\131\001\210\033\252\245\335\310\110\273\264\073\163\060 +\015\006\011\052\206\110\206\367\015\001\001\014\005\000\060\113 +\061\013\060\011\006\003\125\004\006\023\002\103\110\061\031\060 +\027\006\003\125\004\012\014\020\117\111\123\124\105\040\106\157 +\165\156\144\141\164\151\157\156\061\041\060\037\006\003\125\004 +\003\014\030\117\111\123\124\105\040\103\154\151\145\156\164\040 +\122\157\157\164\040\122\123\101\040\107\061\060\036\027\015\062 +\063\060\065\063\061\061\064\062\063\062\071\132\027\015\064\070 +\060\065\062\064\061\064\062\063\062\070\132\060\113\061\013\060 +\011\006\003\125\004\006\023\002\103\110\061\031\060\027\006\003 +\125\004\012\014\020\117\111\123\124\105\040\106\157\165\156\144 +\141\164\151\157\156\061\041\060\037\006\003\125\004\003\014\030 +\117\111\123\124\105\040\103\154\151\145\156\164\040\122\157\157 +\164\040\122\123\101\040\107\061\060\202\002\042\060\015\006\011 +\052\206\110\206\367\015\001\001\001\005\000\003\202\002\017\000 +\060\202\002\012\002\202\002\001\000\272\117\376\376\124\023\265 +\204\074\274\340\323\061\361\035\156\334\304\123\161\372\344\071 +\121\103\166\175\222\037\201\177\000\153\101\302\346\332\334\030 +\115\154\027\131\160\011\063\142\354\151\210\055\260\335\131\371 +\141\140\140\126\361\266\264\357\353\207\320\023\376\303\317\157 +\217\176\071\130\121\263\211\002\216\124\225\036\042\137\253\050 +\005\103\047\370\105\364\011\102\046\224\376\275\023\170\273\221 +\362\020\020\234\015\147\174\332\144\040\353\172\060\032\272\110 +\015\170\124\052\231\061\064\253\313\246\152\347\014\147\071\146 +\244\046\250\047\050\347\363\346\074\163\344\053\314\157\061\056 +\023\164\141\313\150\346\322\063\316\122\274\176\145\044\132\041 +\201\061\103\252\262\234\321\030\347\141\074\122\257\200\211\351 +\064\106\336\371\115\231\132\155\035\275\306\045\321\223\125\216 +\370\047\222\103\072\214\225\105\100\343\211\030\247\206\301\131 +\230\312\333\046\034\023\300\214\201\271\230\260\255\151\255\156 +\030\343\173\142\101\365\255\066\376\013\264\173\040\137\237\251 +\156\371\231\202\022\122\322\212\304\124\170\264\174\367\101\233 +\003\347\007\136\263\302\271\111\144\147\222\026\304\140\220\016 +\260\202\175\063\255\320\066\352\321\166\153\174\210\107\230\254 +\033\371\264\120\214\141\201\151\330\061\363\215\372\076\362\365 +\113\257\316\303\035\357\137\050\033\353\030\326\240\130\122\062 +\276\102\157\315\111\227\042\301\160\271\323\343\140\117\336\203 +\202\240\116\060\275\163\123\302\275\027\375\240\300\230\217\352 +\016\027\007\346\103\225\040\116\333\021\250\371\343\323\270\047 +\107\014\047\333\022\353\201\125\314\165\333\237\323\027\103\304 +\373\353\212\050\155\351\257\104\120\132\103\373\361\071\342\223 +\120\317\230\374\104\226\130\070\245\245\355\105\303\122\102\005 +\247\357\345\074\244\254\075\347\326\251\126\005\252\260\303\247 +\031\344\345\075\327\127\104\155\224\021\037\312\160\310\374\271 +\114\314\101\132\203\164\123\220\170\317\326\324\056\117\261\252 +\115\056\365\321\010\133\072\144\357\310\247\250\172\141\354\354 +\246\325\210\116\266\124\324\130\221\302\045\144\221\274\012\024 +\075\222\024\232\265\013\006\351\057\002\003\001\000\001\243\143 +\060\141\060\017\006\003\125\035\023\001\001\377\004\005\060\003 +\001\001\377\060\037\006\003\125\035\043\004\030\060\026\200\024 +\051\202\045\065\012\072\276\222\053\344\011\003\344\354\217\215 +\070\162\071\313\060\035\006\003\125\035\016\004\026\004\024\051 +\202\045\065\012\072\276\222\053\344\011\003\344\354\217\215\070 +\162\071\313\060\016\006\003\125\035\017\001\001\377\004\004\003 +\002\001\206\060\015\006\011\052\206\110\206\367\015\001\001\014 +\005\000\003\202\002\001\000\155\043\206\302\377\365\340\310\300 +\125\212\140\061\314\227\103\107\160\103\323\343\354\122\372\323 +\302\236\373\211\062\032\312\106\223\117\004\227\053\333\320\234 +\204\015\225\007\102\124\376\357\151\041\337\222\003\056\217\067 +\041\043\167\251\167\067\154\240\304\256\234\247\130\071\112\025 +\227\142\106\203\121\040\355\077\302\243\361\303\142\047\320\254 +\023\036\376\074\122\035\220\325\143\361\251\136\352\177\347\347 +\353\226\132\121\354\324\251\033\343\014\224\146\254\313\210\222 +\111\276\163\134\212\340\152\274\246\201\315\263\134\324\043\222 +\310\115\371\040\214\160\224\113\150\155\362\217\036\154\065\367 +\350\137\324\327\275\040\067\122\146\377\053\273\111\146\267\161 +\250\054\137\163\017\007\222\347\116\137\245\006\333\311\212\074 +\227\305\102\352\175\017\201\033\127\353\236\014\017\377\243\047 +\040\111\123\246\263\072\114\313\155\060\065\332\362\360\232\376 +\120\337\155\134\044\075\115\167\152\175\206\137\114\320\341\246 +\264\256\004\023\001\220\361\200\150\204\007\224\202\007\203\353 +\221\345\223\016\165\221\256\243\043\040\111\144\324\272\071\226 +\127\160\356\125\064\050\174\326\257\312\251\236\346\311\001\311 +\007\301\320\104\261\200\264\121\120\252\217\366\234\345\147\163 +\320\033\352\203\065\027\057\120\306\336\126\307\273\243\003\313 +\342\241\030\350\370\316\121\006\243\322\003\100\141\032\247\147 +\127\203\374\321\022\271\050\252\332\116\153\325\234\330\205\067 +\332\275\042\327\064\131\234\032\246\316\170\326\224\170\007\006 +\017\261\223\041\240\111\307\020\236\012\256\121\167\032\371\161 +\220\303\255\230\017\212\051\152\140\001\252\117\255\040\003\055 +\152\216\243\013\152\326\375\223\014\212\141\313\275\050\361\137 +\161\375\270\063\071\326\112\361\366\262\150\122\076\145\217\103 +\235\201\044\044\366\050\114\065\247\375\063\012\245\170\301\004 +\037\354\111\152\304\256\325\104\026\246\247\215\177\332\041\226 +\076\250\272\026\147\324\251\241\347\302\232\370\020\331\073\232 +\356\150\366\057\000\356\313\273\146\215\042\070\206\364\277\137 +\170\251\310\240\035\132\273\165\120\371\122\013\017\035\002\054 +\024\032\363\207\152\167\363 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "OISTE Client Root RSA G1" +# Issuer: CN=OISTE Client Root RSA G1,O=OISTE Foundation,C=CH +# Serial Number:34:17:6f:59:01:88:1b:aa:a5:dd:c8:48:bb:b4:3b:73 +# Subject: CN=OISTE Client Root RSA G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:23:29 2023 +# Not Valid After : Sun May 24 14:23:28 2048 +# Fingerprint (SHA-256): D0:2A:0F:99:4A:86:8C:66:39:5F:2E:7A:88:0D:F5:09:BD:0C:29:C9:6D:E1:60:15:A0:FD:50:1E:DA:4F:96:A9 +# Fingerprint (SHA1): BD:A8:13:20:E0:BF:97:ED:A2:8E:9E:18:5F:F2:D5:FE:E5:2B:13:D5 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Client Root RSA G1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\275\250\023\040\340\277\227\355\242\216\236\030\137\362\325\376 +\345\053\023\325 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\232\033\325\012\267\026\352\272\241\212\331\361\036\015\371\023 +END +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\103\154\151\145\156 +\164\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\064\027\157\131\001\210\033\252\245\335\310\110\273\264 +\073\163 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "OISTE Server Root ECC G1" +# +# Issuer: CN=OISTE Server Root ECC G1,O=OISTE Foundation,C=CH +# Serial Number:23:f9:c3:d6:35:af:8f:28:4b:1f:f0:54:ea:7e:97:9d +# Subject: CN=OISTE Server Root ECC G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:42:28 2023 +# Not Valid After : Sun May 24 14:42:27 2048 +# Fingerprint (SHA-256): EE:C9:97:C0:C3:0F:21:6F:7E:3B:8B:30:7D:2B:AE:42:41:2D:75:3F:C8:21:9D:AF:D1:52:0B:25:72:85:0F:49 +# Fingerprint (SHA1): 3B:F6:8B:09:AE:2A:92:7B:BA:E3:8D:3F:11:95:D9:E6:44:0C:45:E2 +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Server Root ECC G1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\043\371\303\326\065\257\217\050\113\037\360\124\352\176 +\227\235 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\065\060\202\001\272\240\003\002\001\002\002\020\043 +\371\303\326\065\257\217\050\113\037\360\124\352\176\227\235\060 +\012\006\010\052\206\110\316\075\004\003\003\060\113\061\013\060 +\011\006\003\125\004\006\023\002\103\110\061\031\060\027\006\003 +\125\004\012\014\020\117\111\123\124\105\040\106\157\165\156\144 +\141\164\151\157\156\061\041\060\037\006\003\125\004\003\014\030 +\117\111\123\124\105\040\123\145\162\166\145\162\040\122\157\157 +\164\040\105\103\103\040\107\061\060\036\027\015\062\063\060\065 +\063\061\061\064\064\062\062\070\132\027\015\064\070\060\065\062 +\064\061\064\064\062\062\067\132\060\113\061\013\060\011\006\003 +\125\004\006\023\002\103\110\061\031\060\027\006\003\125\004\012 +\014\020\117\111\123\124\105\040\106\157\165\156\144\141\164\151 +\157\156\061\041\060\037\006\003\125\004\003\014\030\117\111\123 +\124\105\040\123\145\162\166\145\162\040\122\157\157\164\040\105 +\103\103\040\107\061\060\166\060\020\006\007\052\206\110\316\075 +\002\001\006\005\053\201\004\000\042\003\142\000\004\027\057\372 +\022\274\254\030\363\012\364\104\326\166\102\236\263\350\037\267 +\171\251\130\266\370\145\321\072\041\117\250\353\243\276\244\062 +\162\363\266\001\311\053\375\167\205\156\123\335\255\352\252\056 +\045\222\266\351\041\021\250\257\265\114\013\363\226\140\232\073 +\347\352\032\170\056\264\075\345\050\336\034\200\272\134\156\015 +\333\031\245\343\077\234\052\270\100\113\335\346\117\243\143\060 +\141\060\017\006\003\125\035\023\001\001\377\004\005\060\003\001 +\001\377\060\037\006\003\125\035\043\004\030\060\026\200\024\067 +\115\210\145\317\374\075\212\325\243\361\111\300\116\014\020\157 +\102\264\234\060\035\006\003\125\035\016\004\026\004\024\067\115 +\210\145\317\374\075\212\325\243\361\111\300\116\014\020\157\102 +\264\234\060\016\006\003\125\035\017\001\001\377\004\004\003\002 +\001\206\060\012\006\010\052\206\110\316\075\004\003\003\003\151 +\000\060\146\002\061\000\251\052\060\035\320\302\237\220\121\121 +\100\076\225\124\041\315\026\146\367\123\154\010\026\071\320\022 +\174\177\143\033\337\343\070\000\071\331\055\123\040\105\013\034 +\140\147\061\103\045\355\002\061\000\222\211\256\351\134\142\203 +\142\141\371\055\127\253\126\271\021\335\045\276\152\116\112\032 +\202\153\334\317\323\274\112\263\074\327\056\233\333\370\050\151 +\274\153\055\354\061\241\072\343\127 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "OISTE Server Root ECC G1" +# Issuer: CN=OISTE Server Root ECC G1,O=OISTE Foundation,C=CH +# Serial Number:23:f9:c3:d6:35:af:8f:28:4b:1f:f0:54:ea:7e:97:9d +# Subject: CN=OISTE Server Root ECC G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:42:28 2023 +# Not Valid After : Sun May 24 14:42:27 2048 +# Fingerprint (SHA-256): EE:C9:97:C0:C3:0F:21:6F:7E:3B:8B:30:7D:2B:AE:42:41:2D:75:3F:C8:21:9D:AF:D1:52:0B:25:72:85:0F:49 +# Fingerprint (SHA1): 3B:F6:8B:09:AE:2A:92:7B:BA:E3:8D:3F:11:95:D9:E6:44:0C:45:E2 +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Server Root ECC G1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\073\366\213\011\256\052\222\173\272\343\215\077\021\225\331\346 +\104\014\105\342 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\102\247\322\065\256\002\222\333\031\166\010\336\057\005\264\324 +END +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\105\103\103\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\043\371\303\326\065\257\217\050\113\037\360\124\352\176 +\227\235 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "OISTE Server Root RSA G1" +# +# Issuer: CN=OISTE Server Root RSA G1,O=OISTE Foundation,C=CH +# Serial Number:55:a5:d9:67:94:28:c6:ed:0c:fa:27:dd:5b:01:4d:18 +# Subject: CN=OISTE Server Root RSA G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:37:16 2023 +# Not Valid After : Sun May 24 14:37:15 2048 +# Fingerprint (SHA-256): 9A:E3:62:32:A5:18:9F:FD:DB:35:3D:FD:26:52:0C:01:53:95:D2:27:77:DA:C5:9D:B5:7B:98:C0:89:A6:51:E6 +# Fingerprint (SHA1): F7:00:34:25:94:88:68:31:E4:34:87:3F:70:FE:86:B3:86:9F:F0:6E +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Server Root RSA G1" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\125\245\331\147\224\050\306\355\014\372\047\335\133\001 +\115\030 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\005\203\060\202\003\153\240\003\002\001\002\002\020\125 +\245\331\147\224\050\306\355\014\372\047\335\133\001\115\030\060 +\015\006\011\052\206\110\206\367\015\001\001\014\005\000\060\113 +\061\013\060\011\006\003\125\004\006\023\002\103\110\061\031\060 +\027\006\003\125\004\012\014\020\117\111\123\124\105\040\106\157 +\165\156\144\141\164\151\157\156\061\041\060\037\006\003\125\004 +\003\014\030\117\111\123\124\105\040\123\145\162\166\145\162\040 +\122\157\157\164\040\122\123\101\040\107\061\060\036\027\015\062 +\063\060\065\063\061\061\064\063\067\061\066\132\027\015\064\070 +\060\065\062\064\061\064\063\067\061\065\132\060\113\061\013\060 +\011\006\003\125\004\006\023\002\103\110\061\031\060\027\006\003 +\125\004\012\014\020\117\111\123\124\105\040\106\157\165\156\144 +\141\164\151\157\156\061\041\060\037\006\003\125\004\003\014\030 +\117\111\123\124\105\040\123\145\162\166\145\162\040\122\157\157 +\164\040\122\123\101\040\107\061\060\202\002\042\060\015\006\011 +\052\206\110\206\367\015\001\001\001\005\000\003\202\002\017\000 +\060\202\002\012\002\202\002\001\000\252\256\364\253\202\317\373 +\345\067\013\347\325\226\255\220\350\113\051\334\125\140\343\314 +\274\263\274\055\222\271\344\243\172\361\201\264\236\162\162\103 +\337\077\253\013\046\264\356\173\032\151\373\050\320\162\134\112 +\155\151\231\360\143\036\014\322\261\377\326\214\064\320\356\333 +\254\110\271\352\260\024\216\330\007\251\044\230\335\351\011\276 +\250\042\033\131\071\321\047\207\334\034\315\370\373\263\353\351 +\223\170\355\017\316\067\174\046\167\156\241\330\054\041\114\344 +\212\117\307\023\074\156\307\325\023\227\262\250\333\044\151\203 +\126\323\151\313\202\022\273\235\033\362\370\064\362\230\053\052 +\216\004\147\366\343\207\241\035\255\156\316\066\164\016\136\063 +\073\313\333\121\227\224\152\225\074\316\030\132\156\113\306\374 +\007\217\056\032\271\112\367\144\064\051\334\246\215\120\341\215 +\213\113\345\110\033\156\056\200\020\077\344\237\033\145\077\021 +\264\352\127\151\237\264\000\353\205\044\231\044\365\041\235\227 +\252\373\064\177\002\153\025\220\255\273\236\132\031\177\244\214 +\330\372\155\050\374\070\307\343\114\255\152\316\331\116\223\222 +\216\314\014\147\277\013\113\226\316\146\147\123\150\313\027\021 +\216\131\367\254\234\033\271\216\150\104\267\030\257\346\345\017 +\145\334\225\011\260\223\022\265\037\076\224\245\307\210\165\041 +\261\336\011\044\052\114\342\274\354\114\147\107\302\051\210\271 +\012\272\371\301\164\316\214\030\046\145\332\367\157\306\214\173 +\150\134\013\356\143\300\136\113\361\116\314\237\057\017\341\350 +\232\172\223\361\340\310\333\277\047\346\145\051\173\066\340\063 +\025\163\362\235\153\204\010\150\053\066\007\053\047\314\170\330 +\152\207\016\107\164\364\252\240\023\135\144\176\364\333\024\256 +\373\072\344\057\301\145\343\271\172\100\154\360\006\267\173\050 +\233\327\341\137\070\163\224\254\331\160\223\055\334\204\257\106 +\034\242\172\054\077\201\046\102\347\324\330\305\154\204\146\021 +\213\167\153\124\034\243\265\330\020\360\256\051\367\147\010\210 +\027\134\270\227\171\317\352\053\052\356\130\063\345\155\351\051 +\252\145\001\015\202\023\354\045\013\135\054\100\162\025\051\323 +\220\054\367\032\103\325\152\360\151\002\003\001\000\001\243\143 +\060\141\060\017\006\003\125\035\023\001\001\377\004\005\060\003 +\001\001\377\060\037\006\003\125\035\043\004\030\060\026\200\024 +\362\311\301\017\015\143\000\273\354\105\016\112\037\265\261\263 +\066\315\016\215\060\035\006\003\125\035\016\004\026\004\024\362 +\311\301\017\015\143\000\273\354\105\016\112\037\265\261\263\066 +\315\016\215\060\016\006\003\125\035\017\001\001\377\004\004\003 +\002\001\206\060\015\006\011\052\206\110\206\367\015\001\001\014 +\005\000\003\202\002\001\000\064\147\171\262\072\306\345\075\367 +\043\162\271\011\357\222\255\047\037\240\116\012\262\365\332\027 +\014\242\205\322\176\222\121\375\025\145\327\134\153\144\026\356 +\212\105\312\014\103\066\104\065\331\177\376\171\072\034\350\306 +\344\075\153\167\324\041\020\343\366\363\040\116\251\276\211\363 +\034\234\251\337\274\060\072\027\321\062\103\320\252\212\162\034 +\121\050\114\335\066\310\344\055\147\175\221\207\034\235\274\374 +\253\050\226\136\141\134\270\042\063\030\110\026\120\352\312\057 +\351\245\111\334\177\074\244\031\274\066\255\222\342\271\364\113 +\325\353\010\255\347\170\376\027\300\135\207\167\350\147\167\117 +\000\146\257\364\261\003\072\276\022\174\101\065\345\364\246\033 +\107\213\313\171\367\326\277\027\156\116\145\360\370\332\127\301 +\224\201\345\172\126\015\273\106\177\157\221\375\175\346\027\344 +\201\047\273\005\210\126\335\040\245\367\230\055\221\031\151\061 +\137\233\060\362\231\255\162\100\226\314\330\167\146\233\264\325 +\016\262\020\376\024\252\303\200\161\235\075\215\350\175\024\154 +\141\144\206\106\246\327\124\305\266\327\220\026\106\245\205\312 +\236\072\343\346\023\026\266\025\043\314\251\051\122\375\000\306 +\366\220\216\126\217\211\010\335\226\252\346\323\152\251\206\065 +\366\325\105\170\102\112\106\374\003\310\136\330\146\366\105\145 +\044\264\276\207\173\125\040\235\367\235\265\052\374\271\142\031 +\313\154\073\257\323\155\070\154\253\173\246\036\215\374\351\236 +\376\153\025\271\333\202\232\313\230\337\163\241\220\240\240\305 +\340\350\001\250\243\024\234\310\301\232\254\025\120\063\215\355 +\174\052\213\163\225\100\103\046\374\201\244\052\137\071\220\267 +\047\313\121\167\370\226\223\036\317\362\167\175\037\106\223\242 +\131\036\225\104\305\055\165\144\260\326\371\340\074\151\352\004 +\265\034\013\342\106\104\115\103\073\227\111\161\021\275\044\266 +\302\255\162\124\006\376\153\030\371\167\333\051\054\122\236\155 +\167\173\142\375\017\115\216\230\062\060\060\161\022\326\045\065 +\343\237\370\157\234\265\353\152\033\255\352\020\323\226\026\162 +\006\041\045\306\114\274\217\160\273\014\344\136\042\203\055\322 +\276\376\205\133\264\344\275 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "OISTE Server Root RSA G1" +# Issuer: CN=OISTE Server Root RSA G1,O=OISTE Foundation,C=CH +# Serial Number:55:a5:d9:67:94:28:c6:ed:0c:fa:27:dd:5b:01:4d:18 +# Subject: CN=OISTE Server Root RSA G1,O=OISTE Foundation,C=CH +# Not Valid Before: Wed May 31 14:37:16 2023 +# Not Valid After : Sun May 24 14:37:15 2048 +# Fingerprint (SHA-256): 9A:E3:62:32:A5:18:9F:FD:DB:35:3D:FD:26:52:0C:01:53:95:D2:27:77:DA:C5:9D:B5:7B:98:C0:89:A6:51:E6 +# Fingerprint (SHA1): F7:00:34:25:94:88:68:31:E4:34:87:3F:70:FE:86:B3:86:9F:F0:6E +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "OISTE Server Root RSA G1" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\367\000\064\045\224\210\150\061\344\064\207\077\160\376\206\263 +\206\237\360\156 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\043\247\236\324\160\270\271\024\127\101\212\176\104\131\342\150 +END +CKA_ISSUER MULTILINE_OCTAL +\060\113\061\013\060\011\006\003\125\004\006\023\002\103\110\061 +\031\060\027\006\003\125\004\012\014\020\117\111\123\124\105\040 +\106\157\165\156\144\141\164\151\157\156\061\041\060\037\006\003 +\125\004\003\014\030\117\111\123\124\105\040\123\145\162\166\145 +\162\040\122\157\157\164\040\122\123\101\040\107\061 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\020\125\245\331\147\224\050\306\355\014\372\047\335\133\001 +\115\030 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST +CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE + +# +# Certificate "e-Szigno TLS Root CA 2023" +# +# Issuer: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Serial Number:00:e8:6f:18:7b:d6:39:6b:98:4a:49:98:0a +# Subject: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Not Valid Before: Mon Jul 17 14:00:00 2023 +# Not Valid After : Sat Jul 17 14:00:00 2038 +# Fingerprint (SHA-256): B4:91:41:50:2D:00:66:3D:74:0F:2E:7E:C3:40:C5:28:00:96:26:66:12:1A:36:D0:9C:F7:DD:2B:90:38:4F:B4 +# Fingerprint (SHA1): 6F:9A:D5:D5:DF:E8:2C:EB:BE:37:07:EE:4F:4F:52:58:29:41:D1:FE +CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "e-Szigno TLS Root CA 2023" +CKA_CERTIFICATE_TYPE CK_CERTIFICATE_TYPE CKC_X_509 +CKA_SUBJECT MULTILINE_OCTAL +\060\165\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\042\060\040\006\003\125\004\003\014\031\145\055 +\123\172\151\147\156\157\040\124\114\123\040\122\157\157\164\040 +\103\101\040\062\060\062\063 +END +CKA_ID UTF8 "0" +CKA_ISSUER MULTILINE_OCTAL +\060\165\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\042\060\040\006\003\125\004\003\014\031\145\055 +\123\172\151\147\156\157\040\124\114\123\040\122\157\157\164\040 +\103\101\040\062\060\062\063 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\015\000\350\157\030\173\326\071\153\230\112\111\230\012 +END +CKA_VALUE MULTILINE_OCTAL +\060\202\002\317\060\202\002\061\240\003\002\001\002\002\015\000 +\350\157\030\173\326\071\153\230\112\111\230\012\060\012\006\010 +\052\206\110\316\075\004\003\004\060\165\061\013\060\011\006\003 +\125\004\006\023\002\110\125\061\021\060\017\006\003\125\004\007 +\014\010\102\165\144\141\160\145\163\164\061\026\060\024\006\003 +\125\004\012\014\015\115\151\143\162\157\163\145\143\040\114\164 +\144\056\061\027\060\025\006\003\125\004\141\014\016\126\101\124 +\110\125\055\062\063\065\070\064\064\071\067\061\042\060\040\006 +\003\125\004\003\014\031\145\055\123\172\151\147\156\157\040\124 +\114\123\040\122\157\157\164\040\103\101\040\062\060\062\063\060 +\036\027\015\062\063\060\067\061\067\061\064\060\060\060\060\132 +\027\015\063\070\060\067\061\067\061\064\060\060\060\060\132\060 +\165\061\013\060\011\006\003\125\004\006\023\002\110\125\061\021 +\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145\163 +\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143\162 +\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003\125 +\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064\064 +\071\067\061\042\060\040\006\003\125\004\003\014\031\145\055\123 +\172\151\147\156\157\040\124\114\123\040\122\157\157\164\040\103 +\101\040\062\060\062\063\060\201\233\060\020\006\007\052\206\110 +\316\075\002\001\006\005\053\201\004\000\043\003\201\206\000\004 +\000\150\017\337\242\174\074\252\164\210\141\012\215\302\114\245 +\001\042\024\324\367\140\167\102\234\012\070\140\241\214\147\076 +\263\143\351\372\221\260\213\113\346\071\337\002\302\060\001\122 +\000\277\337\214\355\131\255\062\145\253\011\131\120\265\031\302 +\150\034\000\340\005\137\332\120\046\034\303\254\004\042\305\072 +\115\357\351\127\130\066\243\301\031\123\020\012\321\315\077\357 +\113\065\032\103\217\102\023\114\271\054\032\234\276\060\266\304 +\336\334\113\235\344\244\074\313\056\331\255\337\337\175\011\337 +\056\222\377\241\243\143\060\141\060\017\006\003\125\035\023\001 +\001\377\004\005\060\003\001\001\377\060\016\006\003\125\035\017 +\001\001\377\004\004\003\002\001\006\060\035\006\003\125\035\016 +\004\026\004\024\131\204\002\142\132\106\170\365\135\334\217\012 +\020\050\043\334\325\326\373\105\060\037\006\003\125\035\043\004 +\030\060\026\200\024\131\204\002\142\132\106\170\365\135\334\217 +\012\020\050\043\334\325\326\373\105\060\012\006\010\052\206\110 +\316\075\004\003\004\003\201\213\000\060\201\207\002\102\001\055 +\332\256\365\056\170\266\146\270\237\266\160\177\146\164\317\354 +\216\174\376\300\001\171\232\316\122\002\347\303\321\014\172\155 +\313\265\136\356\027\244\233\333\004\166\356\051\051\350\257\373 +\255\254\122\364\327\053\326\167\204\020\275\305\322\050\150\064 +\002\101\065\166\132\165\363\222\206\010\365\262\036\012\366\145 +\013\332\166\307\122\377\013\036\200\160\042\060\303\063\333\030 +\355\204\327\213\354\355\323\250\143\201\265\126\174\107\307\126 +\060\224\150\163\153\322\056\251\271\331\054\034\051\275\014\272 +\271\145\213 +END +CKA_NSS_MOZILLA_CA_POLICY CK_BBOOL CK_TRUE +CKA_NSS_SERVER_DISTRUST_AFTER CK_BBOOL CK_FALSE +CKA_NSS_EMAIL_DISTRUST_AFTER CK_BBOOL CK_FALSE + +# Trust for "e-Szigno TLS Root CA 2023" +# Issuer: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Serial Number:00:e8:6f:18:7b:d6:39:6b:98:4a:49:98:0a +# Subject: CN=e-Szigno TLS Root CA 2023,OID.2.5.4.97=VATHU-23584497,O=Microsec Ltd.,L=Budapest,C=HU +# Not Valid Before: Mon Jul 17 14:00:00 2023 +# Not Valid After : Sat Jul 17 14:00:00 2038 +# Fingerprint (SHA-256): B4:91:41:50:2D:00:66:3D:74:0F:2E:7E:C3:40:C5:28:00:96:26:66:12:1A:36:D0:9C:F7:DD:2B:90:38:4F:B4 +# Fingerprint (SHA1): 6F:9A:D5:D5:DF:E8:2C:EB:BE:37:07:EE:4F:4F:52:58:29:41:D1:FE +CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST +CKA_TOKEN CK_BBOOL CK_TRUE +CKA_PRIVATE CK_BBOOL CK_FALSE +CKA_MODIFIABLE CK_BBOOL CK_FALSE +CKA_LABEL UTF8 "e-Szigno TLS Root CA 2023" +CKA_CERT_SHA1_HASH MULTILINE_OCTAL +\157\232\325\325\337\350\054\353\276\067\007\356\117\117\122\130 +\051\101\321\376 +END +CKA_CERT_MD5_HASH MULTILINE_OCTAL +\152\351\231\164\245\332\136\361\331\056\362\310\321\206\213\161 +END +CKA_ISSUER MULTILINE_OCTAL +\060\165\061\013\060\011\006\003\125\004\006\023\002\110\125\061 +\021\060\017\006\003\125\004\007\014\010\102\165\144\141\160\145 +\163\164\061\026\060\024\006\003\125\004\012\014\015\115\151\143 +\162\157\163\145\143\040\114\164\144\056\061\027\060\025\006\003 +\125\004\141\014\016\126\101\124\110\125\055\062\063\065\070\064 +\064\071\067\061\042\060\040\006\003\125\004\003\014\031\145\055 +\123\172\151\147\156\157\040\124\114\123\040\122\157\157\164\040 +\103\101\040\062\060\062\063 +END +CKA_SERIAL_NUMBER MULTILINE_OCTAL +\002\015\000\350\157\030\173\326\071\153\230\112\111\230\012 +END +CKA_TRUST_SERVER_AUTH CK_TRUST CKT_NSS_TRUSTED_DELEGATOR +CKA_TRUST_EMAIL_PROTECTION CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_CODE_SIGNING CK_TRUST CKT_NSS_MUST_VERIFY_TRUST CKA_TRUST_STEP_UP_APPROVED CK_BBOOL CK_FALSE diff -Nru thunderbird-140.10.0esr/security/nss/lib/ckfw/builtins/nssckbi.h thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/nssckbi.h --- thunderbird-140.10.0esr/security/nss/lib/ckfw/builtins/nssckbi.h 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/ckfw/builtins/nssckbi.h 2026-04-29 18:38:27.000000000 +0000 @@ -46,8 +46,8 @@ * It's recommend to switch back to 0 after having reached version 98/99. */ #define NSS_BUILTINS_LIBRARY_VERSION_MAJOR 2 -#define NSS_BUILTINS_LIBRARY_VERSION_MINOR 76 -#define NSS_BUILTINS_LIBRARY_VERSION "2.76" +#define NSS_BUILTINS_LIBRARY_VERSION_MINOR 84 +#define NSS_BUILTINS_LIBRARY_VERSION "2.84" /* These version numbers detail the semantic changes to the ckfw engine. */ #define NSS_BUILTINS_HARDWARE_VERSION_MAJOR 1 diff -Nru thunderbird-140.10.0esr/security/nss/lib/nss/nss.h thunderbird-140.10.1esr/security/nss/lib/nss/nss.h --- thunderbird-140.10.0esr/security/nss/lib/nss/nss.h 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/nss/nss.h 2026-04-29 18:38:27.000000000 +0000 @@ -22,10 +22,10 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define NSS_VERSION "3.112.4" _NSS_CUSTOMIZED +#define NSS_VERSION "3.112.5" _NSS_CUSTOMIZED #define NSS_VMAJOR 3 #define NSS_VMINOR 112 -#define NSS_VPATCH 4 +#define NSS_VPATCH 5 #define NSS_VBUILD 0 #define NSS_BETA PR_FALSE diff -Nru thunderbird-140.10.0esr/security/nss/lib/softoken/softkver.h thunderbird-140.10.1esr/security/nss/lib/softoken/softkver.h --- thunderbird-140.10.0esr/security/nss/lib/softoken/softkver.h 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/softoken/softkver.h 2026-04-29 18:38:27.000000000 +0000 @@ -17,10 +17,10 @@ * The format of the version string should be * ".[.[.]][ ][ ]" */ -#define SOFTOKEN_VERSION "3.112.4" SOFTOKEN_ECC_STRING +#define SOFTOKEN_VERSION "3.112.5" SOFTOKEN_ECC_STRING #define SOFTOKEN_VMAJOR 3 #define SOFTOKEN_VMINOR 112 -#define SOFTOKEN_VPATCH 4 +#define SOFTOKEN_VPATCH 5 #define SOFTOKEN_VBUILD 0 #define SOFTOKEN_BETA PR_FALSE diff -Nru thunderbird-140.10.0esr/security/nss/lib/ssl/dtlscon.c thunderbird-140.10.1esr/security/nss/lib/ssl/dtlscon.c --- thunderbird-140.10.0esr/security/nss/lib/ssl/dtlscon.c 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/ssl/dtlscon.c 2026-04-29 18:38:27.000000000 +0000 @@ -1135,18 +1135,6 @@ goto loser; /* alert has been sent */ } - /* HelloVerifyRequest is a DTLS 1.2 (and earlier) mechanism; DTLS 1.3 uses - * a cookie extension in HelloRetryRequest instead. Reject an HVR that - * claims a version newer than DTLS 1.2 and cap the negotiable version. - */ - if (version > SSL_LIBRARY_VERSION_TLS_1_2) { - desc = illegal_parameter; - goto alert_loser; - } - if (ss->vrange.max > SSL_LIBRARY_VERSION_TLS_1_2) { - ss->vrange.max = SSL_LIBRARY_VERSION_TLS_1_2; - } - /* Read the cookie. */ SECItem cookie; rv = ssl3_ConsumeHandshakeVariable(ss, &cookie, 1, &b, &length); @@ -1164,6 +1152,8 @@ goto loser; } + ss->ssl3.hs.dtlsReceivedHVR = PR_TRUE; + ssl_GetXmitBufLock(ss); /*******************************/ /* Now re-send the client hello */ diff -Nru thunderbird-140.10.0esr/security/nss/lib/ssl/ssl3con.c thunderbird-140.10.1esr/security/nss/lib/ssl/ssl3con.c --- thunderbird-140.10.0esr/security/nss/lib/ssl/ssl3con.c 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/ssl/ssl3con.c 2026-04-29 18:38:27.000000000 +0000 @@ -7201,6 +7201,15 @@ goto alert_loser; } + /* A server that sent HelloVerifyRequest is DTLS 1.2 or earlier; + * reject a subsequent TLS 1.3 ServerHello as illegal. */ + if (ss->ssl3.hs.dtlsReceivedHVR && + ss->version >= SSL_LIBRARY_VERSION_TLS_1_3) { + desc = illegal_parameter; + errCode = SSL_ERROR_RX_MALFORMED_SERVER_HELLO; + goto alert_loser; + } + /* There are three situations in which the server must pick * TLS 1.3. * @@ -13917,6 +13926,8 @@ sizeof(ss->ssl3.hs.newSessionTicket)); ss->ssl3.hs.zeroRttState = ssl_0rtt_none; + + ss->ssl3.hs.dtlsReceivedHVR = PR_FALSE; return SECSuccess; } diff -Nru thunderbird-140.10.0esr/security/nss/lib/ssl/sslimpl.h thunderbird-140.10.1esr/security/nss/lib/ssl/sslimpl.h --- thunderbird-140.10.0esr/security/nss/lib/ssl/sslimpl.h 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/ssl/sslimpl.h 2026-04-29 18:38:28.000000000 +0000 @@ -760,6 +760,8 @@ * on server.*/ PRBool helloRetry; /* True if HelloRetryRequest has been sent * or received. */ + PRBool dtlsReceivedHVR; /* True if a DTLS HelloVerifyRequest was + * received. */ PRBool receivedCcs; /* A server received ChangeCipherSpec * before the handshake started. */ PRBool rejectCcs; /* Excessive ChangeCipherSpecs are rejected. */ diff -Nru thunderbird-140.10.0esr/security/nss/lib/util/nssutil.h thunderbird-140.10.1esr/security/nss/lib/util/nssutil.h --- thunderbird-140.10.0esr/security/nss/lib/util/nssutil.h 2026-04-21 14:53:00.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/lib/util/nssutil.h 2026-04-29 18:38:27.000000000 +0000 @@ -19,10 +19,10 @@ * The format of the version string should be * ".[.[.]][ ]" */ -#define NSSUTIL_VERSION "3.112.4" +#define NSSUTIL_VERSION "3.112.5" #define NSSUTIL_VMAJOR 3 #define NSSUTIL_VMINOR 112 -#define NSSUTIL_VPATCH 4 +#define NSSUTIL_VPATCH 5 #define NSSUTIL_VBUILD 0 #define NSSUTIL_BETA PR_FALSE diff -Nru thunderbird-140.10.0esr/security/nss/moz.yaml thunderbird-140.10.1esr/security/nss/moz.yaml --- thunderbird-140.10.0esr/security/nss/moz.yaml 2026-04-21 14:52:59.000000000 +0000 +++ thunderbird-140.10.1esr/security/nss/moz.yaml 2026-04-29 18:38:28.000000000 +0000 @@ -9,8 +9,8 @@ description: nss url: https://hg-edge.mozilla.org/projects/nss - release: b2cdc99736d77bf188220c8e780c413f967eb1c7 (2026-04-13T21:48:26Z). - revision: b2cdc99736d77bf188220c8e780c413f967eb1c7 + release: fddd54c0fb1444c710f442c872de3af8eaa9aec9 (2026-04-23T19:27:46Z). + revision: fddd54c0fb1444c710f442c872de3af8eaa9aec9 license: MPL-2.0 license-file: COPYING diff -Nru thunderbird-140.10.0esr/sourcestamp.txt thunderbird-140.10.1esr/sourcestamp.txt --- thunderbird-140.10.0esr/sourcestamp.txt 2026-04-21 14:53:43.000000000 +0000 +++ thunderbird-140.10.1esr/sourcestamp.txt 2026-04-29 18:39:10.000000000 +0000 @@ -1,3 +1,3 @@ -20260417012335 -https://hg.mozilla.org/releases/comm-esr140/rev/b23998b7b404ff8144a931ada5d315103d0cd932 -https://hg.mozilla.org/releases/mozilla-esr140/rev/a1c8c4081ea0e227dbde64c95ec6942fa71edb28 +20260429161633 +https://hg.mozilla.org/releases/comm-esr140/rev/caa26ebdecaf4678249142b676c66f3b50d6db61 +https://hg.mozilla.org/releases/mozilla-esr140/rev/a24e9e115e02794f72dab9ef6081244403b0183a diff -Nru thunderbird-140.10.0esr/testing/web-platform/mozilla/meta/dom/quota/test-partitioned-access-to-fs-in-iframes.https.window.js.ini thunderbird-140.10.1esr/testing/web-platform/mozilla/meta/dom/quota/test-partitioned-access-to-fs-in-iframes.https.window.js.ini --- thunderbird-140.10.0esr/testing/web-platform/mozilla/meta/dom/quota/test-partitioned-access-to-fs-in-iframes.https.window.js.ini 1970-01-01 00:00:00.000000000 +0000 +++ thunderbird-140.10.1esr/testing/web-platform/mozilla/meta/dom/quota/test-partitioned-access-to-fs-in-iframes.https.window.js.ini 2026-04-29 18:38:29.000000000 +0000 @@ -0,0 +1,3 @@ +[test-partitioned-access-to-fs-in-iframes.https.window.html] + expected: + if tsan: [OK, TIMEOUT] diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/af/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/af/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/af/manifest.json 2026-04-23 05:16:28.771449800 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/af/manifest.json 2026-05-01 07:12:08.181461000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Afrikaans", "description": "Thunderbird Language Pack for Afrikaans (af)", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "af": { - "version": "20260417022705", + "version": "20260429171553", "chrome_resources": { "alerts": "chrome/af/locale/af/alerts/", "autoconfig": "chrome/af/locale/af/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ar/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ar/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ar/manifest.json 2026-04-23 05:16:28.826432700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ar/manifest.json 2026-05-01 07:12:08.231116800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: العربية (Arabic)", "description": "Thunderbird Language Pack for العربية (ar) – Arabic", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ar": { - "version": "20260417022922", + "version": "20260429171840", "chrome_resources": { "alerts": "chrome/ar/locale/ar/alerts/", "autoconfig": "chrome/ar/locale/ar/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ast/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ast/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ast/manifest.json 2026-04-23 05:16:28.875102300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ast/manifest.json 2026-05-01 07:12:08.277928000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Asturianu (Asturian)", "description": "Thunderbird Language Pack for Asturianu (ast) – Asturian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ast": { - "version": "20260417023121", + "version": "20260429172059", "chrome_resources": { "alerts": "chrome/ast/locale/ast/alerts/", "autoconfig": "chrome/ast/locale/ast/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/be/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/be/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/be/manifest.json 2026-04-23 05:16:28.927821400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/be/manifest.json 2026-05-01 07:12:08.329314500 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Беларуская (Belarusian)", "description": "Thunderbird Language Pack for Беларуская (be) – Belarusian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "be": { - "version": "20260417023323", + "version": "20260429172312", "chrome_resources": { "alerts": "chrome/be/locale/be/alerts/", "autoconfig": "chrome/be/locale/be/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/bg/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/bg/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/bg/manifest.json 2026-04-23 05:16:28.982705000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/bg/manifest.json 2026-05-01 07:12:08.382157600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Български (Bulgarian)", "description": "Thunderbird Language Pack for Български (bg) – Bulgarian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "bg": { - "version": "20260417023526", + "version": "20260429172523", "chrome_resources": { "alerts": "chrome/bg/locale/bg/alerts/", "autoconfig": "chrome/bg/locale/bg/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/br/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/br/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/br/manifest.json 2026-04-23 05:16:29.032544900 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/br/manifest.json 2026-05-01 07:12:08.431270000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Brezhoneg (Breton)", "description": "Thunderbird Language Pack for Brezhoneg (br) – Breton", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "br": { - "version": "20260417023012", + "version": "20260429172034", "chrome_resources": { "alerts": "chrome/br/locale/br/alerts/", "autoconfig": "chrome/br/locale/br/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ca/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ca/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ca/manifest.json 2026-04-23 05:16:29.085002200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ca/manifest.json 2026-05-01 07:12:08.482025000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Català (Catalan)", "description": "Thunderbird Language Pack for Català (ca) – Catalan", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ca": { - "version": "20260417023235", + "version": "20260429172259", "chrome_resources": { "alerts": "chrome/ca/locale/ca/alerts/", "autoconfig": "chrome/ca/locale/ca/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/cak/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/cak/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/cak/manifest.json 2026-04-23 05:16:29.135573000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/cak/manifest.json 2026-05-01 07:12:08.531139000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Kaqchikel", "description": "Thunderbird Language Pack for Kaqchikel (cak)", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "cak": { - "version": "20260417023443", + "version": "20260429172507", "chrome_resources": { "alerts": "chrome/cak/locale/cak/alerts/", "autoconfig": "chrome/cak/locale/cak/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/cs/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/cs/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/cs/manifest.json 2026-04-23 05:16:29.192350100 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/cs/manifest.json 2026-05-01 07:12:08.583122000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Čeština (Czech)", "description": "Thunderbird Language Pack for Čeština (cs) – Czech", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "cs": { - "version": "20260417023657", + "version": "20260429172717", "chrome_resources": { "alerts": "chrome/cs/locale/cs/alerts/", "autoconfig": "chrome/cs/locale/cs/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/cy/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/cy/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/cy/manifest.json 2026-04-23 05:16:29.245530400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/cy/manifest.json 2026-05-01 07:12:08.634621600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Cymraeg (Welsh)", "description": "Thunderbird Language Pack for Cymraeg (cy) – Welsh", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "cy": { - "version": "20260417023909", + "version": "20260429172927", "chrome_resources": { "alerts": "chrome/cy/locale/cy/alerts/", "autoconfig": "chrome/cy/locale/cy/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/da/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/da/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/da/manifest.json 2026-04-23 05:16:29.299006700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/da/manifest.json 2026-05-01 07:12:08.686471200 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Dansk (Danish)", "description": "Thunderbird Language Pack for Dansk (da) – Danish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "da": { - "version": "20260417023016", + "version": "20260429171642", "chrome_resources": { "alerts": "chrome/da/locale/da/alerts/", "autoconfig": "chrome/da/locale/da/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/de/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/de/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/de/manifest.json 2026-04-23 05:16:29.351820500 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/de/manifest.json 2026-05-01 07:12:08.739898200 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Deutsch (German)", "description": "Thunderbird Language Pack for Deutsch (de) – German", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "de": { - "version": "20260417023249", + "version": "20260429171920", "chrome_resources": { "alerts": "chrome/de/locale/de/alerts/", "autoconfig": "chrome/de/locale/de/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/dsb/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/dsb/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/dsb/manifest.json 2026-04-23 05:16:29.406121000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/dsb/manifest.json 2026-05-01 07:12:08.792503600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Dolnoserbšćina (Lower Sorbian)", "description": "Thunderbird Language Pack for Dolnoserbšćina (dsb) – Lower Sorbian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "dsb": { - "version": "20260417023522", + "version": "20260429172142", "chrome_resources": { "alerts": "chrome/dsb/locale/dsb/alerts/", "autoconfig": "chrome/dsb/locale/dsb/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/el/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/el/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/el/manifest.json 2026-04-23 05:16:29.461453700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/el/manifest.json 2026-05-01 07:12:08.846311600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Ελληνικά (Greek)", "description": "Thunderbird Language Pack for Ελληνικά (el) – Greek", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "el": { - "version": "20260417023741", + "version": "20260429172403", "chrome_resources": { "alerts": "chrome/el/locale/el/alerts/", "autoconfig": "chrome/el/locale/el/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/en-CA/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/en-CA/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/en-CA/manifest.json 2026-04-23 05:16:29.514862800 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/en-CA/manifest.json 2026-05-01 07:12:08.897170000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: English (CA)", "description": "Thunderbird Language Pack for English (CA) (en-CA)", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "en-CA": { - "version": "20260417023953", + "version": "20260429172626", "chrome_resources": { "alerts": "chrome/en-CA/locale/en-CA/alerts/", "autoconfig": "chrome/en-CA/locale/en-CA/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/en-GB/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/en-GB/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/en-GB/manifest.json 2026-04-23 05:16:29.567067400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/en-GB/manifest.json 2026-05-01 07:12:08.949376600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: English (GB)", "description": "Thunderbird Language Pack for English (GB) (en-GB)", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "en-GB": { - "version": "20260417023011", + "version": "20260429172015", "chrome_resources": { "alerts": "chrome/en-GB/locale/en-GB/alerts/", "autoconfig": "chrome/en-GB/locale/en-GB/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/es-AR/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/es-AR/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/es-AR/manifest.json 2026-04-23 05:16:29.621281000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/es-AR/manifest.json 2026-05-01 07:12:09.000956300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Español (AR) (Spanish, Argentina)", "description": "Thunderbird Language Pack for Español (AR) (es-AR) – Spanish, Argentina", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "es-AR": { - "version": "20260417023224", + "version": "20260429172244", "chrome_resources": { "alerts": "chrome/es-AR/locale/es-AR/alerts/", "autoconfig": "chrome/es-AR/locale/es-AR/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/es-ES/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/es-ES/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/es-ES/manifest.json 2026-04-23 05:16:29.675366400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/es-ES/manifest.json 2026-05-01 07:12:09.052616600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Español (ES) (Spanish, Spain)", "description": "Thunderbird Language Pack for Español (ES) (es-ES) – Spanish, Spain", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "es-ES": { - "version": "20260417023424", + "version": "20260429172501", "chrome_resources": { "alerts": "chrome/es-ES/locale/es-ES/alerts/", "autoconfig": "chrome/es-ES/locale/es-ES/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/es-MX/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/es-MX/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/es-MX/manifest.json 2026-04-23 05:16:29.728685600 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/es-MX/manifest.json 2026-05-01 07:12:09.103955500 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Español (MX) (Spanish, Mexico)", "description": "Thunderbird Language Pack for Español (MX) (es-MX) – Spanish, Mexico", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "es-MX": { - "version": "20260417023630", + "version": "20260429172721", "chrome_resources": { "alerts": "chrome/es-MX/locale/es-MX/alerts/", "autoconfig": "chrome/es-MX/locale/es-MX/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/et/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/et/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/et/manifest.json 2026-04-23 05:16:29.781139100 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/et/manifest.json 2026-05-01 07:12:09.154494000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Eesti (Estonian)", "description": "Thunderbird Language Pack for Eesti (et) – Estonian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "et": { - "version": "20260417023836", + "version": "20260429172944", "chrome_resources": { "alerts": "chrome/et/locale/et/alerts/", "autoconfig": "chrome/et/locale/et/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/eu/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/eu/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/eu/manifest.json 2026-04-23 05:16:29.833452000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/eu/manifest.json 2026-05-01 07:12:09.206057000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Euskara (Basque)", "description": "Thunderbird Language Pack for Euskara (eu) – Basque", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "eu": { - "version": "20260417023015", + "version": "20260429172034", "chrome_resources": { "alerts": "chrome/eu/locale/eu/alerts/", "autoconfig": "chrome/eu/locale/eu/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/fi/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/fi/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/fi/manifest.json 2026-04-23 05:16:29.886813600 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/fi/manifest.json 2026-05-01 07:12:09.257892000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Suomi (Finnish)", "description": "Thunderbird Language Pack for Suomi (fi) – Finnish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "fi": { - "version": "20260417023236", + "version": "20260429172250", "chrome_resources": { "alerts": "chrome/fi/locale/fi/alerts/", "autoconfig": "chrome/fi/locale/fi/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/fr/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/fr/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/fr/manifest.json 2026-04-23 05:16:29.939924200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/fr/manifest.json 2026-05-01 07:12:09.309699300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Français (French)", "description": "Thunderbird Language Pack for Français (fr) – French", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "fr": { - "version": "20260417023444", + "version": "20260429172453", "chrome_resources": { "alerts": "chrome/fr/locale/fr/alerts/", "autoconfig": "chrome/fr/locale/fr/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/fy-NL/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/fy-NL/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/fy-NL/manifest.json 2026-04-23 05:16:29.993695700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/fy-NL/manifest.json 2026-05-01 07:12:09.361223200 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Frysk (Frisian)", "description": "Thunderbird Language Pack for Frysk (fy-NL) – Frisian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "fy-NL": { - "version": "20260417023651", + "version": "20260429172700", "chrome_resources": { "alerts": "chrome/fy-NL/locale/fy-NL/alerts/", "autoconfig": "chrome/fy-NL/locale/fy-NL/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ga-IE/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ga-IE/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ga-IE/manifest.json 2026-04-23 05:16:30.041768800 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ga-IE/manifest.json 2026-05-01 07:12:09.408102500 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Gaeilge (Irish)", "description": "Thunderbird Language Pack for Gaeilge (ga-IE) – Irish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ga-IE": { - "version": "20260417023856", + "version": "20260429172913", "chrome_resources": { "alerts": "chrome/ga-IE/locale/ga-IE/alerts/", "autoconfig": "chrome/ga-IE/locale/ga-IE/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/gd/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/gd/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/gd/manifest.json 2026-04-23 05:16:30.095570600 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/gd/manifest.json 2026-05-01 07:12:09.458779800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Gàidhlig (Scottish Gaelic)", "description": "Thunderbird Language Pack for Gàidhlig (gd) – Scottish Gaelic", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "gd": { - "version": "20260417022646", + "version": "20260429172042", "chrome_resources": { "alerts": "chrome/gd/locale/gd/alerts/", "autoconfig": "chrome/gd/locale/gd/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/gl/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/gl/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/gl/manifest.json 2026-04-23 05:16:30.148294000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/gl/manifest.json 2026-05-01 07:12:09.510474200 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Galego (Galician)", "description": "Thunderbird Language Pack for Galego (gl) – Galician", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "gl": { - "version": "20260417022919", + "version": "20260429172258", "chrome_resources": { "alerts": "chrome/gl/locale/gl/alerts/", "autoconfig": "chrome/gl/locale/gl/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/he/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/he/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/he/manifest.json 2026-04-23 05:16:30.202832700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/he/manifest.json 2026-05-01 07:12:09.560506000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: עברית (Hebrew)", "description": "Thunderbird Language Pack for עברית (he) – Hebrew", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "he": { - "version": "20260417023134", + "version": "20260429172452", "chrome_resources": { "alerts": "chrome/he/locale/he/alerts/", "autoconfig": "chrome/he/locale/he/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/hr/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/hr/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/hr/manifest.json 2026-04-23 05:16:30.255300000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/hr/manifest.json 2026-05-01 07:12:09.611263300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Hrvatski (Croatian)", "description": "Thunderbird Language Pack for Hrvatski (hr) – Croatian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "hr": { - "version": "20260417023351", + "version": "20260429172647", "chrome_resources": { "alerts": "chrome/hr/locale/hr/alerts/", "autoconfig": "chrome/hr/locale/hr/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/hsb/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/hsb/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/hsb/manifest.json 2026-04-23 05:16:30.309874300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/hsb/manifest.json 2026-05-01 07:12:09.663206300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Hornjoserbšćina (Upper Sorbian)", "description": "Thunderbird Language Pack for Hornjoserbšćina (hsb) – Upper Sorbian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "hsb": { - "version": "20260417023606", + "version": "20260429172843", "chrome_resources": { "alerts": "chrome/hsb/locale/hsb/alerts/", "autoconfig": "chrome/hsb/locale/hsb/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/hu/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/hu/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/hu/manifest.json 2026-04-23 05:16:30.362358000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/hu/manifest.json 2026-05-01 07:12:09.715932600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Magyar (Hungarian)", "description": "Thunderbird Language Pack for Magyar (hu) – Hungarian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "hu": { - "version": "20260417023030", + "version": "20260429172653", "chrome_resources": { "alerts": "chrome/hu/locale/hu/alerts/", "autoconfig": "chrome/hu/locale/hu/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/hy-AM/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/hy-AM/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/hy-AM/manifest.json 2026-04-23 05:16:30.415599800 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/hy-AM/manifest.json 2026-05-01 07:12:09.768016800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: հայերեն (Armenian)", "description": "Thunderbird Language Pack for հայերեն (hy-AM) – Armenian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "hy-AM": { - "version": "20260417023254", + "version": "20260429172902", "chrome_resources": { "alerts": "chrome/hy-AM/locale/hy-AM/alerts/", "autoconfig": "chrome/hy-AM/locale/hy-AM/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/id/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/id/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/id/manifest.json 2026-04-23 05:16:30.467483000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/id/manifest.json 2026-05-01 07:12:09.819354300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Indonesia (Indonesian)", "description": "Thunderbird Language Pack for Indonesia (id) – Indonesian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "id": { - "version": "20260417023512", + "version": "20260429173058", "chrome_resources": { "alerts": "chrome/id/locale/id/alerts/", "autoconfig": "chrome/id/locale/id/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/is/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/is/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/is/manifest.json 2026-04-23 05:16:30.522585200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/is/manifest.json 2026-05-01 07:12:09.870611700 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Islenska (Icelandic)", "description": "Thunderbird Language Pack for Islenska (is) – Icelandic", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "is": { - "version": "20260417023738", + "version": "20260429173254", "chrome_resources": { "alerts": "chrome/is/locale/is/alerts/", "autoconfig": "chrome/is/locale/is/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/it/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/it/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/it/manifest.json 2026-04-23 05:16:30.580242600 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/it/manifest.json 2026-05-01 07:12:09.922180400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Italiano (Italian)", "description": "Thunderbird Language Pack for Italiano (it) – Italian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "it": { - "version": "20260417023959", + "version": "20260429173453", "chrome_resources": { "alerts": "chrome/it/locale/it/alerts/", "autoconfig": "chrome/it/locale/it/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ja/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ja/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ja/manifest.json 2026-04-23 05:16:30.633949300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ja/manifest.json 2026-05-01 07:12:09.973919400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: 日本語 (Japanese)", "description": "Thunderbird Language Pack for 日本語 (ja) – Japanese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ja": { - "version": "20260417023022", + "version": "20260429172028", "chrome_resources": { "alerts": "chrome/ja/locale/ja/alerts/", "autoconfig": "chrome/ja/locale/ja/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ka/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ka/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ka/manifest.json 2026-04-23 05:16:30.689925200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ka/manifest.json 2026-05-01 07:12:10.026961800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: ქართული (Georgian)", "description": "Thunderbird Language Pack for ქართული (ka) – Georgian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ka": { - "version": "20260417023241", + "version": "20260429172248", "chrome_resources": { "alerts": "chrome/ka/locale/ka/alerts/", "autoconfig": "chrome/ka/locale/ka/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/kab/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/kab/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/kab/manifest.json 2026-04-23 05:16:30.742758500 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/kab/manifest.json 2026-05-01 07:12:10.077943600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Taqbaylit (Kabyle)", "description": "Thunderbird Language Pack for Taqbaylit (kab) – Kabyle", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "kab": { - "version": "20260417023443", + "version": "20260429172445", "chrome_resources": { "alerts": "chrome/kab/locale/kab/alerts/", "autoconfig": "chrome/kab/locale/kab/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/kk/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/kk/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/kk/manifest.json 2026-04-23 05:16:30.798363700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/kk/manifest.json 2026-05-01 07:12:10.130888500 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: қазақ тілі (Kazakh)", "description": "Thunderbird Language Pack for қазақ тілі (kk) – Kazakh", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "kk": { - "version": "20260417023647", + "version": "20260429172644", "chrome_resources": { "alerts": "chrome/kk/locale/kk/alerts/", "autoconfig": "chrome/kk/locale/kk/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ko/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ko/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ko/manifest.json 2026-04-23 05:16:30.851062500 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ko/manifest.json 2026-05-01 07:12:10.182245700 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: 한국어 (Korean)", "description": "Thunderbird Language Pack for 한국어 (ko) – Korean", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ko": { - "version": "20260417023851", + "version": "20260429172841", "chrome_resources": { "alerts": "chrome/ko/locale/ko/alerts/", "autoconfig": "chrome/ko/locale/ko/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/lt/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/lt/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/lt/manifest.json 2026-04-23 05:16:30.903665300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/lt/manifest.json 2026-05-01 07:12:10.233080900 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Lietuvių (Lithuanian)", "description": "Thunderbird Language Pack for Lietuvių (lt) – Lithuanian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "lt": { - "version": "20260417023017", + "version": "20260429172014", "chrome_resources": { "alerts": "chrome/lt/locale/lt/alerts/", "autoconfig": "chrome/lt/locale/lt/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/lv/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/lv/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/lv/manifest.json 2026-04-23 05:16:30.952651000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/lv/manifest.json 2026-05-01 07:12:10.281552800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Latviešu (Latvian)", "description": "Thunderbird Language Pack for Latviešu (lv) – Latvian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "lv": { - "version": "20260417023228", + "version": "20260429172243", "chrome_resources": { "alerts": "chrome/lv/locale/lv/alerts/", "autoconfig": "chrome/lv/locale/lv/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ms/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ms/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ms/manifest.json 2026-04-23 05:16:31.001345900 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ms/manifest.json 2026-05-01 07:12:10.327786400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Melayu (Malay)", "description": "Thunderbird Language Pack for Melayu (ms) – Malay", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ms": { - "version": "20260417023425", + "version": "20260429172500", "chrome_resources": { "alerts": "chrome/ms/locale/ms/alerts/", "autoconfig": "chrome/ms/locale/ms/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/nb-NO/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/nb-NO/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/nb-NO/manifest.json 2026-04-23 05:16:31.053806000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/nb-NO/manifest.json 2026-05-01 07:12:10.378969400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Norsk Bokmål (Norwegian Bokmål)", "description": "Thunderbird Language Pack for Norsk Bokmål (nb-NO) – Norwegian Bokmål", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "nb-NO": { - "version": "20260417023622", + "version": "20260429172722", "chrome_resources": { "alerts": "chrome/nb-NO/locale/nb-NO/alerts/", "autoconfig": "chrome/nb-NO/locale/nb-NO/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/nl/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/nl/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/nl/manifest.json 2026-04-23 05:16:31.107416900 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/nl/manifest.json 2026-05-01 07:12:10.461873000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Nederlands (Dutch)", "description": "Thunderbird Language Pack for Nederlands (nl) – Dutch", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "nl": { - "version": "20260417023818", + "version": "20260429172947", "chrome_resources": { "alerts": "chrome/nl/locale/nl/alerts/", "autoconfig": "chrome/nl/locale/nl/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/nn-NO/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/nn-NO/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/nn-NO/manifest.json 2026-04-23 05:16:31.160041600 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/nn-NO/manifest.json 2026-05-01 07:12:10.513658300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Nynorsk (Norwegian Nynorsk)", "description": "Thunderbird Language Pack for Nynorsk (nn-NO) – Norwegian Nynorsk", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "nn-NO": { - "version": "20260417023021", + "version": "20260429172046", "chrome_resources": { "alerts": "chrome/nn-NO/locale/nn-NO/alerts/", "autoconfig": "chrome/nn-NO/locale/nn-NO/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/pa-IN/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/pa-IN/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/pa-IN/manifest.json 2026-04-23 05:16:31.213989300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/pa-IN/manifest.json 2026-05-01 07:12:10.563461300 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: ਪੰਜਾਬੀ (Punjabi)", "description": "Thunderbird Language Pack for ਪੰਜਾਬੀ (pa-IN) – Punjabi", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "pa-IN": { - "version": "20260417023245", + "version": "20260429172304", "chrome_resources": { "alerts": "chrome/pa-IN/locale/pa-IN/alerts/", "autoconfig": "chrome/pa-IN/locale/pa-IN/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/pl/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/pl/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/pl/manifest.json 2026-04-23 05:16:31.267445300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/pl/manifest.json 2026-05-01 07:12:10.616187000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Polski (Polish)", "description": "Thunderbird Language Pack for Polski (pl) – Polish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "pl": { - "version": "20260417023455", + "version": "20260429172507", "chrome_resources": { "alerts": "chrome/pl/locale/pl/alerts/", "autoconfig": "chrome/pl/locale/pl/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/pt-BR/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/pt-BR/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/pt-BR/manifest.json 2026-04-23 05:16:31.321533400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/pt-BR/manifest.json 2026-05-01 07:12:10.668197000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Português (BR)", "description": "Thunderbird Language Pack for Português (BR) (pt-BR) – Brazilian Portuguese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "pt-BR": { - "version": "20260417023706", + "version": "20260429172710", "chrome_resources": { "alerts": "chrome/pt-BR/locale/pt-BR/alerts/", "autoconfig": "chrome/pt-BR/locale/pt-BR/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/pt-PT/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/pt-PT/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/pt-PT/manifest.json 2026-04-23 05:16:31.375684700 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/pt-PT/manifest.json 2026-05-01 07:12:10.720873400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Português (PT) (Portuguese)", "description": "Thunderbird Language Pack for Português (PT) (pt-PT) – Portuguese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "pt-PT": { - "version": "20260417023917", + "version": "20260429172913", "chrome_resources": { "alerts": "chrome/pt-PT/locale/pt-PT/alerts/", "autoconfig": "chrome/pt-PT/locale/pt-PT/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/rm/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/rm/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/rm/manifest.json 2026-04-23 05:16:31.433505300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/rm/manifest.json 2026-05-01 07:12:10.774062000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Rumantsch (Romansh)", "description": "Thunderbird Language Pack for Rumantsch (rm) – Romansh", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "rm": { - "version": "20260417023023", + "version": "20260429172040", "chrome_resources": { "alerts": "chrome/rm/locale/rm/alerts/", "autoconfig": "chrome/rm/locale/rm/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ro/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ro/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ro/manifest.json 2026-04-23 05:16:31.487209000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ro/manifest.json 2026-05-01 07:12:10.826300600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Română (Romanian)", "description": "Thunderbird Language Pack for Română (ro) – Romanian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ro": { - "version": "20260417023245", + "version": "20260429172312", "chrome_resources": { "alerts": "chrome/ro/locale/ro/alerts/", "autoconfig": "chrome/ro/locale/ro/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/ru/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/ru/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/ru/manifest.json 2026-04-23 05:16:31.542050100 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/ru/manifest.json 2026-05-01 07:12:10.879917400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Русский (Russian)", "description": "Thunderbird Language Pack for Русский (ru) – Russian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "ru": { - "version": "20260417023504", + "version": "20260429172520", "chrome_resources": { "alerts": "chrome/ru/locale/ru/alerts/", "autoconfig": "chrome/ru/locale/ru/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/sk/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/sk/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/sk/manifest.json 2026-04-23 05:16:31.596306800 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/sk/manifest.json 2026-05-01 07:12:10.931861400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Slovenčina (Slovak)", "description": "Thunderbird Language Pack for Slovenčina (sk) – Slovak", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "sk": { - "version": "20260417023723", + "version": "20260429172731", "chrome_resources": { "alerts": "chrome/sk/locale/sk/alerts/", "autoconfig": "chrome/sk/locale/sk/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/sl/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/sl/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/sl/manifest.json 2026-04-23 05:16:31.649017300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/sl/manifest.json 2026-05-01 07:12:10.983204400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Slovenščina (Slovenian)", "description": "Thunderbird Language Pack for Slovenščina (sl) – Slovenian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "sl": { - "version": "20260417023922", + "version": "20260429172940", "chrome_resources": { "alerts": "chrome/sl/locale/sl/alerts/", "autoconfig": "chrome/sl/locale/sl/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/sq/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/sq/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/sq/manifest.json 2026-04-23 05:16:31.703168200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/sq/manifest.json 2026-05-01 07:12:11.034866600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Shqip (Albanian)", "description": "Thunderbird Language Pack for Shqip (sq) – Albanian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "sq": { - "version": "20260417022911", + "version": "20260429172027", "chrome_resources": { "alerts": "chrome/sq/locale/sq/alerts/", "autoconfig": "chrome/sq/locale/sq/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/sr/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/sr/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/sr/manifest.json 2026-04-23 05:16:31.756486200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/sr/manifest.json 2026-05-01 07:12:11.087364000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Српски (Serbian)", "description": "Thunderbird Language Pack for Српски (sr) – Serbian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "sr": { - "version": "20260417023124", + "version": "20260429172242", "chrome_resources": { "alerts": "chrome/sr/locale/sr/alerts/", "autoconfig": "chrome/sr/locale/sr/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/sv-SE/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/sv-SE/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/sv-SE/manifest.json 2026-04-23 05:16:31.810442400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/sv-SE/manifest.json 2026-05-01 07:12:11.138708000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Svenska (Swedish)", "description": "Thunderbird Language Pack for Svenska (sv-SE) – Swedish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "sv-SE": { - "version": "20260417023330", + "version": "20260429172450", "chrome_resources": { "alerts": "chrome/sv-SE/locale/sv-SE/alerts/", "autoconfig": "chrome/sv-SE/locale/sv-SE/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/th/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/th/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/th/manifest.json 2026-04-23 05:16:31.864904400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/th/manifest.json 2026-05-01 07:12:11.192534700 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: ไทย (Thai)", "description": "Thunderbird Language Pack for ไทย (th) – Thai", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "th": { - "version": "20260417023524", + "version": "20260429172649", "chrome_resources": { "alerts": "chrome/th/locale/th/alerts/", "autoconfig": "chrome/th/locale/th/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/tr/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/tr/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/tr/manifest.json 2026-04-23 05:16:31.918808200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/tr/manifest.json 2026-05-01 07:12:11.244141600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Türkçe (Turkish)", "description": "Thunderbird Language Pack for Türkçe (tr) – Turkish", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "tr": { - "version": "20260417023719", + "version": "20260429172849", "chrome_resources": { "alerts": "chrome/tr/locale/tr/alerts/", "autoconfig": "chrome/tr/locale/tr/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/uk/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/uk/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/uk/manifest.json 2026-04-23 05:16:31.973449000 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/uk/manifest.json 2026-05-01 07:12:11.297500800 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Українська (Ukrainian)", "description": "Thunderbird Language Pack for Українська (uk) – Ukrainian", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "uk": { - "version": "20260417023018", + "version": "20260429172015", "chrome_resources": { "alerts": "chrome/uk/locale/uk/alerts/", "autoconfig": "chrome/uk/locale/uk/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/uz/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/uz/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/uz/manifest.json 2026-04-23 05:16:32.021766400 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/uz/manifest.json 2026-05-01 07:12:11.343947400 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: O‘zbek (Uzbek)", "description": "Thunderbird Language Pack for O‘zbek (uz) – Uzbek", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "uz": { - "version": "20260417023237", + "version": "20260429172240", "chrome_resources": { "alerts": "chrome/uz/locale/uz/alerts/", "autoconfig": "chrome/uz/locale/uz/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/vi/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/vi/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/vi/manifest.json 2026-04-23 05:16:32.075175500 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/vi/manifest.json 2026-05-01 07:12:11.395951700 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: Tiếng Việt (Vietnamese)", "description": "Thunderbird Language Pack for Tiếng Việt (vi) – Vietnamese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "vi": { - "version": "20260417023443", + "version": "20260429172456", "chrome_resources": { "alerts": "chrome/vi/locale/vi/alerts/", "autoconfig": "chrome/vi/locale/vi/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/zh-CN/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/zh-CN/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/zh-CN/manifest.json 2026-04-23 05:16:32.127357200 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/zh-CN/manifest.json 2026-05-01 07:12:11.446895600 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: 简体中文 (Simplified Chinese)", "description": "Thunderbird Language Pack for 简体中文 (zh-CN) – Simplified Chinese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "zh-CN": { - "version": "20260417023646", + "version": "20260429172714", "chrome_resources": { "alerts": "chrome/zh-CN/locale/zh-CN/alerts/", "autoconfig": "chrome/zh-CN/locale/zh-CN/autoconfig/", diff -Nru thunderbird-140.10.0esr/thunderbird-l10n/zh-TW/manifest.json thunderbird-140.10.1esr/thunderbird-l10n/zh-TW/manifest.json --- thunderbird-140.10.0esr/thunderbird-l10n/zh-TW/manifest.json 2026-04-23 05:16:32.203581300 +0000 +++ thunderbird-140.10.1esr/thunderbird-l10n/zh-TW/manifest.json 2026-05-01 07:12:11.500421000 +0000 @@ -10,10 +10,10 @@ }, "name": "Language: 正體中文 (Traditional Chinese)", "description": "Thunderbird Language Pack for 正體中文 (zh-TW) – Traditional Chinese", - "version": "140.10.20260417.12335", + "version": "140.10.20260429.161633", "languages": { "zh-TW": { - "version": "20260417023848", + "version": "20260429172935", "chrome_resources": { "alerts": "chrome/zh-TW/locale/zh-TW/alerts/", "autoconfig": "chrome/zh-TW/locale/zh-TW/autoconfig/", diff -Nru thunderbird-140.10.0esr/tools/rewriting/ThirdPartyPaths.txt thunderbird-140.10.1esr/tools/rewriting/ThirdPartyPaths.txt --- thunderbird-140.10.0esr/tools/rewriting/ThirdPartyPaths.txt 2026-04-21 14:53:09.000000000 +0000 +++ thunderbird-140.10.1esr/tools/rewriting/ThirdPartyPaths.txt 2026-04-29 18:38:36.000000000 +0000 @@ -37,6 +37,7 @@ dom/media/platforms/ffmpeg/ffmpeg59/ dom/media/platforms/ffmpeg/ffmpeg60/ dom/media/platforms/ffmpeg/ffmpeg61/ +dom/media/platforms/ffmpeg/ffmpeg62/ dom/media/platforms/ffmpeg/libav53/ dom/media/platforms/ffmpeg/libav54/ dom/media/platforms/ffmpeg/libav55/ diff -Nru thunderbird-140.10.0esr/xpcom/base/nsCycleCollector.cpp thunderbird-140.10.1esr/xpcom/base/nsCycleCollector.cpp --- thunderbird-140.10.0esr/xpcom/base/nsCycleCollector.cpp 2026-04-21 14:53:10.000000000 +0000 +++ thunderbird-140.10.1esr/xpcom/base/nsCycleCollector.cpp 2026-04-29 18:38:37.000000000 +0000 @@ -167,6 +167,7 @@ #include +#include "js/friend/CycleCollector.h" #include "js/SliceBudget.h" #include "mozilla/Attributes.h" #include "mozilla/Likely.h" @@ -1257,6 +1258,12 @@ // returns whether anything was collected bool CollectWhite(); + void ClearWhiteJSWeakRefTargets(); + + public: + bool IsGCThingWhiteInCCGraph(JS::GCCellPtr aPtr); + + private: void CleanupAfterCollection(); }; @@ -3223,6 +3230,8 @@ // - Unlink(whites), which drops outgoing links on each white. // - Unroot(whites), which returns the whites to normal GC. + ClearWhiteJSWeakRefTargets(); + // Segments are 4 KiB on 32-bit and 8 KiB on 64-bit. static const size_t kSegmentSize = sizeof(void*) * 1024; SegmentedVector whiteNodes( @@ -3314,6 +3323,31 @@ return numWhiteNodes > 0 || numWhiteGCed > 0 || numWhiteJSZones > 0; } +static bool IsGCThingWhiteInCCGraph(JS::GCCellPtr aPtr, void* aData) { + auto* cc = static_cast(aData); + return cc->IsGCThingWhiteInCCGraph(aPtr); +} + +bool nsCycleCollector::IsGCThingWhiteInCCGraph(JS::GCCellPtr aPtr) { + PtrInfo* pinfo = mGraph.FindNode(aPtr.asCell()); + if (!pinfo) { + return false; + } + + MOZ_ASSERT(pinfo->mParticipant); + bool isWhite = pinfo->mColor == white; + + MOZ_ASSERT_IF(isWhite, pinfo->IsGrayJS()); + return isWhite; +} + +void nsCycleCollector::ClearWhiteJSWeakRefTargets() { + // Clear the targets of JS WeakRef objects whose target is part of a cycle + // that we're about to unlink. + JSRuntime* runtime = Runtime()->Runtime(); + JS::MaybeClearWeakRefTargets(runtime, &::IsGCThingWhiteInCCGraph, this); +} + //////////////////////// // Memory reporting //////////////////////// diff -Nru thunderbird-140.10.0esr/xpcom/io/SlicedInputStream.cpp thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.cpp --- thunderbird-140.10.0esr/xpcom/io/SlicedInputStream.cpp 2026-04-21 14:53:10.000000000 +0000 +++ thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.cpp 2026-04-29 18:38:37.000000000 +0000 @@ -43,6 +43,15 @@ NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInputStream) NS_INTERFACE_MAP_END +// It is highly unlikely for a stream to exceed INT64_MAX bytes in length, so we +// clamp these values here to allow callers as well as SlicedInputStream to +// avoid unnecessary integer overflow checks. Out of range start/length values +// should behave as expected in all realistic situations. +// +// Some stream APIs use an int64_t (e.g. Tell), so we use INT64_MAX as the +// maximum internal offset for start/end. +static constexpr uint64_t kMaxStreamPos = INT64_MAX; + SlicedInputStream::SlicedInputStream( already_AddRefed aInputStream, uint64_t aStart, uint64_t aLength) @@ -53,8 +62,8 @@ mWeakAsyncInputStream(nullptr), mWeakInputStreamLength(nullptr), mWeakAsyncInputStreamLength(nullptr), - mStart(aStart), - mLength(aLength), + mStart(std::clamp(aStart, 0, kMaxStreamPos)), + mLength(std::clamp(aLength, 0, kMaxStreamPos - mStart)), mCurPos(0), mClosed(false), mAsyncWaitFlags(0), @@ -491,11 +500,11 @@ const SlicedInputStreamParams& params = aParams.get_SlicedInputStreamParams(); - auto end = CheckedUint64(params.start()) + params.length(); - if (!end.isValid()) { + if (params.start() > kMaxStreamPos || + params.length() > kMaxStreamPos - params.start()) { return false; } - if (params.curPos() > end.value()) { + if (params.curPos() > params.start() + params.length()) { return false; } diff -Nru thunderbird-140.10.0esr/xpcom/io/SlicedInputStream.h thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.h --- thunderbird-140.10.0esr/xpcom/io/SlicedInputStream.h 2026-04-21 14:53:10.000000000 +0000 +++ thunderbird-140.10.1esr/xpcom/io/SlicedInputStream.h 2026-04-29 18:38:37.000000000 +0000 @@ -47,7 +47,11 @@ // than aStart bytes, reading from SlicedInputStream returns no data. If // aInputStream contains more than aStart bytes, but fewer than aStart + // aLength bytes, reading from SlicedInputStream returns as many bytes as can - // be consumed from aInputStream after reading aLength bytes. + // be consumed from aInputStream after reading aStart bytes. + // + // It is safe to specify an arbitrarily large aLength (e.g. UINT64_MAX). Doing + // so is treated as allowing an arbitrary number of additional bytes following + // aStart. // // aInputStream should not be read from after constructing a // SlicedInputStream wrapper around it. diff -Nru thunderbird-140.10.0esr/xpcom/io/nsICloneableInputStream.idl thunderbird-140.10.1esr/xpcom/io/nsICloneableInputStream.idl --- thunderbird-140.10.0esr/xpcom/io/nsICloneableInputStream.idl 2026-04-21 14:53:09.000000000 +0000 +++ thunderbird-140.10.1esr/xpcom/io/nsICloneableInputStream.idl 2026-04-29 18:38:37.000000000 +0000 @@ -27,5 +27,12 @@ [scriptable, builtinclass, uuid(ece853c3-aded-4cef-8f51-0d1493d60bd5)] interface nsICloneableInputStreamWithRange : nsICloneableInputStream { + // Create a copy of the input stream, but with the data range reduced to a + // sub-slice. The copy will begin at `start` bytes, and extends for a maximum + // of `length` bytes. If the underlying stream contains more than `start` + // bytes, but fewer than `length` bytes, reading from the stream returns all + // remaining bytes. + // + // See SlicedInputStream's constructor for more details. nsIInputStream cloneWithRange(in uint64_t start, in uint64_t length); }; diff -Nru thunderbird-140.10.0esr/xpcom/tests/gtest/TestSlicedInputStream.cpp thunderbird-140.10.1esr/xpcom/tests/gtest/TestSlicedInputStream.cpp --- thunderbird-140.10.0esr/xpcom/tests/gtest/TestSlicedInputStream.cpp 2026-04-21 14:53:09.000000000 +0000 +++ thunderbird-140.10.1esr/xpcom/tests/gtest/TestSlicedInputStream.cpp 2026-04-29 18:38:37.000000000 +0000 @@ -307,6 +307,41 @@ ASSERT_EQ((uint64_t)500, count); } +// Like LengthBiggerThan, but for an overflowing aStart + aLength pair. +TEST(TestSlicedInputStream, LengthMuchBiggerThan) +{ + nsCString buf; + RefPtr sis = + CreateNonSeekableStreams(500, 100, UINT64_MAX - 1, buf); + + uint64_t length; + ASSERT_EQ(NS_OK, sis->Available(&length)); + ASSERT_EQ((uint64_t)500 - 100, length); + + char buf2[4096]; + uint32_t count; + ASSERT_EQ(NS_OK, sis->Read(buf2, sizeof(buf2), &count)); + ASSERT_EQ((uint64_t)(500 - 100), count); + ASSERT_EQ(Substring(buf, 100, count), Substring(buf2, count)); +} + +// Like LengthMuchBiggerThan, but with a massive aStart value. +TEST(TestSlicedInputStream, StartMuchBiggerThan) +{ + nsCString buf; + RefPtr sis = + CreateNonSeekableStreams(500, UINT64_MAX - 1, 100, buf); + + uint64_t length; + ASSERT_EQ(NS_OK, sis->Available(&length)); + ASSERT_EQ((uint64_t)0, length); + + char buf2[4096]; + uint32_t count; + ASSERT_EQ(NS_OK, sis->Read(buf2, sizeof(buf2), &count)); + ASSERT_EQ((uint64_t)0, count); +} + // What if the length is 0? TEST(TestSlicedInputStream, Length0) {