History

dnxhddec: return proper error code

Alexandra Khirnova committed 12 years ago

Commit 28e508a1 parent b0c2c091 file · +11 −11Browse files

Unified · Split

libavcodec/dnxhddec.c+11−11
@@ -70,7 +70,7 @@ static int dnxhd_init_vlc(DNXHDContext *ctx, int cid) · 69 unmodified lines
7070
7171 if ((index = ff_dnxhd_get_cid_table(cid)) < 0) {
7272 av_log(ctx->avctx, AV_LOG_ERROR, "unsupported cid %d\n", cid);
73− return -1;
73+ return AVERROR(ENOSYS);
7474 }
7575 ctx->cid_table = &ff_dnxhd_cid_table[index];
7676
@@ -98,14 +98,14 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 21 unmodified lines
9898 const uint8_t *buf, int buf_size, int first_field)
9999 {
100100 static const uint8_t header_prefix[] = { 0x00, 0x00, 0x02, 0x80, 0x01 };
101− int i, cid;
101+ int i, cid, ret;
102102
103103 if (buf_size < 0x280)
104− return -1;
104+ return AVERROR_INVALIDDATA;
105105
106106 if (memcmp(buf, header_prefix, 5)) {
107107 av_log(ctx->avctx, AV_LOG_ERROR, "error in header\n");
108− return -1;
108+ return AVERROR_INVALIDDATA;
109109 }
110110 if (buf[5] & 2) { /* interlaced */
111111 ctx->cur_field = buf[5] & 1;
@@ -140,12 +140,12 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 28 unmodified lines
140140 cid = AV_RB32(buf + 0x28);
141141 av_dlog(ctx->avctx, "compression id %d\n", cid);
142142
143− if (dnxhd_init_vlc(ctx, cid) < 0)
144− return -1;
143+ if ((ret = dnxhd_init_vlc(ctx, cid)) < 0)
144+ return ret;
145145
146146 if (buf_size < ctx->cid_table->coding_unit_size) {
147147 av_log(ctx->avctx, AV_LOG_ERROR, "incorrect frame size\n");
148− return -1;
148+ return AVERROR_INVALIDDATA;
149149 }
150150
151151 ctx->mb_width = ctx->width>>4;
@@ -159,7 +159,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 7 unmodified lines
159159 if (ctx->mb_height > 68 ||
160160 (ctx->mb_height << frame->interlaced_frame) > (ctx->height+15)>>4) {
161161 av_log(ctx->avctx, AV_LOG_ERROR, "mb height too big: %d\n", ctx->mb_height);
162− return -1;
162+ return AVERROR_INVALIDDATA;
163163 }
164164
165165 for (i = 0; i < ctx->mb_height; i++) {
@@ -167,7 +167,7 @@ static int dnxhd_decode_header(DNXHDContext *ctx, AVFrame *frame, · 1 unmodified line
167167 av_dlog(ctx->avctx, "mb scan index %d\n", ctx->mb_scan_index[i]);
168168 if (buf_size < ctx->mb_scan_index[i] + 0x280) {
169169 av_log(ctx->avctx, AV_LOG_ERROR, "invalid mb scan index\n");
170− return -1;
170+ return AVERROR_INVALIDDATA;
171171 }
172172 }
173173
@@ -338,8 +338,8 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, · 164 unmodified lines
338338 av_dlog(avctx, "frame size %d\n", buf_size);
339339
340340 decode_coding_unit:
341− if (dnxhd_decode_header(ctx, picture, buf, buf_size, first_field) < 0)
342− return -1;
341+ if ((ret = dnxhd_decode_header(ctx, picture, buf, buf_size, first_field)) < 0)
342+ return ret;
343343
344344 if ((avctx->width || avctx->height) &&
345345 (ctx->width != avctx->width || ctx->height != avctx->height)) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t