From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- dom/media/platforms/ffmpeg/FFmpegUtils.h | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'dom/media/platforms/ffmpeg/FFmpegUtils.h') diff --git a/dom/media/platforms/ffmpeg/FFmpegUtils.h b/dom/media/platforms/ffmpeg/FFmpegUtils.h index fe588ed14c..bdbb184cf2 100644 --- a/dom/media/platforms/ffmpeg/FFmpegUtils.h +++ b/dom/media/platforms/ffmpeg/FFmpegUtils.h @@ -51,6 +51,36 @@ inline bool IsVideoCodec(AVCodecID aCodecID) { } } +// Access the correct location for the channel count, based on ffmpeg version. +template +inline int& ChannelCount(T* aObject) { +#if LIBAVCODEC_VERSION_MAJOR <= 59 + return aObject->channels; +#else + return aObject->ch_layout.nb_channels; +#endif +} + +// Access the correct location for the duration, based on ffmpeg version. +template +inline int64_t& Duration(T* aObject) { +#if LIBAVCODEC_VERSION_MAJOR < 61 + return aObject->pkt_duration; +#else + return aObject->duration; +#endif +} + +// Access the correct location for the duration, based on ffmpeg version. +template +inline const int64_t& Duration(const T* aObject) { +#if LIBAVCODEC_VERSION_MAJOR < 61 + return aObject->pkt_duration; +#else + return aObject->duration; +#endif +} + } // namespace mozilla #endif // DOM_MEDIA_PLATFORMS_FFMPEG_FFMPEGUTILS_H_ -- cgit v1.2.3