/*1* Copyright (c) 2011 Reinhard Tartler2*3* Permission is hereby granted, free of charge, to any person obtaining a copy4* of this software and associated documentation files (the "Software"), to deal5* in the Software without restriction, including without limitation the rights6* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell7* copies of the Software, and to permit persons to whom the Software is8* furnished to do so, subject to the following conditions:9*10* The above copyright notice and this permission notice shall be included in11* all copies or substantial portions of the Software.12*13* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR14* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,15* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL16* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER17* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,18* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN19* THE SOFTWARE.20*/2122/**23* @file24* Shows how the metadata API can be used in application programs.25* @example metadata.c26*/2728#include <stdio.h>2930#include <libavformat/avformat.h>31#include <libavutil/dict.h>3233int main (int argc, char **argv)34{35AVFormatContext *fmt_ctx = NULL;36AVDictionaryEntry *tag = NULL;37int ret;3839if (argc != 2) {40printf("usage: %s <input_file>\n"41"example program to demonstrate the use of the libavformat metadata API.\n"42"\n", argv[0]);43return 1;44}4546av_register_all();47if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL)))48return ret;4950while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))51printf("%s=%s\n", tag->key, tag->value);5253avformat_close_input(&fmt_ctx);54return 0;55}565758