Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: source/patched-ffmpeg-mt/libavformat/metadata.c

Issue 4533003: patched ffmpeg nov 2 (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/third_party/ffmpeg/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * copyright (c) 2009 Michael Niedermayer 2 * copyright (c) 2009 Michael Niedermayer
3 * 3 *
4 * This file is part of FFmpeg. 4 * This file is part of FFmpeg.
5 * 5 *
6 * FFmpeg is free software; you can redistribute it and/or 6 * FFmpeg is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public 7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either 8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version. 9 * version 2.1 of the License, or (at your option) any later version.
10 * 10 *
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX)) 42 if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX))
43 continue; 43 continue;
44 return &m->elems[i]; 44 return &m->elems[i];
45 } 45 }
46 return NULL; 46 return NULL;
47 } 47 }
48 48
49 int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl ags) 49 int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int fl ags)
50 { 50 {
51 AVMetadata *m= *pm; 51 AVMetadata *m= *pm;
52 AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE); 52 AVMetadataTag *tag= av_metadata_get(m, key, NULL, flags);
53 53
54 if(!m) 54 if(!m)
55 m=*pm= av_mallocz(sizeof(*m)); 55 m=*pm= av_mallocz(sizeof(*m));
56 56
57 if(tag){ 57 if(tag){
58 if (flags & AV_METADATA_DONT_OVERWRITE) 58 if (flags & AV_METADATA_DONT_OVERWRITE)
59 return 0; 59 return 0;
60 av_free(tag->value); 60 av_free(tag->value);
61 av_free(tag->key); 61 av_free(tag->key);
62 *tag= m->elems[--m->count]; 62 *tag= m->elems[--m->count];
(...skipping 21 matching lines...) Expand all
84 } 84 }
85 85
86 return 0; 86 return 0;
87 } 87 }
88 88
89 #if FF_API_OLD_METADATA 89 #if FF_API_OLD_METADATA
90 int av_metadata_set(AVMetadata **pm, const char *key, const char *value) 90 int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
91 { 91 {
92 return av_metadata_set2(pm, key, value, 0); 92 return av_metadata_set2(pm, key, value, 0);
93 } 93 }
94
95 void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv,
96 const AVMetadataConv *s_conv)
97 {
98 return;
99 }
94 #endif 100 #endif
95 101
96 void av_metadata_free(AVMetadata **pm) 102 void av_metadata_free(AVMetadata **pm)
97 { 103 {
98 AVMetadata *m= *pm; 104 AVMetadata *m= *pm;
99 105
100 if(m){ 106 if(m){
101 while(m->count--){ 107 while(m->count--){
102 av_free(m->elems[m->count].key); 108 av_free(m->elems[m->count].key);
103 av_free(m->elems[m->count].value); 109 av_free(m->elems[m->count].value);
104 } 110 }
105 av_free(m->elems); 111 av_free(m->elems);
106 } 112 }
107 av_freep(pm); 113 av_freep(pm);
108 } 114 }
109 115
110 void metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv, 116 void ff_metadata_conv(AVMetadata **pm, const AVMetadataConv *d_conv,
111 const AVMetadataConv *s_conv) 117 const AVMetadataConv *s_conv)
112 { 118 {
113 /* TODO: use binary search to look up the two conversion tables 119 /* TODO: use binary search to look up the two conversion tables
114 if the tables are getting big enough that it would matter speed wise */ 120 if the tables are getting big enough that it would matter speed wise */
115 const AVMetadataConv *sc, *dc; 121 const AVMetadataConv *sc, *dc;
116 AVMetadataTag *mtag = NULL; 122 AVMetadataTag *mtag = NULL;
117 AVMetadata *dst = NULL; 123 AVMetadata *dst = NULL;
118 const char *key; 124 const char *key;
119 125
120 if (d_conv == s_conv) 126 if (d_conv == s_conv)
121 return; 127 return;
(...skipping 11 matching lines...) Expand all
133 if (!strcasecmp(key, dc->generic)) { 139 if (!strcasecmp(key, dc->generic)) {
134 key = dc->native; 140 key = dc->native;
135 break; 141 break;
136 } 142 }
137 av_metadata_set2(&dst, key, mtag->value, 0); 143 av_metadata_set2(&dst, key, mtag->value, 0);
138 } 144 }
139 av_metadata_free(pm); 145 av_metadata_free(pm);
140 *pm = dst; 146 *pm = dst;
141 } 147 }
142 148
143 void av_metadata_conv(AVFormatContext *ctx, const AVMetadataConv *d_conv, 149 void ff_metadata_conv_ctx(AVFormatContext *ctx, const AVMetadataConv *d_conv,
144 const AVMetadataConv *s_conv) 150 const AVMetadataConv *s_conv)
145 { 151 {
146 int i; 152 int i;
147 metadata_conv(&ctx->metadata, d_conv, s_conv); 153 ff_metadata_conv(&ctx->metadata, d_conv, s_conv);
148 for (i=0; i<ctx->nb_streams ; i++) 154 for (i=0; i<ctx->nb_streams ; i++)
149 metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv); 155 ff_metadata_conv(&ctx->streams [i]->metadata, d_conv, s_conv);
150 for (i=0; i<ctx->nb_chapters; i++) 156 for (i=0; i<ctx->nb_chapters; i++)
151 metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv); 157 ff_metadata_conv(&ctx->chapters[i]->metadata, d_conv, s_conv);
152 for (i=0; i<ctx->nb_programs; i++) 158 for (i=0; i<ctx->nb_programs; i++)
153 metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv); 159 ff_metadata_conv(&ctx->programs[i]->metadata, d_conv, s_conv);
154 } 160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698