mirror of
https://github.com/OpenMANET/morse-feed.git
synced 2025-12-10 03:43:06 -06:00
aws-kvs: add the aws-kvs package.
The AWS KVS SDK provides functionality to easily stream video from connected devices to AWS for processing, including ML, playback, and analytics. The Morse Micro package adds procd support to manage stream configuration and triggering the aws stream.
This commit is contained in:
parent
802c5c8afe
commit
5ae4fe7400
5
.gitattributes
vendored
5
.gitattributes
vendored
@ -48,3 +48,8 @@
|
|||||||
*.7z binary
|
*.7z binary
|
||||||
*.ttf binary
|
*.ttf binary
|
||||||
*.pyc binary
|
*.pyc binary
|
||||||
|
|
||||||
|
# aws-kvs files unfortunately have CRs in them, which means the patch
|
||||||
|
# files mix LF and CRLF.
|
||||||
|
multimedia/aws-kvs/patches/*.patch -text
|
||||||
|
multimedia/aws-kvs/files/*.patch -text
|
||||||
|
|||||||
63
multimedia/aws-kvs/Makefile
Normal file
63
multimedia/aws-kvs/Makefile
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
#
|
||||||
|
# Copyright 2023 Morse Micro
|
||||||
|
#
|
||||||
|
# This is free software, licensed under the Apache License, Version 2.0.
|
||||||
|
#
|
||||||
|
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=aws-kvs
|
||||||
|
PKG_VERSION:=3.4.1
|
||||||
|
|
||||||
|
ARCHIVE_NAME:=amazon-kinesis-video-streams-producer-sdk-cpp
|
||||||
|
PKG_SOURCE:= $(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||||
|
PKG_SOURCE_URL:=https://codeload.github.com/awslabs/$(ARCHIVE_NAME)/tar.gz/v$(PKG_VERSION)?
|
||||||
|
PKG_HASH:=ac85de2cd61326150471bdce68176c2c8e93cff979633bc6b99f6293de8dd5d4
|
||||||
|
PKG_BUILD_DIR:=$(BUILD_DIR)/$(ARCHIVE_NAME)-$(PKG_VERSION)
|
||||||
|
|
||||||
|
PKG_USE_NINJA:=1
|
||||||
|
PKG_MAINTAINER:=Morse Micro <info@morsemicro.com>
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/cmake.mk
|
||||||
|
include $(INCLUDE_DIR)/nls.mk
|
||||||
|
|
||||||
|
|
||||||
|
define Package/aws-kvs
|
||||||
|
SECTION:=multimedia
|
||||||
|
CATEGORY:=Multimedia
|
||||||
|
SUBMENU:=Streaming
|
||||||
|
URL:=https://github.com/awslabs/amazon-kinesis-video-streams-producer-sdk-cpp.git
|
||||||
|
TITLE:=Amazon Kinesis Video Streams Producer
|
||||||
|
DEPENDS:= +libopenssl +libcurl +log4cplus +libgstreamer1 +libgst1app +gst1-mod-videoparsersbad +gstreamer1-utils +gst1-mod-rtpmanager +gst1-mod-udp +gstreamer1-plugins-base +@PACKAGE_gstreamer1-plugins-good +gst1-mod-rtsp +gst1-mod-rtp $(INTL_DEPENDS)
|
||||||
|
endef
|
||||||
|
|
||||||
|
|
||||||
|
define Package/aws-kvs/description
|
||||||
|
Amazon Kinesis Video Streams provides a service that publishes a video stream to AWS Kinesis Video Streams using the gstreamer plugins
|
||||||
|
endef
|
||||||
|
|
||||||
|
CMAKE_OPTIONS += -DBUILD_dumpcap=ON
|
||||||
|
CMAKE_OPTIONS += -DBUILD_DEPENDENCIES=OFF
|
||||||
|
CMAKE_OPTIONS += -DCOMPILER_WARNINGS=ON
|
||||||
|
CMAKE_OPTIONS += -DCONSTRAINED_DEVICE=ON
|
||||||
|
CMAKE_OPTIONS += -DBUILD_GSTREAMER_PLUGIN=ON
|
||||||
|
|
||||||
|
define Build/Prepare
|
||||||
|
$(Build/Prepare/Default)
|
||||||
|
$(CP) files/*.patch $(PKG_BUILD_DIR)/
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/aws-kvs/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/etc/init.d/aws_kvs $(1)/etc/init.d/
|
||||||
|
$(INSTALL_DIR) $(1)/etc/config
|
||||||
|
$(INSTALL_BIN) ./files/etc/config/aws_kvs $(1)/etc/config/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/dependency/libkvscproducer/kvscproducer-src/libcproducer.so $(1)/usr/lib/
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libKinesisVideoProducer.so $(1)/usr/lib/
|
||||||
|
$(INSTALL_DIR) $(1)/usr/lib/gstreamer-1.0
|
||||||
|
$(INSTALL_DATA) $(PKG_BUILD_DIR)/libgstkvssink.so $(1)/usr/lib/gstreamer-1.0/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,aws-kvs))
|
||||||
23
multimedia/aws-kvs/files/002-libcurl_setopts.patch
Normal file
23
multimedia/aws-kvs/files/002-libcurl_setopts.patch
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#File: 002-libcurl_setopts.patch
|
||||||
|
#Description: The provided patch addresses an issue stemming from the default libcurl setting, which attempts to resolve the AWS URL to IPv6. This resolution fails, resulting in a 'could not resolve host' error. The patch adjusts the curl option to IPv4, effectively resolving the host successfully.
|
||||||
|
|
||||||
|
--- a/dependency/libkvscproducer/kvscproducer-src/src/source/Common/Curl/CurlCall.c 2023-11-13 13:05:46.950163615 +1100
|
||||||
|
+++ b/dependency/libkvscproducer/kvscproducer-src/src/source/Common/Curl/CurlCall.c 2023-11-13 13:06:43.684309233 +1100
|
||||||
|
@@ -58,6 +58,7 @@
|
||||||
|
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, pHeaderList);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_URL, pRequestInfo->url);
|
||||||
|
+ curl_easy_setopt(curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSLCERTTYPE, getSslCertNameFromType(pRequestInfo->certType));
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSLCERT, pRequestInfo->sslCertPath);
|
||||||
|
curl_easy_setopt(curl, CURLOPT_SSLKEY, pRequestInfo->sslPrivateKeyPath);
|
||||||
|
--- a/dependency/libkvscproducer/kvscproducer-src/src/source/Response.c 2023-11-14 10:49:38.987263012 +1100
|
||||||
|
+++ b/dependency/libkvscproducer/kvscproducer-src/src/source/Response.c 2023-11-14 10:49:57.367256068 +1100
|
||||||
|
@@ -147,6 +147,7 @@
|
||||||
|
curl_easy_setopt(pCurl, CURLOPT_ERRORBUFFER, pCallInfo->errorBuffer);
|
||||||
|
|
||||||
|
curl_easy_setopt(pCurl, CURLOPT_URL, pRequestInfo->url);
|
||||||
|
+ curl_easy_setopt(pCurl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
|
||||||
|
curl_easy_setopt(pCurl, CURLOPT_NOSIGNAL, 1);
|
||||||
|
|
||||||
|
// Setting up limits for curl timeout
|
||||||
0
multimedia/aws-kvs/files/etc/config/aws_kvs
Normal file
0
multimedia/aws-kvs/files/etc/config/aws_kvs
Normal file
53
multimedia/aws-kvs/files/etc/init.d/aws_kvs
Executable file
53
multimedia/aws-kvs/files/etc/init.d/aws_kvs
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=90
|
||||||
|
STOP=01
|
||||||
|
USE_PROCD=1
|
||||||
|
SERVICE=aws_kvs
|
||||||
|
|
||||||
|
get_aws_kvs_credentials() {
|
||||||
|
local stream=$1
|
||||||
|
config_get access_key $stream access_key
|
||||||
|
config_get secret_key $stream secret_key
|
||||||
|
config_get region $stream region
|
||||||
|
config_get stream_name $stream stream_name
|
||||||
|
config_get storage_size $stream storage_size
|
||||||
|
config_get location $stream stream_url
|
||||||
|
|
||||||
|
if [ -z "$access_key" ] || [ -z "$secret_key" ] || [ -z "$region" ] || [ -z "$stream_name" ] || [ -z "$storage_size" ]; then
|
||||||
|
logger -t $SERVICE -p daemon.crit "One or more AWS Kinesis Video Streaming credentials are missing. Cannot start the service."
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
create_gst_instance() {
|
||||||
|
local stream=$1
|
||||||
|
config_get enable $stream enable
|
||||||
|
if [ "$enable" == "1" ]; then
|
||||||
|
procd_open_instance $stream
|
||||||
|
get_aws_kvs_credentials $stream
|
||||||
|
procd_set_param env GST_PLUGIN_PATH=/usr/lib/gstreamer-1.0
|
||||||
|
procd_set_param command gst-launch-1.0
|
||||||
|
procd_set_param stdout 1
|
||||||
|
procd_set_param stderr 1
|
||||||
|
procd_append_param command rtspsrc location="$location" short-header=TRUE ! rtph264depay ! h264parse ! kvssink
|
||||||
|
procd_append_param command stream-name="$stream_name"
|
||||||
|
procd_append_param command storage-size=$storage_size
|
||||||
|
procd_append_param command access-key=$access_key
|
||||||
|
procd_append_param command secret-key=$secret_key
|
||||||
|
procd_append_param command aws-region=$region
|
||||||
|
procd_close_instance
|
||||||
|
else
|
||||||
|
logger -t $SERVICE -p daemon.info "Stream $stream is disabled"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
start_service() {
|
||||||
|
#For each stream create a gst instance
|
||||||
|
config_load aws_kvs
|
||||||
|
config_foreach create_gst_instance kvs_stream
|
||||||
|
}
|
||||||
|
|
||||||
|
service_triggers() {
|
||||||
|
procd_add_reload_trigger aws_kvs
|
||||||
|
}
|
||||||
|
|
||||||
@ -0,0 +1,52 @@
|
|||||||
|
From 49515f24d12d1e47b4ed0a746395894cfc87d939 Mon Sep 17 00:00:00 2001
|
||||||
|
From: jdelapla <delaplan@amazon.com>
|
||||||
|
Date: Wed, 11 Oct 2023 11:26:43 -0700
|
||||||
|
Subject: [PATCH] Alpine stackoverflow fix (#1084)
|
||||||
|
|
||||||
|
* Update producer-c dependency to allow for Constrained device flag
|
||||||
|
---
|
||||||
|
CMake/Dependencies/libkvscproducer-CMakeLists.txt | 4 ++--
|
||||||
|
CMakeLists.txt | 1 +
|
||||||
|
README.md | 1 +
|
||||||
|
3 files changed, 4 insertions(+), 2 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/README.md b/README.md
|
||||||
|
index 473caa5..b0014d3 100644
|
||||||
|
--- a/README.md
|
||||||
|
+++ b/README.md
|
||||||
|
@@ -94,6 +94,7 @@ You can pass the following options to `cmake ..`.
|
||||||
|
* `-DUNDEFINED_BEHAVIOR_SANITIZER` Build with UndefinedBehaviorSanitizer
|
||||||
|
* `-DALIGNED_MEMORY_MODEL` Build for aligned memory model only devices. Default is OFF.
|
||||||
|
* `-DBUILD_LOG4CPLUS_HOST` Specify host-name for log4cplus for cross-compilation. Default is OFF.
|
||||||
|
+* `-DCONSTRAINED_DEVICE` Set the thread stack size to 0.5MB, needed for Alpine builds
|
||||||
|
|
||||||
|
#### To Include JNI
|
||||||
|
|
||||||
|
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||||
|
--- a/CMakeLists.txt 2023-11-10 14:53:25.865727556 +1100
|
||||||
|
+++ b/CMakeLists.txt 2023-11-10 15:00:51.255565535 +1100
|
||||||
|
@@ -16,7 +16,7 @@
|
||||||
|
option(BUILD_DEPENDENCIES "Whether or not to build depending libraries from source" ON)
|
||||||
|
option(BUILD_OPENSSL_PLATFORM "If buildng OpenSSL what is the target platform" OFF)
|
||||||
|
option(BUILD_LOG4CPLUS_HOST "Specify host-name for log4cplus for cross-compilation" OFF)
|
||||||
|
-
|
||||||
|
+option(CONSTRAINED_DEVICE "Set thread stack size to 0.5MB" OFF)
|
||||||
|
|
||||||
|
# Developer Flags
|
||||||
|
option(BUILD_TEST "Build the testing tree" OFF)
|
||||||
|
|
||||||
|
diff --git a/CMake/Dependencies/libkvscproducer-CMakeLists.txt b/CMake/Dependencies/libkvscproducer-CMakeLists.txt
|
||||||
|
--- a/CMake/Dependencies/libkvscproducer-CMakeLists.txt 2023-11-14 10:39:58.047477235 +1100
|
||||||
|
+++ b/CMake/Dependencies/libkvscproducer-CMakeLists.txt 2023-11-14 10:41:03.727453683 +1100
|
||||||
|
@@ -7,9 +7,10 @@
|
||||||
|
# clone repo only
|
||||||
|
ExternalProject_Add(libkvscproducer-download
|
||||||
|
GIT_REPOSITORY https://github.com/awslabs/amazon-kinesis-video-streams-producer-c.git
|
||||||
|
- GIT_TAG 178109a5dbfc5288ba5cf7fab1dc1afd5e2e182b
|
||||||
|
+ GIT_TAG 5e8a5cfa0e2e12304983abbe0a9fa023b574ef9a
|
||||||
|
SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-src"
|
||||||
|
BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/kvscproducer-build"
|
||||||
|
+ PATCH_COMMAND ${CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/../../ patch -p1 < ${CMAKE_CURRENT_SOURCE_DIR}/../../002-libcurl_setopts.patch
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
BUILD_COMMAND ""
|
||||||
|
INSTALL_COMMAND ""
|
||||||
Loading…
x
Reference in New Issue
Block a user