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

fix for compilerwarnings

This commit is contained in:
jojo61 2019-01-04 10:08:47 +01:00
parent 003d06b946
commit 6c5b65ed82
5 changed files with 143 additions and 180 deletions

19
codec.c
View File

@ -59,6 +59,7 @@
#define _N(str) str ///< gettext_noop shortcut #define _N(str) str ///< gettext_noop shortcut
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavutil/opt.h>
#include <libavutil/mem.h> #include <libavutil/mem.h>
// support old ffmpeg versions <1.0 // support old ffmpeg versions <1.0
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,18,102) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,18,102)
@ -395,9 +396,6 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
*/ */
void CodecVideoClose(VideoDecoder *video_decoder) void CodecVideoClose(VideoDecoder *video_decoder)
{ {
AVCodecContext *video_ctx = video_decoder->VideoCtx;;
int ret;
AVFrame *frame;
// FIXME: play buffered data // FIXME: play buffered data
av_frame_free(&video_decoder->Frame); // callee does checks av_frame_free(&video_decoder->Frame); // callee does checks
@ -465,12 +463,10 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
{ {
AVCodecContext *video_ctx; AVCodecContext *video_ctx;
AVFrame *frame; AVFrame *frame;
int used,ret,ret1; int ret,ret1;
int got_frame; int got_frame;
int consumed = 0; int consumed = 0;
AVPacket *pkt; const AVPacket *pkt;
static uint64_t last_time = 0;
static uint64_t lastpts = 0;
next_part: next_part:
video_ctx = decoder->VideoCtx; video_ctx = decoder->VideoCtx;
@ -529,10 +525,6 @@ next_part:
} }
/** /**
** Flush the video decoder. ** Flush the video decoder.
** **
@ -540,9 +532,6 @@ next_part:
*/ */
void CodecVideoFlushBuffers(VideoDecoder * decoder) void CodecVideoFlushBuffers(VideoDecoder * decoder)
{ {
AVFrame *frame;
frame = decoder->Frame;
if (decoder->VideoCtx) { if (decoder->VideoCtx) {
avcodec_flush_buffers(decoder->VideoCtx); avcodec_flush_buffers(decoder->VideoCtx);
} }
@ -1841,7 +1830,9 @@ void CodecInit(void)
#else #else
(void)CodecNoopCallback; (void)CodecNoopCallback;
#endif #endif
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,9,100)
avcodec_register_all(); // register all formats and codecs avcodec_register_all(); // register all formats and codecs
#endif
} }
/** /**

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: VDR \n" "Project-Id-Version: VDR \n"
"Report-Msgid-Bugs-To: <see README>\n" "Report-Msgid-Bugs-To: <see README>\n"
"POT-Creation-Date: 2018-08-18 15:05+0200\n" "POT-Creation-Date: 2019-01-04 09:19+0100\n"
"PO-Revision-Date: blabla\n" "PO-Revision-Date: blabla\n"
"Last-Translator: blabla\n" "Last-Translator: blabla\n"
"Language-Team: blabla\n" "Language-Team: blabla\n"
@ -260,14 +260,22 @@ msgstr ""
msgid "codec: missing close\n" msgid "codec: missing close\n"
msgstr "" msgstr ""
#, c-format msgid " No decoder found"
msgid "codec: codec ID %#06x not found\n"
msgstr "" msgstr ""
msgid "codec: can't allocate video codec context\n" msgid "codec: can't allocate video codec context\n"
msgstr "" msgstr ""
msgid "codec: can't set options to video codec!\n" msgid "codec: can't set option deint to video codec!\n"
msgstr ""
msgid "codec: can't set option surfces to video codec!\n"
msgstr ""
msgid "codec: can't set option drop 2.field to video codec!\n"
msgstr ""
msgid "codec: can't set option drop 2.field to video codec!\n"
msgstr "" msgstr ""
msgid "codec: can't open video codec!\n" msgid "codec: can't open video codec!\n"
@ -282,6 +290,10 @@ msgstr ""
msgid "codec: can't allocate audio decoder frame buffer\n" msgid "codec: can't allocate audio decoder frame buffer\n"
msgstr "" msgstr ""
#, c-format
msgid "codec: codec ID %#06x not found\n"
msgstr ""
msgid "codec: can't allocate audio codec context\n" msgid "codec: can't allocate audio codec context\n"
msgstr "" msgstr ""
@ -327,8 +339,8 @@ msgstr ""
msgid "codec/audio: no frame\n" msgid "codec/audio: no frame\n"
msgstr "" msgstr ""
msgid "A software and GPU emulated UHD device" msgid "A software and GPU emulated HD device"
msgstr "" msgstr "Ein Software und GPU emulieres HD-Gerät"
msgid "SoftUHD" msgid "SoftUHD"
msgstr "" msgstr ""
@ -360,6 +372,9 @@ msgstr "OSD Breite"
msgid "Osd height" msgid "Osd height"
msgstr "OSD Höhe" msgstr "OSD Höhe"
msgid "GPU mem used for image caching (MB)"
msgstr ""
msgid "Suspend" msgid "Suspend"
msgstr "Unterbrechen" msgstr "Unterbrechen"
@ -384,8 +399,8 @@ msgstr "Video Hintergrundfrabe (RGB)"
msgid "Video background color (Alpha)" msgid "Video background color (Alpha)"
msgstr "Video Hintergrundfarbe (Alpha)" msgstr "Video Hintergrundfarbe (Alpha)"
msgid "Use studio levels (vdpau only)" msgid "Use studio levels"
msgstr "Benutze Studio Levels (nur vdpau)" msgstr ""
msgid "60hz display mode" msgid "60hz display mode"
msgstr "60Hz Anzeigemodus" msgstr "60Hz Anzeigemodus"
@ -399,8 +414,11 @@ msgstr "Schwarz während Kanalwechsel"
msgid "Clear decoder on channel switch" msgid "Clear decoder on channel switch"
msgstr "Decoder bei Kanalwechsel leeren" msgstr "Decoder bei Kanalwechsel leeren"
msgid "Brightness (-1000..1000) (vdpau)" msgid "Scaler Test"
msgstr "Helligkeit (-1000..1000) (vdpau)" msgstr ""
msgid "Brightness (-100..100)"
msgstr ""
msgid "min" msgid "min"
msgstr "min" msgstr "min"
@ -408,14 +426,26 @@ msgstr "min"
msgid "max" msgid "max"
msgstr "max" msgstr "max"
msgid "Contrast (0..10000) (vdpau)" msgid "Contrast (0..100)"
msgstr "Kontrast (0..10000) (vdpau)" msgstr ""
msgid "Saturation (0..10000) (vdpau)" msgid "Saturation (0..100)"
msgstr "Sättigung (0..10000) (vdpau)" msgstr ""
msgid "Hue (-3141..3141) (vdpau)" msgid "Gamma (0..100)"
msgstr "Farbton (-3141..3141) (vdpau)" msgstr ""
msgid "Hue (-314..314) "
msgstr ""
msgid "Monitor Colorspace"
msgstr ""
msgid "Color Blindness"
msgstr ""
msgid "Color Correction (-100..100) "
msgstr ""
msgid "Scaling" msgid "Scaling"
msgstr "Skalierung" msgstr "Skalierung"
@ -474,6 +504,15 @@ msgstr "Audio Driftkorrektur"
msgid "Pass-through default" msgid "Pass-through default"
msgstr "Pass-Through-Standard" msgstr "Pass-Through-Standard"
msgid " PCM pass-through"
msgstr ""
msgid " AC-3 pass-through"
msgstr ""
msgid " E-AC-3 pass-through"
msgstr ""
msgid "Enable (E-)AC-3 (decoder) downmix" msgid "Enable (E-)AC-3 (decoder) downmix"
msgstr "Aktiviere (E-)AC-3 (decoder) downmix" msgstr "Aktiviere (E-)AC-3 (decoder) downmix"
@ -611,6 +650,10 @@ msgstr "PIP schließen"
msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)" msgid " Frames missed(%d) duped(%d) dropped(%d) total(%d)"
msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)" msgstr " Frames verloren(%d) verdoppelt(%d) übersprungen(%d) Gesamt(%d)"
#, c-format
msgid " Frame Process time %2.2fms"
msgstr ""
msgid "pass-through disabled" msgid "pass-through disabled"
msgstr "" msgstr ""
@ -690,10 +733,6 @@ msgstr ""
msgid "[softhddev] out of memory\n" msgid "[softhddev] out of memory\n"
msgstr "" msgstr ""
#, c-format
msgid "video: packet buffer too small for %d\n"
msgstr ""
msgid "video: no empty slot in packet ringbuffer\n" msgid "video: no empty slot in packet ringbuffer\n"
msgstr "" msgstr ""
@ -714,10 +753,6 @@ msgstr ""
msgid "[softhddev] invalid video packet %d/%d bytes\n" msgid "[softhddev] invalid video packet %d/%d bytes\n"
msgstr "" msgstr ""
#, c-format
msgid "[softhddev] empty video packet %d bytes\n"
msgstr ""
#, c-format #, c-format
msgid "softhddev: %s called without hw decoder\n" msgid "softhddev: %s called without hw decoder\n"
msgstr "" msgstr ""
@ -815,10 +850,6 @@ msgstr ""
msgid "video/glx: SGI v-sync enabled\n" msgid "video/glx: SGI v-sync enabled\n"
msgstr "" msgstr ""
#, c-format
msgid "checkCudaErrors() Driver API error = %04d"
msgstr ""
msgid "video/cuvid: surface needed not set\n" msgid "video/cuvid: surface needed not set\n"
msgstr "" msgstr ""
@ -832,9 +863,6 @@ msgstr ""
msgid "video/cuvid: out of memory\n" msgid "video/cuvid: out of memory\n"
msgstr "" msgstr ""
msgid "video/cuvid: need 1 future, 1 current, 1 back and 1 work surface\n"
msgstr ""
msgid "video/cuvid: decoder not in decoder list.\n" msgid "video/cuvid: decoder not in decoder list.\n"
msgstr "" msgstr ""
@ -842,47 +870,31 @@ msgid "video/glx: glx error\n"
msgstr "" msgstr ""
#, c-format #, c-format
msgid "video/cuvid: SDL error %d: %d\n" msgid "video/cuvid: SDL error %d\n"
msgstr "" msgstr ""
msgid "video/vdpau: no valid vdpau pixfmt found\n" msgid "Unable to create placebo textures"
msgstr "" msgstr ""
msgid "video/vdpau: no valid profile found\n" msgid "video: no valid pixfmt found\n"
msgstr "" msgstr ""
msgid "CUVID Init failed\n" msgid "video: no valid profile found\n"
msgstr "" msgstr ""
msgid "CUVID Not found\n" msgid "NO Format valid"
msgstr "" msgstr ""
#, c-format msgid "Failed rendering frame!\n"
msgid "video/vdpau: can't get output surface parameters: %s\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't render output surface: %s\n"
msgstr ""
msgid "video/vdpau: video surface size mismatch\n"
msgstr ""
msgid "video/vdpau: out of memory\n"
msgstr ""
#, c-format
msgid "video/vdpau: unsupported rgba format %d\n"
msgstr ""
#, c-format
msgid "video/vdpau: can't get video surface bits native: %s\n"
msgstr "" msgstr ""
#, c-format #, c-format
msgid "video/vdpau: can't get video surface parameters: %s\n" msgid "video/vdpau: can't get video surface parameters: %s\n"
msgstr "" msgstr ""
msgid "video/vdpau: out of memory\n"
msgstr ""
#, c-format #, c-format
msgid "video/vdpau: unsupported chroma type %d\n" msgid "video/vdpau: unsupported chroma type %d\n"
msgstr "" msgstr ""
@ -902,18 +914,16 @@ msgstr ""
msgid "Kein Cuda device gefunden" msgid "Kein Cuda device gefunden"
msgstr "" msgstr ""
#, c-format msgid "Failed to submit swapchain buffer\n"
msgid "video/cuvid: can't block queue: %s\n"
msgstr ""
#, c-format
msgid "video/cuvid: missed frame (%d/%d)\n"
msgstr "" msgstr ""
#, c-format #, c-format
msgid "video: decoder buffer empty, duping frame (%d/%d) %d v-buf\n" msgid "video: decoder buffer empty, duping frame (%d/%d) %d v-buf\n"
msgstr "" msgstr ""
msgid "Failed creating vulkan swapchain!"
msgstr ""
msgid "video: fatal i/o error\n" msgid "video: fatal i/o error\n"
msgstr "" msgstr ""
@ -927,6 +937,21 @@ msgstr ""
msgid "video: can't unlock thread\n" msgid "video: can't unlock thread\n"
msgstr "" msgstr ""
msgid "Cant get memory for PLACEBO struct"
msgstr ""
msgid "Failed initializing libplacebo\n"
msgstr ""
msgid "Failed to create XCB Surface\n"
msgstr ""
msgid "Failed to create Vulkan Device"
msgstr ""
msgid "Failed initializing libplacebo renderer\n"
msgstr ""
msgid "video: can't queue cancel video display thread\n" msgid "video: can't queue cancel video display thread\n"
msgstr "" msgstr ""
@ -944,11 +969,11 @@ msgid "softhddev: grab unsupported\n"
msgstr "" msgstr ""
#, c-format #, c-format
msgid "video: Can't connect to X11 server on '%s'\n" msgid "video: Can't initialize X11 thread support on '%s'\n"
msgstr "" msgstr ""
#, c-format #, c-format
msgid "video: Can't initialize X11 thread support on '%s'\n" msgid "video: Can't connect to X11 server on '%s'\n"
msgstr "" msgstr ""
msgid "video: Can't convert XLIB display to XCB connection\n" msgid "video: Can't convert XLIB display to XCB connection\n"
@ -961,8 +986,20 @@ msgstr ""
msgid "video: error closing display\n" msgid "video: error closing display\n"
msgstr "" msgstr ""
#~ msgid "A software and GPU emulated HD device" #~ msgid "Use studio levels (vdpau only)"
#~ msgstr "Ein Software und GPU emulieres HD-Gerät" #~ msgstr "Benutze Studio Levels (nur vdpau)"
#~ msgid "Brightness (-1000..1000) (vdpau)"
#~ msgstr "Helligkeit (-1000..1000) (vdpau)"
#~ msgid "Contrast (0..10000) (vdpau)"
#~ msgstr "Kontrast (0..10000) (vdpau)"
#~ msgid "Saturation (0..10000) (vdpau)"
#~ msgstr "Sättigung (0..10000) (vdpau)"
#~ msgid "Hue (-3141..3141) (vdpau)"
#~ msgstr "Farbton (-3141..3141) (vdpau)"
#~ msgid "SoftHdDevice" #~ msgid "SoftHdDevice"
#~ msgstr "SoftHdDevice" #~ msgstr "SoftHdDevice"

View File

@ -992,6 +992,7 @@ void cMenuSetupSoft::Create(void)
static const char *const video_display_formats_16_9[] = { static const char *const video_display_formats_16_9[] = {
"pan&scan", "pillarbox", "center cut-out", "pan&scan", "pillarbox", "center cut-out",
}; };
#if 0
static const char *const deinterlace[] = { static const char *const deinterlace[] = {
"Bob", "Weave/None", "Temporal", "TemporalSpatial", "Software Bob", "Bob", "Weave/None", "Temporal", "TemporalSpatial", "Software Bob",
"Software Spatial", "Software Spatial",
@ -999,14 +1000,8 @@ void cMenuSetupSoft::Create(void)
static const char *const deinterlace_short[] = { static const char *const deinterlace_short[] = {
"B", "W", "T", "T+S", "S+B", "S+S", "B", "W", "T", "T+S", "S+B", "S+S",
}; };
#ifndef PLACEBO
static const char *const scaling[] = {
"Normal", "Fast", "HQ", "Anamorphic"
};
#endif #endif
static const char *const scaling_short[] = {
"N", "F", "HQ", "A"
};
static const char *const audiodrift[] = { static const char *const audiodrift[] = {
"None", "PCM", "AC-3", "PCM + AC-3" "None", "PCM", "AC-3", "PCM + AC-3"
}; };

View File

@ -661,7 +661,7 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size,
n = pesdx->Index - pesdx->Skip; n = pesdx->Index - pesdx->Skip;
while (n >= 5) { while (n >= 5) {
int r; int r;
unsigned codec_id; unsigned codec_id = AV_CODEC_ID_NONE;
// 4 bytes 0xFFExxxxx Mpeg audio // 4 bytes 0xFFExxxxx Mpeg audio
// 5 bytes 0x0B77xxxxxx AC-3 audio // 5 bytes 0x0B77xxxxxx AC-3 audio
@ -1687,6 +1687,8 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts,
** **
** @param avpkt ffmpeg a/v packet ** @param avpkt ffmpeg a/v packet
*/ */
#ifndef USE_PIP
static void FixPacketForFFMpeg(VideoDecoder * vdecoder, AVPacket * avpkt) static void FixPacketForFFMpeg(VideoDecoder * vdecoder, AVPacket * avpkt)
{ {
uint8_t *p; uint8_t *p;
@ -1746,7 +1748,7 @@ static void FixPacketForFFMpeg(VideoDecoder * vdecoder, AVPacket * avpkt)
#endif #endif
CodecVideoDecode(vdecoder, tmp); CodecVideoDecode(vdecoder, tmp);
} }
#endif
/** /**
@ -2676,7 +2678,6 @@ void StillPicture(const uint8_t * data, int size)
// H265 NAL End of Sequence // H265 NAL End of Sequence
static uint8_t seq_end_h265[] = { 0x00, 0x00, 0x00, 0x01, 0x48, 0x01 }; //0x48 = end of seq 0x4a = end of stream static uint8_t seq_end_h265[] = { 0x00, 0x00, 0x00, 0x01, 0x48, 0x01 }; //0x48 = end of seq 0x4a = end of stream
int i; int i;
int old_video_hardware_decoder;
// might be called in Suspended Mode // might be called in Suspended Mode
if (!MyVideoStream->Decoder || MyVideoStream->SkipStream) { if (!MyVideoStream->Decoder || MyVideoStream->SkipStream) {

115
video.c
View File

@ -393,12 +393,6 @@ static int VideoCutTopBottom[VideoResolutionMax];
/// Default cut left and right in pixels /// Default cut left and right in pixels
static int VideoCutLeftRight[VideoResolutionMax]; static int VideoCutLeftRight[VideoResolutionMax];
/// Color space ITU-R BT.601, ITU-R BT.709, ...
static const VideoColorSpace VideoColorSpaces[VideoResolutionMax] = {
VideoColorSpaceBt601, VideoColorSpaceBt709, VideoColorSpaceBt709,
VideoColorSpaceBt709,VideoColorSpaceBt709
};
/// Default scaling mode /// Default scaling mode
static VideoScalingModes VideoScaling[VideoResolutionMax]; static VideoScalingModes VideoScaling[VideoResolutionMax];
@ -891,10 +885,8 @@ static void GlxUploadOsdTexture(int x, int y, int width, int height,
/// @param width osd width /// @param width osd width
/// @param height osd height /// @param height osd height
/// ///
static void GlxOsdInit(int width, int height) static void GlxOsdInit(__attribute__((unused))int width, __attribute__((unused))int height)
{ {
int i;
#ifdef DEBUG #ifdef DEBUG
if (!GlxEnabled) { if (!GlxEnabled) {
Debug(3, "video/glx: %s called without glx enabled\n", __FUNCTION__); Debug(3, "video/glx: %s called without glx enabled\n", __FUNCTION__);
@ -1666,7 +1658,7 @@ typedef struct _cuvid_decoder_
CUcontext cuda_ctx; CUcontext cuda_ctx;
#ifdef PLACEBO #ifdef PLACEBO
struct pl_image pl_images[CODEC_SURFACES_MAX+1]; // images für Placebo chain struct pl_image pl_images[CODEC_SURFACES_MAX+1]; // images f<EFBFBD>r Placebo chain
const struct pl_tex *pl_tex_in[CODEC_SURFACES_MAX+1][2]; // Textures in image const struct pl_tex *pl_tex_in[CODEC_SURFACES_MAX+1][2]; // Textures in image
const struct pl_buf *pl_buf_Y,*pl_buf_UV; // buffer for Texture upload const struct pl_buf *pl_buf_Y,*pl_buf_UV; // buffer for Texture upload
struct ext_buf ebuf[2]; // for managing vk buffer struct ext_buf ebuf[2]; // for managing vk buffer
@ -1854,8 +1846,6 @@ static void CuvidCreateSurfaces(CuvidDecoder * decoder, int width, int height,en
static void CuvidDestroySurfaces(CuvidDecoder * decoder) static void CuvidDestroySurfaces(CuvidDecoder * decoder)
{ {
int i,j; int i,j;
CUcontext dummy;
CUdeviceptr d;
Debug(3, "video/cuvid: %s\n", __FUNCTION__); Debug(3, "video/cuvid: %s\n", __FUNCTION__);
@ -2003,7 +1993,7 @@ static CuvidDecoder *CuvidNewHwDecoder(VideoStream * stream)
return NULL; return NULL;
} }
if (i = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_CUDA, X11DisplayName, NULL, 0)) { if ((i = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_CUDA, X11DisplayName, NULL, 0)) != 0) {
Fatal("codec: can't allocate HW video codec context err %04x",i); Fatal("codec: can't allocate HW video codec context err %04x",i);
} }
HwDeviceContext = av_buffer_ref(hw_device_ctx); HwDeviceContext = av_buffer_ref(hw_device_ctx);
@ -2061,7 +2051,7 @@ static CuvidDecoder *CuvidNewHwDecoder(VideoStream * stream)
/// ///
static void CuvidCleanup(CuvidDecoder * decoder) static void CuvidCleanup(CuvidDecoder * decoder)
{ {
int i,n=0; int i;
Debug(3,"Cuvid Clean up\n"); Debug(3,"Cuvid Clean up\n");
@ -2096,7 +2086,7 @@ Debug(3,"Cuvid Clean up\n");
/// ///
static void CuvidDelHwDecoder(CuvidDecoder * decoder) static void CuvidDelHwDecoder(CuvidDecoder * decoder)
{ {
int i,n; int i;
Debug(3,"cuvid del hw decoder \n"); Debug(3,"cuvid del hw decoder \n");
if (decoder == CuvidDecoders[0]) if (decoder == CuvidDecoders[0])
pthread_mutex_lock(&VideoLockMutex); pthread_mutex_lock(&VideoLockMutex);
@ -2130,7 +2120,7 @@ Debug(3,"cuvid del hw decoder \n");
Error(_("video/cuvid: decoder not in decoder list.\n")); Error(_("video/cuvid: decoder not in decoder list.\n"));
} }
static int CuvidGlxInit(const char *display_name) static int CuvidGlxInit(__attribute__((unused))const char *display_name)
{ {
#ifndef PLACEBO #ifndef PLACEBO
GlxEnabled = 1; GlxEnabled = 1;
@ -2266,7 +2256,7 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
img->num_overlays = 0; img->num_overlays = 0;
} }
decoder->pl_buf_Y = pl_buf_create(p->gpu, &(struct pl_buf_params) { // buffer für Y texture upload decoder->pl_buf_Y = pl_buf_create(p->gpu, &(struct pl_buf_params) { // buffer f<EFBFBD>r Y texture upload
.type = PL_BUF_TEX_TRANSFER, .type = PL_BUF_TEX_TRANSFER,
.size = size_x * size_y * size, .size = size_x * size_y * size,
.host_mapped = false, .host_mapped = false,
@ -2277,7 +2267,7 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
decoder->ebuf[0].fd = dup(decoder->pl_buf_Y->shared_mem.handle.fd); // dup fd decoder->ebuf[0].fd = dup(decoder->pl_buf_Y->shared_mem.handle.fd); // dup fd
// printf("Y Offset %d Size %d FD %d\n",decoder->pl_buf_Y->handle_offset,decoder->pl_buf_Y->handles.size,decoder->pl_buf_Y->handles.fd); // printf("Y Offset %d Size %d FD %d\n",decoder->pl_buf_Y->handle_offset,decoder->pl_buf_Y->handles.size,decoder->pl_buf_Y->handles.fd);
decoder->pl_buf_UV = pl_buf_create(p->gpu, &(struct pl_buf_params) { // buffer für UV texture upload decoder->pl_buf_UV = pl_buf_create(p->gpu, &(struct pl_buf_params) { // buffer f<EFBFBD>r UV texture upload
.type = PL_BUF_TEX_TRANSFER, .type = PL_BUF_TEX_TRANSFER,
.size = size_x * size_y * size / 2, .size = size_x * size_y * size / 2,
.host_mapped = false, .host_mapped = false,
@ -2376,8 +2366,7 @@ void
createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned int size_y, enum AVPixelFormat PixFmt) createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned int size_y, enum AVPixelFormat PixFmt)
{ {
int n,i,size; int n,i;
CUcontext dummy;
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext); glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext);
GlxCheck(); GlxCheck();
@ -2422,8 +2411,7 @@ createTextureDst(CuvidDecoder * decoder,int anz, unsigned int size_x, unsigned i
// copy image and process using CUDA // copy image and process using CUDA
void generateCUDAImage(CuvidDecoder * decoder,int index, const AVFrame *frame,int image_width , int image_height, int bytes) void generateCUDAImage(CuvidDecoder * decoder,int index, const AVFrame *frame,int image_width , int image_height, int bytes)
{ {
int n,version; int n;
CUcontext dummy=NULL;
for (n = 0; n < 2; n++) { // for (n = 0; n < 2; n++) { //
// widthInBytes must account for the chroma plane // widthInBytes must account for the chroma plane
@ -2452,9 +2440,6 @@ void generateCUDAImage(CuvidDecoder * decoder,int index, const AVFrame *frame,in
/// ///
static void CuvidSetupOutput(CuvidDecoder * decoder) static void CuvidSetupOutput(CuvidDecoder * decoder)
{ {
uint32_t width;
uint32_t height;
// FIXME: need only to create and destroy surfaces for size changes // FIXME: need only to create and destroy surfaces for size changes
// or when number of needed surfaces changed! // or when number of needed surfaces changed!
decoder->Resolution = VideoResolutionGroup(decoder->InputWidth, decoder->InputHeight, decoder->Interlaced); decoder->Resolution = VideoResolutionGroup(decoder->InputWidth, decoder->InputHeight, decoder->Interlaced);
@ -2490,26 +2475,6 @@ typedef struct CUVIDContext {
AVFrame *tmp_frame; AVFrame *tmp_frame;
} CUVIDContext; } CUVIDContext;
static int cuvid_get_buffer(AVCodecContext *s, AVFrame *frame, int flags)
{
VideoDecoder *ist = s->opaque;
CUVIDContext *ctx = ist->hwaccel_ctx;
int ret;
if (!ctx->hw_frames_ctx) {
Debug(3,"CUDA fail get buffer\n");
exit(0);
}
ret = av_hwframe_get_buffer(ctx->hw_frames_ctx, frame, 0);
//ret = avcodec_default_get_buffer2(s, frame, flags);
Debug(3,"CUDA hwframe got buffer %d\n",ret);
return ret;
}
/// ///
/// Callback to negotiate the PixelFormat. /// Callback to negotiate the PixelFormat.
/// ///
@ -2620,7 +2585,7 @@ int get_RGB(CuvidDecoder *decoder) {
int width; int width;
int height; int height;
GLuint fb,texture; GLuint fb,texture;
int current,i; int current;
GLint texLoc; GLint texLoc;
base = decoder->grabbase; base = decoder->grabbase;
@ -2770,10 +2735,8 @@ int get_RGB(CuvidDecoder *decoder) {
}); });
pl_tex_destroy(p->gpu,&target.fbo); pl_tex_destroy(p->gpu,&target.fbo);
#endif #endif
return 0;
} }
/// ///
@ -2785,17 +2748,11 @@ int get_RGB(CuvidDecoder *decoder) {
/// ///
static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int *ret_height, int mitosd) static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int *ret_height, int mitosd)
{ {
int surface,i;
int rgba_format;
uint32_t size; uint32_t size;
uint32_t width; uint32_t width;
uint32_t height; uint32_t height;
uint8_t *base; uint8_t *base;
void *data[1];
uint32_t pitches[1];
VdpRect source_rect; VdpRect source_rect;
VdpRect output_rect;
CuvidDecoder *decoder; CuvidDecoder *decoder;
decoder = CuvidDecoders[0]; decoder = CuvidDecoders[0];
@ -2850,12 +2807,6 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int
source_rect.x0, source_rect.y0, source_rect.x1, source_rect.y1, source_rect.x0, source_rect.y0, source_rect.x1, source_rect.y1,
width, height); width, height);
output_rect.x0 = 0;
output_rect.y0 = 0;
output_rect.x1 = width;
output_rect.y1 = height;
size = width * height * sizeof(uint32_t); size = width * height * sizeof(uint32_t);
base = malloc(size); base = malloc(size);
@ -3177,7 +3128,6 @@ static void CuvidRenderFrame(CuvidDecoder * decoder,
const AVCodecContext * video_ctx, const AVFrame * frame) const AVCodecContext * video_ctx, const AVFrame * frame)
{ {
int surface; int surface;
VideoDecoder *ist = video_ctx->opaque;
enum AVColorSpace color; enum AVColorSpace color;
// update aspect ratio changes // update aspect ratio changes
@ -3287,10 +3237,7 @@ Debug(3,"fmt %02d:%02d width %d:%d hight %d:%d\n",decoder->ColorSpace,frame->co
/// ///
static void *CuvidGetHwAccelContext(CuvidDecoder * decoder) static void *CuvidGetHwAccelContext(CuvidDecoder * decoder)
{ {
unsigned int version;
int ret,n;
unsigned int device_count,version;
CUdevice device;
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; //turn NULL;
@ -3328,11 +3275,9 @@ static void *CuvidGetHwAccelContext(CuvidDecoder * decoder)
/// @FIXME: render only video area, not fullscreen! /// @FIXME: render only video area, not fullscreen!
/// decoder->Output.. isn't correct setup for radio stations /// decoder->Output.. isn't correct setup for radio stations
/// ///
static void CuvidBlackSurface(CuvidDecoder * decoder) static void CuvidBlackSurface(__attribute__((unused))CuvidDecoder * decoder)
{ {
#ifndef PLACEBO #ifndef PLACEBO
VdpRect source_rect;
VdpRect output_rect;
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
#endif #endif
return; return;
@ -3382,7 +3327,7 @@ static void CuvidAdvanceDecoderFrame(CuvidDecoder * decoder)
#ifdef PLACEBO #ifdef PLACEBO
static void CuvidMixVideo(CuvidDecoder * decoder, int level,struct pl_render_target *target, struct pl_overlay *ovl ) static void CuvidMixVideo(CuvidDecoder * decoder, int level,struct pl_render_target *target, struct pl_overlay *ovl )
#else #else
static void CuvidMixVideo(CuvidDecoder * decoder, int level) static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused))int level)
#endif #endif
{ {
#ifdef PLACEBO #ifdef PLACEBO
@ -3395,26 +3340,23 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
VkImage Image; VkImage Image;
struct pl_image *img; struct pl_image *img;
bool ok; bool ok;
#endif
static int last;
int current;
VdpRect video_src_rect; VdpRect video_src_rect;
VdpRect dst_rect; VdpRect dst_rect;
VdpRect dst_video_rect; VdpRect dst_video_rect;
int w = decoder->InputWidth; #endif
int h = decoder->InputHeight;
int current;
int y; int y;
float xcropf, ycropf; float xcropf, ycropf;
GLint texLoc; GLint texLoc;
size_t nSize = 0;
static uint32_t lasttime = 0;
#ifdef USE_AUTOCROP #ifdef USE_AUTOCROP
// FIXME: can move to render frame // FIXME: can move to render frame
CuvidCheckAutoCrop(decoder); CuvidCheckAutoCrop(decoder);
#endif #endif
#ifdef PLACEBO
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;
@ -3431,15 +3373,17 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
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;
video_src_rect.y1 = decoder->CropY + decoder->CropHeight; video_src_rect.y1 = decoder->CropY + decoder->CropHeight;
#endif
xcropf = (float) decoder->CropX / (float) decoder->InputWidth; xcropf = (float) decoder->CropX / (float) decoder->InputWidth;
ycropf = (float) decoder->CropY / (float) decoder->InputHeight; ycropf = (float) decoder->CropY / (float) decoder->InputHeight;
#ifdef PLACEBO
dst_video_rect.x0 = decoder->OutputX; // video output (scale) dst_video_rect.x0 = decoder->OutputX; // video output (scale)
dst_video_rect.y0 = decoder->OutputY; dst_video_rect.y0 = decoder->OutputY;
dst_video_rect.x1 = decoder->OutputX + decoder->OutputWidth; dst_video_rect.x1 = decoder->OutputX + decoder->OutputWidth;
dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight; dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight;
#endif
current = decoder->SurfacesRb[decoder->SurfaceRead]; current = decoder->SurfacesRb[decoder->SurfaceRead];
// Render Progressive frame and simple interlaced // Render Progressive frame and simple interlaced
@ -3674,13 +3618,14 @@ void make_osd_overlay(int x, int y, int width, int height) {
static void CuvidDisplayFrame(void) static void CuvidDisplayFrame(void)
{ {
uint64_t first_time, diff, akt_time; uint64_t first_time;
static uint64_t last_time = 0; static uint64_t last_time = 0;
int i; int i;
static unsigned int Count; static unsigned int Count;
int filled; int filled;
CuvidDecoder *decoder; CuvidDecoder *decoder;
#ifdef PLACEBO #ifdef PLACEBO
uint64_t diff;
struct pl_swapchain_frame frame; struct pl_swapchain_frame frame;
struct pl_render_target target; struct pl_render_target target;
bool ok; bool ok;
@ -3981,12 +3926,11 @@ void CuvidGetStats(CuvidDecoder * decoder, int *missed, int *duped,
/// ///
static void CuvidSyncDecoder(CuvidDecoder * decoder) static void CuvidSyncDecoder(CuvidDecoder * decoder)
{ {
int err;
int filled; int filled;
int64_t audio_clock; int64_t audio_clock;
int64_t video_clock; int64_t video_clock;
int err = 0;
err = 0;
video_clock = CuvidGetClock(decoder); video_clock = CuvidGetClock(decoder);
filled = atomic_read(&decoder->SurfacesFilled); filled = atomic_read(&decoder->SurfacesFilled);
@ -4357,9 +4301,6 @@ static void CuvidSetOutputPosition(CuvidDecoder * decoder, int x, int y,
// CUVID OSD // CUVID OSD
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static const uint8_t OsdZeros[4096 * 2160 * 4]; ///< 0 for clear osd
/// ///
/// CUVID module. /// CUVID module.
/// ///
@ -4798,7 +4739,7 @@ static void VideoEvent(void)
case MapNotify: case MapNotify:
Debug(3, "video/event: MapNotify\n"); Debug(3, "video/event: MapNotify\n");
// µwm workaround // <EFBFBD>wm workaround
VideoThreadLock(); VideoThreadLock();
xcb_change_window_attributes(Connection, VideoWindow, xcb_change_window_attributes(Connection, VideoWindow,
XCB_CW_CURSOR, &VideoBlankCursor); XCB_CW_CURSOR, &VideoBlankCursor);
@ -5041,8 +4982,6 @@ static void *VideoDisplayHandlerThread(void *dummy)
{ {
CUcontext cuda_ctx; CUcontext cuda_ctx;
unsigned int device_count,version;
CUdevice device;
#ifdef PLACEBO_ #ifdef PLACEBO_
InitPlacebo(); InitPlacebo();