59 if (chunksize > end - p)
65 if (end - p < 8 + skip)
103 if (
av_strstart(p,
"pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
107 int len = strlen(p) * 6 / 8;
117 "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
156 if (stream_index < 0)
198 int res, mflags, len_off;
205 int off, out_len = 0;
227 if (!(mflags & 0x40)) {
237 if (!len_off && !asf->
pktbuf &&
258 int cur_len = start_off + len_off - off;
259 int prev_len = out_len;
261 if (
FFMIN(cur_len, len - off) < 0)
265 memcpy(asf->
buf + prev_len, buf + off,
266 FFMIN(cur_len, len - off));
293 return res == 1 ? -1 : res;
302 #define RTP_ASF_HANDLER(n, s, t) \
303 const RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
306 .codec_id = AV_CODEC_ID_NONE, \
307 .priv_data_size = sizeof(PayloadContext), \
308 .parse_sdp_a_line = asfrtp_parse_sdp_line, \
309 .close = asfrtp_close_context, \
310 .parse_packet = asfrtp_parse_packet, \
const ff_asf_guid ff_asf_header
int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
Parse a Windows Media Server-specific SDP line.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
unsigned char * buf_end
End of the data, may be less than buffer+buffer_size if the read function returned less data than req...
RTP/JPEG specific private data.
unsigned char * buffer
Start of the buffer.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
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 av_cold int end(AVCodecContext *avctx)
enum AVStreamParseType need_parsing
int id
Format-specific stream ID.
AVStream ** streams
A list of all streams in the file.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
Private data for the RTSP demuxer.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
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)
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
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 (...
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values. ...
simple assert() macros that are a bit more flexible than ISO C assert().
int avio_r8(AVIOContext *s)
uint64_t asf_pb_pos
cache for position of the asf demuxer, since we load a new data packet in the bytecontext for each in...
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
AVFormatContext * asf_ctx
The following are used for RTP/ASF streams.
unsigned int avio_rb24(AVIOContext *s)
static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, PayloadContext *asf, const char *line)
static void init_packetizer(AVIOContext *pb, uint8_t *buf, int len)
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
static AVInputFormat * iformat
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
const ff_asf_guid ff_asf_file_header
AVIOContext * pb
I/O context.
void av_packet_unref(AVPacket *pkt)
Wipe the packet.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
uint8_t * buf
the temporary storage buffer
static void asfrtp_close_context(PayloadContext *asf)
#define AVERROR_DEMUXER_NOT_FOUND
Demuxer not found.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
#define RTP_ASF_HANDLER(n, s, t)
int ffio_init_context(AVIOContext *s, unsigned char *buffer, int buffer_size, int write_flag, void *opaque, int(*read_packet)(void *opaque, uint8_t *buf, int buf_size), int(*write_packet)(void *opaque, uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
int64_t pos
position in the file of the current buffer
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int eof_reached
true if eof reached
void * priv_data
Format private data.
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
int avformat_open_input(AVFormatContext **ps, const char *url, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.