File: enable-h264-streaming.sh

package info (click to toggle)
nvidia-cuda-toolkit 12.4.1-3
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 18,505,836 kB
  • sloc: ansic: 203,477; cpp: 64,769; python: 34,699; javascript: 22,006; xml: 13,410; makefile: 3,085; sh: 2,343; perl: 352
file content (73 lines) | stat: -rwxr-xr-x 2,289 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#!/bin/bash -x

# SPDX-FileCopyrightText: Copyright (c) 2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

SCRIPT=$(realpath "$0")
HERE=$(dirname "$SCRIPT")

GSTREAMER_INSTALL_PREFIX=/usr
GSTREAMER_TEMP_INSTALL_PREFIX="$OPENH264_DIR_NAME/usr"

mkdir -p "$OPENH264_DIR_NAME"
cd "${OPENH264_DIR_NAME}"
/bin/bash -x "${HERE}/openh264-installer/download-binary-openh264.sh"
/bin/bash -x "${HERE}/openh264-installer/install-binary-openh264-if-downloaded.sh"
mkdir -p "${GSTREAMER_TEMP_INSTALL_PREFIX}"

if [[ -z `find "${GSTREAMER_TEMP_INSTALL_PREFIX}" -name "libgstopenh264.so"` ]]; then
	# install build dependencies
	apt update && apt-get install -y --no-install-recommends \
		autoconf \
		automake \
		libtool \
		build-essential \
		gettext \
		libssl-dev \
		cmake \
		meson \
		ninja-build \
		git \
		wget \
		g++ \
		flex \
		bison \
		xz-utils \
		libglib2.0-dev

	wget https://gstreamer.freedesktop.org/src/gst-plugins-bad/gst-plugins-bad-${GSTREAMER_VERSION}.tar.xz \
		&& tar xvfJ gst-plugins-bad-${GSTREAMER_VERSION}.tar.xz > /dev/null \
		&& cd gst-plugins-bad-${GSTREAMER_VERSION}

	# find all the possible feature
	all_gst_features=$(sed -rn \
			"/^/,/^#.*$/s;^option\('([^']*)'.*type *\: *'feature'.*;\1;p" \
			"./meson_options.txt"
	)

	# disable all features except openh264
	gst_features_conf=()
	for feature in ${all_gst_features} ; do
		if [ ${feature} = "openh264" ] ; then
			gst_features_conf+=( -D${feature}=enabled )
		else
			gst_features_conf+=( -D${feature}=disabled )
		fi
	done

	meson --prefix=${GSTREAMER_TEMP_INSTALL_PREFIX} "${gst_features_conf[@]}" build && ninja -C build && ninja -C build install
fi

/bin/bash -x "${HERE}/enable-h264-streaming-if-installed.sh"