[vlc-devel] [PATCH 2/2] nvdec: add video size fallback
quentin.chateau at deepskycorp.com
quentin.chateau at deepskycorp.com
Mon Apr 6 15:02:07 CEST 2020
From: Quentin Chateau <quentin.chateau at deepskycorp.com>
When the video size is unknown to the hxxx_helper,
fallback to the size given by the demuxer
---
modules/hw/nvdec/nvdec.c | 26 ++++++++++++++++----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/modules/hw/nvdec/nvdec.c b/modules/hw/nvdec/nvdec.c
index ca28522d32..2fa035368e 100644
--- a/modules/hw/nvdec/nvdec.c
+++ b/modules/hw/nvdec/nvdec.c
@@ -939,8 +939,22 @@ static int OpenDecoder(vlc_object_t *p_this)
unsigned i_w, i_h, i_vw, i_vh;
result = hxxx_helper_get_current_picture_size(&p_sys->hh, &i_w, &i_h, &i_vw, &i_vh);
- if (result != VLC_SUCCESS)
- goto error;
+ if (result == VLC_SUCCESS)
+ {
+ p_dec->fmt_out.video.i_width = vlc_align(i_w, OUTPUT_WIDTH_ALIGN);
+ p_dec->fmt_out.video.i_height = i_h;
+
+ if (!p_dec->fmt_in.video.i_visible_width || !p_dec->fmt_in.video.i_visible_height)
+ {
+ p_dec->fmt_out.video.i_visible_width = i_vw;
+ p_dec->fmt_out.video.i_visible_height = i_vh;
+ }
+ }
+ else
+ {
+ p_dec->fmt_out.video.i_width = vlc_align(p_dec->fmt_in.video.i_width, OUTPUT_WIDTH_ALIGN);
+ p_dec->fmt_out.video.i_height = p_dec->fmt_in.video.i_height;
+ }
if(p_dec->fmt_in.video.primaries == COLOR_PRIMARIES_UNDEF)
{
@@ -961,14 +975,6 @@ static int OpenDecoder(vlc_object_t *p_this)
}
}
- p_dec->fmt_out.video.i_width = vlc_align(i_w, OUTPUT_WIDTH_ALIGN);
- p_dec->fmt_out.video.i_height = i_h;
-
- if (!p_dec->fmt_in.video.i_visible_width || !p_dec->fmt_in.video.i_visible_height)
- {
- p_dec->fmt_out.video.i_visible_width = i_vw;
- p_dec->fmt_out.video.i_visible_height = i_vh;
- }
if (VLC_SUCCESS !=
hxxx_helper_get_current_sar(&p_sys->hh, &i_sar_num, &i_sar_den))
--
2.17.1
More information about the vlc-devel
mailing list