Unified · Split
| @@ -28,7 +28,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 27 unmodified lines | ||
| 28 | 28 | { |
| 29 | 29 | if (avctx->width & 1) { |
| 30 | 30 | av_log(avctx, AV_LOG_ERROR, "FRWU needs even width\n"); |
| 31 | − return -1; | |
| 31 | + return AVERROR(EINVAL); | |
| 32 | 32 | } |
| 33 | 33 | avctx->pix_fmt = PIX_FMT_UYVY422; |
| 34 | 34 | |
| @@ -42,7 +42,7 @@ static av_cold int decode_init(AVCodecContext *avctx) · 7 unmodified lines | ||
| 42 | 42 | static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, |
| 43 | 43 | AVPacket *avpkt) |
| 44 | 44 | { |
| 45 | − int field; | |
| 45 | + int field, ret; | |
| 46 | 46 | AVFrame *pic = avctx->coded_frame; |
| 47 | 47 | const uint8_t *buf = avpkt->data; |
| 48 | 48 | const uint8_t *buf_end = buf + avpkt->size; |
| @@ -52,16 +52,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 3 unmodified lines | ||
| 52 | 52 | |
| 53 | 53 | if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) { |
| 54 | 54 | av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n"); |
| 55 | − return -1; | |
| 55 | + return AVERROR_INVALIDDATA; | |
| 56 | 56 | } |
| 57 | 57 | if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) { |
| 58 | 58 | av_log(avctx, AV_LOG_ERROR, "incorrect marker\n"); |
| 59 | − return -1; | |
| 59 | + return AVERROR_INVALIDDATA; | |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | pic->reference = 0; |
| 63 | − if (avctx->get_buffer(avctx, pic) < 0) | |
| 64 | − return -1; | |
| 63 | + if ((ret = avctx->get_buffer(avctx, pic)) < 0) { | |
| 64 | + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); | |
| 65 | + return ret; | |
| 66 | + } | |
| 65 | 67 | |
| 66 | 68 | pic->pict_type = AV_PICTURE_TYPE_I; |
| 67 | 69 | pic->key_frame = 1; |
| @@ -74,16 +76,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, · 6 unmodified lines | ||
| 74 | 76 | int field_size, min_field_size = avctx->width * 2 * field_h; |
| 75 | 77 | uint8_t *dst = pic->data[0]; |
| 76 | 78 | if (buf_end - buf < 8) |
| 77 | − return -1; | |
| 79 | + return AVERROR_INVALIDDATA; | |
| 78 | 80 | buf += 4; // flags? 0x80 == bottom field maybe? |
| 79 | 81 | field_size = bytestream_get_le32(&buf); |
| 80 | 82 | if (field_size < min_field_size) { |
| 81 | 83 | av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size); |
| 82 | − return -1; | |
| 84 | + return AVERROR_INVALIDDATA; | |
| 83 | 85 | } |
| 84 | 86 | if (buf_end - buf < field_size) { |
| 85 | 87 | av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf)); |
| 86 | − return -1; | |
| 88 | + return AVERROR_INVALIDDATA; | |
| 87 | 89 | } |
| 88 | 90 | if (field) |
| 89 | 91 | dst += pic->linesize[0]; |