FFmpeg开发笔记(十一):ffmpeg在移植到海思HI35xx平台之将ffmpeg库引入到sample的demo中
前言
上一篇交叉编译了ffmpeg的海思版本,使用交叉编译的qt的ffmpeg播放器在海思上播放,本片是将ffmpeg的环境添加进海思的sample环境中。
##### 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
如下图:
(注意海思的sample子目录下,文件夹只能有一个main函数,也就是说会把子文件夹中所有的头文件和源文件当作一个应用联合编译。)
将原来的.c的改一下后缀.bak,然后重新建立一个c文件。
(注意:需要先将库加入到运行环境中,最简单的方式就是直接copy之前的库,将lib放到海思系统的/lib文件目录下,也可以自定义路径,运行时使用脚本先加入路径然后跑应用,方法很多,条条大路通罗马)。
在HI3559AV100运行结果如下:
#ifdef __cplusplus
#if __cplusplus
extern "C" {
#endif
#endif /* End of #ifdef __cplusplus */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <netinet/in.h>
#include<arpa/inet.h>
#include <sys/types.h>
#include "sample_comm.h"
// ffmepg
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
#include <libavformat/version.h>
#include <libavutil/time.h>
#include <libavutil/mathematics.h>
#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 */
分类:
Hi35XX
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· DeepSeek 开源周回顾「GitHub 热点速览」
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· .NET 10首个预览版发布:重大改进与新特性概览!
· AI与.NET技术实操系列(二):开始使用ML.NET
· 单线程的Redis速度为什么快?