Gentoo Archives: gentoo-commits

From: Alexis Ballier <aballier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: sci-libs/ignition-common/, sci-libs/ignition-common/files/
Date: Wed, 24 Aug 2022 11:39:00
Message-Id: 1661341124.d2ae17e834044bc7d9b0d742309fc84a6e66675e.aballier@gentoo
1 commit: d2ae17e834044bc7d9b0d742309fc84a6e66675e
2 Author: Alexis Ballier <aballier <AT> gentoo <DOT> org>
3 AuthorDate: Wed Aug 24 11:38:21 2022 +0000
4 Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org>
5 CommitDate: Wed Aug 24 11:38:44 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d2ae17e8
7
8 sci-libs/ignition-common: update patch
9
10 Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org>
11
12 sci-libs/ignition-common/files/ffmpeg5.patch | 113 +++++----------------
13 .../ignition-common/ignition-common-3.14.2.ebuild | 2 +-
14 2 files changed, 25 insertions(+), 90 deletions(-)
15
16 diff --git a/sci-libs/ignition-common/files/ffmpeg5.patch b/sci-libs/ignition-common/files/ffmpeg5.patch
17 index 668b2befeb74..dc0f763072eb 100644
18 --- a/sci-libs/ignition-common/files/ffmpeg5.patch
19 +++ b/sci-libs/ignition-common/files/ffmpeg5.patch
20 @@ -1,93 +1,28 @@
21 -Index: ign-common-ignition-common3_3.14.0/av/src/AudioDecoder.cc
22 +Index: gz-common-ignition-common3_3.14.2/graphics/src/Image.cc
23 ===================================================================
24 ---- ign-common-ignition-common3_3.14.0.orig/av/src/AudioDecoder.cc
25 -+++ ign-common-ignition-common3_3.14.0/av/src/AudioDecoder.cc
26 -@@ -35,7 +35,7 @@ class ignition::common::AudioDecoderPriv
27 - public: AVCodecContext *codecCtx;
28 +--- gz-common-ignition-common3_3.14.2.orig/graphics/src/Image.cc
29 ++++ gz-common-ignition-common3_3.14.2/graphics/src/Image.cc
30 +@@ -20,6 +20,7 @@
31 + #include <FreeImage.h>
32
33 - /// \brief libavcodec audio codec.
34 -- public: AVCodec *codec;
35 -+ public: const AVCodec *codec;
36 + #include <string>
37 ++#include <cstring>
38
39 - /// \brief Index of the audio stream.
40 - public: int audioStream;
41 -@@ -132,8 +132,12 @@ bool AudioDecoder::Decode(uint8_t **_out
42 - # pragma GCC diagnostic push
43 - # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
44 - #endif
45 -- bytesDecoded = avcodec_decode_audio4(this->data->codecCtx, decodedFrame,
46 -- &gotFrame, &packet1);
47 -+ bytesDecoded = avcodec_send_packet(this->data->codecCtx, &packet1);
48 -+ if (bytesDecoded >= 0 || bytesDecoded == AVERROR_EOF) {
49 -+ bytesDecoded = avcodec_receive_frame(this->data->codecCtx, decodedFrame);
50 -+ gotFrame = bytesDecoded >= 0;
51 -+ if (bytesDecoded == AVERROR(EAGAIN) || bytesDecoded == AVERROR_EOF) bytesDecoded = 0;
52 -+ }
53 - #ifndef _WIN32
54 - # pragma GCC diagnostic pop
55 - #endif
56 -@@ -224,7 +228,7 @@ bool AudioDecoder::SetFile(const std::st
57 - # pragma GCC diagnostic push
58 - # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
59 - #endif
60 -- if (this->data->formatCtx->streams[i]->codec->codec_type == // NOLINT(*)
61 -+ if (this->data->formatCtx->streams[i]->codecpar->codec_type == // NOLINT(*)
62 - AVMEDIA_TYPE_AUDIO)
63 - #ifndef _WIN32
64 - # pragma GCC diagnostic pop
65 -@@ -249,8 +253,9 @@ bool AudioDecoder::SetFile(const std::st
66 - # pragma GCC diagnostic push
67 - # pragma GCC diagnostic ignored "-Wdeprecated-declarations"
68 - #endif
69 -- this->data->codecCtx = this->data->formatCtx->streams[
70 -- this->data->audioStream]->codec;
71 -+ this->data->codecCtx = avcodec_alloc_context3(nullptr);
72 -+ avcodec_parameters_to_context(this->data->codecCtx, this->data->formatCtx->streams[
73 -+ this->data->audioStream]->codecpar);
74 - #ifndef _WIN32
75 - # pragma GCC diagnostic pop
76 - #endif
77 -Index: ign-common-ignition-common3_3.14.0/av/src/Video.cc
78 + #include <ignition/common/Console.hh>
79 + #include <ignition/common/Util.hh>
80 +Index: gz-common-ignition-common3_3.14.2/av/src/AudioDecoder.cc
81 ===================================================================
82 ---- ign-common-ignition-common3_3.14.0.orig/av/src/Video.cc
83 -+++ ign-common-ignition-common3_3.14.0/av/src/Video.cc
84 -@@ -91,7 +91,7 @@ void Video::Cleanup()
85 - /////////////////////////////////////////////////
86 - bool Video::Load(const std::string &_filename)
87 - {
88 -- AVCodec *codec = nullptr;
89 -+ const AVCodec *codec = nullptr;
90 - this->dataPtr->videoStream = -1;
91 -
92 - if (this->dataPtr->formatCtx || this->dataPtr->avFrame ||
93 -Index: ign-common-ignition-common3_3.14.0/av/src/VideoEncoder.cc
94 -===================================================================
95 ---- ign-common-ignition-common3_3.14.0.orig/av/src/VideoEncoder.cc
96 -+++ ign-common-ignition-common3_3.14.0/av/src/VideoEncoder.cc
97 -@@ -106,7 +106,7 @@ class IGNITION_COMMON_AV_HIDDEN ignition
98 - /// Find a suitable encoder for the given codec ID.
99 - /// \param[in] _codecId ID of the codec we seek the encoder for.
100 - /// \return The matched encoder (or nullptr on failure).
101 -- public: AVCodec* FindEncoder(AVCodecID _codecId);
102 -+ public: const AVCodec* FindEncoder(AVCodecID _codecId);
103 -
104 - /// \brief Get a pointer to the frame that contains the encoder input. This
105 - /// mainly serves for uploading the frame to GPU buffer if HW acceleration is
106 -@@ -123,7 +123,7 @@ class IGNITION_COMMON_AV_HIDDEN ignition
107 - };
108 -
109 - /////////////////////////////////////////////////
110 --AVCodec* VideoEncoderPrivate::FindEncoder(AVCodecID _codecId)
111 -+const AVCodec* VideoEncoderPrivate::FindEncoder(AVCodecID _codecId)
112 - {
113 - #ifdef IGN_COMMON_BUILD_HW_VIDEO
114 - if (this->hwEncoder)
115 -@@ -367,7 +367,7 @@ bool VideoEncoder::Start(
116 - }
117 - else
118 - {
119 -- AVOutputFormat *outputFormat = av_guess_format(nullptr,
120 -+ const AVOutputFormat *outputFormat = av_guess_format(nullptr,
121 - this->dataPtr->filename.c_str(), nullptr);
122 -
123 - if (!outputFormat)
124 +--- gz-common-ignition-common3_3.14.2.orig/av/src/AudioDecoder.cc
125 ++++ gz-common-ignition-common3_3.14.2/av/src/AudioDecoder.cc
126 +@@ -157,7 +157,11 @@ bool AudioDecoder::Decode(uint8_t **_out
127 + // decodedFrame->linesize[0].
128 + int size = decodedFrame->nb_samples *
129 + av_get_bytes_per_sample(this->data->codecCtx->sample_fmt) *
130 ++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(59,24,100)
131 + this->data->codecCtx->ch_layout.nb_channels;
132 ++#else
133 ++ this->data->codecCtx->channels;
134 ++#endif
135 + // Resize the audio buffer as necessary
136 + if (*_outBufferSize + size > maxBufferSize)
137 + {
138
139 diff --git a/sci-libs/ignition-common/ignition-common-3.14.2.ebuild b/sci-libs/ignition-common/ignition-common-3.14.2.ebuild
140 index 0d31e9ce6c0c..b1328bf00fb2 100644
141 --- a/sci-libs/ignition-common/ignition-common-3.14.2.ebuild
142 +++ b/sci-libs/ignition-common/ignition-common-3.14.2.ebuild
143 @@ -33,7 +33,7 @@ DEPEND="${RDEPEND}
144 BDEPEND="
145 dev-util/ignition-cmake:2"
146
147 -S="${WORKDIR}/ign-common-${PN}${IGN_MAJOR}_${PV}"
148 +S="${WORKDIR}/gz-common-ignition-common${IGN_MAJOR}_${PV}"
149 PATCHES=( "${FILESDIR}/ffmpeg5.patch" )
150
151 src_configure() {