aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/rtp.c
diff options
context:
space:
mode:
authorRafaël Carré <rafael.carre@savoirfairelinux.com>2011-09-26 11:56:48 -0400
committerMartin Storsjö <martin@martin.st>2011-09-26 21:54:57 +0300
commit9152880e9503f193032304c65c78b297171c81ee (patch)
treeb1f9392ffd369b55d3ac5346d9acf38bb9b019f5 /libavformat/rtp.c
parent142887741fceed6de63a64e21cfca1944c2be889 (diff)
downloadffmpeg-9152880e9503f193032304c65c78b297171c81ee.tar.gz
rtpenc: Add a payload type private option
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ö <martin@martin.st>
Diffstat (limited to 'libavformat/rtp.c')
-rw-r--r--libavformat/rtp.c11
1 files changed, 10 insertions, 1 deletions
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 <libavutil/opt.h>
#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)