Skip to content

Commit

Permalink
source extracted from "Linux for Tegra"
Browse files Browse the repository at this point in the history
  • Loading branch information
bmegli committed Mar 7, 2023
1 parent 970b305 commit e3ebc13
Show file tree
Hide file tree
Showing 39 changed files with 28,144 additions and 0 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,16 @@
# gst-nvvideo4linux2

Nvidia nvvideo4linux GStreamear source (Jetson/Tegra)

## Origin

Extracted 07.03.2023 from
- https://developer.nvidia.com/embedded/jetson-linux
- SOURCES
- Driver Package (BSP) Sources
- public_sources.tbz2
- Linux_for_Tegra
- source
- public
- gst-nvvideo4linux2_src.tbz2

397 changes: 397 additions & 0 deletions gst-v4l2/LICENSE.gst-nvvideo4linux2

Large diffs are not rendered by default.

70 changes: 70 additions & 0 deletions gst-v4l2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
###############################################################################
#
# Copyright (c) 2018-2022, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#
###############################################################################

SO_NAME := libgstnvvideo4linux2.so

TARGET_DEVICE = $(shell gcc -dumpmachine | cut -f1 -d -)

NVDS_VERSION:=6.0

ifeq ($(TARGET_DEVICE),aarch64)
GST_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/gstreamer-1.0/
LIB_INSTALL_DIR?=/usr/lib/aarch64-linux-gnu/tegra/
CFLAGS:=
else
GST_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/gst-plugins/
LIB_INSTALL_DIR?=/opt/nvidia/deepstream/deepstream-$(NVDS_VERSION)/lib/
CFLAGS:= -DUSE_V4L2_TARGET_NV_CODECSDK=1 -DUSE_V4L2_TARGET_NV_X86=1 -DUSE_V4L2_GST_HEADER_VER_1_8
endif

LIBS:= -lnvbufsurface -lnvbufsurftransform -lgstnvdsseimeta
SRCS := $(wildcard *.c)

INCLUDES += -I./ -I../
INCLUDES += -I/usr/src/jetson_multimedia_api/include/

PKGS := gstreamer-1.0 \
gstreamer-base-1.0 \
gstreamer-video-1.0 \
gstreamer-allocators-1.0 \
glib-2.0 \
libv4l2

OBJS := $(SRCS:.c=.o)

CFLAGS += -fPIC \
-DEXPLICITLY_ADDED=1 \
-DGETTEXT_PACKAGE=1 \
-DHAVE_LIBV4L2=1 \
-DUSE_V4L2_TARGET_NV=1

CFLAGS += `pkg-config --cflags $(PKGS)`

LDFLAGS = -Wl,--no-undefined -L$(LIB_INSTALL_DIR) -Wl,-rpath,$(LIB_INSTALL_DIR)

LIBS += `pkg-config --libs $(PKGS)`

all: $(SO_NAME)

%.o: %.c
$(CC) -c $< $(CFLAGS) $(INCLUDES) -o $@

$(SO_NAME): $(OBJS)
$(CC) -shared -o $(SO_NAME) $(OBJS) $(LIBS) $(LDFLAGS)

.PHONY: install
install: $(SO_NAME)
cp -vp $(SO_NAME) $(GST_INSTALL_DIR)

.PHONY: clean
clean:
rm -rf $(OBJS) $(SO_NAME)
37 changes: 37 additions & 0 deletions gst-v4l2/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
###############################################################################
#
# Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
#
# NVIDIA Corporation and its licensors retain all intellectual property
# and proprietary rights in and to this software, related documentation
# and any modifications thereto. Any use, reproduction, disclosure or
# distribution of this software and related documentation without an express
# license agreement from NVIDIA Corporation is strictly prohibited.
#
###############################################################################

Steps to compile the "gst-nvvideo4linux2" sources natively:

1) Install gstreamer related packages on target using the command:

sudo apt-get install libgstreamer1.0-dev \
gstreamer1.0-plugins-base \
gstreamer1.0-plugins-good \
libgstreamer-plugins-base1.0-dev \
libv4l-dev \
libegl1-mesa-dev

2) Download and extract the package "gst-nvvideo4linux_src.tbz2" as follow:

tar -I lbzip2 -xvf gst-nvvideo4linux2_src.tbz2

3) Run the following commands to build and install "libgstnvvideo4linux2.so":
make
make install
or
DEST_DIR=<dir> make install

Note: For Jetson, "make install" will copy library "libgstnvvideo4linux2.so"
into "/usr/lib/aarch64-linux-gnu/gstreamer-1.0" directory. For x86 platforms,
make install will copy the library "libgstnvvideo4linux2.so" into
/opt/nvidia/deepstream/deepstream-4.0/lib/gst-plugins
58 changes: 58 additions & 0 deletions gst-v4l2/ext/types-compat.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (C) 2014 Collabora Ltd.
* Author: Nicolas Dufresne <[email protected]>
* Copyright (c) 2018-2019, NVIDIA CORPORATION. All rights reserved.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*
*/

#include <glib.h>

#ifndef __TYPES_COMPAT_H__
#define __TYPES_COMPAT_H__

/* From linux/types.h */
#ifndef __bitwise__
# ifdef __CHECKER__
# define __bitwise__ __attribute__((bitwise))
# else
# define __bitwise__
# endif
#endif

#ifndef __bitwise
# ifdef __CHECK_ENDIAN__
# define __bitwise __bitwise__
# else
# define __bitwise
# endif
#endif

#define __u64 guint64
#define __u32 guint32
#define __u16 guint16
#define __u8 guint8
#ifdef USE_V4L2_TARGET_NV
#define __s8 gint8
#endif
#define __s64 gint64
#define __s32 gint32
#define __le32 guint32 __bitwise

#define __user

#endif /* __TYPES_COMPAT_H__ */
107 changes: 107 additions & 0 deletions gst-v4l2/ext/v4l2-common.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
/*
* include/linux/v4l2-common.h
*
* Common V4L2 and V4L2 subdev definitions.
*
* Users are advised to #include this file either through videodev2.h
* (V4L2) or through v4l2-subdev.h (V4L2 subdev) rather than to refer
* to this file directly.
*
* Copyright (C) 2012 Nokia Corporation
* Contact: Sakari Ailus <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* Alternatively you can redistribute this file under the terms of the
* BSD license as stated below:
*
* 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.
* 3. The names of its contributors may not be used to endorse or promote
* products derived from this software without specific prior written
* permission.
*
* 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
* OWNER 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.
*
*/

#ifndef __V4L2_COMMON__
#define __V4L2_COMMON__

#include "ext/types-compat.h"

/*
*
* Selection interface definitions
*
*/

/* Current cropping area */
#define V4L2_SEL_TGT_CROP 0x0000
/* Default cropping area */
#define V4L2_SEL_TGT_CROP_DEFAULT 0x0001
/* Cropping bounds */
#define V4L2_SEL_TGT_CROP_BOUNDS 0x0002
/* Native frame size */
#define V4L2_SEL_TGT_NATIVE_SIZE 0x0003
/* Current composing area */
#define V4L2_SEL_TGT_COMPOSE 0x0100
/* Default composing area */
#define V4L2_SEL_TGT_COMPOSE_DEFAULT 0x0101
/* Composing bounds */
#define V4L2_SEL_TGT_COMPOSE_BOUNDS 0x0102
/* Current composing area plus all padding pixels */
#define V4L2_SEL_TGT_COMPOSE_PADDED 0x0103

/* Backward compatibility target definitions --- to be removed. */
#define V4L2_SEL_TGT_CROP_ACTIVE V4L2_SEL_TGT_CROP
#define V4L2_SEL_TGT_COMPOSE_ACTIVE V4L2_SEL_TGT_COMPOSE
#define V4L2_SUBDEV_SEL_TGT_CROP_ACTUAL V4L2_SEL_TGT_CROP
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_ACTUAL V4L2_SEL_TGT_COMPOSE
#define V4L2_SUBDEV_SEL_TGT_CROP_BOUNDS V4L2_SEL_TGT_CROP_BOUNDS
#define V4L2_SUBDEV_SEL_TGT_COMPOSE_BOUNDS V4L2_SEL_TGT_COMPOSE_BOUNDS

/* Selection flags */
#define V4L2_SEL_FLAG_GE (1 << 0)
#define V4L2_SEL_FLAG_LE (1 << 1)
#define V4L2_SEL_FLAG_KEEP_CONFIG (1 << 2)

/* Backward compatibility flag definitions --- to be removed. */
#define V4L2_SUBDEV_SEL_FLAG_SIZE_GE V4L2_SEL_FLAG_GE
#define V4L2_SUBDEV_SEL_FLAG_SIZE_LE V4L2_SEL_FLAG_LE
#define V4L2_SUBDEV_SEL_FLAG_KEEP_CONFIG V4L2_SEL_FLAG_KEEP_CONFIG

struct v4l2_edid {
__u32 pad;
__u32 start_block;
__u32 blocks;
__u32 reserved[5];
__u8 *edid;
};

#endif /* __V4L2_COMMON__ */
Loading

0 comments on commit e3ebc13

Please sign in to comment.