Skip to content

Commit

Permalink
All functions translated and created new json test files
Browse files Browse the repository at this point in the history
All functions translated and created new json test files
  • Loading branch information
LufeBisect committed Dec 16, 2024
1 parent df4640c commit bc1c7e8
Show file tree
Hide file tree
Showing 9 changed files with 307 additions and 13 deletions.
20 changes: 10 additions & 10 deletions cpp/demos/ossrf-nmos-api/config/nmos_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"label": "BISECT OSSRF Node",
"description": "BISECT OSSRF node",
"host_addresses": [
"192.168.1.85"
"192.168.88.92"
],
"interfaces": [
{
Expand All @@ -24,10 +24,10 @@
"locked": true
}
],
"registry_address": "192.168.1.85",
"registry_address": "192.168.88.92",
"registry_version": "v1.3",
"registration_port": 8010,
"system_address": "192.168.1.85",
"system_address": "192.168.88.92",
"system_version": "v1.0",
"system_port": 8010
}
Expand All @@ -44,7 +44,7 @@
"description": "BISECT OSSRF receiver video",
"network": {
"primary": {
"interface_address": "192.168.1.85",
"interface_address": "192.168.88.92",
"interface_name": "wlp1s0"
}
},
Expand All @@ -58,7 +58,7 @@
"description": "BISECT OSSRF receiver audio",
"network": {
"primary": {
"interface_address": "192.168.1.85",
"interface_address": "192.168.88.92",
"interface_name": "wlp1s0"
}
},
Expand All @@ -74,9 +74,9 @@
"description": "BISECT OSSRF sender video",
"network": {
"primary": {
"source_address": "192.168.1.85",
"source_address": "192.168.88.92",
"interface_name": "wlp1s0",
"destination_address": "239.10.10.10",
"destination_address": "192.168.88.92",
"destination_port": 5004
}
},
Expand All @@ -99,9 +99,9 @@
"description": "BISECT OSSRF sender audio",
"network": {
"primary": {
"source_address": "192.168.1.85",
"source_address": "192.168.88.92",
"interface_name": "wlp1s0",
"destination_address": "239.10.10.11",
"destination_address": "192.168.88.92",
"destination_port": 5005
}
},
Expand All @@ -114,4 +114,4 @@
}
}
]
}
}
14 changes: 14 additions & 0 deletions cpp/demos/ossrf-nmos-api/config/nmos_receiver_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"id": "db9f46cf-2414-4e25-b6c6-2078159857f9",
"label": "BISECT OSSRF receiver video",
"description": "BISECT OSSRF receiver video",
"network": {
"primary": {
"interface_address": "192.168.88.92",
"interface_name": "wlp1s0"
}
},
"capabilities": [
"video/raw"
]
}
25 changes: 25 additions & 0 deletions cpp/demos/ossrf-nmos-api/config/nmos_sender_config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"id": "e543a2c1-d6a2-47f5-8d14-296bb6714ef2",
"label": "BISECT OSSRF sender video",
"description": "BISECT OSSRF sender video",
"network": {
"primary": {
"source_address": "192.168.88.92",
"interface_name": "wlp1s0",
"destination_address": "192.168.88.92",
"destination_port": 5004
}
},
"payload_type": 97,
"media_type": "video/raw",
"media": {
"width": 640,
"height": 480,
"frame_rate": {
"num": 50,
"den": 1
},
"sampling": "YCbCr-4:2:2",
"structure": "progressive"
}
}
2 changes: 2 additions & 0 deletions cpp/libs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ add_subdirectory(bisect_expected)
add_subdirectory(bisect_nmoscpp)
add_subdirectory(bisect_sdp)
add_subdirectory(bisect_gst)
add_subdirectory(gst_nmos_sender_plugin)
add_subdirectory(ossrf_nmos_api)
add_subdirectory(ossrf_c_nmos_api)
add_subdirectory(ossrf_gstreamer_api)
add_subdirectory(bisect_json)
10 changes: 8 additions & 2 deletions cpp/libs/gst_nmos_sender_plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
cmake_minimum_required(VERSION 3.16)
project(gst_nmos_sender_plugin LANGUAGES C)

# Define the path to the ossrf_c_nmos_api directory
set(OSSRF_C_NMOS_API_PATH "../ossrf_c_nmos_api/")

# Find required GStreamer packages
find_package(PkgConfig REQUIRED)
pkg_search_module(GSTREAMER REQUIRED gstreamer-1.0>=1.4)
Expand All @@ -15,22 +18,25 @@ file(GLOB_RECURSE ${PROJECT_NAME}_source_files *.c *.h)
add_library(${PROJECT_NAME} MODULE ${${PROJECT_NAME}_source_files})

# Include directories
target_include_directories(${PROJECT_NAME} PRIVATE ${GSTREAMER_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME} PRIVATE ${GSTREAMER_INCLUDE_DIRS} ${OSSRF_C_NMOS_API_PATH})

# Link GStreamer libraries
target_compile_options(${PROJECT_NAME} PRIVATE ${GSTREAMER_CFLAGS_OTHER})
target_link_libraries(${PROJECT_NAME} PRIVATE
${GSTREAMER_LIBRARIES}
${GSTREAMER_APP_LIBRARIES}
${GSTREAMER_AUDIO_LIBRARIES}
${GSTREAMER_VIDEO_LIBRARIES})
${GSTREAMER_VIDEO_LIBRARIES}
ossrf::ossrf_c_nmos_api)

# Specify the output directory and the library name
set_target_properties(${PROJECT_NAME} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/plugins
OUTPUT_NAME "gstnmossender" # Custom .so name
)

add_library(ossrf::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

# Install the plugin to the system's GStreamer plugin directory
install(TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ~/.local/lib/gstreamer-1.0)
21 changes: 20 additions & 1 deletion cpp/libs/gst_nmos_sender_plugin/gst_nmos_sender_plugin.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#include <gst/gst.h>
#include <gst/gstpad.h>
#include <ossrf_c_nmos_api.h>

GST_DEBUG_CATEGORY_STATIC(gst_nmossender_debug_category);
#define GST_CAT_DEFAULT gst_nmossender_debug_category
Expand All @@ -44,7 +45,7 @@ typedef struct _GstNmossenderClass
} GstNmossenderClass;

G_DEFINE_TYPE_WITH_CODE(GstNmossender, gst_nmossender, GST_TYPE_BIN,
GST_DEBUG_CATEGORY_INIT(gst_nmossender_debug_category, "nmossender", 0, "NMOS Sender Plugin"));
GST_DEBUG_CATEGORY_INIT(gst_nmossender_debug_category, "nmossender", 0, "NMOS Sender Plugin"))

/* Pad template */
static GstStaticPadTemplate sink_template =
Expand Down Expand Up @@ -80,6 +81,24 @@ static void gst_nmossender_init(GstNmossender* self)
return;
}

// Example of using the nmos_client_create function
const char* config_location =
"/home/nmos/repos/nmos-sender-receiver-framework/cpp/demos/ossrf-nmos-api/config/nmos_config.json";

nmos_client_t* client = nmos_client_create(config_location);
if(client)
{
nmos_client_add_device(client, config_location);
nmos_client_add_sender(client);
nmos_client_add_receiver(client);
nmos_client_remove_sender(client);
nmos_client_remove_receiver(client);
}
else
{
// Handle error
}

/* Configure udpsink properties */
g_object_set(G_OBJECT(self->udpsink), "host", "127.0.0.1", "port", 9999, NULL);

Expand Down
43 changes: 43 additions & 0 deletions cpp/libs/ossrf_c_nmos_api/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
cmake_minimum_required(VERSION 3.16)
project(ossrf_c_nmos_api LANGUAGES CXX C)

find_package(nlohmann_json REQUIRED)

file(GLOB_RECURSE ${PROJECT_NAME}_source_files *.cpp *.h)

add_library(${PROJECT_NAME} STATIC ${${PROJECT_NAME}_source_files})

target_link_libraries(
${PROJECT_NAME}
PRIVATE project_options project_warnings
PUBLIC
bisect::project_warnings
bisect::expected
bisect::bisect_nmoscpp
bisect::bisect_json
nlohmann_json::nlohmann_json
ossrf::ossrf_nmos_api
)

set_target_properties(
${PROJECT_NAME}
PROPERTIES CXX_EXTENSIONS NO
POSITION_INDEPENDENT_CODE ON)

target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)

target_include_directories(
${PROJECT_NAME}
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
PRIVATE src)

add_library(ossrf::${PROJECT_NAME} ALIAS ${PROJECT_NAME})

install(TARGETS ${PROJECT_NAME})
install(DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/include" # source directory
DESTINATION "." # target directory
FILES_MATCHING # install only matched files
PATTERN "*.h" # select header files
)
Loading

0 comments on commit bc1c7e8

Please sign in to comment.