1 |
commit: 4acf91aa4f7b2e90218205e351c5f3bc98a6a89b |
2 |
Author: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Feb 21 11:27:33 2022 +0000 |
4 |
Commit: Alexis Ballier <aballier <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Feb 21 17:04:37 2022 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=4acf91aa |
7 |
|
8 |
sci-libs/ignition-common: fix build with ffmpeg5 |
9 |
|
10 |
Package-Manager: Portage-3.0.30, Repoman-3.0.3 |
11 |
Signed-off-by: Alexis Ballier <aballier <AT> gentoo.org> |
12 |
|
13 |
sci-libs/ignition-common/files/ffmpeg5.patch | 93 ++++++++++++++++++++++ |
14 |
.../ignition-common/ignition-common-3.14.0.ebuild | 1 + |
15 |
2 files changed, 94 insertions(+) |
16 |
|
17 |
diff --git a/sci-libs/ignition-common/files/ffmpeg5.patch b/sci-libs/ignition-common/files/ffmpeg5.patch |
18 |
new file mode 100644 |
19 |
index 000000000000..668b2befeb74 |
20 |
--- /dev/null |
21 |
+++ b/sci-libs/ignition-common/files/ffmpeg5.patch |
22 |
@@ -0,0 +1,93 @@ |
23 |
+Index: ign-common-ignition-common3_3.14.0/av/src/AudioDecoder.cc |
24 |
+=================================================================== |
25 |
+--- ign-common-ignition-common3_3.14.0.orig/av/src/AudioDecoder.cc |
26 |
++++ ign-common-ignition-common3_3.14.0/av/src/AudioDecoder.cc |
27 |
+@@ -35,7 +35,7 @@ class ignition::common::AudioDecoderPriv |
28 |
+ public: AVCodecContext *codecCtx; |
29 |
+ |
30 |
+ /// \brief libavcodec audio codec. |
31 |
+- public: AVCodec *codec; |
32 |
++ public: const AVCodec *codec; |
33 |
+ |
34 |
+ /// \brief Index of the audio stream. |
35 |
+ public: int audioStream; |
36 |
+@@ -132,8 +132,12 @@ bool AudioDecoder::Decode(uint8_t **_out |
37 |
+ # pragma GCC diagnostic push |
38 |
+ # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
39 |
+ #endif |
40 |
+- bytesDecoded = avcodec_decode_audio4(this->data->codecCtx, decodedFrame, |
41 |
+- &gotFrame, &packet1); |
42 |
++ bytesDecoded = avcodec_send_packet(this->data->codecCtx, &packet1); |
43 |
++ if (bytesDecoded >= 0 || bytesDecoded == AVERROR_EOF) { |
44 |
++ bytesDecoded = avcodec_receive_frame(this->data->codecCtx, decodedFrame); |
45 |
++ gotFrame = bytesDecoded >= 0; |
46 |
++ if (bytesDecoded == AVERROR(EAGAIN) || bytesDecoded == AVERROR_EOF) bytesDecoded = 0; |
47 |
++ } |
48 |
+ #ifndef _WIN32 |
49 |
+ # pragma GCC diagnostic pop |
50 |
+ #endif |
51 |
+@@ -224,7 +228,7 @@ bool AudioDecoder::SetFile(const std::st |
52 |
+ # pragma GCC diagnostic push |
53 |
+ # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
54 |
+ #endif |
55 |
+- if (this->data->formatCtx->streams[i]->codec->codec_type == // NOLINT(*) |
56 |
++ if (this->data->formatCtx->streams[i]->codecpar->codec_type == // NOLINT(*) |
57 |
+ AVMEDIA_TYPE_AUDIO) |
58 |
+ #ifndef _WIN32 |
59 |
+ # pragma GCC diagnostic pop |
60 |
+@@ -249,8 +253,9 @@ bool AudioDecoder::SetFile(const std::st |
61 |
+ # pragma GCC diagnostic push |
62 |
+ # pragma GCC diagnostic ignored "-Wdeprecated-declarations" |
63 |
+ #endif |
64 |
+- this->data->codecCtx = this->data->formatCtx->streams[ |
65 |
+- this->data->audioStream]->codec; |
66 |
++ this->data->codecCtx = avcodec_alloc_context3(nullptr); |
67 |
++ avcodec_parameters_to_context(this->data->codecCtx, this->data->formatCtx->streams[ |
68 |
++ this->data->audioStream]->codecpar); |
69 |
+ #ifndef _WIN32 |
70 |
+ # pragma GCC diagnostic pop |
71 |
+ #endif |
72 |
+Index: ign-common-ignition-common3_3.14.0/av/src/Video.cc |
73 |
+=================================================================== |
74 |
+--- ign-common-ignition-common3_3.14.0.orig/av/src/Video.cc |
75 |
++++ ign-common-ignition-common3_3.14.0/av/src/Video.cc |
76 |
+@@ -91,7 +91,7 @@ void Video::Cleanup() |
77 |
+ ///////////////////////////////////////////////// |
78 |
+ bool Video::Load(const std::string &_filename) |
79 |
+ { |
80 |
+- AVCodec *codec = nullptr; |
81 |
++ const AVCodec *codec = nullptr; |
82 |
+ this->dataPtr->videoStream = -1; |
83 |
+ |
84 |
+ if (this->dataPtr->formatCtx || this->dataPtr->avFrame || |
85 |
+Index: ign-common-ignition-common3_3.14.0/av/src/VideoEncoder.cc |
86 |
+=================================================================== |
87 |
+--- ign-common-ignition-common3_3.14.0.orig/av/src/VideoEncoder.cc |
88 |
++++ ign-common-ignition-common3_3.14.0/av/src/VideoEncoder.cc |
89 |
+@@ -106,7 +106,7 @@ class IGNITION_COMMON_AV_HIDDEN ignition |
90 |
+ /// Find a suitable encoder for the given codec ID. |
91 |
+ /// \param[in] _codecId ID of the codec we seek the encoder for. |
92 |
+ /// \return The matched encoder (or nullptr on failure). |
93 |
+- public: AVCodec* FindEncoder(AVCodecID _codecId); |
94 |
++ public: const AVCodec* FindEncoder(AVCodecID _codecId); |
95 |
+ |
96 |
+ /// \brief Get a pointer to the frame that contains the encoder input. This |
97 |
+ /// mainly serves for uploading the frame to GPU buffer if HW acceleration is |
98 |
+@@ -123,7 +123,7 @@ class IGNITION_COMMON_AV_HIDDEN ignition |
99 |
+ }; |
100 |
+ |
101 |
+ ///////////////////////////////////////////////// |
102 |
+-AVCodec* VideoEncoderPrivate::FindEncoder(AVCodecID _codecId) |
103 |
++const AVCodec* VideoEncoderPrivate::FindEncoder(AVCodecID _codecId) |
104 |
+ { |
105 |
+ #ifdef IGN_COMMON_BUILD_HW_VIDEO |
106 |
+ if (this->hwEncoder) |
107 |
+@@ -367,7 +367,7 @@ bool VideoEncoder::Start( |
108 |
+ } |
109 |
+ else |
110 |
+ { |
111 |
+- AVOutputFormat *outputFormat = av_guess_format(nullptr, |
112 |
++ const AVOutputFormat *outputFormat = av_guess_format(nullptr, |
113 |
+ this->dataPtr->filename.c_str(), nullptr); |
114 |
+ |
115 |
+ if (!outputFormat) |
116 |
|
117 |
diff --git a/sci-libs/ignition-common/ignition-common-3.14.0.ebuild b/sci-libs/ignition-common/ignition-common-3.14.0.ebuild |
118 |
index 6dbcc7750672..0d31e9ce6c0c 100644 |
119 |
--- a/sci-libs/ignition-common/ignition-common-3.14.0.ebuild |
120 |
+++ b/sci-libs/ignition-common/ignition-common-3.14.0.ebuild |
121 |
@@ -34,6 +34,7 @@ BDEPEND=" |
122 |
dev-util/ignition-cmake:2" |
123 |
|
124 |
S="${WORKDIR}/ign-common-${PN}${IGN_MAJOR}_${PV}" |
125 |
+PATCHES=( "${FILESDIR}/ffmpeg5.patch" ) |
126 |
|
127 |
src_configure() { |
128 |
local mycmakeargs=( |