diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-09 02:06:40 +0200 |
commit | 58257ea29e0716a50dc742959de876606ed22416 (patch) | |
tree | a4949244816d4eb7a4231b1798b54bea4a79d4e5 /libavformat/gif.c | |
parent | 971c04066c601bdd38ed5e8eb585d2f5ba211fe2 (diff) | |
parent | bda168d2b0210dda84f1a9d32c8aa4653d1674d5 (diff) | |
download | ffmpeg-58257ea29e0716a50dc742959de876606ed22416.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (28 commits)
mp3enc: write a xing frame containing number of frames in the file
lavf: update AVStream.nb_frames when muxing.
ffmpeg: remove unused variables from InputStream.
doc: update ffmpeg -ar and -ac documentation to reflect reality.
ffmpeg: remove pointless if (nb_input_files)
ffmpeg: merge input_files_ts_offset into input_files.
ffmpeg: merge input_codecs into input_streams.
ffmpeg: drop AV prefixes from struct names.
ffmpeg: deprecate loop_input and loop_output options
gif: add loop private option.
img2: add loop private option.
AVOptions: in av_opt_find() don't return named constants unless unit is specified.
x11grab: replace undocumented nomouse hackery with a private option.
dict: extend documentation.
lls: whitespace cosmetics
docs: Use proper markup for a literal command line option
docs: Remove a remark that isn't relevant any longer
docs: Explain how to regenerate import libraries with MSVC tools
docs: Mention that libraries for MSVC can be built with a cross compiler
docs: Remove old docs that mention setting up a build environment with lib.exe
...
Conflicts:
doc/ffmpeg.texi
doc/general.texi
ffmpeg.c
libavcodec/Makefile
libavcodec/dnxhddata.c
libavformat/mp3enc.c
libavformat/utils.c
libavutil/Makefile
tests/copycooker.sh
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/gif.c')
-rw-r--r-- | libavformat/gif.c | 29 |
1 files changed, 26 insertions, 3 deletions
diff --git a/libavformat/gif.c b/libavformat/gif.c index 0960705cf3..81a1b6fe07 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; } 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 = s->loop_output; +#endif + + gif_image_write_header(pb, width, height, gif->loop, NULL); avio_flush(s->pb); return 0; @@ -340,6 +348,20 @@ static int gif_write_trailer(AVFormatContext *s) return 0; } +#define OFFSET(x) offsetof(GIFContext, x) +#define ENC AV_OPT_FLAG_ENCODING_PARAM +static const AVOption options[] = { + { "loop", "Number of times to loop the output.", OFFSET(loop), FF_OPT_TYPE_INT, {0}, 0, 65535, ENC }, + { NULL }, +}; + +static const AVClass gif_muxer_class = { + .class_name = "GIF muxer", + .item_name = av_default_item_name, + .version = LIBAVUTIL_VERSION_INT, + .option = options, +}; + AVOutputFormat ff_gif_muxer = { "gif", NULL_IF_CONFIG_SMALL("GIF Animation"), @@ -351,4 +373,5 @@ AVOutputFormat ff_gif_muxer = { gif_write_header, gif_write_packet, gif_write_trailer, + .priv_class = &gif_muxer_class, }; |