[packages/vapoursynth-plugin-bestsource] - new

qboosh qboosh at pld-linux.org
Tue Apr 25 19:14:01 CEST 2023


commit 83ccb7b0e2b529af11e786cc95882ec1d4b43061
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date:   Tue Apr 25 19:16:40 2023 +0200

    - new

 bestsource-ffmpeg4.patch           | 33 ++++++++++++++++++++
 bestsource-system-libp2p.patch     | 63 ++++++++++++++++++++++++++++++++++++++
 vapoursynth-plugin-bestsource.spec | 61 ++++++++++++++++++++++++++++++++++++
 3 files changed, 157 insertions(+)
---
diff --git a/vapoursynth-plugin-bestsource.spec b/vapoursynth-plugin-bestsource.spec
new file mode 100644
index 0000000..65cffd8
--- /dev/null
+++ b/vapoursynth-plugin-bestsource.spec
@@ -0,0 +1,61 @@
+Summary:	Vapoursynth plugin to access audio and video via FFmpeg library
+Summary(pl.UTF-8):	Wtyczka Vapoursynth pozwalająca na dostęp do dźwięku i obrazu poprzez bibliotekę FFmpeg
+Name:		vapoursynth-plugin-bestsource
+# src/version.h says 0.9?
+Version:	0
+%define	snap	20230419
+%define	gitref	d917b26767c41851c50ccad29d8d126e139a7822
+%define	rel	1
+Release:	0.%{snap}.1
+License:	MIT
+Group:		Libraries
+Source0:	https://github.com/vapoursynth/bestsource/archive/%{gitref}/bestsource-%{gitref}.tar.gz
+# Source0-md5:	b3afb3b36ed0a7ab457bd1d44927b1a0
+Patch0:		bestsource-system-libp2p.patch
+# remove after switching to ffmpeg 5.x, bump BR then
+Patch1:		bestsource-ffmpeg4.patch
+URL:		https://github.com/vapoursynth/bestsource
+# libavcodec >= 58.18.0, libavformat >= 58.12.0
+BuildRequires:	ffmpeg-devel >= 4.1
+BuildRequires:	jansson-devel >= 2.7
+BuildRequires:	libp2p-devel
+BuildRequires:	libstdc++-devel
+BuildRequires:	meson >= 0.48.0
+BuildRequires:	ninja >= 1.5
+BuildRequires:	pkgconfig
+BuildRequires:	vapoursynth-devel >= 55
+Requires:	ffmpeg-libs >= 4.1
+Requires:	jansson >= 2.7
+Requires:	vapoursynth >= 55
+Obsoletes:	vapoursynth-plugin-bestaudiosource < 2
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%description
+Vapoursynth plugin to access audio and video via FFmpeg library.
+
+%description -l pl.UTF-8
+Wtyczka Vapoursynth pozwalająca na dostęp do dźwięku i obrazu poprzez
+bibliotekę FFmpeg.
+
+%prep
+%setup -q -n bestsource-%{gitref}
+%patch0 -p1
+%patch1 -p1
+
+%build
+%meson build
+
+%ninja_build -C build
+
+%install
+rm -rf $RPM_BUILD_ROOT
+
+%ninja_install -C build
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc LICENSE README.md
+%attr(755,root,root) %{_libdir}/vapoursynth/libbestsource.so
diff --git a/bestsource-ffmpeg4.patch b/bestsource-ffmpeg4.patch
new file mode 100644
index 0000000..c39f330
--- /dev/null
+++ b/bestsource-ffmpeg4.patch
@@ -0,0 +1,33 @@
+--- bestsource-d917b26767c41851c50ccad29d8d126e139a7822/src/audiosource.cpp.orig	2023-04-19 19:03:30.000000000 +0200
++++ bestsource-d917b26767c41851c50ccad29d8d126e139a7822/src/audiosource.cpp	2023-04-25 19:00:34.719483566 +0200
+@@ -153,7 +153,7 @@ LWAudioDecoder::LWAudioDecoder(const std
+         AP.BytesPerSample = av_get_bytes_per_sample(static_cast<AVSampleFormat>(DecodeFrame->format));
+         AP.BitsPerSample = CodecContext->bits_per_raw_sample ? (CodecContext->bits_per_raw_sample) : (AP.BytesPerSample * 8); // assume all bits are relevant if not specified
+         AP.SampleRate = DecodeFrame->sample_rate;
+-        AP.Channels = DecodeFrame->ch_layout.nb_channels;
++        AP.Channels = DecodeFrame->channels;
+         AP.ChannelLayout = DecodeFrame->channel_layout ? DecodeFrame->channel_layout : av_get_default_channel_layout(DecodeFrame->channels);  
+         AP.NumSamples = (FormatContext->duration * DecodeFrame->sample_rate) / AV_TIME_BASE - FormatContext->streams[TrackNumber]->codecpar->initial_padding;
+         if (DecodeFrame->pts != AV_NOPTS_VALUE)
+@@ -256,16 +256,16 @@ BestAudioSource::CacheBlock::CacheBlock(
+     } else {
+         int BytesPerSample = av_get_bytes_per_sample(static_cast<AVSampleFormat>(Frame->format));
+         LineSize = Length * BytesPerSample;
+-        Storage.resize(LineSize * Frame->ch_layout.nb_channels);
++        Storage.resize(LineSize * Frame->channels);
+ 
+         if (BytesPerSample == 1)
+-            UnpackChannels<uint8_t>(Frame->data[0], Storage.data(), Length, Frame->ch_layout.nb_channels);
++            UnpackChannels<uint8_t>(Frame->data[0], Storage.data(), Length, Frame->channels);
+         else if (BytesPerSample == 2)
+-            UnpackChannels<uint16_t>(Frame->data[0], Storage.data(), Length, Frame->ch_layout.nb_channels);
++            UnpackChannels<uint16_t>(Frame->data[0], Storage.data(), Length, Frame->channels);
+         else if (BytesPerSample == 4)
+-            UnpackChannels<uint32_t>(Frame->data[0], Storage.data(), Length, Frame->ch_layout.nb_channels);
++            UnpackChannels<uint32_t>(Frame->data[0], Storage.data(), Length, Frame->channels);
+         else if (BytesPerSample == 8)
+-            UnpackChannels<uint64_t>(Frame->data[0], Storage.data(), Length, Frame->ch_layout.nb_channels);
++            UnpackChannels<uint64_t>(Frame->data[0], Storage.data(), Length, Frame->channels);
+         av_frame_free(&Frame);
+     }
+ }
diff --git a/bestsource-system-libp2p.patch b/bestsource-system-libp2p.patch
new file mode 100644
index 0000000..8994e59
--- /dev/null
+++ b/bestsource-system-libp2p.patch
@@ -0,0 +1,63 @@
+--- bestsource-d917b26767c41851c50ccad29d8d126e139a7822/meson.build.orig	2023-04-19 19:03:30.000000000 +0200
++++ bestsource-d917b26767c41851c50ccad29d8d126e139a7822/meson.build	2023-04-25 17:23:34.687680051 +0200
+@@ -3,8 +3,6 @@ project('BestSource', 'cpp',
+     meson_version: '>=0.48.0'
+ )
+ 
+-libs = []
+-
+ sources = [
+     'src/audiosource.cpp',
+     'src/videosource.cpp',
+@@ -19,26 +17,7 @@ if host_machine.cpu_family().startswith(
+     p2p_args += ['-DP2P_SIMD']
+ endif
+ 
+-libs += static_library('p2p_main',
+-    [
+-        'libp2p/p2p_api.cpp',
+-        'libp2p/v210.cpp',
+-        'libp2p/simd/cpuinfo_x86.cpp',
+-        'libp2p/simd/p2p_simd.cpp'
+-    ],
+-    include_directories: ['libp2p', 'libp2p/simd'],
+-    cpp_args: p2p_args
+-)
+-
+-if host_machine.cpu_family().startswith('x86')
+-    p2p_args += ['-msse4.1']
+-
+-    libs += static_library('p2p_sse41',
+-        'libp2p/simd/p2p_sse41.cpp',
+-        include_directories: ['libp2p', 'libp2p/simd'],
+-        cpp_args: p2p_args
+-    )
+-endif
++p2p_dep = meson.get_compiler('cpp').find_library('p2p')
+ 
+ vapoursynth_dep = dependency('vapoursynth', version: '>=R55').partial_dependency(compile_args: true, includes: true)
+ jansson_dep = dependency('jansson', version: '>= 2.7', required: true)
+@@ -48,11 +27,11 @@ deps = [
+     jansson_dep,
+     dependency('libavcodec', version: '>=58.18.0'),
+     dependency('libavformat', version: '>=58.12.0'),
++    p2p_dep,
+ ]
+ 
+ shared_module('bestsource', sources,
+     dependencies: deps,
+-    link_with: libs,
+     install: true,
+     install_dir: join_paths(vapoursynth_dep.get_pkgconfig_variable('libdir'), 'vapoursynth'),
+     gnu_symbol_visibility: 'hidden'
+--- bestsource-d917b26767c41851c50ccad29d8d126e139a7822/src/videosource.cpp.orig	2023-04-19 19:03:30.000000000 +0200
++++ bestsource-d917b26767c41851c50ccad29d8d126e139a7822/src/videosource.cpp	2023-04-25 19:05:31.834540622 +0200
+@@ -24,7 +24,7 @@
+ #include <thread>
+ #include <cassert>
+ 
+-#include "../libp2p/p2p_api.h"
++#include <p2p_api.h>
+ 
+ extern "C" {
+ #include <libavformat/avformat.h>
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/vapoursynth-plugin-bestsource.git/commitdiff/83ccb7b0e2b529af11e786cc95882ec1d4b43061



More information about the pld-cvs-commit mailing list