27 #define MMS_MAX_STREAMS 256
29 int ff_mms_read_header(MMSContext *mms, uint8_t *buf, const int size)
33 int remaining_size = mms->asf_header_size - mms->asf_header_read_size;
34 size_to_copy =
FFMIN(
size, remaining_size);
35 pos = mms->asf_header + mms->asf_header_read_size;
36 memcpy(buf, pos, size_to_copy);
37 if (mms->asf_header_read_size == mms->asf_header_size) {
40 mms->asf_header_read_size += size_to_copy;
64 "Corrupt stream (invalid ASF header, size=%d)\n",
79 if (!chunksize || chunksize > end - p) {
81 "Corrupt stream (header chunksize %"PRId64
" is invalid)\n",
91 "Corrupt stream (too large pkt_len %d)\n",
98 stream_id = flags & 0x7F;
111 "Corrupt stream (too many A/V streams)\n");
116 int stream_count =
AV_RL16(p + 84), ext_len_count =
AV_RL16(p + 86);
117 uint64_t skip_bytes = 88;
118 while (stream_count--) {
119 if (end - p < skip_bytes + 4) {
121 "Corrupt stream (next stream name length is not in the buffer)\n");
124 skip_bytes += 4 +
AV_RL16(p + skip_bytes + 2);
126 while (ext_len_count--) {
127 if (end - p < skip_bytes + 22) {
129 "Corrupt stream (next extension system info length is not in the buffer)\n");
132 skip_bytes += 22 +
AV_RL32(p + skip_bytes + 18);
134 if (end - p < skip_bytes) {
136 "Corrupt stream (the last extension system info length is invalid)\n");
139 if (chunksize - skip_bytes > 24)
140 chunksize = skip_bytes;
const ff_asf_guid ff_asf_header
unsigned int nb_streams_allocated
allocated size of streams
uint8_t * read_in_ptr
Pointer for reading from incoming buffer.
int stream_num
stream numbers.
#define MMS_MAX_STREAMS
arbitrary sanity check value
const ff_asf_guid ff_asf_ext_stream_header
void av_freep(void *arg)
Free a memory block which has been allocated with av_malloc(z)() or av_realloc() and set the pointer ...
uint8_t * asf_header
Internal handling of the ASF header.
const ff_asf_guid ff_asf_data_header
int ff_mms_read_data(MMSContext *mms, uint8_t *buf, const int size)
uint8_t in_buffer[65536]
Buffer for incoming packets.
const ff_asf_guid ff_asf_head1_guid
void * av_fast_realloc(void *ptr, unsigned int *size, size_t min_size)
Reallocate the given block if it is not large enough, otherwise do nothing.
void av_log(void *avcl, int level, const char *fmt,...)
uint8_t out_buffer[512]
Buffer for outgoing packet.
int remaining_in_len
Reading length from incoming buffer.
const ff_asf_guid ff_asf_file_header
const ff_asf_guid ff_asf_stream_header
int asf_header_size
Size of stored ASF header.
#define AVERROR_INVALIDDATA
int ff_mms_asf_header_parser(MMSContext *mms)