[vlc-devel] [RFC PATCH 02/10] decoder: add decoder_ShouldHWAccel helper

Thomas Guillem thomas at gllm.fr
Thu Apr 21 11:53:36 CEST 2016


An helper that return true if a module should do hardware-accelerated decoding.
---
 include/vlc_codec.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/vlc_codec.h b/include/vlc_codec.h
index 2d01d26..f283041 100644
--- a/include/vlc_codec.h
+++ b/include/vlc_codec.h
@@ -387,6 +387,14 @@ VLC_API mtime_t decoder_GetDisplayDate( decoder_t *, mtime_t ) VLC_USED;
  */
 VLC_API int decoder_GetDisplayRate( decoder_t * ) VLC_USED;
 
+static inline bool decoder_ShouldHWAccel( decoder_t *p_dec )
+{
+    return (p_dec->fmt_in.i_cat == VIDEO_ES
+         && var_CreateGetBool(p_dec, "codec-video-hw"))
+        || (p_dec->fmt_in.i_cat == AUDIO_ES
+         && var_CreateGetBool(p_dec, "codec-audio-hw"));
+}
+
 /** @} */
 /** @} */
 #endif /* _VLC_CODEC_H */
-- 
2.8.0.rc3



More information about the vlc-devel mailing list