1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

Removed unused Konfigs

This commit is contained in:
jojo61 2018-08-22 21:04:52 +02:00
parent d6d2674d23
commit b06bd8e3ec
5 changed files with 150 additions and 118 deletions

13
.gitignore vendored Normal file
View File

@ -0,0 +1,13 @@
syntax: glob
*~
*.orig
*.o
*.so
.dependencies
po/*.mo
po/*.pot
.project
.cproject
.includepath
.settings
vdr-softhdcuvid*.tgz

View File

@ -15,15 +15,9 @@ PLUGIN = softhdcuvid
ALSA ?= $(shell pkg-config --exists alsa && echo 1) ALSA ?= $(shell pkg-config --exists alsa && echo 1)
# support OSS audio output module # support OSS audio output module
OSS ?= 1 OSS ?= 1
# support VDPAU video output module
VDPAU ?= $(shell pkg-config --exists vdpau && echo 1)
# support VA-API video output module (deprecated)
VAAPI ?= $(shell pkg-config --exists libva && echo 1)
# support glx output # support glx output
OPENGL ?= $(shell pkg-config --exists gl glu && echo 1) OPENGL=1
#OPENGL = 0
# screensaver disable/enable
SCREENSAVER ?= 1
# use ffmpeg libswresample # use ffmpeg libswresample
#SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 1) #SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 1)
SWRESAMPLE = 1 SWRESAMPLE = 1
@ -33,7 +27,7 @@ AVRESAMPLE ?= $(shell pkg-config --exists libavresample && echo 1)
AVRESAMPLE = 0 AVRESAMPLE = 0
endif endif
CONFIG := #-DDEBUG #-DOSD_DEBUG # enable debug output+functions CONFIG := -DDEBUG #-DOSD_DEBUG # enable debug output+functions
CONFIG += -DCUVID # enable CUVID decoder CONFIG += -DCUVID # enable CUVID decoder
CONFIG += -DHAVE_GL # needed for mpv libs CONFIG += -DHAVE_GL # needed for mpv libs
#CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level #CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level
@ -105,25 +99,58 @@ endif
ifeq ($(OSS),1) ifeq ($(OSS),1)
CONFIG += -DUSE_OSS CONFIG += -DUSE_OSS
endif endif
ifeq ($(VDPAU),1)
CONFIG += -DUSE_VDPAU
_CFLAGS += $(shell pkg-config --cflags vdpau)
LIBS += $(shell pkg-config --libs vdpau)
endif
ifeq ($(VAAPI),1)
CONFIG += -DUSE_VAAPI
_CFLAGS += $(shell pkg-config --cflags libva-x11 libva)
LIBS += $(shell pkg-config --libs libva-x11 libva)
ifeq ($(OPENGL),1) ifeq ($(OPENGL),1)
_CFLAGS += $(shell pkg-config --cflags libva-glx) _CFLAGS += $(shell pkg-config --cflags libva-glx)
LIBS += $(shell pkg-config --libs libva-glx) LIBS += $(shell pkg-config --libs libva-glx)
endif endif
endif
ifeq ($(OPENGL),1) ifeq ($(OPENGL),1)
CONFIG += -DUSE_GLX CONFIG += -DUSE_GLX
_CFLAGS += $(shell pkg-config --cflags gl glu) _CFLAGS += $(shell pkg-config --cflags gl glu glew)
LIBS += $(shell pkg-config --libs gl glu) LIBS += $(shell pkg-config --libs gl glu glew)
endif endif
#
# Test that libswresample is available
#
ifneq (exists, $(shell pkg-config libswresample && echo exists))
$(warning ******************************************************************)
$(warning 'libswresample' not found!)
$(error ******************************************************************)
endif
#
# Test and set config for libavutil
#
ifneq (exists, $(shell pkg-config libavutil && echo exists))
$(warning ******************************************************************)
$(warning 'libavutil' not found!)
$(error ******************************************************************)
endif
_CFLAGS += $(shell pkg-config --cflags libavutil)
LIBS += $(shell pkg-config --libs libavutil)
#
# Test and set config for libswscale
#
ifneq (exists, $(shell pkg-config libswscale && echo exists))
$(warning ******************************************************************)
$(warning 'libswscale' not found!)
$(error ******************************************************************)
endif
_CFLAGS += $(shell pkg-config --cflags libswscale)
LIBS += $(shell pkg-config --libs libswscale)
#
# Test and set config for libavcodec
#
ifneq (exists, $(shell pkg-config libavcodec && echo exists))
$(warning ******************************************************************)
$(warning 'libavcodec' not found!)
$(error ******************************************************************)
endif
_CFLAGS += $(shell pkg-config --cflags libavcodec)
LIBS += $(shell pkg-config --libs libavcodec)
#ifeq ($(SCREENSAVER),1) #ifeq ($(SCREENSAVER),1)
#CONFIG += -DUSE_SCREENSAVER #CONFIG += -DUSE_SCREENSAVER
#_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms) #_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
@ -131,8 +158,8 @@ endif
#endif #endif
ifeq ($(SWRESAMPLE),1) ifeq ($(SWRESAMPLE),1)
CONFIG += -DUSE_SWRESAMPLE CONFIG += -DUSE_SWRESAMPLE
#_CFLAGS += $(shell pkg-config --cflags libswresample) _CFLAGS += $(shell pkg-config --cflags libswresample)
#LIBS += $(shell pkg-config --libs libswresample) LIBS += $(shell pkg-config --libs libswresample)
endif endif
#ifeq ($(AVRESAMPLE),1) #ifeq ($(AVRESAMPLE),1)
#CONFIG += -DUSE_AVRESAMPLE #CONFIG += -DUSE_AVRESAMPLE
@ -145,18 +172,13 @@ endif
_CFLAGS += $(shell pkg-config --cflags x11 x11-xcb xcb xcb-icccm) _CFLAGS += $(shell pkg-config --cflags x11 x11-xcb xcb xcb-icccm)
LIBS += -lrt $(shell pkg-config --libs x11 x11-xcb xcb xcb-icccm) LIBS += -lrt $(shell pkg-config --libs x11 x11-xcb xcb xcb-icccm)
_CFLAGS += -I/usr/include/libavcodec -I/usr/local/cuda/include -std=c99 _CFLAGS += -I/usr/local/cuda/include
LIBS += -lavcodec _CFLAGS += -I./opengl -I./
_CFLAGS += -I/usr/include/libavresample
#LIBS += -lavresample
_CFLAGS += -I/usr/include/libswresample
_CFLAGS += -I./opengl -I./ -std=c99 -Wdeclaration-after-statement
LIBS += -L/usr/lib64/opengl/nvidia/lib LIBS += -L/usr/lib64/opengl/nvidia/lib
LIBS += -L/usr/local/cuda/lib64 LIBS += -L/usr/local/cuda/lib64
LIBS += -lavutil -lswresample -lswscale -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid
### Includes and Defines (add further entries here): ### Includes and Defines (add further entries here):
INCLUDES += INCLUDES +=

View File

@ -905,7 +905,7 @@ void cMenuSetupSoft::Create(void)
&Video4to3DisplayFormat, 3, video_display_formats_4_3)); &Video4to3DisplayFormat, 3, video_display_formats_4_3));
Add(new cMenuEditStraItem(trVDR("16:9+other video display format"), Add(new cMenuEditStraItem(trVDR("16:9+other video display format"),
&VideoOtherDisplayFormat, 3, video_display_formats_16_9)); &VideoOtherDisplayFormat, 3, video_display_formats_16_9));
#if 0
// FIXME: switch config gray/color configuration // FIXME: switch config gray/color configuration
Add(new cMenuEditIntItem(tr("Video background color (RGB)"), Add(new cMenuEditIntItem(tr("Video background color (RGB)"),
(int *)&Background, 0, 0x00FFFFFF)); (int *)&Background, 0, 0x00FFFFFF));
@ -915,13 +915,14 @@ void cMenuSetupSoft::Create(void)
&StudioLevels, trVDR("no"), trVDR("yes"))); &StudioLevels, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode, Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode,
trVDR("no"), trVDR("yes"))); trVDR("no"), trVDR("yes")));
#endif
Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync, Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync,
trVDR("no"), trVDR("yes"))); trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Black during channel switch"), Add(new cMenuEditBoolItem(tr("Black during channel switch"),
&BlackPicture, trVDR("no"), trVDR("yes"))); &BlackPicture, trVDR("no"), trVDR("yes")));
Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"), Add(new cMenuEditBoolItem(tr("Clear decoder on channel switch"),
&ClearOnSwitch, trVDR("no"), trVDR("yes"))); &ClearOnSwitch, trVDR("no"), trVDR("yes")));
#if 0
Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"), Add(new cMenuEditIntItem(tr("Brightness (-1000..1000) (vdpau)"),
&Brightness, -1000, 1000, tr("min"), tr("max"))); &Brightness, -1000, 1000, tr("min"), tr("max")));
Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast, Add(new cMenuEditIntItem(tr("Contrast (0..10000) (vdpau)"), &Contrast,
@ -973,6 +974,7 @@ void cMenuSetupSoft::Create(void)
&AutoCropDelay, 0, 200)); &AutoCropDelay, 0, 200));
Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"), Add(new cMenuEditIntItem(tr("Autocrop tolerance (pixel)"),
&AutoCropTolerance, 0, 32)); &AutoCropTolerance, 0, 32));
#endif
} }
// //
// audio // audio

109
video.c
View File

@ -324,7 +324,7 @@ typedef struct {
char VideoIgnoreRepeatPict; ///< disable repeat pict warning char VideoIgnoreRepeatPict; ///< disable repeat pict warning
static const char *VideoDriverName; ///< video output device static const char *VideoDriverName="cuvid"; ///< video output device
static Display *XlibDisplay; ///< Xlib X11 display static Display *XlibDisplay; ///< Xlib X11 display
static xcb_connection_t *Connection; ///< xcb connection static xcb_connection_t *Connection; ///< xcb connection
static xcb_colormap_t VideoColormap; ///< video colormap static xcb_colormap_t VideoColormap; ///< video colormap
@ -1088,17 +1088,29 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex
/// ///
static void GlxInit(void) static void GlxInit(void)
{ {
static GLint visual_attr[] = {
GLX_RGBA, XVisualInfo *vi;
GLX_RED_SIZE, 8, //The desired 30-bit color visual
GLX_GREEN_SIZE, 8, int attributeList10[] = {
GLX_BLUE_SIZE, 8, GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
#ifdef USE_DOUBLEBUFFER GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, GLX_DOUBLEBUFFER, True,
#endif GLX_RED_SIZE, 10, /*10bits for R */
GLX_GREEN_SIZE, 10, /*10bits for G */
GLX_BLUE_SIZE, 10, /*10bits for B */
None None
}; };
XVisualInfo *vi; int attributeList[] = {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True,
GLX_RED_SIZE, 8, /*8 bits for R */
GLX_GREEN_SIZE, 8, /*8 bits for G */
GLX_BLUE_SIZE, 8, /*8 bits for B */
None
};
int fbcount;
GLXContext context; GLXContext context;
int major; int major;
int minor; int minor;
@ -1146,52 +1158,29 @@ static void GlxInit(void)
#endif #endif
// glXGetVideoSyncSGI glXWaitVideoSyncSGI // glXGetVideoSyncSGI glXWaitVideoSyncSGI
#if 0
// FIXME: use xcb: xcb_glx_create_context
#endif
// create glx context // create glx context
glXMakeCurrent(XlibDisplay, None, NULL); glXMakeCurrent(XlibDisplay, None, NULL);
//The desired 30-bit color visual GLXFBConfig *fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList10,&fbcount); // try 10 Bit
int attributeList10[] = { if (fbc==NULL) {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList,&fbcount); // fall back to 8 Bit
GLX_RENDER_TYPE, GLX_RGBA_BIT, if (fbc==NULL)
GLX_DOUBLEBUFFER, True,
GLX_RED_SIZE, 8, /*10bits for R */
GLX_GREEN_SIZE, 8, /*10bits for G */
GLX_BLUE_SIZE, 8, /*10bits for B */
None
};
int attributeList[] = {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True,
GLX_RED_SIZE, 8, /*10bits for R */
GLX_GREEN_SIZE, 8, /*10bits for G */
GLX_BLUE_SIZE, 8, /*10bits for B */
None
};
int fbcount;
GLXFBConfig *fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList10,&fbcount);
if (!fbc) {
GLXFBConfig *fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList,&fbcount);
if (!fbc)
Fatal(_("did not get FBconfig")); Fatal(_("did not get FBconfig"));
} }
XVisualInfo *vis = glXGetVisualFromFBConfig(XlibDisplay, fbc[0]);
//Make sure we have 10bit Red, Green and Blue vi = glXGetVisualFromFBConfig(XlibDisplay, fbc[0]);
int redSize, greenSize, blueSize;
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize);
//printf("RGB size %d:%d:%d\n",redSize, greenSize, blueSize);
int redSize, greenSize, blueSize;
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize);
Debug(3,"RGB size %d:%d:%d\n",redSize, greenSize, blueSize);
vi = glXChooseVisual(XlibDisplay, DefaultScreen(XlibDisplay), visual_attr);
if (!vi) { if (!vi) {
Error(_("video/glx: can't get a RGB visual\n")); Fatal(_("video/glx: can't get a RGB visual\n"));
GlxEnabled = 0; GlxEnabled = 0;
return; return;
} }
@ -1200,7 +1189,6 @@ glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize);
GlxEnabled = 0; GlxEnabled = 0;
return; return;
} }
//printf("bits per RGB %d\n",vi->bits_per_rgb);
if (vi->bits_per_rgb < 8) { if (vi->bits_per_rgb < 8) {
Error(_("video/glx: need atleast 8-bits per RGB\n")); Error(_("video/glx: need atleast 8-bits per RGB\n"));
GlxEnabled = 0; GlxEnabled = 0;
@ -1310,6 +1298,7 @@ static void GlxExit(void)
} }
if (GlxSharedContext) { if (GlxSharedContext) {
glXDestroyContext(XlibDisplay, GlxSharedContext); glXDestroyContext(XlibDisplay, GlxSharedContext);
GlxSharedContext=0;
} }
if (GlxContext) { if (GlxContext) {
glXDestroyContext(XlibDisplay, GlxContext); glXDestroyContext(XlibDisplay, GlxContext);
@ -2059,8 +2048,11 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
int n,i; int n,i;
CUcontext dummy; CUcontext dummy;
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
GlxCheck();
glGenBuffers(1,&vao_buffer); glGenBuffers(1,&vao_buffer);
GlxCheck();
if (decoder->cuda_ctx) if (decoder->cuda_ctx)
checkCudaErrors(cuCtxPushCurrent(decoder->cuda_ctx)); checkCudaErrors(cuCtxPushCurrent(decoder->cuda_ctx));
@ -4174,7 +4166,7 @@ static void *VideoDisplayHandlerThread(void *dummy)
{ {
prctl(PR_SET_NAME,"cuvid video",0,0,0); prctl(PR_SET_NAME,"cuvid video",0,0,0);
#ifdef USE_GLX
if (GlxEnabled) { if (GlxEnabled) {
Debug(3, "video/glx: thread context %p <-> %p\n",glXGetCurrentContext(), GlxThreadContext); Debug(3, "video/glx: thread context %p <-> %p\n",glXGetCurrentContext(), GlxThreadContext);
Debug(3, "video/glx: context %p <-> %p\n", glXGetCurrentContext(),GlxContext); Debug(3, "video/glx: context %p <-> %p\n", glXGetCurrentContext(),GlxContext);
@ -4187,7 +4179,7 @@ static void *VideoDisplayHandlerThread(void *dummy)
// set glx context // set glx context
GlxSetupWindow(VideoWindow, VideoWindowWidth, VideoWindowHeight, GlxThreadContext); GlxSetupWindow(VideoWindow, VideoWindowWidth, VideoWindowHeight, GlxThreadContext);
} }
#endif
for (;;) { for (;;) {
// fix dead-lock with CuvidExit // fix dead-lock with CuvidExit
@ -4207,9 +4199,9 @@ static void *VideoDisplayHandlerThread(void *dummy)
/// ///
static void VideoThreadInit(void) static void VideoThreadInit(void)
{ {
#ifdef USE_GLX
glXMakeCurrent(XlibDisplay, None, NULL); glXMakeCurrent(XlibDisplay, None, NULL);
#endif
pthread_mutex_init(&VideoMutex, NULL); pthread_mutex_init(&VideoMutex, NULL);
pthread_mutex_init(&VideoLockMutex, NULL); pthread_mutex_init(&VideoLockMutex, NULL);
pthread_cond_init(&VideoWakeupCond, NULL); pthread_cond_init(&VideoWakeupCond, NULL);
@ -5571,16 +5563,18 @@ void VideoExit(void)
VideoUsedModule->Exit(); VideoUsedModule->Exit();
VideoUsedModule = &NoopModule; VideoUsedModule = &NoopModule;
#ifdef USE_GLX
if (GlxEnabled) {
GlxExit();
}
#endif
#ifdef USE_VIDEO_THREAD #ifdef USE_VIDEO_THREAD
VideoThreadExit(); VideoThreadExit();
// CUVID cleanup hangs in XLockDisplay every 100 exits // CUVID cleanup hangs in XLockDisplay every 100 exits
// XUnlockDisplay(XlibDisplay); // XUnlockDisplay(XlibDisplay);
// xcb_flush(Connection); // xcb_flush(Connection);
#endif
#ifdef USE_GLX
if (GlxEnabled) {
GlxExit();
}
#endif #endif
// //
// FIXME: cleanup. // FIXME: cleanup.
@ -5614,6 +5608,7 @@ void VideoExit(void)
XlibDisplay = NULL; XlibDisplay = NULL;
Connection = 0; Connection = 0;
} }
} }