Skip to content

Commit

Permalink
Added NVDEC video module.
Browse files Browse the repository at this point in the history
No deinterlace yet. NVDEC is a more modern codec for Nvidia video, then CUVID.
  • Loading branch information
ua0lnj committed Aug 2, 2023
1 parent e9ce1ee commit 27a3053
Show file tree
Hide file tree
Showing 7 changed files with 2,943 additions and 154 deletions.
21 changes: 11 additions & 10 deletions README.txt
Expand Up @@ -21,9 +21,9 @@ $Id$
A software and GPU emulated UHD output device plugin for VDR.
Only 8-bit output now.

o Video decoder CPU / VA-API / VDPAU / CUVID
o Video output VA-API / VDPAU / GLX (VA-API / CUVID / CPU) / EGL (VA-API / CUVID / CPU)
o OSD accelerated by GPU VDPAU / CUVID / VA-API-GLX/EGL / CPU-GLX/EGL
o Video decoder CPU / VA-API / VDPAU / CUVID / NVDEC
o Video output VA-API / VDPAU / GLX (VA-API / CUVID / NVDEC / CPU) / EGL (VA-API / CUVID / NVDEC / CPU)
o OSD accelerated by GPU VDPAU / CUVID / NVDEC / VA-API-GLX/EGL / CPU-GLX/EGL
o Audio FFMpeg / Alsa / Analog
o Audio FFMpeg / Alsa / Digital
o Audio FFMpeg / OSS / Analog
Expand All @@ -32,15 +32,13 @@ Only 8-bit output now.
o VDR ScaleVideo API
o Software deinterlacer Bob (VA-API only)
o Autocrop
o Grab image (VA-API / VDPAU / CUVID / CPU)
o Grab image (VA-API / VDPAU / CUVID / NVDEC / CPU)
o Suspend / Dettach
o Letterbox, Stretch and Center cut-out video display modes
o atmo light support with plugin http://github.com/durchflieger/DFAtmo
o PIP (Picture-in-Picture) (VDPAU / CUVID / VA-API-GLX/EGL / CPU-GLX/EGL)
o PIP (Picture-in-Picture) (VDPAU / CUVID / NVDEC / VA-API-GLX/EGL / CPU-GLX/EGL)

o planned: Xv
o planned: Improved software deinterlacer (yadif or/and ffmpeg filters)
o XvBa support is no longer planned (use future Radeon UVD VDPAU)

To compile you must have the 'requires' installed.

Expand Down Expand Up @@ -314,7 +312,8 @@ Commandline:
-f start with fullscreen window (only with window manager)
-g geometry x11 window geometry wxh+x+y
-l loglevel set the log level (0=none, 1=errors, 2=info, 3=debug)
-v device video driver device (va-api, va-api-glx, va-api-egl, vdpau, cuvid, cuvid-egl, cpu-glx, cpu-egl, noop)
-v device video driver device (va-api, va-api-glx, va-api-egl, vdpau,
cuvid, cuvid-egl, nvdec, nvdec-egl, cpu-glx, cpu-egl, noop)
-s start in suspended mode
-x start x11 server, with -xx try to connect, if this fails
-X args X11 server arguments (f.e. -nocursor)
Expand Down Expand Up @@ -443,6 +442,8 @@ Optional:
libs gl glu glew freetype2

Note:
For old Intel video use va-api and va-api-glx. For newest Intel video use va-api-egl.
For old Nvidia video use vdpau. For newest Nvidia video use cuvid and cuvid-egl.
For old Intel video use va-api and va-api-glx.
For newest Intel video use va-api-egl.
For old Nvidia video use vdpau.
For newest Nvidia video use cuvid and cuvid-egl or nvdec and nvdec-egl.
For all system with openGL you can use cpu-glx or cpu-egl.
5 changes: 3 additions & 2 deletions codec.c
Expand Up @@ -565,7 +565,8 @@ int CodecVideoOpen(VideoDecoder * decoder, int codec_id)
Debug(3, "codec: can export data for HW decoding\n");
// FIXME: get_format never called.
decoder->VideoCtx->get_format = Codec_get_format;
decoder->VideoCtx->get_buffer2 = Codec_get_buffer2;
if (!VideoIsDriverNVdec())
decoder->VideoCtx->get_buffer2 = Codec_get_buffer2;
decoder->VideoCtx->draw_horiz_band = Codec_draw_horiz_band;
decoder->VideoCtx->thread_count = 1;
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,114,100)
Expand Down Expand Up @@ -631,7 +632,7 @@ void CodecVideoClose(VideoDecoder * video_decoder)
}
#endif
if (video_decoder->VideoCtx) {
if (VideoIsDriverCuvid())
if (VideoIsDriverCuvid() || VideoIsDriverNVdec())
VideoUnregisterSurface(video_decoder->HwDecoder);
pthread_mutex_lock(&CodecLockMutex);
#if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100)
Expand Down
17 changes: 17 additions & 0 deletions openglosd.cpp
Expand Up @@ -566,6 +566,14 @@ bool cOglOutputFb::Init(void) {
}
#endif
#ifdef USE_CUVID
#ifdef USE_EGL
if (!strcasecmp(VideoGetDriverName(), "nvdec-egl")) {
GetNVdecEglOsdOutputTexture(texture);
} else
#endif
if (VideoIsDriverNVdec()) {
GetNVdecOsdOutputTexture(texture);
}
#ifdef USE_EGL
if (!strcasecmp(VideoGetDriverName(), "cuvid-egl")) {
GetCuvidEglOsdOutputTexture(texture);
Expand Down Expand Up @@ -1709,6 +1717,15 @@ bool cOglThread::InitOpenGL(void) {
if (VideoIsDriverCuvid()) {
if (!CuvidInitGlx()) return false;
}
#ifdef USE_EGL
if (!strcasecmp(VideoGetDriverName(), "nvdec-egl")) {
if (!NVdecInitEgl()) return false;
egl = 1;
} else
#endif
if (VideoIsDriverNVdec()) {
if (!NVdecInitGlx()) return false;
}
#endif
#ifdef USE_EGL
if (!strcasecmp(VideoGetDriverName(), "cpu-egl")) {
Expand Down
2 changes: 1 addition & 1 deletion softhddev.c
Expand Up @@ -3358,7 +3358,7 @@ const char *CommandLineHelp(void)
" -f\t\tstart with fullscreen window (only with window manager)\n"
" -g geometry\tx11 window geometry wxh+x+y\n"
" -l loglevel\tset the log level (0=none, 1=errors, 2=info, 3=debug)\n"
" -v device\tvideo driver device (va-api, va-api-glx, va-api-egl, vdpau, cuvid, cuvid-egl, cpu-glx, cpu-egl, noop)\n"
" -v device\tvideo driver device (va-api, va-api-glx, va-api-egl, vdpau, cuvid, cuvid-egl, nvdec, nvdec-egl, cpu-glx, cpu-egl, noop)\n"
" -s\t\tstart in suspended mode\n"
" -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
" -X args\tX11 server arguments (f.e. -nocursor)\n"
Expand Down
8 changes: 4 additions & 4 deletions softhddevice.cpp
Expand Up @@ -852,7 +852,7 @@ cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level)
#endif

#ifdef USE_OPENGLOSD
if (((!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && strcasecmp(VideoGetDriverName(), "va-api-glx")
if (((!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && !VideoIsDriverNVdec() && strcasecmp(VideoGetDriverName(), "va-api-glx")
&& strcasecmp(VideoGetDriverName(), "va-api-egl") && !VideoIsDriverCpu())
|| DisableOglOsd) && SuspendMode == NOT_SUSPENDED) {
dsyslog("[softhddev]OpenGL Osd disabled - use soft OSD");
Expand Down Expand Up @@ -892,7 +892,7 @@ void cSoftOsdProvider::OsdSizeChanged(void) {
}

bool cSoftOsdProvider::StartOpenGlThread(void) {
if ((!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && strcasecmp(VideoGetDriverName(), "va-api-glx")
if ((!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && !VideoIsDriverNVdec() && strcasecmp(VideoGetDriverName(), "va-api-glx")
&& strcasecmp(VideoGetDriverName(), "va-api-egl") && !VideoIsDriverCpu()) || DisableOglOsd)
return false;
//only try to start worker thread if shd is attached
Expand Down Expand Up @@ -1222,7 +1222,7 @@ void cMenuSetupSoft::Create(void)
(int *)&Background, 0, 0x00FFFFFF));
Add(new cMenuEditIntItem(tr("Video background color (Alpha)"),
(int *)&BackgroundAlpha, 0, 0xFF));
if (VideoIsDriverVdpau() || VideoIsDriverCuvid())
if (VideoIsDriverVdpau() || VideoIsDriverCuvid() || VideoIsDriverNVdec())
Add(new cMenuEditBoolItem(tr("Use studio levels"),
&StudioLevels, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
Expand Down Expand Up @@ -2236,7 +2236,7 @@ static void NewPip(int channel_nr)
*/
static void TogglePip(void)
{
if(!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && strcasecmp(VideoGetDriverName(), "va-api-glx")
if(!VideoIsDriverVdpau() && !VideoIsDriverCuvid() && !VideoIsDriverNVdec() && strcasecmp(VideoGetDriverName(), "va-api-glx")
&& strcasecmp(VideoGetDriverName(), "va-api-egl") && !VideoIsDriverCpu()) return;
if (PipReceiver) {
int attached;
Expand Down

0 comments on commit 27a3053

Please sign in to comment.