[FFmpeg-devel] [PATCH] avformat: add limit_transfer_len option

Michael Niedermayer michaelni at gmx.at
Sun Mar 30 19:45:51 CEST 2014


On Sun, Mar 30, 2014 at 05:05:56PM +0200, Clément Bœsch wrote:
> On Sun, Mar 30, 2014 at 03:07:50PM +0200, Michael Niedermayer wrote:
> > This allows forcing smaller chunks to be read for debuging demuxers
> > and the avformat core
> > 
> 
> What's the use case? Is this in order to make networking code faster in
> later commits?
> 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavformat/avio.c |   14 +++++++++++++-
> >  libavformat/url.h  |    1 +
> >  2 files changed, 14 insertions(+), 1 deletion(-)
> > 
> > diff --git a/libavformat/avio.c b/libavformat/avio.c
> > index 4edaaa6..185ab1c 100644
> > --- a/libavformat/avio.c
> > +++ b/libavformat/avio.c
> > @@ -72,7 +72,16 @@ static const AVClass *urlcontext_child_class_next(const AVClass *prev)
> >      return NULL;
> >  }
> >  
> > -static const AVOption options[] = { { NULL } };
> > +#define OFFSET(x) offsetof(URLContext, x)
> > +//these names are too long to be readable
> > +#define E AV_OPT_FLAG_ENCODING_PARAM
> > +#define D AV_OPT_FLAG_DECODING_PARAM
> > +
> 
> Does it make sense to have these flags at this level?

i could remove them, but its more consistent to always have them


> 
> > +static const AVOption options[] = {
> > +    {"limit_transfer_len", "maximum number of bytes tranfered with a single read/write call", OFFSET(limit_transfer_len), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, INT_MAX, D|E},
> > +    { NULL }
> > +};
> > +
> >  const AVClass ffurl_context_class = {
> >      .class_name       = "URLContext",
> >      .item_name        = urlcontext_to_name,
> > @@ -296,6 +305,9 @@ static inline int retry_transfer_wrapper(URLContext *h, uint8_t *buf,
> >      int fast_retries = 5;
> >      int64_t wait_since = 0;
> >  
> > +    if (h->limit_transfer_len && h->limit_transfer_len<size)
> 
> nitstyle: " < "

locally fixed


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Democracy is the form of government in which you can choose your dictator
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140330/2a361633/attachment.asc>


More information about the ffmpeg-devel mailing list