mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
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
This commit is contained in:
parent
dd990075d6
commit
ed0aacc76e
@ -34,13 +34,13 @@
|
|||||||
#include "rm.h"
|
#include "rm.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
|
||||||
typedef struct rdt_data {
|
struct PayloadContext {
|
||||||
AVFormatContext *rmctx;
|
AVFormatContext *rmctx;
|
||||||
uint8_t *mlti_data;
|
uint8_t *mlti_data;
|
||||||
unsigned int mlti_data_size;
|
unsigned int mlti_data_size;
|
||||||
uint32_t prev_sn, prev_ts;
|
uint32_t prev_sn, prev_ts;
|
||||||
char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
|
char buffer[RTP_MAX_PACKET_LENGTH + FF_INPUT_BUFFER_PADDING_SIZE];
|
||||||
} rdt_data;
|
};
|
||||||
|
|
||||||
void
|
void
|
||||||
ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
|
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
|
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;
|
ByteIOContext *pb;
|
||||||
int size;
|
int size;
|
||||||
@ -166,7 +166,7 @@ static int
|
|||||||
rdt_parse_packet (RTPDemuxContext *s, AVPacket *pkt, uint32_t *timestamp,
|
rdt_parse_packet (RTPDemuxContext *s, AVPacket *pkt, uint32_t *timestamp,
|
||||||
const uint8_t *buf, int len, int flags)
|
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;
|
int seq = 1, res;
|
||||||
ByteIOContext *pb = rdt->rmctx->pb;
|
ByteIOContext *pb = rdt->rmctx->pb;
|
||||||
RMContext *rm = rdt->rmctx->priv_data;
|
RMContext *rm = rdt->rmctx->priv_data;
|
||||||
@ -206,7 +206,7 @@ int
|
|||||||
ff_rdt_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
|
ff_rdt_parse_packet(RTPDemuxContext *s, AVPacket *pkt,
|
||||||
const uint8_t *buf, int len)
|
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;
|
int seq, flags = 0, rule, sn;
|
||||||
uint32_t timestamp;
|
uint32_t timestamp;
|
||||||
int rv= 0;
|
int rv= 0;
|
||||||
@ -252,7 +252,7 @@ void
|
|||||||
ff_rdt_subscribe_rule2 (RTPDemuxContext *s, char *cmd, int size,
|
ff_rdt_subscribe_rule2 (RTPDemuxContext *s, char *cmd, int size,
|
||||||
int stream_nr, int rule_nr)
|
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);
|
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
|
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;
|
const char *p = line;
|
||||||
|
|
||||||
if (av_strstart(p, "OpaqueData:buffer;", &p)) {
|
if (av_strstart(p, "OpaqueData:buffer;", &p)) {
|
||||||
@ -286,10 +285,10 @@ rdt_parse_sdp_line (AVStream *stream, void *d, const char *line)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void *
|
static PayloadContext *
|
||||||
rdt_new_extradata (void)
|
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);
|
av_open_input_stream(&rdt->rmctx, NULL, "", &rdt_demuxer, NULL);
|
||||||
rdt->prev_ts = -1;
|
rdt->prev_ts = -1;
|
||||||
@ -299,10 +298,8 @@ rdt_new_extradata (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
rdt_free_extradata (void *d)
|
rdt_free_extradata (PayloadContext *rdt)
|
||||||
{
|
{
|
||||||
rdt_data *rdt = d;
|
|
||||||
|
|
||||||
if (rdt->rmctx)
|
if (rdt->rmctx)
|
||||||
av_close_input_stream(rdt->rmctx);
|
av_close_input_stream(rdt->rmctx);
|
||||||
av_freep(&rdt->mlti_data);
|
av_freep(&rdt->mlti_data);
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
/**
|
/**
|
||||||
RTP/H264 specific private data.
|
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.
|
unsigned long cookie; ///< sanity check, to make sure we get the pointer we're expecting.
|
||||||
|
|
||||||
//sdp setup parameters
|
//sdp setup parameters
|
||||||
@ -63,14 +63,14 @@ typedef struct h264_rtp_extra_data {
|
|||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int packet_types_received[32];
|
int packet_types_received[32];
|
||||||
#endif
|
#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 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.
|
#define DEAD_COOKIE (0xdeaddead) ///< Cookie for the extradata; once it is freed.
|
||||||
|
|
||||||
/* ---------------- private code */
|
/* ---------------- private code */
|
||||||
static void sdp_parse_fmtp_config_h264(AVStream * stream,
|
static void sdp_parse_fmtp_config_h264(AVStream * stream,
|
||||||
h264_rtp_extra_data * h264_data,
|
PayloadContext * h264_data,
|
||||||
char *attr, char *value)
|
char *attr, char *value)
|
||||||
{
|
{
|
||||||
AVCodecContext *codec = stream->codec;
|
AVCodecContext *codec = stream->codec;
|
||||||
@ -166,7 +166,7 @@ static int h264_handle_packet(RTPDemuxContext * s,
|
|||||||
int len, int flags)
|
int len, int flags)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
h264_rtp_extra_data *data = s->dynamic_protocol_context;
|
PayloadContext *data = s->dynamic_protocol_context;
|
||||||
#endif
|
#endif
|
||||||
uint8_t nal = buf[0];
|
uint8_t nal = buf[0];
|
||||||
uint8_t type = (nal & 0x1f);
|
uint8_t type = (nal & 0x1f);
|
||||||
@ -315,10 +315,10 @@ static int h264_handle_packet(RTPDemuxContext * s,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* ---------------- public code */
|
/* ---------------- public code */
|
||||||
static void *h264_new_extradata(void)
|
static PayloadContext *h264_new_extradata(void)
|
||||||
{
|
{
|
||||||
h264_rtp_extra_data *data =
|
PayloadContext *data =
|
||||||
av_mallocz(sizeof(h264_rtp_extra_data) +
|
av_mallocz(sizeof(PayloadContext) +
|
||||||
FF_INPUT_BUFFER_PADDING_SIZE);
|
FF_INPUT_BUFFER_PADDING_SIZE);
|
||||||
|
|
||||||
if (data) {
|
if (data) {
|
||||||
@ -328,9 +328,8 @@ static void *h264_new_extradata(void)
|
|||||||
return data;
|
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
|
#ifdef DEBUG
|
||||||
int ii;
|
int ii;
|
||||||
|
|
||||||
@ -351,11 +350,10 @@ static void h264_free_extradata(void *d)
|
|||||||
av_free(data);
|
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)
|
const char *line)
|
||||||
{
|
{
|
||||||
AVCodecContext *codec = stream->codec;
|
AVCodecContext *codec = stream->codec;
|
||||||
h264_rtp_extra_data *h264_data = (h264_rtp_extra_data *) data;
|
|
||||||
const char *p = line;
|
const char *p = line;
|
||||||
|
|
||||||
assert(h264_data->cookie == MAGIC_COOKIE);
|
assert(h264_data->cookie == MAGIC_COOKIE);
|
||||||
|
@ -41,6 +41,7 @@ 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.
|
||||||
*
|
*
|
||||||
@ -65,10 +66,10 @@ typedef struct RTPDynamicProtocolHandler_s {
|
|||||||
|
|
||||||
// may be null
|
// may be null
|
||||||
int (*parse_sdp_a_line) (AVStream * stream,
|
int (*parse_sdp_a_line) (AVStream * stream,
|
||||||
void *protocol_data,
|
PayloadContext *priv_data,
|
||||||
const char *line); ///< Parse the a= line from the sdp field
|
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.
|
PayloadContext *(*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.
|
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.
|
DynamicPayloadPacketHandlerProc parse_packet; ///< parse handler for this dynamic packet.
|
||||||
|
|
||||||
struct RTPDynamicProtocolHandler_s *next;
|
struct RTPDynamicProtocolHandler_s *next;
|
||||||
@ -113,7 +114,7 @@ struct RTPDemuxContext {
|
|||||||
|
|
||||||
/* dynamic payload stuff */
|
/* dynamic payload stuff */
|
||||||
DynamicPayloadPacketHandlerProc parse_packet; ///< This is also copied from the dynamic protocol handler structure
|
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;
|
int max_frames_per_packet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ typedef struct RTSPStream {
|
|||||||
rtp_payload_data_t rtp_payload_data; /* rtp payload parsing infos from SDP */
|
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)
|
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;
|
} RTSPStream;
|
||||||
|
|
||||||
static int rtsp_read_play(AVFormatContext *s);
|
static int rtsp_read_play(AVFormatContext *s);
|
||||||
|
Loading…
Reference in New Issue
Block a user