static int sdp_parse_rtpmap(AVFormatContext *s,

                            AVCodecContext *codec, RTSPStream *rtsp_st,

                            int payload_type, const char *p)

{

    char buf[256];

    int i;

    AVCodec *c;

    const char *c_name;



    /* Loop into AVRtpDynamicPayloadTypes[] and AVRtpPayloadTypes[] and

     * see if we can handle this kind of payload.

     * The space should normally not be there but some Real streams or

     * particular servers ("RealServer Version 6.1.3.970", see issue 1658)

     * have a trailing space. */

    get_word_sep(buf, sizeof(buf), "/ ", &p);

    if (payload_type >= RTP_PT_PRIVATE) {

        RTPDynamicProtocolHandler *handler;

        for (handler = RTPFirstDynamicPayloadHandler;

             handler; handler = handler->next) {

            if (!strcasecmp(buf, handler->enc_name) &&

                codec->codec_type == handler->codec_type) {

                codec->codec_id          = handler->codec_id;

                rtsp_st->dynamic_handler = handler;

                if (handler->open)

                    rtsp_st->dynamic_protocol_context = handler->open();

                break;

            }

        }

    } else {

        /* We are in a standard case

         * (from http://www.iana.org/assignments/rtp-parameters). */

        /* search into AVRtpPayloadTypes[] */

        codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);

    }



    c = avcodec_find_decoder(codec->codec_id);

    if (c && c->name)

        c_name = c->name;

    else

        c_name = (char *) NULL;



    if (c_name) {

        get_word_sep(buf, sizeof(buf), "/", &p);

        i = atoi(buf);

        switch (codec->codec_type) {

        case CODEC_TYPE_AUDIO:

            av_log(s, AV_LOG_DEBUG, "audio codec set to: %s\n", c_name);

            codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;

            codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;

            if (i > 0) {

                codec->sample_rate = i;

                get_word_sep(buf, sizeof(buf), "/", &p);

                i = atoi(buf);

                if (i > 0)

                    codec->channels = i;

                // TODO: there is a bug here; if it is a mono stream, and

                // less than 22000Hz, faad upconverts to stereo and twice

                // the frequency.  No problem, but the sample rate is being

                // set here by the sdp line. Patch on its way. (rdm)

            }

            av_log(s, AV_LOG_DEBUG, "audio samplerate set to: %i\n",

                   codec->sample_rate);

            av_log(s, AV_LOG_DEBUG, "audio channels set to: %i\n",

                   codec->channels);

            break;

        case CODEC_TYPE_VIDEO:

            av_log(s, AV_LOG_DEBUG, "video codec set to: %s\n", c_name);

            break;

        default:

            break;

        }

        return 0;

    }



    return -1;

}

static int sdp_parse_rtpmap(AVFormatContext *s,

                            AVCodecContext *codec, RTSPStream *rtsp_st,

                            int payload_type, const char *p)

{

    char buf[256];

    int i;

    AVCodec *c;

    const char *c_name;



    









    get_word_sep(buf, sizeof(buf), "/ ", &p);

    if (payload_type >= RTP_PT_PRIVATE) {

        RTPDynamicProtocolHandler *handler;

        for (handler = RTPFirstDynamicPayloadHandler;

             handler; handler = handler->next) {

            if (!strcasecmp(buf, handler->enc_name) &&

                codec->codec_type == handler->codec_type) {

                codec->codec_id          = handler->codec_id;

                rtsp_st->dynamic_handler = handler;

                if (handler->open)

                    rtsp_st->dynamic_protocol_context = handler->open();

                break;

            }

        }

    } else {

        



        

        codec->codec_id = ff_rtp_codec_id(buf, codec->codec_type);

    }



    c = avcodec_find_decoder(codec->codec_id);

    if (c && c->name)

        c_name = c->name;

    else

        c_name = (char *) NULL;



    if (c_name) {

        get_word_sep(buf, sizeof(buf), "/", &p);

        i = atoi(buf);

        switch (codec->codec_type) {

        case CODEC_TYPE_AUDIO:

            av_log(s, AV_LOG_DEBUG, "audio codec set to: %s\n", c_name);

            codec->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;

            codec->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;

            if (i > 0) {

                codec->sample_rate = i;

                get_word_sep(buf, sizeof(buf), "/", &p);

                i = atoi(buf);

                if (i > 0)

                    codec->channels = i;

                

                

                

                

            }

            av_log(s, AV_LOG_DEBUG, "audio samplerate set to: %i\n",

                   codec->sample_rate);

            av_log(s, AV_LOG_DEBUG, "audio channels set to: %i\n",

                   codec->channels);

            break;

        case CODEC_TYPE_VIDEO:

            av_log(s, AV_LOG_DEBUG, "video codec set to: %s\n", c_name);

            break;

        default:

            break;

        }

        return 0;

    }



    return -1;

}

        c_name = (char *) NULL;     if (c_name) {     return -1;
static int FUNC_0(AVFormatContext *VAR_0,

                            AVCodecContext *VAR_1, RTSPStream *VAR_2,

                            int VAR_3, const char *VAR_4)

{

    char VAR_5[256];

    int VAR_6;

    AVCodec *c;

    const char *VAR_7;



    









    get_word_sep(VAR_5, sizeof(VAR_5), "/ ", &VAR_4);

    if (VAR_3 >= RTP_PT_PRIVATE) {

        RTPDynamicProtocolHandler *handler;

        for (handler = RTPFirstDynamicPayloadHandler;

             handler; handler = handler->next) {

            if (!strcasecmp(VAR_5, handler->enc_name) &&

                VAR_1->codec_type == handler->codec_type) {

                VAR_1->codec_id          = handler->codec_id;

                VAR_2->dynamic_handler = handler;

                if (handler->open)

                    VAR_2->dynamic_protocol_context = handler->open();

                break;

            }

        }

    } else {

        



        

        VAR_1->codec_id = ff_rtp_codec_id(VAR_5, VAR_1->codec_type);

    }



    c = avcodec_find_decoder(VAR_1->codec_id);

    if (c && c->name)

        VAR_7 = c->name;

    else

        VAR_7 = (char *) NULL;



    if (VAR_7) {

        get_word_sep(VAR_5, sizeof(VAR_5), "/", &VAR_4);

        VAR_6 = atoi(VAR_5);

        switch (VAR_1->codec_type) {

        case CODEC_TYPE_AUDIO:

            av_log(VAR_0, AV_LOG_DEBUG, "audio VAR_1 set to: %VAR_0\n", VAR_7);

            VAR_1->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE;

            VAR_1->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS;

            if (VAR_6 > 0) {

                VAR_1->sample_rate = VAR_6;

                get_word_sep(VAR_5, sizeof(VAR_5), "/", &VAR_4);

                VAR_6 = atoi(VAR_5);

                if (VAR_6 > 0)

                    VAR_1->channels = VAR_6;

                

                

                

                

            }

            av_log(VAR_0, AV_LOG_DEBUG, "audio samplerate set to: %VAR_6\n",

                   VAR_1->sample_rate);

            av_log(VAR_0, AV_LOG_DEBUG, "audio channels set to: %VAR_6\n",

                   VAR_1->channels);

            break;

        case CODEC_TYPE_VIDEO:

            av_log(VAR_0, AV_LOG_DEBUG, "video VAR_1 set to: %VAR_0\n", VAR_7);

            break;

        default:

            break;

        }

        return 0;

    }



    return -1;

}

static int FUNC_0(AVFormatContext *VAR_0,
AVCodecContext *VAR_1, RTSPStream *VAR_2,
int VAR_3, const char *VAR_4)
{ char VAR_5[256]; int VAR_6; AVCodec *c; const char *VAR_7; get_word_sep(VAR_5, sizeof(VAR_5), "/ ", &VAR_4); if (VAR_3 >= RTP_PT_PRIVATE) { RTPDynamicProtocolHandler *handler; for (handler = RTPFirstDynamicPayloadHandler; handler; handler = handler->next) { if (!strcasecmp(VAR_5, handler->enc_name) &&
VAR_1->codec_type == handler->codec_type) { VAR_1->codec_id          = handler->codec_id; VAR_2->dynamic_handler = handler; if (handler->open)
VAR_2->dynamic_protocol_context = handler->open(); break; } } } else { VAR_1->codec_id = ff_rtp_codec_id(VAR_5, VAR_1->codec_type); } c = avcodec_find_decoder(VAR_1->codec_id); if (c && c->name)
VAR_7 = c->name; else
VAR_7 = (char *) NULL; if (VAR_7) { get_word_sep(VAR_5, sizeof(VAR_5), "/", &VAR_4); VAR_6 = atoi(VAR_5); switch (VAR_1->codec_type) { case CODEC_TYPE_AUDIO:
av_log(VAR_0, AV_LOG_DEBUG, "audio VAR_1 set to: %VAR_0\n", VAR_7); VAR_1->sample_rate = RTSP_DEFAULT_AUDIO_SAMPLERATE; VAR_1->channels = RTSP_DEFAULT_NB_AUDIO_CHANNELS; if (VAR_6 > 0) { VAR_1->sample_rate = VAR_6; get_word_sep(VAR_5, sizeof(VAR_5), "/", &VAR_4); VAR_6 = atoi(VAR_5); if (VAR_6 > 0)
VAR_1->channels = VAR_6; } av_log(VAR_0, AV_LOG_DEBUG, "audio samplerate set to: %VAR_6\n",
VAR_1->sample_rate); av_log(VAR_0, AV_LOG_DEBUG, "audio channels set to: %VAR_6\n",
VAR_1->channels); break; case CODEC_TYPE_VIDEO:
av_log(VAR_0, AV_LOG_DEBUG, "video VAR_1 set to: %VAR_0\n", VAR_7); break; default:
break; } return 0; } return -1; }