mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-03-01 10:39:28 +00:00
Compare commits
35 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
9dd936df86 | ||
|
4e5529efcf | ||
|
20f1bd45e6 | ||
|
7a7e09ff7a | ||
|
c4a660ede2 | ||
|
8e495266e2 | ||
|
f27e4fb35f | ||
|
e14ea73a00 | ||
|
72cb77f771 | ||
|
c679d812d1 | ||
|
47b461ab46 | ||
|
8629946041 | ||
|
a222f6a1d5 | ||
|
b51589aaa9 | ||
|
c3af54aae0 | ||
|
7e387fa3f1 | ||
|
f3e5a14fdf | ||
|
aa0c2f80e4 | ||
|
215f251572 | ||
|
a425ec94e0 | ||
|
91961bdffe | ||
|
f741dff042 | ||
|
7a31761c89 | ||
|
d5ca73c22f | ||
|
6704b2ca5a | ||
|
e0bbaceec0 | ||
|
45043b9ffc | ||
|
a56b3737c7 | ||
|
e59eeba0d2 | ||
|
838dfab45b | ||
|
ddd44e6f62 | ||
|
1390139cbd | ||
|
f72653c3c1 | ||
|
4e96489e35 | ||
|
65017da5ac |
20
Makefile
20
Makefile
@@ -24,18 +24,17 @@ DRM ?= 0
|
||||
|
||||
# use libplacebo -
|
||||
# available for all decoders but for DRM you need LIBPLACEBO_GL
|
||||
LIBPLACEBO ?= 1
|
||||
LIBPLACEBO ?= 0
|
||||
LIBPLACEBO_GL ?= 0
|
||||
|
||||
# use YADIF deint - only available with cuvid
|
||||
#YADIF = 1
|
||||
YADIF = 1
|
||||
|
||||
# use gamma correction
|
||||
#GAMMA ?= 0
|
||||
|
||||
CONFIG := -DDEBUG # remove '#' to enable debug output
|
||||
|
||||
|
||||
#--------------------- no more config needed past this point--------------------------------
|
||||
|
||||
# sanitize selections --------
|
||||
@@ -159,29 +158,29 @@ endif
|
||||
|
||||
ifeq ($(LIBPLACEBO_GL),1)
|
||||
CONFIG += -DPLACEBO_GL -DPLACEBO
|
||||
LIBS += -lepoxy
|
||||
LIBS += -lplacebo
|
||||
_CFLAGS += $(shell pkg-config --cflags libplacebo)
|
||||
LIBS += $(shell pkg-config --libs epoxy libplacebo)
|
||||
else
|
||||
LIBS += -lEGL
|
||||
LIBS += $(shell pkg-config --libs egl)
|
||||
endif
|
||||
|
||||
ifeq ($(LIBPLACEBO),1)
|
||||
CONFIG += -DPLACEBO
|
||||
LIBS += -lEGL
|
||||
LIBS += -lplacebo
|
||||
_CFLAGS += $(shell pkg-config --cflags libplacebo)
|
||||
LIBS += $(shell pkg-config --libs egl libplacebo)
|
||||
endif
|
||||
|
||||
ifeq ($(DRM),1)
|
||||
PLUGIN = softhddrm
|
||||
CONFIG += -DUSE_DRM -DVAAPI
|
||||
_CFLAGS += $(shell pkg-config --cflags libdrm)
|
||||
LIBS += -lgbm -ldrm -lEGL
|
||||
LIBS += $(shell pkg-config --libs egl gbm libdrm)
|
||||
endif
|
||||
|
||||
ifeq ($(CUVID),1)
|
||||
#CONFIG += -DUSE_PIP # PIP support
|
||||
CONFIG += -DCUVID # enable CUVID decoder
|
||||
LIBS += -lEGL -lGL
|
||||
LIBS += $(shell pkg-config --libs egl gl)
|
||||
ifeq ($(YADIF),1)
|
||||
CONFIG += -DYADIF # Yadif only with CUVID
|
||||
endif
|
||||
@@ -274,6 +273,7 @@ LIBS += -lcuda -lnvcuvid
|
||||
endif
|
||||
|
||||
LIBS += -lGLEW -lGLU -ldl -lglut
|
||||
#LIBS += -ldl $(shell pkg-config --libs glew glu glut)
|
||||
|
||||
### Includes and Defines (add further entries here):
|
||||
|
||||
|
@@ -82,9 +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.
|
||||
I recommend to use libplacebo and set LIBPLACEBO_GL=1 in the Makefile.
|
||||
|
||||
You should use the following libplacebo Version:
|
||||
https://github.com/haasn/libplacebo/archive/f2c4da9d6121bb330c9fff640aad40e98c081190.zip
|
||||
Newer Versions may not work.
|
||||
|
||||
|
||||
Install:
|
||||
@@ -123,6 +120,9 @@ Beginners Guide for libplacebo:
|
||||
|
||||
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.
|
||||
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
|
||||
|
253
audio.c
253
audio.c
@@ -93,6 +93,7 @@ static const AudioModule NoopModule; ///< forward definition of noop module
|
||||
// Variables
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
char AudioAlsaNotest; ///< disable Audio capbility test
|
||||
char AudioAlsaDriverBroken; ///< disable broken driver message
|
||||
char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
||||
char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
||||
@@ -2187,143 +2188,145 @@ found:
|
||||
AudioRingInit();
|
||||
AudioUsedModule->Init();
|
||||
|
||||
#if 1
|
||||
for (u = 0; u < AudioRatesMax; ++u) {
|
||||
|
||||
AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=\
|
||||
AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=AudioChannelMatrix[u][7]=AudioChannelMatrix[u][8]=2;
|
||||
//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],
|
||||
// AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
|
||||
if (AudioAlsaNotest) {
|
||||
for (u = 0; u < AudioRatesMax; ++u) {
|
||||
|
||||
AudioChannelMatrix[u][1]=AudioChannelMatrix[u][2]=2;
|
||||
AudioChannelMatrix[u][3]=AudioChannelMatrix[u][4]=4;
|
||||
AudioChannelMatrix[u][5]=AudioChannelMatrix[u][6]=6;
|
||||
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],
|
||||
AudioChannelMatrix[u][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
|
||||
|
||||
}
|
||||
|
||||
AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
|
||||
AudioChannelsInHw[2]=2;
|
||||
}
|
||||
|
||||
AudioChannelsInHw[1]=AudioChannelsInHw[3]=AudioChannelsInHw[4]=AudioChannelsInHw[5]=AudioChannelsInHw[6]=AudioChannelsInHw[7]=AudioChannelsInHw[8]=0;
|
||||
AudioChannelsInHw[2]=2;
|
||||
|
||||
#else
|
||||
//
|
||||
// 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;
|
||||
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;
|
||||
}
|
||||
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]) {
|
||||
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) {
|
||||
else {
|
||||
//
|
||||
// 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) {
|
||||
AudioChannelMatrix[u][chan] = 0;
|
||||
if (!AudioRatesInHw[u]) { // rate unsupported
|
||||
int tchan;
|
||||
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;
|
||||
}
|
||||
if (AudioChannelsInHw[chan]) {
|
||||
AudioChannelMatrix[u][chan] = chan;
|
||||
tchan = chan;
|
||||
tfreq = freq;
|
||||
if (AudioUsedModule->Setup(&tfreq, &tchan, 0)) {
|
||||
// AudioChannelsInHw[chan] = 0;
|
||||
} else {
|
||||
switch (chan) {
|
||||
case 1:
|
||||
if (AudioChannelsInHw[2]) {
|
||||
AudioChannelMatrix[u][chan] = 2;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
if (AudioChannelsInHw[4]) {
|
||||
AudioChannelMatrix[u][chan] = 4;
|
||||
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]) {
|
||||
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;
|
||||
}
|
||||
case 4:
|
||||
if (AudioChannelsInHw[5]) {
|
||||
AudioChannelMatrix[u][chan] = 5;
|
||||
case 2:
|
||||
case 3:
|
||||
if (AudioChannelsInHw[4]) {
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
Debug(3,"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][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
|
||||
}
|
||||
}
|
||||
for (u = 0; u < AudioRatesMax; ++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][5], AudioChannelMatrix[u][6], AudioChannelMatrix[u][7], AudioChannelMatrix[u][8]);
|
||||
}
|
||||
#endif
|
||||
#ifdef USE_AUDIO_THREAD
|
||||
if (AudioUsedModule->Thread) { // supports threads
|
||||
AudioInitThread();
|
||||
|
1
audio.h
1
audio.h
@@ -60,6 +60,7 @@ extern void AudioExit(void); ///< cleanup and exit audio module
|
||||
// Variables
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
extern char AudioAlsaNotest; ///< disable Alsa capability test
|
||||
extern char AudioAlsaDriverBroken; ///< disable broken driver message
|
||||
extern char AudioAlsaNoCloseOpen; ///< disable alsa close/open fix
|
||||
extern char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix
|
||||
|
109
codec.c
109
codec.c
@@ -260,8 +260,8 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||
|
||||
decoder->VideoCtx->pkt_timebase.num = 1;
|
||||
decoder->VideoCtx->pkt_timebase.den = 90000;
|
||||
decoder->VideoCtx->framerate.num = 50;
|
||||
decoder->VideoCtx->framerate.den = 1;
|
||||
//decoder->VideoCtx->framerate.num = 50;
|
||||
//decoder->VideoCtx->framerate.den = 1;
|
||||
|
||||
pthread_mutex_lock(&CodecLockMutex);
|
||||
// open codec
|
||||
@@ -311,12 +311,12 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||
pthread_mutex_unlock(&CodecLockMutex);
|
||||
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);
|
||||
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) {
|
||||
pthread_mutex_unlock(&CodecLockMutex);
|
||||
Fatal(_("codec: can't set option drop 2.field to video codec!\n"));
|
||||
@@ -326,12 +326,10 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||
pthread_mutex_unlock(&CodecLockMutex);
|
||||
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) {
|
||||
pthread_mutex_unlock(&CodecLockMutex);
|
||||
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) {
|
||||
pthread_mutex_unlock(&CodecLockMutex);
|
||||
Fatal(_("codec: can't set option drop 2.field to video codec!\n"));
|
||||
@@ -492,8 +490,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) {
|
||||
decoder->filter = 2;
|
||||
}
|
||||
}
|
||||
if (frame->interlaced_frame && decoder->filter == 2 &&
|
||||
(frame->height != 720)) { // broken ZDF sends Interlaced flag
|
||||
if (decoder->filter == 2) {
|
||||
push_filters(video_ctx, decoder->HwDecoder, frame);
|
||||
continue;
|
||||
}
|
||||
@@ -525,7 +522,6 @@ next_part:
|
||||
pkt = avpkt; // use copy
|
||||
got_frame = 0;
|
||||
|
||||
// printf("decode packet %d\n",(GetusTicks()-first_time)/1000000);
|
||||
ret1 = avcodec_send_packet(video_ctx, pkt);
|
||||
|
||||
// first_time = GetusTicks();
|
||||
@@ -545,12 +541,12 @@ next_part:
|
||||
frame = av_frame_alloc();
|
||||
ret = avcodec_receive_frame(video_ctx, frame); // get new frame
|
||||
if (ret >= 0) { // one is avail.
|
||||
first_time = frame->pts;
|
||||
got_frame = 1;
|
||||
} else {
|
||||
got_frame = 0;
|
||||
}
|
||||
// printf("got %s packet from
|
||||
// decoder\n",got_frame?"1":"no");
|
||||
//printf("got %s packet from decoder\n",got_frame?"1":"no");
|
||||
if (got_frame) { // frame completed
|
||||
// printf("video frame pts %#012" PRIx64 "
|
||||
//%dms\n",frame->pts,(int)(apts - frame->pts) / 90);
|
||||
@@ -558,15 +554,14 @@ next_part:
|
||||
if (decoder->filter) {
|
||||
if (decoder->filter == 1) {
|
||||
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;
|
||||
} else {
|
||||
Debug(3, "Init YADIF ok\n");
|
||||
decoder->filter = 2;
|
||||
}
|
||||
}
|
||||
if (frame->interlaced_frame && decoder->filter == 2 &&
|
||||
(frame->height != 720)) { // broken ZDF sends Interlaced flag
|
||||
if (decoder->filter == 2) {
|
||||
ret = push_filters(video_ctx, decoder->HwDecoder, frame);
|
||||
// av_frame_unref(frame);
|
||||
continue;
|
||||
@@ -721,9 +716,6 @@ void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
|
||||
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);
|
||||
// open codec
|
||||
if (1) {
|
||||
@@ -876,19 +868,35 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
|
||||
int err;
|
||||
|
||||
audio_ctx = audio_decoder->AudioCtx;
|
||||
Debug(3, "codec/audio: format change %s %dHz *%d channels%s%s%s%s%s\n",
|
||||
av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate, audio_ctx->channels,
|
||||
CodecPassthrough & CodecPCM ? " PCM" : "", CodecPassthrough & CodecMPA ? " MPA" : "",
|
||||
CodecPassthrough & CodecAC3 ? " AC-3" : "", CodecPassthrough & CodecEAC3 ? " E-AC-3" : "",
|
||||
CodecPassthrough ? " pass-through" : "");
|
||||
|
||||
|
||||
Debug(3, "codec/audio: format change %s %dHz *%d channels%s%s%s%s%s%s\n",
|
||||
av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate,
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
audio_ctx->channels, CodecPassthrough & CodecPCM ? " PCM" : "",
|
||||
#else
|
||||
audio_ctx->ch_layout.nb_channels, CodecPassthrough & CodecPCM ? " PCM" : "",
|
||||
#endif
|
||||
CodecPassthrough & CodecMPA ? " MPA" : "",
|
||||
CodecPassthrough & CodecAC3 ? " AC-3" : "",
|
||||
CodecPassthrough & CodecEAC3 ? " E-AC-3" : "",
|
||||
CodecPassthrough & CodecDTS ? " DTS" : "",
|
||||
CodecPassthrough ? " pass-through" : "");
|
||||
|
||||
|
||||
*passthrough = 0;
|
||||
audio_decoder->SampleRate = audio_ctx->sample_rate;
|
||||
audio_decoder->HwSampleRate = audio_ctx->sample_rate;
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
audio_decoder->Channels = audio_ctx->channels;
|
||||
audio_decoder->HwChannels = audio_ctx->channels;
|
||||
audio_decoder->Passthrough = CodecPassthrough;
|
||||
#else
|
||||
audio_decoder->Channels = audio_ctx->ch_layout.nb_channels;
|
||||
audio_decoder->HwChannels = audio_ctx->ch_layout.nb_channels;
|
||||
#endif
|
||||
if (CodecDownmix && !CodecPassthrough) audio_decoder->HwChannels = 2;
|
||||
|
||||
audio_decoder->Passthrough = CodecPassthrough;
|
||||
// SPDIF/HDMI pass-through
|
||||
if ((CodecPassthrough & CodecAC3 && audio_ctx->codec_id == AV_CODEC_ID_AC3) ||
|
||||
(CodecPassthrough & CodecEAC3 && audio_ctx->codec_id == AV_CODEC_ID_EAC3)) {
|
||||
@@ -917,9 +925,15 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
|
||||
}
|
||||
}
|
||||
|
||||
Debug(3, "codec/audio: resample %s %dHz *%d -> %s %dHz *%d\n", av_get_sample_fmt_name(audio_ctx->sample_fmt),
|
||||
audio_ctx->sample_rate, audio_ctx->channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
|
||||
audio_decoder->HwSampleRate, audio_decoder->HwChannels);
|
||||
Debug(3, "codec/audio: resample %s %dHz *%d -> %s %dHz *%d\n",
|
||||
av_get_sample_fmt_name(audio_ctx->sample_fmt), audio_ctx->sample_rate,
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
audio_ctx->channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
|
||||
#else
|
||||
audio_ctx->ch_layout.nb_channels, av_get_sample_fmt_name(AV_SAMPLE_FMT_S16),
|
||||
#endif
|
||||
audio_decoder->HwSampleRate, audio_decoder->HwChannels);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1148,6 +1162,12 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
|
||||
int passthrough;
|
||||
const AVCodecContext *audio_ctx;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
int64_t dmlayout = AV_CH_LAYOUT_STEREO;
|
||||
#else
|
||||
AVChannelLayout dmlayout = AV_CHANNEL_LAYOUT_STEREO;
|
||||
#endif
|
||||
|
||||
if (CodecAudioUpdateHelper(audio_decoder, &passthrough)) {
|
||||
// FIXME: handle swresample format conversions.
|
||||
return;
|
||||
@@ -1158,6 +1178,12 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
|
||||
|
||||
audio_ctx = audio_decoder->AudioCtx;
|
||||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
if (!CodecDownmix || CodecPassthrough) dmlayout = audio_ctx->channel_layout;
|
||||
#else
|
||||
if (!CodecDownmix || CodecPassthrough) dmlayout = audio_ctx->ch_layout;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
if (audio_ctx->sample_fmt == AV_SAMPLE_FMT_S16 && audio_ctx->sample_rate == audio_decoder->HwSampleRate &&
|
||||
!CodecAudioDrift) {
|
||||
@@ -1165,15 +1191,26 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
|
||||
fprintf(stderr, "no resample needed\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LIBSWRESAMPLE_VERSION_INT < AV_VERSION_INT(4,5,100)
|
||||
audio_decoder->Resample =
|
||||
swr_alloc_set_opts(audio_decoder->Resample, dmlayout,
|
||||
AV_SAMPLE_FMT_S16, audio_decoder->HwSampleRate,
|
||||
audio_ctx->channel_layout, audio_ctx->sample_fmt,
|
||||
#else
|
||||
swr_alloc_set_opts2(&audio_decoder->Resample, &dmlayout,
|
||||
AV_SAMPLE_FMT_S16, audio_decoder->HwSampleRate,
|
||||
&audio_ctx->ch_layout, audio_ctx->sample_fmt,
|
||||
#endif
|
||||
audio_ctx->sample_rate, 0, NULL);
|
||||
|
||||
audio_decoder->Resample = swr_alloc_set_opts(audio_decoder->Resample, 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);
|
||||
if (audio_decoder->Resample) {
|
||||
swr_init(audio_decoder->Resample);
|
||||
swr_init(audio_decoder->Resample);
|
||||
} else {
|
||||
Error(_("codec/audio: can't setup resample\n"));
|
||||
Error(_("codec/audio: can't setup resample\n"));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1216,7 +1253,11 @@ void CodecAudioDecode(AudioDecoder *audio_decoder, const AVPacket *avpkt) {
|
||||
// format change
|
||||
if (audio_decoder->Passthrough != CodecPassthrough ||
|
||||
audio_decoder->SampleRate != audio_ctx->sample_rate ||
|
||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,24,100)
|
||||
audio_decoder->Channels != audio_ctx->channels) {
|
||||
#else
|
||||
audio_decoder->Channels != audio_ctx->ch_layout.nb_channels) {
|
||||
#endif
|
||||
CodecAudioUpdateFormat(audio_decoder);
|
||||
}
|
||||
if (!audio_decoder->HwSampleRate || !audio_decoder->HwChannels) {
|
||||
@@ -1225,13 +1266,15 @@ void CodecAudioDecode(AudioDecoder *audio_decoder, const AVPacket *avpkt) {
|
||||
if (CodecAudioPassthroughHelper(audio_decoder, avpkt)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (audio_decoder->Resample) {
|
||||
uint8_t outbuf[8192 * 2 * 8];
|
||||
uint8_t outbuf[8192 * 2 * 8];
|
||||
uint8_t *out[1];
|
||||
|
||||
out[0] = outbuf;
|
||||
ret = swr_convert(audio_decoder->Resample, out, sizeof(outbuf) / (2 * audio_decoder->HwChannels),
|
||||
(const uint8_t **)frame->extended_data, frame->nb_samples);
|
||||
|
||||
if (ret > 0) {
|
||||
if (!(audio_decoder->Passthrough & CodecPCM)) {
|
||||
CodecReorderAudioFrame((int16_t *)outbuf, ret * 2 * audio_decoder->HwChannels,
|
||||
|
38
drm.c
38
drm.c
@@ -209,8 +209,11 @@ static int FindDevice(VideoRender *render) {
|
||||
int found = 0;
|
||||
render->fd_drm = open("/dev/dri/card0", O_RDWR);
|
||||
if (render->fd_drm < 0) {
|
||||
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0: %m\n");
|
||||
return -errno;
|
||||
render->fd_drm = open("/dev/dri/card1", O_RDWR);
|
||||
if (render->fd_drm < 0) {
|
||||
fprintf(stderr, "FindDevice: cannot open /dev/dri/card0 or card1: %m\n");
|
||||
return -errno;
|
||||
}
|
||||
}
|
||||
|
||||
int ret = drmSetMaster(render->fd_drm);
|
||||
@@ -545,6 +548,7 @@ static void drm_swap_buffers() {
|
||||
m_need_modeset = 0;
|
||||
has_modeset = 1;
|
||||
}
|
||||
|
||||
drmModeSetCrtc(render->fd_drm, render->crtc_id, fb, 0, 0, &render->connector_id, 1, &render->mode);
|
||||
|
||||
if (previous_bo) {
|
||||
@@ -562,15 +566,16 @@ static void drm_clean_up() {
|
||||
return;
|
||||
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) {
|
||||
drmModeRmFB(render->fd_drm, previous_fb);
|
||||
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) {
|
||||
drmModeAtomicReqPtr ModeReq;
|
||||
const uint32_t flags = DRM_MODE_ATOMIC_ALLOW_MODESET;
|
||||
@@ -613,22 +618,29 @@ static void drm_clean_up() {
|
||||
if (render->hdr_blob_id)
|
||||
drmModeDestroyPropertyBlob(render->fd_drm, render->hdr_blob_id);
|
||||
render->hdr_blob_id = 0;
|
||||
|
||||
#if 0
|
||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroySurface(eglDisplay, eglSurface);
|
||||
EglCheck();
|
||||
gbm_surface_destroy(gbm.surface);
|
||||
eglDestroyContext(eglDisplay, eglContext);
|
||||
EglCheck();
|
||||
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||
EglCheck();
|
||||
eglDestroyContext(eglDisplay, eglContext);
|
||||
EglCheck();
|
||||
eglSharedContext = NULL;
|
||||
|
||||
eglContext = NULL;
|
||||
eglTerminate(eglDisplay);
|
||||
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);
|
||||
drmDropMaster(render->fd_drm);
|
||||
close(render->fd_drm);
|
||||
eglDisplay = NULL;
|
||||
free(render);
|
||||
render = NULL;
|
||||
Debug(3, "nach drm clean up\n");
|
||||
}
|
@@ -726,14 +726,15 @@ bool cOglCmdDeleteFb::Execute(void) {
|
||||
|
||||
//------------------ cOglCmdRenderFbToBufferFb --------------------
|
||||
cOglCmdRenderFbToBufferFb::cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency,
|
||||
GLint drawPortX, GLint drawPortY)
|
||||
GLint drawPortX, GLint drawPortY, bool alphablending)
|
||||
: cOglCmd(fb) {
|
||||
this->buffer = buffer;
|
||||
this->x = (GLfloat)x;
|
||||
this->y = (GLfloat)y;
|
||||
this->drawPortX = (GLfloat)drawPortX;
|
||||
this->drawPortY = (GLfloat)drawPortY;
|
||||
this->transparency = transparency;
|
||||
this->transparency = (alphablending ? transparency : ALPHA_OPAQUE);
|
||||
this->alphablending = alphablending;
|
||||
}
|
||||
|
||||
bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
||||
@@ -773,11 +774,14 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
||||
|
||||
if (!fb->BindTexture())
|
||||
return false;
|
||||
|
||||
if (!alphablending)
|
||||
VertexBuffers[vbTexture]->DisableBlending();
|
||||
VertexBuffers[vbTexture]->Bind();
|
||||
VertexBuffers[vbTexture]->SetVertexData(quadVertices);
|
||||
VertexBuffers[vbTexture]->DrawArrays();
|
||||
VertexBuffers[vbTexture]->Unbind();
|
||||
if (!alphablending)
|
||||
VertexBuffers[vbTexture]->EnableBlending();
|
||||
buffer->Unbind();
|
||||
|
||||
return true;
|
||||
@@ -1283,10 +1287,10 @@ bool cOglCmdDrawImage::Execute(void) {
|
||||
pthread_mutex_unlock(&OSDMutex);
|
||||
#endif
|
||||
|
||||
GLfloat x1 = x; // left
|
||||
GLfloat y1 = y; // top
|
||||
GLfloat x2 = x + width; // right
|
||||
GLfloat y2 = y + height; // bottom
|
||||
GLfloat x1 = x; // left
|
||||
GLfloat y1 = y; // top
|
||||
GLfloat x2 = x + width * scaleX; // right
|
||||
GLfloat y2 = y + height * scaleY; // bottom
|
||||
|
||||
GLfloat quadVertices[] = {
|
||||
x1, y2, 0.0, 1.0, // left bottom
|
||||
@@ -1320,19 +1324,21 @@ bool cOglCmdDrawImage::Execute(void) {
|
||||
}
|
||||
|
||||
//------------------ 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->x = x;
|
||||
this->y = y;
|
||||
this->scaleX = scaleX;
|
||||
this->scaleY = scaleY;
|
||||
}
|
||||
|
||||
bool cOglCmdDrawTexture::Execute(void) {
|
||||
if (imageRef->width <= 0 || imageRef->height <= 0)
|
||||
return false;
|
||||
GLfloat x1 = x; // top
|
||||
GLfloat y1 = y; // left
|
||||
GLfloat x2 = x + imageRef->width; // right
|
||||
GLfloat y2 = y + imageRef->height; // bottom
|
||||
GLfloat x1 = x; // top
|
||||
GLfloat y1 = y; // left
|
||||
GLfloat x2 = x + imageRef->width * scaleX; // right
|
||||
GLfloat y2 = y + imageRef->height * scaleY; // bottom
|
||||
|
||||
GLfloat quadVertices[] = {
|
||||
// Pos // TexCoords
|
||||
@@ -1826,6 +1832,10 @@ void cOglPixmap::Fill(tColor Color) {
|
||||
}
|
||||
|
||||
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())
|
||||
return;
|
||||
tColor *argb = MALLOC(tColor, Image.Width() * Image.Height());
|
||||
@@ -1834,19 +1844,25 @@ void cOglPixmap::DrawImage(const cPoint &Point, const cImage &Image) {
|
||||
return;
|
||||
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();
|
||||
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) {
|
||||
DrawScaledImage(Point, ImageHandle);
|
||||
}
|
||||
|
||||
void cOglPixmap::DrawScaledImage(const cPoint &Point, int ImageHandle, double FactorX, double FactorY, bool AntiAlias) {
|
||||
if (!oglThread->Active())
|
||||
return;
|
||||
|
||||
if (ImageHandle < 0 && 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
|
||||
@@ -1854,8 +1870,6 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) {
|
||||
DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle));
|
||||
}
|
||||
*/
|
||||
SetDirty();
|
||||
MarkDrawPortDirty(DrawPort());
|
||||
}
|
||||
|
||||
void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) {
|
||||
@@ -2096,6 +2110,14 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr
|
||||
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) {
|
||||
if (!oglThread->Active())
|
||||
return;
|
||||
@@ -2141,10 +2163,16 @@ void cOglOsd::Flush(void) {
|
||||
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(),
|
||||
(!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(),
|
||||
oglPixmaps[i]->DrawPort().X(), oglPixmaps[i]->DrawPort().Y()));
|
||||
bool alphablending = layer == 0 ? false : true; // Decide wether to render (with alpha) or copy a pixmap
|
||||
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(),
|
||||
oglPixmaps[i]->DrawPort().Y(),
|
||||
alphablending
|
||||
));
|
||||
oglPixmaps[i]->SetDirty(false);
|
||||
}
|
||||
}
|
||||
|
@@ -290,10 +290,11 @@ class cOglCmdRenderFbToBufferFb : public cOglCmd {
|
||||
GLfloat x, y;
|
||||
GLfloat drawPortX, drawPortY;
|
||||
GLint transparency;
|
||||
GLint alphablending;
|
||||
|
||||
public:
|
||||
cOglCmdRenderFbToBufferFb(cOglFb *fb, cOglFb *buffer, GLint x, GLint y, GLint transparency, GLint drawPortX,
|
||||
GLint drawPortY);
|
||||
GLint drawPortY, bool alphablending);
|
||||
virtual ~cOglCmdRenderFbToBufferFb(void){};
|
||||
virtual const char *Description(void) { return "Render Framebuffer to Buffer"; }
|
||||
virtual bool Execute(void);
|
||||
@@ -402,9 +403,10 @@ class cOglCmdDrawTexture : public cOglCmd {
|
||||
private:
|
||||
sOglImage *imageRef;
|
||||
GLint x, y;
|
||||
GLfloat scaleX, scaleY;
|
||||
|
||||
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 const char *Description(void) { return "Draw Texture"; }
|
||||
virtual bool Execute(void);
|
||||
@@ -500,6 +502,8 @@ class cOglPixmap : public cPixmap {
|
||||
virtual void Fill(tColor Color);
|
||||
virtual void DrawImage(const cPoint &Point, const cImage &Image);
|
||||
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 DrawBitmap(const cPoint &Point, const cBitmap &Bitmap, tColor ColorFg = 0, tColor ColorBg = 0,
|
||||
bool Overlay = false);
|
||||
@@ -528,6 +532,7 @@ class cOglOsd : public cOsd {
|
||||
public:
|
||||
cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglThread);
|
||||
virtual ~cOglOsd();
|
||||
static void SetOsdPosition(int Left, int Top, int Width, int Height);
|
||||
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);
|
||||
|
@@ -61,7 +61,7 @@ extern void ToggleLUT();
|
||||
/// vdr-plugin version number.
|
||||
/// Makefile extracts the version number for generating the file name
|
||||
/// for the distribution archive.
|
||||
static const char *const VERSION = "3.12"
|
||||
static const char *const VERSION = "3.23"
|
||||
#ifdef GIT_REV
|
||||
"-GIT" GIT_REV
|
||||
#endif
|
||||
@@ -658,6 +658,20 @@ class cDummyPixmap : public cPixmap {
|
||||
(void)Point;
|
||||
(void)ImageHandle;
|
||||
}
|
||||
virtual void DrawScaledImage(const cPoint &Point, const cImage &Image, double FactorX, double FactorY, bool AntiAlias) {
|
||||
(void)Point;
|
||||
(void)Image;
|
||||
(void)FactorX;
|
||||
(void)FactorY;
|
||||
(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;
|
||||
@@ -723,6 +737,12 @@ class cDummyOsd : public cOsd {
|
||||
public:
|
||||
cDummyOsd(int Left, int Top, uint Level) : cOsd(Left, Top, Level) {}
|
||||
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) {
|
||||
p = new cDummyPixmap(Layer, ViewPort, DrawPort);
|
||||
return p;
|
||||
@@ -1147,9 +1167,9 @@ void cMenuSetupSoft::Create(void) {
|
||||
|
||||
if (scalers == 0) {
|
||||
scalingtest[0] = (char *)"Off";
|
||||
for (scalers = 0; pl_named_filters[scalers].name != NULL; scalers++) {
|
||||
scaling[scalers] = (char *)pl_named_filters[scalers].name;
|
||||
scalingtest[scalers + 1] = (char *)pl_named_filters[scalers].name;
|
||||
for (scalers = 0; pl_filter_presets[scalers].name != NULL; scalers++) {
|
||||
scaling[scalers] = (char *)pl_filter_presets[scalers].name;
|
||||
scalingtest[scalers + 1] = (char *)pl_filter_presets[scalers].name;
|
||||
// printf("Scaler %s\n",pl_named_filters[scalers].name);
|
||||
}
|
||||
// scalers -= 2;
|
||||
|
@@ -2817,8 +2817,8 @@ const char *CommandLineHelp(void) {
|
||||
"\tstill-h264-hw-decoder\tenable h264 hw decoder for still-pictures\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-close-open-delay\tenable close open delay to fix no sound "
|
||||
"bug\n"
|
||||
"\talsa-no-test\tdisable Alsa Capability test on start for NUC11/12\n"
|
||||
"\talsa-close-open-delay\tenable close open delay to fix no sound bug\n"
|
||||
"\tignore-repeat-pict\tdisable repeat pict message\n"
|
||||
"\tuse-possible-defect-frames prefer faster channel switch\n"
|
||||
" -D\t\tstart in detached mode\n";
|
||||
@@ -2908,6 +2908,8 @@ int ProcessArgs(int argc, char *const argv[]) {
|
||||
AudioAlsaDriverBroken = 1;
|
||||
} else if (!strcasecmp("alsa-no-close-open", optarg)) {
|
||||
AudioAlsaNoCloseOpen = 1;
|
||||
} else if (!strcasecmp("alsa-no-test", optarg)) {
|
||||
AudioAlsaNotest = 1;
|
||||
} else if (!strcasecmp("alsa-close-open-delay", optarg)) {
|
||||
AudioAlsaCloseOpenDelay = 1;
|
||||
} else if (!strcasecmp("ignore-repeat-pict", optarg)) {
|
||||
|
117
video.c
117
video.c
@@ -1246,28 +1246,33 @@ static void EglExit(void) {
|
||||
glxSharedContext = NULL;
|
||||
}
|
||||
#else
|
||||
if (eglGetCurrentContext() == eglContext) {
|
||||
// if currently used, set to none
|
||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
}
|
||||
#ifndef USE_DRM
|
||||
if (eglSharedContext) {
|
||||
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||
EglCheck();
|
||||
}
|
||||
#ifdef USE_DRM
|
||||
drm_clean_up();
|
||||
|
||||
#endif
|
||||
|
||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
if (eglSurface) {
|
||||
eglDestroySurface(eglDisplay, eglSurface);
|
||||
EglCheck();
|
||||
eglSurface = NULL;
|
||||
}
|
||||
|
||||
if (eglContext) {
|
||||
eglDestroyContext(eglDisplay, eglContext);
|
||||
EglCheck();
|
||||
eglContext = NULL;
|
||||
}
|
||||
if (eglSharedContext) {
|
||||
eglDestroyContext(eglDisplay, eglSharedContext);
|
||||
EglCheck();
|
||||
eglSharedContext = NULL;
|
||||
}
|
||||
|
||||
|
||||
eglTerminate(eglDisplay);
|
||||
#endif
|
||||
|
||||
#ifdef USE_DRM
|
||||
drm_clean_up();
|
||||
#endif
|
||||
eglDisplay = NULL;
|
||||
|
||||
#endif
|
||||
}
|
||||
@@ -1990,6 +1995,9 @@ make_egl() {
|
||||
Fatal(_("Could not make context current!\n"));
|
||||
}
|
||||
EglEnabled = 1;
|
||||
#ifdef USE_DRM
|
||||
drm_swap_buffers();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -2611,7 +2619,16 @@ void generateVAAPIImage(CuvidDecoder *decoder, VASurfaceID index, const AVFrame
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, decoder->gl_textures[index * Planes + n]);
|
||||
EGLImageTargetTexture2DOES(GL_TEXTURE_2D, decoder->images[index * Planes + n]);
|
||||
decoder->fds[index * Planes + n] = desc.objects[n].fd;
|
||||
if (n==0) {
|
||||
decoder->fds[index * Planes + n] = fd;
|
||||
|
||||
}
|
||||
else if (fd == decoder->fds[index * Planes]) {
|
||||
decoder->fds[index * Planes + n] = 0;
|
||||
}
|
||||
else {
|
||||
decoder->fds[index * Planes + n] = fd;
|
||||
}
|
||||
}
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
@@ -2682,8 +2699,6 @@ int push_filters(AVCodecContext *dec_ctx, CuvidDecoder *decoder, AVFrame *frame)
|
||||
while ((ret = av_buffersink_get_frame(decoder->buffersink_ctx, filt_frame)) >= 0) {
|
||||
filt_frame->pts /= 2;
|
||||
decoder->Interlaced = 0;
|
||||
// printf("vaapideint video:new %#012" PRIx64 " old %#012" PRIx64
|
||||
// "\n",filt_frame->pts,frame->pts);
|
||||
CuvidSyncRenderFrame(decoder, dec_ctx, filt_frame);
|
||||
filt_frame = av_frame_alloc(); // get new frame
|
||||
}
|
||||
@@ -2959,19 +2974,6 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
|
||||
#ifdef PLACEBO
|
||||
VideoThreadUnlock();
|
||||
// dont show first frame
|
||||
#endif
|
||||
#ifdef YADIF
|
||||
if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) {
|
||||
deint = 0;
|
||||
ist->filter = 1; // init yadif_cuda
|
||||
} else {
|
||||
deint = 2;
|
||||
ist->filter = 0;
|
||||
}
|
||||
CuvidMessage(2, "deint = %s\n", deint == 0 ? "Yadif" : "Cuda");
|
||||
if (av_opt_set_int(video_ctx->priv_data, "deint", deint, 0) < 0) { // adaptive
|
||||
Fatal(_("codec: can't set option deint to video codec!\n"));
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
decoder->SyncCounter = 0;
|
||||
@@ -2985,15 +2987,31 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
|
||||
CuvidUpdateOutput(decoder); // update aspect/scaling
|
||||
}
|
||||
|
||||
#if defined YADIF && defined CUVID
|
||||
if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) {
|
||||
deint = 0;
|
||||
ist->filter = 1; // init yadif_cuda
|
||||
} else {
|
||||
deint = 2;
|
||||
ist->filter = 0;
|
||||
}
|
||||
CuvidMessage(2, "deint = %s\n", deint == 0 ? "Yadif" : "Cuda");
|
||||
if (av_opt_set_int(video_ctx->priv_data, "deint", deint, 0) < 0) { // adaptive
|
||||
Fatal(_("codec: can't set option deint to video codec!\n"));
|
||||
}
|
||||
#endif
|
||||
|
||||
CuvidMessage(2, "GetFormat Init ok %dx%d\n", video_ctx->width, video_ctx->height);
|
||||
decoder->InputAspect = video_ctx->sample_aspect_ratio;
|
||||
#ifdef CUVID
|
||||
ist->active_hwaccel_id = HWACCEL_CUVID;
|
||||
#else
|
||||
if (VideoDeinterlace[decoder->Resolution]) // need deinterlace
|
||||
if (VideoDeinterlace[decoder->Resolution]) {// need deinterlace
|
||||
ist->filter = 1; // init deint vaapi
|
||||
else
|
||||
}
|
||||
else {
|
||||
ist->filter = 0;
|
||||
}
|
||||
|
||||
ist->active_hwaccel_id = HWACCEL_VAAPI;
|
||||
#endif
|
||||
@@ -3793,6 +3811,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
||||
AVFrameSideData *sd, *sd1 = NULL, *sd2 = NULL;
|
||||
|
||||
#ifdef PLACEBO
|
||||
|
||||
if (level) {
|
||||
dst_rect.x0 = decoder->VideoX; // video window output (clip)
|
||||
dst_rect.y0 = decoder->VideoY;
|
||||
@@ -4079,8 +4098,11 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
||||
|
||||
// render_params.upscaler = &pl_filter_ewa_lanczos;
|
||||
|
||||
render_params.upscaler = pl_named_filters[VideoScaling[decoder->Resolution]].filter;
|
||||
render_params.downscaler = pl_named_filters[VideoScaling[decoder->Resolution]].filter;
|
||||
render_params.upscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter;
|
||||
render_params.downscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter;
|
||||
|
||||
if (level)
|
||||
render_params.skip_target_clearing = 1;
|
||||
|
||||
render_params.color_adjustment = &colors;
|
||||
|
||||
@@ -4147,7 +4169,8 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
||||
if (!pl_render_image(p->renderer, &decoder->pl_frames[current], target, &render_params)) {
|
||||
Debug(4, "Failed rendering frame!\n");
|
||||
}
|
||||
// pl_gpu_finish(p->gpu);
|
||||
|
||||
|
||||
// printf("Rendertime %ld -- \n,",GetusTicks() - tt);
|
||||
|
||||
if (VideoScalerTest) { // left side test scaler
|
||||
@@ -4170,11 +4193,12 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
||||
target->crop.y1 = dst_video_rect.y1;
|
||||
#endif
|
||||
|
||||
render_params.upscaler = pl_named_filters[VideoScalerTest - 1].filter;
|
||||
render_params.downscaler = pl_named_filters[VideoScalerTest - 1].filter;
|
||||
render_params.upscaler = pl_filter_presets[VideoScalerTest - 1].filter;
|
||||
render_params.downscaler = pl_filter_presets[VideoScalerTest - 1].filter;
|
||||
|
||||
// render_params.lut = NULL;
|
||||
render_params.num_hooks = 0;
|
||||
render_params.skip_target_clearing = 1;
|
||||
|
||||
if (!p->renderertest)
|
||||
p->renderertest = pl_renderer_create(p->ctx, p->gpu);
|
||||
@@ -4413,7 +4437,7 @@ static void CuvidDisplayFrame(void) {
|
||||
if ((VideoShowBlackPicture && !decoder->TrickSpeed) ||
|
||||
(VideoShowBlackPicture && decoder->Closing < -300)) {
|
||||
CuvidBlackSurface(decoder);
|
||||
CuvidMessage(4, "video/cuvid: black surface displayed\n");
|
||||
CuvidMessage(4, "video/cuvid: black surface displayed Filled %d\n",filled);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
@@ -4460,6 +4484,9 @@ static void CuvidDisplayFrame(void) {
|
||||
decoder->grab = 0;
|
||||
}
|
||||
}
|
||||
#ifdef PLACEBO
|
||||
pl_gpu_finish(p->gpu);
|
||||
#endif
|
||||
|
||||
#ifndef PLACEBO
|
||||
// add osd to surface
|
||||
@@ -4876,7 +4903,7 @@ static void CuvidSyncRenderFrame(CuvidDecoder *decoder, const AVCodecContext *vi
|
||||
// if video output buffer is full, wait and display surface.
|
||||
// loop for interlace
|
||||
if (atomic_read(&decoder->SurfacesFilled) >= VIDEO_SURFACES_MAX) {
|
||||
Fatal("video/cuvid: this code part shouldn't be used\n");
|
||||
//Fatal("video/cuvid: this code part shouldn't be used\n");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -6883,10 +6910,10 @@ void VideoSetAbove() {
|
||||
void VideoSetDeinterlace(int mode[VideoResolutionMax]) {
|
||||
#ifdef CUVID
|
||||
VideoDeinterlace[0] = mode[0]; // 576i
|
||||
VideoDeinterlace[1] = 1; // mode[1]; // 720p
|
||||
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
||||
VideoDeinterlace[2] = mode[2]; // fake 1080
|
||||
VideoDeinterlace[3] = mode[3]; // 1080
|
||||
VideoDeinterlace[4] = 1; // mode[4]; 2160p
|
||||
VideoDeinterlace[4] = 0; // mode[4]; 2160p
|
||||
#else
|
||||
VideoDeinterlace[0] = 1; // 576i
|
||||
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
||||
@@ -7074,6 +7101,14 @@ void VideoInit(const char *display_name) {
|
||||
xcb_screen_iterator_t screen_iter;
|
||||
xcb_screen_t const *screen;
|
||||
|
||||
#ifdef VAAPI
|
||||
VideoDeinterlace[0] = 1; // 576i
|
||||
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
||||
VideoDeinterlace[2] = 1; // fake 1080
|
||||
VideoDeinterlace[3] = 1; // 1080
|
||||
VideoDeinterlace[4] = 0; // mode[4]; 2160p
|
||||
#endif
|
||||
|
||||
#ifdef USE_DRM
|
||||
VideoInitDrm();
|
||||
#else
|
||||
|
Reference in New Issue
Block a user