Mercurial > libavformat.hg
changeset 3975:44561554cb7e libavformat
Rename RTP payload contexts to PayloadContext, suggested by Luca in
"RDT/Realmedia patches #2" thread on ML.
author | rbultje |
---|---|
date | Sat, 04 Oct 2008 04:11:12 +0000 |
parents | a8383d02c686 |
children | 64056a0c38ce |
files | rdt.c rtp_h264.c rtp_internal.h rtsp.c |
diffstat | 4 files changed, 25 insertions(+), 29 deletions(-) [+] |
line wrap: on
line diff
--- a/rdt.c Fri Oct 03 19:37:41 2008 +0000 +++ b/rdt.c Sat Oct 04 04:11:12 2008 +0000 @@ -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 @@ } 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 @@ 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 @@ 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 @@ 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 @@ } 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 @@ 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 @@ } 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);
--- a/rtp_h264.c Fri Oct 03 19:37:41 2008 +0000 +++ b/rtp_h264.c Sat Oct 04 04:11:12 2008 +0000 @@ -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 @@ #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 @@ 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 @@ } /* ---------------- 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 @@ 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 @@ 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);
--- a/rtp_internal.h Fri Oct 03 19:37:41 2008 +0000 +++ b/rtp_internal.h Sat Oct 04 04:11:12 2008 +0000 @@ -41,6 +41,7 @@ uint32_t jitter; ///< estimated jitter. } RTPStatistics; +typedef struct PayloadContext PayloadContext; /** * Packet parsing for "private" payloads in the RTP specs. * @@ -65,10 +66,10 @@ // 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 @@ /* 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; };
--- a/rtsp.c Fri Oct 03 19:37:41 2008 +0000 +++ b/rtsp.c Sat Oct 04 04:11:12 2008 +0000 @@ -92,7 +92,7 @@ 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);