forked from Travis990/FFmpegCoding
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathffmpeg_list.c
36 lines (29 loc) · 826 Bytes
/
ffmpeg_list.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <libavutil/log.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
int main(int argc, char* argv[]){
AVIODirContext *ctx = NULL;
AVIODirEntry *entry = NULL;
int ret;
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){
ret = avio_read_dir(ctx,&entry);
if(ret < 0){
av_log(NULL, AV_LOG_ERROR, "Cant open dir:%s\n", av_err2str(ret));
//return -1;
goto __fail;
}
if(!entry){
break;
}
av_log(NULL, AV_LOG_INFO, "%12"PRId64" %s \n",entry->size,entry->name);
avio_free_directory_entry(&entry);
}
__fail:
avio_close_dir(&ctx);
}