Commit d57a6fe6 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '07493148'

* commit '07493148':
  h263: Return meaningful errors

Conflicts:
	libavcodec/h263dec.c

See: 7b62d341Merged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents c985966a 07493148
...@@ -107,7 +107,9 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx) ...@@ -107,7 +107,9 @@ av_cold int ff_h263_decode_init(AVCodecContext *avctx)
s->h263_flv = 1; s->h263_flv = 1;
break; break;
default: default:
return AVERROR(EINVAL); av_log(avctx, AV_LOG_ERROR, "Unsupported codec %d\n",
avctx->codec->id);
return AVERROR(ENOSYS);
} }
s->codec_id = avctx->codec->id; s->codec_id = avctx->codec->id;
avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt); avctx->hwaccel = ff_find_hwaccel(avctx->codec->id, avctx->pix_fmt);
...@@ -166,7 +168,8 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size) ...@@ -166,7 +168,8 @@ static int get_consumed_bytes(MpegEncContext *s, int buf_size)
static int decode_slice(MpegEncContext *s) static int decode_slice(MpegEncContext *s)
{ {
const int part_mask = s->partitioned_frame ? (ER_AC_END | ER_AC_ERROR) : 0x7F; const int part_mask = s->partitioned_frame
? (ER_AC_END | ER_AC_ERROR) : 0x7F;
const int mb_size = 16 >> s->avctx->lowres; const int mb_size = 16 >> s->avctx->lowres;
int ret; int ret;
...@@ -403,7 +406,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, ...@@ -403,7 +406,7 @@ int ff_h263_decode_frame(AVCodecContext *avctx, void *data, int *got_frame,
} else { } else {
av_log(s->avctx, AV_LOG_ERROR, av_log(s->avctx, AV_LOG_ERROR,
"this codec does not support truncated bitstreams\n"); "this codec does not support truncated bitstreams\n");
return AVERROR(EINVAL); return AVERROR(ENOSYS);
} }
if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf, if (ff_combine_frame(&s->parse_context, next, (const uint8_t **)&buf,
...@@ -435,7 +438,8 @@ retry: ...@@ -435,7 +438,8 @@ retry:
return ret; return ret;
if (!s->context_initialized) if (!s->context_initialized)
if ((ret = ff_MPV_common_init(s)) < 0) // we need the idct permutaton for reading a custom matrix // we need the idct permutaton for reading a custom matrix
if ((ret = ff_MPV_common_init(s)) < 0)
return ret; return ret;
/* We need to set current_picture_ptr before reading the header, /* We need to set current_picture_ptr before reading the header,
...@@ -676,10 +680,12 @@ retry: ...@@ -676,10 +680,12 @@ retry:
goto frame_end; goto frame_end;
} }
if (avctx->hwaccel) if (avctx->hwaccel) {
if ((ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer, ret = avctx->hwaccel->start_frame(avctx, s->gb.buffer,
s->gb.buffer_end - s->gb.buffer)) < 0) s->gb.buffer_end - s->gb.buffer);
if (ret < 0 )
return ret; return ret;
}
ff_mpeg_er_frame_start(s); ff_mpeg_er_frame_start(s);
...@@ -729,9 +735,11 @@ retry: ...@@ -729,9 +735,11 @@ retry:
frame_end: frame_end:
ff_er_frame_end(&s->er); ff_er_frame_end(&s->er);
if (avctx->hwaccel) if (avctx->hwaccel) {
if ((ret = avctx->hwaccel->end_frame(avctx)) < 0) ret = avctx->hwaccel->end_frame(avctx);
if (ret < 0)
return ret; return ret;
}
ff_MPV_frame_end(s); ff_MPV_frame_end(s);
......
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