From 9152880e9503f193032304c65c78b297171c81ee Mon Sep 17 00:00:00 2001 From: Rafaël Carré Date: Mon, 26 Sep 2011 11:56:48 -0400 Subject: rtpenc: Add a payload type private option MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Specifying the payload type is useful when the type number has already been negotiated before creating the stream, for example in SIP protocol. Signed-off-by: Martin Storsjö --- libavformat/rtp.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'libavformat/rtp.c') diff --git a/libavformat/rtp.c b/libavformat/rtp.c index 35edb5066a..5dee4362db 100644 --- a/libavformat/rtp.c +++ b/libavformat/rtp.c @@ -19,6 +19,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "avformat.h" #include "rtp.h" @@ -89,9 +90,17 @@ int ff_rtp_get_codec_info(AVCodecContext *codec, int payload_type) return -1; } -int ff_rtp_get_payload_type(AVCodecContext *codec) +int ff_rtp_get_payload_type(AVFormatContext *fmt, AVCodecContext *codec) { int i, payload_type; + 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) -- cgit v1.2.3