diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-08-31 23:44:21 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-09-01 00:01:21 +0200 |
commit | 0ed7bc49a3f7accc4952372b914eb584b1201c86 (patch) | |
tree | 48bd1d573e6acc909a9a5c26e94701da489e3184 /libavcodec/mjpegdec.c | |
parent | a9c69362ea930b15cc42fa9f25c5201d370ff156 (diff) | |
parent | 5d06f15235c2fa1b6ed2c5af3bc0e3750df4291c (diff) | |
download | ffmpeg-0ed7bc49a3f7accc4952372b914eb584b1201c86.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master: (31 commits)
libx264: set default thread count to 0 (auto)
lavc: cosmetics, group deprecated codec flags
mpeg12: add 'scan_offset' private option.
h263/p encoder: add 'structured_slices' private option.
h263/p encoder: add 'obmc' private option.
h263p encoder: add 'aiv' private option.
h263p encoder: add 'umv' private option.
mpeg12enc/mpeg4videoenc: add 'alternate_scan' private option.
mjpegdec: add 'extern_huff' private option.
mpeg4enc: add 'data_partitioning' private option.
snow: add 'memc_only' private option.
libx264: add 'mbtree' private option.
libx264: add 'psy' private option.
libmp3lame: add 'reservoir' private option.
mpeg2enc: add 'non_linear_quant' private option
mpeg12enc: add drop_frame_timecode private option.
mpeg12enc: add intra_vlc private option.
VC1: Support dynamic dimension changes
mjpeg: treat external huffman table setup failure as codec init failure if external huffman table use requested
lavc: deprecate CODEC_FLAG2_BRDO
...
Conflicts:
avconv.c
libavcodec/libmp3lame.c
libavcodec/libx264.c
libavcodec/mjpegdec.c
libavcodec/mpeg12enc.c
libavcodec/mpegvideo.h
libavcodec/vc1.c
libavcodec/vc1dec.c
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mjpegdec.c')
-rw-r--r-- | libavcodec/mjpegdec.c | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 9bfe706001..1deaaf3afd 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -35,6 +35,7 @@ #include "libavutil/imgutils.h" #include "libavutil/avassert.h" +#include "libavutil/opt.h" #include "avcodec.h" #include "dsputil.h" #include "mjpeg.h" @@ -98,13 +99,17 @@ 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); if (ff_mjpeg_decode_dht(s)) { - av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table, switching back to internal\n"); - build_basic_mjpeg_vlc(s); + av_log(avctx, AV_LOG_ERROR, "mjpeg: error using external huffman table\n"); + return AVERROR_INVALIDDATA; } } if (avctx->extradata_size > 9 && @@ -1578,6 +1583,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, @@ -1589,6 +1608,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 = { |