Commit 99a1d191 authored by Ronald S. Bultje's avatar Ronald S. Bultje

Remove access into RTPDemuxContext in rtsp.c, which allows making it opaque

(and thus preparing for the introduction of RDTDemuxContext) in a next patch.
See discussion in "RDT/Realmedia patches #2" thread on ML.

Originally committed as revision 15542 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 9b932b8a
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "avformat.h" #include "avformat.h"
typedef struct PayloadContext PayloadContext;
typedef struct RTPDynamicProtocolHandler_s RTPDynamicProtocolHandler;
#define RTP_MIN_PACKET_LENGTH 12 #define RTP_MIN_PACKET_LENGTH 12
#define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */ #define RTP_MAX_PACKET_LENGTH 1500 /* XXX: suppress this define */
...@@ -35,6 +38,8 @@ int rtp_get_payload_type(AVCodecContext *codec); ...@@ -35,6 +38,8 @@ int rtp_get_payload_type(AVCodecContext *codec);
typedef struct RTPDemuxContext RTPDemuxContext; typedef struct RTPDemuxContext RTPDemuxContext;
typedef struct rtp_payload_data_s rtp_payload_data_s; typedef struct rtp_payload_data_s rtp_payload_data_s;
RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data); RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *rtpc, int payload_type, rtp_payload_data_s *rtp_payload_data);
void rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
RTPDynamicProtocolHandler *handler);
int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt, int rtp_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
const uint8_t *buf, int len); const uint8_t *buf, int len);
void rtp_parse_close(RTPDemuxContext *s); void rtp_parse_close(RTPDemuxContext *s);
......
...@@ -41,7 +41,6 @@ typedef struct { ...@@ -41,7 +41,6 @@ typedef struct {
uint32_t jitter; ///< estimated jitter. uint32_t jitter; ///< estimated jitter.
} RTPStatistics; } RTPStatistics;
typedef struct PayloadContext PayloadContext;
/** /**
* Packet parsing for "private" payloads in the RTP specs. * Packet parsing for "private" payloads in the RTP specs.
* *
...@@ -60,7 +59,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (PayloadContext *s, ...@@ -60,7 +59,7 @@ typedef int (*DynamicPayloadPacketHandlerProc) (PayloadContext *s,
const uint8_t * buf, const uint8_t * buf,
int len, int flags); int len, int flags);
typedef struct RTPDynamicProtocolHandler_s { struct RTPDynamicProtocolHandler_s {
// fields from AVRtpDynamicPayloadType_s // fields from AVRtpDynamicPayloadType_s
const char enc_name[50]; /* XXX: still why 50 ? ;-) */ const char enc_name[50]; /* XXX: still why 50 ? ;-) */
enum CodecType codec_type; enum CodecType codec_type;
...@@ -75,7 +74,7 @@ typedef struct RTPDynamicProtocolHandler_s { ...@@ -75,7 +74,7 @@ typedef struct RTPDynamicProtocolHandler_s {
DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet. DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
struct RTPDynamicProtocolHandler_s *next; struct RTPDynamicProtocolHandler_s *next;
} RTPDynamicProtocolHandler; };
// moved out of rtp.c, because the h264 decoder needs to know about this structure.. // moved out of rtp.c, because the h264 decoder needs to know about this structure..
struct RTPDemuxContext { struct RTPDemuxContext {
......
...@@ -311,6 +311,14 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r ...@@ -311,6 +311,14 @@ RTPDemuxContext *rtp_parse_open(AVFormatContext *s1, AVStream *st, URLContext *r
return s; return s;
} }
void
rtp_parse_set_dynamic_protocol(RTPDemuxContext *s, PayloadContext *ctx,
RTPDynamicProtocolHandler *handler)
{
s->dynamic_protocol_context = ctx;
s->parse_packet = handler->parse_packet;
}
static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf) static int rtp_parse_mp4_au(RTPDemuxContext *s, const uint8_t *buf)
{ {
int au_headers_length, au_header_size, i; int au_headers_length, au_header_size, i;
......
...@@ -900,8 +900,9 @@ rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st) ...@@ -900,8 +900,9 @@ rtsp_open_transport_ctx(AVFormatContext *s, RTSPStream *rtsp_st)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} else { } else {
if(rtsp_st->dynamic_handler) { if(rtsp_st->dynamic_handler) {
rtsp_st->rtp_ctx->dynamic_protocol_context= rtsp_st->dynamic_protocol_context; rtp_parse_set_dynamic_protocol(rtsp_st->rtp_ctx,
rtsp_st->rtp_ctx->parse_packet= rtsp_st->dynamic_handler->parse_packet; rtsp_st->dynamic_protocol_context,
rtsp_st->dynamic_handler);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment