diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:22:27 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2009-12-13 20:22:27 +0000 |
commit | a181981eb49fc20d1a701fcfebda5cec70def295 (patch) | |
tree | 71b13cfe15b54d37b3ab878f6604dd83c117e4c0 /libavformat/metadata.c | |
parent | 813338a00a2b0b89c65fbbb84c02c7327cc0aa71 (diff) | |
download | ffmpeg-a181981eb49fc20d1a701fcfebda5cec70def295.tar.gz |
Add flags to prevent strdup() on arguments to av_metadata_set2().
I cannot use the same ABI as ffmbc as value 2 is already used in ffmpeg,
besides the name AV_METADATA_NONCONST* makes no sense to me.
Add av_metadata_set2() that takes flags.
Originally committed as revision 20834 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/metadata.c')
-rw-r--r-- | libavformat/metadata.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/libavformat/metadata.c b/libavformat/metadata.c index c7d036fd05..080ebcde88 100644 --- a/libavformat/metadata.c +++ b/libavformat/metadata.c @@ -46,7 +46,7 @@ av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int f return NULL; } -int av_metadata_set(AVMetadata **pm, const char *key, const char *value) +int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags) { AVMetadata *m= *pm; AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE); @@ -66,7 +66,13 @@ int av_metadata_set(AVMetadata **pm, const char *key, const char *value) return AVERROR(ENOMEM); } if(value){ + if(flags & AV_METADATA_DONT_STRDUP_KEY){ + m->elems[m->count].key = key; + }else m->elems[m->count].key = av_strdup(key ); + if(flags & AV_METADATA_DONT_STRDUP_VAL){ + m->elems[m->count].value= value; + }else m->elems[m->count].value= av_strdup(value); m->count++; } @@ -78,6 +84,13 @@ int av_metadata_set(AVMetadata **pm, const char *key, const char *value) return 0; } +#if LIBAVFORMAT_VERSION_MAJOR == 52 +int av_metadata_set(AVMetadata **pm, const char *key, const char *value) +{ + return av_metadata_set2(pm, key, value, 0); +} +#endif + void av_metadata_free(AVMetadata **pm) { AVMetadata *m= *pm; |