comparison utils.c @ 5455:df772456ed85 libavformat

Factorize dump_metadata() out. Idea from ffmbc, code not, mine is a fraction of the size due to simpler metadata API.
author michael
date Sun, 13 Dec 2009 23:19:24 +0000
parents 01cad9ef4a57
children 90b61b66076d
comparison
equal deleted inserted replaced
5454:01cad9ef4a57 5455:df772456ed85
2850 if (v% 100 ) av_log(NULL, AV_LOG_INFO, ", %3.2f %s", d, postfix); 2850 if (v% 100 ) av_log(NULL, AV_LOG_INFO, ", %3.2f %s", d, postfix);
2851 else if(v%(100*1000)) av_log(NULL, AV_LOG_INFO, ", %1.0f %s", d, postfix); 2851 else if(v%(100*1000)) av_log(NULL, AV_LOG_INFO, ", %1.0f %s", d, postfix);
2852 else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix); 2852 else av_log(NULL, AV_LOG_INFO, ", %1.0fk %s", d/1000, postfix);
2853 } 2853 }
2854 2854
2855 static void dump_metadata(void *ctx, AVMetadata *m, const char *indent)
2856 {
2857 if(m){
2858 AVMetadataTag *tag=NULL;
2859
2860 av_log(ctx, AV_LOG_INFO, "%sMetadata:\n", indent);
2861 while((tag=av_metadata_get(m, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
2862 av_log(ctx, AV_LOG_INFO, "%s %-16s: %s\n", indent, tag->key, tag->value);
2863 }
2864 }
2865 }
2866
2855 /* "user interface" functions */ 2867 /* "user interface" functions */
2856 static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output) 2868 static void dump_stream_format(AVFormatContext *ic, int i, int index, int is_output)
2857 { 2869 {
2858 char buf[256]; 2870 char buf[256];
2859 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); 2871 int flags = (is_output ? ic->oformat->flags : ic->iformat->flags);
2958 } 2970 }
2959 for(i=0;i<ic->nb_streams;i++) 2971 for(i=0;i<ic->nb_streams;i++)
2960 if (!printed[i]) 2972 if (!printed[i])
2961 dump_stream_format(ic, i, index, is_output); 2973 dump_stream_format(ic, i, index, is_output);
2962 2974
2963 if (ic->metadata) { 2975 dump_metadata(NULL, ic->metadata, " ");
2964 AVMetadataTag *tag=NULL;
2965 av_log(NULL, AV_LOG_INFO, " Metadata\n");
2966 while((tag=av_metadata_get(ic->metadata, "", tag, AV_METADATA_IGNORE_SUFFIX))) {
2967 av_log(NULL, AV_LOG_INFO, " %-16s: %s\n", tag->key, tag->value);
2968 }
2969 }
2970 av_free(printed); 2976 av_free(printed);
2971 } 2977 }
2972 2978
2973 #if LIBAVFORMAT_VERSION_MAJOR < 53 2979 #if LIBAVFORMAT_VERSION_MAJOR < 53
2974 int parse_image_size(int *width_ptr, int *height_ptr, const char *str) 2980 int parse_image_size(int *width_ptr, int *height_ptr, const char *str)