Browse code

Use proper return values in case of missing features

Diego Biurrun authored on 2012/10/09 07:41:34
Showing 13 changed files
... ...
@@ -62,7 +62,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
62 62
 
63 63
     if (!hdr.crc_absent && hdr.num_aac_frames > 1) {
64 64
         av_log_missing_feature(avctx, "Multiple RDBs per frame with CRC", 0);
65
-        return -1;
65
+        return AVERROR_PATCHWELCOME;
66 66
     }
67 67
 
68 68
     buf      += AAC_ADTS_HEADER_SIZE + 2*!hdr.crc_absent;
... ...
@@ -75,7 +75,7 @@ static int aac_adtstoasc_filter(AVBitStreamFilterContext *bsfc,
75 75
             init_get_bits(&gb, buf, buf_size * 8);
76 76
             if (get_bits(&gb, 3) != 5) {
77 77
                 av_log_missing_feature(avctx, "PCE based channel configuration, where the PCE is not the first syntax element", 0);
78
-                return -1;
78
+                return AVERROR_PATCHWELCOME;
79 79
             }
80 80
             init_put_bits(&pb, pce_data, MAX_PCE_SIZE);
81 81
             pce_size = avpriv_copy_pce_data(&pb, &gb)/8;
... ...
@@ -634,7 +634,7 @@ static int decode_ga_specific_config(AACContext *ac, AVCodecContext *avctx,
634 634
 
635 635
     if (get_bits1(gb)) { // frameLengthFlag
636 636
         av_log_missing_feature(avctx, "960/120 MDCT window", 1);
637
-        return -1;
637
+        return AVERROR_PATCHWELCOME;
638 638
     }
639 639
 
640 640
     if (get_bits1(gb))       // dependsOnCoreCoder
... ...
@@ -1635,7 +1635,7 @@ static int decode_ics(AACContext *ac, SingleChannelElement *sce,
1635 1635
             return -1;
1636 1636
         if (get_bits1(gb)) {
1637 1637
             av_log_missing_feature(ac->avctx, "SSR", 1);
1638
-            return -1;
1638
+            return AVERROR_PATCHWELCOME;
1639 1639
         }
1640 1640
     }
1641 1641
 
... ...
@@ -2324,7 +2324,7 @@ static int parse_adts_frame_header(AACContext *ac, GetBitContext *gb)
2324 2324
     if (size > 0) {
2325 2325
         if (hdr_info.num_aac_frames != 1) {
2326 2326
             av_log_missing_feature(ac->avctx, "More than one AAC RDB per ADTS frame", 0);
2327
-            return -1;
2327
+            return AVERROR_PATCHWELCOME;
2328 2328
         }
2329 2329
         push_output_configuration(ac);
2330 2330
         if (hdr_info.chan_config) {
... ...
@@ -2609,7 +2609,7 @@ static int latm_decode_audio_specific_config(struct LATMContext *latmctx,
2609 2609
     if (config_start_bit % 8) {
2610 2610
         av_log_missing_feature(latmctx->aac_ctx.avctx,
2611 2611
                                "Non-byte-aligned audio-specific config", 1);
2612
-        return AVERROR_INVALIDDATA;
2612
+        return AVERROR_PATCHWELCOME;
2613 2613
     }
2614 2614
     if (asclen <= 0)
2615 2615
         return AVERROR_INVALIDDATA;
... ...
@@ -876,7 +876,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
876 876
             if (s->eac3 && get_bits1(gbc)) {
877 877
                 /* TODO: parse enhanced coupling strategy info */
878 878
                 av_log_missing_feature(s->avctx, "Enhanced coupling", 1);
879
-                return -1;
879
+                return AVERROR_PATCHWELCOME;
880 880
             }
881 881
 
882 882
             /* determine which channels are coupled */
... ...
@@ -427,9 +427,9 @@ static int check_specific_config(ALSDecContext *ctx)
427 427
         }                                               \
428 428
     }
429 429
 
430
-    MISSING_ERR(sconf->floating,             "Floating point decoding",     -1);
431
-    MISSING_ERR(sconf->rlslms,               "Adaptive RLS-LMS prediction", -1);
432
-    MISSING_ERR(sconf->chan_sort,            "Channel sorting",              0);
430
+    MISSING_ERR(sconf->floating,  "Floating point decoding",     AVERROR_PATCHWELCOME);
431
+    MISSING_ERR(sconf->rlslms,    "Adaptive RLS-LMS prediction", AVERROR_PATCHWELCOME);
432
+    MISSING_ERR(sconf->chan_sort, "Channel sorting",             0);
433 433
 
434 434
     return error;
435 435
 }
... ...
@@ -951,7 +951,7 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data,
951 951
     }
952 952
     if (p->cur_frame_mode == MODE_DTX) {
953 953
         av_log_missing_feature(avctx, "dtx mode", 1);
954
-        return -1;
954
+        return AVERROR_PATCHWELCOME;
955 955
     }
956 956
 
957 957
     if (p->cur_frame_mode == MODE_12k2) {
... ...
@@ -1111,7 +1111,7 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data,
1111 1111
 
1112 1112
     if (ctx->fr_cur_mode == MODE_SID) { /* Comfort noise frame */
1113 1113
         av_log_missing_feature(avctx, "SID mode", 1);
1114
-        return -1;
1114
+        return AVERROR_PATCHWELCOME;
1115 1115
     }
1116 1116
 
1117 1117
     ff_amr_bit_reorder((uint16_t *) &ctx->frame, sizeof(AMRWBFrame),
... ...
@@ -322,7 +322,7 @@ int ff_eac3_parse_header(AC3DecodeContext *s)
322 322
            handled like AC-3 DolbyNet, but we cannot be sure until we have a
323 323
            sample which utilizes this feature. */
324 324
         av_log_missing_feature(s->avctx, "Reduced sampling rates", 1);
325
-        return -1;
325
+        return AVERROR_PATCHWELCOME;
326 326
     }
327 327
     skip_bits(gbc, 5); // skip bitstream id
328 328
 
... ...
@@ -372,7 +372,7 @@ static inline int decode_subframe(FLACContext *s, int channel)
372 372
     }
373 373
     if (bps > 32) {
374 374
         av_log_missing_feature(s->avctx, "decorrelated bit depth > 32", 0);
375
-        return -1;
375
+        return AVERROR_PATCHWELCOME;
376 376
     }
377 377
 
378 378
 //FIXME use av_log2 for types
... ...
@@ -130,7 +130,7 @@ static av_cold int mpc8_decode_init(AVCodecContext * avctx)
130 130
     channels = get_bits(&gb, 4) + 1;
131 131
     if (channels > 2) {
132 132
         av_log_missing_feature(avctx, "Multichannel MPC SV8", 1);
133
-        return -1;
133
+        return AVERROR_PATCHWELCOME;
134 134
     }
135 135
     c->MSS = get_bits1(&gb);
136 136
     c->frames = 1 << (get_bits(&gb, 3) * 2);
... ...
@@ -222,7 +222,7 @@ static av_cold int tta_decode_init(AVCodecContext * avctx)
222 222
         }
223 223
         if (s->format == FORMAT_ENCRYPTED) {
224 224
             av_log_missing_feature(s->avctx, "Encrypted TTA", 0);
225
-            return AVERROR(EINVAL);
225
+            return AVERROR_PATCHWELCOME;
226 226
         }
227 227
         avctx->channels = s->channels = get_bits(&s->gb, 16);
228 228
         avctx->bits_per_coded_sample = get_bits(&s->gb, 16);
... ...
@@ -314,7 +314,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
314 314
     bits = ff_wma_get_frame_len_bits(avctx->sample_rate, 3, s->decode_flags);
315 315
     if (bits > WMAPRO_BLOCK_MAX_BITS) {
316 316
         av_log_missing_feature(avctx, "14-bits block sizes", 1);
317
-        return AVERROR_INVALIDDATA;
317
+        return AVERROR_PATCHWELCOME;
318 318
     }
319 319
     s->samples_per_frame = 1 << bits;
320 320
 
... ...
@@ -1763,7 +1763,7 @@ static int synth_superframe(AVCodecContext *ctx, int *got_frame_ptr)
1763 1763
      * the wild yet. */
1764 1764
     if (!get_bits1(gb)) {
1765 1765
         av_log_missing_feature(ctx, "WMAPro-in-WMAVoice support", 1);
1766
-        return -1;
1766
+        return AVERROR_PATCHWELCOME;
1767 1767
     }
1768 1768
 
1769 1769
     /* (optional) nr. of samples in superframe; always <= 480 and >= 0 */
... ...
@@ -99,7 +99,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
99 99
         if (!is_start || !is_finish) {
100 100
             av_log_missing_feature(s, "RTP-X-QT with payload description "
101 101
                                       "split over several packets", 1);
102
-            return AVERROR(ENOSYS);
102
+            return AVERROR_PATCHWELCOME;
103 103
         }
104 104
         skip_bits(&gb, 12); // reserved
105 105
         data_len = get_bits(&gb, 16);
... ...
@@ -162,7 +162,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
162 162
 
163 163
     if (has_packet_info) {
164 164
         av_log_missing_feature(s, "RTP-X-QT with packet specific info", 1);
165
-        return AVERROR(ENOSYS);
165
+        return AVERROR_PATCHWELCOME;
166 166
     }
167 167
 
168 168
     alen = len - avio_tell(&pb);
... ...
@@ -225,7 +225,7 @@ static int qt_rtp_parse_packet(AVFormatContext *s, PayloadContext *qt,
225 225
 
226 226
     default:  /* unimplemented */
227 227
         av_log_missing_feature(NULL, "RTP-X-QT with packing scheme 2", 1);
228
-        return AVERROR(ENOSYS);
228
+        return AVERROR_PATCHWELCOME;
229 229
     }
230 230
 }
231 231