[FFmpeg-devel] [PATCH] avcodec/dnxhdenc: return meaningful return codes

Michael Niedermayer michaelni at gmx.at
Fri Jan 17 17:28:26 CET 2014


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



> @@ -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()

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

While the State exists there can be no freedom; when there is freedom there
will be no State. -- Vladimir Lenin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20140117/0a451eb5/attachment.asc>


More information about the ffmpeg-devel mailing list