-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from aws-deepracer-community/build-fix
Adding H264 Encoder to Codebase
- Loading branch information
Showing
15 changed files
with
1,233 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
project(h264_video_encoder) | ||
|
||
## Compile as C++11, supported in ROS Kinetic and newer | ||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
find_package(catkin REQUIRED COMPONENTS | ||
h264_encoder_core | ||
aws_common | ||
aws_ros1_common | ||
image_transport | ||
message_generation | ||
sensor_msgs | ||
kinesis_video_msgs | ||
) | ||
|
||
catkin_package(CATKIN_DEPENDS | ||
aws_ros1_common | ||
image_transport | ||
message_runtime | ||
) | ||
|
||
|
||
############# | ||
## Compile ## | ||
############# | ||
|
||
set(h264_video_encoder_SRCS | ||
src/h264_video_encoder.cpp | ||
) | ||
set(h264_video_encoder_INCS | ||
include | ||
${aws_common_INCLUDE_DIRS} | ||
${catkin_INCLUDE_DIRS} | ||
) | ||
set(h264_video_encoder_LIBS | ||
${catkin_LIBRARIES} | ||
aws_common | ||
) | ||
|
||
# add the publisher example | ||
add_executable(${PROJECT_NAME} src/main.cpp ${h264_video_encoder_SRCS}) | ||
add_library(${PROJECT_NAME}_lib STATIC ${h264_video_encoder_SRCS}) | ||
|
||
target_include_directories(${PROJECT_NAME} PRIVATE ${h264_video_encoder_INCS}) | ||
target_include_directories(${PROJECT_NAME}_lib PUBLIC ${h264_video_encoder_INCS}) | ||
|
||
target_link_libraries(${PROJECT_NAME} ${h264_video_encoder_LIBS}) | ||
target_link_libraries(${PROJECT_NAME}_lib ${h264_video_encoder_LIBS}) | ||
|
||
add_dependencies(${PROJECT_NAME} | ||
${catkin_EXPORTED_TARGETS} | ||
${${PROJECT_NAME}_EXPORTED_TARGETS} | ||
) | ||
|
||
|
||
############# | ||
## Install ## | ||
############# | ||
|
||
# Mark executables and/or libraries for installation | ||
install(TARGETS ${PROJECT_NAME} | ||
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION} | ||
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION} | ||
) | ||
install(DIRECTORY launch/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/launch) | ||
install(DIRECTORY config/ DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/config) | ||
|
||
|
||
############# | ||
## Tests ## | ||
############# | ||
|
||
## Add gtest based cpp test target and link libraries | ||
if(CATKIN_ENABLE_TESTING) | ||
find_package(rostest REQUIRED) | ||
find_package(GMock QUIET) | ||
if(GMOCK_FOUND) | ||
add_rostest_gmock(test_h264_video_encoder | ||
test/test_h264_video_encoder.test | ||
test/h264_video_encoder_test.cpp | ||
) | ||
target_link_libraries(test_h264_video_encoder | ||
${PROJECT_NAME}_lib | ||
${catkin_LIBRARIES} | ||
${GMOCK_BOTH_LIBRARIES} | ||
) | ||
else() | ||
include_directories(/usr/include/gmock /usr/src/gmock) | ||
add_library(${PROJECT_NAME}_libgmock SHARED /usr/src/gmock/src/gmock-all.cc) | ||
|
||
add_rostest_gtest(test_h264_video_encoder | ||
test/test_h264_video_encoder.test | ||
test/h264_video_encoder_test.cpp | ||
) | ||
target_link_libraries(test_h264_video_encoder | ||
${PROJECT_NAME}_lib | ||
${catkin_LIBRARIES} | ||
${PROJECT_NAME}_libgmock | ||
) | ||
endif() | ||
endif() |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
|
||
This product includes software developed by | ||
Amazon Technologies, Inc (http://www.amazon.com/). |
27 changes: 27 additions & 0 deletions
27
bundle/h264_video_encoder/config/sample_configuration.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# This sample YAML config file is catered towards running the H264 Encoder Node on a Raspberry Pi based system | ||
|
||
# The name of the topic to which the H264 encoder node should subscribe to obtain the feed desired to be encoded | ||
# The topic must be a sensor_msgs/Image message | ||
subscription_topic: "/raspicam_node/image" | ||
|
||
# The name of the topic to which H264 encoder node should publish the encoded video stream | ||
# The topic will be a kinesis_video_msgs/KinesisVideoFrame message | ||
publication_topic: "/video/encoded" | ||
|
||
# The size of the subscribed and publishing message queues (default: 100) | ||
# queue_size: 100 | ||
|
||
# The desired output width of the encoded video stream (default: width of the input image stream) | ||
# output_width: | ||
|
||
# The desired output height of the encoded video stream (default: height of the input image stream) | ||
# output_height: | ||
|
||
# The numerator when expressing the frame rate as a rational number | ||
fps_numerator: 30 | ||
|
||
# The denominator when expressing the frame rate as a rational number (default: 1) | ||
fps_denominator: 1 | ||
|
||
# The target bit rate in bits per second of the output video stream | ||
bitrate: 2048000 |
27 changes: 27 additions & 0 deletions
27
bundle/h264_video_encoder/launch/h264_video_encoder.launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<!-- | ||
This is an example launch file to use when you want to launch a H264 Video Encoder node | ||
@param node_name (optional) If provided, the value will be set as the name of the node when it is launched. | ||
Otherwise, the default value is 'h264_video_encoder' | ||
@param config_file (optional) If provided, rosparam will attempt to load the file into the private namespace | ||
of the node. | ||
--> | ||
|
||
<launch> | ||
<!-- If a node_name argument is provided by the caller then we will set the node's name to that value --> | ||
<arg name="node_name" default="h264_video_encoder" /> | ||
<!-- If a config file argument is provided by the caller then we will load it into the node's namespace --> | ||
<arg name="config_file" default="" doc="Path to config file. All configuration settings will be loaded into node's namespace." /> | ||
<!-- The output argument sets the node's stdout/stderr location. Set to 'screen' to see this node's output in the terminal. --> | ||
<arg name="output" default="log" doc="The stdout/stderr location for this node. Set to 'screen' to see this node's output in the terminal." /> | ||
<!-- The image transport used by the video encoder. This can be 'raw' or 'compressed' --> | ||
<arg name="image_transport" default="compressed" doc="The image transport used by this video encoder node. This can be 'raw' or 'compressed'." /> | ||
|
||
<node name="$(arg node_name)" pkg="h264_video_encoder" type="h264_video_encoder" output="$(arg output)"> | ||
<!-- If the caller specified a config file then load it here. --> | ||
<rosparam if="$(eval config_file!='')" command="load" file="$(arg config_file)"/> | ||
|
||
<!-- Name of image transport to use when subscribing to a sensor message topic --> | ||
<param name="image_transport" value="$(arg image_transport)"/> | ||
</node> | ||
</launch> |
13 changes: 13 additions & 0 deletions
13
bundle/h264_video_encoder/launch/sample_application.launch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<!-- This is an example launch file for how a ROS application could use a h264_video_encoder --> | ||
|
||
<launch> | ||
<!-- Custom Nodes would be launched here --> | ||
|
||
<arg name="config_file" default="$(find h264_video_encoder)/config/sample_configuration.yaml"/> | ||
|
||
<include file="$(find h264_video_encoder)/launch/h264_video_encoder.launch" > | ||
<!-- The configuration can either be passed in using the "config_file" parameter or by using a rosparam tag | ||
to load the config into the parameter server --> | ||
<arg name="config_file" value="$(arg config_file)"/> | ||
</include> | ||
</launch> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0"?> | ||
<package format="2"> | ||
<name>h264_video_encoder</name> | ||
<version>1.1.4</version> | ||
<description>ROS1 H264 encoder node</description> | ||
<url>http://wiki.ros.org/h264_video_encoder</url> | ||
|
||
<author email="ros-contributions@amazon.com">AWS RoboMaker</author> | ||
<maintainer email="ros-contributions@amazon.com">AWS RoboMaker</maintainer> | ||
|
||
<license>LGPLv2.1</license> | ||
|
||
<buildtool_depend>catkin</buildtool_depend> | ||
|
||
<build_depend>aws_ros1_common</build_depend> | ||
<build_depend>h264_encoder_core</build_depend> | ||
<build_depend>image_transport</build_depend> | ||
<build_depend>kinesis_video_msgs</build_depend> | ||
<build_depend>message_generation</build_depend> | ||
<build_depend>sensor_msgs</build_depend> | ||
|
||
<exec_depend>aws_ros1_common</exec_depend> | ||
<exec_depend>h264_encoder_core</exec_depend> | ||
<exec_depend>image_transport</exec_depend> | ||
<exec_depend>image_transport_plugins</exec_depend> | ||
<exec_depend>kinesis_video_msgs</exec_depend> | ||
<exec_depend>message_runtime</exec_depend> | ||
<exec_depend>sensor_msgs</exec_depend> | ||
|
||
<test_depend>google-mock</test_depend> | ||
<test_depend>gtest</test_depend> | ||
<test_depend>rostest</test_depend> | ||
</package> |
Oops, something went wrong.