75 Commits

Author SHA1 Message Date
jojo61
b883fa606b Add repeat handling for X11 keyboard remote control 2019-11-06 16:44:53 +01:00
jojo61
6acd2feb3f Changed OSD Interface without Placebo 2019-11-05 22:06:54 +01:00
jojo61
499731fc1f Fixed Vaapi OSD with PLACEBO 2019-11-02 15:47:45 +01:00
jojo61
a4bee138f2 Improved Placebo Frame turnaroundtime 2019-11-02 13:28:42 +01:00
jojo61
146b826b4d OSD optimizations 2019-11-01 08:22:26 +01:00
jojo61
3dfaeaf7e2 Merge pull request #16 from dnehring7/master
Fix remaining indentation problems.
2019-10-28 22:28:48 +01:00
Dirk Nehring
132caa81de Remove old VDR API compatibility defines 2019-10-28 21:52:29 +01:00
Dirk Nehring
9ebdd3baae Fix remaining indentation problems. 2019-10-28 21:43:37 +01:00
jojo61
43fa0b8929 Merge pull request #15 from jojo61/revert-10-Add-glFinish()-before-unmapping-the-surface
Revert "Add glFinish() before unmapping the surface"
2019-10-28 20:02:17 +01:00
jojo61
2cd8415f2b Revert "Add glFinish() before unmapping the surface" 2019-10-28 20:01:37 +01:00
jojo61
2d3a7339e8 Merge pull request #14 from 9000h/fix-missing-break
fix missing break
2019-10-28 19:59:40 +01:00
jojo61
c4a7aefc20 Merge pull request #13 from 9000h/use-the-log-defines
use the log defines
2019-10-28 19:59:11 +01:00
jojo61
bdfe1a62c9 Merge pull request #12 from 9000h/Switch-to-posix-compaatible-sched_yield
Switch to posix compatible sched_yield
2019-10-28 19:58:27 +01:00
9000h
1bf5a841e9 Merge branch 'master' into Switch-to-posix-compaatible-sched_yield 2019-10-28 15:51:49 +01:00
9000h
7269e28f9a Update softhdcuvid.cpp 2019-10-28 15:49:03 +01:00
9000h
b83cb6167c Merge branch 'master' into fix-missing-break 2019-10-28 15:47:35 +01:00
9000h
7b0984381d fix missing break 2019-10-28 13:02:12 +01:00
9000h
ed5fa65837 use the log defines
use the log defines
2019-10-28 12:57:05 +01:00
9000h
70ef3d6602 Switch to posix compaatible sched_yield
Use sched_yield() instead of pthread_yield()
2019-10-28 12:34:46 +01:00
jojo61
557c17982f Merge pull request #10 from 9000h/Add-glFinish()-before-unmapping-the-surface
Add glFinish() before unmapping the surface
2019-10-27 10:52:02 +01:00
jojo61
01a564cf3d Merge pull request #9 from dnehring7/master
Reindent all sources to common coding style (second try). This makes it easier for future patches.
2019-10-27 10:48:39 +01:00
9000h
6044db40f3 Add glFinish() before unmapping the surface
cherry picked from rellla
22590848da
2019-10-26 23:03:35 +02:00
Dirk Nehring
ed53dd21ca Reindent all sources to common coding style. 2019-10-26 18:42:19 +02:00
jojo61
5653e31466 Merge pull request #7 from 9000h/second-tryfix-osd
second tryfix osd
2019-10-26 15:55:08 +02:00
9000h
59354108fc second tryfix osd
fix core dump at start when using vdr-plugin-skinnopacity
the code is maybe not needed for VAAPI anyway
2019-10-25 23:25:20 +02:00
jojo61
d25f456e67 Fixed StillPicture
Fixed YADIF Compile error
2019-10-24 16:00:09 +02:00
jojo61
9e8cd60f28 Improve Edit Speed 2019-10-23 16:25:10 +02:00
jojo61
6fbf240f6e Merge pull request #6 from 9000h/try-fix-osd
try fix osd
2019-10-23 12:05:27 +00:00
jojo61
51e2aaaeb0 Merge pull request #5 from 9000h/fix-missing-AudioSetBufferTime
fix missing AudioSetBufferTime
2019-10-23 12:04:18 +00:00
9000h
d03bd4661b try fix osd 2019-10-22 19:59:56 +02:00
9000h
11ea3baba3 fix missing AudioSetBufferTime 2019-10-22 19:46:24 +02:00
jojo61
ce294f55e8 Merge pull request #4 from dnehring7/master
Code cleanup for newer ffmpeg versions
2019-10-22 16:36:01 +02:00
Dirk Nehring
35cc401e13 Drop ffmpeg compatibility checks
Set minimum ffmpeg API to 3.4
Set minimum VDR API to 2.4.0
2019-10-22 15:21:26 +02:00
jojo61
f80d757704 Fixed ATTA and DETA
Cleanup some code
Testet GRAB funktions
2019-10-20 14:48:28 +02:00
jojo61
40115f4fc6 disable PIP for vaapi 2019-10-12 14:27:47 +02:00
jojo61
9003beee34 Fix PIP with PLACEBO 2019-10-12 11:23:32 +02:00
jojo61
e09d5a8001 Fix OSD for skindesigner 2019-10-12 11:14:51 +02:00
jojo61
6d91af9d74 More a/v Sync and cleanup 2019-10-12 09:04:04 +02:00
jojo61
cd4611d5cd Improve skindesigner handling 2019-10-11 13:35:52 +02:00
jojo61
06918ebbd2 removed gittid 2019-10-11 12:05:26 +02:00
jojo61
a2b52bb804 Fix jump in recordings
Fix in CUVID Bufferhandling
2019-10-11 11:47:11 +02:00
jojo61
6eb0a7f35a Fix Radio 2019-10-06 10:41:09 +02:00
jojo61
5fa43b5d71 Fix Makefile and DEBUG Error 2019-10-04 14:21:55 +02:00
jojo61
4d2735a971 Vaapi changed to egl 2019-10-04 10:37:57 +02:00
jojo61
cdac2bcc3d fix framedrop in vaapi 2019-08-26 15:00:40 +02:00
jojo61
18759e8dab fix device name 2019-08-23 14:26:43 +02:00
jojo61
9d84e34318 more fixes 2019-08-23 07:35:29 +02:00
jojo61
74c5a1f3ea Force openglosd with VAAPI 2019-08-23 07:25:27 +02:00
jojo61
6d7ef37384 fixed compile error 2019-08-23 07:11:05 +02:00
jojo61
6849d4d54f enable redeonsi 2019-08-22 15:53:45 +02:00
jojo61
5c2b801a45 First support for VAAPI 2019-08-22 12:34:29 +02:00
jojo61
fae0d3a9bd improve channelswitch 2019-04-26 09:33:59 +02:00
jojo61
053fd53bc4 improved still picture and channel switch 2019-04-13 11:45:17 +02:00
jojo61
de7311d233 make Fatal when YADIF fails 2019-04-07 15:55:40 +02:00
jojo61
71fb080fe4 added libavfilter 2019-04-05 14:33:48 +02:00
jojo61
7dbfba85f4 explain YADIF config 2019-04-05 07:26:18 +02:00
jojo61
7e5c6f349d YADIF Deinterlacer 2019-04-05 07:20:52 +02:00
jojo61
8682ab01c4 search in lib64 2019-01-04 13:12:34 +01:00
jojo61
24ccfefff3 optimized CodecAudioDecode 2019-01-04 12:27:13 +01:00
jojo61
33a3316344 removed deprecated ffmpeg functions 2019-01-04 11:27:54 +01:00
jojo61
8b16c0b490 fix DrawPixel 2019-01-04 10:15:51 +01:00
jojo61
6c5b65ed82 fix for compilerwarnings 2019-01-04 10:08:47 +01:00
jojo61
003d06b946 fix for checkCudaErrors 2019-01-04 09:21:47 +01:00
jojo61
24f679e1d3 fixed StillPicture for h265 2018-12-15 11:56:56 +01:00
jojo61
6787d9601b fixed resized GRAB 2018-12-12 11:10:20 +01:00
jojo61
3d183b0fdc fix PIP 2018-12-11 19:31:14 +01:00
jojo61
56ee6f0cec fixed GRAB 2018-12-11 17:29:01 +01:00
jojo61
b510de5728 V1.1.0 2018-12-10 13:14:46 +01:00
jojo61
333b720c65 improve records cutting 2018-12-10 13:10:58 +01:00
jojo61
b3d3caec41 more changes 2018-12-07 13:10:03 +01:00
jojo61
7b3c47035e more changes 2018-12-07 13:07:50 +01:00
jojo61
36072dd1c6 more fixes 2018-11-24 09:34:55 +01:00
jojo61
4f4472d4a7 More Konfigs nad skindesigner fixes 2018-11-20 16:17:48 +01:00
jojo61
2253957c11 More Konfigs nad skindesigner fixes 2018-11-20 16:05:38 +01:00
jojo61
56932f47e4 Cleanup 2018-11-18 15:25:43 +01:00
28 changed files with 12351 additions and 11731 deletions

37
.indent.pro vendored Normal file
View File

@@ -0,0 +1,37 @@
--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

181
Makefile
View File

@@ -7,40 +7,63 @@
# This name will be used in the '-P...' option of VDR to load the plugin.
# By default the main source file also carries this name.
PLUGIN = softhdcuvid
### Configuration (edit this for your needs)
# comment out if not needed
# support alsa audio output module
# what kind of driver do we make -
# if VAAPI is enabled the drivername is softhdvaapi
# if CUVID is enabled the drivername is softhdcuvid
#VAAPI=1
CUVID=1
# use libplacebo - available for both drivers
#LIBPLACEBO=1
# use YADIF deint - only available with cuvid
#YADIF=1
#--------------------- no more config needed past this point--------------------------------
PLUGIN = softhdcuvid
# support OPENGLOSD always needed
OPENGLOSD=1
# support alsa audio output module
ALSA ?= $(shell pkg-config --exists alsa && echo 1)
# support OSS audio output module
OSS ?= 1
# support OPENGLOSD
OPENGLOSD=1
# use Libplacebo
LIBPLACEBO=0
# use DMPS
# use DMPS
SCREENSAVER=1
OPENGL=1
# use ffmpeg libswresample
#SWRESAMPLE ?= $(shell pkg-config --exists libswresample && echo 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 = 0
endif
# use libav libavresample
#ifneq ($(SWRESAMPLE),1)
#AVRESAMPLE ?= $(shell pkg-config --exists libavresample && echo 1#)
#AVRESAMPLE = 1
#endif
CONFIG := #-DDEBUG #-DOSD_DEBUG # enable debug output+functions
CONFIG += -DCUVID # enable CUVID decoder
CONFIG += -DHAVE_GL # needed for mpv libs
#CONFIG += -DSTILL_DEBUG=2 # still picture debug verbose level
CONFIG += -DAV_INFO -DAV_INFO_TIME=3000 # info/debug a/v sync
CONFIG += -DUSE_PIP # PIP support
#CONFIG += -DHAVE_PTHREAD_NAME # supports new pthread_setname_np
#CONFIG += -DNO_TS_AUDIO # disable ts audio parser
#CONFIG += -DUSE_TS_VIDEO # build new ts video parser
@@ -53,8 +76,9 @@ CONFIG += -DUSE_VDR_SPU # use VDR SPU decoder.
### The version number of this plugin (taken from the main source file):
VERSION = $(shell grep 'static const char \*const VERSION *=' $(PLUGIN).cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
VERSION = $(shell grep 'static const char \*const VERSION *=' softhdcuvid.cpp | awk '{ print $$7 }' | sed -e 's/[";]//g')
GIT_REV = $(shell git describe --always 2>/dev/null)
### The name of the distribution archive:
### The directory environment:
@@ -68,7 +92,7 @@ TMPDIR ?= /tmp
### The compiler options:
export CFLAGS = $(call PKGCFG,cflags)
export CFLAGS = $(call PKGCFG,cflags)
export CXXFLAGS = $(call PKGCFG,cxxflags)
ifeq ($(CFLAGS),)
@@ -86,14 +110,7 @@ APIVERSION = $(call PKGCFG,apiversion)
-include $(PLGCFG)
### The name of the distribution archive:
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
### Parse softhddevice config
@@ -102,40 +119,70 @@ 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)
_CFLAGS += $(shell pkg-config --cflags libva-glx)
LIBS += $(shell pkg-config --libs libva-glx)
#_CFLAGS += $(shell pkg-config --cflags libva-glx)
#LIBS += $(shell pkg-config --libs libva-glx)
endif
ifeq ($(OPENGLOSD),1)
CONFIG += -DUSE_OPENGLOSD
endif
ifeq ($(OPENGL),1)
CONFIG += -DUSE_GLX
_CFLAGS += $(shell pkg-config --cflags gl glu glew)
LIBS += $(shell pkg-config --libs gl glu glew)
_CFLAGS += $(shell pkg-config --cflags glew)
LIBS += $(shell pkg-config --libs glew)
#LIBS += $(shell pkg-config --libs glu glew)
_CFLAGS += $(shell pkg-config --cflags freetype2)
LIBS += $(shell pkg-config --libs freetype2)
endif
ifeq ($(VAAPI),1)
CONFIG += -DVAAPI
#LIBPLACEBO=1
PLUGIN = softhdvaapi
LIBS += -lEGL
endif
ifeq ($(LIBPLACEBO),1)
CONFIG += -DPLACEBO
endif
#
# Test that libswresample is available
#
ifneq (exists, $(shell pkg-config libswresample && echo exists))
$(warning ******************************************************************)
$(warning 'libswresample' not found!)
$(error ******************************************************************)
ifeq ($(CUVID),1)
CONFIG += -DUSE_PIP # PIP support
CONFIG += -DCUVID # enable CUVID decoder
LIBS += -lEGL -lGL
ifeq ($(YADIF),1)
CONFIG += -DYADIF # Yadif only with CUVID
endif
endif
ARCHIVE = $(PLUGIN)-$(VERSION)
PACKAGE = vdr-$(ARCHIVE)
### The name of the shared object file:
SOFILE = libvdr-$(PLUGIN).so
#
# Test and set config for libavutil
# Test that libswresample is available
#
#ifneq (exists, $(shell pkg-config libswresample && echo exists))
# $(warning ******************************************************************)
# $(warning 'libswresample' not found!)
# $(error ******************************************************************)
#endif
#
# Test and set config for libavutil
#
ifneq (exists, $(shell pkg-config libavutil && echo exists))
$(warning ******************************************************************)
@@ -146,7 +193,7 @@ _CFLAGS += $(shell pkg-config --cflags 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))
$(warning ******************************************************************)
@@ -165,7 +212,7 @@ ifneq (exists, $(shell pkg-config libavcodec && echo exists))
$(error ******************************************************************)
endif
_CFLAGS += $(shell pkg-config --cflags libavcodec)
LIBS += $(shell pkg-config --libs libavcodec)
LIBS += $(shell pkg-config --libs libavcodec libavfilter)
ifeq ($(SCREENSAVER),1)
@@ -178,28 +225,32 @@ 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
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)
#LIBS += -lrt $(shell pkg-config --libs libavcodec 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)
_CFLAGS += $(shell pkg-config --cflags x11 x11-xcb xcb xcb-icccm)
LIBS += -lrt $(shell pkg-config --libs x11 x11-xcb xcb xcb-icccm)
_CFLAGS += -I/usr/local/cuda/include
_CFLAGS += -I/usr/local/cuda/include
_CFLAGS += -I./opengl -I./
LIBS += -L/usr/lib64/opengl/nvidia/lib
LIBS += -L/usr/lib64
LIBS += -L/usr/local/cuda/lib64
ifeq ($(LIBPLACEBO),1)
LIBS += -lplacebo -lglut
LIBS += -lplacebo
endif
LIBS += -lGLEW -lGLX -ldl -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid
ifeq ($(CUVID),1)
LIBS += -lcuda -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart -lnvcuvid
endif
LIBS += -lGLEW -lGLU -ldl -lglut
### Includes and Defines (add further entries here):
INCLUDES +=
@@ -210,19 +261,19 @@ DEFINES += -DPLUGIN_NAME_I18N='"$(PLUGIN)"' -D_GNU_SOURCE $(CONFIG) \
### Make it standard
override CXXFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
-g -Wextra -Winit-self -Werror=overloaded-virtual -std=c++0x
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
-g -Wextra -Winit-self -Werror=overloaded-virtual -std=c++0x
override CFLAGS += $(_CFLAGS) $(DEFINES) $(INCLUDES) \
-g -W -Wextra -Winit-self -Wdeclaration-after-statement
### The object files (add further files here):
OBJS = $(PLUGIN).o softhddev.o video.o audio.o codec.o ringbuffer.o
OBJS = softhdcuvid.o softhddev.o video.o audio.o codec.o ringbuffer.o
ifeq ($(OPENGLOSD),1)
OBJS += openglosd.o
OBJS += openglosd.o
endif
SRCS = $(wildcard $(OBJS:.o=.c)) $(PLUGIN).cpp
SRCS = $(wildcard $(OBJS:.o=.c)) softhdcuvid.cpp
### The main target:
@@ -239,11 +290,11 @@ $(DEPFILE): Makefile
### Internationalization (I18N):
PODIR = po
I18Npo = $(wildcard $(PODIR)/*.po)
I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
PODIR = po
I18Npo = $(wildcard $(PODIR)/*.po)
I18Nmo = $(addsuffix .mo, $(foreach file, $(I18Npo), $(basename $(file))))
I18Nmsgs = $(addprefix $(DESTDIR)$(LOCDIR)/, $(addsuffix /LC_MESSAGES/vdr-$(PLUGIN).mo, $(notdir $(foreach file, $(I18Npo), $(basename $(file))))))
I18Npot = $(PODIR)/$(PLUGIN).pot
I18Npot = $(PODIR)/$(PLUGIN).pot
%.mo: %.po
msgfmt -c -o $@ $<
@@ -271,7 +322,7 @@ $(OBJS): Makefile
$(SOFILE): $(OBJS) shaders.h
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
$(CXX) $(CXXFLAGS) $(LDFLAGS) -shared $(OBJS) $(LIBS) -o $@
install-lib: $(SOFILE)
install -D $^ $(DESTDIR)$(LIBDIR)/$^.$(APIVERSION)
@@ -292,13 +343,11 @@ clean:
## Private Targets:
HDRS= $(wildcard *.h)
HDRS= $(wildcard *.h)
indent:
for i in $(SRCS) $(HDRS); do \
indent $$i; \
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
mv $$i.up $$i; \
done
video_test: video.c Makefile

View File

@@ -5,7 +5,7 @@ Copyright (c) 2018 by jojo61. All Rights Reserved.
Contributor(s):
jojo61
jojo61
License: AGPLv3
@@ -31,24 +31,28 @@ A software and GPU emulated UHD output device plugin for VDR.
o HDMI/SPDIF pass-through
o Software volume, compression, normalize and channel resample
o VDR ScaleVideo API
o CUDA deinterlacer
o CUDA deinterlacer
o Autocrop
o Suspend / Dettach
o PIP (Picture-in-Picture) (not working yet)
To compile you must have the 'requires' installed.
To compile you must have the 'requires' installed.
This is a fork of johns original softhddevice work and I reworked ist to support HEVC with CUDA and opengl output.
This is a fork of johns original softhddevice work and I reworked it to support HEVC with CUDA and opengl output.
Currently I have tested it with a GTX 1050 from NVIDIA. SD, HD and UHD is working.
Current Status NVIDA:
Current Status NVIDIA:
The CUDA driver supports HEVC with 8 Bit and 10 Bit up to UHD resolution. Opengl is able to output also 10 Bit, but NVIDIA does not support to output 10 Bit via HDMI.
Only via DisplayPort you can get 10 Bit output to a ompatible screen. This is a restriction from NVIDIA.
Only via DisplayPort you can get 10 Bit output to a compatible screen. This is a restriction from NVIDIA.
Current Status with VAAPI
You need libplacebo.
It is still beta and I tested it with Intel VAAPI. If you have problmes with the shaders then copy the drirc file in your home directory as .drirc
AMD VAAPI is broken by AMD and will not work currently. The vaapi_deinterlace is broken and the amdgpu driver is instable. I have not testet with amdgpupro
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
You have to adapt the Makefile to your needs. I use FFMPEG 4.0
The Makefile expects the CUDA SDK in /usr/local/cuda. Currently it is tested with CUDA 10
Unfortunatly older FFMEGs has a bug with deinterlacing cuda frames. Best to get the latest FFMPEG Version.
@@ -61,13 +65,16 @@ old:
new:
ctx->frame_queue = av_fifo_alloc((ctx->nb_surfaces + 2 ) * sizeof(CuvidParsedFrame));
This Version supports building with libplacebo. https://github.com/haasn/libplacebo
This Version supports building with libplacebo. https://github.com/haasn/libplacebo
You have to enable it in the Makefile and install libplacebo yourself.
At the moment this is Work in progress and the used upscaler is hardcoded. This will be changend to be configurable.
At the moment this is Work in progress.
It also needs the NVIDIA driver 410.48 or newer as well as CUDA 10.
In the settings you can enable a correction for Colorblindness. First you have to decide what kind of colorblindness to use. And then the faktor of correction. If the faktor is negativ than the selected type of colorblindness is simulated. If the faktor is positiv then the colors are enhanced to try to correct the deficiency.
Also you can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test is activ.
If your FFMEG supports it then you can enable YADIF in the Makefile and select btween the buildin NVIDIA CUDA deinterlacer and the YADIF cuda deinterlacer.
Good luck
jojo61
@@ -369,40 +376,5 @@ Requires:
or
kernel support for oss/oss4 or alsa oss emulation
x11-libs/libva (deprecated)
Video Acceleration (VA) API for Linux
http://www.freedesktop.org/wiki/Software/vaapi
x11-libs/libva-intel-driver
HW video decode support for Intel integrated graphics
http://www.freedesktop.org/wiki/Software/vaapi
or
x11-libs/vdpau-video
VDPAU Backend for Video Acceleration (VA) API
http://www.freedesktop.org/wiki/Software/vaapi
or
x11-libs/xvba-video
XVBA Backend for Video Acceleration (VA) API
http://www.freedesktop.org/wiki/Software/vaapi
x11-libs/libvdpau
VDPAU wrapper and trace libraries
http://www.freedesktop.org/wiki/Software/VDPAU
x11-libs/libxcb,
X C-language Bindings library
http://xcb.freedesktop.org
x11-libs/xcb-util,
x11-libs/xcb-util-wm,
x11-libs/xcb-util-keysyms
X C-language Bindings library
http://xcb.freedesktop.org
Only versions >= 0.3.8 are good supported
x11-libs/libX11
X.Org X11 library
http://xorg.freedesktop.org
GNU Make 3.xx
http://www.gnu.org/software/make/make.html
Optional:

2813
audio.c

File diff suppressed because it is too large Load Diff

80
audio.h
View File

@@ -1,67 +1,67 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: da055758af70cfdb9ab1989d5fcfb218c5d6a366 $
/// $Id: da055758af70cfdb9ab1989d5fcfb218c5d6a366 $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup Audio
/// @{
//----------------------------------------------------------------------------
// Prototypes
// Prototypes
//----------------------------------------------------------------------------
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
extern void AudioFlushBuffers(void); ///< flush audio buffers
extern void AudioPoller(void); ///< poll audio events/handling
extern int AudioFreeBytes(void); ///< free bytes in audio output
extern int AudioUsedBytes(void); ///< used bytes in audio output
extern int64_t AudioGetDelay(void); ///< get current audio delay
extern void AudioSetClock(int64_t); ///< set audio clock base
extern int64_t AudioGetClock(); ///< get current audio clock
extern void AudioSetVolume(int); ///< set volume
extern int AudioSetup(int *, int *, int); ///< setup audio output
extern void AudioEnqueue(const void *, int); ///< buffer audio samples
extern void AudioFlushBuffers(void); ///< flush audio buffers
extern void AudioPoller(void); ///< poll audio events/handling
extern int AudioFreeBytes(void); ///< free bytes in audio output
extern int AudioUsedBytes(void); ///< used bytes in audio output
extern int64_t AudioGetDelay(void); ///< get current audio delay
extern void AudioSetClock(int64_t); ///< set audio clock base
extern int64_t AudioGetClock(); ///< get current audio clock
extern void AudioSetVolume(int); ///< set volume
extern int AudioSetup(int *, int *, int); ///< setup audio output
extern void AudioPlay(void); ///< play audio
extern void AudioPause(void); ///< pause audio
extern void AudioPlay(void); ///< play audio
extern void AudioPause(void); ///< pause audio
extern void AudioSetBufferTime(int); ///< set audio buffer time
extern void AudioSetSoftvol(int); ///< enable/disable softvol
extern void AudioSetNormalize(int, int); ///< set normalize parameters
extern void AudioSetCompression(int, int); ///< set compression parameters
extern void AudioSetStereoDescent(int); ///< set stereo loudness descent
extern void AudioSetBufferTime(int); ///< set audio buffer time
extern void AudioSetSoftvol(int); ///< enable/disable softvol
extern void AudioSetNormalize(int, int); ///< set normalize parameters
extern void AudioSetCompression(int, int); ///< set compression parameters
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
extern void AudioSetPassthroughDevice(const char *);
extern void AudioSetChannel(const char *); ///< set mixer channel
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
extern void AudioInit(void); ///< setup audio module
extern void AudioExit(void); ///< cleanup and exit audio module
extern void AudioSetChannel(const char *); ///< set mixer channel
extern void AudioSetAutoAES(int); ///< set automatic AES flag handling
extern void AudioInit(void); ///< setup audio module
extern void AudioExit(void); ///< cleanup and exit audio module
//----------------------------------------------------------------------------
// Variables
// Variables
//----------------------------------------------------------------------------
extern char AudioAlsaDriverBroken; ///< disable broken driver message
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
extern char AudioAlsaDriverBroken; ///< disable broken driver message
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
/// @}

1994
codec.c

File diff suppressed because it is too large Load Diff

174
codec.h
View File

@@ -1,173 +1,175 @@
///
/// @file codec.h @brief Codec module headerfile
/// @file codec.h @brief Codec module headerfile
///
/// Copyright (c) 2009 - 2013, 2015 by Johns. All Rights Reserved.
/// Copyright (c) 2009 - 2013, 2015 by Johns. All Rights Reserved.
///
/// Contributor(s):
/// Contributor(s):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: bdb4d18dbe371e497d039e45faa7c134b019860a $
/// $Id: bdb4d18dbe371e497d039e45faa7c134b019860a $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup Codec
/// @{
//----------------------------------------------------------------------------
// Defines
// Defines
//----------------------------------------------------------------------------
#define CodecPCM 0x01 ///< PCM bit mask
#define CodecMPA 0x02 ///< MPA bit mask (planned)
#define CodecAC3 0x04 ///< AC-3 bit mask
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
#define CodecDTS 0x10 ///< DTS bit mask (planned)
#define CodecPCM 0x01 ///< PCM bit mask
#define CodecMPA 0x02 ///< MPA bit mask (planned)
#define CodecAC3 0x04 ///< AC-3 bit mask
#define CodecEAC3 0x08 ///< E-AC-3 bit mask
#define CodecDTS 0x10 ///< DTS bit mask (planned)
#define AVCODEC_MAX_AUDIO_FRAME_SIZE 192000
enum HWAccelID {
HWACCEL_NONE = 0,
HWACCEL_AUTO,
HWACCEL_VDPAU,
HWACCEL_DXVA2,
HWACCEL_VDA,
HWACCEL_VIDEOTOOLBOX,
HWACCEL_QSV,
HWACCEL_VAAPI,
HWACCEL_CUVID,
enum HWAccelID
{
HWACCEL_NONE = 0,
HWACCEL_AUTO,
HWACCEL_VDPAU,
HWACCEL_DXVA2,
HWACCEL_VDA,
HWACCEL_VIDEOTOOLBOX,
HWACCEL_QSV,
HWACCEL_VAAPI,
HWACCEL_CUVID,
};
extern AVBufferRef *hw_device_ctx;
///
/// Video decoder structure.
/// Video decoder structure.
///
struct _video_decoder_
{
VideoHwDecoder *HwDecoder; ///< video hardware decoder
int GetFormatDone; ///< flag get format called!
AVCodec *VideoCodec; ///< video codec
AVCodecContext *VideoCtx; ///< video codec context
//#ifdef FFMPEG_WORKAROUND_ARTIFACTS
int FirstKeyFrame; ///< flag first frame
//#endif
AVFrame *Frame; ///< decoded video frame
/* hwaccel options */
enum HWAccelID hwaccel_id;
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
/* hwaccel context */
enum HWAccelID active_hwaccel_id;
void *hwaccel_ctx;
void (*hwaccel_uninit)(AVCodecContext *s);
int (*hwaccel_get_buffer)(AVCodecContext *s, AVFrame *frame, int flags);
int (*hwaccel_retrieve_data)(AVCodecContext *s, AVFrame *frame);
enum AVPixelFormat hwaccel_pix_fmt;
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
AVBufferRef *hw_frames_ctx;
VideoHwDecoder *HwDecoder; ///< video hardware decoder
void *hwdec_priv;
// For HDR side-data caching
double cached_hdr_peak;
// From VO
struct mp_hwdec_devices *hwdec_devs;
int GetFormatDone; ///< flag get format called!
AVCodec *VideoCodec; ///< video codec
AVCodecContext *VideoCtx; ///< video codec context
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
int FirstKeyFrame; ///< flag first frame
// #endif
// AVFrame *Frame; ///< decoded video frame
int filter; // flag for deint filter
/* hwaccel options */
enum HWAccelID hwaccel_id;
char *hwaccel_device;
enum AVPixelFormat hwaccel_output_format;
/* hwaccel context */
enum HWAccelID active_hwaccel_id;
void *hwaccel_ctx;
void (*hwaccel_uninit)(AVCodecContext * s);
int (*hwaccel_get_buffer)(AVCodecContext * s, AVFrame * frame, int flags);
int (*hwaccel_retrieve_data)(AVCodecContext * s, AVFrame * frame);
enum AVPixelFormat hwaccel_pix_fmt;
enum AVPixelFormat hwaccel_retrieved_pix_fmt;
AVBufferRef *hw_frames_ctx;
void *hwdec_priv;
// For HDR side-data caching
double cached_hdr_peak;
// From VO
struct mp_hwdec_devices *hwdec_devs;
};
//----------------------------------------------------------------------------
// Typedefs
// Typedefs
//----------------------------------------------------------------------------
/// Video decoder typedef.
/// Video decoder typedef.
typedef struct _video_decoder_ VideoDecoder;
/// Audio decoder typedef.
/// Audio decoder typedef.
typedef struct _audio_decoder_ AudioDecoder;
//----------------------------------------------------------------------------
// Variables
//----------------------------------------------------------------------------
/// x11 display name
/// x11 display name
extern const char *X11DisplayName;
/// HW device context from video module
/// HW device context from video module
extern AVBufferRef *HwDeviceContext;
//----------------------------------------------------------------------------
// Variables
// Variables
//----------------------------------------------------------------------------
/// Flag prefer fast xhannel switch
/// Flag prefer fast xhannel switch
extern char CodecUsePossibleDefectFrames;
//----------------------------------------------------------------------------
// Prototypes
// Prototypes
//----------------------------------------------------------------------------
/// Allocate a new video decoder context.
/// Allocate a new video decoder context.
extern VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder *);
/// Deallocate a video decoder context.
/// Deallocate a video decoder context.
extern void CodecVideoDelDecoder(VideoDecoder *);
/// Open video codec.
/// Open video codec.
extern void CodecVideoOpen(VideoDecoder *, int);
/// Close video codec.
/// Close video codec.
extern void CodecVideoClose(VideoDecoder *);
/// Decode a video packet.
/// Decode a video packet.
extern void CodecVideoDecode(VideoDecoder *, const AVPacket *);
/// Flush video buffers.
/// Flush video buffers.
extern void CodecVideoFlushBuffers(VideoDecoder *);
/// Allocate a new audio decoder context.
/// Allocate a new audio decoder context.
extern AudioDecoder *CodecAudioNewDecoder(void);
/// Deallocate an audio decoder context.
/// Deallocate an audio decoder context.
extern void CodecAudioDelDecoder(AudioDecoder *);
/// Open audio codec.
/// Open audio codec.
extern void CodecAudioOpen(AudioDecoder *, int);
/// Close audio codec.
/// Close audio codec.
extern void CodecAudioClose(AudioDecoder *);
/// Set audio drift correction.
/// Set audio drift correction.
extern void CodecSetAudioDrift(int);
/// Set audio pass-through.
/// Set audio pass-through.
extern void CodecSetAudioPassthrough(int);
/// Set audio downmix.
/// Set audio downmix.
extern void CodecSetAudioDownmix(int);
/// Decode an audio packet.
/// Decode an audio packet.
extern void CodecAudioDecode(AudioDecoder *, const AVPacket *);
/// Flush audio buffers.
/// Flush audio buffers.
extern void CodecAudioFlushBuffers(AudioDecoder *);
/// Setup and initialize codec module.
/// Setup and initialize codec module.
extern void CodecInit(void);
/// Cleanup and exit codec module.
/// Cleanup and exit codec module.
extern void CodecExit(void);
/// @}

299
common.h
View File

@@ -1,3 +1,4 @@
/*
* This file is part of mpv.
*
@@ -8,7 +9,7 @@
*
* mpv is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -52,22 +53,23 @@
struct GL;
typedef struct GL GL;
enum {
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
MPGL_CAP_FB = (1 << 5),
MPGL_CAP_VAO = (1 << 6),
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
MPGL_CAP_VDPAU = (1 << 11), // GL_NV_vdpau_interop
MPGL_CAP_APPLE_RGB_422 = (1 << 12), // GL_APPLE_rgb_422
MPGL_CAP_1D_TEX = (1 << 14),
MPGL_CAP_3D_TEX = (1 << 15),
MPGL_CAP_DEBUG = (1 << 16),
MPGL_CAP_DXINTEROP = (1 << 17), // WGL_NV_DX_interop
MPGL_CAP_EXT16 = (1 << 18), // GL_EXT_texture_norm16
MPGL_CAP_ARB_FLOAT = (1 << 19), // GL_ARB_texture_float
MPGL_CAP_EXT_CR_HFLOAT = (1 << 20), // GL_EXT_color_buffer_half_float
enum
{
MPGL_CAP_ROW_LENGTH = (1 << 4), // GL_[UN]PACK_ROW_LENGTH
MPGL_CAP_FB = (1 << 5),
MPGL_CAP_VAO = (1 << 6),
MPGL_CAP_TEX_RG = (1 << 10), // GL_ARB_texture_rg / GL 3.x
MPGL_CAP_VDPAU = (1 << 11), // GL_NV_vdpau_interop
MPGL_CAP_APPLE_RGB_422 = (1 << 12), // GL_APPLE_rgb_422
MPGL_CAP_1D_TEX = (1 << 14),
MPGL_CAP_3D_TEX = (1 << 15),
MPGL_CAP_DEBUG = (1 << 16),
MPGL_CAP_DXINTEROP = (1 << 17), // WGL_NV_DX_interop
MPGL_CAP_EXT16 = (1 << 18), // GL_EXT_texture_norm16
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_SW = (1 << 30), // indirect or sw renderer
MPGL_CAP_SW = (1 << 30), // indirect or sw renderer
};
// E.g. 310 means 3.1
@@ -78,167 +80,146 @@ enum {
#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_functions2(GL *gl, void *(*get_fn)(void *ctx, const char *n),
void *fn_ctx, 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,
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
struct GL {
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
int es; // es version (e.g. 300), 0 for desktop GL
int glsl_version; // e.g. 130 for GLSL 1.30
char *extensions; // Equivalent to GL_EXTENSIONS
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
GLuint main_fb; // framebuffer to render to (normally 0)
// function pointers loaded from the OpenGL library
struct GL
{
int version; // MPGL_VER() mangled (e.g. 210 for 2.1)
int es; // es version (e.g. 300), 0 for desktop GL
int glsl_version; // e.g. 130 for GLSL 1.30
char *extensions; // Equivalent to GL_EXTENSIONS
int mpgl_caps; // Bitfield of MPGL_CAP_* constants
bool debug_context; // use of e.g. GLX_CONTEXT_DEBUG_BIT_ARB
GLuint main_fb; // framebuffer to render to (normally 0)
void (GLAPIENTRY *Viewport)(GLint, GLint, GLsizei, GLsizei);
void (GLAPIENTRY *Clear)(GLbitfield);
void (GLAPIENTRY *GenTextures)(GLsizei, GLuint *);
void (GLAPIENTRY *DeleteTextures)(GLsizei, const GLuint *);
void (GLAPIENTRY *ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
void (GLAPIENTRY *Enable)(GLenum);
void (GLAPIENTRY *Disable)(GLenum);
const GLubyte *(GLAPIENTRY * GetString)(GLenum);
void (GLAPIENTRY *BlendFuncSeparate)(GLenum, GLenum, GLenum, GLenum);
void (GLAPIENTRY *Flush)(void);
void (GLAPIENTRY *Finish)(void);
void (GLAPIENTRY *PixelStorei)(GLenum, GLint);
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 *TexSubImage2D)(GLenum, GLint, GLint, GLint,
GLsizei, GLsizei, GLenum, GLenum,
const GLvoid *);
void (GLAPIENTRY *TexParameteri)(GLenum, GLenum, GLint);
void (GLAPIENTRY *GetIntegerv)(GLenum, GLint *);
void (GLAPIENTRY *ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum,
GLenum, GLvoid *);
void (GLAPIENTRY *ReadBuffer)(GLenum);
void (GLAPIENTRY *DrawArrays)(GLenum, GLint, GLsizei);
GLenum (GLAPIENTRY *GetError)(void);
void (GLAPIENTRY *GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
void (GLAPIENTRY *Scissor)(GLint, GLint, GLsizei, GLsizei);
void (GLAPIENTRY * Viewport) (GLint, GLint, GLsizei, GLsizei);
void (GLAPIENTRY * Clear) (GLbitfield);
void (GLAPIENTRY * GenTextures) (GLsizei, GLuint *);
void (GLAPIENTRY * DeleteTextures) (GLsizei, const GLuint *);
void (GLAPIENTRY * ClearColor) (GLclampf, GLclampf, GLclampf, GLclampf);
void (GLAPIENTRY * Enable) (GLenum);
void (GLAPIENTRY * Disable) (GLenum);
const GLubyte *(GLAPIENTRY * GetString) (GLenum);
void (GLAPIENTRY * BlendFuncSeparate) (GLenum, GLenum, GLenum, GLenum);
void (GLAPIENTRY * Flush) (void);
void (GLAPIENTRY * Finish) (void);
void (GLAPIENTRY * PixelStorei) (GLenum, GLint);
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 * TexSubImage2D) (GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
void (GLAPIENTRY * TexParameteri) (GLenum, GLenum, GLint);
void (GLAPIENTRY * GetIntegerv) (GLenum, GLint *);
void (GLAPIENTRY * ReadPixels) (GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
void (GLAPIENTRY * ReadBuffer) (GLenum);
void (GLAPIENTRY * DrawArrays) (GLenum, GLint, GLsizei);
GLenum(GLAPIENTRY * GetError) (void);
void (GLAPIENTRY * GetTexLevelParameteriv) (GLenum, GLint, GLenum, GLint *);
void (GLAPIENTRY * Scissor) (GLint, GLint, GLsizei, GLsizei);
void (GLAPIENTRY *GenBuffers)(GLsizei, GLuint *);
void (GLAPIENTRY *DeleteBuffers)(GLsizei, const GLuint *);
void (GLAPIENTRY *BindBuffer)(GLenum, GLuint);
void (GLAPIENTRY *BindBufferBase)(GLenum, GLuint, GLuint);
GLvoid * (GLAPIENTRY *MapBufferRange)(GLenum, GLintptr, GLsizeiptr,
GLbitfield);
GLboolean (GLAPIENTRY *UnmapBuffer)(GLenum);
void (GLAPIENTRY *BufferData)(GLenum, intptr_t, const GLvoid *, GLenum);
void (GLAPIENTRY *ActiveTexture)(GLenum);
void (GLAPIENTRY *BindTexture)(GLenum, GLuint);
int (GLAPIENTRY *SwapInterval)(int);
void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei,
GLsizei, GLint, GLenum, GLenum,
const GLvoid *);
void (GLAPIENTRY * GenBuffers) (GLsizei, GLuint *);
void (GLAPIENTRY * DeleteBuffers) (GLsizei, const GLuint *);
void (GLAPIENTRY * BindBuffer) (GLenum, GLuint);
void (GLAPIENTRY * BindBufferBase) (GLenum, GLuint, GLuint);
GLvoid *(GLAPIENTRY * MapBufferRange) (GLenum, GLintptr, GLsizeiptr, GLbitfield);
GLboolean(GLAPIENTRY * UnmapBuffer) (GLenum);
void (GLAPIENTRY * BufferData) (GLenum, intptr_t, const GLvoid *, GLenum);
void (GLAPIENTRY * ActiveTexture) (GLenum);
void (GLAPIENTRY * BindTexture) (GLenum, GLuint);
int (GLAPIENTRY * SwapInterval) (int);
void (GLAPIENTRY * TexImage3D) (GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum,
const GLvoid *);
void (GLAPIENTRY *GenVertexArrays)(GLsizei, GLuint *);
void (GLAPIENTRY *BindVertexArray)(GLuint);
GLint (GLAPIENTRY *GetAttribLocation)(GLuint, const GLchar *);
void (GLAPIENTRY *EnableVertexAttribArray)(GLuint);
void (GLAPIENTRY *DisableVertexAttribArray)(GLuint);
void (GLAPIENTRY *VertexAttribPointer)(GLuint, GLint, GLenum, GLboolean,
GLsizei, const GLvoid *);
void (GLAPIENTRY *DeleteVertexArrays)(GLsizei, const GLuint *);
void (GLAPIENTRY *UseProgram)(GLuint);
GLint (GLAPIENTRY *GetUniformLocation)(GLuint, const GLchar *);
void (GLAPIENTRY *CompileShader)(GLuint);
GLuint (GLAPIENTRY *CreateProgram)(void);
GLuint (GLAPIENTRY *CreateShader)(GLenum);
void (GLAPIENTRY *ShaderSource)(GLuint, GLsizei, const GLchar **,
const GLint *);
void (GLAPIENTRY *LinkProgram)(GLuint);
void (GLAPIENTRY *AttachShader)(GLuint, GLuint);
void (GLAPIENTRY *DeleteShader)(GLuint);
void (GLAPIENTRY *DeleteProgram)(GLuint);
void (GLAPIENTRY *GetShaderInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
void (GLAPIENTRY *GetShaderiv)(GLuint, GLenum, GLint *);
void (GLAPIENTRY *GetProgramInfoLog)(GLuint, GLsizei, GLsizei *, GLchar *);
void (GLAPIENTRY *GetProgramiv)(GLenum, GLenum, GLint *);
const GLubyte* (GLAPIENTRY *GetStringi)(GLenum, GLuint);
void (GLAPIENTRY *BindAttribLocation)(GLuint, GLuint, const GLchar *);
void (GLAPIENTRY *BindFramebuffer)(GLenum, GLuint);
void (GLAPIENTRY *GenFramebuffers)(GLsizei, GLuint *);
void (GLAPIENTRY *DeleteFramebuffers)(GLsizei, const GLuint *);
GLenum (GLAPIENTRY *CheckFramebufferStatus)(GLenum);
void (GLAPIENTRY *FramebufferTexture2D)(GLenum, GLenum, GLenum, GLuint,
GLint);
void (GLAPIENTRY *BlitFramebuffer)(GLint, GLint, GLint, GLint, GLint, GLint,
GLint, GLint, GLbitfield, GLenum);
void (GLAPIENTRY *GetFramebufferAttachmentParameteriv)(GLenum, GLenum,
GLenum, GLint *);
void (GLAPIENTRY * GenVertexArrays) (GLsizei, GLuint *);
void (GLAPIENTRY * BindVertexArray) (GLuint);
GLint(GLAPIENTRY * GetAttribLocation) (GLuint, const GLchar *);
void (GLAPIENTRY * EnableVertexAttribArray) (GLuint);
void (GLAPIENTRY * DisableVertexAttribArray) (GLuint);
void (GLAPIENTRY * VertexAttribPointer) (GLuint, GLint, GLenum, GLboolean, GLsizei, const GLvoid *);
void (GLAPIENTRY * DeleteVertexArrays) (GLsizei, const GLuint *);
void (GLAPIENTRY * UseProgram) (GLuint);
GLint(GLAPIENTRY * GetUniformLocation) (GLuint, const GLchar *);
void (GLAPIENTRY * CompileShader) (GLuint);
GLuint(GLAPIENTRY * CreateProgram) (void);
GLuint(GLAPIENTRY * CreateShader) (GLenum);
void (GLAPIENTRY * ShaderSource) (GLuint, GLsizei, const GLchar **, const GLint *);
void (GLAPIENTRY * LinkProgram) (GLuint);
void (GLAPIENTRY * AttachShader) (GLuint, GLuint);
void (GLAPIENTRY * DeleteShader) (GLuint);
void (GLAPIENTRY * DeleteProgram) (GLuint);
void (GLAPIENTRY * GetShaderInfoLog) (GLuint, GLsizei, GLsizei *, GLchar *);
void (GLAPIENTRY * GetShaderiv) (GLuint, GLenum, GLint *);
void (GLAPIENTRY * GetProgramInfoLog) (GLuint, GLsizei, GLsizei *, GLchar *);
void (GLAPIENTRY * GetProgramiv) (GLenum, GLenum, GLint *);
const GLubyte *(GLAPIENTRY * GetStringi) (GLenum, GLuint);
void (GLAPIENTRY * BindAttribLocation) (GLuint, GLuint, const GLchar *);
void (GLAPIENTRY * BindFramebuffer) (GLenum, GLuint);
void (GLAPIENTRY * GenFramebuffers) (GLsizei, GLuint *);
void (GLAPIENTRY * DeleteFramebuffers) (GLsizei, const GLuint *);
GLenum(GLAPIENTRY * CheckFramebufferStatus) (GLenum);
void (GLAPIENTRY * FramebufferTexture2D) (GLenum, GLenum, GLenum, GLuint, GLint);
void (GLAPIENTRY * BlitFramebuffer) (GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum);
void (GLAPIENTRY * GetFramebufferAttachmentParameteriv) (GLenum, GLenum, GLenum, GLint *);
void (GLAPIENTRY *Uniform1f)(GLint, GLfloat);
void (GLAPIENTRY *Uniform2f)(GLint, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform3f)(GLint, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform4f)(GLint, GLfloat, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY *Uniform1i)(GLint, GLint);
void (GLAPIENTRY *UniformMatrix2fv)(GLint, GLsizei, GLboolean,
const GLfloat *);
void (GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean,
const GLfloat *);
void (GLAPIENTRY * Uniform1f) (GLint, GLfloat);
void (GLAPIENTRY * Uniform2f) (GLint, GLfloat, GLfloat);
void (GLAPIENTRY * Uniform3f) (GLint, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY * Uniform4f) (GLint, GLfloat, GLfloat, GLfloat, GLfloat);
void (GLAPIENTRY * Uniform1i) (GLint, GLint);
void (GLAPIENTRY * UniformMatrix2fv) (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);
GLenum (GLAPIENTRY *ClientWaitSync)(GLsync, GLbitfield, GLuint64);
void (GLAPIENTRY *DeleteSync)(GLsync sync);
GLsync(GLAPIENTRY * FenceSync) (GLenum, GLbitfield);
GLenum(GLAPIENTRY * ClientWaitSync) (GLsync, GLbitfield, GLuint64);
void (GLAPIENTRY * DeleteSync) (GLsync sync);
void (GLAPIENTRY *GenQueries)(GLsizei, GLuint *);
void (GLAPIENTRY *DeleteQueries)(GLsizei, const GLuint *);
void (GLAPIENTRY *BeginQuery)(GLenum, GLuint);
void (GLAPIENTRY *EndQuery)(GLenum);
void (GLAPIENTRY *QueryCounter)(GLuint, GLenum);
GLboolean (GLAPIENTRY *IsQuery)(GLuint);
void (GLAPIENTRY *GetQueryObjectiv)(GLuint, GLenum, GLint *);
void (GLAPIENTRY *GetQueryObjecti64v)(GLuint, GLenum, GLint64 *);
void (GLAPIENTRY *GetQueryObjectuiv)(GLuint, GLenum, GLuint *);
void (GLAPIENTRY *GetQueryObjectui64v)(GLuint, GLenum, GLuint64 *);
void (GLAPIENTRY * GenQueries) (GLsizei, GLuint *);
void (GLAPIENTRY * DeleteQueries) (GLsizei, const GLuint *);
void (GLAPIENTRY * BeginQuery) (GLenum, GLuint);
void (GLAPIENTRY * EndQuery) (GLenum);
void (GLAPIENTRY * QueryCounter) (GLuint, GLenum);
GLboolean(GLAPIENTRY * IsQuery) (GLuint);
void (GLAPIENTRY * GetQueryObjectiv) (GLuint, GLenum, GLint *);
void (GLAPIENTRY * GetQueryObjecti64v) (GLuint, GLenum, GLint64 *);
void (GLAPIENTRY * GetQueryObjectuiv) (GLuint, GLenum, GLuint *);
void (GLAPIENTRY * GetQueryObjectui64v) (GLuint, GLenum, GLuint64 *);
void (GLAPIENTRY *VDPAUInitNV)(const GLvoid *, const GLvoid *);
void (GLAPIENTRY *VDPAUFiniNV)(void);
GLvdpauSurfaceNV (GLAPIENTRY *VDPAURegisterOutputSurfaceNV)
(GLvoid *, GLenum, GLsizei, const GLuint *);
GLvdpauSurfaceNV (GLAPIENTRY *VDPAURegisterVideoSurfaceNV)
(GLvoid *, GLenum, GLsizei, const GLuint *);
void (GLAPIENTRY *VDPAUUnregisterSurfaceNV)(GLvdpauSurfaceNV);
void (GLAPIENTRY *VDPAUSurfaceAccessNV)(GLvdpauSurfaceNV, GLenum);
void (GLAPIENTRY *VDPAUMapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
void (GLAPIENTRY *VDPAUUnmapSurfacesNV)(GLsizei, const GLvdpauSurfaceNV *);
void (GLAPIENTRY * VDPAUInitNV) (const GLvoid *, const GLvoid *);
void (GLAPIENTRY * VDPAUFiniNV) (void);
GLvdpauSurfaceNV(GLAPIENTRY * VDPAURegisterOutputSurfaceNV)
(GLvoid *, GLenum, GLsizei, const GLuint *);
GLvdpauSurfaceNV(GLAPIENTRY * VDPAURegisterVideoSurfaceNV)
(GLvoid *, GLenum, GLsizei, const GLuint *);
void (GLAPIENTRY * VDPAUUnregisterSurfaceNV) (GLvdpauSurfaceNV);
void (GLAPIENTRY * VDPAUSurfaceAccessNV) (GLvdpauSurfaceNV, GLenum);
void (GLAPIENTRY * VDPAUMapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV *);
void (GLAPIENTRY * VDPAUUnmapSurfacesNV) (GLsizei, const GLvdpauSurfaceNV *);
#if HAVE_GL_WIN32
// The HANDLE type might not be present on non-Win32
BOOL (GLAPIENTRY *DXSetResourceShareHandleNV)(void *dxObject,
HANDLE shareHandle);
HANDLE (GLAPIENTRY *DXOpenDeviceNV)(void *dxDevice);
BOOL (GLAPIENTRY *DXCloseDeviceNV)(HANDLE hDevice);
HANDLE (GLAPIENTRY *DXRegisterObjectNV)(HANDLE hDevice, void *dxObject,
GLuint name, GLenum type, GLenum access);
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);
BOOL(GLAPIENTRY * DXSetResourceShareHandleNV) (void *dxObject, HANDLE shareHandle);
HANDLE(GLAPIENTRY * DXOpenDeviceNV) (void *dxDevice);
BOOL(GLAPIENTRY * DXCloseDeviceNV) (HANDLE hDevice);
HANDLE(GLAPIENTRY * DXRegisterObjectNV) (HANDLE hDevice, void *dxObject, GLuint name, GLenum type, GLenum access);
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
GLint (GLAPIENTRY *GetVideoSync)(GLuint *);
GLint (GLAPIENTRY *WaitVideoSync)(GLint, GLint, unsigned int *);
GLint(GLAPIENTRY * GetVideoSync) (GLuint *);
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 */

View File

@@ -1,3 +1,4 @@
/*
* This file is part of libplacebo.
*
@@ -8,7 +9,7 @@
*
* libplacebo is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@@ -39,5 +40,4 @@
#define PL_HAVE_SHADERC 0
#define PL_HAVE_VULKAN 1
#endif // LIBPLACEBO_CONTEXT_H_

54
drirc Normal file
View File

@@ -0,0 +1,54 @@
<driconf>
<device screen="0" driver="i965">
<application name="Default">
<option name="always_flush_cache" value="false" />
<option name="mesa_no_error" value="false" />
<option name="precise_trig" value="false" />
<option name="mesa_glthread" value="false" />
<option name="disable_glsl_line_continuations" value="false" />
<option name="disable_blend_func_extended" value="false" />
<option name="shader_precompile" value="true" />
<option name="clamp_max_samples" value="-1" />
<option name="allow_glsl_extension_directive_midshader" value="false" />
<option name="allow_rgb10_configs" value="true" />
<option name="allow_glsl_cross_stage_interpolation_mismatch" value="false" />
<option name="force_glsl_abs_sqrt" value="false" />
<option name="dual_color_blend_by_location" value="false" />
<option name="bo_reuse" value="1" />
<option name="always_flush_batch" value="false" />
<option name="allow_rgb565_configs" value="true" />
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
<option name="force_glsl_extensions_warn" value="false" />
<option name="disable_throttling" value="false" />
<option name="force_glsl_version" value="330" />
<option name="glsl_zero_init" value="false" />
<option name="allow_higher_compat_version" value="true" />
</application>
</device>
<device screen="0" driver="radeonsi">
<application name="Default">
<option name="always_flush_cache" value="false" />
<option name="mesa_no_error" value="false" />
<option name="precise_trig" value="false" />
<option name="mesa_glthread" value="false" />
<option name="disable_glsl_line_continuations" value="false" />
<option name="disable_blend_func_extended" value="false" />
<option name="shader_precompile" value="true" />
<option name="clamp_max_samples" value="-1" />
<option name="allow_glsl_extension_directive_midshader" value="false" />
<option name="allow_rgb10_configs" value="true" />
<option name="allow_glsl_cross_stage_interpolation_mismatch" value="false" />
<option name="force_glsl_abs_sqrt" value="false" />
<option name="dual_color_blend_by_location" value="false" />
<option name="bo_reuse" value="1" />
<option name="always_flush_batch" value="false" />
<option name="allow_rgb565_configs" value="true" />
<option name="allow_glsl_builtin_variable_redeclaration" value="true" />
<option name="force_glsl_extensions_warn" value="false" />
<option name="disable_throttling" value="false" />
<option name="force_glsl_version" value="330" />
<option name="glsl_zero_init" value="false" />
<option name="allow_higher_compat_version" value="true" />
</application>
</device>
</driconf>

View File

@@ -1,3 +1,4 @@
/*
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
*
@@ -16,88 +17,91 @@
#include <string.h>
#include <stdlib.h>
#ifdef __cuda_cuda_h__ // check to see if CUDA_H is included above
#ifdef __cuda_cuda_h__ // check to see if CUDA_H is included above
// Error Code string definitions here
typedef struct
{
char const *error_string;
unsigned int error_id;
unsigned int error_id;
} s_CudaErrorStr;
/**
* Error codes
*/
s_CudaErrorStr sCudaDrvErrorString[] =
{
s_CudaErrorStr sCudaDrvErrorString[] = {
/**
* The API call returned with no errors. In the case of query calls, this
* can also mean that the operation being queried is complete (see
* ::cuEventQuery() and ::cuStreamQuery()).
*/
{ "CUDA_SUCCESS", 0 },
{"CUDA_SUCCESS", 0},
/**
* This indicates that one or more of the parameters passed to the API call
* is not within an acceptable range of values.
*/
{ "CUDA_ERROR_INVALID_VALUE", 1 },
{"CUDA_ERROR_INVALID_VALUE", 1},
/**
* The API call failed because it was unable to allocate enough memory to
* perform the requested operation.
*/
{ "CUDA_ERROR_OUT_OF_MEMORY", 2 },
{"CUDA_ERROR_OUT_OF_MEMORY", 2},
/**
* This indicates that the CUDA driver has not been initialized with
* ::cuInit() or that initialization has failed.
*/
{ "CUDA_ERROR_NOT_INITIALIZED", 3 },
{"CUDA_ERROR_NOT_INITIALIZED", 3},
/**
* This indicates that the CUDA driver is in the process of shutting down.
*/
{ "CUDA_ERROR_DEINITIALIZED", 4 },
{"CUDA_ERROR_DEINITIALIZED", 4},
/**
* This indicates profiling APIs are called while application is running
* in visual profiler mode.
*/
{ "CUDA_ERROR_PROFILER_DISABLED", 5 },
{"CUDA_ERROR_PROFILER_DISABLED", 5},
/**
* This indicates profiling has not been initialized for this context.
* 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
* 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
* 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
* CUDA driver.
*/
{ "CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100 },
{"CUDA_ERROR_NO_DEVICE (no CUDA-capable devices were detected)", 100},
/**
* This indicates that the device ordinal supplied by the user does not
* correspond to a valid CUDA device.
*/
{ "CUDA_ERROR_INVALID_DEVICE (device specified is not a valid CUDA device)", 101 },
{"CUDA_ERROR_INVALID_DEVICE (device specified is not a valid CUDA device)", 101},
/**
* This indicates that the device kernel image is invalid. This can also
* indicate an invalid CUDA module.
*/
{ "CUDA_ERROR_INVALID_IMAGE", 200 },
{"CUDA_ERROR_INVALID_IMAGE", 200},
/**
* This most frequently indicates that there is no context bound to the
@@ -107,7 +111,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* mixes different API versions (i.e. 3010 context with 3020 API calls).
* See ::cuCtxGetApiVersion() for more details.
*/
{ "CUDA_ERROR_INVALID_CONTEXT", 201 },
{"CUDA_ERROR_INVALID_CONTEXT", 201},
/**
* This indicated that the context being supplied as a parameter to the
@@ -116,28 +120,28 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* This error return is deprecated as of CUDA 3.2. It is no longer an
* error to attempt to push the active context via ::cuCtxPushCurrent().
*/
{ "CUDA_ERROR_CONTEXT_ALREADY_CURRENT", 202 },
{"CUDA_ERROR_CONTEXT_ALREADY_CURRENT", 202},
/**
* This indicates that a map or register operation has failed.
*/
{ "CUDA_ERROR_MAP_FAILED", 205 },
{"CUDA_ERROR_MAP_FAILED", 205},
/**
* This indicates that an unmap or unregister operation has failed.
*/
{ "CUDA_ERROR_UNMAP_FAILED", 206 },
{"CUDA_ERROR_UNMAP_FAILED", 206},
/**
* This indicates that the specified array is currently mapped and thus
* cannot be destroyed.
*/
{ "CUDA_ERROR_ARRAY_IS_MAPPED", 207 },
{"CUDA_ERROR_ARRAY_IS_MAPPED", 207},
/**
* This indicates that the resource is already mapped.
*/
{ "CUDA_ERROR_ALREADY_MAPPED", 208 },
{"CUDA_ERROR_ALREADY_MAPPED", 208},
/**
* This indicates that there is no kernel image available that is suitable
@@ -145,115 +149,112 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* options for a particular CUDA source file that do not include the
* corresponding device configuration.
*/
{ "CUDA_ERROR_NO_BINARY_FOR_GPU", 209 },
{"CUDA_ERROR_NO_BINARY_FOR_GPU", 209},
/**
* This indicates that a resource has already been acquired.
*/
{ "CUDA_ERROR_ALREADY_ACQUIRED", 210 },
{"CUDA_ERROR_ALREADY_ACQUIRED", 210},
/**
* This indicates that a resource is not mapped.
*/
{ "CUDA_ERROR_NOT_MAPPED", 211 },
{"CUDA_ERROR_NOT_MAPPED", 211},
/**
* This indicates that a mapped resource is not available for access as an
* array.
*/
{ "CUDA_ERROR_NOT_MAPPED_AS_ARRAY", 212 },
{"CUDA_ERROR_NOT_MAPPED_AS_ARRAY", 212},
/**
* This indicates that a mapped resource is not available for access as a
* pointer.
*/
{ "CUDA_ERROR_NOT_MAPPED_AS_POINTER", 213 },
{"CUDA_ERROR_NOT_MAPPED_AS_POINTER", 213},
/**
* This indicates that an uncorrectable ECC error was detected during
* execution.
*/
{ "CUDA_ERROR_ECC_UNCORRECTABLE", 214 },
{"CUDA_ERROR_ECC_UNCORRECTABLE", 214},
/**
* This indicates that the ::CUlimit passed to the API call is not
* supported by the active device.
*/
{ "CUDA_ERROR_UNSUPPORTED_LIMIT", 215 },
{"CUDA_ERROR_UNSUPPORTED_LIMIT", 215},
/**
* This indicates that the ::CUcontext passed to the API call can
* only be bound to a single CPU thread at a time but is already
* bound to a CPU thread.
*/
{ "CUDA_ERROR_CONTEXT_ALREADY_IN_USE", 216 },
{"CUDA_ERROR_CONTEXT_ALREADY_IN_USE", 216},
/**
* This indicates that peer access is not supported across the given
* devices.
*/
{ "CUDA_ERROR_PEER_ACCESS_UNSUPPORTED", 217 },
{"CUDA_ERROR_PEER_ACCESS_UNSUPPORTED", 217},
/**
* This indicates that a PTX JIT compilation failed.
*/
{ "CUDA_ERROR_INVALID_PTX", 218 },
{"CUDA_ERROR_INVALID_PTX", 218},
/**
* This indicates an error with OpenGL or DirectX context.
*/
{ "CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219 },
{"CUDA_ERROR_INVALID_GRAPHICS_CONTEXT", 219},
/**
* This indicates that an uncorrectable NVLink error was detected during the
* execution.
*/
{ "CUDA_ERROR_NVLINK_UNCORRECTABLE", 220 },
{"CUDA_ERROR_NVLINK_UNCORRECTABLE", 220},
/**
* This indicates that the PTX JIT compiler library was not found.
*/
{ "CUDA_ERROR_JIT_COMPILER_NOT_FOUND", 221 },
{"CUDA_ERROR_JIT_COMPILER_NOT_FOUND", 221},
/**
* This indicates that the device kernel source is invalid.
*/
{ "CUDA_ERROR_INVALID_SOURCE", 300 },
{"CUDA_ERROR_INVALID_SOURCE", 300},
/**
* This indicates that the file specified was not found.
*/
{ "CUDA_ERROR_FILE_NOT_FOUND", 301 },
{"CUDA_ERROR_FILE_NOT_FOUND", 301},
/**
* This indicates that a link to a shared object failed to resolve.
*/
{ "CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND", 302 },
{"CUDA_ERROR_SHARED_OBJECT_SYMBOL_NOT_FOUND", 302},
/**
* This indicates that initialization of a shared object failed.
*/
{ "CUDA_ERROR_SHARED_OBJECT_INIT_FAILED", 303 },
{"CUDA_ERROR_SHARED_OBJECT_INIT_FAILED", 303},
/**
* This indicates that an OS call failed.
*/
{ "CUDA_ERROR_OPERATING_SYSTEM", 304 },
{"CUDA_ERROR_OPERATING_SYSTEM", 304},
/**
* This indicates that a resource handle passed to the API call was not
* valid. Resource handles are opaque types like ::CUstream and ::CUevent.
*/
{ "CUDA_ERROR_INVALID_HANDLE", 400 },
{"CUDA_ERROR_INVALID_HANDLE", 400},
/**
* This indicates that a named symbol was not found. Examples of symbols
* are global/constant variable names, texture names }, and surface names.
*/
{ "CUDA_ERROR_NOT_FOUND", 500 },
{"CUDA_ERROR_NOT_FOUND", 500},
/**
* This indicates that asynchronous operations issued previously have not
@@ -261,8 +262,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* differently than ::CUDA_SUCCESS (which indicates completion). 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
@@ -271,7 +271,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must be terminated
* and relaunched.
*/
{ "CUDA_ERROR_ILLEGAL_ADDRESS", 700 },
{"CUDA_ERROR_ILLEGAL_ADDRESS", 700},
/**
* This indicates that a launch did not occur because it did not have
@@ -282,7 +282,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* when a 32-bit int is expected) is equivalent to passing too many
* arguments and can also result in this error.
*/
{ "CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES", 701 },
{"CUDA_ERROR_LAUNCH_OUT_OF_RESOURCES", 701},
/**
* This indicates that the device kernel took too long to execute. This can
@@ -293,40 +293,40 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* this context are invalid and must be reconstructed if the program is to
* continue using CUDA.
*/
{ "CUDA_ERROR_LAUNCH_TIMEOUT", 702 },
{"CUDA_ERROR_LAUNCH_TIMEOUT", 702},
/**
* This error indicates a kernel launch that uses an incompatible texturing
* mode.
*/
{ "CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING", 703 },
{"CUDA_ERROR_LAUNCH_INCOMPATIBLE_TEXTURING", 703},
/**
* This error indicates that a call to ::cuCtxEnablePeerAccess() is
* trying to re-enable peer access to a context which has already
* had peer access to it enabled.
*/
{ "CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED", 704 },
{"CUDA_ERROR_PEER_ACCESS_ALREADY_ENABLED", 704},
/**
* This error indicates that ::cuCtxDisablePeerAccess() is
* trying to disable peer access which has not been enabled yet
* via ::cuCtxEnablePeerAccess().
*/
{ "CUDA_ERROR_PEER_ACCESS_NOT_ENABLED", 705 },
{"CUDA_ERROR_PEER_ACCESS_NOT_ENABLED", 705},
/**
* This error indicates that the primary context for the specified device
* has already been initialized.
*/
{ "CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE", 708 },
{"CUDA_ERROR_PRIMARY_CONTEXT_ACTIVE", 708},
/**
* This error indicates that the context current to the calling thread
* has been destroyed using ::cuCtxDestroy }, or is a primary context which
* has not yet been initialized.
*/
{ "CUDA_ERROR_CONTEXT_IS_DESTROYED", 709 },
{"CUDA_ERROR_CONTEXT_IS_DESTROYED", 709},
/**
* A device-side assert triggered during kernel execution. The context
@@ -334,26 +334,26 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* memory allocations from this context are invalid and must be
* reconstructed if the program is to continue using CUDA.
*/
{ "CUDA_ERROR_ASSERT", 710 },
{"CUDA_ERROR_ASSERT", 710},
/**
* This error indicates that the hardware resources required to enable
* peer access have been exhausted for one or more of the devices
* passed to ::cuCtxEnablePeerAccess().
*/
{ "CUDA_ERROR_TOO_MANY_PEERS", 711 },
{"CUDA_ERROR_TOO_MANY_PEERS", 711},
/**
* This error indicates that the memory range passed to ::cuMemHostRegister()
* has already been registered.
*/
{ "CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712 },
{"CUDA_ERROR_HOST_MEMORY_ALREADY_REGISTERED", 712},
/**
* This error indicates that the pointer passed to ::cuMemHostUnregister()
* does not correspond to any currently registered memory region.
*/
{ "CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED", 713 },
{"CUDA_ERROR_HOST_MEMORY_NOT_REGISTERED", 713},
/**
* While executing a kernel, the device encountered a stack error.
@@ -362,7 +362,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must 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.
@@ -370,7 +370,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must 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
@@ -379,7 +379,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must be terminated
* and relaunched.
*/
{ "CUDA_ERROR_MISALIGNED_ADDRESS", 716 },
{"CUDA_ERROR_MISALIGNED_ADDRESS", 716},
/**
* While executing a kernel, the device encountered an instruction
@@ -390,7 +390,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must 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.
@@ -398,7 +398,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* will return the same error. To continue using CUDA, the process must be terminated
* and relaunched.
*/
{ "CUDA_ERROR_INVALID_PC", 718 },
{"CUDA_ERROR_INVALID_PC", 718},
/**
* An exception occurred on the device while executing a kernel. Common
@@ -408,7 +408,7 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* memory allocations from this context are invalid and must be
* reconstructed if the program is to continue using CUDA.
*/
{ "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
@@ -417,37 +417,33 @@ s_CudaErrorStr sCudaDrvErrorString[] =
* or ::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},
/**
* This error indicates that the attempted operation is not permitted.
*/
{ "CUDA_ERROR_NOT_PERMITTED", 800 },
{"CUDA_ERROR_NOT_PERMITTED", 800},
/**
* This error indicates that the attempted operation is not supported
* on the current system or device.
*/
{ "CUDA_ERROR_NOT_SUPPORTED", 801 },
{"CUDA_ERROR_NOT_SUPPORTED", 801},
/**
* This indicates that an unknown internal error has occurred.
*/
{ "CUDA_ERROR_UNKNOWN", 999 },
{ NULL, -1 }
{"CUDA_ERROR_UNKNOWN", 999},
{NULL, -1}
};
// This is just a linear search through the array, since the error_id's are not
// always ocurring consecutively
inline const char *getCudaDrvErrorString(CUresult error_id)
static inline const char *getCudaDrvErrorString(CUresult error_id)
{
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) {
index++;
}
@@ -459,5 +455,4 @@ inline const char *getCudaDrvErrorString(CUresult error_id)
#endif // __cuda_cuda_h__
#endif

View File

@@ -1,23 +1,23 @@
///
/// @file iatomic.h @brief Misc function header file
/// @file iatomic.h @brief Misc function header file
///
/// Copyright (c) 2014 by Johns. All Rights Reserved.
/// Copyright (c) 2014 by Johns. All Rights Reserved.
///
/// Contributor(s):
/// Contributor(s):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: 59e1684aaa6678ecdebb6ce0df6ce5b5f461dd6e $
/// $Id: 59e1684aaa6678ecdebb6ce0df6ce5b5f461dd6e $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup iatomic
@@ -27,8 +27,8 @@
+ __GNUC_MINOR__ * 100 \
+ __GNUC_PATCHLEVEL__)
// gcc before 4.7 didn't support atomic builtins,
// use alsa atomic functions.
// gcc before 4.7 didn't support atomic builtins,
// use alsa atomic functions.
#if GCC_VERSION < 40700
#include <alsa/iatomic.h>
@@ -36,58 +36,58 @@
#else
//////////////////////////////////////////////////////////////////////////////
// Defines
// Defines
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Declares
// Declares
//////////////////////////////////////////////////////////////////////////////
///
/// atomic type, 24 bit useable,
/// atomic type, 24 bit useable,
///
typedef volatile int atomic_t;
//////////////////////////////////////////////////////////////////////////////
// Prototypes
// Prototypes
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Inlines
// Inlines
//////////////////////////////////////////////////////////////////////////////
///
/// Set atomic value.
/// Set atomic value.
///
#define atomic_set(ptr, val) \
__atomic_store_n(ptr, val, __ATOMIC_SEQ_CST)
///
/// Read atomic value.
/// Read atomic value.
///
#define atomic_read(ptr) \
__atomic_load_n(ptr, __ATOMIC_SEQ_CST)
///
/// Increment atomic value.
/// Increment atomic value.
///
#define atomic_inc(ptr) \
__atomic_add_fetch(ptr, 1, __ATOMIC_SEQ_CST)
///
/// Decrement atomic value.
/// Decrement atomic value.
///
#define atomic_dec(ptr) \
__atomic_sub_fetch(ptr, 1, __ATOMIC_SEQ_CST)
///
/// Add to atomic value.
/// Add to atomic value.
///
#define atomic_add(val, ptr) \
__atomic_add_fetch(ptr, val, __ATOMIC_SEQ_CST)
///
/// Subtract from atomic value.
/// Subtract from atomic value.
///
#define atomic_sub(val, ptr) \
__atomic_sub_fetch(ptr, val, __ATOMIC_SEQ_CST)

80
misc.h
View File

@@ -1,24 +1,24 @@
///
/// @file misc.h @brief Misc function header file
/// @file misc.h @brief Misc function header file
///
/// Copyright (c) 2009 - 2012 by Lutz Sammer. All Rights Reserved.
/// Copyright (c) 2009 - 2012 by Lutz Sammer. All Rights Reserved.
///
/// Contributor(s):
/// Copied from uwm.
/// Contributor(s):
/// Copied from uwm.
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: f5ff4b300aa33eb721d658c0c9374c8499b67318 $
/// $Id: f5ff4b300aa33eb721d658c0c9374c8499b67318 $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup misc
@@ -26,37 +26,37 @@
#include <syslog.h>
#include <stdarg.h>
#include <time.h> // clock_gettime
#include <time.h> // clock_gettime
//////////////////////////////////////////////////////////////////////////////
// Defines
// Defines
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// Declares
// Declares
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
// 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, ...)
__attribute__ ((format(printf, 2, 3)));
__attribute__((format(printf, 2, 3)));
//////////////////////////////////////////////////////////////////////////////
// Inlines
// Inlines
//////////////////////////////////////////////////////////////////////////////
#ifdef DEBUG
#define DebugLevel 4 /// private debug level
#define DebugLevel 4 /// private debug level
#else
#define DebugLevel 0 /// private debug level
#define DebugLevel 0 /// private debug level
#endif
/**
@@ -70,18 +70,18 @@ static inline void Syslog(const int, const char *format, ...)
static inline void Syslog(const int level, const char *format, ...)
{
if (SysLogLevel > level || DebugLevel > level) {
va_list ap;
va_list ap;
va_start(ap, format);
vsyslog(LOG_ERR, format, ap);
va_end(ap);
va_start(ap, format);
vsyslog(LOG_ERR, format, ap);
va_end(ap);
}
}
/**
** Show error.
*/
#define Error(fmt...) Syslog(0, fmt)
#define Error(fmt...) Syslog(LOG_ERR, fmt)
/**
** Show fatal error.
@@ -91,12 +91,12 @@ static inline void Syslog(const int level, const char *format, ...)
/**
** Show warning.
*/
#define Warning(fmt...) Syslog(1, fmt)
#define Warning(fmt...) Syslog(LOG_WARNING, fmt)
/**
** Show info.
*/
#define Info(fmt...) Syslog(2, fmt)
#define Info(fmt...) Syslog(LOG_INFO, fmt)
/**
** Show debug.
@@ -104,7 +104,7 @@ static inline void Syslog(const int level, const char *format, ...)
#ifdef DEBUG
#define Debug(level, fmt...) Syslog(level, fmt)
#else
#define Debug(level, fmt...) /* disabled */
#define Debug(level, fmt...) /* disabled */
#endif
#ifndef AV_NOPTS_VALUE
@@ -122,12 +122,11 @@ static inline const char *Timestamp2String(int64_t ts)
static int idx;
if (ts == (int64_t) AV_NOPTS_VALUE) {
return "--:--:--.---";
return "--:--:--.---";
}
idx = (idx + 1) % 3;
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));
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));
return buf[idx];
}
@@ -148,24 +147,25 @@ static inline uint32_t GetMsTicks(void)
struct timeval tval;
if (gettimeofday(&tval, NULL) < 0) {
return 0;
return 0;
}
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
#endif
}
static inline uint64_t GetusTicks(void)
{
#ifdef CLOCK_MONOTONIC
struct timespec tspec;
clock_gettime(CLOCK_MONOTONIC, &tspec);
return (tspec.tv_sec * 1000000) + (tspec.tv_nsec) ;
return (uint64_t) (tspec.tv_sec * 1000000) + (tspec.tv_nsec);
#else
struct timeval tval;
if (gettimeofday(&tval, NULL) < 0) {
return 0;
return 0;
}
return (tval.tv_sec * 1000) + (tval.tv_usec / 1000);
#endif

View File

@@ -14,12 +14,14 @@ void ConvertColor(const GLint &colARGB, glm::vec4 &col) {
col.b = ((colARGB & 0x000000FF) ) / 255.0;
}
/****************************************************************************************
* cShader
****************************************************************************************/
const char *rectVertexShader =
#ifdef CUVID
const char *rectVertexShader =
"#version 330 core \n\
\
layout (location = 0) in vec2 position; \
@@ -34,7 +36,7 @@ void main() \
} \
";
const char *rectFragmentShader =
const char *rectFragmentShader =
"#version 330 core \n\
\
in vec4 rectCol; \
@@ -46,7 +48,7 @@ void main() \
} \
";
const char *textureVertexShader =
const char *textureVertexShader =
"#version 330 core \n\
\
layout (location = 0) in vec2 position; \
@@ -66,7 +68,7 @@ void main() \
} \
";
const char *textureFragmentShader =
const char *textureFragmentShader =
"#version 330 core \n\
in vec2 TexCoords; \
in vec4 alphaValue; \
@@ -80,7 +82,7 @@ void main() \
} \
";
const char *textVertexShader =
const char *textVertexShader =
"#version 330 core \n\
\
layout (location = 0) in vec2 position; \
@@ -100,7 +102,7 @@ void main() \
} \
";
const char *textFragmentShader =
const char *textFragmentShader =
"#version 330 core \n\
in vec2 TexCoords; \
in vec4 textColor; \
@@ -116,7 +118,109 @@ void main() \
} \
";
static cShader *Shaders[stCount];
#else
const char *rectVertexShader =
"\n \
\
layout (location = 0) in vec2 position; \
out vec4 rectCol; \
uniform vec4 inColor; \
uniform mat4 projection; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
rectCol = inColor; \
} \
";
const char *rectFragmentShader =
"\n \
\
precision mediump float; \
in vec4 rectCol; \
out vec4 color; \
\
void main() \
{ \
color = rectCol; \
} \
";
const char *textureVertexShader =
"\n \
\
layout (location = 0) in vec2 position; \
layout (location = 1) in vec2 texCoords; \
\
out vec2 TexCoords; \
out vec4 alphaValue;\
\
uniform mat4 projection; \
uniform vec4 alpha; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
TexCoords = texCoords; \
alphaValue = alpha; \
} \
";
const char *textureFragmentShader =
"\n \
precision mediump float; \
in vec2 TexCoords; \
in vec4 alphaValue; \
out vec4 color; \
\
uniform sampler2D screenTexture; \
\
void main() \
{ \
color = texture(screenTexture, TexCoords) * alphaValue; \
} \
";
const char *textVertexShader =
"\n \
\
layout (location = 0) in vec2 position; \
layout (location = 1) in vec2 texCoords; \
\
out vec2 TexCoords; \
out vec4 textColor; \
\
uniform mat4 projection; \
uniform vec4 inColor; \
\
void main() \
{ \
gl_Position = projection * vec4(position.x, position.y, 0.0, 1.0); \
TexCoords = texCoords; \
textColor = inColor; \
} \
";
const char *textFragmentShader =
"\n \
precision mediump float; \
in vec2 TexCoords; \
in vec4 textColor; \
\
out vec4 color; \
\
uniform sampler2D glyphTexture; \
\
void main() \
{ \
vec4 sampled = vec4(1.0, 1.0, 1.0, texture(glyphTexture, TexCoords).r); \
color = textColor * sampled; \
} \
";
#endif
static cShader *Shaders[stCount];
void cShader::Use(void) {
glUseProgram(id);
@@ -188,12 +292,14 @@ bool cShader::Compile(const char *vertexCode, const char *fragmentCode) {
sVertex = glCreateShader(GL_VERTEX_SHADER);
glShaderSource(sVertex, 1, &vertexCode, NULL);
glCompileShader(sVertex);
// esyslog("[softhddev]:SHADER:VERTEX %s\n",vertexCode);
if (!CheckCompileErrors(sVertex))
return false;
// Fragment Shader
sFragment = glCreateShader(GL_FRAGMENT_SHADER);
glShaderSource(sFragment, 1, &fragmentCode, NULL);
glCompileShader(sFragment);
// esyslog("[softhddev]:SHADER:FRAGMENT %s\n",fragmentCode);
if (!CheckCompileErrors(sFragment))
return false;
// link Program
@@ -216,14 +322,14 @@ bool cShader::CheckCompileErrors(GLuint object, bool program) {
glGetShaderiv(object, GL_COMPILE_STATUS, &success);
if (!success) {
glGetShaderInfoLog(object, 1024, NULL, infoLog);
esyslog("[softhddev]:SHADER: Compile-time error: Type: %d - %s", type, infoLog);
esyslog("[softhddev]:SHADER: Compile-time error: Type: %d - \n%s\n", type, infoLog);
return false;
}
} else {
glGetProgramiv(object, GL_LINK_STATUS, &success);
if (!success) {
glGetProgramInfoLog(object, 1024, NULL, infoLog);
esyslog("[softhddev]:SHADER: Link-time error: Type: %d", type);
esyslog("[softhddev]:SHADER: Link-time error: Type: %d - \n%s\n", type, infoLog);
return false;
}
}
@@ -266,6 +372,7 @@ void cOglGlyph::BindTexture(void) {
void cOglGlyph::LoadTexture(FT_BitmapGlyph ftGlyph) {
// Disable byte-alignment restriction
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
@@ -287,6 +394,8 @@ void cOglGlyph::LoadTexture(FT_BitmapGlyph ftGlyph) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
}
@@ -372,7 +481,7 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const {
error = FT_Stroker_New( ftLib, &stroker );
if (error) {
esyslog("[softhddev]FT_Stroker_New FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message);
return NULL;
return NULL;
}
float outlineWidth = 0.25f;
FT_Stroker_Set(stroker,
@@ -381,11 +490,11 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const {
FT_STROKER_LINEJOIN_ROUND,
0);
error = FT_Get_Glyph(face->glyph, &ftGlyph);
if (error) {
esyslog("[softhddev]FT_Get_Glyph FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message);
return NULL;
return NULL;
}
error = FT_Glyph_StrokeBorder( &ftGlyph, stroker, 0, 1 );
@@ -398,9 +507,9 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const {
error = FT_Glyph_To_Bitmap( &ftGlyph, FT_RENDER_MODE_NORMAL, 0, 1);
if (error) {
esyslog("[softhddev]FT_Glyph_To_Bitmap FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message);
return NULL;
return NULL;
}
cOglGlyph *Glyph = new cOglGlyph(charCode, (FT_BitmapGlyph)ftGlyph);
glyphCache.Add(Glyph);
FT_Done_Glyph(ftGlyph);
@@ -442,13 +551,16 @@ cOglFb::cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHei
}
cOglFb::~cOglFb(void) {
glDeleteTextures(1, &texture);
glDeleteFramebuffers(1, &fb);
if (texture)
glDeleteTextures(1, &texture);
if (fb)
glDeleteFramebuffers(1, &fb);
}
bool cOglFb::Init(void) {
initiated = true;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
@@ -459,12 +571,15 @@ bool cOglFb::Init(void) {
glGenFramebuffers(1, &fb);
glBindFramebuffer(GL_FRAMEBUFFER, fb);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) {
esyslog("[softhddev]ERROR: Framebuffer is not complete!\n");
esyslog("[softhddev]ERROR: %d Framebuffer is not complete!\n",__LINE__);
return false;
}
return true;
}
@@ -484,7 +599,7 @@ void cOglFb::BindWrite(void) {
}
void cOglFb::Unbind(void) {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glBindTexture(GL_TEXTURE_2D, 0);
}
@@ -504,28 +619,29 @@ void cOglFb::Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2) {
* cOglOutputFb
****************************************************************************************/
cOglOutputFb::cOglOutputFb(GLint width, GLint height) : cOglFb(width, height, width, height) {
// surface = 0;
initiated = false;
// surface = 0;
initiated = false;
fb = 0;
texture = 0;
}
cOglOutputFb::~cOglOutputFb(void) {
// glVDPAUUnregisterSurfaceNV(surface);
glDeleteTextures(1, &texture);
// glVDPAUUnregisterSurfaceNV(surface);
glDeleteTextures(1, &texture);
glDeleteFramebuffers(1, &fb);
}
bool cOglOutputFb::Init(void) {
initiated = true;
initiated = true;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
glGenFramebuffers(1, &fb);
glBindFramebuffer(GL_FRAMEBUFFER, fb);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
@@ -533,26 +649,23 @@ bool cOglOutputFb::Init(void) {
esyslog("[softhddev]ERROR::cOglOutputFb: Framebuffer is not complete!");
return false;
}
return true;
}
void cOglOutputFb::BindWrite(void) {
// glVDPAUMapSurfacesNV(1, &surface);
if (!initiated)
if (!initiated)
Init();
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
}
void cOglOutputFb::Unbind(void) {
// glVDPAUUnmapSurfacesNV(1, &surface);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}
/****************************************************************************************
* cOglVb
****************************************************************************************/
static cOglVb *VertexBuffers[vbCount];
static cOglVb *VertexBuffers[vbCount];
cOglVb::cOglVb(int type) {
this->type = (eVertexBufferType)type;
@@ -570,35 +683,35 @@ cOglVb::~cOglVb(void) {
bool cOglVb::Init(void) {
if (type == vbTexture) {
//Texture VBO definition
// Texture VBO definition
sizeVertex1 = 2;
sizeVertex2 = 2;
numVertices = 6;
drawMode = GL_TRIANGLES;
shader = stTexture;
} else if (type == vbRect) {
//Rectangle VBO definition
// Rectangle VBO definition
sizeVertex1 = 2;
sizeVertex2 = 0;
numVertices = 4;
drawMode = GL_TRIANGLE_FAN;
shader = stRect;
} else if (type == vbEllipse) {
//Ellipse VBO definition
// Ellipse VBO definition
sizeVertex1 = 2;
sizeVertex2 = 0;
numVertices = 182;
drawMode = GL_TRIANGLE_FAN;
shader = stRect;
} else if (type == vbSlope) {
//Slope VBO definition
// Slope VBO definition
sizeVertex1 = 2;
sizeVertex2 = 0;
numVertices = 102;
drawMode = GL_TRIANGLE_FAN;
shader = stRect;
} else if (type == vbText) {
//Text VBO definition
// Text VBO definition
sizeVertex1 = 2;
sizeVertex2 = 2;
numVertices = 6;
@@ -616,9 +729,9 @@ bool cOglVb::Init(void) {
glVertexAttribPointer(0, sizeVertex1, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)0);
if (sizeVertex2 > 0) {
glEnableVertexAttribArray(1);
glVertexAttribPointer(1, sizeVertex2, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)(sizeVertex1 * sizeof(GLfloat)));
glVertexAttribPointer(1, sizeVertex2, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)(sizeVertex1 * sizeof(GLfloat)));
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
@@ -673,7 +786,7 @@ void cOglVb::DrawArrays(int count) {
if (count == 0)
count = numVertices;
glDrawArrays(drawMode, 0, count);
glFlush();
glFlush();
}
@@ -709,7 +822,8 @@ cOglCmdDeleteFb::cOglCmdDeleteFb(cOglFb *fb) : cOglCmd(fb) {
}
bool cOglCmdDeleteFb::Execute(void) {
delete fb;
if (fb)
delete fb;
return true;
}
@@ -758,7 +872,7 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
buffer->Bind();
if (!fb->BindTexture())
return false;
VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
VertexBuffers[vbTexture]->DrawArrays();
VertexBuffers[vbTexture]->Unbind();
@@ -774,35 +888,28 @@ cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputF
this->y = y;
}
#ifdef PLACEBO
//extern "C" {
extern unsigned char *posd;
//}
#endif
extern unsigned char *posd;
bool cOglCmdCopyBufferToOutputFb::Execute(void) {
int i;
int i;
pthread_mutex_lock(&OSDMutex);
fb->BindRead();
oFb->BindWrite();
glClear(GL_COLOR_BUFFER_BIT);
// glClear(GL_COLOR_BUFFER_BIT);
#ifdef PLACEBO
// if (posd)
// free(posd);
// posd = MALLOC(unsigned char, (y+fb->Height()) * (x+fb->Width()) * 4);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if (posd)
glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_BGRA,GL_UNSIGNED_BYTE,posd);
#else
fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
//#ifdef PLACEBO
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if (posd)
glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_RGBA,GL_UNSIGNED_BYTE,posd);
//#else
#if 0
fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
glFlush();
#endif
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
oFb->Unbind();
pthread_mutex_unlock(&OSDMutex);
ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height());
oFb->Unbind();
pthread_mutex_unlock(&OSDMutex);
return true;
}
@@ -816,7 +923,7 @@ bool cOglCmdFill::Execute(void) {
glm::vec4 col;
ConvertColor(color, col);
fb->Bind();
glClearColor(col.r, col.g, col.b, col.a);
glClearColor(col.r, col.g, col.b, col.a);
glClear(GL_COLOR_BUFFER_BIT);
fb->Unbind();
return true;
@@ -847,7 +954,7 @@ bool cOglCmdDrawRectangle::Execute(void) {
VertexBuffers[vbRect]->ActivateShader();
VertexBuffers[vbRect]->SetShaderColor(color);
VertexBuffers[vbRect]->SetShaderProjectionMatrix(fb->Width(), fb->Height());
fb->Bind();
VertexBuffers[vbRect]->DisableBlending();
VertexBuffers[vbRect]->Bind();
@@ -897,7 +1004,7 @@ bool cOglCmdDrawEllipse::Execute(void) {
VertexBuffers[vbEllipse]->SetShaderColor(color);
VertexBuffers[vbEllipse]->SetShaderProjectionMatrix(fb->Width(), fb->Height());
//not antialiased
// not antialiased
fb->Bind();
VertexBuffers[vbEllipse]->DisableBlending();
VertexBuffers[vbEllipse]->Bind();
@@ -981,7 +1088,7 @@ GLfloat *cOglCmdDrawEllipse::CreateVerticesQuadrant(int &numVertices) {
vertices[0] = x + width;
vertices[1] = y + height;
startAngle = 270;
break;
break;
default:
break;
}
@@ -999,7 +1106,7 @@ GLfloat *cOglCmdDrawEllipse::CreateVerticesHalf(int &numVertices) {
GLfloat radiusY = 0.0f;
GLint transX = 0;
GLint transY = 0;
GLint startAngle = 0;
GLint startAngle = 0;
GLfloat *vertices = new GLfloat[size];
switch (quadrants) {
case 5:
@@ -1115,7 +1222,7 @@ bool cOglCmdDrawSlope::Execute(void) {
VertexBuffers[vbSlope]->SetShaderColor(color);
VertexBuffers[vbSlope]->SetShaderProjectionMatrix(fb->Width(), fb->Height());
//not antialiased
// not antialiased
fb->Bind();
VertexBuffers[vbSlope]->DisableBlending();
VertexBuffers[vbSlope]->Bind();
@@ -1130,7 +1237,7 @@ bool cOglCmdDrawSlope::Execute(void) {
}
//------------------ cOglCmdDrawText --------------------
cOglCmdDrawText::cOglCmdDrawText( cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX,
cOglCmdDrawText::cOglCmdDrawText( cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX,
const char *name, int fontSize, tColor colorText) : cOglCmd(fb), fontName(name) {
this->x = x;
this->y = y;
@@ -1188,9 +1295,9 @@ bool cOglCmdDrawText::Execute(void) {
x1, y2, 0.0, 1.0, // left bottom
x2, y1, 1.0, 0.0, // right top
x2, y2, 1.0, 1.0 // right bottom
x2, y2, 1.0, 1.0 // right bottom
};
g->BindTexture();
VertexBuffers[vbText]->SetVertexData(vertices);
VertexBuffers[vbText]->DrawArrays();
@@ -1225,6 +1332,7 @@ cOglCmdDrawImage::~cOglCmdDrawImage(void) {
bool cOglCmdDrawImage::Execute(void) {
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(
@@ -1244,6 +1352,7 @@ bool cOglCmdDrawImage::Execute(void) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
GLfloat x1 = x; //left
GLfloat y1 = y; //top
GLfloat x2 = x + width; //right
@@ -1256,7 +1365,7 @@ bool cOglCmdDrawImage::Execute(void) {
x1, y2, 0.0, 1.0, // left bottom
x2, y1, 1.0, 0.0, // right top
x2, y2, 1.0, 1.0 // right bottom
x2, y2, 1.0, 1.0 // right bottom
};
VertexBuffers[vbTexture]->ActivateShader();
@@ -1324,7 +1433,7 @@ bool cOglCmdDrawTexture::Execute(void) {
//------------------ cOglCmdStoreImage --------------------
cOglCmdStoreImage::cOglCmdStoreImage(sOglImage *imageRef, tColor *argb) : cOglCmd(NULL) {
this->imageRef = imageRef;
data = argb;
data = argb;
}
cOglCmdStoreImage::~cOglCmdStoreImage(void) {
@@ -1332,6 +1441,7 @@ cOglCmdStoreImage::~cOglCmdStoreImage(void) {
}
bool cOglCmdStoreImage::Execute(void) {
glGenTextures(1, &imageRef->texture);
glBindTexture(GL_TEXTURE_2D, imageRef->texture);
glTexImage2D(
@@ -1350,6 +1460,7 @@ bool cOglCmdStoreImage::Execute(void) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0);
return true;
}
@@ -1378,7 +1489,7 @@ cOglThread::cOglThread(cCondWait *startWait, int maxCacheSize) : cThread("oglThr
maxTextureSize = 0;
for (int i = 0; i < OGL_MAX_OSDIMAGES; i++) {
imageCache[i].used = false;
imageCache[i].texture = GL_NONE;
imageCache[i].texture = GL_NONE;
imageCache[i].width = 0;
imageCache[i].height = 0;
}
@@ -1404,7 +1515,7 @@ void cOglThread::Stop(void) {
void cOglThread::DoCmd(cOglCmd* cmd) {
while (stalled)
cCondWait::SleepMs(10);
bool doSignal = false;
Lock();
if (commands.size() == 0)
@@ -1421,6 +1532,7 @@ void cOglThread::DoCmd(cOglCmd* cmd) {
}
int cOglThread::StoreImage(const cImage &image) {
if (image.Width() > maxTextureSize || image.Height() > maxTextureSize) {
esyslog("[softhddev] cannot store image of %dpx x %dpx "
"(maximum size is %dpx x %dpx) - falling back to "
@@ -1438,14 +1550,14 @@ int cOglThread::StoreImage(const cImage &image) {
esyslog("[softhddev]Maximum size for GPU cache reached. Used: %.2fMB Max: %.2fMB", cachedMB, maxMB);
return 0;
}
int slot = GetFreeSlot();
if (!slot)
return 0;
tColor *argb = MALLOC(tColor, imgSize);
if (!argb) {
esyslog("[softhddev]memory allocation of %d kb for OSD image failed", imgSize * sizeof(tColor) / 1024);
esyslog("[softhddev]memory allocation of %ld kb for OSD image failed", (imgSize * sizeof(tColor)) / 1024);
ClearSlot(slot);
slot = 0;
return 0;
@@ -1489,7 +1601,7 @@ void cOglThread::ClearSlot(int slot) {
int i = -slot - 1;
if (i >= 0 && i < OGL_MAX_OSDIMAGES) {
Lock();
imageCache[i].used = false;
imageCache[i].used = false;
imageCache[i].texture = GL_NONE;
imageCache[i].width = 0;
imageCache[i].height = 0;
@@ -1525,7 +1637,7 @@ void cOglThread::Action(void) {
return;
}
dsyslog("[softhddev]OpenGL Context initialized");
if (!InitShaders()) {
esyslog("[softhddev]Could not initiate Shaders");
Cleanup();
@@ -1533,7 +1645,7 @@ void cOglThread::Action(void) {
return;
}
dsyslog("[softhddev]Shaders initialized");
if (!InitVdpauInterop()) {
esyslog("[softhddev]: vdpau interop NOT initialized");
Cleanup();
@@ -1556,7 +1668,7 @@ void cOglThread::Action(void) {
//now Thread is ready to do his job
startWait->Signal();
stalled = false;
while(Running()) {
if (commands.empty()) {
@@ -1568,14 +1680,14 @@ void cOglThread::Action(void) {
cOglCmd* cmd = commands.front();
commands.pop();
Unlock();
//uint64_t start = cTimeMs::Now();
// uint64_t start = cTimeMs::Now();
cmd->Execute();
//esyslog("[softhddev]\"%s\", %dms, %d commands left, time %" PRIu64 "", cmd->Description(), (int)(cTimeMs::Now() - start), commands.size(), cTimeMs::Now());
// esyslog("[softhddev]\"%s\", %dms, %d commands left, time %" PRIu64 "", cmd->Description(), (int)(cTimeMs::Now() - start), commands.size(), cTimeMs::Now());
delete cmd;
if (stalled && commands.size() < OGL_CMDQUEUE_SIZE / 2)
stalled = false;
}
dsyslog("[softhddev]Cleaning up OpenGL stuff");
Cleanup();
dsyslog("[softhddev]OpenGL Worker Thread Ended");
@@ -1587,9 +1699,7 @@ extern "C" int GlxInitopengl();
bool cOglThread::InitOpenGL(void) {
#ifdef PLACEBO
const char *displayName = X11DisplayName;
if (!displayName) {
displayName = getenv("DISPLAY");
@@ -1605,6 +1715,7 @@ bool cOglThread::InitOpenGL(void) {
buffer[0] = strdup("openglosd");
buffer[1] = strdup("-display");
buffer[2] = strdup(displayName);
char **argv = buffer;
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGBA | GLUT_ALPHA);
@@ -1621,11 +1732,7 @@ bool cOglThread::InitOpenGL(void) {
esyslog("[softhddev]glewInit failed, aborting\n");
return false;
}
#else
if (!GlxInitopengl())
return false;
#endif
VertexBuffers[vbText]->EnableBlending();
glDisable(GL_DEPTH_TEST);
return true;
@@ -1653,7 +1760,7 @@ bool cOglThread::InitVdpauInterop(void) {
void *procAdress = GetVDPAUProcAdress();
while (glGetError() != GL_NO_ERROR);
glVDPAUInitNV(vdpDevice, procAdress);
if (glGetError() != GL_NO_ERROR)
if (glGetError() != GL_NO_ERROR)
return false;
#endif
return true;
@@ -1676,21 +1783,20 @@ void cOglThread::DeleteVertexBuffers(void) {
}
void cOglThread::Cleanup(void) {
esyslog("[softhddev]OglThread cleanup\n");
pthread_mutex_lock(&OSDMutex);
OsdClose();
esyslog("[softhddev]OglThread cleanup\n");
pthread_mutex_lock(&OSDMutex);
OsdClose();
DeleteVertexBuffers();
delete cOglOsd::oFb;
cOglOsd::oFb = NULL;
DeleteShaders();
// glVDPAUFiniNV();
// glVDPAUFiniNV();
cOglFont::Cleanup();
#ifdef PLACEBO
glutExit();
#endif
pthread_mutex_unlock(&OSDMutex);
pthread_mutex_unlock(&OSDMutex);
}
/****************************************************************************************
@@ -1702,7 +1808,7 @@ cOglPixmap::cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const c
int width = DrawPort.IsEmpty() ? ViewPort.Width() : DrawPort.Width();
int height = DrawPort.IsEmpty() ? ViewPort.Height() : DrawPort.Height();
fb = new cOglFb(width, height, ViewPort.Width(), ViewPort.Height());
dirty = true;
dirty = true;
}
cOglPixmap::~cOglPixmap(void) {
@@ -1775,7 +1881,7 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y()));
}
/*
Fallback to VDR implementation, needs to separate cSoftOsdProvider from softhddevice.cpp
Fallback to VDR implementation, needs to separate cSoftOsdProvider from softhddevice.cpp
else {
if (cSoftOsdProvider::GetImageData(ImageHandle))
DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle));
@@ -1786,7 +1892,11 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
}
void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) {
esyslog("[softhddev] DrawPixel %d %d color %x not implemented in OpenGl OSD", Point.X(), Point.X(), Color);
cRect r(Point.X(), Point.Y(), 1, 1);
oglThread->DoCmd(new cOglCmdDrawRectangle(fb, r.X(), r.Y(), r.Width(), r.Height(), Color));
SetDirty();
MarkDrawPortDirty(r);
}
void cOglPixmap::DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg, tColor ColorBg, bool Overlay) {
@@ -1833,7 +1943,7 @@ void cOglPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tC
int cw = Width ? Width : w;
int ch = Height ? Height : h;
cRect r(x, y, cw, ch);
if (ColorBg != clrTransparent)
oglThread->DoCmd(new cOglCmdDrawRectangle(fb, r.X(), r.Y(), r.Width(), r.Height(), ColorBg));
@@ -1927,32 +2037,35 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
int osdWidth = 0;
int osdHeight = 0;
pthread_mutex_lock(&OSDMutex);
VideoGetOsdSize(&osdWidth, &osdHeight);
// osdWidth = 1920;
// osdHeight = 1080;
// osdWidth = 1920;
// osdHeight = 1080;
dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight);
#ifdef PLACEBO
if (posd)
free(posd);
posd = MALLOC(unsigned char, osdWidth * osdHeight * 4);
#endif
//create output framebuffer
if (posd)
free(posd);
posd = MALLOC(unsigned char, osdWidth * osdHeight * 4);
// create output framebuffer
if (!oFb) {
oFb = new cOglOutputFb(osdWidth, osdHeight);
oglThread->DoCmd(new cOglCmdInitOutputFb(oFb));
}
pthread_mutex_unlock(&OSDMutex);
}
cOglOsd::~cOglOsd() {
OsdClose();
SetActive(false);
#ifdef PLACEBO
if (posd)
free(posd);
posd = 0;
#endif
if (posd)
free(posd);
posd = 0;
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
}
@@ -1965,9 +2078,9 @@ eOsdError cOglOsd::SetAreas(const tArea *Areas, int NumAreas) {
tArea area = { r.Left(), r.Top(), r.Right(), r.Bottom(), 32 };
//now we know the actuaL osd size, create double buffer frame buffer
// now we know the actuaL osd size, create double buffer frame buffer
if (bFb) {
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
oglThread->DoCmd(new cOglCmdDeleteFb(bFb));
DestroyPixmap(oglPixmaps[0]);
}
bFb = new cOglFb(r.Width(), r.Height(), r.Width(), r.Height());
@@ -1986,7 +2099,7 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
int height = DrawPort.IsEmpty() ? ViewPort.Height() : DrawPort.Height();
if (width > oglThread->MaxTextureSize() || height > oglThread->MaxTextureSize()) {
esyslog("[softhddev] cannot allocate pixmap of %dpx x %dpx, clipped to %dpx x %dpx!",
esyslog("[softhddev] cannot allocate pixmap of %dpx x %dpx, clipped to %dpx x %dpx!",
width, height, std::min(width, oglThread->MaxTextureSize()), std::min(height, oglThread->MaxTextureSize()));
width = std::min(width, oglThread->MaxTextureSize());
height = std::min(height, oglThread->MaxTextureSize());
@@ -1995,11 +2108,11 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
cOglPixmap *p = new cOglPixmap(oglThread, Layer, ViewPort, DrawPort);
if (cOsd::AddPixmap(p)) {
//find free slot
// find free slot
for (int i = 0; i < oglPixmaps.Size(); i++)
if (!oglPixmaps[i])
return oglPixmaps[i] = p;
//append at end
// append at end
oglPixmaps.Append(p);
return p;
}
@@ -2031,28 +2144,28 @@ void cOglOsd::Flush(void) {
if (!oglThread->Active())
return;
LOCK_PIXMAPS;
//check if any pixmap is dirty
// check if any pixmap is dirty
bool dirty = false;
for (int i = 0; i < oglPixmaps.Size() && !dirty; i++)
if (oglPixmaps[i] && oglPixmaps[i]->Layer() >= 0 && oglPixmaps[i]->IsDirty())
dirty = true;
if (!dirty)
return;
//clear buffer
//uint64_t start = cTimeMs::Now();
//dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
// clear buffer
// uint64_t start = cTimeMs::Now();
// dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent));
//render pixmap textures blended to buffer
// render pixmap textures blended to buffer
for (int layer = 0; layer < MAXPIXMAPLAYERS; layer++) {
for (int i = 0; i < oglPixmaps.Size(); i++) {
if (oglPixmaps[i]) {
if (oglPixmaps[i]->Layer() == layer) {
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(),
bFb,
oglPixmaps[i]->ViewPort().X(),
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(),
bFb,
oglPixmaps[i]->ViewPort().X(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0,
oglPixmaps[i]->Alpha(),
oglPixmaps[i]->DrawPort().X(),
@@ -2064,7 +2177,7 @@ void cOglOsd::Flush(void) {
}
oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top()));
//dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
// dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
}
void cOglOsd::DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias) {

View File

@@ -17,25 +17,21 @@
#include FT_STROKER_H
#undef __FTERRORS_H__
#define FT_ERRORDEF( e, v, s ) { e, s },
#define FT_ERROR_START_LIST {
#define FT_ERROR_END_LIST { 0, 0 } };
const struct {
int code;
const char* message;
#define FT_ERRORDEF( e, v, s ) { e, s },
#define FT_ERROR_START_LIST {
#define FT_ERROR_END_LIST { 0, 0 } };
const struct
{
int code;
const char *message;
} FT_Errors[] =
#include FT_ERRORS_H
#include <memory>
#include <queue>
#include <vdr/plugin.h>
#include <vdr/osd.h>
#include <vdr/thread.h>
#include "softhddev.h"
extern "C"
{
#include <stdint.h>
@@ -49,7 +45,8 @@ extern "C"
extern "C" pthread_mutex_t OSDMutex;
struct sOglImage {
struct sOglImage
{
GLuint texture;
GLint width;
GLint height;
@@ -60,69 +57,97 @@ struct sOglImage {
* Helpers
****************************************************************************************/
void ConvertColor(const GLint &colARGB, glm::vec4 &col);
void ConvertColor(const GLint & colARGB, glm::vec4 & col);
/****************************************************************************************
* cShader
****************************************************************************************/
enum eShaderType {
enum eShaderType
{
stRect,
stTexture,
stText,
stCount
};
class cShader {
private:
class cShader
{
private:
eShaderType type;
GLuint id;
bool Compile(const char *vertexCode, const char *fragmentCode);
bool CheckCompileErrors(GLuint object, bool program = false);
public:
cShader(void) {};
virtual ~cShader(void) {};
public:
cShader(void)
{
};
virtual ~ cShader(void)
{
};
bool Load(eShaderType type);
void Use(void);
void SetFloat (const GLchar *name, GLfloat value);
void SetInteger (const GLchar *name, GLint value);
void SetVector2f (const GLchar *name, GLfloat x, GLfloat y);
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 SetMatrix4 (const GLchar *name, const glm::mat4 &matrix);
void SetFloat(const GLchar * name, GLfloat value);
void SetInteger(const GLchar * name, GLint value);
void SetVector2f(const GLchar * name, GLfloat x, GLfloat y);
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 SetMatrix4(const GLchar * name, const glm::mat4 & matrix);
};
/****************************************************************************************
* cOglGlyph
****************************************************************************************/
class cOglGlyph : public cListObject {
private:
struct tKerning {
public:
tKerning(uint prevSym, GLfloat kerning = 0.0f) {
this->prevSym = prevSym;
this->kerning = kerning;
}
uint prevSym;
GLfloat kerning;
class cOglGlyph:public cListObject
{
private:
struct tKerning
{
public:
tKerning(uint prevSym, GLfloat kerning = 0.0f) {
this->prevSym = prevSym;
this->kerning = kerning;
}
uint prevSym;
GLfloat kerning;
};
uint charCode;
int bearingLeft;
int bearingTop;
int width;
int height;
int advanceX;
cVector<tKerning> kerningCache;
int advanceX;
cVector < tKerning > kerningCache;
GLuint texture;
void LoadTexture(FT_BitmapGlyph ftGlyph);
public:
public:
cOglGlyph(uint charCode, FT_BitmapGlyph ftGlyph);
virtual ~cOglGlyph();
uint CharCode(void) { return charCode; }
int AdvanceX(void) { 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; }
virtual ~ cOglGlyph();
uint CharCode(void)
{
return charCode;
}
int AdvanceX(void)
{
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(uint prevSym);
void SetKerningCache(uint prevSym, int kerning);
void BindTexture(void);
@@ -131,8 +156,9 @@ public:
/****************************************************************************************
* cOglFont
****************************************************************************************/
class cOglFont : public cListObject {
private:
class cOglFont:public cListObject
{
private:
static bool initiated;
cString name;
int size;
@@ -140,41 +166,57 @@ private:
int bottom;
static FT_Library ftLib;
FT_Face face;
static cList<cOglFont> *fonts;
mutable cList<cOglGlyph> glyphCache;
cOglFont(const char *fontName, int charHeight);
static cList < cOglFont > *fonts;
mutable cList < cOglGlyph > glyphCache;
cOglFont(const char *fontName, int charHeight);
static void Init(void);
public:
virtual ~cOglFont(void);
public:
virtual ~ cOglFont(void);
static cOglFont *Get(const char *name, int charHeight);
static void Cleanup(void);
const char *Name(void) { return *name; };
int Size(void) { return size; };
int Bottom(void) {return bottom; };
int Height(void) {return height; };
cOglGlyph* Glyph(uint charCode) const;
int Kerning(cOglGlyph *glyph, uint prevSym) const;
const char *Name(void)
{
return *name;
};
int Size(void)
{
return size;
};
int Bottom(void)
{
return bottom;
};
int Height(void)
{
return height;
};
cOglGlyph *Glyph(uint charCode) const;
int Kerning(cOglGlyph * glyph, uint prevSym) const;
};
/****************************************************************************************
* cOglFb
* Framebuffer Object - OpenGL part of a Pixmap
****************************************************************************************/
class cOglFb {
protected:
class cOglFb
{
protected:
bool initiated;
// GLuint fb;
// GLuint texture;
// GLuint fb;
// GLuint texture;
GLint width, height;
GLint viewPortWidth, viewPortHeight;
bool scrollable;
public:
GLuint fb;
GLuint texture;
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
virtual ~cOglFb(void);
bool Initiated(void) { return initiated; }
public:
GLuint fb;
GLuint texture;
cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHeight);
virtual ~ cOglFb(void);
bool Initiated(void)
{
return initiated;
}
virtual bool Init(void);
void Bind(void);
void BindRead(void);
@@ -182,27 +224,43 @@ public:
virtual void Unbind(void);
bool BindTexture(void);
void Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2);
GLint Width(void) { return width; };
GLint Height(void) { return height; };
bool Scrollable(void) { return scrollable; };
GLint ViewportWidth(void) { return viewPortWidth; };
GLint ViewportHeight(void) { return viewPortHeight; };
GLint Width(void)
{
return width;
};
GLint Height(void)
{
return height;
};
bool Scrollable(void)
{
return scrollable;
};
GLint ViewportWidth(void)
{
return viewPortWidth;
};
GLint ViewportHeight(void)
{
return viewPortHeight;
};
};
/****************************************************************************************
* cOglOutputFb
* Output Framebuffer Object - holds Vdpau Output Surface which is our "output framebuffer"
****************************************************************************************/
class cOglOutputFb : public cOglFb {
protected:
class cOglOutputFb:public cOglFb
{
protected:
bool initiated;
private:
GLvdpauSurfaceNV surface;
public:
GLuint fb;
GLuint texture;
cOglOutputFb(GLint width, GLint height);
virtual ~cOglOutputFb(void);
private:
GLvdpauSurfaceNV surface;
public:
GLuint fb;
GLuint texture;
cOglOutputFb(GLint width, GLint height);
virtual ~ cOglOutputFb(void);
virtual bool Init(void);
virtual void BindWrite(void);
virtual void Unbind(void);
@@ -210,9 +268,10 @@ public:
/****************************************************************************************
* 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,
@@ -221,8 +280,9 @@ enum eVertexBufferType {
vbCount
};
class cOglVb {
private:
class cOglVb
{
private:
eVertexBufferType type;
eShaderType shader;
GLuint vao;
@@ -231,9 +291,9 @@ private:
int sizeVertex2;
int numVertices;
GLuint drawMode;
public:
cOglVb(int type);
virtual ~cOglVb(void);
public:
cOglVb(int type);
virtual ~ cOglVb(void);
bool Init(void);
void Bind(void);
void Unbind(void);
@@ -243,184 +303,271 @@ public:
void SetShaderColor(GLint color);
void SetShaderAlpha(GLint alpha);
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);
};
/****************************************************************************************
* cOpenGLCmd
****************************************************************************************/
class cOglCmd {
protected:
cOglFb *fb;
public:
cOglCmd(cOglFb *fb) { this->fb = fb; };
virtual ~cOglCmd(void) {};
virtual const char* Description(void) = 0;
class cOglCmd
{
protected:
cOglFb * fb;
public:
cOglCmd(cOglFb * fb)
{
this->fb = fb;
};
virtual ~ cOglCmd(void)
{
};
virtual const char *Description(void) = 0;
virtual bool Execute(void) = 0;
};
class cOglCmdInitOutputFb : public cOglCmd {
private:
cOglOutputFb *oFb;
public:
cOglCmdInitOutputFb(cOglOutputFb *oFb);
virtual ~cOglCmdInitOutputFb(void) {};
virtual const char* Description(void) { return "InitOutputFramebuffer"; }
class cOglCmdInitOutputFb:public cOglCmd
{
private:
cOglOutputFb * oFb;
public:
cOglCmdInitOutputFb(cOglOutputFb * oFb);
virtual ~ cOglCmdInitOutputFb(void)
{
};
virtual const char *Description(void)
{
return "InitOutputFramebuffer";
}
virtual bool Execute(void);
};
class cOglCmdInitFb : public cOglCmd {
private:
cCondWait *wait;
public:
cOglCmdInitFb(cOglFb *fb, cCondWait *wait = NULL);
virtual ~cOglCmdInitFb(void) {};
virtual const char* Description(void) { return "InitFramebuffer"; }
class cOglCmdInitFb:public cOglCmd
{
private:
cCondWait * wait;
public:
cOglCmdInitFb(cOglFb * fb, cCondWait * wait = NULL);
virtual ~ cOglCmdInitFb(void)
{
};
virtual const char *Description(void)
{
return "InitFramebuffer";
}
virtual bool Execute(void);
};
class cOglCmdDeleteFb : public cOglCmd {
public:
cOglCmdDeleteFb(cOglFb *fb);
virtual ~cOglCmdDeleteFb(void) {};
virtual const char* Description(void) { return "DeleteFramebuffer"; }
class cOglCmdDeleteFb:public cOglCmd
{
public:
cOglCmdDeleteFb(cOglFb * fb);
virtual ~ cOglCmdDeleteFb(void)
{
};
virtual const char *Description(void)
{
return "DeleteFramebuffer";
}
virtual bool Execute(void);
};
class cOglCmdRenderFbToBufferFb : public cOglCmd {
private:
cOglFb *buffer;
class cOglCmdRenderFbToBufferFb:public cOglCmd
{
private:
cOglFb * buffer;
GLfloat x, y;
GLfloat drawPortX, drawPortY;
GLint transparency;
public:
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, GLint drawPortY);
virtual ~cOglCmdRenderFbToBufferFb(void) {};
virtual const char* Description(void) { return "Render Framebuffer to Buffer"; }
public:
cOglCmdRenderFbToBufferFb(cOglFb * fb, cOglFb * buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
GLint drawPortY);
virtual ~ cOglCmdRenderFbToBufferFb(void)
{
};
virtual const char *Description(void)
{
return "Render Framebuffer to Buffer";
}
virtual bool Execute(void);
};
class cOglCmdCopyBufferToOutputFb : public cOglCmd {
private:
cOglOutputFb *oFb;
class cOglCmdCopyBufferToOutputFb:public cOglCmd
{
private:
cOglOutputFb * oFb;
GLint x, y;
public:
cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y);
virtual ~cOglCmdCopyBufferToOutputFb(void) {};
virtual const char* Description(void) { return "Copy buffer to OutputFramebuffer"; }
public:
cOglCmdCopyBufferToOutputFb(cOglFb * fb, cOglOutputFb * oFb, GLint x, GLint y);
virtual ~ cOglCmdCopyBufferToOutputFb(void)
{
};
virtual const char *Description(void)
{
return "Copy buffer to OutputFramebuffer";
}
virtual bool Execute(void);
};
class cOglCmdFill : public cOglCmd {
private:
class cOglCmdFill:public cOglCmd
{
private:
GLint color;
public:
cOglCmdFill(cOglFb *fb, GLint color);
virtual ~cOglCmdFill(void) {};
virtual const char* Description(void) { return "Fill"; }
public:
cOglCmdFill(cOglFb * fb, GLint color);
virtual ~ cOglCmdFill(void)
{
};
virtual const char *Description(void)
{
return "Fill";
}
virtual bool Execute(void);
};
class cOglCmdDrawRectangle : public cOglCmd {
private:
class cOglCmdDrawRectangle:public cOglCmd
{
private:
GLint x, y;
GLint width, height;
GLint color;
public:
cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color);
virtual ~cOglCmdDrawRectangle(void) {};
virtual const char* Description(void) { return "DrawRectangle"; }
public:
cOglCmdDrawRectangle(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color);
virtual ~ cOglCmdDrawRectangle(void)
{
};
virtual const char *Description(void)
{
return "DrawRectangle";
}
virtual bool Execute(void);
};
class cOglCmdDrawEllipse : public cOglCmd {
private:
class cOglCmdDrawEllipse:public cOglCmd
{
private:
GLint x, y;
GLint width, height;
GLint color;
GLint quadrants;
GLfloat *CreateVerticesFull(int &numVertices);
GLfloat *CreateVerticesQuadrant(int &numVertices);
GLfloat *CreateVerticesHalf(int &numVertices);
public:
cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
virtual ~cOglCmdDrawEllipse(void) {};
virtual const char* Description(void) { return "DrawEllipse"; }
GLfloat *CreateVerticesHalf(int &numVertices);
public:
cOglCmdDrawEllipse(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint quadrants);
virtual ~ cOglCmdDrawEllipse(void)
{
};
virtual const char *Description(void)
{
return "DrawEllipse";
}
virtual bool Execute(void);
};
class cOglCmdDrawSlope : public cOglCmd {
private:
class cOglCmdDrawSlope:public cOglCmd
{
private:
GLint x, y;
GLint width, height;
GLint color;
GLint type;
public:
cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
virtual ~cOglCmdDrawSlope(void) {};
virtual const char* Description(void) { return "DrawSlope"; }
public:
cOglCmdDrawSlope(cOglFb * fb, GLint x, GLint y, GLint width, GLint height, GLint color, GLint type);
virtual ~ cOglCmdDrawSlope(void)
{
};
virtual const char *Description(void)
{
return "DrawSlope";
}
virtual bool Execute(void);
};
class cOglCmdDrawText : public cOglCmd {
private:
class cOglCmdDrawText:public cOglCmd
{
private:
GLint x, y;
GLint limitX;
GLint colorText;
cString fontName;
int fontSize;
unsigned int *symbols;
public:
cOglCmdDrawText(cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText);
virtual ~cOglCmdDrawText(void);
virtual const char* Description(void) { return "DrawText"; }
public:
cOglCmdDrawText(cOglFb * fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name,
int fontSize, tColor colorText);
virtual ~ cOglCmdDrawText(void);
virtual const char *Description(void)
{
return "DrawText";
}
virtual bool Execute(void);
};
class cOglCmdDrawImage : public cOglCmd {
private:
tColor *argb;
class cOglCmdDrawImage:public cOglCmd
{
private:
tColor * argb;
GLint x, y, width, height;
bool overlay;
GLfloat scaleX, scaleY;
public:
cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint height, GLint x, GLint y, bool overlay = true, double scaleX = 1.0f, double scaleY = 1.0f);
virtual ~cOglCmdDrawImage(void);
virtual const char* Description(void) { return "Draw Image"; }
public:
cOglCmdDrawImage(cOglFb * fb, tColor * argb, GLint width, GLint height, GLint x, GLint y, bool overlay =
true, double scaleX = 1.0f, double scaleY = 1.0f);
virtual ~ cOglCmdDrawImage(void);
virtual const char *Description(void)
{
return "Draw Image";
}
virtual bool Execute(void);
};
class cOglCmdDrawTexture : public cOglCmd {
private:
sOglImage *imageRef;
class cOglCmdDrawTexture:public cOglCmd
{
private:
sOglImage * imageRef;
GLint x, y;
public:
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y);
virtual ~cOglCmdDrawTexture(void) {};
virtual const char* Description(void) { return "Draw Texture"; }
public:
cOglCmdDrawTexture(cOglFb * fb, sOglImage * imageRef, GLint x, GLint y);
virtual ~ cOglCmdDrawTexture(void)
{
};
virtual const char *Description(void)
{
return "Draw Texture";
}
virtual bool Execute(void);
};
class cOglCmdStoreImage : public cOglCmd {
private:
sOglImage *imageRef;
class cOglCmdStoreImage:public cOglCmd
{
private:
sOglImage * imageRef;
tColor *data;
public:
cOglCmdStoreImage(sOglImage *imageRef, tColor *argb);
virtual ~cOglCmdStoreImage(void);
virtual const char* Description(void) { return "Store Image"; }
public:
cOglCmdStoreImage(sOglImage * imageRef, tColor * argb);
virtual ~ cOglCmdStoreImage(void);
virtual const char *Description(void)
{
return "Store Image";
}
virtual bool Execute(void);
};
class cOglCmdDropImage : public cOglCmd {
private:
sOglImage *imageRef;
class cOglCmdDropImage:public cOglCmd
{
private:
sOglImage * imageRef;
cCondWait *wait;
public:
cOglCmdDropImage(sOglImage *imageRef, cCondWait *wait);
virtual ~cOglCmdDropImage(void) {};
virtual const char* Description(void) { return "Drop Image"; }
public:
cOglCmdDropImage(sOglImage * imageRef, cCondWait * wait);
virtual ~ cOglCmdDropImage(void)
{
};
virtual const char *Description(void)
{
return "Drop Image";
}
virtual bool Execute(void);
};
@@ -430,12 +577,13 @@ public:
#define OGL_MAX_OSDIMAGES 256
#define OGL_CMDQUEUE_SIZE 100
class cOglThread : public cThread {
private:
cCondWait *startWait;
class cOglThread:public cThread
{
private:
cCondWait * startWait;
cCondWait *wait;
bool stalled;
std::queue<cOglCmd*> commands;
std::queue < cOglCmd * >commands;
GLint maxTextureSize;
sOglImage imageCache[OGL_MAX_OSDIMAGES];
long memCached;
@@ -449,73 +597,96 @@ private:
void Cleanup(void);
int GetFreeSlot(void);
void ClearSlot(int slot);
protected:
virtual void Action(void);
public:
cOglThread(cCondWait *startWait, int maxCacheSize);
virtual ~cOglThread();
protected:
virtual void Action(void);
public:
cOglThread(cCondWait * startWait, int maxCacheSize);
virtual ~ cOglThread();
void Stop(void);
void DoCmd(cOglCmd* cmd);
int StoreImage(const cImage &image);
void DoCmd(cOglCmd * cmd);
int StoreImage(const cImage & image);
void DropImageData(int imageHandle);
sOglImage *GetImageRef(int slot);
int MaxTextureSize(void) { return maxTextureSize; };
int MaxTextureSize(void)
{
return maxTextureSize;
};
};
/****************************************************************************************
* cOglPixmap
****************************************************************************************/
class cOglPixmap : public cPixmap {
private:
cOglFb *fb;
std::shared_ptr<cOglThread> oglThread;
class cOglPixmap:public cPixmap
{
private:
cOglFb * fb;
std::shared_ptr < cOglThread > oglThread;
bool dirty;
public:
cOglPixmap(std::shared_ptr<cOglThread> oglThread, int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
virtual ~cOglPixmap(void);
cOglFb *Fb(void) { return fb; };
int X(void) { return ViewPort().X(); };
int Y(void) { return ViewPort().Y(); };
virtual bool IsDirty(void) { return dirty; }
virtual void SetDirty(bool dirty = true) { this->dirty = dirty; }
public:
cOglPixmap(std::shared_ptr < cOglThread > oglThread, int Layer, const cRect & ViewPort, const cRect & DrawPort =
cRect::Null);
virtual ~ cOglPixmap(void);
cOglFb *Fb(void)
{
return fb;
};
int X(void)
{
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 SetTile(bool Tile);
virtual void SetViewPort(const cRect &Rect);
virtual void SetDrawPortPoint(const cPoint &Point, bool Dirty = true);
virtual void SetViewPort(const cRect & Rect);
virtual void SetDrawPortPoint(const cPoint & Point, bool Dirty = true);
virtual void Clear(void);
virtual void Fill(tColor Color);
virtual void DrawImage(const cPoint &Point, const cImage &Image);
virtual void DrawImage(const cPoint &Point, int ImageHandle);
virtual void DrawPixel(const cPoint &Point, tColor Color);
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false);
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);
virtual void DrawRectangle(const cRect &Rect, tColor Color);
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0);
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type);
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 Scroll(const cPoint &Dest, const cRect &Source = cRect::Null);
virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null);
virtual void DrawImage(const cPoint & Point, const cImage & Image);
virtual void DrawImage(const cPoint & Point, int ImageHandle);
virtual void DrawPixel(const cPoint & Point, tColor Color);
virtual void DrawBitmap(const cPoint & Point, const cBitmap & Bitmap, tColor ColorFg = 0, tColor ColorBg =
0, bool Overlay = false);
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);
virtual void DrawRectangle(const cRect & Rect, tColor Color);
virtual void DrawEllipse(const cRect & Rect, tColor Color, int Quadrants = 0);
virtual void DrawSlope(const cRect & Rect, tColor Color, int Type);
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 Scroll(const cPoint & Dest, const cRect & Source = cRect::Null);
virtual void Pan(const cPoint & Dest, const cRect & Source = cRect::Null);
};
/******************************************************************************
* cOglOsd
******************************************************************************/
class cOglOsd : public cOsd {
private:
cOglFb *bFb;
std::shared_ptr<cOglThread> oglThread;
cVector<cOglPixmap *> oglPixmaps;
class cOglOsd:public cOsd
{
private:
cOglFb * bFb;
std::shared_ptr < cOglThread > oglThread;
cVector < cOglPixmap * >oglPixmaps;
bool isSubtitleOsd;
protected:
public:
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
virtual ~cOglOsd();
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
virtual void DestroyPixmap(cPixmap *Pixmap);
protected:
public:
cOglOsd(int Left, int Top, uint Level, std::shared_ptr < cOglThread > oglThread);
virtual ~ cOglOsd();
virtual eOsdError SetAreas(const tArea * Areas, int NumAreas);
virtual cPixmap *CreatePixmap(int Layer, const cRect & ViewPort, const cRect & DrawPort = cRect::Null);
virtual void DestroyPixmap(cPixmap * Pixmap);
virtual void Flush(void);
virtual void DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias = false);
virtual void DrawScaledBitmap(int x, int y, const cBitmap & Bitmap, double FactorX, double FactorY,
bool AntiAlias = false);
static cOglOutputFb *oFb;
};

View File

@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: VDR \n"
"Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2018-08-18 15:05+0200\n"
"POT-Creation-Date: 2019-10-26 18:41+0200\n"
"PO-Revision-Date: blabla\n"
"Last-Translator: blabla\n"
"Language-Team: blabla\n"
@@ -251,23 +251,31 @@ msgstr ""
msgid "audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"
msgstr ""
msgid "codec: buggy libav, use ffmpeg\n"
msgstr ""
msgid "codec: can't allocate vodeo decoder\n"
msgstr ""
msgid "codec: missing close\n"
msgstr ""
#, c-format
msgid "codec: codec ID %#06x not found\n"
msgid " No decoder found"
msgstr ""
msgid "codec: can't allocate video codec context\n"
msgstr ""
msgid "codec: can't set options to video codec!\n"
msgid "VAAPI Refcounts invalid\n"
msgstr ""
msgid "codec: can't set option deint to video codec!\n"
msgstr ""
msgid "codec: can't set option surfces to video codec!\n"
msgstr ""
msgid "codec: can't set option drop 2.field to video codec!\n"
msgstr ""
msgid "codec: can't set option drop 2.field to video codec!\n"
msgstr ""
msgid "codec: can't open video codec!\n"
@@ -276,12 +284,19 @@ msgstr ""
msgid "codec: can't allocate video decoder frame buffer\n"
msgstr ""
msgid "video: Init of YADIF Filter failed\n"
msgstr ""
msgid "codec: can't allocate audio decoder\n"
msgstr ""
msgid "codec: can't allocate audio decoder frame buffer\n"
msgstr ""
#, c-format
msgid "codec: codec ID %#06x not found\n"
msgstr ""
msgid "codec: can't allocate audio codec context\n"
msgstr ""
@@ -315,18 +330,6 @@ msgstr ""
msgid "codec/audio: can't open resample\n"
msgstr ""
msgid "codec/audio: latm\n"
msgstr ""
msgid "codec/audio: bad audio frame\n"
msgstr ""
msgid "codec/audio: error more than one frame data\n"
msgstr ""
msgid "codec/audio: no frame\n"
msgstr ""
msgid "A software and GPU emulated UHD device"
msgstr ""
@@ -360,6 +363,9 @@ msgstr "OSD Breite"
msgid "Osd height"
msgstr "OSD Höhe"
msgid "GPU mem used for image caching (MB)"
msgstr ""
msgid "Suspend"
msgstr "Unterbrechen"
@@ -384,8 +390,8 @@ msgstr "Video Hintergrundfrabe (RGB)"
msgid "Video background color (Alpha)"
msgstr "Video Hintergrundfarbe (Alpha)"
msgid "Use studio levels (vdpau only)"
msgstr "Benutze Studio Levels (nur vdpau)"
msgid "Use studio levels"
msgstr ""
msgid "60hz display mode"
msgstr "60Hz Anzeigemodus"
@@ -399,8 +405,11 @@ msgstr "Schwarz während Kanalwechsel"
msgid "Clear decoder on channel switch"
msgstr "Decoder bei Kanalwechsel leeren"
msgid "Brightness (-1000..1000) (vdpau)"
msgstr "Helligkeit (-1000..1000) (vdpau)"
msgid "Scaler Test"
msgstr ""
msgid "Brightness (-100..100)"
msgstr ""
msgid "min"
msgstr "min"
@@ -408,14 +417,26 @@ msgstr "min"
msgid "max"
msgstr "max"
msgid "Contrast (0..10000) (vdpau)"
msgstr "Kontrast (0..10000) (vdpau)"
msgid "Contrast (0..100)"
msgstr ""
msgid "Saturation (0..10000) (vdpau)"
msgstr "Sättigung (0..10000) (vdpau)"
msgid "Saturation (0..100)"
msgstr ""
msgid "Hue (-3141..3141) (vdpau)"
msgstr "Farbton (-3141..3141) (vdpau)"
msgid "Gamma (0..100)"
msgstr ""
msgid "Hue (-314..314) "
msgstr ""
msgid "Monitor Colorspace"
msgstr ""
msgid "Color Blindness"
msgstr ""
msgid "Color Correction (-100..100) "
msgstr ""
msgid "Scaling"
msgstr "Skalierung"
@@ -474,6 +495,15 @@ msgstr "Audio Driftkorrektur"
msgid "Pass-through default"
msgstr "Pass-Through-Standard"
msgid " PCM pass-through"
msgstr ""
msgid " AC-3 pass-through"
msgstr ""
msgid " E-AC-3 pass-through"
msgstr ""
msgid "Enable (E-)AC-3 (decoder) downmix"
msgstr "Aktiviere (E-)AC-3 (decoder) downmix"
@@ -611,6 +641,10 @@ msgstr "PIP schließen"
msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)"
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
#, c-format
msgid " Frame Process time %2.2fms"
msgstr ""
msgid "pass-through disabled"
msgstr ""
@@ -690,10 +724,6 @@ msgstr ""
msgid "[softhddev] out of memory\n"
msgstr ""
#, c-format
msgid "video: packet buffer too small for %d\n"
msgstr ""
msgid "video: no empty slot in packet ringbuffer\n"
msgstr ""
@@ -714,10 +744,6 @@ msgstr ""
msgid "[softhddev] invalid video packet %d/%d bytes\n"
msgstr ""
#, c-format
msgid "[softhddev] empty video packet %d bytes\n"
msgstr ""
#, c-format
msgid "softhddev: %s called without hw decoder\n"
msgstr ""
@@ -766,15 +792,18 @@ msgstr ""
msgid "[softhddev] ready%s\n"
msgstr ""
msgid "video/glx: can't make glx context current\n"
msgid "video: can't lock thread\n"
msgstr ""
msgid "video: can't unlock thread\n"
msgstr ""
msgid "video/egl: GlxSetupWindow can't make egl/glx context current\n"
msgstr ""
msgid "video/glx: no v-sync\n"
msgstr ""
msgid "glewinit failed\n"
msgstr ""
msgid "video/glx: no GLX support\n"
msgstr ""
@@ -785,15 +814,6 @@ msgstr ""
msgid "did not get FBconfig"
msgstr ""
msgid "video/glx: can't get a RGB visual\n"
msgstr ""
msgid "video/glx: no valid visual found\n"
msgstr ""
msgid "video/glx: need atleast 8-bits per RGB\n"
msgstr ""
msgid "video/glx: can't create glx context\n"
msgstr ""
@@ -815,8 +835,7 @@ msgstr ""
msgid "video/glx: SGI v-sync enabled\n"
msgstr ""
#, c-format
msgid "checkCudaErrors() Driver API error = %04d"
msgid "video/egl: can't create egl context\n"
msgstr ""
msgid "video/cuvid: surface needed not set\n"
@@ -826,69 +845,56 @@ msgstr ""
msgid "video/cuvid: release surface %#08x, which is not in use\n"
msgstr ""
msgid "Wrong ES version \n"
msgstr ""
msgid " Could not bind API!\n"
msgstr ""
msgid "Can't get EGL Extentions\n"
msgstr ""
msgid "Could not initialize EGL.\n"
msgstr ""
msgid "Could not create EGL Context\n"
msgstr ""
msgid "Could not create EGL surface!\n"
msgstr ""
msgid "Could not make context current!\n"
msgstr ""
msgid "video/cuvid: out of decoders\n"
msgstr ""
msgid "video/cuvid: out of memory\n"
msgstr ""
msgid "video/cuvid: need 1 future, 1 current, 1 back and 1 work surface\n"
msgstr ""
msgid "video/cuvid: decoder not in decoder list.\n"
msgstr ""
msgid "video/glx: glx error\n"
msgid "video/egl: egl init error\n"
msgstr ""
#, c-format
msgid "video/cuvid: SDL error %d: %d\n"
msgid "video/cuvid: SDL error %d\n"
msgstr ""
msgid "video/vdpau: no valid vdpau pixfmt found\n"
msgid "Unable to create placebo textures"
msgstr ""
msgid "video/vdpau: no valid profile found\n"
msgid "video: no valid pixfmt found\n"
msgstr ""
msgid "CUVID Init failed\n"
msgid "video: no valid profile found\n"
msgstr ""
msgid "CUVID Not found\n"
msgid "NO Format valid"
msgstr ""
#, c-format
msgid "video/vdpau: can't get output surface parameters: %s\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't render output surface: %s\n"
msgstr ""
msgid "video/vdpau: video surface size mismatch\n"
msgstr ""
msgid "video/vdpau: out of memory\n"
msgstr ""
#, c-format
msgid "video/vdpau: unsupported rgba format %d\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't get video surface bits native: %s\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't get video surface parameters: %s\n"
msgstr ""
#, c-format
msgid "video/vdpau: unsupported chroma type %d\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't get video surface bits: %s\n"
msgid "Failed rendering frame!\n"
msgstr ""
#, c-format
@@ -902,12 +908,7 @@ msgstr ""
msgid "Kein Cuda device gefunden"
msgstr ""
#, c-format
msgid "video/cuvid: can't block queue: %s\n"
msgstr ""
#, c-format
msgid "video/cuvid: missed frame (%d/%d)\n"
msgid "Failed to submit swapchain buffer\n"
msgstr ""
#, c-format
@@ -921,10 +922,25 @@ msgstr ""
msgid "video/event: No symbol for %d\n"
msgstr ""
msgid "video: can't lock thread\n"
msgid "Cant get memory for PLACEBO struct"
msgstr ""
msgid "video: can't unlock thread\n"
msgid "Failed initializing libplacebo\n"
msgstr ""
msgid "Failed to create XCB Surface\n"
msgstr ""
msgid "Failed to create Vulkan Device"
msgstr ""
msgid "Failed creating vulkan swapchain!"
msgstr ""
msgid "Failed initializing libplacebo renderer\n"
msgstr ""
msgid "video/egl: can't create thread egl context\n"
msgstr ""
msgid "video: can't queue cancel video display thread\n"
@@ -944,11 +960,11 @@ msgid "softhddev: grab unsupported\n"
msgstr ""
#, c-format
msgid "video: Can't connect to X11 server on '%s'\n"
msgid "video: Can't initialize X11 thread support on '%s'\n"
msgstr ""
#, c-format
msgid "video: Can't initialize X11 thread support on '%s'\n"
msgid "video: Can't connect to X11 server on '%s'\n"
msgstr ""
msgid "video: Can't convert XLIB display to XCB connection\n"
@@ -964,5 +980,20 @@ msgstr ""
#~ msgid "A software and GPU emulated HD device"
#~ msgstr "Ein Software und GPU emulieres HD-Gerät"
#~ msgid "Use studio levels (vdpau only)"
#~ msgstr "Benutze Studio Levels (nur vdpau)"
#~ msgid "Brightness (-1000..1000) (vdpau)"
#~ msgstr "Helligkeit (-1000..1000) (vdpau)"
#~ msgid "Contrast (0..10000) (vdpau)"
#~ msgstr "Kontrast (0..10000) (vdpau)"
#~ msgid "Saturation (0..10000) (vdpau)"
#~ msgstr "Sättigung (0..10000) (vdpau)"
#~ msgid "Hue (-3141..3141) (vdpau)"
#~ msgstr "Farbton (-3141..3141) (vdpau)"
#~ msgid "SoftHdDevice"
#~ msgstr "SoftHdDevice"

View File

@@ -1,29 +1,29 @@
///
/// @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.
///
/// Contributor(s):
/// Contributor(s):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: c9497b197ce7e7a6ba397944edc7ccb161152efd $
/// $Id: c9497b197ce7e7a6ba397944edc7ccb161152efd $
//////////////////////////////////////////////////////////////////////////////
///
/// @defgroup Ringbuffer The ring buffer module.
/// @defgroup Ringbuffer The ring buffer module.
///
/// Lock free ring buffer with only one writer and one reader.
/// Lock free ring buffer with only one writer and one reader.
///
#include <stdio.h>
@@ -33,18 +33,18 @@
#include "iatomic.h"
#include "ringbuffer.h"
/// ring buffer structure
/// ring buffer structure
struct _ring_buffer_
{
char *Buffer; ///< ring buffer data
const char *BufferEnd; ///< end of buffer
size_t Size; ///< bytes in buffer (for faster calc)
char *Buffer; ///< ring buffer data
const char *BufferEnd; ///< end of buffer
size_t Size; ///< bytes in buffer (for faster calc)
const char *ReadPointer; ///< only used by reader
char *WritePointer; ///< only used by writer
const char *ReadPointer; ///< only used by reader
char *WritePointer; ///< only used by writer
/// 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
};
/**
@@ -71,12 +71,12 @@ RingBuffer *RingBufferNew(size_t size)
{
RingBuffer *rb;
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
return rb;
if (!(rb = malloc(sizeof(*rb)))) { // allocate structure
return rb;
}
if (!(rb->Buffer = malloc(size))) { // allocate buffer
free(rb);
return NULL;
if (!(rb->Buffer = malloc(size))) { // allocate buffer
free(rb);
return NULL;
}
rb->Size = size;
@@ -108,25 +108,25 @@ size_t RingBufferWriteAdvance(RingBuffer * rb, size_t cnt)
size_t n;
n = rb->Size - atomic_read(&rb->Filled);
if (cnt > n) { // not enough space
cnt = n;
if (cnt > n) { // not enough space
cnt = n;
}
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->WritePointer;
if (n > cnt) { // don't cross the end
rb->WritePointer += cnt;
} else { // reached or cross the end
rb->WritePointer = rb->Buffer;
if (n < cnt) {
n = cnt - n;
rb->WritePointer += n;
}
if (n > cnt) { // don't cross the end
rb->WritePointer += cnt;
} else { // reached or cross the end
rb->WritePointer = rb->Buffer;
if (n < cnt) {
n = cnt - n;
rb->WritePointer += n;
}
}
//
// Only atomic modification!
// Only atomic modification!
//
atomic_add(cnt, &rb->Filled);
return cnt;
@@ -147,29 +147,29 @@ size_t RingBufferWrite(RingBuffer * rb, const void *buf, size_t cnt)
size_t n;
n = rb->Size - atomic_read(&rb->Filled);
if (cnt > n) { // not enough space
cnt = n;
if (cnt > n) { // not enough space
cnt = n;
}
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->WritePointer;
if (n > cnt) { // don't cross the end
memcpy(rb->WritePointer, buf, cnt);
rb->WritePointer += cnt;
} else { // reached or cross the end
memcpy(rb->WritePointer, buf, n);
rb->WritePointer = rb->Buffer;
if (n < cnt) {
buf += n;
n = cnt - n;
memcpy(rb->WritePointer, buf, n);
rb->WritePointer += n;
}
if (n > cnt) { // don't cross the end
memcpy(rb->WritePointer, buf, cnt);
rb->WritePointer += cnt;
} else { // reached or cross the end
memcpy(rb->WritePointer, buf, n);
rb->WritePointer = rb->Buffer;
if (n < cnt) {
buf += n;
n = cnt - n;
memcpy(rb->WritePointer, buf, n);
rb->WritePointer += n;
}
}
//
// Only atomic modification!
// Only atomic modification!
//
atomic_add(cnt, &rb->Filled);
return cnt;
@@ -189,17 +189,17 @@ size_t RingBufferGetWritePointer(RingBuffer * rb, void **wp)
size_t n;
size_t cnt;
// Total free bytes available in ring buffer
// Total free bytes available in ring buffer
cnt = rb->Size - atomic_read(&rb->Filled);
*wp = rb->WritePointer;
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->WritePointer;
if (n <= cnt) { // reached or cross the end
return n;
if (n <= cnt) { // reached or cross the end
return n;
}
return cnt;
}
@@ -217,25 +217,25 @@ size_t RingBufferReadAdvance(RingBuffer * rb, size_t cnt)
size_t n;
n = atomic_read(&rb->Filled);
if (cnt > n) { // not enough filled
cnt = n;
if (cnt > n) { // not enough filled
cnt = n;
}
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->ReadPointer;
if (n > cnt) { // don't cross the end
rb->ReadPointer += cnt;
} else { // reached or cross the end
rb->ReadPointer = rb->Buffer;
if (n < cnt) {
n = cnt - n;
rb->ReadPointer += n;
}
if (n > cnt) { // don't cross the end
rb->ReadPointer += cnt;
} else { // reached or cross the end
rb->ReadPointer = rb->Buffer;
if (n < cnt) {
n = cnt - n;
rb->ReadPointer += n;
}
}
//
// Only atomic modification!
// Only atomic modification!
//
atomic_sub(cnt, &rb->Filled);
return cnt;
@@ -255,29 +255,29 @@ size_t RingBufferRead(RingBuffer * rb, void *buf, size_t cnt)
size_t n;
n = atomic_read(&rb->Filled);
if (cnt > n) { // not enough filled
cnt = n;
if (cnt > n) { // not enough filled
cnt = n;
}
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->ReadPointer;
if (n > cnt) { // don't cross the end
memcpy(buf, rb->ReadPointer, cnt);
rb->ReadPointer += cnt;
} else { // reached or cross the end
memcpy(buf, rb->ReadPointer, n);
rb->ReadPointer = rb->Buffer;
if (n < cnt) {
buf += n;
n = cnt - n;
memcpy(buf, rb->ReadPointer, n);
rb->ReadPointer += n;
}
if (n > cnt) { // don't cross the end
memcpy(buf, rb->ReadPointer, cnt);
rb->ReadPointer += cnt;
} else { // reached or cross the end
memcpy(buf, rb->ReadPointer, n);
rb->ReadPointer = rb->Buffer;
if (n < cnt) {
buf += n;
n = cnt - n;
memcpy(buf, rb->ReadPointer, n);
rb->ReadPointer += n;
}
}
//
// Only atomic modification!
// Only atomic modification!
//
atomic_sub(cnt, &rb->Filled);
return cnt;
@@ -297,17 +297,17 @@ size_t RingBufferGetReadPointer(RingBuffer * rb, const void **rp)
size_t n;
size_t cnt;
// Total used bytes in ring buffer
// Total used bytes in ring buffer
cnt = atomic_read(&rb->Filled);
*rp = rb->ReadPointer;
//
// Hitting end of buffer?
// Hitting end of buffer?
//
n = rb->BufferEnd - rb->ReadPointer;
if (n <= cnt) { // reached or cross the end
return n;
if (n <= cnt) { // reached or cross the end
return n;
}
return cnt;
}

View File

@@ -1,62 +1,62 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: 8a2b4c171f1024afb8b8a7a7add631b7ebe2d45e $
/// $Id: 8a2b4c171f1024afb8b8a7a7add631b7ebe2d45e $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup Ringbuffer
/// @{
/// ring buffer typedef
/// ring buffer typedef
typedef struct _ring_buffer_ RingBuffer;
/// reset ring buffer pointers
/// reset ring buffer pointers
extern void RingBufferReset(RingBuffer *);
/// create new ring buffer
/// create new ring buffer
extern RingBuffer *RingBufferNew(size_t);
/// free ring buffer
/// free ring buffer
extern void RingBufferDel(RingBuffer *);
/// write into ring buffer
/// write into ring buffer
extern size_t RingBufferWrite(RingBuffer *, const void *, size_t);
/// get write pointer of ring buffer
/// get write pointer of ring buffer
extern size_t RingBufferGetWritePointer(RingBuffer *, void **);
/// advance write pointer of ring buffer
/// advance write pointer of ring buffer
extern size_t RingBufferWriteAdvance(RingBuffer *, size_t);
/// read from ring buffer
/// read from ring buffer
extern size_t RingBufferRead(RingBuffer *, void *, size_t);
/// get read pointer of ring buffer
/// get read pointer of ring buffer
extern size_t RingBufferGetReadPointer(RingBuffer *, const void **);
/// advance read pointer of ring buffer
/// advance read pointer of ring buffer
extern size_t RingBufferReadAdvance(RingBuffer *, size_t);
/// free bytes ring buffer
/// free bytes ring buffer
extern size_t RingBufferFreeBytes(RingBuffer *);
/// used bytes ring buffer
/// used bytes ring buffer
extern size_t RingBufferUsedBytes(RingBuffer *);
/// @}

835
shaders.h
View File

@@ -1,369 +1,466 @@
// shader
char vertex[] = {"\
#version 330\n\
in vec2 vertex_position;\n\
in vec2 vertex_texcoord0;\n\
out vec2 texcoord0;\n\
in vec2 vertex_texcoord1;\n\
out vec2 texcoord1;\n\
in vec2 vertex_texcoord2;\n\
out vec2 texcoord2;\n\
in vec2 vertex_texcoord3;\n\
out vec2 texcoord3;\n\
in vec2 vertex_texcoord4;\n\
out vec2 texcoord4;\n\
in vec2 vertex_texcoord5;\n\
out vec2 texcoord5;\n\
void main() {\n\
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
texcoord0 = vertex_texcoord0;\n\
texcoord1 = vertex_texcoord1;\n\
texcoord2 = vertex_texcoord2;\n\
texcoord3 = vertex_texcoord3;\n\
texcoord4 = vertex_texcoord4;\n\
texcoord5 = vertex_texcoord5;\n\
}\n"};
char fragment[] = {"\
#version 330\n\
#define texture1D texture\n\
#define texture3D texture\n\
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
in vec2 texcoord2;\n\
in vec2 texcoord3;\n\
in vec2 texcoord4;\n\
in vec2 texcoord5;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform sampler2D texture0;\n\
//uniform vec2 texture_size0;\n\
//uniform mat2 texture_rot0;\n\
//uniform vec2 pixel_size0;\n\
uniform sampler2D texture1;\n\
//uniform vec2 texture_size1;\n\
//uniform mat2 texture_rot1;\n\
//uniform vec2 pixel_size1;\n\
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
out_color = color;\n\
}\n"};
char fragment_bt2100[] = {"\
#version 330\n\
#define texture1D texture\n\
#define texture3D texture\n\
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
in vec2 texcoord2;\n\
in vec2 texcoord3;\n\
in vec2 texcoord4;\n\
in vec2 texcoord5;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform mat3 cms_matrix;\n\
uniform sampler2D texture0;\n\
//uniform vec2 texture_size0;\n\
//uniform mat2 texture_rot0;\n\
//uniform vec2 pixel_size0;\n\
uniform sampler2D texture1;\n\
//uniform vec2 texture_size1;\n\
//uniform mat2 texture_rot1;\n\
//uniform vec2 pixel_size1;\n\
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(2.4));\n\
color.rgb = cms_matrix * color.rgb;\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(1.0/2.4));\n\
out_color = color;\n\
}\n"};
/* Color conversion matrix: RGB = m * YUV + c
* m is in row-major matrix, with m[row][col], e.g.:
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
* [ a21 a22 a23 ] { a21, a22, a23 },
* [ a31 a32 a33 ] { a31, a32, a33 } };
* 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,
* while each column contains all the coefficients for one of Y, U, V:
* m[r,g,b][y,u,v] = ...
* The matrix could also be viewed as group of 3 vectors, e.g. the 1st column
* 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.
*/
struct mp_cmat {
float m[3][3]; // colormatrix
float c[3]; //colormatrix_c
};
struct mp_mat {
float m[3][3];
};
// YUV input limited range (16-235 for luma, 16-240 for chroma)
// ITU-R BT.601 (SD)
struct mp_cmat yuv_bt601 = {\
{{ 1.164384, 1.164384, 1.164384 },\
{ 0.00000, -0.391762, 2.017232 },\
{ 1.596027, -0.812968 , 0.000000 }},\
{-0.874202, 0.531668, -1.085631 } };
// ITU-R BT.709 (HD)
struct mp_cmat yuv_bt709 = {\
{{ 1.164384, 1.164384, 1.164384 },\
{ 0.00000, -0.213249, 2.112402 },\
{ 1.792741, -0.532909 , 0.000000 }},\
{-0.972945, 0.301483, -1.133402 } };
// ITU-R BT.2020 non-constant luminance system
struct mp_cmat yuv_bt2020ncl = {\
{{ 1.164384, 1.164384, 1.164384 },\
{ 0.00000, -0.187326, 2.141772 },\
{ 1.678674, -0.650424 , 0.000000 }},\
{-0.915688, 0.347459, -1.148145 } };
// ITU-R BT.2020 constant luminance system
struct mp_cmat yuv_bt2020cl = {\
{{ 0.0000, 1.164384, 0.000000 },\
{ 0.00000, 0.000000, 1.138393 },\
{ 1.138393, 0.000000 , 0.000000 }},\
{-0.571429, -0.073059, -0.571429 } };
float cms_matrix[3][3] = \
{{ 1.660497, -0.124547, -0.018154},\
{-0.587657, 1.132895, -0.100597},\
{-0.072840, -0.008348, 1.118751}};
struct gl_vao_entry {
// used for shader / glBindAttribLocation
const char *name;
// glVertexAttribPointer() arguments
int num_elems; // size (number of elements)
GLenum type;
bool normalized;
int offset;
};
struct vertex_pt {
float x, y;
};
struct vertex_pi {
GLint x, y;
};
#define TEXUNIT_VIDEO_NUM 6
struct vertex {
struct vertex_pt position;
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
};
static const struct gl_vao_entry vertex_vao[] = {
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
{"texcoord2", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[2])},
{"texcoord3", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[3])},
{"texcoord4", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[4])},
{"texcoord5", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[5])},
{0}
};
static void compile_attach_shader(GLuint program,
GLenum type, const char *source)
{
GLuint shader;
GLint status, log_length;
shader = glCreateShader(type);
glShaderSource(shader, 1, &source, NULL);
glCompileShader(shader);
status = 0;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
log_length = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
Debug(3,"compile Status %d loglen %d\n",status,log_length);
GlxCheck();
glAttachShader(program, shader);
glDeleteShader(shader);
}
static void link_shader(GLuint program)
{
GLint status,log_length;
glLinkProgram(program);
status = 0;
glGetProgramiv(program, GL_LINK_STATUS, &status);
log_length = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
Debug(3,"Link Status %d loglen %d\n",status,log_length);
}
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
char vname[80];
int n;
GLint cmsLoc;
float *m,*c,*cms;
char *frag;
switch (colorspace) {
case AVCOL_SPC_RGB:
m = &yuv_bt601.m[0][0];
c = &yuv_bt601.c[0];
frag = fragment;
Debug(3,"BT601 Colorspace used\n");
break;
case AVCOL_SPC_BT709:
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
m = &yuv_bt709.m[0][0];
c = &yuv_bt709.c[0];
frag = fragment;
Debug(3,"BT709 Colorspace used\n");
break;
case AVCOL_SPC_BT2020_NCL:
m = &yuv_bt2020ncl.m[0][0];
c = &yuv_bt2020ncl.c[0];
cms = &cms_matrix[0][0];
frag = fragment_bt2100;
Debug(3,"BT2020NCL Colorspace used\n");
break;
default: // fallback
m = &yuv_bt709.m[0][0];
c = &yuv_bt709.c[0];
frag = fragment;
Debug(3,"default BT709 Colorspace used %d\n",colorspace);
break;
}
Debug(3,"vor create\n");
gl_prog = glCreateProgram();
Debug(3,"vor compile vertex\n");
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, vertex);
Debug(3,"vor compile fragment\n");
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, frag);
glBindAttribLocation(gl_prog,0,"vertex_position");
for (n=0;n<6;n++) {
sprintf(vname,"vertex_texcoord%1d",n);
glBindAttribLocation(gl_prog,n+1,vname);
}
link_shader(gl_prog);
gl_colormatrix = glGetUniformLocation(gl_prog,"colormatrix");
Debug(3,"get uniform colormatrix %d \n",gl_colormatrix);
if (gl_colormatrix != -1)
glProgramUniformMatrix3fv(gl_prog,gl_colormatrix,1,0,m);
GlxCheck();
//glProgramUniform3fv(gl_prog,gl_colormatrix,3,&yuv_bt709.m[0][0]);
gl_colormatrix_c = glGetUniformLocation(gl_prog,"colormatrix_c");
Debug(3,"get uniform colormatrix_c %d %f\n",gl_colormatrix_c,*c);
if (gl_colormatrix_c != -1)
glProgramUniform3fv(gl_prog,gl_colormatrix_c,1,c);
GlxCheck();
if (colorspace == AVCOL_SPC_BT2020_NCL) {
cmsLoc = glGetUniformLocation(gl_prog,"cms_matrix");
if (cmsLoc != -1)
glProgramUniformMatrix3fv(gl_prog,cmsLoc,1,0,cms);
GlxCheck();
}
return gl_prog;
}
static void render_pass_quad(int flip, float xcrop, float ycrop)
{
struct vertex va[4];
int n;
const struct gl_vao_entry *e;
// uhhhh what a hack
if (!flip ) {
va[0].position.x = (float) -1.0;
va[0].position.y = (float) 1.0;
va[1].position.x = (float) -1.0;
va[1].position.y = (float) -1.0;
va[2].position.x = (float) 1.0;
va[2].position.y = (float) 1.0;
va[3].position.x = (float) 1.0;
va[3].position.y = (float) -1.0;
} else {
va[0].position.x = (float) -1.0;
va[0].position.y = (float) -1.0;
va[1].position.x = (float) -1.0;
va[1].position.y = (float) 1.0;
va[2].position.x = (float) 1.0;
va[2].position.y = (float) -1.0;
va[3].position.x = (float) 1.0;
va[3].position.y = (float) 1.0;
}
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[1].x = (float) 0.0 + xcrop;
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].y = (float) 1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
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[2].texcoord[0].x = (float) 1.0 - xcrop;
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].y = (float) 0.0 + ycrop; // abgeschnitten von rechts oben
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[1].x = (float) 1.0 - xcrop;
va[3].texcoord[1].y = (float) 1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// enable attribs
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
for ( n = 0; vertex_vao[n].name; n++) {
e = &vertex_vao[n];
glEnableVertexAttribArray(n);
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized,
sizeof(struct vertex), (void *)(intptr_t)e->offset);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
// draw quad
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
for ( n = 0; vertex_vao[n].name; n++)
glDisableVertexAttribArray(n);
}
// shader
#ifdef CUVID
char vertex_osd[] = { "\
#version 330\n\
in vec2 vertex_position;\n\
in vec2 vertex_texcoord0;\n\
out vec2 texcoord0;\n\
void main() {\n\
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
texcoord0 = vertex_texcoord0;\n\
}\n" };
char fragment_osd[] = { "\
#version 330\n\
#define texture1D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
uniform sampler2D texture0;\n\
void main() {\n\
vec4 color; \n\
color = vec4(texture(texture0, texcoord0));\n\
out_color = color;\n\
}\n" };
char vertex[] = { "\
#version 310 es\n\
in vec2 vertex_position;\n\
in vec2 vertex_texcoord0;\n\
out vec2 texcoord0;\n\
in vec2 vertex_texcoord1;\n\
out vec2 texcoord1;\n\
void main() {\n\
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
texcoord0 = vertex_texcoord0;\n\
texcoord1 = vertex_texcoord1;\n\
}\n" };
char fragment[] = { "\
#version 310 es\n\
#define texture1D texture\n\
#define texture3D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform sampler2D texture0;\n\
uniform sampler2D texture1;\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
out_color = color;\n\
}\n" };
char fragment_bt2100[] = { "\
#version 310 es\n \
#define texture1D texture\n\
#define texture3D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform mat3 cms_matrix;\n\
uniform sampler2D texture0;\n\
uniform sampler2D texture1;\n\
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(2.4));\n\
color.rgb = cms_matrix * color.rgb;\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(1.0/2.4));\n\
out_color = color;\n\
}\n" };
#else
char vertex_osd[] = { "\
\n\
in vec2 vertex_position;\n\
in vec2 vertex_texcoord0;\n\
out vec2 texcoord0;\n\
void main() {\n\
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
texcoord0 = vertex_texcoord0;\n\
}\n" };
char fragment_osd[] = { "\
\n\
#define texture1D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
uniform sampler2D texture0;\n\
void main() {\n\
vec4 color; \n\
color = vec4(texture(texture0, texcoord0));\n\
out_color = color;\n\
}\n" };
char vertex[] = { "\
\n\
in vec2 vertex_position;\n\
in vec2 vertex_texcoord0;\n\
out vec2 texcoord0;\n\
in vec2 vertex_texcoord1;\n\
out vec2 texcoord1;\n\
void main() {\n\
gl_Position = vec4(vertex_position, 1.0, 1.0);\n\
texcoord0 = vertex_texcoord0;\n\
texcoord1 = vertex_texcoord1;\n\
}\n" };
char fragment[] = { "\
\n\
#define texture1D texture\n\
#define texture3D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform sampler2D texture0;\n\
uniform sampler2D texture1;\n\
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.000000 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
out_color = color;\n\
}\n" };
char fragment_bt2100[] = { "\
\n \
#define texture1D texture\n\
#define texture3D texture\n\
precision mediump float; \
layout(location = 0) out vec4 out_color;\n\
in vec2 texcoord0;\n\
in vec2 texcoord1;\n\
uniform mat3 colormatrix;\n\
uniform vec3 colormatrix_c;\n\
uniform mat3 cms_matrix;\n\
uniform sampler2D texture0;\n\
uniform sampler2D texture1;\n\
//#define LUT_POS(x, lut_size) mix(0.5 / (lut_size), 1.0 - 0.5 / (lut_size), (x))\n\
void main() {\n\
vec4 color; // = vec4(0.0, 0.0, 0.0, 1.0);\n\
color.r = 1.003906 * vec4(texture(texture0, texcoord0)).r;\n\
color.gb = 1.003906 * vec4(texture(texture1, texcoord1)).rg;\n\
// color conversion\n\
color.rgb = mat3(colormatrix) * color.rgb + colormatrix_c;\n\
color.a = 1.0;\n\
// color mapping\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(2.4));\n\
color.rgb = cms_matrix * color.rgb;\n\
color.rgb = clamp(color.rgb, 0.0, 1.0);\n\
color.rgb = pow(color.rgb, vec3(1.0/2.4));\n\
out_color = color;\n\
}\n" };
#endif
/* Color conversion matrix: RGB = m * YUV + c
* m is in row-major matrix, with m[row][col], e.g.:
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
* [ a21 a22 a23 ] { a21, a22, a23 },
* [ a31 a32 a33 ] { a31, a32, a33 } };
* 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,
* while each column contains all the coefficients for one of Y, U, V:
* m[r,g,b][y,u,v] = ...
* The matrix could also be viewed as group of 3 vectors, e.g. the 1st column
* 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.
*/
struct mp_cmat
{
GLfloat m[3][3]; // colormatrix
GLfloat c[3]; //colormatrix_c
};
struct mp_mat
{
GLfloat m[3][3];
};
// YUV input limited range (16-235 for luma, 16-240 for chroma)
// ITU-R BT.601 (SD)
struct mp_cmat yuv_bt601 = { {{1.164384, 1.164384, 1.164384},
{0.00000, -0.391762, 2.017232},
{1.596027, -0.812968, 0.000000}},
{-0.874202, 0.531668, -1.085631}
};
// ITU-R BT.709 (HD)
struct mp_cmat yuv_bt709 = { {{1.164384, 1.164384, 1.164384},
{0.00000, -0.213249, 2.112402},
{1.792741, -0.532909, 0.000000}},
{-0.972945, 0.301483, -1.133402}
};
// ITU-R BT.2020 non-constant luminance system
struct mp_cmat yuv_bt2020ncl = { {{1.164384, 1.164384, 1.164384},
{0.00000, -0.187326, 2.141772},
{1.678674, -0.650424, 0.000000}},
{-0.915688, 0.347459, -1.148145}
};
// ITU-R BT.2020 constant luminance system
struct mp_cmat yuv_bt2020cl = { {{0.0000, 1.164384, 0.000000},
{0.00000, 0.000000, 1.138393},
{1.138393, 0.000000, 0.000000}},
{-0.571429, -0.073059, -0.571429}
};
float cms_matrix[3][3] = { {1.660497, -0.124547, -0.018154},
{-0.587657, 1.132895, -0.100597},
{-0.072840, -0.008348, 1.118751}
};
struct gl_vao_entry
{
// used for shader / glBindAttribLocation
const char *name;
// glVertexAttribPointer() arguments
int num_elems; // size (number of elements)
GLenum type;
bool normalized;
int offset;
};
struct vertex_pt
{
float x, y;
};
struct vertex_pi
{
GLint x, y;
};
#define TEXUNIT_VIDEO_NUM 6
struct vertex
{
struct vertex_pt position;
struct vertex_pt texcoord[TEXUNIT_VIDEO_NUM];
};
static const struct gl_vao_entry vertex_vao[] = {
{"position", 2, GL_FLOAT, false, offsetof(struct vertex, position)},
{"texcoord0", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[0])},
{"texcoord1", 2, GL_FLOAT, false, offsetof(struct vertex, texcoord[1])},
{0}
};
static void compile_attach_shader(GLuint program, GLenum type, const char *source)
{
GLuint shader;
GLint status, log_length;
char log[4000];
GLsizei len;
shader = glCreateShader(type);
glShaderSource(shader, 1, &source, NULL);
glCompileShader(shader);
status = 0;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
log_length = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
glGetShaderInfoLog(shader, 4000, &len, log);
GlxCheck();
Debug(3, "compile Status %d loglen %d >%s<\n", status, log_length, log);
glAttachShader(program, shader);
glDeleteShader(shader);
}
static void link_shader(GLuint program)
{
GLint status, log_length;
glLinkProgram(program);
status = 0;
glGetProgramiv(program, GL_LINK_STATUS, &status);
log_length = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
Debug(3, "Link Status %d loglen %d\n", status, log_length);
}
static GLuint sc_generate_osd(GLuint gl_prog)
{
Debug(3, "vor create osd\n");
gl_prog = glCreateProgram();
Debug(3, "vor compile vertex osd\n");
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, vertex_osd);
Debug(3, "vor compile fragment osd \n");
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, fragment_osd);
glBindAttribLocation(gl_prog, 0, "vertex_position");
glBindAttribLocation(gl_prog, 1, "vertex_texcoord0");
link_shader(gl_prog);
return gl_prog;
}
static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
{
char vname[80];
int n;
GLint cmsLoc;
float *m, *c, *cms;
char *frag;
switch (colorspace) {
case AVCOL_SPC_RGB:
m = &yuv_bt601.m[0][0];
c = &yuv_bt601.c[0];
frag = fragment;
Debug(3, "BT601 Colorspace used\n");
break;
case AVCOL_SPC_BT709:
case AVCOL_SPC_UNSPECIFIED: // comes with UHD
m = &yuv_bt709.m[0][0];
c = &yuv_bt709.c[0];
frag = fragment;
Debug(3, "BT709 Colorspace used\n");
break;
case AVCOL_SPC_BT2020_NCL:
m = &yuv_bt2020ncl.m[0][0];
c = &yuv_bt2020ncl.c[0];
cms = &cms_matrix[0][0];
frag = fragment_bt2100;
Debug(3, "BT2020NCL Colorspace used\n");
break;
default: // fallback
m = &yuv_bt709.m[0][0];
c = &yuv_bt709.c[0];
frag = fragment;
Debug(3, "default BT709 Colorspace used %d\n", colorspace);
break;
}
Debug(3, "vor create\n");
gl_prog = glCreateProgram();
Debug(3, "vor compile vertex\n");
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, vertex);
Debug(3, "vor compile fragment\n");
compile_attach_shader(gl_prog, GL_FRAGMENT_SHADER, frag);
glBindAttribLocation(gl_prog, 0, "vertex_position");
for (n = 0; n < 6; n++) {
sprintf(vname, "vertex_texcoord%1d", n);
glBindAttribLocation(gl_prog, n + 1, vname);
}
link_shader(gl_prog);
gl_colormatrix = glGetUniformLocation(gl_prog, "colormatrix");
Debug(3, "get uniform colormatrix %d \n", gl_colormatrix);
if (gl_colormatrix != -1)
glProgramUniformMatrix3fv(gl_prog, gl_colormatrix, 1, 0, m);
GlxCheck();
Debug(3, "nach set colormatrix\n");
gl_colormatrix_c = glGetUniformLocation(gl_prog, "colormatrix_c");
Debug(3, "get uniform colormatrix_c %d %f\n", gl_colormatrix_c, *c);
if (gl_colormatrix_c != -1)
glProgramUniform3fv(gl_prog, gl_colormatrix_c, 1, c);
GlxCheck();
if (colorspace == AVCOL_SPC_BT2020_NCL) {
cmsLoc = glGetUniformLocation(gl_prog, "cms_matrix");
if (cmsLoc != -1)
glProgramUniformMatrix3fv(gl_prog, cmsLoc, 1, 0, cms);
GlxCheck();
}
return gl_prog;
}
static void render_pass_quad(int flip, float xcrop, float ycrop)
{
struct vertex va[4];
int n;
const struct gl_vao_entry *e;
// uhhhh what a hack
if (!flip) {
va[0].position.x = (float)-1.0;
va[0].position.y = (float)1.0;
va[1].position.x = (float)-1.0;
va[1].position.y = (float)-1.0;
va[2].position.x = (float)1.0;
va[2].position.y = (float)1.0;
va[3].position.x = (float)1.0;
va[3].position.y = (float)-1.0;
} else {
va[0].position.x = (float)-1.0;
va[0].position.y = (float)-1.0;
va[1].position.x = (float)-1.0;
va[1].position.y = (float)1.0;
va[2].position.x = (float)1.0;
va[2].position.y = (float)-1.0;
va[3].position.x = (float)1.0;
va[3].position.y = (float)1.0;
}
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[1].x = (float)0.0 + xcrop;
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].y = (float)1.0 - ycrop; // abgeschnitten links unten 1.0 - Wert
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[2].texcoord[0].x = (float)1.0 - xcrop;
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].y = (float)0.0 + ycrop; // abgeschnitten von rechts oben
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[1].x = (float)1.0 - xcrop;
va[3].texcoord[1].y = (float)1.0 - ycrop; // abgeschnitten von rechts unten 1.0 - wert
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
glBufferData(GL_ARRAY_BUFFER, 4 * sizeof(struct vertex), va, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
// enable attribs
glBindBuffer(GL_ARRAY_BUFFER, vao_buffer);
for (n = 0; vertex_vao[n].name; n++) {
e = &vertex_vao[n];
glEnableVertexAttribArray(n);
glVertexAttribPointer(n, e->num_elems, e->type, e->normalized, sizeof(struct vertex),
(void *)(intptr_t) e->offset);
}
glBindBuffer(GL_ARRAY_BUFFER, 0);
// draw quad
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
for (n = 0; vertex_vao[n].name; n++)
glDisableVertexAttribArray(n);
}

View File

@@ -89,4 +89,3 @@ color.a = 1.0;
// color mapping
out_color = color;
}

50
skindesigner_patch.txt Normal file
View File

@@ -0,0 +1,50 @@
diff -Naur skindesignerold/coreengine/animation.c skindesigner/coreengine/animation.c
--- skindesignerold/coreengine/animation.c 2018-03-03 09:03:00.000000000 +0100
+++ skindesigner/coreengine/animation.c 2018-11-18 14:56:31.147849032 +0100
@@ -671,9 +671,9 @@
}
animLock.Unlock();
reactivate = false;
- osd->Flush();
if (!animActive)
break;
+ osd->Flush();
Sleep(start);
}
}
diff -Naur skindesignerold/coreengine/view.c skindesigner/coreengine/view.c
--- skindesignerold/coreengine/view.c 2018-03-03 09:03:00.000000000 +0100
+++ skindesigner/coreengine/view.c 2018-11-18 11:59:24.870281811 +0100
@@ -279,7 +279,7 @@
continue;
viewElements[i]->Close();
}
- sdOsd.Flush();
+// sdOsd.Flush();
sdOsd.DeleteOsd();
}
diff -Naur skindesignerold/coreengine/viewdisplaychannel.c skindesigner/coreengine/viewdisplaychannel.c
--- skindesignerold/coreengine/viewdisplaychannel.c 2018-03-03 09:03:00.000000000 +0100
+++ skindesigner/coreengine/viewdisplaychannel.c 2018-11-18 12:01:10.460722220 +0100
@@ -396,7 +396,7 @@
if (groupChannelList)
groupChannelList->Close();
#endif
- sdOsd.Flush();
+// sdOsd.Flush();
sdOsd.DeleteOsd();
}
diff -Naur skindesignerold/coreengine/viewdisplaymenu.c skindesigner/coreengine/viewdisplaymenu.c
--- skindesignerold/coreengine/viewdisplaymenu.c 2018-03-03 09:03:00.000000000 +0100
+++ skindesigner/coreengine/viewdisplaymenu.c 2018-11-18 12:00:20.301464616 +0100
@@ -556,7 +556,7 @@
}
UnScaleTv();
ClearVariables();
- sdOsd.Flush();
+// sdOsd.Flush();
sdOsd.DeleteOsd();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,23 +1,23 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: efb2e251dd7082138ec21609478d2402be8208cf $
/// $Id: efb2e251dd7082138ec21609478d2402be8208cf $
//////////////////////////////////////////////////////////////////////////////
#ifdef __cplusplus
@@ -25,8 +25,7 @@ extern "C"
{
#endif
/// 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
extern void GetOsdSize(int *, int *, double *);
@@ -34,8 +33,7 @@ extern "C"
/// C plugin close osd
extern void OsdClose(void);
/// 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
extern int PlayAudio(const uint8_t *, int, uint8_t);
@@ -111,7 +109,7 @@ extern "C"
/// Pip play video packet
extern int PipPlayVideo(const uint8_t *, int);
extern const char *X11DisplayName; ///< x11 display name
extern const char *X11DisplayName; ///< x11 display name
#ifdef __cplusplus
}
#endif

View File

@@ -1,21 +1,21 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: 3bc44809950ec019529638cad9223a85d4ab5576 $
/// $Id: 3bc44809950ec019529638cad9223a85d4ab5576 $
//////////////////////////////////////////////////////////////////////////////

View File

@@ -1,23 +1,23 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: c7c2d5e8b724515d7c767668aab717b27f4e4068 $
/// $Id: c7c2d5e8b724515d7c767668aab717b27f4e4068 $
//////////////////////////////////////////////////////////////////////////////
#pragma once

8321
video.c

File diff suppressed because it is too large Load Diff

198
video.h
View File

@@ -1,23 +1,23 @@
///
/// @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):
///
/// License: AGPLv3
/// License: AGPLv3
///
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
/// This program is free software: you can redistribute it and/or modify
/// it under the terms of the GNU Affero General Public License as
/// published by the Free Software Foundation, either version 3 of the
/// License.
///
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
/// This program is distributed in the hope that it will be useful,
/// but WITHOUT ANY WARRANTY; without even the implied warranty of
/// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
/// GNU Affero General Public License for more details.
///
/// $Id: 83cd827a8744e8c80c8adba6cb87653b0ad58c45 $
/// $Id: 83cd827a8744e8c80c8adba6cb87653b0ad58c45 $
//////////////////////////////////////////////////////////////////////////////
/// @addtogroup Video
@@ -27,227 +27,231 @@
#include <GL/glx.h>
//----------------------------------------------------------------------------
// Typedefs
// Typedefs
//----------------------------------------------------------------------------
/// Video hardware decoder typedef
/// Video hardware decoder typedef
typedef struct _video_hw_decoder_ VideoHwDecoder;
/// Video output stream typedef
/// Video output stream typedef
typedef struct __video_stream__ VideoStream;
//----------------------------------------------------------------------------
// Variables
// Variables
//----------------------------------------------------------------------------
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
extern int VideoAudioDelay; ///< audio/video delay
extern char ConfigStartX11Server; ///< flag start the x11 server
extern signed char VideoHardwareDecoder; ///< flag use hardware decoder
extern char VideoIgnoreRepeatPict; ///< disable repeat pict warning
extern int VideoAudioDelay; ///< audio/video delay
extern char ConfigStartX11Server; ///< flag start the x11 server
//----------------------------------------------------------------------------
// Prototypes
// Prototypes
//----------------------------------------------------------------------------
/// Allocate new video hardware decoder.
/// Allocate new video hardware decoder.
extern VideoHwDecoder *VideoNewHwDecoder(VideoStream *);
/// Deallocate video hardware decoder.
/// Deallocate video hardware decoder.
extern void VideoDelHwDecoder(VideoHwDecoder *);
#ifdef LIBAVCODEC_VERSION
/// Get and allocate a video hardware surface.
/// Get and allocate a video hardware surface.
extern unsigned VideoGetSurface(VideoHwDecoder *, const AVCodecContext *);
/// Release a video hardware surface
/// Release a video hardware surface
extern void VideoReleaseSurface(VideoHwDecoder *, unsigned);
/// Callback to negotiate the PixelFormat.
extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *,
const enum AVPixelFormat *);
/// Callback to negotiate the PixelFormat.
extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *, const enum AVPixelFormat *);
/// Render a ffmpeg frame.
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *,
const AVFrame *);
/// Render a ffmpeg frame.
extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *, const AVFrame *);
/// Get hwaccel context for ffmpeg.
/// Get hwaccel context for ffmpeg.
extern void *VideoGetHwAccelContext(VideoHwDecoder *);
#ifdef AVCODEC_VDPAU_H
/// Draw vdpau render state.
extern void VideoDrawRenderState(VideoHwDecoder *,
struct vdpau_render_state *);
#endif
/// Draw vdpau render state.
extern void VideoDrawRenderState(VideoHwDecoder *, struct vdpau_render_state *);
#endif
#ifdef USE_OPENGLOSD
/// Set callback funktion to notify VDR about VideoEvents
/// Set callback funktion to notify VDR about VideoEvents
extern void VideoSetVideoEventCallback(void (*)(void));
#endif
/// Poll video events.
/// Poll video events.
extern void VideoPollEvent(void);
/// Wakeup display handler.
/// Wakeup display handler.
extern void VideoDisplayWakeup(void);
/// Set video device.
/// Set video device.
extern void VideoSetDevice(const char *);
/// Get video driver name.
/// Get video driver name.
extern const char *VideoGetDriverName(void);
/// Set video geometry.
/// Set video geometry.
extern int VideoSetGeometry(const char *);
/// Set 60Hz display mode.
/// Set 60Hz display mode.
extern void VideoSet60HzMode(int);
/// Set soft start audio/video sync.
/// Set soft start audio/video sync.
extern void VideoSetSoftStartSync(int);
/// Set show black picture during channel switch.
/// Set show black picture during channel switch.
extern void VideoSetBlackPicture(int);
/// Set brightness adjustment.
/// Set brightness adjustment.
extern void VideoSetBrightness(int);
/// Set contrast adjustment.
/// Set contrast adjustment.
extern void VideoSetContrast(int);
/// Set saturation adjustment.
/// Set saturation adjustment.
extern void VideoSetSaturation(int);
/// Set Gamm.
/// Set Gamma.
extern void VideoSetGamma(int);
/// Set ColorSpace.
/// Set ColorSpace.
extern void VideoSetTargetColor(int);
/// Set hue adjustment.
/// Set hue adjustment.
extern void VideoSetHue(int);
/// Set video output position.
/// Set Color Blindness.
extern void VideoSetColorBlindness(int);
/// Set Color Blindness Faktor
extern void VideoSetColorBlindnessFaktor(int);
/// Set video output position.
extern void VideoSetOutputPosition(VideoHwDecoder *, int, int, int, int);
/// Set video mode.
/// Set video mode.
extern void VideoSetVideoMode(int, int, int, int);
/// Set 4:3 display format.
/// Set 4:3 display format.
extern void VideoSet4to3DisplayFormat(int);
/// Set other display format.
/// Set other display format.
extern void VideoSetOtherDisplayFormat(int);
/// Set video fullscreen mode.
/// Set video fullscreen mode.
extern void VideoSetFullscreen(int);
/// Set deinterlace.
/// Set deinterlace.
extern void VideoSetDeinterlace(int[]);
/// Set skip chroma deinterlace.
/// Set skip chroma deinterlace.
extern void VideoSetSkipChromaDeinterlace(int[]);
/// Set inverse telecine.
/// Set inverse telecine.
extern void VideoSetInverseTelecine(int[]);
/// Set scaling.
/// Set scaling.
extern void VideoSetScaling(int[]);
/// Set denoise.
/// Set scaler test.
extern void VideoSetScalerTest(int);
/// Set denoise.
extern void VideoSetDenoise(int[]);
/// Set sharpen.
/// Set sharpen.
extern void VideoSetSharpen(int[]);
/// Set cut top and bottom.
/// Set cut top and bottom.
extern void VideoSetCutTopBottom(int[]);
/// Set cut left and right.
/// Set cut left and right.
extern void VideoSetCutLeftRight(int[]);
/// Set studio levels.
/// Set studio levels.
extern void VideoSetStudioLevels(int);
/// Set background.
/// Set background.
extern void VideoSetBackground(uint32_t);
/// Set audio delay.
/// Set audio delay.
extern void VideoSetAudioDelay(int);
/// Set auto-crop parameters.
/// Set auto-crop parameters.
extern void VideoSetAutoCrop(int, int, int);
/// Clear OSD.
/// Clear OSD.
extern void VideoOsdClear(void);
/// Draw an OSD ARGB image.
extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int,
int);
/// Draw an OSD ARGB image.
extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int);
/// Get OSD size.
/// Get OSD size.
extern void VideoGetOsdSize(int *, int *);
/// Set OSD size.
/// Set OSD size.
extern void VideoSetOsdSize(int, int);
/// Set Osd 3D Mode
/// Set Osd 3D Mode
extern void VideoSetOsd3DMode(int);
/// Set video clock.
/// Set video clock.
extern void VideoSetClock(VideoHwDecoder *, int64_t);
/// Get video clock.
/// Get video clock.
extern int64_t VideoGetClock(const VideoHwDecoder *);
/// Set closing flag.
/// Set closing flag.
extern void VideoSetClosing(VideoHwDecoder *);
/// Reset start of frame counter
/// Reset start of frame counter
extern void VideoResetStart(VideoHwDecoder *);
/// Set trick play speed.
/// Set trick play speed.
extern void VideoSetTrickSpeed(VideoHwDecoder *, int);
/// Grab screen.
/// Grab screen.
extern uint8_t *VideoGrab(int *, int *, int *, int);
/// Grab screen raw.
/// Grab screen raw.
extern uint8_t *VideoGrabService(int *, int *, int *);
/// Get decoder statistics.
/// Get decoder statistics.
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 VideoOsdInit(void); ///< Setup osd.
extern void VideoOsdExit(void); ///< Cleanup osd.
extern void VideoOsdInit(void); ///< Setup osd.
extern void VideoOsdExit(void); ///< Cleanup osd.
extern void VideoInit(const char *); ///< Setup video module.
extern void VideoExit(void); ///< Cleanup and exit video module.
extern void VideoInit(const char *); ///< Setup video module.
extern void VideoExit(void); ///< Cleanup and exit video module.
/// Poll video input buffers.
/// Poll video input buffers.
extern int VideoPollInput(VideoStream *);
/// Decode video input buffers.
/// Decode video input buffers.
extern int VideoDecodeInput(VideoStream *);
/// Get number of input buffers.
/// Get number of input buffers.
extern int VideoGetBuffers(const VideoStream *);
/// Set DPMS at Blackscreen switch
/// Set DPMS at Blackscreen switch
extern void SetDPMSatBlackScreen(int);
/// Raise the frontend window
/// Raise the frontend window
extern int VideoRaiseWindow(void);
#ifdef USE_OPENGLOSD
extern void ActivateOsd(GLuint,int,int,int,int);
extern void ActivateOsd(GLuint, int, int, int, int);
#endif
#if 0
long int gettid()
{
return (long int)syscall(224);
return (long int)syscall(224);
}
#endif