当前位置:网站首页>FFmpeg multimedia file processing (implementation of ffmpeg operation directory and list)
FFmpeg multimedia file processing (implementation of ffmpeg operation directory and list)
2022-08-09 13:51:00 【One Leaf Knows Autumn @qqy】
Manipulate directory important functions
- avio_open_dir() 打开目录
- avio_read_dir() Read information about each file in the directory,Including file size, etc
- avio_close_dir() 关闭目录,释放资源
Manipulate the important structure of the directory
- AVIODirContext 操作目录的上下文
- AVIODirEntry 目录项,用于存放文件名,文件大小等信息
实战 简单的ls命令
在linux、mac等系统下,终端输入lsYou can see what files are in the current directory,what are their properties
使用ls -alt,可以查看更详细的信息
#include <libavutil/log.h>
#include <libavformat/avformat.h>
int main(int argc, char *argv[])
{
int ret;
AVIODirContext *ctx = NULL;
AVIODirEntry *entry = NULL;
av_log_set_level(AV_LOG_INFO);
ret = avio_open_dir(&ctx, "./", NULL); //打开目录
if(ret < 0){
av_log(NULL, AV_LOG_ERROR, "Cant open dir:%s\n", av_err2str(ret));
return -1;
}
while(1){
avio_read_dir(ctx, &entry); //读取目录
if(ret < 0){
av_log(NULL, AV_LOG_ERR, "Cant rad dir:%s\n", av_err2str(ret));
goto __fail;
}
if(!entry){
break; //If read to the end,break out of the loop
}
av_log(NULL, AV_LOG_INFO, "%12"PRId64" %s \n", entry->size, entry->name);
avio_free_directory_entry(&entry);
}
__fail:
avio_close_dir(&ctx);
return 0;
}
边栏推荐
- ARM板卡增加路由功能
- 剑指 Offer 43. 1~n 整数中 1 出现的次数(递归、数学)
- 5G China unicom 一般性异常处理
- Professor Chen Qiang's "Machine Learning and R Application" course Chapter 14 Assignment
- Ledong Fire Rescue Brigade was invited to carry out fire safety training for cadres
- 昇腾AI开发者创享日南京站!一起CANN机器狗+AI机械臂实现硬核智慧救援!燃爆现场~
- NFS pays special attention to the problem of permissions
- NFS 特别注意权限的问题
- Rmarkdown教程
- LnReader编译
猜你喜欢
ctfshow七夕杯2022
jenkins api创建自定义pipeline
我的2020年终总结
uni-app - uview Swiper 轮播图组件点击跳转链接(点击后拿到 item 行数据, 取出数据做操作)
Redis源码剖析之字典(dict)
How to solve the 0x80070005 error when the computer is reinstalled and the system is restored
电脑重装系统后桌面图标如何调小尺寸
透明tune proxy
Flutter entry and advanced tour (6) Layout Widget
gin的中间件和路由分组
随机推荐
SQL Server查询优化 (转载非原创)
5G China unicom AP:B SMS ASCII 转码要求
LnReader编译
某高校的R语言数据分析期末作业
绘制混合密度函数图以及添加分位数线
Redis源码剖析之跳表(skiplist)
陈强教授《机器学习及R应用》课程 第十六章作业
GIN a preliminary study, the environment is installed
GIN文件上传与返回
透明tune proxy
陈强教授《机器学习及R应用》课程 第十五章作业
第六届”蓝帽杯“全国大学生网络安全技能大赛 半决赛
5G China unicom 一般性异常处理
Professor Chen Qiang's "Machine Learning and R Application" course Chapter 16 Assignment
剑指 Offer 43. 1~n 整数中 1 出现的次数(递归、数学)
Jenkins API groovy调用实践: Jenkins Core Api & Job DSL创建项目
面试题精选:神奇的斐波那契数列
剑指 Offer 56 - II. 数组中数字出现的次数 II(位运算)
ABP中的数据过滤器 (转载非原创)
剑指 Offer 57 - II. 和为s的连续正数序列(滑动窗口)