switch(payload_type) { case RTP_PT_ULAW: codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_PCM_MULAW; codec->channels = 1; codec->sample_rate = 8000; break; case RTP_PT_ALAW: codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_PCM_ALAW; codec->channels = 1; codec->sample_rate = 8000; break; case RTP_PT_S16BE_STEREO: codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_PCM_S16BE; codec->channels = 2; codec->sample_rate = 44100; break; case RTP_PT_S16BE_MONO: codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_PCM_S16BE; codec->channels = 1; codec->sample_rate = 44100; break; case RTP_PT_MPEGAUDIO: codec->codec_type = CODEC_TYPE_AUDIO; codec->codec_id = CODEC_ID_MP2; break; case RTP_PT_JPEG: codec->codec_type = CODEC_TYPE_VIDEO; codec->codec_id = CODEC_ID_MJPEG; break; case RTP_PT_MPEGVIDEO: codec->codec_type = CODEC_TYPE_VIDEO; codec->codec_id = CODEC_ID_MPEG1VIDEO; break; case RTP_PT_MPEG2TS: codec->codec_type = CODEC_TYPE_DATA; codec->codec_id = CODEC_ID_MPEG2TS; break; default: return -1;
if (AVRtpPayloadTypes[payload_type].codec_id != CODEC_ID_NONE) { codec->codec_type = AVRtpPayloadTypes[payload_type].codec_type; codec->codec_id = AVRtpPayloadTypes[payload_type].codec_type; if (AVRtpPayloadTypes[payload_type].audio_channels > 0) codec->channels = AVRtpPayloadTypes[payload_type].audio_channels; if (AVRtpPayloadTypes[payload_type].clock_rate > 0) codec->sample_rate = AVRtpPayloadTypes[payload_type].clock_rate; return 0;
int rtp_get_codec_info(AVCodecContext *codec, int payload_type){    switch(payload_type) {    case RTP_PT_ULAW:        codec->codec_type = CODEC_TYPE_AUDIO;        codec->codec_id = CODEC_ID_PCM_MULAW;        codec->channels = 1;        codec->sample_rate = 8000;        break;    case RTP_PT_ALAW:        codec->codec_type = CODEC_TYPE_AUDIO;        codec->codec_id = CODEC_ID_PCM_ALAW;        codec->channels = 1;        codec->sample_rate = 8000;        break;    case RTP_PT_S16BE_STEREO:        codec->codec_type = CODEC_TYPE_AUDIO;        codec->codec_id = CODEC_ID_PCM_S16BE;        codec->channels = 2;        codec->sample_rate = 44100;        break;    case RTP_PT_S16BE_MONO:        codec->codec_type = CODEC_TYPE_AUDIO;        codec->codec_id = CODEC_ID_PCM_S16BE;        codec->channels = 1;        codec->sample_rate = 44100;        break;    case RTP_PT_MPEGAUDIO:        codec->codec_type = CODEC_TYPE_AUDIO;        codec->codec_id = CODEC_ID_MP2;        break;    case RTP_PT_JPEG:        codec->codec_type = CODEC_TYPE_VIDEO;        codec->codec_id = CODEC_ID_MJPEG;        break;    case RTP_PT_MPEGVIDEO:        codec->codec_type = CODEC_TYPE_VIDEO;        codec->codec_id = CODEC_ID_MPEG1VIDEO;        break;    case RTP_PT_MPEG2TS:        codec->codec_type = CODEC_TYPE_DATA;        codec->codec_id = CODEC_ID_MPEG2TS;        break;    default:        return -1;    }    return 0;}