Revision 81ab1fa1 libavformat/sdp.c

View differences:

libavformat/sdp.c
111 111
    return buff;
112 112
}
113 113

  
114
static char *extradata2config(const uint8_t *extradata, int extradata_size)
114
static char *extradata2config(AVCodecContext *c)
115 115
{
116 116
    char *config;
117 117

  
118
    if (extradata_size > MAX_EXTRADATA_SIZE) {
119
        av_log(NULL, AV_LOG_ERROR, "Too many extra data!\n");
118
    if (c->extradata_size > MAX_EXTRADATA_SIZE) {
119
        av_log(c, AV_LOG_ERROR, "Too many extra data!\n");
120 120

  
121 121
        return NULL;
122 122
    }
123
    config = av_malloc(10 + extradata_size * 2);
123
    config = av_malloc(10 + c->extradata_size * 2);
124 124
    if (config == NULL) {
125
        av_log(NULL, AV_LOG_ERROR, "Cannot allocate memory for the config info\n");
125
        av_log(c, AV_LOG_ERROR, "Cannot allocate memory for the config info\n");
126 126
        return NULL;
127 127
    }
128 128
    memcpy(config, "; config=", 9);
129
    data_to_hex(config + 9, extradata, extradata_size);
130
    config[9 + extradata_size * 2] = 0;
129
    data_to_hex(config + 9, c->extradata, c->extradata_size);
130
    config[9 + c->extradata_size * 2] = 0;
131 131

  
132 132
    return config;
133 133
}
......
139 139
    switch (c->codec_id) {
140 140
        case CODEC_ID_MPEG4:
141 141
            if (c->extradata_size) {
142
                config = extradata2config(c->extradata, c->extradata_size);
142
                config = extradata2config(c);
143 143
            }
144 144
            av_strlcatf(buff, size, "a=rtpmap:%d MP4V-ES/90000\r\n"
145 145
                                    "a=fmtp:%d profile-level-id=1%s\r\n",
......
148 148
            break;
149 149
        case CODEC_ID_AAC:
150 150
            if (c->extradata_size) {
151
                config = extradata2config(c->extradata, c->extradata_size);
151
                config = extradata2config(c);
152 152
            } else {
153 153
                /* FIXME: maybe we can forge config information based on the
154 154
                 *        codec parameters...
155 155
                 */
156
                av_log(NULL, AV_LOG_ERROR, "AAC with no global headers is currently not supported\n");
156
                av_log(c, AV_LOG_ERROR, "AAC with no global headers is currently not supported\n");
157 157
                return NULL;
158 158
            }
159 159
            if (config == NULL) {

Also available in: Unified diff