63 Commits
V3.6 ... V3.21

Author SHA1 Message Date
jojo61
c4a660ede2 Update Version 2024-02-15 09:24:30 +01:00
jojo61
8e495266e2 Changes for egl exit 2024-02-15 09:23:09 +01:00
jojo61
f27e4fb35f Set Deinterlace Table for vaapi
Clean up exit on softhddrm
2024-02-05 10:50:19 +01:00
jojo61
e14ea73a00 Fix typo 2024-02-04 17:45:54 +01:00
jojo61
72cb77f771 Simplify Stereo Downmix 2024-02-04 10:32:33 +01:00
jojo61
c679d812d1 Fix flicker after mpv plugin use 2024-02-03 12:09:17 +01:00
jojo61
47b461ab46 Ffmeg does no Stereo Downmix for Codec AAV LATM
Do Downmix after decoding
2024-02-02 15:27:39 +01:00
jojo61
8629946041 Reverse pkg-config for glu glew and glut 2024-02-02 00:19:43 +01:00
jojo61
a222f6a1d5 Fix Makefile 2024-01-30 17:11:16 +01:00
jojo61
b51589aaa9 Fix Makefile (remove placebo default) 2024-01-30 17:07:53 +01:00
jojo61
c3af54aae0 Merge pull request #69 from tmn505/pkg-config
Use pkg-config for most configuration
2024-01-30 16:59:50 +01:00
Joachim König
7e387fa3f1 Enable Fastscale for vdr 2.6.6 2024-01-25 13:00:58 +01:00
Joachim König
f3e5a14fdf Move flush for libplacebo for PIP 2024-01-20 11:01:39 +01:00
Joachim König
aa0c2f80e4 Fix Renderproblem with libplacebo 2024-01-20 10:32:24 +01:00
Joachim König
215f251572 Update README 2024-01-20 09:04:17 +01:00
Joachim König
a425ec94e0 too much ) 2024-01-20 08:44:38 +01:00
Joachim König
91961bdffe Update for libplacebo API Version 342 2024-01-19 11:45:54 +01:00
Joachim König
f741dff042 Cleanup of broken mpeg fix 2024-01-19 09:45:14 +01:00
Joachim König
7a31761c89 Fix broken mpeg2 streams 2024-01-17 11:52:05 +01:00
Joachim König
d5ca73c22f Fix handling of vaapi filehandles 2024-01-11 10:59:09 +01:00
jojo61
6704b2ca5a Fix channelswitch with YADIF deinterlacer 2023-09-22 12:00:08 +02:00
jojo61
e0bbaceec0 Enable Yadif in Makefile
Reverse Bob for mpeg2
2023-09-20 12:43:52 +02:00
jojo61
45043b9ffc Changes for NVIDIA 535 and more for PIP with placebo 2023-09-18 11:52:03 +02:00
jojo61
a56b3737c7 Small Fix for PIP 2023-08-22 11:40:04 +02:00
jojo61
e59eeba0d2 Fix for Layer0 Pixmap alpha 2023-08-07 13:46:33 +02:00
jojo61
838dfab45b Fix PIP for cuvid (unstable) 2023-08-07 13:12:22 +02:00
jojo61
ddd44e6f62 Update README 2023-07-16 12:04:00 +02:00
jojo61
1390139cbd Disable Alsa Test with -w alsa-no-test 2023-07-16 10:07:21 +02:00
jojo61
f72653c3c1 Enable ALSA Test on start for Multi PCM. 2023-07-15 17:11:48 +02:00
jojo61
4b9cd22405 More changes for placebo API 292 2023-07-14 14:14:19 +02:00
jojo61
38bda0c834 Support libplacebo up to API 292 2023-07-14 10:46:25 +02:00
jojo61
45c86f12dd Use first Connector with EDID Data for drm output. 2023-07-14 10:41:41 +02:00
jojo61
e2e9ae94d7 Disable use of HBR for DD+ 2023-07-14 09:15:34 +02:00
jojo61
4837f7fa35 Fix Thread locking for softhddrm Version with placebo 2023-07-14 09:13:09 +02:00
jojo61
7f054f8320 OPENGLOSD: early break on no text draw 2023-05-25 13:57:15 +02:00
jojo61
ad7acde1f4 OPENGLOSD: don't draw if nothin to draw 2023-05-25 12:56:35 +02:00
jojo61
e5c48a4bb7 Update Version 2023-04-23 11:09:08 +02:00
jojo61
fb67617d63 Make Switch for AES Paramters
Change VAAPI Lock
2023-04-23 11:07:09 +02:00
jojo61
8aa807eec6 Disable vaapi Lock only with placebo 2023-04-22 13:07:57 +02:00
jojo61
0621ed064d Set AES Parameter for SPDIF 2023-04-22 09:57:00 +02:00
jojo61
9219f06c5a Remove vaapi Lock for DRM 2023-04-21 12:22:44 +02:00
Tomasz Maciej Nowak
4e96489e35 Query pkg-config for libplacebo library location
The location of libplacebo could vary between systems, as it's
fast-changing library with very dynamic API. This could force having
various versions on the system for different applications. Use
pkg-config to provide location of targeted libplacebo version, by
providing custom PKG_CONFIG_PATH environmet variable.
2023-02-18 17:08:58 +01:00
Tomasz Maciej Nowak
65017da5ac Provide linked libs by querying pkg-config 2023-02-18 17:08:58 +01:00
jojo61
7b41b9b45a Support libplacebo API 229 2023-02-18 08:45:32 +01:00
jojo61
58c39d51f4 Fix Make with LIBPLACBEO_GL
No LUT with HLG Video
2023-02-16 12:50:57 +01:00
jojo61
d78e905411 Update libplacebo link in README 2023-02-15 16:03:10 +01:00
jojo61
7b10c2d0a3 Update for libplacebo API 246 2023-02-15 15:58:51 +01:00
jojo61
9714824a5a Fix non placebo Version for newer INTEL GPUs (A380) 2023-02-15 13:06:44 +01:00
jojo61
3e9b909685 More FFMPEG fixes and Version update 2023-02-13 12:01:15 +01:00
jojo61
464f7de014 Update README with link to libplacebo 2023-02-13 10:48:30 +01:00
jojo61
da33b90f94 Update for latest FFMPEG 2023-02-13 10:11:12 +01:00
jojo61
90194d4b6c Fix for pts (fixed hang at the end when playing records). Version 3.7.5 2022-12-19 09:17:34 +01:00
jojo61
45a83eaa3f Fix Connector Search for DRM
More debug prints in syslog
2022-12-09 11:27:57 +01:00
jojo61
37f87e2511 Reenable Alsa Set Audio 2022-10-19 16:54:45 +02:00
jojo61
bd9184db01 Reenable Alsa Set Volume 2022-10-19 16:53:08 +02:00
jojo61
101bffd01f Merge branch 'master' of github.com:jojo61/vdr-plugin-softhdcuvid 2022-10-19 16:48:11 +02:00
jojo61
43085a3608 Reenable Alsa Set Volume 2022-10-19 16:47:32 +02:00
jojo61
3de7a17105 Merge pull request #65 from dnehring7/master
Remove RASPI support
2022-10-04 13:04:47 +02:00
dnehring7
c229e77151 Merge branch 'jojo61:master' into master 2022-10-03 12:27:16 +02:00
jojo61
af370721d4 Fix Audio for NUC11 2022-09-24 14:59:46 +02:00
jojo61
79fa8efc6a Fix E-AC3 Parser 2022-09-20 15:05:18 +02:00
jojo61
d5dec38d62 remove glxMakeCurrent 2022-07-09 12:52:28 +02:00
Dirk Nehring
74847c9bed Remove RASPI support 2022-05-24 00:09:55 +02:00
12 changed files with 716 additions and 474 deletions

View File

@@ -24,18 +24,17 @@ DRM ?= 0
# use libplacebo - # use libplacebo -
# available for all decoders but for DRM you need LIBPLACEBO_GL # available for all decoders but for DRM you need LIBPLACEBO_GL
LIBPLACEBO ?= 1 LIBPLACEBO ?= 0
LIBPLACEBO_GL ?= 0 LIBPLACEBO_GL ?= 0
# use YADIF deint - only available with cuvid # use YADIF deint - only available with cuvid
#YADIF = 1 YADIF = 1
# use gamma correction # use gamma correction
#GAMMA ?= 0 #GAMMA ?= 0
CONFIG := -DDEBUG # remove '#' to enable debug output CONFIG := -DDEBUG # remove '#' to enable debug output
#--------------------- no more config needed past this point-------------------------------- #--------------------- no more config needed past this point--------------------------------
# sanitize selections -------- # sanitize selections --------
@@ -159,29 +158,29 @@ endif
ifeq ($(LIBPLACEBO_GL),1) ifeq ($(LIBPLACEBO_GL),1)
CONFIG += -DPLACEBO_GL -DPLACEBO CONFIG += -DPLACEBO_GL -DPLACEBO
LIBS += -lepoxy _CFLAGS += $(shell pkg-config --cflags libplacebo)
LIBS += -lplacebo LIBS += $(shell pkg-config --libs epoxy libplacebo)
else else
LIBS += -lEGL LIBS += $(shell pkg-config --libs egl)
endif endif
ifeq ($(LIBPLACEBO),1) ifeq ($(LIBPLACEBO),1)
CONFIG += -DPLACEBO CONFIG += -DPLACEBO
LIBS += -lEGL _CFLAGS += $(shell pkg-config --cflags libplacebo)
LIBS += -lplacebo LIBS += $(shell pkg-config --libs egl libplacebo)
endif endif
ifeq ($(DRM),1) ifeq ($(DRM),1)
PLUGIN = softhddrm PLUGIN = softhddrm
CONFIG += -DUSE_DRM -DVAAPI CONFIG += -DUSE_DRM -DVAAPI
_CFLAGS += $(shell pkg-config --cflags libdrm) _CFLAGS += $(shell pkg-config --cflags libdrm)
LIBS += -lgbm -ldrm -lEGL LIBS += $(shell pkg-config --libs egl gbm libdrm)
endif endif
ifeq ($(CUVID),1) ifeq ($(CUVID),1)
#CONFIG += -DUSE_PIP # PIP support #CONFIG += -DUSE_PIP # PIP support
CONFIG += -DCUVID # enable CUVID decoder CONFIG += -DCUVID # enable CUVID decoder
LIBS += -lEGL -lGL LIBS += $(shell pkg-config --libs egl gl)
ifeq ($(YADIF),1) ifeq ($(YADIF),1)
CONFIG += -DYADIF # Yadif only with CUVID CONFIG += -DYADIF # Yadif only with CUVID
endif endif
@@ -274,6 +273,7 @@ LIBS += -lcuda -lnvcuvid
endif endif
LIBS += -lGLEW -lGLU -ldl -lglut LIBS += -lGLEW -lGLU -ldl -lglut
#LIBS += -ldl $(shell pkg-config --libs glew glu glut)
### Includes and Defines (add further entries here): ### Includes and Defines (add further entries here):

View File

@@ -37,7 +37,6 @@ A software and GPU emulated UHD output device plugin for VDR.
o PIP (Picture-in-Picture) (only for CUVID) o PIP (Picture-in-Picture) (only for CUVID)
To compile you must have the 'requires' installed.
This is a fork of johns original softhddevice work and I reworked it 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.
@@ -83,7 +82,6 @@ You have to adapt the Makefile. There are 3 possible Version that you can build:
runs without X Server. There are several commandline options to select the resolution and refresh rate. runs without X Server. There are several commandline options to select the resolution and refresh rate.
I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile. I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
Libplacebo API Version >= 113 is needed.
Install: Install:
@@ -122,6 +120,9 @@ Beginners Guide for libplacebo:
All other settings can be in their default state. All other settings can be in their default state.
Note for NUC11/12 Users:
Provide paramete -w alsa-no-test to get Audio working.
Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader. Beginning with libplacebo API 58 user shaders from mpv are supported. Use -S parameter to set the shader.
The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is The plugins searches the shaders in $ConfigDir/plugins/shaders for the shaders. One example shader is
provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start provided in the shader subdirectory. Copy it to e.g.: /etc/vdr/plugins/shaders and then start

285
audio.c
View File

@@ -93,6 +93,7 @@ static const AudioModule NoopModule; ///< forward definition of noop module
// Variables // Variables
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
char AudioAlsaNotest; ///< disable Audio capbility test
char AudioAlsaDriverBroken; ///< disable broken driver message char AudioAlsaDriverBroken; ///< disable broken driver message
char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
@@ -927,6 +928,7 @@ static snd_pcm_t *AlsaOpenPCM(int passthrough) {
const char *device; const char *device;
snd_pcm_t *handle; snd_pcm_t *handle;
int err; int err;
char tmp[80];
// &&|| hell // &&|| hell
if (!(passthrough && ((device = AudioPassthroughDevice) || (device = getenv("ALSA_PASSTHROUGH_DEVICE")))) && if (!(passthrough && ((device = AudioPassthroughDevice) || (device = getenv("ALSA_PASSTHROUGH_DEVICE")))) &&
@@ -936,30 +938,42 @@ static snd_pcm_t *AlsaOpenPCM(int passthrough) {
if (!AudioDoingInit) { // reduce blabla during init if (!AudioDoingInit) { // reduce blabla during init
Info(_("audio/alsa: using %sdevice '%s'\n"), passthrough ? "pass-through " : "", device); Info(_("audio/alsa: using %sdevice '%s'\n"), passthrough ? "pass-through " : "", device);
} }
//printf("audio/alsa: using %sdevice '%s'\n", passthrough ? "pass-through " : "", device);
// //
// for AC3 pass-through try to set the non-audio bit, use AES0=6 // for AC3 pass-through try to set the non-audio bit, use AES0=6
// //
if (passthrough && AudioAppendAES) { if (passthrough && AudioAppendAES) {
#if 0 if (!(strchr(device, ':'))) {
// FIXME: not yet finished sprintf(tmp,
char *buf; //"AES0=%d,AES1=%d,AES2=0,AES3=%d",
const char *s; "%s:AES0=%d,AES1=%d,AES2=0",
int n; device,
IEC958_AES0_NONAUDIO | IEC958_AES0_PRO_EMPHASIS_NONE,
n = strlen(device); IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER);
buf = alloca(n + sizeof(":AES0=6") + 1); //map_iec958_srate(ao->samplerate));
strcpy(buf, device); }
if (!(s = strchr(buf, ':'))) { else {
// no alsa parameters sprintf(tmp,
strcpy(buf + n, ":AES=6"); //"AES0=%d,AES1=%d,AES2=0,AES3=%d",
} "%s,AES0=%d,AES1=%d,AES2=0",
Debug(3, "audio/alsa: try '%s'\n", buf); device,
#endif IEC958_AES0_NONAUDIO | IEC958_AES0_PRO_EMPHASIS_NONE,
} IEC958_AES1_CON_ORIGINAL | IEC958_AES1_CON_PCM_CODER);
// open none blocking; if device is already used, we don't want wait //map_iec958_srate(ao->samplerate));
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) { }
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL; printf( "opening device '%s' => '%s'\n", device, tmp);
if ((err = snd_pcm_open(&handle, tmp, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0 ) {
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL;
}
} else {
// open none blocking; if device is already used, we don't want wait
if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK)) < 0) {
Error(_("audio/alsa: playback open '%s' error: %s\n"), device, snd_strerror(err));
return NULL;
}
} }
if ((err = snd_pcm_nonblock(handle, 0)) < 0) { if ((err = snd_pcm_nonblock(handle, 0)) < 0) {
@@ -2173,126 +2187,145 @@ found:
AudioDoingInit = 1; AudioDoingInit = 1;
AudioRingInit(); AudioRingInit();
AudioUsedModule->Init(); AudioUsedModule->Init();
//
// Check which channels/rates/formats are supported
// FIXME: we force 44.1Khz and 48Khz must be supported equal
// FIXME: should use bitmap of channels supported in RatesInHw
// FIXME: use loop over sample-rates
freq = 44100;
AudioRatesInHw[Audio44100] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
tchan = chan; if (AudioAlsaNotest) {
tfreq = freq; for (u = 0; u < AudioRatesMax; ++u) {
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
AudioChannelsInHw[chan] = 0; AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=2;
} else { AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=4;
AudioChannelsInHw[chan] = chan; AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=6;
AudioRatesInHw[Audio44100] |= (1 << chan); AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=8;
} printf("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
} AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
freq = 48000; AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
AudioRatesInHw[Audio48000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) {
continue;
} }
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio48000] |= (1 << chan);
}
}
freq = 192000;
AudioRatesInHw[Audio192000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) { AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
continue; AudioChannelsInHw[2]=2;
}
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio192000] |= (1 << chan);
}
} }
// build channel support and conversion table else {
for (u = 0; u < AudioRatesMax; ++u) { //
// Check which channels/rates/formats are supported
// FIXME: we force 44.1Khz and 48Khz must be supported equal
// FIXME: should use bitmap of channels supported in RatesInHw
// FIXME: use loop over sample-rates
freq = 44100;
AudioRatesInHw[Audio44100] = 0;
for (chan = 1; chan < 9; ++chan) { for (chan = 1; chan < 9; ++chan) {
AudioChannelMatrix[u][chan] = 0; int tchan;
if (!AudioRatesInHw[u]) { // rate unsupported int tfreq;
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio44100] |= (1 << chan);
}
}
freq = 48000;
AudioRatesInHw[Audio48000] = 0;
for (chan = 1; chan < 9; ++chan) {
int tchan;
int tfreq;
if (!AudioChannelsInHw[chan]) {
continue; continue;
} }
if (AudioChannelsInHw[chan]) { tchan = chan;
AudioChannelMatrix[u][chan] = chan; tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else { } else {
switch (chan) { AudioChannelsInHw[chan] = chan;
case 1: AudioRatesInHw[Audio48000] |= (1 << chan);
if (AudioChannelsInHw[2]) { }
AudioChannelMatrix[u][chan] = 2; }
} freq = 192000;
break; AudioRatesInHw[Audio192000] = 0;
case 2: for (chan = 1; chan < 9; ++chan) {
case 3: int tchan;
if (AudioChannelsInHw[4]) { int tfreq;
AudioChannelMatrix[u][chan] = 4;
if (!AudioChannelsInHw[chan]) {
continue;
}
tchan = chan;
tfreq = freq;
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
// AudioChannelsInHw[chan] = 0;
} else {
AudioChannelsInHw[chan] = chan;
AudioRatesInHw[Audio192000] |= (1 << chan);
}
}
// build channel support and conversion table
for (u = 0; u < AudioRatesMax; ++u) {
for (chan = 1; chan < 9; ++chan) {
AudioChannelMatrix[u][chan] = 0;
if (!AudioRatesInHw[u]) { // rate unsupported
continue;
}
if (AudioChannelsInHw[chan]) {
AudioChannelMatrix[u][chan] = chan;
} else {
switch (chan) {
case 1:
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
}
break; break;
} case 2:
case 4: case 3:
if (AudioChannelsInHw[5]) { if (AudioChannelsInHw[4]) {
AudioChannelMatrix[u][chan] = 5; AudioChannelMatrix[u][chan] = 4;
break;
}
case 4:
if (AudioChannelsInHw[5]) {
AudioChannelMatrix[u][chan] = 5;
break;
}
case 5:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
case 6:
if (AudioChannelsInHw[7]) {
AudioChannelMatrix[u][chan] = 7;
break;
}
case 7:
if (AudioChannelsInHw[8]) {
AudioChannelMatrix[u][chan] = 8;
break;
}
case 8:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
break;
}
if (AudioChannelsInHw[1]) {
AudioChannelMatrix[u][chan] = 1;
break;
}
break; break;
} }
case 5:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
case 6:
if (AudioChannelsInHw[7]) {
AudioChannelMatrix[u][chan] = 7;
break;
}
case 7:
if (AudioChannelsInHw[8]) {
AudioChannelMatrix[u][chan] = 8;
break;
}
case 8:
if (AudioChannelsInHw[6]) {
AudioChannelMatrix[u][chan] = 6;
break;
}
if (AudioChannelsInHw[2]) {
AudioChannelMatrix[u][chan] = 2;
break;
}
if (AudioChannelsInHw[1]) {
AudioChannelMatrix[u][chan] = 1;
break;
}
break;
} }
} }
} }
} for (u = 0; u < AudioRatesMax; ++u) {
for (u = 0; u < AudioRatesMax; ++u) { Debug(3,"audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n", AudioRatesTable[u],
Info(_("audio: %6dHz supports %d %d %d %d %d %d %d %d channels\n"), AudioRatesTable[u], AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4],
AudioChannelMatrix[u][1], AudioChannelMatrix[u][2], AudioChannelMatrix[u][3], AudioChannelMatrix[u][4], AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]); }
} }
#ifdef USE_AUDIO_THREAD #ifdef USE_AUDIO_THREAD
if (AudioUsedModule->Thread) { // supports threads if (AudioUsedModule->Thread) { // supports threads

View File

@@ -60,6 +60,7 @@ extern void AudioExit(void); ///< cleanup and exit audio module
// Variables // Variables
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
extern char AudioAlsaNotest; ///< disable Alsa capability test
extern char AudioAlsaDriverBroken; ///< disable broken driver message extern char AudioAlsaDriverBroken; ///< disable broken driver message
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix

104
codec.c
View File

@@ -234,20 +234,6 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
break; break;
} }
} }
#endif
#ifdef RASPI
switch (codec_id) {
case AV_CODEC_ID_MPEG2VIDEO:
name = "mpeg2_v4l2m2m";
break;
case AV_CODEC_ID_H264:
name = "h264_v4l2m2m";
// name = "h264_mmal";
break;
case AV_CODEC_ID_HEVC:
name = "hevc_v4l2m2m";
break;
}
#endif #endif
if (name && (video_codec = avcodec_find_decoder_by_name(name))) { if (name && (video_codec = avcodec_find_decoder_by_name(name))) {
Debug(3, "codec: decoder found\n"); Debug(3, "codec: decoder found\n");
@@ -264,31 +250,27 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
Fatal(_("codec: can't allocate video codec context\n")); Fatal(_("codec: can't allocate video codec context\n"));
} }
#ifndef RASPI
if (!HwDeviceContext) { if (!HwDeviceContext) {
Fatal("codec: no hw device context to be used"); Fatal("codec: no hw device context to be used");
} }
decoder->VideoCtx->hw_device_ctx = av_buffer_ref(HwDeviceContext); decoder->VideoCtx->hw_device_ctx = av_buffer_ref(HwDeviceContext);
#else
decoder->VideoCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME; /* request a DRM frame */
// decoder->VideoCtx->pix_fmt = AV_PIX_FMT_MMAL; /* request a DRM frame
//*/
#endif
// FIXME: for software decoder use all cpus, otherwise 1 // FIXME: for software decoder use all cpus, otherwise 1
decoder->VideoCtx->thread_count = 1; decoder->VideoCtx->thread_count = 1;
decoder->VideoCtx->pkt_timebase.num = 1; decoder->VideoCtx->pkt_timebase.num = 1;
decoder->VideoCtx->pkt_timebase.den = 90000; decoder->VideoCtx->pkt_timebase.den = 90000;
decoder->VideoCtx->framerate.num = 50; //decoder->VideoCtx->framerate.num = 50;
decoder->VideoCtx->framerate.den = 1; //decoder->VideoCtx->framerate.den = 1;
pthread_mutex_lock(&CodecLockMutex); pthread_mutex_lock(&CodecLockMutex);
// open codec // open codec
#ifdef YADIF #ifdef YADIF
deint = 2; deint = 2;
#endif #endif
#if defined VAAPI && !defined RASPI
#if defined VAAPI
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100)
// decoder->VideoCtx->extra_hw_frames = 8; // VIDEO_SURFACES_MAX +1 // decoder->VideoCtx->extra_hw_frames = 8; // VIDEO_SURFACES_MAX +1
if (video_codec->capabilities & (AV_CODEC_CAP_AUTO_THREADS)) { if (video_codec->capabilities & (AV_CODEC_CAP_AUTO_THREADS)) {
Debug(3, "codec: auto threads enabled"); Debug(3, "codec: auto threads enabled");
@@ -299,6 +281,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
Debug(3, "codec: supports truncated packets"); Debug(3, "codec: supports truncated packets");
// decoder->VideoCtx->flags |= CODEC_FLAG_TRUNCATED; // decoder->VideoCtx->flags |= CODEC_FLAG_TRUNCATED;
} }
#endif
// FIXME: own memory management for video frames. // FIXME: own memory management for video frames.
if (video_codec->capabilities & AV_CODEC_CAP_DR1) { if (video_codec->capabilities & AV_CODEC_CAP_DR1) {
Debug(3, "codec: can use own buffer management"); Debug(3, "codec: can use own buffer management");
@@ -315,22 +298,10 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
} }
// if (av_opt_set_int(decoder->VideoCtx, "refcounted_frames", 1, 0) < 0) // if (av_opt_set_int(decoder->VideoCtx, "refcounted_frames", 1, 0) < 0)
// Fatal(_("VAAPI Refcounts invalid\n")); // Fatal(_("VAAPI Refcounts invalid\n"));
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100)
decoder->VideoCtx->thread_safe_callbacks = 0; decoder->VideoCtx->thread_safe_callbacks = 0;
#endif #endif
#ifdef RASPI
decoder->VideoCtx->codec_id = codec_id;
decoder->VideoCtx->flags |= AV_CODEC_FLAG_BITEXACT;
if (video_codec->capabilities & AV_CODEC_CAP_FRAME_THREADS || AV_CODEC_CAP_SLICE_THREADS) {
Debug(3, "codec: supports frame threads");
decoder->VideoCtx->thread_count = 4;
// decoder->VideoCtx->thread_type |= FF_THREAD_FRAME;
}
if (video_codec->capabilities & AV_CODEC_CAP_SLICE_THREADS) {
Debug(3, "codec: supports slice threads");
decoder->VideoCtx->thread_type |= FF_THREAD_SLICE;
}
#endif #endif
#ifdef CUVID #ifdef CUVID
@@ -340,12 +311,12 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option deint to video codec!\n")); Fatal(_("codec: can't set option deint to video codec!\n"));
} }
#if 1
if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 9, 0) < 0) { if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 10, 0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option surfces to video codec!\n")); Fatal(_("codec: can't set option surfces to video codec!\n"));
} }
#endif
if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) { if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option drop 2.field to video codec!\n")); Fatal(_("codec: can't set option drop 2.field to video codec!\n"));
@@ -355,12 +326,10 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option deint to video codec!\n")); Fatal(_("codec: can't set option deint to video codec!\n"));
} }
#if 1
if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 13, 0) < 0) { if (av_opt_set_int(decoder->VideoCtx->priv_data, "surfaces", 13, 0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option surfces to video codec!\n")); Fatal(_("codec: can't set option surfces to video codec!\n"));
} }
#endif
if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) { if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false", 0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); pthread_mutex_unlock(&CodecLockMutex);
Fatal(_("codec: can't set option drop 2.field to video codec!\n")); Fatal(_("codec: can't set option drop 2.field to video codec!\n"));
@@ -401,7 +370,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
// reset buggy ffmpeg/libav flag // reset buggy ffmpeg/libav flag
decoder->GetFormatDone = 0; decoder->GetFormatDone = 0;
#if defined(YADIF) || defined(RASPI) #if defined(YADIF)
decoder->filter = 0; decoder->filter = 0;
#endif #endif
} }
@@ -521,8 +490,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
decoder->filter = 2; decoder->filter = 2;
} }
} }
if (frame->interlaced_frame && decoder->filter == 2 && if (decoder->filter == 2) {
(frame->height != 720)) { // broken ZDF sends Interlaced flag
push_filters(video_ctx, decoder->HwDecoder, frame); push_filters(video_ctx, decoder->HwDecoder, frame);
continue; continue;
} }
@@ -554,7 +522,6 @@ next_part:
pkt = avpkt; // use copy pkt = avpkt; // use copy
got_frame = 0; got_frame = 0;
// printf("decode packet %d\n",(GetusTicks()-first_time)/1000000);
ret1 = avcodec_send_packet(video_ctx, pkt); ret1 = avcodec_send_packet(video_ctx, pkt);
// first_time = GetusTicks(); // first_time = GetusTicks();
@@ -574,12 +541,12 @@ next_part:
frame = av_frame_alloc(); frame = av_frame_alloc();
ret = avcodec_receive_frame(video_ctx, frame); // get new frame ret = avcodec_receive_frame(video_ctx, frame); // get new frame
if (ret >= 0) { // one is avail. if (ret >= 0) { // one is avail.
first_time = frame->pts;
got_frame = 1; got_frame = 1;
} else { } else {
got_frame = 0; got_frame = 0;
} }
// printf("got %s packet from //printf("got %s packet from decoder\n",got_frame?"1":"no");
// decoder\n",got_frame?"1":"no");
if (got_frame) { // frame completed if (got_frame) { // frame completed
// printf("video frame pts %#012" PRIx64 " // printf("video frame pts %#012" PRIx64 "
//%dms\n",frame->pts,(int)(apts - frame->pts) / 90); //%dms\n",frame->pts,(int)(apts - frame->pts) / 90);
@@ -587,15 +554,14 @@ next_part:
if (decoder->filter) { if (decoder->filter) {
if (decoder->filter == 1) { if (decoder->filter == 1) {
if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) { if (init_filters(video_ctx, decoder->HwDecoder, frame) < 0) {
Fatal(_("video: Init of YADIF Filter failed\n")); Debug(3,"video: Init of YADIF Filter failed\n");
decoder->filter = 0; decoder->filter = 0;
} else { } else {
Debug(3, "Init YADIF ok\n"); Debug(3, "Init YADIF ok\n");
decoder->filter = 2; decoder->filter = 2;
} }
} }
if (frame->interlaced_frame && decoder->filter == 2 && if (decoder->filter == 2) {
(frame->height != 720)) { // broken ZDF sends Interlaced flag
ret = push_filters(video_ctx, decoder->HwDecoder, frame); ret = push_filters(video_ctx, decoder->HwDecoder, frame);
// av_frame_unref(frame); // av_frame_unref(frame);
continue; continue;
@@ -750,9 +716,6 @@ void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
Fatal(_("codec: can't allocate audio codec context\n")); Fatal(_("codec: can't allocate audio codec context\n"));
} }
if (CodecDownmix) {
audio_decoder->AudioCtx->request_channel_layout = AV_CH_LAYOUT_STEREO;
}
pthread_mutex_lock(&CodecLockMutex); pthread_mutex_lock(&CodecLockMutex);
// open codec // open codec
if (1) { if (1) {
@@ -905,7 +868,7 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
int err; int err;
audio_ctx = audio_decoder->AudioCtx; audio_ctx = audio_decoder->AudioCtx;
Debug(3, "codec/audio: format change %s %dHz *%d channels%s%s%s%s%s\n", Debug(3, "codec/audio: Chanlayout %lx format change %s %dHz *%d channels%s%s%s%s%s\n",audio_ctx->channel_layout,
av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate, audio_ctx->channels, av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate, audio_ctx->channels,
CodecPassthrough & CodecPCM ? " PCM" : "", CodecPassthrough & CodecMPA ? " MPA" : "", CodecPassthrough & CodecPCM ? " PCM" : "", CodecPassthrough & CodecMPA ? " MPA" : "",
CodecPassthrough & CodecAC3 ? " AC-3" : "", CodecPassthrough & CodecEAC3 ? " E-AC-3" : "", CodecPassthrough & CodecAC3 ? " AC-3" : "", CodecPassthrough & CodecEAC3 ? " E-AC-3" : "",
@@ -915,7 +878,7 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
audio_decoder->SampleRate = audio_ctx->sample_rate; audio_decoder->SampleRate = audio_ctx->sample_rate;
audio_decoder->HwSampleRate = audio_ctx->sample_rate; audio_decoder->HwSampleRate = audio_ctx->sample_rate;
audio_decoder->Channels = audio_ctx->channels; audio_decoder->Channels = audio_ctx->channels;
audio_decoder->HwChannels = audio_ctx->channels; audio_decoder->HwChannels = CodecDownmix ? 2 : audio_ctx->channels;
audio_decoder->Passthrough = CodecPassthrough; audio_decoder->Passthrough = CodecPassthrough;
// SPDIF/HDMI pass-through // SPDIF/HDMI pass-through
@@ -923,7 +886,7 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
(CodecPassthrough & CodecEAC3 && audio_ctx->codec_id == AV_CODEC_ID_EAC3)) { (CodecPassthrough & CodecEAC3 && audio_ctx->codec_id == AV_CODEC_ID_EAC3)) {
if (audio_ctx->codec_id == AV_CODEC_ID_EAC3) { if (audio_ctx->codec_id == AV_CODEC_ID_EAC3) {
// E-AC-3 over HDMI some receivers need HBR // E-AC-3 over HDMI some receivers need HBR
audio_decoder->HwSampleRate *= 4; //audio_decoder->HwSampleRate *= 4;
} }
audio_decoder->HwChannels = 2; audio_decoder->HwChannels = 2;
audio_decoder->SpdifIndex = 0; // reset buffer audio_decoder->SpdifIndex = 0; // reset buffer
@@ -1195,14 +1158,29 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
} }
#endif #endif
audio_decoder->Resample = swr_alloc_set_opts(audio_decoder->Resample, audio_ctx->channel_layout, AV_SAMPLE_FMT_S16, #if LIBSWRESAMPLE_VERSION_INT < AV_VERSION_INT(4,5,100)
audio_decoder->HwSampleRate, audio_ctx->channel_layout, audio_decoder->Resample = swr_alloc_set_opts(audio_decoder->Resample,
audio_ctx->sample_fmt, audio_ctx->sample_rate, 0, NULL); CodecDownmix ? AV_CH_LAYOUT_STEREO : audio_ctx->channel_layout,
AV_SAMPLE_FMT_S16, audio_decoder->HwSampleRate,
audio_ctx->channel_layout, audio_ctx->sample_fmt,audio_ctx->sample_rate,
0, NULL);
#else
//printf("last ressort downmix Layout in %lx Lyout out: %llx \n",audio_ctx->channel_layout,AV_CH_LAYOUT_STEREO);
audio_decoder->Resample = swr_alloc();
av_opt_set_channel_layout(audio_decoder->Resample, "in_channel_layout",audio_ctx->channel_layout, 0);
av_opt_set_channel_layout(audio_decoder->Resample, "out_channel_layout", CodecDownmix ? AV_CH_LAYOUT_STEREO : audio_ctx->channel_layout , 0);
av_opt_set_int(audio_decoder->Resample, "in_sample_rate", audio_ctx->sample_rate, 0);
av_opt_set_int(audio_decoder->Resample, "out_sample_rate", audio_ctx->sample_rate, 0);
av_opt_set_sample_fmt(audio_decoder->Resample, "in_sample_fmt", audio_ctx->sample_fmt, 0);
av_opt_set_sample_fmt(audio_decoder->Resample, "out_sample_fmt", AV_SAMPLE_FMT_S16, 0);
#endif
if (audio_decoder->Resample) { if (audio_decoder->Resample) {
swr_init(audio_decoder->Resample); swr_init(audio_decoder->Resample);
} else { } else {
Error(_("codec/audio: can't setup resample\n")); Error(_("codec/audio: can't setup resample\n"));
} }
} }
/** /**
@@ -1254,13 +1232,15 @@ void CodecAudioDecode(AudioDecoder *audio_decoder, const AVPacket *avpkt) {
if (CodecAudioPassthroughHelper(audio_decoder, avpkt)) { if (CodecAudioPassthroughHelper(audio_decoder, avpkt)) {
return; return;
} }
if (audio_decoder->Resample) { if (audio_decoder->Resample) {
uint8_t outbuf[8192 * 2 * 8]; uint8_t outbuf[8192 * 2 * 8];
uint8_t *out[1]; uint8_t *out[1];
out[0] = outbuf; out[0] = outbuf;
ret = swr_convert(audio_decoder->Resample, out, sizeof(outbuf) / (2 * audio_decoder->HwChannels), ret = swr_convert(audio_decoder->Resample, out, sizeof(outbuf) / (2 * audio_decoder->HwChannels),
(const uint8_t **)frame->extended_data, frame->nb_samples); (const uint8_t **)frame->extended_data, frame->nb_samples);
if (ret > 0) { if (ret > 0) {
if (!(audio_decoder->Passthrough & CodecPCM)) { if (!(audio_decoder->Passthrough & CodecPCM)) {
CodecReorderAudioFrame((int16_t *)outbuf, ret * 2 * audio_decoder->HwChannels, CodecReorderAudioFrame((int16_t *)outbuf, ret * 2 * audio_decoder->HwChannels,

60
drm.c
View File

@@ -168,6 +168,7 @@ void set_video_mode(int width, int height) {
drmModeConnector *connector; drmModeConnector *connector;
drmModeModeInfo *mode; drmModeModeInfo *mode;
int ii; int ii;
printf("Set video mode %d &%d\n",width,height);
if (height != 1080 && height != 2160) if (height != 1080 && height != 2160)
return; return;
connector = drmModeGetConnector(render->fd_drm, render->connector_id); connector = drmModeGetConnector(render->fd_drm, render->connector_id);
@@ -206,11 +207,7 @@ static int FindDevice(VideoRender *render) {
int i, ii = 0; int i, ii = 0;
char connectorstr[10]; char connectorstr[10];
int found = 0; int found = 0;
#ifdef RASPI
render->fd_drm = open("/dev/dri/card1", O_RDWR);
#else
render->fd_drm = open("/dev/dri/card0", O_RDWR); render->fd_drm = open("/dev/dri/card0", O_RDWR);
#endif
if (render->fd_drm < 0) { if (render->fd_drm < 0) {
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n"); fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n");
return -errno; return -errno;
@@ -278,10 +275,12 @@ static int FindDevice(VideoRender *render) {
connector->connector_type_id); connector->connector_type_id);
printf("Connector >%s< is %sconnected\n", connectorstr, printf("Connector >%s< is %sconnected\n", connectorstr,
connector->connection == DRM_MODE_CONNECTED ? "" : "not "); connector->connection == DRM_MODE_CONNECTED ? "" : "not ");
Debug(3,"Connector >%s< is %sconnected\n", connectorstr,
connector->connection == DRM_MODE_CONNECTED ? "" : "not ");
if (DRMConnector && strcmp(DRMConnector, connectorstr)) if (DRMConnector && strcmp(DRMConnector, connectorstr))
continue; continue;
if (connector->connection == DRM_MODE_CONNECTED && connector->count_modes > 0) { if (/*connector->connection == DRM_MODE_CONNECTED && */ connector->count_modes > 0) {
float aspect = (float)connector->mmWidth / (float)connector->mmHeight; float aspect = (float)connector->mmWidth / (float)connector->mmHeight;
if ((aspect > 1.70) && (aspect < 1.85)) { if ((aspect > 1.70) && (aspect < 1.85)) {
render->mmHeight = 90; render->mmHeight = 90;
@@ -309,7 +308,7 @@ static int FindDevice(VideoRender *render) {
mode = &connector->modes[ii]; mode = &connector->modes[ii];
printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh); printf("Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
Debug(3,"Mode %d %dx%d Rate %d\n", ii, mode->hdisplay, mode->vdisplay, mode->vrefresh);
if (VideoWindowWidth && VideoWindowHeight) { // preset by command line if (VideoWindowWidth && VideoWindowHeight) { // preset by command line
if (VideoWindowWidth == mode->hdisplay && VideoWindowHeight == mode->vdisplay && if (VideoWindowWidth == mode->hdisplay && VideoWindowHeight == mode->vdisplay &&
mode->vrefresh == DRMRefresh && !(mode->flags & DRM_MODE_FLAG_INTERLACE)) { mode->vrefresh == DRMRefresh && !(mode->flags & DRM_MODE_FLAG_INTERLACE)) {
@@ -328,11 +327,16 @@ static int FindDevice(VideoRender *render) {
found = 1; found = 1;
i = resources->count_connectors; // uuuuhh i = resources->count_connectors; // uuuuhh
} }
VideoWindowWidth = render->mode.hdisplay;
VideoWindowHeight = render->mode.vdisplay; if (found) {
if (found) VideoWindowWidth = render->mode.hdisplay;
VideoWindowHeight = render->mode.vdisplay;
printf("Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay, printf("Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay,
render->mode.vrefresh); render->mode.vrefresh);
Debug(3,"Use Mode %d %dx%d Rate %d\n", ii, render->mode.hdisplay, render->mode.vdisplay,
render->mode.vrefresh);
}
drmModeFreeConnector(connector); drmModeFreeConnector(connector);
} }
if (!found) { if (!found) {
@@ -372,11 +376,7 @@ static int FindDevice(VideoRender *render) {
for (k = 0; k < plane->count_formats; k++) { for (k = 0; k < plane->count_formats; k++) {
if (encoder->possible_crtcs & plane->possible_crtcs) { if (encoder->possible_crtcs & plane->possible_crtcs) {
switch (plane->formats[k]) { switch (plane->formats[k]) {
#ifdef RASPI
case DRM_FORMAT_ARGB8888:
#else
case DRM_FORMAT_XRGB2101010: case DRM_FORMAT_XRGB2101010:
#endif
if (!render->video_plane) { if (!render->video_plane) {
render->video_plane = plane->plane_id; render->video_plane = plane->plane_id;
} }
@@ -492,6 +492,7 @@ static void drm_swap_buffers() {
uint32_t fb; uint32_t fb;
eglSwapBuffers(eglDisplay, eglSurface); eglSwapBuffers(eglDisplay, eglSurface);
usleep(1000);
struct gbm_bo *bo = gbm_surface_lock_front_buffer(gbm.surface); struct gbm_bo *bo = gbm_surface_lock_front_buffer(gbm.surface);
#if 1 #if 1
if (bo == NULL) if (bo == NULL)
@@ -544,6 +545,7 @@ static void drm_swap_buffers() {
m_need_modeset = 0; m_need_modeset = 0;
has_modeset = 1; has_modeset = 1;
} }
drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode); drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
if (previous_bo) { if (previous_bo) {
@@ -561,15 +563,16 @@ static void drm_clean_up() {
return; return;
Debug(3, "drm clean up\n"); Debug(3, "drm clean up\n");
drmModeSetCrtc(render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id, render->saved_crtc->x,
render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
drmModeFreeCrtc(render->saved_crtc);
if (previous_bo) { if (previous_bo) {
drmModeRmFB(render->fd_drm, previous_fb); drmModeRmFB(render->fd_drm, previous_fb);
gbm_surface_release_buffer(gbm.surface, previous_bo); gbm_surface_release_buffer(gbm.surface, previous_bo);
} }
drmModeSetCrtc(render->fd_drm, render->saved_crtc->crtc_id, render->saved_crtc->buffer_id, render->saved_crtc->x,
render->saved_crtc->y, &render->connector_id, 1, &render->saved_crtc->mode);
drmModeFreeCrtc(render->saved_crtc);
if (has_modeset) { if (has_modeset) {
drmModeAtomicReqPtr ModeReq; drmModeAtomicReqPtr ModeReq;
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET; const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
@@ -612,22 +615,29 @@ static void drm_clean_up() {
if (render->hdr_blob_id) if (render->hdr_blob_id)
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id); drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
render->hdr_blob_id = 0; render->hdr_blob_id = 0;
#if 0
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(eglDisplay, eglSurface); eglDestroySurface(eglDisplay, eglSurface);
EglCheck(); EglCheck();
gbm_surface_destroy(gbm.surface);
eglDestroyContext(eglDisplay, eglContext);
EglCheck();
eglDestroyContext(eglDisplay, eglSharedContext); eglDestroyContext(eglDisplay, eglSharedContext);
EglCheck(); EglCheck();
eglDestroyContext(eglDisplay, eglContext);
EglCheck();
eglSharedContext = NULL; eglSharedContext = NULL;
eglContext = NULL;
eglTerminate(eglDisplay); eglTerminate(eglDisplay);
EglCheck(); EglCheck();
eglDisplay = NULL;
#endif
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(eglDisplay, eglSurface);
EglCheck();
eglSurface = NULL;
gbm_surface_destroy(gbm.surface);
gbm_device_destroy(gbm.dev); gbm_device_destroy(gbm.dev);
drmDropMaster(render->fd_drm); drmDropMaster(render->fd_drm);
close(render->fd_drm); close(render->fd_drm);
eglDisplay = NULL;
free(render); free(render);
} render = NULL;
Debug(3, "nach drm clean up\n");
}

View File

@@ -20,12 +20,8 @@ void ConvertColor(const GLint &colARGB, glm::vec4 &col) {
#ifdef CUVID #ifdef CUVID
const char *glversion = "#version 330 core "; const char *glversion = "#version 330 core ";
#else #else
#ifdef RASPI
const char *glversion = "#version 300 es";
#else
const char *glversion = "#version 300 es "; const char *glversion = "#version 300 es ";
#endif #endif
#endif
const char *rectVertexShader = "%s\n \ const char *rectVertexShader = "%s\n \
\ \
@@ -730,14 +726,15 @@ bool cOglCmdDeleteFb::Execute(void) {
//------------------ cOglCmdRenderFbToBufferFb -------------------- //------------------ cOglCmdRenderFbToBufferFb --------------------
cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency,
GLint drawPortX, GLint drawPortY) GLint drawPortX, GLint drawPortY, bool alphablending)
: cOglCmd(fb) { : cOglCmd(fb) {
this->buffer = buffer; this->buffer = buffer;
this->x = (GLfloat)x; this->x = (GLfloat)x;
this->y = (GLfloat)y; this->y = (GLfloat)y;
this->drawPortX = (GLfloat)drawPortX; this->drawPortX = (GLfloat)drawPortX;
this->drawPortY = (GLfloat)drawPortY; this->drawPortY = (GLfloat)drawPortY;
this->transparency = transparency; this->transparency = (alphablending ? transparency : ALPHA_OPAQUE);
this->alphablending = alphablending;
} }
bool cOglCmdRenderFbToBufferFb::Execute(void) { bool cOglCmdRenderFbToBufferFb::Execute(void) {
@@ -777,11 +774,14 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
if (!fb->BindTexture()) if (!fb->BindTexture())
return false; return false;
if (!alphablending)
VertexBuffers[vbTexture]->DisableBlending();
VertexBuffers[vbTexture]->Bind(); VertexBuffers[vbTexture]->Bind();
VertexBuffers[vbTexture]->SetVertexData(quadVertices); VertexBuffers[vbTexture]->SetVertexData(quadVertices);
VertexBuffers[vbTexture]->DrawArrays(); VertexBuffers[vbTexture]->DrawArrays();
VertexBuffers[vbTexture]->Unbind(); VertexBuffers[vbTexture]->Unbind();
if (!alphablending)
VertexBuffers[vbTexture]->EnableBlending();
buffer->Unbind(); buffer->Unbind();
return true; return true;
@@ -837,6 +837,8 @@ cOglCmdDrawRectangle::cOglCmdDrawRectangle(cOglFb *fb, GLint x, GLint y, GLint w
} }
bool cOglCmdDrawRectangle::Execute(void) { bool cOglCmdDrawRectangle::Execute(void) {
if (width <= 0 || height <= 0)
return false;
GLfloat x1 = x; GLfloat x1 = x;
GLfloat y1 = y; GLfloat y1 = y;
GLfloat x2 = x + width; GLfloat x2 = x + width;
@@ -883,6 +885,8 @@ cOglCmdDrawEllipse::cOglCmdDrawEllipse(cOglFb *fb, GLint x, GLint y, GLint width
} }
bool cOglCmdDrawEllipse::Execute(void) { bool cOglCmdDrawEllipse::Execute(void) {
if (width <= 0 || height <= 0)
return false;
int numVertices = 0; int numVertices = 0;
GLfloat *vertices = NULL; GLfloat *vertices = NULL;
@@ -1090,6 +1094,8 @@ cOglCmdDrawSlope::cOglCmdDrawSlope(cOglFb *fb, GLint x, GLint y, GLint width, GL
} }
bool cOglCmdDrawSlope::Execute(void) { bool cOglCmdDrawSlope::Execute(void) {
if (width <= 0 || height <= 0)
return false;
bool falling = type & 0x02; bool falling = type & 0x02;
bool vertical = type & 0x04; bool vertical = type & 0x04;
@@ -1177,7 +1183,7 @@ cOglCmdDrawText::~cOglCmdDrawText(void) { free(symbols); }
bool cOglCmdDrawText::Execute(void) { bool cOglCmdDrawText::Execute(void) {
cOglFont *f = cOglFont::Get(*fontName, fontSize); cOglFont *f = cOglFont::Get(*fontName, fontSize);
if (!f) if (!f || !symbols[0])
return false; return false;
VertexBuffers[vbText]->ActivateShader(); VertexBuffers[vbText]->ActivateShader();
@@ -1256,10 +1262,13 @@ cOglCmdDrawImage::cOglCmdDrawImage(cOglFb *fb, tColor *argb, GLint width, GLint
cOglCmdDrawImage::~cOglCmdDrawImage(void) { free(argb); } cOglCmdDrawImage::~cOglCmdDrawImage(void) { free(argb); }
bool cOglCmdDrawImage::Execute(void) { bool cOglCmdDrawImage::Execute(void) {
if (width <= 0 || height <= 0)
return false;
GLuint texture; GLuint texture;
#ifdef USE_DRM #ifdef USE_DRM
// pthread_mutex_lock(&OSDMutex); //esyslog("upload Image\n");
pthread_mutex_lock(&OSDMutex);
GlxDrawopengl(); // here we need the Shared Context for upload GlxDrawopengl(); // here we need the Shared Context for upload
GlxCheck(); GlxCheck();
#endif #endif
@@ -1272,16 +1281,16 @@ bool cOglCmdDrawImage::Execute(void) {
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glBindTexture(GL_TEXTURE_2D, 0); glBindTexture(GL_TEXTURE_2D, 0);
glFlush(); glFlush();
#ifdef USE_DRM #ifdef USE_DRM
GlxInitopengl(); // Reset Context GlxInitopengl(); // Reset Context
GlxCheck(); GlxCheck();
// pthread_mutex_unlock(&OSDMutex); pthread_mutex_unlock(&OSDMutex);
#endif #endif
GLfloat x1 = x; // left GLfloat x1 = x; // left
GLfloat y1 = y; // top GLfloat y1 = y; // top
GLfloat x2 = x + width; // right GLfloat x2 = x + width * scaleX; // right
GLfloat y2 = y + height; // bottom GLfloat y2 = y + height * scaleY; // bottom
GLfloat quadVertices[] = { GLfloat quadVertices[] = {
x1, y2, 0.0, 1.0, // left bottom x1, y2, 0.0, 1.0, // left bottom
@@ -1315,17 +1324,21 @@ bool cOglCmdDrawImage::Execute(void) {
} }
//------------------ cOglCmdDrawTexture -------------------- //------------------ cOglCmdDrawTexture --------------------
cOglCmdDrawTexture::cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y) : cOglCmd(fb) { cOglCmdDrawTexture::cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX, double scaleY) : cOglCmd(fb) {
this->imageRef = imageRef; this->imageRef = imageRef;
this->x = x; this->x = x;
this->y = y; this->y = y;
this->scaleX = scaleX;
this->scaleY = scaleY;
} }
bool cOglCmdDrawTexture::Execute(void) { bool cOglCmdDrawTexture::Execute(void) {
GLfloat x1 = x; // top if (imageRef->width <= 0 || imageRef->height <= 0)
GLfloat y1 = y; // left return false;
GLfloat x2 = x + imageRef->width; // right GLfloat x1 = x; // top
GLfloat y2 = y + imageRef->height; // bottom GLfloat y1 = y; // left
GLfloat x2 = x + imageRef->width * scaleX; // right
GLfloat y2 = y + imageRef->height * scaleY; // bottom
GLfloat quadVertices[] = { GLfloat quadVertices[] = {
// Pos // TexCoords // Pos // TexCoords
@@ -1363,7 +1376,8 @@ cOglCmdStoreImage::~cOglCmdStoreImage(void) { free(data); }
bool cOglCmdStoreImage::Execute(void) { bool cOglCmdStoreImage::Execute(void) {
#ifdef USE_DRM #ifdef USE_DRM
// pthread_mutex_lock(&OSDMutex); return false;
pthread_mutex_lock(&OSDMutex);
GlxDrawopengl(); // here we need the Shared Context for upload GlxDrawopengl(); // here we need the Shared Context for upload
GlxCheck(); GlxCheck();
#endif #endif
@@ -1380,7 +1394,7 @@ bool cOglCmdStoreImage::Execute(void) {
#ifdef USE_DRM #ifdef USE_DRM
GlxInitopengl(); // Reset Context GlxInitopengl(); // Reset Context
GlxCheck(); GlxCheck();
// pthread_mutex_lock(&OSDMutex); pthread_mutex_lock(&OSDMutex);
#endif #endif
return true; return true;
} }
@@ -1460,7 +1474,9 @@ int cOglThread::StoreImage(const cImage &image) {
if (!maxCacheSize) { if (!maxCacheSize) {
return 0; return 0;
} }
#ifdef USE_DRM
return 0;
#endif
if (image.Width() > maxTextureSize || image.Height() > maxTextureSize) { if (image.Width() > maxTextureSize || image.Height() > maxTextureSize) {
esyslog("[softhddev] cannot store image of %dpx x %dpx " esyslog("[softhddev] cannot store image of %dpx x %dpx "
"(maximum size is %dpx x %dpx) - falling back to " "(maximum size is %dpx x %dpx) - falling back to "
@@ -1640,6 +1656,7 @@ void cOglThread::Action(void) {
bool cOglThread::InitOpenGL(void) { bool cOglThread::InitOpenGL(void) {
#ifdef USE_DRM #ifdef USE_DRM
esyslog("InitOpenGL\n");
GlxInitopengl(); GlxInitopengl();
#else #else
const char *displayName = X11DisplayName; const char *displayName = X11DisplayName;
@@ -1651,7 +1668,7 @@ bool cOglThread::InitOpenGL(void) {
} }
} }
dsyslog("[softhddev]OpenGL using display %s", displayName); esyslog("[softhddev]OpenGL using display %s", displayName);
int argc = 3; int argc = 3;
char *buffer[3]; char *buffer[3];
@@ -1815,6 +1832,10 @@ void cOglPixmap::Fill(tColor Color) {
} }
void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) { void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
DrawScaledImage(Point, Image);
}
void cOglPixmap::DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias) {
if (!oglThread->Active()) if (!oglThread->Active())
return; return;
tColor *argb = MALLOC(tColor, Image.Width() * Image.Height()); tColor *argb = MALLOC(tColor, Image.Width() * Image.Height());
@@ -1823,19 +1844,25 @@ void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
return; return;
memcpy(argb, Image.Data(), sizeof(tColor) * Image.Width() * Image.Height()); memcpy(argb, Image.Data(), sizeof(tColor) * Image.Width() * Image.Height());
oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y())); oglThread->DoCmd(new cOglCmdDrawImage(fb, argb, Image.Width(), Image.Height(), Point.X(), Point.Y(), true, FactorX, FactorY));
SetDirty(); SetDirty();
MarkDrawPortDirty(cRect(Point, cSize(Image.Width(), Image.Height())).Intersected(DrawPort().Size())); MarkDrawPortDirty(cRect(Point, cSize(Image.Width() * FactorX, Image.Height() * FactorY)).Intersected(DrawPort().Size()));
} }
void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) { void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
DrawScaledImage(Point, ImageHandle);
}
void cOglPixmap::DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias) {
if (!oglThread->Active()) if (!oglThread->Active())
return; return;
if (ImageHandle < 0 && oglThread->GetImageRef(ImageHandle)) { if (ImageHandle < 0 && oglThread->GetImageRef(ImageHandle)) {
sOglImage *img = oglThread->GetImageRef(ImageHandle); sOglImage *img = oglThread->GetImageRef(ImageHandle);
oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y())); oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y(), FactorX, FactorY));
SetDirty();
MarkDrawPortDirty(cRect(Point, cSize(img->width * FactorX, img->height * FactorY)).Intersected(DrawPort().Size()));
} }
/* /*
Fallback to VDR implementation, needs to separate cSoftOsdProvider from Fallback to VDR implementation, needs to separate cSoftOsdProvider from
@@ -1843,8 +1870,6 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle)); DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle));
} }
*/ */
SetDirty();
MarkDrawPortDirty(DrawPort());
} }
void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) { void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) {
@@ -2085,6 +2110,14 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
return NULL; return NULL;
} }
extern "C" {void VideoSetOsdSize(int, int ) ;}
void SetOsdPosition(int Left, int Top, int Width, int Height) {
printf("Set OSD Position %d %d\n",Width,Height);
VideoSetOsdSize( Width, Height) ;
}
void cOglOsd::DestroyPixmap(cPixmap *Pixmap) { void cOglOsd::DestroyPixmap(cPixmap *Pixmap) {
if (!oglThread->Active()) if (!oglThread->Active())
return; return;
@@ -2130,10 +2163,16 @@ void cOglOsd::Flush(void) {
for (int i = 0; i < oglPixmaps.Size(); i++) { for (int i = 0; i < oglPixmaps.Size(); i++) {
if (oglPixmaps[i]) { if (oglPixmaps[i]) {
if (oglPixmaps[i]->Layer() == layer) { if (oglPixmaps[i]->Layer() == layer) {
oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( bool alphablending = layer == 0 ? false : true; // Decide wether to render (with alpha) or copy a pixmap
oglPixmaps[i]->Fb(), bFb, oglPixmaps[i]->ViewPort().X(), oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(), bFb,
oglPixmaps[i]->DrawPort().X(), oglPixmaps[i]->DrawPort().Y())); oglPixmaps[i]->ViewPort().X(),
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0,
oglPixmaps[i]->Alpha(),
oglPixmaps[i]->DrawPort().X(),
oglPixmaps[i]->DrawPort().Y(),
alphablending
));
oglPixmaps[i]->SetDirty(false); oglPixmaps[i]->SetDirty(false);
} }
} }

View File

@@ -290,10 +290,11 @@ class cOglCmdRenderFbToBufferFb : public cOglCmd {
GLfloat x, y; GLfloat x, y;
GLfloat drawPortX, drawPortY; GLfloat drawPortX, drawPortY;
GLint transparency; GLint transparency;
GLint alphablending;
public: public:
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX, cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
GLint drawPortY); GLint drawPortY, bool alphablending);
virtual ~cOglCmdRenderFbToBufferFb(void){}; virtual ~cOglCmdRenderFbToBufferFb(void){};
virtual const char *Description(void) { return "Render Framebuffer to Buffer"; } virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
virtual bool Execute(void); virtual bool Execute(void);
@@ -402,9 +403,10 @@ class cOglCmdDrawTexture : public cOglCmd {
private: private:
sOglImage *imageRef; sOglImage *imageRef;
GLint x, y; GLint x, y;
GLfloat scaleX, scaleY;
public: public:
cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y); cOglCmdDrawTexture(cOglFb *fb, sOglImage *imageRef, GLint x, GLint y, double scaleX = 1.0f, double scaleY = 1.0f);
virtual ~cOglCmdDrawTexture(void){}; virtual ~cOglCmdDrawTexture(void){};
virtual const char *Description(void) { return "Draw Texture"; } virtual const char *Description(void) { return "Draw Texture"; }
virtual bool Execute(void); virtual bool Execute(void);
@@ -500,6 +502,8 @@ class cOglPixmap : public cPixmap {
virtual void Fill(tColor Color); virtual void Fill(tColor Color);
virtual void DrawImage(const cPoint &Point, const cImage &Image); virtual void DrawImage(const cPoint &Point, const cImage &Image);
virtual void DrawImage(const cPoint &Point, int ImageHandle); virtual void DrawImage(const cPoint &Point, int ImageHandle);
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX = 1.0f, double FactorY = 1.0f, bool AntiAlias = false);
virtual void DrawPixel(const cPoint &Point, tColor Color); virtual void DrawPixel(const cPoint &Point, tColor Color);
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
bool Overlay = false); bool Overlay = false);
@@ -528,6 +532,7 @@ class cOglOsd : public cOsd {
public: public:
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread); cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
virtual ~cOglOsd(); virtual ~cOglOsd();
static void SetOsdPosition(int Left, int Top, int Width, int Height);
virtual eOsdError SetAreas(const tArea *Areas, int NumAreas); virtual eOsdError SetAreas(const tArea *Areas, int NumAreas);
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null); virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null);
virtual void DestroyPixmap(cPixmap *Pixmap); virtual void DestroyPixmap(cPixmap *Pixmap);

View File

@@ -4,12 +4,8 @@
#ifdef CUVID #ifdef CUVID
const char *gl_version = "#version 330"; const char *gl_version = "#version 330";
#else #else
#ifdef RASPI
const char *gl_version = "#version 300 es";
#else
const char *gl_version = "#version 300 es "; const char *gl_version = "#version 300 es ";
#endif #endif
#endif
/* Color conversion matrix: RGB = m * YUV + c /* Color conversion matrix: RGB = m * YUV + c
* m is in row-major matrix, with m[row][col], e.g.: * m is in row-major matrix, with m[row][col], e.g.:

View File

@@ -61,7 +61,7 @@ extern void ToggleLUT();
/// vdr-plugin version number. /// vdr-plugin version number.
/// Makefile extracts the version number for generating the file name /// Makefile extracts the version number for generating the file name
/// for the distribution archive. /// for the distribution archive.
static const char *const VERSION = "3.6" static const char *const VERSION = "3.21"
#ifdef GIT_REV #ifdef GIT_REV
"-GIT" GIT_REV "-GIT" GIT_REV
#endif #endif
@@ -642,36 +642,107 @@ void cSoftOsd::Flush(void) {
#ifdef USE_OPENGLOSD #ifdef USE_OPENGLOSD
//Dummy Pixmap for skins // Dummy Pixmap for skins
class cDummyPixmap : public cPixmap { class cDummyPixmap : public cPixmap {
public: public:
cDummyPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null) : cPixmap(Layer, ViewPort, DrawPort) {} cDummyPixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null)
: cPixmap(Layer, ViewPort, DrawPort) {}
virtual ~cDummyPixmap(void) {} virtual ~cDummyPixmap(void) {}
virtual void Clear(void) {} virtual void Clear(void) {}
virtual void Fill(tColor Color) { (void)Color; } virtual void Fill(tColor Color) { (void)Color; }
virtual void DrawImage(const cPoint &Point, const cImage &Image) { (void)Point; (void)Image; } virtual void DrawImage(const cPoint &Point, const cImage &Image) {
virtual void DrawImage(const cPoint &Point, int ImageHandle) { (void)Point; (void)ImageHandle; } (void)Point;
virtual void DrawPixel(const cPoint &Point, tColor Color) { (void)Point; (void)Color; } (void)Image;
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0, bool Overlay = false) { }
(void) Point; (void)Bitmap; (void)ColorFg; (void)ColorBg; (void)Overlay; } virtual void DrawImage(const cPoint &Point, int ImageHandle) {
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) { (void)Point;
(void)Point; (void)s; (void)ColorFg; (void) ColorBg; (void) Font; (void)Width; (void)Height; (void)Alignment; } (void)ImageHandle;
virtual void DrawRectangle(const cRect &Rect, tColor Color) { (void)Rect; (void)Color; } }
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0) { (void)Rect; (void)Color; (void)Quadrants; } virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias) {
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type) { (void)Rect; (void)Color; (void)Type; } (void)Point;
virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) { (void)Pixmap; (void)Source; (void)Dest; } (void)Image;
virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) { (void)Pixmap; (void)Source; (void)Dest; } (void)FactorX;
virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null) { (void)Dest; (void)Source; } (void)FactorY;
virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null) { (void)Dest; (void)Source; } (void)AntiAlias;
}
virtual void DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias) {
(void)Point;
(void)ImageHandle;
(void)FactorX;
(void)FactorY;
(void)AntiAlias;
}
virtual void DrawPixel(const cPoint &Point, tColor Color) {
(void)Point;
(void)Color;
}
virtual void DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
bool Overlay = false) {
(void)Point;
(void)Bitmap;
(void)ColorFg;
(void)ColorBg;
(void)Overlay;
}
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) {
(void)Point;
(void)s;
(void)ColorFg;
(void)ColorBg;
(void)Font;
(void)Width;
(void)Height;
(void)Alignment;
}
virtual void DrawRectangle(const cRect &Rect, tColor Color) {
(void)Rect;
(void)Color;
}
virtual void DrawEllipse(const cRect &Rect, tColor Color, int Quadrants = 0) {
(void)Rect;
(void)Color;
(void)Quadrants;
}
virtual void DrawSlope(const cRect &Rect, tColor Color, int Type) {
(void)Rect;
(void)Color;
(void)Type;
}
virtual void Render(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) {
(void)Pixmap;
(void)Source;
(void)Dest;
}
virtual void Copy(const cPixmap *Pixmap, const cRect &Source, const cPoint &Dest) {
(void)Pixmap;
(void)Source;
(void)Dest;
}
virtual void Scroll(const cPoint &Dest, const cRect &Source = cRect::Null) {
(void)Dest;
(void)Source;
}
virtual void Pan(const cPoint &Dest, const cRect &Source = cRect::Null) {
(void)Dest;
(void)Source;
}
}; };
// Dummy OSD for OpenGL OSD if no X Server is available // Dummy OSD for OpenGL OSD if no X Server is available
class cDummyOsd : public cOsd { class cDummyOsd : public cOsd {
private: private:
cDummyPixmap *p; cDummyPixmap *p;
public: public:
cDummyOsd(int Left, int Top, uint Level) : cOsd(Left, Top, Level) {} cDummyOsd(int Left, int Top, uint Level) : cOsd(Left, Top, Level) {}
virtual ~cDummyOsd() {} virtual ~cDummyOsd() {}
static void SetOsdPosition(int Left, int Top, int Width, int Height) {
(void) Left;
(void) Top;
(void) Width;
(void) Height;
}
virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null) { virtual cPixmap *CreatePixmap(int Layer, const cRect &ViewPort, const cRect &DrawPort = cRect::Null) {
p = new cDummyPixmap(Layer, ViewPort, DrawPort); p = new cDummyPixmap(Layer, ViewPort, DrawPort);
return p; return p;
@@ -1096,9 +1167,9 @@ void cMenuSetupSoft::Create(void) {
if (scalers == 0) { if (scalers == 0) {
scalingtest[0] = (char *)"Off"; scalingtest[0] = (char *)"Off";
for (scalers = 0; pl_named_filters[scalers].name != NULL; scalers++) { for (scalers = 0; pl_filter_presets[scalers].name != NULL; scalers++) {
scaling[scalers] = (char *)pl_named_filters[scalers].name; scaling[scalers] = (char *)pl_filter_presets[scalers].name;
scalingtest[scalers + 1] = (char *)pl_named_filters[scalers].name; scalingtest[scalers + 1] = (char *)pl_filter_presets[scalers].name;
// printf("Scaler %s\n",pl_named_filters[scalers].name); // printf("Scaler %s\n",pl_named_filters[scalers].name);
} }
// scalers -= 2; // scalers -= 2;

View File

@@ -364,7 +364,7 @@ static int Ac3Check(const uint8_t *data, int size) {
if ((data[4] & 0xF0) == 0xF0) { // invalid fscod fscod2 if ((data[4] & 0xF0) == 0xF0) { // invalid fscod fscod2
return 0; return 0;
} }
frame_size = ((data[2] & 0x03) << 8) + data[3] + 1; frame_size = ((data[2] & 0x07) << 8) + data[3] + 1;
frame_size *= 2; frame_size *= 2;
} else { // AC-3 } else { // AC-3
int fscod; int fscod;
@@ -2142,7 +2142,7 @@ int PlayVideo3(VideoStream *stream, const uint8_t *data, int size) {
} }
// hard limit buffer full: needed for replay // hard limit buffer full: needed for replay
if (atomic_read(&stream->PacketsFilled) >= VIDEO_PACKET_MAX - 10) { if (atomic_read(&stream->PacketsFilled) >= VIDEO_PACKET_MAX - 10) {
// Debug(3, "video: video buffer full\n"); //Debug(3, "video: video buffer full\n");
return 0; return 0;
} }
#ifdef USE_SOFTLIMIT #ifdef USE_SOFTLIMIT
@@ -2817,8 +2817,8 @@ const char *CommandLineHelp(void) {
"\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\n" "\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\n"
"\talsa-driver-broken\tdisable broken alsa driver message\n" "\talsa-driver-broken\tdisable broken alsa driver message\n"
"\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n" "\talsa-no-close-open\tdisable close open to fix alsa no sound bug\n"
"\talsa-close-open-delay\tenable close open delay to fix no sound " "\talsa-no-test\tdisable Alsa Capability test on start for NUC11/12\n"
"bug\n" "\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
"\tignore-repeat-pict\tdisable repeat pict message\n" "\tignore-repeat-pict\tdisable repeat pict message\n"
"\tuse-possible-defect-frames prefer faster channel switch\n" "\tuse-possible-defect-frames prefer faster channel switch\n"
" -D\t\tstart in detached mode\n"; " -D\t\tstart in detached mode\n";
@@ -2908,6 +2908,8 @@ int ProcessArgs(int argc, char *const argv[]) {
AudioAlsaDriverBroken = 1; AudioAlsaDriverBroken = 1;
} else if (!strcasecmp("alsa-no-close-open", optarg)) { } else if (!strcasecmp("alsa-no-close-open", optarg)) {
AudioAlsaNoCloseOpen = 1; AudioAlsaNoCloseOpen = 1;
} else if (!strcasecmp("alsa-no-test", optarg)) {
AudioAlsaNotest = 1;
} else if (!strcasecmp("alsa-close-open-delay", optarg)) { } else if (!strcasecmp("alsa-close-open-delay", optarg)) {
AudioAlsaCloseOpenDelay = 1; AudioAlsaCloseOpenDelay = 1;
} else if (!strcasecmp("ignore-repeat-pict", optarg)) { } else if (!strcasecmp("ignore-repeat-pict", optarg)) {

474
video.c

File diff suppressed because it is too large Load Diff