aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/utils.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-12-19 11:46:34 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-12-19 11:57:34 +0100
commite39eeb10d1b36b5681e42a7539d5b168fa292d61 (patch)
treed44c9aeb4ec02bc245f2e90bdba9975935805696 /libavformat/utils.c
parentf85334f58e1286287d0547a49fa9c93b40cbf48f (diff)
downloadffmpeg-e39eeb10d1b36b5681e42a7539d5b168fa292d61.tar.gz
lavf: split out ffio_limit()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r--libavformat/utils.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c
index f0df759bf5..edcae2fe37 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -264,11 +264,8 @@ AVInputFormat *av_find_input_format(const char *short_name)
return NULL;
}
-
-int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
+int ffio_limit(AVIOContext *s, int size)
{
- int ret;
-
if(s->maxsize>=0){
int64_t remaining= s->maxsize - avio_tell(s);
if(remaining < size){
@@ -283,6 +280,13 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
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);