mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
commit
ce71019f44
6
.clang-format
Normal file
6
.clang-format
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
BasedOnStyle: LLVM
|
||||||
|
UseTab: Never
|
||||||
|
IndentWidth: 4
|
||||||
|
IndentCaseLabels: true
|
||||||
|
ColumnLimit: 119
|
37
.indent.pro
vendored
37
.indent.pro
vendored
@ -1,37 +0,0 @@
|
|||||||
--blank-lines-before-block-comments
|
|
||||||
--blank-lines-after-declarations
|
|
||||||
--blank-lines-after-procedures
|
|
||||||
--no-blank-lines-after-commas
|
|
||||||
--braces-on-if-line
|
|
||||||
--no-blank-before-sizeof
|
|
||||||
--comment-indentation41
|
|
||||||
--declaration-comment-column41
|
|
||||||
--no-comment-delimiters-on-blank-lines
|
|
||||||
--swallow-optional-blank-lines
|
|
||||||
--dont-format-comments
|
|
||||||
--parameter-indentation4
|
|
||||||
--indent-level4
|
|
||||||
--line-comments-indentation0
|
|
||||||
--cuddle-else
|
|
||||||
--cuddle-do-while
|
|
||||||
--brace-indent0
|
|
||||||
--case-brace-indentation0
|
|
||||||
//--start-left-side-of-comments
|
|
||||||
--leave-preprocessor-space
|
|
||||||
//--continuation-indentation8
|
|
||||||
--case-indentation4
|
|
||||||
--else-endif-column0
|
|
||||||
--no-space-after-casts
|
|
||||||
--declaration-indentation1
|
|
||||||
--dont-line-up-parentheses
|
|
||||||
--no-space-after-function-call-names
|
|
||||||
--space-special-semicolon
|
|
||||||
--tab-size4
|
|
||||||
--no-tabs
|
|
||||||
--line-length119
|
|
||||||
--comment-line-length119
|
|
||||||
--honour-newlines
|
|
||||||
--dont-break-procedure-type
|
|
||||||
--break-before-boolean-operator
|
|
||||||
--continuation-indentation4
|
|
||||||
--ignore-newlines
|
|
155
Makefile
155
Makefile
@ -1,6 +1,6 @@
|
|||||||
#
|
#
|
||||||
# Makefile for a Video Disk Recorder plugin
|
# Makefile for a Video Disk Recorder plugin
|
||||||
#
|
#
|
||||||
# $Id: 2a41981a57e5e83036463c6a08c84b86ed9d2be3 $
|
# $Id: 2a41981a57e5e83036463c6a08c84b86ed9d2be3 $
|
||||||
|
|
||||||
# The official name of this plugin.
|
# The official name of this plugin.
|
||||||
@ -11,7 +11,7 @@
|
|||||||
### Configuration (edit this for your needs)
|
### Configuration (edit this for your needs)
|
||||||
# comment out if not needed
|
# comment out if not needed
|
||||||
|
|
||||||
# what kind of decoder do we make -
|
# what kind of decoder do we make -
|
||||||
# if VAAPI is enabled the pluginname is softhdvaapi
|
# if VAAPI is enabled the pluginname is softhdvaapi
|
||||||
# if CUVID is enabled the pluginname is softhdcuvid
|
# if CUVID is enabled the pluginname is softhdcuvid
|
||||||
# if DRM is enabled the pluginname is softhddrm
|
# if DRM is enabled the pluginname is softhddrm
|
||||||
@ -19,28 +19,21 @@ VAAPI ?= 0
|
|||||||
CUVID ?= 0
|
CUVID ?= 0
|
||||||
|
|
||||||
# if you enable DRM then the plugin will only run without X server
|
# if you enable DRM then the plugin will only run without X server
|
||||||
# only valid for VAAPI
|
# only valid for VAAPI
|
||||||
DRM ?= 0
|
DRM ?= 0
|
||||||
|
|
||||||
|
# use libplacebo -
|
||||||
# use libplacebo -
|
# available for all decoders but for DRM you need LIBPLACEBO_GL
|
||||||
# available for all decoders but for DRM you need LIBPLACEBO_GL
|
|
||||||
LIBPLACEBO ?= 1
|
LIBPLACEBO ?= 1
|
||||||
LIBPLACEBO_GL ?= 0
|
LIBPLACEBO_GL ?= 0
|
||||||
|
|
||||||
# use YADIF deint - only available with cuvid
|
# use YADIF deint - only available with cuvid
|
||||||
#YADIF=1
|
#YADIF = 1
|
||||||
|
|
||||||
# use gamma correction
|
# use gamma correction
|
||||||
#GAMMA ?= 0
|
#GAMMA ?= 0
|
||||||
|
|
||||||
|
CONFIG := -DDEBUG # remove '#' to enable debug output
|
||||||
|
|
||||||
CONFIG := -DDEBUG # remove # to enable debug output
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#--------------------- no more config needed past this point--------------------------------
|
#--------------------- no more config needed past this point--------------------------------
|
||||||
@ -61,7 +54,7 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CUVID),1)
|
ifeq ($(CUVID),1)
|
||||||
ifeq ($(DRM),1)
|
ifeq ($(DRM),1)
|
||||||
$(error Missmatch in Plugin selection)
|
$(error Mismatch in Plugin selection)
|
||||||
exit 1;
|
exit 1;
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
@ -69,42 +62,27 @@ endif
|
|||||||
|
|
||||||
ifeq ($(CUVID),1)
|
ifeq ($(CUVID),1)
|
||||||
ifeq ($(VAAPI),1)
|
ifeq ($(VAAPI),1)
|
||||||
$(error Missmatch in Plugin selection)
|
$(error Mismatch in Plugin selection)
|
||||||
exit 1;
|
exit 1;
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
endif # MAKECMDGOALS!=indent
|
endif # MAKECMDGOALS!=indent
|
||||||
endif # MAKECMDGOALS!=clean
|
endif # MAKECMDGOALS!=clean
|
||||||
|
|
||||||
|
|
||||||
#--------------------------
|
#--------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
PLUGIN = softhdcuvid
|
PLUGIN = softhdcuvid
|
||||||
|
|
||||||
# support OPENGLOSD always needed
|
# support OPENGLOSD always needed
|
||||||
OPENGLOSD=1
|
OPENGLOSD=1
|
||||||
|
|
||||||
# support alsa audio output module
|
|
||||||
ALSA ?= $(shell pkg-config --exists alsa && echo 1)
|
|
||||||
# support OSS audio output module
|
|
||||||
OSS ?= 1
|
|
||||||
|
|
||||||
# use DMPS
|
# use DMPS
|
||||||
SCREENSAVER=1
|
SCREENSAVER=1
|
||||||
|
|
||||||
OPENGL=1
|
OPENGL=1
|
||||||
|
|
||||||
# use ffmpeg libswresample
|
|
||||||
SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 1)
|
|
||||||
SWRESAMPLE = 1
|
|
||||||
|
|
||||||
# use libav libavresample
|
|
||||||
#ifneq ($(SWRESAMPLE),1)
|
|
||||||
#AVRESAMPLE ?= $(shell pkg-config --exists libavresample && echo 1#)
|
|
||||||
#AVRESAMPLE = 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
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
|
||||||
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # info/debug a/v sync
|
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # info/debug a/v sync
|
||||||
@ -136,7 +114,7 @@ TMPDIR ?= /tmp
|
|||||||
|
|
||||||
### The compiler options:
|
### The compiler options:
|
||||||
|
|
||||||
export CFLAGS = $(call PKGCFG,cflags)
|
export CFLAGS = $(call PKGCFG,cflags)
|
||||||
export CXXFLAGS = $(call PKGCFG,cxxflags)
|
export CXXFLAGS = $(call PKGCFG,cxxflags)
|
||||||
|
|
||||||
ifeq ($(CFLAGS),)
|
ifeq ($(CFLAGS),)
|
||||||
@ -154,20 +132,8 @@ APIVERSION = $(call PKGCFG,apiversion)
|
|||||||
|
|
||||||
-include $(PLGCFG)
|
-include $(PLGCFG)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Parse softhddevice config
|
### Parse softhddevice config
|
||||||
|
|
||||||
ifeq ($(ALSA),1)
|
|
||||||
CONFIG += -DUSE_ALSA
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags alsa)
|
|
||||||
LIBS += $(shell pkg-config --libs alsa)
|
|
||||||
endif
|
|
||||||
|
|
||||||
ifeq ($(OSS),1)
|
|
||||||
CONFIG += -DUSE_OSS
|
|
||||||
endif
|
|
||||||
|
|
||||||
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)
|
||||||
@ -180,29 +146,29 @@ endif
|
|||||||
ifeq ($(OPENGL),1)
|
ifeq ($(OPENGL),1)
|
||||||
CONFIG += -DUSE_GLX
|
CONFIG += -DUSE_GLX
|
||||||
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
|
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
|
||||||
#LIBS += $(shell pkg-config --libs glu glew)
|
#LIBS += $(shell pkg-config --libs glu glew)
|
||||||
_CFLAGS += $(shell pkg-config --cflags freetype2)
|
_CFLAGS += $(shell pkg-config --cflags freetype2)
|
||||||
LIBS += $(shell pkg-config --libs freetype2)
|
LIBS += $(shell pkg-config --libs freetype2)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(VAAPI),1)
|
ifeq ($(VAAPI),1)
|
||||||
CONFIG += -DVAAPI
|
CONFIG += -DVAAPI
|
||||||
#LIBPLACEBO=1
|
#LIBPLACEBO=1
|
||||||
PLUGIN = softhdvaapi
|
PLUGIN = softhdvaapi
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LIBPLACEBO_GL),1)
|
ifeq ($(LIBPLACEBO_GL),1)
|
||||||
CONFIG += -DPLACEBO_GL -DPLACEBO
|
CONFIG += -DPLACEBO_GL -DPLACEBO
|
||||||
LIBS += -lepoxy
|
LIBS += -lepoxy
|
||||||
LIBS += -lplacebo
|
LIBS += -lplacebo
|
||||||
else
|
else
|
||||||
LIBS += -lEGL
|
LIBS += -lEGL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(LIBPLACEBO),1)
|
ifeq ($(LIBPLACEBO),1)
|
||||||
CONFIG += -DPLACEBO
|
CONFIG += -DPLACEBO
|
||||||
LIBS += -lEGL
|
LIBS += -lEGL
|
||||||
LIBS += -lplacebo
|
LIBS += -lplacebo
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(DRM),1)
|
ifeq ($(DRM),1)
|
||||||
@ -212,21 +178,19 @@ _CFLAGS += $(shell pkg-config --cflags libdrm)
|
|||||||
LIBS += -lgbm -ldrm -lEGL
|
LIBS += -lgbm -ldrm -lEGL
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(CUVID),1)
|
ifeq ($(CUVID),1)
|
||||||
#CONFIG += -DUSE_PIP # PIP support
|
#CONFIG += -DUSE_PIP # PIP support
|
||||||
CONFIG += -DCUVID # enable CUVID decoder
|
CONFIG += -DCUVID # enable CUVID decoder
|
||||||
LIBS += -lEGL -lGL
|
LIBS += -lEGL -lGL
|
||||||
ifeq ($(YADIF),1)
|
ifeq ($(YADIF),1)
|
||||||
CONFIG += -DYADIF # Yadif only with CUVID
|
CONFIG += -DYADIF # Yadif only with CUVID
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(GAMMA),1)
|
ifeq ($(GAMMA),1)
|
||||||
CONFIG += -DGAMMA
|
CONFIG += -DGAMMA
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
ARCHIVE = $(PLUGIN)-$(VERSION)
|
ARCHIVE = $(PLUGIN)-$(VERSION)
|
||||||
PACKAGE = vdr-$(ARCHIVE)
|
PACKAGE = vdr-$(ARCHIVE)
|
||||||
|
|
||||||
@ -234,18 +198,19 @@ PACKAGE = vdr-$(ARCHIVE)
|
|||||||
|
|
||||||
SOFILE = libvdr-$(PLUGIN).so
|
SOFILE = libvdr-$(PLUGIN).so
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test that libswresample is available
|
||||||
|
#
|
||||||
|
ifneq (exists, $(shell pkg-config libswresample && echo exists))
|
||||||
|
$(warning ******************************************************************)
|
||||||
|
$(warning 'libswresample' not found!)
|
||||||
|
$(error ******************************************************************)
|
||||||
|
endif
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags libswresample)
|
||||||
|
LIBS += $(shell pkg-config --libs libswresample)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test that libswresample is available
|
# Test and set config for libavutil
|
||||||
#
|
|
||||||
#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))
|
ifneq (exists, $(shell pkg-config libavutil && echo exists))
|
||||||
$(warning ******************************************************************)
|
$(warning ******************************************************************)
|
||||||
@ -256,7 +221,7 @@ _CFLAGS += $(shell pkg-config --cflags libavutil)
|
|||||||
LIBS += $(shell pkg-config --libs libavutil)
|
LIBS += $(shell pkg-config --libs libavutil)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Test and set config for libswscale
|
# Test and set config for libswscale
|
||||||
#
|
#
|
||||||
ifneq (exists, $(shell pkg-config libswscale && echo exists))
|
ifneq (exists, $(shell pkg-config libswscale && echo exists))
|
||||||
$(warning ******************************************************************)
|
$(warning ******************************************************************)
|
||||||
@ -277,27 +242,27 @@ endif
|
|||||||
_CFLAGS += $(shell pkg-config --cflags libavcodec)
|
_CFLAGS += $(shell pkg-config --cflags libavcodec)
|
||||||
LIBS += $(shell pkg-config --libs libavcodec libavfilter)
|
LIBS += $(shell pkg-config --libs libavcodec libavfilter)
|
||||||
|
|
||||||
|
#
|
||||||
|
# Test and set config for alsa
|
||||||
|
#
|
||||||
|
ifneq (exists, $(shell pkg-config alsa && echo exists))
|
||||||
|
$(warning ******************************************************************)
|
||||||
|
$(warning 'alsa' not found!)
|
||||||
|
$(error ******************************************************************)
|
||||||
|
endif
|
||||||
|
_CFLAGS += $(shell pkg-config --cflags alsa)
|
||||||
|
LIBS += $(shell pkg-config --libs alsa)
|
||||||
|
|
||||||
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)
|
||||||
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
|
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
|
||||||
endif
|
endif
|
||||||
ifeq ($(SWRESAMPLE),1)
|
|
||||||
CONFIG += -DUSE_SWRESAMPLE
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags libswresample)
|
|
||||||
LIBS += $(shell pkg-config --libs libswresample)
|
|
||||||
endif
|
|
||||||
ifeq ($(AVRESAMPLE),1)
|
|
||||||
CONFIG += -DUSE_AVRESAMPLE
|
|
||||||
_CFLAGS += $(shell pkg-config --cflags libavresample)
|
|
||||||
LIBS += $(shell pkg-config --libs libavresample)
|
|
||||||
endif
|
|
||||||
|
|
||||||
#_CFLAGS += $(shell pkg-config --cflags libavcodec x11 x11-xcb xcb xcb-icccm)
|
#_CFLAGS += $(shell pkg-config --cflags libavcodec x11 x11-xcb xcb xcb-icccm)
|
||||||
#LIBS += -lrt $(shell pkg-config --libs libavcodec x11 x11-xcb xcb xcb-icccm)
|
#LIBS += -lrt $(shell pkg-config --libs libavcodec x11 x11-xcb xcb xcb-icccm)
|
||||||
_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./opengl -I./
|
_CFLAGS += -I./opengl -I./
|
||||||
|
|
||||||
@ -305,10 +270,11 @@ LIBS += -L/usr/lib64
|
|||||||
|
|
||||||
|
|
||||||
ifeq ($(CUVID),1)
|
ifeq ($(CUVID),1)
|
||||||
LIBS += -lcuda -lnvcuvid
|
LIBS += -lcuda -lnvcuvid
|
||||||
endif
|
endif
|
||||||
|
|
||||||
LIBS += -lGLEW -lGLU -ldl -lglut
|
LIBS += -lGLEW -lGLU -ldl -lglut
|
||||||
|
|
||||||
### Includes and Defines (add further entries here):
|
### Includes and Defines (add further entries here):
|
||||||
|
|
||||||
INCLUDES +=
|
INCLUDES +=
|
||||||
@ -319,16 +285,15 @@ DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D_GNU_SOURCE $(CONFIG) \
|
|||||||
### Make it standard
|
### Make it standard
|
||||||
|
|
||||||
override CXXFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
override CXXFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||||
-g -W -Wextra -Winit-self -Werror=overloaded-virtual -Wno-unused-parameter
|
-g -W -Wextra -Werror=overloaded-virtual -Wno-unused-parameter
|
||||||
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
|
||||||
-g -W -Wextra -Winit-self -std=gnu99
|
-g -W -Wextra
|
||||||
|
|
||||||
|
|
||||||
### The object files (add further files here):
|
### The object files (add further files here):
|
||||||
|
|
||||||
OBJS = softhdcuvid.o softhddev.o video.o audio.o codec.o ringbuffer.o openglosd.o
|
OBJS = softhdcuvid.o softhddev.o video.o audio.o codec.o ringbuffer.o openglosd.o
|
||||||
ifeq ($(GAMMA),1)
|
ifeq ($(GAMMA),1)
|
||||||
OBJS += colorramp.o
|
OBJS += colorramp.o
|
||||||
ifeq ($(DRM),1)
|
ifeq ($(DRM),1)
|
||||||
OBJS += gamma-drm.o
|
OBJS += gamma-drm.o
|
||||||
else
|
else
|
||||||
@ -383,9 +348,8 @@ install-i18n: $(I18Nmsgs)
|
|||||||
|
|
||||||
$(OBJS): Makefile
|
$(OBJS): Makefile
|
||||||
|
|
||||||
|
|
||||||
$(SOFILE): $(OBJS) shaders.h
|
$(SOFILE): $(OBJS) shaders.h
|
||||||
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
|
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
|
||||||
|
|
||||||
install-lib: $(SOFILE)
|
install-lib: $(SOFILE)
|
||||||
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
|
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
|
||||||
@ -404,17 +368,14 @@ clean:
|
|||||||
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
|
@-rm -f $(PODIR)/*.mo $(PODIR)/*.pot
|
||||||
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
|
@-rm -f $(OBJS) $(DEPFILE) *.so *.tgz core* *~
|
||||||
|
|
||||||
## Private Targets:
|
HDRS = $(wildcard *.h)
|
||||||
|
|
||||||
HDRS= $(wildcard *.h)
|
|
||||||
|
|
||||||
indent:
|
indent:
|
||||||
for i in $(SRCS) $(HDRS); do \
|
for i in $(SRCS) drm.c hdr.c $(HDRS); do \
|
||||||
indent $$i; \
|
clang-format -i $$i; \
|
||||||
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
|
|
||||||
mv $$i.up $$i; \
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
## Private Targets:
|
||||||
|
|
||||||
video_test: video.c Makefile
|
video_test: video.c Makefile
|
||||||
$(CC) -DVIDEO_TEST -DVERSION='"$(VERSION)"' $(CFLAGS) $(LDFLAGS) $< \
|
$(CC) -DVIDEO_TEST -DVERSION='"$(VERSION)"' $(CFLAGS) $(LDFLAGS) $< \
|
||||||
$(LIBS) -o $@
|
$(LIBS) -o $@
|
||||||
|
61
README.md
61
README.md
@ -25,14 +25,13 @@ A software and GPU emulated UHD output device plugin for VDR.
|
|||||||
|
|
||||||
o Video decoder CUVID or VAAPI
|
o Video decoder CUVID or VAAPI
|
||||||
o Video output opengl or DRM
|
o Video output opengl or DRM
|
||||||
o Audio FFMpeg / Alsa / Analog
|
o Audio FFMpeg / ALSA / Analog
|
||||||
o Audio FFMpeg / Alsa / Digital
|
o Audio FFMpeg / ALSA / Digital
|
||||||
o Audio FFMpeg / OSS / Analog
|
|
||||||
o HDMI/SPDIF pass-through
|
o HDMI/SPDIF pass-through
|
||||||
o Software volume, compression, normalize and channel resample
|
o Software volume, compression, normalize and channel resample
|
||||||
o VDR ScaleVideo API
|
o VDR ScaleVideo API
|
||||||
o CUDA deinterlacer
|
o CUDA deinterlacer
|
||||||
o Suspend / Dettach
|
o Suspend / Detach
|
||||||
o Support for ambilight
|
o Support for ambilight
|
||||||
o Support for Screencopy
|
o Support for Screencopy
|
||||||
o PIP (Picture-in-Picture) (only for CUVID)
|
o PIP (Picture-in-Picture) (only for CUVID)
|
||||||
@ -83,10 +82,10 @@ You have to adapt the Makefile. There are 3 possible Version that you can build:
|
|||||||
This is for INTEL cards and also uses Vaapi as decoder. It uses the DRM API for output and
|
This is for INTEL cards and also uses Vaapi as decoder. It uses the DRM API for output and
|
||||||
runs without X Server. There are several commandline options to select the resolution and refresh rate.
|
runs without X Server. There are several commandline options to select the resolution and refresh rate.
|
||||||
I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
|
I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
|
||||||
|
|
||||||
Libplacebo API Version >= 113 is needed.
|
Libplacebo API Version >= 113 is needed.
|
||||||
|
|
||||||
|
|
||||||
Install:
|
Install:
|
||||||
--------
|
--------
|
||||||
1a) git
|
1a) git
|
||||||
@ -96,9 +95,6 @@ Install:
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
You can edit Makefile to enable/disable Alsa / OSS
|
|
||||||
support. The default is to autodetect as much as possible.
|
|
||||||
|
|
||||||
You have to start vdr with -P 'softhdcuvid -d :0.0 ..<more option>.. '
|
You have to start vdr with -P 'softhdcuvid -d :0.0 ..<more option>.. '
|
||||||
|
|
||||||
Beginners Guide for libplacebo:
|
Beginners Guide for libplacebo:
|
||||||
@ -125,22 +121,22 @@ Beginners Guide for libplacebo:
|
|||||||
in rare cases.
|
in rare cases.
|
||||||
|
|
||||||
All other settings can be in their default state.
|
All other settings can be in their default state.
|
||||||
|
|
||||||
Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader.
|
Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader.
|
||||||
The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is
|
The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is
|
||||||
provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start
|
provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start
|
||||||
vdr -P 'softhdcuvid -S filmgrain.glsl ...'
|
vdr -P 'softhdcuvid -S filmgrain.glsl ...'
|
||||||
I use KrigBilateral for UV scaling and then adaptive-sharpen for sharpening. This results in a perfect
|
I use KrigBilateral for UV scaling and then adaptive-sharpen for sharpening. This results in a perfect
|
||||||
picture for me.
|
picture for me.
|
||||||
|
|
||||||
You can also use a custon LUT File. It is located in $ConfigDir/shaders/lut/lut.cube. If you provide there
|
You can also use a custon LUT File. It is located in $ConfigDir/shaders/lut/lut.cube. If you provide there
|
||||||
a lut file it will be automaticly used. In the Mainmenue you can switch LUT on and off.
|
a lut file it will be automaticly used. In the Mainmenue you can switch LUT on and off.
|
||||||
|
|
||||||
Konfig Guide for softhddrm Version
|
Konfig Guide for softhddrm Version
|
||||||
----------------------------------
|
----------------------------------
|
||||||
You should set the Monitor Type to HD TV or UHD-HDR TV depending on your TV Set
|
You should set the Monitor Type to HD TV or UHD-HDR TV depending on your TV Set
|
||||||
With softhddrm and a HDR TV Set you can view HDR-HLG content. This is tested with Kernel 5.12 and a Intel NUC.
|
With softhddrm and a HDR TV Set you can view HDR-HLG content. This is tested with Kernel 5.12 and a Intel NUC.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Setup: environment
|
Setup: environment
|
||||||
@ -148,27 +144,17 @@ Setup: environment
|
|||||||
Following is supported:
|
Following is supported:
|
||||||
|
|
||||||
DISPLAY=:0.0
|
DISPLAY=:0.0
|
||||||
x11 display name
|
X11 display name
|
||||||
|
|
||||||
only if alsa is configured
|
ALSA configuration:
|
||||||
ALSA_DEVICE=default
|
ALSA_DEVICE=default
|
||||||
alsa PCM device name
|
ALSA PCM device name
|
||||||
ALSA_PASSTHROUGH_DEVICE=
|
ALSA_PASSTHROUGH_DEVICE=
|
||||||
alsa pass-though (AC-3,E-AC-3,DTS,...) device name
|
ALSA pass-though (AC-3,E-AC-3,DTS,...) device name
|
||||||
ALSA_MIXER=default
|
ALSA_MIXER=default
|
||||||
alsa control device name
|
ALSA control device name
|
||||||
ALSA_MIXER_CHANNEL=PCM
|
ALSA_MIXER_CHANNEL=PCM
|
||||||
alsa control channel name
|
ALSA control channel name
|
||||||
|
|
||||||
only if oss is configured
|
|
||||||
OSS_AUDIODEV=/dev/dsp
|
|
||||||
oss dsp device name
|
|
||||||
OSS_PASSTHROUGHDEV=
|
|
||||||
oss pass-though (AC-3,E-AC-3,DTS,...) device name
|
|
||||||
OSS_MIXERDEV=/dev/mixer
|
|
||||||
oss mixer device name
|
|
||||||
OSS_MIXER_CHANNEL=pcm
|
|
||||||
oss mixer channel name
|
|
||||||
|
|
||||||
Setup: /etc/vdr/setup.conf
|
Setup: /etc/vdr/setup.conf
|
||||||
------
|
------
|
||||||
@ -197,7 +183,7 @@ Setup: /etc/vdr/setup.conf
|
|||||||
(only 0, 1, 4 supported with VA-API)
|
(only 0, 1, 4 supported with VA-API)
|
||||||
|
|
||||||
softhddevice.<res>.SkipChromaDeinterlace = 0
|
softhddevice.<res>.SkipChromaDeinterlace = 0
|
||||||
0 = disabled, 1 = enabled (for slower cards, poor qualität)
|
0 = disabled, 1 = enabled (for slower cards, poor qualit<EFBFBD>t)
|
||||||
|
|
||||||
softhddevice.<res>.InverseTelecine = 0
|
softhddevice.<res>.InverseTelecine = 0
|
||||||
0 = disabled, 1 = enabled
|
0 = disabled, 1 = enabled
|
||||||
@ -336,10 +322,7 @@ Commandline:
|
|||||||
|
|
||||||
Selects audio output module and device.
|
Selects audio output module and device.
|
||||||
"" to disable audio output
|
"" to disable audio output
|
||||||
/... to use oss audio module (if compiled with oss
|
other to use ALSA audio module
|
||||||
support)
|
|
||||||
other to use alsa audio module (if compiled with alsa
|
|
||||||
support)
|
|
||||||
|
|
||||||
SVDRP:
|
SVDRP:
|
||||||
------
|
------
|
||||||
|
@ -1,21 +1,21 @@
|
|||||||
GNU AFFERO GENERAL PUBLIC LICENSE
|
GNU AFFERO GENERAL PUBLIC LICENSE
|
||||||
Version 3, 19 November 2007
|
Version 3, 19 November 2007
|
||||||
|
|
||||||
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
|
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||||
Everyone is permitted to copy and distribute verbatim copies
|
Everyone is permitted to copy and distribute verbatim copies
|
||||||
of this license document, but changing it is not allowed.
|
of this license document, but changing it is not allowed.
|
||||||
|
|
||||||
Preamble
|
Preamble
|
||||||
|
|
||||||
The GNU Affero General Public License is a free, copyleft license
|
The GNU Affero General Public License is a free, copyleft license for
|
||||||
for software and other kinds of works, specifically designed to ensure
|
software and other kinds of works, specifically designed to ensure
|
||||||
cooperation with the community in the case of network server software.
|
cooperation with the community in the case of network server software.
|
||||||
|
|
||||||
The licenses for most software and other practical works are
|
The licenses for most software and other practical works are designed
|
||||||
designed to take away your freedom to share and change the works. By
|
to take away your freedom to share and change the works. By contrast,
|
||||||
contrast, our General Public Licenses are intended to guarantee your
|
our General Public Licenses are intended to guarantee your freedom to
|
||||||
freedom to share and change all versions of a program--to make sure it
|
share and change all versions of a program--to make sure it remains free
|
||||||
remains free software for all its users.
|
software for all its users.
|
||||||
|
|
||||||
When we speak of free software, we are referring to freedom, not
|
When we speak of free software, we are referring to freedom, not
|
||||||
price. Our General Public Licenses are designed to make sure that you
|
price. Our General Public Licenses are designed to make sure that you
|
||||||
@ -60,11 +60,10 @@ modification follow.
|
|||||||
|
|
||||||
0. Definitions.
|
0. Definitions.
|
||||||
|
|
||||||
"This License" refers to version 3 of the GNU Affero General Public
|
"This License" refers to version 3 of the GNU Affero General Public License.
|
||||||
License.
|
|
||||||
|
|
||||||
"Copyright" also means copyright-like laws that apply to other kinds
|
"Copyright" also means copyright-like laws that apply to other kinds of
|
||||||
of works, such as semiconductor masks.
|
works, such as semiconductor masks.
|
||||||
|
|
||||||
"The Program" refers to any copyrightable work licensed under this
|
"The Program" refers to any copyrightable work licensed under this
|
||||||
License. Each licensee is addressed as "you". "Licensees" and
|
License. Each licensee is addressed as "you". "Licensees" and
|
||||||
@ -377,12 +376,12 @@ that material) supplement the terms of this License with terms:
|
|||||||
All other non-permissive additional terms are considered "further
|
All other non-permissive additional terms are considered "further
|
||||||
restrictions" within the meaning of section 10. If the Program as you
|
restrictions" within the meaning of section 10. If the Program as you
|
||||||
received it, or any part of it, contains a notice stating that it is
|
received it, or any part of it, contains a notice stating that it is
|
||||||
governed by this License along with a term that is a further restriction,
|
governed by this License along with a term that is a further
|
||||||
you may remove that term. If a license document contains a further
|
restriction, you may remove that term. If a license document contains
|
||||||
restriction but permits relicensing or conveying under this License, you
|
a further restriction but permits relicensing or conveying under this
|
||||||
may add to a covered work material governed by the terms of that license
|
License, you may add to a covered work material governed by the terms
|
||||||
document, provided that the further restriction does not survive such
|
of that license document, provided that the further restriction does
|
||||||
relicensing or conveying.
|
not survive such relicensing or conveying.
|
||||||
|
|
||||||
If you add terms to a covered work in accord with this section, you
|
If you add terms to a covered work in accord with this section, you
|
||||||
must place, in the relevant source files, a statement of the
|
must place, in the relevant source files, a statement of the
|
||||||
@ -551,34 +550,34 @@ shall include the Corresponding Source for any work covered by version 3
|
|||||||
of the GNU General Public License that is incorporated pursuant to the
|
of the GNU General Public License that is incorporated pursuant to the
|
||||||
following paragraph.
|
following paragraph.
|
||||||
|
|
||||||
Notwithstanding any other provision of this License, you have permission
|
Notwithstanding any other provision of this License, you have
|
||||||
to link or combine any covered work with a work licensed under version 3
|
permission to link or combine any covered work with a work licensed
|
||||||
of the GNU General Public License into a single combined work, and to
|
under version 3 of the GNU General Public License into a single
|
||||||
convey the resulting work. The terms of this License will continue to
|
combined work, and to convey the resulting work. The terms of this
|
||||||
apply to the part which is the covered work, but the work with which it is
|
License will continue to apply to the part which is the covered work,
|
||||||
combined will remain governed by version 3 of the GNU General Public
|
but the work with which it is combined will remain governed by version
|
||||||
License.
|
3 of the GNU General Public License.
|
||||||
|
|
||||||
14. Revised Versions of this License.
|
14. Revised Versions of this License.
|
||||||
|
|
||||||
The Free Software Foundation may publish revised and/or new versions of
|
The Free Software Foundation may publish revised and/or new versions of
|
||||||
the GNU Affero General Public License from time to time. Such new
|
the GNU Affero General Public License from time to time. Such new versions
|
||||||
versions will be similar in spirit to the present version, but may differ
|
will be similar in spirit to the present version, but may differ in detail to
|
||||||
in detail to address new problems or concerns.
|
address new problems or concerns.
|
||||||
|
|
||||||
Each version is given a distinguishing version number. If the
|
Each version is given a distinguishing version number. If the
|
||||||
Program specifies that a certain numbered version of the GNU Affero
|
Program specifies that a certain numbered version of the GNU Affero General
|
||||||
General Public License "or any later version" applies to it, you have
|
Public License "or any later version" applies to it, you have the
|
||||||
the option of following the terms and conditions either of that
|
option of following the terms and conditions either of that numbered
|
||||||
numbered version or of any later version published by the Free
|
version or of any later version published by the Free Software
|
||||||
Software Foundation. If the Program does not specify a version number
|
Foundation. If the Program does not specify a version number of the
|
||||||
of the GNU Affero General Public License, you may choose any version
|
GNU Affero General Public License, you may choose any version ever published
|
||||||
ever published by the Free Software Foundation.
|
by the Free Software Foundation.
|
||||||
|
|
||||||
If the Program specifies that a proxy can decide which future
|
If the Program specifies that a proxy can decide which future
|
||||||
versions of the GNU Affero General Public License can be used, that
|
versions of the GNU Affero General Public License can be used, that proxy's
|
||||||
proxy's public statement of acceptance of a version permanently
|
public statement of acceptance of a version permanently authorizes you
|
||||||
authorizes you to choose that version for the Program.
|
to choose that version for the Program.
|
||||||
|
|
||||||
Later license versions may give you additional or different
|
Later license versions may give you additional or different
|
||||||
permissions. However, no additional obligations are imposed on any
|
permissions. However, no additional obligations are imposed on any
|
||||||
@ -617,9 +616,9 @@ an absolute waiver of all civil liability in connection with the
|
|||||||
Program, unless a warranty or assumption of liability accompanies a
|
Program, unless a warranty or assumption of liability accompanies a
|
||||||
copy of the Program in return for a fee.
|
copy of the Program in return for a fee.
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS
|
END OF TERMS AND CONDITIONS
|
||||||
|
|
||||||
How to Apply These Terms to Your New Programs
|
How to Apply These Terms to Your New Programs
|
||||||
|
|
||||||
If you develop a new program, and you want it to be of the greatest
|
If you develop a new program, and you want it to be of the greatest
|
||||||
possible use to the public, the best way to achieve this is to make it
|
possible use to the public, the best way to achieve this is to make it
|
||||||
@ -634,9 +633,9 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
Copyright (C) <year> <name of author>
|
Copyright (C) <year> <name of author>
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
published by the Free Software Foundation, either version 3 of the
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
License, or (at your option) any later version.
|
(at your option) any later version.
|
||||||
|
|
||||||
This program is distributed in the hope that it will be useful,
|
This program is distributed in the hope that it will be useful,
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
@ -644,7 +643,7 @@ the "copyright" line and a pointer to where the full notice is found.
|
|||||||
GNU Affero General Public License for more details.
|
GNU Affero General Public License for more details.
|
||||||
|
|
||||||
You should have received a copy of the GNU Affero General Public License
|
You should have received a copy of the GNU Affero General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
Also add information on how to contact you by electronic and paper mail.
|
Also add information on how to contact you by electronic and paper mail.
|
||||||
|
|
||||||
@ -659,4 +658,4 @@ specific requirements.
|
|||||||
You should also get your employer (if you work as a programmer) or school,
|
You should also get your employer (if you work as a programmer) or school,
|
||||||
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
if any, to sign a "copyright disclaimer" for the program, if necessary.
|
||||||
For more information on this, and how to apply and follow the GNU AGPL, see
|
For more information on this, and how to apply and follow the GNU AGPL, see
|
||||||
<http://www.gnu.org/licenses/>.
|
<https://www.gnu.org/licenses/>.
|
54
audio.h
54
audio.h
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file audio.h @brief Audio module headerfile
|
/// @file audio.h @brief Audio module headerfile
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -27,41 +27,41 @@
|
|||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
|
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
|
||||||
extern void AudioFlushBuffers(void); ///< flush audio buffers
|
extern void AudioFlushBuffers(void); ///< flush audio buffers
|
||||||
extern void AudioPoller(void); ///< poll audio events/handling
|
extern void AudioPoller(void); ///< poll audio events/handling
|
||||||
extern int AudioFreeBytes(void); ///< free bytes in audio output
|
extern int AudioFreeBytes(void); ///< free bytes in audio output
|
||||||
extern int AudioUsedBytes(void); ///< used bytes in audio output
|
extern int AudioUsedBytes(void); ///< used bytes in audio output
|
||||||
extern int64_t AudioGetDelay(void); ///< get current audio delay
|
extern int64_t AudioGetDelay(void); ///< get current audio delay
|
||||||
extern void AudioSetClock(int64_t); ///< set audio clock base
|
extern void AudioSetClock(int64_t); ///< set audio clock base
|
||||||
extern int64_t AudioGetClock(); ///< get current audio clock
|
extern int64_t AudioGetClock(); ///< get current audio clock
|
||||||
extern void AudioSetVolume(int); ///< set volume
|
extern void AudioSetVolume(int); ///< set volume
|
||||||
extern int AudioSetup(int *, int *, int); ///< setup audio output
|
extern int AudioSetup(int *, int *, int); ///< setup audio output
|
||||||
|
|
||||||
extern void AudioPlay(void); ///< play audio
|
extern void AudioPlay(void); ///< play audio
|
||||||
extern void AudioPause(void); ///< pause audio
|
extern void AudioPause(void); ///< pause audio
|
||||||
|
|
||||||
extern void AudioSetBufferTime(int); ///< set audio buffer time
|
extern void AudioSetBufferTime(int); ///< set audio buffer time
|
||||||
extern void AudioSetSoftvol(int); ///< enable/disable softvol
|
extern void AudioSetSoftvol(int); ///< enable/disable softvol
|
||||||
extern void AudioSetNormalize(int, int); ///< set normalize parameters
|
extern void AudioSetNormalize(int, int); ///< set normalize parameters
|
||||||
extern void AudioSetCompression(int, int); ///< set compression parameters
|
extern void AudioSetCompression(int, int); ///< set compression parameters
|
||||||
extern void AudioSetStereoDescent(int); ///< set stereo loudness descent
|
extern void AudioSetStereoDescent(int); ///< set stereo loudness descent
|
||||||
|
|
||||||
extern void AudioSetDevice(const char *); ///< set PCM audio device
|
extern void AudioSetDevice(const char *); ///< set PCM audio device
|
||||||
|
|
||||||
/// set pass-through device
|
/// set pass-through device
|
||||||
extern void AudioSetPassthroughDevice(const char *);
|
extern void AudioSetPassthroughDevice(const char *);
|
||||||
extern void AudioSetChannel(const char *); ///< set mixer channel
|
extern void AudioSetChannel(const char *); ///< set mixer channel
|
||||||
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
|
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
|
||||||
extern void AudioInit(void); ///< setup audio module
|
extern void AudioInit(void); ///< setup audio module
|
||||||
extern void AudioExit(void); ///< cleanup and exit audio module
|
extern void AudioExit(void); ///< cleanup and exit audio module
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern char AudioAlsaDriverBroken; ///< disable broken driver message
|
extern char AudioAlsaDriverBroken; ///< disable broken driver message
|
||||||
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
||||||
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
|
37
codec.h
37
codec.h
@ -27,16 +27,15 @@
|
|||||||
// Defines
|
// Defines
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
#define CodecPCM 0x01 ///< PCM bit mask
|
#define CodecPCM 0x01 ///< PCM bit mask
|
||||||
#define CodecMPA 0x02 ///< MPA bit mask (planned)
|
#define CodecMPA 0x02 ///< MPA bit mask (planned)
|
||||||
#define CodecAC3 0x04 ///< AC-3 bit mask
|
#define CodecAC3 0x04 ///< AC-3 bit mask
|
||||||
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
|
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
|
||||||
#define CodecDTS 0x10 ///< DTS bit mask (planned)
|
#define CodecDTS 0x10 ///< DTS bit mask (planned)
|
||||||
|
|
||||||
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
|
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
|
||||||
|
|
||||||
enum HWAccelID
|
enum HWAccelID {
|
||||||
{
|
|
||||||
HWACCEL_NONE = 0,
|
HWACCEL_NONE = 0,
|
||||||
HWACCEL_AUTO,
|
HWACCEL_AUTO,
|
||||||
HWACCEL_VDPAU,
|
HWACCEL_VDPAU,
|
||||||
@ -53,19 +52,18 @@ extern AVBufferRef *hw_device_ctx;
|
|||||||
///
|
///
|
||||||
/// Video decoder structure.
|
/// Video decoder structure.
|
||||||
///
|
///
|
||||||
struct _video_decoder_
|
struct _video_decoder_ {
|
||||||
{
|
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
||||||
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
|
||||||
|
|
||||||
int GetFormatDone; ///< flag get format called!
|
int GetFormatDone; ///< flag get format called!
|
||||||
AVCodec *VideoCodec; ///< video codec
|
AVCodec *VideoCodec; ///< video codec
|
||||||
AVCodecContext *VideoCtx; ///< video codec context
|
AVCodecContext *VideoCtx; ///< video codec context
|
||||||
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
int FirstKeyFrame; ///< flag first frame
|
int FirstKeyFrame; ///< flag first frame
|
||||||
// #endif
|
// #endif
|
||||||
// AVFrame *Frame; ///< decoded video frame
|
// AVFrame *Frame; ///< decoded video frame
|
||||||
|
|
||||||
int filter; // flag for deint filter
|
int filter; // flag for deint filter
|
||||||
|
|
||||||
/* hwaccel options */
|
/* hwaccel options */
|
||||||
enum HWAccelID hwaccel_id;
|
enum HWAccelID hwaccel_id;
|
||||||
@ -75,9 +73,9 @@ struct _video_decoder_
|
|||||||
/* hwaccel context */
|
/* hwaccel context */
|
||||||
enum HWAccelID active_hwaccel_id;
|
enum HWAccelID active_hwaccel_id;
|
||||||
void *hwaccel_ctx;
|
void *hwaccel_ctx;
|
||||||
void (*hwaccel_uninit)(AVCodecContext * s);
|
void (*hwaccel_uninit)(AVCodecContext *s);
|
||||||
int (*hwaccel_get_buffer)(AVCodecContext * s, AVFrame * frame, int flags);
|
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
|
||||||
int (*hwaccel_retrieve_data)(AVCodecContext * s, AVFrame * frame);
|
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
|
||||||
enum AVPixelFormat hwaccel_pix_fmt;
|
enum AVPixelFormat hwaccel_pix_fmt;
|
||||||
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
|
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
|
||||||
AVBufferRef *hw_frames_ctx;
|
AVBufferRef *hw_frames_ctx;
|
||||||
@ -87,7 +85,6 @@ struct _video_decoder_
|
|||||||
double cached_hdr_peak;
|
double cached_hdr_peak;
|
||||||
// From VO
|
// From VO
|
||||||
struct mp_hwdec_devices *hwdec_devs;
|
struct mp_hwdec_devices *hwdec_devs;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
260
common.h
260
common.h
@ -19,17 +19,17 @@
|
|||||||
#ifndef MPLAYER_GL_COMMON_H
|
#ifndef MPLAYER_GL_COMMON_H
|
||||||
#define MPLAYER_GL_COMMON_H
|
#define MPLAYER_GL_COMMON_H
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
#if 0
|
#if 0
|
||||||
#include "config.h"
|
|
||||||
#include "common/msg.h"
|
#include "common/msg.h"
|
||||||
|
#include "config.h"
|
||||||
#include "misc/bstr.h"
|
#include "misc/bstr.h"
|
||||||
|
|
||||||
#include "video/out/vo.h"
|
|
||||||
#include "video/csputils.h"
|
#include "video/csputils.h"
|
||||||
#include "video/mp_image.h"
|
#include "video/mp_image.h"
|
||||||
|
#include "video/out/vo.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if HAVE_GL_COCOA
|
#if HAVE_GL_COCOA
|
||||||
@ -53,9 +53,8 @@
|
|||||||
struct GL;
|
struct GL;
|
||||||
typedef struct GL GL;
|
typedef struct GL GL;
|
||||||
|
|
||||||
enum
|
enum {
|
||||||
{
|
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
|
||||||
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
|
|
||||||
MPGL_CAP_FB = (1 << 5),
|
MPGL_CAP_FB = (1 << 5),
|
||||||
MPGL_CAP_VAO = (1 << 6),
|
MPGL_CAP_VAO = (1 << 6),
|
||||||
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
|
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
|
||||||
@ -69,157 +68,158 @@ enum
|
|||||||
MPGL_CAP_ARB_FLOAT = (1 << 19), // GL_ARB_texture_float
|
MPGL_CAP_ARB_FLOAT = (1 << 19), // GL_ARB_texture_float
|
||||||
MPGL_CAP_EXT_CR_HFLOAT = (1 << 20), // GL_EXT_color_buffer_half_float
|
MPGL_CAP_EXT_CR_HFLOAT = (1 << 20), // GL_EXT_color_buffer_half_float
|
||||||
|
|
||||||
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
|
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
|
||||||
};
|
};
|
||||||
|
|
||||||
// E.g. 310 means 3.1
|
// E.g. 310 means 3.1
|
||||||
// Code doesn't have to use the macros; they are for convenience only.
|
// Code doesn't have to use the macros; they are for convenience only.
|
||||||
#define MPGL_VER(major, minor) (((major) * 100) + (minor) * 10)
|
#define MPGL_VER(major, minor) (((major)*100) + (minor)*10)
|
||||||
#define MPGL_VER_GET_MAJOR(ver) ((unsigned)(ver) / 100)
|
#define MPGL_VER_GET_MAJOR(ver) ((unsigned)(ver) / 100)
|
||||||
#define MPGL_VER_GET_MINOR(ver) ((unsigned)(ver) % 100 / 10)
|
#define MPGL_VER_GET_MINOR(ver) ((unsigned)(ver) % 100 / 10)
|
||||||
|
|
||||||
#define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver)
|
#define MPGL_VER_P(ver) MPGL_VER_GET_MAJOR(ver), MPGL_VER_GET_MINOR(ver)
|
||||||
|
|
||||||
void mpgl_load_functions(GL * gl, void *(*getProcAddress)(const GLubyte *), const char *ext2, struct mp_log *log);
|
void mpgl_load_functions(GL *gl, void *(*getProcAddress)(const GLubyte *), const char *ext2, struct mp_log *log);
|
||||||
void mpgl_load_functions2(GL * gl, void *(*get_fn)(void *ctx, const char *n), void *fn_ctx, const char *ext2,
|
void mpgl_load_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n), void *fn_ctx, const char *ext2,
|
||||||
struct mp_log *log);
|
struct mp_log *log);
|
||||||
|
|
||||||
typedef void (GLAPIENTRY * MP_GLDEBUGPROC) (GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *);
|
typedef void(GLAPIENTRY *MP_GLDEBUGPROC)(GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *);
|
||||||
|
|
||||||
// function pointers loaded from the OpenGL library
|
// function pointers loaded from the OpenGL library
|
||||||
struct GL
|
struct GL {
|
||||||
{
|
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
|
||||||
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
|
int es; // es version (e.g. 300), 0 for desktop GL
|
||||||
int es; // es version (e.g. 300), 0 for desktop GL
|
int glsl_version; // e.g. 130 for GLSL 1.30
|
||||||
int glsl_version; // e.g. 130 for GLSL 1.30
|
char *extensions; // Equivalent to GL_EXTENSIONS
|
||||||
char *extensions; // Equivalent to GL_EXTENSIONS
|
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
||||||
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
|
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
||||||
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
|
GLuint main_fb; // framebuffer to render to (normally 0)
|
||||||
GLuint main_fb; // framebuffer to render to (normally 0)
|
|
||||||
|
|
||||||
void (GLAPIENTRY * Viewport) (GLint, GLint, GLsizei, GLsizei);
|
void(GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
|
||||||
void (GLAPIENTRY * Clear) (GLbitfield);
|
void(GLAPIENTRY *Clear)(GLbitfield);
|
||||||
void (GLAPIENTRY * GenTextures) (GLsizei, GLuint *);
|
void(GLAPIENTRY *GenTextures)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY * DeleteTextures) (GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY * ClearColor) (GLclampf, GLclampf, GLclampf, GLclampf);
|
void(GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
|
||||||
void (GLAPIENTRY * Enable) (GLenum);
|
void(GLAPIENTRY *Enable)(GLenum);
|
||||||
void (GLAPIENTRY * Disable) (GLenum);
|
void(GLAPIENTRY *Disable)(GLenum);
|
||||||
const GLubyte *(GLAPIENTRY * GetString) (GLenum);
|
const GLubyte *(GLAPIENTRY *GetString)(GLenum);
|
||||||
void (GLAPIENTRY * BlendFuncSeparate) (GLenum, GLenum, GLenum, GLenum);
|
void(GLAPIENTRY *BlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum);
|
||||||
void (GLAPIENTRY * Flush) (void);
|
void(GLAPIENTRY *Flush)(void);
|
||||||
void (GLAPIENTRY * Finish) (void);
|
void(GLAPIENTRY *Finish)(void);
|
||||||
void (GLAPIENTRY * PixelStorei) (GLenum, GLint);
|
void(GLAPIENTRY *PixelStorei)(GLenum, GLint);
|
||||||
void (GLAPIENTRY * TexImage1D) (GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
void(GLAPIENTRY *TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||||
void (GLAPIENTRY * TexImage2D) (GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
void(GLAPIENTRY *TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||||
void (GLAPIENTRY * TexSubImage2D) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
void(GLAPIENTRY *TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||||
void (GLAPIENTRY * TexParameteri) (GLenum, GLenum, GLint);
|
void(GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint);
|
||||||
void (GLAPIENTRY * GetIntegerv) (GLenum, GLint *);
|
void(GLAPIENTRY *GetIntegerv)(GLenum, GLint *);
|
||||||
void (GLAPIENTRY * ReadPixels) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
|
void(GLAPIENTRY *ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
|
||||||
void (GLAPIENTRY * ReadBuffer) (GLenum);
|
void(GLAPIENTRY *ReadBuffer)(GLenum);
|
||||||
void (GLAPIENTRY * DrawArrays) (GLenum, GLint, GLsizei);
|
void(GLAPIENTRY *DrawArrays)(GLenum, GLint, GLsizei);
|
||||||
GLenum(GLAPIENTRY * GetError) (void);
|
GLenum(GLAPIENTRY *GetError)(void);
|
||||||
void (GLAPIENTRY * GetTexLevelParameteriv) (GLenum, GLint, GLenum, GLint *);
|
void(GLAPIENTRY *GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
|
||||||
void (GLAPIENTRY * Scissor) (GLint, GLint, GLsizei, GLsizei);
|
void(GLAPIENTRY *Scissor)(GLint, GLint, GLsizei, GLsizei);
|
||||||
|
|
||||||
void (GLAPIENTRY * GenBuffers) (GLsizei, GLuint *);
|
void(GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY * DeleteBuffers) (GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY * BindBuffer) (GLenum, GLuint);
|
void(GLAPIENTRY *BindBuffer)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY * BindBufferBase) (GLenum, GLuint, GLuint);
|
void(GLAPIENTRY *BindBufferBase)(GLenum, GLuint, GLuint);
|
||||||
GLvoid *(GLAPIENTRY * MapBufferRange) (GLenum, GLintptr, GLsizeiptr, GLbitfield);
|
GLvoid *(GLAPIENTRY *MapBufferRange)(GLenum, GLintptr, GLsizeiptr, GLbitfield);
|
||||||
GLboolean(GLAPIENTRY * UnmapBuffer) (GLenum);
|
GLboolean(GLAPIENTRY *UnmapBuffer)(GLenum);
|
||||||
void (GLAPIENTRY * BufferData) (GLenum, intptr_t, const GLvoid *, GLenum);
|
void(GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
|
||||||
void (GLAPIENTRY * ActiveTexture) (GLenum);
|
void(GLAPIENTRY *ActiveTexture)(GLenum);
|
||||||
void (GLAPIENTRY * BindTexture) (GLenum, GLuint);
|
void(GLAPIENTRY *BindTexture)(GLenum, GLuint);
|
||||||
int (GLAPIENTRY * SwapInterval) (int);
|
int(GLAPIENTRY *SwapInterval)(int);
|
||||||
void (GLAPIENTRY * TexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum,
|
void(GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum,
|
||||||
const GLvoid *);
|
const GLvoid *);
|
||||||
|
|
||||||
void (GLAPIENTRY * GenVertexArrays) (GLsizei, GLuint *);
|
void(GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY * BindVertexArray) (GLuint);
|
void(GLAPIENTRY *BindVertexArray)(GLuint);
|
||||||
GLint(GLAPIENTRY * GetAttribLocation) (GLuint, const GLchar *);
|
GLint(GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
|
||||||
void (GLAPIENTRY * EnableVertexAttribArray) (GLuint);
|
void(GLAPIENTRY *EnableVertexAttribArray)(GLuint);
|
||||||
void (GLAPIENTRY * DisableVertexAttribArray) (GLuint);
|
void(GLAPIENTRY *DisableVertexAttribArray)(GLuint);
|
||||||
void (GLAPIENTRY * VertexAttribPointer) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
|
void(GLAPIENTRY *VertexAttribPointer)(GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
|
||||||
void (GLAPIENTRY * DeleteVertexArrays) (GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteVertexArrays)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY * UseProgram) (GLuint);
|
void(GLAPIENTRY *UseProgram)(GLuint);
|
||||||
GLint(GLAPIENTRY * GetUniformLocation) (GLuint, const GLchar *);
|
GLint(GLAPIENTRY *GetUniformLocation)(GLuint, const GLchar *);
|
||||||
void (GLAPIENTRY * CompileShader) (GLuint);
|
void(GLAPIENTRY *CompileShader)(GLuint);
|
||||||
GLuint(GLAPIENTRY * CreateProgram) (void);
|
GLuint(GLAPIENTRY *CreateProgram)(void);
|
||||||
GLuint(GLAPIENTRY * CreateShader) (GLenum);
|
GLuint(GLAPIENTRY *CreateShader)(GLenum);
|
||||||
void (GLAPIENTRY * ShaderSource) (GLuint, GLsizei, const GLchar **, const GLint *);
|
void(GLAPIENTRY *ShaderSource)(GLuint, GLsizei, const GLchar **, const GLint *);
|
||||||
void (GLAPIENTRY * LinkProgram) (GLuint);
|
void(GLAPIENTRY *LinkProgram)(GLuint);
|
||||||
void (GLAPIENTRY * AttachShader) (GLuint, GLuint);
|
void(GLAPIENTRY *AttachShader)(GLuint, GLuint);
|
||||||
void (GLAPIENTRY * DeleteShader) (GLuint);
|
void(GLAPIENTRY *DeleteShader)(GLuint);
|
||||||
void (GLAPIENTRY * DeleteProgram) (GLuint);
|
void(GLAPIENTRY *DeleteProgram)(GLuint);
|
||||||
void (GLAPIENTRY * GetShaderInfoLog) (GLuint, GLsizei, GLsizei *, GLchar *);
|
void(GLAPIENTRY *GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
||||||
void (GLAPIENTRY * GetShaderiv) (GLuint, GLenum, GLint *);
|
void(GLAPIENTRY *GetShaderiv)(GLuint, GLenum, GLint *);
|
||||||
void (GLAPIENTRY * GetProgramInfoLog) (GLuint, GLsizei, GLsizei *, GLchar *);
|
void(GLAPIENTRY *GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
|
||||||
void (GLAPIENTRY * GetProgramiv) (GLenum, GLenum, GLint *);
|
void(GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *);
|
||||||
const GLubyte *(GLAPIENTRY * GetStringi) (GLenum, GLuint);
|
const GLubyte *(GLAPIENTRY *GetStringi)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY * BindAttribLocation) (GLuint, GLuint, const GLchar *);
|
void(GLAPIENTRY *BindAttribLocation)(GLuint, GLuint, const GLchar *);
|
||||||
void (GLAPIENTRY * BindFramebuffer) (GLenum, GLuint);
|
void(GLAPIENTRY *BindFramebuffer)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY * GenFramebuffers) (GLsizei, GLuint *);
|
void(GLAPIENTRY *GenFramebuffers)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY * DeleteFramebuffers) (GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteFramebuffers)(GLsizei, const GLuint *);
|
||||||
GLenum(GLAPIENTRY * CheckFramebufferStatus) (GLenum);
|
GLenum(GLAPIENTRY *CheckFramebufferStatus)(GLenum);
|
||||||
void (GLAPIENTRY * FramebufferTexture2D) (GLenum, GLenum, GLenum, GLuint, GLint);
|
void(GLAPIENTRY *FramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint, GLint);
|
||||||
void (GLAPIENTRY * BlitFramebuffer) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
|
void(GLAPIENTRY *BlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
|
||||||
void (GLAPIENTRY * GetFramebufferAttachmentParameteriv) (GLenum, GLenum, GLenum, GLint *);
|
void(GLAPIENTRY *GetFramebufferAttachmentParameteriv)(GLenum, GLenum, GLenum, GLint *);
|
||||||
|
|
||||||
void (GLAPIENTRY * Uniform1f) (GLint, GLfloat);
|
void(GLAPIENTRY *Uniform1f)(GLint, GLfloat);
|
||||||
void (GLAPIENTRY * Uniform2f) (GLint, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform2f)(GLint, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY * Uniform3f) (GLint, GLfloat, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY * Uniform4f) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
void(GLAPIENTRY *Uniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
|
||||||
void (GLAPIENTRY * Uniform1i) (GLint, GLint);
|
void(GLAPIENTRY *Uniform1i)(GLint, GLint);
|
||||||
void (GLAPIENTRY * UniformMatrix2fv) (GLint, GLsizei, GLboolean, const GLfloat *);
|
void(GLAPIENTRY *UniformMatrix2fv)(GLint, GLsizei, GLboolean, const GLfloat *);
|
||||||
void (GLAPIENTRY * UniformMatrix3fv) (GLint, GLsizei, GLboolean, const GLfloat *);
|
void(GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *);
|
||||||
|
|
||||||
void (GLAPIENTRY * InvalidateFramebuffer) (GLenum, GLsizei, const GLenum *);
|
void(GLAPIENTRY *InvalidateFramebuffer)(GLenum, GLsizei, const GLenum *);
|
||||||
|
|
||||||
GLsync(GLAPIENTRY * FenceSync) (GLenum, GLbitfield);
|
GLsync(GLAPIENTRY *FenceSync)(GLenum, GLbitfield);
|
||||||
GLenum(GLAPIENTRY * ClientWaitSync) (GLsync, GLbitfield, GLuint64);
|
GLenum(GLAPIENTRY *ClientWaitSync)(GLsync, GLbitfield, GLuint64);
|
||||||
void (GLAPIENTRY * DeleteSync) (GLsync sync);
|
void(GLAPIENTRY *DeleteSync)(GLsync sync);
|
||||||
|
|
||||||
void (GLAPIENTRY * GenQueries) (GLsizei, GLuint *);
|
void(GLAPIENTRY *GenQueries)(GLsizei, GLuint *);
|
||||||
void (GLAPIENTRY * DeleteQueries) (GLsizei, const GLuint *);
|
void(GLAPIENTRY *DeleteQueries)(GLsizei, const GLuint *);
|
||||||
void (GLAPIENTRY * BeginQuery) (GLenum, GLuint);
|
void(GLAPIENTRY *BeginQuery)(GLenum, GLuint);
|
||||||
void (GLAPIENTRY * EndQuery) (GLenum);
|
void(GLAPIENTRY *EndQuery)(GLenum);
|
||||||
void (GLAPIENTRY * QueryCounter) (GLuint, GLenum);
|
void(GLAPIENTRY *QueryCounter)(GLuint, GLenum);
|
||||||
GLboolean(GLAPIENTRY * IsQuery) (GLuint);
|
GLboolean(GLAPIENTRY *IsQuery)(GLuint);
|
||||||
void (GLAPIENTRY * GetQueryObjectiv) (GLuint, GLenum, GLint *);
|
void(GLAPIENTRY *GetQueryObjectiv)(GLuint, GLenum, GLint *);
|
||||||
void (GLAPIENTRY * GetQueryObjecti64v) (GLuint, GLenum, GLint64 *);
|
void(GLAPIENTRY *GetQueryObjecti64v)(GLuint, GLenum, GLint64 *);
|
||||||
void (GLAPIENTRY * GetQueryObjectuiv) (GLuint, GLenum, GLuint *);
|
void(GLAPIENTRY *GetQueryObjectuiv)(GLuint, GLenum, GLuint *);
|
||||||
void (GLAPIENTRY * GetQueryObjectui64v) (GLuint, GLenum, GLuint64 *);
|
void(GLAPIENTRY *GetQueryObjectui64v)(GLuint, GLenum, GLuint64 *);
|
||||||
|
|
||||||
void (GLAPIENTRY * VDPAUInitNV) (const GLvoid *, const GLvoid *);
|
void(GLAPIENTRY *VDPAUInitNV)(const GLvoid *, const GLvoid *);
|
||||||
void (GLAPIENTRY * VDPAUFiniNV) (void);
|
void(GLAPIENTRY *VDPAUFiniNV)(void);
|
||||||
GLvdpauSurfaceNV(GLAPIENTRY * VDPAURegisterOutputSurfaceNV)
|
GLvdpauSurfaceNV(GLAPIENTRY *VDPAURegisterOutputSurfaceNV)(GLvoid *, GLenum, GLsizei, const GLuint *);
|
||||||
(GLvoid *, GLenum, GLsizei, const GLuint *);
|
GLvdpauSurfaceNV(GLAPIENTRY *VDPAURegisterVideoSurfaceNV)(GLvoid *, GLenum, GLsizei, const GLuint *);
|
||||||
GLvdpauSurfaceNV(GLAPIENTRY * VDPAURegisterVideoSurfaceNV)
|
void(GLAPIENTRY *VDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV);
|
||||||
(GLvoid *, GLenum, GLsizei, const GLuint *);
|
void(GLAPIENTRY *VDPAUSurfaceAccessNV)(GLvdpauSurfaceNV, GLenum);
|
||||||
void (GLAPIENTRY * VDPAUUnregisterSurfaceNV) (GLvdpauSurfaceNV);
|
void(GLAPIENTRY *VDPAUMapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
||||||
void (GLAPIENTRY * VDPAUSurfaceAccessNV) (GLvdpauSurfaceNV, GLenum);
|
void(GLAPIENTRY *VDPAUUnmapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
|
||||||
void (GLAPIENTRY * VDPAUMapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV *);
|
|
||||||
void (GLAPIENTRY * VDPAUUnmapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV *);
|
|
||||||
|
|
||||||
#if HAVE_GL_WIN32
|
#if HAVE_GL_WIN32
|
||||||
// The HANDLE type might not be present on non-Win32
|
// The HANDLE type might not be present on non-Win32
|
||||||
BOOL(GLAPIENTRY * DXSetResourceShareHandleNV) (void *dxObject, HANDLE shareHandle);
|
BOOL(GLAPIENTRY *DXSetResourceShareHandleNV)
|
||||||
HANDLE(GLAPIENTRY * DXOpenDeviceNV) (void *dxDevice);
|
(void *dxObject, HANDLE shareHandle);
|
||||||
BOOL(GLAPIENTRY * DXCloseDeviceNV) (HANDLE hDevice);
|
HANDLE(GLAPIENTRY *DXOpenDeviceNV)(void *dxDevice);
|
||||||
HANDLE(GLAPIENTRY * DXRegisterObjectNV) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
BOOL(GLAPIENTRY *DXCloseDeviceNV)(HANDLE hDevice);
|
||||||
BOOL(GLAPIENTRY * DXUnregisterObjectNV) (HANDLE hDevice, HANDLE hObject);
|
HANDLE(GLAPIENTRY *DXRegisterObjectNV)
|
||||||
BOOL(GLAPIENTRY * DXLockObjectsNV) (HANDLE hDevice, GLint count, HANDLE * hObjects);
|
(HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
|
||||||
BOOL(GLAPIENTRY * DXUnlockObjectsNV) (HANDLE hDevice, GLint count, HANDLE * hObjects);
|
BOOL(GLAPIENTRY *DXUnregisterObjectNV)(HANDLE hDevice, HANDLE hObject);
|
||||||
|
BOOL(GLAPIENTRY *DXLockObjectsNV)
|
||||||
|
(HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||||
|
BOOL(GLAPIENTRY *DXUnlockObjectsNV)
|
||||||
|
(HANDLE hDevice, GLint count, HANDLE *hObjects);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
GLint(GLAPIENTRY * GetVideoSync) (GLuint *);
|
GLint(GLAPIENTRY *GetVideoSync)(GLuint *);
|
||||||
GLint(GLAPIENTRY * WaitVideoSync) (GLint, GLint, unsigned int *);
|
GLint(GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);
|
||||||
|
|
||||||
void (GLAPIENTRY * GetTranslatedShaderSourceANGLE) (GLuint, GLsizei, GLsizei *, GLchar * source);
|
void(GLAPIENTRY *GetTranslatedShaderSourceANGLE)(GLuint, GLsizei, GLsizei *, GLchar *source);
|
||||||
|
|
||||||
void (GLAPIENTRY * DebugMessageCallback) (MP_GLDEBUGPROC callback, const void *userParam);
|
void(GLAPIENTRY *DebugMessageCallback)(MP_GLDEBUGPROC callback, const void *userParam);
|
||||||
|
|
||||||
void *(GLAPIENTRY * MPGetNativeDisplay) (const char *name);
|
void *(GLAPIENTRY *MPGetNativeDisplay)(const char *name);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* MPLAYER_GL_COMMON_H */
|
#endif /* MPLAYER_GL_COMMON_H */
|
||||||
|
384
drm.c
384
drm.c
@ -1,30 +1,26 @@
|
|||||||
#include <unistd.h>
|
#include <drm_fourcc.h>
|
||||||
#include <gbm.h>
|
#include <gbm.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
#include <xf86drm.h>
|
#include <unistd.h>
|
||||||
#include <xf86drmMode.h>
|
|
||||||
#include <drm_fourcc.h>
|
|
||||||
#include <xf86drm.h>
|
#include <xf86drm.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
|
|
||||||
#define DRM_DEBUG
|
#define DRM_DEBUG
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// DRM
|
// DRM
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
struct _Drm_Render_
|
struct _Drm_Render_ {
|
||||||
{
|
|
||||||
int fd_drm;
|
int fd_drm;
|
||||||
drmModeModeInfo mode;
|
drmModeModeInfo mode;
|
||||||
drmModeCrtc *saved_crtc;
|
drmModeCrtc *saved_crtc;
|
||||||
// drmEventContext ev;
|
// drmEventContext ev;
|
||||||
int bpp;
|
int bpp;
|
||||||
uint32_t connector_id, crtc_id, video_plane;
|
uint32_t connector_id, crtc_id, video_plane;
|
||||||
uint32_t hdr_metadata;
|
uint32_t hdr_metadata;
|
||||||
uint32_t mmWidth,mmHeight; // Size in mm
|
uint32_t mmWidth, mmHeight; // Size in mm
|
||||||
uint32_t hdr_blob_id;
|
uint32_t hdr_blob_id;
|
||||||
|
|
||||||
};
|
};
|
||||||
typedef struct _Drm_Render_ VideoRender;
|
typedef struct _Drm_Render_ VideoRender;
|
||||||
|
|
||||||
@ -46,10 +42,7 @@ struct type_name {
|
|||||||
const char *name;
|
const char *name;
|
||||||
};
|
};
|
||||||
|
|
||||||
static const char *util_lookup_type_name(unsigned int type,
|
static const char *util_lookup_type_name(unsigned int type, const struct type_name *table, unsigned int count) {
|
||||||
const struct type_name *table,
|
|
||||||
unsigned int count)
|
|
||||||
{
|
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
@ -60,41 +53,36 @@ static const char *util_lookup_type_name(unsigned int type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct type_name connector_type_names[] = {
|
static const struct type_name connector_type_names[] = {
|
||||||
{ DRM_MODE_CONNECTOR_Unknown, "unknown" },
|
{DRM_MODE_CONNECTOR_Unknown, "unknown"},
|
||||||
{ DRM_MODE_CONNECTOR_VGA, "VGA" },
|
{DRM_MODE_CONNECTOR_VGA, "VGA"},
|
||||||
{ DRM_MODE_CONNECTOR_DVII, "DVI-I" },
|
{DRM_MODE_CONNECTOR_DVII, "DVI-I"},
|
||||||
{ DRM_MODE_CONNECTOR_DVID, "DVI-D" },
|
{DRM_MODE_CONNECTOR_DVID, "DVI-D"},
|
||||||
{ DRM_MODE_CONNECTOR_DVIA, "DVI-A" },
|
{DRM_MODE_CONNECTOR_DVIA, "DVI-A"},
|
||||||
{ DRM_MODE_CONNECTOR_Composite, "composite" },
|
{DRM_MODE_CONNECTOR_Composite, "composite"},
|
||||||
{ DRM_MODE_CONNECTOR_SVIDEO, "s-video" },
|
{DRM_MODE_CONNECTOR_SVIDEO, "s-video"},
|
||||||
{ DRM_MODE_CONNECTOR_LVDS, "LVDS" },
|
{DRM_MODE_CONNECTOR_LVDS, "LVDS"},
|
||||||
{ DRM_MODE_CONNECTOR_Component, "component" },
|
{DRM_MODE_CONNECTOR_Component, "component"},
|
||||||
{ DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN" },
|
{DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN"},
|
||||||
{ DRM_MODE_CONNECTOR_DisplayPort, "DP" },
|
{DRM_MODE_CONNECTOR_DisplayPort, "DP"},
|
||||||
{ DRM_MODE_CONNECTOR_HDMIA, "HDMI-A" },
|
{DRM_MODE_CONNECTOR_HDMIA, "HDMI-A"},
|
||||||
{ DRM_MODE_CONNECTOR_HDMIB, "HDMI-B" },
|
{DRM_MODE_CONNECTOR_HDMIB, "HDMI-B"},
|
||||||
{ DRM_MODE_CONNECTOR_TV, "TV" },
|
{DRM_MODE_CONNECTOR_TV, "TV"},
|
||||||
{ DRM_MODE_CONNECTOR_eDP, "eDP" },
|
{DRM_MODE_CONNECTOR_eDP, "eDP"},
|
||||||
{ DRM_MODE_CONNECTOR_VIRTUAL, "Virtual" },
|
{DRM_MODE_CONNECTOR_VIRTUAL, "Virtual"},
|
||||||
{ DRM_MODE_CONNECTOR_DSI, "DSI" },
|
{DRM_MODE_CONNECTOR_DSI, "DSI"},
|
||||||
{ DRM_MODE_CONNECTOR_DPI, "DPI" },
|
{DRM_MODE_CONNECTOR_DPI, "DPI"},
|
||||||
};
|
};
|
||||||
|
|
||||||
const char *util_lookup_connector_type_name(unsigned int type)
|
const char *util_lookup_connector_type_name(unsigned int type) {
|
||||||
{
|
return util_lookup_type_name(type, connector_type_names, ARRAY_SIZE(connector_type_names));
|
||||||
return util_lookup_type_name(type, connector_type_names,
|
|
||||||
ARRAY_SIZE(connector_type_names));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t GetPropertyValue(int fd_drm, uint32_t objectID,
|
static uint64_t GetPropertyValue(int fd_drm, uint32_t objectID, uint32_t objectType, const char *propName) {
|
||||||
uint32_t objectType, const char *propName)
|
|
||||||
{
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
uint64_t value = 0;
|
uint64_t value = 0;
|
||||||
drmModePropertyPtr Prop;
|
drmModePropertyPtr Prop;
|
||||||
drmModeObjectPropertiesPtr objectProps =
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
|
||||||
|
|
||||||
for (i = 0; i < objectProps->count_props; i++) {
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
@ -115,20 +103,16 @@ static uint64_t GetPropertyValue(int fd_drm, uint32_t objectID,
|
|||||||
|
|
||||||
#ifdef DRM_DEBUG
|
#ifdef DRM_DEBUG
|
||||||
if (!found)
|
if (!found)
|
||||||
fprintf(stderr, "GetPropertyValue: Unable to find value for property \'%s\'.\n",
|
fprintf(stderr, "GetPropertyValue: Unable to find value for property \'%s\'.\n", propName);
|
||||||
propName);
|
|
||||||
#endif
|
#endif
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
static uint32_t GetPropertyID(int fd_drm, uint32_t objectID,
|
static uint32_t GetPropertyID(int fd_drm, uint32_t objectID, uint32_t objectType, const char *propName) {
|
||||||
uint32_t objectType, const char *propName)
|
|
||||||
{
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
uint32_t value = -1;
|
uint32_t value = -1;
|
||||||
drmModePropertyPtr Prop;
|
drmModePropertyPtr Prop;
|
||||||
drmModeObjectPropertiesPtr objectProps =
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
|
||||||
|
|
||||||
for (i = 0; i < objectProps->count_props; i++) {
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
@ -146,24 +130,21 @@ static uint32_t GetPropertyID(int fd_drm, uint32_t objectID,
|
|||||||
|
|
||||||
#ifdef DRM_DEBUG
|
#ifdef DRM_DEBUG
|
||||||
if (!found)
|
if (!found)
|
||||||
Debug(3,"GetPropertyValue: Unable to find ID for property \'%s\'.\n",propName);
|
Debug(3, "GetPropertyValue: Unable to find ID for property \'%s\'.\n", propName);
|
||||||
#endif
|
#endif
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int SetPropertyRequest(drmModeAtomicReqPtr ModeReq, int fd_drm,
|
static int SetPropertyRequest(drmModeAtomicReqPtr ModeReq, int fd_drm, uint32_t objectID, uint32_t objectType,
|
||||||
uint32_t objectID, uint32_t objectType,
|
const char *propName, uint64_t value) {
|
||||||
const char *propName, uint64_t value)
|
|
||||||
{
|
|
||||||
uint32_t i;
|
uint32_t i;
|
||||||
uint64_t id = 0;
|
uint64_t id = 0;
|
||||||
drmModePropertyPtr Prop;
|
drmModePropertyPtr Prop;
|
||||||
drmModeObjectPropertiesPtr objectProps =
|
drmModeObjectPropertiesPtr objectProps = drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
||||||
drmModeObjectGetProperties(fd_drm, objectID, objectType);
|
|
||||||
|
|
||||||
for (i = 0; i < objectProps->count_props; i++) {
|
for (i = 0; i < objectProps->count_props; i++) {
|
||||||
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
if ((Prop = drmModeGetProperty(fd_drm, objectProps->props[i])) == NULL)
|
||||||
printf( "SetPropertyRequest: Unable to query property.\n");
|
printf("SetPropertyRequest: Unable to query property.\n");
|
||||||
|
|
||||||
if (strcmp(propName, Prop->name) == 0) {
|
if (strcmp(propName, Prop->name) == 0) {
|
||||||
id = Prop->prop_id;
|
id = Prop->prop_id;
|
||||||
@ -177,15 +158,13 @@ static int SetPropertyRequest(drmModeAtomicReqPtr ModeReq, int fd_drm,
|
|||||||
drmModeFreeObjectProperties(objectProps);
|
drmModeFreeObjectProperties(objectProps);
|
||||||
|
|
||||||
if (id == 0)
|
if (id == 0)
|
||||||
printf( "SetPropertyRequest: Unable to find value for property \'%s\'.\n",
|
printf("SetPropertyRequest: Unable to find value for property \'%s\'.\n", propName);
|
||||||
propName);
|
|
||||||
|
|
||||||
return drmModeAtomicAddProperty(ModeReq, objectID, id, value);
|
return drmModeAtomicAddProperty(ModeReq, objectID, id, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void CuvidSetVideoMode(void);
|
static void CuvidSetVideoMode(void);
|
||||||
void set_video_mode(int width, int height)
|
void set_video_mode(int width, int height) {
|
||||||
{
|
|
||||||
drmModeConnector *connector;
|
drmModeConnector *connector;
|
||||||
drmModeModeInfo *mode;
|
drmModeModeInfo *mode;
|
||||||
int ii;
|
int ii;
|
||||||
@ -194,29 +173,25 @@ void set_video_mode(int width, int height)
|
|||||||
connector = drmModeGetConnector(render->fd_drm, render->connector_id);
|
connector = drmModeGetConnector(render->fd_drm, render->connector_id);
|
||||||
for (ii = 0; ii < connector->count_modes; ii++) {
|
for (ii = 0; ii < connector->count_modes; ii++) {
|
||||||
mode = &connector->modes[ii];
|
mode = &connector->modes[ii];
|
||||||
printf("Mode %d %dx%d Rate %d\n",ii,mode->hdisplay,mode->vdisplay,mode->vrefresh);
|
printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
if (width == mode->hdisplay &&
|
if (width == mode->hdisplay && height == mode->vdisplay && mode->vrefresh == DRMRefresh &&
|
||||||
height == mode->vdisplay &&
|
render->mode.hdisplay != width && render->mode.vdisplay != height &&
|
||||||
mode->vrefresh == DRMRefresh &&
|
!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
render->mode.hdisplay != width &&
|
|
||||||
render->mode.vdisplay != height &&
|
|
||||||
!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
|
||||||
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
VideoWindowWidth = mode->hdisplay;
|
VideoWindowWidth = mode->hdisplay;
|
||||||
VideoWindowHeight = mode->vdisplay;
|
VideoWindowHeight = mode->vdisplay;
|
||||||
eglDestroySurface (eglDisplay, eglSurface);
|
eglDestroySurface(eglDisplay, eglSurface);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
gbm_surface_destroy (gbm.surface);
|
gbm_surface_destroy(gbm.surface);
|
||||||
InitBo(render->bpp);
|
InitBo(render->bpp);
|
||||||
CuvidSetVideoMode();
|
CuvidSetVideoMode();
|
||||||
Debug(3,"Set new mode %d:%d\n",mode->hdisplay,mode->vdisplay);
|
Debug(3, "Set new mode %d:%d\n", mode->hdisplay, mode->vdisplay);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int FindDevice(VideoRender * render)
|
static int FindDevice(VideoRender *render) {
|
||||||
{
|
|
||||||
drmVersion *version;
|
drmVersion *version;
|
||||||
drmModeRes *resources;
|
drmModeRes *resources;
|
||||||
drmModeConnector *connector;
|
drmModeConnector *connector;
|
||||||
@ -228,7 +203,7 @@ static int FindDevice(VideoRender * render)
|
|||||||
uint32_t j, k;
|
uint32_t j, k;
|
||||||
uint64_t has_dumb;
|
uint64_t has_dumb;
|
||||||
uint64_t has_prime;
|
uint64_t has_prime;
|
||||||
int i,ii=0;
|
int i, ii = 0;
|
||||||
char connectorstr[10];
|
char connectorstr[10];
|
||||||
int found = 0;
|
int found = 0;
|
||||||
#ifdef RASPI
|
#ifdef RASPI
|
||||||
@ -240,30 +215,27 @@ static int FindDevice(VideoRender * render)
|
|||||||
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n");
|
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n");
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = drmSetMaster(render->fd_drm);
|
int ret = drmSetMaster(render->fd_drm);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
|
||||||
drm_magic_t magic;
|
drm_magic_t magic;
|
||||||
|
|
||||||
ret = drmGetMagic(render->fd_drm, &magic);
|
ret = drmGetMagic(render->fd_drm, &magic);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
Debug(3, "drm:%s - failed to get drm magic: %s\n", __FUNCTION__, strerror(errno));
|
||||||
Debug(3, "drm:%s - failed to get drm magic: %s\n", __FUNCTION__, strerror(errno));
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = drmAuthMagic(render->fd_drm, magic);
|
ret = drmAuthMagic(render->fd_drm, magic);
|
||||||
if (ret < 0)
|
if (ret < 0) {
|
||||||
{
|
Debug(3, "drm:%s - failed to authorize drm magic: %s\n", __FUNCTION__, strerror(errno));
|
||||||
Debug(3, "drm:%s - failed to authorize drm magic: %s\n", __FUNCTION__, strerror(errno));
|
return -1;
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
version = drmGetVersion(render->fd_drm);
|
version = drmGetVersion(render->fd_drm);
|
||||||
fprintf(stderr, "FindDevice: open /dev/dri/card0: %s\n", version->name);
|
fprintf(stderr, "FindDevice: open /dev/dri/card0: %s\n", version->name);
|
||||||
|
|
||||||
// check capability
|
// check capability
|
||||||
if (drmGetCap(render->fd_drm, DRM_CAP_DUMB_BUFFER, &has_dumb) < 0 || has_dumb == 0)
|
if (drmGetCap(render->fd_drm, DRM_CAP_DUMB_BUFFER, &has_dumb) < 0 || has_dumb == 0)
|
||||||
@ -284,15 +256,14 @@ static int FindDevice(VideoRender * render)
|
|||||||
if (drmGetCap(render->fd_drm, DRM_PRIME_CAP_IMPORT, &has_prime) < 0)
|
if (drmGetCap(render->fd_drm, DRM_PRIME_CAP_IMPORT, &has_prime) < 0)
|
||||||
fprintf(stderr, "FindDevice: DRM_PRIME_CAP_IMPORT not available.\n");
|
fprintf(stderr, "FindDevice: DRM_PRIME_CAP_IMPORT not available.\n");
|
||||||
|
|
||||||
if ((resources = drmModeGetResources(render->fd_drm)) == NULL){
|
if ((resources = drmModeGetResources(render->fd_drm)) == NULL) {
|
||||||
fprintf(stderr, "FindDevice: cannot retrieve DRM resources (%d): %m\n", errno);
|
fprintf(stderr, "FindDevice: cannot retrieve DRM resources (%d): %m\n", errno);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
Debug(3,"[FindDevice] DRM have %i connectors, %i crtcs, %i encoders\n",
|
Debug(3, "[FindDevice] DRM have %i connectors, %i crtcs, %i encoders\n", resources->count_connectors,
|
||||||
resources->count_connectors, resources->count_crtcs,
|
resources->count_crtcs, resources->count_encoders);
|
||||||
resources->count_encoders);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// find all available connectors
|
// find all available connectors
|
||||||
@ -303,49 +274,49 @@ static int FindDevice(VideoRender * render)
|
|||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(connectorstr,"%s-%u",util_lookup_connector_type_name(connector->connector_type),connector->connector_type_id);
|
sprintf(connectorstr, "%s-%u", util_lookup_connector_type_name(connector->connector_type),
|
||||||
printf("Connector >%s< is %sconnected\n",connectorstr,connector->connection == DRM_MODE_CONNECTED?"":"not ");
|
connector->connector_type_id);
|
||||||
if (DRMConnector && strcmp(DRMConnector,connectorstr))
|
printf("Connector >%s< is %sconnected\n", connectorstr,
|
||||||
|
connector->connection == DRM_MODE_CONNECTED ? "" : "not ");
|
||||||
|
if (DRMConnector && strcmp(DRMConnector, connectorstr))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (connector->connection == DRM_MODE_CONNECTED && connector->count_modes > 0) {
|
if (connector->connection == DRM_MODE_CONNECTED && connector->count_modes > 0) {
|
||||||
float aspect = (float)connector->mmWidth / (float)connector->mmHeight;
|
float aspect = (float)connector->mmWidth / (float)connector->mmHeight;
|
||||||
if ((aspect > 1.70) && (aspect < 1.85)) {
|
if ((aspect > 1.70) && (aspect < 1.85)) {
|
||||||
render->mmHeight = 90;
|
render->mmHeight = 90;
|
||||||
render->mmWidth = 160;
|
render->mmWidth = 160;
|
||||||
} else {
|
} else {
|
||||||
render->mmHeight = connector->mmHeight;
|
render->mmHeight = connector->mmHeight;
|
||||||
render->mmWidth = connector->mmWidth;
|
render->mmWidth = connector->mmWidth;
|
||||||
}
|
}
|
||||||
render->connector_id = connector->connector_id;
|
render->connector_id = connector->connector_id;
|
||||||
// FIXME: use default encoder/crtc pair
|
// FIXME: use default encoder/crtc pair
|
||||||
if ((encoder = drmModeGetEncoder(render->fd_drm, connector->encoder_id)) == NULL){
|
if ((encoder = drmModeGetEncoder(render->fd_drm, connector->encoder_id)) == NULL) {
|
||||||
fprintf(stderr, "FindDevice: cannot retrieve encoder (%d): %m\n", errno);
|
fprintf(stderr, "FindDevice: cannot retrieve encoder (%d): %m\n", errno);
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
render->crtc_id = encoder->crtc_id;
|
render->crtc_id = encoder->crtc_id;
|
||||||
|
|
||||||
render->hdr_metadata = GetPropertyID(render->fd_drm, connector->connector_id,
|
render->hdr_metadata = GetPropertyID(render->fd_drm, connector->connector_id, DRM_MODE_OBJECT_CONNECTOR,
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "HDR_OUTPUT_METADATA");
|
"HDR_OUTPUT_METADATA");
|
||||||
printf("ID %d of METADATA in Connector %d connected %d\n",render->hdr_metadata,connector->connector_id,connector->connection);
|
printf("ID %d of METADATA in Connector %d connected %d\n", render->hdr_metadata, connector->connector_id,
|
||||||
|
connector->connection);
|
||||||
|
|
||||||
memcpy(&render->mode, &connector->modes[0], sizeof(drmModeModeInfo)); // set fallback
|
memcpy(&render->mode, &connector->modes[0], sizeof(drmModeModeInfo)); // set fallback
|
||||||
// search Modes for Connector
|
// search Modes for Connector
|
||||||
for (ii = 0; ii < connector->count_modes; ii++) {
|
for (ii = 0; ii < connector->count_modes; ii++) {
|
||||||
mode = &connector->modes[ii];
|
mode = &connector->modes[ii];
|
||||||
|
|
||||||
printf("Mode %d %dx%d Rate %d\n",ii,mode->hdisplay,mode->vdisplay,mode->vrefresh);
|
printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
|
||||||
|
|
||||||
if (VideoWindowWidth && VideoWindowHeight) { // preset by command line
|
if (VideoWindowWidth && VideoWindowHeight) { // preset by command line
|
||||||
if (VideoWindowWidth == mode->hdisplay &&
|
if (VideoWindowWidth == mode->hdisplay && VideoWindowHeight == mode->vdisplay &&
|
||||||
VideoWindowHeight == mode->vdisplay &&
|
mode->vrefresh == DRMRefresh && !(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
mode->vrefresh == DRMRefresh &&
|
|
||||||
!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
|
||||||
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
if (!(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
|
||||||
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
memcpy(&render->mode, mode, sizeof(drmModeModeInfo));
|
||||||
VideoWindowWidth = mode->hdisplay;
|
VideoWindowWidth = mode->hdisplay;
|
||||||
@ -355,16 +326,17 @@ static int FindDevice(VideoRender * render)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
found = 1;
|
found = 1;
|
||||||
i = resources->count_connectors; // uuuuhh
|
i = resources->count_connectors; // uuuuhh
|
||||||
}
|
}
|
||||||
VideoWindowWidth = render->mode.hdisplay;
|
VideoWindowWidth = render->mode.hdisplay;
|
||||||
VideoWindowHeight = render->mode.vdisplay;
|
VideoWindowHeight = render->mode.vdisplay;
|
||||||
if (found)
|
if (found)
|
||||||
printf("Use Mode %d %dx%d Rate %d\n",ii,render->mode.hdisplay,render->mode.vdisplay,render->mode.vrefresh);
|
printf("Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay,
|
||||||
|
render->mode.vrefresh);
|
||||||
drmModeFreeConnector(connector);
|
drmModeFreeConnector(connector);
|
||||||
}
|
}
|
||||||
if (!found) {
|
if (!found) {
|
||||||
Debug(3,"Requested Connector not found or not connected\n");
|
Debug(3, "Requested Connector not found or not connected\n");
|
||||||
printf("Requested Connector not found or not connected\n");
|
printf("Requested Connector not found or not connected\n");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -384,16 +356,16 @@ static int FindDevice(VideoRender * render)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t type = GetPropertyValue(render->fd_drm, plane_res->planes[j],
|
uint64_t type = GetPropertyValue(render->fd_drm, plane_res->planes[j], DRM_MODE_OBJECT_PLANE, "type");
|
||||||
DRM_MODE_OBJECT_PLANE, "type");
|
|
||||||
uint64_t zpos = 0;
|
uint64_t zpos = 0;
|
||||||
|
|
||||||
#ifdef DRM_DEBUG // If more then 2 crtcs this must rewriten!!!
|
#ifdef DRM_DEBUG // If more then 2 crtcs this must rewriten!!!
|
||||||
printf("[FindDevice] Plane id %i crtc_id %i possible_crtcs %i possible CRTC %i type %s\n",
|
printf("[FindDevice] Plane id %i crtc_id %i possible_crtcs %i possible CRTC %i type %s\n", plane->plane_id,
|
||||||
plane->plane_id, plane->crtc_id, plane->possible_crtcs, resources->crtcs[i],
|
plane->crtc_id, plane->possible_crtcs, resources->crtcs[i],
|
||||||
(type == DRM_PLANE_TYPE_PRIMARY) ? "primary plane" :
|
(type == DRM_PLANE_TYPE_PRIMARY) ? "primary plane"
|
||||||
(type == DRM_PLANE_TYPE_OVERLAY) ? "overlay plane" :
|
: (type == DRM_PLANE_TYPE_OVERLAY) ? "overlay plane"
|
||||||
(type == DRM_PLANE_TYPE_CURSOR) ? "cursor plane" : "No plane type");
|
: (type == DRM_PLANE_TYPE_CURSOR) ? "cursor plane"
|
||||||
|
: "No plane type");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// test pixel format and plane caps
|
// test pixel format and plane caps
|
||||||
@ -423,8 +395,7 @@ static int FindDevice(VideoRender * render)
|
|||||||
drmModeFreeResources(resources);
|
drmModeFreeResources(resources);
|
||||||
|
|
||||||
#ifdef DRM_DEBUG
|
#ifdef DRM_DEBUG
|
||||||
printf("[FindDevice] DRM setup CRTC: %i video_plane: %i \n",
|
printf("[FindDevice] DRM setup CRTC: %i video_plane: %i \n", render->crtc_id, render->video_plane);
|
||||||
render->crtc_id, render->video_plane);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// save actual modesetting
|
// save actual modesetting
|
||||||
@ -436,8 +407,7 @@ static int FindDevice(VideoRender * render)
|
|||||||
///
|
///
|
||||||
/// Initialize video output module.
|
/// Initialize video output module.
|
||||||
///
|
///
|
||||||
void VideoInitDrm()
|
void VideoInitDrm() {
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!(render = calloc(1, sizeof(*render)))) {
|
if (!(render = calloc(1, sizeof(*render)))) {
|
||||||
@ -445,25 +415,24 @@ void VideoInitDrm()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FindDevice(render)){
|
if (FindDevice(render)) {
|
||||||
Fatal(_( "VideoInit: FindDevice() failed\n"));
|
Fatal(_("VideoInit: FindDevice() failed\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
gbm.dev = gbm_create_device (render->fd_drm);
|
gbm.dev = gbm_create_device(render->fd_drm);
|
||||||
assert (gbm.dev != NULL);
|
assert(gbm.dev != NULL);
|
||||||
|
|
||||||
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
|
PFNEGLGETPLATFORMDISPLAYEXTPROC get_platform_display = NULL;
|
||||||
|
|
||||||
get_platform_display =
|
get_platform_display = (void *)eglGetProcAddress("eglGetPlatformDisplayEXT");
|
||||||
(void *) eglGetProcAddress("eglGetPlatformDisplayEXT");
|
|
||||||
assert(get_platform_display != NULL);
|
assert(get_platform_display != NULL);
|
||||||
|
|
||||||
eglDisplay = get_platform_display(EGL_PLATFORM_GBM_KHR, gbm.dev, NULL);
|
eglDisplay = get_platform_display(EGL_PLATFORM_GBM_KHR, gbm.dev, NULL);
|
||||||
|
|
||||||
EglCheck();
|
EglCheck();
|
||||||
|
|
||||||
assert (eglDisplay != NULL);
|
assert(eglDisplay != NULL);
|
||||||
// return;
|
// return;
|
||||||
|
|
||||||
drmModeAtomicReqPtr ModeReq;
|
drmModeAtomicReqPtr ModeReq;
|
||||||
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
@ -477,13 +446,11 @@ void VideoInitDrm()
|
|||||||
fprintf(stderr, "cannot allocate atomic request (%d): %m\n", errno);
|
fprintf(stderr, "cannot allocate atomic request (%d): %m\n", errno);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
printf("set CRTC %d of Connector %d aktiv\n",render->crtc_id,render->connector_id);
|
printf("set CRTC %d of Connector %d aktiv\n", render->crtc_id, render->connector_id);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
render->crtc_id);
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID", render->crtc_id);
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
|
||||||
DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
|
||||||
|
|
||||||
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
@ -492,54 +459,51 @@ void VideoInitDrm()
|
|||||||
fprintf(stderr, "cannot destroy property blob (%d): %m\n", errno);
|
fprintf(stderr, "cannot destroy property blob (%d): %m\n", errno);
|
||||||
|
|
||||||
drmModeAtomicFree(ModeReq);
|
drmModeAtomicFree(ModeReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_drm_aspect(int *num,int *den)
|
void get_drm_aspect(int *num, int *den) {
|
||||||
{
|
|
||||||
*num = VideoWindowWidth;
|
*num = VideoWindowWidth;
|
||||||
*den = VideoWindowHeight;
|
*den = VideoWindowHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct gbm_bo *bo = NULL, *next_bo=NULL;
|
struct gbm_bo *bo = NULL, *next_bo = NULL;
|
||||||
struct drm_fb *fb;
|
struct drm_fb *fb;
|
||||||
static int m_need_modeset = 0;
|
static int m_need_modeset = 0;
|
||||||
static int old_color=-1,old_trc=-1;
|
static int old_color = -1, old_trc = -1;
|
||||||
|
|
||||||
void InitBo(int bpp) {
|
void InitBo(int bpp) {
|
||||||
// create the GBM and EGL surface
|
// create the GBM and EGL surface
|
||||||
|
|
||||||
render->bpp = bpp;
|
|
||||||
gbm.surface = gbm_surface_create (gbm.dev, VideoWindowWidth,VideoWindowHeight,
|
|
||||||
bpp==10?GBM_FORMAT_XRGB2101010:GBM_FORMAT_ARGB8888,
|
|
||||||
GBM_BO_USE_SCANOUT|GBM_BO_USE_RENDERING);
|
|
||||||
assert(gbm.surface != NULL);
|
|
||||||
eglSurface = eglCreateWindowSurface (eglDisplay, eglConfig, gbm.surface, NULL);
|
|
||||||
assert(eglSurface != NULL);
|
|
||||||
|
|
||||||
|
render->bpp = bpp;
|
||||||
|
gbm.surface = gbm_surface_create(gbm.dev, VideoWindowWidth, VideoWindowHeight,
|
||||||
|
bpp == 10 ? GBM_FORMAT_XRGB2101010 : GBM_FORMAT_ARGB8888,
|
||||||
|
GBM_BO_USE_SCANOUT | GBM_BO_USE_RENDERING);
|
||||||
|
assert(gbm.surface != NULL);
|
||||||
|
eglSurface = eglCreateWindowSurface(eglDisplay, eglConfig, gbm.surface, NULL);
|
||||||
|
assert(eglSurface != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct gbm_bo *previous_bo = NULL;
|
static struct gbm_bo *previous_bo = NULL;
|
||||||
static uint32_t previous_fb;
|
static uint32_t previous_fb;
|
||||||
static int has_modeset = 0;
|
static int has_modeset = 0;
|
||||||
|
|
||||||
static void drm_swap_buffers () {
|
static void drm_swap_buffers() {
|
||||||
|
|
||||||
uint32_t fb;
|
uint32_t fb;
|
||||||
|
|
||||||
eglSwapBuffers (eglDisplay, eglSurface);
|
eglSwapBuffers(eglDisplay, eglSurface);
|
||||||
struct gbm_bo *bo = gbm_surface_lock_front_buffer (gbm.surface);
|
struct gbm_bo *bo = gbm_surface_lock_front_buffer(gbm.surface);
|
||||||
#if 1
|
#if 1
|
||||||
if (bo == NULL)
|
if (bo == NULL)
|
||||||
bo = gbm_surface_lock_front_buffer (gbm.surface);
|
bo = gbm_surface_lock_front_buffer(gbm.surface);
|
||||||
#endif
|
#endif
|
||||||
assert (bo != NULL);
|
assert(bo != NULL);
|
||||||
uint32_t handle = gbm_bo_get_handle (bo).u32;
|
uint32_t handle = gbm_bo_get_handle(bo).u32;
|
||||||
uint32_t pitch = gbm_bo_get_stride (bo);
|
uint32_t pitch = gbm_bo_get_stride(bo);
|
||||||
|
|
||||||
|
drmModeAddFB(render->fd_drm, VideoWindowWidth, VideoWindowHeight, render->bpp == 10 ? 30 : 24, 32, pitch, handle,
|
||||||
drmModeAddFB (render->fd_drm, VideoWindowWidth,VideoWindowHeight,render->bpp==10? 30:24, 32, pitch, handle, &fb);
|
&fb);
|
||||||
// drmModeSetCrtc (render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
// drmModeSetCrtc (render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
||||||
|
|
||||||
if (m_need_modeset) {
|
if (m_need_modeset) {
|
||||||
drmModeAtomicReqPtr ModeReq;
|
drmModeAtomicReqPtr ModeReq;
|
||||||
@ -556,23 +520,19 @@ static void drm_swap_buffers () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to disable the CRTC in order to submit the HDR data....
|
// Need to disable the CRTC in order to submit the HDR data....
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
||||||
DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
|
||||||
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "Colorspace",
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "Colorspace",old_color==AVCOL_PRI_BT2020?9:2 );
|
old_color == AVCOL_PRI_BT2020 ? 9 : 2);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING",
|
||||||
DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING",old_color==AVCOL_PRI_BT2020?2:1 );
|
old_color == AVCOL_PRI_BT2020 ? 2 : 1);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_RANGE", 0);
|
||||||
DRM_MODE_OBJECT_PLANE, "COLOR_RANGE",0 );
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
render->crtc_id);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID", render->crtc_id);
|
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
|
||||||
DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
|
||||||
|
|
||||||
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
fprintf(stderr, "cannot set atomic mode modeset 2 (%d): %m\n", errno);
|
fprintf(stderr, "cannot set atomic mode modeset 2 (%d): %m\n", errno);
|
||||||
@ -584,33 +544,32 @@ static void drm_swap_buffers () {
|
|||||||
m_need_modeset = 0;
|
m_need_modeset = 0;
|
||||||
has_modeset = 1;
|
has_modeset = 1;
|
||||||
}
|
}
|
||||||
drmModeSetCrtc (render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
||||||
|
|
||||||
if (previous_bo) {
|
if (previous_bo) {
|
||||||
drmModeRmFB (render->fd_drm, previous_fb);
|
drmModeRmFB(render->fd_drm, previous_fb);
|
||||||
gbm_surface_release_buffer (gbm.surface, previous_bo);
|
gbm_surface_release_buffer(gbm.surface, previous_bo);
|
||||||
}
|
}
|
||||||
previous_bo = bo;
|
previous_bo = bo;
|
||||||
previous_fb = fb;
|
previous_fb = fb;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void drm_clean_up () {
|
static void drm_clean_up() {
|
||||||
// set the previous crtc
|
// set the previous crtc
|
||||||
|
|
||||||
if (!render)
|
if (!render)
|
||||||
return;
|
return;
|
||||||
Debug(3,"drm clean up\n");
|
Debug(3, "drm clean up\n");
|
||||||
|
|
||||||
if (previous_bo) {
|
if (previous_bo) {
|
||||||
drmModeRmFB (render->fd_drm, previous_fb);
|
drmModeRmFB(render->fd_drm, previous_fb);
|
||||||
gbm_surface_release_buffer (gbm.surface, previous_bo);
|
gbm_surface_release_buffer(gbm.surface, previous_bo);
|
||||||
}
|
}
|
||||||
|
|
||||||
drmModeSetCrtc (render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id,
|
drmModeSetCrtc(render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id, render->saved_crtc->x,
|
||||||
render->saved_crtc->x, render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
|
render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
|
||||||
drmModeFreeCrtc (render->saved_crtc);
|
drmModeFreeCrtc(render->saved_crtc);
|
||||||
|
|
||||||
if (has_modeset) {
|
if (has_modeset) {
|
||||||
drmModeAtomicReqPtr ModeReq;
|
drmModeAtomicReqPtr ModeReq;
|
||||||
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||||
@ -626,25 +585,19 @@ static void drm_clean_up () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to disable the CRTC in order to submit the HDR data....
|
// Need to disable the CRTC in order to submit the HDR data....
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
||||||
DRM_MODE_OBJECT_CRTC, "ACTIVE", 0);
|
|
||||||
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
|
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR,
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "HDR_OUTPUT_METADATA", 0);
|
"HDR_OUTPUT_METADATA", 0);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "Colorspace", 2);
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "Colorspace",2 );
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING", 1);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane, DRM_MODE_OBJECT_PLANE, "COLOR_RANGE", 1);
|
||||||
DRM_MODE_OBJECT_PLANE, "COLOR_ENCODING",1 );
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->video_plane,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id, DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID",
|
||||||
DRM_MODE_OBJECT_PLANE, "COLOR_RANGE",1 );
|
render->crtc_id);
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id, DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
||||||
DRM_MODE_OBJECT_CRTC, "MODE_ID", modeID);
|
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->connector_id,
|
|
||||||
DRM_MODE_OBJECT_CONNECTOR, "CRTC_ID", render->crtc_id);
|
|
||||||
SetPropertyRequest(ModeReq, render->fd_drm, render->crtc_id,
|
|
||||||
DRM_MODE_OBJECT_CRTC, "ACTIVE", 1);
|
|
||||||
|
|
||||||
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
if (drmModeAtomicCommit(render->fd_drm, ModeReq, flags, NULL) != 0)
|
||||||
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
fprintf(stderr, "cannot set atomic mode (%d): %m\n", errno);
|
||||||
@ -655,27 +608,26 @@ static void drm_clean_up () {
|
|||||||
drmModeAtomicFree(ModeReq);
|
drmModeAtomicFree(ModeReq);
|
||||||
has_modeset = 0;
|
has_modeset = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render->hdr_blob_id)
|
if (render->hdr_blob_id)
|
||||||
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
render->hdr_blob_id = 0;
|
render->hdr_blob_id = 0;
|
||||||
|
|
||||||
eglDestroySurface (eglDisplay, eglSurface);
|
eglDestroySurface(eglDisplay, eglSurface);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
gbm_surface_destroy (gbm.surface);
|
gbm_surface_destroy(gbm.surface);
|
||||||
eglDestroyContext (eglDisplay, eglContext);
|
eglDestroyContext(eglDisplay, eglContext);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
eglDestroyContext (eglDisplay, eglSharedContext);
|
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
eglSharedContext = NULL;
|
eglSharedContext = NULL;
|
||||||
|
|
||||||
eglTerminate (eglDisplay);
|
eglTerminate(eglDisplay);
|
||||||
EglCheck();
|
EglCheck();
|
||||||
|
|
||||||
gbm_device_destroy (gbm.dev);
|
gbm_device_destroy(gbm.dev);
|
||||||
drmDropMaster(render->fd_drm);
|
drmDropMaster(render->fd_drm);
|
||||||
close (render->fd_drm);
|
close(render->fd_drm);
|
||||||
eglDisplay = NULL;
|
eglDisplay = NULL;
|
||||||
free(render);
|
free(render);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,11 @@
|
|||||||
#define _DRVAPI_ERROR_STRING_H_
|
#define _DRVAPI_ERROR_STRING_H_
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
// Error Code string definitions here
|
// Error Code string definitions here
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
char const *error_string;
|
char const *error_string;
|
||||||
unsigned int error_id;
|
unsigned int error_id;
|
||||||
} s_CudaErrorStr;
|
} s_CudaErrorStr;
|
||||||
@ -62,30 +61,30 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
/**
|
/**
|
||||||
* This indicates profiling APIs are called while application is running
|
* This indicates profiling APIs are called while application is running
|
||||||
* in visual profiler mode.
|
* in visual profiler mode.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_PROFILER_DISABLED", 5},
|
{"CUDA_ERROR_PROFILER_DISABLED", 5},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiling has not been initialized for this context.
|
* This indicates profiling has not been initialized for this context.
|
||||||
* Call cuProfilerInitialize() to resolve this.
|
* Call cuProfilerInitialize() to resolve this.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_PROFILER_NOT_INITIALIZED", 6},
|
{"CUDA_ERROR_PROFILER_NOT_INITIALIZED", 6},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiler has already been started and probably
|
* This indicates profiler has already been started and probably
|
||||||
* cuProfilerStart() is incorrectly called.
|
* cuProfilerStart() is incorrectly called.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_PROFILER_ALREADY_STARTED", 7},
|
{"CUDA_ERROR_PROFILER_ALREADY_STARTED", 7},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates profiler has already been stopped and probably
|
* This indicates profiler has already been stopped and probably
|
||||||
* cuProfilerStop() is incorrectly called.
|
* cuProfilerStop() is incorrectly called.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_PROFILER_ALREADY_STOPPED", 8},
|
{"CUDA_ERROR_PROFILER_ALREADY_STOPPED", 8},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that no CUDA-capable devices were detected by the installed
|
* This indicates that no CUDA-capable devices were detected by the
|
||||||
* CUDA driver.
|
* installed CUDA driver.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100},
|
{"CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100},
|
||||||
|
|
||||||
@ -207,9 +206,9 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
{"CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219},
|
{"CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that an uncorrectable NVLink error was detected during the
|
* This indicates that an uncorrectable NVLink error was detected during the
|
||||||
* execution.
|
* execution.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_NVLINK_UNCORRECTABLE", 220},
|
{"CUDA_ERROR_NVLINK_UNCORRECTABLE", 220},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -256,18 +255,19 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This indicates that asynchronous operations issued previously have not
|
* This indicates that asynchronous operations issued previously have not
|
||||||
* completed yet. This result is not actually an error, but must be indicated
|
* completed yet. This result is not actually an error, but must be
|
||||||
* differently than ::CUDA_SUCCESS (which indicates completion). Calls that
|
* indicated differently than ::CUDA_SUCCESS (which indicates completion).
|
||||||
* may return this value include ::cuEventQuery() and ::cuStreamQuery().
|
* Calls that may return this value include ::cuEventQuery() and
|
||||||
|
* ::cuStreamQuery().
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_NOT_READY", 600},
|
{"CUDA_ERROR_NOT_READY", 600},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a
|
* While executing a kernel, the device encountered a
|
||||||
* load or store instruction on an invalid memory address.
|
* load or store instruction on an invalid memory address.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_ILLEGAL_ADDRESS", 700},
|
{"CUDA_ERROR_ILLEGAL_ADDRESS", 700},
|
||||||
|
|
||||||
@ -342,8 +342,8 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
{"CUDA_ERROR_TOO_MANY_PEERS", 711},
|
{"CUDA_ERROR_TOO_MANY_PEERS", 711},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the memory range passed to ::cuMemHostRegister()
|
* This error indicates that the memory range passed to
|
||||||
* has already been registered.
|
* ::cuMemHostRegister() has already been registered.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712},
|
{"CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712},
|
||||||
|
|
||||||
@ -356,25 +356,25 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a stack error.
|
* While executing a kernel, the device encountered a stack error.
|
||||||
* This can be due to stack corruption or exceeding the stack size limit.
|
* This can be due to stack corruption or exceeding the stack size limit.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_HARDWARE_STACK_ERROR", 714},
|
{"CUDA_ERROR_HARDWARE_STACK_ERROR", 714},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered an illegal instruction.
|
* While executing a kernel, the device encountered an illegal instruction.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_ILLEGAL_INSTRUCTION", 715},
|
{"CUDA_ERROR_ILLEGAL_INSTRUCTION", 715},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device encountered a load or store instruction
|
* While executing a kernel, the device encountered a load or store
|
||||||
* on a memory address which is not aligned.
|
* instruction on a memory address which is not aligned. This leaves the
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* process in an inconsistent state and any further CUDA work will return
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* the same error. To continue using CUDA, the process must be terminated
|
||||||
* and relaunched.
|
* and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_MISALIGNED_ADDRESS", 716},
|
{"CUDA_ERROR_MISALIGNED_ADDRESS", 716},
|
||||||
@ -384,17 +384,17 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
* which can only operate on memory locations in certain address spaces
|
* which can only operate on memory locations in certain address spaces
|
||||||
* (global, shared, or local), but was supplied a memory address not
|
* (global, shared, or local), but was supplied a memory address not
|
||||||
* belonging to an allowed address space.
|
* belonging to an allowed address space.
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* This leaves the process in an inconsistent state and any further CUDA
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* work will return the same error. To continue using CUDA, the process must
|
||||||
* and relaunched.
|
* be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_INVALID_ADDRESS_SPACE", 717},
|
{"CUDA_ERROR_INVALID_ADDRESS_SPACE", 717},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* While executing a kernel, the device program counter wrapped its address space.
|
* While executing a kernel, the device program counter wrapped its address
|
||||||
* This leaves the process in an inconsistent state and any further CUDA work
|
* space. This leaves the process in an inconsistent state and any further
|
||||||
* will return the same error. To continue using CUDA, the process must be terminated
|
* CUDA work will return the same error. To continue using CUDA, the process
|
||||||
* and relaunched.
|
* must be terminated and relaunched.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_INVALID_PC", 718},
|
{"CUDA_ERROR_INVALID_PC", 718},
|
||||||
|
|
||||||
@ -409,11 +409,13 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
{"CUDA_ERROR_LAUNCH_FAILED", 719},
|
{"CUDA_ERROR_LAUNCH_FAILED", 719},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This error indicates that the number of blocks launched per grid for a kernel that was
|
* This error indicates that the number of blocks launched per grid for a
|
||||||
* launched via either ::cuLaunchCooperativeKernel or ::cuLaunchCooperativeKernelMultiDevice
|
* kernel that was launched via either ::cuLaunchCooperativeKernel or
|
||||||
* exceeds the maximum number of blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor
|
* ::cuLaunchCooperativeKernelMultiDevice exceeds the maximum number of
|
||||||
* or ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number of multiprocessors
|
* blocks as allowed by ::cuOccupancyMaxActiveBlocksPerMultiprocessor or
|
||||||
* as specified by the device attribute ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
|
* ::cuOccupancyMaxActiveBlocksPerMultiprocessorWithFlags times the number
|
||||||
|
* of multiprocessors as specified by the device attribute
|
||||||
|
* ::CU_DEVICE_ATTRIBUTE_MULTIPROCESSOR_COUNT.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE", 720},
|
{"CUDA_ERROR_COOPERATIVE_LAUNCH_TOO_LARGE", 720},
|
||||||
|
|
||||||
@ -432,13 +434,11 @@ s_CudaErrorStr sCudaDrvErrorString[] = {
|
|||||||
* This indicates that an unknown internal error has occurred.
|
* This indicates that an unknown internal error has occurred.
|
||||||
*/
|
*/
|
||||||
{"CUDA_ERROR_UNKNOWN", 999},
|
{"CUDA_ERROR_UNKNOWN", 999},
|
||||||
{NULL, -1}
|
{NULL, -1}};
|
||||||
};
|
|
||||||
|
|
||||||
// This is just a linear search through the array, since the error_id's are not
|
// This is just a linear search through the array, since the error_id's are not
|
||||||
// always ocurring consecutively
|
// always ocurring consecutively
|
||||||
static inline const char *getCudaDrvErrorString(CUresult error_id)
|
static inline const char *getCudaDrvErrorString(CUresult error_id) {
|
||||||
{
|
|
||||||
int index = 0;
|
int index = 0;
|
||||||
|
|
||||||
while (sCudaDrvErrorString[index].error_id != error_id && (int)sCudaDrvErrorString[index].error_id != -1) {
|
while (sCudaDrvErrorString[index].error_id != error_id && (int)sCudaDrvErrorString[index].error_id != -1) {
|
||||||
|
485
hdr.c
485
hdr.c
@ -29,7 +29,7 @@ struct hdr_metadata_infoframe {
|
|||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
__u16 x, y;
|
__u16 x, y;
|
||||||
} display_primaries[3];
|
} display_primaries[3];
|
||||||
/**
|
/**
|
||||||
* @white_point: White Point of Colorspace Data.
|
* @white_point: White Point of Colorspace Data.
|
||||||
* These are coded as unsigned 16-bit values in units of
|
* These are coded as unsigned 16-bit values in units of
|
||||||
@ -40,7 +40,7 @@ struct hdr_metadata_infoframe {
|
|||||||
*/
|
*/
|
||||||
struct {
|
struct {
|
||||||
__u16 x, y;
|
__u16 x, y;
|
||||||
} white_point;
|
} white_point;
|
||||||
/**
|
/**
|
||||||
* @max_display_mastering_luminance: Max Mastering Display Luminance.
|
* @max_display_mastering_luminance: Max Mastering Display Luminance.
|
||||||
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
|
* This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
|
||||||
@ -87,7 +87,6 @@ struct hdr_output_metadata {
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
enum hdr_metadata_eotf {
|
enum hdr_metadata_eotf {
|
||||||
EOTF_TRADITIONAL_GAMMA_SDR,
|
EOTF_TRADITIONAL_GAMMA_SDR,
|
||||||
EOTF_TRADITIONAL_GAMMA_HDR,
|
EOTF_TRADITIONAL_GAMMA_HDR,
|
||||||
@ -95,27 +94,15 @@ enum hdr_metadata_eotf {
|
|||||||
EOTF_HLG,
|
EOTF_HLG,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
enum metadata_id {
|
enum metadata_id {
|
||||||
METADATA_TYPE1,
|
METADATA_TYPE1,
|
||||||
};
|
};
|
||||||
|
|
||||||
void
|
void weston_hdr_metadata(void *data, uint16_t display_primary_r_x, uint16_t display_primary_r_y,
|
||||||
weston_hdr_metadata(void *data,
|
uint16_t display_primary_g_x, uint16_t display_primary_g_y, uint16_t display_primary_b_x,
|
||||||
uint16_t display_primary_r_x,
|
uint16_t display_primary_b_y, uint16_t white_point_x, uint16_t white_point_y,
|
||||||
uint16_t display_primary_r_y,
|
uint16_t min_luminance, uint16_t max_luminance, uint16_t max_cll, uint16_t max_fall,
|
||||||
uint16_t display_primary_g_x,
|
enum hdr_metadata_eotf eotf) {
|
||||||
uint16_t display_primary_g_y,
|
|
||||||
uint16_t display_primary_b_x,
|
|
||||||
uint16_t display_primary_b_y,
|
|
||||||
uint16_t white_point_x,
|
|
||||||
uint16_t white_point_y,
|
|
||||||
uint16_t min_luminance,
|
|
||||||
uint16_t max_luminance,
|
|
||||||
uint16_t max_cll,
|
|
||||||
uint16_t max_fall,
|
|
||||||
enum hdr_metadata_eotf eotf)
|
|
||||||
{
|
|
||||||
uint8_t *data8;
|
uint8_t *data8;
|
||||||
uint16_t *data16;
|
uint16_t *data16;
|
||||||
|
|
||||||
@ -124,7 +111,7 @@ weston_hdr_metadata(void *data,
|
|||||||
*data8++ = eotf;
|
*data8++ = eotf;
|
||||||
*data8++ = METADATA_TYPE1;
|
*data8++ = METADATA_TYPE1;
|
||||||
|
|
||||||
data16 = (void*)data8;
|
data16 = (void *)data8;
|
||||||
|
|
||||||
*data16++ = display_primary_r_x;
|
*data16++ = display_primary_r_x;
|
||||||
*data16++ = display_primary_r_y;
|
*data16++ = display_primary_r_y;
|
||||||
@ -155,151 +142,302 @@ struct weston_colorspace {
|
|||||||
struct weston_colorspace hdr10;
|
struct weston_colorspace hdr10;
|
||||||
|
|
||||||
static const struct weston_colorspace bt470m = {
|
static const struct weston_colorspace bt470m = {
|
||||||
.r = {{ 0.670f, 0.330f, }},
|
.r = {{
|
||||||
.g = {{ 0.210f, 0.710f, }},
|
0.670f,
|
||||||
.b = {{ 0.140f, 0.080f, }},
|
0.330f,
|
||||||
.whitepoint = {{ 0.3101f, 0.3162f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.210f,
|
||||||
|
0.710f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.140f,
|
||||||
|
0.080f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3101f,
|
||||||
|
0.3162f,
|
||||||
|
}},
|
||||||
.name = "BT.470 M",
|
.name = "BT.470 M",
|
||||||
.whitepoint_name = "C",
|
.whitepoint_name = "C",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace bt470bg = {
|
static const struct weston_colorspace bt470bg = {
|
||||||
.r = {{ 0.640f, 0.330f, }},
|
.r = {{
|
||||||
.g = {{ 0.290f, 0.600f, }},
|
0.640f,
|
||||||
.b = {{ 0.150f, 0.060f, }},
|
0.330f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.290f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "BT.470 B/G",
|
.name = "BT.470 B/G",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace smpte170m = {
|
static const struct weston_colorspace smpte170m = {
|
||||||
.r = {{ 0.630f, 0.340f, }},
|
.r = {{
|
||||||
.g = {{ 0.310f, 0.595f, }},
|
0.630f,
|
||||||
.b = {{ 0.155f, 0.070f, }},
|
0.340f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.310f,
|
||||||
|
0.595f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.155f,
|
||||||
|
0.070f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "SMPTE 170M",
|
.name = "SMPTE 170M",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace smpte240m = {
|
static const struct weston_colorspace smpte240m = {
|
||||||
.r = {{ 0.630f, 0.340f, }},
|
.r = {{
|
||||||
.g = {{ 0.310f, 0.595f, }},
|
0.630f,
|
||||||
.b = {{ 0.155f, 0.070f, }},
|
0.340f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.310f,
|
||||||
|
0.595f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.155f,
|
||||||
|
0.070f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "SMPTE 240M",
|
.name = "SMPTE 240M",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace bt709 = {
|
static const struct weston_colorspace bt709 = {
|
||||||
.r = {{ 0.640f, 0.330f, }},
|
.r = {{
|
||||||
.g = {{ 0.300f, 0.600f, }},
|
0.640f,
|
||||||
.b = {{ 0.150f, 0.060f, }},
|
0.330f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.300f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "BT.709",
|
.name = "BT.709",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace bt2020 = {
|
static const struct weston_colorspace bt2020 = {
|
||||||
.r = {{ 0.708f, 0.292f, }},
|
.r = {{
|
||||||
.g = {{ 0.170f, 0.797f, }},
|
0.708f,
|
||||||
.b = {{ 0.131f, 0.046f, }},
|
0.292f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.170f,
|
||||||
|
0.797f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.131f,
|
||||||
|
0.046f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "BT.2020",
|
.name = "BT.2020",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace srgb = {
|
static const struct weston_colorspace srgb = {
|
||||||
.r = {{ 0.640f, 0.330f, }},
|
.r = {{
|
||||||
.g = {{ 0.300f, 0.600f, }},
|
0.640f,
|
||||||
.b = {{ 0.150f, 0.060f, }},
|
0.330f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.300f,
|
||||||
|
0.600f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "sRGB",
|
.name = "sRGB",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace adobergb = {
|
static const struct weston_colorspace adobergb = {
|
||||||
.r = {{ 0.640f, 0.330f, }},
|
.r = {{
|
||||||
.g = {{ 0.210f, 0.710f, }},
|
0.640f,
|
||||||
.b = {{ 0.150f, 0.060f, }},
|
0.330f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.210f,
|
||||||
|
0.710f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "AdobeRGB",
|
.name = "AdobeRGB",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace dci_p3 = {
|
static const struct weston_colorspace dci_p3 = {
|
||||||
.r = {{ 0.680f, 0.320f, }},
|
.r = {{
|
||||||
.g = {{ 0.265f, 0.690f, }},
|
0.680f,
|
||||||
.b = {{ 0.150f, 0.060f, }},
|
0.320f,
|
||||||
.whitepoint = {{ 0.3127f, 0.3290f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.265f,
|
||||||
|
0.690f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.150f,
|
||||||
|
0.060f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.3127f,
|
||||||
|
0.3290f,
|
||||||
|
}},
|
||||||
.name = "DCI-P3 D65",
|
.name = "DCI-P3 D65",
|
||||||
.whitepoint_name = "D65",
|
.whitepoint_name = "D65",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace prophotorgb = {
|
static const struct weston_colorspace prophotorgb = {
|
||||||
.r = {{ 0.7347f, 0.2653f, }},
|
.r = {{
|
||||||
.g = {{ 0.1596f, 0.8404f, }},
|
0.7347f,
|
||||||
.b = {{ 0.0366f, 0.0001f, }},
|
0.2653f,
|
||||||
.whitepoint = {{ .3457, .3585 }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.1596f,
|
||||||
|
0.8404f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0366f,
|
||||||
|
0.0001f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{.3457, .3585}},
|
||||||
.name = "ProPhoto RGB",
|
.name = "ProPhoto RGB",
|
||||||
.whitepoint_name = "D50",
|
.whitepoint_name = "D50",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace ciergb = {
|
static const struct weston_colorspace ciergb = {
|
||||||
.r = {{ 0.7347f, 0.2653f, }},
|
.r = {{
|
||||||
.g = {{ 0.2738f, 0.7174f, }},
|
0.7347f,
|
||||||
.b = {{ 0.1666f, 0.0089f, }},
|
0.2653f,
|
||||||
.whitepoint = {{ 1.0f / 3.0f, 1.0f / 3.0f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.2738f,
|
||||||
|
0.7174f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.1666f,
|
||||||
|
0.0089f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
1.0f / 3.0f,
|
||||||
|
1.0f / 3.0f,
|
||||||
|
}},
|
||||||
.name = "CIE RGB",
|
.name = "CIE RGB",
|
||||||
.whitepoint_name = "E",
|
.whitepoint_name = "E",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace ciexyz = {
|
static const struct weston_colorspace ciexyz = {
|
||||||
.r = {{ 1.0f, 0.0f, }},
|
.r = {{
|
||||||
.g = {{ 0.0f, 1.0f, }},
|
1.0f,
|
||||||
.b = {{ 0.0f, 0.0f, }},
|
0.0f,
|
||||||
.whitepoint = {{ 1.0f / 3.0f, 1.0f / 3.0f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.0f,
|
||||||
|
1.0f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0f,
|
||||||
|
0.0f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
1.0f / 3.0f,
|
||||||
|
1.0f / 3.0f,
|
||||||
|
}},
|
||||||
.name = "CIE XYZ",
|
.name = "CIE XYZ",
|
||||||
.whitepoint_name = "E",
|
.whitepoint_name = "E",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct weston_colorspace ap0 = {
|
const struct weston_colorspace ap0 = {
|
||||||
.r = {{ 0.7347f, 0.2653f, }},
|
.r = {{
|
||||||
.g = {{ 0.0000f, 1.0000f, }},
|
0.7347f,
|
||||||
.b = {{ 0.0001f, -0.0770f, }},
|
0.2653f,
|
||||||
.whitepoint = {{ .32168f, .33767f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.0000f,
|
||||||
|
1.0000f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.0001f,
|
||||||
|
-0.0770f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
.32168f,
|
||||||
|
.33767f,
|
||||||
|
}},
|
||||||
.name = "ACES primaries #0",
|
.name = "ACES primaries #0",
|
||||||
.whitepoint_name = "D60",
|
.whitepoint_name = "D60",
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct weston_colorspace ap1 = {
|
const struct weston_colorspace ap1 = {
|
||||||
.r = {{ 0.713f, 0.393f, }},
|
.r = {{
|
||||||
.g = {{ 0.165f, 0.830f, }},
|
0.713f,
|
||||||
.b = {{ 0.128f, 0.044f, }},
|
0.393f,
|
||||||
.whitepoint = {{ 0.32168f, 0.33767f, }},
|
}},
|
||||||
|
.g = {{
|
||||||
|
0.165f,
|
||||||
|
0.830f,
|
||||||
|
}},
|
||||||
|
.b = {{
|
||||||
|
0.128f,
|
||||||
|
0.044f,
|
||||||
|
}},
|
||||||
|
.whitepoint = {{
|
||||||
|
0.32168f,
|
||||||
|
0.33767f,
|
||||||
|
}},
|
||||||
.name = "ACES primaries #1",
|
.name = "ACES primaries #1",
|
||||||
.whitepoint_name = "D60",
|
.whitepoint_name = "D60",
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct weston_colorspace * const colorspaces[] = {
|
static const struct weston_colorspace *const colorspaces[] = {
|
||||||
&bt470m,
|
&bt470m, &bt470bg, &smpte170m, &smpte240m, &bt709, &bt2020, &srgb,
|
||||||
&bt470bg,
|
&adobergb, &dci_p3, &prophotorgb, &ciergb, &ciexyz, &ap0, &ap1,
|
||||||
&smpte170m,
|
|
||||||
&smpte240m,
|
|
||||||
&bt709,
|
|
||||||
&bt2020,
|
|
||||||
&srgb,
|
|
||||||
&adobergb,
|
|
||||||
&dci_p3,
|
|
||||||
&prophotorgb,
|
|
||||||
&ciergb,
|
|
||||||
&ciexyz,
|
|
||||||
&ap0,
|
|
||||||
&ap1,
|
|
||||||
};
|
};
|
||||||
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a)[0])
|
#define ARRAY_LENGTH(a) (sizeof(a) / sizeof(a)[0])
|
||||||
const struct weston_colorspace *
|
const struct weston_colorspace *weston_colorspace_lookup(const char *name) {
|
||||||
weston_colorspace_lookup(const char *name)
|
|
||||||
{
|
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
if (!name)
|
if (!name)
|
||||||
@ -315,35 +453,27 @@ weston_colorspace_lookup(const char *name)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int cleanup=0;
|
static int cleanup = 0;
|
||||||
|
|
||||||
|
static uint16_t encode_xyy(float xyy) { return xyy * 50000; }
|
||||||
static uint16_t encode_xyy(float xyy)
|
|
||||||
{
|
|
||||||
return xyy * 50000;
|
|
||||||
}
|
|
||||||
static AVMasteringDisplayMetadata md_save = {0};
|
static AVMasteringDisplayMetadata md_save = {0};
|
||||||
static AVContentLightMetadata ld_save = {0};
|
static AVContentLightMetadata ld_save = {0};
|
||||||
static void set_hdr_metadata(int color,int trc, AVFrameSideData *sd1, AVFrameSideData *sd2)
|
static void set_hdr_metadata(int color, int trc, AVFrameSideData *sd1, AVFrameSideData *sd2) {
|
||||||
{
|
drmModeAtomicReqPtr ModeReq;
|
||||||
drmModeAtomicReqPtr ModeReq;
|
|
||||||
struct weston_colorspace *cs;
|
struct weston_colorspace *cs;
|
||||||
enum hdr_metadata_eotf eotf;
|
enum hdr_metadata_eotf eotf;
|
||||||
struct hdr_output_metadata data;
|
struct hdr_output_metadata data;
|
||||||
int ret,MaxCLL=1500,MaxFALL=400;
|
int ret, MaxCLL = 1500, MaxFALL = 400;
|
||||||
int max_lum=4000,min_lum=0050;
|
int max_lum = 4000, min_lum = 0050;
|
||||||
struct AVMasteringDisplayMetadata *md = NULL;
|
struct AVMasteringDisplayMetadata *md = NULL;
|
||||||
struct AVContentLightMetadata *ld = NULL;
|
struct AVContentLightMetadata *ld = NULL;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// clean up FFMEPG stuff
|
// clean up FFMEPG stuff
|
||||||
if (trc == AVCOL_TRC_BT2020_10)
|
if (trc == AVCOL_TRC_BT2020_10)
|
||||||
trc = AVCOL_TRC_ARIB_STD_B67;
|
trc = AVCOL_TRC_ARIB_STD_B67;
|
||||||
|
|
||||||
|
|
||||||
if ((old_color == color && old_trc == trc && !sd1 && !sd2) || !render->hdr_metadata)
|
if ((old_color == color && old_trc == trc && !sd1 && !sd2) || !render->hdr_metadata)
|
||||||
return; // nothing to do
|
return; // nothing to do
|
||||||
|
|
||||||
if (sd1)
|
if (sd1)
|
||||||
md = sd1->data;
|
md = sd1->data;
|
||||||
@ -351,81 +481,76 @@ static void set_hdr_metadata(int color,int trc, AVFrameSideData *sd1, AVFrameSid
|
|||||||
if (sd2)
|
if (sd2)
|
||||||
ld = sd2->data;
|
ld = sd2->data;
|
||||||
|
|
||||||
if (md && !memcmp(md,&md_save,sizeof(md_save)))
|
if (md && !memcmp(md, &md_save, sizeof(md_save)))
|
||||||
if (ld && !memcmp(ld,&ld_save,sizeof(ld_save))) {
|
if (ld && !memcmp(ld, &ld_save, sizeof(ld_save))) {
|
||||||
|
return;
|
||||||
|
} else if (ld && !memcmp(ld, &ld_save, sizeof(ld_save))) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (ld && !memcmp(ld,&ld_save,sizeof(ld_save))) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ld)
|
if (ld)
|
||||||
memcpy(&ld_save,ld,sizeof(ld_save));
|
memcpy(&ld_save, ld, sizeof(ld_save));
|
||||||
if (md)
|
if (md)
|
||||||
memcpy(&md_save,md,sizeof(md_save));
|
memcpy(&md_save, md, sizeof(md_save));
|
||||||
|
|
||||||
Debug(3,"Update HDR to TRC %d color %d\n",trc,color);
|
Debug(3, "Update HDR to TRC %d color %d\n", trc, color);
|
||||||
|
|
||||||
old_color = color;
|
old_color = color;
|
||||||
old_trc = trc;
|
old_trc = trc;
|
||||||
|
|
||||||
|
|
||||||
if (VulkanTargetColorSpace != 3) { // no HDR TV
|
if (VulkanTargetColorSpace != 3) { // no HDR TV
|
||||||
m_need_modeset = 1; // change in colorsettings
|
m_need_modeset = 1; // change in colorsettings
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (render->hdr_blob_id)
|
if (render->hdr_blob_id)
|
||||||
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
|
|
||||||
switch(trc) {
|
switch (trc) {
|
||||||
case AVCOL_TRC_BT709: // 1
|
case AVCOL_TRC_BT709: // 1
|
||||||
case AVCOL_TRC_UNSPECIFIED: // 2
|
case AVCOL_TRC_UNSPECIFIED: // 2
|
||||||
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
||||||
break;
|
break;
|
||||||
case AVCOL_TRC_BT2020_10: // 14
|
case AVCOL_TRC_BT2020_10: // 14
|
||||||
case AVCOL_TRC_BT2020_12:
|
case AVCOL_TRC_BT2020_12:
|
||||||
case AVCOL_TRC_ARIB_STD_B67: // 18 HLG
|
case AVCOL_TRC_ARIB_STD_B67: // 18 HLG
|
||||||
eotf = EOTF_HLG;
|
eotf = EOTF_HLG;
|
||||||
break;
|
break;
|
||||||
case AVCOL_TRC_SMPTE2084: // 16
|
case AVCOL_TRC_SMPTE2084: // 16
|
||||||
eotf = EOTF_ST2084;
|
eotf = EOTF_ST2084;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
eotf = EOTF_TRADITIONAL_GAMMA_SDR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (color) {
|
switch (color) {
|
||||||
case AVCOL_PRI_BT709: // 1
|
case AVCOL_PRI_BT709: // 1
|
||||||
case AVCOL_PRI_UNSPECIFIED: // 2
|
case AVCOL_PRI_UNSPECIFIED: // 2
|
||||||
cs = weston_colorspace_lookup("BT.709");
|
cs = weston_colorspace_lookup("BT.709");
|
||||||
break;
|
break;
|
||||||
case AVCOL_PRI_BT2020: // 9
|
case AVCOL_PRI_BT2020: // 9
|
||||||
cs = weston_colorspace_lookup("BT.2020");
|
cs = weston_colorspace_lookup("BT.2020");
|
||||||
break;
|
break;
|
||||||
case AVCOL_PRI_BT470BG: // 5
|
case AVCOL_PRI_BT470BG: // 5
|
||||||
cs = weston_colorspace_lookup("BT.470 B/G"); // BT.601
|
cs = weston_colorspace_lookup("BT.470 B/G"); // BT.601
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
cs = weston_colorspace_lookup("BT.709");
|
cs = weston_colorspace_lookup("BT.709");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (md) { // we got Metadata
|
if (md) { // we got Metadata
|
||||||
if (md->has_primaries) {
|
if (md->has_primaries) {
|
||||||
Debug(3,"Mastering Display Metadata,\n has_primaries:%d has_luminance:%d \n"
|
Debug(3,
|
||||||
"r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) \n"
|
"Mastering Display Metadata,\n has_primaries:%d has_luminance:%d \n"
|
||||||
"min_luminance=%f, max_luminance=%f\n",
|
"r(%5.4f,%5.4f) g(%5.4f,%5.4f) b(%5.4f %5.4f) wp(%5.4f, %5.4f) \n"
|
||||||
md->has_primaries, md->has_luminance,
|
"min_luminance=%f, max_luminance=%f\n",
|
||||||
av_q2d(md->display_primaries[0][0]),
|
md->has_primaries, md->has_luminance, av_q2d(md->display_primaries[0][0]),
|
||||||
av_q2d(md->display_primaries[0][1]),
|
av_q2d(md->display_primaries[0][1]), av_q2d(md->display_primaries[1][0]),
|
||||||
av_q2d(md->display_primaries[1][0]),
|
av_q2d(md->display_primaries[1][1]), av_q2d(md->display_primaries[2][0]),
|
||||||
av_q2d(md->display_primaries[1][1]),
|
av_q2d(md->display_primaries[2][1]), av_q2d(md->white_point[0]), av_q2d(md->white_point[1]),
|
||||||
av_q2d(md->display_primaries[2][0]),
|
av_q2d(md->min_luminance), av_q2d(md->max_luminance));
|
||||||
av_q2d(md->display_primaries[2][1]),
|
|
||||||
av_q2d(md->white_point[0]), av_q2d(md->white_point[1]),
|
|
||||||
av_q2d(md->min_luminance), av_q2d(md->max_luminance));
|
|
||||||
|
|
||||||
cs = &hdr10;
|
cs = &hdr10;
|
||||||
cs->r.f[0] = (float)md->display_primaries[0][0].num / (float)md->display_primaries[0][0].den;
|
cs->r.f[0] = (float)md->display_primaries[0][0].num / (float)md->display_primaries[0][0].den;
|
||||||
@ -439,53 +564,43 @@ static void set_hdr_metadata(int color,int trc, AVFrameSideData *sd1, AVFrameSid
|
|||||||
}
|
}
|
||||||
if (md->has_luminance) {
|
if (md->has_luminance) {
|
||||||
max_lum = av_q2d(md->max_luminance);
|
max_lum = av_q2d(md->max_luminance);
|
||||||
min_lum = av_q2d(md->min_luminance) * 10000 ;
|
min_lum = av_q2d(md->min_luminance) * 10000;
|
||||||
printf("max_lum %d min_lum %d\n",max_lum,min_lum);
|
printf("max_lum %d min_lum %d\n", max_lum, min_lum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ld) {
|
if (ld) {
|
||||||
Debug(3,"Has MaxCLL %d MaxFALL %d\n",ld->MaxCLL,ld->MaxFALL);
|
Debug(3, "Has MaxCLL %d MaxFALL %d\n", ld->MaxCLL, ld->MaxFALL);
|
||||||
MaxCLL = ld->MaxCLL;
|
MaxCLL = ld->MaxCLL;
|
||||||
MaxFALL = ld->MaxFALL;
|
MaxFALL = ld->MaxFALL;
|
||||||
}
|
}
|
||||||
data.metadata_type = 7; // ????????????????????????
|
data.metadata_type = 7; // ????????????????????????
|
||||||
weston_hdr_metadata(&data.hdmi_metadata_type1,
|
weston_hdr_metadata(&data.hdmi_metadata_type1, encode_xyy(cs->r.f[0]), encode_xyy(cs->r.f[1]),
|
||||||
encode_xyy(cs->r.f[0]),
|
encode_xyy(cs->g.f[0]), encode_xyy(cs->g.f[1]), encode_xyy(cs->b.f[0]), encode_xyy(cs->b.f[1]),
|
||||||
encode_xyy(cs->r.f[1]),
|
encode_xyy(cs->whitepoint.f[0]), encode_xyy(cs->whitepoint.f[1]),
|
||||||
encode_xyy(cs->g.f[0]),
|
max_lum, // max_display_mastering_luminance
|
||||||
encode_xyy(cs->g.f[1]),
|
min_lum, // min_display_mastering_luminance
|
||||||
encode_xyy(cs->b.f[0]),
|
MaxCLL, // Maximum Content Light Level (MaxCLL)
|
||||||
encode_xyy(cs->b.f[1]),
|
MaxFALL, // Maximum Frame-Average Light Level (MaxFALL)
|
||||||
encode_xyy(cs->whitepoint.f[0]),
|
eotf);
|
||||||
encode_xyy(cs->whitepoint.f[1]),
|
|
||||||
max_lum, // max_display_mastering_luminance
|
|
||||||
min_lum, // min_display_mastering_luminance
|
|
||||||
MaxCLL, // Maximum Content Light Level (MaxCLL)
|
|
||||||
MaxFALL, // Maximum Frame-Average Light Level (MaxFALL)
|
|
||||||
eotf);
|
|
||||||
|
|
||||||
|
ret = drmModeCreatePropertyBlob(render->fd_drm, &data, sizeof(data), &render->hdr_blob_id);
|
||||||
|
if (ret) {
|
||||||
|
printf("DRM: HDR metadata: failed blob create \n");
|
||||||
|
render->hdr_blob_id = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = drmModeConnectorSetProperty(render->fd_drm, render->connector_id, render->hdr_metadata, render->hdr_blob_id);
|
||||||
ret = drmModeCreatePropertyBlob(render->fd_drm, &data, sizeof(data), &render->hdr_blob_id);
|
if (ret) {
|
||||||
if (ret) {
|
printf("DRM: HDR metadata: failed property set %d\n", ret);
|
||||||
printf("DRM: HDR metadata: failed blob create \n");
|
|
||||||
render->hdr_blob_id = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = drmModeConnectorSetProperty(render->fd_drm, render->connector_id,
|
if (render->hdr_blob_id)
|
||||||
render->hdr_metadata, render->hdr_blob_id);
|
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||||
if (ret) {
|
render->hdr_blob_id = 0;
|
||||||
printf("DRM: HDR metadata: failed property set %d\n",ret);
|
return;
|
||||||
|
}
|
||||||
if (render->hdr_blob_id)
|
|
||||||
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
|
||||||
render->hdr_blob_id = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_need_modeset = 1;
|
m_need_modeset = 1;
|
||||||
|
|
||||||
Debug(3,"DRM: HDR metadata: prop set\n");
|
Debug(3, "DRM: HDR metadata: prop set\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
22
iatomic.h
22
iatomic.h
@ -23,9 +23,7 @@
|
|||||||
/// @addtogroup iatomic
|
/// @addtogroup iatomic
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#define GCC_VERSION (__GNUC__ * 10000 \
|
#define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
|
||||||
+ __GNUC_MINOR__ * 100 \
|
|
||||||
+ __GNUC_PATCHLEVEL__)
|
|
||||||
|
|
||||||
// gcc before 4.7 didn't support atomic builtins,
|
// gcc before 4.7 didn't support atomic builtins,
|
||||||
// use alsa atomic functions.
|
// use alsa atomic functions.
|
||||||
@ -59,38 +57,32 @@ typedef volatile int atomic_t;
|
|||||||
///
|
///
|
||||||
/// Set atomic value.
|
/// Set atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_set(ptr, val) \
|
#define atomic_set(ptr, val) __atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Read atomic value.
|
/// Read atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_read(ptr) \
|
#define atomic_read(ptr) __atomic_load_n(ptr, __ATOMIC_SEQ_CST)
|
||||||
__atomic_load_n(ptr, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Increment atomic value.
|
/// Increment atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_inc(ptr) \
|
#define atomic_inc(ptr) __atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
||||||
__atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Decrement atomic value.
|
/// Decrement atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_dec(ptr) \
|
#define atomic_dec(ptr) __atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
||||||
__atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Add to atomic value.
|
/// Add to atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_add(val, ptr) \
|
#define atomic_add(val, ptr) __atomic_add_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_add_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Subtract from atomic value.
|
/// Subtract from atomic value.
|
||||||
///
|
///
|
||||||
#define atomic_sub(val, ptr) \
|
#define atomic_sub(val, ptr) __atomic_sub_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
||||||
__atomic_sub_fetch(ptr, val, __ATOMIC_SEQ_CST)
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
47
misc.h
47
misc.h
@ -24,9 +24,9 @@
|
|||||||
/// @addtogroup misc
|
/// @addtogroup misc
|
||||||
/// @{
|
/// @{
|
||||||
|
|
||||||
#include <syslog.h>
|
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <time.h> // clock_gettime
|
#include <syslog.h>
|
||||||
|
#include <time.h> // clock_gettime
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Defines
|
// Defines
|
||||||
@ -40,23 +40,22 @@
|
|||||||
// Variables
|
// Variables
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
extern int SysLogLevel; ///< how much information wanted
|
extern int SysLogLevel; ///< how much information wanted
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
static inline void Syslog(const int, const char *format, ...)
|
static inline void Syslog(const int, const char *format, ...) __attribute__((format(printf, 2, 3)));
|
||||||
__attribute__((format(printf, 2, 3)));
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
// Inlines
|
// Inlines
|
||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define DebugLevel 4 /// private debug level
|
#define DebugLevel 4 /// private debug level
|
||||||
#else
|
#else
|
||||||
#define DebugLevel 0 /// private debug level
|
#define DebugLevel 0 /// private debug level
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -67,8 +66,7 @@ static inline void Syslog(const int, const char *format, ...)
|
|||||||
** - 2 info
|
** - 2 info
|
||||||
** - 3 important debug and fixme's
|
** - 3 important debug and fixme's
|
||||||
*/
|
*/
|
||||||
static inline void Syslog(const int level, const char *format, ...)
|
static inline void Syslog(const int level, const char *format, ...) {
|
||||||
{
|
|
||||||
if (SysLogLevel > level || DebugLevel > level) {
|
if (SysLogLevel > level || DebugLevel > level) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -81,30 +79,34 @@ static inline void Syslog(const int level, const char *format, ...)
|
|||||||
/**
|
/**
|
||||||
** Show error.
|
** Show error.
|
||||||
*/
|
*/
|
||||||
#define Error(fmt...) Syslog(LOG_ERR, fmt)
|
#define Error(fmt...) Syslog(LOG_ERR, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show fatal error.
|
** Show fatal error.
|
||||||
*/
|
*/
|
||||||
#define Fatal(fmt...) do { Error(fmt); abort(); } while (0)
|
#define Fatal(fmt...) \
|
||||||
|
do { \
|
||||||
|
Error(fmt); \
|
||||||
|
abort(); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show warning.
|
** Show warning.
|
||||||
*/
|
*/
|
||||||
#define Warning(fmt...) Syslog(LOG_WARNING, fmt)
|
#define Warning(fmt...) Syslog(LOG_WARNING, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show info.
|
** Show info.
|
||||||
*/
|
*/
|
||||||
#define Info(fmt...) Syslog(LOG_INFO, fmt)
|
#define Info(fmt...) Syslog(LOG_INFO, fmt)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Show debug.
|
** Show debug.
|
||||||
*/
|
*/
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
#define Debug(level, fmt...) Syslog(level, fmt)
|
#define Debug(level, fmt...) Syslog(level, fmt)
|
||||||
#else
|
#else
|
||||||
#define Debug(level, fmt...) /* disabled */
|
#define Debug(level, fmt...) /* disabled */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef AV_NOPTS_VALUE
|
#ifndef AV_NOPTS_VALUE
|
||||||
@ -116,17 +118,16 @@ static inline void Syslog(const int level, const char *format, ...)
|
|||||||
**
|
**
|
||||||
** @param ts dvb time stamp
|
** @param ts dvb time stamp
|
||||||
*/
|
*/
|
||||||
static inline const char *Timestamp2String(int64_t ts)
|
static inline const char *Timestamp2String(int64_t ts) {
|
||||||
{
|
|
||||||
static char buf[4][16];
|
static char buf[4][16];
|
||||||
static int idx;
|
static int idx;
|
||||||
|
|
||||||
if (ts == (int64_t) AV_NOPTS_VALUE) {
|
if (ts == (int64_t)AV_NOPTS_VALUE) {
|
||||||
return "--:--:--.---";
|
return "--:--:--.---";
|
||||||
}
|
}
|
||||||
idx = (idx + 1) % 3;
|
idx = (idx + 1) % 3;
|
||||||
snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d", (int)(ts / (90 * 3600000)),
|
snprintf(buf[idx], sizeof(buf[idx]), "%2d:%02d:%02d.%03d", (int)(ts / (90 * 3600000)),
|
||||||
(int)((ts / (90 * 60000)) % 60), (int)((ts / (90 * 1000)) % 60), (int)((ts / 90) % 1000));
|
(int)((ts / (90 * 60000)) % 60), (int)((ts / (90 * 1000)) % 60), (int)((ts / 90) % 1000));
|
||||||
|
|
||||||
return buf[idx];
|
return buf[idx];
|
||||||
}
|
}
|
||||||
@ -136,8 +137,7 @@ static inline const char *Timestamp2String(int64_t ts)
|
|||||||
**
|
**
|
||||||
** @returns ticks in ms,
|
** @returns ticks in ms,
|
||||||
*/
|
*/
|
||||||
static inline uint32_t GetMsTicks(void)
|
static inline uint32_t GetMsTicks(void) {
|
||||||
{
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
struct timespec tspec;
|
struct timespec tspec;
|
||||||
|
|
||||||
@ -153,14 +153,13 @@ static inline uint32_t GetMsTicks(void)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline uint64_t GetusTicks(void)
|
static inline uint64_t GetusTicks(void) {
|
||||||
{
|
|
||||||
|
|
||||||
#ifdef CLOCK_MONOTONIC
|
#ifdef CLOCK_MONOTONIC
|
||||||
struct timespec tspec;
|
struct timespec tspec;
|
||||||
|
|
||||||
clock_gettime(CLOCK_MONOTONIC, &tspec);
|
clock_gettime(CLOCK_MONOTONIC, &tspec);
|
||||||
return (uint64_t) (tspec.tv_sec * 1000000) + (tspec.tv_nsec);
|
return (uint64_t)(tspec.tv_sec * 1000000) + (tspec.tv_nsec);
|
||||||
#else
|
#else
|
||||||
struct timeval tval;
|
struct timeval tval;
|
||||||
|
|
||||||
|
845
openglosd.cpp
845
openglosd.cpp
File diff suppressed because it is too large
Load Diff
603
openglosd.h
603
openglosd.h
@ -1,6 +1,7 @@
|
|||||||
#ifndef __SOFTHDDEVICE_OPENGLOSD_H
|
#ifndef __SOFTHDDEVICE_OPENGLOSD_H
|
||||||
#define __SOFTHDDEVICE_OPENGLOSD_H
|
#define __SOFTHDDEVICE_OPENGLOSD_H
|
||||||
|
|
||||||
|
// clang-format off
|
||||||
#include <GL/glew.h>
|
#include <GL/glew.h>
|
||||||
#include <GL/freeglut.h>
|
#include <GL/freeglut.h>
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
@ -17,9 +18,9 @@
|
|||||||
#include FT_STROKER_H
|
#include FT_STROKER_H
|
||||||
|
|
||||||
#undef __FTERRORS_H__
|
#undef __FTERRORS_H__
|
||||||
#define FT_ERRORDEF( e, v, s ) { e, s },
|
#define FT_ERRORDEF( e, v, s ) { e, s },
|
||||||
#define FT_ERROR_START_LIST {
|
#define FT_ERROR_START_LIST {
|
||||||
#define FT_ERROR_END_LIST { 0, 0 } };
|
#define FT_ERROR_END_LIST { 0, 0 } };
|
||||||
const struct
|
const struct
|
||||||
{
|
{
|
||||||
int code;
|
int code;
|
||||||
@ -36,17 +37,15 @@ extern "C"
|
|||||||
{
|
{
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <libavcodec/avcodec.h>
|
#include <libavcodec/avcodec.h>
|
||||||
|
|
||||||
#include "audio.h"
|
#include "audio.h"
|
||||||
#include "video.h"
|
#include "video.h"
|
||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// clang-format on
|
||||||
|
|
||||||
extern "C" pthread_mutex_t OSDMutex;
|
extern "C" pthread_mutex_t OSDMutex;
|
||||||
|
|
||||||
struct sOglImage
|
struct sOglImage {
|
||||||
{
|
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
GLint width;
|
GLint width;
|
||||||
GLint height;
|
GLint height;
|
||||||
@ -54,54 +53,42 @@ struct sOglImage
|
|||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* Helpers
|
* Helpers
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
|
|
||||||
void ConvertColor(const GLint & colARGB, glm::vec4 & col);
|
void ConvertColor(const GLint &colARGB, glm::vec4 &col);
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cShader
|
* cShader
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
enum eShaderType
|
enum eShaderType { stRect, stTexture, stText, stCount };
|
||||||
{
|
|
||||||
stRect,
|
|
||||||
stTexture,
|
|
||||||
stText,
|
|
||||||
stCount
|
|
||||||
};
|
|
||||||
|
|
||||||
class cShader
|
class cShader {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
eShaderType type;
|
eShaderType type;
|
||||||
GLuint id;
|
GLuint id;
|
||||||
bool Compile(const char *vertexCode, const char *fragmentCode);
|
bool Compile(const char *vertexCode, const char *fragmentCode);
|
||||||
bool CheckCompileErrors(GLuint object, bool program = false);
|
bool CheckCompileErrors(GLuint object, bool program = false);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cShader(void)
|
cShader(void){};
|
||||||
{
|
virtual ~cShader(void){};
|
||||||
};
|
|
||||||
virtual ~ cShader(void)
|
|
||||||
{
|
|
||||||
};
|
|
||||||
bool Load(eShaderType type);
|
bool Load(eShaderType type);
|
||||||
void Use(void);
|
void Use(void);
|
||||||
void SetFloat(const GLchar * name, GLfloat value);
|
void SetFloat(const GLchar *name, GLfloat value);
|
||||||
void SetInteger(const GLchar * name, GLint value);
|
void SetInteger(const GLchar *name, GLint value);
|
||||||
void SetVector2f(const GLchar * name, GLfloat x, GLfloat y);
|
void SetVector2f(const GLchar *name, GLfloat x, GLfloat y);
|
||||||
void SetVector3f(const GLchar * name, GLfloat x, GLfloat y, GLfloat z);
|
void SetVector3f(const GLchar *name, GLfloat x, GLfloat y, GLfloat z);
|
||||||
void SetVector4f(const GLchar * name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
void SetVector4f(const GLchar *name, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||||
void SetMatrix4(const GLchar * name, const glm::mat4 & matrix);
|
void SetMatrix4(const GLchar *name, const glm::mat4 &matrix);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglGlyph
|
* cOglGlyph
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglGlyph:public cListObject
|
class cOglGlyph : public cListObject {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
struct tKerning
|
struct tKerning {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
tKerning(FT_ULong prevSym, GLfloat kerning = 0.0f) {
|
tKerning(FT_ULong prevSym, GLfloat kerning = 0.0f) {
|
||||||
this->prevSym = prevSym;
|
this->prevSym = prevSym;
|
||||||
@ -117,47 +104,28 @@ class cOglGlyph:public cListObject
|
|||||||
int height;
|
int height;
|
||||||
int advanceX;
|
int advanceX;
|
||||||
|
|
||||||
cVector < tKerning > kerningCache;
|
cVector<tKerning> kerningCache;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
void LoadTexture(FT_BitmapGlyph ftGlyph);
|
void LoadTexture(FT_BitmapGlyph ftGlyph);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglGlyph(FT_ULong charCode, FT_BitmapGlyph ftGlyph);
|
cOglGlyph(FT_ULong charCode, FT_BitmapGlyph ftGlyph);
|
||||||
virtual ~ cOglGlyph();
|
virtual ~cOglGlyph();
|
||||||
FT_ULong CharCode(void)
|
FT_ULong CharCode(void) { return charCode; }
|
||||||
{
|
int AdvanceX(void) { return advanceX; }
|
||||||
return charCode;
|
int BearingLeft(void) const { return bearingLeft; }
|
||||||
}
|
int BearingTop(void) const { return bearingTop; }
|
||||||
int AdvanceX(void)
|
int Width(void) const { return width; }
|
||||||
{
|
int Height(void) const { return height; }
|
||||||
return advanceX;
|
|
||||||
}
|
|
||||||
int BearingLeft(void) const
|
|
||||||
{
|
|
||||||
return bearingLeft;
|
|
||||||
}
|
|
||||||
int BearingTop(void) const
|
|
||||||
{
|
|
||||||
return bearingTop;
|
|
||||||
}
|
|
||||||
int Width(void) const
|
|
||||||
{
|
|
||||||
return width;
|
|
||||||
}
|
|
||||||
int Height(void) const
|
|
||||||
{
|
|
||||||
return height;
|
|
||||||
}
|
|
||||||
int GetKerningCache(FT_ULong prevSym);
|
int GetKerningCache(FT_ULong prevSym);
|
||||||
void SetKerningCache(FT_ULong prevSym, int kerning);
|
void SetKerningCache(FT_ULong prevSym, int kerning);
|
||||||
void BindTexture(void);
|
void BindTexture(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglFont
|
* cOglFont
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglFont:public cListObject
|
class cOglFont : public cListObject {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
static bool initiated;
|
static bool initiated;
|
||||||
cString name;
|
cString name;
|
||||||
@ -166,40 +134,28 @@ class cOglFont:public cListObject
|
|||||||
int bottom;
|
int bottom;
|
||||||
static FT_Library ftLib;
|
static FT_Library ftLib;
|
||||||
FT_Face face;
|
FT_Face face;
|
||||||
static cList < cOglFont > *fonts;
|
static cList<cOglFont> *fonts;
|
||||||
mutable cList < cOglGlyph > glyphCache;
|
mutable cList<cOglGlyph> glyphCache;
|
||||||
cOglFont(const char *fontName, int charHeight);
|
cOglFont(const char *fontName, int charHeight);
|
||||||
static void Init(void);
|
static void Init(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual ~ cOglFont(void);
|
virtual ~cOglFont(void);
|
||||||
static cOglFont *Get(const char *name, int charHeight);
|
static cOglFont *Get(const char *name, int charHeight);
|
||||||
static void Cleanup(void);
|
static void Cleanup(void);
|
||||||
const char *Name(void)
|
const char *Name(void) { return *name; };
|
||||||
{
|
int Size(void) { return size; };
|
||||||
return *name;
|
int Bottom(void) { return bottom; };
|
||||||
};
|
int Height(void) { return height; };
|
||||||
int Size(void)
|
|
||||||
{
|
|
||||||
return size;
|
|
||||||
};
|
|
||||||
int Bottom(void)
|
|
||||||
{
|
|
||||||
return bottom;
|
|
||||||
};
|
|
||||||
int Height(void)
|
|
||||||
{
|
|
||||||
return height;
|
|
||||||
};
|
|
||||||
cOglGlyph *Glyph(FT_ULong charCode) const;
|
cOglGlyph *Glyph(FT_ULong charCode) const;
|
||||||
int Kerning(cOglGlyph * glyph, FT_ULong prevSym) const;
|
int Kerning(cOglGlyph *glyph, FT_ULong prevSym) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglFb
|
* cOglFb
|
||||||
* Framebuffer Object - OpenGL part of a Pixmap
|
* Framebuffer Object - OpenGL part of a Pixmap
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglFb
|
class cOglFb {
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
bool initiated;
|
bool initiated;
|
||||||
// GLuint fb;
|
// GLuint fb;
|
||||||
@ -207,16 +163,14 @@ class cOglFb
|
|||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint viewPortWidth, viewPortHeight;
|
GLint viewPortWidth, viewPortHeight;
|
||||||
bool scrollable;
|
bool scrollable;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLuint fb;
|
GLuint fb;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
|
|
||||||
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
|
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
|
||||||
virtual ~ cOglFb(void);
|
virtual ~cOglFb(void);
|
||||||
bool Initiated(void)
|
bool Initiated(void) { return initiated; }
|
||||||
{
|
|
||||||
return initiated;
|
|
||||||
}
|
|
||||||
virtual bool Init(void);
|
virtual bool Init(void);
|
||||||
void Bind(void);
|
void Bind(void);
|
||||||
void BindRead(void);
|
void BindRead(void);
|
||||||
@ -224,64 +178,42 @@ class cOglFb
|
|||||||
virtual void Unbind(void);
|
virtual void Unbind(void);
|
||||||
bool BindTexture(void);
|
bool BindTexture(void);
|
||||||
void Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2);
|
void Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2);
|
||||||
GLint Width(void)
|
GLint Width(void) { return width; };
|
||||||
{
|
GLint Height(void) { return height; };
|
||||||
return width;
|
bool Scrollable(void) { return scrollable; };
|
||||||
};
|
GLint ViewportWidth(void) { return viewPortWidth; };
|
||||||
GLint Height(void)
|
GLint ViewportHeight(void) { return viewPortHeight; };
|
||||||
{
|
|
||||||
return height;
|
|
||||||
};
|
|
||||||
bool Scrollable(void)
|
|
||||||
{
|
|
||||||
return scrollable;
|
|
||||||
};
|
|
||||||
GLint ViewportWidth(void)
|
|
||||||
{
|
|
||||||
return viewPortWidth;
|
|
||||||
};
|
|
||||||
GLint ViewportHeight(void)
|
|
||||||
{
|
|
||||||
return viewPortHeight;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglOutputFb
|
* cOglOutputFb
|
||||||
* Output Framebuffer Object - holds Vdpau Output Surface which is our "output framebuffer"
|
* Output Framebuffer Object - holds Vdpau Output Surface which is our "output
|
||||||
****************************************************************************************/
|
*framebuffer"
|
||||||
class cOglOutputFb:public cOglFb
|
****************************************************************************************/
|
||||||
{
|
class cOglOutputFb : public cOglFb {
|
||||||
protected:
|
protected:
|
||||||
bool initiated;
|
bool initiated;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
GLvdpauSurfaceNV surface;
|
GLvdpauSurfaceNV surface;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GLuint fb;
|
GLuint fb;
|
||||||
GLuint texture;
|
GLuint texture;
|
||||||
cOglOutputFb(GLint width, GLint height);
|
cOglOutputFb(GLint width, GLint height);
|
||||||
virtual ~ cOglOutputFb(void);
|
virtual ~cOglOutputFb(void);
|
||||||
virtual bool Init(void);
|
virtual bool Init(void);
|
||||||
virtual void BindWrite(void);
|
virtual void BindWrite(void);
|
||||||
virtual void Unbind(void);
|
virtual void Unbind(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglVb
|
* cOglVb
|
||||||
* Vertex Buffer - OpenGl Vertices for the different drawing commands
|
* Vertex Buffer - OpenGl Vertices for the different drawing commands
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
enum eVertexBufferType
|
enum eVertexBufferType { vbRect, vbEllipse, vbSlope, vbTexture, vbText, vbCount };
|
||||||
{
|
|
||||||
vbRect,
|
|
||||||
vbEllipse,
|
|
||||||
vbSlope,
|
|
||||||
vbTexture,
|
|
||||||
vbText,
|
|
||||||
vbCount
|
|
||||||
};
|
|
||||||
|
|
||||||
class cOglVb
|
class cOglVb {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
eVertexBufferType type;
|
eVertexBufferType type;
|
||||||
eShaderType shader;
|
eShaderType shader;
|
||||||
@ -291,9 +223,10 @@ class cOglVb
|
|||||||
int sizeVertex2;
|
int sizeVertex2;
|
||||||
int numVertices;
|
int numVertices;
|
||||||
GLuint drawMode;
|
GLuint drawMode;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglVb(int type);
|
cOglVb(int type);
|
||||||
virtual ~ cOglVb(void);
|
virtual ~cOglVb(void);
|
||||||
bool Init(void);
|
bool Init(void);
|
||||||
void Bind(void);
|
void Bind(void);
|
||||||
void Unbind(void);
|
void Unbind(void);
|
||||||
@ -303,148 +236,106 @@ class cOglVb
|
|||||||
void SetShaderColor(GLint color);
|
void SetShaderColor(GLint color);
|
||||||
void SetShaderAlpha(GLint alpha);
|
void SetShaderAlpha(GLint alpha);
|
||||||
void SetShaderProjectionMatrix(GLint width, GLint height);
|
void SetShaderProjectionMatrix(GLint width, GLint height);
|
||||||
void SetVertexData(GLfloat * vertices, int count = 0);
|
void SetVertexData(GLfloat *vertices, int count = 0);
|
||||||
void DrawArrays(int count = 0);
|
void DrawArrays(int count = 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOpenGLCmd
|
* cOpenGLCmd
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglCmd
|
class cOglCmd {
|
||||||
{
|
|
||||||
protected:
|
protected:
|
||||||
cOglFb * fb;
|
cOglFb *fb;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmd(cOglFb * fb)
|
cOglCmd(cOglFb *fb) { this->fb = fb; };
|
||||||
{
|
virtual ~cOglCmd(void){};
|
||||||
this->fb = fb;
|
|
||||||
};
|
|
||||||
virtual ~ cOglCmd(void)
|
|
||||||
{
|
|
||||||
};
|
|
||||||
virtual const char *Description(void) = 0;
|
virtual const char *Description(void) = 0;
|
||||||
virtual bool Execute(void) = 0;
|
virtual bool Execute(void) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdInitOutputFb:public cOglCmd
|
class cOglCmdInitOutputFb : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cOglOutputFb * oFb;
|
cOglOutputFb *oFb;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdInitOutputFb(cOglOutputFb * oFb);
|
cOglCmdInitOutputFb(cOglOutputFb *oFb);
|
||||||
virtual ~ cOglCmdInitOutputFb(void)
|
virtual ~cOglCmdInitOutputFb(void){};
|
||||||
{
|
virtual const char *Description(void) { return "InitOutputFramebuffer"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "InitOutputFramebuffer";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdInitFb:public cOglCmd
|
class cOglCmdInitFb : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cCondWait * wait;
|
cCondWait *wait;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdInitFb(cOglFb * fb, cCondWait * wait = NULL);
|
cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL);
|
||||||
virtual ~ cOglCmdInitFb(void)
|
virtual ~cOglCmdInitFb(void){};
|
||||||
{
|
virtual const char *Description(void) { return "InitFramebuffer"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "InitFramebuffer";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDeleteFb:public cOglCmd
|
class cOglCmdDeleteFb : public cOglCmd {
|
||||||
{
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDeleteFb(cOglFb * fb);
|
cOglCmdDeleteFb(cOglFb *fb);
|
||||||
virtual ~ cOglCmdDeleteFb(void)
|
virtual ~cOglCmdDeleteFb(void){};
|
||||||
{
|
virtual const char *Description(void) { return "DeleteFramebuffer"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "DeleteFramebuffer";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdRenderFbToBufferFb:public cOglCmd
|
class cOglCmdRenderFbToBufferFb : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cOglFb * buffer;
|
cOglFb *buffer;
|
||||||
GLfloat x, y;
|
GLfloat x, y;
|
||||||
GLfloat drawPortX, drawPortY;
|
GLfloat drawPortX, drawPortY;
|
||||||
GLint transparency;
|
GLint transparency;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdRenderFbToBufferFb(cOglFb * fb, cOglFb * buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
|
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
|
||||||
GLint drawPortY);
|
GLint drawPortY);
|
||||||
virtual ~ cOglCmdRenderFbToBufferFb(void)
|
virtual ~cOglCmdRenderFbToBufferFb(void){};
|
||||||
{
|
virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "Render Framebuffer to Buffer";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdCopyBufferToOutputFb:public cOglCmd
|
class cOglCmdCopyBufferToOutputFb : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cOglOutputFb * oFb;
|
cOglOutputFb *oFb;
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdCopyBufferToOutputFb(cOglFb * fb, cOglOutputFb * oFb, GLint x, GLint y);
|
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y);
|
||||||
virtual ~ cOglCmdCopyBufferToOutputFb(void)
|
virtual ~cOglCmdCopyBufferToOutputFb(void){};
|
||||||
{
|
virtual const char *Description(void) { return "Copy buffer to OutputFramebuffer"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "Copy buffer to OutputFramebuffer";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdFill:public cOglCmd
|
class cOglCmdFill : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
GLint color;
|
GLint color;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdFill(cOglFb * fb, GLint color);
|
cOglCmdFill(cOglFb *fb, GLint color);
|
||||||
virtual ~ cOglCmdFill(void)
|
virtual ~cOglCmdFill(void){};
|
||||||
{
|
virtual const char *Description(void) { return "Fill"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "Fill";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawRectangle:public cOglCmd
|
class cOglCmdDrawRectangle : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint color;
|
GLint color;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawRectangle(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color);
|
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color);
|
||||||
virtual ~ cOglCmdDrawRectangle(void)
|
virtual ~cOglCmdDrawRectangle(void){};
|
||||||
{
|
virtual const char *Description(void) { return "DrawRectangle"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "DrawRectangle";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawEllipse:public cOglCmd
|
class cOglCmdDrawEllipse : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
@ -453,39 +344,29 @@ class cOglCmdDrawEllipse:public cOglCmd
|
|||||||
GLfloat *CreateVerticesFull(int &numVertices);
|
GLfloat *CreateVerticesFull(int &numVertices);
|
||||||
GLfloat *CreateVerticesQuadrant(int &numVertices);
|
GLfloat *CreateVerticesQuadrant(int &numVertices);
|
||||||
GLfloat *CreateVerticesHalf(int &numVertices);
|
GLfloat *CreateVerticesHalf(int &numVertices);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawEllipse(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
|
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
|
||||||
virtual ~ cOglCmdDrawEllipse(void)
|
virtual ~cOglCmdDrawEllipse(void){};
|
||||||
{
|
virtual const char *Description(void) { return "DrawEllipse"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "DrawEllipse";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawSlope:public cOglCmd
|
class cOglCmdDrawSlope : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint width, height;
|
GLint width, height;
|
||||||
GLint color;
|
GLint color;
|
||||||
GLint type;
|
GLint type;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawSlope(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
|
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
|
||||||
virtual ~ cOglCmdDrawSlope(void)
|
virtual ~cOglCmdDrawSlope(void){};
|
||||||
{
|
virtual const char *Description(void) { return "DrawSlope"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "DrawSlope";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawText:public cOglCmd
|
class cOglCmdDrawText : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
GLint limitX;
|
GLint limitX;
|
||||||
@ -493,97 +374,78 @@ class cOglCmdDrawText:public cOglCmd
|
|||||||
cString fontName;
|
cString fontName;
|
||||||
int fontSize;
|
int fontSize;
|
||||||
unsigned int *symbols;
|
unsigned int *symbols;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawText(cOglFb * fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name,
|
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize,
|
||||||
int fontSize, tColor colorText);
|
tColor colorText);
|
||||||
virtual ~ cOglCmdDrawText(void);
|
virtual ~cOglCmdDrawText(void);
|
||||||
virtual const char *Description(void)
|
virtual const char *Description(void) { return "DrawText"; }
|
||||||
{
|
|
||||||
return "DrawText";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawImage:public cOglCmd
|
class cOglCmdDrawImage : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
tColor * argb;
|
tColor *argb;
|
||||||
GLint x, y, width, height;
|
GLint x, y, width, height;
|
||||||
bool overlay;
|
bool overlay;
|
||||||
GLfloat scaleX, scaleY;
|
GLfloat scaleX, scaleY;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawImage(cOglFb * fb, tColor * argb, GLint width, GLint height, GLint x, GLint y, bool overlay =
|
cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true,
|
||||||
true, double scaleX = 1.0f, double scaleY = 1.0f);
|
double scaleX = 1.0f, double scaleY = 1.0f);
|
||||||
virtual ~ cOglCmdDrawImage(void);
|
virtual ~cOglCmdDrawImage(void);
|
||||||
virtual const char *Description(void)
|
virtual const char *Description(void) { return "Draw Image"; }
|
||||||
{
|
|
||||||
return "Draw Image";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDrawTexture:public cOglCmd
|
class cOglCmdDrawTexture : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
sOglImage * imageRef;
|
sOglImage *imageRef;
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDrawTexture(cOglFb * fb, sOglImage * imageRef, GLint x, GLint y);
|
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y);
|
||||||
virtual ~ cOglCmdDrawTexture(void)
|
virtual ~cOglCmdDrawTexture(void){};
|
||||||
{
|
virtual const char *Description(void) { return "Draw Texture"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "Draw Texture";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdStoreImage:public cOglCmd
|
class cOglCmdStoreImage : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
sOglImage * imageRef;
|
sOglImage *imageRef;
|
||||||
tColor *data;
|
tColor *data;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdStoreImage(sOglImage * imageRef, tColor * argb);
|
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb);
|
||||||
virtual ~ cOglCmdStoreImage(void);
|
virtual ~cOglCmdStoreImage(void);
|
||||||
virtual const char *Description(void)
|
virtual const char *Description(void) { return "Store Image"; }
|
||||||
{
|
|
||||||
return "Store Image";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
class cOglCmdDropImage:public cOglCmd
|
class cOglCmdDropImage : public cOglCmd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
sOglImage * imageRef;
|
sOglImage *imageRef;
|
||||||
cCondWait *wait;
|
cCondWait *wait;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglCmdDropImage(sOglImage * imageRef, cCondWait * wait);
|
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait);
|
||||||
virtual ~ cOglCmdDropImage(void)
|
virtual ~cOglCmdDropImage(void){};
|
||||||
{
|
virtual const char *Description(void) { return "Drop Image"; }
|
||||||
};
|
|
||||||
virtual const char *Description(void)
|
|
||||||
{
|
|
||||||
return "Drop Image";
|
|
||||||
}
|
|
||||||
virtual bool Execute(void);
|
virtual bool Execute(void);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* cOglThread
|
* cOglThread
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
#define OGL_MAX_OSDIMAGES 256
|
#define OGL_MAX_OSDIMAGES 256
|
||||||
#define OGL_CMDQUEUE_SIZE 100
|
#define OGL_CMDQUEUE_SIZE 100
|
||||||
|
|
||||||
class cOglThread:public cThread
|
class cOglThread : public cThread {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cCondWait * startWait;
|
cCondWait *startWait;
|
||||||
cCondWait *wait;
|
cCondWait *wait;
|
||||||
bool stalled;
|
bool stalled;
|
||||||
std::queue < cOglCmd * >commands;
|
std::queue<cOglCmd *> commands;
|
||||||
GLint maxTextureSize;
|
GLint maxTextureSize;
|
||||||
sOglImage imageCache[OGL_MAX_OSDIMAGES];
|
sOglImage imageCache[OGL_MAX_OSDIMAGES];
|
||||||
long memCached;
|
long memCached;
|
||||||
@ -597,96 +459,81 @@ class cOglThread:public cThread
|
|||||||
void Cleanup(void);
|
void Cleanup(void);
|
||||||
int GetFreeSlot(void);
|
int GetFreeSlot(void);
|
||||||
void ClearSlot(int slot);
|
void ClearSlot(int slot);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void Action(void);
|
virtual void Action(void);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglThread(cCondWait * startWait, int maxCacheSize);
|
cOglThread(cCondWait *startWait, int maxCacheSize);
|
||||||
virtual ~ cOglThread();
|
virtual ~cOglThread();
|
||||||
void Stop(void);
|
void Stop(void);
|
||||||
void DoCmd(cOglCmd * cmd);
|
void DoCmd(cOglCmd *cmd);
|
||||||
int StoreImage(const cImage & image);
|
int StoreImage(const cImage &image);
|
||||||
void DropImageData(int imageHandle);
|
void DropImageData(int imageHandle);
|
||||||
sOglImage *GetImageRef(int slot);
|
sOglImage *GetImageRef(int slot);
|
||||||
int MaxTextureSize(void)
|
int MaxTextureSize(void) { return maxTextureSize; };
|
||||||
{
|
|
||||||
return maxTextureSize;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOglPixmap
|
* cOglPixmap
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
class cOglPixmap:public cPixmap
|
class cOglPixmap : public cPixmap {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cOglFb * fb;
|
cOglFb *fb;
|
||||||
std::shared_ptr < cOglThread > oglThread;
|
std::shared_ptr<cOglThread> oglThread;
|
||||||
bool dirty;
|
bool dirty;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
cOglPixmap(std::shared_ptr < cOglThread > oglThread, int Layer, const cRect & ViewPort, const cRect & DrawPort =
|
cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const cRect &ViewPort,
|
||||||
cRect::Null);
|
const cRect &DrawPort = cRect::Null);
|
||||||
virtual ~ cOglPixmap(void);
|
virtual ~cOglPixmap(void);
|
||||||
cOglFb *Fb(void)
|
cOglFb *Fb(void) { return fb; };
|
||||||
{
|
int X(void) { return ViewPort().X(); };
|
||||||
return fb;
|
int Y(void) { return ViewPort().Y(); };
|
||||||
};
|
virtual bool IsDirty(void) { return dirty; }
|
||||||
int X(void)
|
virtual void SetDirty(bool dirty = true) { this->dirty = dirty; }
|
||||||
{
|
|
||||||
return ViewPort().X();
|
|
||||||
};
|
|
||||||
int Y(void)
|
|
||||||
{
|
|
||||||
return ViewPort().Y();
|
|
||||||
};
|
|
||||||
virtual bool IsDirty(void)
|
|
||||||
{
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
virtual void SetDirty(bool dirty = true) {
|
|
||||||
this->dirty = dirty;
|
|
||||||
}
|
|
||||||
virtual void SetAlpha(int Alpha);
|
virtual void SetAlpha(int Alpha);
|
||||||
virtual void SetTile(bool Tile);
|
virtual void SetTile(bool Tile);
|
||||||
virtual void SetViewPort(const cRect & Rect);
|
virtual void SetViewPort(const cRect &Rect);
|
||||||
virtual void SetDrawPortPoint(const cPoint & Point, bool Dirty = true);
|
virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty = true);
|
||||||
virtual void Clear(void);
|
virtual void Clear(void);
|
||||||
virtual void Fill(tColor Color);
|
virtual void Fill(tColor Color);
|
||||||
virtual void DrawImage(const cPoint & Point, const cImage & Image);
|
virtual void DrawImage(const cPoint &Point, const cImage &Image);
|
||||||
virtual void DrawImage(const cPoint & Point, int ImageHandle);
|
virtual void DrawImage(const cPoint &Point, int ImageHandle);
|
||||||
virtual void DrawPixel(const cPoint & Point, tColor Color);
|
virtual void DrawPixel(const cPoint &Point, tColor Color);
|
||||||
virtual void DrawBitmap(const cPoint & Point, const cBitmap & Bitmap, tColor ColorFg = 0, tColor ColorBg =
|
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
|
||||||
0, bool Overlay = false);
|
bool Overlay = false);
|
||||||
virtual void DrawText(const cPoint & Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont * Font,
|
virtual void DrawText(const cPoint &Point, const char *s, tColor ColorFg, tColor ColorBg, const cFont *Font,
|
||||||
int Width = 0, int Height = 0, int Alignment = taDefault);
|
int Width = 0, int Height = 0, int Alignment = taDefault);
|
||||||
virtual void DrawRectangle(const cRect & Rect, tColor Color);
|
virtual void DrawRectangle(const cRect &Rect, tColor Color);
|
||||||
virtual void DrawEllipse(const cRect & Rect, tColor Color, int Quadrants = 0);
|
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0);
|
||||||
virtual void DrawSlope(const cRect & Rect, tColor Color, int Type);
|
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type);
|
||||||
virtual void Render(const cPixmap * Pixmap, const cRect & Source, const cPoint & Dest);
|
virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest);
|
||||||
virtual void Copy(const cPixmap * Pixmap, const cRect & Source, const cPoint & Dest);
|
virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest);
|
||||||
virtual void Scroll(const cPoint & Dest, const cRect & Source = cRect::Null);
|
virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null);
|
||||||
virtual void Pan(const cPoint & Dest, const cRect & Source = cRect::Null);
|
virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null);
|
||||||
};
|
};
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* cOglOsd
|
* cOglOsd
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
class cOglOsd:public cOsd
|
class cOglOsd : public cOsd {
|
||||||
{
|
|
||||||
private:
|
private:
|
||||||
cOglFb * bFb;
|
cOglFb *bFb;
|
||||||
std::shared_ptr < cOglThread > oglThread;
|
std::shared_ptr<cOglThread> oglThread;
|
||||||
cVector < cOglPixmap * >oglPixmaps;
|
cVector<cOglPixmap *> oglPixmaps;
|
||||||
bool isSubtitleOsd;
|
bool isSubtitleOsd;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
public:
|
public:
|
||||||
cOglOsd(int Left, int Top, uint Level, std::shared_ptr < cOglThread > oglThread);
|
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
|
||||||
virtual ~ cOglOsd();
|
virtual ~cOglOsd();
|
||||||
virtual eOsdError SetAreas(const tArea * Areas, int NumAreas);
|
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
|
||||||
virtual cPixmap *CreatePixmap(int Layer, const cRect & ViewPort, const cRect & DrawPort = cRect::Null);
|
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
|
||||||
virtual void DestroyPixmap(cPixmap * Pixmap);
|
virtual void DestroyPixmap(cPixmap *Pixmap);
|
||||||
virtual void Flush(void);
|
virtual void Flush(void);
|
||||||
virtual void DrawScaledBitmap(int x, int y, const cBitmap & Bitmap, double FactorX, double FactorY,
|
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY,
|
||||||
bool AntiAlias = false);
|
bool AntiAlias = false);
|
||||||
static cOglOutputFb *oFb;
|
static cOglOutputFb *oFb;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
111
po/de_DE.po
111
po/de_DE.po
@ -7,7 +7,7 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: VDR \n"
|
"Project-Id-Version: VDR \n"
|
||||||
"Report-Msgid-Bugs-To: <see README>\n"
|
"Report-Msgid-Bugs-To: <see README>\n"
|
||||||
"POT-Creation-Date: 2020-04-15 18:57+0200\n"
|
"POT-Creation-Date: 2021-12-30 10:23+0100\n"
|
||||||
"PO-Revision-Date: blabla\n"
|
"PO-Revision-Date: blabla\n"
|
||||||
"Last-Translator: blabla\n"
|
"Last-Translator: blabla\n"
|
||||||
"Language-Team: blabla\n"
|
"Language-Team: blabla\n"
|
||||||
@ -140,91 +140,6 @@ msgstr ""
|
|||||||
msgid "snd_pcm_drop(): %s\n"
|
msgid "snd_pcm_drop(): %s\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_GETOSPACE): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: write error: %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: error not all bytes written\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_HALT_OUTPUT): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: error poll %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: using %sdevice '%s'\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: can't open dsp device '%s': %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(MIXER_WRITE): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: can't open mixer device '%s': %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SOUND_MIXER_READ_DEVMASK): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: channel '%s' not supported\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: channel '%s' not found\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: should not happen\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_GETODELAY): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_SETFMT): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "audio/oss: device doesn't support 16 bit sample format.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_CHANNELS): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: device doesn't support %d channels.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_SPEED): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: device doesn't support %dHz sample rate.\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: ioctl(SNDCTL_DSP_POLICY): %s\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
|
||||||
msgid "audio/oss: delay %ums\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "audio: can't set channels %d sample-rate %dHz\n"
|
msgid "audio: can't set channels %d sample-rate %dHz\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -306,9 +221,6 @@ msgstr ""
|
|||||||
msgid "codec/audio: can't setup resample\n"
|
msgid "codec/audio: can't setup resample\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "codec/audio: can't open resample\n"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "A software and GPU emulated UHD device"
|
msgid "A software and GPU emulated UHD device"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -408,7 +320,7 @@ msgstr ""
|
|||||||
msgid "Hue (-314..314) "
|
msgid "Hue (-314..314) "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Monitor Colorspace"
|
msgid "Temperature 6500K + x * 100K"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "Color Blindness"
|
msgid "Color Blindness"
|
||||||
@ -417,6 +329,9 @@ msgstr ""
|
|||||||
msgid "Color Correction (-100..100) "
|
msgid "Color Correction (-100..100) "
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Monitor Type"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Scaling"
|
msgid "Scaling"
|
||||||
msgstr "Skalierung"
|
msgstr "Skalierung"
|
||||||
|
|
||||||
@ -574,15 +489,15 @@ msgstr ""
|
|||||||
msgid "Suspend SoftHdDevice"
|
msgid "Suspend SoftHdDevice"
|
||||||
msgstr "Unterbreche SoftHdDevice"
|
msgstr "Unterbreche SoftHdDevice"
|
||||||
|
|
||||||
|
msgid "Toggle LUT on/off"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "PIP toggle on/off: off"
|
msgid "PIP toggle on/off: off"
|
||||||
msgstr "PIP deaktivieren"
|
msgstr "PIP deaktivieren"
|
||||||
|
|
||||||
msgid "PIP toggle on/off: on"
|
msgid "PIP toggle on/off: on"
|
||||||
msgstr "PIP aktivieren"
|
msgstr "PIP aktivieren"
|
||||||
|
|
||||||
msgid "PIP zapmode (not working)"
|
|
||||||
msgstr ""
|
|
||||||
|
|
||||||
msgid "PIP channel +"
|
msgid "PIP channel +"
|
||||||
msgstr "PIP Kanal +"
|
msgstr "PIP Kanal +"
|
||||||
|
|
||||||
@ -715,6 +630,10 @@ msgstr ""
|
|||||||
msgid "[softhddev] no codec known for still picture\n"
|
msgid "[softhddev] no codec known for still picture\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
#, c-format
|
||||||
|
msgid "Too much shaders definded\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
#, c-format
|
#, c-format
|
||||||
msgid "Bad formated geometry please use: [=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]\n"
|
msgid "Bad formated geometry please use: [=][<width>{xX}<height>][{+-}<xoffset>{+-}<yoffset>]\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
@ -884,6 +803,9 @@ msgstr ""
|
|||||||
msgid "Failed initializing libplacebo\n"
|
msgid "Failed initializing libplacebo\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Failed to create placebo opengl \n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Failed to create XCB Surface\n"
|
msgid "Failed to create XCB Surface\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@ -893,6 +815,9 @@ msgstr ""
|
|||||||
msgid "Failed creating vulkan swapchain!"
|
msgid "Failed creating vulkan swapchain!"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "libplacebo: failed initializing swapchain\n"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Failed initializing libplacebo renderer\n"
|
msgid "Failed initializing libplacebo renderer\n"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
108
ringbuffer.c
108
ringbuffer.c
@ -1,5 +1,5 @@
|
|||||||
///
|
///
|
||||||
/// @file ringbuffer.c @brief Ringbuffer module
|
/// @file ringbuffer.c @brief Ringbuffer module
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009, 2011, 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009, 2011, 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
@ -34,17 +34,16 @@
|
|||||||
#include "ringbuffer.h"
|
#include "ringbuffer.h"
|
||||||
|
|
||||||
/// ring buffer structure
|
/// ring buffer structure
|
||||||
struct _ring_buffer_
|
struct _ring_buffer_ {
|
||||||
{
|
char *Buffer; ///< ring buffer data
|
||||||
char *Buffer; ///< ring buffer data
|
const char *BufferEnd; ///< end of buffer
|
||||||
const char *BufferEnd; ///< end of buffer
|
size_t Size; ///< bytes in buffer (for faster calc)
|
||||||
size_t Size; ///< bytes in buffer (for faster calc)
|
|
||||||
|
|
||||||
const char *ReadPointer; ///< only used by reader
|
const char *ReadPointer; ///< only used by reader
|
||||||
char *WritePointer; ///< only used by writer
|
char *WritePointer; ///< only used by writer
|
||||||
|
|
||||||
/// The only thing modified by both
|
/// The only thing modified by both
|
||||||
atomic_t Filled; ///< how many of the buffer is used
|
atomic_t Filled; ///< how many of the buffer is used
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -52,8 +51,7 @@ struct _ring_buffer_
|
|||||||
**
|
**
|
||||||
** @param rb Ring buffer to reset read/write pointers.
|
** @param rb Ring buffer to reset read/write pointers.
|
||||||
*/
|
*/
|
||||||
void RingBufferReset(RingBuffer * rb)
|
void RingBufferReset(RingBuffer *rb) {
|
||||||
{
|
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
atomic_set(&rb->Filled, 0);
|
atomic_set(&rb->Filled, 0);
|
||||||
@ -67,11 +65,10 @@ void RingBufferReset(RingBuffer * rb)
|
|||||||
** @returns Allocated ring buffer, must be freed with
|
** @returns Allocated ring buffer, must be freed with
|
||||||
** RingBufferDel(), NULL for out of memory.
|
** RingBufferDel(), NULL for out of memory.
|
||||||
*/
|
*/
|
||||||
RingBuffer *RingBufferNew(size_t size)
|
RingBuffer *RingBufferNew(size_t size) {
|
||||||
{
|
|
||||||
RingBuffer *rb;
|
RingBuffer *rb;
|
||||||
|
|
||||||
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
|
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
|
||||||
return rb;
|
return rb;
|
||||||
}
|
}
|
||||||
if (!(rb->Buffer = malloc(size))) { // allocate buffer
|
if (!(rb->Buffer = malloc(size))) { // allocate buffer
|
||||||
@ -89,8 +86,7 @@ RingBuffer *RingBufferNew(size_t size)
|
|||||||
/**
|
/**
|
||||||
** Free an allocated ring buffer.
|
** Free an allocated ring buffer.
|
||||||
*/
|
*/
|
||||||
void RingBufferDel(RingBuffer * rb)
|
void RingBufferDel(RingBuffer *rb) {
|
||||||
{
|
|
||||||
free(rb->Buffer);
|
free(rb->Buffer);
|
||||||
free(rb);
|
free(rb);
|
||||||
}
|
}
|
||||||
@ -103,21 +99,20 @@ void RingBufferDel(RingBuffer * rb)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be advanced in ring buffer.
|
** @returns Number of bytes that could be advanced in ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
|
size_t RingBufferWriteAdvance(RingBuffer *rb, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = rb->Size - atomic_read(&rb->Filled);
|
n = rb->Size - atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough space
|
if (cnt > n) { // not enough space
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
rb->WritePointer += cnt;
|
rb->WritePointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
@ -126,7 +121,7 @@ size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only atomic modification!
|
// Only atomic modification!
|
||||||
//
|
//
|
||||||
atomic_add(cnt, &rb->Filled);
|
atomic_add(cnt, &rb->Filled);
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -142,22 +137,21 @@ size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
** @returns The number of bytes that could be placed in the ring
|
** @returns The number of bytes that could be placed in the ring
|
||||||
** buffer.
|
** buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
|
size_t RingBufferWrite(RingBuffer *rb, const void *buf, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = rb->Size - atomic_read(&rb->Filled);
|
n = rb->Size - atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough space
|
if (cnt > n) { // not enough space
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
memcpy(rb->WritePointer, buf, cnt);
|
memcpy(rb->WritePointer, buf, cnt);
|
||||||
rb->WritePointer += cnt;
|
rb->WritePointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
memcpy(rb->WritePointer, buf, n);
|
memcpy(rb->WritePointer, buf, n);
|
||||||
rb->WritePointer = rb->Buffer;
|
rb->WritePointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
@ -169,7 +163,7 @@ size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only atomic modification!
|
// Only atomic modification!
|
||||||
//
|
//
|
||||||
atomic_add(cnt, &rb->Filled);
|
atomic_add(cnt, &rb->Filled);
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -184,21 +178,20 @@ size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
|
|||||||
** @returns The number of bytes that could be placed in the ring
|
** @returns The number of bytes that could be placed in the ring
|
||||||
** buffer at the write pointer.
|
** buffer at the write pointer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
|
size_t RingBufferGetWritePointer(RingBuffer *rb, void **wp) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
|
||||||
// Total free bytes available in ring buffer
|
// Total free bytes available in ring buffer
|
||||||
cnt = rb->Size - atomic_read(&rb->Filled);
|
cnt = rb->Size - atomic_read(&rb->Filled);
|
||||||
|
|
||||||
*wp = rb->WritePointer;
|
*wp = rb->WritePointer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->WritePointer;
|
n = rb->BufferEnd - rb->WritePointer;
|
||||||
if (n <= cnt) { // reached or cross the end
|
if (n <= cnt) { // reached or cross the end
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -212,21 +205,20 @@ size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be advanced in ring buffer.
|
** @returns Number of bytes that could be advanced in ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
|
size_t RingBufferReadAdvance(RingBuffer *rb, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = atomic_read(&rb->Filled);
|
n = atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough filled
|
if (cnt > n) { // not enough filled
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
rb->ReadPointer += cnt;
|
rb->ReadPointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
n = cnt - n;
|
n = cnt - n;
|
||||||
@ -235,7 +227,7 @@ size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only atomic modification!
|
// Only atomic modification!
|
||||||
//
|
//
|
||||||
atomic_sub(cnt, &rb->Filled);
|
atomic_sub(cnt, &rb->Filled);
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -250,22 +242,21 @@ size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes that could be read from ring buffer.
|
** @returns Number of bytes that could be read from ring buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
|
size_t RingBufferRead(RingBuffer *rb, void *buf, size_t cnt) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
|
|
||||||
n = atomic_read(&rb->Filled);
|
n = atomic_read(&rb->Filled);
|
||||||
if (cnt > n) { // not enough filled
|
if (cnt > n) { // not enough filled
|
||||||
cnt = n;
|
cnt = n;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n > cnt) { // don't cross the end
|
if (n > cnt) { // don't cross the end
|
||||||
memcpy(buf, rb->ReadPointer, cnt);
|
memcpy(buf, rb->ReadPointer, cnt);
|
||||||
rb->ReadPointer += cnt;
|
rb->ReadPointer += cnt;
|
||||||
} else { // reached or cross the end
|
} else { // reached or cross the end
|
||||||
memcpy(buf, rb->ReadPointer, n);
|
memcpy(buf, rb->ReadPointer, n);
|
||||||
rb->ReadPointer = rb->Buffer;
|
rb->ReadPointer = rb->Buffer;
|
||||||
if (n < cnt) {
|
if (n < cnt) {
|
||||||
@ -277,7 +268,7 @@ size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Only atomic modification!
|
// Only atomic modification!
|
||||||
//
|
//
|
||||||
atomic_sub(cnt, &rb->Filled);
|
atomic_sub(cnt, &rb->Filled);
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -292,21 +283,20 @@ size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
|
|||||||
** @returns The number of bytes that could be read from the ring
|
** @returns The number of bytes that could be read from the ring
|
||||||
** buffer at the read pointer.
|
** buffer at the read pointer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
|
size_t RingBufferGetReadPointer(RingBuffer *rb, const void **rp) {
|
||||||
{
|
|
||||||
size_t n;
|
size_t n;
|
||||||
size_t cnt;
|
size_t cnt;
|
||||||
|
|
||||||
// Total used bytes in ring buffer
|
// Total used bytes in ring buffer
|
||||||
cnt = atomic_read(&rb->Filled);
|
cnt = atomic_read(&rb->Filled);
|
||||||
|
|
||||||
*rp = rb->ReadPointer;
|
*rp = rb->ReadPointer;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Hitting end of buffer?
|
// Hitting end of buffer?
|
||||||
//
|
//
|
||||||
n = rb->BufferEnd - rb->ReadPointer;
|
n = rb->BufferEnd - rb->ReadPointer;
|
||||||
if (n <= cnt) { // reached or cross the end
|
if (n <= cnt) { // reached or cross the end
|
||||||
return n;
|
return n;
|
||||||
}
|
}
|
||||||
return cnt;
|
return cnt;
|
||||||
@ -319,10 +309,7 @@ size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes free in buffer.
|
** @returns Number of bytes free in buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferFreeBytes(RingBuffer * rb)
|
size_t RingBufferFreeBytes(RingBuffer *rb) { return rb->Size - atomic_read(&rb->Filled); }
|
||||||
{
|
|
||||||
return rb->Size - atomic_read(&rb->Filled);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Get used bytes in ring buffer.
|
** Get used bytes in ring buffer.
|
||||||
@ -331,7 +318,4 @@ size_t RingBufferFreeBytes(RingBuffer * rb)
|
|||||||
**
|
**
|
||||||
** @returns Number of bytes used in buffer.
|
** @returns Number of bytes used in buffer.
|
||||||
*/
|
*/
|
||||||
size_t RingBufferUsedBytes(RingBuffer * rb)
|
size_t RingBufferUsedBytes(RingBuffer *rb) { return atomic_read(&rb->Filled); }
|
||||||
{
|
|
||||||
return atomic_read(&rb->Filled);
|
|
||||||
}
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file ringbuffer.h @brief Ringbuffer module header file
|
/// @file ringbuffer.h @brief Ringbuffer module header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009, 2011 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009, 2011 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
|
251
shaders.h
251
shaders.h
@ -13,9 +13,9 @@ const char *gl_version = "#version 300 es ";
|
|||||||
|
|
||||||
/* Color conversion matrix: RGB = m * YUV + c
|
/* Color conversion matrix: RGB = m * YUV + c
|
||||||
* m is in row-major matrix, with m[row][col], e.g.:
|
* m is in row-major matrix, with m[row][col], e.g.:
|
||||||
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
|
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
|
||||||
* [ a21 a22 a23 ] { a21, a22, a23 },
|
* [ a21 a22 a23 ] { a21, a22, a23 },
|
||||||
* [ a31 a32 a33 ] { a31, a32, a33 } };
|
* [ a31 a32 a33 ] { a31, a32, a33 } };
|
||||||
* This is accessed as e.g.: m[2-1][1-1] = a21
|
* This is accessed as e.g.: m[2-1][1-1] = a21
|
||||||
* In particular, each row contains all the coefficients for one of R, G, B,
|
* In particular, each row contains all the coefficients for one of R, G, B,
|
||||||
* while each column contains all the coefficients for one of Y, U, V:
|
* while each column contains all the coefficients for one of Y, U, V:
|
||||||
@ -24,88 +24,67 @@ const char *gl_version = "#version 300 es ";
|
|||||||
* is the Y vector (1, 1, 1), the 2nd is the U vector, the 3rd the V vector.
|
* is the Y vector (1, 1, 1), the 2nd is the U vector, the 3rd the V vector.
|
||||||
* The matrix might also be used for other conversions and colorspaces.
|
* The matrix might also be used for other conversions and colorspaces.
|
||||||
*/
|
*/
|
||||||
struct mp_cmat
|
struct mp_cmat {
|
||||||
{
|
GLfloat m[3][3]; // colormatrix
|
||||||
GLfloat m[3][3]; // colormatrix
|
GLfloat c[3]; // colormatrix_c
|
||||||
GLfloat c[3]; //colormatrix_c
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct mp_mat
|
struct mp_mat {
|
||||||
{
|
|
||||||
GLfloat m[3][3];
|
GLfloat m[3][3];
|
||||||
};
|
};
|
||||||
|
|
||||||
// YUV input limited range (16-235 for luma, 16-240 for chroma)
|
// YUV input limited range (16-235 for luma, 16-240 for chroma)
|
||||||
// ITU-R BT.601 (SD)
|
// ITU-R BT.601 (SD)
|
||||||
struct mp_cmat yuv_bt601 = { {{1.164384, 1.164384, 1.164384},
|
struct mp_cmat yuv_bt601 = {
|
||||||
{0.00000, -0.391762, 2.017232},
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.391762, 2.017232}, {1.596027, -0.812968, 0.000000}},
|
||||||
{1.596027, -0.812968, 0.000000}},
|
{-0.874202, 0.531668, -1.085631}};
|
||||||
{-0.874202, 0.531668, -1.085631}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ITU-R BT.709 (HD)
|
// ITU-R BT.709 (HD)
|
||||||
struct mp_cmat yuv_bt709 = { {{1.164384, 1.164384, 1.164384},
|
struct mp_cmat yuv_bt709 = {
|
||||||
{0.00000, -0.213249, 2.112402},
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.213249, 2.112402}, {1.792741, -0.532909, 0.000000}},
|
||||||
{1.792741, -0.532909, 0.000000}},
|
{-0.972945, 0.301483, -1.133402}};
|
||||||
{-0.972945, 0.301483, -1.133402}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ITU-R BT.2020 non-constant luminance system
|
// ITU-R BT.2020 non-constant luminance system
|
||||||
struct mp_cmat yuv_bt2020ncl = { {{1.164384, 1.164384, 1.164384},
|
struct mp_cmat yuv_bt2020ncl = {
|
||||||
{0.00000, -0.187326, 2.141772},
|
{{1.164384, 1.164384, 1.164384}, {0.00000, -0.187326, 2.141772}, {1.678674, -0.650424, 0.000000}},
|
||||||
{1.678674, -0.650424, 0.000000}},
|
{-0.915688, 0.347459, -1.148145}};
|
||||||
{-0.915688, 0.347459, -1.148145}
|
|
||||||
};
|
|
||||||
|
|
||||||
// ITU-R BT.2020 constant luminance system
|
// ITU-R BT.2020 constant luminance system
|
||||||
struct mp_cmat yuv_bt2020cl = { {{0.0000, 1.164384, 0.000000},
|
struct mp_cmat yuv_bt2020cl = {
|
||||||
{0.00000, 0.000000, 1.138393},
|
{{0.0000, 1.164384, 0.000000}, {0.00000, 0.000000, 1.138393}, {1.138393, 0.000000, 0.000000}},
|
||||||
{1.138393, 0.000000, 0.000000}},
|
{-0.571429, -0.073059, -0.571429}};
|
||||||
{-0.571429, -0.073059, -0.571429}
|
|
||||||
};
|
|
||||||
|
|
||||||
float cms_matrix[3][3] = { {1.660497, -0.124547, -0.018154},
|
float cms_matrix[3][3] = {
|
||||||
{-0.587657, 1.132895, -0.100597},
|
{1.660497, -0.124547, -0.018154}, {-0.587657, 1.132895, -0.100597}, {-0.072840, -0.008348, 1.118751}};
|
||||||
{-0.072840, -0.008348, 1.118751}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Common constants for SMPTE ST.2084 (PQ)
|
// Common constants for SMPTE ST.2084 (PQ)
|
||||||
static const float PQ_M1 = 2610. / 4096 * 1. / 4,
|
static const float PQ_M1 = 2610. / 4096 * 1. / 4, PQ_M2 = 2523. / 4096 * 128, PQ_C1 = 3424. / 4096,
|
||||||
PQ_M2 = 2523. / 4096 * 128,
|
PQ_C2 = 2413. / 4096 * 32, PQ_C3 = 2392. / 4096 * 32;
|
||||||
PQ_C1 = 3424. / 4096,
|
|
||||||
PQ_C2 = 2413. / 4096 * 32,
|
|
||||||
PQ_C3 = 2392. / 4096 * 32;
|
|
||||||
|
|
||||||
// Common constants for ARIB STD-B67 (HLG)
|
// Common constants for ARIB STD-B67 (HLG)
|
||||||
static const float HLG_A = 0.17883277,
|
static const float HLG_A = 0.17883277, HLG_B = 0.28466892, HLG_C = 0.55991073;
|
||||||
HLG_B = 0.28466892,
|
|
||||||
HLG_C = 0.55991073;
|
|
||||||
|
|
||||||
struct gl_vao_entry
|
struct gl_vao_entry {
|
||||||
{
|
|
||||||
// used for shader / glBindAttribLocation
|
// used for shader / glBindAttribLocation
|
||||||
const char *name;
|
const char *name;
|
||||||
// glVertexAttribPointer() arguments
|
// glVertexAttribPointer() arguments
|
||||||
int num_elems; // size (number of elements)
|
int num_elems; // size (number of elements)
|
||||||
GLenum type;
|
GLenum type;
|
||||||
bool normalized;
|
bool normalized;
|
||||||
int offset;
|
int offset;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vertex_pt
|
struct vertex_pt {
|
||||||
{
|
|
||||||
float x, y;
|
float x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vertex_pi
|
struct vertex_pi {
|
||||||
{
|
|
||||||
GLint x, y;
|
GLint x, y;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define TEXUNIT_VIDEO_NUM 6
|
#define TEXUNIT_VIDEO_NUM 6
|
||||||
|
|
||||||
struct vertex
|
struct vertex {
|
||||||
{
|
|
||||||
struct vertex_pt position;
|
struct vertex_pt position;
|
||||||
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
|
||||||
};
|
};
|
||||||
@ -114,27 +93,19 @@ static const struct gl_vao_entry vertex_vao[] = {
|
|||||||
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
|
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
|
||||||
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
|
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
|
||||||
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
|
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
|
||||||
{0}
|
{0}};
|
||||||
};
|
|
||||||
|
|
||||||
#define GLSL(...) pl_shader_append(__VA_ARGS__)
|
#define GLSL(...) pl_shader_append(__VA_ARGS__)
|
||||||
#define GLSLV(...) pl_shader_append_v(__VA_ARGS__)
|
#define GLSLV(...) pl_shader_append_v(__VA_ARGS__)
|
||||||
|
|
||||||
char sh[SHADER_LENGTH];
|
char sh[SHADER_LENGTH];
|
||||||
char shv[SHADER_LENGTH];
|
char shv[SHADER_LENGTH];
|
||||||
|
|
||||||
void GL_init()
|
void GL_init() { sh[0] = 0; }
|
||||||
{
|
|
||||||
sh[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void GLV_init()
|
void GLV_init() { shv[0] = 0; }
|
||||||
{
|
|
||||||
shv[0] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void pl_shader_append(const char *fmt, ...)
|
void pl_shader_append(const char *fmt, ...) {
|
||||||
{
|
|
||||||
char temp[1000];
|
char temp[1000];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -145,11 +116,9 @@ void pl_shader_append(const char *fmt, ...)
|
|||||||
if (strlen(sh) + strlen(temp) > SHADER_LENGTH)
|
if (strlen(sh) + strlen(temp) > SHADER_LENGTH)
|
||||||
Fatal(_("Shaderlenght fault\n"));
|
Fatal(_("Shaderlenght fault\n"));
|
||||||
strcat(sh, temp);
|
strcat(sh, temp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pl_shader_append_v(const char *fmt, ...)
|
void pl_shader_append_v(const char *fmt, ...) {
|
||||||
{
|
|
||||||
char temp[1000];
|
char temp[1000];
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
@ -160,18 +129,16 @@ void pl_shader_append_v(const char *fmt, ...)
|
|||||||
if (strlen(shv) + strlen(temp) > SHADER_LENGTH)
|
if (strlen(shv) + strlen(temp) > SHADER_LENGTH)
|
||||||
Fatal(_("Shaderlenght fault\n"));
|
Fatal(_("Shaderlenght fault\n"));
|
||||||
strcat(shv, temp);
|
strcat(shv, temp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void compile_attach_shader(GLuint program, GLenum type, const char *source)
|
static void compile_attach_shader(GLuint program, GLenum type, const char *source) {
|
||||||
{
|
|
||||||
GLuint shader;
|
GLuint shader;
|
||||||
GLint status = 1234, log_length;
|
GLint status = 1234, log_length;
|
||||||
char log[4000];
|
char log[4000];
|
||||||
GLsizei len;
|
GLsizei len;
|
||||||
|
|
||||||
shader = glCreateShader(type);
|
shader = glCreateShader(type);
|
||||||
glShaderSource(shader, 1, (const GLchar **)&source, NULL); // &buffer, NULL);
|
glShaderSource(shader, 1, (const GLchar **)&source, NULL); // &buffer, NULL);
|
||||||
glCompileShader(shader);
|
glCompileShader(shader);
|
||||||
status = 0;
|
status = 0;
|
||||||
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
|
||||||
@ -183,11 +150,9 @@ static void compile_attach_shader(GLuint program, GLenum type, const char *sourc
|
|||||||
|
|
||||||
glAttachShader(program, shader);
|
glAttachShader(program, shader);
|
||||||
glDeleteShader(shader);
|
glDeleteShader(shader);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void link_shader(GLuint program)
|
static void link_shader(GLuint program) {
|
||||||
{
|
|
||||||
GLint status, log_length;
|
GLint status, log_length;
|
||||||
|
|
||||||
glLinkProgram(program);
|
glLinkProgram(program);
|
||||||
@ -198,8 +163,7 @@ static void link_shader(GLuint program)
|
|||||||
Debug(3, "Link Status %d loglen %d\n", status, log_length);
|
Debug(3, "Link Status %d loglen %d\n", status, log_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint sc_generate_osd(GLuint gl_prog)
|
static GLuint sc_generate_osd(GLuint gl_prog) {
|
||||||
{
|
|
||||||
|
|
||||||
Debug(3, "vor create osd\n");
|
Debug(3, "vor create osd\n");
|
||||||
gl_prog = glCreateProgram();
|
gl_prog = glCreateProgram();
|
||||||
@ -215,7 +179,7 @@ static GLuint sc_generate_osd(GLuint gl_prog)
|
|||||||
GLSL("}\n");
|
GLSL("}\n");
|
||||||
|
|
||||||
Debug(3, "vor compile vertex osd\n");
|
Debug(3, "vor compile vertex osd\n");
|
||||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh); // vertex_osd);
|
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh); // vertex_osd);
|
||||||
GL_init();
|
GL_init();
|
||||||
GLSL("%s\n", gl_version);
|
GLSL("%s\n", gl_version);
|
||||||
GLSL("#define texture1D texture\n");
|
GLSL("#define texture1D texture\n");
|
||||||
@ -227,14 +191,14 @@ static GLuint sc_generate_osd(GLuint gl_prog)
|
|||||||
GLSL("vec4 color; \n");
|
GLSL("vec4 color; \n");
|
||||||
GLSL("color = vec4(texture(texture0, texcoord0));\n");
|
GLSL("color = vec4(texture(texture0, texcoord0));\n");
|
||||||
#ifdef GAMMA
|
#ifdef GAMMA
|
||||||
GLSL("// delinearize gamma \n");
|
GLSL("// delinearize gamma \n");
|
||||||
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // delinearize gamma
|
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // delinearize gamma
|
||||||
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
#endif
|
#endif
|
||||||
GLSL("out_color = color;\n");
|
GLSL("out_color = color;\n");
|
||||||
GLSL("}\n");
|
GLSL("}\n");
|
||||||
Debug(3, "vor compile fragment osd \n");
|
Debug(3, "vor compile fragment osd \n");
|
||||||
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh); //fragment_osd);
|
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh); // fragment_osd);
|
||||||
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
||||||
glBindAttribLocation(gl_prog, 1, "vertex_texcoord0");
|
glBindAttribLocation(gl_prog, 1, "vertex_texcoord0");
|
||||||
|
|
||||||
@ -243,8 +207,7 @@ static GLuint sc_generate_osd(GLuint gl_prog)
|
|||||||
return gl_prog;
|
return gl_prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
||||||
{
|
|
||||||
|
|
||||||
char vname[80];
|
char vname[80];
|
||||||
int n;
|
int n;
|
||||||
@ -254,39 +217,39 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
|
|
||||||
GL_init();
|
GL_init();
|
||||||
GLSL("%s\n", gl_version);
|
GLSL("%s\n", gl_version);
|
||||||
GLSL("in vec2 vertex_position; \n");
|
GLSL("in vec2 vertex_position; \n");
|
||||||
GLSL("in vec2 vertex_texcoord0; \n");
|
GLSL("in vec2 vertex_texcoord0; \n");
|
||||||
GLSL("out vec2 texcoord0; \n");
|
GLSL("out vec2 texcoord0; \n");
|
||||||
GLSL("in vec2 vertex_texcoord1; \n");
|
GLSL("in vec2 vertex_texcoord1; \n");
|
||||||
GLSL("out vec2 texcoord1; \n");
|
GLSL("out vec2 texcoord1; \n");
|
||||||
if (Planes == 3) {
|
if (Planes == 3) {
|
||||||
GLSL("in vec2 vertex_texcoord2; \n");
|
GLSL("in vec2 vertex_texcoord2; \n");
|
||||||
GLSL("out vec2 texcoord2; \n");
|
GLSL("out vec2 texcoord2; \n");
|
||||||
}
|
}
|
||||||
GLSL("void main() { \n");
|
GLSL("void main() { \n");
|
||||||
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
GLSL("gl_Position = vec4(vertex_position, 1.0, 1.0);\n");
|
||||||
GLSL("texcoord0 = vertex_texcoord0; \n");
|
GLSL("texcoord0 = vertex_texcoord0; \n");
|
||||||
GLSL("texcoord1 = vertex_texcoord1; \n");
|
GLSL("texcoord1 = vertex_texcoord1; \n");
|
||||||
if (Planes == 3) {
|
if (Planes == 3) {
|
||||||
GLSL("texcoord2 = vertex_texcoord1; \n"); // texcoord1 ist hier richtig
|
GLSL("texcoord2 = vertex_texcoord1; \n"); // texcoord1 ist hier richtig
|
||||||
}
|
}
|
||||||
GLSL("} \n");
|
GLSL("} \n");
|
||||||
|
|
||||||
Debug(3, "vor create\n");
|
Debug(3, "vor create\n");
|
||||||
gl_prog = glCreateProgram();
|
gl_prog = glCreateProgram();
|
||||||
Debug(3, "vor compile vertex\n");
|
Debug(3, "vor compile vertex\n");
|
||||||
// printf("%s",sh);
|
// printf("%s",sh);
|
||||||
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh);
|
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh);
|
||||||
|
|
||||||
switch (colorspace) {
|
switch (colorspace) {
|
||||||
case AVCOL_SPC_RGB:
|
case AVCOL_SPC_RGB:
|
||||||
case AVCOL_SPC_BT470BG:
|
case AVCOL_SPC_BT470BG:
|
||||||
m = &yuv_bt601.m[0][0];
|
m = &yuv_bt601.m[0][0];
|
||||||
c = &yuv_bt601.c[0];
|
c = &yuv_bt601.c[0];
|
||||||
Debug(3, "BT601 Colorspace used\n");
|
Debug(3, "BT601 Colorspace used\n");
|
||||||
break;
|
break;
|
||||||
case AVCOL_SPC_BT709:
|
case AVCOL_SPC_BT709:
|
||||||
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
|
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
|
||||||
m = &yuv_bt709.m[0][0];
|
m = &yuv_bt709.m[0][0];
|
||||||
c = &yuv_bt709.c[0];
|
c = &yuv_bt709.c[0];
|
||||||
Debug(3, "BT709 Colorspace used\n");
|
Debug(3, "BT709 Colorspace used\n");
|
||||||
@ -297,7 +260,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
cms = &cms_matrix[0][0];
|
cms = &cms_matrix[0][0];
|
||||||
Debug(3, "BT2020NCL Colorspace used\n");
|
Debug(3, "BT2020NCL Colorspace used\n");
|
||||||
break;
|
break;
|
||||||
default: // fallback
|
default: // fallback
|
||||||
m = &yuv_bt709.m[0][0];
|
m = &yuv_bt709.m[0][0];
|
||||||
c = &yuv_bt709.c[0];
|
c = &yuv_bt709.c[0];
|
||||||
Debug(3, "default BT709 Colorspace used %d\n", colorspace);
|
Debug(3, "default BT709 Colorspace used %d\n", colorspace);
|
||||||
@ -309,8 +272,8 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
GLSL("%s\n", gl_version);
|
GLSL("%s\n", gl_version);
|
||||||
GLSL("precision mediump float; \n");
|
GLSL("precision mediump float; \n");
|
||||||
GLSL("layout(location = 0) out vec4 out_color;\n");
|
GLSL("layout(location = 0) out vec4 out_color;\n");
|
||||||
GLSL("in vec2 texcoord0; \n");
|
GLSL("in vec2 texcoord0; \n");
|
||||||
GLSL("in vec2 texcoord1; \n");
|
GLSL("in vec2 texcoord1; \n");
|
||||||
if (Planes == 3)
|
if (Planes == 3)
|
||||||
GLSL("in vec2 texcoord2; \n");
|
GLSL("in vec2 texcoord2; \n");
|
||||||
GLSL("uniform mat3 colormatrix; \n");
|
GLSL("uniform mat3 colormatrix; \n");
|
||||||
@ -321,8 +284,8 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
GLSL("uniform sampler2D texture1; \n");
|
GLSL("uniform sampler2D texture1; \n");
|
||||||
if (Planes == 3)
|
if (Planes == 3)
|
||||||
GLSL("uniform sampler2D texture2; \n");
|
GLSL("uniform sampler2D texture2; \n");
|
||||||
GLSL("void main() { \n");
|
GLSL("void main() { \n");
|
||||||
GLSL("vec4 color; \n");
|
GLSL("vec4 color; \n");
|
||||||
|
|
||||||
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
if (colorspace == AVCOL_SPC_BT2020_NCL) {
|
||||||
GLSL("color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r; \n");
|
GLSL("color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||||
@ -333,55 +296,64 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
GLSL("color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n");
|
GLSL("color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n");
|
||||||
}
|
}
|
||||||
GLSL("// color conversion\n");
|
GLSL("// color conversion\n");
|
||||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; "
|
||||||
GLSL("color.a = 1.0; \n");
|
"\n");
|
||||||
|
GLSL("color.a = 1.0; \n");
|
||||||
|
|
||||||
GLSL("// pl_shader_linearize \n");
|
GLSL("// pl_shader_linearize \n");
|
||||||
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
||||||
// GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
// GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
// GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(%f)) * vec3(1.0/%f)) + vec3(%f) , bvec3(lessThan(vec3(0.5), color.rgb)));\n",HLG_C, HLG_A, HLG_B);
|
// GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb -
|
||||||
GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - vec3(0.55991073)) * vec3(1.0/0.17883277)) + vec3(0.28466892), bvec3(lessThan(vec3(0.5), color.rgb)));\n");
|
// vec3(%f)) * vec3(1.0/%f)) + vec3(%f) ,
|
||||||
GLSL("color.rgb *= vec3(1.0/3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
// bvec3(lessThan(vec3(0.5), color.rgb)));\n",HLG_C, HLG_A, HLG_B);
|
||||||
GLSL("// color mapping \n");
|
GLSL("color.rgb = mix(vec3(4.0) * color.rgb * color.rgb,exp((color.rgb - "
|
||||||
GLSL("color.rgb = cms_matrix * color.rgb; \n");
|
"vec3(0.55991073)) * vec3(1.0/0.17883277)) + vec3(0.28466892), "
|
||||||
|
"bvec3(lessThan(vec3(0.5), color.rgb)));\n");
|
||||||
|
GLSL("color.rgb *= vec3(1.0/3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
||||||
|
GLSL("// color mapping \n");
|
||||||
|
GLSL("color.rgb = cms_matrix * color.rgb; \n");
|
||||||
#ifndef GAMMA
|
#ifndef GAMMA
|
||||||
GLSL("// pl_shader_delinearize \n");
|
GLSL("// pl_shader_delinearize \n");
|
||||||
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
// GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n");
|
||||||
// GLSL("color.rgb = pow(color.rgb, vec3(1.0/2.4)); \n");
|
// GLSL("color.rgb = pow(color.rgb, vec3(1.0/2.4)); \n");
|
||||||
GLSL("color.rgb *= vec3(3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
GLSL("color.rgb *= vec3(3.17955); \n"); // PL_COLOR_SDR_WHITE_HLG
|
||||||
GLSL("color.rgb = mix(vec3(0.5) * sqrt(color.rgb), vec3(0.17883277) * log(color.rgb - vec3(0.28466892)) + vec3(0.55991073), bvec3(lessThan(vec3(1.0), color.rgb))); \n");
|
GLSL("color.rgb = mix(vec3(0.5) * sqrt(color.rgb), vec3(0.17883277) * "
|
||||||
|
"log(color.rgb - vec3(0.28466892)) + vec3(0.55991073), "
|
||||||
|
"bvec3(lessThan(vec3(1.0), color.rgb))); \n");
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
GLSL("out_color = color; \n");
|
GLSL("out_color = color; \n");
|
||||||
GLSL("} \n");
|
GLSL("} \n");
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
|
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
|
||||||
if (Planes == 3) {
|
if (Planes == 3) {
|
||||||
GLSL("color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;\n");
|
GLSL("color.g = 1.000000 * vec4(texture(texture1, texcoord1)).r;\n");
|
||||||
GLSL("color.b = 1.000000 * vec4(texture(texture2, texcoord2)).r;\n");
|
GLSL("color.b = 1.000000 * vec4(texture(texture2, texcoord2)).r;\n");
|
||||||
} else {
|
} else {
|
||||||
GLSL("color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg; \n");
|
GLSL("color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg; \n");
|
||||||
}
|
}
|
||||||
GLSL("// color conversion \n");
|
GLSL("// color conversion \n");
|
||||||
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
GLSL("color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c; \n");
|
||||||
GLSL("color.a = 1.0; \n");
|
GLSL("color.a = 1.0; \n");
|
||||||
|
|
||||||
GLSL("// linearize gamma \n");
|
GLSL("// linearize gamma \n");
|
||||||
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
|
GLSL("color.rgb = clamp(color.rgb, 0.0, 1.0); \n"); // linearize gamma
|
||||||
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
GLSL("color.rgb = pow(color.rgb, vec3(2.4)); \n");
|
||||||
#ifndef GAMMA
|
#ifndef GAMMA
|
||||||
GLSL("// delinearize gamma to sRGB \n");
|
GLSL("// delinearize gamma to sRGB \n");
|
||||||
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
GLSL("color.rgb = max(color.rgb, 0.0); \n");
|
||||||
GLSL("color.rgb = mix(color.rgb * vec3(12.92), vec3(1.055) * pow(color.rgb, vec3(1.0/2.4)) - vec3(0.055), bvec3(lessThanEqual(vec3(0.0031308), color.rgb))); \n");
|
GLSL("color.rgb = mix(color.rgb * vec3(12.92), vec3(1.055) * "
|
||||||
|
"pow(color.rgb, vec3(1.0/2.4)) - vec3(0.055), "
|
||||||
|
"bvec3(lessThanEqual(vec3(0.0031308), color.rgb))); \n");
|
||||||
#endif
|
#endif
|
||||||
GLSL("// color mapping \n");
|
GLSL("// color mapping \n");
|
||||||
GLSL("out_color = color; \n");
|
GLSL("out_color = color; \n");
|
||||||
GLSL("} \n");
|
GLSL("} \n");
|
||||||
}
|
}
|
||||||
//printf(">%s<",sh);
|
// printf(">%s<",sh);
|
||||||
Debug(3, "vor compile fragment\n");
|
Debug(3, "vor compile fragment\n");
|
||||||
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh);
|
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, sh);
|
||||||
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
glBindAttribLocation(gl_prog, 0, "vertex_position");
|
||||||
@ -416,8 +388,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
|
|||||||
return gl_prog;
|
return gl_prog;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_pass_quad(int flip, float xcrop, float ycrop)
|
static void render_pass_quad(int flip, float xcrop, float ycrop) {
|
||||||
{
|
|
||||||
struct vertex va[4];
|
struct vertex va[4];
|
||||||
int n;
|
int n;
|
||||||
const struct gl_vao_entry *e;
|
const struct gl_vao_entry *e;
|
||||||
@ -444,21 +415,21 @@ static void render_pass_quad(int flip, float xcrop, float ycrop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
va[0].texcoord[0].x = (float)0.0 + xcrop;
|
va[0].texcoord[0].x = (float)0.0 + xcrop;
|
||||||
va[0].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
va[0].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
||||||
va[0].texcoord[1].x = (float)0.0 + xcrop;
|
va[0].texcoord[1].x = (float)0.0 + xcrop;
|
||||||
va[0].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
va[0].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von links oben
|
||||||
va[1].texcoord[0].x = (float)0.0 + xcrop;
|
va[1].texcoord[0].x = (float)0.0 + xcrop;
|
||||||
va[1].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
va[1].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
||||||
va[1].texcoord[1].x = (float)0.0 + xcrop;
|
va[1].texcoord[1].x = (float)0.0 + xcrop;
|
||||||
va[1].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
va[1].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
|
||||||
va[2].texcoord[0].x = (float)1.0 - xcrop;
|
va[2].texcoord[0].x = (float)1.0 - xcrop;
|
||||||
va[2].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
va[2].texcoord[0].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
||||||
va[2].texcoord[1].x = (float)1.0 - xcrop;
|
va[2].texcoord[1].x = (float)1.0 - xcrop;
|
||||||
va[2].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
va[2].texcoord[1].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
|
||||||
va[3].texcoord[0].x = (float)1.0 - xcrop;
|
va[3].texcoord[0].x = (float)1.0 - xcrop;
|
||||||
va[3].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
va[3].texcoord[0].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
||||||
va[3].texcoord[1].x = (float)1.0 - xcrop;
|
va[3].texcoord[1].x = (float)1.0 - xcrop;
|
||||||
va[3].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
va[3].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
|
||||||
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
|
||||||
@ -470,7 +441,7 @@ static void render_pass_quad(int flip, float xcrop, float ycrop)
|
|||||||
e = &vertex_vao[n];
|
e = &vertex_vao[n];
|
||||||
glEnableVertexAttribArray(n);
|
glEnableVertexAttribArray(n);
|
||||||
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized, sizeof(struct vertex),
|
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized, sizeof(struct vertex),
|
||||||
(void *)(intptr_t) e->offset);
|
(void *)(intptr_t)e->offset);
|
||||||
}
|
}
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
glBindBuffer(GL_ARRAY_BUFFER, 0);
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@
|
|||||||
// modify it under the terms of the GNU Lesser General Public
|
// modify it under the terms of the GNU Lesser General Public
|
||||||
// License as published by the Free Software Foundation; either
|
// License as published by the Free Software Foundation; either
|
||||||
// version 3.0 of the License, or (at your option) any later version.
|
// version 3.0 of the License, or (at your option) any later version.
|
||||||
//
|
//
|
||||||
// This library is distributed in the hope that it will be useful,
|
// This library is distributed in the hope that it will be useful,
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Lesser General Public License for more details.
|
// Lesser General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Lesser General Public
|
// You should have received a copy of the GNU Lesser General Public
|
||||||
// License along with this library.
|
// License along with this library.
|
||||||
|
|
||||||
|
@ -25,24 +25,24 @@
|
|||||||
// -- Advanced sharpening settings --
|
// -- Advanced sharpening settings --
|
||||||
#define pattern 2 //[1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
|
#define pattern 2 //[1|2|3|4] Choose a sample pattern. 1 = Fast, 2 = Normal, 3 = Wider, 4 = Pyramid shaped.
|
||||||
//[8|9] Experimental slower patterns. 8 = 9 tap 9 fetch gaussian, 9 = 9 tap 9 fetch high pass.
|
//[8|9] Experimental slower patterns. 8 = 9 tap 9 fetch gaussian, 9 = 9 tap 9 fetch high pass.
|
||||||
|
|
||||||
#define offset_bias 1.0 //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
|
#define offset_bias 1.0 //[0.0 to 6.0] Offset bias adjusts the radius of the sampling pattern.
|
||||||
|
|
||||||
vec4 hook(){
|
vec4 hook(){
|
||||||
vec4 colorInput = LUMA_tex(LUMA_pos);
|
vec4 colorInput = LUMA_tex(LUMA_pos);
|
||||||
|
|
||||||
|
|
||||||
//We are on luma plane: xyzw = [luma_val, 0.0, 0.0, 1.0]
|
//We are on luma plane: xyzw = [luma_val, 0.0, 0.0, 1.0]
|
||||||
float ori = colorInput.x;
|
float ori = colorInput.x;
|
||||||
|
|
||||||
// -- Combining the strength and luma multipliers --
|
// -- Combining the strength and luma multipliers --
|
||||||
float sharp_strength_luma = sharp_strength; //I'll be combining even more multipliers with it later on
|
float sharp_strength_luma = sharp_strength; //I'll be combining even more multipliers with it later on
|
||||||
|
|
||||||
float px = 1.0;
|
float px = 1.0;
|
||||||
float py = 1.0;
|
float py = 1.0;
|
||||||
|
|
||||||
// Sampling patterns
|
// Sampling patterns
|
||||||
|
|
||||||
// [ NW, , NE ] Each texture lookup (except ori)
|
// [ NW, , NE ] Each texture lookup (except ori)
|
||||||
// [ ,ori, ] samples 4 pixels
|
// [ ,ori, ] samples 4 pixels
|
||||||
// [ SW, , SE ]
|
// [ SW, , SE ]
|
||||||
@ -54,39 +54,39 @@ vec4 hook(){
|
|||||||
// [ 1/9, 2/9, ] [ 1 , 2 , ]
|
// [ 1/9, 2/9, ] [ 1 , 2 , ]
|
||||||
// [ 2/9, 8/9, 2/9] = [ 2 , 8 , 2 ]
|
// [ 2/9, 8/9, 2/9] = [ 2 , 8 , 2 ]
|
||||||
// [ , 2/9, 1/9] [ , 2 , 1 ]
|
// [ , 2/9, 1/9] [ , 2 , 1 ]
|
||||||
|
|
||||||
px = (px / 3.0) * offset_bias;
|
px = (px / 3.0) * offset_bias;
|
||||||
py = (py / 3.0) * offset_bias;
|
py = (py / 3.0) * offset_bias;
|
||||||
|
|
||||||
float blur_ori = LUMA_texOff(vec2(px,py)).x; // North West
|
float blur_ori = LUMA_texOff(vec2(px,py)).x; // North West
|
||||||
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South East
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South East
|
||||||
|
|
||||||
//blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
//blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
//blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
//blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
|
|
||||||
blur_ori *= 0.5; //Divide by the number of texture fetches
|
blur_ori *= 0.5; //Divide by the number of texture fetches
|
||||||
|
|
||||||
sharp_strength_luma *= 1.5; // Adjust strength to aproximate the strength of pattern 2
|
sharp_strength_luma *= 1.5; // Adjust strength to aproximate the strength of pattern 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Pattern 2 -- A 9 tap gaussian using 4+1 texture fetches.
|
// -- Pattern 2 -- A 9 tap gaussian using 4+1 texture fetches.
|
||||||
#if pattern == 2
|
#if pattern == 2
|
||||||
// -- Gaussian filter --
|
// -- Gaussian filter --
|
||||||
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
||||||
// [ .50, 1, .50] = [ 2 , 4 , 2 ]
|
// [ .50, 1, .50] = [ 2 , 4 , 2 ]
|
||||||
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
// [ .25, .50, .25] [ 1 , 2 , 1 ]
|
||||||
|
|
||||||
px = px * 0.5 * offset_bias;
|
px = px * 0.5 * offset_bias;
|
||||||
py = py * 0.5 * offset_bias;
|
py = py * 0.5 * offset_bias;
|
||||||
|
|
||||||
float blur_ori = LUMA_texOff(vec2(px,-py)).x; // South East
|
float blur_ori = LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
blur_ori += LUMA_texOff(vec2(-px,py)).x; // North West
|
blur_ori += LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
|
|
||||||
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Pattern 3 -- An experimental 17 tap gaussian using 4+1 texture fetches.
|
// -- Pattern 3 -- An experimental 17 tap gaussian using 4+1 texture fetches.
|
||||||
#if pattern == 3
|
#if pattern == 3
|
||||||
|
|
||||||
@ -96,7 +96,7 @@ vec4 hook(){
|
|||||||
// [ 6 ,24 , ,24 , 6 ]
|
// [ 6 ,24 , ,24 , 6 ]
|
||||||
// [ 4 ,16 ,24 ,16 , ]
|
// [ 4 ,16 ,24 ,16 , ]
|
||||||
// [ , , 6 , 4 , ]
|
// [ , , 6 , 4 , ]
|
||||||
|
|
||||||
px = px * offset_bias;
|
px = px * offset_bias;
|
||||||
py = py * offset_bias;
|
py = py * offset_bias;
|
||||||
|
|
||||||
@ -104,97 +104,97 @@ vec4 hook(){
|
|||||||
blur_ori += LUMA_texOff(vec2(-1.2*px,-0.4*py)).x; // West South West
|
blur_ori += LUMA_texOff(vec2(-1.2*px,-0.4*py)).x; // West South West
|
||||||
blur_ori += LUMA_texOff(vec2(1.2*px,0.4*py)).x; // East North East
|
blur_ori += LUMA_texOff(vec2(1.2*px,0.4*py)).x; // East North East
|
||||||
blur_ori += LUMA_texOff(vec2(-0.4*px,1.2*py)).x; // North North West
|
blur_ori += LUMA_texOff(vec2(-0.4*px,1.2*py)).x; // North North West
|
||||||
|
|
||||||
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
blur_ori *= 0.25; // ( /= 4) Divide by the number of texture fetches
|
||||||
|
|
||||||
sharp_strength_luma *= 0.51;
|
sharp_strength_luma *= 0.51;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Pattern 4 -- A 9 tap high pass (pyramid filter) using 4+1 texture fetches.
|
// -- Pattern 4 -- A 9 tap high pass (pyramid filter) using 4+1 texture fetches.
|
||||||
#if pattern == 4
|
#if pattern == 4
|
||||||
// -- Gaussian filter --
|
// -- Gaussian filter --
|
||||||
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
||||||
// [ .50, , .50] = [ 1 , , 1 ]
|
// [ .50, , .50] = [ 1 , , 1 ]
|
||||||
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
// [ .50, .50, .50] [ 1 , 1 , 1 ]
|
||||||
|
|
||||||
float blur_ori = LUMA_texOff(vec2(0.5 * px,-py * offset_bias)).x; // South South East
|
float blur_ori = LUMA_texOff(vec2(0.5 * px,-py * offset_bias)).x; // South South East
|
||||||
blur_ori += LUMA_texOff(vec2(offset_bias * -px,0.5 * -py)).x; // West South West
|
blur_ori += LUMA_texOff(vec2(offset_bias * -px,0.5 * -py)).x; // West South West
|
||||||
blur_ori += LUMA_texOff(vec2(offset_bias * px,0.5 * py)).x; // East North East
|
blur_ori += LUMA_texOff(vec2(offset_bias * px,0.5 * py)).x; // East North East
|
||||||
blur_ori += LUMA_texOff(vec2(0.5 * -px,py * offset_bias)).x; // North North West
|
blur_ori += LUMA_texOff(vec2(0.5 * -px,py * offset_bias)).x; // North North West
|
||||||
|
|
||||||
//blur_ori += (2.0 * ori); // Probably not needed. Only serves to lessen the effect.
|
//blur_ori += (2.0 * ori); // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
blur_ori *= 0.25; //Divide by the number of texture fetches
|
blur_ori *= 0.25; //Divide by the number of texture fetches
|
||||||
|
|
||||||
sharp_strength_luma *= 0.666; // Adjust strength to aproximate the strength of pattern 2
|
sharp_strength_luma *= 0.666; // Adjust strength to aproximate the strength of pattern 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Pattern 8 -- A (slower) 9 tap gaussian using 9 texture fetches.
|
// -- Pattern 8 -- A (slower) 9 tap gaussian using 9 texture fetches.
|
||||||
#if pattern == 8
|
#if pattern == 8
|
||||||
|
|
||||||
// -- Gaussian filter --
|
// -- Gaussian filter --
|
||||||
// [ 1 , 2 , 1 ]
|
// [ 1 , 2 , 1 ]
|
||||||
// [ 2 , 4 , 2 ]
|
// [ 2 , 4 , 2 ]
|
||||||
// [ 1 , 2 , 1 ]
|
// [ 1 , 2 , 1 ]
|
||||||
|
|
||||||
px = px * offset_bias;
|
px = px * offset_bias;
|
||||||
py = py * offset_bias;
|
py = py * offset_bias;
|
||||||
|
|
||||||
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
|
||||||
float blur_ori2 = LUMA_texOff(vec2(0.0,py)).x; // North
|
float blur_ori2 = LUMA_texOff(vec2(0.0,py)).x; // North
|
||||||
blur_ori2 += LUMA_texOff(vec2(0.0,-py)).x; // South
|
blur_ori2 += LUMA_texOff(vec2(0.0,-py)).x; // South
|
||||||
blur_ori2 += LUMA_texOff(vec2(-px,0.0)).x; // West
|
blur_ori2 += LUMA_texOff(vec2(-px,0.0)).x; // West
|
||||||
blur_ori2 += LUMA_texOff(vec2(px,0.0)).x; // East
|
blur_ori2 += LUMA_texOff(vec2(px,0.0)).x; // East
|
||||||
blur_ori2 *= 2.0;
|
blur_ori2 *= 2.0;
|
||||||
|
|
||||||
blur_ori += blur_ori2;
|
blur_ori += blur_ori2;
|
||||||
blur_ori += (ori * 4.0); // Probably not needed. Only serves to lessen the effect.
|
blur_ori += (ori * 4.0); // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
// dot()s with gaussian strengths here?
|
// dot()s with gaussian strengths here?
|
||||||
|
|
||||||
blur_ori /= 16.0; //Divide by the number of texture fetches
|
blur_ori /= 16.0; //Divide by the number of texture fetches
|
||||||
|
|
||||||
sharp_strength_luma *= 0.75; // Adjust strength to aproximate the strength of pattern 2
|
sharp_strength_luma *= 0.75; // Adjust strength to aproximate the strength of pattern 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Pattern 9 -- A (slower) 9 tap high pass using 9 texture fetches.
|
// -- Pattern 9 -- A (slower) 9 tap high pass using 9 texture fetches.
|
||||||
#if pattern == 9
|
#if pattern == 9
|
||||||
|
|
||||||
// -- Gaussian filter --
|
// -- Gaussian filter --
|
||||||
// [ 1 , 1 , 1 ]
|
// [ 1 , 1 , 1 ]
|
||||||
// [ 1 , 1 , 1 ]
|
// [ 1 , 1 , 1 ]
|
||||||
// [ 1 , 1 , 1 ]
|
// [ 1 , 1 , 1 ]
|
||||||
|
|
||||||
px = px * offset_bias;
|
px = px * offset_bias;
|
||||||
py = py * offset_bias;
|
py = py * offset_bias;
|
||||||
|
|
||||||
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
float blur_ori = LUMA_texOff(vec2(-px,py)).x; // North West
|
||||||
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
blur_ori += LUMA_texOff(vec2(px,-py)).x; // South East
|
||||||
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
blur_ori += LUMA_texOff(vec2(-px,-py)).x; // South West
|
||||||
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
blur_ori += LUMA_texOff(vec2(px,py)).x; // North East
|
||||||
|
|
||||||
blur_ori += ori; // Probably not needed. Only serves to lessen the effect.
|
blur_ori += ori; // Probably not needed. Only serves to lessen the effect.
|
||||||
|
|
||||||
blur_ori += LUMA_texOff(vec2(0.0,py)).x; // North
|
blur_ori += LUMA_texOff(vec2(0.0,py)).x; // North
|
||||||
blur_ori += LUMA_texOff(vec2(0.0,-py)).x; // South
|
blur_ori += LUMA_texOff(vec2(0.0,-py)).x; // South
|
||||||
blur_ori += LUMA_texOff(vec2(-px,0.0)).x; // West
|
blur_ori += LUMA_texOff(vec2(-px,0.0)).x; // West
|
||||||
blur_ori += LUMA_texOff(vec2(px,0.0)).x; // East
|
blur_ori += LUMA_texOff(vec2(px,0.0)).x; // East
|
||||||
|
|
||||||
blur_ori /= 9.0; //Divide by the number of texture fetches
|
blur_ori /= 9.0; //Divide by the number of texture fetches
|
||||||
|
|
||||||
sharp_strength_luma *= (8.0/9.0); // Adjust strength to aproximate the strength of pattern 2
|
sharp_strength_luma *= (8.0/9.0); // Adjust strength to aproximate the strength of pattern 2
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// -- Calculate the sharpening --
|
// -- Calculate the sharpening --
|
||||||
float sharp = ori - blur_ori; //Subtracting the blurred image from the original image
|
float sharp = ori - blur_ori; //Subtracting the blurred image from the original image
|
||||||
|
|
||||||
// -- Adjust strength of the sharpening and clamp it--
|
// -- Adjust strength of the sharpening and clamp it--
|
||||||
float sharp_strength_luma_clamp = sharp_strength_luma / (2.0 * sharp_clamp); //Roll part of the clamp into the dot
|
float sharp_strength_luma_clamp = sharp_strength_luma / (2.0 * sharp_clamp); //Roll part of the clamp into the dot
|
||||||
|
|
||||||
float sharp_luma = clamp((sharp * sharp_strength_luma_clamp + 0.5), 0.0,1.0 ); //Calculate the luma, adjust the strength, scale up and clamp
|
float sharp_luma = clamp((sharp * sharp_strength_luma_clamp + 0.5), 0.0,1.0 ); //Calculate the luma, adjust the strength, scale up and clamp
|
||||||
sharp_luma = (sharp_clamp * 2.0) * sharp_luma - sharp_clamp; //scale down
|
sharp_luma = (sharp_clamp * 2.0) * sharp_luma - sharp_clamp; //scale down
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
//--------------------------------------- Settings ------------------------------------------------
|
//--------------------------------------- Settings ------------------------------------------------
|
||||||
|
|
||||||
#define curve_height 1.6 // Main control of sharpening strength [>0]
|
#define curve_height 1.6 // Main control of sharpening strength [>0]
|
||||||
// 0.3 <-> 2.0 is a reasonable range of values
|
// 0.3 <-> 2.0 is a reasonable range of values
|
||||||
|
|
||||||
// Defined values under this row are "optimal" DO NOT CHANGE IF YOU DO NOT KNOW WHAT YOU ARE DOING!
|
// Defined values under this row are "optimal" DO NOT CHANGE IF YOU DO NOT KNOW WHAT YOU ARE DOING!
|
||||||
|
1269
softhdcuvid.cpp
1269
softhdcuvid.cpp
File diff suppressed because it is too large
Load Diff
1223
softhddev.c
1223
softhddev.c
File diff suppressed because it is too large
Load Diff
157
softhddev.h
157
softhddev.h
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddev.h @brief software HD device plugin header file.
|
/// @file softhddev.h @brief software HD device plugin header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2011 - 2015 by Johns. All Rights Reserved.
|
/// Copyright (c) 2011 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -21,95 +21,94 @@
|
|||||||
//////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C" {
|
||||||
{
|
|
||||||
#endif
|
#endif
|
||||||
/// C callback feed key press
|
/// C callback feed key press
|
||||||
extern void FeedKeyPress(const char *, const char *, int, int, const char *);
|
extern void FeedKeyPress(const char *, const char *, int, int, const char *);
|
||||||
|
|
||||||
/// C plugin get osd size and ascpect
|
/// C plugin get osd size and ascpect
|
||||||
extern void GetOsdSize(int *, int *, double *);
|
extern void GetOsdSize(int *, int *, double *);
|
||||||
|
|
||||||
/// C plugin close osd
|
/// C plugin close osd
|
||||||
extern void OsdClose(void);
|
extern void OsdClose(void);
|
||||||
/// C plugin draw osd pixmap
|
/// C plugin draw osd pixmap
|
||||||
extern void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
|
extern void OsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
|
||||||
|
|
||||||
/// C plugin play audio packet
|
/// C plugin play audio packet
|
||||||
extern int PlayAudio(const uint8_t *, int, uint8_t);
|
extern int PlayAudio(const uint8_t *, int, uint8_t);
|
||||||
/// C plugin play TS audio packet
|
/// C plugin play TS audio packet
|
||||||
extern int PlayTsAudio(const uint8_t *, int);
|
extern int PlayTsAudio(const uint8_t *, int);
|
||||||
/// C plugin set audio volume
|
/// C plugin set audio volume
|
||||||
extern void SetVolumeDevice(int);
|
extern void SetVolumeDevice(int);
|
||||||
/// C plugin reset channel id (restarts audio)
|
/// C plugin reset channel id (restarts audio)
|
||||||
extern void ResetChannelId(void);
|
extern void ResetChannelId(void);
|
||||||
|
|
||||||
/// C plugin play video packet
|
/// C plugin play video packet
|
||||||
extern int PlayVideo(const uint8_t *, int);
|
extern int PlayVideo(const uint8_t *, int);
|
||||||
/// C plugin play TS video packet
|
/// C plugin play TS video packet
|
||||||
extern void PlayTsVideo(const uint8_t *, int);
|
extern void PlayTsVideo(const uint8_t *, int);
|
||||||
/// C plugin grab an image
|
/// C plugin grab an image
|
||||||
extern uint8_t *GrabImage(int *, int, int, int, int);
|
extern uint8_t *GrabImage(int *, int, int, int, int);
|
||||||
|
|
||||||
/// C plugin set play mode
|
/// C plugin set play mode
|
||||||
extern int SetPlayMode(int);
|
extern int SetPlayMode(int);
|
||||||
/// C plugin get current system time counter
|
/// C plugin get current system time counter
|
||||||
extern int64_t GetSTC(void);
|
extern int64_t GetSTC(void);
|
||||||
/// C plugin get video stream size and aspect
|
/// C plugin get video stream size and aspect
|
||||||
extern void GetVideoSize(int *, int *, double *);
|
extern void GetVideoSize(int *, int *, double *);
|
||||||
/// C plugin set trick speed
|
/// C plugin set trick speed
|
||||||
extern void TrickSpeed(int);
|
extern void TrickSpeed(int);
|
||||||
/// C plugin clears all video and audio data from the device
|
/// C plugin clears all video and audio data from the device
|
||||||
extern void Clear(void);
|
extern void Clear(void);
|
||||||
/// C plugin sets the device into play mode
|
/// C plugin sets the device into play mode
|
||||||
extern void Play(void);
|
extern void Play(void);
|
||||||
/// C plugin sets the device into "freeze frame" mode
|
/// C plugin sets the device into "freeze frame" mode
|
||||||
extern void Freeze(void);
|
extern void Freeze(void);
|
||||||
/// C plugin mute audio
|
/// C plugin mute audio
|
||||||
extern void Mute(void);
|
extern void Mute(void);
|
||||||
/// C plugin display I-frame as a still picture.
|
/// C plugin display I-frame as a still picture.
|
||||||
extern void StillPicture(const uint8_t *, int);
|
extern void StillPicture(const uint8_t *, int);
|
||||||
/// C plugin poll if ready
|
/// C plugin poll if ready
|
||||||
extern int Poll(int);
|
extern int Poll(int);
|
||||||
/// C plugin flush output buffers
|
/// C plugin flush output buffers
|
||||||
extern int Flush(int);
|
extern int Flush(int);
|
||||||
|
|
||||||
/// C plugin command line help
|
/// C plugin command line help
|
||||||
extern const char *CommandLineHelp(void);
|
extern const char *CommandLineHelp(void);
|
||||||
/// C plugin process the command line arguments
|
/// C plugin process the command line arguments
|
||||||
extern int ProcessArgs(int, char *const[]);
|
extern int ProcessArgs(int, char *const[]);
|
||||||
|
|
||||||
/// C plugin exit + cleanup
|
/// C plugin exit + cleanup
|
||||||
extern void SoftHdDeviceExit(void);
|
extern void SoftHdDeviceExit(void);
|
||||||
/// C plugin start code
|
/// C plugin start code
|
||||||
extern int Start(void);
|
extern int Start(void);
|
||||||
/// C plugin stop code
|
/// C plugin stop code
|
||||||
extern void Stop(void);
|
extern void Stop(void);
|
||||||
/// C plugin house keeping
|
/// C plugin house keeping
|
||||||
extern void Housekeeping(void);
|
extern void Housekeeping(void);
|
||||||
/// C plugin main thread hook
|
/// C plugin main thread hook
|
||||||
extern void MainThreadHook(void);
|
extern void MainThreadHook(void);
|
||||||
|
|
||||||
/// Suspend plugin
|
/// Suspend plugin
|
||||||
extern void Suspend(int, int, int);
|
extern void Suspend(int, int, int);
|
||||||
/// Resume plugin
|
/// Resume plugin
|
||||||
extern void Resume(void);
|
extern void Resume(void);
|
||||||
|
|
||||||
/// Get decoder statistics
|
/// Get decoder statistics
|
||||||
extern void GetStats(int *, int *, int *, int *, float *, int *, int *, int *, int *);
|
extern void GetStats(int *, int *, int *, int *, float *, int *, int *, int *, int *);
|
||||||
/// C plugin scale video
|
/// C plugin scale video
|
||||||
extern void ScaleVideo(int, int, int, int);
|
extern void ScaleVideo(int, int, int, int);
|
||||||
|
|
||||||
/// Set Pip position
|
/// Set Pip position
|
||||||
extern void PipSetPosition(int, int, int, int, int, int, int, int);
|
extern void PipSetPosition(int, int, int, int, int, int, int, int);
|
||||||
/// Pip start
|
/// Pip start
|
||||||
extern void PipStart(int, int, int, int, int, int, int, int);
|
extern void PipStart(int, int, int, int, int, int, int, int);
|
||||||
/// Pip stop
|
/// Pip stop
|
||||||
extern void PipStop(void);
|
extern void PipStop(void);
|
||||||
/// Pip play video packet
|
/// Pip play video packet
|
||||||
extern int PipPlayVideo(const uint8_t *, int);
|
extern int PipPlayVideo(const uint8_t *, int);
|
||||||
|
|
||||||
extern const char *X11DisplayName; ///< x11 display name
|
extern const char *X11DisplayName; ///< x11 display name
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddevice.h @brief software HD device plugin header file.
|
/// @file softhddevice.h @brief software HD device plugin header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2011, 2014 by Johns. All Rights Reserved.
|
/// Copyright (c) 2011, 2014 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file softhddev_service.h @brief software HD device service header file.
|
/// @file softhddev_service.h @brief software HD device service header file.
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2012 by durchflieger. All Rights Reserved.
|
/// Copyright (c) 2012 by durchflieger. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -22,15 +22,13 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
|
#define ATMO_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.0"
|
||||||
#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
|
#define ATMO1_GRAB_SERVICE "SoftHDDevice-AtmoGrabService-v1.1"
|
||||||
#define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
|
#define OSD_3DMODE_SERVICE "SoftHDDevice-Osd3DModeService-v1.0"
|
||||||
|
|
||||||
enum
|
enum { GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
|
||||||
{ GRAB_IMG_RGBA_FORMAT_B8G8R8A8 };
|
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int structSize;
|
int structSize;
|
||||||
|
|
||||||
// request data
|
// request data
|
||||||
@ -45,13 +43,11 @@ typedef struct
|
|||||||
void *img;
|
void *img;
|
||||||
} SoftHDDevice_AtmoGrabService_v1_0_t;
|
} SoftHDDevice_AtmoGrabService_v1_0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
int Mode;
|
int Mode;
|
||||||
} SoftHDDevice_Osd3DModeService_v1_0_t;
|
} SoftHDDevice_Osd3DModeService_v1_0_t;
|
||||||
|
|
||||||
typedef struct
|
typedef struct {
|
||||||
{
|
|
||||||
// request/reply data
|
// request/reply data
|
||||||
|
|
||||||
int width;
|
int width;
|
||||||
|
19
video.h
19
video.h
@ -1,7 +1,7 @@
|
|||||||
///
|
///
|
||||||
/// @file video.h @brief Video module header file
|
/// @file video.h @brief Video module header file
|
||||||
///
|
///
|
||||||
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
/// Copyright (c) 2009 - 2015 by Johns. All Rights Reserved.
|
||||||
///
|
///
|
||||||
/// Contributor(s):
|
/// Contributor(s):
|
||||||
///
|
///
|
||||||
@ -40,11 +40,12 @@ typedef struct __video_stream__ VideoStream;
|
|||||||
// Variables
|
// Variables
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
|
||||||
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
|
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
|
||||||
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
|
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
|
||||||
extern int VideoAudioDelay; ///< audio/video delay
|
extern int VideoAudioDelay; ///< audio/video delay
|
||||||
extern char ConfigStartX11Server; ///< flag start the x11 server
|
extern char ConfigStartX11Server; ///< flag start the x11 server
|
||||||
extern char MyConfigDir[];
|
extern char MyConfigDir[];
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Prototypes
|
// Prototypes
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -224,11 +225,11 @@ extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *,
|
|||||||
/// Get video stream size
|
/// Get video stream size
|
||||||
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);
|
extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *);
|
||||||
|
|
||||||
extern void VideoOsdInit(void); ///< Setup osd.
|
extern void VideoOsdInit(void); ///< Setup osd.
|
||||||
extern void VideoOsdExit(void); ///< Cleanup osd.
|
extern void VideoOsdExit(void); ///< Cleanup osd.
|
||||||
|
|
||||||
extern void VideoInit(const char *); ///< Setup video module.
|
extern void VideoInit(const char *); ///< Setup video module.
|
||||||
extern void VideoExit(void); ///< Cleanup and exit video module.
|
extern void VideoExit(void); ///< Cleanup and exit video module.
|
||||||
|
|
||||||
/// Poll video input buffers.
|
/// Poll video input buffers.
|
||||||
extern int VideoPollInput(VideoStream *);
|
extern int VideoPollInput(VideoStream *);
|
||||||
|
Loading…
Reference in New Issue
Block a user