* fixed FLAG AVOption Originally committed as revision 1661 to svn://svn.ffmpeg.org/ffmpeg/trunktags/v0.5
| @@ -57,6 +57,14 @@ | |||||
| #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } | #define AVOPTION_SUB(ptr) { .name = NULL, .help = (const char*)ptr } | ||||
| #define AVOPTION_END() AVOPTION_SUB(NULL) | #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 */ | #endif /* HAVE_AV_CONFIG_H */ | ||||
| /* Suppress restrict if it was not defined in config.h. */ | /* Suppress restrict if it was not defined in config.h. */ | ||||
| @@ -792,6 +792,12 @@ printf("%Ld\n", rdtsc()-time); | |||||
| return get_consumed_bytes(s, buf_size); | return get_consumed_bytes(s, buf_size); | ||||
| } | } | ||||
| static const AVOption mpeg4_decoptions[] = | |||||
| { | |||||
| AVOPTION_SUB(avoptions_workaround_bug), | |||||
| AVOPTION_END() | |||||
| }; | |||||
| AVCodec mpeg4_decoder = { | AVCodec mpeg4_decoder = { | ||||
| "mpeg4", | "mpeg4", | ||||
| CODEC_TYPE_VIDEO, | CODEC_TYPE_VIDEO, | ||||
| @@ -802,6 +808,7 @@ AVCodec mpeg4_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1 | CODEC_CAP_TRUNCATED, | ||||
| .options = mpeg4_decoptions, | |||||
| }; | }; | ||||
| AVCodec h263_decoder = { | AVCodec h263_decoder = { | ||||
| @@ -826,6 +833,7 @@ AVCodec msmpeg4v1_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | ||||
| mpeg4_decoptions, | |||||
| }; | }; | ||||
| AVCodec msmpeg4v2_decoder = { | AVCodec msmpeg4v2_decoder = { | ||||
| @@ -838,6 +846,7 @@ AVCodec msmpeg4v2_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | ||||
| mpeg4_decoptions, | |||||
| }; | }; | ||||
| AVCodec msmpeg4v3_decoder = { | AVCodec msmpeg4v3_decoder = { | ||||
| @@ -850,6 +859,7 @@ AVCodec msmpeg4v3_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | ||||
| .options = mpeg4_decoptions, | |||||
| }; | }; | ||||
| AVCodec wmv1_decoder = { | AVCodec wmv1_decoder = { | ||||
| @@ -862,6 +872,7 @@ AVCodec wmv1_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | ||||
| mpeg4_decoptions, | |||||
| }; | }; | ||||
| AVCodec h263i_decoder = { | AVCodec h263i_decoder = { | ||||
| @@ -874,5 +885,6 @@ AVCodec h263i_decoder = { | |||||
| ff_h263_decode_end, | ff_h263_decode_end, | ||||
| ff_h263_decode_frame, | ff_h263_decode_frame, | ||||
| CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1, | ||||
| mpeg4_decoptions, | |||||
| }; | }; | ||||
| @@ -3905,7 +3905,6 @@ char ff_get_pict_type_char(int pict_type){ | |||||
| } | } | ||||
| } | } | ||||
| extern const AVOption common_options[2]; | |||||
| static const AVOption mpeg4_options[] = | static const AVOption mpeg4_options[] = | ||||
| { | { | ||||
| AVOPTION_CODEC_INT("bitrate", "desired video bitrate", bit_rate, 4, 240000000, 800000), | 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), | flags, CODEC_FLAG_PSNR, 0), | ||||
| AVOPTION_CODEC_RCOVERRIDE("rc_override", "ratecontrol override (=startframe,endframe,qscale,quality_factor)", | AVOPTION_CODEC_RCOVERRIDE("rc_override", "ratecontrol override (=startframe,endframe,qscale,quality_factor)", | ||||
| rc_override), | rc_override), | ||||
| AVOPTION_SUB(common_options), | |||||
| AVOPTION_SUB(avoptions_common), | |||||
| AVOPTION_END() | AVOPTION_END() | ||||
| }; | }; | ||||
| @@ -12,13 +12,7 @@ | |||||
| #include "avcodec.h" | #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("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), | AVOPTION_CODEC_FLAG("mm_force", "force mm flags", dsp_mask, FF_MM_FORCE, 0), | ||||
| #ifdef HAVE_MMX | #ifdef HAVE_MMX | ||||
| @@ -31,6 +25,21 @@ const AVOption common_options[] = { | |||||
| AVOPTION_END() | 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) | static int parse_bool(const AVOption *c, char *s, int *var) | ||||
| { | { | ||||
| int b = 1; /* by default -on- when present */ | 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; | 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; | return 0; | ||||
| } | } | ||||