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/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.
 
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.
 
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.
 
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 PayloadContextasfrtp_new_context (void)
 
static void asfrtp_free_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,
  t 
)
Value:
RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
.enc_name = s, \
.codec_type = t, \
.codec_id = AV_CODEC_ID_NONE, \
.parse_sdp_a_line = asfrtp_parse_sdp_line, \
.alloc = asfrtp_new_context, \
.parse_packet = asfrtp_parse_packet, \
}

Definition at line 295 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 45 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 82 of file rtpdec_asf.c.

Referenced by init_packetizer().

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

Definition at line 87 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 96 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 130 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 168 of file rtpdec_asf.c.

static PayloadContext* asfrtp_new_context ( void  )
static

Definition at line 278 of file rtpdec_asf.c.

static void asfrtp_free_context ( PayloadContext asf)
static

Definition at line 283 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   
)