mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2025-03-01 10:39:28 +00:00
Cleanup some Compiler Warnings
This commit is contained in:
parent
68fc7e4511
commit
41da5ca526
5
audio.c
5
audio.c
@ -2283,26 +2283,31 @@ found:
|
|||||||
AudioChannelMatrix[u][chan] = 4;
|
AudioChannelMatrix[u][chan] = 4;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
case 4:
|
case 4:
|
||||||
if (AudioChannelsInHw[5]) {
|
if (AudioChannelsInHw[5]) {
|
||||||
AudioChannelMatrix[u][chan] = 5;
|
AudioChannelMatrix[u][chan] = 5;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
case 5:
|
case 5:
|
||||||
if (AudioChannelsInHw[6]) {
|
if (AudioChannelsInHw[6]) {
|
||||||
AudioChannelMatrix[u][chan] = 6;
|
AudioChannelMatrix[u][chan] = 6;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
case 6:
|
case 6:
|
||||||
if (AudioChannelsInHw[7]) {
|
if (AudioChannelsInHw[7]) {
|
||||||
AudioChannelMatrix[u][chan] = 7;
|
AudioChannelMatrix[u][chan] = 7;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
case 7:
|
case 7:
|
||||||
if (AudioChannelsInHw[8]) {
|
if (AudioChannelsInHw[8]) {
|
||||||
AudioChannelMatrix[u][chan] = 8;
|
AudioChannelMatrix[u][chan] = 8;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
case 8:
|
case 8:
|
||||||
if (AudioChannelsInHw[6]) {
|
if (AudioChannelsInHw[6]) {
|
||||||
AudioChannelMatrix[u][chan] = 6;
|
AudioChannelMatrix[u][chan] = 6;
|
||||||
|
20
codec.c
20
codec.c
@ -208,9 +208,13 @@ void CodecVideoDelDecoder(VideoDecoder *decoder) { free(decoder); }
|
|||||||
** @param codec_id video codec id
|
** @param codec_id video codec id
|
||||||
*/
|
*/
|
||||||
void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
||||||
AVCodec *video_codec;
|
AVCodec *video_codec;
|
||||||
|
#else
|
||||||
|
const AVCodec *video_codec;
|
||||||
|
#endif
|
||||||
const char *name;
|
const char *name;
|
||||||
int ret, deint = 2;
|
int ret;
|
||||||
|
|
||||||
Debug(3, "***************codec: Video Open using video codec ID %#06x (%s)\n", codec_id,
|
Debug(3, "***************codec: Video Open using video codec ID %#06x (%s)\n", codec_id,
|
||||||
avcodec_get_name(codec_id));
|
avcodec_get_name(codec_id));
|
||||||
@ -265,9 +269,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
|||||||
|
|
||||||
pthread_mutex_lock(&CodecLockMutex);
|
pthread_mutex_lock(&CodecLockMutex);
|
||||||
// open codec
|
// open codec
|
||||||
#ifdef YADIF
|
|
||||||
deint = 2;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined VAAPI
|
#if defined VAAPI
|
||||||
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100)
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100)
|
||||||
@ -305,6 +307,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef CUVID
|
#ifdef CUVID
|
||||||
|
int deint = 2;
|
||||||
if (strcmp(decoder->VideoCodec->long_name,
|
if (strcmp(decoder->VideoCodec->long_name,
|
||||||
"Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken
|
"Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken
|
||||||
if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", deint, 0) < 0) { // adaptive
|
if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", deint, 0) < 0) { // adaptive
|
||||||
@ -619,7 +622,11 @@ typedef struct _audio_decoder_ AudioDecoder;
|
|||||||
/// Audio decoder structure.
|
/// Audio decoder structure.
|
||||||
///
|
///
|
||||||
struct _audio_decoder_ {
|
struct _audio_decoder_ {
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
||||||
AVCodec *AudioCodec; ///< audio codec
|
AVCodec *AudioCodec; ///< audio codec
|
||||||
|
#else
|
||||||
|
const AVCodec *AudioCodec; ///< audio codec
|
||||||
|
#endif
|
||||||
AVCodecContext *AudioCtx; ///< audio codec context
|
AVCodecContext *AudioCtx; ///< audio codec context
|
||||||
|
|
||||||
char Passthrough; ///< current pass-through flags
|
char Passthrough; ///< current pass-through flags
|
||||||
@ -706,8 +713,11 @@ void CodecAudioDelDecoder(AudioDecoder *decoder) {
|
|||||||
** @param codec_id audio codec id
|
** @param codec_id audio codec id
|
||||||
*/
|
*/
|
||||||
void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
|
void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) {
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
||||||
AVCodec *audio_codec;
|
AVCodec *audio_codec;
|
||||||
|
#else
|
||||||
|
const AVCodec *audio_codec;
|
||||||
|
#endif
|
||||||
Debug(3, "codec: using audio codec ID %#06x (%s)\n", codec_id, avcodec_get_name(codec_id));
|
Debug(3, "codec: using audio codec ID %#06x (%s)\n", codec_id, avcodec_get_name(codec_id));
|
||||||
if (!(audio_codec = avcodec_find_decoder(codec_id))) {
|
if (!(audio_codec = avcodec_find_decoder(codec_id))) {
|
||||||
// if (!(audio_codec = avcodec_find_decoder(codec_id))) {
|
// if (!(audio_codec = avcodec_find_decoder(codec_id))) {
|
||||||
|
4
codec.h
4
codec.h
@ -56,7 +56,11 @@ struct _video_decoder_ {
|
|||||||
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
VideoHwDecoder *HwDecoder; ///< video hardware decoder
|
||||||
|
|
||||||
int GetFormatDone; ///< flag get format called!
|
int GetFormatDone; ///< flag get format called!
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100)
|
||||||
AVCodec *VideoCodec; ///< video codec
|
AVCodec *VideoCodec; ///< video codec
|
||||||
|
#else
|
||||||
|
const AVCodec *VideoCodec; ///< video codec
|
||||||
|
#endif
|
||||||
AVCodecContext *VideoCtx; ///< video codec context
|
AVCodecContext *VideoCtx; ///< video codec context
|
||||||
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
// #ifdef FFMPEG_WORKAROUND_ARTIFACTS
|
||||||
int FirstKeyFrame; ///< flag first frame
|
int FirstKeyFrame; ///< flag first frame
|
||||||
|
@ -126,7 +126,7 @@ void pl_shader_append_v(const char *fmt, ...) {
|
|||||||
Fatal(_("Shaderlenght fault\n"));
|
Fatal(_("Shaderlenght fault\n"));
|
||||||
strcat(shv, temp);
|
strcat(shv, temp);
|
||||||
}
|
}
|
||||||
|
#ifndef PLACEBO
|
||||||
static void compile_attach_shader(GLuint program, GLenum type, const char *source) {
|
static void compile_attach_shader(GLuint program, GLenum type, const char *source) {
|
||||||
GLuint shader;
|
GLuint shader;
|
||||||
GLint status = 1234, log_length;
|
GLint status = 1234, log_length;
|
||||||
@ -159,6 +159,7 @@ static void link_shader(GLuint program) {
|
|||||||
Debug(3, "Link Status %d loglen %d\n", status, log_length);
|
Debug(3, "Link Status %d loglen %d\n", status, log_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static GLuint sc_generate_osd(GLuint gl_prog) {
|
static GLuint sc_generate_osd(GLuint gl_prog) {
|
||||||
|
|
||||||
Debug(3, "vor create osd\n");
|
Debug(3, "vor create osd\n");
|
||||||
@ -209,7 +210,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) {
|
|||||||
int n;
|
int n;
|
||||||
GLint cmsLoc;
|
GLint cmsLoc;
|
||||||
float *m, *c, *cms;
|
float *m, *c, *cms;
|
||||||
char *frag;
|
//char *frag;
|
||||||
|
|
||||||
GL_init();
|
GL_init();
|
||||||
GLSL("%s\n", gl_version);
|
GLSL("%s\n", gl_version);
|
||||||
@ -446,3 +447,4 @@ static void render_pass_quad(int flip, float xcrop, float ycrop) {
|
|||||||
for (n = 0; vertex_vao[n].name; n++)
|
for (n = 0; vertex_vao[n].name; n++)
|
||||||
glDisableVertexAttribArray(n);
|
glDisableVertexAttribArray(n);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@ -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.25"
|
static const char *const VERSION = "3.26"
|
||||||
#ifdef GIT_REV
|
#ifdef GIT_REV
|
||||||
"-GIT" GIT_REV
|
"-GIT" GIT_REV
|
||||||
#endif
|
#endif
|
||||||
|
27
softhddev.c
27
softhddev.c
@ -60,7 +60,7 @@
|
|||||||
#include "codec.h"
|
#include "codec.h"
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if 0
|
||||||
static int DumpH264(const uint8_t *data, int size);
|
static int DumpH264(const uint8_t *data, int size);
|
||||||
static void DumpMpeg(const uint8_t *data, int size);
|
static void DumpMpeg(const uint8_t *data, int size);
|
||||||
#endif
|
#endif
|
||||||
@ -662,7 +662,13 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100)
|
||||||
AVPacket avpkt[1];
|
AVPacket avpkt[1];
|
||||||
|
av_init_packet(avpkt);
|
||||||
|
#else
|
||||||
|
AVPacket * avpkt;
|
||||||
|
avpkt = av_packet_alloc();
|
||||||
|
#endif
|
||||||
|
|
||||||
// new codec id, close and open new
|
// new codec id, close and open new
|
||||||
if (AudioCodecID != codec_id) {
|
if (AudioCodecID != codec_id) {
|
||||||
@ -671,13 +677,15 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star
|
|||||||
CodecAudioOpen(MyAudioDecoder, codec_id);
|
CodecAudioOpen(MyAudioDecoder, codec_id);
|
||||||
AudioCodecID = codec_id;
|
AudioCodecID = codec_id;
|
||||||
}
|
}
|
||||||
av_init_packet(avpkt);
|
|
||||||
avpkt->data = (void *)q;
|
avpkt->data = (void *)q;
|
||||||
avpkt->size = r;
|
avpkt->size = r;
|
||||||
avpkt->pts = pesdx->PTS;
|
avpkt->pts = pesdx->PTS;
|
||||||
avpkt->dts = pesdx->DTS;
|
avpkt->dts = pesdx->DTS;
|
||||||
// FIXME: not aligned for ffmpeg
|
// FIXME: not aligned for ffmpeg
|
||||||
CodecAudioDecode(MyAudioDecoder, avpkt);
|
CodecAudioDecode(MyAudioDecoder, avpkt);
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100)
|
||||||
|
av_packet_free(&avpkt);
|
||||||
|
#endif
|
||||||
pesdx->PTS = AV_NOPTS_VALUE;
|
pesdx->PTS = AV_NOPTS_VALUE;
|
||||||
pesdx->DTS = AV_NOPTS_VALUE;
|
pesdx->DTS = AV_NOPTS_VALUE;
|
||||||
pesdx->Skip += r;
|
pesdx->Skip += r;
|
||||||
@ -1147,21 +1155,28 @@ int PlayAudio(const uint8_t *data, int size, uint8_t id) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
|
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100)
|
||||||
AVPacket avpkt[1];
|
AVPacket avpkt[1];
|
||||||
|
av_init_packet(avpkt);
|
||||||
|
#else
|
||||||
|
AVPacket * avpkt;
|
||||||
|
avpkt = av_packet_alloc();
|
||||||
|
#endif
|
||||||
// new codec id, close and open new
|
// new codec id, close and open new
|
||||||
if (AudioCodecID != codec_id) {
|
if (AudioCodecID != codec_id) {
|
||||||
CodecAudioClose(MyAudioDecoder);
|
CodecAudioClose(MyAudioDecoder);
|
||||||
CodecAudioOpen(MyAudioDecoder, codec_id);
|
CodecAudioOpen(MyAudioDecoder, codec_id);
|
||||||
AudioCodecID = codec_id;
|
AudioCodecID = codec_id;
|
||||||
}
|
}
|
||||||
av_init_packet(avpkt);
|
|
||||||
avpkt->data = (void *)p;
|
avpkt->data = (void *)p;
|
||||||
avpkt->size = r;
|
avpkt->size = r;
|
||||||
avpkt->pts = AudioAvPkt->pts;
|
avpkt->pts = AudioAvPkt->pts;
|
||||||
avpkt->dts = AudioAvPkt->dts;
|
avpkt->dts = AudioAvPkt->dts;
|
||||||
// FIXME: not aligned for ffmpeg
|
// FIXME: not aligned for ffmpeg
|
||||||
CodecAudioDecode(MyAudioDecoder, avpkt);
|
CodecAudioDecode(MyAudioDecoder, avpkt);
|
||||||
|
#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100)
|
||||||
|
av_packet_free(&avpkt);
|
||||||
|
#endif
|
||||||
AudioAvPkt->pts = AV_NOPTS_VALUE;
|
AudioAvPkt->pts = AV_NOPTS_VALUE;
|
||||||
AudioAvPkt->dts = AV_NOPTS_VALUE;
|
AudioAvPkt->dts = AV_NOPTS_VALUE;
|
||||||
p += r;
|
p += r;
|
||||||
@ -1625,7 +1640,7 @@ static void VideoMpegEnqueue(VideoStream *stream, int64_t pts, int64_t dts, cons
|
|||||||
** @param avpkt ffmpeg a/v packet
|
** @param avpkt ffmpeg a/v packet
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef USE_PIP
|
#if !defined USE_PIP && !defined VAAPI
|
||||||
static void FixPacketForFFMpeg(VideoDecoder *vdecoder, AVPacket *avpkt) {
|
static void FixPacketForFFMpeg(VideoDecoder *vdecoder, AVPacket *avpkt) {
|
||||||
uint8_t *p;
|
uint8_t *p;
|
||||||
int n;
|
int n;
|
||||||
@ -1993,7 +2008,7 @@ static void StopVideo(void) {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#if 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
** Dump mpeg video packet.
|
** Dump mpeg video packet.
|
||||||
|
293
video.c
293
video.c
@ -172,6 +172,7 @@ typedef enum {
|
|||||||
#if !defined PLACEBO_GL
|
#if !defined PLACEBO_GL
|
||||||
#include <EGL/egl.h>
|
#include <EGL/egl.h>
|
||||||
#include <EGL/eglext.h>
|
#include <EGL/eglext.h>
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef GL_OES_EGL_image
|
#ifndef GL_OES_EGL_image
|
||||||
@ -183,6 +184,7 @@ typedef void *EGLImageKHR;
|
|||||||
|
|
||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
#ifdef PLACEBO_GL
|
#ifdef PLACEBO_GL
|
||||||
|
GLenum glewInit(void);
|
||||||
#include <libplacebo/opengl.h>
|
#include <libplacebo/opengl.h>
|
||||||
#else
|
#else
|
||||||
#define VK_USE_PLATFORM_XCB_KHR
|
#define VK_USE_PLATFORM_XCB_KHR
|
||||||
@ -380,18 +382,12 @@ signed char VideoHardwareDecoder = -1; ///< flag use hardware decoder
|
|||||||
|
|
||||||
static char VideoSurfaceModesChanged; ///< flag surface modes changed
|
static char VideoSurfaceModesChanged; ///< flag surface modes changed
|
||||||
|
|
||||||
/// flag use transparent OSD.
|
|
||||||
static const char VideoTransparentOsd = 1;
|
|
||||||
|
|
||||||
static uint32_t VideoBackground; ///< video background color
|
static uint32_t VideoBackground; ///< video background color
|
||||||
char VideoStudioLevels; ///< flag use studio levels
|
char VideoStudioLevels; ///< flag use studio levels
|
||||||
|
|
||||||
/// Default deinterlace mode.
|
/// Default deinterlace mode.
|
||||||
static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax];
|
static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax];
|
||||||
|
|
||||||
/// Default number of deinterlace surfaces
|
|
||||||
static const int VideoDeinterlaceSurfaces = 4;
|
|
||||||
|
|
||||||
/// Default skip chroma deinterlace flag (CUVID only).
|
/// Default skip chroma deinterlace flag (CUVID only).
|
||||||
static char VideoSkipChromaDeinterlace[VideoResolutionMax];
|
static char VideoSkipChromaDeinterlace[VideoResolutionMax];
|
||||||
|
|
||||||
@ -430,7 +426,7 @@ static int DRMRefresh = 50;
|
|||||||
|
|
||||||
static char Video60HzMode; ///< handle 60hz displays
|
static char Video60HzMode; ///< handle 60hz displays
|
||||||
static char VideoSoftStartSync; ///< soft start sync audio/video
|
static char VideoSoftStartSync; ///< soft start sync audio/video
|
||||||
static const int VideoSoftStartFrames = 100; ///< soft start frames
|
//static const int VideoSoftStartFrames = 100; ///< soft start frames
|
||||||
static char VideoShowBlackPicture; ///< flag show black picture
|
static char VideoShowBlackPicture; ///< flag show black picture
|
||||||
|
|
||||||
static float VideoBrightness = 0.0f;
|
static float VideoBrightness = 0.0f;
|
||||||
@ -442,11 +438,14 @@ static float VideoTemperature = 0.0f;
|
|||||||
static int VulkanTargetColorSpace = 0;
|
static int VulkanTargetColorSpace = 0;
|
||||||
static int VideoScalerTest = 0;
|
static int VideoScalerTest = 0;
|
||||||
static int VideoColorBlindness = 0;
|
static int VideoColorBlindness = 0;
|
||||||
static float VideoColorBlindnessFaktor = 1.0f;
|
static float VideoColorBlindnessFaktor = 1.0;
|
||||||
|
|
||||||
|
#ifdef PLACEBO
|
||||||
static char *shadersp[NUM_SHADERS];
|
static char *shadersp[NUM_SHADERS];
|
||||||
char MyConfigDir[200];
|
char MyConfigDir[200];
|
||||||
static int num_shaders = 0;
|
static int num_shaders = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
static int LUTon = -1;
|
static int LUTon = -1;
|
||||||
|
|
||||||
static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message atom
|
static xcb_atom_t WmDeleteWindowAtom; ///< WM delete message atom
|
||||||
@ -494,11 +493,11 @@ static char DPMSDisabled; ///< flag we have disabled dpms
|
|||||||
static char EnableDPMSatBlackScreen; ///< flag we should enable dpms at black screen
|
static char EnableDPMSatBlackScreen; ///< flag we should enable dpms at black screen
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static unsigned int Count;
|
|
||||||
static int EglEnabled; ///< use EGL
|
static int EglEnabled; ///< use EGL
|
||||||
static int GlxVSyncEnabled = 1; ///< enable/disable v-sync
|
|
||||||
|
|
||||||
#ifdef CUVID
|
#ifdef CUVID
|
||||||
|
static int GlxVSyncEnabled = 1; ///< enable/disable v-sync
|
||||||
|
static unsigned int Count;
|
||||||
static GLXContext glxSharedContext; ///< shared gl context
|
static GLXContext glxSharedContext; ///< shared gl context
|
||||||
static GLXContext glxContext; ///< our gl context
|
static GLXContext glxContext; ///< our gl context
|
||||||
|
|
||||||
@ -509,11 +508,13 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex
|
|||||||
GLXContext OSDcontext;
|
GLXContext OSDcontext;
|
||||||
#else
|
#else
|
||||||
static EGLContext eglSharedContext; ///< shared gl context
|
static EGLContext eglSharedContext; ///< shared gl context
|
||||||
|
#ifdef USE_DRM
|
||||||
static EGLContext eglOSDContext = NULL; ///< our gl context for the thread
|
static EGLContext eglOSDContext = NULL; ///< our gl context for the thread
|
||||||
|
#endif
|
||||||
static EGLContext eglContext; ///< our gl context
|
static EGLContext eglContext; ///< our gl context
|
||||||
static EGLConfig eglConfig;
|
static EGLConfig eglConfig;
|
||||||
static EGLDisplay eglDisplay;
|
static EGLDisplay eglDisplay;
|
||||||
static EGLSurface eglSurface, eglOSDSurface;
|
static EGLSurface eglSurface;
|
||||||
static EGLint eglAttrs[10];
|
static EGLint eglAttrs[10];
|
||||||
static int eglVersion = 2;
|
static int eglVersion = 2;
|
||||||
static EGLImageKHR(EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *);
|
static EGLImageKHR(EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *);
|
||||||
@ -531,9 +532,6 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContex
|
|||||||
EGLContext OSDcontext;
|
EGLContext OSDcontext;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static GLuint OsdGlTextures[2]; ///< gl texture for OSD
|
|
||||||
static int OsdIndex = 0; ///< index into OsdGlTextures
|
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
// Common Functions
|
// Common Functions
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
@ -630,8 +628,8 @@ static void VideoSetPts(int64_t *pts_p, int interlaced, const AVCodecContext *vi
|
|||||||
// } else {
|
// } else {
|
||||||
duration = interlaced ? 40 : 20; // 50Hz -> 20ms default
|
duration = interlaced ? 40 : 20; // 50Hz -> 20ms default
|
||||||
// }
|
// }
|
||||||
// Debug(4, "video: %d/%d %" PRIx64 " -> %d\n", video_ctx->framerate.den,
|
Debug(4, "video: Framerate %d/%d \n", video_ctx->framerate.den,
|
||||||
// video_ctx->framerate.num, av_frame_get_pkt_duration(frame), duration);
|
video_ctx->framerate.num);
|
||||||
|
|
||||||
// update video clock
|
// update video clock
|
||||||
if (*pts_p != (int64_t)AV_NOPTS_VALUE) {
|
if (*pts_p != (int64_t)AV_NOPTS_VALUE) {
|
||||||
@ -793,7 +791,7 @@ video_none:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint64_t test_time = 0;
|
//static uint64_t test_time = 0;
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Lock video thread.
|
/// Lock video thread.
|
||||||
@ -871,18 +869,7 @@ static uint64_t test_time = 0;
|
|||||||
|
|
||||||
#ifdef USE_GLX
|
#ifdef USE_GLX
|
||||||
|
|
||||||
///
|
|
||||||
/// GLX extension functions
|
|
||||||
///@{
|
|
||||||
#ifdef GLX_MESA_swap_control
|
|
||||||
static PFNGLXSWAPINTERVALMESAPROC GlxSwapIntervalMESA;
|
|
||||||
#endif
|
|
||||||
#ifdef GLX_SGI_video_sync
|
|
||||||
static PFNGLXGETVIDEOSYNCSGIPROC GlxGetVideoSyncSGI;
|
|
||||||
#endif
|
|
||||||
#ifdef GLX_SGI_swap_control
|
|
||||||
static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
///
|
///
|
||||||
/// GLX check error.
|
/// GLX check error.
|
||||||
@ -896,6 +883,21 @@ static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI;
|
|||||||
} \
|
} \
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef CUVID
|
||||||
|
///
|
||||||
|
/// GLX extension functions
|
||||||
|
///@{
|
||||||
|
#ifdef GLX_MESA_swap_control
|
||||||
|
static PFNGLXSWAPINTERVALMESAPROC GlxSwapIntervalMESA;
|
||||||
|
#endif
|
||||||
|
#ifdef GLX_SGI_video_sync
|
||||||
|
static PFNGLXGETVIDEOSYNCSGIPROC GlxGetVideoSyncSGI;
|
||||||
|
#endif
|
||||||
|
#ifdef GLX_SGI_swap_control
|
||||||
|
static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI;
|
||||||
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
/// GLX check if a GLX extension is supported.
|
/// GLX check if a GLX extension is supported.
|
||||||
///
|
///
|
||||||
@ -915,6 +917,7 @@ static int GlxIsExtensionSupported(const char *ext) {
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
///
|
///
|
||||||
/// Setup GLX window.
|
/// Setup GLX window.
|
||||||
@ -930,11 +933,12 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex
|
|||||||
static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context)
|
static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
#ifdef CUVID
|
||||||
uint32_t start;
|
uint32_t start;
|
||||||
uint32_t end;
|
uint32_t end;
|
||||||
int i;
|
int i;
|
||||||
unsigned count;
|
unsigned count;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PLACEBO_
|
#ifdef PLACEBO_
|
||||||
return;
|
return;
|
||||||
@ -1170,6 +1174,7 @@ static void EglInit(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#else // VAAPI
|
#else // VAAPI
|
||||||
|
extern void make_egl(void);
|
||||||
static void EglInit(void) {
|
static void EglInit(void) {
|
||||||
int redSize, greenSize, blueSize, alphaSize;
|
int redSize, greenSize, blueSize, alphaSize;
|
||||||
static int glewdone = 0;
|
static int glewdone = 0;
|
||||||
@ -1185,7 +1190,8 @@ static void EglInit(void) {
|
|||||||
make_egl();
|
make_egl();
|
||||||
|
|
||||||
if (!glewdone) {
|
if (!glewdone) {
|
||||||
GLenum err = glewInit();
|
//GLenum err = glewInit();
|
||||||
|
glewInit();
|
||||||
|
|
||||||
glewdone = 1;
|
glewdone = 1;
|
||||||
// if (err != GLEW_OK) {
|
// if (err != GLEW_OK) {
|
||||||
@ -1456,11 +1462,11 @@ typedef struct priv {
|
|||||||
const struct pl_vulkan *vk;
|
const struct pl_vulkan *vk;
|
||||||
const struct pl_vk_inst *vk_inst;
|
const struct pl_vk_inst *vk_inst;
|
||||||
#endif
|
#endif
|
||||||
struct pl_context *ctx;
|
const struct pl_log_t *ctx;
|
||||||
struct pl_custom_lut *lut;
|
struct pl_custom_lut *lut;
|
||||||
struct pl_renderer *renderer;
|
struct pl_renderer_t *renderer;
|
||||||
struct pl_renderer *renderertest;
|
struct pl_renderer_t *renderertest;
|
||||||
const struct pl_swapchain *swapchain;
|
const struct pl_swapchain_t *swapchain;
|
||||||
struct pl_log_params context;
|
struct pl_log_params context;
|
||||||
#ifndef PLACEBO_GL
|
#ifndef PLACEBO_GL
|
||||||
VkSurfaceKHR pSurface;
|
VkSurfaceKHR pSurface;
|
||||||
@ -1468,7 +1474,7 @@ typedef struct priv {
|
|||||||
int has_dma_buf;
|
int has_dma_buf;
|
||||||
#ifdef PLACEBO_GL
|
#ifdef PLACEBO_GL
|
||||||
#if PL_API_VER >= 229
|
#if PL_API_VER >= 229
|
||||||
struct pl_opengl_t *gl;
|
const struct pl_opengl_t *gl;
|
||||||
#else
|
#else
|
||||||
struct pl_opengl *gl;
|
struct pl_opengl *gl;
|
||||||
#endif
|
#endif
|
||||||
@ -1484,7 +1490,6 @@ static struct pl_overlay osdoverlay;
|
|||||||
static struct pl_overlay_part part;
|
static struct pl_overlay_part part;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int semid;
|
|
||||||
struct itimerval itimer;
|
struct itimerval itimer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1816,11 +1821,6 @@ struct mp_egl_config_attr {
|
|||||||
#define MP_EGL_ATTRIB(id) \
|
#define MP_EGL_ATTRIB(id) \
|
||||||
{ id, #id }
|
{ id, #id }
|
||||||
|
|
||||||
static const struct mp_egl_config_attr mp_egl_attribs[] = {
|
|
||||||
MP_EGL_ATTRIB(EGL_CONFIG_ID), MP_EGL_ATTRIB(EGL_RED_SIZE), MP_EGL_ATTRIB(EGL_GREEN_SIZE),
|
|
||||||
MP_EGL_ATTRIB(EGL_BLUE_SIZE), MP_EGL_ATTRIB(EGL_ALPHA_SIZE), MP_EGL_ATTRIB(EGL_COLOR_BUFFER_TYPE),
|
|
||||||
MP_EGL_ATTRIB(EGL_CONFIG_CAVEAT), MP_EGL_ATTRIB(EGL_CONFORMANT),
|
|
||||||
};
|
|
||||||
|
|
||||||
const int mpgl_preferred_gl_versions[] = {460, 440, 430, 400, 330, 320, 310, 300, 210, 0};
|
const int mpgl_preferred_gl_versions[] = {460, 440, 430, 400, 330, 320, 310, 300, 210, 0};
|
||||||
|
|
||||||
@ -1952,7 +1952,7 @@ static bool create_context_cb(EGLDisplay display, int es_version, EGLContext *ou
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
make_egl() {
|
void make_egl(void) {
|
||||||
int bpp;
|
int bpp;
|
||||||
|
|
||||||
CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
|
CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
|
||||||
@ -1976,7 +1976,7 @@ make_egl() {
|
|||||||
if (!create_context_cb(eglDisplay, 0, &eglContext, &eglConfig, &bpp)) {
|
if (!create_context_cb(eglDisplay, 0, &eglContext, &eglConfig, &bpp)) {
|
||||||
Fatal(_("Could not create EGL Context\n"));
|
Fatal(_("Could not create EGL Context\n"));
|
||||||
}
|
}
|
||||||
int vID, n;
|
int vID;
|
||||||
|
|
||||||
eglGetConfigAttrib(eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &vID);
|
eglGetConfigAttrib(eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &vID);
|
||||||
Debug(3, "chose visual 0x%x bpp %d\n", vID, bpp);
|
Debug(3, "chose visual 0x%x bpp %d\n", vID, bpp);
|
||||||
@ -2249,9 +2249,9 @@ void generateCUDAImage(CuvidDecoder *decoder, int index, const AVFrame *frame, i
|
|||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsigned int size_y,
|
void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsigned int size_y,
|
||||||
enum AVPixelFormat PixFmt) {
|
enum AVPixelFormat PixFmt) {
|
||||||
int n, i, size = 1, fd;
|
int n, i;
|
||||||
const struct pl_fmt *fmt;
|
const struct pl_fmt_t *fmt;
|
||||||
struct pl_tex *tex;
|
//struct pl_tex *tex;
|
||||||
struct pl_frame *img;
|
struct pl_frame *img;
|
||||||
struct pl_plane *pl;
|
struct pl_plane *pl;
|
||||||
|
|
||||||
@ -2270,10 +2270,8 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig
|
|||||||
|
|
||||||
if (PixFmt == AV_PIX_FMT_NV12) {
|
if (PixFmt == AV_PIX_FMT_NV12) {
|
||||||
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV
|
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV
|
||||||
size = 1;
|
|
||||||
} else {
|
} else {
|
||||||
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r16" : "rg16"); // 10 Bit YUV
|
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r16" : "rg16"); // 10 Bit YUV
|
||||||
size = 2;
|
|
||||||
}
|
}
|
||||||
if (decoder->pl_frames[i].planes[n].texture) {
|
if (decoder->pl_frames[i].planes[n].texture) {
|
||||||
// #ifdef VAAPI
|
// #ifdef VAAPI
|
||||||
@ -2320,7 +2318,7 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig
|
|||||||
Fatal(_("Unable to create placebo textures"));
|
Fatal(_("Unable to create placebo textures"));
|
||||||
}
|
}
|
||||||
#ifdef CUVID
|
#ifdef CUVID
|
||||||
fd = dup(decoder->pl_frames[i].planes[n].texture->shared_mem.handle.fd);
|
int fd = dup(decoder->pl_frames[i].planes[n].texture->shared_mem.handle.fd);
|
||||||
CUDA_EXTERNAL_MEMORY_HANDLE_DESC ext_desc = {
|
CUDA_EXTERNAL_MEMORY_HANDLE_DESC ext_desc = {
|
||||||
.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD,
|
.type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD,
|
||||||
.handle.fd = fd,
|
.handle.fd = fd,
|
||||||
@ -2372,8 +2370,6 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig
|
|||||||
void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, int image_width, int image_height) {
|
void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, int image_width, int image_height) {
|
||||||
int n;
|
int n;
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
int toggle = 0;
|
|
||||||
uint64_t first_time;
|
|
||||||
VADRMPRIMESurfaceDescriptor desc;
|
VADRMPRIMESurfaceDescriptor desc;
|
||||||
|
|
||||||
vaSyncSurface(decoder->VaDisplay, (unsigned int)frame->data[3]);
|
vaSyncSurface(decoder->VaDisplay, (unsigned int)frame->data[3]);
|
||||||
@ -2394,11 +2390,8 @@ void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame,
|
|||||||
int fd = desc.objects[id].fd;
|
int fd = desc.objects[id].fd;
|
||||||
uint32_t size = desc.objects[id].size;
|
uint32_t size = desc.objects[id].size;
|
||||||
uint32_t offset = desc.layers[n].offset[0];
|
uint32_t offset = desc.layers[n].offset[0];
|
||||||
#if PL_API_VER < 229
|
|
||||||
struct pl_fmt *fmt;
|
|
||||||
#else
|
|
||||||
struct pl_fmt_t *fmt;
|
struct pl_fmt_t *fmt;
|
||||||
#endif
|
|
||||||
|
|
||||||
if (fd == -1) {
|
if (fd == -1) {
|
||||||
printf("Fehler beim Import von Surface %d\n", index);
|
printf("Fehler beim Import von Surface %d\n", index);
|
||||||
@ -2409,15 +2402,14 @@ void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame,
|
|||||||
size = n == 0 ? desc.width * desc.height : desc.width * desc.height / 2;
|
size = n == 0 ? desc.width * desc.height : desc.width * desc.height / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
// fmt = pl_find_fourcc(p->gpu,desc.layers[n].drm_format);
|
// fmt = pl_find_fourcc(p->gpu,desc.lsayers[n].drm_format);
|
||||||
#if 1
|
|
||||||
if (decoder->PixFmt == AV_PIX_FMT_NV12) {
|
if (decoder->PixFmt == AV_PIX_FMT_NV12) {
|
||||||
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV
|
fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV
|
||||||
} else {
|
} else {
|
||||||
fmt = pl_find_fourcc(p->gpu,
|
fmt = pl_find_fourcc(p->gpu,
|
||||||
n == 0 ? 0x20363152 : 0x32335247); // 10 Bit YUV
|
n == 0 ? 0x20363152 : 0x32335247); // 10 Bit YUV
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
assert(fmt != NULL);
|
assert(fmt != NULL);
|
||||||
#ifdef PLACEBO_GL
|
#ifdef PLACEBO_GL
|
||||||
@ -2570,8 +2562,6 @@ void generateVAAPIImage(CuvidDecoder *decoder, VASurfaceID index, const AVFrame
|
|||||||
int image_height) {
|
int image_height) {
|
||||||
VAStatus status;
|
VAStatus status;
|
||||||
|
|
||||||
uint64_t first_time;
|
|
||||||
|
|
||||||
#if defined(VAAPI)
|
#if defined(VAAPI)
|
||||||
VADRMPRIMESurfaceDescriptor desc;
|
VADRMPRIMESurfaceDescriptor desc;
|
||||||
|
|
||||||
@ -2840,7 +2830,7 @@ static int init_generic_hwaccel(CuvidDecoder *decoder, enum AVPixelFormat hw_fmt
|
|||||||
if (decoder->cached_hw_frames_ctx) {
|
if (decoder->cached_hw_frames_ctx) {
|
||||||
AVHWFramesContext *old_fctx = (void *)decoder->cached_hw_frames_ctx->data;
|
AVHWFramesContext *old_fctx = (void *)decoder->cached_hw_frames_ctx->data;
|
||||||
|
|
||||||
Debug(3, "CMP %d:%d %d:%d %d:%d %d:%d %d:%d\,", new_fctx->format, old_fctx->format, new_fctx->sw_format,
|
Debug(3, "CMP %d:%d %d:%d %d:%d %d:%d %d:%d\n,", new_fctx->format, old_fctx->format, new_fctx->sw_format,
|
||||||
old_fctx->sw_format, new_fctx->width, old_fctx->width, new_fctx->height, old_fctx->height,
|
old_fctx->sw_format, new_fctx->width, old_fctx->width, new_fctx->height, old_fctx->height,
|
||||||
new_fctx->initial_pool_size, old_fctx->initial_pool_size);
|
new_fctx->initial_pool_size, old_fctx->initial_pool_size);
|
||||||
if (new_fctx->format != old_fctx->format || new_fctx->sw_format != old_fctx->sw_format ||
|
if (new_fctx->format != old_fctx->format || new_fctx->sw_format != old_fctx->sw_format ||
|
||||||
@ -2889,7 +2879,7 @@ error:
|
|||||||
static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext *video_ctx,
|
static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext *video_ctx,
|
||||||
const enum AVPixelFormat *fmt) {
|
const enum AVPixelFormat *fmt) {
|
||||||
const enum AVPixelFormat *fmt_idx;
|
const enum AVPixelFormat *fmt_idx;
|
||||||
int bitformat16 = 0, deint = 0;
|
int bitformat16 = 0;
|
||||||
|
|
||||||
VideoDecoder *ist = video_ctx->opaque;
|
VideoDecoder *ist = video_ctx->opaque;
|
||||||
|
|
||||||
@ -2986,6 +2976,7 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if defined YADIF && defined CUVID
|
#if defined YADIF && defined CUVID
|
||||||
|
int deint;
|
||||||
if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) {
|
if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) {
|
||||||
deint = 0;
|
deint = 0;
|
||||||
ist->filter = 1; // init yadif_cuda
|
ist->filter = 1; // init yadif_cuda
|
||||||
@ -3040,18 +3031,18 @@ int get_RGB(CuvidDecoder *decoder) {
|
|||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
struct pl_render_params render_params = pl_render_default_params;
|
struct pl_render_params render_params = pl_render_default_params;
|
||||||
struct pl_frame target = {0};
|
struct pl_frame target = {0};
|
||||||
const struct pl_fmt *fmt;
|
const struct pl_fmt_t *fmt;
|
||||||
|
|
||||||
int offset, x1, y1, x0, y0;
|
int x1=0, y1=0, x0=0, y0=0;
|
||||||
float faktorx, faktory;
|
float faktorx, faktory;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
uint8_t *base;
|
uint8_t *base;
|
||||||
int width;
|
int width;
|
||||||
int height;
|
int height;
|
||||||
GLuint fb, texture;
|
|
||||||
int current;
|
int current;
|
||||||
GLint texLoc;
|
|
||||||
|
|
||||||
base = decoder->grabbase;
|
base = decoder->grabbase;
|
||||||
width = decoder->grabwidth;
|
width = decoder->grabwidth;
|
||||||
@ -3060,7 +3051,8 @@ int get_RGB(CuvidDecoder *decoder) {
|
|||||||
current = decoder->SurfacesRb[decoder->SurfaceRead];
|
current = decoder->SurfacesRb[decoder->SurfaceRead];
|
||||||
|
|
||||||
#ifndef PLACEBO
|
#ifndef PLACEBO
|
||||||
|
GLint texLoc;
|
||||||
|
GLuint fb, texture;
|
||||||
glGenTextures(1, &texture);
|
glGenTextures(1, &texture);
|
||||||
GlxCheck();
|
GlxCheck();
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
@ -3499,7 +3491,6 @@ extern void cudaLaunchNV12toARGBDrv(uint32_t * d_srcNV12, size_t nSourcePitch, u
|
|||||||
/// @param frame frame to display
|
/// @param frame frame to display
|
||||||
///
|
///
|
||||||
static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame) {
|
static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame) {
|
||||||
uint64_t first_time;
|
|
||||||
int surface;
|
int surface;
|
||||||
enum AVColorSpace color;
|
enum AVColorSpace color;
|
||||||
|
|
||||||
@ -3527,33 +3518,40 @@ static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_
|
|||||||
|
|
||||||
// Fix libav colorspace failure
|
// Fix libav colorspace failure
|
||||||
color = frame->colorspace;
|
color = frame->colorspace;
|
||||||
if (color == AVCOL_SPC_UNSPECIFIED) // failure with RTL HD and all SD channels
|
if (color == AVCOL_SPC_UNSPECIFIED) { // failure with RTL HD and all SD channels
|
||||||
// with vaapi
|
// with vaapi
|
||||||
if (frame->width > 720)
|
if (frame->width > 720) {
|
||||||
color = AVCOL_SPC_BT709;
|
color = AVCOL_SPC_BT709;
|
||||||
else
|
} else {
|
||||||
color = AVCOL_SPC_BT470BG;
|
color = AVCOL_SPC_BT470BG;
|
||||||
if (color == AVCOL_SPC_RGB) // Cuvid decoder failure with SD channels
|
}
|
||||||
|
}
|
||||||
|
if (color == AVCOL_SPC_RGB) { // Cuvid decoder failure with SD channels
|
||||||
color = AVCOL_SPC_BT470BG;
|
color = AVCOL_SPC_BT470BG;
|
||||||
|
}
|
||||||
frame->colorspace = color;
|
frame->colorspace = color;
|
||||||
|
|
||||||
// Fix libav Color primaries failures
|
// Fix libav Color primaries failures
|
||||||
if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED) // failure with RTL HD and all SD channels with
|
if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED) { // failure with RTL HD and all SD channels with
|
||||||
// vaapi
|
// vaapi
|
||||||
if (frame->width > 720)
|
if (frame->width > 720) {
|
||||||
frame->color_primaries = AVCOL_PRI_BT709;
|
frame->color_primaries = AVCOL_PRI_BT709;
|
||||||
else
|
} else {
|
||||||
frame->color_primaries = AVCOL_PRI_BT470BG;
|
frame->color_primaries = AVCOL_PRI_BT470BG;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (frame->color_primaries == AVCOL_PRI_RESERVED0) // cuvid decoder failure with SD channels
|
if (frame->color_primaries == AVCOL_PRI_RESERVED0) // cuvid decoder failure with SD channels
|
||||||
frame->color_primaries = AVCOL_PRI_BT470BG;
|
frame->color_primaries = AVCOL_PRI_BT470BG;
|
||||||
|
|
||||||
// Fix libav Color TRC failures
|
// Fix libav Color TRC failures
|
||||||
if (frame->color_trc == AVCOL_TRC_UNSPECIFIED) // failure with RTL HD and all
|
if (frame->color_trc == AVCOL_TRC_UNSPECIFIED) { // failure with RTL HD and all
|
||||||
// SD channels with vaapi
|
// SD channels with vaapi
|
||||||
if (frame->width > 720)
|
if (frame->width > 720) {
|
||||||
frame->color_trc = AVCOL_TRC_BT709;
|
frame->color_trc = AVCOL_TRC_BT709;
|
||||||
else
|
} else {
|
||||||
frame->color_trc = AVCOL_TRC_SMPTE170M;
|
frame->color_trc = AVCOL_TRC_SMPTE170M;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (frame->color_trc == AVCOL_TRC_RESERVED0) // cuvid decoder failure with SD channels
|
if (frame->color_trc == AVCOL_TRC_RESERVED0) // cuvid decoder failure with SD channels
|
||||||
frame->color_trc = AVCOL_TRC_SMPTE170M;
|
frame->color_trc = AVCOL_TRC_SMPTE170M;
|
||||||
|
|
||||||
@ -3648,10 +3646,10 @@ static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_
|
|||||||
/// @param decoder CUVID hw decoder
|
/// @param decoder CUVID hw decoder
|
||||||
///
|
///
|
||||||
static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) {
|
static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) {
|
||||||
unsigned int version, ret;
|
|
||||||
|
|
||||||
|
(void)decoder;
|
||||||
Debug(3, "Initializing cuvid hwaccel thread ID:%ld\n", (long int)syscall(186));
|
Debug(3, "Initializing cuvid hwaccel thread ID:%ld\n", (long int)syscall(186));
|
||||||
// turn NULL;
|
|
||||||
#ifdef CUVID
|
#ifdef CUVID
|
||||||
if (decoder->cuda_ctx) {
|
if (decoder->cuda_ctx) {
|
||||||
Debug(3, "schon passiert\n");
|
Debug(3, "schon passiert\n");
|
||||||
@ -3659,7 +3657,7 @@ static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!cu) {
|
if (!cu) {
|
||||||
ret = cuda_load_functions(&cu, NULL);
|
int ret = cuda_load_functions(&cu, NULL);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
Error(_("Could not dynamically load CUDA\n"));
|
Error(_("Could not dynamically load CUDA\n"));
|
||||||
return 0;
|
return 0;
|
||||||
@ -3671,7 +3669,7 @@ static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) {
|
|||||||
|
|
||||||
if (decoder->cuda_ctx == NULL)
|
if (decoder->cuda_ctx == NULL)
|
||||||
Fatal(_("Kein Cuda device gefunden"));
|
Fatal(_("Kein Cuda device gefunden"));
|
||||||
|
// unsigned int version;
|
||||||
// cu->cuCtxGetApiVersion(decoder->cuda_ctx, &version);
|
// cu->cuCtxGetApiVersion(decoder->cuda_ctx, &version);
|
||||||
// Debug(3, "***********CUDA API Version %d\n", version);
|
// Debug(3, "***********CUDA API Version %d\n", version);
|
||||||
#endif
|
#endif
|
||||||
@ -3730,7 +3728,7 @@ static void CuvidAdvanceDecoderFrame(CuvidDecoder *decoder) {
|
|||||||
#if defined PLACEBO && PL_API_VER >= 58
|
#if defined PLACEBO && PL_API_VER >= 58
|
||||||
|
|
||||||
static const struct pl_hook *parse_user_shader(char *shader) {
|
static const struct pl_hook *parse_user_shader(char *shader) {
|
||||||
char tmp[200];
|
char tmp[400];
|
||||||
|
|
||||||
if (!shader)
|
if (!shader)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -3793,26 +3791,23 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
struct pl_deband_params deband;
|
struct pl_deband_params deband;
|
||||||
struct pl_color_adjustment colors;
|
struct pl_color_adjustment colors;
|
||||||
struct pl_cone_params cone;
|
struct pl_cone_params cone;
|
||||||
struct pl_tex_vk *vkp;
|
//struct pl_tex_vk *vkp;
|
||||||
struct pl_plane *pl;
|
struct pl_plane *pl;
|
||||||
struct pl_tex *tex0, *tex1;
|
//struct pl_tex *tex0, *tex1;
|
||||||
|
|
||||||
struct pl_frame *img;
|
struct pl_frame *img;
|
||||||
bool ok;
|
//bool ok;
|
||||||
VdpRect video_src_rect;
|
VdpRect video_src_rect;
|
||||||
VdpRect dst_rect;
|
//VdpRect dst_rect;
|
||||||
VdpRect dst_video_rect;
|
VdpRect dst_video_rect;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
int current;
|
int current;
|
||||||
int y;
|
|
||||||
float xcropf, ycropf;
|
|
||||||
GLint texLoc;
|
|
||||||
AVFrame *frame;
|
|
||||||
AVFrameSideData *sd, *sd1 = NULL, *sd2 = NULL;
|
|
||||||
|
|
||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (level) {
|
if (level) {
|
||||||
dst_rect.x0 = decoder->VideoX; // video window output (clip)
|
dst_rect.x0 = decoder->VideoX; // video window output (clip)
|
||||||
dst_rect.y0 = decoder->VideoY;
|
dst_rect.y0 = decoder->VideoY;
|
||||||
@ -3824,7 +3819,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
dst_rect.x1 = VideoWindowWidth;
|
dst_rect.x1 = VideoWindowWidth;
|
||||||
dst_rect.y1 = VideoWindowHeight;
|
dst_rect.y1 = VideoWindowHeight;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
video_src_rect.x0 = decoder->CropX; // video source (crop)
|
video_src_rect.x0 = decoder->CropX; // video source (crop)
|
||||||
video_src_rect.y0 = decoder->CropY;
|
video_src_rect.y0 = decoder->CropY;
|
||||||
video_src_rect.x1 = decoder->CropX + decoder->CropWidth;
|
video_src_rect.x1 = decoder->CropX + decoder->CropWidth;
|
||||||
@ -3836,12 +3831,13 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight;
|
dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
xcropf = (float)decoder->CropX / (float)decoder->InputWidth;
|
|
||||||
ycropf = (float)decoder->CropY / (float)decoder->InputHeight;
|
|
||||||
|
|
||||||
current = decoder->SurfacesRb[decoder->SurfaceRead];
|
current = decoder->SurfacesRb[decoder->SurfaceRead];
|
||||||
|
|
||||||
#ifdef USE_DRM
|
#ifdef USE_DRM
|
||||||
|
|
||||||
|
AVFrameSideData *sd, *sd1 = NULL, *sd2 = NULL;
|
||||||
if (!decoder->Closing) {
|
if (!decoder->Closing) {
|
||||||
frame = decoder->frames[current];
|
frame = decoder->frames[current];
|
||||||
sd1 = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
sd1 = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
||||||
@ -3853,6 +3849,14 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
|
|
||||||
// Render Progressive frame
|
// Render Progressive frame
|
||||||
#ifndef PLACEBO
|
#ifndef PLACEBO
|
||||||
|
|
||||||
|
GLint texLoc;
|
||||||
|
int y;
|
||||||
|
float xcropf, ycropf;
|
||||||
|
|
||||||
|
xcropf = (float)decoder->CropX / (float)decoder->InputWidth;
|
||||||
|
ycropf = (float)decoder->CropY / (float)decoder->InputHeight;
|
||||||
|
|
||||||
y = VideoWindowHeight - decoder->OutputY - decoder->OutputHeight;
|
y = VideoWindowHeight - decoder->OutputY - decoder->OutputHeight;
|
||||||
if (y < 0)
|
if (y < 0)
|
||||||
y = 0;
|
y = 0;
|
||||||
@ -3891,7 +3895,6 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
else
|
else
|
||||||
render_params.lut = NULL;
|
render_params.lut = NULL;
|
||||||
|
|
||||||
frame = decoder->frames[current];
|
|
||||||
|
|
||||||
// Fix Color Parameters
|
// Fix Color Parameters
|
||||||
|
|
||||||
@ -3975,6 +3978,9 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
// target.repr.bits.bit_shift =0;
|
// target.repr.bits.bit_shift =0;
|
||||||
|
|
||||||
#if USE_DRM
|
#if USE_DRM
|
||||||
|
AVFrame *frame;
|
||||||
|
frame = decoder->frames[current];
|
||||||
|
|
||||||
switch (VulkanTargetColorSpace) {
|
switch (VulkanTargetColorSpace) {
|
||||||
case 0: // Monitor
|
case 0: // Monitor
|
||||||
memcpy(&target->color, &pl_color_space_monitor, sizeof(struct pl_color_space));
|
memcpy(&target->color, &pl_color_space_monitor, sizeof(struct pl_color_space));
|
||||||
@ -4103,7 +4109,11 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
render_params.downscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter;
|
render_params.downscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter;
|
||||||
|
|
||||||
if (level)
|
if (level)
|
||||||
|
#if PL_API_VER < 346
|
||||||
render_params.skip_target_clearing = 1;
|
render_params.skip_target_clearing = 1;
|
||||||
|
#else
|
||||||
|
render_params.border = PL_CLEAR_SKIP;
|
||||||
|
#endif
|
||||||
|
|
||||||
render_params.color_adjustment = &colors;
|
render_params.color_adjustment = &colors;
|
||||||
|
|
||||||
@ -4199,7 +4209,11 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
|
|
||||||
// render_params.lut = NULL;
|
// render_params.lut = NULL;
|
||||||
render_params.num_hooks = 0;
|
render_params.num_hooks = 0;
|
||||||
|
#if PL_API_VER < 346
|
||||||
render_params.skip_target_clearing = 1;
|
render_params.skip_target_clearing = 1;
|
||||||
|
#else
|
||||||
|
render_params.border = PL_CLEAR_SKIP;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (!p->renderertest)
|
if (!p->renderertest)
|
||||||
p->renderertest = pl_renderer_create(p->ctx, p->gpu);
|
p->renderertest = pl_renderer_create(p->ctx, p->gpu);
|
||||||
@ -4212,7 +4226,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev
|
|||||||
p->renderertest = NULL;
|
p->renderertest = NULL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
Debug(4, "video/cuvid: yy video surface %p displayed\n", current, decoder->SurfaceRead);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
@ -4220,7 +4234,7 @@ void make_osd_overlay(int x, int y, int width, int height) {
|
|||||||
const struct pl_fmt *fmt;
|
const struct pl_fmt *fmt;
|
||||||
struct pl_overlay *pl;
|
struct pl_overlay *pl;
|
||||||
|
|
||||||
int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y);
|
|
||||||
|
|
||||||
fmt = pl_find_named_fmt(p->gpu, "rgba8"); // 8 Bit RGB
|
fmt = pl_find_named_fmt(p->gpu, "rgba8"); // 8 Bit RGB
|
||||||
|
|
||||||
@ -4285,7 +4299,7 @@ void make_osd_overlay(int x, int y, int width, int height) {
|
|||||||
pl->rect.x1 = x + width;
|
pl->rect.x1 = x + width;
|
||||||
pl->rect.y0 = VideoWindowHeight - height - y;
|
pl->rect.y0 = VideoWindowHeight - height - y;
|
||||||
#else
|
#else
|
||||||
|
int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y);
|
||||||
pl->rect.x0 = x;
|
pl->rect.x0 = x;
|
||||||
pl->rect.y0 = VideoWindowHeight - y + offset; // Boden von oben
|
pl->rect.y0 = VideoWindowHeight - y + offset; // Boden von oben
|
||||||
pl->rect.x1 = x + width;
|
pl->rect.x1 = x + width;
|
||||||
@ -4300,6 +4314,7 @@ void make_osd_overlay(int x, int y, int width, int height) {
|
|||||||
part.dst.x1 = x + width;
|
part.dst.x1 = x + width;
|
||||||
part.dst.y0 = VideoWindowHeight - height - y;
|
part.dst.y0 = VideoWindowHeight - height - y;
|
||||||
#else
|
#else
|
||||||
|
int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y);
|
||||||
part.dst.x0 = x;
|
part.dst.x0 = x;
|
||||||
part.dst.y0 = VideoWindowHeight - y + offset; // Boden von oben
|
part.dst.y0 = VideoWindowHeight - y + offset; // Boden von oben
|
||||||
part.dst.x1 = x + width;
|
part.dst.x1 = x + width;
|
||||||
@ -4314,30 +4329,33 @@ void make_osd_overlay(int x, int y, int width, int height) {
|
|||||||
|
|
||||||
static void CuvidDisplayFrame(void) {
|
static void CuvidDisplayFrame(void) {
|
||||||
|
|
||||||
static uint64_t first_time = 0, round_time = 0;
|
|
||||||
static uint64_t last_time = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
#if defined PLACEBO_GL || defined CUVID
|
||||||
|
static uint64_t round_time = 0;
|
||||||
|
//static uint64_t first_time = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
int filled;
|
int filled;
|
||||||
CuvidDecoder *decoder;
|
CuvidDecoder *decoder;
|
||||||
int RTS_flag;
|
|
||||||
int valid_frame = 0;
|
|
||||||
float ldiff;
|
|
||||||
float turnaround;
|
|
||||||
|
|
||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
uint64_t diff;
|
//uint64_t diff;
|
||||||
static float fdiff = 23000.0;
|
//static float fdiff = 23000.0;
|
||||||
struct pl_swapchain_frame frame;
|
struct pl_swapchain_frame frame;
|
||||||
struct pl_frame target;
|
struct pl_frame target;
|
||||||
bool ok;
|
//bool ok;
|
||||||
|
|
||||||
const struct pl_fmt *fmt;
|
//const struct pl_fmt *fmt;
|
||||||
const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
//const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||||
|
#else
|
||||||
|
int valid_frame = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef PLACEBO
|
#ifndef PLACEBO
|
||||||
|
static uint64_t last_time = 0;
|
||||||
if (CuvidDecoderN)
|
if (CuvidDecoderN)
|
||||||
CuvidDecoders[0]->Frameproc = (float)(GetusTicks() - last_time) / 1000000.0;
|
CuvidDecoders[0]->Frameproc = (float)(GetusTicks() - last_time) / 1000000.0;
|
||||||
|
|
||||||
@ -4373,7 +4391,7 @@ static void CuvidDisplayFrame(void) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (CuvidDecoderN) {
|
if (CuvidDecoderN) {
|
||||||
ldiff = (float)(GetusTicks() - round_time) / 1000000.0;
|
float ldiff = (float)(GetusTicks() - round_time) / 1000000.0;
|
||||||
if (ldiff < 100.0 && ldiff > 0.0)
|
if (ldiff < 100.0 && ldiff > 0.0)
|
||||||
CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0;
|
CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0;
|
||||||
}
|
}
|
||||||
@ -4387,7 +4405,7 @@ static void CuvidDisplayFrame(void) {
|
|||||||
VideoThreadLock();
|
VideoThreadLock();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
last_time = GetusTicks();
|
//last_time = GetusTicks();
|
||||||
|
|
||||||
while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap
|
while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap
|
||||||
usleep(5);
|
usleep(5);
|
||||||
@ -4442,7 +4460,7 @@ static void CuvidDisplayFrame(void) {
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
valid_frame = 1;
|
|
||||||
#ifdef PLACEBO
|
#ifdef PLACEBO
|
||||||
//pthread_mutex_lock(&OSDMutex);
|
//pthread_mutex_lock(&OSDMutex);
|
||||||
if (OsdShown == 1) { // New OSD opened
|
if (OsdShown == 1) { // New OSD opened
|
||||||
@ -4470,6 +4488,7 @@ static void CuvidDisplayFrame(void) {
|
|||||||
}
|
}
|
||||||
//pthread_mutex_unlock(&OSDMutex);
|
//pthread_mutex_unlock(&OSDMutex);
|
||||||
#else
|
#else
|
||||||
|
valid_frame = 1;
|
||||||
CuvidMixVideo(decoder, i);
|
CuvidMixVideo(decoder, i);
|
||||||
#endif
|
#endif
|
||||||
if (i == 0 && decoder->grab) { // Grab frame
|
if (i == 0 && decoder->grab) { // Grab frame
|
||||||
@ -4586,7 +4605,7 @@ static void CuvidDisplayFrame(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PLACEBO_GL
|
#ifdef PLACEBO_GL
|
||||||
CuvidSwapBuffer() {
|
void CuvidSwapBuffer() {
|
||||||
#ifndef USE_DRM
|
#ifndef USE_DRM
|
||||||
eglSwapBuffers(eglDisplay, eglSurface);
|
eglSwapBuffers(eglDisplay, eglSurface);
|
||||||
// eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
// eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE,
|
||||||
@ -4702,7 +4721,6 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) {
|
|||||||
int filled;
|
int filled;
|
||||||
int64_t audio_clock;
|
int64_t audio_clock;
|
||||||
int64_t video_clock;
|
int64_t video_clock;
|
||||||
int err = 0;
|
|
||||||
static int speedup = 3;
|
static int speedup = 3;
|
||||||
|
|
||||||
#ifdef GAMMA
|
#ifdef GAMMA
|
||||||
@ -4770,14 +4788,14 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (abs(diff) > 5000 * 90) { // more than 5s
|
if (abs(diff) > 5000 * 90) { // more than 5s
|
||||||
err = CuvidMessage(2, "video: audio/video difference too big %d\n", diff / 90);
|
CuvidMessage(2, "video: audio/video difference too big %d\n", diff / 90);
|
||||||
// decoder->SyncCounter = 1;
|
// decoder->SyncCounter = 1;
|
||||||
// usleep(10);
|
// usleep(10);
|
||||||
goto skip_sync;
|
goto skip_sync;
|
||||||
|
|
||||||
} else if (diff > 100 * 90) {
|
} else if (diff > 100 * 90) {
|
||||||
|
|
||||||
err = CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90);
|
CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90);
|
||||||
++decoder->FramesDuped;
|
++decoder->FramesDuped;
|
||||||
if ((speedup && --speedup) || VideoSoftStartSync)
|
if ((speedup && --speedup) || VideoSoftStartSync)
|
||||||
decoder->SyncCounter = 1;
|
decoder->SyncCounter = 1;
|
||||||
@ -4786,13 +4804,13 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) {
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
} else if (diff > 25 * 90) {
|
} else if (diff > 25 * 90) {
|
||||||
err = CuvidMessage(3, "video: slow down video, duping frame %d \n", diff / 90);
|
CuvidMessage(3, "video: slow down video, duping frame %d \n", diff / 90);
|
||||||
++decoder->FramesDuped;
|
++decoder->FramesDuped;
|
||||||
decoder->SyncCounter = 1;
|
decoder->SyncCounter = 1;
|
||||||
goto out;
|
goto out;
|
||||||
} else if ((diff < -100 * 90)) {
|
} else if ((diff < -100 * 90)) {
|
||||||
if (filled > 2) {
|
if (filled > 2) {
|
||||||
err = CuvidMessage(3, "video: speed up video, droping frame %d\n", diff / 90);
|
CuvidMessage(3, "video: speed up video, droping frame %d\n", diff / 90);
|
||||||
++decoder->FramesDropped;
|
++decoder->FramesDropped;
|
||||||
CuvidAdvanceDecoderFrame(decoder);
|
CuvidAdvanceDecoderFrame(decoder);
|
||||||
} else if ((diff < -100 * 90)) { // give it some time to get frames to drop
|
} else if ((diff < -100 * 90)) { // give it some time to get frames to drop
|
||||||
@ -5282,7 +5300,7 @@ void VideoOsdDrawARGB(int xi, int yi, int width, int height, int pitch, const ui
|
|||||||
}
|
}
|
||||||
Debug(3, "video: osd dirty %dx%d%+d%+d -> %dx%d%+d%+d\n", width, height, x, y, OsdDirtyWidth, OsdDirtyHeight,
|
Debug(3, "video: osd dirty %dx%d%+d%+d -> %dx%d%+d%+d\n", width, height, x, y, OsdDirtyWidth, OsdDirtyHeight,
|
||||||
OsdDirtyX, OsdDirtyY);
|
OsdDirtyX, OsdDirtyY);
|
||||||
|
Debug(4," dummy print %d %d %d %s",xi,yi,pitch,argb);
|
||||||
VideoThreadUnlock();
|
VideoThreadUnlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5586,7 +5604,7 @@ void pl_log_intern(void *stream, enum pl_log_level level, const char *msg) {
|
|||||||
[PL_LOG_FATAL] = "fatal", [PL_LOG_ERR] = "error", [PL_LOG_WARN] = "warn",
|
[PL_LOG_FATAL] = "fatal", [PL_LOG_ERR] = "error", [PL_LOG_WARN] = "warn",
|
||||||
[PL_LOG_INFO] = "info", [PL_LOG_DEBUG] = "debug", [PL_LOG_TRACE] = "trace",
|
[PL_LOG_INFO] = "info", [PL_LOG_DEBUG] = "debug", [PL_LOG_TRACE] = "trace",
|
||||||
};
|
};
|
||||||
|
(void)stream;
|
||||||
printf("%5s: %s\n", prefix[level], msg);
|
printf("%5s: %s\n", prefix[level], msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5711,14 +5729,14 @@ void InitPlacebo() {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PLACEBO_GL
|
#ifdef PLACEBO_GL
|
||||||
if (!pl_swapchain_resize(p->swapchain, &VideoWindowWidth, &VideoWindowHeight)) {
|
if (!pl_swapchain_resize(p->swapchain, (int *)&VideoWindowWidth, (int *)&VideoWindowHeight)) {
|
||||||
Fatal(_("libplacebo: failed initializing swapchain\n"));
|
Fatal(_("libplacebo: failed initializing swapchain\n"));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#if PL_API_VER >= 113
|
#if PL_API_VER >= 113
|
||||||
// load LUT File
|
// load LUT File
|
||||||
struct file lutf;
|
struct file lutf;
|
||||||
char tmp[200];
|
char tmp[400];
|
||||||
|
|
||||||
sprintf(tmp, "%s/%s", MyConfigDir, lut_file);
|
sprintf(tmp, "%s/%s", MyConfigDir, lut_file);
|
||||||
if (open_file(tmp, &lutf) && lutf.size) {
|
if (open_file(tmp, &lutf) && lutf.size) {
|
||||||
@ -5824,10 +5842,9 @@ void exit_display() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void *VideoHandlerThread(void *dummy) {
|
static void *VideoHandlerThread(void *dummy) {
|
||||||
#ifdef VAAPI
|
#if defined VAAPI && !defined PLACEBO_GL
|
||||||
EGLint contextAttrs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
|
EGLint contextAttrs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE};
|
||||||
#endif
|
#endif
|
||||||
int redSize, greenSize, blueSize, alphaSize;
|
|
||||||
|
|
||||||
prctl(PR_SET_NAME, "video display", 0, 0, 0);
|
prctl(PR_SET_NAME, "video display", 0, 0, 0);
|
||||||
|
|
||||||
@ -6591,13 +6608,13 @@ int VideoSetShader(char *s) {
|
|||||||
#if defined PLACEBO && PL_API_VER >= 58
|
#if defined PLACEBO && PL_API_VER >= 58
|
||||||
if (num_shaders == NUM_SHADERS)
|
if (num_shaders == NUM_SHADERS)
|
||||||
return -1;
|
return -1;
|
||||||
p = malloc(strlen(s) + 1);
|
char *p = malloc(strlen(s) + 1);
|
||||||
memcpy(p, s, strlen(s) + 1);
|
memcpy(p, s, strlen(s) + 1);
|
||||||
shadersp[num_shaders++] = p;
|
shadersp[num_shaders++] = p;
|
||||||
CuvidMessage(2, "Use Shader %s\n", s);
|
CuvidMessage(2, "Use Shader %s\n", s);
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
printf("Shaders are only support with placebo\n");
|
printf("Shaders are only support with placebo (%s)\n",s);
|
||||||
return -1;
|
return -1;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -6913,7 +6930,8 @@ void VideoSetAbove() {
|
|||||||
///
|
///
|
||||||
/// Set deinterlace mode.
|
/// Set deinterlace mode.
|
||||||
///
|
///
|
||||||
void VideoSetDeinterlace(int mode[VideoResolutionMax]) {
|
void VideoSetDeinterlace(int mode[]) {
|
||||||
|
|
||||||
#ifdef CUVID
|
#ifdef CUVID
|
||||||
VideoDeinterlace[0] = mode[0]; // 576i
|
VideoDeinterlace[0] = mode[0]; // 576i
|
||||||
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
||||||
@ -6921,6 +6939,7 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax]) {
|
|||||||
VideoDeinterlace[3] = mode[3]; // 1080
|
VideoDeinterlace[3] = mode[3]; // 1080
|
||||||
VideoDeinterlace[4] = 0; // mode[4]; 2160p
|
VideoDeinterlace[4] = 0; // mode[4]; 2160p
|
||||||
#else
|
#else
|
||||||
|
(void)mode;
|
||||||
VideoDeinterlace[0] = 1; // 576i
|
VideoDeinterlace[0] = 1; // 576i
|
||||||
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
VideoDeinterlace[1] = 0; // mode[1]; // 720p
|
||||||
VideoDeinterlace[2] = 1; // fake 1080
|
VideoDeinterlace[2] = 1; // fake 1080
|
||||||
@ -6933,7 +6952,7 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// Set skip chroma deinterlace on/off.
|
/// Set skip chroma deinterlace on/off.
|
||||||
///
|
///
|
||||||
void VideoSetSkipChromaDeinterlace(int onoff[VideoResolutionMax]) {
|
void VideoSetSkipChromaDeinterlace(int onoff[]) {
|
||||||
VideoSkipChromaDeinterlace[0] = onoff[0];
|
VideoSkipChromaDeinterlace[0] = onoff[0];
|
||||||
VideoSkipChromaDeinterlace[1] = onoff[1];
|
VideoSkipChromaDeinterlace[1] = onoff[1];
|
||||||
VideoSkipChromaDeinterlace[2] = onoff[2];
|
VideoSkipChromaDeinterlace[2] = onoff[2];
|
||||||
@ -6945,7 +6964,7 @@ void VideoSetSkipChromaDeinterlace(int onoff[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// Set inverse telecine on/off.
|
/// Set inverse telecine on/off.
|
||||||
///
|
///
|
||||||
void VideoSetInverseTelecine(int onoff[VideoResolutionMax]) {
|
void VideoSetInverseTelecine(int onoff[]) {
|
||||||
VideoInverseTelecine[0] = onoff[0];
|
VideoInverseTelecine[0] = onoff[0];
|
||||||
VideoInverseTelecine[1] = onoff[1];
|
VideoInverseTelecine[1] = onoff[1];
|
||||||
VideoInverseTelecine[2] = onoff[2];
|
VideoInverseTelecine[2] = onoff[2];
|
||||||
@ -6957,7 +6976,7 @@ void VideoSetInverseTelecine(int onoff[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// Set denoise level (0 .. 1000).
|
/// Set denoise level (0 .. 1000).
|
||||||
///
|
///
|
||||||
void VideoSetDenoise(int level[VideoResolutionMax]) {
|
void VideoSetDenoise(int level[]) {
|
||||||
VideoDenoise[0] = level[0];
|
VideoDenoise[0] = level[0];
|
||||||
VideoDenoise[1] = level[1];
|
VideoDenoise[1] = level[1];
|
||||||
VideoDenoise[2] = level[2];
|
VideoDenoise[2] = level[2];
|
||||||
@ -6969,7 +6988,7 @@ void VideoSetDenoise(int level[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// Set sharpness level (-1000 .. 1000).
|
/// Set sharpness level (-1000 .. 1000).
|
||||||
///
|
///
|
||||||
void VideoSetSharpen(int level[VideoResolutionMax]) {
|
void VideoSetSharpen(int level[]) {
|
||||||
VideoSharpen[0] = level[0];
|
VideoSharpen[0] = level[0];
|
||||||
VideoSharpen[1] = level[1];
|
VideoSharpen[1] = level[1];
|
||||||
VideoSharpen[2] = level[2];
|
VideoSharpen[2] = level[2];
|
||||||
@ -6983,7 +7002,7 @@ void VideoSetSharpen(int level[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// @param mode table with VideoResolutionMax values
|
/// @param mode table with VideoResolutionMax values
|
||||||
///
|
///
|
||||||
void VideoSetScaling(int mode[VideoResolutionMax]) {
|
void VideoSetScaling(int mode[]) {
|
||||||
VideoScaling[0] = mode[0];
|
VideoScaling[0] = mode[0];
|
||||||
VideoScaling[1] = mode[1];
|
VideoScaling[1] = mode[1];
|
||||||
VideoScaling[2] = mode[2];
|
VideoScaling[2] = mode[2];
|
||||||
@ -6997,7 +7016,7 @@ void VideoSetScaling(int mode[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// @param pixels table with VideoResolutionMax values
|
/// @param pixels table with VideoResolutionMax values
|
||||||
///
|
///
|
||||||
void VideoSetCutTopBottom(int pixels[VideoResolutionMax]) {
|
void VideoSetCutTopBottom(int pixels[]) {
|
||||||
VideoCutTopBottom[0] = pixels[0];
|
VideoCutTopBottom[0] = pixels[0];
|
||||||
VideoCutTopBottom[1] = pixels[1];
|
VideoCutTopBottom[1] = pixels[1];
|
||||||
VideoCutTopBottom[2] = pixels[2];
|
VideoCutTopBottom[2] = pixels[2];
|
||||||
@ -7011,7 +7030,7 @@ void VideoSetCutTopBottom(int pixels[VideoResolutionMax]) {
|
|||||||
///
|
///
|
||||||
/// @param pixels table with VideoResolutionMax values
|
/// @param pixels table with VideoResolutionMax values
|
||||||
///
|
///
|
||||||
void VideoSetCutLeftRight(int pixels[VideoResolutionMax]) {
|
void VideoSetCutLeftRight(int pixels[]) {
|
||||||
VideoCutLeftRight[0] = pixels[0];
|
VideoCutLeftRight[0] = pixels[0];
|
||||||
VideoCutLeftRight[1] = pixels[1];
|
VideoCutLeftRight[1] = pixels[1];
|
||||||
VideoCutLeftRight[2] = pixels[2];
|
VideoCutLeftRight[2] = pixels[2];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user