Add gstreamer1-plugin-openh264 subpackage with the openh264 plugin

Previously, the whole contents of this package used to be part of the
openh264 srpm, which was used to build both the openh264 library and the
gstreamer openh264 plugin. All of which was built in koji, but hosted by
Cisco on their servers.

Now with the introduction of the "noopenh264" stub package in Fedora,
we'll be able to build the gstreamer plugin as part of
gstreamer1-plugins-bad-free again. The stub is used during build
time, and gets replaced by the actual openh264 library package that's
downloaded directly from Cisco on actual user systems.

The binary package name used to be gstreamer1-plugin-openh264 and this
commit keeps the exact same package name, so no obsoletes are needed.
This commit is contained in:
Kalev Lember 2024-02-08 16:35:55 +01:00
parent 1464017d14
commit 5b10adaeb2
4 changed files with 257 additions and 3 deletions

View File

@ -81,6 +81,7 @@ netsim
nsf
nuvdemux
onvif
openh264
patchdetect
pcapparse
pnm

View File

@ -11,7 +11,7 @@
Name: gstreamer1-plugins-bad-free
Version: 1.22.9
Release: 2%{?dist}
Release: 3%{?dist}
Summary: GStreamer streaming media framework "bad" plugins
License: LGPLv2+ and LGPLv2
@ -28,6 +28,11 @@ URL: http://gstreamer.freedesktop.org/
Source0: gst-plugins-bad-free-%{version}.tar.xz
Source1: gst-p-bad-cleanup.sh
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5622
Patch: openh264-add-license-file.patch
# https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5780
Patch: openh264-drop-runtime-version-checks.patch
BuildRequires: meson >= 0.48.0
BuildRequires: gcc-c++
BuildRequires: gstreamer1-devel >= %{version}
@ -113,6 +118,7 @@ BuildRequires: openal-soft-devel
BuildRequires: opencv-devel
%endif
BuildRequires: openjpeg2-devel
BuildRequires: pkgconfig(openh264)
BuildRequires: pkgconfig(spandsp) >= 0.0.6
## Plugins not ported
#BuildRequires: SDL-devel
@ -234,6 +240,19 @@ This package (%{name}-opencv) contains the OpenCV plugins.
%endif
%package -n gstreamer1-plugin-openh264
Summary: GStreamer OpenH264 plugin
License: LGPL-2.0-or-later AND BSD-2-Clause
# Prefer actual openh264 library over the noopenh264 stub
Suggests: openh264%{_isa}
%description -n gstreamer1-plugin-openh264
GStreamer is a streaming media framework, based on graphs of elements which
operate on media data.
This package contains the OpenH264 plugin.
%package libs
Summary: Runtime libraries for the GStreamer media framework "bad" plug-ins
@ -312,7 +331,7 @@ aren't tested well enough, or the code is not of good enough quality.
%{!?with_extras:-D ldac=disabled } \
%endif
%{!?with_extras:-D qroverlay=disabled } \
-D openh264=disabled -D gs=disabled -D isac=disabled \
-D gs=disabled -D isac=disabled \
-D onnx=disabled -D openaptx=disabled -Dgpl=enabled \
-D amfcodec=disabled -D directshow=disabled -D qsv=disabled
@ -377,6 +396,37 @@ cat > $RPM_BUILD_ROOT%{_metainfodir}/gstreamer-bad-free.appdata.xml <<EOF
</component>
EOF
cat > $RPM_BUILD_ROOT%{_metainfodir}/gstreamer-openh264.appdata.xml <<EOF
<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2015 Kalev Lember <klember@redhat.com> -->
<component type="codec">
<id>gstreamer-openh264</id>
<metadata_license>CC0-1.0</metadata_license>
<name>GStreamer Multimedia Codecs - H.264</name>
<summary>Multimedia playback for H.264</summary>
<description>
<p>
This addon includes a codec for H.264 playback and encoding.
</p>
<p>
These codecs can be used to encode and decode media files where the
format is not patent encumbered.
</p>
<p>
A codec decodes audio and video for playback or editing and is also
used for transmission or storage.
Different codecs are used in video-conferencing, streaming media and
video editing applications.
</p>
</description>
<url type="homepage">http://gstreamer.freedesktop.org/</url>
<url type="bugtracker">https://bugzilla.gnome.org/enter_bug.cgi?product=GStreamer</url>
<url type="help">http://gstreamer.freedesktop.org/documentation/</url>
<url type="donation">http://www.gnome.org/friends/</url>
<update_contact><!-- upstream-contact_at_email.com --></update_contact>
</component>
EOF
%find_lang gst-plugins-bad-%{majorminor}
# unpackaged files
@ -388,7 +438,7 @@ rm $RPM_BUILD_ROOT%{_bindir}/playout
%license COPYING
%doc AUTHORS NEWS README.md README.static-linking RELEASE REQUIREMENTS
%{_metainfodir}/*.appdata.xml
%{_metainfodir}/gstreamer-bad-free.appdata.xml
%{_bindir}/gst-transcoder-%{majorminor}
# presets
@ -582,6 +632,12 @@ rm $RPM_BUILD_ROOT%{_bindir}/playout
%{_libdir}/libgstopencv-%{majorminor}.so.0{,.*}
%endif
%files -n gstreamer1-plugin-openh264
%license COPYING
%license ext/openh264/LICENSE
%{_metainfodir}/gstreamer-openh264.appdata.xml
%{_libdir}/gstreamer-1.0/libgstopenh264.so
%files libs
%license COPYING
%{_libdir}/libgstadaptivedemux-%{majorminor}.so.0{,.*}
@ -711,6 +767,9 @@ rm $RPM_BUILD_ROOT%{_bindir}/playout
%changelog
* Thu Feb 08 2024 Kalev Lember <klember@redhat.com> - 1.22.9-3
- Add gstreamer1-plugin-openh264 subpackage with the openh264 plugin
* Tue Feb 06 2024 Yaakov Selkowitz <yselkowi@redhat.com> - 1.22.9-2
- Rebuilt for opencv-4.9.0

View File

@ -0,0 +1,45 @@
From b13e925daa574fb07aac0271f2b51c25ecb9d483 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 8 Nov 2023 14:41:14 +0100
Subject: [PATCH 1/1] openh264: Add LICENSE file
The openh264 plugin is BSD-licensed, different from the rest of the
gst-plugins-bad. This commit splits the license text out in its own file
to make it easier for binary distributions to distribute the license
text.
---
.../gst-plugins-bad/ext/openh264/LICENSE | 22 +++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 subprojects/gst-plugins-bad/ext/openh264/LICENSE
diff --git a/subprojects/gst-plugins-bad/ext/openh264/LICENSE b/subprojects/gst-plugins-bad/ext/openh264/LICENSE
new file mode 100644
index 00000000000..e57601b4fb6
--- /dev/null
+++ b/subprojects/gst-plugins-bad/ext/openh264/LICENSE
@@ -0,0 +1,22 @@
+Copyright (c) 2014, Ericsson AB. All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice, this
+list of conditions and the following disclaimer in the documentation and/or other
+materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+OF SUCH DAMAGE.
--
GitLab

View File

@ -0,0 +1,149 @@
From 1dadccd48c97a4b7c96ae0307c2263107e7f1876 Mon Sep 17 00:00:00 2001
From: Kalev Lember <klember@redhat.com>
Date: Wed, 6 Dec 2023 14:58:38 +0100
Subject: [PATCH] openh264: Drop runtime version checks
With the way the runtime checks are currently set up, every single
openh264 release, no matter how minor, is considered an ABI break and
requires gst-plugins-bad recompilation. This is unnecessarily strict
because it doesn't allow downstream distributions to ship any openh264
bug fix version updates without breaking gstreamer's openh264 support.
Years ago, at the time when gstreamer's openh264 support was merged,
openh264 releases were done without a versioned soname (the library was
just libopenh264.so, unversioned). Since then, starting with version
1.3.0, openh264 has started using versioned sonames and the intent has
been to bump the soname every time there's a new release with an ABI
change.
This patch drops the strict version check. meson.build already has a
minimum requirement on openh264 version 1.3.0 where soname versioning
was added, which should be good enough to ensure that the library is
using soname versioning.
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5780>
---
.../ext/openh264/gstopenh264dec.cpp | 7 +--
.../ext/openh264/gstopenh264element.c | 48 -------------------
.../ext/openh264/gstopenh264elements.h | 2 -
.../ext/openh264/gstopenh264enc.cpp | 7 +--
.../gst-plugins-bad/ext/openh264/meson.build | 1 -
5 files changed, 4 insertions(+), 61 deletions(-)
delete mode 100644 subprojects/gst-plugins-bad/ext/openh264/gstopenh264element.c
diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp
index 77f2b8fe348..f3302567c7b 100644
--- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp
+++ b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264dec.cpp
@@ -459,10 +459,7 @@ openh264dec_element_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_openh264dec_debug_category, "openh264dec", 0,
"debug category for openh264dec element");
- if (openh264_element_init (plugin))
- return gst_element_register (plugin, "openh264dec", GST_RANK_MARGINAL,
- GST_TYPE_OPENH264DEC);
- GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
- return FALSE;
+ return gst_element_register (plugin, "openh264dec", GST_RANK_MARGINAL,
+ GST_TYPE_OPENH264DEC);
}
diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264element.c b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264element.c
deleted file mode 100644
index 3c5c378c81e..00000000000
--- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264element.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * Copyright (c) 2014, Ericsson AB. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without modification,
- * are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright notice, this
- * list of conditions and the following disclaimer in the documentation and/or other
- * materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
- * OF SUCH DAMAGE.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gst/gst.h>
-#include <wels/codec_api.h>
-#include <wels/codec_ver.h>
-#include <string.h>
-#include "gstopenh264elements.h"
-
-
-gboolean
-openh264_element_init (GstPlugin * plugin)
-{
- OpenH264Version libver;
- /* g_stCodecVersion is the version detected at build time as defined in the
- * headers and WelsGetCodecVersion() is the version detected at runtime.
- * This is a safeguard to avoid crashes since OpenH264 has been changing
- * ABI without changing the SONAME.
- */
- libver = WelsGetCodecVersion ();
- return (memcmp (&libver, &g_stCodecVersion, sizeof (libver)) == 0);
-}
diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264elements.h b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264elements.h
index 572f6a8e078..5c9582941ee 100644
--- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264elements.h
+++ b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264elements.h
@@ -27,8 +27,6 @@
G_BEGIN_DECLS
-gboolean openh264_element_init (GstPlugin * plugin);
-
GST_ELEMENT_REGISTER_DECLARE (openh264dec);
GST_ELEMENT_REGISTER_DECLARE (openh264enc);
diff --git a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp
index 6b54b1584f8..05c126cfc64 100644
--- a/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp
+++ b/subprojects/gst-plugins-bad/ext/openh264/gstopenh264enc.cpp
@@ -1066,10 +1066,7 @@ openh264enc_element_init (GstPlugin * plugin)
{
GST_DEBUG_CATEGORY_INIT (gst_openh264enc_debug_category, "openh264enc", 0,
"debug category for openh264enc element");
- if (openh264_element_init (plugin))
- return gst_element_register (plugin, "openh264enc", GST_RANK_MARGINAL,
- GST_TYPE_OPENH264ENC);
- GST_ERROR ("Incorrect library version loaded, expecting %s", g_strCodecVer);
- return FALSE;
+ return gst_element_register (plugin, "openh264enc", GST_RANK_MARGINAL,
+ GST_TYPE_OPENH264ENC);
}
diff --git a/subprojects/gst-plugins-bad/ext/openh264/meson.build b/subprojects/gst-plugins-bad/ext/openh264/meson.build
index 1f0a198b05e..c6f247e1cdd 100644
--- a/subprojects/gst-plugins-bad/ext/openh264/meson.build
+++ b/subprojects/gst-plugins-bad/ext/openh264/meson.build
@@ -1,7 +1,6 @@
openh264_sources = [
'gstopenh264dec.cpp',
'gstopenh264enc.cpp',
- 'gstopenh264element.c',
'gstopenh264plugin.c',
]
--
GitLab