Show how to list directories through the libavformat AVIOContext API.
{
return "<DIR>";
return "<FILE>";
return "<BLOCK DEVICE>";
return "<CHARACTER DEVICE>";
return "<PIPE>";
return "<LINK>";
return "<SOCKET>";
return "<SERVER>";
return "<SHARE>";
return "<WORKGROUP>";
default:
break;
}
return "<UNKNOWN>";
}
static int list_op(
const char *input_dir)
{
char filemode[4], uid_and_gid[20];
}
cnt = 0;
for (;;) {
}
if (!entry)
break;
} else {
}
if (cnt == 0)
"TYPE", "SIZE", "NAME", "UID(GID)", "UGO", "MODIFIED",
"ACCESSED", "STATUS_CHANGED");
uid_and_gid,
filemode,
cnt++;
};
}
{
fprintf(stderr, "usage: %s input_dir\n"
"API example program to show how to list files in directory "
}
int main(
int argc,
char *argv[])
{
if (argc < 2) {
return 1;
}
}
const char program_name[]
program name, defined by the program for show_version().
int type
Type of the entry.
int64_t access_timestamp
Time of last access in microseconds since unix epoch, -1 if unknown.
@ AVIO_ENTRY_CHARACTER_DEVICE
it s the only field you need to keep assuming you have a context There is some magic you don t need to care about around this just let it vf type
int avformat_network_init(void)
Do global initialization of network libraries.
void avio_free_directory_entry(AVIODirEntry **entry)
Free entry allocated by avio_read_dir().
int64_t modification_timestamp
Time of last modification in microseconds since unix epoch, -1 if unknown.
static int list_op(const char *input_dir)
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
@ AVIO_ENTRY_SYMBOLIC_LINK
int avio_close_dir(AVIODirContext **s)
Close directory.
#define AV_LOG_DEBUG
Stuff which is only useful for libav* developers.
int main(int argc, char *argv[])
int64_t size
File size in bytes, -1 if unknown.
int64_t group_id
Group ID of owner, -1 if unknown.
int avio_read_dir(AVIODirContext *s, AVIODirEntry **next)
Get next directory entry.
int64_t filemode
Unix file mode, -1 if unknown.
#define av_err2str(errnum)
Convenience macro, the return value should be used only directly in function arguments but never stan...
Describes single entry of the directory.
int64_t status_change_timestamp
Time of last status change in microseconds since unix epoch, -1 if unknown.
#define AV_LOG_INFO
Standard information.
int64_t user_id
User ID of owner, -1 if unknown.
void av_log_set_level(int level)
Set the log level.
int avio_open_dir(AVIODirContext **s, const char *url, AVDictionary **options)
Open directory for reading.
@ AVIO_ENTRY_BLOCK_DEVICE
static const char * type_string(int type)
int avformat_network_deinit(void)
Undo the initialization done by avformat_network_init.