On 9/26/11 5:56 PM, Rafaël Carré wrote:
From: Rafaël 
Carré<rafael.carre-4ysUXcep3aM1wj+D4I0NRVaTQe2KTcn/@public.gmane.org>

Specifying the payload type is useful when the type number has
already been negotiated before creating the stream, for example
in SIP protocol.
---
  libavformat/rtp.c    |   11 ++++++++++-
  libavformat/rtp.h    |    6 ++++--
  libavformat/rtpenc.c |    4 +++-
  libavformat/sdp.c    |    2 +-
  4 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/libavformat/rtp.c b/libavformat/rtp.c
index 35edb50..7b6639d 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;

what happens if ofmt->priv_class == NULL?

and I'm not sure about using fmt->priv_data...

2 and 3 might be squashed together.

lu
_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to