[FFmpeg-cvslog] lavc: replace references to deprecated AVCodecContext. error_recognition to use AVCodecContext.err_recognition

Dustin Brody git at videolan.org
Sun Oct 23 05:53:09 CEST 2011


ffmpeg | branch: master | Dustin Brody <libav at parsoma.net> | Sat Oct 22 08:44:16 2011 -0400| [9abc98737fe12ee67ddb7d52e9d497d4de2bac6c] | committer: Anton Khirnov

lavc: replace references to deprecated AVCodecContext.error_recognition to use AVCodecContext.err_recognition

Signed-off-by: Anton Khirnov <anton at khirnov.net>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9abc98737fe12ee67ddb7d52e9d497d4de2bac6c
---

 libavcodec/aacdec.c       |    2 +-
 libavcodec/ac3dec.c       |    2 +-
 libavcodec/alsdec.c       |    6 +++---
 libavcodec/h261dec.c      |    2 +-
 libavcodec/h263dec.c      |    2 +-
 libavcodec/h264.c         |    4 ++--
 libavcodec/h264_refs.c    |    2 +-
 libavcodec/mjpegbdec.c    |    4 ++--
 libavcodec/mjpegdec.c     |    2 +-
 libavcodec/mpeg12.c       |   26 +++++++++++++-------------
 libavcodec/mpegaudiodec.c |   10 +++++-----
 libavcodec/mxpegdec.c     |    4 ++--
 12 files changed, 33 insertions(+), 33 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index a3a6b42..e4e18d6 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -594,7 +594,7 @@ 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);
-            else if (avctx->error_recognition >= FF_ER_EXPLODE)
+            else if (avctx->err_recognition & AV_EF_EXPLODE)
                 return AVERROR_INVALIDDATA;
         }
     }
diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c
index 134e0b5..8e216c0 100644
--- a/libavcodec/ac3dec.c
+++ b/libavcodec/ac3dec.c
@@ -1357,7 +1357,7 @@ 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;
-        } else if (avctx->error_recognition >= FF_ER_CAREFUL) {
+        } else if (avctx->err_recognition & AV_EF_CRCCHECK) {
             /* 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 4301fab..e7a0de2 100644
--- a/libavcodec/alsdec.c
+++ b/libavcodec/alsdec.c
@@ -393,7 +393,7 @@ static av_cold int read_specific_config(ALSDecContext *ctx)
         if (get_bits_left(&gb) < 32)
             return -1;
 
-        if (avctx->error_recognition >= FF_ER_CAREFUL) {
+        if (avctx->err_recognition & AV_EF_CRCCHECK) {
             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 +1476,7 @@ static int decode_frame(AVCodecContext *avctx,
     }
 
     // update CRC
-    if (sconf->crc_enabled && avctx->error_recognition >= FF_ER_CAREFUL) {
+    if (sconf->crc_enabled && (avctx->err_recognition & AV_EF_CRCCHECK)) {
         int swap = HAVE_BIGENDIAN != sconf->msb_first;
 
         if (ctx->avctx->bits_per_raw_sample == 24) {
@@ -1710,7 +1710,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
 
     // allocate crc buffer
     if (HAVE_BIGENDIAN != sconf->msb_first && sconf->crc_enabled &&
-        avctx->error_recognition >= FF_ER_CAREFUL) {
+        (avctx->err_recognition & AV_EF_CRCCHECK)) {
         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..81f7dc6 100644
--- a/libavcodec/h261dec.c
+++ b/libavcodec/h261dec.c
@@ -136,7 +136,7 @@ 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 (s->avctx->error_recognition >= FF_ER_COMPLIANT)
+        if (s->avctx->err_recognition & AV_EF_BITSTREAM)
             return -1;
     }
 
diff --git a/libavcodec/h263dec.c b/libavcodec/h263dec.c
index 8786679..48f8240 100644
--- a/libavcodec/h263dec.c
+++ b/libavcodec/h263dec.c
@@ -724,7 +724,7 @@ intrax8_decoded:
 av_log(avctx, AV_LOG_DEBUG, "%"PRId64"\n", rdtsc()-time);
 #endif
 
-    return (ret && avctx->error_recognition >= FF_ER_EXPLODE)?ret:get_consumed_bytes(s, buf_size);
+    return (ret && (avctx->err_recognition & AV_EF_EXPLODE))?ret:get_consumed_bytes(s, buf_size);
 }
 
 AVCodec ff_h263_decoder = {
diff --git a/libavcodec/h264.c b/libavcodec/h264.c
index 17124c3..3f711c6 100644
--- a/libavcodec/h264.c
+++ b/libavcodec/h264.c
@@ -2827,7 +2827,7 @@ 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 &&
-                s->avctx->error_recognition >= FF_ER_EXPLODE)
+                (s->avctx->err_recognition & AV_EF_EXPLODE))
                 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
@@ -3005,7 +3005,7 @@ static int decode_slice_header(H264Context *h, H264Context *h0){
     }
 
     if(h->nal_ref_idc && ff_h264_decode_ref_pic_marking(h0, &s->gb) < 0 &&
-       s->avctx->error_recognition >= FF_ER_EXPLODE)
+       (s->avctx->err_recognition & AV_EF_EXPLODE))
         return AVERROR_INVALIDDATA;
 
     if(FRAME_MBAFF){
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index 1f30916..370b5c3 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -655,7 +655,7 @@ int ff_h264_execute_ref_pic_marking(H264Context *h, MMCO *mmco, int mmco_count){
 
     print_short_term(h);
     print_long_term(h);
-    return h->s.avctx->error_recognition >= FF_ER_EXPLODE ? err : 0;
+    return (h->s.avctx->err_recognition & AV_EF_EXPLODE) ? err : 0;
 }
 
 int ff_h264_decode_ref_pic_marking(H264Context *h, GetBitContext *gb){
diff --git a/libavcodec/mjpegbdec.c b/libavcodec/mjpegbdec.c
index a9f94f1..4ad17ab 100644
--- a/libavcodec/mjpegbdec.c
+++ b/libavcodec/mjpegbdec.c
@@ -82,7 +82,7 @@ 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 &&
-            avctx->error_recognition >= FF_ER_EXPLODE)
+            (avctx->err_recognition & AV_EF_EXPLODE))
           return AVERROR_INVALIDDATA;
     }
 
@@ -116,7 +116,7 @@ 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 &&
-            avctx->error_recognition >= FF_ER_EXPLODE)
+            (avctx->err_recognition & AV_EF_EXPLODE))
           return AVERROR_INVALIDDATA;
     }
 
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index 592dfe7..0a1236c 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -1531,7 +1531,7 @@ eoi_parser:
                         break;
                     }
                     if (ff_mjpeg_decode_sos(s, NULL, NULL) < 0 &&
-                        avctx->error_recognition >= FF_ER_EXPLODE)
+                        (avctx->err_recognition & AV_EF_EXPLODE))
                       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 b7b8abd..cdccefb 100644
--- a/libavcodec/mpeg12.c
+++ b/libavcodec/mpeg12.c
@@ -1342,7 +1342,7 @@ 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 (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+        if (f_code == 0 && (avctx->err_recognition & AV_EF_BITSTREAM))
             return -1;
         s->mpeg_f_code[0][0] = f_code;
         s->mpeg_f_code[0][1] = f_code;
@@ -1350,7 +1350,7 @@ 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 (f_code == 0 && avctx->error_recognition >= FF_ER_COMPLIANT)
+        if (f_code == 0 && (avctx->err_recognition & AV_EF_BITSTREAM))
             return -1;
         s->mpeg_f_code[1][0] = f_code;
         s->mpeg_f_code[1][1] = f_code;
@@ -1784,7 +1784,7 @@ 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)
-                    || (avctx->error_recognition >= FF_ER_AGGRESSIVE && left > 8)) {
+                    || ((avctx->err_recognition & AV_EF_BUFFER) && left > 8)) {
                     av_log(avctx, AV_LOG_ERROR, "end mismatch left=%d %0X\n", left, show_bits(&s->gb, FFMIN(left, 23)));
                     return -1;
                 } else
@@ -1876,7 +1876,7 @@ 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 (c->error_recognition >= FF_ER_EXPLODE)
+            if (c->err_recognition & AV_EF_EXPLODE)
                 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);
@@ -1964,7 +1964,7 @@ 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 (avctx->error_recognition >= FF_ER_COMPLIANT)
+        if (avctx->err_recognition & AV_EF_BITSTREAM)
             return -1;
     }
     s->frame_rate_index = get_bits(&s->gb, 4);
@@ -2238,7 +2238,7 @@ 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 (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+        if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
             return ret;
     }
 
@@ -2296,7 +2296,7 @@ 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 (avctx->error_recognition >= FF_ER_EXPLODE)
+                if (avctx->err_recognition & AV_EF_EXPLODE)
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2326,7 +2326,7 @@ 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 (avctx->error_recognition >= FF_ER_EXPLODE)
+                if (avctx->err_recognition & AV_EF_EXPLODE)
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2339,7 +2339,7 @@ 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 (avctx->error_recognition >= FF_ER_EXPLODE)
+                    if (avctx->err_recognition & AV_EF_EXPLODE)
                         return AVERROR_INVALIDDATA;
                 }
                 break;
@@ -2357,7 +2357,7 @@ 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 (avctx->error_recognition >= FF_ER_EXPLODE)
+                    if (avctx->err_recognition & AV_EF_EXPLODE)
                         return AVERROR_INVALIDDATA;
                 }
                 break;
@@ -2373,7 +2373,7 @@ 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 (avctx->error_recognition >= FF_ER_EXPLODE)
+                if (avctx->err_recognition & AV_EF_EXPLODE)
                     return AVERROR_INVALIDDATA;
             }
             break;
@@ -2420,7 +2420,7 @@ static int decode_chunks(AVCodecContext *avctx,
 
                 if (!s2->pict_type) {
                     av_log(avctx, AV_LOG_ERROR, "Missing picture start code\n");
-                    if (avctx->error_recognition >= FF_ER_EXPLODE)
+                    if (avctx->err_recognition & AV_EF_EXPLODE)
                         return AVERROR_INVALIDDATA;
                     break;
                 }
@@ -2460,7 +2460,7 @@ static int decode_chunks(AVCodecContext *avctx,
                     emms_c();
 
                     if (ret < 0) {
-                        if (avctx->error_recognition >= FF_ER_EXPLODE)
+                        if (avctx->err_recognition & AV_EF_EXPLODE)
                             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 2b357b5..e3d19c0 100644
--- a/libavcodec/mpegaudiodec.c
+++ b/libavcodec/mpegaudiodec.c
@@ -79,7 +79,7 @@ typedef struct MPADecodeContext {
 #endif
     int adu_mode; ///< 0 for standard mp3, 1 for adu formatted mp3
     int dither_state;
-    int error_recognition;
+    int err_recognition;
     AVCodecContext* avctx;
     MPADSPContext mpadsp;
 } MPADecodeContext;
@@ -280,7 +280,7 @@ static av_cold int decode_init(AVCodecContext * avctx)
     ff_mpadsp_init(&s->mpadsp);
 
     avctx->sample_fmt= OUT_FMT;
-    s->error_recognition= avctx->error_recognition;
+    s->err_recognition = avctx->err_recognition;
 
     if (!init && !avctx->parse_only) {
         int offset;
@@ -1104,7 +1104,7 @@ 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(s->error_recognition >= FF_ER_COMPLIANT)
+                if(s->err_recognition & AV_EF_BITSTREAM)
                     s_index=0;
                 break;
             }
@@ -1134,10 +1134,10 @@ 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 (bits_left < 0 && s->error_recognition >= FF_ER_COMPLIANT) {
+    if (bits_left < 0 && (s->err_recognition & AV_EF_BITSTREAM)) {
         av_log(s->avctx, AV_LOG_ERROR, "bits_left=%d\n", bits_left);
         s_index=0;
-    }else if(bits_left > 0 && s->error_recognition >= FF_ER_AGGRESSIVE){
+    }else if(bits_left > 0 && (s->err_recognition & AV_EF_BUFFER)){
         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..6f0d045 100644
--- a/libavcodec/mxpegdec.c
+++ b/libavcodec/mxpegdec.c
@@ -274,11 +274,11 @@ static int mxpeg_decode_frame(AVCodecContext *avctx,
                     }
 
                     ret = ff_mjpeg_decode_sos(jpg, s->mxm_bitmask, reference_ptr);
-                    if (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+                    if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
                         return ret;
                 } else {
                     ret = ff_mjpeg_decode_sos(jpg, NULL, NULL);
-                    if (ret < 0 && avctx->error_recognition >= FF_ER_EXPLODE)
+                    if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE))
                         return ret;
                 }
 



More information about the ffmpeg-cvslog mailing list