[vlc-commits] qsv: only set the encoder_t values when fully initialized
Steve Lhomme
git at videolan.org
Wed Apr 4 18:28:11 CEST 2018
vlc | branch: master | Steve Lhomme <robux4 at videolabs.io> | Fri Sep 15 16:35:42 2017 +0200| [0c8291795d5f3ed3bb70720c7eb54c3828c8cbb4] | committer: Steve Lhomme
qsv: only set the encoder_t values when fully initialized
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0c8291795d5f3ed3bb70720c7eb54c3828c8cbb4
---
modules/codec/qsv.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/modules/codec/qsv.c b/modules/codec/qsv.c
index c7e789a24b..fb4050cab2 100644
--- a/modules/codec/qsv.c
+++ b/modules/codec/qsv.c
@@ -465,25 +465,20 @@ static int Open(vlc_object_t *this)
return VLC_EGENERIC;
}
+ enc->p_sys = sys;
+
config_ChainParse(enc, SOUT_CFG_PREFIX, sout_options, enc->p_cfg);
/* Checking if we are on software and are allowing it */
MFXQueryIMPL(sys->session, &impl);
if (!var_InheritBool(enc, SOUT_CFG_PREFIX "software") && (impl & MFX_IMPL_SOFTWARE)) {
msg_Err(enc, "No hardware implementation found and software mode disabled");
- free(sys);
- return VLC_EGENERIC;
+ goto error;
}
msg_Dbg(enc, "Using Intel QuickSync Video %s implementation",
impl & MFX_IMPL_HARDWARE ? "hardware" : "software");
- /* Vlc module configuration */
- enc->p_sys = sys;
- enc->fmt_in.i_codec = VLC_CODEC_NV12; // Intel Media SDK requirement
- enc->fmt_in.video.i_chroma = VLC_CODEC_NV12;
- enc->fmt_in.video.i_bits_per_pixel = 12;
-
/* Input picture format description */
sys->params.mfx.FrameInfo.FrameRateExtN = enc->fmt_in.video.i_frame_rate;
sys->params.mfx.FrameInfo.FrameRateExtD = enc->fmt_in.video.i_frame_rate_base;
@@ -630,15 +625,22 @@ static int Open(vlc_object_t *this)
if (unlikely(!sys->tasks))
goto nomem;
+ /* Vlc module configuration */
+ enc->fmt_in.i_codec = VLC_CODEC_NV12; // Intel Media SDK requirement
+ enc->fmt_in.video.i_chroma = VLC_CODEC_NV12;
+ enc->fmt_in.video.i_bits_per_pixel = 12;
+
enc->pf_encode_video = Encode;
return VLC_SUCCESS;
error:
Close(this);
+ enc->p_sys = NULL;
return VLC_EGENERIC;
nomem:
Close(this);
+ enc->p_sys = NULL;
return VLC_ENOMEM;
}
More information about the vlc-commits
mailing list