Browse code

qdm2: print error messages instead of just retunring failures

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2012/05/09 06:09:45
Showing 1 changed files
... ...
@@ -888,8 +888,10 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
888 888
                     case 30:
889 889
                         if (get_bits_left(gb) >= 4) {
890 890
                             unsigned index = qdm2_get_vlc(gb, &vlc_tab_type30, 0, 1);
891
-                            if (index >= FF_ARRAY_ELEMS(type30_dequant))
891
+                            if (index >= FF_ARRAY_ELEMS(type30_dequant)) {
892
+                                av_log(NULL, AV_LOG_ERROR, "index %d out of type30_dequant array\n", index);
892 893
                                 return AVERROR_INVALIDDATA;
894
+                            }
893 895
                             samples[0] = type30_dequant[index];
894 896
                         } else
895 897
                             samples[0] = SB_DITHERING_NOISE(sb,q->noise_idx);
... ...
@@ -906,8 +908,10 @@ static int synthfilt_build_sb_samples (QDM2Context *q, GetBitContext *gb, int le
906 906
                                 type34_first = 0;
907 907
                             } else {
908 908
                                 unsigned index = qdm2_get_vlc(gb, &vlc_tab_type34, 0, 1);
909
-                                if (index >= FF_ARRAY_ELEMS(type34_delta))
909
+                                if (index >= FF_ARRAY_ELEMS(type34_delta)) {
910
+                                    av_log(NULL, AV_LOG_ERROR, "index %d out of type34_delta array\n", index);
910 911
                                     return AVERROR_INVALIDDATA;
912
+                                }
911 913
                                 samples[0] = type34_delta[index] / type34_div + type34_predictor;
912 914
                                 type34_predictor = samples[0];
913 915
                             }
... ...
@@ -1834,8 +1838,10 @@ static av_cold int qdm2_decode_init(AVCodecContext *avctx)
1834 1834
 
1835 1835
     avctx->channels = s->nb_channels = s->channels = AV_RB32(extradata);
1836 1836
     extradata += 4;
1837
-    if (s->channels > MPA_MAX_CHANNELS)
1837
+    if (s->channels > MPA_MAX_CHANNELS) {
1838
+        av_log(avctx, AV_LOG_ERROR, "Too many channels\n");
1838 1839
         return AVERROR_INVALIDDATA;
1840
+    }
1839 1841
 
1840 1842
     avctx->sample_rate = AV_RB32(extradata);
1841 1843
     extradata += 4;