Go to the documentation of this file.
47 uint8_t *p = buf, *end = buf +
len;
58 if (chunksize > end - p)
64 if (end - p < 8 +
skip)
102 if (
av_strstart(p,
"pgmpu:data:application/vnd.ms.wms-hdr.asfv1;base64,", &p)) {
106 int len = strlen(p) * 6 / 8;
116 "Failed to fix invalid RTSP-MS/ASF min_pktsize\n");
155 if (stream_index < 0)
160 s->streams[stream_index]->id = strtol(
line,
NULL, 10);
194 const uint8_t *buf,
int len, uint16_t seq,
199 int res, mflags, len_off;
206 int off, out_len = 0;
228 if (!(mflags & 0x40)) {
238 if (!len_off && !asf->
pktbuf &&
259 int cur_len = start_off + len_off - off;
260 int prev_len = out_len;
266 memcpy(asf->
buf + prev_len, buf + off,
285 for (
i = 0;
i <
s->nb_streams;
i++) {
294 return res == 1 ? -1 : res;
303 #define RTP_ASF_HANDLER(n, s, t) \
304 const RTPDynamicProtocolHandler ff_ms_rtp_ ## n ## _handler = { \
307 .codec_id = AV_CODEC_ID_NONE, \
308 .priv_data_size = sizeof(PayloadContext), \
309 .parse_sdp_a_line = asfrtp_parse_sdp_line, \
310 .close = asfrtp_close_context, \
311 .parse_packet = asfrtp_parse_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_packet_unref(AVPacket *pkt)
Wipe the packet.
void ffio_init_context(FFIOContext *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, const uint8_t *buf, int buf_size), int64_t(*seek)(void *opaque, int64_t offset, int whence))
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
static void asfrtp_close_context(PayloadContext *asf)
AVStream ** streams
A list of all streams in the file.
#define RTP_FLAG_MARKER
RTP marker bit was set for this packet.
void ffio_init_read_context(FFIOContext *s, const uint8_t *buffer, int buffer_size)
Wrap a buffer in an AVIOContext for reading.
AVFormatContext * asf_ctx
The following are used for RTP/ASF streams.
void avformat_close_input(AVFormatContext **s)
Close an opened input AVFormatContext.
int64_t pos
position in the file of the current buffer
static av_always_inline int64_t avio_tell(AVIOContext *s)
ftell() equivalent for AVIOContext.
int avio_close_dyn_buf(AVIOContext *s, uint8_t **pbuffer)
Return the written size and a pointer to the buffer.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
AVDictionary * metadata
Metadata that applies to the whole file.
int avformat_open_input(AVFormatContext **ps, const char *url, const AVInputFormat *fmt, AVDictionary **options)
Open an input stream and read the header.
int avio_open_dyn_buf(AVIOContext **s)
Open a write only memory stream.
#define RTP_ASF_HANDLER(n, s, t)
#define AVERROR_DEMUXER_NOT_FOUND
Demuxer not found.
enum AVStreamParseType need_parsing
AVCodecParameters * codecpar
Codec parameters associated with this stream.
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...
AVIOContext * pb
I/O context.
static void init_packetizer(FFIOContext *pb, uint8_t *buf, int len)
int av_base64_decode(uint8_t *out, const char *in_str, int out_size)
Decode a base64-encoded string.
unsigned int nb_streams
Number of elements in AVFormatContext.streams.
const ff_asf_guid ff_asf_file_header
static int asfrtp_parse_sdp_line(AVFormatContext *s, int stream_index, PayloadContext *asf, const char *line)
unsigned int avio_rb24(AVIOContext *s)
AVFormatContext * avformat_alloc_context(void)
Allocate an AVFormatContext.
unsigned char * buf_end
End of the data, may be less than buffer+buffer_size if the read function returned less data than req...
Private data for the RTSP demuxer.
int av_reallocp(void *ptr, size_t size)
Allocate, reallocate, or free a block of memory through a pointer to a pointer.
void avio_write(AVIOContext *s, const unsigned char *buf, int size)
int avio_r8(AVIOContext *s)
void av_dict_free(AVDictionary **pm)
Free all the memory allocated for an AVDictionary struct and all keys and values.
int av_strstart(const char *str, const char *pfx, const char **ptr)
Return non-zero if pfx is a prefix of str.
static const AVInputFormat * iformat
#define i(width, name, range_min, range_max)
int ff_read_packet(AVFormatContext *s, AVPacket *pkt)
Read a transport packet from a media file.
void * av_mallocz(size_t size)
Allocate a memory block with alignment suitable for all memory accesses (including vectors if availab...
void ffio_free_dyn_buf(AVIOContext **s)
Free a dynamic buffer.
int id
Format-specific stream ID.
int ff_wms_parse_sdp_a_line(AVFormatContext *s, const char *p)
Parse a Windows Media Server-specific SDP line.
uint64_t_TMPL AV_WL64 unsigned int_TMPL AV_RL32
uint8_t * buf
the temporary storage buffer
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.
int eof_reached
true if was unable to read due to error or eof
const AVInputFormat * av_find_input_format(const char *short_name)
Find AVInputFormat based on the short name of the input format.
int64_t avio_skip(AVIOContext *s, int64_t offset)
Skip given number of bytes forward.
unsigned char * buffer
Start of the buffer.
This structure stores compressed data.
int av_dict_set(AVDictionary **pm, const char *key, const char *value, int flags)
Set the given entry in *pm, overwriting an existing entry.
int av_dict_copy(AVDictionary **dst, const AVDictionary *src, int flags)
Copy entries from one AVDictionary struct into another.
#define flags(name, subs,...)
const ff_asf_guid ff_asf_header
RTP/JPEG specific private data.
static void BS_FUNC() skip(BSCTX *bc, unsigned int n)
Skip n bits in the buffer.
int avcodec_parameters_copy(AVCodecParameters *dst, const AVCodecParameters *src)
Copy the contents of src to dst.
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)