%bcond_without extras
%bcond_without nasm

Name:           gstreamer1-plugins-good
Version:        1.20.3
Release:        2
Summary:        GStreamer plugins with good code and licensing
License:        LGPLv2+
URL:            http://gstreamer.freedesktop.org/
Source0:        http://gstreamer.freedesktop.org/src/gst-plugins-good/gst-plugins-good-%{version}.tar.xz
Source1:        gstreamer-good.appdata.xml
#https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4894.patch
Patch0:         CVE-2023-37327.patch

BuildRequires:  meson >= 0.48.0
BuildRequires:  gcc
BuildRequires:  gcc-c++
BuildRequires:  gstreamer1-devel >= %{version}
BuildRequires:  gstreamer1-plugins-base-devel >= %{version}
BuildRequires:  cairo-devel >= 1.10.0
BuildRequires:  cairo-gobject-devel >= 1.10.0
BuildRequires:  flac-devel >= 1.1.4
BuildRequires:  gdk-pixbuf2-devel
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel >= 1.2.0
BuildRequires:  libshout-devel
BuildRequires:  libsoup-devel
BuildRequires:  libX11-devel
BuildRequires:  libXext-devel
BuildRequires:  libXdamage-devel
BuildRequires:  libXfixes-devel
BuildRequires:  orc-devel
BuildRequires:  pulseaudio-libs-devel
BuildRequires:  speex-devel
BuildRequires:  taglib-devel
BuildRequires:  wavpack-devel
BuildRequires:  libv4l-devel
BuildRequires:  libvpx-devel >= 1.1.0
BuildRequires:  gtk3-devel >= 3.4
BuildRequires:  mesa-libGL-devel
BuildRequires:  mesa-libGLES-devel
BuildRequires:  mesa-libGLU-devel
BuildRequires:  mesa-libEGL-devel
BuildRequires:  lame-devel
BuildRequires:  mpg123-devel
BuildRequires:  twolame-devel
%if %{with nasm}
BuildRequires:  nasm
%endif
%if %{with extras}
BuildRequires:  jack-audio-connection-kit-devel
BuildRequires:  libdv-devel
BuildRequires:  libraw1394-devel libavc1394-devel
BuildRequires:  libiec61883-devel
%endif
BuildRequires:  libgudev-devel

Provides:       gstreamer1-plugins-mpg123 = %{version}-%{release}
Obsoletes:      gstreamer1-plugins-mpg123 < %{version}-%{release}
Obsoletes:      gstreamer1-plugins-good-help < 1.20.3

%description
GStreamer is a streaming media framework, based on graphs of filters which
operate on media data. Applications using this library can do anything
from real-time sound processing to playing videos, and just about anything
else media-related.  Its plugin-based architecture means that new data
types or processing capabilities can be added simply by installing new
plugins.

GStreamer Good Plugins is a collection of well-supported plugins of
good quality and under the LGPL license.

%package       	gtk
Summary:        gtk plugin for gstreamer1-plugins-good
Requires:       %{name} = %{version}-%{release}
Provides:       gstreamer1-plugins-bad-free-gtk = %{version}-%{release}
Obsoletes:      gstreamer1-plugins-bad-free-gtk < %{version}-%{release}

%description    gtk
GStreamer is a streaming media framework, based on graphs of elements which
operate on media data.

GStreamer Good Plugins is a collection of well-supported plugins of
good quality and under the LGPL license.

%package        qt
Summary:        GStreamer "good" plugins qt qml plugin
Requires:       %{name}%{?_isa} = %{version}-%{release}
 
BuildRequires:  pkgconfig(Qt5Gui)
BuildRequires:  pkgconfig(Qt5Qml)
BuildRequires:  pkgconfig(Qt5Quick)
BuildRequires:  pkgconfig(Qt5X11Extras)
BuildRequires:  pkgconfig(Qt5WaylandClient)
 
Supplements:    (gstreamer1-plugins-good and qt5-qtdeclarative)
 
%description    qt
GStreamer is a streaming media framework, based on graphs of elements which
operate on media data.
 
GStreamer Good Plugins is a collection of well-supported plugins of
good quality and under the LGPL license.
 
This package (%{name}-qt) contains the qtsink output plugin.

%if %{with extras}
%package        extras
Summary:        Extra GStreamer plugins with good code and licensing
Requires:       %{name}%{?_isa} = %{version}-%{release}
 
 
%description    extras
GStreamer is a streaming media framework, based on graphs of filters
which operate on media data.
 
GStreamer Good Plugins is a collection of well-supported plugins of
good quality and under the LGPL license.
 
%{name}-extras contains extra "good" plugins
which are not used very much and require additional libraries
to be installed.
%endif

%prep
%autosetup -n gst-plugins-good-%{version} -p1

%build
%meson \
  -D doc=disabled \
  -D asm=%{?with_nasm:enabled}%{!?with_nasm:disabled} \
  -D orc=enabled \
  -D monoscope=disabled \
  -D aalib=disabled \
  -D libcaca=disabled \
  -D rpicamsrc=disabled \
  -D jack=%{?with_extras:enabled}%{!?with_extras:disabled} \
  -D dv=%{?with_extras:enabled}%{!?with_extras:disabled} \
  -D dv1394=%{?with_extras:enabled}%{!?with_extras:disabled} \

%meson_build

%install
%meson_install 
%delete_la_and_a
install -p -D %{SOURCE1} %{buildroot}%{_metainfodir}/gstreamer-good.appdata.xml

%files
%defattr(-,root,root)
%doc AUTHORS NEWS README.md README.static-linking RELEASE REQUIREMENTS
%license COPYING
%{_libdir}/gstreamer-1.0/*.so
%{_datadir}/locale/*
%dir %{_datadir}/gstreamer-1.0/presets 
%{_datadir}/gstreamer-1.0/presets/*.prs
%{_metainfodir}/gstreamer-good.appdata.xml
%exclude %{_libdir}/gstreamer-1.0/libgstgtk.so
%exclude %{_libdir}/gstreamer-1.0/libgstqmlgl.so
%exclude %{_libdir}/gstreamer-1.0/libgstjack.so
%exclude %{_libdir}/gstreamer-1.0/libgstdv.so
%exclude %{_libdir}/gstreamer-1.0/libgst1394.so

%files gtk
%defattr(-,root,root)
%{_libdir}/gstreamer-1.0/libgstgtk.so

%files qt
%{_libdir}/gstreamer-1.0/libgstqmlgl.so

%if %{with extras}
%files extras
# Plugins with external dependencies
%{_libdir}/gstreamer-1.0/libgstjack.so
%{_libdir}/gstreamer-1.0/libgstdv.so
%{_libdir}/gstreamer-1.0/libgst1394.so
%endif

%changelog
* Fri Dec 15 2023 wangkai <13474090681@163.com> - 1.20.3-2
- Fix CVE-2023-37327

* Wed Nov 01 2023 wangkai <13474090681@163.com> - 1.20.3-1
- Update to 1.20.3

* Mon Jun 27 2022 yaoxin <yaoxin30@h-partners.com> - 1.16.2-5
- Fix CVE-2022-2122 CVE-2022-1920-to-CVE-2022-1925

* Fri Sep 10 2021 gaihuiying <gaihuiying1@huawei.com> - 1.16.2-4
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:remove rpath of libgstshout2.so

* Mon Aug 16 2021 yanglu <yanglu72@huawei.com> - 1.16.2-3
- Type:cves
- ID:CVE-2021-3497 CVE-2021-3498
- SUG:NA
- DESC:fix CVE-2021-3497 CVE-2021-3498

* Thu Oct 29 2020 gaihuiying <gaihuiying1@huawei.com> - 1.16.2-2
- Type:requirement
- ID:NA
- SUG:NA
- DESC:remove python2

* Thu Aug 06 2020 yuboyun <yuboyun@huawei.com> - 1.16.2-1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:update to 1.16.2

* Fri Mar 6 2020 openEuler Buildteam <buildteam@openeuler.org> - 1.14.4-3
- Package init
