FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions
rtpdec_asf.c File Reference

Microsoft RTP/ASF support. More...

#include "libavutil/avassert.h"
#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 (AVIOContext *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

#define RTP_ASF_HANDLER (   n,
  s,
 
)
Value:
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, \
}
const char * s
Definition: avisynth_c.h:631
RTP/JPEG specific private data.
Definition: rdt.c:83
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:193
static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, PayloadContext *asf, const char *line)
Definition: rtpdec_asf.c:153
int n
Definition: avisynth_c.h:547
static void asfrtp_close_context(PayloadContext *asf)
Definition: rtpdec_asf.c:298
static int parse_packet(AVFormatContext *s, AVPacket *pkt, int stream_index)
Parse a packet, add all split parts to parse_queue.
Definition: utils.c:1187

Definition at line 304 of file rtpdec_asf.c.

Function Documentation

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 46 of file rtpdec_asf.c.

Referenced by ff_wms_parse_sdp_a_line().

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 86 of file rtpdec_asf.c.

Referenced by init_packetizer().

static void init_packetizer ( AVIOContext pb,
uint8_t buf,
int  len 
)
static

Definition at line 91 of file rtpdec_asf.c.

Referenced by asfrtp_parse_packet(), and 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 100 of file rtpdec_asf.c.

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

Definition at line 153 of file rtpdec_asf.c.

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 193 of file rtpdec_asf.c.

static void asfrtp_close_context ( PayloadContext asf)
static

Definition at line 298 of file rtpdec_asf.c.

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