Mercurial > libavcodec.hg
comparison mlpdec.c @ 9286:e02f401dde04 libavcodec
mlpdec: Simplify substream length mismatch error.
author | ramiro |
---|---|
date | Mon, 30 Mar 2009 03:42:40 +0000 |
parents | f2f4f136add4 |
children | b00fc746bdf4 |
comparison
equal
deleted
inserted
replaced
9285:f2f4f136add4 | 9286:e02f401dde04 |
---|---|
1015 } | 1015 } |
1016 | 1016 |
1017 if (read_block_data(m, &gb, substr) < 0) | 1017 if (read_block_data(m, &gb, substr) < 0) |
1018 return -1; | 1018 return -1; |
1019 | 1019 |
1020 } while ((get_bits_count(&gb) < substream_data_len[substr] * 8) | 1020 if (get_bits_count(&gb) >= substream_data_len[substr] * 8) |
1021 && get_bits1(&gb) == 0); | 1021 goto substream_length_mismatch; |
1022 | |
1023 } while (!get_bits1(&gb)); | |
1022 | 1024 |
1023 skip_bits(&gb, (-get_bits_count(&gb)) & 15); | 1025 skip_bits(&gb, (-get_bits_count(&gb)) & 15); |
1024 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) { | 1026 if (substream_data_len[substr] * 8 - get_bits_count(&gb) >= 32) { |
1025 int shorten_by; | 1027 int shorten_by; |
1026 | 1028 |
1047 av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr); | 1049 av_log(m->avctx, AV_LOG_ERROR, "Substream %d parity check failed.\n", substr); |
1048 if ( get_bits(&gb, 8) != checksum) | 1050 if ( get_bits(&gb, 8) != checksum) |
1049 av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr); | 1051 av_log(m->avctx, AV_LOG_ERROR, "Substream %d checksum failed.\n" , substr); |
1050 } | 1052 } |
1051 if (substream_data_len[substr] * 8 != get_bits_count(&gb)) { | 1053 if (substream_data_len[substr] * 8 != get_bits_count(&gb)) { |
1052 av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", | 1054 goto substream_length_mismatch; |
1053 substr); | |
1054 return -1; | |
1055 } | 1055 } |
1056 | 1056 |
1057 next_substr: | 1057 next_substr: |
1058 buf += substream_data_len[substr]; | 1058 buf += substream_data_len[substr]; |
1059 } | 1059 } |
1062 | 1062 |
1063 if (output_data(m, m->max_decoded_substream, data, data_size) < 0) | 1063 if (output_data(m, m->max_decoded_substream, data, data_size) < 0) |
1064 return -1; | 1064 return -1; |
1065 | 1065 |
1066 return length; | 1066 return length; |
1067 | |
1068 substream_length_mismatch: | |
1069 av_log(m->avctx, AV_LOG_ERROR, "substream %d length mismatch\n", substr); | |
1070 return -1; | |
1067 | 1071 |
1068 error: | 1072 error: |
1069 m->params_valid = 0; | 1073 m->params_valid = 0; |
1070 return -1; | 1074 return -1; |
1071 } | 1075 } |