[FFmpeg-cvslog] avcodec/cuvid: set width and height before calling get_format
Timo Rothenpieler
git at videolan.org
Tue Feb 14 13:03:52 EET 2017
ffmpeg | branch: master | Timo Rothenpieler <timo at rothenpieler.org> | Tue Feb 14 11:47:08 2017 +0100| [ce79410bba776d4121685654056f2b4e39bbd3f7] | committer: Timo Rothenpieler
avcodec/cuvid: set width and height before calling get_format
The external hw_frames_ctx is initialized in that callback, and needs
that information to be accurate.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ce79410bba776d4121685654056f2b4e39bbd3f7
---
libavcodec/cuvid.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/libavcodec/cuvid.c b/libavcodec/cuvid.c
index 2a305ab..5e6e716 100644
--- a/libavcodec/cuvid.c
+++ b/libavcodec/cuvid.c
@@ -113,6 +113,10 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
ctx->internal_error = 0;
+ // width and height need to be set before calling ff_get_format
+ avctx->width = format->display_area.right;
+ avctx->height = format->display_area.bottom;
+
switch (format->bit_depth_luma_minus8) {
case 0: // 8-bit
pix_fmts[1] = AV_PIX_FMT_NV12;
@@ -156,9 +160,6 @@ static int CUDAAPI cuvid_handle_video_sequence(void *opaque, CUVIDEOFORMAT* form
hwframe_ctx = (AVHWFramesContext*)ctx->hwframe->data;
}
- avctx->width = format->display_area.right;
- avctx->height = format->display_area.bottom;
-
ff_set_sar(avctx, av_div_q(
(AVRational){ format->display_aspect_ratio.x, format->display_aspect_ratio.y },
(AVRational){ avctx->width, avctx->height }));
More information about the ffmpeg-cvslog
mailing list