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

fixed some compiler warnings

This commit is contained in:
jojo61 2018-10-14 13:05:22 +02:00
parent a32b42c68d
commit 5f5facba9d
3 changed files with 44 additions and 33 deletions

View File

@ -22,13 +22,13 @@
typedef struct
{
char const *error_string;
int error_id;
unsigned int error_id;
} s_CudaErrorStr;
/**
* Error codes
*/
static s_CudaErrorStr sCudaDrvErrorString[] =
s_CudaErrorStr sCudaDrvErrorString[] =
{
/**
* The API call returned with no errors. In the case of query calls, this

View File

@ -196,13 +196,15 @@ static const struct gl_vao_entry vertex_vao[] = {
static void compile_attach_shader(GLuint program,
GLenum type, const char *source)
{
GLuint shader;
GLint status, log_length;
GLuint shader = glCreateShader(type);
shader = glCreateShader(type);
glShaderSource(shader, 1, &source, NULL);
glCompileShader(shader);
GLint status = 0;
status = 0;
glGetShaderiv(shader, GL_COMPILE_STATUS, &status);
GLint log_length = 0;
log_length = 0;
glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &log_length);
Debug(3,"compile Status %d loglen %d\n",status,log_length);
@ -213,10 +215,12 @@ Debug(3,"compile Status %d loglen %d\n",status,log_length);
static void link_shader(GLuint program)
{
GLint status,log_length;
glLinkProgram(program);
GLint status = 0;
status = 0;
glGetProgramiv(program, GL_LINK_STATUS, &status);
GLint log_length = 0;
log_length = 0;
glGetProgramiv(program, GL_INFO_LOG_LENGTH, &log_length);
Debug(3,"Link Status %d loglen %d\n",status,log_length);

53
video.c
View File

@ -508,7 +508,7 @@ static void VideoSetPts(int64_t * pts_p, int interlaced,
} else {
duration = interlaced ? 40 : 20; // 50Hz -> 20ms default
}
Debug(4, "video: %d/%d %" PRIx64 " -> %d\n", video_ctx->framerate.den, video_ctx->framerate.num, av_frame_get_pkt_duration(frame), duration);
// Debug(4, "video: %d/%d %" PRIx64 " -> %d\n", video_ctx->framerate.den, video_ctx->framerate.num, av_frame_get_pkt_duration(frame), duration);
// update video clock
@ -552,7 +552,8 @@ static void VideoSetPts(int64_t * pts_p, int interlaced,
}
}
}
static int CuvidMessage(int level, const char *format, ...);
int CuvidMessage(int level, const char *format, ...);
///
/// Update output for new size or aspect ratio.
///
@ -1128,6 +1129,8 @@ static void GlxInit(void)
int glx_GLX_MESA_swap_control;
int glx_GLX_SGI_swap_control;
int glx_GLX_SGI_video_sync;
GLXFBConfig *fbc;
int redSize, greenSize, blueSize;
if (!glXQueryVersion(XlibDisplay, &major, &minor)) {
Error(_("video/glx: no GLX support\n"));
@ -1173,7 +1176,7 @@ static void GlxInit(void)
// create glx context
glXMakeCurrent(XlibDisplay, None, NULL);
GLXFBConfig *fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList10,&fbcount); // try 10 Bit
fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList10,&fbcount); // try 10 Bit
if (fbc==NULL) {
fbc = glXChooseFBConfig(XlibDisplay, DefaultScreen(XlibDisplay),attributeList,&fbcount); // fall back to 8 Bit
if (fbc==NULL)
@ -1182,8 +1185,6 @@ static void GlxInit(void)
vi = glXGetVisualFromFBConfig(XlibDisplay, fbc[0]);
int redSize, greenSize, blueSize;
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize);
@ -1665,21 +1666,7 @@ unsigned int num_values;
int window_width,window_height;
#include "shaders.h"
////////////////////////////////////////////////////////////////////////////////
// These are CUDA Helper functions
// This will output the proper CUDA error strings in the event that a CUDA host call returns an error
#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
// These are the inline versions for all of the SDK helper functions
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);
exit(EXIT_FAILURE);
}
}
//----------------------------------------------------------------------------
@ -1694,7 +1681,7 @@ inline void __checkCudaErrors(CUresult err, const char *file, const int line)
///
/// @returns true, if message shown
///
static int CuvidMessage(int level, const char *format, ...)
int CuvidMessage(int level, const char *format, ...)
{
if (SysLogLevel > level || DebugLevel > level) {
static const char *last_format;
@ -1721,6 +1708,21 @@ static int CuvidMessage(int level, const char *format, ...)
return 0;
}
////////////////////////////////////////////////////////////////////////////////
// These are CUDA Helper functions
// This will output the proper CUDA error strings in the event that a CUDA host call returns an error
#define checkCudaErrors(err) __checkCudaErrors (err, __FILE__, __LINE__)
// These are the inline versions for all of the SDK helper functions
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);
exit(EXIT_FAILURE);
}
}
// Surfaces -------------------------------------------------------------
void
@ -2313,13 +2315,16 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder,
#ifdef USE_GRAB
int get_RGB(CuvidDecoder *decoder) {
uint8_t *base = decoder->grabbase;;
int width = decoder->grabwidth;
int height = decoder->grabheight;
uint8_t *base;
int width;
int height;
GLuint fb,texture;
int current,i;
GLint texLoc;
base = decoder->grabbase;
width = decoder->grabwidth;
height = decoder->grabheight;
glGenTextures(1, &texture);
GlxCheck();
glBindTexture(GL_TEXTURE_2D, texture);
@ -3422,11 +3427,13 @@ static void CuvidSyncDisplayFrame(void)
static void CuvidSyncRenderFrame(CuvidDecoder * decoder,
const AVCodecContext * video_ctx, const AVFrame * frame)
{
#if 0
// FIXME: temp debug
if (0 && frame->pkt_pts != (int64_t) AV_NOPTS_VALUE) {
Debug(3, "video: render frame pts %s\n",
Timestamp2String(frame->pkt_pts));
}
#endif
#ifdef DEBUG
if (!atomic_read(&decoder->SurfacesFilled)) {
Debug(4, "video: new stream frame %dms\n", GetMsTicks() - VideoSwitch);