1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

- Reindent all sources to common coding style again.

- Fix compile bug occurred with gcc10 (-fno-common is now default)
This commit is contained in:
Dirk Nehring 2020-04-10 16:17:23 +02:00
parent 5875e10479
commit 36c208967e
13 changed files with 1236 additions and 1076 deletions

View File

@ -385,9 +385,7 @@ HDRS= $(wildcard *.h)
indent:
for i in $(SRCS) $(HDRS); do \
indent $$i; \
unexpand -a $$i | sed -e s/constconst/const/ > $$i.up; \
mv $$i.up $$i; \
VERSION_CONTROL=none indent $$i; \
done
video_test: video.c Makefile

View File

@ -146,7 +146,6 @@ static volatile char AudioRunning; ///< thread running / stopped
static volatile char AudioPaused; ///< audio paused
static volatile char AudioVideoIsReady; ///< video ready start early
static int AudioSkip; ///< skip audio to sync to video
int AudioDelay; /// delay audio to sync to video
static const int AudioBytesProSample = 2; ///< number of bytes per sample
@ -2024,7 +2023,8 @@ static void *AudioPlayHandlerThread(void *dummy)
Debug(3, "audio: ----> %dms %d start\n", (AudioUsedBytes() * 1000)
/ (!AudioRing[AudioRingWrite].HwSampleRate + !AudioRing[AudioRingWrite].HwChannels +
AudioRing[AudioRingWrite].HwSampleRate * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample),AudioUsedBytes());
AudioRing[AudioRingWrite].HwSampleRate * AudioRing[AudioRingWrite].HwChannels * AudioBytesProSample),
AudioUsedBytes());
do {
int filled;
@ -2337,6 +2337,7 @@ void AudioVideoReady(int64_t pts)
if (!AudioRunning) {
int skip;
// buffer ~15 video frames
// FIXME: HDTV can use smaller video buffer
skip = pts - 0 * 20 * 90 - AudioBufferTime * 90 - audio_pts + VideoAudioDelay;

View File

@ -96,6 +96,7 @@ static pthread_mutex_t CodecLockMutex;
/// Flag prefer fast channel switch
char CodecUsePossibleDefectFrames;
AVBufferRef *hw_device_ctx;
//----------------------------------------------------------------------------
// Video
//----------------------------------------------------------------------------
@ -288,7 +289,7 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
}
decoder->VideoCtx->hw_device_ctx = av_buffer_ref(HwDeviceContext);
#else
decoder->VideoCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME; /* request a DRM frame
decoder->VideoCtx->pix_fmt = AV_PIX_FMT_DRM_PRIME; /* request a DRM frame */
// decoder->VideoCtx->pix_fmt = AV_PIX_FMT_MMAL; /* request a DRM frame */
#endif
@ -1111,8 +1112,6 @@ static int CodecAudioPassthroughHelper(AudioDecoder * audio_decoder, const AVPac
return 0;
}
#if defined(USE_SWRESAMPLE) || defined(USE_AVRESAMPLE)
/**
@ -1346,6 +1345,7 @@ void CodecAudioDecode(AudioDecoder * audio_decoder, const AVPacket * avpkt)
if (audio_decoder->Resample) {
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),

View File

@ -1,4 +1,3 @@
/*
* This file is part of mpv.
*

View File

@ -1,4 +1,3 @@
/*
* This file is part of libplacebo.
*

View File

@ -1,4 +1,3 @@
/*
* Copyright 1993-2013 NVIDIA Corporation. All rights reserved.
*

1
hdr.c
View File

@ -490,4 +490,3 @@ static void set_hdr_metadata(int color,int trc, AVFrameSideData *sd1, AVFrameSid
Debug(3,"DRM: HDR metadata: prop set\n");
}

File diff suppressed because it is too large Load Diff

View File

@ -11,7 +11,6 @@ const char *gl_version = "#version 300 es ";
#endif
#endif
/* Color conversion matrix: RGB = m * YUV + c
* m is in row-major matrix, with m[row][col], e.g.:
* [ a11 a12 a13 ] float m[3][3] = { { a11, a12, a13 },
@ -71,16 +70,11 @@ float cms_matrix[3][3] = { {1.660497, -0.124547, -0.018154},
};
// Common constants for SMPTE ST.2084 (PQ)
static const float PQ_M1 = 2610./4096 * 1./4,
PQ_M2 = 2523./4096 * 128,
PQ_C1 = 3424./4096,
PQ_C2 = 2413./4096 * 32,
PQ_C3 = 2392./4096 * 32;
static const float PQ_M1 = 2610. / 4096 * 1. / 4, PQ_M2 = 2523. / 4096 * 128, PQ_C1 = 3424. / 4096, PQ_C2 =
2413. / 4096 * 32, PQ_C3 = 2392. / 4096 * 32;
// Common constants for ARIB STD-B67 (HLG)
static const float HLG_A = 0.17883277,
HLG_B = 0.28466892,
HLG_C = 0.55991073;
static const float HLG_A = 0.17883277, HLG_B = 0.28466892, HLG_C = 0.55991073;
struct gl_vao_entry
{
@ -124,13 +118,18 @@ static const struct gl_vao_entry vertex_vao[] = {
char sh[SHADER_LENGTH];
char shv[SHADER_LENGTH];
GL_init() {
GL_init()
{
sh[0] = 0;
}
GLV_init() {
GLV_init()
{
shv[0] = 0;
}
pl_shader_append(const char *fmt, ...) {
pl_shader_append(const char *fmt, ...)
{
char temp[1000];
va_list ap;
@ -144,7 +143,8 @@ pl_shader_append(const char *fmt, ...) {
}
pl_shader_append_v(const char *fmt, ...) {
pl_shader_append_v(const char *fmt, ...)
{
char temp[1000];
va_list ap;
@ -157,6 +157,7 @@ pl_shader_append_v(const char *fmt, ...) {
strcat(shv, temp);
}
static void compile_attach_shader(GLuint program, GLenum type, const char *source)
{
GLuint shader;
@ -272,7 +273,6 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
// printf("%s",sh);
compile_attach_shader(gl_prog, GL_VERTEX_SHADER, sh);
switch (colorspace) {
case AVCOL_SPC_RGB:
m = &yuv_bt601.m[0][0];
@ -348,8 +348,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace)
#endif
GLSL("out_color = color; \n");
GLSL("} \n");
}
else {
} else {
GLSL("color.r = 1.000000 * vec4(texture(texture0, texcoord0)).r; \n");
if (Planes == 3) {

View File

@ -2213,7 +2213,8 @@ void cSoftHdMenu::Create(void)
}
Add(new cOsdItem(cString::sprintf(tr(" Frames missed(%d) duped(%d) dropped(%d) total(%d)"), missed, duped, dropped,
counter), osUnknown, false));
Add(new cOsdItem(cString::sprintf(tr(" Video %dx%d Color: %s Gamma: %s"), width, height, colorstr, eotfstr), osUnknown, false));
Add(new cOsdItem(cString::sprintf(tr(" Video %dx%d Color: %s Gamma: %s"), width, height, colorstr, eotfstr),
osUnknown, false));
// Add(new cOsdItem(cString::sprintf(tr(" Frame Process time %2.2fms"), frametime), osUnknown, false));
SetCurrent(Get(current)); // restore selected menu entry
Display(); // display build menu

View File

@ -2871,11 +2871,10 @@ const char *CommandLineHelp(void)
" -p device\taudio device for pass-through (hw:0,1 or /dev/dsp1)\n"
" -c channel\taudio mixer channel name (fe. PCM)\n" " -d display\tdisplay of x11 server (fe. :0.0)\n"
" -f\t\tstart with fullscreen window (only with window manager)\n"
" -g geometry\tx11 window geometry wxh+x+y\n"
" -r Refresh\tRefreshrate for DRM (default is 50 Hz)\n"
" -g geometry\tx11 window geometry wxh+x+y\n" " -r Refresh\tRefreshrate for DRM (default is 50 Hz)\n"
" -C Connector\tConnector for DRM (default is current Connector)\n"
" -v device\tvideo driver device (cuvid)\n"
" -s\t\tstart in suspended mode\n" " -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
" -v device\tvideo driver device (cuvid)\n" " -s\t\tstart in suspended mode\n"
" -x\t\tstart x11 server, with -xx try to connect, if this fails\n"
" -X args\tX11 server arguments (f.e. -nocursor)\n" " -w workaround\tenable/disable workarounds\n"
"\tno-hw-decoder\t\tdisable hw decoder, use software decoder only\n"
"\tno-mpeg-hw-decoder\tdisable hw decoder for mpeg only\n"
@ -3369,7 +3368,8 @@ void Resume(void)
** @param[out] dropped dropped frames
** @param[out] count number of decoded frames
*/
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int *eotf)
void GetStats(int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height,
int *color, int *eotf)
{
*missed = 0;
*duped = 0;
@ -3381,7 +3381,8 @@ void GetStats(int *missed, int *duped, int *dropped, int *counter, float *framet
*color = NULL;
*eotf = NULL;
if (MyVideoStream->HwDecoder) {
VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime, width, height, color, eotf);
VideoGetStats(MyVideoStream->HwDecoder, missed, duped, dropped, counter, frametime, width, height, color,
eotf);
}
}

105
video.c
View File

@ -495,7 +495,6 @@ static int GlxVSyncEnabled = 1; ///< enable/disable v-sync
static GLXContext glxSharedContext; ///< shared gl context
static GLXContext glxContext; ///< our gl context
static GLXContext glxThreadContext; ///< our gl context for the thread
static XVisualInfo *GlxVisualInfo; ///< our gl visual
@ -543,7 +542,6 @@ static void X11DPMSReenable(xcb_connection_t *);
static void X11DPMSDisable(xcb_connection_t *);
#endif
char *eglErrorString(EGLint error)
{
switch (error) {
@ -699,8 +697,8 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in
#ifdef USE_DRM
get_drm_aspect(&display_aspect_ratio.num, &display_aspect_ratio.den);
#else
Debug(3,"mmHeight %d mm Width %d VideoHeight %d VideoWidth %d\n",VideoScreen->height_in_millimeters,VideoScreen->width_in_millimeters,
VideoScreen->height_in_pixels,VideoScreen->width_in_pixels);
Debug(3, "mmHeight %d mm Width %d VideoHeight %d VideoWidth %d\n", VideoScreen->height_in_millimeters,
VideoScreen->width_in_millimeters, VideoScreen->height_in_pixels, VideoScreen->width_in_pixels);
display_aspect_ratio.num = VideoScreen->width_in_pixels * VideoScreen->height_in_millimeters;
display_aspect_ratio.den = VideoScreen->height_in_pixels * VideoScreen->width_in_millimeters;
#endif
@ -873,9 +871,6 @@ static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI;
}\
}
///
/// GLX check if a GLX extension is supported.
///
@ -974,7 +969,6 @@ static void EglInit(void)
XVisualInfo *vi = NULL;
#ifdef PLACEBO
return;
#endif
@ -1165,6 +1159,7 @@ static void EglInit(void)
if (!glewdone) {
GLenum err = glewInit();
glewdone = 1;
if (err != GLEW_OK) {
Debug(3, "Error: %s\n", glewGetErrorString(err));
@ -1509,7 +1504,8 @@ int CuvidMessage(int level, const char *format, ...)
static inline void __checkCudaErrors(CUresult err, const char *file, const int line)
{
if (CUDA_SUCCESS != err) {
CuvidMessage(2, "checkCudaErrors() Driver API error = %04d >%s< from file <%s>, line %i.\n", err, getCudaDrvErrorString(err), file, line);
CuvidMessage(2, "checkCudaErrors() Driver API error = %04d >%s< from file <%s>, line %i.\n", err,
getCudaDrvErrorString(err), file, line);
exit(EXIT_FAILURE);
}
}
@ -1736,6 +1732,7 @@ static void CuvidPrintFrames(const CuvidDecoder * decoder)
int CuvidTestSurfaces()
{
int i = 0;
if (CuvidDecoders[0] != NULL) {
if (i = atomic_read(&CuvidDecoders[0]->SurfacesFilled) < VIDEO_SURFACES_MAX - 1)
return i;
@ -1779,14 +1776,14 @@ const int mpgl_preferred_gl_versions[] = {
0
};
static bool create_context_cb(EGLDisplay display, int es_version, EGLContext * out_context, EGLConfig * out_config, int *bpp)
static bool create_context_cb(EGLDisplay display, int es_version, EGLContext * out_context, EGLConfig * out_config,
int *bpp)
{
EGLenum api;
EGLint rend, *attribs;
const char *name;
switch (es_version) {
case 0:
api = EGL_OPENGL_API;
@ -1832,6 +1829,7 @@ static bool create_context_cb(EGLDisplay display, int es_version, EGLContext * o
EGL_NONE
};
EGLint num_configs = 0;
#ifndef RASPI
attribs = attributes10;
*bpp = 10;
@ -1909,6 +1907,7 @@ static bool create_context_cb(EGLDisplay display, int es_version, EGLContext * o
make_egl()
{
int bpp;
CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR");
DestroyImageKHR = (void *)eglGetProcAddress("eglDestroyImageKHR");
EGLImageTargetTexture2DOES = (void *)eglGetProcAddress("glEGLImageTargetTexture2DOES");
@ -2439,14 +2438,18 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
#ifdef RASPI
if (PixFmt == AV_PIX_FMT_NV12)
glTexImage2D(GL_TEXTURE_2D, 0,GL_R8 ,n==0?size_x:size_x/2, n==0?size_y:size_y/2, 0, GL_RED , GL_UNSIGNED_BYTE , NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R8, n == 0 ? size_x : size_x / 2, n == 0 ? size_y : size_y / 2, 0,
GL_RED, GL_UNSIGNED_BYTE, NULL);
else
glTexImage2D(GL_TEXTURE_2D, 0,GL_R16,n==0?size_x:size_x/2, n==0?size_y:size_y/2, 0, GL_RED , GL_UNSIGNED_SHORT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, GL_R16, n == 0 ? size_x : size_x / 2, n == 0 ? size_y : size_y / 2, 0,
GL_RED, GL_UNSIGNED_SHORT, NULL);
#else
if (PixFmt == AV_PIX_FMT_NV12)
glTexImage2D(GL_TEXTURE_2D, 0,n==0?GL_R8 :GL_RG8 ,n==0?size_x:size_x/2, n==0?size_y:size_y/2, 0, n==0?GL_RED:GL_RG , GL_UNSIGNED_BYTE , NULL);
glTexImage2D(GL_TEXTURE_2D, 0, n == 0 ? GL_R8 : GL_RG8, n == 0 ? size_x : size_x / 2,
n == 0 ? size_y : size_y / 2, 0, n == 0 ? GL_RED : GL_RG, GL_UNSIGNED_BYTE, NULL);
else
glTexImage2D(GL_TEXTURE_2D, 0,n==0?GL_R16:GL_RG16 ,n==0?size_x:size_x/2, n==0?size_y:size_y/2, 0, n==0?GL_RED:GL_RG , GL_UNSIGNED_SHORT, NULL);
glTexImage2D(GL_TEXTURE_2D, 0, n == 0 ? GL_R16 : GL_RG16, n == 0 ? size_x : size_x / 2,
n == 0 ? size_y : size_y / 2, 0, n == 0 ? GL_RED : GL_RG, GL_UNSIGNED_SHORT, NULL);
#endif
SDK_CHECK_ERROR_GL();
// register this texture with CUDA
@ -2489,17 +2492,20 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi
desc.layers[n].pitch[plane]); \
} while (0)
void generateVAAPIImage(CuvidDecoder * decoder, VASurfaceID index, const AVFrame * frame, int image_width, int image_height)
void generateVAAPIImage(CuvidDecoder * decoder, VASurfaceID index, const AVFrame * frame, int image_width,
int image_height)
{
VAStatus status;
uint64_t first_time;
#if defined (VAAPI) && !defined (RASPI)
VADRMPRIMESurfaceDescriptor desc;
status =
vaExportSurfaceHandle(decoder->VaDisplay, (VASurfaceID)(uintptr_t)frame->data[3], VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2,
VA_EXPORT_SURFACE_READ_ONLY | VA_EXPORT_SURFACE_SEPARATE_LAYERS, &desc);
vaExportSurfaceHandle(decoder->VaDisplay, (VASurfaceID) (uintptr_t) frame->data[3],
VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, VA_EXPORT_SURFACE_READ_ONLY | VA_EXPORT_SURFACE_SEPARATE_LAYERS,
&desc);
if (status != VA_STATUS_SUCCESS) {
printf("Fehler beim export VAAPI Handle\n");
@ -2509,6 +2515,7 @@ void generateVAAPIImage(CuvidDecoder * decoder, VASurfaceID index, const AVFrame
#endif
#ifdef RASPI
AVDRMFrameDescriptor desc;
memcpy(&desc, frame->data[0], sizeof(desc));
#endif
@ -2520,6 +2527,7 @@ void generateVAAPIImage(CuvidDecoder * decoder, VASurfaceID index, const AVFrame
int attribs[20] = { EGL_NONE };
uint num_attribs = 0;
int fd;
#if defined (VAAPI) && !defined (RASPI)
ADD_ATTRIB(EGL_LINUX_DRM_FOURCC_EXT, desc.layers[n].drm_format);
ADD_ATTRIB(EGL_WIDTH, n == 0 ? image_width : image_width / 2);
@ -2610,7 +2618,6 @@ static unsigned CuvidGetVideoSurface(CuvidDecoder * decoder, const AVCodecContex
#if defined (VAAPI) || defined (YADIF)
static void CuvidSyncRenderFrame(CuvidDecoder * decoder, const AVCodecContext * video_ctx, AVFrame * frame);
int push_filters(AVCodecContext * dec_ctx, CuvidDecoder * decoder, AVFrame * frame)
{
@ -2761,9 +2768,7 @@ static int init_generic_hwaccel(CuvidDecoder * decoder, enum AVPixelFormat hw_fm
goto error;
}
if (avcodec_get_hw_frames_parameters(video_ctx,
hw_device_ctx, hw_fmt, &new_frames_ctx) < 0)
{
if (avcodec_get_hw_frames_parameters(video_ctx, hw_device_ctx, hw_fmt, &new_frames_ctx) < 0) {
Debug(3, "Hardware decoding of this stream is unsupported?\n");
goto error;
}
@ -2773,16 +2778,13 @@ static int init_generic_hwaccel(CuvidDecoder * decoder, enum AVPixelFormat hw_fm
// We might be able to reuse a previously allocated frame pool.
if (decoder->cached_hw_frames_ctx) {
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,old_fctx->sw_format ,
new_fctx->width, old_fctx->width ,
new_fctx->height, old_fctx->height ,
Debug(3, "CMP %d:%d %d:%d %d:%d %d:%d %d:%d\,", 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,
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 ||
new_fctx->width != old_fctx->width ||
new_fctx->height != old_fctx->height ||
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
|| new_fctx->width != old_fctx->width || new_fctx->height != old_fctx->height
|| new_fctx->initial_pool_size != old_fctx->initial_pool_size) {
Debug(3, "delete old cache");
if (decoder->filter_graph)
avfilter_graph_free(&decoder->filter_graph);
@ -2892,8 +2894,8 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder, AVCodecContex
ist->hwaccel_output_format = AV_PIX_FMT_NV12;
}
if ((video_ctx->width != decoder->InputWidth
|| video_ctx->height != decoder->InputHeight) && decoder->TrickSpeed == 0) {
if ((video_ctx->width != decoder->InputWidth || video_ctx->height != decoder->InputHeight)
&& decoder->TrickSpeed == 0) {
// if (decoder->TrickSpeed == 0) {
#ifdef PLACEBO
@ -3383,7 +3385,8 @@ static void CuvidRenderFrame(CuvidDecoder * decoder, const AVCodecContext * vide
video_ctx->width != decoder->InputWidth
// || decoder->ColorSpace != color
|| video_ctx->height != decoder->InputHeight) {
Debug(3,"fmt %02d:%02d width %d:%d hight %d:%d\n",decoder->ColorSpace,frame->colorspace ,video_ctx->width, decoder->InputWidth,video_ctx->height, decoder->InputHeight);
Debug(3, "fmt %02d:%02d width %d:%d hight %d:%d\n", decoder->ColorSpace, frame->colorspace, video_ctx->width,
decoder->InputWidth, video_ctx->height, decoder->InputHeight);
decoder->PixFmt = AV_PIX_FMT_NV12;
decoder->InputWidth = video_ctx->width;
decoder->InputHeight = video_ctx->height;
@ -3631,11 +3634,11 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))
frame = decoder->frames[current];
AVFrameSideData *sd1 = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
AVFrameSideData *sd2 = av_frame_get_side_data(frame, AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
set_hdr_metadata(frame->color_primaries, frame->color_trc, sd1, sd2);
}
#endif
// Render Progressive frame
#ifndef PLACEBO
y = VideoWindowHeight - decoder->OutputY - decoder->OutputHeight;
@ -3809,7 +3812,6 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))
decoder->newchannel = 0;
if (!pl_render_image(p->renderer, &decoder->pl_images[current], target, &render_params)) {
Debug(3, "Failed rendering frame!\n");
}
@ -3849,7 +3851,6 @@ void make_osd_overlay(int x, int y, int width, int height)
const struct pl_fmt *fmt;
struct pl_overlay *pl;
int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y);
fmt = pl_find_named_fmt(p->gpu, "rgba8"); // 8 Bit RGB
@ -4275,7 +4276,8 @@ static void CuvidSetTrickSpeed(CuvidDecoder * decoder, int speed)
/// @param[out] dropped dropped frames
/// @param[out] count number of decoded frames
///
void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int * eotf)
void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime,
int *width, int *height, int *color, int *eotf)
{
*missed = decoder->FramesMissed;
*duped = decoder->FramesDuped;
@ -4313,7 +4315,6 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder)
Get_Gamma();
#endif
video_clock = CuvidGetClock(decoder);
filled = atomic_read(&decoder->SurfacesFilled);
@ -4403,8 +4404,7 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder)
AudioDelayms(abs(diff / 90));
}
decoder->SyncCounter = 1;
}
else {
} else {
speedup = 2;
}
#if defined(DEBUG) || defined(AV_INFO)
@ -4575,7 +4575,6 @@ static void CuvidDisplayHandlerThread(void)
allfull = 1;
decoded = 0;
for (i = 0; i < CuvidDecoderN; ++i) {
decoder = CuvidDecoders[i];
@ -5199,8 +5198,6 @@ void pl_log_intern(void *stream, enum pl_log_level level, const char *msg)
printf("%5s: %s\n", prefix[level], msg);
}
void InitPlacebo()
{
@ -5300,7 +5297,8 @@ void InitPlacebo()
/// Video render thread.
///
void delete_decode() {
void delete_decode()
{
Debug(3, "decoder thread exit\n");
}
@ -5885,7 +5883,8 @@ uint8_t *VideoGrabService(int *size, int *width, int *height)
/// @param[out] dropped dropped frames
/// @param[out] count number of decoded frames
///
void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime, int *width, int *height, int *color, int *eotf)
void VideoGetStats(VideoHwDecoder * hw_decoder, int *missed, int *duped, int *dropped, int *counter, float *frametime,
int *width, int *height, int *color, int *eotf)
{
VideoUsedModule->GetStats(hw_decoder, missed, duped, dropped, counter, frametime, width, height, color, eotf);
}
@ -6163,7 +6162,6 @@ void VideoSetDevice(const char *device)
VideoDriverName = device;
}
void VideoSetConnector(char *c)
{
DRMConnector = c;
@ -6927,7 +6925,8 @@ void VideoExit(void)
}
#ifdef USE_DRM
int GlxInitopengl () {
int GlxInitopengl()
{
EGLint contextAttrs[] = {
EGL_CONTEXT_CLIENT_VERSION, 3,
EGL_NONE
@ -6947,12 +6946,14 @@ int GlxInitopengl () {
return;
}
int GlxDrawopengl () {
int GlxDrawopengl()
{
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext);
return;
}
void GlxDestroy() {
void GlxDestroy()
{
eglDestroyContext(eglDisplay, eglOSDContext);
eglOSDContext = NULL;
}
@ -6963,7 +6964,8 @@ void GlxDestroy() {
#include <sys/stat.h>
extern uint8_t *CreateJpeg(uint8_t *, int *, int, int, int);
void makejpg(uint8_t *data, int width, int height) {
void makejpg(uint8_t * data, int width, int height)
{
static int count = 0;
int i, n = 0, gpu = 0;;
char buf[32], FileName[32];
@ -7001,6 +7003,7 @@ void makejpg(uint8_t *data, int width, int height) {
jpg_image = CreateJpeg(rgb, &size1, 90, width, height);
int fd = open(FileName, O_WRONLY | O_CREAT | O_NOFOLLOW | O_TRUNC, DEFFILEMODE);
write(fd, jpg_image, size1);
close(fd);
free(rgb);