提交 48a81c0f 编写于 作者: A Aurelien Jacobs

replace AV_METADATA_IGNORE_CASE flag by a new AV_METADATA_MATCH_CASE flag

with the opposed meaning

Originally committed as revision 16680 to svn://svn.ffmpeg.org/ffmpeg/trunk
上级 b0973124
...@@ -67,7 +67,7 @@ unsigned avformat_version(void); ...@@ -67,7 +67,7 @@ unsigned avformat_version(void);
* A demuxer should set a default if it sets any translated tag. * A demuxer should set a default if it sets any translated tag.
*/ */
#define AV_METADATA_IGNORE_CASE 1 #define AV_METADATA_MATCH_CASE 1
#define AV_METADATA_IGNORE_SUFFIX 2 #define AV_METADATA_IGNORE_SUFFIX 2
typedef struct { typedef struct {
......
...@@ -105,9 +105,9 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s ...@@ -105,9 +105,9 @@ static void avi_write_info_tag(ByteIOContext *pb, const char *tag, const char *s
static void avi_write_info_tag2(AVFormatContext *s, const char *fourcc, const char *key1, const char *key2) static void avi_write_info_tag2(AVFormatContext *s, const char *fourcc, const char *key1, const char *key2)
{ {
AVMetadataTag *tag= av_metadata_get(s->metadata, key1, NULL, AV_METADATA_IGNORE_CASE); AVMetadataTag *tag= av_metadata_get(s->metadata, key1, NULL, 0);
if(!tag && key2) if(!tag && key2)
tag= av_metadata_get(s->metadata, key2, NULL, AV_METADATA_IGNORE_CASE); tag= av_metadata_get(s->metadata, key2, NULL, 0);
if(tag) if(tag)
avi_write_info_tag(s->pb, fourcc, tag->value); avi_write_info_tag(s->pb, fourcc, tag->value);
} }
......
...@@ -33,8 +33,8 @@ av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f ...@@ -33,8 +33,8 @@ av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f
for(; i<m->count; i++){ for(; i<m->count; i++){
const char *s= m->elems[i].key; const char *s= m->elems[i].key;
if(flags & AV_METADATA_IGNORE_CASE) for(j=0; toupper(s[j]) == toupper(key[j]) && key[j]; j++); if(flags & AV_METADATA_MATCH_CASE) for(j=0; s[j] == key[j] && key[j]; j++);
else for(j=0; s[j] == key[j] && key[j]; j++); else for(j=0; toupper(s[j]) == toupper(key[j]) && key[j]; j++);
if(key[j]) if(key[j])
continue; continue;
if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX)) if(s[j] && !(flags & AV_METADATA_IGNORE_SUFFIX))
...@@ -47,7 +47,7 @@ av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f ...@@ -47,7 +47,7 @@ av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f
int av_metadata_set(AVMetadata **pm, AVMetadataTag elem) int av_metadata_set(AVMetadata **pm, AVMetadataTag elem)
{ {
AVMetadata *m= *pm; AVMetadata *m= *pm;
AVMetadataTag *tag= av_metadata_get(m, elem.key, NULL, 0); AVMetadataTag *tag= av_metadata_get(m, elem.key, NULL, AV_METADATA_MATCH_CASE);
if(!m) if(!m)
m=*pm= av_mallocz(sizeof(*m)); m=*pm= av_mallocz(sizeof(*m));
......
...@@ -105,8 +105,7 @@ void ff_metadata_demux_compat(AVFormatContext *ctx) ...@@ -105,8 +105,7 @@ void ff_metadata_demux_compat(AVFormatContext *ctx)
#define FILL_METADATA(s, key, value) { \ #define FILL_METADATA(s, key, value) { \
if (value && *value && \ if (value && *value && !av_metadata_get(s->metadata, #key, NULL, 0)) \
!av_metadata_get(s->metadata, #key, NULL, AV_METADATA_IGNORE_CASE)) \
av_metadata_set(&s->metadata, (const AVMetadataTag){#key, value}); \ av_metadata_set(&s->metadata, (const AVMetadataTag){#key, value}); \
} }
#define FILL_METADATA_STR(s, key) FILL_METADATA(s, key, s->key) #define FILL_METADATA_STR(s, key) FILL_METADATA(s, key, s->key)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册