summaryrefslogtreecommitdiff
path: root/libavcodec/tiffenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-11-24 02:08:21 +0100
committerMichael Niedermayer <michaelni@gmx.at>2011-11-24 03:32:24 +0100
commit8e576d58306df95d6373dd0ca2c1f21f1afaeca9 (patch)
tree5f7b9c8783b342e80e32b58b94ded819eb414b3c /libavcodec/tiffenc.c
parent7ffa9ea05aa951b6b13e615f1bd3b8280f758561 (diff)
parentbbb46f3ec7128d8a624f2aa5b4f99ec44c0b9567 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: libavutil: add utility functions to simplify allocation of audio buffers. libavutil: add planar sample formats and av_sample_fmt_is_planar() avconv: fix segfault at EOF with delayed pictures pcmdec: remove unneeded resetting of samples pointer avconv: remove a now unused parameter from output_packet(). avconv: formatting fixes in output_packet() avconv: declare some variables in blocks where they are used avconv: use the same behavior when decoding audio/video/subs bethsoftvideo: return proper consumed size for palette packets. cdg: skip packets that don't contain a cdg command. crcenc: add flags avconv: use vsync 0 for AVFMT_NOTIMESTAMPS formats. tiffenc: add a private option for selecting compression algorithm md5enc: add flags ARM: remove needless .text/.align directives Conflicts: doc/APIchanges libavcodec/tiffenc.c libavutil/avutil.h libavutil/samplefmt.c libavutil/samplefmt.h tests/ref/fate/bethsoft-vid tests/ref/fate/cdgraphics tests/ref/fate/film-cvid-pcm-stereo-8bit tests/ref/fate/mpeg2-field-enc tests/ref/fate/nuv tests/ref/fate/tiertex-seq tests/ref/fate/tscc-32bit tests/ref/fate/vmnc-32bit Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/tiffenc.c')
-rw-r--r--libavcodec/tiffenc.c31
1 files changed, 24 insertions, 7 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index b9a1e20fa5..9656cd9b68 100644
--- a/libavcodec/tiffenc.c
+++ b/libavcodec/tiffenc.c
@@ -25,6 +25,9 @@
* @author Bartlomiej Wolowiec
*/
+#include "libavutil/log.h"
+#include "libavutil/opt.h"
+
#include "avcodec.h"
#if CONFIG_ZLIB
#include <zlib.h>
@@ -44,7 +47,7 @@ static const uint8_t type_sizes2[6] = {
};
typedef struct TiffEncoderContext {
- AVClass *avclass;
+ AVClass *class; ///< for private options
AVCodecContext *avctx;
AVFrame picture;
@@ -230,7 +233,6 @@ static int encode_frame(AVCodecContext * avctx, unsigned char *buf,
p->key_frame = 1;
avctx->coded_frame= &s->picture;
- s->compr = TIFF_PACKBITS;
if (avctx->compression_level == 0) {
s->compr = TIFF_RAW;
} else if(avctx->compression_level == 2) {
@@ -453,11 +455,26 @@ fail:
return ret;
}
-static const AVOption options[]={
-{"dpi", "set the image resolution (in dpi)", offsetof(TiffEncoderContext, dpi), AV_OPT_TYPE_INT, {.dbl = 72}, 1, 0x10000, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_ENCODING_PARAM},
-{NULL}
+#define OFFSET(x) offsetof(TiffEncoderContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ {"dpi", "set the image resolution (in dpi)", OFFSET(dpi), AV_OPT_TYPE_INT, {.dbl = 72}, 1, 0x10000, AV_OPT_FLAG_VIDEO_PARAM|AV_OPT_FLAG_ENCODING_PARAM},
+ { "compression_algo", NULL, OFFSET(compr), AV_OPT_TYPE_INT, {TIFF_PACKBITS}, TIFF_RAW, TIFF_DEFLATE, VE, "compression_algo" },
+ { "packbits", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_PACKBITS}, 0, 0, VE, "compression_algo" },
+ { "raw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_RAW}, 0, 0, VE, "compression_algo" },
+ { "lzw", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_LZW}, 0, 0, VE, "compression_algo" },
+#if CONFIG_ZLIB
+ { "deflate", NULL, 0, AV_OPT_TYPE_CONST, {TIFF_DEFLATE}, 0, 0, VE, "compression_algo" },
+#endif
+ { NULL },
+};
+
+static const AVClass tiffenc_class = {
+ .class_name = "TIFF encoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
};
-static const AVClass class = { "tiff", av_default_item_name, options, LIBAVUTIL_VERSION_INT };
AVCodec ff_tiff_encoder = {
.name = "tiff",
@@ -473,5 +490,5 @@ AVCodec ff_tiff_encoder = {
PIX_FMT_YUV411P, PIX_FMT_RGB48LE,
PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
- .priv_class= &class,
+ .priv_class = &tiffenc_class,
};