FFmpeg
Data Structures | Macros | Functions
rtpdec_asf.c File Reference

Microsoft RTP/ASF support. More...

#include "libavutil/base64.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "rtp.h"
#include "rtpdec_formats.h"
#include "rtsp.h"
#include "asf.h"
#include "avio_internal.h"
#include "internal.h"

Go to the source code of this file.

Data Structures

struct  PayloadContext
 RTP/JPEG specific private data. More...
 

Macros

#define RTP_ASF_HANDLER(n, s, t)
 

Functions

static int rtp_asf_fix_header (uint8_t *buf, int len)
 From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not contain any padding. More...
 
static int packetizer_read (void *opaque, uint8_t *buf, int buf_size)
 The following code is basically a buffered AVIOContext, with the added benefit of returning -EAGAIN (instead of 0) on packet boundaries, such that the ASF demuxer can return safely and resume business at the next packet. More...
 
static void init_packetizer (FFIOContext *pb, uint8_t *buf, int len)
 
int ff_wms_parse_sdp_a_line (AVFormatContext *s, const char *p)
 Parse a Windows Media Server-specific SDP line. More...
 
static int asfrtp_parse_sdp_line (AVFormatContext *s, int stream_index, PayloadContext *asf, const char *line)
 
static int asfrtp_parse_packet (AVFormatContext *s, PayloadContext *asf, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
 
static void asfrtp_close_context (PayloadContext *asf)
 
 RTP_ASF_HANDLER (asf_pfv, "x-asf-pf", AVMEDIA_TYPE_VIDEO)
 
 RTP_ASF_HANDLER (asf_pfa, "x-asf-pf", AVMEDIA_TYPE_AUDIO)
 

Detailed Description

Microsoft RTP/ASF support.

Author
Ronald S. Bultje rbult.nosp@m.je@r.nosp@m.onald.nosp@m..bit.nosp@m.freak.nosp@m..net

Definition in file rtpdec_asf.c.

Macro Definition Documentation

◆ RTP_ASF_HANDLER

#define RTP_ASF_HANDLER (   n,
  s,
 
)
Value:
const RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
.codec_id = AV_CODEC_ID_NONE, \
.priv_data_size = sizeof(PayloadContext), \
.parse_sdp_a_line = asfrtp_parse_sdp_line, \
}

Definition at line 303 of file rtpdec_asf.c.

Function Documentation

◆ rtp_asf_fix_header()

static int rtp_asf_fix_header ( uint8_t *  buf,
int  len 
)
static

From MSDN 2.2.1.4, we learn that ASF data packets over RTP should not contain any padding.

Unfortunately, the header min/max_pktsize are not updated (thus making min_pktsize invalid). Here, we "fix" these faulty min_pktsize values in the ASF file header.

Returns
0 on success, <0 on failure (currently -1).

Definition at line 45 of file rtpdec_asf.c.

Referenced by ff_wms_parse_sdp_a_line().

◆ packetizer_read()

static int packetizer_read ( void *  opaque,
uint8_t *  buf,
int  buf_size 
)
static

The following code is basically a buffered AVIOContext, with the added benefit of returning -EAGAIN (instead of 0) on packet boundaries, such that the ASF demuxer can return safely and resume business at the next packet.

Definition at line 85 of file rtpdec_asf.c.

Referenced by init_packetizer().

◆ init_packetizer()

static void init_packetizer ( FFIOContext pb,
uint8_t *  buf,
int  len 
)
static

Definition at line 90 of file rtpdec_asf.c.

Referenced by asfrtp_parse_packet(), and ff_wms_parse_sdp_a_line().

◆ ff_wms_parse_sdp_a_line()

int ff_wms_parse_sdp_a_line ( AVFormatContext s,
const char *  p 
)

Parse a Windows Media Server-specific SDP line.

Parameters
sRTSP demux context

Definition at line 99 of file rtpdec_asf.c.

◆ asfrtp_parse_sdp_line()

static int asfrtp_parse_sdp_line ( AVFormatContext s,
int  stream_index,
PayloadContext asf,
const char *  line 
)
static

Definition at line 152 of file rtpdec_asf.c.

◆ asfrtp_parse_packet()

static int asfrtp_parse_packet ( AVFormatContext s,
PayloadContext asf,
AVStream st,
AVPacket pkt,
uint32_t *  timestamp,
const uint8_t *  buf,
int  len,
uint16_t  seq,
int  flags 
)
static
Returns
0 when a packet was written into /p pkt, and no more data is left; 1 when a packet was written into /p pkt, and more packets might be left; <0 when not enough data was provided to return a full packet, or on error.

< relative timestamp

< has duration

< has location ID

If 0x40 is not set, the len_off field specifies an offset of this packet's payload data in the complete (reassembled) ASF packet. This is used to spread one ASF packet over multiple RTP packets.

If 0x40 is set, the len_off field specifies the length of the next ASF packet that can be read from this payload data alone. This is commonly the same as the payload size, but could be less in case of packet splitting (i.e. multiple ASF packets in one RTP packet).

Definition at line 191 of file rtpdec_asf.c.

◆ asfrtp_close_context()

static void asfrtp_close_context ( PayloadContext asf)
static

Definition at line 297 of file rtpdec_asf.c.

◆ RTP_ASF_HANDLER() [1/2]

RTP_ASF_HANDLER ( asf_pfv  ,
"x-asf-pf"  ,
AVMEDIA_TYPE_VIDEO   
)

◆ RTP_ASF_HANDLER() [2/2]

RTP_ASF_HANDLER ( asf_pfa  ,
"x-asf-pf"  ,
AVMEDIA_TYPE_AUDIO   
)
asfrtp_close_context
static void asfrtp_close_context(PayloadContext *asf)
Definition: rtpdec_asf.c:297
RTPDynamicProtocolHandler::enc_name
const char * enc_name
Definition: rtpdec.h:117
s
#define s(width, name)
Definition: cbs_vp9.c:257
asfrtp_parse_sdp_line
static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, PayloadContext *asf, const char *line)
Definition: rtpdec_asf.c:152
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:48
parse_packet
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index, int flush)
Parse a packet, add all split parts to parse_queue.
Definition: demux.c:1105
PayloadContext
RTP/JPEG specific private data.
Definition: rdt.c:83
RTPDynamicProtocolHandler
Definition: rtpdec.h:116
asfrtp_parse_packet
static int asfrtp_parse_packet(AVFormatContext *s, PayloadContext *asf, AVStream *st, AVPacket *pkt, uint32_t *timestamp, const uint8_t *buf, int len, uint16_t seq, int flags)
Definition: rtpdec_asf.c:191