commit c5c31bfe4e3710b90cfd0af5f54394952870263e
Author: Antonio Trande <sagitter(a)fedoraproject.org>
Date: Thu Feb 10 19:22:00 2022 +0100
Bugfix for building against ffmpeg 5+ /2
moc-bugfix-ffmpeg45.patch | 10 --------
moc-bugfix-ffmpeg5.patch | 63 +++++++++++++++++++++++++++++++++++++++++++++++
moc.spec | 33 ++++++++++++++++++++++---
3 files changed, 92 insertions(+), 14 deletions(-)
---
diff --git a/moc-bugfix-ffmpeg5.patch b/moc-bugfix-ffmpeg5.patch
new file mode 100644
index 0000000..c4289b4
--- /dev/null
+++ b/moc-bugfix-ffmpeg5.patch
@@ -0,0 +1,63 @@
+--- a/decoder_plugins/ffmpeg/ffmpeg.orig.c 2020-02-19 22:47:44.000000000 +0100
++++ b/decoder_plugins/ffmpeg/ffmpeg.c 2022-01-05 22:14:24.095941842 +0100
+@@ -32,6 +32,7 @@
+ #include <stdint.h>
+ #include <errno.h>
+
++#include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+ #include <libavutil/mathematics.h>
+ #if HAVE_LIBAVUTIL_CHANNEL_LAYOUT_H
+--- a/decoder_plugins/ffmpeg/ffmpeg.c 2022-02-07 15:26:04.819317207 +1300
++++ b/decoder_plugins/ffmpeg/ffmpeg.c 2022-02-07 15:36:40.767288638 +1300
+@@ -79,7 +79,7 @@ struct ffmpeg_data
+ AVIOContext *pb;
+ AVStream *stream;
+ AVCodecContext *enc;
+- AVCodec *codec;
++ const AVCodec *codec;
+
+ char *remain_buf;
+ int remain_buf_len;
+@@ -848,7 +848,7 @@ static int ffmpeg_can_decode (struct io_
+ {
+ int res;
+ AVProbeData probe_data;
+- AVInputFormat *fmt;
++ const AVInputFormat *fmt;
+ char buf[8096 + AVPROBE_PADDING_SIZE] = {0};
+
+ res = io_peek (stream, buf, sizeof (buf));
+@@ -1411,7 +1411,7 @@ static int ffmpeg_our_format_ext (const
+
+ static int ffmpeg_our_format_mime (const char *mime_type)
+ {
+- AVOutputFormat *fmt;
++ const AVOutputFormat *fmt;
+
+ fmt = av_guess_format (NULL, NULL, mime_type);
+ return fmt ? 1 : 0;
+--- a/decoder_plugins/ffmpeg/ffmpeg.c 2022-02-08 10:15:49.468786495 +1300
++++ b/decoder_plugins/ffmpeg/ffmpeg.c 2022-02-08 10:17:23.894780498 +1300
+@@ -1172,7 +1172,7 @@ static bool seek_in_stream (struct ffmpe
+ static bool seek_in_stream (struct ffmpeg_data *data, int sec)
+ #endif
+ {
+- int rc, flags = AVSEEK_FLAG_ANY;
++ int rc;
+ int64_t seek_ts;
+
+ #if SEEK_IN_DECODER
+@@ -1198,10 +1198,8 @@ static bool seek_in_stream (struct ffmpe
+ seek_ts += data->stream->start_time;
+ }
+
+- if (data->stream->cur_dts > seek_ts)
+- flags |= AVSEEK_FLAG_BACKWARD;
+-
+- rc = av_seek_frame (data->ic, data->stream->index, seek_ts, flags);
++ rc = av_seek_frame (data->ic, data->stream->index, seek_ts,
++ AVSEEK_FLAG_BACKWARD);
+ if (rc < 0) {
+ log_errno ("Seek error", rc);
+ return false;
diff --git a/moc.spec b/moc.spec
index 34c6f6c..2011e5b 100644
--- a/moc.spec
+++ b/moc.spec
@@ -2,6 +2,13 @@
%bcond_with debug
#
+# MOC is not ready for FFMpeg-5+ yet
+%if 0%{?fedora} > 34
+%bcond_with oldffmpeg
+%else
+%bcond_with oldffmpeg
+%endif
+
# Filtering of private libraries
%global __provides_exclude_from ^%{_libdir}/mocp/.*\\.so$
#
@@ -28,7 +35,8 @@ Patch0: %{name}-r2961+lt_init-1.patch
# RHBZ #1963427
Patch1: %{name}-change_private_libdir.patch
-Patch2: %{name}-bugfix-ffmpeg45.patch
+# Initial fix for FFMpeg-5
+Patch2: %{name}-bugfix-ffmpeg5.patch
BuildRequires: pkgconfig(ncurses)
BuildRequires: pkgconfig(alsa)
@@ -52,7 +60,11 @@ BuildRequires: pkgconfig(opus)
BuildRequires: libtool
BuildRequires: librcc-devel
BuildRequires: popt-devel
+%if %{with oldffmpeg}
+BuildRequires: compat-ffmpeg4-devel
+%else
BuildRequires: ffmpeg-devel
+%endif
BuildRequires: libmad-devel
BuildRequires: faad2-devel
@@ -68,7 +80,13 @@ using the menu similar to Midnight Commander, and MOC will start
playing all
files in this directory beginning from the chosen file.
%prep
-%autosetup -p 1 -n trunk
+%autosetup -N -n trunk
+
+%patch0 -p1
+%patch1 -p1
+%if %{without oldffmpeg}
+%patch2 -p1
+%endif
%build
mv configure.in configure.ac
@@ -83,8 +101,15 @@ export LT_SYS_LIBRARY_PATH=%{_libdir}/mocp
--disable-static --disable-silent-rules --enable-rpath --with-rcc \
--with-oss --with-alsa --with-jack --with-aac --with-mp3 \
--with-musepack --with-vorbis --with-flac --with-wavpack \
- --with-sndfile --with-modplug --with-ffmpeg --with-speex \
+ --with-sndfile --with-modplug --with-speex \
--with-samplerate --with-curl --without-magic \
+%if %{with oldffmpeg}
+ ffmpeg_CPPFLAGS=-I%{_includedir}/compat-ffmpeg28 \
+ ffmpeg_CFLAGS=-I%{_includedir}/compat-ffmpeg28 \
+ ffmpeg_LIBS="-L%{_libdir}/compat-ffmpeg4 -lswscale -lavcodec -lavdevice -lavfilter
-lavresample -lpostproc -lavutil" \
+%else
+ --with-ffmpeg \
+%endif
%if %{with debug}
--enable-debug \
%else
@@ -113,7 +138,7 @@ patchelf --set-rpath %{_libdir}/mocp/decoder_plugins
%{buildroot}%{_bindir}/*
%{_libdir}/mocp/decoder_plugins/*.so
%changelog
-* Wed Jan 05 2022 Antonio Trande <sagitter(a)fedoraproject.org> - 2.6-0.44.svn3005
+* Thu Feb 10 2022 Antonio Trande <sagitter(a)fedoraproject.org> - 2.6-0.44.svn3005
- Bugfix for building against ffmpeg 5+
* Fri Nov 12 2021 Leigh Scott <leigh123linux(a)gmail.com> - 2.6-0.43.svn3005
Show replies by date