From a77146abfe33ab22a2b69721c9f74fa693f1ceed Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 10 Mar 2003 11:48:33 +0000 Subject: * 'externaly' visible option list begins avoptions_ prefix * fixed FLAG AVOption Originally committed as revision 1661 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/common.h | 8 ++++++++ libavcodec/h263dec.c | 12 ++++++++++++ libavcodec/mpegvideo.c | 3 +-- libavcodec/opts.c | 31 +++++++++++++++++++++++-------- 4 files changed, 44 insertions(+), 10 deletions(-) diff --git a/libavcodec/common.h b/libavcodec/common.h index a1be71b759..258302661a 100644 --- a/libavcodec/common.h +++ b/libavcodec/common.h @@ -57,6 +57,14 @@ #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } #define AVOPTION_END() AVOPTION_SUB(NULL) +struct AVOption; +#ifdef HAVE_MMX +extern const struct AVOption avoptions_common[3 + 5]; +#else +extern const struct AVOption avoptions_common[3]; +#endif +extern const struct AVOption avoptions_workaround_bug[11]; + #endif /* HAVE_AV_CONFIG_H */ /* Suppress restrict if it was not defined in config.h. */ diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c index 14f3046a89..15383d12f0 100644 --- a/libavcodec/h263dec.c +++ b/libavcodec/h263dec.c @@ -792,6 +792,12 @@ printf("%Ld\n", rdtsc()-time); return get_consumed_bytes(s, buf_size); } +static const AVOption mpeg4_decoptions[] = +{ + AVOPTION_SUB(avoptions_workaround_bug), + AVOPTION_END() +}; + AVCodec mpeg4_decoder = { "mpeg4", CODEC_TYPE_VIDEO, @@ -802,6 +808,7 @@ AVCodec mpeg4_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, + .options = mpeg4_decoptions, }; AVCodec h263_decoder = { @@ -826,6 +833,7 @@ AVCodec msmpeg4v1_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, + mpeg4_decoptions, }; AVCodec msmpeg4v2_decoder = { @@ -838,6 +846,7 @@ AVCodec msmpeg4v2_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, + mpeg4_decoptions, }; AVCodec msmpeg4v3_decoder = { @@ -850,6 +859,7 @@ AVCodec msmpeg4v3_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, + .options = mpeg4_decoptions, }; AVCodec wmv1_decoder = { @@ -862,6 +872,7 @@ AVCodec wmv1_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, + mpeg4_decoptions, }; AVCodec h263i_decoder = { @@ -874,5 +885,6 @@ AVCodec h263i_decoder = { ff_h263_decode_end, ff_h263_decode_frame, CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, + mpeg4_decoptions, }; diff --git a/libavcodec/mpegvideo.c b/libavcodec/mpegvideo.c index 9744179768..2639817265 100644 --- a/libavcodec/mpegvideo.c +++ b/libavcodec/mpegvideo.c @@ -3905,7 +3905,6 @@ char ff_get_pict_type_char(int pict_type){ } } -extern const AVOption common_options[2]; static const AVOption mpeg4_options[] = { AVOPTION_CODEC_INT("bitrate", "desired video bitrate", bit_rate, 4, 240000000, 800000), @@ -3925,7 +3924,7 @@ static const AVOption mpeg4_options[] = flags, CODEC_FLAG_PSNR, 0), AVOPTION_CODEC_RCOVERRIDE("rc_override", "ratecontrol override (=startframe,endframe,qscale,quality_factor)", rc_override), - AVOPTION_SUB(common_options), + AVOPTION_SUB(avoptions_common), AVOPTION_END() }; diff --git a/libavcodec/opts.c b/libavcodec/opts.c index fc00d76393..40a058de1a 100644 --- a/libavcodec/opts.c +++ b/libavcodec/opts.c @@ -12,13 +12,7 @@ #include "avcodec.h" -#ifdef HAVE_MMX -extern const AVOption common_options[3 + 5]; -#else -extern const AVOption common_options[3]; -#endif - -const AVOption common_options[] = { +const AVOption avoptions_common[] = { AVOPTION_CODEC_FLAG("bit_exact", "use only bit-exact stuff", flags, CODEC_FLAG_BITEXACT, 0), AVOPTION_CODEC_FLAG("mm_force", "force mm flags", dsp_mask, FF_MM_FORCE, 0), #ifdef HAVE_MMX @@ -31,6 +25,21 @@ const AVOption common_options[] = { AVOPTION_END() }; +const AVOption avoptions_workaround_bug[] = { + AVOPTION_CODEC_FLAG("bug_autodetect", "workaround bug autodetection", workaround_bugs, FF_BUG_AUTODETECT, 1), + AVOPTION_CODEC_FLAG("bug_old_msmpeg4", "workaround old msmpeg4 bug", workaround_bugs, FF_BUG_OLD_MSMPEG4, 0), + AVOPTION_CODEC_FLAG("bug_xvid_ilace", "workaround XviD interlace bug", workaround_bugs, FF_BUG_XVID_ILACE, 0), + AVOPTION_CODEC_FLAG("bug_ump4", "workaround ump4 bug", workaround_bugs, FF_BUG_UMP4, 0), + AVOPTION_CODEC_FLAG("bug_no_padding", "workaround padding bug", workaround_bugs, FF_BUG_NO_PADDING, 0), + AVOPTION_CODEC_FLAG("bug_ac_vlc", "workaround ac VLC bug", workaround_bugs, FF_BUG_AC_VLC, 0), + AVOPTION_CODEC_FLAG("bug_qpel_chroma", "workaround qpel chroma bug", workaround_bugs, FF_BUG_QPEL_CHROMA, 0), + AVOPTION_CODEC_FLAG("bug_std_qpel", "workaround std qpel bug", workaround_bugs, FF_BUG_STD_QPEL, 0), + AVOPTION_CODEC_FLAG("bug_qpel_chroma2", "workaround qpel chroma2 bug", workaround_bugs, FF_BUG_QPEL_CHROMA2, 0), + AVOPTION_CODEC_FLAG("bug_direct_blocksize", "workaround direct blocksize bug", workaround_bugs, FF_BUG_DIRECT_BLOCKSIZE, 0), + AVOPTION_END() +}; + + static int parse_bool(const AVOption *c, char *s, int *var) { int b = 1; /* by default -on- when present */ @@ -45,7 +54,13 @@ static int parse_bool(const AVOption *c, char *s, int *var) return -1; } - *var = b; + if (c->type == FF_OPT_TYPE_FLAG) { + if (b) + *var |= (int)c->min; + else + *var &= ~(int)c->min; + } else + *var = b; return 0; } -- cgit v1.2.3