FFmpeg开发笔记(十一):ffmpeg在移植到海思HI35xx平台之将ffmpeg库引入到sample的demo中
前言
??上一篇交叉编译了ffmpeg的海思版本,使用交叉编译的qt的ffmpeg播放器在海思上播放,本片是将ffmpeg的环境添加进海思的sample环境中。
在海思sample中引入ffmpeg库
步骤一:查看之前交叉编译的安装文件
??
步骤二:打开编译的参数文件,添加头文件和库文件
??
##### add by yangjiong 2022-03-12 start
INC_FLAGS += -I/home/yang/work/ffmpeg-hi3559av100/include
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavcodec.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavdevice.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavfilter.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavformat.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavutil.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libswresample.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libswscale.a
##### add by yangjiong 2022-03-12 stop
??如下图:
??
步骤三:在venc另起sample添加ffmpeg测试
??(注意海思的sample子目录下,文件夹只能有一个main函数,也就是说会把子文件夹中所有的头文件和源文件当作一个应用联合编译。)
??将原来的.c的改一下后缀.bak,然后重新建立一个c文件。
??
??
步骤四:将目标应用在板子上跑
??(注意:需要先将库加入到运行环境中,最简单的方式就是直接copy之前的库,将lib放到海思系统的/lib文件目录下,也可以自定义路径,运行时使用脚本先加入路径然后跑应用,方法很多,条条大路通罗马)。
??在HI3559AV100运行结果如下:
??
Demo源码
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "sample_comm.h"
// ffmepg
#include
#include
#include
#include
#include
#include
#include
#define LOG printf("%s:%d\n", __FILE__, __LINE__);
int main(int argc, char *argv[])
{
printf("%s\n", avcodec_configuration());
return 0;
}
#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */