History

vaapi_encode: Warn if input has cropping information

Cropping is not supported by VAAPI encode.

Mark Thompson committed 7 years ago

Commit 909bced1 parent ef2f89b2 files · +23 −0Browse files

Showing the changes to libavcodec/vaapi_encode.c (1 of 2 files). Show all

Unified · Split

libavcodec/vaapi_encode.c+19−0
@@ -913,6 +913,21 @@ static int vaapi_encode_clear_old(AVCodecContext *avctx) · 912 unmodified lines
913913 return 0;
914914 }
915915
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+
916931 int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)
917932 {
918933 VAAPIEncodeContext *ctx = avctx->priv_data;
@@ -923,6 +938,10 @@ int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame) · 4 unmodified lines
923938 av_log(avctx, AV_LOG_DEBUG, "Input frame: %ux%u (%"PRId64").\n",
924939 frame->width, frame->height, frame->pts);
925940
941+ err = vaapi_encode_check_frame(avctx, frame);
942+ if (err < 0)
943+ return err;
944+
926945 pic = vaapi_encode_alloc(avctx);
927946 if (!pic)
928947 return AVERROR(ENOMEM);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

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

Repository code

Go to file
t