Forward error codes where possible.
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
... | ... |
@@ -239,12 +239,12 @@ static inline int ff_mpeg4_pred_dc(MpegEncContext *s, int n, int level, |
239 | 239 |
if (level < 0) { |
240 | 240 |
av_log(s->avctx, AV_LOG_ERROR, |
241 | 241 |
"dc<0 at %dx%d\n", s->mb_x, s->mb_y); |
242 |
- return -1; |
|
242 |
+ return AVERROR_INVALIDDATA; |
|
243 | 243 |
} |
244 | 244 |
if (level > 2048 + scale) { |
245 | 245 |
av_log(s->avctx, AV_LOG_ERROR, |
246 | 246 |
"dc overflow at %dx%d\n", s->mb_x, s->mb_y); |
247 |
- return -1; |
|
247 |
+ return AVERROR_INVALIDDATA; |
|
248 | 248 |
} |
249 | 249 |
} |
250 | 250 |
if (level < 0) |
... | ... |
@@ -448,7 +448,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) |
448 | 448 |
|
449 | 449 |
/* is there enough space left for a video packet + header */ |
450 | 450 |
if (get_bits_count(&s->gb) > s->gb.size_in_bits - 20) |
451 |
- return -1; |
|
451 |
+ return AVERROR_INVALIDDATA; |
|
452 | 452 |
|
453 | 453 |
for (len = 0; len < 32; len++) |
454 | 454 |
if (get_bits1(&s->gb)) |
... | ... |
@@ -456,7 +456,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) |
456 | 456 |
|
457 | 457 |
if (len != ff_mpeg4_get_video_packet_prefix_length(s)) { |
458 | 458 |
av_log(s->avctx, AV_LOG_ERROR, "marker does not match f_code\n"); |
459 |
- return -1; |
|
459 |
+ return AVERROR_INVALIDDATA; |
|
460 | 460 |
} |
461 | 461 |
|
462 | 462 |
if (ctx->shape != RECT_SHAPE) { |
... | ... |
@@ -468,7 +468,7 @@ int ff_mpeg4_decode_video_packet_header(Mpeg4DecContext *ctx) |
468 | 468 |
if (mb_num >= s->mb_num || !mb_num) { |
469 | 469 |
av_log(s->avctx, AV_LOG_ERROR, |
470 | 470 |
"illegal mb_num in video packet (%d %d) \n", mb_num, s->mb_num); |
471 |
- return -1; |
|
471 |
+ return AVERROR_INVALIDDATA; |
|
472 | 472 |
} |
473 | 473 |
|
474 | 474 |
s->mb_x = mb_num % s->mb_width; |
... | ... |
@@ -597,7 +597,7 @@ static inline int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr) |
597 | 597 |
|
598 | 598 |
if (code < 0 || code > 9 /* && s->nbit < 9 */) { |
599 | 599 |
av_log(s->avctx, AV_LOG_ERROR, "illegal dc vlc\n"); |
600 |
- return -1; |
|
600 |
+ return AVERROR_INVALIDDATA; |
|
601 | 601 |
} |
602 | 602 |
|
603 | 603 |
if (code == 0) { |
... | ... |
@@ -620,7 +620,7 @@ static inline int mpeg4_decode_dc(MpegEncContext *s, int n, int *dir_ptr) |
620 | 620 |
if (get_bits1(&s->gb) == 0) { /* marker */ |
621 | 621 |
if (s->avctx->err_recognition & (AV_EF_BITSTREAM|AV_EF_COMPLIANT)) { |
622 | 622 |
av_log(s->avctx, AV_LOG_ERROR, "dc marker bit missing\n"); |
623 |
- return -1; |
|
623 |
+ return AVERROR_INVALIDDATA; |
|
624 | 624 |
} |
625 | 625 |
} |
626 | 626 |
} |
... | ... |
@@ -664,7 +664,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) |
664 | 664 |
if (cbpc < 0) { |
665 | 665 |
av_log(s->avctx, AV_LOG_ERROR, |
666 | 666 |
"mcbpc corrupted at %d %d\n", s->mb_x, s->mb_y); |
667 |
- return -1; |
|
667 |
+ return AVERROR_INVALIDDATA; |
|
668 | 668 |
} |
669 | 669 |
} while (cbpc == 8); |
670 | 670 |
|
... | ... |
@@ -684,7 +684,7 @@ static int mpeg4_decode_partition_a(Mpeg4DecContext *ctx) |
684 | 684 |
if (dc < 0) { |
685 | 685 |
av_log(s->avctx, AV_LOG_ERROR, |
686 | 686 |
"DC corrupted at %d %d\n", s->mb_x, s->mb_y); |
687 |
- return -1; |
|
687 |
+ return dc; |
|
688 | 688 |
} |
689 | 689 |
dir <<= 1; |
690 | 690 |
if (dc_pred_dir) |
... | ... |
@@ -736,7 +736,7 @@ try_again: |
736 | 736 |
if (cbpc < 0) { |
737 | 737 |
av_log(s->avctx, AV_LOG_ERROR, |
738 | 738 |
"mcbpc corrupted at %d %d\n", s->mb_x, s->mb_y); |
739 |
- return -1; |
|
739 |
+ return AVERROR_INVALIDDATA; |
|
740 | 740 |
} |
741 | 741 |
if (cbpc == 20) |
742 | 742 |
goto try_again; |
... | ... |
@@ -774,11 +774,11 @@ try_again: |
774 | 774 |
if (!s->mcsel) { |
775 | 775 |
mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
776 | 776 |
if (mx >= 0xffff) |
777 |
- return -1; |
|
777 |
+ return AVERROR_INVALIDDATA; |
|
778 | 778 |
|
779 | 779 |
my = ff_h263_decode_motion(s, pred_y, s->f_code); |
780 | 780 |
if (my >= 0xffff) |
781 |
- return -1; |
|
781 |
+ return AVERROR_INVALIDDATA; |
|
782 | 782 |
s->current_picture.mb_type[xy] = MB_TYPE_16x16 | |
783 | 783 |
MB_TYPE_L0; |
784 | 784 |
} else { |
... | ... |
@@ -805,11 +805,11 @@ try_again: |
805 | 805 |
int16_t *mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
806 | 806 |
mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
807 | 807 |
if (mx >= 0xffff) |
808 |
- return -1; |
|
808 |
+ return AVERROR_INVALIDDATA; |
|
809 | 809 |
|
810 | 810 |
my = ff_h263_decode_motion(s, pred_y, s->f_code); |
811 | 811 |
if (my >= 0xffff) |
812 |
- return -1; |
|
812 |
+ return AVERROR_INVALIDDATA; |
|
813 | 813 |
mot_val[0] = mx; |
814 | 814 |
mot_val[1] = my; |
815 | 815 |
} |
... | ... |
@@ -850,7 +850,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) |
850 | 850 |
if (cbpy < 0) { |
851 | 851 |
av_log(s->avctx, AV_LOG_ERROR, |
852 | 852 |
"cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); |
853 |
- return -1; |
|
853 |
+ return AVERROR_INVALIDDATA; |
|
854 | 854 |
} |
855 | 855 |
|
856 | 856 |
s->cbp_table[xy] |= cbpy << 2; |
... | ... |
@@ -865,7 +865,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) |
865 | 865 |
if (cbpy < 0) { |
866 | 866 |
av_log(s->avctx, AV_LOG_ERROR, |
867 | 867 |
"I cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); |
868 |
- return -1; |
|
868 |
+ return AVERROR_INVALIDDATA; |
|
869 | 869 |
} |
870 | 870 |
|
871 | 871 |
if (s->cbp_table[xy] & 8) |
... | ... |
@@ -878,7 +878,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) |
878 | 878 |
if (dc < 0) { |
879 | 879 |
av_log(s->avctx, AV_LOG_ERROR, |
880 | 880 |
"DC corrupted at %d %d\n", s->mb_x, s->mb_y); |
881 |
- return -1; |
|
881 |
+ return dc; |
|
882 | 882 |
} |
883 | 883 |
dir <<= 1; |
884 | 884 |
if (dc_pred_dir) |
... | ... |
@@ -897,7 +897,7 @@ static int mpeg4_decode_partition_b(MpegEncContext *s, int mb_count) |
897 | 897 |
if (cbpy < 0) { |
898 | 898 |
av_log(s->avctx, AV_LOG_ERROR, |
899 | 899 |
"P cbpy corrupted at %d %d\n", s->mb_x, s->mb_y); |
900 |
- return -1; |
|
900 |
+ return AVERROR_INVALIDDATA; |
|
901 | 901 |
} |
902 | 902 |
|
903 | 903 |
if (s->cbp_table[xy] & 8) |
... | ... |
@@ -924,6 +924,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) |
924 | 924 |
{ |
925 | 925 |
MpegEncContext *s = &ctx->m; |
926 | 926 |
int mb_num; |
927 |
+ int ret; |
|
927 | 928 |
const int part_a_error = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_ERROR | ER_MV_ERROR) : ER_MV_ERROR; |
928 | 929 |
const int part_a_end = s->pict_type == AV_PICTURE_TYPE_I ? (ER_DC_END | ER_MV_END) : ER_MV_END; |
929 | 930 |
|
... | ... |
@@ -931,14 +932,14 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) |
931 | 931 |
if (mb_num <= 0) { |
932 | 932 |
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
933 | 933 |
s->mb_x, s->mb_y, part_a_error); |
934 |
- return -1; |
|
934 |
+ return mb_num ? mb_num : AVERROR_INVALIDDATA; |
|
935 | 935 |
} |
936 | 936 |
|
937 | 937 |
if (s->resync_mb_x + s->resync_mb_y * s->mb_width + mb_num > s->mb_num) { |
938 | 938 |
av_log(s->avctx, AV_LOG_ERROR, "slice below monitor ...\n"); |
939 | 939 |
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
940 | 940 |
s->mb_x, s->mb_y, part_a_error); |
941 |
- return -1; |
|
941 |
+ return AVERROR_INVALIDDATA; |
|
942 | 942 |
} |
943 | 943 |
|
944 | 944 |
s->mb_num_left = mb_num; |
... | ... |
@@ -950,7 +951,7 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) |
950 | 950 |
av_log(s->avctx, AV_LOG_ERROR, |
951 | 951 |
"marker missing after first I partition at %d %d\n", |
952 | 952 |
s->mb_x, s->mb_y); |
953 |
- return -1; |
|
953 |
+ return AVERROR_INVALIDDATA; |
|
954 | 954 |
} |
955 | 955 |
} else { |
956 | 956 |
while (show_bits(&s->gb, 10) == 1) |
... | ... |
@@ -959,17 +960,18 @@ int ff_mpeg4_decode_partitions(Mpeg4DecContext *ctx) |
959 | 959 |
av_log(s->avctx, AV_LOG_ERROR, |
960 | 960 |
"marker missing after first P partition at %d %d\n", |
961 | 961 |
s->mb_x, s->mb_y); |
962 |
- return -1; |
|
962 |
+ return AVERROR_INVALIDDATA; |
|
963 | 963 |
} |
964 | 964 |
} |
965 | 965 |
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
966 | 966 |
s->mb_x - 1, s->mb_y, part_a_end); |
967 | 967 |
|
968 |
- if (mpeg4_decode_partition_b(s, mb_num) < 0) { |
|
968 |
+ ret = mpeg4_decode_partition_b(s, mb_num); |
|
969 |
+ if (ret < 0) { |
|
969 | 970 |
if (s->pict_type == AV_PICTURE_TYPE_P) |
970 | 971 |
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
971 | 972 |
s->mb_x, s->mb_y, ER_DC_ERROR); |
972 |
- return -1; |
|
973 |
+ return ret; |
|
973 | 974 |
} else { |
974 | 975 |
if (s->pict_type == AV_PICTURE_TYPE_P) |
975 | 976 |
ff_er_add_slice(&s->er, s->resync_mb_x, s->resync_mb_y, |
... | ... |
@@ -1008,7 +1010,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1008 | 1008 |
} else { |
1009 | 1009 |
level = mpeg4_decode_dc(s, n, &dc_pred_dir); |
1010 | 1010 |
if (level < 0) |
1011 |
- return -1; |
|
1011 |
+ return level; |
|
1012 | 1012 |
} |
1013 | 1013 |
block[0] = level; |
1014 | 1014 |
i = 0; |
... | ... |
@@ -1076,7 +1078,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1076 | 1076 |
if (SHOW_UBITS(re, &s->gb, 1) == 0) { |
1077 | 1077 |
av_log(s->avctx, AV_LOG_ERROR, |
1078 | 1078 |
"1. marker bit missing in rvlc esc\n"); |
1079 |
- return -1; |
|
1079 |
+ return AVERROR_INVALIDDATA; |
|
1080 | 1080 |
} |
1081 | 1081 |
SKIP_CACHE(re, &s->gb, 1); |
1082 | 1082 |
|
... | ... |
@@ -1089,7 +1091,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1089 | 1089 |
if (SHOW_UBITS(re, &s->gb, 1) == 0) { |
1090 | 1090 |
av_log(s->avctx, AV_LOG_ERROR, |
1091 | 1091 |
"2. marker bit missing in rvlc esc\n"); |
1092 |
- return -1; |
|
1092 |
+ return AVERROR_INVALIDDATA; |
|
1093 | 1093 |
} |
1094 | 1094 |
SKIP_CACHE(re, &s->gb, 1); |
1095 | 1095 |
|
... | ... |
@@ -1098,7 +1100,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1098 | 1098 |
|
1099 | 1099 |
if (SHOW_UBITS(re, &s->gb, 5) != 0x10) { |
1100 | 1100 |
av_log(s->avctx, AV_LOG_ERROR, "reverse esc missing\n"); |
1101 |
- return -1; |
|
1101 |
+ return AVERROR_INVALIDDATA; |
|
1102 | 1102 |
} |
1103 | 1103 |
SKIP_CACHE(re, &s->gb, 5); |
1104 | 1104 |
|
... | ... |
@@ -1134,7 +1136,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1134 | 1134 |
av_log(s->avctx, AV_LOG_ERROR, |
1135 | 1135 |
"1. marker bit missing in 3. esc\n"); |
1136 | 1136 |
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR)) |
1137 |
- return -1; |
|
1137 |
+ return AVERROR_INVALIDDATA; |
|
1138 | 1138 |
} |
1139 | 1139 |
SKIP_CACHE(re, &s->gb, 1); |
1140 | 1140 |
|
... | ... |
@@ -1145,7 +1147,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1145 | 1145 |
av_log(s->avctx, AV_LOG_ERROR, |
1146 | 1146 |
"2. marker bit missing in 3. esc\n"); |
1147 | 1147 |
if (!(s->avctx->err_recognition & AV_EF_IGNORE_ERR)) |
1148 |
- return -1; |
|
1148 |
+ return AVERROR_INVALIDDATA; |
|
1149 | 1149 |
} |
1150 | 1150 |
|
1151 | 1151 |
SKIP_COUNTER(re, &s->gb, 1 + 12 + 1); |
... | ... |
@@ -1158,16 +1160,16 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1158 | 1158 |
const int run1= run - rl->max_run[last][abs_level] - 1; |
1159 | 1159 |
if (abs_level <= rl->max_level[last][run]) { |
1160 | 1160 |
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, vlc encoding possible\n"); |
1161 |
- return -1; |
|
1161 |
+ return AVERROR_INVALIDDATA; |
|
1162 | 1162 |
} |
1163 | 1163 |
if (s->error_recognition > FF_ER_COMPLIANT) { |
1164 | 1164 |
if (abs_level <= rl->max_level[last][run]*2) { |
1165 | 1165 |
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 1 encoding possible\n"); |
1166 |
- return -1; |
|
1166 |
+ return AVERROR_INVALIDDATA; |
|
1167 | 1167 |
} |
1168 | 1168 |
if (run1 >= 0 && abs_level <= rl->max_level[last][run1]) { |
1169 | 1169 |
av_log(s->avctx, AV_LOG_ERROR, "illegal 3. esc, esc 2 encoding possible\n"); |
1170 |
- return -1; |
|
1170 |
+ return AVERROR_INVALIDDATA; |
|
1171 | 1171 |
} |
1172 | 1172 |
} |
1173 | 1173 |
} |
... | ... |
@@ -1184,7 +1186,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1184 | 1184 |
av_log(s->avctx, AV_LOG_ERROR, |
1185 | 1185 |
"|level| overflow in 3. esc, qp=%d\n", |
1186 | 1186 |
s->qscale); |
1187 |
- return -1; |
|
1187 |
+ return AVERROR_INVALIDDATA; |
|
1188 | 1188 |
} |
1189 | 1189 |
} |
1190 | 1190 |
level = level < 0 ? -2048 : 2047; |
... | ... |
@@ -1222,7 +1224,7 @@ static inline int mpeg4_decode_block(Mpeg4DecContext *ctx, int16_t *block, |
1222 | 1222 |
if (i & (~63)) { |
1223 | 1223 |
av_log(s->avctx, AV_LOG_ERROR, |
1224 | 1224 |
"ac-tex damaged at %d %d\n", s->mb_x, s->mb_y); |
1225 |
- return -1; |
|
1225 |
+ return AVERROR_INVALIDDATA; |
|
1226 | 1226 |
} |
1227 | 1227 |
|
1228 | 1228 |
block[scan_table[i]] = level; |
... | ... |
@@ -1319,7 +1321,7 @@ static int mpeg4_decode_partitioned_mb(MpegEncContext *s, int16_t block[6][64]) |
1319 | 1319 |
av_log(s->avctx, AV_LOG_ERROR, |
1320 | 1320 |
"texture corrupted at %d %d %d\n", |
1321 | 1321 |
s->mb_x, s->mb_y, s->mb_intra); |
1322 |
- return -1; |
|
1322 |
+ return AVERROR_INVALIDDATA; |
|
1323 | 1323 |
} |
1324 | 1324 |
cbp += cbp; |
1325 | 1325 |
} |
... | ... |
@@ -1387,7 +1389,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1387 | 1387 |
if (cbpc < 0) { |
1388 | 1388 |
av_log(s->avctx, AV_LOG_ERROR, |
1389 | 1389 |
"mcbpc damaged at %d %d\n", s->mb_x, s->mb_y); |
1390 |
- return -1; |
|
1390 |
+ return AVERROR_INVALIDDATA; |
|
1391 | 1391 |
} |
1392 | 1392 |
} while (cbpc == 20); |
1393 | 1393 |
|
... | ... |
@@ -1443,11 +1445,11 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1443 | 1443 |
for (i = 0; i < 2; i++) { |
1444 | 1444 |
mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
1445 | 1445 |
if (mx >= 0xffff) |
1446 |
- return -1; |
|
1446 |
+ return AVERROR_INVALIDDATA; |
|
1447 | 1447 |
|
1448 | 1448 |
my = ff_h263_decode_motion(s, pred_y / 2, s->f_code); |
1449 | 1449 |
if (my >= 0xffff) |
1450 |
- return -1; |
|
1450 |
+ return AVERROR_INVALIDDATA; |
|
1451 | 1451 |
|
1452 | 1452 |
s->mv[0][i][0] = mx; |
1453 | 1453 |
s->mv[0][i][1] = my; |
... | ... |
@@ -1460,12 +1462,12 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1460 | 1460 |
mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
1461 | 1461 |
|
1462 | 1462 |
if (mx >= 0xffff) |
1463 |
- return -1; |
|
1463 |
+ return AVERROR_INVALIDDATA; |
|
1464 | 1464 |
|
1465 | 1465 |
my = ff_h263_decode_motion(s, pred_y, s->f_code); |
1466 | 1466 |
|
1467 | 1467 |
if (my >= 0xffff) |
1468 |
- return -1; |
|
1468 |
+ return AVERROR_INVALIDDATA; |
|
1469 | 1469 |
s->mv[0][0][0] = mx; |
1470 | 1470 |
s->mv[0][0][1] = my; |
1471 | 1471 |
} |
... | ... |
@@ -1476,11 +1478,11 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1476 | 1476 |
mot_val = ff_h263_pred_motion(s, i, 0, &pred_x, &pred_y); |
1477 | 1477 |
mx = ff_h263_decode_motion(s, pred_x, s->f_code); |
1478 | 1478 |
if (mx >= 0xffff) |
1479 |
- return -1; |
|
1479 |
+ return AVERROR_INVALIDDATA; |
|
1480 | 1480 |
|
1481 | 1481 |
my = ff_h263_decode_motion(s, pred_y, s->f_code); |
1482 | 1482 |
if (my >= 0xffff) |
1483 |
- return -1; |
|
1483 |
+ return AVERROR_INVALIDDATA; |
|
1484 | 1484 |
s->mv[0][i][0] = mx; |
1485 | 1485 |
s->mv[0][i][1] = my; |
1486 | 1486 |
mot_val[0] = mx; |
... | ... |
@@ -1536,7 +1538,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1536 | 1536 |
mb_type = get_vlc2(&s->gb, mb_type_b_vlc.table, MB_TYPE_B_VLC_BITS, 1); |
1537 | 1537 |
if (mb_type < 0) { |
1538 | 1538 |
av_log(s->avctx, AV_LOG_ERROR, "illegal MB_type\n"); |
1539 |
- return -1; |
|
1539 |
+ return AVERROR_INVALIDDATA; |
|
1540 | 1540 |
} |
1541 | 1541 |
mb_type = mb_type_b_map[mb_type]; |
1542 | 1542 |
if (modb2) { |
... | ... |
@@ -1647,7 +1649,7 @@ static int mpeg4_decode_mb(MpegEncContext *s, int16_t block[6][64]) |
1647 | 1647 |
if (cbpc < 0) { |
1648 | 1648 |
av_log(s->avctx, AV_LOG_ERROR, |
1649 | 1649 |
"I cbpc damaged at %d %d\n", s->mb_x, s->mb_y); |
1650 |
- return -1; |
|
1650 |
+ return AVERROR_INVALIDDATA; |
|
1651 | 1651 |
} |
1652 | 1652 |
} while (cbpc == 8); |
1653 | 1653 |
|
... | ... |
@@ -1665,7 +1667,7 @@ intra: |
1665 | 1665 |
if (cbpy < 0) { |
1666 | 1666 |
av_log(s->avctx, AV_LOG_ERROR, |
1667 | 1667 |
"I cbpy damaged at %d %d\n", s->mb_x, s->mb_y); |
1668 |
- return -1; |
|
1668 |
+ return AVERROR_INVALIDDATA; |
|
1669 | 1669 |
} |
1670 | 1670 |
cbp = (cbpc & 3) | (cbpy << 2); |
1671 | 1671 |
|
... | ... |
@@ -1681,7 +1683,7 @@ intra: |
1681 | 1681 |
/* decode each block */ |
1682 | 1682 |
for (i = 0; i < 6; i++) { |
1683 | 1683 |
if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 1, 0) < 0) |
1684 |
- return -1; |
|
1684 |
+ return AVERROR_INVALIDDATA; |
|
1685 | 1685 |
cbp += cbp; |
1686 | 1686 |
} |
1687 | 1687 |
goto end; |
... | ... |
@@ -1690,7 +1692,7 @@ intra: |
1690 | 1690 |
/* decode each block */ |
1691 | 1691 |
for (i = 0; i < 6; i++) { |
1692 | 1692 |
if (mpeg4_decode_block(ctx, block[i], i, cbp & 32, 0, 0) < 0) |
1693 |
- return -1; |
|
1693 |
+ return AVERROR_INVALIDDATA; |
|
1694 | 1694 |
cbp += cbp; |
1695 | 1695 |
} |
1696 | 1696 |
|
... | ... |
@@ -1700,7 +1702,7 @@ end: |
1700 | 1700 |
int next = mpeg4_is_resync(ctx); |
1701 | 1701 |
if (next) { |
1702 | 1702 |
if (s->mb_x + s->mb_y*s->mb_width + 1 > next && (s->avctx->err_recognition & AV_EF_AGGRESSIVE)) { |
1703 |
- return -1; |
|
1703 |
+ return AVERROR_INVALIDDATA; |
|
1704 | 1704 |
} else if (s->mb_x + s->mb_y*s->mb_width + 1 >= next) |
1705 | 1705 |
return SLICE_END; |
1706 | 1706 |
|
... | ... |
@@ -1727,7 +1729,7 @@ static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb) |
1727 | 1727 |
|
1728 | 1728 |
if (!show_bits(gb, 23)) { |
1729 | 1729 |
av_log(s->avctx, AV_LOG_WARNING, "GOP header invalid\n"); |
1730 |
- return -1; |
|
1730 |
+ return AVERROR_INVALIDDATA; |
|
1731 | 1731 |
} |
1732 | 1732 |
|
1733 | 1733 |
hours = get_bits(gb, 5); |
... | ... |
@@ -2636,7 +2638,7 @@ int ff_mpeg4_decode_picture_header(Mpeg4DecContext *ctx, GetBitContext *gb) |
2636 | 2636 |
av_log(s->avctx, AV_LOG_VERBOSE, "frame skip %d\n", gb->size_in_bits); |
2637 | 2637 |
return FRAME_SKIPPED; // divx bug |
2638 | 2638 |
} else |
2639 |
- return -1; // end of stream |
|
2639 |
+ return AVERROR_INVALIDDATA; // end of stream |
|
2640 | 2640 |
} |
2641 | 2641 |
|
2642 | 2642 |
/* use the bits after the test */ |