diff options
author | Rafaël Carré <rafael.carre@savoirfairelinux.com> | 2011-09-26 11:56:49 -0400 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2011-09-26 21:55:27 +0300 |
commit | 1430ae44e82074cc4edee508f11431a0d0fcbe12 (patch) | |
tree | 8033ced94cc3abe0ddbdfe5381c0441b0e49c8b3 /libavformat | |
parent | 9152880e9503f193032304c65c78b297171c81ee (diff) | |
download | ffmpeg-streaming-1430ae44e82074cc4edee508f11431a0d0fcbe12.zip ffmpeg-streaming-1430ae44e82074cc4edee508f11431a0d0fcbe12.tar.gz |
rtp: Simplify ff_rtp_get_payload_type
Signed-off-by: Martin Storsjö <martin@martin.st>
Diffstat (limited to 'libavformat')
-rw-r--r-- | libavformat/rtp.c | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 5dee436..bb4bc17 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -92,32 +92,29 @@ int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type) int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec) { - int i, payload_type; + int i; AVOutputFormat *ofmt = fmt ? fmt->oformat : NULL; /* Was the payload type already specified for the RTP muxer? */ - if (ofmt && ofmt->priv_class) - payload_type = av_get_int(fmt->priv_data, "payload_type", NULL); - - if (payload_type >= 0) - return payload_type; - - /* compute the payload type */ - for (payload_type = -1, i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i) + if (ofmt && ofmt->priv_class) { + int payload_type = av_get_int(fmt->priv_data, "payload_type", NULL); + if (payload_type >= 0) + return payload_type; + } + + /* static payload type */ + for (i = 0; AVRtpPayloadTypes[i].pt >= 0; ++i) if (AVRtpPayloadTypes[i].codec_id == codec->codec_id) { if (codec->codec_id == CODEC_ID_H263) continue; if (codec->codec_id == CODEC_ID_PCM_S16BE) if (codec->channels != AVRtpPayloadTypes[i].audio_channels) continue; - payload_type = AVRtpPayloadTypes[i].pt; + return AVRtpPayloadTypes[i].pt; } /* dynamic payload type */ - if (payload_type < 0) - payload_type = RTP_PT_PRIVATE + (codec->codec_type == AVMEDIA_TYPE_AUDIO); - - return payload_type; + return RTP_PT_PRIVATE + (codec->codec_type == AVMEDIA_TYPE_AUDIO); } const char *ff_rtp_enc_name(int payload_type) |