Hi,

On Mon, Jun 20, 2011 at 11:44 PM, Anton Khirnov <[email protected]> wrote:
> Deprecate AVFormatContext.loop_output.
> ---
>  libavformat/avformat.h |    6 +++++-
>  libavformat/gif.c      |   29 ++++++++++++++++++++++++++---
>  libavformat/version.h  |    3 +++
>  3 files changed, 34 insertions(+), 4 deletions(-)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index ecc008c..6b36f62 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -713,12 +713,16 @@ typedef struct AVFormatContext {
>     int preload;
>     int max_delay;
>
> +#if FF_API_LOOP_OUTPUT
>  #define AVFMT_NOOUTPUTLOOP -1
>  #define AVFMT_INFINITEOUTPUTLOOP 0
>     /**
>      * number of times to loop output in formats that support it
> +     *
> +     * @deprecated use the loop_output private option in the gif muxer.
>      */
> -    int loop_output;
> +    attribute_deprecated int loop_output;
> +#endif
>
>     int flags;
>  #define AVFMT_FLAG_GENPTS       0x0001 ///< Generate missing pts even if it 
> requires parsing future frames.
> diff --git a/libavformat/gif.c b/libavformat/gif.c
> index 55deb4d..f9481fd 100644
> --- a/libavformat/gif.c
> +++ b/libavformat/gif.c
> @@ -40,6 +40,8 @@
>  */
>
>  #include "avformat.h"
> +#include "libavutil/log.h"
> +#include "libavutil/opt.h"
>
>  /* The GIF format uses reversed order for bitstreams... */
>  /* at least they don't use PDP_ENDIAN :) */
> @@ -245,8 +247,10 @@ static int gif_image_write_image(AVIOContext *pb,
>  }
>
>  typedef struct {
> +    AVClass *class;         /** Class for private options. */
>     int64_t time, file_time;
>     uint8_t buffer[100]; /* data chunks */
> +    int loop_output;
>  } GIFContext;
>
>  static int gif_write_header(AVFormatContext *s)
> @@ -254,7 +258,7 @@ static int gif_write_header(AVFormatContext *s)
>     GIFContext *gif = s->priv_data;
>     AVIOContext *pb = s->pb;
>     AVCodecContext *enc, *video_enc;
> -    int i, width, height, loop_count /*, rate*/;
> +    int i, width, height /*, rate*/;
>
>  /* XXX: do we reject audio streams or just ignore them ?
>     if(s->nb_streams > 1)
> @@ -276,7 +280,6 @@ static int gif_write_header(AVFormatContext *s)
>     } else {
>         width = video_enc->width;
>         height = video_enc->height;
> -        loop_count = s->loop_output;
>  //        rate = video_enc->time_base.den;
>     }
>
> @@ -285,7 +288,12 @@ static int gif_write_header(AVFormatContext *s)
>         return AVERROR(EIO);
>     }
>
> -    gif_image_write_header(pb, width, height, loop_count, NULL);
> +#if FF_API_LOOP_OUTPUT
> +    if (s->loop_output)
> +        gif->loop_output = s->loop_output;
> +#endif

Warn to stop using it and set private option instead.

> +static const AVOption options[] = {
> +    { "loop_output", "Number of times to loop the output.", 
> OFFSET(loop_output), FF_OPT_TYPE_INT, {-1}, -1, INT_MAX, ENC },
> +    { NULL },
> +};

0-65535. Also -1 is not a valid default, should be ero (no loop).

Ronald
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to