diff --git a/libavcodec/4xm.c b/libavcodec/4xm.c index 6a6349115b..cd22aa4c39 100644 --- a/libavcodec/4xm.c +++ b/libavcodec/4xm.c @@ -884,10 +884,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, // alternatively we would have to use our own buffer management avctx->flags |= CODEC_FLAG_EMU_EDGE; - if ((ret = ff_reget_buffer(avctx, f->current_picture)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, f->current_picture)) < 0) return ret; - } if (frame_4cc == AV_RL32("ifr2")) { f->current_picture->pict_type = AV_PICTURE_TYPE_I; @@ -904,10 +902,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, } else if (frame_4cc == AV_RL32("pfrm") || frame_4cc == AV_RL32("pfr2")) { if (!f->last_picture->data[0]) { if ((ret = ff_get_buffer(avctx, f->last_picture, - AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } for (i=0; iheight; i++) memset(f->last_picture->data[0] + i*f->last_picture->linesize[0], 0, 2*avctx->width); } diff --git a/libavcodec/8bps.c b/libavcodec/8bps.c index 5f5dde62ff..a910551410 100644 --- a/libavcodec/8bps.c +++ b/libavcodec/8bps.c @@ -70,10 +70,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, unsigned char *planemap = c->planemap; int ret; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } /* Set data pointer after line lengths */ dp = encoded + planes * (height << 1); diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c index 8f0fbade42..82fda6f449 100644 --- a/libavcodec/8svx.c +++ b/libavcodec/8svx.c @@ -136,10 +136,8 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = buf_size * 2; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } for (ch = 0; ch < avctx->channels; ch++) { delta_decode(frame->data[ch], &esc->data[ch][esc->data_idx], diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index c69ec15bab..130996da60 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -192,10 +192,8 @@ static int frame_configure_elements(AVCodecContext *avctx) /* get output buffer */ av_frame_unref(ac->frame); ac->frame->nb_samples = 2048; - if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, ac->frame, 0)) < 0) return ret; - } /* map output channel pointers to AVFrame data */ for (ch = 0; ch < avctx->channels; ch++) { diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index b47019601d..d3bddc6439 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -91,10 +91,8 @@ static int aasc_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } compr = AV_RL32(buf); buf += 4; diff --git a/libavcodec/ac3dec.c b/libavcodec/ac3dec.c index 87f1067b91..0e584a5b31 100644 --- a/libavcodec/ac3dec.c +++ b/libavcodec/ac3dec.c @@ -1375,10 +1375,8 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ frame->nb_samples = s->num_blocks * 256; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } /* decode the audio blocks */ channel_map = ff_ac3_dec_channel_map[s->output_mode & ~AC3_OUTPUT_LFEON][s->lfe_on]; diff --git a/libavcodec/adpcm.c b/libavcodec/adpcm.c index a995b554a4..3d6115c5c2 100644 --- a/libavcodec/adpcm.c +++ b/libavcodec/adpcm.c @@ -637,10 +637,8 @@ static int adpcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = nb_samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (short *)frame->data[0]; samples_p = (int16_t **)frame->extended_data; diff --git a/libavcodec/adxdec.c b/libavcodec/adxdec.c index b5868a09c5..7d7fe3ae64 100644 --- a/libavcodec/adxdec.c +++ b/libavcodec/adxdec.c @@ -142,10 +142,8 @@ static int adx_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = num_blocks * BLOCK_SAMPLES; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t **)frame->extended_data; samples_offset = 0; diff --git a/libavcodec/alac.c b/libavcodec/alac.c index 532b7ab6fb..ca219c10d9 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -289,10 +289,8 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, if (!alac->nb_samples) { /* get output buffer */ frame->nb_samples = output_samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } } else if (output_samples != alac->nb_samples) { av_log(avctx, AV_LOG_ERROR, "sample count mismatch: %u != %d\n", output_samples, alac->nb_samples); diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index d7cad19e30..31bf2ab416 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1480,10 +1480,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, /* get output buffer */ frame->nb_samples = ctx->cur_frame_length; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } // transform decoded frame into output format #define INTERLEAVE_OUTPUT(bps) \ diff --git a/libavcodec/amrnbdec.c b/libavcodec/amrnbdec.c index d186dccc4d..e1773aa702 100644 --- a/libavcodec/amrnbdec.c +++ b/libavcodec/amrnbdec.c @@ -963,10 +963,8 @@ static int amrnb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = AMR_BLOCK_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } buf_out = (float *)frame->data[0]; p->cur_frame_mode = unpack_bitstream(p, buf, buf_size); diff --git a/libavcodec/amrwbdec.c b/libavcodec/amrwbdec.c index 0e9446f1be..dae4745845 100644 --- a/libavcodec/amrwbdec.c +++ b/libavcodec/amrwbdec.c @@ -1112,10 +1112,8 @@ static int amrwb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 4 * AMRWB_SFR_SIZE_16k; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } buf_out = (float *)frame->data[0]; header_size = decode_mime_header(ctx, buf); diff --git a/libavcodec/anm.c b/libavcodec/anm.c index 4e9737f6a1..0b8f7c80a8 100644 --- a/libavcodec/anm.c +++ b/libavcodec/anm.c @@ -117,10 +117,8 @@ static int decode_frame(AVCodecContext *avctx, uint8_t *dst, *dst_end; int count, ret; - if ((ret = ff_reget_buffer(avctx, s->frame)) < 0){ - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } dst = s->frame->data[0]; dst_end = s->frame->data[0] + s->frame->linesize[0]*avctx->height; diff --git a/libavcodec/ansi.c b/libavcodec/ansi.c index 621f095f06..f259852427 100644 --- a/libavcodec/ansi.c +++ b/libavcodec/ansi.c @@ -246,11 +246,9 @@ static int execute_code(AVCodecContext * avctx, int c) if (width != avctx->width || height != avctx->height) { av_frame_unref(s->frame); avcodec_set_dimensions(avctx, width, height); - ret = ff_get_buffer(avctx, s->frame, AV_GET_BUFFER_FLAG_REF); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, s->frame, + AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } s->frame->pict_type = AV_PICTURE_TYPE_I; s->frame->palette_has_changed = 1; set_palette((uint32_t *)s->frame->data[1]); @@ -351,11 +349,8 @@ static int decode_frame(AVCodecContext *avctx, const uint8_t *buf_end = buf+buf_size; int ret, i, count; - ret = ff_reget_buffer(avctx, s->frame); - if (ret < 0){ - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } if (!avctx->frame_number) { for (i=0; iheight; i++) memset(s->frame->data[0]+ i*s->frame->linesize[0], 0, avctx->width); diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 8752341381..e6538a22ec 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -904,10 +904,8 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = blockstodecode; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } s->error=0; diff --git a/libavcodec/asvdec.c b/libavcodec/asvdec.c index 532c9e59a6..7dca22b993 100644 --- a/libavcodec/asvdec.c +++ b/libavcodec/asvdec.c @@ -210,10 +210,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p = data; int mb_x, mb_y, ret; - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/atrac1.c b/libavcodec/atrac1.c index 5db608592f..ff7dd3ee48 100644 --- a/libavcodec/atrac1.c +++ b/libavcodec/atrac1.c @@ -287,10 +287,8 @@ static int atrac1_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = AT1_SU_SAMPLES; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } for (ch = 0; ch < avctx->channels; ch++) { AT1SUCtx* su = &q->SUs[ch]; diff --git a/libavcodec/atrac3.c b/libavcodec/atrac3.c index 0c42a6d4fd..eb42ed20a2 100644 --- a/libavcodec/atrac3.c +++ b/libavcodec/atrac3.c @@ -813,10 +813,8 @@ static int atrac3_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = SAMPLES_PER_FRAME; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } /* Check if we need to descramble and what buffer to pass on. */ if (q->scrambled_stream) { diff --git a/libavcodec/aura.c b/libavcodec/aura.c index bb2be7ee9f..34d46ae607 100644 --- a/libavcodec/aura.c +++ b/libavcodec/aura.c @@ -59,10 +59,8 @@ static int aura_decode_frame(AVCodecContext *avctx, /* pixel data starts 48 bytes in, after 3x16-byte tables */ buf += 48; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } Y = frame->data[0]; U = frame->data[1]; diff --git a/libavcodec/avrndec.c b/libavcodec/avrndec.c index 882ee50769..40aca178d1 100644 --- a/libavcodec/avrndec.c +++ b/libavcodec/avrndec.c @@ -93,10 +93,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if((ret = ff_get_buffer(avctx, p, 0)) < 0){ - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type= AV_PICTURE_TYPE_I; p->key_frame= 1; diff --git a/libavcodec/avs.c b/libavcodec/avs.c index a6e020a6d2..e3733d7711 100644 --- a/libavcodec/avs.c +++ b/libavcodec/avs.c @@ -60,10 +60,8 @@ avs_decode_frame(AVCodecContext * avctx, AvsBlockType type; GetBitContext change_map = {0}; //init to silence warning - if ((ret = ff_reget_buffer(avctx, p)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, p)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_P; p->key_frame = 0; diff --git a/libavcodec/avuidec.c b/libavcodec/avuidec.c index 689191d2e6..a574f5bc2a 100644 --- a/libavcodec/avuidec.c +++ b/libavcodec/avuidec.c @@ -33,6 +33,7 @@ static av_cold int avui_decode_init(AVCodecContext *avctx) static int avui_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { + int ret; AVFrame *pic = data; const uint8_t *src = avpkt->data, *extradata = avctx->extradata; const uint8_t *srca; @@ -67,10 +68,8 @@ static int avui_decode_frame(AVCodecContext *avctx, void *data, avpkt->size >= opaque_length * 2 + 4; srca = src + opaque_length + 5; - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/bethsoftvideo.c b/libavcodec/bethsoftvideo.c index ed9525a41a..474265f1bd 100644 --- a/libavcodec/bethsoftvideo.c +++ b/libavcodec/bethsoftvideo.c @@ -75,10 +75,8 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, int code, ret; int yoffset; - if ((ret = ff_reget_buffer(avctx, &vid->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &vid->frame)) < 0) return ret; - } wrap_to_next_line = vid->frame.linesize[0] - avctx->width; if (avpkt->side_data_elems > 0 && diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index da22cc00a8..9cfcd14aa3 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -58,10 +58,8 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, uint32_t *pal; int i, j, ret, height = avctx->height; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } bytestream2_init(&g, avpkt->data, buf_size); diff --git a/libavcodec/bink.c b/libavcodec/bink.c index 980df453cd..9bab4b992b 100644 --- a/libavcodec/bink.c +++ b/libavcodec/bink.c @@ -1186,15 +1186,11 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac int bits_count = pkt->size << 3; if (c->version > 'b') { - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } } else { - if ((ret = ff_reget_buffer(avctx, c->last)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, c->last)) < 0) return ret; - } if ((ret = av_frame_ref(frame, c->last)) < 0) return ret; } diff --git a/libavcodec/binkaudio.c b/libavcodec/binkaudio.c index 7de2c245e0..ef5569a8c4 100644 --- a/libavcodec/binkaudio.c +++ b/libavcodec/binkaudio.c @@ -318,10 +318,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = s->frame_len; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (decode_block(s, (float **)frame->extended_data, avctx->codec->id == AV_CODEC_ID_BINKAUDIO_DCT)) { diff --git a/libavcodec/bintext.c b/libavcodec/bintext.c index b6d7d0f84c..f8059aa1af 100644 --- a/libavcodec/bintext.c +++ b/libavcodec/bintext.c @@ -144,10 +144,8 @@ static int decode_frame(AVCodecContext *avctx, int ret; s->x = s->y = 0; - if (ff_reget_buffer(avctx, s->frame) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) + return ret; s->frame->pict_type = AV_PICTURE_TYPE_I; s->frame->palette_has_changed = 1; memcpy(s->frame->data[1], s->palette, 16 * 4); diff --git a/libavcodec/bmp.c b/libavcodec/bmp.c index fef2f2372d..a3bb1a77d7 100644 --- a/libavcodec/bmp.c +++ b/libavcodec/bmp.c @@ -196,10 +196,8 @@ static int bmp_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index 78176f837f..2628e4a2c0 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -242,10 +242,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, scr_off = 0; } - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (decode_bmv_frame(c->stream, pkt->size - (c->stream - pkt->data), c->frame, scr_off)) { av_log(avctx, AV_LOG_ERROR, "Error decoding frame data\n"); @@ -320,10 +318,8 @@ static int bmv_aud_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = total_blocks * 32; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } output_samples = (int16_t *)frame->data[0]; for (blocks = 0; blocks < total_blocks; blocks++) { diff --git a/libavcodec/brender_pix.c b/libavcodec/brender_pix.c index 67bec05413..b30b8827f0 100644 --- a/libavcodec/brender_pix.c +++ b/libavcodec/brender_pix.c @@ -134,10 +134,8 @@ static int brpix_decode_frame(AVCodecContext *avctx, if (hdr.width != avctx->width || hdr.height != avctx->height) avcodec_set_dimensions(avctx, hdr.width, hdr.height); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } chunk_type = bytestream2_get_be32(&gb); diff --git a/libavcodec/c93.c b/libavcodec/c93.c index e7fbcc85c9..9aaa3ee780 100644 --- a/libavcodec/c93.c +++ b/libavcodec/c93.c @@ -129,10 +129,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, c93->currentpic ^= 1; - if ((ret = ff_reget_buffer(avctx, newpic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, newpic)) < 0) return ret; - } stride = newpic->linesize[0]; diff --git a/libavcodec/cdgraphics.c b/libavcodec/cdgraphics.c index f380dcdc9f..d22e9f6e73 100644 --- a/libavcodec/cdgraphics.c +++ b/libavcodec/cdgraphics.c @@ -278,11 +278,8 @@ static int cdg_decode_frame(AVCodecContext *avctx, return AVERROR(EINVAL); } - ret = ff_reget_buffer(avctx, cc->frame); - if (ret) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, cc->frame)) < 0) return ret; - } if (!avctx->frame_number) { memset(cc->frame->data[0], 0, cc->frame->linesize[0] * avctx->height); memset(cc->frame->data[1], 0, AVPALETTE_SIZE); @@ -333,11 +330,8 @@ static int cdg_decode_frame(AVCodecContext *avctx, return AVERROR(EINVAL); } - ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF); - if (ret) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } cdg_scroll(cc, cdg_data, frame, inst == CDG_INST_SCROLL_COPY); av_frame_unref(cc->frame); diff --git a/libavcodec/cdxl.c b/libavcodec/cdxl.c index 8546e0bdb6..a46ba83d70 100644 --- a/libavcodec/cdxl.c +++ b/libavcodec/cdxl.c @@ -260,10 +260,8 @@ static int cdxl_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_PATCHWELCOME; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; if (encoding) { diff --git a/libavcodec/cinepak.c b/libavcodec/cinepak.c index 02f16ec09d..181039cf91 100644 --- a/libavcodec/cinepak.c +++ b/libavcodec/cinepak.c @@ -439,10 +439,8 @@ static int cinepak_decode_frame(AVCodecContext *avctx, s->data = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } if (s->palette_video) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); diff --git a/libavcodec/cljr.c b/libavcodec/cljr.c index 7d4fd6897e..2120864675 100644 --- a/libavcodec/cljr.c +++ b/libavcodec/cljr.c @@ -52,10 +52,8 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/cllc.c b/libavcodec/cllc.c index 685ad59300..6378c79d55 100644 --- a/libavcodec/cllc.c +++ b/libavcodec/cllc.c @@ -329,11 +329,8 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_RGB24; avctx->bits_per_raw_sample = 8; - ret = ff_get_buffer(avctx, pic, 0); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; - } ret = decode_rgb24_frame(ctx, &gb, pic); if (ret < 0) @@ -344,11 +341,8 @@ static int cllc_decode_frame(AVCodecContext *avctx, void *data, avctx->pix_fmt = AV_PIX_FMT_ARGB; avctx->bits_per_raw_sample = 8; - ret = ff_get_buffer(avctx, pic, 0); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; - } ret = decode_argb_frame(ctx, &gb, pic); if (ret < 0) diff --git a/libavcodec/cngdec.c b/libavcodec/cngdec.c index b22ee6885c..675f77d203 100644 --- a/libavcodec/cngdec.c +++ b/libavcodec/cngdec.c @@ -142,10 +142,8 @@ static int cng_decode_frame(AVCodecContext *avctx, void *data, p->excitation, avctx->frame_size, p->order); frame->nb_samples = avctx->frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } buf_out = (int16_t *)frame->data[0]; for (i = 0; i < avctx->frame_size; i++) buf_out[i] = p->filter_out[i + p->order]; diff --git a/libavcodec/cook.c b/libavcodec/cook.c index d9c443701b..31b986c1d4 100644 --- a/libavcodec/cook.c +++ b/libavcodec/cook.c @@ -970,10 +970,8 @@ static int cook_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ if (q->discarded_packets >= 2) { frame->nb_samples = q->samples_per_channel; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (float **)frame->extended_data; } diff --git a/libavcodec/cpia.c b/libavcodec/cpia.c index a29b651867..4f83503e0d 100644 --- a/libavcodec/cpia.c +++ b/libavcodec/cpia.c @@ -100,10 +100,8 @@ static int cpia_decode_frame(AVCodecContext *avctx, } // Get buffer filled with previous frame - if ((ret = ff_reget_buffer(avctx, frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed!\n"); + if ((ret = ff_reget_buffer(avctx, frame)) < 0) return ret; - } for ( i = 0; diff --git a/libavcodec/crystalhd.c b/libavcodec/crystalhd.c index 5445894a9d..d1ed84bbf5 100644 --- a/libavcodec/crystalhd.c +++ b/libavcodec/crystalhd.c @@ -642,10 +642,8 @@ static inline CopyRet copy_frame(AVCodecContext *avctx, priv->pic->buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; if (!priv->pic->data[0]) { - if (ff_get_buffer(avctx, priv->pic, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_get_buffer(avctx, priv->pic, AV_GET_BUFFER_FLAG_REF) < 0) return RET_ERROR; - } } bwidth = av_image_get_linesize(avctx->pix_fmt, width, 0); diff --git a/libavcodec/cscd.c b/libavcodec/cscd.c index cc7fe950a8..0a5fa69186 100644 --- a/libavcodec/cscd.c +++ b/libavcodec/cscd.c @@ -74,10 +74,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, c->pic)) < 0) return ret; - } // decompress data switch ((buf[0] >> 1) & 7) { diff --git a/libavcodec/cyuv.c b/libavcodec/cyuv.c index 8e45b3ad12..3a30138efb 100644 --- a/libavcodec/cyuv.c +++ b/libavcodec/cyuv.c @@ -105,10 +105,8 @@ static int cyuv_decode_frame(AVCodecContext *avctx, /* pixel data starts 48 bytes in, after 3x16-byte tables */ stream_ptr = 48; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } y_plane = frame->data[0]; u_plane = frame->data[1]; diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index fd518a755b..881f052a2f 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -2355,10 +2355,8 @@ static int dca_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 256 * (s->sample_blocks / 8); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples_flt = (float **)frame->extended_data; /* allocate buffer for extra channels if downmixing */ diff --git a/libavcodec/dfa.c b/libavcodec/dfa.c index a2f18ae0e0..b20cd0e41b 100644 --- a/libavcodec/dfa.c +++ b/libavcodec/dfa.c @@ -324,10 +324,8 @@ static int dfa_decode_frame(AVCodecContext *avctx, int ret; int i, pal_elems; - if ((ret = ff_get_buffer(avctx, frame, 0))) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } bytestream2_init(&gb, avpkt->data, avpkt->size); while (bytestream2_get_bytes_left(&gb) > 0) { diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index aa158bfae1..81d2b6509e 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1747,7 +1747,7 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int { DiracContext *s = avctx->priv_data; DiracFrame *pic = NULL; - int i, parse_code = buf[4]; + int ret, i, parse_code = buf[4]; unsigned tmp; if (size < DATA_UNIT_HEADER_SIZE) @@ -1811,10 +1811,8 @@ static int dirac_decode_data_unit(AVCodecContext *avctx, const uint8_t *buf, int pic->avframe.key_frame = s->num_refs == 0; /* [DIRAC_STD] is_intra() */ pic->avframe.pict_type = s->num_refs + 1; /* Definition of AVPictureType in avutil.h */ - if (ff_get_buffer(avctx, &pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, &pic->avframe, (parse_code & 0x0C) == 0x0C ? AV_GET_BUFFER_FLAG_REF : 0)) < 0) + return ret; s->current_picture = pic; s->plane[0].stride = pic->avframe.linesize[0]; s->plane[1].stride = pic->avframe.linesize[1]; diff --git a/libavcodec/dnxhddec.c b/libavcodec/dnxhddec.c index 19921195b6..11bed00e02 100644 --- a/libavcodec/dnxhddec.c +++ b/libavcodec/dnxhddec.c @@ -385,10 +385,8 @@ static int dnxhd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, avcodec_set_dimensions(avctx, ctx->width, ctx->height); if (first_field) { - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } picture->pict_type = AV_PICTURE_TYPE_I; picture->key_frame = 1; } diff --git a/libavcodec/dpcm.c b/libavcodec/dpcm.c index e6325ed637..402b0f9706 100644 --- a/libavcodec/dpcm.c +++ b/libavcodec/dpcm.c @@ -211,10 +211,8 @@ static int dpcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = (out + avctx->channels - 1) / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } output_samples = (int16_t *)frame->data[0]; samples_end = output_samples + out; diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index bcd72d263a..0d60a7e4fb 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -179,10 +179,8 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } // Move pointer to offset from start of file buf = avpkt->data + offset; diff --git a/libavcodec/dsicinav.c b/libavcodec/dsicinav.c index 4f6b731ea0..f0e8f02ec2 100644 --- a/libavcodec/dsicinav.c +++ b/libavcodec/dsicinav.c @@ -305,10 +305,8 @@ static int cinvideo_decode_frame(AVCodecContext *avctx, break; } - if ((res = ff_reget_buffer(avctx, &cin->frame)) < 0) { - av_log(cin->avctx, AV_LOG_ERROR, "failed to allocate a frame\n"); + if ((res = ff_reget_buffer(avctx, &cin->frame)) < 0) return res; - } memcpy(cin->frame.data[1], cin->palette, sizeof(cin->palette)); cin->frame.palette_has_changed = 1; @@ -363,10 +361,8 @@ static int cinaudio_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = avpkt->size - cin->initial_decode_frame; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; delta = cin->delta; diff --git a/libavcodec/dvdec.c b/libavcodec/dvdec.c index 51e32b5fb3..5cc205ce03 100644 --- a/libavcodec/dvdec.c +++ b/libavcodec/dvdec.c @@ -319,7 +319,7 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, int buf_size = avpkt->size; DVVideoContext *s = avctx->priv_data; const uint8_t* vsc_pack; - int apt, is16_9; + int ret, apt, is16_9; s->sys = avpriv_dv_frame_profile2(avctx, s->sys, buf, buf_size); if (!s->sys || buf_size < s->sys->frame_size || ff_dv_init_dynamic_tables(s->sys)) { @@ -332,10 +332,8 @@ static int dvvideo_decode_frame(AVCodecContext *avctx, avctx->pix_fmt = s->sys->pix_fmt; avctx->time_base = s->sys->time_base; avcodec_set_dimensions(avctx, s->sys->width, s->sys->height); - if (ff_get_buffer(avctx, &s->picture, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, &s->picture, 0)) < 0) + return ret; s->picture.interlaced_frame = 1; s->picture.top_field_first = 0; diff --git a/libavcodec/dxa.c b/libavcodec/dxa.c index 5d9da0011f..2286f335df 100644 --- a/libavcodec/dxa.c +++ b/libavcodec/dxa.c @@ -212,10 +212,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac pc = 1; } - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } memcpy(frame->data[1], c->pal, AVPALETTE_SIZE); frame->palette_has_changed = pc; diff --git a/libavcodec/eacmv.c b/libavcodec/eacmv.c index 78a42983a4..4e96c1af49 100644 --- a/libavcodec/eacmv.c +++ b/libavcodec/eacmv.c @@ -188,10 +188,8 @@ static int cmv_decode_frame(AVCodecContext *avctx, if (av_image_check_size(s->width, s->height, 0, s->avctx)) return -1; - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } memcpy(frame->data[1], s->palette, AVPALETTE_SIZE); diff --git a/libavcodec/eamad.c b/libavcodec/eamad.c index c193d81294..58cdea6753 100644 --- a/libavcodec/eamad.c +++ b/libavcodec/eamad.c @@ -266,10 +266,8 @@ static int decode_frame(AVCodecContext *avctx, av_frame_unref(&s->last_frame); } - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } if (inter && !s->last_frame.data[0]) { av_log(avctx, AV_LOG_WARNING, "Missing reference frame.\n"); diff --git a/libavcodec/eatgq.c b/libavcodec/eatgq.c index cbf49a72bd..cf93c0660e 100644 --- a/libavcodec/eatgq.c +++ b/libavcodec/eatgq.c @@ -225,10 +225,8 @@ static int tgq_decode_frame(AVCodecContext *avctx, tgq_calculate_qtable(s, bytestream2_get_byteu(&s->gb)); bytestream2_skip(&s->gb, 3); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } frame->key_frame = 1; frame->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/eatqi.c b/libavcodec/eatqi.c index 2c3e3efdbe..1484ddc998 100644 --- a/libavcodec/eatqi.c +++ b/libavcodec/eatqi.c @@ -114,10 +114,8 @@ static int tqi_decode_frame(AVCodecContext *avctx, if (s->avctx->width!=s->width || s->avctx->height!=s->height) avcodec_set_dimensions(s->avctx, s->width, s->height); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } av_fast_padded_malloc(&t->bitstream_buf, &t->bitstream_buf_size, buf_end - buf); diff --git a/libavcodec/escape124.c b/libavcodec/escape124.c index 3a4edecad1..3c83e588f1 100644 --- a/libavcodec/escape124.c +++ b/libavcodec/escape124.c @@ -271,10 +271,8 @@ static int escape124_decode_frame(AVCodecContext *avctx, } } - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } new_frame_data = (uint16_t*)frame->data[0]; new_stride = frame->linesize[0] / 2; diff --git a/libavcodec/escape130.c b/libavcodec/escape130.c index 64d2383073..d24af79cbe 100644 --- a/libavcodec/escape130.c +++ b/libavcodec/escape130.c @@ -131,10 +131,8 @@ static int escape130_decode_frame(AVCodecContext *avctx, // Header; no useful information in here skip_bits_long(&gb, 128); - if (ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; new_y = frame->data[0]; new_cb = frame->data[1]; diff --git a/libavcodec/exr.c b/libavcodec/exr.c index 9b93e3fb13..4e7c19ce1b 100644 --- a/libavcodec/exr.c +++ b/libavcodec/exr.c @@ -755,10 +755,8 @@ static int decode_frame(AVCodecContext *avctx, memset(s->thread_data + prev_size, 0, s->thread_data_size - prev_size); } - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } if (buf_end - buf < scan_line_blocks * 8) return AVERROR_INVALIDDATA; diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c index 72e5ef338c..21afa1d3f3 100644 --- a/libavcodec/ffv1dec.c +++ b/libavcodec/ffv1dec.c @@ -758,10 +758,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac p->key_frame = 0; } - if ((ret = ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } if (avctx->debug & FF_DEBUG_PICT_INFO) av_log(avctx, AV_LOG_DEBUG, "ver:%d keyframe:%d coder:%d ec:%d slices:%d bps:%d\n", diff --git a/libavcodec/flacdec.c b/libavcodec/flacdec.c index f3f46e685d..1d662f9ea5 100644 --- a/libavcodec/flacdec.c +++ b/libavcodec/flacdec.c @@ -545,10 +545,8 @@ static int flac_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = s->blocksize; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } s->dsp.decorrelate[s->ch_mode](frame->data, s->decoded, s->channels, s->blocksize, s->sample_shift); diff --git a/libavcodec/flashsv.c b/libavcodec/flashsv.c index a44e779d8d..81628e6788 100644 --- a/libavcodec/flashsv.c +++ b/libavcodec/flashsv.c @@ -337,10 +337,8 @@ static int flashsv_decode_frame(AVCodecContext *avctx, void *data, s->image_width, s->image_height, s->block_width, s->block_height, h_blocks, v_blocks, h_part, v_part); - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } /* loop over all block columns */ for (j = 0; j < v_blocks + (v_part ? 1 : 0); j++) { diff --git a/libavcodec/flicvideo.c b/libavcodec/flicvideo.c index 27584cb23b..90885fc0d5 100644 --- a/libavcodec/flicvideo.c +++ b/libavcodec/flicvideo.c @@ -185,10 +185,8 @@ static int flic_decode_frame_8BPP(AVCodecContext *avctx, bytestream2_init(&g2, buf, buf_size); - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } pixels = s->frame.data[0]; pixel_limit = s->avctx->height * s->frame.linesize[0]; @@ -505,10 +503,8 @@ static int flic_decode_frame_15_16BPP(AVCodecContext *avctx, bytestream2_init(&g2, buf, buf_size); - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } pixels = s->frame.data[0]; pixel_limit = s->avctx->height * s->frame.linesize[0]; diff --git a/libavcodec/fraps.c b/libavcodec/fraps.c index f80b41e660..00a38c6169 100644 --- a/libavcodec/fraps.c +++ b/libavcodec/fraps.c @@ -201,10 +201,8 @@ static int decode_frame(AVCodecContext *avctx, avctx->pix_fmt = version & 1 ? AV_PIX_FMT_BGR24 : AV_PIX_FMT_YUVJ420P; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0))) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } switch (version) { case 0: diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c index b7d8ca820c..b1c7408a93 100644 --- a/libavcodec/frwu.c +++ b/libavcodec/frwu.c @@ -59,10 +59,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) return ret; - } pic->pict_type = AV_PICTURE_TYPE_I; pic->key_frame = 1; diff --git a/libavcodec/g722dec.c b/libavcodec/g722dec.c index 796db920c2..1a489a71dc 100644 --- a/libavcodec/g722dec.c +++ b/libavcodec/g722dec.c @@ -94,10 +94,8 @@ static int g722_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = avpkt->size * 2; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } out_buf = (int16_t *)frame->data[0]; init_get_bits(&gb, avpkt->data, avpkt->size * 8); diff --git a/libavcodec/g723_1.c b/libavcodec/g723_1.c index 7ee06c963c..6254c9a5b2 100644 --- a/libavcodec/g723_1.c +++ b/libavcodec/g723_1.c @@ -1185,10 +1185,8 @@ static int g723_1_decode_frame(AVCodecContext *avctx, void *data, } frame->nb_samples = FRAME_LEN; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return ret; - } + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) + return ret; out = (int16_t *)frame->data[0]; diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 8e630ffd05..58d046817c 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -431,10 +431,8 @@ static int g726_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = out_samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; init_get_bits(&gb, buf, buf_size * 8); diff --git a/libavcodec/g729dec.c b/libavcodec/g729dec.c index c9af3705b2..440bf80cfc 100644 --- a/libavcodec/g729dec.c +++ b/libavcodec/g729dec.c @@ -420,10 +420,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, int is_periodic = 0; // whether one of the subframes is declared as periodic or not ctx->frame.nb_samples = SUBFRAME_SIZE<<1; - if ((ret = ff_get_buffer(avctx, &ctx->frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, &ctx->frame, 0)) < 0) return ret; - } out_frame = (int16_t*) ctx->frame.data[0]; if (buf_size == 10) { diff --git a/libavcodec/gifdec.c b/libavcodec/gifdec.c index 617e5b7583..27364c9713 100644 --- a/libavcodec/gifdec.c +++ b/libavcodec/gifdec.c @@ -469,10 +469,8 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A avcodec_set_dimensions(avctx, s->screen_width, s->screen_height); av_frame_unref(s->frame); - if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, s->frame, 0)) < 0) return ret; - } av_fast_malloc(&s->idx_line, &s->idx_line_size, s->screen_width); if (!s->idx_line) @@ -487,10 +485,8 @@ static int gif_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, A return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } s->frame->pict_type = AV_PICTURE_TYPE_P; s->frame->key_frame = 0; diff --git a/libavcodec/gsmdec.c b/libavcodec/gsmdec.c index 2db4bddc28..dc64267ed0 100644 --- a/libavcodec/gsmdec.c +++ b/libavcodec/gsmdec.c @@ -70,10 +70,8 @@ static int gsm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = avctx->frame_size; - if ((res = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((res = ff_get_buffer(avctx, frame, 0)) < 0) return res; - } samples = (int16_t *)frame->data[0]; switch (avctx->codec_id) { diff --git a/libavcodec/huffyuvdec.c b/libavcodec/huffyuvdec.c index 8554ecf8f2..e5a9e3bf81 100644 --- a/libavcodec/huffyuvdec.c +++ b/libavcodec/huffyuvdec.c @@ -523,10 +523,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, s->dsp.bswap_buf((uint32_t*)s->bitstream_buffer, (const uint32_t*)buf, buf_size / 4); - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } if (s->context) { table_size = read_huffman_tables(s, s->bitstream_buffer, buf_size); diff --git a/libavcodec/idcinvideo.c b/libavcodec/idcinvideo.c index 7e63da9987..3596080056 100644 --- a/libavcodec/idcinvideo.c +++ b/libavcodec/idcinvideo.c @@ -222,10 +222,8 @@ static int idcin_decode_frame(AVCodecContext *avctx, s->buf = buf; s->size = buf_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (idcin_decode_vlcs(s, frame)) return AVERROR_INVALIDDATA; diff --git a/libavcodec/iff.c b/libavcodec/iff.c index dc70b9fea4..822a981643 100644 --- a/libavcodec/iff.c +++ b/libavcodec/iff.c @@ -663,10 +663,8 @@ static int decode_frame(AVCodecContext *avctx, if ((res = extract_header(avctx, avpkt)) < 0) return res; - if ((res = ff_reget_buffer(avctx, s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((res = ff_reget_buffer(avctx, s->frame)) < 0) return res; - } if (!s->init && avctx->bits_per_coded_sample <= 8 && avctx->pix_fmt == AV_PIX_FMT_PAL8) { if ((res = cmap_read_palette(avctx, (uint32_t*)s->frame->data[1])) < 0) diff --git a/libavcodec/imc.c b/libavcodec/imc.c index 2d7dd638a8..bdeef04dc5 100644 --- a/libavcodec/imc.c +++ b/libavcodec/imc.c @@ -948,10 +948,8 @@ static int imc_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = COEFFS; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } for (i = 0; i < avctx->channels; i++) { q->out_samples = (float *)frame->extended_data[i]; diff --git a/libavcodec/indeo2.c b/libavcodec/indeo2.c index 0ce65b1ffa..f8e7415f82 100644 --- a/libavcodec/indeo2.c +++ b/libavcodec/indeo2.c @@ -149,10 +149,8 @@ static int ir2_decode_frame(AVCodecContext *avctx, AVFrame * const p = &s->picture; int start, ret; - if ((ret = ff_reget_buffer(avctx, p)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, p)) < 0) return ret; - } start = 48; /* hardcoded for now */ diff --git a/libavcodec/indeo3.c b/libavcodec/indeo3.c index 629bcab316..ee05da0825 100644 --- a/libavcodec/indeo3.c +++ b/libavcodec/indeo3.c @@ -1088,10 +1088,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, /* use BS_BUFFER flag for buffer switching */ ctx->buf_sel = (ctx->frame_flags >> BS_BUFFER) & 1; - if ((res = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(ctx->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((res = ff_get_buffer(avctx, frame, 0)) < 0) return res; - } /* decode luma plane */ if ((res = decode_plane(ctx, avctx, ctx->planes, ctx->y_data_ptr, ctx->y_data_size, 40))) diff --git a/libavcodec/interplayvideo.c b/libavcodec/interplayvideo.c index 5c43a785d5..4f710b8e38 100644 --- a/libavcodec/interplayvideo.c +++ b/libavcodec/interplayvideo.c @@ -979,10 +979,8 @@ static int ipvideo_decode_frame(AVCodecContext *avctx, bytestream2_init(&s->stream_ptr, buf + s->decoding_map_size, buf_size - s->decoding_map_size); - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } if (!s->is_16bpp) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); diff --git a/libavcodec/ivi_common.c b/libavcodec/ivi_common.c index 8dd89400b5..265c64586f 100644 --- a/libavcodec/ivi_common.c +++ b/libavcodec/ivi_common.c @@ -905,10 +905,8 @@ int ff_ivi_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return buf_size; avcodec_set_dimensions(avctx, ctx->planes[0].width, ctx->planes[0].height); - if ((result = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((result = ff_get_buffer(avctx, frame, 0)) < 0) return result; - } if (ctx->is_scalable) { if (avctx->codec_id == AV_CODEC_ID_INDEO4) diff --git a/libavcodec/jvdec.c b/libavcodec/jvdec.c index 8ec07c21f3..18cc73fb2d 100644 --- a/libavcodec/jvdec.c +++ b/libavcodec/jvdec.c @@ -151,10 +151,8 @@ static int decode_frame(AVCodecContext *avctx, av_log(avctx, AV_LOG_ERROR, "video size %d invalid\n", video_size); return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } if (video_type == 0 || video_type == 1) { GetBitContext gb; diff --git a/libavcodec/kmvc.c b/libavcodec/kmvc.c index 2034ebdbce..20aae67096 100644 --- a/libavcodec/kmvc.c +++ b/libavcodec/kmvc.c @@ -271,10 +271,8 @@ static int decode_frame(AVCodecContext * avctx, void *data, int *got_frame, bytestream2_init(&ctx->g, avpkt->data, avpkt->size); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } header = bytestream2_get_byte(&ctx->g); diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c index 200cbdc715..85997846e4 100644 --- a/libavcodec/lagarith.c +++ b/libavcodec/lagarith.c @@ -539,10 +539,8 @@ static int lag_decode_frame(AVCodecContext *avctx, planes = 4; } - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } dst = p->data[0]; if (frametype == FRAME_SOLID_RGBA) { @@ -568,10 +566,8 @@ static int lag_decode_frame(AVCodecContext *avctx, if (frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24) avctx->pix_fmt = AV_PIX_FMT_RGB24; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } offs[0] = offset_bv; offs[1] = offset_gu; @@ -627,10 +623,8 @@ static int lag_decode_frame(AVCodecContext *avctx, case FRAME_ARITH_YUY2: avctx->pix_fmt = AV_PIX_FMT_YUV422P; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } if (offset_ry >= buf_size || offset_gu >= buf_size || @@ -653,10 +647,8 @@ static int lag_decode_frame(AVCodecContext *avctx, case FRAME_ARITH_YV12: avctx->pix_fmt = AV_PIX_FMT_YUV420P; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } if (buf_size <= offset_ry || buf_size <= offset_gu || buf_size <= offset_bv) { return AVERROR_INVALIDDATA; } diff --git a/libavcodec/lcldec.c b/libavcodec/lcldec.c index 45308ccbbe..7948199802 100644 --- a/libavcodec/lcldec.c +++ b/libavcodec/lcldec.c @@ -181,10 +181,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac unsigned int mthread_inlen, mthread_outlen; unsigned int len = buf_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } outptr = frame->data[0]; // Output image pointer diff --git a/libavcodec/libcelt_dec.c b/libavcodec/libcelt_dec.c index 496b95a0ed..53bbb723ce 100644 --- a/libavcodec/libcelt_dec.c +++ b/libavcodec/libcelt_dec.c @@ -111,11 +111,8 @@ static int libcelt_dec_decode(AVCodecContext *c, void *data, int16_t *pcm; frame->nb_samples = c->frame_size; - err = ff_get_buffer(c, frame, 0); - if (err < 0) { - av_log(c, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((err = ff_get_buffer(c, frame, 0)) < 0) return err; - } pcm = (int16_t *)frame->data[0]; err = celt_decode(celt->dec, pkt->data, pkt->size, pcm, c->frame_size); if (err < 0) diff --git a/libavcodec/libgsm.c b/libavcodec/libgsm.c index 16fbb0ebda..8250a15140 100644 --- a/libavcodec/libgsm.c +++ b/libavcodec/libgsm.c @@ -198,10 +198,8 @@ static int libgsm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = avctx->frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; for (i = 0; i < avctx->frame_size / GSM_FRAME_SIZE; i++) { diff --git a/libavcodec/libilbc.c b/libavcodec/libilbc.c index 15433ed79e..b4163c67eb 100644 --- a/libavcodec/libilbc.c +++ b/libavcodec/libilbc.c @@ -93,10 +93,8 @@ static int ilbc_decode_frame(AVCodecContext *avctx, void *data, } frame->nb_samples = s->decoder.blockl; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } WebRtcIlbcfix_DecodeImpl((WebRtc_Word16*) frame->data[0], (const WebRtc_UWord16*) buf, &s->decoder, 1); diff --git a/libavcodec/libopencore-amr.c b/libavcodec/libopencore-amr.c index 2935932c9a..1a416ce6d6 100644 --- a/libavcodec/libopencore-amr.c +++ b/libavcodec/libopencore-amr.c @@ -104,10 +104,8 @@ static int amr_nb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 160; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } dec_mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[dec_mode] + 1; @@ -335,10 +333,8 @@ static int amr_wb_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 320; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } mode = (buf[0] >> 3) & 0x000F; packet_size = block_size[mode]; diff --git a/libavcodec/libopenjpegdec.c b/libavcodec/libopenjpegdec.c index 5476e0a70a..f8b616573c 100644 --- a/libavcodec/libopenjpegdec.c +++ b/libavcodec/libopenjpegdec.c @@ -310,10 +310,8 @@ static int libopenjpeg_decode_frame(AVCodecContext *avctx, if (image->comps[i].prec > avctx->bits_per_raw_sample) avctx->bits_per_raw_sample = image->comps[i].prec; - if (ff_thread_get_buffer(avctx, &frame, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "ff_thread_get_buffer() failed\n"); + if (ff_thread_get_buffer(avctx, &frame, 0) < 0) goto done; - } ctx->dec_params.cp_limit_decoding = NO_LIMITATION; ctx->dec_params.cp_reduce = avctx->lowres; diff --git a/libavcodec/libopusdec.c b/libavcodec/libopusdec.c index 71078c4a14..9b5cfe7b3d 100644 --- a/libavcodec/libopusdec.c +++ b/libavcodec/libopusdec.c @@ -132,11 +132,8 @@ static int libopus_decode(AVCodecContext *avc, void *data, int ret, nb_samples; frame->nb_samples = MAX_FRAME_SIZE; - ret = ff_get_buffer(avc, frame, 0); - if (ret < 0) { - av_log(avc, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avc, frame, 0)) < 0) return ret; - } if (avc->sample_fmt == AV_SAMPLE_FMT_S16) nb_samples = opus_multistream_decode(opus->dec, pkt->data, pkt->size, diff --git a/libavcodec/libschroedingerdec.c b/libavcodec/libschroedingerdec.c index 7720344dbc..2e0ce5d18c 100644 --- a/libavcodec/libschroedingerdec.c +++ b/libavcodec/libschroedingerdec.c @@ -306,10 +306,10 @@ static int libschroedinger_decode_frame(AVCodecContext *avctx, framewithpts = ff_schro_queue_pop(&p_schro_params->dec_frame_queue); if (framewithpts && framewithpts->frame) { - if (ff_get_buffer(avctx, avframe, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Unable to allocate buffer\n"); - return AVERROR(ENOMEM); - } + int ret; + + if ((ret = ff_get_buffer(avctx, avframe, 0)) < 0) + return ret; memcpy(avframe->data[0], framewithpts->frame->components[0].data, diff --git a/libavcodec/libspeexdec.c b/libavcodec/libspeexdec.c index 1544647691..7c1ffa6f67 100644 --- a/libavcodec/libspeexdec.c +++ b/libavcodec/libspeexdec.c @@ -118,10 +118,8 @@ static int libspeex_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = s->frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } output = (int16_t *)frame->data[0]; /* if there is not enough data left for the smallest possible frame or the diff --git a/libavcodec/libstagefright.cpp b/libavcodec/libstagefright.cpp index 4c270b0342..a6fd1b9890 100644 --- a/libavcodec/libstagefright.cpp +++ b/libavcodec/libstagefright.cpp @@ -187,7 +187,6 @@ void* decode_thread(void *arg) } ret = ff_get_buffer(avctx, frame->vframe); if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); frame->status = ret; decode_done = 1; buffer->release(); diff --git a/libavcodec/libvorbisdec.c b/libavcodec/libvorbisdec.c index e54e4b32d9..c4142cd959 100644 --- a/libavcodec/libvorbisdec.c +++ b/libavcodec/libvorbisdec.c @@ -143,10 +143,8 @@ static int oggvorbis_decode_frame(AVCodecContext *avccontext, void *data, } frame->nb_samples = 8192*4; - if ((ret = ff_get_buffer(avccontext, frame, 0)) < 0) { - av_log(avccontext, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avccontext, frame, 0)) < 0) return ret; - } output = (int16_t *)frame->data[0]; diff --git a/libavcodec/loco.c b/libavcodec/loco.c index 5019e7ad6c..a77fd83cd5 100644 --- a/libavcodec/loco.c +++ b/libavcodec/loco.c @@ -178,10 +178,8 @@ static int decode_frame(AVCodecContext *avctx, AVFrame * const p = data; int decoded, ret; - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->key_frame = 1; #define ADVANCE_BY_DECODED do { \ diff --git a/libavcodec/mace.c b/libavcodec/mace.c index 4ac1af8d6c..94bf2e7ef8 100644 --- a/libavcodec/mace.c +++ b/libavcodec/mace.c @@ -246,10 +246,8 @@ static int mace_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 3 * (buf_size << (1 - is_mace3)) / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t **)frame->extended_data; for(i = 0; i < avctx->channels; i++) { diff --git a/libavcodec/mdec.c b/libavcodec/mdec.c index 561c2edd5d..8fb29ce1eb 100644 --- a/libavcodec/mdec.c +++ b/libavcodec/mdec.c @@ -165,10 +165,8 @@ static int decode_frame(AVCodecContext *avctx, ThreadFrame frame = { .f = data }; int i, ret; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } frame.f->pict_type = AV_PICTURE_TYPE_I; frame.f->key_frame = 1; diff --git a/libavcodec/mimic.c b/libavcodec/mimic.c index 7ecdbc0205..335d58be13 100644 --- a/libavcodec/mimic.c +++ b/libavcodec/mimic.c @@ -405,10 +405,8 @@ static int mimic_decode_frame(AVCodecContext *avctx, void *data, ctx->frames[ctx->cur_index].f->pict_type = is_pframe ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I; if ((res = ff_thread_get_buffer(avctx, &ctx->frames[ctx->cur_index], - AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + AV_GET_BUFFER_FLAG_REF)) < 0) return res; - } ctx->next_prev_index = ctx->cur_index; ctx->next_cur_index = (ctx->cur_index - 1) & 15; diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c index 7a4c78c22b..b7d4cf5995 100644 --- a/libavcodec/mjpegdec.c +++ b/libavcodec/mjpegdec.c @@ -443,10 +443,8 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s) } av_frame_unref(s->picture_ptr); - if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_get_buffer(s->avctx, s->picture_ptr, AV_GET_BUFFER_FLAG_REF) < 0) return -1; - } s->picture_ptr->pict_type = AV_PICTURE_TYPE_I; s->picture_ptr->key_frame = 1; s->got_picture = 1; diff --git a/libavcodec/mlpdec.c b/libavcodec/mlpdec.c index 5473318451..214ea4570d 100644 --- a/libavcodec/mlpdec.c +++ b/libavcodec/mlpdec.c @@ -1023,10 +1023,8 @@ static int output_data(MLPDecodeContext *m, unsigned int substr, /* get output buffer */ frame->nb_samples = s->blockpos; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } data_32 = (int32_t *)frame->data[0]; data_16 = (int16_t *)frame->data[0]; diff --git a/libavcodec/mmvideo.c b/libavcodec/mmvideo.c index d242b4bb12..bf47f6527c 100644 --- a/libavcodec/mmvideo.c +++ b/libavcodec/mmvideo.c @@ -188,10 +188,8 @@ static int mm_decode_frame(AVCodecContext *avctx, buf_size -= MM_PREAMBLE_SIZE; bytestream2_init(&s->gb, buf, buf_size); - if ((res = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((res = ff_reget_buffer(avctx, &s->frame)) < 0) return res; - } switch(type) { case MM_TYPE_PALETTE : res = mm_decode_pal(s); return avpkt->size; diff --git a/libavcodec/motionpixels.c b/libavcodec/motionpixels.c index 1d5624500b..00c11482c9 100644 --- a/libavcodec/motionpixels.c +++ b/libavcodec/motionpixels.c @@ -265,10 +265,8 @@ static int mp_decode_frame(AVCodecContext *avctx, GetBitContext gb; int i, count1, count2, sz, ret; - if ((ret = ff_reget_buffer(avctx, &mp->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &mp->frame)) < 0) return ret; - } /* le32 bitstream msb first */ av_fast_malloc(&mp->bswapbuf, &mp->bswapbuf_size, buf_size + FF_INPUT_BUFFER_PADDING_SIZE); diff --git a/libavcodec/mpc7.c b/libavcodec/mpc7.c index 26969b1c5e..db37f5f9e8 100644 --- a/libavcodec/mpc7.c +++ b/libavcodec/mpc7.c @@ -225,10 +225,8 @@ static int mpc7_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ frame->nb_samples = MPC_FRAME_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } av_fast_padded_malloc(&c->bits, &c->buf_size, buf_size); if (!c->bits) diff --git a/libavcodec/mpc8.c b/libavcodec/mpc8.c index c7cf7fb462..a05a72b35d 100644 --- a/libavcodec/mpc8.c +++ b/libavcodec/mpc8.c @@ -254,10 +254,8 @@ static int mpc8_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ frame->nb_samples = MPC_FRAME_SIZE; - if ((res = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((res = ff_get_buffer(avctx, frame, 0)) < 0) return res; - } keyframe = c->cur_frame == 0; diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c index 763244d9c8..f7fdeb5334 100644 --- a/libavcodec/mpegaudiodec.c +++ b/libavcodec/mpegaudiodec.c @@ -1628,10 +1628,8 @@ static int mp_decode_frame(MPADecodeContext *s, OUT_INT **samples, if (!samples) { av_assert0(s->frame != NULL); s->frame->nb_samples = s->avctx->frame_size; - if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) return ret; - } samples = (OUT_INT **)s->frame->extended_data; } @@ -1935,10 +1933,8 @@ static int decode_frame_mp3on4(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = MPA_FRAME_SIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } out_samples = (OUT_INT **)frame->extended_data; // Discard too short frames diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index ba38daad2f..674e586ac2 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -92,10 +92,8 @@ static int msrle_decode_frame(AVCodecContext *avctx, s->buf = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } if (avctx->bits_per_coded_sample > 1 && avctx->bits_per_coded_sample <= 8) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); diff --git a/libavcodec/mss1.c b/libavcodec/mss1.c index 195f242525..bb1858dbb8 100644 --- a/libavcodec/mss1.c +++ b/libavcodec/mss1.c @@ -151,10 +151,8 @@ static int mss1_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, init_get_bits(&gb, buf, buf_size * 8); arith_init(&acoder, &gb); - if ((ret = ff_reget_buffer(avctx, &ctx->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &ctx->pic)) < 0) return ret; - } c->pal_pic = ctx->pic.data[0] + ctx->pic.linesize[0] * (avctx->height - 1); c->pal_stride = -ctx->pic.linesize[0]; diff --git a/libavcodec/mss2.c b/libavcodec/mss2.c index 7f10f9fe42..c4323468c6 100644 --- a/libavcodec/mss2.c +++ b/libavcodec/mss2.c @@ -598,10 +598,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (c->mvX < 0 || c->mvY < 0) { FFSWAP(uint8_t *, c->pal_pic, c->last_pal_pic); - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } if (ctx->last_pic.data[0]) { av_assert0(frame->linesize[0] == ctx->last_pic.linesize[0]); @@ -612,10 +610,8 @@ static int mss2_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } } else { - if ((ret = ff_reget_buffer(avctx, &ctx->last_pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &ctx->last_pic)) < 0) return ret; - } if ((ret = av_frame_ref(frame, &ctx->last_pic)) < 0) return ret; diff --git a/libavcodec/mss3.c b/libavcodec/mss3.c index 089b722e48..3cc484f7b7 100644 --- a/libavcodec/mss3.c +++ b/libavcodec/mss3.c @@ -731,10 +731,8 @@ static int mss3_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return buf_size; c->got_error = 0; - if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) return ret; - } c->pic.key_frame = keyframe; c->pic.pict_type = keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; if (!bytestream2_get_bytes_left(&gb)) { diff --git a/libavcodec/mss4.c b/libavcodec/mss4.c index 526c4c0522..391805fa4e 100644 --- a/libavcodec/mss4.c +++ b/libavcodec/mss4.c @@ -554,10 +554,8 @@ static int mss4_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) return ret; - } c->pic.key_frame = (frame_type == INTRA_FRAME); c->pic.pict_type = (frame_type == INTRA_FRAME) ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; diff --git a/libavcodec/msvideo1.c b/libavcodec/msvideo1.c index afaa7ae89f..c5a1daae81 100644 --- a/libavcodec/msvideo1.c +++ b/libavcodec/msvideo1.c @@ -298,10 +298,8 @@ static int msvideo1_decode_frame(AVCodecContext *avctx, s->buf = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } if (s->mode_8bit) { const uint8_t *pal = av_packet_get_side_data(avpkt, AV_PKT_DATA_PALETTE, NULL); diff --git a/libavcodec/mvcdec.c b/libavcodec/mvcdec.c index 7848d32efd..54e975717f 100644 --- a/libavcodec/mvcdec.c +++ b/libavcodec/mvcdec.c @@ -230,11 +230,8 @@ static int mvc_decode_frame(AVCodecContext *avctx, GetByteContext gb; int ret; - ret = ff_reget_buffer(avctx, s->frame); - if (ret < 0) { - av_log (avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) + return ret; bytestream2_init(&gb, avpkt->data, avpkt->size); if (avctx->codec_id == AV_CODEC_ID_MVC1) diff --git a/libavcodec/mxpegdec.c b/libavcodec/mxpegdec.c index 5b72d42447..0069ca5885 100644 --- a/libavcodec/mxpegdec.c +++ b/libavcodec/mxpegdec.c @@ -248,11 +248,9 @@ static int mxpeg_decode_frame(AVCodecContext *avctx, } /* use stored SOF data to allocate current picture */ av_frame_unref(jpg->picture_ptr); - if (ff_get_buffer(avctx, jpg->picture_ptr, - AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, jpg->picture_ptr, + AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; jpg->picture_ptr->pict_type = AV_PICTURE_TYPE_P; jpg->picture_ptr->key_frame = 0; jpg->got_picture = 1; @@ -268,11 +266,9 @@ static int mxpeg_decode_frame(AVCodecContext *avctx, /* allocate dummy reference picture if needed */ if (!reference_ptr->data[0] && - ff_get_buffer(avctx, reference_ptr, - AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return AVERROR(ENOMEM); - } + (ret = ff_get_buffer(avctx, reference_ptr, + AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; ret = ff_mjpeg_decode_sos(jpg, s->mxm_bitmask, reference_ptr); if (ret < 0 && (avctx->err_recognition & AV_EF_EXPLODE)) diff --git a/libavcodec/nellymoserdec.c b/libavcodec/nellymoserdec.c index 2e1cb978a4..42110a2c0f 100644 --- a/libavcodec/nellymoserdec.c +++ b/libavcodec/nellymoserdec.c @@ -171,10 +171,8 @@ static int decode_tag(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = NELLY_SAMPLES * blocks; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples_flt = (float *)frame->data[0]; for (i=0 ; ipic); - if (result < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((result = ff_reget_buffer(avctx, &c->pic)) < 0) return result; - } if (init_frame) { memset(c->pic.data[0], 0, avctx->height * c->pic.linesize[0]); memset(c->pic.data[1], 0x80, avctx->height * c->pic.linesize[1] / 2); diff --git a/libavcodec/pcm-mpeg.c b/libavcodec/pcm-mpeg.c index 6743b1c6e6..aec056aa55 100644 --- a/libavcodec/pcm-mpeg.c +++ b/libavcodec/pcm-mpeg.c @@ -153,10 +153,8 @@ static int pcm_bluray_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = samples; - if ((retval = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((retval = ff_get_buffer(avctx, frame, 0)) < 0) return retval; - } dst16 = (int16_t *)frame->data[0]; dst32 = (int32_t *)frame->data[0]; diff --git a/libavcodec/pcm.c b/libavcodec/pcm.c index 2cc14c1a4c..83482dd737 100644 --- a/libavcodec/pcm.c +++ b/libavcodec/pcm.c @@ -356,10 +356,8 @@ static int pcm_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = n * samples_per_block / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = frame->data[0]; switch (avctx->codec_id) { diff --git a/libavcodec/pcx.c b/libavcodec/pcx.c index 9e94e4bf3e..ba9233257a 100644 --- a/libavcodec/pcx.c +++ b/libavcodec/pcx.c @@ -131,10 +131,8 @@ static int pcx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 8d7c009a7d..8e6da75e41 100644 --- a/libavcodec/pictordec.c +++ b/libavcodec/pictordec.c @@ -146,10 +146,8 @@ static int decode_frame(AVCodecContext *avctx, avcodec_set_dimensions(avctx, s->width, s->height); } - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } memset(frame->data[0], 0, s->height * frame->linesize[0]); frame->pict_type = AV_PICTURE_TYPE_I; frame->palette_has_changed = 1; diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 564baaf831..086f3b414e 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -637,10 +637,8 @@ static int decode_frame(AVCodecContext *avctx, goto fail; } - if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) goto fail; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; p->interlaced_frame = !!s->interlace_type; diff --git a/libavcodec/pnmdec.c b/libavcodec/pnmdec.c index a34acf812d..d0c72954aa 100644 --- a/libavcodec/pnmdec.c +++ b/libavcodec/pnmdec.c @@ -43,10 +43,8 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data, if ((ret = ff_pnm_decode_header(avctx, s)) < 0) return ret; - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/pthread.c b/libavcodec/pthread.c index d4997e9c47..799644ff43 100644 --- a/libavcodec/pthread.c +++ b/libavcodec/pthread.c @@ -940,7 +940,7 @@ int ff_thread_can_start_frame(AVCodecContext *avctx) return 1; } -int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) +static int thread_get_buffer_internal(AVCodecContext *avctx, ThreadFrame *f, int flags) { PerThreadContext *p = avctx->thread_opaque; int err; @@ -1004,6 +1004,14 @@ int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) return err; } +int ff_thread_get_buffer(AVCodecContext *avctx, ThreadFrame *f, int flags) +{ + int ret = thread_get_buffer_internal(avctx, f, flags); + if (ret < 0) + av_log(avctx, AV_LOG_ERROR, "thread_get_buffer() failed\n"); + return ret; +} + void ff_thread_release_buffer(AVCodecContext *avctx, ThreadFrame *f) { PerThreadContext *p = avctx->thread_opaque; diff --git a/libavcodec/ptx.c b/libavcodec/ptx.c index 93bb57d40d..740186bee7 100644 --- a/libavcodec/ptx.c +++ b/libavcodec/ptx.c @@ -59,10 +59,8 @@ static int ptx_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/qcelpdec.c b/libavcodec/qcelpdec.c index 3f482a91bf..ab95f2d2a9 100644 --- a/libavcodec/qcelpdec.c +++ b/libavcodec/qcelpdec.c @@ -695,10 +695,8 @@ static int qcelp_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 160; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } outbuffer = (float *)frame->data[0]; if ((q->bitrate = determine_bitrate(avctx, buf_size, &buf)) == I_F_Q) { diff --git a/libavcodec/qdm2.c b/libavcodec/qdm2.c index 6e313b41fc..977528e295 100644 --- a/libavcodec/qdm2.c +++ b/libavcodec/qdm2.c @@ -1985,10 +1985,8 @@ static int qdm2_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = 16 * s->frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } out = (int16_t *)frame->data[0]; for (i = 0; i < 16; i++) { diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 96962dd2e6..69700999fb 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -43,10 +43,8 @@ static int decode_frame(AVCodecContext *avctx, uint32_t *pal; int r, g, b; - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/qpeg.c b/libavcodec/qpeg.c index 193e8c6a42..6015b7f4b0 100644 --- a/libavcodec/qpeg.c +++ b/libavcodec/qpeg.c @@ -271,10 +271,8 @@ static int decode_frame(AVCodecContext *avctx, av_frame_unref(ref); av_frame_move_ref(ref, p); - if ((ret = ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } outdata = a->pic.data[0]; bytestream2_skip(&a->buffer, 4); bytestream2_get_buffer(&a->buffer, ctable, 128); diff --git a/libavcodec/qtrle.c b/libavcodec/qtrle.c index 60b2029413..c043249b04 100644 --- a/libavcodec/qtrle.c +++ b/libavcodec/qtrle.c @@ -412,10 +412,8 @@ static int qtrle_decode_frame(AVCodecContext *avctx, int ret; bytestream2_init(&s->g, avpkt->data, avpkt->size); - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log (s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } /* check if this frame is even supposed to change */ if (avpkt->size < 8) diff --git a/libavcodec/ra144dec.c b/libavcodec/ra144dec.c index abaf52d449..5531fd21c9 100644 --- a/libavcodec/ra144dec.c +++ b/libavcodec/ra144dec.c @@ -85,10 +85,8 @@ static int ra144_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ frame->nb_samples = NBLOCKS * BLOCKSIZE; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; init_get_bits(&gb, buf, FRAMESIZE * 8); diff --git a/libavcodec/ra288.c b/libavcodec/ra288.c index 57602f1050..7269783345 100644 --- a/libavcodec/ra288.c +++ b/libavcodec/ra288.c @@ -198,10 +198,8 @@ static int ra288_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ frame->nb_samples = RA288_BLOCK_SIZE * RA288_BLOCKS_PER_FRAME; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } out = (float *)frame->data[0]; init_get_bits(&gb, buf, avctx->block_align * 8); diff --git a/libavcodec/ralf.c b/libavcodec/ralf.c index 91c984f083..041861d1ea 100644 --- a/libavcodec/ralf.c +++ b/libavcodec/ralf.c @@ -460,10 +460,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame_ptr, } frame->nb_samples = ctx->max_frame_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "Me fail get_buffer()? That's unpossible!\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples0 = (int16_t *)frame->data[0]; samples1 = (int16_t *)frame->data[1]; diff --git a/libavcodec/rl2.c b/libavcodec/rl2.c index 5a8064b72b..c8853de22e 100644 --- a/libavcodec/rl2.c +++ b/libavcodec/rl2.c @@ -181,10 +181,8 @@ static int rl2_decode_frame(AVCodecContext *avctx, int ret, buf_size = avpkt->size; Rl2Context *s = avctx->priv_data; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } /** run length decode */ rl2_rle_decode(s, buf, buf_size, frame->data[0], frame->linesize[0], diff --git a/libavcodec/roqvideodec.c b/libavcodec/roqvideodec.c index 2309b0b857..85fdab7edb 100644 --- a/libavcodec/roqvideodec.c +++ b/libavcodec/roqvideodec.c @@ -204,10 +204,8 @@ static int roq_decode_frame(AVCodecContext *avctx, int copy= !s->current_frame->data[0]; int ret; - if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->current_frame)) < 0) return ret; - } if(copy) av_picture_copy((AVPicture*)s->current_frame, (AVPicture*)s->last_frame, diff --git a/libavcodec/roqvideoenc.c b/libavcodec/roqvideoenc.c index 187b848bac..a652c47c64 100644 --- a/libavcodec/roqvideoenc.c +++ b/libavcodec/roqvideoenc.c @@ -1051,11 +1051,9 @@ static int roq_encode_frame(AVCodecContext *avctx, AVPacket *pkt, if (enc->first_frame) { /* Alloc memory for the reconstruction data (we must know the stride for that) */ - if (ff_get_buffer(avctx, enc->current_frame, 0) || - ff_get_buffer(avctx, enc->last_frame, 0)) { - av_log(avctx, AV_LOG_ERROR, " RoQ: get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, enc->current_frame, 0)) < 0 || + (ret = ff_get_buffer(avctx, enc->last_frame, 0)) < 0) + return ret; /* Before the first video frame, write a "video info" chunk */ roq_write_video_info_chunk(enc); diff --git a/libavcodec/rpza.c b/libavcodec/rpza.c index cce5b0d07d..2aa0091d32 100644 --- a/libavcodec/rpza.c +++ b/libavcodec/rpza.c @@ -256,10 +256,8 @@ static int rpza_decode_frame(AVCodecContext *avctx, s->buf = buf; s->size = buf_size; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } rpza_decode_stream(s); diff --git a/libavcodec/s302m.c b/libavcodec/s302m.c index e61bbe7963..5f73148f77 100644 --- a/libavcodec/s302m.c +++ b/libavcodec/s302m.c @@ -106,10 +106,8 @@ static int s302m_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ block_size = (avctx->bits_per_coded_sample + 4) / 4; frame->nb_samples = 2 * (buf_size / block_size) / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } buf_size = (frame->nb_samples * avctx->channels / 2) * block_size; diff --git a/libavcodec/sanm.c b/libavcodec/sanm.c index 826873088a..66ff52257f 100644 --- a/libavcodec/sanm.c +++ b/libavcodec/sanm.c @@ -1144,10 +1144,8 @@ static int copy_output(SANMVideoContext *ctx, SANMFrameHeader *hdr) int ret, dstpitch, height = ctx->height; int srcpitch = ctx->pitch * (hdr ? sizeof(ctx->frm0[0]) : 1); - if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0) { - av_log(ctx->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(ctx->avctx, ctx->frame, 0)) < 0) return ret; - } dst = ctx->frame->data[0]; dstpitch = ctx->frame->linesize[0]; diff --git a/libavcodec/sgidec.c b/libavcodec/sgidec.c index 4b98daf4f4..e7f453bc17 100644 --- a/libavcodec/sgidec.c +++ b/libavcodec/sgidec.c @@ -205,10 +205,8 @@ static int decode_frame(AVCodecContext *avctx, return -1; avcodec_set_dimensions(avctx, s->width, s->height); - if (ff_get_buffer(avctx, p, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed.\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) + return ret; p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/sgirledec.c b/libavcodec/sgirledec.c index 59f8e3150c..d49a957b8a 100644 --- a/libavcodec/sgirledec.c +++ b/libavcodec/sgirledec.c @@ -115,11 +115,8 @@ static int sgirle_decode_frame(AVCodecContext *avctx, SGIRLEContext *s = avctx->priv_data; int ret; - ret = ff_reget_buffer(avctx, s->frame); - if (ret < 0) { - av_log (avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, s->frame)) < 0) return ret; - } ret = decode_sgirle8(avctx, s->frame->data[0], avpkt->data, avpkt->size, avctx->width, avctx->height, s->frame->linesize[0]); if (ret < 0) diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c index c84a57cdd6..1d3b6eb1bb 100644 --- a/libavcodec/shorten.c +++ b/libavcodec/shorten.c @@ -596,10 +596,8 @@ static int shorten_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = s->blocksize; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } for (chan = 0; chan < s->channels; chan++) { samples_u8 = ((uint8_t **)frame->extended_data)[chan]; diff --git a/libavcodec/sipr.c b/libavcodec/sipr.c index 41c119795c..35e8bf5ea5 100644 --- a/libavcodec/sipr.c +++ b/libavcodec/sipr.c @@ -543,10 +543,8 @@ static int sipr_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = mode_par->frames_per_packet * subframe_size * mode_par->subframe_count; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (float *)frame->data[0]; init_get_bits(&gb, buf, mode_par->bits_per_frame); diff --git a/libavcodec/smacker.c b/libavcodec/smacker.c index 3530033f44..c070150f7d 100644 --- a/libavcodec/smacker.c +++ b/libavcodec/smacker.c @@ -381,10 +381,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, if (avpkt->size <= 769) return AVERROR_INVALIDDATA; - if ((ret = ff_reget_buffer(avctx, &smk->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &smk->pic)) < 0) return ret; - } /* make the palette available on the way out */ pal = (uint32_t*)smk->pic.data[1]; @@ -634,10 +632,8 @@ static int smka_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = unp_size / (avctx->channels * (bits + 1)); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; samples8 = frame->data[0]; diff --git a/libavcodec/smc.c b/libavcodec/smc.c index 52dce53679..bb00c69aec 100644 --- a/libavcodec/smc.c +++ b/libavcodec/smc.c @@ -434,10 +434,8 @@ static int smc_decode_frame(AVCodecContext *avctx, bytestream2_init(&s->gb, buf, buf_size); - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } if (pal) { s->frame.palette_has_changed = 1; diff --git a/libavcodec/snow.c b/libavcodec/snow.c index eea729716e..de19687a97 100644 --- a/libavcodec/snow.c +++ b/libavcodec/snow.c @@ -477,10 +477,9 @@ int ff_snow_common_init_after_header(AVCodecContext *avctx) { int ret, emu_buf_size; if(!s->scratchbuf) { - if ((ret = ff_get_buffer(s->avctx, &s->mconly_picture, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(s->avctx, &s->mconly_picture, + AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } FF_ALLOCZ_OR_GOTO(avctx, s->scratchbuf, FFMAX(s->mconly_picture.linesize[0], 2*avctx->width+256)*7*MB_SIZE, fail); emu_buf_size = FFMAX(s->mconly_picture.linesize[0], 2*avctx->width+256) * (2 * MB_SIZE + HTAPS_MAX - 1); FF_ALLOC_OR_GOTO(avctx, s->emu_edge_buffer, emu_buf_size, fail); @@ -601,7 +600,7 @@ void ff_snow_release_buffer(AVCodecContext *avctx) int ff_snow_frame_start(SnowContext *s){ AVFrame tmp; - int i; + int i, ret; int w= s->avctx->width; //FIXME round up to x16 ? int h= s->avctx->height; @@ -642,10 +641,8 @@ int ff_snow_frame_start(SnowContext *s){ } } - if(ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF) < 0){ - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(s->avctx, &s->current_picture, AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; s->current_picture.key_frame= s->keyframe; diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c index 7f11ca74d6..fe9f01f0be 100644 --- a/libavcodec/sonic.c +++ b/libavcodec/sonic.c @@ -877,10 +877,8 @@ static int sonic_decode_frame(AVCodecContext *avctx, if (buf_size == 0) return 0; s->frame.nb_samples = s->frame_size; - if ((ret = ff_get_buffer(avctx, &s->frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, &s->frame, 0)) < 0) return ret; - } samples = (int16_t *)s->frame.data[0]; // av_log(NULL, AV_LOG_INFO, "buf_size: %d\n", buf_size); diff --git a/libavcodec/sunrast.c b/libavcodec/sunrast.c index 533ff62367..6ea8fbccbc 100644 --- a/libavcodec/sunrast.c +++ b/libavcodec/sunrast.c @@ -102,10 +102,8 @@ static int sunrast_decode_frame(AVCodecContext *avctx, void *data, if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/targa.c b/libavcodec/targa.c index 9601a27a0b..ff4390f675 100644 --- a/libavcodec/targa.c +++ b/libavcodec/targa.c @@ -177,10 +177,8 @@ static int decode_frame(AVCodecContext *avctx, return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } if (flags & TGA_TOPTOBOTTOM) { dst = p->data[0]; diff --git a/libavcodec/targa_y216dec.c b/libavcodec/targa_y216dec.c index 67d19a1181..38694ce39e 100644 --- a/libavcodec/targa_y216dec.c +++ b/libavcodec/targa_y216dec.c @@ -36,17 +36,15 @@ static int y216_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pic = data; const uint16_t *src = (uint16_t *)avpkt->data; uint16_t *y, *u, *v, aligned_width = FFALIGN(avctx->width, 4); - int i, j; + int i, j, ret; if (avpkt->size < 4 * avctx->height * aligned_width) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/tiertexseqv.c b/libavcodec/tiertexseqv.c index 1c7e2e0acf..f892e4dac9 100644 --- a/libavcodec/tiertexseqv.c +++ b/libavcodec/tiertexseqv.c @@ -232,10 +232,8 @@ static int seqvideo_decode_frame(AVCodecContext *avctx, SeqVideoContext *seq = avctx->priv_data; - if ((ret = ff_reget_buffer(avctx, &seq->frame)) < 0) { - av_log(seq->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &seq->frame)) < 0) return ret; - } if (seqvideo_decode(seq, buf, buf_size)) return AVERROR_INVALIDDATA; diff --git a/libavcodec/tiff.c b/libavcodec/tiff.c index b749a6be25..6c5f49c30c 100644 --- a/libavcodec/tiff.c +++ b/libavcodec/tiff.c @@ -642,10 +642,8 @@ static int init_image(TiffContext *s, AVFrame *frame) return ret; avcodec_set_dimensions(s->avctx, s->width, s->height); } - if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(s->avctx, frame, 0)) < 0) return ret; - } if (s->avctx->pix_fmt == AV_PIX_FMT_PAL8) { if (s->palette_is_set) { memcpy(frame->data[1], s->palette, sizeof(s->palette)); diff --git a/libavcodec/tmv.c b/libavcodec/tmv.c index 2e6a22badf..279298c2b3 100644 --- a/libavcodec/tmv.c +++ b/libavcodec/tmv.c @@ -46,10 +46,8 @@ static int tmv_decode_frame(AVCodecContext *avctx, void *data, unsigned x, y, fg, bg, c; int ret; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (avpkt->size < 2*char_rows*char_cols) { av_log(avctx, AV_LOG_ERROR, diff --git a/libavcodec/truemotion1.c b/libavcodec/truemotion1.c index a98897fb7f..35fb2a3bc3 100644 --- a/libavcodec/truemotion1.c +++ b/libavcodec/truemotion1.c @@ -868,10 +868,8 @@ static int truemotion1_decode_frame(AVCodecContext *avctx, if ((ret = truemotion1_decode_header(s)) < 0) return ret; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } if (compression_types[s->compression].algorithm == ALGO_RGB24H) { truemotion1_decode_24bit(s); diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c index 6918a17e16..13b972320c 100644 --- a/libavcodec/truemotion2.c +++ b/libavcodec/truemotion2.c @@ -868,10 +868,8 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR(ENOMEM); } - if ((ret = ff_reget_buffer(avctx, p)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, p)) < 0) return ret; - } l->dsp.bswap_buf((uint32_t*)l->buffer, (const uint32_t*)buf, buf_size >> 2); diff --git a/libavcodec/truespeech.c b/libavcodec/truespeech.c index 67d77fd310..3ed4dec177 100644 --- a/libavcodec/truespeech.c +++ b/libavcodec/truespeech.c @@ -325,10 +325,8 @@ static int truespeech_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = iterations * 240; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (int16_t *)frame->data[0]; memset(samples, 0, iterations * 240 * sizeof(*samples)); diff --git a/libavcodec/tscc.c b/libavcodec/tscc.c index d9072410b6..6e1e077471 100644 --- a/libavcodec/tscc.c +++ b/libavcodec/tscc.c @@ -73,10 +73,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int zret; // Zlib return code int ret, len = buf_size; - if ((ret = ff_reget_buffer(avctx, frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, frame)) < 0) return ret; - } zret = inflateReset(&c->zstream); if (zret != Z_OK) { diff --git a/libavcodec/tscc2.c b/libavcodec/tscc2.c index f87ab406f2..f275ff9d8d 100644 --- a/libavcodec/tscc2.c +++ b/libavcodec/tscc2.c @@ -230,10 +230,8 @@ static int tscc2_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) return ret; - } if (frame_type == 0) { *got_frame = 1; diff --git a/libavcodec/tta.c b/libavcodec/tta.c index 0d1075098b..8b4ca5acfb 100644 --- a/libavcodec/tta.c +++ b/libavcodec/tta.c @@ -334,10 +334,8 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = framelen; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } // decode directly to output buffer for 24-bit sample format if (s->bps == 3) diff --git a/libavcodec/twinvq.c b/libavcodec/twinvq.c index 8cd6ccf23e..8b9c79f655 100644 --- a/libavcodec/twinvq.c +++ b/libavcodec/twinvq.c @@ -832,10 +832,8 @@ static int twin_decode_frame(AVCodecContext * avctx, void *data, /* get output buffer */ if (tctx->discarded_packets >= 2) { frame->nb_samples = mtab->size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } out = (float **)frame->extended_data; } diff --git a/libavcodec/txd.c b/libavcodec/txd.c index a51d766aee..e8d483f0ee 100644 --- a/libavcodec/txd.c +++ b/libavcodec/txd.c @@ -67,10 +67,8 @@ static int txd_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/ulti.c b/libavcodec/ulti.c index 84337c645f..2120d97aae 100644 --- a/libavcodec/ulti.c +++ b/libavcodec/ulti.c @@ -227,10 +227,8 @@ static int ulti_decode_frame(AVCodecContext *avctx, int skip; int tmp; - if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; - } bytestream2_init(&s->gb, buf, buf_size); diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 4ed64c967e..3a2c82803a 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -681,7 +681,7 @@ static void compat_release_buffer(void *opaque, uint8_t *data) } #endif -int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +static int get_buffer_internal(AVCodecContext *avctx, AVFrame *frame, int flags) { int ret; @@ -804,7 +804,15 @@ fail: return avctx->get_buffer2(avctx, frame, flags); } -int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) +int ff_get_buffer(AVCodecContext *avctx, AVFrame *frame, int flags) +{ + int ret = get_buffer_internal(avctx, frame, flags); + if (ret < 0) + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; +} + +static int reget_buffer_internal(AVCodecContext *avctx, AVFrame *frame) { AVFrame tmp; int ret; @@ -841,6 +849,14 @@ int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) return 0; } +int ff_reget_buffer(AVCodecContext *avctx, AVFrame *frame) +{ + int ret = reget_buffer_internal(avctx, frame); + if (ret < 0) + av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + return ret; +} + #if FF_API_GET_BUFFER void avcodec_default_release_buffer(AVCodecContext *s, AVFrame *pic) { diff --git a/libavcodec/utvideodec.c b/libavcodec/utvideodec.c index 1bb2eb5b2f..c098e44913 100644 --- a/libavcodec/utvideodec.c +++ b/libavcodec/utvideodec.c @@ -333,10 +333,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, GetByteContext gb; ThreadFrame frame = { .f = data }; - if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0) return ret; - } /* parse plane structure to get frame flags and validate slice offsets */ bytestream2_init(&gb, buf, buf_size); diff --git a/libavcodec/v308dec.c b/libavcodec/v308dec.c index a85d655eb9..cddc7799ea 100644 --- a/libavcodec/v308dec.c +++ b/libavcodec/v308dec.c @@ -38,17 +38,15 @@ static int v308_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pic = data; const uint8_t *src = avpkt->data; uint8_t *y, *u, *v; - int i, j; + int i, j, ret; if (avpkt->size < 3 * avctx->height * avctx->width) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/v408dec.c b/libavcodec/v408dec.c index b295d4abdf..31c14dc3e1 100644 --- a/libavcodec/v408dec.c +++ b/libavcodec/v408dec.c @@ -35,17 +35,15 @@ static int v408_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pic = data; const uint8_t *src = avpkt->data; uint8_t *y, *u, *v, *a; - int i, j; + int i, j, ret; if (avpkt->size < 4 * avctx->height * avctx->width) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/v410dec.c b/libavcodec/v410dec.c index 9e125443d9..f8229e20f3 100644 --- a/libavcodec/v410dec.c +++ b/libavcodec/v410dec.c @@ -49,17 +49,15 @@ static int v410_decode_frame(AVCodecContext *avctx, void *data, uint8_t *src = avpkt->data; uint16_t *y, *u, *v; uint32_t val; - int i, j; + int i, j, ret; if (avpkt->size < 4 * avctx->height * avctx->width) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/vb.c b/libavcodec/vb.c index ebb06f522f..29cd10432d 100644 --- a/libavcodec/vb.c +++ b/libavcodec/vb.c @@ -197,10 +197,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, bytestream2_init(&c->stream, avpkt->data, avpkt->size); - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } flags = bytestream2_get_le16(&c->stream); diff --git a/libavcodec/vble.c b/libavcodec/vble.c index 76dfef8750..cbb2ffc54e 100644 --- a/libavcodec/vble.c +++ b/libavcodec/vble.c @@ -121,6 +121,7 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, int version; int offset = 0; int width_uv = avctx->width / 2, height_uv = avctx->height / 2; + int ret; if (avpkt->size < 4 || avpkt->size - 4 > INT_MAX/8) { av_log(avctx, AV_LOG_ERROR, "Invalid packet size\n"); @@ -128,10 +129,8 @@ static int vble_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } /* Allocate buffer */ - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; /* Set flags */ pic->key_frame = 1; diff --git a/libavcodec/vc1dec.c b/libavcodec/vc1dec.c index ebb13c351c..624dab3dd3 100644 --- a/libavcodec/vc1dec.c +++ b/libavcodec/vc1dec.c @@ -5021,6 +5021,7 @@ static void vc1_draw_sprites(VC1Context *v, SpriteData* sd) static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) { + int ret; MpegEncContext *s = &v->s; AVCodecContext *avctx = s->avctx; SpriteData sd; @@ -5038,10 +5039,8 @@ static int vc1_decode_sprites(VC1Context *v, GetBitContext* gb) } av_frame_unref(&v->sprite_output_frame); - if (ff_get_buffer(avctx, &v->sprite_output_frame, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; - } + if ((ret = ff_get_buffer(avctx, &v->sprite_output_frame, 0)) < 0) + return ret; vc1_draw_sprites(v, &sd); diff --git a/libavcodec/vcr1.c b/libavcodec/vcr1.c index 6ef7165c8d..e9c988e90a 100644 --- a/libavcodec/vcr1.c +++ b/libavcodec/vcr1.c @@ -59,10 +59,8 @@ static int vcr1_decode_frame(AVCodecContext *avctx, void *data, return AVERROR(EINVAL); } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/vima.c b/libavcodec/vima.c index 658c6ce700..705839e6b1 100644 --- a/libavcodec/vima.c +++ b/libavcodec/vima.c @@ -170,10 +170,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, } frame->nb_samples = samples; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } for (chan = 0; chan < channels; chan++) { uint16_t *dest = (uint16_t*)frame->data[0] + chan; diff --git a/libavcodec/vmdav.c b/libavcodec/vmdav.c index cef4796411..0e27ef6779 100644 --- a/libavcodec/vmdav.c +++ b/libavcodec/vmdav.c @@ -425,10 +425,8 @@ static int vmdvideo_decode_frame(AVCodecContext *avctx, if (buf_size < 16) return buf_size; - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } vmd_decode(s, frame); @@ -597,10 +595,8 @@ static int vmdaudio_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = ((silent_chunks + audio_chunks) * avctx->block_align) / avctx->channels; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } output_samples_u8 = frame->data[0]; output_samples_s16 = (int16_t *)frame->data[0]; diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c index 769b40a4b6..99571a1b76 100644 --- a/libavcodec/vmnc.c +++ b/libavcodec/vmnc.c @@ -296,10 +296,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, const uint8_t *src = buf; int dx, dy, w, h, depth, enc, chunks, res, size_left, ret; - if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) { - av_log(avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &c->pic)) < 0) return ret; - } c->pic.key_frame = 0; c->pic.pict_type = AV_PICTURE_TYPE_P; diff --git a/libavcodec/vorbisdec.c b/libavcodec/vorbisdec.c index a7c0da5557..f30745d7ae 100644 --- a/libavcodec/vorbisdec.c +++ b/libavcodec/vorbisdec.c @@ -1729,10 +1729,8 @@ static int vorbis_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = vc->blocksize[1] / 2; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (vc->audio_channels > 8) { for (i = 0; i < vc->audio_channels; i++) diff --git a/libavcodec/vp3.c b/libavcodec/vp3.c index f12b1b30bc..1e76786f37 100644 --- a/libavcodec/vp3.c +++ b/libavcodec/vp3.c @@ -2028,10 +2028,8 @@ static int vp3_decode_frame(AVCodecContext *avctx, s->current_frame.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; s->current_frame.f->key_frame = s->keyframe; - if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_thread_get_buffer(avctx, &s->current_frame, AV_GET_BUFFER_FLAG_REF) < 0) goto error; - } if (!s->edge_emu_buffer) s->edge_emu_buffer = av_malloc(9*FFABS(s->current_frame.f->linesize[0])); @@ -2059,10 +2057,8 @@ static int vp3_decode_frame(AVCodecContext *avctx, av_log(s->avctx, AV_LOG_WARNING, "vp3: first frame not a keyframe\n"); s->golden_frame.f->pict_type = AV_PICTURE_TYPE_I; - if (ff_thread_get_buffer(avctx, &s->golden_frame, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_thread_get_buffer(avctx, &s->golden_frame, AV_GET_BUFFER_FLAG_REF) < 0) goto error; - } ff_thread_release_buffer(avctx, &s->last_frame); if ((ret = ff_thread_ref_frame(&s->last_frame, &s->golden_frame)) < 0) goto error; diff --git a/libavcodec/vp56.c b/libavcodec/vp56.c index 83ba68c985..15691e04a1 100644 --- a/libavcodec/vp56.c +++ b/libavcodec/vp56.c @@ -524,10 +524,8 @@ int ff_vp56_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, } } - if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if (ff_get_buffer(avctx, p, AV_GET_BUFFER_FLAG_REF) < 0) return -1; - } if (s->has_alpha) { av_frame_unref(s->alpha_context->frames[VP56_FRAME_CURRENT]); diff --git a/libavcodec/vp8.c b/libavcodec/vp8.c index 9218dff234..7bd1cc9950 100644 --- a/libavcodec/vp8.c +++ b/libavcodec/vp8.c @@ -1909,10 +1909,8 @@ static int vp8_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, curframe->tf.f->key_frame = s->keyframe; curframe->tf.f->pict_type = s->keyframe ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P; - if ((ret = vp8_alloc_frame(s, curframe, referenced))) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed!\n"); + if ((ret = vp8_alloc_frame(s, curframe, referenced)) < 0) goto err; - } // check if golden and altref are swapped if (s->update_altref != VP56_FRAME_NONE) { diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c index 6510582cd6..a47e2db041 100644 --- a/libavcodec/vqavideo.c +++ b/libavcodec/vqavideo.c @@ -598,10 +598,8 @@ static int vqa_decode_frame(AVCodecContext *avctx, AVFrame *frame = data; int res; - if ((res = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((res = ff_get_buffer(avctx, frame, 0)) < 0) return res; - } bytestream2_init(&s->gb, avpkt->data, avpkt->size); if ((res = vqa_decode_chunk(s, frame)) < 0) diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c index c9a908f29a..b30b41414b 100644 --- a/libavcodec/wavpack.c +++ b/libavcodec/wavpack.c @@ -1216,10 +1216,8 @@ static int wavpack_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = s->samples + 1; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } frame->nb_samples = s->samples; while (buf_size > 0) { diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c index ae1a983ad8..0648c1e505 100644 --- a/libavcodec/wmadec.c +++ b/libavcodec/wmadec.c @@ -842,10 +842,8 @@ static int wma_decode_superframe(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = nb_frames * s->frame_len; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = (float **)frame->extended_data; samples_offset = 0; diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c index cccdbd0554..b38e0c0413 100644 --- a/libavcodec/wmalosslessdec.c +++ b/libavcodec/wmalosslessdec.c @@ -1017,8 +1017,6 @@ static int decode_frame(WmallDecodeCtx *s) s->frame.nb_samples = s->samples_per_frame; if ((ret = ff_get_buffer(s->avctx, &s->frame, 0)) < 0) { /* return an error if no frame could be decoded at all */ - av_log(s->avctx, AV_LOG_ERROR, - "not enough space for the output samples\n"); s->packet_loss = 1; return ret; } diff --git a/libavcodec/wmaprodec.c b/libavcodec/wmaprodec.c index d5af3eeb3f..ec12a10fc3 100644 --- a/libavcodec/wmaprodec.c +++ b/libavcodec/wmaprodec.c @@ -1379,7 +1379,6 @@ static int decode_frame(WMAProDecodeCtx *s, AVFrame *frame, int *got_frame_ptr) /* get output buffer */ frame->nb_samples = s->samples_per_frame; if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); s->packet_loss = 1; return 0; } diff --git a/libavcodec/wmavoice.c b/libavcodec/wmavoice.c index ecd5b4ae1d..970902b0d8 100644 --- a/libavcodec/wmavoice.c +++ b/libavcodec/wmavoice.c @@ -1799,10 +1799,8 @@ static int synth_superframe(AVCodecContext *ctx, AVFrame *frame, /* get output buffer */ frame->nb_samples = 480; - if ((res = ff_get_buffer(ctx, frame, 0)) < 0) { - av_log(ctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((res = ff_get_buffer(ctx, frame, 0)) < 0) return res; - } frame->nb_samples = n_samples; samples = (float *)frame->data[0]; diff --git a/libavcodec/wnv1.c b/libavcodec/wnv1.c index dd72938830..f7609af637 100644 --- a/libavcodec/wnv1.c +++ b/libavcodec/wnv1.c @@ -82,7 +82,6 @@ static int decode_frame(AVCodecContext *avctx, } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(rbuf); return ret; } diff --git a/libavcodec/ws-snd1.c b/libavcodec/ws-snd1.c index d4e866f4ef..d27df75ae7 100644 --- a/libavcodec/ws-snd1.c +++ b/libavcodec/ws-snd1.c @@ -81,10 +81,8 @@ static int ws_snd_decode_frame(AVCodecContext *avctx, void *data, /* get output buffer */ frame->nb_samples = out_size; - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } samples = frame->data[0]; samples_end = samples + out_size; diff --git a/libavcodec/xan.c b/libavcodec/xan.c index 3caa6c0069..2ee22910f1 100644 --- a/libavcodec/xan.c +++ b/libavcodec/xan.c @@ -587,10 +587,8 @@ static int xan_decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF))) { - av_log(s->avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, AV_GET_BUFFER_FLAG_REF)) < 0) return ret; - } if (!s->frame_size) s->frame_size = frame->linesize[0] * s->avctx->height; diff --git a/libavcodec/xl.c b/libavcodec/xl.c index d5d774d5fe..f50b6506fe 100644 --- a/libavcodec/xl.c +++ b/libavcodec/xl.c @@ -59,10 +59,8 @@ static int decode_frame(AVCodecContext *avctx, return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->pict_type = AV_PICTURE_TYPE_I; p->key_frame = 1; diff --git a/libavcodec/xwddec.c b/libavcodec/xwddec.c index 03f7f40a2c..c47c3eb71a 100644 --- a/libavcodec/xwddec.c +++ b/libavcodec/xwddec.c @@ -199,10 +199,8 @@ static int xwd_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_PATCHWELCOME; } - if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, p, 0)) < 0) return ret; - } p->key_frame = 1; p->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index 148b058e28..e2b1b8ccf0 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -392,10 +392,8 @@ static int xan_decode_frame(AVCodecContext *avctx, int ftype; int ret; - if ((ret = ff_reget_buffer(avctx, &s->pic))) { - av_log(s->avctx, AV_LOG_ERROR, "reget_buffer() failed\n"); + if ((ret = ff_reget_buffer(avctx, &s->pic)) < 0) return ret; - } bytestream2_init(&s->gb, avpkt->data, avpkt->size); ftype = bytestream2_get_le32(&s->gb); diff --git a/libavcodec/y41pdec.c b/libavcodec/y41pdec.c index e53fe16966..42449c63c4 100644 --- a/libavcodec/y41pdec.c +++ b/libavcodec/y41pdec.c @@ -41,17 +41,15 @@ static int y41p_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pic = data; uint8_t *src = avpkt->data; uint8_t *y, *u, *v; - int i, j; + int i, j, ret; if (avpkt->size < 1.5 * avctx->height * avctx->width) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/yop.c b/libavcodec/yop.c index 092e84caa8..e1f5321252 100644 --- a/libavcodec/yop.c +++ b/libavcodec/yop.c @@ -188,11 +188,8 @@ static int yop_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, return AVERROR_INVALIDDATA; } - ret = ff_get_buffer(avctx, frame, 0); - if (ret < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (!avctx->frame_number) memset(frame->data[1], 0, AVPALETTE_SIZE); diff --git a/libavcodec/yuv4dec.c b/libavcodec/yuv4dec.c index 95cacbe819..6965f3924f 100644 --- a/libavcodec/yuv4dec.c +++ b/libavcodec/yuv4dec.c @@ -36,17 +36,15 @@ static int yuv4_decode_frame(AVCodecContext *avctx, void *data, AVFrame *pic = data; const uint8_t *src = avpkt->data; uint8_t *y, *u, *v; - int i, j; + int i, j, ret; if (avpkt->size < 6 * (avctx->width + 1 >> 1) * (avctx->height + 1 >> 1)) { av_log(avctx, AV_LOG_ERROR, "Insufficient input data.\n"); return AVERROR(EINVAL); } - if (ff_get_buffer(avctx, pic, 0) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, 0)) < 0) + return ret; pic->key_frame = 1; pic->pict_type = AV_PICTURE_TYPE_I; diff --git a/libavcodec/zerocodec.c b/libavcodec/zerocodec.c index e503aa7689..4a23b67834 100644 --- a/libavcodec/zerocodec.c +++ b/libavcodec/zerocodec.c @@ -59,10 +59,8 @@ static int zerocodec_decode_frame(AVCodecContext *avctx, void *data, return AVERROR_INVALIDDATA; } - if (ff_get_buffer(avctx, pic, AV_GET_BUFFER_FLAG_REF) < 0) { - av_log(avctx, AV_LOG_ERROR, "Could not allocate buffer.\n"); - return AVERROR(ENOMEM); - } + if ((ret = ff_get_buffer(avctx, pic, AV_GET_BUFFER_FLAG_REF)) < 0) + return ret; zstream->next_in = avpkt->data; zstream->avail_in = avpkt->size; diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c index 38529335b2..446a4ea6a5 100644 --- a/libavcodec/zmbv.c +++ b/libavcodec/zmbv.c @@ -508,10 +508,8 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPac return AVERROR_INVALIDDATA; } - if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) { - av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + if ((ret = ff_get_buffer(avctx, frame, 0)) < 0) return ret; - } if (c->comp == 0) { //Uncompressed data if (c->decomp_size < len) {