#include <stdio.h>
#include "libavformat/avformat.h"
#include "libavutil/log.h"
int main(int argc, char const *argv[])
{
int result ;
av_log_set_level(AV_LOG_INFO);
AVIODirContext * dir_context = NULL;
AVIODirEntry * dir_entry = NULL;
result = avio_open_dir(&dir_context,"./",NULL);
if(result < 0){
av_log(NULL,AV_LOG_ERROR,"can't open dir %s \n",av_err2str(result));
return -1;
}
av_log(NULL,AV_LOG_INFO,"open dir success \n");
while(1){
result = avio_read_dir(dir_context,&dir_entry);
if(result < 0){
av_log(NULL,AV_LOG_ERROR,"can't read dir %s",av_err2str(result));
goto __failed;
}
if(!dir_entry){
break;
}
av_log(NULL,AV_LOG_INFO,"%12"PRId64" %s\n",dir_entry->size,dir_entry->name);
avio_free_directory_entry(&dir_entry);
}
__failed:
avio_close_dir(&dir_context);
return 0;
}
ffmpeg遍历文件夹下的所有文件
最新推荐文章于 2024-02-26 18:00:36 发布