changeset 1124:64c7c76ed17c libavcodec

* 'externaly' visible option list begins avoptions_ prefix * fixed FLAG AVOption
author kabi
date Mon, 10 Mar 2003 11:48:33 +0000
parents 9403cad8a1e8
children 0980ae063f4e
files common.h h263dec.c mpegvideo.c opts.c
diffstat 4 files changed, 44 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/common.h	Mon Mar 10 11:24:10 2003 +0000
+++ b/common.h	Mon Mar 10 11:48:33 2003 +0000
@@ -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.  */
--- a/h263dec.c	Mon Mar 10 11:24:10 2003 +0000
+++ b/h263dec.c	Mon Mar 10 11:48:33 2003 +0000
@@ -792,6 +792,12 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     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 @@
     ff_h263_decode_end,
     ff_h263_decode_frame,
     CODEC_CAP_DRAW_HORIZ_BAND | CODEC_CAP_DR1,
+    mpeg4_decoptions,
 };
 
--- a/mpegvideo.c	Mon Mar 10 11:24:10 2003 +0000
+++ b/mpegvideo.c	Mon Mar 10 11:48:33 2003 +0000
@@ -3905,7 +3905,6 @@
     }
 }
 
-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 @@
 		        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()
 };
 
--- a/opts.c	Mon Mar 10 11:24:10 2003 +0000
+++ b/opts.c	Mon Mar 10 11:48:33 2003 +0000
@@ -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 @@
     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 @@
 	    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;
 }