static void sdp_parse_fmtp_config_h264(AVStream * stream,
                                       h264_rtp_extra_data * h264_data,
                                       char *attr, char *value)
{
    AVCodecContext *codec = stream->codec;
    assert(codec->codec_id == CODEC_ID_H264);
    assert(h264_data != NULL);
    if (!strcmp(attr, "packetization-mode")) {
        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Packetization Mode: %d\n", atoi(value));
        h264_data->packetization_mode = atoi(value);
        if (h264_data->packetization_mode > 1)
            av_log(stream, AV_LOG_ERROR,
                   "H.264/RTP Interleaved RTP mode is not supported yet.");
    } else if (!strcmp(attr, "profile-level-id")) {
        if (strlen(value) == 6) {
            char buffer[3];
            uint8_t profile_idc;
            uint8_t profile_iop;
            uint8_t level_idc;
            buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = '\0';
            profile_idc = strtol(buffer, NULL, 16);
            buffer[0] = value[2]; buffer[1] = value[3];
            profile_iop = strtol(buffer, NULL, 16);
            buffer[0] = value[4]; buffer[1] = value[5];
            level_idc = strtol(buffer, NULL, 16);
            av_log(NULL, AV_LOG_DEBUG,
                   "H.264/RTP Profile IDC: %x Profile IOP: %x Level: %x\n",
                   profile_idc, profile_iop, level_idc);
            h264_data->profile_idc = profile_idc;
            h264_data->profile_iop = profile_iop;
            h264_data->level_idc = level_idc;
        }
    } else  if (!strcmp(attr, "sprop-parameter-sets")) {
        uint8_t start_sequence[]= { 0, 0, 1 };
        codec->extradata_size= 0;
        codec->extradata= NULL;
        while (*value) {
            char base64packet[1024];
            uint8_t decoded_packet[1024];
            uint32_t packet_size;
            char *dst = base64packet;
            while (*value && *value != ','
                   && (dst - base64packet) < sizeof(base64packet) - 1) {
                *dst++ = *value++;
            }
            *dst++ = '\0';
            if (*value == ',')
                value++;
            packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));
            if (packet_size) {
                uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size);
                if(dest)
                {
                    if(codec->extradata_size)
                    {
                        memcpy(dest, codec->extradata, codec->extradata_size);
                        av_free(codec->extradata);
                    }
                    memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));
                    memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);
                    codec->extradata= dest;
                    codec->extradata_size+= sizeof(start_sequence)+packet_size;
                } else {
                    av_log(NULL, AV_LOG_ERROR, "H.264/RTP Unable to allocate memory for extradata!");
                }
            }
        }
        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size);
    }
}
['static void sdp_parse_fmtp_config_h264(AVStream * stream,\n                                       h264_rtp_extra_data * h264_data,\n                                       char *attr, char *value)\n{\n    AVCodecContext *codec = stream->codec;\n    assert(codec->codec_id == CODEC_ID_H264);\n    assert(h264_data != NULL);\n    if (!strcmp(attr, "packetization-mode")) {\n        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Packetization Mode: %d\\n", atoi(value));\n        h264_data->packetization_mode = atoi(value);\n        if (h264_data->packetization_mode > 1)\n            av_log(stream, AV_LOG_ERROR,\n                   "H.264/RTP Interleaved RTP mode is not supported yet.");\n    } else if (!strcmp(attr, "profile-level-id")) {\n        if (strlen(value) == 6) {\n            char buffer[3];\n            uint8_t profile_idc;\n            uint8_t profile_iop;\n            uint8_t level_idc;\n            buffer[0] = value[0]; buffer[1] = value[1]; buffer[2] = \'\\0\';\n            profile_idc = strtol(buffer, NULL, 16);\n            buffer[0] = value[2]; buffer[1] = value[3];\n            profile_iop = strtol(buffer, NULL, 16);\n            buffer[0] = value[4]; buffer[1] = value[5];\n            level_idc = strtol(buffer, NULL, 16);\n            av_log(NULL, AV_LOG_DEBUG,\n                   "H.264/RTP Profile IDC: %x Profile IOP: %x Level: %x\\n",\n                   profile_idc, profile_iop, level_idc);\n            h264_data->profile_idc = profile_idc;\n            h264_data->profile_iop = profile_iop;\n            h264_data->level_idc = level_idc;\n        }\n    } else  if (!strcmp(attr, "sprop-parameter-sets")) {\n        uint8_t start_sequence[]= { 0, 0, 1 };\n        codec->extradata_size= 0;\n        codec->extradata= NULL;\n        while (*value) {\n            char base64packet[1024];\n            uint8_t decoded_packet[1024];\n            uint32_t packet_size;\n            char *dst = base64packet;\n            while (*value && *value != \',\'\n                   && (dst - base64packet) < sizeof(base64packet) - 1) {\n                *dst++ = *value++;\n            }\n            *dst++ = \'\\0\';\n            if (*value == \',\')\n                value++;\n            packet_size= av_base64_decode(decoded_packet, base64packet, sizeof(decoded_packet));\n            if (packet_size) {\n                uint8_t *dest= av_malloc(packet_size+sizeof(start_sequence)+codec->extradata_size);\n                if(dest)\n                {\n                    if(codec->extradata_size)\n                    {\n                        memcpy(dest, codec->extradata, codec->extradata_size);\n                        av_free(codec->extradata);\n                    }\n                    memcpy(dest+codec->extradata_size, start_sequence, sizeof(start_sequence));\n                    memcpy(dest+codec->extradata_size+sizeof(start_sequence), decoded_packet, packet_size);\n                    codec->extradata= dest;\n                    codec->extradata_size+= sizeof(start_sequence)+packet_size;\n                } else {\n                    av_log(NULL, AV_LOG_ERROR, "H.264/RTP Unable to allocate memory for extradata!");\n                }\n            }\n        }\n        av_log(NULL, AV_LOG_DEBUG, "H.264/RTP Extradata set to %p (size: %d)!", codec->extradata, codec->extradata_size);\n    }\n}', "int av_base64_decode(uint8_t * out, const char *in, int out_length)\n{\n    int i, v;\n    uint8_t *dst = out;\n    v = 0;\n    for (i = 0; in[i] && in[i] != '='; i++) {\n        unsigned int index= in[i]-43;\n        if (index>=(sizeof(map2)/sizeof(map2[0])) || map2[index] == 0xff)\n            return -1;\n        v = (v << 6) + map2[index];\n        if (i & 3) {\n            if (dst - out < out_length) {\n                *dst++ = v >> (6 - 2 * (i & 3));\n            }\n        }\n    }\n    return (dst - out);\n}"]