aboutsummaryrefslogtreecommitdiffstats
path: root/libavcodec/mjpegdec.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2011-08-27 10:16:14 +0200
committerAnton Khirnov <anton@khirnov.net>2011-08-31 13:25:54 +0200
commit1f0c7020a1f08a7cbec2d629759ca33ea92bd89d (patch)
treec606447af1645774452ba5633abe1e879316b2da /libavcodec/mjpegdec.c
parent4623420d84e97d141c20078cfa09c7568f693bd5 (diff)
downloadffmpeg-1f0c7020a1f08a7cbec2d629759ca33ea92bd89d.tar.gz
mjpegdec: add 'extern_huff' private option.
Deprecate CODEC_FLAG_EXTERN_HUFF
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r--libavcodec/mjpegdec.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index b9db777fe1..168cc0bece 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -34,6 +34,7 @@
#include <assert.h>
#include "libavutil/imgutils.h"
+#include "libavutil/opt.h"
#include "avcodec.h"
#include "dsputil.h"
#include "mjpeg.h"
@@ -96,7 +97,11 @@ av_cold int ff_mjpeg_decode_init(AVCodecContext *avctx)
build_basic_mjpeg_vlc(s);
+#if FF_API_MJPEG_GLOBAL_OPTS
if (avctx->flags & CODEC_FLAG_EXTERN_HUFF)
+ s->extern_huff = 1;
+#endif
+ if (s->extern_huff)
{
av_log(avctx, AV_LOG_INFO, "mjpeg: using external huffman table\n");
init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
@@ -1597,6 +1602,20 @@ av_cold int ff_mjpeg_decode_end(AVCodecContext *avctx)
return 0;
}
+#define OFFSET(x) offsetof(MJpegDecodeContext, x)
+#define VD AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM
+static const AVOption options[] = {
+ { "extern_huff", "Use external huffman table.", OFFSET(extern_huff), FF_OPT_TYPE_INT, { 0 }, 0, 1, VD },
+ { NULL },
+};
+
+static const AVClass mjpegdec_class = {
+ .class_name = "MJPEG decoder",
+ .item_name = av_default_item_name,
+ .option = options,
+ .version = LIBAVUTIL_VERSION_INT,
+};
+
AVCodec ff_mjpeg_decoder = {
.name = "mjpeg",
.type = AVMEDIA_TYPE_VIDEO,
@@ -1608,6 +1627,7 @@ AVCodec ff_mjpeg_decoder = {
.capabilities = CODEC_CAP_DR1,
.max_lowres = 3,
.long_name = NULL_IF_CONFIG_SMALL("MJPEG (Motion JPEG)"),
+ .priv_class = &mjpegdec_class,
};
AVCodec ff_thp_decoder = {