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

Unified · Split

2 files
  1. libavcodec/vaapi_encode.c +19 −0
  2. libavcodec/vaapi_encode.h +4 −0
libavcodec/vaapi_encode.c+19−0
@@ -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
916static 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
916int ff_vaapi_encode_send_frame(AVCodecContext *avctx, const AVFrame *frame)931int 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);
libavcodec/vaapi_encode.h+4−0
@@ -314,6 +314,10 @@ typedef struct VAAPIEncodeContext { · 313 unmodified lines
314 int idr_counter;314 int idr_counter;
315 int gop_counter;315 int gop_counter;
316 int end_of_stream;316 int end_of_stream;
317
318 // The encoder does not support cropping information, so warn about
319 // it the first time we encounter any nonzero crop fields.
320 int crop_warned;
317} VAAPIEncodeContext;321} VAAPIEncodeContext;
318 322
319enum {323enum {

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