How to Compile rkmedia on a Linux Board
Introduction
rkmedia is a multimedia library for the Rockchip Linux platform that encapsulates the underlying media module interfaces, providing common multimedia solutions. rkmedia supports video input, video output, video encoding and decoding, audio input and output, audio encoding and decoding, image processing, and other functions.
To compile rkmedia on a Rockchip Linux board, you need to first download the source code of rkmedia and configure the cross-compiler and related dependencies. The specific steps are as follows:
Compile
Copy the Source Code
cp -rf SDK/external/rkmedia /home/neardi/
Install the Compilation Environment
sudo apt install libv4l-dev libasound2-dev build-essential cmake
Compile easymedia
Since easymedia is a dependency of rkmedia, you need to compile easymedia before compiling rkmedia.
cd /home/neardi/rkmedia
cmake ./
neardi@LPA3399PRO:~/rkmedia$ cmake ./
-- cmake version 3.16.3
CMake Deprecation Warning at CMakeLists.txt:11 (cmake_policy):
The OLD behavior for policy CMP0025 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
CMake Deprecation Warning at CMakeLists.txt:12 (cmake_policy):
The OLD behavior for policy CMP0042 will be removed from a future version
of CMake.
The cmake-policies(7) manual explains that the OLD behaviors of all
policies are deprecated and that a policy should be set to OLD only under
specific short-term circumstances. Projects should be ported to the NEW
behavior and not rely on setting a policy to OLD.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/neardi/rkmedia
Install easymedia
sudo make install
neardi@LPA3399PRO:~/rkmedia$ sudo make install
[sudo] password for neardi:
[100%] Built target easymedia
Install the project...
-- Install configuration: ""
-- Up-to-date: /usr/local/lib/libeasymedia.so.1.0.1
-- Up-to-date: /usr/local/lib/libeasymedia.so.1
-- Up-to-date: /usr/local/lib/libeasymedia.so
-- Up-to-date: /usr/local/include/easymedia/buffer.h
-- Up-to-date: /usr/local/include/easymedia/codec.h
-- Up-to-date: /usr/local/include/easymedia/control.h
-- Up-to-date: /usr/local/include/easymedia/decoder.h
-- Up-to-date: /usr/local/include/easymedia/demuxer.h
-- Up-to-date: /usr/local/include/easymedia/encoder.h
-- Up-to-date: /usr/local/include/easymedia/filter.h
-- Up-to-date: /usr/local/include/easymedia/flow.h
-- Up-to-date: /usr/local/include/easymedia/image.h
-- Up-to-date: /usr/local/include/easymedia/key_string.h
-- Up-to-date: /usr/local/include/easymedia/link_config.h
-- Up-to-date: /usr/local/include/easymedia/lock.h
-- Up-to-date: /usr/local/include/easymedia/media_config.h
-- Up-to-date: /usr/local/include/easymedia/media_reflector.h
-- Up-to-date: /usr/local/include/easymedia/media_type.h
-- Up-to-date: /usr/local/include/easymedia/message.h
-- Up-to-date: /usr/local/include/easymedia/message_type.h
-- Up-to-date: /usr/local/include/easymedia/muxer.h
-- Up-to-date: /usr/local/include/easymedia/reflector.h
-- Up-to-date: /usr/local/include/easymedia/rga_filter.h
-- Up-to-date: /usr/local/include/easymedia/rknn_user.h
-- Up-to-date: /usr/local/include/easymedia/rknn_utils.h
-- Up-to-date: /usr/local/include/easymedia/sound.h
-- Up-to-date: /usr/local/include/easymedia/stream.h
-- Up-to-date: /usr/local/include/easymedia/utils.h
-- Up-to-date: /usr/local/lib/pkgconfig/libeasymedia.pc
Modify imported files
neardi@LPA3399PRO:~/rkmedia/examples$ git diff .
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f133c01..d9a442d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -489,6 +489,8 @@ endif() #if(DRM_DISPLAY)
# rkmedia_muxer_test
#--------------------------
add_executable(rkmedia_muxer_test rkmedia_muxer_test.c ${COMMON_SRC})
+include_directories(../include/easymedia)
+include_directories(../include/rkmedia)
add_dependencies(rkmedia_muxer_test easymedia)
target_link_libraries(rkmedia_muxer_test easymedia)
target_include_directories(rkmedia_muxer_test PRIVATE ${CMAKE_SOURCE_DIR}/include)
Compile rkmedia
make -j16
neardi@LPA3399PRO:~/rkmedia/examples$ make -j16
-- The C compiler identification is GNU 9.4.0
-- The CXX compiler identification is GNU 9.4.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
CMake Warning (dev) in CMakeLists.txt:
No cmake_minimum_required command is present. A line of code such as
cmake_minimum_required(VERSION 3.16)
should be added at the top of the file. The version specified may be lower
if you wish to support older CMake versions for this project. For more
information run "cmake --help-policy CMP0000".
This warning is for project developers. Use -Wno-dev to suppress it.
-- Configuring done
CMake Warning (dev) at CMakeLists.txt:494 (add_dependencies):
Policy CMP0046 is not set: Error on non-existent dependency in
add_dependencies. Run "cmake --help-policy CMP0046" for policy details.
Use the cmake_policy command to set the policy and suppress this warning.
The dependency target "easymedia" of target "rkmedia_muxer_test" does not
exist.
This warning is for project developers. Use -Wno-dev to suppress it.
-- Generating done
-- Build files have been written to: /home/neardi/rkmedia/examples
Scanning dependencies of target rkmedia_muxer_test
[ 50%] Building C object CMakeFiles/rkmedia_muxer_test.dir/common/sample_common_isp.o
[ 50%] Building C object CMakeFiles/rkmedia_muxer_test.dir/common/sample_fake_isp.o
[ 75%] Building C object CMakeFiles/rkmedia_muxer_test.dir/rkmedia_muxer_test.o
[100%] Linking C executable rkmedia_muxer_test
[100%] Built target rkmedia_muxer_test