yading@10: /* yading@10: * Copyright (c) 2011 Reinhard Tartler yading@10: * yading@10: * Permission is hereby granted, free of charge, to any person obtaining a copy yading@10: * of this software and associated documentation files (the "Software"), to deal yading@10: * in the Software without restriction, including without limitation the rights yading@10: * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell yading@10: * copies of the Software, and to permit persons to whom the Software is yading@10: * furnished to do so, subject to the following conditions: yading@10: * yading@10: * The above copyright notice and this permission notice shall be included in yading@10: * all copies or substantial portions of the Software. yading@10: * yading@10: * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR yading@10: * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, yading@10: * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL yading@10: * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER yading@10: * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, yading@10: * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN yading@10: * THE SOFTWARE. yading@10: */ yading@10: yading@10: /** yading@10: * @file yading@10: * Shows how the metadata API can be used in application programs. yading@10: * @example doc/examples/metadata.c yading@10: */ yading@10: yading@10: #include yading@10: yading@10: #include yading@10: #include yading@10: yading@10: int main (int argc, char **argv) yading@10: { yading@10: AVFormatContext *fmt_ctx = NULL; yading@10: AVDictionaryEntry *tag = NULL; yading@10: int ret; yading@10: yading@10: if (argc != 2) { yading@10: printf("usage: %s \n" yading@10: "example program to demonstrate the use of the libavformat metadata API.\n" yading@10: "\n", argv[0]); yading@10: return 1; yading@10: } yading@10: yading@10: av_register_all(); yading@10: if ((ret = avformat_open_input(&fmt_ctx, argv[1], NULL, NULL))) yading@10: return ret; yading@10: yading@10: while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) yading@10: printf("%s=%s\n", tag->key, tag->value); yading@10: yading@10: avformat_close_input(&fmt_ctx); yading@10: return 0; yading@10: }