lavf: split out ffio_limit()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
f85334f58e
commit
e39eeb10d1
@ -71,6 +71,8 @@ uint64_t ffio_read_varlen(AVIOContext *bc);
|
|||||||
/** @warning must be called before any I/O */
|
/** @warning must be called before any I/O */
|
||||||
int ffio_set_buf_size(AVIOContext *s, int buf_size);
|
int ffio_set_buf_size(AVIOContext *s, int buf_size);
|
||||||
|
|
||||||
|
int ffio_limit(AVIOContext *s, int size);
|
||||||
|
|
||||||
void ffio_init_checksum(AVIOContext *s,
|
void ffio_init_checksum(AVIOContext *s,
|
||||||
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
unsigned long (*update_checksum)(unsigned long c, const uint8_t *p, unsigned int len),
|
||||||
unsigned long checksum);
|
unsigned long checksum);
|
||||||
|
@ -264,11 +264,8 @@ AVInputFormat *av_find_input_format(const char *short_name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ffio_limit(AVIOContext *s, int size)
|
||||||
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
|
||||||
{
|
{
|
||||||
int ret;
|
|
||||||
|
|
||||||
if(s->maxsize>=0){
|
if(s->maxsize>=0){
|
||||||
int64_t remaining= s->maxsize - avio_tell(s);
|
int64_t remaining= s->maxsize - avio_tell(s);
|
||||||
if(remaining < size){
|
if(remaining < size){
|
||||||
@ -283,6 +280,13 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
|||||||
size= remaining+1;
|
size= remaining+1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
|
int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
size= ffio_limit(s, size);
|
||||||
|
|
||||||
ret= av_new_packet(pkt, size);
|
ret= av_new_packet(pkt, size);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user