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)
200 int res, mflags, len_off;
207 int off, out_len = 0;
229 if (!(mflags & 0x40)) {
239 if (!len_off && !asf->
pktbuf &&
260 int cur_len = start_off + len_off - off;
261 int prev_len = out_len;
263 if (
FFMIN(cur_len, len - off) < 0)
267 memcpy(asf->
buf + prev_len, buf + off,
268 FFMIN(cur_len, len - off));
295 return res == 1 ? -1 : res;
304 #define RTP_ASF_HANDLER(n, s, t) \
305 RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
308 .codec_id = AV_CODEC_ID_NONE, \
309 .priv_data_size = sizeof(PayloadContext), \
310 .parse_sdp_a_line = asfrtp_parse_sdp_line, \
311 .close = asfrtp_close_context, \
312 .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.
void av_free_packet(AVPacket *pkt)
Free a packet.
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...
int avformat_open_input(AVFormatContext **ps, const char *filename, AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
RTP/JPEG specific private data.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
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.
uint8_t * extradata
some codecs need / can use extradata like Huffman tables.
AVStream ** streams
A list of all streams in the file.
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
int av_reallocp(void *ptr, size_t size)
Allocate or reallocate a block of memory.
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)
void av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
Private data for the RTSP demuxer.
#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...
AVCodecContext * codec
Codec context associated with this stream.
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
const ff_asf_guid ff_asf_file_header
AVIOContext * pb
I/O context.
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.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
This structure stores compressed data.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...