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)
# support OSS audio output module
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
OPENGL ?= $(shell pkg-config --exists gl glu && echo 1)
#OPENGL = 0
# screensaver disable/enable
SCREENSAVER ?= 1
OPENGL=1
# use ffmpeg libswresample
#SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 1)
SWRESAMPLE = 1
@ -33,7 +27,7 @@ AVRESAMPLE ?= $(shell pkg-config --exists libavresample && echo 1)
AVRESAMPLE = 0
endif
CONFIG := #-DDEBUG #-DOSD_DEBUG # enable debug output+functions
CONFIG := -DDEBUG #-DOSD_DEBUG # enable debug output+functions
CONFIG += -DCUVID # enable CUVID decoder
CONFIG += -DHAVE_GL # needed for mpv libs
#CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level
@ -105,25 +99,58 @@ endif
ifeq ($(OSS),1)
CONFIG += -DUSE_OSS
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)
_CFLAGS += $(shell pkg-config --cflags libva-glx)
LIBS += $(shell pkg-config --libs libva-glx)
endif
endif
ifeq ($(OPENGL),1)
CONFIG += -DUSE_GLX
_CFLAGS += $(shell pkg-config --cflags gl glu)
LIBS += $(shell pkg-config --libs gl glu)
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
LIBS += $(shell pkg-config --libs gl glu glew)
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)
#CONFIG += -DUSE_SCREENSAVER
#_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
@ -131,8 +158,8 @@ endif
#endif
ifeq ($(SWRESAMPLE),1)
CONFIG += -DUSE_SWRESAMPLE
#_CFLAGS += $(shell pkg-config --cflags libswresample)
#LIBS += $(shell pkg-config --libs libswresample)
_CFLAGS += $(shell pkg-config --cflags libswresample)
LIBS += $(shell pkg-config --libs libswresample)
endif
#ifeq ($(AVRESAMPLE),1)
#CONFIG += -DUSE_AVRESAMPLE
@ -145,18 +172,13 @@ endif
_CFLAGS += $(shell pkg-config --cflags 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
LIBS += -lavcodec
_CFLAGS += -I/usr/include/libavresample
#LIBS += -lavresample
_CFLAGS += -I/usr/include/libswresample
_CFLAGS += -I./opengl -I./ -std=c99 -Wdeclaration-after-statement
_CFLAGS += -I/usr/local/cuda/include
_CFLAGS += -I./opengl -I./
LIBS += -L/usr/lib64/opengl/nvidia/lib
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 +=

View File

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

View File

@ -3370,7 +3370,7 @@ void Suspend(int video, int audio, int dox11)
void Resume(void)
{
if (!MyVideoStream->SkipStream && !SkipAudio) { // we are not suspended
return;
return;
}
Debug(3, "[softhddev]%s:\n", __FUNCTION__);
@ -3379,19 +3379,19 @@ void Resume(void)
// FIXME: start x11
if (!MyVideoStream->HwDecoder) { // video not running
StartVideo();
StartVideo();
}
if (!MyAudioDecoder) { // audio not running
// StartAudio();
AudioInit();
av_new_packet(AudioAvPkt, AUDIO_BUFFER_SIZE);
MyAudioDecoder = CodecAudioNewDecoder();
AudioCodecID = AV_CODEC_ID_NONE;
AudioChannelID = -1;
if (!MyAudioDecoder) { // audio not running
// StartAudio();
AudioInit();
av_new_packet(AudioAvPkt, AUDIO_BUFFER_SIZE);
MyAudioDecoder = CodecAudioNewDecoder();
AudioCodecID = AV_CODEC_ID_NONE;
AudioChannelID = -1;
}
if (MyVideoStream->Decoder) {
MyVideoStream->SkipStream = 0;
MyVideoStream->SkipStream = 0;
}
SkipAudio = 0;

145
video.c
View File

@ -324,7 +324,7 @@ typedef struct {
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 xcb_connection_t *Connection; ///< xcb connection
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 GLint visual_attr[] = {
GLX_RGBA,
GLX_RED_SIZE, 8,
GLX_GREEN_SIZE, 8,
GLX_BLUE_SIZE, 8,
#ifdef USE_DOUBLEBUFFER
GLX_DOUBLEBUFFER,
#endif
None
};
XVisualInfo *vi;
//The desired 30-bit color visual
int attributeList10[] = {
GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT,
GLX_RENDER_TYPE, GLX_RGBA_BIT,
GLX_DOUBLEBUFFER, True,
GLX_RED_SIZE, 10, /*10bits for R */
GLX_GREEN_SIZE, 10, /*10bits for G */
GLX_BLUE_SIZE, 10, /*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, /*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;
int major;
int minor;
@ -1146,52 +1158,29 @@ static void GlxInit(void)
#endif
// glXGetVideoSyncSGI glXWaitVideoSyncSGI
#if 0
// FIXME: use xcb: xcb_glx_create_context
#endif
// create glx context
glXMakeCurrent(XlibDisplay, None, NULL);
//The desired 30-bit color visual
int attributeList10[] = {
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 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"));
}
XVisualInfo *vis = glXGetVisualFromFBConfig(XlibDisplay, fbc[0]);
//Make sure we have 10bit Red, Green and Blue
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);
GLXFBConfig *fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList10,&fbcount); // try 10 Bit
if (fbc==NULL) {
fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList,&fbcount); // fall back to 8 Bit
if (fbc==NULL)
Fatal(_("did not get FBconfig"));
}
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);
Debug(3,"RGB size %d:%d:%d\n",redSize, greenSize, blueSize);
vi = glXChooseVisual(XlibDisplay, DefaultScreen(XlibDisplay), visual_attr);
if (!vi) {
Error(_("video/glx: can't get a RGB visual\n"));
Fatal(_("video/glx: can't get a RGB visual\n"));
GlxEnabled = 0;
return;
}
@ -1200,7 +1189,6 @@ glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize);
GlxEnabled = 0;
return;
}
//printf("bits per RGB %d\n",vi->bits_per_rgb);
if (vi->bits_per_rgb < 8) {
Error(_("video/glx: need atleast 8-bits per RGB\n"));
GlxEnabled = 0;
@ -1310,6 +1298,7 @@ static void GlxExit(void)
}
if (GlxSharedContext) {
glXDestroyContext(XlibDisplay, GlxSharedContext);
GlxSharedContext=0;
}
if (GlxContext) {
glXDestroyContext(XlibDisplay, GlxContext);
@ -2059,9 +2048,12 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
int n,i;
CUcontext dummy;
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
GlxCheck();
glGenBuffers(1,&vao_buffer);
GlxCheck();
if (decoder->cuda_ctx)
checkCudaErrors(cuCtxPushCurrent(decoder->cuda_ctx));
@ -3947,11 +3939,11 @@ void VideoSetOsd3DMode(int mode)
void VideoOsdInit(void)
{
if (OsdConfigWidth && OsdConfigHeight) {
OsdWidth = OsdConfigWidth;
OsdHeight = OsdConfigHeight;
OsdWidth = OsdConfigWidth;
OsdHeight = OsdConfigHeight;
} else {
OsdWidth = VideoWindowWidth;
OsdHeight = VideoWindowHeight;
OsdWidth = VideoWindowWidth;
OsdHeight = VideoWindowHeight;
}
VideoThreadLock();
@ -4174,7 +4166,7 @@ static void *VideoDisplayHandlerThread(void *dummy)
{
prctl(PR_SET_NAME,"cuvid video",0,0,0);
#ifdef USE_GLX
if (GlxEnabled) {
Debug(3, "video/glx: thread context %p <-> %p\n",glXGetCurrentContext(), GlxThreadContext);
Debug(3, "video/glx: context %p <-> %p\n", glXGetCurrentContext(),GlxContext);
@ -4187,7 +4179,7 @@ static void *VideoDisplayHandlerThread(void *dummy)
// set glx context
GlxSetupWindow(VideoWindow, VideoWindowWidth, VideoWindowHeight, GlxThreadContext);
}
#endif
for (;;) {
// fix dead-lock with CuvidExit
@ -4207,9 +4199,9 @@ static void *VideoDisplayHandlerThread(void *dummy)
///
static void VideoThreadInit(void)
{
#ifdef USE_GLX
glXMakeCurrent(XlibDisplay, None, NULL);
#endif
pthread_mutex_init(&VideoMutex, NULL);
pthread_mutex_init(&VideoLockMutex, NULL);
pthread_cond_init(&VideoWakeupCond, NULL);
@ -4250,11 +4242,11 @@ static void VideoThreadExit(void)
void VideoDisplayWakeup(void)
{
if (!XlibDisplay) { // not yet started
return;
return;
}
if (!VideoThread) { // start video thread, if needed
VideoThreadInit();
VideoThreadInit();
}
}
@ -4313,14 +4305,14 @@ void VideoDelHwDecoder(VideoHwDecoder * hw_decoder)
{
if (hw_decoder) {
#ifdef DEBUG
if (!pthread_equal(pthread_self(), VideoThread)) {
Debug(3, "video: should only be called from inside the thread\n");
}
if (!pthread_equal(pthread_self(), VideoThread)) {
Debug(3, "video: should only be called from inside the thread\n");
}
#endif
// only called from inside the thread
//VideoThreadLock();
VideoUsedModule->DelHwDecoder(hw_decoder);
//VideoThreadUnlock();
// only called from inside the thread
//VideoThreadLock();
VideoUsedModule->DelHwDecoder(hw_decoder);
//VideoThreadUnlock();
}
}
@ -5571,16 +5563,18 @@ void VideoExit(void)
VideoUsedModule->Exit();
VideoUsedModule = &NoopModule;
#ifdef USE_GLX
if (GlxEnabled) {
GlxExit();
}
#endif
#ifdef USE_VIDEO_THREAD
VideoThreadExit();
// CUVID cleanup hangs in XLockDisplay every 100 exits
// XUnlockDisplay(XlibDisplay);
// xcb_flush(Connection);
#endif
#ifdef USE_GLX
if (GlxEnabled) {
GlxExit();
}
#endif
//
// FIXME: cleanup.
@ -5590,7 +5584,7 @@ void VideoExit(void)
//
// X11/xcb cleanup
//
if (VideoWindow != XCB_NONE) {
if (VideoWindow != XCB_NONE) {
xcb_destroy_window(Connection, VideoWindow);
VideoWindow = XCB_NONE;
}
@ -5614,6 +5608,7 @@ void VideoExit(void)
XlibDisplay = NULL;
Connection = 0;
}
}