[vlc-devel] [PATCH v4 1/7] libvlc: allow selecting the video hardware acceleration

Thomas Guillem thomas at gllm.fr
Fri Mar 13 16:11:42 CET 2020



On Fri, Mar 13, 2020, at 13:35, Steve Lhomme wrote:
> This time it's a string.
We should also add it for vlc_player_t. The QT preferences will need it too.

> 
> There's still no way to actually force NVDEC though. The nvdec decoder 
> has lower priority than lavc and therefore is never selected. The only 
> way to use it is to force --codec=nvdec.
> 
> Maybe we could give it a higher priority than lavc. After all if the 
> decoder device fails to load or if another one is used, it won't be used 
> and will fall back to lavc. And hardware decoders already have higher 
> priority than software decoders in lavc, so long as the decoder device 
> matches.
OK with that.
> 
> On 2020-03-13 13:28, Steve Lhomme wrote:
> > Pass a string matching one of the decoder device strings.
> > ---
> >   include/vlc/libvlc_media_player.h | 30 ++++++++++++++++++++++++++++++
> >   lib/libvlc.sym                    |  1 +
> >   lib/media_player.c                |  6 ++++++
> >   3 files changed, 37 insertions(+)
> > 
> > diff --git a/include/vlc/libvlc_media_player.h b/include/vlc/libvlc_media_player.h
> > index 5e0255a10ac..1d66858d28f 100644
> > --- a/include/vlc/libvlc_media_player.h
> > +++ b/include/vlc/libvlc_media_player.h
> > @@ -503,6 +503,36 @@ void libvlc_video_set_format_callbacks( libvlc_media_player_t *mp,
> >                                           libvlc_video_cleanup_cb cleanup );
> >   
> >   
> > +/**
> > + * Enumeration of the Video hardware processing acceleration to be used.
> > + * can be passed to @a libvlc_video_set_hw_acceleration
> > + */
> > +typedef enum libvlc_video_acceleration_t {
> > +    /** Pick the best hardware decoder/processor for the source material */
> > +    libvlc_video_acceleration_default,
> > +
> > +    /** Only software processing of video */
> > +    libvlc_video_acceleration_disable,
> > +} libvlc_video_acceleration_t;
> > +
> > +/**
> > + * Set the hardware acceleration system to use to decode videos.
> > + *
> > + * Not all videos might be decoded through the selected mode depending on the
> > + * hardware and the source material.
> > + *
> > + * Selecting an unsupported mode for the platform or video source will result
> > + * in the video being decoded/processing in software.
> > + *
> > + * \param mode hardware acceleration system to use like "any", "none", "dxva2",
> > + *             "d3d11", "nvdec", "vdpau", etc.
> > + *
> > + * \version LibVLC 4.0.0 or later
> > + */
> > +LIBVLC_API
> > +void libvlc_video_set_hw_acceleration( libvlc_media_player_t *mp,
> > +                                       const char * mode );
> > +
> >   typedef struct
> >   {
> >       bool hardware_decoding; /** set if D3D11_CREATE_DEVICE_VIDEO_SUPPORT is needed for D3D11 */
> > diff --git a/lib/libvlc.sym b/lib/libvlc.sym
> > index 67e4dcf7482..159c67f7693 100644
> > --- a/lib/libvlc.sym
> > +++ b/lib/libvlc.sym
> > @@ -239,6 +239,7 @@ libvlc_video_set_deinterlace
> >   libvlc_video_set_format
> >   libvlc_video_set_format_callbacks
> >   libvlc_video_set_output_callbacks
> > +libvlc_video_set_hw_acceleration
> >   libvlc_video_set_key_input
> >   libvlc_video_set_logo_int
> >   libvlc_video_set_logo_string
> > diff --git a/lib/media_player.c b/lib/media_player.c
> > index 96af310c340..50d49336403 100644
> > --- a/lib/media_player.c
> > +++ b/lib/media_player.c
> > @@ -1033,6 +1033,12 @@ void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
> >       var_SetInteger( mp, "vmem-pitch", pitch );
> >   }
> >   
> > +void libvlc_video_set_hw_acceleration( libvlc_media_player_t *mp,
> > +                                       const char * mode )
> > +{
> > +    var_SetString ( mp, "dec-dev", mode );
> > +}
> > +
> >   bool libvlc_video_set_output_callbacks(libvlc_media_player_t *mp,
> >                                          libvlc_video_engine_t engine,
> >                                          libvlc_video_output_setup_cb setup_cb,
> > -- 
> > 2.17.1
> > 
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> > 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel


More information about the vlc-devel mailing list