[FFmpeg-devel] [PATCH] avcodec/dnxhdenc: return meaningful return codes
Timothy Gu
timothygu99 at gmail.com
Fri Jan 17 19:11:31 CET 2014
On Fri, Jan 17, 2014 at 8:28 AM, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Thu, Jan 16, 2014 at 08:23:58PM -0800, Timothy Gu wrote:
>> Also move error message to actual error function.
>>
>> Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
>
> [...]
>
>> @@ -819,8 +819,11 @@ static int dnxhd_find_qscale(DNXHDEncContext *ctx)
>> else
>> qscale += up_step++;
>> down_step = 1;
>> - if (qscale >= ctx->m.avctx->qmax)
>> - return -1;
>> + if (qscale >= ctx->m.avctx->qmax){
>> + av_log(avctx, AV_LOG_ERROR,
>> + "picture could not fit ratecontrol constraints, increase qmax\n");
>> + return AVERROR(EINVAL);
>> + }
>> }
>> }
>> //av_dlog(ctx->m.avctx, "out qscale %d\n", qscale);
>
> this fails compiling
Ooops. Will fix.
>
>
>
>> @@ -889,7 +892,7 @@ static int dnxhd_encode_fast(AVCodecContext *avctx, DNXHDEncContext *ctx)
>> int max_bits = 0;
>> int ret, x, y;
>> if ((ret = dnxhd_find_qscale(ctx)) < 0)
>> - return -1;
>> + return ret;
>> for (y = 0; y < ctx->m.mb_height; y++) {
>> for (x = 0; x < ctx->m.mb_width; x++) {
>> int mb = y*ctx->m.mb_width+x;
>
>> @@ -963,11 +966,8 @@ static int dnxhd_encode_picture(AVCodecContext *avctx, AVPacket *pkt,
>> ret = dnxhd_encode_rdo(avctx, ctx);
>> else
>> ret = dnxhd_encode_fast(avctx, ctx);
>> - if (ret < 0) {
>> - av_log(avctx, AV_LOG_ERROR,
>> - "picture could not fit ratecontrol constraints, increase qmax\n");
>> - return -1;
>> - }
>> + if (ret < 0)
>> + return ret;
>
> this looses the error message for dnxhd_encode_rdo()
The error message does not apply to dnxhd_encode_rdo in the first place.
[...]
Timothy
More information about the ffmpeg-devel
mailing list