Revision a181981e

View differences:

libavformat/avformat.h
22 22
#define AVFORMAT_AVFORMAT_H
23 23

  
24 24
#define LIBAVFORMAT_VERSION_MAJOR 52
25
#define LIBAVFORMAT_VERSION_MINOR 42
25
#define LIBAVFORMAT_VERSION_MINOR 43
26 26
#define LIBAVFORMAT_VERSION_MICRO  0
27 27

  
28 28
#define LIBAVFORMAT_VERSION_INT AV_VERSION_INT(LIBAVFORMAT_VERSION_MAJOR, \
......
81 81

  
82 82
#define AV_METADATA_MATCH_CASE      1
83 83
#define AV_METADATA_IGNORE_SUFFIX   2
84
#define AV_METADATA_DONT_STRDUP_KEY 4
85
#define AV_METADATA_DONT_STRDUP_VAL 8
84 86

  
85 87
typedef struct {
86 88
    char *key;
......
99 101
AVMetadataTag *
100 102
av_metadata_get(AVMetadata *m, const char *key, const AVMetadataTag *prev, int flags);
101 103

  
104
#if LIBAVFORMAT_VERSION_MAJOR == 52
102 105
/**
103 106
 * Sets the given tag in m, overwriting an existing tag.
104 107
 * @param key tag key to add to m (will be av_strduped)
......
106 109
 * @return >= 0 on success otherwise an error code <0
107 110
 */
108 111
int av_metadata_set(AVMetadata **pm, const char *key, const char *value);
112
#endif
113

  
114
/**
115
 * Sets the given tag in m, overwriting an existing tag.
116
 * @param key tag key to add to m (will be av_strduped depending on flags)
117
 * @param value tag value to add to m (will be av_strduped depending on flags)
118
 * @return >= 0 on success otherwise an error code <0
119
 */
120
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags);
109 121

  
110 122
/**
111 123
 * Converts all the metadata sets from ctx according to the source and
libavformat/metadata.c
46 46
    return NULL;
47 47
}
48 48

  
49
int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
49
int av_metadata_set2(AVMetadata **pm, const char *key, const char *value, int flags)
50 50
{
51 51
    AVMetadata *m= *pm;
52 52
    AVMetadataTag *tag= av_metadata_get(m, key, NULL, AV_METADATA_MATCH_CASE);
......
66 66
            return AVERROR(ENOMEM);
67 67
    }
68 68
    if(value){
69
        if(flags & AV_METADATA_DONT_STRDUP_KEY){
70
            m->elems[m->count].key  = key;
71
        }else
69 72
        m->elems[m->count].key  = av_strdup(key  );
73
        if(flags & AV_METADATA_DONT_STRDUP_VAL){
74
            m->elems[m->count].value= value;
75
        }else
70 76
        m->elems[m->count].value= av_strdup(value);
71 77
        m->count++;
72 78
    }
......
78 84
    return 0;
79 85
}
80 86

  
87
#if LIBAVFORMAT_VERSION_MAJOR == 52
88
int av_metadata_set(AVMetadata **pm, const char *key, const char *value)
89
{
90
    return av_metadata_set2(pm, key, value, 0);
91
}
92
#endif
93

  
81 94
void av_metadata_free(AVMetadata **pm)
82 95
{
83 96
    AVMetadata *m= *pm;

Also available in: Unified diff