编译Android版本的OpenSSL

将android-ndk-r20b和openssl-master解压在同一层目录,在此目录创建脚本bld.sh,内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh
 
BASE_DIR=/home/sdb/android/ndk-r20b
 
export ANDROID_NDK_HOME=${BASE_DIR}/android-ndk-r20b
 
PATH=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin:$ANDROID_NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin:$PATH
 
cd openssl-master/
 
#./Configure --prefix=${BASE_DIR}/openssl-arm32 android-arm -D__ANDROID_API__=29
./Configure --prefix=${BASE_DIR}/openssl-arm32 android-arm -D__ANDROID_API__=16
#./Configure --prefix=${BASE_DIR}/openssl-x86 android-x86 -D__ANDROID_API__=16
 
make
make install

运行bld.sh脚本就会生成OpenSSL库文件。

How to build rtsp stream from a mp4 file to test EuhatRtsp

First, convert mp4 file to h264 file, save script below as convert.bat

1
2
3
ffmpeg.exe -i %1 -s 1920x1080 -b:v 1536K -an output.mp4
ffmpeg -i output.mp4 -codec copy -bsf: h264_mp4toannexb -f h264 output.264
#ffmpeg -i test.264 -vcodec copy -f mp4 test.mp4

drag a mp4 file over convert.bat, after a while, output.264 will be generated. download h264LiveMediaServer.zip, unzip as h264LiveMediaServer.exe, move it to the same directory with output.264, just double click and run h264LiveMediaServer.exe, it will notify you the rtsp url, then input the url in the url edit box on the EuhatRtsp Demo app ui, click begin button, wait several seconds, you will see the video rendering in EuhatRtsp.

Before running h264LiveMediaServer.exe, vc2019 x86 Redistributable must be installed.

Visit H264LiveMediaServer on Github to get the source code.

编译时打印宏变量内容

1
2
3
4
5
6
7
8
9
#define PRINT_MACRO_HELPER(_x) #_x
#define PRINT_MACRO(_x) #_x " = " PRINT_MACRO_HELPER(_x)
 
#define DEFINED_PI 3.14
#define DEFINED_NULL
#pragma message(PRINT_MACRO(DEFINED_PI))
#pragma message(PRINT_MACRO(DEFINED_NULL))
#pragma message(PRINT_MACRO(UNDEFINED))
//#error print stop here.

refer to: https://blog.csdn.net/xshbx/article/details/7981564