-
Notifications
You must be signed in to change notification settings - Fork 15
Expand file tree
/
Copy pathmetadata.c
More file actions
37 lines (28 loc) · 879 Bytes
/
Copy pathmetadata.c
File metadata and controls
37 lines (28 loc) · 879 Bytes
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
/*
* @file
* Show how the metadata API can be used in application programs
* @example metadata.c
*/
#include <stdio.h>
#include <libavformat/avformat.h>
#include <libavutil/dict.h>
int main(int argc, char **argv)
{
AVFormatContext *fmt_ctx = NULL;
AVDictionaryEntry *tag = NULL;
int ret;
if(argc != 2){
printf("usage:%s <input_file>\n"
"example program to demostrate the use of the libavformat metadata API.\n", argv[0]);
return 1;
}
av_register_all();
if((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))
return ret;
printf("AVDictionary count %d\n",
av_dict_count(fmt_ctx->metadata));
while((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
printf("%s=%s\n", tag->key, tag->value);
avformat_close_input(&fmt_ctx);
return 0;
}