[FFmpeg-devel] [PATCH] move put_v from nutenc.c and make it public in avio.h and aviobuf.c

Michael Niedermayer michaelni
Thu Jul 1 04:12:25 CEST 2010


On Thu, Jul 01, 2010 at 01:37:53AM +0200, Michael Chinen wrote:
> 2010/7/1 M?ns Rullg?rd <mans at mansr.com>:
> >> +/**
> >> + * Get the length in bytes which is needed to store val as v.
> >> + */
> >
> > You don't need to repeat the comment here. ?Once in the header is
> > enough.
> ok.  done.
> 
> Index: libavformat/avio.h
> ===================================================================
> --- libavformat/avio.h	(revision 23915)
> +++ libavformat/avio.h	(working copy)
> @@ -348,8 +348,14 @@
>  void put_tag(ByteIOContext *s, const char *tag);
> 
>  void put_strz(ByteIOContext *s, const char *buf);
> +void put_v(ByteIOContext *bc, uint64_t val);
> 
>  /**
> + * Get the length in bytes which is needed to store val as v.
> + */
> +int get_length(uint64_t val);
> +
> +/**
>   * fseek() equivalent for ByteIOContext.
>   * @return new position or AVERROR.
>   */
> Index: libavformat/aviobuf.c
> ===================================================================
> --- libavformat/aviobuf.c	(revision 23915)
> +++ libavformat/aviobuf.c	(working copy)
> @@ -284,6 +284,24 @@
>      put_byte(s, val);
>  }
> 
> +int get_length(uint64_t val){
> +    int i=1;
> +
> +    while(val>>=7)
> +        i++;
> +
> +    return i;
> +}
> +
> +void put_v(ByteIOContext *bc, uint64_t val){
> +    int i= get_length(val);
> +
> +    while(--i>0)
> +        put_byte(bc, 128 | (val>>(7*i)));
> +
> +    put_byte(bc, val&127);
> +}
> +
>  void put_tag(ByteIOContext *s, const char *tag)
>  {
>      while (*tag) {
> Index: libavformat/nutenc.c
> ===================================================================
> --- libavformat/nutenc.c	(revision 23915)
> +++ libavformat/nutenc.c	(working copy)
> @@ -241,27 +241,6 @@
>      nut->frame_code['N'].flags= FLAG_INVALID;
>  }
> 
> -/**
> - * Get the length in bytes which is needed to store val as v.
> - */
> -static int get_length(uint64_t val){
> -    int i=1;
> -
> -    while(val>>=7)
> -        i++;
> -
> -    return i;
> -}
> -
> -static void put_v(ByteIOContext *bc, uint64_t val){
> -    int i= get_length(val);
> -
> -    while(--i>0)
> -        put_byte(bc, 128 | (val>>(7*i)));
> -
> -    put_byte(bc, val&127);
> -}
> -
>  static void put_tt(NUTContext *nut, StreamContext *nus, ByteIOContext
> *bc, uint64_t val){
>      val *= nut->time_base_count;
>      val += nus->time_base - nut->time_base;

>  avio.h    |    6 ++++++
>  aviobuf.c |   18 ++++++++++++++++++
>  nutenc.c  |   21 ---------------------
>  3 files changed, 24 insertions(+), 21 deletions(-)
> aecf1d9c9221aae98ccd955b79236b9abb86f659  moving_put_v_r23915_2.patch

ok but

* they need ff_ prefixes (seperate patch/commit)
* get_v() needs doxy comment
* get_length() is too generic namewise (any renaming would go into a
  seperate patch/commit)

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

In a rich man's house there is no place to spit but his face.
-- Diogenes of Sinope
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20100701/271649a3/attachment.pgp>



More information about the ffmpeg-devel mailing list