Commit bab11fe7 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/mpeg12dec: forward error codes

Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 1852b2a0
......@@ -733,6 +733,7 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
{
int i, j, k, cbp, val, mb_type, motion_type;
const int mb_block_count = 4 + (1 << s->chroma_format);
int ret;
av_dlog(s->avctx, "decode_mb: x=%d y=%d\n", s->mb_x, s->mb_y);
......@@ -846,13 +847,13 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
mpeg2_fast_decode_block_intra(s, *s->pblocks[i], i);
} else {
for (i = 0; i < mb_block_count; i++)
if (mpeg2_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
if ((ret = mpeg2_decode_block_intra(s, *s->pblocks[i], i)) < 0)
return ret;
}
} else {
for (i = 0; i < 6; i++)
if (mpeg1_decode_block_intra(s, *s->pblocks[i], i) < 0)
return -1;
if ((ret = mpeg1_decode_block_intra(s, *s->pblocks[i], i)) < 0)
return ret;
}
} else {
if (mb_type & MB_TYPE_ZERO_MV) {
......@@ -1074,8 +1075,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
for (i = 0; i < mb_block_count; i++) {
if (cbp & (1 << 11)) {
if (mpeg2_decode_block_non_intra(s, *s->pblocks[i], i) < 0)
return -1;
if ((ret = mpeg2_decode_block_non_intra(s, *s->pblocks[i], i)) < 0)
return ret;
} else {
s->block_last_index[i] = -1;
}
......@@ -1094,8 +1095,8 @@ static int mpeg_decode_mb(MpegEncContext *s, int16_t block[12][64])
} else {
for (i = 0; i < 6; i++) {
if (cbp & 32) {
if (mpeg1_decode_block_inter(s, *s->pblocks[i], i) < 0)
return -1;
if ((ret = mpeg1_decode_block_inter(s, *s->pblocks[i], i)) < 0)
return ret;
} else {
s->block_last_index[i] = -1;
}
......@@ -1627,13 +1628,14 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
{
AVCodecContext *avctx = s->avctx;
Mpeg1Context *s1 = (Mpeg1Context *) s;
int ret;
/* start frame decoding */
if (s->first_field || s->picture_structure == PICT_FRAME) {
AVFrameSideData *pan_scan;
if (ff_mpv_frame_start(s, avctx) < 0)
return -1;
if ((ret = ff_mpv_frame_start(s, avctx)) < 0)
return ret;
ff_mpeg_er_frame_start(s);
......@@ -1712,8 +1714,8 @@ static int mpeg_field_start(MpegEncContext *s, const uint8_t *buf, int buf_size)
}
if (avctx->hwaccel) {
if (avctx->hwaccel->start_frame(avctx, buf, buf_size) < 0)
return -1;
if ((ret = avctx->hwaccel->start_frame(avctx, buf, buf_size)) < 0)
return ret;
}
return 0;
......@@ -1734,6 +1736,7 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
AVCodecContext *avctx = s->avctx;
const int lowres = s->avctx->lowres;
const int field_pic = s->picture_structure != PICT_FRAME;
int ret;
s->resync_mb_x =
s->resync_mb_y = -1;
......@@ -1830,8 +1833,8 @@ static int mpeg_decode_slice(MpegEncContext *s, int mb_y,
if ((CONFIG_MPEG1_XVMC_HWACCEL || CONFIG_MPEG2_XVMC_HWACCEL) && s->pack_pblocks)
ff_xvmc_init_block(s); // set s->block
if (mpeg_decode_mb(s, s->block) < 0)
return -1;
if ((ret = mpeg_decode_mb(s, s->block)) < 0)
return ret;
// Note motion_val is normally NULL unless we want to extract the MVs.
if (s->current_picture.motion_val[0] && !s->encoding) {
......@@ -2189,6 +2192,7 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
Mpeg1Context *s1 = avctx->priv_data;
MpegEncContext *s = &s1->mpeg_enc_ctx;
int i, v;
int ret;
/* start new MPEG-1 context decoding */
s->out_format = FMT_MPEG1;
......@@ -2205,8 +2209,8 @@ static int vcr2_init_sequence(AVCodecContext *avctx)
setup_hwaccel_for_pixfmt(avctx);
ff_mpv_idct_init(s);
if (ff_mpv_common_init(s) < 0)
return -1;
if ((ret = ff_mpv_common_init(s)) < 0)
return ret;
s1->mpeg_enc_ctx_allocated = 1;
for (i = 0; i < 64; i++) {
......@@ -2663,8 +2667,8 @@ static int decode_chunks(AVCodecContext *avctx, AVFrame *picture,
if (s->first_slice) {
skip_frame = 0;
s->first_slice = 0;
if (mpeg_field_start(s2, buf, buf_size) < 0)
return -1;
if ((ret = mpeg_field_start(s2, buf, buf_size)) < 0)
return ret;
}
if (!s2->current_picture_ptr) {
av_log(avctx, AV_LOG_ERROR,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment