[FFmpeg-cvslog] r15540 - in trunk/libavformat: rdt.c rtp_h264.c rtp_internal.h rtsp.c
rbultje
subversion
Sat Oct 4 06:11:12 CEST 2008
Author: rbultje
Date: Sat Oct 4 06:11:12 2008
New Revision: 15540
Log:
Rename RTP payload contexts to PayloadContext, suggested by Luca in
"RDT/Realmedia patches #2" thread on ML.
Modified:
trunk/libavformat/rdt.c
trunk/libavformat/rtp_h264.c
trunk/libavformat/rtp_internal.h
trunk/libavformat/rtsp.c
Modified: trunk/libavformat/rdt.c
==============================================================================
--- trunk/libavformat/rdt.c (original)
+++ trunk/libavformat/rdt.c Sat Oct 4 06:11:12 2008
@@ -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 r
}
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_l
}
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, vo
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);
Modified: trunk/libavformat/rtp_h264.c
==============================================================================
--- trunk/libavformat/rtp_h264.c (original)
+++ trunk/libavformat/rtp_h264.c Sat Oct 4 06:11:12 2008
@@ -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(RTPDemuxCo
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(RTPDemuxCo
}
/* ---------------- 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);
Modified: trunk/libavformat/rtp_internal.h
==============================================================================
--- trunk/libavformat/rtp_internal.h (original)
+++ trunk/libavformat/rtp_internal.h Sat Oct 4 06:11:12 2008
@@ -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
// 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;
};
Modified: trunk/libavformat/rtsp.c
==============================================================================
--- trunk/libavformat/rtsp.c (original)
+++ trunk/libavformat/rtsp.c Sat Oct 4 06:11:12 2008
@@ -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);
More information about the ffmpeg-cvslog
mailing list