11 Commits
V3.16 ... V3.20

Author SHA1 Message Date
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
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
5 changed files with 82 additions and 43 deletions

View File

@@ -24,7 +24,7 @@ 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
@@ -35,7 +35,6 @@ YADIF = 1
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):

34
codec.c
View File

@@ -716,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) {
@@ -881,7 +878,7 @@ static int CodecAudioUpdateHelper(AudioDecoder *audio_decoder, int *passthrough)
audio_decoder->SampleRate = audio_ctx->sample_rate;
audio_decoder->HwSampleRate = audio_ctx->sample_rate;
audio_decoder->Channels = audio_ctx->channels;
audio_decoder->HwChannels = audio_ctx->channels;
audio_decoder->HwChannels = CodecDownmix ? 2 : audio_ctx->channels;
audio_decoder->Passthrough = CodecPassthrough;
// SPDIF/HDMI pass-through
@@ -1161,14 +1158,29 @@ static void CodecAudioUpdateFormat(AudioDecoder *audio_decoder) {
}
#endif
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 LIBSWRESAMPLE_VERSION_INT < AV_VERSION_INT(4,5,100)
audio_decoder->Resample = swr_alloc_set_opts(audio_decoder->Resample,
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) {
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"));
}
}
/**
@@ -1220,13 +1232,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,

31
drm.c
View File

@@ -545,6 +545,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 +563,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 +615,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");
}

View File

@@ -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.16"
static const char *const VERSION = "3.20"
#ifdef GIT_REV
"-GIT" GIT_REV
#endif

40
video.c
View File

@@ -1246,14 +1246,22 @@ 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);
#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;
}
#ifndef USE_DRM
if (eglSharedContext) {
eglDestroyContext(eglDisplay, eglSharedContext);
EglCheck();
eglSharedContext = NULL;
}
if (eglContext) {
@@ -1261,13 +1269,8 @@ static void EglExit(void) {
EglCheck();
eglContext = NULL;
}
eglTerminate(eglDisplay);
#endif
#ifdef USE_DRM
drm_clean_up();
#endif
eglDisplay = NULL;
#endif
}
@@ -1990,6 +1993,9 @@ make_egl() {
Fatal(_("Could not make context current!\n"));
}
EglEnabled = 1;
#ifdef USE_DRM
drm_swap_buffers();
#endif
}
#endif
@@ -2998,10 +3004,12 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
#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
@@ -7091,6 +7099,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