---
 libavcodec/aacdec.c       |    4 +++
 libavcodec/ac3dec.c       |    4 +++
 libavcodec/alsdec.c       |   12 ++++++++++
 libavcodec/h261dec.c      |    4 +++
 libavcodec/h263dec.c      |    4 +++
 libavcodec/h264.c         |    8 +++++++
 libavcodec/h264_refs.c    |    4 +++
 libavcodec/ituh263dec.c   |    4 +++
 libavcodec/mjpegbdec.c    |    8 +++++++
 libavcodec/mjpegdec.c     |    4 +++
 libavcodec/mpeg12.c       |   52 +++++++++++++++++++++++++++++++++++++++++++++
 libavcodec/mpegaudiodec.c |   12 ++++++++++
 libavcodec/mxpegdec.c     |    8 +++++++
 libavcodec/options.c      |   10 +++++++-
 libavcodec/version.h      |    2 +-
 libavformat/avidec.c      |    8 +++++++
 libavformat/options.c     |    6 +++++
 17 files changed, 151 insertions(+), 3 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index ef5daed..b272132 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -594,7 +594,11 @@ static av_cold int aac_decode_init(AVCodecContext *avctx)
             int ret = set_default_channel_config(avctx, new_che_pos, 
ac->m4ac.chan_config);
             if (!ret)
                 output_configure(ac, ac->che_pos, new_che_pos, 
ac->m4ac.chan_config, OC_GLOBAL_HDR);
+#if FF_API_ER
             else if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+            else if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                 return AVERROR_INVALIDDATA;
         }
     }
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 79360c2..68074d6 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1357,7 +1357,11 @@ static int ac3_decode_frame(AVCodecContext * avctx, void 
*data, int *data_size,
         if (s->frame_size > buf_size) {
             av_log(avctx, AV_LOG_ERROR, "incomplete frame\n");
             err = AAC_AC3_PARSE_ERROR_FRAME_SIZE;
+#if FF_API_ER
         } else if (avctx->error_recognition >= FF_ER_CAREFUL) {
+#else
+        } else if (avctx->error_recognition & AV_ER_CRCCHECK) {
+#endif /* FF_API_ER */
             /* check for crc mismatch */
             if (av_crc(av_crc_get_table(AV_CRC_16_ANSI), 0, &buf[2], 
s->frame_size-2)) {
                 av_log(avctx, AV_LOG_ERROR, "frame CRC mismatch\n");
diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 1ab72ad..a8aed39 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -393,7 +393,11 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
         if (get_bits_left(&gb) < 32)
             return -1;
 
+#if FF_API_ER
         if (avctx->error_recognition >= FF_ER_CAREFUL) {
+#else
+        if (avctx->error_recognition & AV_ER_CRCCHECK) {
+#endif /* FF_API_ER */
             ctx->crc_table = av_crc_get_table(AV_CRC_32_IEEE_LE);
             ctx->crc       = 0xFFFFFFFF;
             ctx->crc_org   = ~get_bits_long(&gb, 32);
@@ -1476,7 +1480,11 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     // update CRC
+#if FF_API_ER
     if (sconf->crc_enabled && avctx->error_recognition >= FF_ER_CAREFUL) {
+#else
+    if (sconf->crc_enabled && (avctx->error_recognition & AV_ER_CRCCHECK)) {
+#endif /* FF_API_ER */
         int swap = HAVE_BIGENDIAN != sconf->msb_first;
 
         if (ctx->avctx->bits_per_raw_sample == 24) {
@@ -1710,7 +1718,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     // allocate crc buffer
     if (HAVE_BIGENDIAN != sconf->msb_first && sconf->crc_enabled &&
+#if FF_API_ER
         avctx->error_recognition >= FF_ER_CAREFUL) {
+#else
+        (avctx->error_recognition & AV_ER_CRCCHECK)) {
+#endif /* FF_API_ER */
         ctx->crc_buffer = av_malloc(sizeof(*ctx->crc_buffer) *
                                     ctx->cur_frame_length *
                                     avctx->channels *
diff --git a/libavcodec/h261dec.c b/libavcodec/h261dec.c
index 00375ef..15304dc 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -136,7 +136,11 @@ static int h261_decode_gob_header(H261Context *h){
 
     if(s->qscale==0) {
         av_log(s->avctx, AV_LOG_ERROR, "qscale has forbidden 0 value\n");
+#if FF_API_ER
         if (s->avctx->error_recognition >= FF_ER_COMPLIANT)
+#else
+        if (s->avctx->error_recognition & AV_ER_BITSTREAM)
+#endif /* FF_API_ER */
             return -1;
     }
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8786679..9d5f388 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -724,7 +724,11 @@ intrax8_decoded:
 av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
 #endif
 
+#if FF_API_ER
     return (ret && avctx->error_recognition >= 
FF_ER_EXPLODE)?ret:get_consumed_bytes(s, buf_size);
+#else
+    return (ret && (avctx->error_recognition & 
AV_ER_EXPLODE))?ret:get_consumed_bytes(s, buf_size);
+#endif /* FF_API_ER */
 }
 
 AVCodec ff_h263_decoder = {
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index e5d0ed8..24dadbf 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2703,7 +2703,11 @@ static int decode_slice_header(H264Context *h, 
H264Context *h0){
             ff_thread_report_progress((AVFrame*)s->current_picture_ptr, 
INT_MAX, 1);
             ff_generate_sliding_window_mmcos(h);
             if (ff_h264_execute_ref_pic_marking(h, h->mmco, h->mmco_index) < 0 
&&
+#if FF_API_ER
                 s->avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                (s->avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
                 return AVERROR_INVALIDDATA;
             /* Error concealment: if a ref is missing, copy the previous ref 
in its place.
              * FIXME: avoiding a memcpy would be nice, but ref handling makes 
many assumptions
@@ -2879,7 +2883,11 @@ static int decode_slice_header(H264Context *h, 
H264Context *h0){
     }
 
     if(h->nal_ref_idc && ff_h264_decode_ref_pic_marking(h0, &s->gb) < 0 &&
+#if FF_API_ER
        s->avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+       (s->avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
         return AVERROR_INVALIDDATA;
 
     if(FRAME_MBAFF){
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 1f30916..586a7cb 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -655,7 +655,11 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO 
*mmco, int mmco_count){
 
     print_short_term(h);
     print_long_term(h);
+#if FF_API_ER
     return h->s.avctx->error_recognition >= FF_ER_EXPLODE ? err : 0;
+#else
+    return (h->s.avctx->error_recognition & AV_ER_EXPLODE) ? err : 0;
+#endif /* FF_API_ER */
 }
 
 int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
diff --git a/libavcodec/ituh263dec.c b/libavcodec/ituh263dec.c
index a54d7c1..e00ab60 100644
--- a/libavcodec/ituh263dec.c
+++ b/libavcodec/ituh263dec.c
@@ -485,7 +485,11 @@ static int h263_decode_block(MpegEncContext * s, DCTELEM * 
block,
             level = get_bits(&s->gb, 8);
             if((level&0x7F) == 0){
                 av_log(s->avctx, AV_LOG_ERROR, "illegal dc %d at %d %d\n", 
level, s->mb_x, s->mb_y);
+#if FF_API_ER
                 if(s->error_recognition >= FF_ER_COMPLIANT)
+#else
+                if(s->error_recognition & AV_ER_BITSTREAM)
+#endif /* FF_API_ER */
                     return -1;
             }
             if (level == 255)
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index a9f94f1..2603224 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -82,7 +82,11 @@ read_header:
         init_get_bits(&s->gb, buf_ptr+dqt_offs, (buf_end - 
(buf_ptr+dqt_offs))*8);
         s->start_code = DQT;
         if (ff_mjpeg_decode_dqt(s) < 0 &&
+#if FF_API_ER
             avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+            (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
           return AVERROR_INVALIDDATA;
     }
 
@@ -116,7 +120,11 @@ read_header:
         s->mjpb_skiptosod = (sod_offs - sos_offs - show_bits(&s->gb, 16));
         s->start_code = SOS;
         if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
+#if FF_API_ER
             avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+            (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
           return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 168cc0b..def571d 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1531,7 +1531,11 @@ eoi_parser:
                         break;
                     }
                     if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
+#if FF_API_ER
                         avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                        (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
                       return AVERROR_INVALIDDATA;
                     /* buggy avid puts EOI every 10-20th frame */
                     /* if restart period is over process EOI */
diff --git a/libavcodec/mpeg12.c b/libavcodec/mpeg12.c
index 6a12344..5db66d0 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1344,7 +1344,11 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
     if (s->pict_type == AV_PICTURE_TYPE_P || s->pict_type == 
AV_PICTURE_TYPE_B) {
         s->full_pel[0] = get_bits1(&s->gb);
         f_code = get_bits(&s->gb, 3);
+#if FF_API_ER
         if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+#else
+        if (f_code == 0 && (avctx->error_recognition & AV_ER_BITSTREAM))
+#endif /* FF_API_ER */
             return -1;
         s->mpeg_f_code[0][0] = f_code;
         s->mpeg_f_code[0][1] = f_code;
@@ -1352,7 +1356,11 @@ static int mpeg1_decode_picture(AVCodecContext *avctx,
     if (s->pict_type == AV_PICTURE_TYPE_B) {
         s->full_pel[1] = get_bits1(&s->gb);
         f_code = get_bits(&s->gb, 3);
+#if FF_API_ER
         if (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+#else
+        if (f_code == 0 && (avctx->error_recognition & AV_ER_BITSTREAM))
+#endif /* FF_API_ER */
             return -1;
         s->mpeg_f_code[1][0] = f_code;
         s->mpeg_f_code[1][1] = f_code;
@@ -1786,7 +1794,11 @@ static int mpeg_decode_slice(Mpeg1Context *s1, int mb_y,
                              && s->progressive_frame == 0 /* vbv_delay == 
0xBBB || 0xE10*/;
 
                 if (left < 0 || (left && show_bits(&s->gb, FFMIN(left, 23)) && 
!is_d10)
+#if FF_API_ER
                     || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left > 
8)) {
+#else
+                    || ((avctx->error_recognition & AV_ER_AGGRESSIVE) && left 
> 8)) {
+#endif /* FF_API_ER */
                     av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", 
left, show_bits(&s->gb, FFMIN(left, 23)));
                     return -1;
                 } else
@@ -1878,7 +1890,11 @@ static int slice_decode_thread(AVCodecContext *c, void 
*arg)
 //av_log(c, AV_LOG_DEBUG, "ret:%d resync:%d/%d mb:%d/%d ts:%d/%d ec:%d\n",
 //ret, s->resync_mb_x, s->resync_mb_y, s->mb_x, s->mb_y, s->start_mb_y, 
s->end_mb_y, s->error_count);
         if (ret < 0) {
+#if FF_API_ER
             if (c->error_recognition >= FF_ER_EXPLODE)
+#else
+            if (c->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                 return ret;
             if (s->resync_mb_x >= 0 && s->resync_mb_y >= 0)
                 ff_er_add_slice(s, s->resync_mb_x, s->resync_mb_y, s->mb_x, 
s->mb_y, AC_ERROR | DC_ERROR | MV_ERROR);
@@ -1966,7 +1982,11 @@ static int mpeg1_decode_sequence(AVCodecContext *avctx,
     s->aspect_ratio_info = get_bits(&s->gb, 4);
     if (s->aspect_ratio_info == 0) {
         av_log(avctx, AV_LOG_ERROR, "aspect ratio has forbidden 0 value\n");
+#if FF_API_ER
         if (avctx->error_recognition >= FF_ER_COMPLIANT)
+#else
+        if (avctx->error_recognition & AV_ER_BITSTREAM)
+#endif /* FF_API_ER */
             return -1;
     }
     s->frame_rate_index = get_bits(&s->gb, 4);
@@ -2240,7 +2260,11 @@ static int mpeg_decode_frame(AVCodecContext *avctx,
 
     if (avctx->extradata && !avctx->frame_number) {
         int ret = decode_chunks(avctx, picture, data_size, avctx->extradata, 
avctx->extradata_size);
+#if FF_API_ER
         if (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+        if (ret < 0 && (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
             return ret;
     }
 
@@ -2298,7 +2322,11 @@ static int decode_chunks(AVCodecContext *avctx,
                 s->sync=1;
             } else {
                 av_log(avctx, AV_LOG_ERROR, "ignoring SEQ_START_CODE after 
%X\n", last_code);
+#if FF_API_ER
                 if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2328,7 +2356,11 @@ static int decode_chunks(AVCodecContext *avctx,
                 last_code = PICTURE_START_CODE;
             } else {
                 av_log(avctx, AV_LOG_ERROR, "ignoring pic after %X\n", 
last_code);
+#if FF_API_ER
                 if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2341,7 +2373,11 @@ static int decode_chunks(AVCodecContext *avctx,
                 mpeg_decode_sequence_extension(s);
                 } else {
                     av_log(avctx, AV_LOG_ERROR, "ignoring seq ext after %X\n", 
last_code);
+#if FF_API_ER
                     if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                    if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                         return AVERROR_INVALIDDATA;
                 }
                 break;
@@ -2359,7 +2395,11 @@ static int decode_chunks(AVCodecContext *avctx,
                     mpeg_decode_picture_coding_extension(s);
                 } else {
                     av_log(avctx, AV_LOG_ERROR, "ignoring pic cod ext after 
%X\n", last_code);
+#if FF_API_ER
                     if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                    if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                         return AVERROR_INVALIDDATA;
                 }
                 break;
@@ -2375,7 +2415,11 @@ static int decode_chunks(AVCodecContext *avctx,
                 s->sync=1;
             } else {
                 av_log(avctx, AV_LOG_ERROR, "ignoring GOP_START_CODE after 
%X\n", last_code);
+#if FF_API_ER
                 if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2422,7 +2466,11 @@ static int decode_chunks(AVCodecContext *avctx,
 
                 if (!s2->pict_type) {
                     av_log(avctx, AV_LOG_ERROR, "Missing picture start 
code\n");
+#if FF_API_ER
                     if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                    if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                         return AVERROR_INVALIDDATA;
                     break;
                 }
@@ -2462,7 +2510,11 @@ static int decode_chunks(AVCodecContext *avctx,
                     emms_c();
 
                     if (ret < 0) {
+#if FF_API_ER
                         if (avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                        if (avctx->error_recognition & AV_ER_EXPLODE)
+#endif /* FF_API_ER */
                             return ret;
                         if (s2->resync_mb_x >= 0 && s2->resync_mb_y >= 0)
                             ff_er_add_slice(s2, s2->resync_mb_x, 
s2->resync_mb_y, s2->mb_x, s2->mb_y, AC_ERROR | DC_ERROR | MV_ERROR);
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c
index 6f841e8..ae2f362 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -1104,7 +1104,11 @@ static int huffman_decode(MPADecodeContext *s, 
GranuleDef *g,
                 s_index -= 4;
                 skip_bits_long(&s->gb, last_pos - pos);
                 av_log(s->avctx, AV_LOG_INFO, "overread, skip %d enddists: %d 
%d\n", last_pos - pos, end_pos-pos, end_pos2-pos);
+#if FF_API_ER
                 if(s->error_recognition >= FF_ER_COMPLIANT)
+#else
+                if(s->error_recognition & AV_ER_BITSTREAM)
+#endif /* FF_API_ER */
                     s_index=0;
                 break;
             }
@@ -1134,10 +1138,18 @@ static int huffman_decode(MPADecodeContext *s, 
GranuleDef *g,
     /* skip extension bits */
     bits_left = end_pos2 - get_bits_count(&s->gb);
 //av_log(NULL, AV_LOG_ERROR, "left:%d buf:%p\n", bits_left, s->in_gb.buffer);
+#if FF_API_ER
     if (bits_left < 0 && s->error_recognition >= FF_ER_COMPLIANT) {
+#else
+    if (bits_left < 0 && (s->error_recognition & AV_ER_BITSTREAM)) {
+#endif /* FF_API_ER */
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
         s_index=0;
+#if FF_API_ER
     }else if(bits_left > 0 && s->error_recognition >= FF_ER_AGGRESSIVE){
+#else
+    }else if(bits_left > 0 && (s->error_recognition & AV_ER_AGGRESSIVE)){
+#endif /* FF_API_ER */
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
         s_index=0;
     }
diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c
index fd3fef4..2c23b2f 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -274,11 +274,19 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
                     }
 
                     ret = ff_mjpeg_decode_sos(jpg, s->mxm_bitmask, 
reference_ptr);
+#if FF_API_ER
                     if (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                    if (ret < 0 && (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
                         return ret;
                 } else {
                     ret = ff_mjpeg_decode_sos(jpg, NULL, NULL);
+#if FF_API_ER
                     if (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+#else
+                    if (ret < 0 && (avctx->error_recognition & AV_ER_EXPLODE))
+#endif /* FF_API_ER */
                         return ret;
                 }
 
diff --git a/libavcodec/options.c b/libavcodec/options.c
index 5a048bd..037eea3 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -195,14 +195,20 @@ static const AVOption options[]={
 {"unofficial", "allow unofficial extensions", 0, FF_OPT_TYPE_CONST, {.dbl = 
FF_COMPLIANCE_UNOFFICIAL }, INT_MIN, INT_MAX, V|D|E, "strict"},
 {"experimental", "allow non standardized experimental things", 0, 
FF_OPT_TYPE_CONST, {.dbl = FF_COMPLIANCE_EXPERIMENTAL }, INT_MIN, INT_MAX, 
V|D|E, "strict"},
 {"b_qoffset", "qp offset between P and B frames", OFFSET(b_quant_offset), 
FF_OPT_TYPE_FLOAT, {.dbl = 1.25 }, -FLT_MAX, FLT_MAX, V|E},
+#if FF_API_ER
 {"er", "set error detection aggressivity", OFFSET(error_recognition), 
FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, A|V|D, "er"},
 {"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, 
INT_MAX, V|D, "er"},
 {"compliant", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_COMPLIANT }, INT_MIN, 
INT_MAX, V|D, "er"},
 {"aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_AGGRESSIVE }, 
INT_MIN, INT_MAX, V|D, "er"},
-#if FF_API_ER
 {"very_aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_VERY_AGGRESSIVE 
}, INT_MIN, INT_MAX, V|D, "er"},
-#endif /* FF_API_ER */
 {"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl 
= FF_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
+#else
+{"er", "set error detection aggressivity", OFFSET(error_recognition), 
FF_OPT_TYPE_INT, {.dbl = AV_ER_CRCCHECK | AV_ER_BITSTREAM }, INT_MIN, INT_MAX, 
A|V|D, "er"},
+{"crccheck", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_ER_CRCCHECK }, INT_MIN, 
INT_MAX, V|D, "er"},
+{"bitstream", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_ER_BITSTREAM }, INT_MIN, 
INT_MAX, V|D, "er"},
+{"aggressive", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_ER_AGGRESSIVE }, 
INT_MIN, INT_MAX, V|D, "er"},
+{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl 
= AV_ER_EXPLODE }, INT_MIN, INT_MAX, V|D, "er"},
+#endif /* FF_API_ER */
 {"has_b_frames", NULL, OFFSET(has_b_frames), FF_OPT_TYPE_INT, {.dbl = DEFAULT 
}, INT_MIN, INT_MAX},
 {"block_align", NULL, OFFSET(block_align), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 
INT_MIN, INT_MAX},
 {"parse_only", NULL, OFFSET(parse_only), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 
INT_MIN, INT_MAX},
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 9c90859..661b94f 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -78,7 +78,7 @@
 #define FF_API_DRC_SCALE        (LIBAVCODEC_VERSION_MAJOR < 54)
 #endif
 #ifndef FF_API_ER
-#define FF_API_ER  (LIBAVCODEC_VERSION_MAJOR < 54)
+#define FF_API_ER               (LIBAVCODEC_VERSION_MAJOR < 54)
 #endif
 #ifndef FF_API_AVCODEC_INIT
 #define FF_API_AVCODEC_INIT     (LIBAVCODEC_VERSION_MAJOR < 54)
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 8c0ef13..c3c0e37 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -668,7 +668,11 @@ static int avi_read_header(AVFormatContext *s, 
AVFormatParameters *ap)
         case MKTAG('i', 'n', 'd', 'x'):
             i= avio_tell(pb);
             if(pb->seekable && !(s->flags & AVFMT_FLAG_IGNIDX) &&
+#if FF_API_ER
                read_braindead_odml_indx(s, 0) < 0 && s->error_recognition >= 
FF_ER_EXPLODE){
+#else
+               read_braindead_odml_indx(s, 0) < 0 && (s->error_recognition & 
AV_ER_EXPLODE)){
+#endif /* FF_API_ER */
                 goto fail;
             }
             avio_seek(pb, i+size, SEEK_SET);
@@ -707,7 +711,11 @@ static int avi_read_header(AVFormatContext *s, 
AVFormatParameters *ap)
             if(size > 1000000){
                 av_log(s, AV_LOG_ERROR, "Something went wrong during header 
parsing, "
                                         "I will ignore it and try to continue 
anyway.\n");
+#if FF_API_ER
                 if (s->error_recognition >= FF_ER_EXPLODE) goto fail;
+#else
+                if (s->error_recognition & AV_ER_EXPLODE) goto fail;
+#endif /* FF_API_ER */
                 avi->movi_list = avio_tell(pb) - 4;
                 avi->movi_end  = avio_size(pb);
                 goto end_of_header;
diff --git a/libavformat/options.c b/libavformat/options.c
index 43a6dec..b1552ac 100644
--- a/libavformat/options.c
+++ b/libavformat/options.c
@@ -87,9 +87,15 @@ static const AVOption options[]={
 {"fdebug", "print specific debug info", OFFSET(debug), FF_OPT_TYPE_FLAGS, 
{.dbl = DEFAULT }, 0, INT_MAX, E|D, "fdebug"},
 {"ts", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_FDEBUG_TS }, INT_MIN, INT_MAX, 
E|D, "fdebug"},
 {"max_delay", "maximum muxing or demuxing delay in microseconds", 
OFFSET(max_delay), FF_OPT_TYPE_INT, {.dbl = DEFAULT }, 0, INT_MAX, E|D},
+#if FF_API_ER
 {"fer", "set error detection aggressivity", OFFSET(error_recognition), 
FF_OPT_TYPE_INT, {.dbl = FF_ER_CAREFUL }, INT_MIN, INT_MAX, D, "fer"},
 {"careful", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = FF_ER_CAREFUL }, INT_MIN, 
INT_MAX, D, "fer"},
 {"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl 
= FF_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
+#else
+{"fer", "set error detection aggressivity", OFFSET(error_recognition), 
FF_OPT_TYPE_INT, {.dbl = AV_ER_CRCCHECK | AV_ER_BITSTREAM }, INT_MIN, INT_MAX, 
D, "fer"},
+{"bitstream", NULL, 0, FF_OPT_TYPE_CONST, {.dbl = AV_ER_BITSTREAM }, INT_MIN, 
INT_MAX, D, "fer"},
+{"explode", "abort decoding on error recognition", 0, FF_OPT_TYPE_CONST, {.dbl 
= AV_ER_EXPLODE }, INT_MIN, INT_MAX, D, "fer"},
+#endif /* FF_API_ER */
 {"fpsprobesize", "number of frames used to probe fps", OFFSET(fps_probe_size), 
FF_OPT_TYPE_INT, {.dbl = -1}, -1, INT_MAX-1, D},
 {NULL},
 };
-- 
1.7.2.5

_______________________________________________
libav-devel mailing list
libav-devel@libav.org
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to