diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2008-10-04 04:11:12 +0000 |
---|---|---|
committer | Ronald S. Bultje <rsbultje@gmail.com> | 2008-10-04 04:11:12 +0000 |
commit | ed0aacc76eccf2b523352f0c74107e2f6ba9cf93 (patch) | |
tree | c6d6eb117f212699a5545135927130a31e7a11e9 | |
parent | dd990075d62a981283de008b43cea0556fa81959 (diff) | |
download | ffmpeg-ed0aacc76eccf2b523352f0c74107e2f6ba9cf93.tar.gz |
Rename RTP payload contexts to PayloadContext, suggested by Luca in
"RDT/Realmedia patches #2" thread on ML.
Originally committed as revision 15540 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/rdt.c | 23 | ||||
-rw-r--r-- | libavformat/rtp_h264.c | 20 | ||||
-rw-r--r-- | libavformat/rtp_internal.h | 9 | ||||
-rw-r--r-- | libavformat/rtsp.c | 2 |
4 files changed, 25 insertions, 29 deletions
diff --git a/libavformat/rdt.c b/libavformat/rdt.c index c65e1d5e34..1fa36df04d 100644 --- a/libavformat/rdt.c +++ b/libavformat/rdt.c @@ -34,13 +34,13 @@ #include "rm.h" #include "internal.h" -typedef struct rdt_data { +struct PayloadContext { AVFormatContext *rmctx; uint8_t *mlti_data; unsigned int mlti_data_size; uint32_t prev_sn, prev_ts; char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE]; -} rdt_data; +}; void ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], @@ -82,7 +82,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9], } static int -rdt_load_mdpr (rdt_data *rdt, AVStream *st, int rule_nr) +rdt_load_mdpr (PayloadContext *rdt, AVStream *st, int rule_nr) { ByteIOContext *pb; int size; @@ -166,7 +166,7 @@ static int rdt_parse_packet (RTPDemuxContext *s, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, int flags) { - rdt_data *rdt = s->dynamic_protocol_context; + PayloadContext *rdt = s->dynamic_protocol_context; int seq = 1, res; ByteIOContext *pb = rdt->rmctx->pb; RMContext *rm = rdt->rmctx->priv_data; @@ -206,7 +206,7 @@ int ff_rdt_parse_packet(RTPDemuxContext *s, AVPacket *pkt, const uint8_t *buf, int len) { - rdt_data *rdt = s->dynamic_protocol_context; + PayloadContext *rdt = s->dynamic_protocol_context; int seq, flags = 0, rule, sn; uint32_t timestamp; int rv= 0; @@ -252,7 +252,7 @@ void ff_rdt_subscribe_rule2 (RTPDemuxContext *s, char *cmd, int size, int stream_nr, int rule_nr) { - rdt_data *rdt = s->dynamic_protocol_context; + PayloadContext *rdt = s->dynamic_protocol_context; rdt_load_mdpr(rdt, s->st, rule_nr * 2); } @@ -273,9 +273,8 @@ rdt_parse_b64buf (unsigned int *target_len, const char *p) } static int -rdt_parse_sdp_line (AVStream *stream, void *d, const char *line) +rdt_parse_sdp_line (AVStream *stream, PayloadContext *rdt, const char *line) { - rdt_data *rdt = d; const char *p = line; if (av_strstart(p, "OpaqueData:buffer;", &p)) { @@ -286,10 +285,10 @@ rdt_parse_sdp_line (AVStream *stream, void *d, const char *line) return 0; } -static void * +static PayloadContext * rdt_new_extradata (void) { - rdt_data *rdt = av_mallocz(sizeof(rdt_data)); + PayloadContext *rdt = av_mallocz(sizeof(PayloadContext)); av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL); rdt->prev_ts = -1; @@ -299,10 +298,8 @@ rdt_new_extradata (void) } static void -rdt_free_extradata (void *d) +rdt_free_extradata (PayloadContext *rdt) { - rdt_data *rdt = d; - if (rdt->rmctx) av_close_input_stream(rdt->rmctx); av_freep(&rdt->mlti_data); diff --git a/libavformat/rtp_h264.c b/libavformat/rtp_h264.c index c83b3a7178..861798bcb1 100644 --- a/libavformat/rtp_h264.c +++ b/libavformat/rtp_h264.c @@ -52,7 +52,7 @@ /** RTP/H264 specific private data. */ -typedef struct h264_rtp_extra_data { +struct PayloadContext { unsigned long cookie; ///< sanity check, to make sure we get the pointer we're expecting. //sdp setup parameters @@ -63,14 +63,14 @@ typedef struct h264_rtp_extra_data { #ifdef DEBUG int packet_types_received[32]; #endif -} h264_rtp_extra_data; +}; #define MAGIC_COOKIE (0xdeadbeef) ///< Cookie for the extradata; to verify we are what we think we are, and that we haven't been freed. #define DEAD_COOKIE (0xdeaddead) ///< Cookie for the extradata; once it is freed. /* ---------------- private code */ static void sdp_parse_fmtp_config_h264(AVStream * stream, - h264_rtp_extra_data * h264_data, + PayloadContext * h264_data, char *attr, char *value) { AVCodecContext *codec = stream->codec; @@ -166,7 +166,7 @@ static int h264_handle_packet(RTPDemuxContext * s, int len, int flags) { #ifdef DEBUG - h264_rtp_extra_data *data = s->dynamic_protocol_context; + PayloadContext *data = s->dynamic_protocol_context; #endif uint8_t nal = buf[0]; uint8_t type = (nal & 0x1f); @@ -315,10 +315,10 @@ static int h264_handle_packet(RTPDemuxContext * s, } /* ---------------- public code */ -static void *h264_new_extradata(void) +static PayloadContext *h264_new_extradata(void) { - h264_rtp_extra_data *data = - av_mallocz(sizeof(h264_rtp_extra_data) + + PayloadContext *data = + av_mallocz(sizeof(PayloadContext) + FF_INPUT_BUFFER_PADDING_SIZE); if (data) { @@ -328,9 +328,8 @@ static void *h264_new_extradata(void) return data; } -static void h264_free_extradata(void *d) +static void h264_free_extradata(PayloadContext *data) { - h264_rtp_extra_data *data = (h264_rtp_extra_data *) d; #ifdef DEBUG int ii; @@ -351,11 +350,10 @@ static void h264_free_extradata(void *d) av_free(data); } -static int parse_h264_sdp_line(AVStream * stream, void *data, +static int parse_h264_sdp_line(AVStream * stream, PayloadContext *h264_data, const char *line) { AVCodecContext *codec = stream->codec; - h264_rtp_extra_data *h264_data = (h264_rtp_extra_data *) data; const char *p = line; assert(h264_data->cookie == MAGIC_COOKIE); diff --git a/libavformat/rtp_internal.h b/libavformat/rtp_internal.h index fdfb8ff02f..c1d9001a17 100644 --- a/libavformat/rtp_internal.h +++ b/libavformat/rtp_internal.h @@ -41,6 +41,7 @@ typedef struct { uint32_t jitter; ///< estimated jitter. } RTPStatistics; +typedef struct PayloadContext PayloadContext; /** * Packet parsing for "private" payloads in the RTP specs. * @@ -65,10 +66,10 @@ typedef struct RTPDynamicProtocolHandler_s { // may be null int (*parse_sdp_a_line) (AVStream * stream, - void *protocol_data, + PayloadContext *priv_data, const char *line); ///< Parse the a= line from the sdp field - void *(*open) (); ///< allocate any data needed by the rtp parsing for this dynamic data. - void (*close)(void *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data. + PayloadContext *(*open) (); ///< allocate any data needed by the rtp parsing for this dynamic data. + void (*close)(PayloadContext *protocol_data); ///< free any data needed by the rtp parsing for this dynamic data. DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet. struct RTPDynamicProtocolHandler_s *next; @@ -113,7 +114,7 @@ struct RTPDemuxContext { /* dynamic payload stuff */ DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure - void *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me. + PayloadContext *dynamic_protocol_context; ///< This is a copy from the values setup from the sdp parsing, in rtsp.c don't free me. int max_frames_per_packet; }; diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c index 413aadde95..f6d985968c 100644 --- a/libavformat/rtsp.c +++ b/libavformat/rtsp.c @@ -92,7 +92,7 @@ typedef struct RTSPStream { rtp_payload_data_t rtp_payload_data; /* rtp payload parsing infos from SDP */ RTPDynamicProtocolHandler *dynamic_handler; ///< Only valid if it's a dynamic protocol. (This is the handler structure) - void *dynamic_protocol_context; ///< Only valid if it's a dynamic protocol. (This is any private data associated with the dynamic protocol) + PayloadContext *dynamic_protocol_context; ///< Only valid if it's a dynamic protocol. (This is any private data associated with the dynamic protocol) } RTSPStream; static int rtsp_read_play(AVFormatContext *s); |