update to 2.9.71.20220415git.276ffa5a4 [release 2.9.71.20220415git.276ffa5a4-1mamba;Fri Apr 15 2022]

This commit is contained in:
Silvan Calarco 2024-01-05 20:22:00 +01:00
parent 88eb4181af
commit dbbdbfdbd9
2 changed files with 234 additions and 42 deletions

View File

@ -0,0 +1,201 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9dd9719555f79850d640872fd46731a926eda051..d18f5277536e05faf6f54273891be9b6c263c32b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -187,13 +187,8 @@ if( CMAKE_BUILD_TYPE_TOLOWER MATCHES debug )
add_definitions(-Wall -Wextra)
endif()
-# this needs to be here because also code in shared/ needs config.h. This is also the
-# reason why various checks are above why they belong under if( WITH_PLAYER )
-configure_file( shared/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/shared/config.h )
-
add_subdirectory( data )
add_subdirectory( images )
-add_subdirectory( shared )
if( WITH_PLAYER )
find_package(X11)
@@ -317,6 +312,12 @@ if( WITH_PLAYER )
endif()
+# this needs to be here because also code in shared/ needs config.h. This is also the
+# reason why various checks are above why they belong under if( WITH_PLAYER )
+configure_file( shared/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/shared/config.h )
+
+add_subdirectory( shared )
+
if( WITH_UTILITIES )
add_subdirectory( utilities )
endif()
diff --git a/shared/config.h.cmake b/shared/config.h.cmake
index 3478edd0d468d6beb182fd7ac0d0978c623cb002..9dde3306862a9662c0fb442a926e27572b6acd50 100644
--- a/shared/config.h.cmake
+++ b/shared/config.h.cmake
@@ -19,10 +19,16 @@
#cmakedefine QT_QTOPENGL_FOUND 1
/* If liblastfm is found */
-#cmakedefine HAVE_LIBLASTFM 1
+#cmakedefine LIBLASTFM_FOUND 1
+#ifdef LIBLASTFM_FOUND
+#define HAVE_LIBLASTFM 1
+#endif
/* If libofa is found */
-#cmakedefine HAVE_LIBOFA 1
+#cmakedefine LIBOFA_FOUND 1
+#ifdef LIBOFA_FOUND
+#define HAVE_LIBOFA 1
+#endif
/* Whether cmake build type is debug */
#cmakedefine DEBUG_BUILD_TYPE
diff --git a/src/musicbrainz/MusicDNSAudioDecoder.cpp b/src/musicbrainz/MusicDNSAudioDecoder.cpp
index e8e14d540efb55f91a3fd79047d8a6171c4b52bb..5f86b16b35a5041c9e4933fc5f58da88c4565844 100644
--- a/src/musicbrainz/MusicDNSAudioDecoder.cpp
+++ b/src/musicbrainz/MusicDNSAudioDecoder.cpp
@@ -133,8 +133,10 @@ MusicDNSAudioDecoder::run(ThreadWeaver::JobPointer self, ThreadWeaver::Thread *t
Q_UNUSED(thread);
DecodedAudioData data;
+#if LIBAVCODEC_VERSION_MAJOR < 59
avcodec_register_all();
av_register_all();
+#endif
foreach( Meta::TrackPtr track, m_tracks )
{
@@ -173,7 +175,130 @@ MusicDNSAudioDecoder::defaultEnd(const ThreadWeaver::JobPointer& self, ThreadWea
// Function below has separate implementation for each ffmpeg API version
int
MusicDNSAudioDecoder::decode( const QString &fileName, DecodedAudioData *data, const int length )
-#if LIBAVCODEC_VERSION_MAJOR >= 54 // ffmpeg 0.11
+#if LIBAVCODEC_VERSION_MAJOR >= 59 // ffmpeg 5.0
+{
+ AVFormatContext *pFormatCtx = NULL;
+ AVCodecContext *pCodecCtx = NULL;
+ const AVCodec *pCodec = NULL;
+ AVFrame *decodedFrame = NULL;
+ AVPacket *packet = NULL, *avpkt = NULL;
+ AVCodecParameters *codecpar = NULL;
+ AVRational streamTimeBase = { 1, 1000000 };
+ AVRational localTimeBase = { 1, 1000 };
+
+ int audioStream = 0;
+ int decoderRet = 0;
+ int planeSize = 0;
+
+ bool isOk = true;
+ av_log_set_level(AV_LOG_VERBOSE);
+
+ if( avformat_open_input( &pFormatCtx, fileName.toLocal8Bit(), NULL, NULL ) < 0 )
+ {
+ warning() << QLatin1String( "Unable to open input file: " ) + fileName;
+ return 0;
+ }
+
+ if( avformat_find_stream_info( pFormatCtx, NULL ) < 0 )
+ {
+ warning() << QLatin1String( "Unable to find stream info: " ) + fileName;
+ avformat_close_input( &pFormatCtx );
+ return 0;
+ }
+
+ audioStream = av_find_best_stream(pFormatCtx, AVMEDIA_TYPE_AUDIO, -1, -1, &pCodec, 0);
+ if( audioStream < 0 )
+ {
+ warning() << QLatin1String( "Unable to find stream: " ) + fileName;
+ avformat_close_input( &pFormatCtx );
+ return 0;
+ }
+
+ if( !pCodec )
+ {
+ warning() << QLatin1String( "Unable to find decoder: " ) + fileName;
+ avformat_close_input( &pFormatCtx );
+ return 0;
+ }
+
+ pCodecCtx = avcodec_alloc_context3(pCodec);
+
+ if( avcodec_open2( pCodecCtx, pCodec, NULL ) < 0 )
+ {
+ warning() << QLatin1String( "Unable to open codec " ) + fileName;
+ avformat_close_input( &pFormatCtx );
+ return 0;
+ }
+
+ streamTimeBase = pFormatCtx->streams[audioStream]->time_base;
+ codecpar = pFormatCtx->streams[audioStream]->codecpar;
+
+ data->setSampleRate( codecpar->sample_rate );
+ data->setChannels( ( codecpar->channels > 1 )? 1 : 0 );
+
+ avpkt = av_packet_alloc();
+ packet = av_packet_alloc();
+ while( !av_read_frame( pFormatCtx, packet ) && isOk )
+ {
+ if( packet->stream_index == audioStream )
+ {
+ avpkt->size = packet->size;
+ avpkt->data = packet->data;
+ if( !decodedFrame )
+ {
+ decodedFrame = av_frame_alloc();
+ if( !decodedFrame )
+ {
+ warning() << "Unable to allocate enough memory to decode file.";
+ isOk = false;
+ break;
+ }
+ else
+ av_frame_unref( decodedFrame );
+ }
+
+ decoderRet = avcodec_send_packet( pCodecCtx, avpkt );
+ if( decoderRet < 0 )
+ {
+ warning() << "Error while sending avcodec packet.";
+ isOk = false;
+ break;
+ }
+ do {
+ decoderRet = avcodec_receive_frame( pCodecCtx, decodedFrame );
+ if( decoderRet == AVERROR(AVERROR_EOF) || decoderRet == AVERROR(EAGAIN) )
+ {
+ break;
+ }
+ else if( decoderRet < 0 )
+ {
+ warning() << "Error while decoding.";
+ isOk = false;
+ break;
+ }
+ av_samples_get_buffer_size( &planeSize, pCodecCtx->channels, decodedFrame->nb_samples, pCodecCtx->sample_fmt, 1);
+ for( int i = 0; i < qMin( pCodecCtx->channels, 2 ); i++ )
+ data->appendData( const_cast<const quint8 *>( decodedFrame->extended_data[i] ), planeSize );
+ } while( decoderRet == 0 );
+
+ data->addTime( av_rescale_q( packet->duration, streamTimeBase, localTimeBase ) );
+ }
+
+ av_packet_unref( packet );
+
+ if( data->duration() >= length )
+ break;
+ }
+
+ av_packet_unref( avpkt );
+
+ avcodec_close( pCodecCtx );
+ avformat_close_input( &pFormatCtx );
+ av_free( decodedFrame );
+
+ return data->duration();
+}
+#elif LIBAVCODEC_VERSION_MAJOR >= 54 // ffmpeg 0.11
{
AVFormatContext *pFormatCtx = NULL;
AVCodecContext *pCodecCtx = NULL;

View File

@ -1,5 +1,6 @@
%define gittag %(echo %version | cut -d. -f5)
Name: amarok
Version: 2.9.71
Version: 2.9.71.20220415git.276ffa5a4
Release: 1mamba
Epoch: 1
Summary: A powerful music player for KDE
@ -8,16 +9,15 @@ Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://amarok.kde.org
Source: https://github.com/KDE/amarok.git/master/amarok-%{version}.tar.bz2
#Source: http://download.kde.org/stable/amarok/%{version}/src/amarok-%{version}.tar.xz
Source: https://github.com/KDE/amarok.git/master@%{gittag?%gittag:"dont"}/amarok-%{version}.tar.bz2
Patch0: amarok-2.8.0-x86_64-include-QSharedPointer.patch
Patch1: amarok-2.8.0-libtag-1.10.patch
Patch2: amarok-2.8.0-ffmpeg-3.0.patch
Patch3: amarok-2.9.75-ffmpeg-5.0.patch
License: GPL
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: ldconfig
BuildRequires: libQt5WebEngine-devel
BuildRequires: libQt5Svg-devel
BuildRequires: libattica5-devel
BuildRequires: libavcodec-ffmpeg-devel
BuildRequires: libavformat-ffmpeg-devel
@ -26,7 +26,6 @@ BuildRequires: libfftw-devel
BuildRequires: libgdk-pixbuf-devel
BuildRequires: libglib-devel
BuildRequires: libgpod-devel
BuildRequires: libimobiledevice-devel
BuildRequires: libkarchive-devel
BuildRequires: libkcmutils-devel
BuildRequires: libkcodecs-devel
@ -60,13 +59,14 @@ BuildRequires: libmtp-devel
BuildRequires: libmygpo-qt-devel
BuildRequires: libofa-devel
BuildRequires: libphonon-devel
BuildRequires: libqt5-devel
BuildRequires: libsolid-devel
BuildRequires: libstdc++6-devel
BuildRequires: libtag-devel
BuildRequires: libtag-extras-devel
BuildRequires: libthreadweaver-devel
BuildRequires: perl-devel
BuildRequires: qt5-qtbase-devel
BuildRequires: qt5-qtdeclarative-devel
## AUTOBUILDREQ-END
BuildRequires: coreutils
#BuildRequires: libmpeg4ip-devel
@ -88,23 +88,22 @@ Requires: ruby
Requires: qtscriptgenerator
Requires: clamz
Provides: amarok4
Obsoletes: amarok4
Obsoletes: amarok-engine-xine
Obsoletes: amarok-i18n-da
Obsoletes: amarok-i18n-de
Obsoletes: amarok-i18n-es
Obsoletes: amarok-i18n-et
Obsoletes: amarok-i18n-fr
Obsoletes: amarok-i18n-it
Obsoletes: amarok-i18n-nl
Obsoletes: amarok-i18n-pl
Obsoletes: amarok-i18n-pt
Obsoletes: amarok-i18n-pt_BR
Obsoletes: amarok-i18n-ru
Obsoletes: amarok-i18n-sv
Obsoletes: libamarok
Obsoletes: libamarok-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: amarok4 < 1:2.9.75
Obsoletes: amarok-engine-xine < 1:2.9.75
Obsoletes: amarok-i18n-da < 1:2.9.75
Obsoletes: amarok-i18n-de < 1:2.9.75
Obsoletes: amarok-i18n-es < 1:2.9.75
Obsoletes: amarok-i18n-et < 1:2.9.75
Obsoletes: amarok-i18n-fr < 1:2.9.75
Obsoletes: amarok-i18n-it < 1:2.9.75
Obsoletes: amarok-i18n-nl < 1:2.9.75
Obsoletes: amarok-i18n-pl < 1:2.9.75
Obsoletes: amarok-i18n-pt < 1:2.9.75
Obsoletes: amarok-i18n-pt_BR < 1:2.9.75
Obsoletes: amarok-i18n-ru < 1:2.9.75
Obsoletes: amarok-i18n-sv < 1:2.9.75
Obsoletes: libamarok < 1:2.9.75
Obsoletes: libamarok-devel < 1:2.9.75
%description
Amarok is a powerful music player for Linux and Unix, MacOS X and Windows with an intuitive interface:
@ -123,6 +122,7 @@ Amarok is a powerful music player for Linux and Unix, MacOS X and Windows with a
%patch0 -p1
#%patch1 -p1
#%patch2 -p1
%patch3 -p1 -b .ffmpeg-5.0
sed -i "s|mygpo-qt5/|mygpo-qt/|" src/services/gpodder/*.h src/services/gpodder/*.cpp
@ -168,12 +168,9 @@ exit 0
%files -f %{name}5_qt.lang
%defattr(-,root,root)
%{_kde5_bindir}/*
#%{_kde5_libdir}/kde4/amarok_*.so
#%{_kde5_libdir}/kde4/kcm_amarok_service_*.so
%{_kde5_libdir}/libamarokcore.so
%{_kde5_libdir}/libamarokcore.so.*
%{_kde5_libdir}/libamaroklib.so*
#%{_kde5_libdir}/libamarokocsclient.so.*
%{_kde5_libdir}/libamarok-sqlcollection.so*
%{_kde5_libdir}/libamarok-transcoding.so
%{_kde5_libdir}/libamarok-transcoding.so.*
@ -187,40 +184,34 @@ exit 0
%{_libdir}/qt5/plugins/kcm_amarok_service_*.so
%dir %{_libdir}/qt5/qml/org/kde/amarok
%{_libdir}/qt5/qml/org/kde/amarok/*
%{_datadir}/dbus-1/interfaces/org.kde.amarok.*.xml
%{_datadir}/dbus-1/services/org.kde.amarok.service
%{_kde5_sharedir}/metainfo/org.kde.amarok.*.xml
%{_datadir}/applications/org.kde.amarok*.desktop
%{_datadir}/metainfo/org.kde.amarok.context.appdata.xml
%{_datadir}/knotifications5/amarok.notifyrc
%dir %{_datadir}/kpackage/amarok
%{_datadir}/kpackage/amarok/*
%dir %{_datadir}/kpackage/genericqml/org.kde.amarok.context
%{_datadir}/kpackage/genericqml/org.kde.amarok.context/*
%{_datadir}/metainfo/org.kde.amarok.context.appdata.xml
%{_kde5_datadir}/amarok
#%{_kde5_datadir}/desktoptheme/default/widgets/amarok-*.svg
%{_kde5_datadir}/solid/actions/amarok-play-audiocd.desktop
%{_kde5_datadir}/kconf_update/amarok-2.4.1-tokens_syntax_update.pl
%{_kde5_datadir}/kconf_update/amarok.upd
%{_kde5_sharedir}/metainfo/org.kde.amarok.*.xml
%{_datadir}/applications/org.kde.amarok.desktop
%{_datadir}/applications/org.kde.amarok_containers.desktop
#%{_kde5_xdgappsdir}/amzdownloader.desktop
#%{_kde5_xdgmimedir}/amzdownloader.xml
%{_kde5_datadir}/kconf_update/*
%{_kde5_kcfgdir}/amarokconfig.kcfg
%{_kde5_configdir}/amarok_homerc
#%{_kde5_configdir}/amarokapplets.knsrc
%{_datadir}/knsrcfiles/amarok.knsrc
%{_kde5_dbusinterfacesdir}/org.kde.amarok.Collection.xml
#%{_kde5_dbusinterfacesdir}/org.freedesktop.MediaPlayer.player.xml
#%{_kde5_dbusinterfacesdir}/org.freedesktop.MediaPlayer.root.xml
#%{_kde5_dbusinterfacesdir}/org.freedesktop.MediaPlayer.tracklist.xml
%{_kde5_icondir}/hicolor/*/apps/amarok.png
%{_kde5_servicesdir}/ServiceMenus/*.desktop
%{_kde5_servicesdir}/*.desktop
%{_kde5_servicesdir}/*.protocol
%{_kde5_servicetypesdir}/*.desktop
%{_datadir}/dbus-1/interfaces/org.kde.amarok.App.xml
%{_datadir}/dbus-1/interfaces/org.kde.amarok.Mpris?Extensions.Player.xml
%doc AUTHORS COPYING
%changelog
* Fri Apr 15 2022 Silvan Calarco <silvan.calarco@mambasoft.it> 2.9.71.20220415git.276ffa5a4-1mamba
- update to 2.9.71.20220415git.276ffa5a4
* Tue Feb 09 2021 Automatic Build System <autodist@mambasoft.it> 2.9.71-1mamba
- automatic version update by autodist