Cropping is not supported by VAAPI encode.
Showing the changes to libavcodec/vaapi_encode.c (1 of 2 files). Show all
Unified · Split
| @@ -913,6 +913,21 @@ static int vaapi_encode_clear_old(AVCodecContext *avctx) · 912 unmodified lines | |||
| 913 | return 0; | 913 | return 0; |
| 914 | } | 914 | } |
| 915 | 915 | ||
| 916 | static int vaapi_encode_check_frame(AVCodecContext *avctx, | ||
| 917 | const AVFrame *frame) | ||
| 918 | { | ||
| 919 | VAAPIEncodeContext *ctx = avctx->priv_data; | ||
| 920 | |||
| 921 | if ((frame->crop_top || frame->crop_bottom || | ||
| 922 | frame->crop_left || frame->crop_right) && !ctx->crop_warned) { | ||
| 923 | av_log(avctx, AV_LOG_WARNING, "Cropping information on input " | ||
| 924 | "frames ignored due to lack of API support.\n"); | ||
| 925 | ctx->crop_warned = 1; | ||
| 926 | } | ||
| 927 | |||
| 928 | return 0; | ||
| 929 | } | ||
| 930 | |||
| 916 | int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame) | 931 | int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame) |
| 917 | { | 932 | { |
| 918 | VAAPIEncodeContext *ctx = avctx->priv_data; | 933 | VAAPIEncodeContext *ctx = avctx->priv_data; |
| @@ -923,6 +938,10 @@ int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame) · 4 unmodified lines | |||
| 923 | av_log(avctx, AV_LOG_DEBUG, "Input frame: %ux%u (%"PRId64").\n", | 938 | av_log(avctx, AV_LOG_DEBUG, "Input frame: %ux%u (%"PRId64").\n", |
| 924 | frame->width, frame->height, frame->pts); | 939 | frame->width, frame->height, frame->pts); |
| 925 | 940 | ||
| 941 | err = vaapi_encode_check_frame(avctx, frame); | ||
| 942 | if (err < 0) | ||
| 943 | return err; | ||
| 944 | |||
| 926 | pic = vaapi_encode_alloc(avctx); | 945 | pic = vaapi_encode_alloc(avctx); |
| 927 | if (!pic) | 946 | if (!pic) |
| 928 | return AVERROR(ENOMEM); | 947 | return AVERROR(ENOMEM); |