summaryrefslogtreecommitdiff
path: root/libavcodec/tiffenc.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-11-23 19:45:39 +0100
committerAnton Khirnov <anton@khirnov.net>2011-11-23 20:29:25 +0100
commita94c769dad502e2b782a09ece0ba490276239252 (patch)
treea19bdbfea990971977db2f704a0a00489f7eb7cb /libavcodec/tiffenc.c
parent50efd3cad8b2a77d98b9e6b6637ef70fe70c6681 (diff)
tiffenc: add a private option for selecting compression algorithm
Diffstat (limited to 'libavcodec/tiffenc.c')
-rw-r--r--libavcodec/tiffenc.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/libavcodec/tiffenc.c b/libavcodec/tiffenc.c
index d486b3fd4b..7b71481a74 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>
@@ -43,6 +46,7 @@ static const uint8_t type_sizes2[6] = {
};
typedef struct TiffEncoderContext {
+ AVClass *class; ///< for private options
AVCodecContext *avctx;
AVFrame picture;
@@ -227,7 +231,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) {
@@ -444,6 +447,26 @@ fail:
return ret;
}
+#define OFFSET(x) offsetof(TiffEncoderContext, x)
+#define VE AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
+static const AVOption options[] = {
+ { "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,
+};
+
AVCodec ff_tiff_encoder = {
.name = "tiff",
.type = AVMEDIA_TYPE_VIDEO,
@@ -458,4 +481,5 @@ AVCodec ff_tiff_encoder = {
PIX_FMT_YUV411P,
PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("TIFF image"),
+ .priv_class = &tiffenc_class,
};