diff --git a/README.md b/README.md index 42fb834..c213f90 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Copyright (c) 2018 by jojo61. All Rights Reserved. Contributor(s): -jojo61 +jojo61 License: AGPLv3 @@ -31,13 +31,13 @@ A software and GPU emulated UHD output device plugin for VDR. o HDMI/SPDIF pass-through o Software volume, compression, normalize and channel resample o VDR ScaleVideo API - o CUDA deinterlacer + o CUDA deinterlacer o Autocrop o Suspend / Dettach o PIP (Picture-in-Picture) (not working yet) -To compile you must have the 'requires' installed. +To compile you must have the 'requires' installed. This is a fork of johns original softhddevice work and I reworked it to support HEVC with CUDA and opengl output. @@ -52,7 +52,7 @@ You need libplacebo. It is still beta and I tested it with Intel VAAPI. If you have problmes with the shaders then copy the drirc file in your home directory as .drirc AMD VAAPI is broken by AMD and will not work currently. The vaapi_deinterlace is broken and the amdgpu driver is instable. I have not testet with amdgpupro -You have to adapt the Makefile to your needs. I use FFMPEG 4.0 +You have to adapt the Makefile to your needs. I use FFMPEG 4.0 The Makefile expects the CUDA SDK in /usr/local/cuda. Currently it is tested with CUDA 10 Unfortunatly older FFMEGs has a bug with deinterlacing cuda frames. Best to get the latest FFMPEG Version. @@ -65,7 +65,7 @@ old: new: ctx->frame_queue = av_fifo_alloc((ctx->nb_surfaces + 2 ) * sizeof(CuvidParsedFrame)); -This Version supports building with libplacebo. https://github.com/haasn/libplacebo +This Version supports building with libplacebo. https://github.com/haasn/libplacebo You have to enable it in the Makefile and install libplacebo yourself. At the moment this is Work in progress. It also needs the NVIDIA driver 410.48 or newer as well as CUDA 10. @@ -74,7 +74,7 @@ In the settings you can enable a correction for Colorblindness. First you have t Also you can enable a Scaler Test feature. When enabled then the screen is split.On the left half you will see the scaler defined by Scaler Test and on the right side you will see the scaler defined at the Resolution setting. There is as small black line between the halfs to remaind you that Scaler Test is activ. -If your FFMEG supports it then you can enable YADIF in the Makefile and select btween the buildin NVIDIA CUDA deinterlacer and the YADIF cuda deinterlacer. +If your FFMEG supports it then you can enable YADIF in the Makefile and select btween the buildin NVIDIA CUDA deinterlacer and the YADIF cuda deinterlacer. Good luck jojo61 diff --git a/audio.c b/audio.c index 0b4ff61..449e257 100644 --- a/audio.c +++ b/audio.c @@ -87,7 +87,7 @@ #endif #include #ifndef HAVE_PTHREAD_NAME - /// only available with newer glibc +/// only available with newer glibc #define pthread_setname_np(thread, name) #endif #endif @@ -132,7 +132,7 @@ char AudioAlsaCloseOpenDelay; ///< enable alsa close/open delay fix static const char *AudioModuleName; ///< which audio module to use - /// Selected audio module. +/// Selected audio module. static const AudioModule *AudioUsedModule = &NoopModule; static const char *AudioPCMDevice; ///< PCM device name static const char *AudioPassthroughDevice; ///< Passthrough device name @@ -174,30 +174,30 @@ static int AudioVolume; ///< current volume (0 .. 1000) extern int VideoAudioDelay; ///< import audio/video delay - /// default ring buffer size ~2s 8ch 16bit (3 * 5 * 7 * 8) +/// default ring buffer size ~2s 8ch 16bit (3 * 5 * 7 * 8) static const unsigned AudioRingBufferSize = 3 * 5 * 7 * 8 * 2 * 1000; static int AudioChannelsInHw[9]; ///< table which channels are supported enum _audio_rates { ///< sample rates enumeration // HW: 32000 44100 48000 88200 96000 176400 192000 - //Audio32000, ///< 32.0Khz + // Audio32000, ///< 32.0Khz Audio44100, ///< 44.1Khz Audio48000, ///< 48.0Khz - //Audio88200, ///< 88.2Khz - //Audio96000, ///< 96.0Khz - //Audio176400, ///< 176.4Khz + // Audio88200, ///< 88.2Khz + // Audio96000, ///< 96.0Khz + // Audio176400, ///< 176.4Khz Audio192000, ///< 192.0Khz AudioRatesMax ///< max index }; - /// table which rates are supported +/// table which rates are supported static int AudioRatesInHw[AudioRatesMax]; - /// input to hardware channel matrix +/// input to hardware channel matrix static int AudioChannelMatrix[AudioRatesMax][9]; - /// rates tables (must be sorted by frequency) +/// rates tables (must be sorted by frequency) static const unsigned AudioRatesTable[AudioRatesMax] = { 44100, 48000, 192000 }; @@ -209,7 +209,7 @@ static const unsigned AudioRatesTable[AudioRatesMax] = { static const int AudioNormSamples = 4096; ///< number of samples #define AudioNormMaxIndex 128 ///< number of average values - /// average of n last sample blocks +/// average of n last sample blocks static uint32_t AudioNormAverage[AudioNormMaxIndex]; static int AudioNormIndex; ///< index into average table static int AudioNormReady; ///< index counter @@ -1149,7 +1149,7 @@ static int64_t AlsaGetDelay(void) } // delay in frames in alsa + kernel buffers if ((err = snd_pcm_delay(AlsaPCMHandle, &delay)) < 0) { - //Debug(3, "audio/alsa: no hw delay\n"); + // Debug(3, "audio/alsa: no hw delay\n"); delay = 0L; #ifdef DEBUG } else if (snd_pcm_state(AlsaPCMHandle) != SND_PCM_STATE_RUNNING) { @@ -2285,7 +2285,7 @@ void AudioEnqueue(const void *samples, int count) // forced start or enough video + audio buffered // for some exotic channels * 4 too small if (AudioStartThreshold * 10 < n || (AudioVideoIsReady -// if ((AudioVideoIsReady + // if ((AudioVideoIsReady && AudioStartThreshold < n)) { // restart play-back // no lock needed, can wakeup next time diff --git a/codec.c b/codec.c index 0addf9f..2ba9576 100644 --- a/codec.c +++ b/codec.c @@ -1,4 +1,3 @@ - /// /// @file codec.c @brief Codec functions /// @@ -31,15 +30,15 @@ /// many bugs and incompatiblity in it. Don't use this shit. /// - /// compile with pass-through support (stable, AC-3, E-AC-3 only) +/// compile with pass-through support (stable, AC-3, E-AC-3 only) #define USE_PASSTHROUGH - /// compile audio drift correction support (very experimental) +/// compile audio drift correction support (very experimental) #define USE_AUDIO_DRIFT_CORRECTION - /// compile AC-3 audio drift correction support (very experimental) +/// compile AC-3 audio drift correction support (very experimental) #define USE_AC3_DRIFT_CORRECTION - /// use ffmpeg libswresample API (autodected, Makefile) +/// use ffmpeg libswresample API (autodected, Makefile) #define noUSE_SWRESAMPLE - /// use libav libavresample API (autodected, Makefile) +/// use libav libavresample API (autodected, Makefile) #define noUSE_AVRESAMPLE #include @@ -89,15 +88,15 @@ // Global //---------------------------------------------------------------------------- - /// - /// ffmpeg lock mutex - /// - /// new ffmpeg dislikes simultanous open/close - /// this breaks our code, until this is fixed use lock. - /// +/// +/// ffmpeg lock mutex +/// +/// new ffmpeg dislikes simultanous open/close +/// this breaks our code, until this is fixed use lock. +/// static pthread_mutex_t CodecLockMutex; - /// Flag prefer fast channel switch +/// Flag prefer fast channel switch char CodecUsePossibleDefectFrames; AVBufferRef *hw_device_ctx; @@ -155,7 +154,7 @@ static enum AVPixelFormat Codec_get_format(AVCodecContext * video_ctx, const enu } -//static void Codec_free_buffer(void *opaque, uint8_t *data); +// static void Codec_free_buffer(void *opaque, uint8_t *data); /** ** Video buffer management, get buffer for frame. @@ -174,8 +173,8 @@ static int Codec_get_buffer2(AVCodecContext * video_ctx, AVFrame * frame, int fl if (!decoder->GetFormatDone) { // get_format missing enum AVPixelFormat fmts[2]; -// fprintf(stderr, "codec: buggy libav, use ffmpeg\n"); -// Warning(_("codec: buggy libav, use ffmpeg\n")); + // fprintf(stderr, "codec: buggy libav, use ffmpeg\n"); + // Warning(_("codec: buggy libav, use ffmpeg\n")); fmts[0] = video_ctx->pix_fmt; fmts[1] = AV_PIX_FMT_NONE; Codec_get_format(video_ctx, fmts); @@ -183,11 +182,11 @@ static int Codec_get_buffer2(AVCodecContext * video_ctx, AVFrame * frame, int fl #if 0 if (decoder->hwaccel_get_buffer && (AV_PIX_FMT_VDPAU == decoder->hwaccel_pix_fmt || AV_PIX_FMT_CUDA == decoder->hwaccel_pix_fmt || AV_PIX_FMT_VAAPI == decoder->hwaccel_pix_fmt)) { - //Debug(3,"hwaccel get_buffer\n"); + // Debug(3,"hwaccel get_buffer\n"); return decoder->hwaccel_get_buffer(video_ctx, frame, flags); } #endif - //Debug(3, "codec: fallback to default get_buffer\n"); + // Debug(3, "codec: fallback to default get_buffer\n"); return avcodec_default_get_buffer2(video_ctx, frame, flags); } @@ -322,7 +321,7 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id) #endif #ifdef CUVID - if (strcmp(decoder->VideoCodec->long_name, "Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken + if (strcmp(decoder->VideoCodec->long_name, "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 pthread_mutex_unlock(&CodecLockMutex); Fatal(_("codec: can't set option deint to video codec!\n")); @@ -368,12 +367,12 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id) //decoder->VideoCtx->debug = FF_DEBUG_STARTCODE; //decoder->VideoCtx->err_recognition |= AV_EF_EXPLODE; -// av_log_set_level(AV_LOG_DEBUG); + // av_log_set_level(AV_LOG_DEBUG); av_log_set_level(0); decoder->VideoCtx->get_format = Codec_get_format; decoder->VideoCtx->get_buffer2 = Codec_get_buffer2; -// decoder->VideoCtx->active_thread_type = 0; + // decoder->VideoCtx->active_thread_type = 0; decoder->VideoCtx->draw_horiz_band = NULL; decoder->VideoCtx->hwaccel_context = VideoGetHwAccelContext(decoder->HwDecoder); @@ -403,7 +402,7 @@ void CodecVideoClose(VideoDecoder * video_decoder) AVFrame *frame; // FIXME: play buffered data -// av_frame_free(&video_decoder->Frame); // callee does checks + // av_frame_free(&video_decoder->Frame); // callee does checks Debug(3, "CodecVideoClose\n"); if (video_decoder->VideoCtx) { @@ -533,10 +532,10 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt) pkt = avpkt; // use copy got_frame = 0; -// printf("decode packet %d\n",(GetusTicks()-first_time)/1000000); + // printf("decode packet %d\n",(GetusTicks()-first_time)/1000000); ret1 = avcodec_send_packet(video_ctx, pkt); -// first_time = GetusTicks(); + // first_time = GetusTicks(); if (ret1 >= 0) { consumed = 1; @@ -545,7 +544,7 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt) if (!CuvidTestSurfaces()) usleep(1000); -//printf("send packet to decode %s\n",consumed?"ok":"Full"); + // printf("send packet to decode %s\n",consumed?"ok":"Full"); if ((ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) && CuvidTestSurfaces()) { ret = 0; @@ -557,7 +556,7 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt) } else { got_frame = 0; } -// printf("got %s packet from decoder\n",got_frame?"1":"no"); + // printf("got %s packet from decoder\n",got_frame?"1":"no"); if (got_frame) { // frame completed #ifdef YADIF if (decoder->filter) { @@ -572,24 +571,24 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt) } if (frame->interlaced_frame && decoder->filter == 2 && (frame->height != 720)) { // broken ZDF sends Interlaced flag ret = push_filters(video_ctx, decoder->HwDecoder, frame); -// av_frame_unref(frame); + // av_frame_unref(frame); continue; } } #endif - //DisplayPts(video_ctx, frame); + // DisplayPts(video_ctx, frame); VideoRenderFrame(decoder->HwDecoder, video_ctx, frame); -// av_frame_unref(frame); + // av_frame_unref(frame); } else { av_frame_free(&frame); -// printf("codec: got no frame %d send %d\n",ret,ret1); + // printf("codec: got no frame %d send %d\n",ret,ret1); } } if (!CuvidTestSurfaces()) { usleep(1000); } } else { -// consumed = 1; + // consumed = 1; } if (!consumed) { @@ -694,9 +693,9 @@ static char CodecAudioDrift; ///< flag: enable audio-drift correction static const int CodecAudioDrift = 0; #endif #ifdef USE_PASSTHROUGH - /// - /// Pass-through flags: CodecPCM, CodecAC3, CodecEAC3, ... - /// +/// +/// Pass-through flags: CodecPCM, CodecAC3, CodecEAC3, ... +/// static char CodecPassthrough; #else static const int CodecPassthrough = 0; @@ -745,7 +744,7 @@ void CodecAudioOpen(AudioDecoder * audio_decoder, int 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))) { Fatal(_("codec: codec ID %#06x not found\n"), codec_id); // FIXME: errors aren't fatal } @@ -765,9 +764,9 @@ void CodecAudioOpen(AudioDecoder * audio_decoder, int codec_id) av_dict = NULL; // FIXME: import settings - //av_dict_set(&av_dict, "dmix_mode", "0", 0); - //av_dict_set(&av_dict, "ltrt_cmixlev", "1.414", 0); - //av_dict_set(&av_dict, "loro_cmixlev", "1.414", 0); + // av_dict_set(&av_dict, "dmix_mode", "0", 0); + // av_dict_set(&av_dict, "ltrt_cmixlev", "1.414", 0); + // av_dict_set(&av_dict, "loro_cmixlev", "1.414", 0); if (avcodec_open2(audio_decoder->AudioCtx, audio_codec, &av_dict) < 0) { pthread_mutex_unlock(&CodecLockMutex); Fatal(_("codec: can't open audio codec\n")); @@ -1364,12 +1363,12 @@ int myavcodec_decode_audio3(AVCodecContext * avctx, int16_t * samples, int *fram #if 0 ret = avcodec_decode_audio4(avctx, frame, &got_frame, avpkt); #else -// SUGGESTION -// Now that avcodec_decode_audio4 is deprecated and replaced -// by 2 calls (receive frame and send packet), this could be optimized -// into separate routines or separate threads. -// Also now that it always consumes a whole buffer some code -// in the caller may be able to be optimized. + // SUGGESTION + // Now that avcodec_decode_audio4 is deprecated and replaced + // by 2 calls (receive frame and send packet), this could be optimized + // into separate routines or separate threads. + // Also now that it always consumes a whole buffer some code + // in the caller may be able to be optimized. ret = avcodec_receive_frame(avctx, frame); if (ret == 0) got_frame = 1; @@ -1380,7 +1379,7 @@ int myavcodec_decode_audio3(AVCodecContext * avctx, int16_t * samples, int *fram if (ret == AVERROR(EAGAIN)) ret = 0; else if (ret < 0) { -// Debug(3, "codec/audio: audio decode error: %1 (%2)\n",av_make_error_string(error, sizeof(error), ret),got_frame); + // Debug(3, "codec/audio: audio decode error: %1 (%2)\n",av_make_error_string(error, sizeof(error), ret),got_frame); return ret; } else ret = avpkt->size; @@ -1401,7 +1400,7 @@ int myavcodec_decode_audio3(AVCodecContext * avctx, int16_t * samples, int *fram samples = (char *)samples + data_size; } } - //Debug(3,"data_size %d nb_samples %d sample_fmt %d channels %d planar %d\n",data_size,frame->nb_samples,avctx->sample_fmt,avctx->channels,planar); + // Debug(3,"data_size %d nb_samples %d sample_fmt %d channels %d planar %d\n",data_size,frame->nb_samples,avctx->sample_fmt,avctx->channels,planar); *frame_size_ptr = data_size * avctx->channels * frame->nb_samples; } else { *frame_size_ptr = 0; diff --git a/codec.h b/codec.h index 26f5cbc..2a28c8f 100644 --- a/codec.h +++ b/codec.h @@ -60,10 +60,10 @@ struct _video_decoder_ int GetFormatDone; ///< flag get format called! AVCodec *VideoCodec; ///< video codec AVCodecContext *VideoCtx; ///< video codec context - //#ifdef FFMPEG_WORKAROUND_ARTIFACTS + // #ifdef FFMPEG_WORKAROUND_ARTIFACTS int FirstKeyFrame; ///< flag first frame - //#endif -// AVFrame *Frame; ///< decoded video frame + // #endif + // AVFrame *Frame; ///< decoded video frame int filter; // flag for deint filter @@ -94,82 +94,82 @@ struct _video_decoder_ // Typedefs //---------------------------------------------------------------------------- - /// Video decoder typedef. +/// Video decoder typedef. typedef struct _video_decoder_ VideoDecoder; - /// Audio decoder typedef. +/// Audio decoder typedef. typedef struct _audio_decoder_ AudioDecoder; //---------------------------------------------------------------------------- // Variables //---------------------------------------------------------------------------- - /// x11 display name +/// x11 display name extern const char *X11DisplayName; - /// HW device context from video module +/// HW device context from video module extern AVBufferRef *HwDeviceContext; //---------------------------------------------------------------------------- // Variables //---------------------------------------------------------------------------- - /// Flag prefer fast xhannel switch +/// Flag prefer fast xhannel switch extern char CodecUsePossibleDefectFrames; //---------------------------------------------------------------------------- // Prototypes //---------------------------------------------------------------------------- - /// Allocate a new video decoder context. +/// Allocate a new video decoder context. extern VideoDecoder *CodecVideoNewDecoder(VideoHwDecoder *); - /// Deallocate a video decoder context. +/// Deallocate a video decoder context. extern void CodecVideoDelDecoder(VideoDecoder *); - /// Open video codec. +/// Open video codec. extern void CodecVideoOpen(VideoDecoder *, int); - /// Close video codec. +/// Close video codec. extern void CodecVideoClose(VideoDecoder *); - /// Decode a video packet. +/// Decode a video packet. extern void CodecVideoDecode(VideoDecoder *, const AVPacket *); - /// Flush video buffers. +/// Flush video buffers. extern void CodecVideoFlushBuffers(VideoDecoder *); - /// Allocate a new audio decoder context. +/// Allocate a new audio decoder context. extern AudioDecoder *CodecAudioNewDecoder(void); - /// Deallocate an audio decoder context. +/// Deallocate an audio decoder context. extern void CodecAudioDelDecoder(AudioDecoder *); - /// Open audio codec. +/// Open audio codec. extern void CodecAudioOpen(AudioDecoder *, int); - /// Close audio codec. +/// Close audio codec. extern void CodecAudioClose(AudioDecoder *); - /// Set audio drift correction. +/// Set audio drift correction. extern void CodecSetAudioDrift(int); - /// Set audio pass-through. +/// Set audio pass-through. extern void CodecSetAudioPassthrough(int); - /// Set audio downmix. +/// Set audio downmix. extern void CodecSetAudioDownmix(int); - /// Decode an audio packet. +/// Decode an audio packet. extern void CodecAudioDecode(AudioDecoder *, const AVPacket *); - /// Flush audio buffers. +/// Flush audio buffers. extern void CodecAudioFlushBuffers(AudioDecoder *); - /// Setup and initialize codec module. +/// Setup and initialize codec module. extern void CodecInit(void); - /// Cleanup and exit codec module. +/// Cleanup and exit codec module. extern void CodecExit(void); /// @} diff --git a/common.h b/common.h index 381bdc5..ceb935e 100644 --- a/common.h +++ b/common.h @@ -86,7 +86,7 @@ void mpgl_load_functions2(GL * gl, void *(*get_fn)(void *ctx, const char *n), vo typedef void (GLAPIENTRY * MP_GLDEBUGPROC) (GLenum, GLenum, GLuint, GLenum, GLsizei, const GLchar *, const void *); -//function pointers loaded from the OpenGL library +// function pointers loaded from the OpenGL library struct GL { int version; // MPGL_VER() mangled (e.g. 210 for 2.1) diff --git a/openglosd.cpp b/openglosd.cpp index c69af55..d5a6cc5 100644 --- a/openglosd.cpp +++ b/openglosd.cpp @@ -23,7 +23,7 @@ extern "C" void OSD_release_context(); ****************************************************************************************/ #ifdef CUVID -const char *rectVertexShader = +const char *rectVertexShader = "#version 330 core \n\ \ layout (location = 0) in vec2 position; \ @@ -38,7 +38,7 @@ void main() \ } \ "; -const char *rectFragmentShader = +const char *rectFragmentShader = "#version 330 core \n\ \ in vec4 rectCol; \ @@ -50,7 +50,7 @@ void main() \ } \ "; -const char *textureVertexShader = +const char *textureVertexShader = "#version 330 core \n\ \ layout (location = 0) in vec2 position; \ @@ -70,7 +70,7 @@ void main() \ } \ "; -const char *textureFragmentShader = +const char *textureFragmentShader = "#version 330 core \n\ in vec2 TexCoords; \ in vec4 alphaValue; \ @@ -84,7 +84,7 @@ void main() \ } \ "; -const char *textVertexShader = +const char *textVertexShader = "#version 330 core \n\ \ layout (location = 0) in vec2 position; \ @@ -104,7 +104,7 @@ void main() \ } \ "; -const char *textFragmentShader = +const char *textFragmentShader = "#version 330 core \n\ in vec2 TexCoords; \ in vec4 textColor; \ @@ -122,7 +122,7 @@ void main() \ #else -const char *rectVertexShader = +const char *rectVertexShader = "\n \ \ layout (location = 0) in vec2 position; \ @@ -137,7 +137,7 @@ void main() \ } \ "; -const char *rectFragmentShader = +const char *rectFragmentShader = "\n \ \ precision mediump float; \ @@ -150,7 +150,7 @@ void main() \ } \ "; -const char *textureVertexShader = +const char *textureVertexShader = "\n \ \ layout (location = 0) in vec2 position; \ @@ -170,7 +170,7 @@ void main() \ } \ "; -const char *textureFragmentShader = +const char *textureFragmentShader = "\n \ precision mediump float; \ in vec2 TexCoords; \ @@ -185,7 +185,7 @@ void main() \ } \ "; -const char *textVertexShader = +const char *textVertexShader = "\n \ \ layout (location = 0) in vec2 position; \ @@ -205,7 +205,7 @@ void main() \ } \ "; -const char *textFragmentShader = +const char *textFragmentShader = "\n \ precision mediump float; \ in vec2 TexCoords; \ @@ -222,7 +222,7 @@ void main() \ } \ "; #endif -static cShader *Shaders[stCount]; +static cShader *Shaders[stCount]; void cShader::Use(void) { glUseProgram(id); @@ -294,14 +294,14 @@ bool cShader::Compile(const char *vertexCode, const char *fragmentCode) { sVertex = glCreateShader(GL_VERTEX_SHADER); glShaderSource(sVertex, 1, &vertexCode, NULL); glCompileShader(sVertex); -// esyslog("[softhddev]:SHADER:VERTEX %s\n",vertexCode); + // esyslog("[softhddev]:SHADER:VERTEX %s\n",vertexCode); if (!CheckCompileErrors(sVertex)) return false; // Fragment Shader sFragment = glCreateShader(GL_FRAGMENT_SHADER); glShaderSource(sFragment, 1, &fragmentCode, NULL); glCompileShader(sFragment); -// esyslog("[softhddev]:SHADER:FRAGMENT %s\n",fragmentCode); + // esyslog("[softhddev]:SHADER:FRAGMENT %s\n",fragmentCode); if (!CheckCompileErrors(sFragment)) return false; // link Program @@ -375,8 +375,8 @@ void cOglGlyph::BindTexture(void) { void cOglGlyph::LoadTexture(FT_BitmapGlyph ftGlyph) { // Disable byte-alignment restriction #ifdef VAAPI - OSD_release_context(); - OSD_get_shared_context(); + OSD_release_context(); + OSD_get_shared_context(); #endif glPixelStorei(GL_UNPACK_ALIGNMENT, 1); glGenTextures(1, &texture); @@ -400,10 +400,10 @@ void cOglGlyph::LoadTexture(FT_BitmapGlyph ftGlyph) { glBindTexture(GL_TEXTURE_2D, 0); glPixelStorei(GL_UNPACK_ALIGNMENT, 4); #ifdef VAAPI - OSD_release_context(); - OSD_get_context(); + OSD_release_context(); + OSD_get_context(); #endif - + } @@ -445,7 +445,7 @@ cOglFont *cOglFont::Get(const char *name, int charHeight) { fonts->Add(font); return font; } - + void cOglFont::Init(void) { fonts = new cList; if (FT_Init_FreeType(&ftLib)) @@ -489,7 +489,7 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const { error = FT_Stroker_New( ftLib, &stroker ); if (error) { esyslog("[softhddev]FT_Stroker_New FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message); - return NULL; + return NULL; } float outlineWidth = 0.25f; FT_Stroker_Set(stroker, @@ -498,11 +498,11 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const { FT_STROKER_LINEJOIN_ROUND, 0); - + error = FT_Get_Glyph(face->glyph, &ftGlyph); if (error) { esyslog("[softhddev]FT_Get_Glyph FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message); - return NULL; + return NULL; } error = FT_Glyph_StrokeBorder( &ftGlyph, stroker, 0, 1 ); @@ -515,9 +515,9 @@ cOglGlyph* cOglFont::Glyph(uint charCode) const { error = FT_Glyph_To_Bitmap( &ftGlyph, FT_RENDER_MODE_NORMAL, 0, 1); if (error) { esyslog("[softhddev]FT_Glyph_To_Bitmap FT_Error (0x%02x) : %s\n", FT_Errors[error].code, FT_Errors[error].message); - return NULL; + return NULL; } - + cOglGlyph *Glyph = new cOglGlyph(charCode, (FT_BitmapGlyph)ftGlyph); glyphCache.Add(Glyph); FT_Done_Glyph(ftGlyph); @@ -559,18 +559,18 @@ cOglFb::cOglFb(GLint width, GLint height, GLint viewPortWidth, GLint viewPortHei } cOglFb::~cOglFb(void) { - if (texture) - glDeleteTextures(1, &texture); - if (fb) - glDeleteFramebuffers(1, &fb); + if (texture) + glDeleteTextures(1, &texture); + if (fb) + glDeleteFramebuffers(1, &fb); } bool cOglFb::Init(void) { initiated = true; #ifdef VAAPI - OSD_release_context(); - OSD_get_shared_context(); + OSD_release_context(); + OSD_get_shared_context(); #endif glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); @@ -582,20 +582,20 @@ bool cOglFb::Init(void) { glGenFramebuffers(1, &fb); glBindFramebuffer(GL_FRAMEBUFFER, fb); - + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); - + if(glCheckFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE) { esyslog("[softhddev]ERROR: %d Framebuffer is not complete!\n",__LINE__); #ifdef VAAPI - OSD_release_context(); - OSD_get_context(); + OSD_release_context(); + OSD_get_context(); #endif return false; } #ifdef VAAPI - OSD_release_context(); - OSD_get_context(); + OSD_release_context(); + OSD_get_context(); #endif return true; } @@ -616,7 +616,7 @@ void cOglFb::BindWrite(void) { } void cOglFb::Unbind(void) { - glBindFramebuffer(GL_FRAMEBUFFER, 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); glBindTexture(GL_TEXTURE_2D, 0); } @@ -636,29 +636,29 @@ void cOglFb::Blit(GLint destX1, GLint destY1, GLint destX2, GLint destY2) { * cOglOutputFb ****************************************************************************************/ cOglOutputFb::cOglOutputFb(GLint width, GLint height) : cOglFb(width, height, width, height) { -// surface = 0; - initiated = false; + // surface = 0; + initiated = false; fb = 0; texture = 0; } cOglOutputFb::~cOglOutputFb(void) { -// glVDPAUUnregisterSurfaceNV(surface); - glDeleteTextures(1, &texture); + // glVDPAUUnregisterSurfaceNV(surface); + glDeleteTextures(1, &texture); glDeleteFramebuffers(1, &fb); } bool cOglOutputFb::Init(void) { - initiated = true; + initiated = true; glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER); - + glGenFramebuffers(1, &fb); glBindFramebuffer(GL_FRAMEBUFFER, fb); glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0); @@ -670,7 +670,7 @@ bool cOglOutputFb::Init(void) { } void cOglOutputFb::BindWrite(void) { - if (!initiated) + if (!initiated) Init(); glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb); } @@ -682,7 +682,7 @@ void cOglOutputFb::Unbind(void) { /**************************************************************************************** * cOglVb ****************************************************************************************/ -static cOglVb *VertexBuffers[vbCount]; +static cOglVb *VertexBuffers[vbCount]; cOglVb::cOglVb(int type) { this->type = (eVertexBufferType)type; @@ -700,35 +700,35 @@ cOglVb::~cOglVb(void) { bool cOglVb::Init(void) { if (type == vbTexture) { - //Texture VBO definition + // Texture VBO definition sizeVertex1 = 2; sizeVertex2 = 2; numVertices = 6; drawMode = GL_TRIANGLES; shader = stTexture; } else if (type == vbRect) { - //Rectangle VBO definition + // Rectangle VBO definition sizeVertex1 = 2; sizeVertex2 = 0; numVertices = 4; drawMode = GL_TRIANGLE_FAN; shader = stRect; } else if (type == vbEllipse) { - //Ellipse VBO definition + // Ellipse VBO definition sizeVertex1 = 2; sizeVertex2 = 0; numVertices = 182; drawMode = GL_TRIANGLE_FAN; shader = stRect; } else if (type == vbSlope) { - //Slope VBO definition + // Slope VBO definition sizeVertex1 = 2; sizeVertex2 = 0; numVertices = 102; drawMode = GL_TRIANGLE_FAN; shader = stRect; } else if (type == vbText) { - //Text VBO definition + // Text VBO definition sizeVertex1 = 2; sizeVertex2 = 2; numVertices = 6; @@ -746,9 +746,9 @@ bool cOglVb::Init(void) { glVertexAttribPointer(0, sizeVertex1, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)0); if (sizeVertex2 > 0) { glEnableVertexAttribArray(1); - glVertexAttribPointer(1, sizeVertex2, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)(sizeVertex1 * sizeof(GLfloat))); + glVertexAttribPointer(1, sizeVertex2, GL_FLOAT, GL_FALSE, (sizeVertex1 + sizeVertex2) * sizeof(GLfloat), (GLvoid*)(sizeVertex1 * sizeof(GLfloat))); } - + glBindBuffer(GL_ARRAY_BUFFER, 0); glBindVertexArray(0); @@ -803,7 +803,7 @@ void cOglVb::DrawArrays(int count) { if (count == 0) count = numVertices; glDrawArrays(drawMode, 0, count); - glFlush(); + glFlush(); } @@ -839,8 +839,8 @@ cOglCmdDeleteFb::cOglCmdDeleteFb(cOglFb *fb) : cOglCmd(fb) { } bool cOglCmdDeleteFb::Execute(void) { - if (fb) - delete fb; + if (fb) + delete fb; return true; } @@ -889,7 +889,7 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) { buffer->Bind(); if (!fb->BindTexture()) return false; - VertexBuffers[vbTexture]->Bind(); + VertexBuffers[vbTexture]->Bind(); VertexBuffers[vbTexture]->SetVertexData(quadVertices); VertexBuffers[vbTexture]->DrawArrays(); VertexBuffers[vbTexture]->Unbind(); @@ -906,33 +906,33 @@ cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputF } #ifdef PLACEBO -//extern "C" { -extern unsigned char *posd; +//extern "C" { +extern unsigned char *posd; //} #endif bool cOglCmdCopyBufferToOutputFb::Execute(void) { - int i; + int i; pthread_mutex_lock(&OSDMutex); fb->BindRead(); oFb->BindWrite(); - glClear(GL_COLOR_BUFFER_BIT); + glClear(GL_COLOR_BUFFER_BIT); #ifdef PLACEBO - glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - glPixelStorei(GL_PACK_ALIGNMENT, 1); - if (posd) - glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_BGRA,GL_UNSIGNED_BYTE,posd); + glPixelStorei(GL_UNPACK_ALIGNMENT, 1); + glPixelStorei(GL_PACK_ALIGNMENT, 1); + if (posd) + glReadPixels(0, 0 ,fb->Width(), fb->Height(),GL_BGRA,GL_UNSIGNED_BYTE,posd); #else - fb->Blit(x, y + fb->Height(), x + fb->Width(), y); - glFlush(); + fb->Blit(x, y + fb->Height(), x + fb->Width(), y); + glFlush(); #endif - ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height()); + ActivateOsd(oFb->texture,x, y, fb->Width() ,fb->Height()); - oFb->Unbind(); - pthread_mutex_unlock(&OSDMutex); + oFb->Unbind(); + pthread_mutex_unlock(&OSDMutex); return true; } @@ -946,7 +946,7 @@ bool cOglCmdFill::Execute(void) { glm::vec4 col; ConvertColor(color, col); fb->Bind(); - glClearColor(col.r, col.g, col.b, col.a); + glClearColor(col.r, col.g, col.b, col.a); glClear(GL_COLOR_BUFFER_BIT); fb->Unbind(); return true; @@ -977,7 +977,7 @@ bool cOglCmdDrawRectangle::Execute(void) { VertexBuffers[vbRect]->ActivateShader(); VertexBuffers[vbRect]->SetShaderColor(color); VertexBuffers[vbRect]->SetShaderProjectionMatrix(fb->Width(), fb->Height()); - + fb->Bind(); VertexBuffers[vbRect]->DisableBlending(); VertexBuffers[vbRect]->Bind(); @@ -1027,7 +1027,7 @@ bool cOglCmdDrawEllipse::Execute(void) { VertexBuffers[vbEllipse]->SetShaderColor(color); VertexBuffers[vbEllipse]->SetShaderProjectionMatrix(fb->Width(), fb->Height()); - //not antialiased + // not antialiased fb->Bind(); VertexBuffers[vbEllipse]->DisableBlending(); VertexBuffers[vbEllipse]->Bind(); @@ -1111,7 +1111,7 @@ GLfloat *cOglCmdDrawEllipse::CreateVerticesQuadrant(int &numVertices) { vertices[0] = x + width; vertices[1] = y + height; startAngle = 270; - break; + break; default: break; } @@ -1129,7 +1129,7 @@ GLfloat *cOglCmdDrawEllipse::CreateVerticesHalf(int &numVertices) { GLfloat radiusY = 0.0f; GLint transX = 0; GLint transY = 0; - GLint startAngle = 0; + GLint startAngle = 0; GLfloat *vertices = new GLfloat[size]; switch (quadrants) { case 5: @@ -1245,7 +1245,7 @@ bool cOglCmdDrawSlope::Execute(void) { VertexBuffers[vbSlope]->SetShaderColor(color); VertexBuffers[vbSlope]->SetShaderProjectionMatrix(fb->Width(), fb->Height()); - //not antialiased + // not antialiased fb->Bind(); VertexBuffers[vbSlope]->DisableBlending(); VertexBuffers[vbSlope]->Bind(); @@ -1260,7 +1260,7 @@ bool cOglCmdDrawSlope::Execute(void) { } //------------------ cOglCmdDrawText -------------------- -cOglCmdDrawText::cOglCmdDrawText( cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, +cOglCmdDrawText::cOglCmdDrawText( cOglFb *fb, GLint x, GLint y, unsigned int *symbols, GLint limitX, const char *name, int fontSize, tColor colorText) : cOglCmd(fb), fontName(name) { this->x = x; this->y = y; @@ -1318,9 +1318,9 @@ bool cOglCmdDrawText::Execute(void) { x1, y2, 0.0, 1.0, // left bottom x2, y1, 1.0, 0.0, // right top - x2, y2, 1.0, 1.0 // right bottom + x2, y2, 1.0, 1.0 // right bottom }; - + g->BindTexture(); VertexBuffers[vbText]->SetVertexData(vertices); VertexBuffers[vbText]->DrawArrays(); @@ -1356,8 +1356,8 @@ cOglCmdDrawImage::~cOglCmdDrawImage(void) { bool cOglCmdDrawImage::Execute(void) { GLuint texture; #ifdef VAAPI - OSD_release_context(); - OSD_get_shared_context(); + OSD_release_context(); + OSD_get_shared_context(); #endif glGenTextures(1, &texture); glBindTexture(GL_TEXTURE_2D, texture); @@ -1378,10 +1378,10 @@ bool cOglCmdDrawImage::Execute(void) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); #ifdef VAAPI - OSD_release_context(); - OSD_get_context(); + OSD_release_context(); + OSD_get_context(); #endif - + GLfloat x1 = x; //left GLfloat y1 = y; //top GLfloat x2 = x + width; //right @@ -1394,7 +1394,7 @@ bool cOglCmdDrawImage::Execute(void) { x1, y2, 0.0, 1.0, // left bottom x2, y1, 1.0, 0.0, // right top - x2, y2, 1.0, 1.0 // right bottom + x2, y2, 1.0, 1.0 // right bottom }; VertexBuffers[vbTexture]->ActivateShader(); @@ -1462,7 +1462,7 @@ bool cOglCmdDrawTexture::Execute(void) { //------------------ cOglCmdStoreImage -------------------- cOglCmdStoreImage::cOglCmdStoreImage(sOglImage *imageRef, tColor *argb) : cOglCmd(NULL) { this->imageRef = imageRef; - data = argb; + data = argb; } cOglCmdStoreImage::~cOglCmdStoreImage(void) { @@ -1471,8 +1471,8 @@ cOglCmdStoreImage::~cOglCmdStoreImage(void) { bool cOglCmdStoreImage::Execute(void) { #ifdef VAAPI - OSD_release_context(); - OSD_get_shared_context(); + OSD_release_context(); + OSD_get_shared_context(); #endif glGenTextures(1, &imageRef->texture); glBindTexture(GL_TEXTURE_2D, imageRef->texture); @@ -1493,8 +1493,8 @@ bool cOglCmdStoreImage::Execute(void) { glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); glBindTexture(GL_TEXTURE_2D, 0); #ifdef VAAPI - OSD_release_context(); - OSD_get_context(); + OSD_release_context(); + OSD_get_context(); #endif return true; } @@ -1524,7 +1524,7 @@ cOglThread::cOglThread(cCondWait *startWait, int maxCacheSize) : cThread("oglThr maxTextureSize = 0; for (int i = 0; i < OGL_MAX_OSDIMAGES; i++) { imageCache[i].used = false; - imageCache[i].texture = GL_NONE; + imageCache[i].texture = GL_NONE; imageCache[i].width = 0; imageCache[i].height = 0; } @@ -1550,7 +1550,7 @@ void cOglThread::Stop(void) { void cOglThread::DoCmd(cOglCmd* cmd) { while (stalled) cCondWait::SleepMs(10); - + bool doSignal = false; Lock(); if (commands.size() == 0) @@ -1584,7 +1584,7 @@ int cOglThread::StoreImage(const cImage &image) { esyslog("[softhddev]Maximum size for GPU cache reached. Used: %.2fMB Max: %.2fMB", cachedMB, maxMB); return 0; } - + int slot = GetFreeSlot(); if (!slot) return 0; @@ -1635,7 +1635,7 @@ void cOglThread::ClearSlot(int slot) { int i = -slot - 1; if (i >= 0 && i < OGL_MAX_OSDIMAGES) { Lock(); - imageCache[i].used = false; + imageCache[i].used = false; imageCache[i].texture = GL_NONE; imageCache[i].width = 0; imageCache[i].height = 0; @@ -1671,7 +1671,7 @@ void cOglThread::Action(void) { return; } dsyslog("[softhddev]OpenGL Context initialized"); - + if (!InitShaders()) { esyslog("[softhddev]Could not initiate Shaders"); Cleanup(); @@ -1679,7 +1679,7 @@ void cOglThread::Action(void) { return; } dsyslog("[softhddev]Shaders initialized"); - + if (!InitVdpauInterop()) { esyslog("[softhddev]: vdpau interop NOT initialized"); Cleanup(); @@ -1702,7 +1702,7 @@ void cOglThread::Action(void) { //now Thread is ready to do his job startWait->Signal(); stalled = false; - + while(Running()) { if (commands.empty()) { @@ -1714,14 +1714,14 @@ void cOglThread::Action(void) { cOglCmd* cmd = commands.front(); commands.pop(); Unlock(); - //uint64_t start = cTimeMs::Now(); + // uint64_t start = cTimeMs::Now(); cmd->Execute(); - //esyslog("[softhddev]\"%s\", %dms, %d commands left, time %" PRIu64 "", cmd->Description(), (int)(cTimeMs::Now() - start), commands.size(), cTimeMs::Now()); + // esyslog("[softhddev]\"%s\", %dms, %d commands left, time %" PRIu64 "", cmd->Description(), (int)(cTimeMs::Now() - start), commands.size(), cTimeMs::Now()); delete cmd; if (stalled && commands.size() < OGL_CMDQUEUE_SIZE / 2) stalled = false; } - + dsyslog("[softhddev]Cleaning up OpenGL stuff"); Cleanup(); dsyslog("[softhddev]OpenGL Worker Thread Ended"); @@ -1733,7 +1733,7 @@ extern "C" int GlxInitopengl(); bool cOglThread::InitOpenGL(void) { - + #ifdef PLACEBO const char *displayName = X11DisplayName; @@ -1762,7 +1762,7 @@ bool cOglThread::InitOpenGL(void) { free(buffer[0]); free(buffer[1]); free(buffer[2]); - + GLenum err = glewInit(); if( err != GLEW_OK) { esyslog("[softhddev]glewInit failed, aborting\n"); @@ -1770,8 +1770,8 @@ bool cOglThread::InitOpenGL(void) { } #else - if (!GlxInitopengl()) - return false; + if (!GlxInitopengl()) + return false; #endif VertexBuffers[vbText]->EnableBlending(); glDisable(GL_DEPTH_TEST); @@ -1800,7 +1800,7 @@ bool cOglThread::InitVdpauInterop(void) { void *procAdress = GetVDPAUProcAdress(); while (glGetError() != GL_NO_ERROR); glVDPAUInitNV(vdpDevice, procAdress); - if (glGetError() != GL_NO_ERROR) + if (glGetError() != GL_NO_ERROR) return false; #endif return true; @@ -1823,21 +1823,21 @@ void cOglThread::DeleteVertexBuffers(void) { } void cOglThread::Cleanup(void) { - esyslog("[softhddev]OglThread cleanup\n"); - pthread_mutex_lock(&OSDMutex); - OsdClose(); + esyslog("[softhddev]OglThread cleanup\n"); + pthread_mutex_lock(&OSDMutex); + OsdClose(); DeleteVertexBuffers(); delete cOglOsd::oFb; cOglOsd::oFb = NULL; DeleteShaders(); -// glVDPAUFiniNV(); + // glVDPAUFiniNV(); cOglFont::Cleanup(); #ifdef PLACEBO glutExit(); #endif - pthread_mutex_unlock(&OSDMutex); + pthread_mutex_unlock(&OSDMutex); } /**************************************************************************************** @@ -1849,7 +1849,7 @@ cOglPixmap::cOglPixmap(std::shared_ptr oglThread, int Layer, const c int width = DrawPort.IsEmpty() ? ViewPort.Width() : DrawPort.Width(); int height = DrawPort.IsEmpty() ? ViewPort.Height() : DrawPort.Height(); fb = new cOglFb(width, height, ViewPort.Width(), ViewPort.Height()); - dirty = true; + dirty = true; } cOglPixmap::~cOglPixmap(void) { @@ -1922,7 +1922,7 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) { oglThread->DoCmd(new cOglCmdDrawTexture(fb, img, Point.X(), Point.Y())); } /* - Fallback to VDR implementation, needs to separate cSoftOsdProvider from softhddevice.cpp + Fallback to VDR implementation, needs to separate cSoftOsdProvider from softhddevice.cpp else { if (cSoftOsdProvider::GetImageData(ImageHandle)) DrawImage(Point, *cSoftOsdProvider::GetImageData(ImageHandle)); @@ -1935,7 +1935,7 @@ void cOglPixmap::DrawImage(const cPoint &Point, int ImageHandle) { void cOglPixmap::DrawPixel(const cPoint &Point, tColor Color) { cRect r(Point.X(), Point.Y(), 1, 1); oglThread->DoCmd(new cOglCmdDrawRectangle(fb, r.X(), r.Y(), r.Width(), r.Height(), Color)); - + SetDirty(); MarkDrawPortDirty(r); } @@ -1984,7 +1984,7 @@ void cOglPixmap::DrawText(const cPoint &Point, const char *s, tColor ColorFg, tC int cw = Width ? Width : w; int ch = Height ? Height : h; cRect r(x, y, cw, ch); - + if (ColorBg != clrTransparent) oglThread->DoCmd(new cOglCmdDrawRectangle(fb, r.X(), r.Y(), r.Width(), r.Height(), ColorBg)); @@ -2077,40 +2077,40 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr oglT isSubtitleOsd = false; int osdWidth = 0; int osdHeight = 0; - + pthread_mutex_lock(&OSDMutex); VideoGetOsdSize(&osdWidth, &osdHeight); -// osdWidth = 1920; -// osdHeight = 1080; - + // osdWidth = 1920; + // osdHeight = 1080; + dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight); #ifdef PLACEBO - if (posd) - free(posd); - posd = MALLOC(unsigned char, osdWidth * osdHeight * 4); + if (posd) + free(posd); + posd = MALLOC(unsigned char, osdWidth * osdHeight * 4); #endif - //create output framebuffer -#ifdef VAAPI - OSD_release_context(); - OSD_get_shared_context(); + // create output framebuffer +#ifdef VAAPI + OSD_release_context(); + OSD_get_shared_context(); #endif if (!oFb) { oFb = new cOglOutputFb(osdWidth, osdHeight); oglThread->DoCmd(new cOglCmdInitOutputFb(oFb)); } #ifdef VAAPI - OSD_release_context(); + OSD_release_context(); #endif - pthread_mutex_unlock(&OSDMutex); + pthread_mutex_unlock(&OSDMutex); } cOglOsd::~cOglOsd() { OsdClose(); SetActive(false); #ifdef PLACEBO - if (posd) - free(posd); - posd = 0; + if (posd) + free(posd); + posd = 0; #endif oglThread->DoCmd(new cOglCmdDeleteFb(bFb)); } @@ -2124,9 +2124,9 @@ eOsdError cOglOsd::SetAreas(const tArea *Areas, int NumAreas) { tArea area = { r.Left(), r.Top(), r.Right(), r.Bottom(), 32 }; - //now we know the actuaL osd size, create double buffer frame buffer + // now we know the actuaL osd size, create double buffer frame buffer if (bFb) { - oglThread->DoCmd(new cOglCmdDeleteFb(bFb)); + oglThread->DoCmd(new cOglCmdDeleteFb(bFb)); DestroyPixmap(oglPixmaps[0]); } bFb = new cOglFb(r.Width(), r.Height(), r.Width(), r.Height()); @@ -2145,7 +2145,7 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr int height = DrawPort.IsEmpty() ? ViewPort.Height() : DrawPort.Height(); if (width > oglThread->MaxTextureSize() || height > oglThread->MaxTextureSize()) { - esyslog("[softhddev] cannot allocate pixmap of %dpx x %dpx, clipped to %dpx x %dpx!", + esyslog("[softhddev] cannot allocate pixmap of %dpx x %dpx, clipped to %dpx x %dpx!", width, height, std::min(width, oglThread->MaxTextureSize()), std::min(height, oglThread->MaxTextureSize())); width = std::min(width, oglThread->MaxTextureSize()); height = std::min(height, oglThread->MaxTextureSize()); @@ -2154,11 +2154,11 @@ cPixmap *cOglOsd::CreatePixmap(int Layer, const cRect &ViewPort, const cRect &Dr cOglPixmap *p = new cOglPixmap(oglThread, Layer, ViewPort, DrawPort); if (cOsd::AddPixmap(p)) { - //find free slot + // find free slot for (int i = 0; i < oglPixmaps.Size(); i++) if (!oglPixmaps[i]) return oglPixmaps[i] = p; - //append at end + // append at end oglPixmaps.Append(p); return p; } @@ -2190,28 +2190,28 @@ void cOglOsd::Flush(void) { if (!oglThread->Active()) return; LOCK_PIXMAPS; - //check if any pixmap is dirty + // check if any pixmap is dirty bool dirty = false; for (int i = 0; i < oglPixmaps.Size() && !dirty; i++) if (oglPixmaps[i] && oglPixmaps[i]->Layer() >= 0 && oglPixmaps[i]->IsDirty()) dirty = true; if (!dirty) return; - //clear buffer - //uint64_t start = cTimeMs::Now(); - //dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now()); + // clear buffer + // uint64_t start = cTimeMs::Now(); + // dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now()); oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent)); - //render pixmap textures blended to buffer + // render pixmap textures blended to buffer for (int layer = 0; layer < MAXPIXMAPLAYERS; layer++) { for (int i = 0; i < oglPixmaps.Size(); i++) { if (oglPixmaps[i]) { if (oglPixmaps[i]->Layer() == layer) { - oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(), - bFb, - oglPixmaps[i]->ViewPort().X(), + oglThread->DoCmd(new cOglCmdRenderFbToBufferFb( oglPixmaps[i]->Fb(), + bFb, + oglPixmaps[i]->ViewPort().X(), (!isSubtitleOsd) ? oglPixmaps[i]->ViewPort().Y() : 0, oglPixmaps[i]->Alpha(), oglPixmaps[i]->DrawPort().X(), @@ -2223,7 +2223,7 @@ void cOglOsd::Flush(void) { } oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top())); - //dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start)); + // dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start)); } void cOglOsd::DrawScaledBitmap(int x, int y, const cBitmap &Bitmap, double FactorX, double FactorY, bool AntiAlias) { diff --git a/openglosd.h b/openglosd.h index 0dc6d88..e857843 100644 --- a/openglosd.h +++ b/openglosd.h @@ -202,8 +202,8 @@ class cOglFb { protected: bool initiated; -// GLuint fb; -// GLuint texture; + // GLuint fb; + // GLuint texture; GLint width, height; GLint viewPortWidth, viewPortHeight; bool scrollable; @@ -268,7 +268,7 @@ class cOglOutputFb:public cOglFb /**************************************************************************************** * cOglVb -* Vertex Buffer - OpenGl Vertices for the different drawing commands +* Vertex Buffer - OpenGl Vertices for the different drawing commands ****************************************************************************************/ enum eVertexBufferType { diff --git a/ringbuffer.c b/ringbuffer.c index 998715c..bdf8ce2 100644 --- a/ringbuffer.c +++ b/ringbuffer.c @@ -33,7 +33,7 @@ #include "iatomic.h" #include "ringbuffer.h" - /// ring buffer structure +/// ring buffer structure struct _ring_buffer_ { char *Buffer; ///< ring buffer data diff --git a/ringbuffer.h b/ringbuffer.h index 045a348..eba4dcb 100644 --- a/ringbuffer.h +++ b/ringbuffer.h @@ -23,40 +23,40 @@ /// @addtogroup Ringbuffer /// @{ - /// ring buffer typedef +/// ring buffer typedef typedef struct _ring_buffer_ RingBuffer; - /// reset ring buffer pointers +/// reset ring buffer pointers extern void RingBufferReset(RingBuffer *); - /// create new ring buffer +/// create new ring buffer extern RingBuffer *RingBufferNew(size_t); - /// free ring buffer +/// free ring buffer extern void RingBufferDel(RingBuffer *); - /// write into ring buffer +/// write into ring buffer extern size_t RingBufferWrite(RingBuffer *, const void *, size_t); - /// get write pointer of ring buffer +/// get write pointer of ring buffer extern size_t RingBufferGetWritePointer(RingBuffer *, void **); - /// advance write pointer of ring buffer +/// advance write pointer of ring buffer extern size_t RingBufferWriteAdvance(RingBuffer *, size_t); - /// read from ring buffer +/// read from ring buffer extern size_t RingBufferRead(RingBuffer *, void *, size_t); - /// get read pointer of ring buffer +/// get read pointer of ring buffer extern size_t RingBufferGetReadPointer(RingBuffer *, const void **); - /// advance read pointer of ring buffer +/// advance read pointer of ring buffer extern size_t RingBufferReadAdvance(RingBuffer *, size_t); - /// free bytes ring buffer +/// free bytes ring buffer extern size_t RingBufferFreeBytes(RingBuffer *); - /// used bytes ring buffer +/// used bytes ring buffer extern size_t RingBufferUsedBytes(RingBuffer *); /// @} diff --git a/shaders.h b/shaders.h index 7dd3af8..25207bf 100644 --- a/shaders.h +++ b/shaders.h @@ -1,4 +1,3 @@ - // shader #ifdef CUVID char vertex_osd[] = { "\ diff --git a/shaders.txt b/shaders.txt index 3924b99..1d71db3 100644 --- a/shaders.txt +++ b/shaders.txt @@ -89,4 +89,3 @@ color.a = 1.0; // color mapping out_color = color; } - diff --git a/softhdcuvid.cpp b/softhdcuvid.cpp index 8018901..8c80df9 100644 --- a/softhdcuvid.cpp +++ b/softhdcuvid.cpp @@ -59,34 +59,34 @@ extern "C" #define MURKS -> #else #define MURKS . -#define LOCK_CHANNELS_READ do { } while (0) +#define LOCK_CHANNELS_READ do { } while (0) #endif ////////////////////////////////////////////////////////////////////////////// - /// vdr-plugin version number. - /// Makefile extracts the version number for generating the file name - /// for the distribution archive. +/// vdr-plugin version number. +/// Makefile extracts the version number for generating the file name +/// for the distribution archive. static const char *const VERSION = "2.1.0" #ifdef GIT_REV "-GIT" GIT_REV #endif ; - /// vdr-plugin description. +/// vdr-plugin description. static const char *const DESCRIPTION = trNOOP("A software and GPU emulated UHD device"); - /// vdr-plugin text of main menu entry +/// vdr-plugin text of main menu entry static const char *MAINMENUENTRY = trNOOP("SoftUHD"); - /// single instance of softhddevice plugin device. +/// single instance of softhddevice plugin device. static class cSoftHdDevice *MyDevice; ////////////////////////////////////////////////////////////////////////////// #define RESOLUTIONS 5 ///< number of resolutions - /// resolutions names +/// resolutions names static const char *const Resolution[RESOLUTIONS] = { "576i", "720p", "1080i_fake", "1080i", "UHD" }; @@ -118,28 +118,28 @@ static int ConfigScalerTest; /// Test for Scalers static int ConfigColorBlindness; static int ConfigColorBlindnessFaktor; - /// config deinterlace +/// config deinterlace static int ConfigVideoDeinterlace[RESOLUTIONS]; - /// config skip chroma +/// config skip chroma static int ConfigVideoSkipChromaDeinterlace[RESOLUTIONS]; - /// config inverse telecine +/// config inverse telecine static int ConfigVideoInverseTelecine[RESOLUTIONS]; - /// config denoise +/// config denoise static int ConfigVideoDenoise[RESOLUTIONS]; - /// config sharpen +/// config sharpen static int ConfigVideoSharpen[RESOLUTIONS]; - /// config scaling +/// config scaling static int ConfigVideoScaling[RESOLUTIONS]; - /// config cut top and bottom pixels +/// config cut top and bottom pixels static int ConfigVideoCutTopBottom[RESOLUTIONS]; - /// config cut left and right pixels +/// config cut left and right pixels static int ConfigVideoCutLeftRight[RESOLUTIONS]; static int ConfigAutoCropEnabled; ///< auto crop detection enabled @@ -194,10 +194,10 @@ static int ConfigMaxSizeGPUImageCache = 128; ///< maximum size of GPU mem to static volatile int DoMakePrimary; ///< switch primary device to this -#define SUSPEND_EXTERNAL -1 ///< play external suspend mode -#define NOT_SUSPENDED 0 ///< not suspend mode -#define SUSPEND_NORMAL 1 ///< normal suspend mode -#define SUSPEND_DETACHED 2 ///< detached suspend mode +#define SUSPEND_EXTERNAL -1 ///< play external suspend mode +#define NOT_SUSPENDED 0 ///< not suspend mode +#define SUSPEND_NORMAL 1 ///< normal suspend mode +#define SUSPEND_DETACHED 2 ///< detached suspend mode static signed char SuspendMode; ///< suspend mode ////////////////////////////////////////////////////////////////////////////// @@ -207,27 +207,27 @@ static signed char SuspendMode; ///< suspend mode ////////////////////////////////////////////////////////////////////////////// /** -** Soft device plugin remote class. +** Soft device plugin remote class. */ class cSoftRemote:public cRemote { public: /** - ** Soft device remote class constructor. + ** Soft device remote class constructor. ** - ** @param name remote name + ** @param name remote name */ cSoftRemote(const char *name):cRemote(name) { } /** - ** Put keycode into vdr event queue. + ** Put keycode into vdr event queue. ** - ** @param code key code - ** @param repeat flag key repeated - ** @param release flag key released + ** @param code key code + ** @param repeat flag key repeated + ** @param release flag key released */ bool Put(const char *code, bool repeat = false, bool release = false) { return cRemote::Put(code, repeat, release); @@ -235,13 +235,13 @@ class cSoftRemote:public cRemote }; /** -** Feed key press as remote input (called from C part). +** Feed key press as remote input (called from C part). ** -** @param keymap target keymap "XKeymap" name -** @param key pressed/released key name -** @param repeat repeated key flag -** @param release released key flag -** @param letter x11 character string (system setting locale) +** @param keymap target keymap "XKeymap" name +** @param key pressed/released key name +** @param repeat repeated key flag +** @param release released key flag +** @param letter x11 character string (system setting locale) */ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, int release, const char *letter) { @@ -265,7 +265,7 @@ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, in csoft = new cSoftRemote(keymap); } - //dsyslog("[softhddev]%s %s, %s, %s\n", __FUNCTION__, keymap, key, letter); + // dsyslog("[softhddev]%s %s, %s, %s\n", __FUNCTION__, keymap, key, letter); if (key[1]) { // no single character if (!csoft->Put(key, repeat, release) && letter && !cRemote::IsLearning()) { cCharSetConv conv; @@ -286,7 +286,7 @@ extern "C" void FeedKeyPress(const char *keymap, const char *key, int repeat, in ////////////////////////////////////////////////////////////////////////////// /** -** Soft device plugin OSD class. +** Soft device plugin OSD class. */ class cSoftOsd:public cOsd { @@ -305,12 +305,12 @@ class cSoftOsd:public cOsd volatile char cSoftOsd::Dirty; ///< flag force redraw everything /** -** Sets this OSD to be the active one. +** Sets this OSD to be the active one. ** -** @param on true on, false off +** @param on true on, false off ** -** @note only needed as workaround for text2skin plugin with -** undrawn areas. +** @note only needed as workaround for text2skin plugin with +** undrawn areas. */ void cSoftOsd::SetActive(bool on) { @@ -335,13 +335,13 @@ void cSoftOsd::SetActive(bool on) } /** -** Constructor OSD. +** Constructor OSD. ** -** Initializes the OSD with the given coordinates. +** Initializes the OSD with the given coordinates. ** -** @param left x-coordinate of osd on display -** @param top y-coordinate of osd on display -** @param level level of the osd (smallest is shown) +** @param left x-coordinate of osd on display +** @param top y-coordinate of osd on display +** @param level level of the osd (smallest is shown) */ cSoftOsd::cSoftOsd(int left, int top, uint level) :cOsd(left, top, level) @@ -356,9 +356,9 @@ cSoftOsd::cSoftOsd(int left, int top, uint level) } /** -** OSD Destructor. +** OSD Destructor. ** -** Shuts down the OSD. +** Shuts down the OSD. */ cSoftOsd::~cSoftOsd(void) { @@ -384,7 +384,7 @@ cSoftOsd::~cSoftOsd(void) } /** -+* Set the sub-areas to the given areas +** Set the sub-areas to the given areas */ eOsdError cSoftOsd::SetAreas(const tArea * areas, int n) { @@ -409,7 +409,7 @@ eOsdError cSoftOsd::SetAreas(const tArea * areas, int n) } /** -** Actually commits all data to the OSD hardware. +** Actually commits all data to the OSD hardware. */ void cSoftOsd::Flush(void) { @@ -748,7 +748,7 @@ class cDummyOsd:public cOsd ////////////////////////////////////////////////////////////////////////////// /** -** Soft device plugin OSD provider class. +** Soft device plugin OSD provider class. */ class cSoftOsdProvider:public cOsdProvider { @@ -796,11 +796,11 @@ void cSoftOsdProvider::DropImageData(int ImageHandle) #endif /** -** Create a new OSD. +** Create a new OSD. ** -** @param left x-coordinate of OSD -** @param top y-coordinate of OSD -** @param level layer level of OSD +** @param left x-coordinate of OSD +** @param top y-coordinate of OSD +** @param level layer level of OSD */ cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level) { @@ -818,9 +818,9 @@ cOsd *cSoftOsdProvider::CreateOsd(int left, int top, uint level) } /** -** Check if this OSD provider is able to handle a true color OSD. +** Check if this OSD provider is able to handle a true color OSD. ** -** @returns true we are able to handle a true color OSD. +** @returns true we are able to handle a true color OSD. */ bool cSoftOsdProvider::ProvidesTrueColor(void) { @@ -835,15 +835,15 @@ const cImage *cSoftOsdProvider::GetImageData(int ImageHandle) void cSoftOsdProvider::OsdSizeChanged(void) { - //cleanup OpenGl Context + // cleanup OpenGl Context cSoftOsdProvider::StopOpenGlThread(); cOsdProvider::UpdateOsdSize(); } bool cSoftOsdProvider::StartOpenGlThread(void) { - //only try to start worker thread if shd is attached - //otherwise glutInit() crashes + // only try to start worker thread if shd is attached + // otherwise glutInit() crashes if (SuspendMode != NOT_SUSPENDED) { dsyslog("[softhddev]detached - OpenGl Worker Thread not tried to start"); return false; @@ -871,7 +871,7 @@ void cSoftOsdProvider::StopOpenGlThread(void) { dsyslog("[softhddev]stopping OpenGL Worker Thread "); if (oglThread) { -// OsdClose(); + // OsdClose(); oglThread->Stop(); } oglThread.reset(); @@ -880,7 +880,7 @@ void cSoftOsdProvider::StopOpenGlThread(void) #endif /** -** Create cOsdProvider class. +** Create cOsdProvider class. */ cSoftOsdProvider::cSoftOsdProvider(void) :cOsdProvider() @@ -896,7 +896,7 @@ cSoftOsdProvider::cSoftOsdProvider(void) } /** -** Destroy cOsdProvider class. +** Destroy cOsdProvider class. */ cSoftOsdProvider::~cSoftOsdProvider() { @@ -913,7 +913,7 @@ cSoftOsdProvider::~cSoftOsdProvider() ////////////////////////////////////////////////////////////////////////////// /** -** Soft device plugin menu setup page class. +** Soft device plugin menu setup page class. */ class cMenuSetupSoft:public cMenuSetupPage { @@ -1022,9 +1022,9 @@ class cMenuSetupSoft:public cMenuSetupPage }; /** -** Create a seperator item. +** Create a seperator item. ** -** @param label text inside separator +** @param label text inside separator */ static inline cOsdItem *SeparatorItem(const char *label) { @@ -1037,11 +1037,11 @@ static inline cOsdItem *SeparatorItem(const char *label) } /** -** Create a collapsed item. +** Create a collapsed item. ** -** @param label text inside collapsed -** @param flag flag handling collapsed or opened -** @param msg open message +** @param label text inside collapsed +** @param flag flag handling collapsed or opened +** @param msg open message */ inline cOsdItem *cMenuSetupSoft::CollapsedItem(const char *label, int &flag, const char *msg) { @@ -1053,7 +1053,7 @@ inline cOsdItem *cMenuSetupSoft::CollapsedItem(const char *label, int &flag, con } /** -** Create setup menu. +** Create setup menu. */ void cMenuSetupSoft::Create(void) { @@ -1102,9 +1102,9 @@ void cMenuSetupSoft::Create(void) for (scalers = 0; pl_named_filters[scalers].filter != NULL; scalers++) { scaling[scalers] = (char *)pl_named_filters[scalers].name; scalingtest[scalers + 1] = (char *)pl_named_filters[scalers].name; -// printf("Scaler %s\n",pl_named_filters[scalers].name); + // printf("Scaler %s\n",pl_named_filters[scalers].name); } -// scalers -= 2; + // scalers -= 2; } #endif @@ -1272,7 +1272,7 @@ void cMenuSetupSoft::Create(void) } /** -** Process key for setup menu. +** Process key for setup menu. */ eOSState cMenuSetupSoft::ProcessKey(eKeys key) { @@ -1321,9 +1321,9 @@ eOSState cMenuSetupSoft::ProcessKey(eKeys key) } /** -** Constructor setup menu. +** Constructor setup menu. ** -** Import global config variables into setup. +** Import global config variables into setup. */ cMenuSetupSoft::cMenuSetupSoft(void) { @@ -1379,7 +1379,7 @@ cMenuSetupSoft::cMenuSetupSoft(void) TargetColorSpace = ConfigTargetColorSpace; ColorBlindness = ConfigColorBlindness; ColorBlindnessFaktor = ConfigColorBlindnessFaktor; -// ScalerTest = ConfigScalerTest; + // ScalerTest = ConfigScalerTest; for (i = 0; i < RESOLUTIONS; ++i) { ResolutionShown[i] = 0; @@ -1455,7 +1455,7 @@ cMenuSetupSoft::cMenuSetupSoft(void) } /** -** Store setup. +** Store setup. */ void cMenuSetupSoft::Store(void) { @@ -1523,7 +1523,7 @@ void cMenuSetupSoft::Store(void) VideoSetColorBlindness(ConfigColorBlindness); SetupStore("CBlindnessFaktor", ConfigColorBlindnessFaktor = ColorBlindnessFaktor); VideoSetColorBlindnessFaktor(ConfigColorBlindnessFaktor); -// SetupStore("ScalerTest", ConfigScalerTest = ScalerTest); + // SetupStore("ScalerTest", ConfigScalerTest = ScalerTest); VideoSetScalerTest(ConfigScalerTest); for (i = 0; i < RESOLUTIONS; ++i) { @@ -1633,7 +1633,7 @@ void cMenuSetupSoft::Store(void) ////////////////////////////////////////////////////////////////////////////// /** -** Dummy player for suspend mode. +** Dummy player for suspend mode. */ class cSoftHdPlayer:public cPlayer { @@ -1657,7 +1657,7 @@ cSoftHdPlayer::~cSoftHdPlayer() ////////////////////////////////////////////////////////////////////////////// /** -** Dummy control class for suspend mode. +** Dummy control class for suspend mode. */ class cSoftHdControl:public cControl { @@ -1676,9 +1676,9 @@ class cSoftHdControl:public cControl cSoftHdPlayer *cSoftHdControl::Player; ///< dummy player instance /** -** Handle a key event. +** Handle a key event. ** -** @param key key pressed +** @param key key pressed */ eOSState cSoftHdControl::ProcessKey(eKeys key) { @@ -1695,7 +1695,7 @@ eOSState cSoftHdControl::ProcessKey(eKeys key) } /** -** Player control constructor. +** Player control constructor. */ cSoftHdControl::cSoftHdControl(void) :cControl(Player = new cSoftHdPlayer) @@ -1703,7 +1703,7 @@ cSoftHdControl::cSoftHdControl(void) } /** -** Player control destructor. +** Player control destructor. */ cSoftHdControl::~cSoftHdControl() { @@ -1735,7 +1735,7 @@ static int PipAltPosition; ///< flag alternative position #include /** -** Receiver class for PIP mode. +** Receiver class for PIP mode. */ class cSoftReceiver:public cReceiver { @@ -1752,9 +1752,9 @@ class cSoftReceiver:public cReceiver }; /** -** Receiver constructor. +** Receiver constructor. ** -** @param channel channel to receive +** @param channel channel to receive */ cSoftReceiver::cSoftReceiver(const cChannel * channel):cReceiver(NULL, MINPRIORITY) { @@ -1764,7 +1764,7 @@ cSoftReceiver::cSoftReceiver(const cChannel * channel):cReceiver(NULL, MINPRIORI } /** -** Receiver destructor. +** Receiver destructor. */ cSoftReceiver::~cSoftReceiver() { @@ -1772,9 +1772,9 @@ cSoftReceiver::~cSoftReceiver() } /** -** Called before the receiver gets attached or detached. +** Called before the receiver gets attached or detached. ** -** @param on flag attached, detached +** @param on flag attached, detached */ void cSoftReceiver::Activate(bool on) { @@ -1858,15 +1858,15 @@ static void PipPesParse(const uint8_t * data, int size, int is_start) } /// Transport stream packet size -#define TS_PACKET_SIZE 188 +#define TS_PACKET_SIZE 188 /// Transport stream packet sync byte -#define TS_PACKET_SYNC 0x47 +#define TS_PACKET_SYNC 0x47 /** -** Receive TS packet from device. +** Receive TS packet from device. ** -** @param data ts packet -** @param size size (#TS_PACKET_SIZE=188) of tes packet +** @param data ts packet +** @param size size (#TS_PACKET_SIZE=188) of tes packet */ #if APIVERSNUM >= 20301 void cSoftReceiver::Receive(const uchar * data, int size) @@ -1931,7 +1931,7 @@ static int PipChannelNr; ///< last PIP channel number static const cChannel *PipChannel; ///< current PIP channel /** -** Stop PIP. +** Stop PIP. */ extern "C" void DelPip(void) { @@ -1942,9 +1942,9 @@ extern "C" void DelPip(void) } /** -** Prepare new PIP. +** Prepare new PIP. ** -** @param channel_nr channel number +** @param channel_nr channel number */ static void NewPip(int channel_nr) { @@ -1979,7 +1979,7 @@ static void NewPip(int channel_nr) } /** -** Toggle PIP on/off. +** Toggle PIP on/off. */ static void TogglePip(void) { @@ -1996,9 +1996,9 @@ static void TogglePip(void) } /** -** Switch PIP to next available channel. +** Switch PIP to next available channel. ** -** @param direction direction of channel switch +** @param direction direction of channel switch */ static void PipNextAvailableChannel(int direction) { @@ -2035,7 +2035,7 @@ static void PipNextAvailableChannel(int direction) } /** -** Swap PIP channels. +** Swap PIP channels. */ static void SwapPipChannels(void) { @@ -2054,7 +2054,7 @@ static void SwapPipChannels(void) } /** -** Swap PIP position. +** Swap PIP position. */ static void SwapPipPosition(void) { @@ -2090,7 +2090,7 @@ static void SwapPipPosition(void) ////////////////////////////////////////////////////////////////////////////// /** -** Hotkey parsing state machine. +** Hotkey parsing state machine. */ typedef enum { @@ -2101,7 +2101,7 @@ typedef enum } HkState; /** -** Soft device plugin menu class. +** Soft device plugin menu class. */ class cSoftHdMenu:public cOsdMenu { @@ -2116,7 +2116,7 @@ class cSoftHdMenu:public cOsdMenu }; /** -** Create main menu. +** Create main menu. */ void cSoftHdMenu::Create(void) { @@ -2169,7 +2169,7 @@ void cSoftHdMenu::Create(void) } /** -** Soft device menu constructor. +** Soft device menu constructor. */ cSoftHdMenu::cSoftHdMenu(const char *title, int c0, int c1, int c2, int c3, int c4) :cOsdMenu(title, c0, c1, c2, c3, c4) @@ -2180,16 +2180,16 @@ cSoftHdMenu::cSoftHdMenu(const char *title, int c0, int c1, int c2, int c3, int } /** -** Soft device menu destructor. +** Soft device menu destructor. */ cSoftHdMenu::~cSoftHdMenu() { } /** -** Handle hot key commands. +** Handle hot key commands. ** -** @param code numeric hot key code +** @param code numeric hot key code */ static void HandleHotkey(int code) { @@ -2319,9 +2319,9 @@ static void HandleHotkey(int code) } /** -** Handle key event. +** Handle key event. ** -** @param key key event +** @param key key event */ eOSState cSoftHdMenu::ProcessKey(eKeys key) { @@ -2489,12 +2489,12 @@ class cSoftHdDevice:public cDevice virtual void SetAudioTrackDevice(eTrackType); virtual void SetVolumeDevice(int); -// Image Grab facilities + // Image Grab facilities virtual uchar *GrabImage(int &, bool, int, int, int); #ifdef USE_VDR_SPU -// SPU facilities + // SPU facilities private: cDvbSpuDecoder * spuDecoder; public: @@ -2506,11 +2506,11 @@ class cSoftHdDevice:public cDevice }; /** -** Constructor device. +** Constructor device. */ cSoftHdDevice::cSoftHdDevice(void) { - //dsyslog("[softhddev]%s\n", __FUNCTION__); + // dsyslog("[softhddev]%s\n", __FUNCTION__); #ifdef USE_VDR_SPU spuDecoder = NULL; @@ -2518,20 +2518,20 @@ cSoftHdDevice::cSoftHdDevice(void) } /** -** Destructor device. +** Destructor device. */ cSoftHdDevice::~cSoftHdDevice(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); #ifdef USE_VDR_SPU delete spuDecoder; #endif } /** -** Informs a device that it will be the primary device. +** Informs a device that it will be the primary device. ** -** @param on flag if becoming or loosing primary +** @param on flag if becoming or loosing primary */ void cSoftHdDevice::MakePrimaryDevice(bool on) { @@ -2558,10 +2558,10 @@ void cSoftHdDevice::MakePrimaryDevice(bool on) #ifdef USE_VDR_SPU /** -** Get the device SPU decoder. +** Get the device SPU decoder. ** -** @returns a pointer to the device's SPU decoder (or NULL, if this -** device doesn't have an SPU decoder) +** @returns a pointer to the device's SPU decoder (or NULL, if this +** device doesn't have an SPU decoder) */ cSpuDecoder *cSoftHdDevice::GetSpuDecoder(void) { @@ -2576,7 +2576,7 @@ cSpuDecoder *cSoftHdDevice::GetSpuDecoder(void) #endif /** -** Tells whether this device has a MPEG decoder. +** Tells whether this device has a MPEG decoder. */ bool cSoftHdDevice::HasDecoder(void) const { @@ -2584,7 +2584,7 @@ bool cSoftHdDevice::HasDecoder(void) const } /** -** Returns true if this device can currently start a replay session. +** Returns true if this device can currently start a replay session. */ bool cSoftHdDevice::CanReplay(void) const { @@ -2592,9 +2592,9 @@ bool cSoftHdDevice::CanReplay(void) const } /** -** Sets the device into the given play mode. +** Sets the device into the given play mode. ** -** @param play_mode new play mode (Audio/Video/External...) +** @param play_mode new play mode (Audio/Video/External...) */ bool cSoftHdDevice::SetPlayMode(ePlayMode play_mode) { @@ -2637,24 +2637,24 @@ bool cSoftHdDevice::SetPlayMode(ePlayMode play_mode) } /** -** Gets the current System Time Counter, which can be used to -** synchronize audio, video and subtitles. +** Gets the current System Time Counter, which can be used to +** synchronize audio, video and subtitles. */ int64_t cSoftHdDevice::GetSTC(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return::GetSTC(); } /** -** Set trick play speed. +** Set trick play speed. ** -** Every single frame shall then be displayed the given number of -** times. +** Every single frame shall then be displayed the given number of +** times. ** -** @param speed trick speed -** @param forward flag forward direction +** @param speed trick speed +** @param forward flag forward direction */ #if APIVERSNUM >= 20103 void cSoftHdDevice::TrickSpeed(int speed, bool forward) @@ -2673,7 +2673,7 @@ void cSoftHdDevice::TrickSpeed(int speed) #endif /** -** Clears all video and audio data from the device. +** Clears all video and audio data from the device. */ void cSoftHdDevice::Clear(void) { @@ -2684,7 +2684,7 @@ void cSoftHdDevice::Clear(void) } /** -** Sets the device into play mode (after a previous trick mode) +** Sets the device into play mode (after a previous trick mode) */ void cSoftHdDevice::Play(void) { @@ -2695,7 +2695,7 @@ void cSoftHdDevice::Play(void) } /** -** Puts the device into "freeze frame" mode. +** Puts the device into "freeze frame" mode. */ void cSoftHdDevice::Freeze(void) { @@ -2706,7 +2706,7 @@ void cSoftHdDevice::Freeze(void) } /** -** Turns off audio while replaying. +** Turns off audio while replaying. */ void cSoftHdDevice::Mute(void) { @@ -2717,10 +2717,10 @@ void cSoftHdDevice::Mute(void) } /** -** Display the given I-frame as a still picture. +** Display the given I-frame as a still picture. ** -** @param data pes or ts data of a frame -** @param length length of data area +** @param data pes or ts data of a frame +** @param length length of data area */ void cSoftHdDevice::StillPicture(const uchar * data, int length) { @@ -2735,25 +2735,25 @@ void cSoftHdDevice::StillPicture(const uchar * data, int length) } /** -** Check if the device is ready for further action. +** Check if the device is ready for further action. ** -** @param poller file handles (unused) -** @param timeout_ms timeout in ms to become ready +** @param poller file handles (unused) +** @param timeout_ms timeout in ms to become ready ** -** @retval true if ready -** @retval false if busy +** @retval true if ready +** @retval false if busy */ bool cSoftHdDevice::Poll( __attribute__((unused)) cPoller & poller, int timeout_ms) { - //dsyslog("[softhddev]%s: %d\n", __FUNCTION__, timeout_ms); + // dsyslog("[softhddev]%s: %d\n", __FUNCTION__, timeout_ms); return::Poll(timeout_ms); } /** -** Flush the device output buffers. +** Flush the device output buffers. ** -** @param timeout_ms timeout in ms to become ready +** @param timeout_ms timeout in ms to become ready */ bool cSoftHdDevice::Flush(int timeout_ms) { @@ -2765,8 +2765,8 @@ bool cSoftHdDevice::Flush(int timeout_ms) // ---------------------------------------------------------------------------- /** -** Sets the video display format to the given one (only useful if this -** device has an MPEG decoder). +** Sets the video display format to the given one (only useful if this +** device has an MPEG decoder). */ void cSoftHdDevice::SetVideoDisplayFormat(eVideoDisplayFormat video_display_format) { @@ -2787,12 +2787,12 @@ void cSoftHdDevice::SetVideoDisplayFormat(eVideoDisplayFormat video_display_form } /** -** Sets the output video format to either 16:9 or 4:3 (only useful -** if this device has an MPEG decoder). +** Sets the output video format to either 16:9 or 4:3 (only useful +** if this device has an MPEG decoder). ** -** Should call SetVideoDisplayFormat. +** Should call SetVideoDisplayFormat. ** -** @param video_format16_9 flag true 16:9. +** @param video_format16_9 flag true 16:9. */ void cSoftHdDevice::SetVideoFormat(bool video_format16_9) { @@ -2804,10 +2804,10 @@ void cSoftHdDevice::SetVideoFormat(bool video_format16_9) } /** -** Returns the width, height and video_aspect ratio of the currently -** displayed video material. +** Returns the width, height and video_aspect ratio of the currently +** displayed video material. ** -** @note the video_aspect is used to scale the subtitle. +** @note the video_aspect is used to scale the subtitle. */ void cSoftHdDevice::GetVideoSize(int &width, int &height, double &video_aspect) { @@ -2815,9 +2815,9 @@ void cSoftHdDevice::GetVideoSize(int &width, int &height, double &video_aspect) } /** -** Returns the width, height and pixel_aspect ratio the OSD. +** Returns the width, height and pixel_aspect ratio the OSD. ** -** FIXME: Called every second, for nothing (no OSD displayed)? +** FIXME: Called every second, for nothing (no OSD displayed)? */ void cSoftHdDevice::GetOsdSize(int &width, int &height, double &pixel_aspect) { @@ -2827,46 +2827,46 @@ void cSoftHdDevice::GetOsdSize(int &width, int &height, double &pixel_aspect) // ---------------------------------------------------------------------------- /** -** Play a audio packet. +** Play a audio packet. ** -** @param data exactly one complete PES packet (which is incomplete) -** @param length length of PES packet -** @param id type of audio data this packet holds +** @param data exactly one complete PES packet (which is incomplete) +** @param length length of PES packet +** @param id type of audio data this packet holds */ int cSoftHdDevice::PlayAudio(const uchar * data, int length, uchar id) { - //dsyslog("[softhddev]%s: %p %p %d %d\n", __FUNCTION__, this, data, length, id); + // dsyslog("[softhddev]%s: %p %p %d %d\n", __FUNCTION__, this, data, length, id); return::PlayAudio(data, length, id); } void cSoftHdDevice::SetAudioTrackDevice( __attribute__((unused)) eTrackType type) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); } void cSoftHdDevice::SetDigitalAudioDevice( __attribute__((unused)) bool on) { - //dsyslog("[softhddev]%s: %s\n", __FUNCTION__, on ? "true" : "false"); + // dsyslog("[softhddev]%s: %s\n", __FUNCTION__, on ? "true" : "false"); } void cSoftHdDevice::SetAudioChannelDevice( __attribute__((unused)) int audio_channel) { - //dsyslog("[softhddev]%s: %d\n", __FUNCTION__, audio_channel); + // dsyslog("[softhddev]%s: %d\n", __FUNCTION__, audio_channel); } int cSoftHdDevice::GetAudioChannelDevice(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return 0; } /** -** Sets the audio volume on this device (Volume = 0...255). +** Sets the audio volume on this device (Volume = 0...255). ** -** @param volume device volume +** @param volume device volume */ void cSoftHdDevice::SetVolumeDevice(int volume) { @@ -2878,24 +2878,24 @@ void cSoftHdDevice::SetVolumeDevice(int volume) // ---------------------------------------------------------------------------- /** -** Play a video packet. +** Play a video packet. ** -** @param data exactly one complete PES packet (which is incomplete) -** @param length length of PES packet +** @param data exactly one complete PES packet (which is incomplete) +** @param length length of PES packet */ int cSoftHdDevice::PlayVideo(const uchar * data, int length) { - //dsyslog("[softhddev]%s: %p %d\n", __FUNCTION__, data, length); + // dsyslog("[softhddev]%s: %p %d\n", __FUNCTION__, data, length); return::PlayVideo(data, length); } #ifdef USE_TS_VIDEO /** -** Play a TS video packet. +** Play a TS video packet. ** -** @param data ts data buffer -** @param length ts packet length (188) +** @param data ts data buffer +** @param length ts packet length (188) */ int cSoftHdDevice::PlayTsVideo(const uchar * data, int length) { @@ -2906,10 +2906,10 @@ int cSoftHdDevice::PlayTsVideo(const uchar * data, int length) #if !defined(USE_AUDIO_THREAD) || !defined(NO_TS_AUDIO) /** -** Play a TS audio packet. +** Play a TS audio packet. ** -** @param data ts data buffer -** @param length ts packet length (188) +** @param data ts data buffer +** @param length ts packet length (188) */ int cSoftHdDevice::PlayTsAudio(const uchar * data, int length) { @@ -2925,13 +2925,13 @@ int cSoftHdDevice::PlayTsAudio(const uchar * data, int length) #endif /** -** Grabs the currently visible screen image. +** Grabs the currently visible screen image. ** -** @param size size of the returned data -** @param jpeg flag true, create JPEG data -** @param quality JPEG quality -** @param width number of horizontal pixels in the frame -** @param height number of vertical pixels in the frame +** @param size size of the returned data +** @param jpeg flag true, create JPEG data +** @param quality JPEG quality +** @param width number of horizontal pixels in the frame +** @param height number of vertical pixels in the frame */ uchar *cSoftHdDevice::GrabImage(int &size, bool jpeg, int quality, int width, int height) { @@ -2950,11 +2950,11 @@ uchar *cSoftHdDevice::GrabImage(int &size, bool jpeg, int quality, int width, in #if APIVERSNUM >= 10733 /** -** Ask the output, if it can scale video. +** Ask the output, if it can scale video. ** -** @param rect requested video window rectangle +** @param rect requested video window rectangle ** -** @returns the real rectangle or cRect:Null if invalid. +** @returns the real rectangle or cRect:Null if invalid. */ cRect cSoftHdDevice::CanScaleVideo(const cRect & rect, __attribute__((unused)) int alignment) @@ -2963,9 +2963,9 @@ cRect cSoftHdDevice::CanScaleVideo(const cRect & rect, __attribute__((unused)) } /** -** Scale the currently shown video. +** Scale the currently shown video. ** -** @param rect video window rectangle +** @param rect video window rectangle */ void cSoftHdDevice::ScaleVideo(const cRect & rect) { @@ -2978,7 +2978,7 @@ void cSoftHdDevice::ScaleVideo(const cRect & rect) #endif /** -** Call rgb to jpeg for C Plugin. +** Call rgb to jpeg for C Plugin. */ extern "C" uint8_t * CreateJpeg(uint8_t * image, int *size, int quality, int width, int height) { @@ -3013,22 +3013,22 @@ class cPluginSoftHdDevice:public cPlugin }; /** -** Initialize any member variables here. +** Initialize any member variables here. ** -** @note DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL -** VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! +** @note DON'T DO ANYTHING ELSE THAT MAY HAVE SIDE EFFECTS, REQUIRE GLOBAL +** VDR OBJECTS TO EXIST OR PRODUCE ANY OUTPUT! */ cPluginSoftHdDevice::cPluginSoftHdDevice(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); } /** -** Clean up after yourself! +** Clean up after yourself! */ cPluginSoftHdDevice::~cPluginSoftHdDevice(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); ::SoftHdDeviceExit(); @@ -3036,9 +3036,9 @@ cPluginSoftHdDevice::~cPluginSoftHdDevice(void) } /** -** Return plugin version number. +** Return plugin version number. ** -** @returns version number as constant string. +** @returns version number as constant string. */ const char *cPluginSoftHdDevice::Version(void) { @@ -3046,9 +3046,9 @@ const char *cPluginSoftHdDevice::Version(void) } /** -** Return plugin short description. +** Return plugin short description. ** -** @returns short description as constant string. +** @returns short description as constant string. */ const char *cPluginSoftHdDevice::Description(void) { @@ -3056,9 +3056,9 @@ const char *cPluginSoftHdDevice::Description(void) } /** -** Return a string that describes all known command line options. +** Return a string that describes all known command line options. ** -** @returns command line help as constant string. +** @returns command line help as constant string. */ const char *cPluginSoftHdDevice::CommandLineHelp(void) { @@ -3066,24 +3066,24 @@ const char *cPluginSoftHdDevice::CommandLineHelp(void) } /** -** Process the command line arguments. +** Process the command line arguments. */ bool cPluginSoftHdDevice::ProcessArgs(int argc, char *argv[]) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return::ProcessArgs(argc, argv); } /** -** Initializes the DVB devices. +** Initializes the DVB devices. ** -** Must be called before accessing any DVB functions. +** Must be called before accessing any DVB functions. ** -** @returns true if any devices are available. +** @returns true if any devices are available. */ bool cPluginSoftHdDevice::Initialize(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); MyDevice = new cSoftHdDevice(); @@ -3091,11 +3091,11 @@ bool cPluginSoftHdDevice::Initialize(void) } /** -** Start any background activities the plugin shall perform. +** Start any background activities the plugin shall perform. */ bool cPluginSoftHdDevice::Start(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); if (!MyDevice->IsPrimaryDevice()) { isyslog("[softhddev] softhddevice %d is not the primary device!", MyDevice->DeviceNumber()); @@ -3125,22 +3125,22 @@ bool cPluginSoftHdDevice::Start(void) } /** -** Shutdown plugin. Stop any background activities the plugin is -** performing. +** Shutdown plugin. Stop any background activities the plugin is +** performing. */ void cPluginSoftHdDevice::Stop(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); ::Stop(); } /** -** Perform any cleanup or other regular tasks. +** Perform any cleanup or other regular tasks. */ void cPluginSoftHdDevice::Housekeeping(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); // check if user is inactive, automatic enter suspend mode // FIXME: cControl prevents shutdown, disable this until fixed @@ -3160,32 +3160,32 @@ void cPluginSoftHdDevice::Housekeeping(void) } /** -** Create main menu entry. +** Create main menu entry. */ const char *cPluginSoftHdDevice::MainMenuEntry(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return ConfigHideMainMenuEntry ? NULL : tr(MAINMENUENTRY); } /** -** Perform the action when selected from the main VDR menu. +** Perform the action when selected from the main VDR menu. */ cOsdObject *cPluginSoftHdDevice::MainMenuAction(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return new cSoftHdMenu("SoftHdDevice"); } /** -** Called for every plugin once during every cycle of VDR's main program -** loop. +** Called for every plugin once during every cycle of VDR's main program +** loop. */ void cPluginSoftHdDevice::MainThreadHook(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); if (DoMakePrimary) { dsyslog("[softhddev]%s: switching primary device to %d\n", __FUNCTION__, DoMakePrimary); @@ -3197,28 +3197,28 @@ void cPluginSoftHdDevice::MainThreadHook(void) } /** -** Return our setup menu. +** Return our setup menu. */ cMenuSetupPage *cPluginSoftHdDevice::SetupMenu(void) { - //dsyslog("[softhddev]%s:\n", __FUNCTION__); + // dsyslog("[softhddev]%s:\n", __FUNCTION__); return new cMenuSetupSoft; } /** -** Parse setup parameters +** Parse setup parameters ** -** @param name paramter name (case sensetive) -** @param value value as string +** @param name paramter name (case sensetive) +** @param value value as string ** -** @returns true if the parameter is supported. +** @returns true if the parameter is supported. */ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) { int i; - //dsyslog("[softhddev]%s: '%s' = '%s'\n", __FUNCTION__, name, value); + // dsyslog("[softhddev]%s: '%s' = '%s'\n", __FUNCTION__, name, value); if (!strcasecmp(name, "MakePrimary")) { ConfigMakePrimary = atoi(value); @@ -3557,15 +3557,15 @@ bool cPluginSoftHdDevice::SetupParse(const char *name, const char *value) } /** -** Receive requests or messages. +** Receive requests or messages. ** -** @param id unique identification string that identifies the -** service protocol -** @param data custom data structure +** @param id unique identification string that identifies the +** service protocol +** @param data custom data structure */ bool cPluginSoftHdDevice::Service(const char *id, void *data) { - //dsyslog("[softhddev]%s: id %s\n", __FUNCTION__, id); + // dsyslog("[softhddev]%s: id %s\n", __FUNCTION__, id); if (strcmp(id, OSD_3DMODE_SERVICE) == 0) { SoftHDDevice_Osd3DModeService_v1_0_t *r; @@ -3633,13 +3633,13 @@ bool cPluginSoftHdDevice::Service(const char *id, void *data) //---------------------------------------------------------------------------- /** -** SVDRP commands help text. -** FIXME: translation? +** SVDRP commands help text. +** FIXME: translation? */ static const char *SVDRPHelpText[] = { "SUSP\n" "\040 Suspend plugin.\n\n" " The plugin is suspended to save energie. Depending on the setup\n" " 'softhddevice.Suspend.Close = 0' only the video and audio output\n" - " is stopped or with 'softhddevice.Suspend.Close = 1' the video\n" " and audio devices are closed.\n" + " is stopped or with 'softhddevice.Suspend.Close = 1' the video\n" " and audio devices are closed.\n" " If 'softhddevice.Suspend.X11 = 1' is set and the X11 server was\n" " started by the plugin, the X11 server would also be closed.\n" " (Stopping X11 while suspended isn't supported yet)\n", @@ -3657,30 +3657,30 @@ static const char *SVDRPHelpText[] = { " is the number of device. Without number softhddevice becomes\n" " the primary device. If becoming primary, the plugin is attached\n" " to the devices. If loosing primary, the plugin is detached from\n" " the devices.", - "HOTK key\n" " Execute hotkey.\n\n" " key is the hotkey number, following are supported:\n" + "HOTK key\n" " Execute hotkey.\n\n" " key is the hotkey number, following are supported:\n" " 10: disable audio pass-through\n" " 11: enable audio pass-through\n" - " 12: toggle audio pass-through\n" " 13: decrease audio delay by 10ms\n" + " 12: toggle audio pass-through\n" " 13: decrease audio delay by 10ms\n" " 14: increase audio delay by 10ms\n" " 15: toggle ac3 mixdown\n" - " 20: disable fullscreen\n\040 21: enable fullscreen\n" " 22: toggle fullscreen\n" - " 23: disable auto-crop\n\040 24: enable auto-crop\n" " 25: toggle auto-crop\n" - " 30: stretch 4:3 to display\n\040 31: pillar box 4:3 in display\n" + " 20: disable fullscreen\n\040 21: enable fullscreen\n" " 22: toggle fullscreen\n" + " 23: disable auto-crop\n\040 24: enable auto-crop\n" " 25: toggle auto-crop\n" + " 30: stretch 4:3 to display\n\040 31: pillar box 4:3 in display\n" " 32: center cut-out 4:3 to display\n" " 39: rotate 4:3 to display zoom mode\n" - " 40: stretch other aspect ratios to display\n" " 41: letter box other aspect ratios in display\n" + " 40: stretch other aspect ratios to display\n" " 41: letter box other aspect ratios in display\n" " 42: center cut-out other aspect ratios to display\n" " 49: rotate other aspect ratios to display zoom mode\n", - "STAT\n" "\040 Display SuspendMode of the plugin.\n\n" " reply code is 910 + SuspendMode\n" - " SUSPEND_EXTERNAL == -1 (909)\n" " NOT_SUSPENDED == 0 (910)\n" - " SUSPEND_NORMAL == 1 (911)\n" " SUSPEND_DETACHED == 2 (912)\n", - "RAIS\n" "\040 Raise softhddevice window\n\n" " If Xserver is not started by softhddevice, the window which\n" + "STAT\n" "\040 Display SuspendMode of the plugin.\n\n" " reply code is 910 + SuspendMode\n" + " SUSPEND_EXTERNAL == -1 (909)\n" " NOT_SUSPENDED == 0 (910)\n" + " SUSPEND_NORMAL == 1 (911)\n" " SUSPEND_DETACHED == 2 (912)\n", + "RAIS\n" "\040 Raise softhddevice window\n\n" " If Xserver is not started by softhddevice, the window which\n" " contains the softhddevice frontend will be raised to the front.\n", NULL }; /** -** Return SVDRP commands help pages. +** Return SVDRP commands help pages. ** -** return a pointer to a list of help strings for all of the plugin's -** SVDRP commands. +** return a pointer to a list of help strings for all of the plugin's +** SVDRP commands. */ const char **cPluginSoftHdDevice::SVDRPHelpPages(void) { @@ -3688,11 +3688,11 @@ const char **cPluginSoftHdDevice::SVDRPHelpPages(void) } /** -** Handle SVDRP commands. +** Handle SVDRP commands. ** -** @param command SVDRP command -** @param option all command arguments -** @param reply_code reply code +** @param command SVDRP command +** @param option all command arguments +** @param reply_code reply code */ cString cPluginSoftHdDevice::SVDRPCommand(const char *command, const char *option, __attribute__((unused)) int &reply_code) diff --git a/softhddev.c b/softhddev.c index 5c9fef6..65e4380 100644 --- a/softhddev.c +++ b/softhddev.c @@ -90,7 +90,7 @@ static enum AVCodecID AudioCodecID; ///< current codec id static int AudioChannelID; ///< current audio channel id static VideoStream *AudioSyncStream; ///< video stream for audio/video sync - /// Minimum free space in audio buffer 8 packets for 8 channels +/// Minimum free space in audio buffer 8 packets for 8 channels #define AUDIO_MIN_BUFFER_FREE (3072 * 8 * 8) #define AUDIO_BUFFER_SIZE (512 * 1024) ///< audio PES buffer default size static AVPacket AudioAvPkt[1]; ///< audio a/v packet @@ -884,9 +884,9 @@ static void PesParse(PesDemux * pesdx, const uint8_t * data, int size, int is_st // Transport stream demux ////////////////////////////////////////////////////////////////////////////// - /// Transport stream packet size +/// Transport stream packet size #define TS_PACKET_SIZE 188 - /// Transport stream packet sync byte +/// Transport stream packet sync byte #define TS_PACKET_SYNC 0x47 /// @@ -962,11 +962,11 @@ static int TsDemuxer(TsDemux * tsdx, const uint8_t * data, int size) #if 0 int tmp; - // check continuity + // check continuity tmp = p[3] & 0x0F; // continuity counter if (((tsdx->CC + 1) & 0x0F) != tmp) { Debug(3, "tsdemux: OUT OF SYNC: %d %d\n", tmp, tsdx->CC); - //TS discontinuity (received 8, expected 0) for PID + // TS discontinuity (received 8, expected 0) for PID } tsdx->CC = tmp; #endif @@ -1049,7 +1049,7 @@ int PlayAudio(const uint8_t * data, int size, uint8_t id) AudioAvPkt->pts = (int64_t) (data[9] & 0x0E) << 29 | data[10] << 22 | (data[11] & 0xFE) << 14 | data[12] << 7 | (data[13] & 0xFE) >> 1; - //Debug(3, "audio: pts %#012" PRIx64 "\n", AudioAvPkt->pts); + // Debug(3, "audio: pts %#012" PRIx64 "\n", AudioAvPkt->pts); } if (0) { // dts is unused if (data[7] & 0x40) { @@ -1256,7 +1256,7 @@ int PlayTsAudio(const uint8_t * data, int size) Debug(3, "AudioDelay %dms\n", AudioDelay); usleep(AudioDelay * 1000); AudioDelay = 0; -// TsDemuxer(tsdx, data, size); // insert dummy audio + // TsDemuxer(tsdx, data, size); // insert dummy audio } return TsDemuxer(tsdx, data, size); @@ -1333,7 +1333,7 @@ static VideoStream PipVideoStream[1]; ///< pip video stream uint32_t VideoSwitch; ///< debug video switch ticks static int VideoMaxPacketSize; ///< biggest used packet buffer #endif -//#define STILL_DEBUG 2 +// #define STILL_DEBUG 2 #ifdef STILL_DEBUG static char InStillPicture; ///< flag still picture #endif @@ -1394,7 +1394,7 @@ static void VideoEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const v { AVPacket *avpkt; - // Debug(3, "video: enqueue %d\n", size); + // Debug(3, "video: enqueue %d\n", size); avpkt = &stream->PacketRb[stream->PacketWrite]; if (!avpkt->stream_index) { // add pts only for first added @@ -1404,8 +1404,8 @@ static void VideoEnqueue(VideoStream * stream, int64_t pts, int64_t dts, const v if (avpkt->stream_index + size >= avpkt->size) { -// Warning(_("video: packet buffer too small for %d\n"), -// avpkt->stream_index + size); + // Warning(_("video: packet buffer too small for %d\n"), + // avpkt->stream_index + size); // new + grow reserves FF_INPUT_BUFFER_PADDING_SIZE av_grow_packet(avpkt, ((size + VIDEO_BUFFER_SIZE / 2) @@ -1479,7 +1479,7 @@ static void VideoNextPacket(VideoStream * stream, int codec_id) memset(avpkt->data + avpkt->stream_index, 0, AV_INPUT_BUFFER_PADDING_SIZE); stream->CodecIDRb[stream->PacketWrite] = codec_id; - //DumpH264(avpkt->data, avpkt->stream_index); + // DumpH264(avpkt->data, avpkt->stream_index); // advance packet write stream->PacketWrite = (stream->PacketWrite + 1) % VIDEO_PACKET_MAX; @@ -1618,7 +1618,7 @@ static void VideoMpegEnqueue(VideoStream * stream, int64_t pts, int64_t dts, con continue; } if (!p[0] && !p[1] && p[2] == 0x01 && p[3] == 0xb3) { -// printf("aspectratio %02x\n",p[7]>>4); + // printf("aspectratio %02x\n",p[7]>>4); } --n; ++p; @@ -1868,7 +1868,7 @@ int VideoDecodeInput(VideoStream * stream) } filled = atomic_read(&stream->PacketsFilled); -// printf("Packets in Decode %d\n",filled); + // printf("Packets in Decode %d\n",filled); if (!filled) { return -1; } @@ -1906,7 +1906,7 @@ int VideoDecodeInput(VideoStream * stream) Debug(3, "in VideoDecode make close\n"); stream->LastCodecID = AV_CODEC_ID_NONE; CodecVideoClose(stream->Decoder); - // FIXME: CodecVideoClose calls/uses hw decoder + // FIXME: CodecVideoClose calls/uses hw decoder goto skip; } // FIXME: look if more close are in the queue @@ -1941,8 +1941,8 @@ int VideoDecodeInput(VideoStream * stream) avpkt->stream_index = 0; #ifdef USE_PIP - //fprintf(stderr, "["); - //DumpMpeg(avpkt->data, avpkt->size); + // fprintf(stderr, "["); + // DumpMpeg(avpkt->data, avpkt->size); #ifdef STILL_DEBUG if (InStillPicture) { DumpMpeg(avpkt->data, avpkt->size); @@ -1954,7 +1954,7 @@ int VideoDecodeInput(VideoStream * stream) CodecVideoDecode(stream->Decoder, avpkt); } pthread_mutex_unlock(&stream->DecoderLockMutex); - //fprintf(stderr, "]\n"); + // fprintf(stderr, "]\n"); #else // old version if (stream->LastCodecID == AV_CODEC_ID_MPEG2VIDEO) { @@ -2193,7 +2193,7 @@ int PlayVideo3(VideoStream * stream, const uint8_t * data, int size) } // hard limit buffer full: needed for replay if (atomic_read(&stream->PacketsFilled) >= VIDEO_PACKET_MAX - 10) { -// Debug(3, "video: video buffer full\n"); + // Debug(3, "video: video buffer full\n"); return 0; } #ifdef USE_SOFTLIMIT @@ -2225,7 +2225,7 @@ int PlayVideo3(VideoStream * stream, const uint8_t * data, int size) z = 0; while (!*check) { // count leading zeros if (l < 3) { -// Warning(_("[softhddev] empty video packet %d bytes\n"), size); + // Warning(_("[softhddev] empty video packet %d bytes\n"), size); z = 0; break; } @@ -2278,7 +2278,7 @@ int PlayVideo3(VideoStream * stream, const uint8_t * data, int size) VideoEnqueue(stream, pts, dts, check - 2, l + 2); return size; } - // HEVC Codec + // HEVC Codec if ((data[6] & 0xC0) == 0x80 && z >= 2 && check[0] == 0x01 && check[1] == 0x46) { // old PES HDTV recording z == 2 -> stronger check! if (stream->CodecID == AV_CODEC_ID_HEVC) { @@ -2372,7 +2372,7 @@ int PlayVideo(const uint8_t * data, int size) return PlayVideo3(MyVideoStream, data, size); } - /// call VDR support function +/// call VDR support function extern uint8_t *CreateJpeg(uint8_t *, int *, int, int, int); #if defined(USE_JPEG) && JPEG_LIB_VERSION >= 80 @@ -3033,7 +3033,7 @@ static void StartXServer(void) int maxfd; int fd; - // X server + // X server if (X11Server) { args[0] = X11Server; } else { @@ -3047,7 +3047,7 @@ static void StartXServer(void) // export display for childs setenv("DISPLAY", X11DisplayName, 1); } - // split X server arguments string into words + // split X server arguments string into words if ((sval = X11ServerArguments)) { char *s; @@ -3071,13 +3071,13 @@ static void StartXServer(void) // FIXME: append VTxx args[argn] = NULL; - // arm the signal + // arm the signal memset(&usr1, 0, sizeof(struct sigaction)); usr1.sa_handler = Usr1Handler; sigaction(SIGUSR1, &usr1, NULL); Debug(3, "x-setup: Starting X server '%s' '%s'\n", args[0], X11ServerArguments); - // fork + // fork if ((pid = fork())) { // parent X11ServerPid = pid; @@ -3096,7 +3096,7 @@ static void StartXServer(void) close(fd); // vdr should open with O_CLOEXEC } - // start the X server + // start the X server execvp(args[0], (char *const *)args); Error(_("x-setup: Failed to start X server '%s'\n"), args[0]); @@ -3269,7 +3269,7 @@ void MainThreadHook(void) // Suspend/Resume ////////////////////////////////////////////////////////////////////////////// - /// call VDR support function +/// call VDR support function extern void DelPip(void); /** diff --git a/video.c b/video.c index 00249d6..264dcc9 100644 --- a/video.c +++ b/video.c @@ -44,10 +44,10 @@ #define noUSE_SCREENSAVER ///< support disable screensaver #define USE_GRAB ///< experimental grab code -//#define USE_GLX ///< outdated GLX code +// #define USE_GLX ///< outdated GLX code #define USE_DOUBLEBUFFER ///< use GLX double buffers #define USE_CUVID ///< enable cuvid support -//#define AV_INFO ///< log a/v sync informations +// #define AV_INFO ///< log a/v sync informations #ifndef AV_INFO_TIME #define AV_INFO_TIME (50 * 60) ///< a/v info every minute #endif @@ -86,7 +86,7 @@ #include #include #ifndef HAVE_PTHREAD_NAME - /// only available with newer glibc +/// only available with newer glibc #define pthread_setname_np(thread, name) #endif #endif @@ -104,12 +104,12 @@ #include #endif -//#include -//#include +// #include +// #include -//#include -//#include -//#include +// #include +// #include +// #include #include #ifdef XCB_ICCCM_NUM_WM_SIZE_HINTS_ELEMENTS #include @@ -132,10 +132,10 @@ typedef enum #ifdef USE_GLX #include -//#include // For GL_COLOR_BUFFER_BIT -//#include // For GL_COLOR_BUFFER_BIT -//#include -//#include +// #include // For GL_COLOR_BUFFER_BIT +// #include // For GL_COLOR_BUFFER_BIT +// #include +// #include // only for gluErrorString #include #include @@ -146,8 +146,8 @@ typedef enum #include #ifdef CUVID -//#include // For GL_COLOR_BUFFER_BIT -//#include // For GL_COLOR_BUFFER_BIT +// #include // For GL_COLOR_BUFFER_BIT +// #include // For GL_COLOR_BUFFER_BIT #include #include #include @@ -168,7 +168,7 @@ typedef enum #endif #include -//#define EGL_EGLEXT_PROTOTYPES +// #define EGL_EGLEXT_PROTOTYPES #include #include #ifndef GL_OES_EGL_image @@ -332,8 +332,8 @@ typedef struct #define CODEC_SURFACES_MAX 12 // -#define VIDEO_SURFACES_MAX 6 ///< video output surfaces for queue -//#define OUTPUT_SURFACES_MAX 4 ///< output surfaces for flip page +#define VIDEO_SURFACES_MAX 6 ///< video output surfaces for queue +// #define OUTPUT_SURFACES_MAX 4 ///< output surfaces for flip page #ifdef VAAPI #define PIXEL_FORMAT AV_PIX_FMT_VAAPI #define SWAP_BUFFER_SIZE 3 @@ -367,53 +367,53 @@ static unsigned VideoWindowHeight; ///< video output window height static const VideoModule NoopModule; ///< forward definition of noop module - /// selected video module +/// selected video module static const VideoModule *VideoUsedModule = &NoopModule; signed char VideoHardwareDecoder = -1; ///< flag use hardware decoder static char VideoSurfaceModesChanged; ///< flag surface modes changed - /// flag use transparent OSD. +/// flag use transparent OSD. static const char VideoTransparentOsd = 1; static uint32_t VideoBackground; ///< video background color static char VideoStudioLevels; ///< flag use studio levels - /// Default deinterlace mode. +/// Default deinterlace mode. static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax]; - /// Default number of deinterlace surfaces +/// 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]; - /// Default inverse telecine flag (CUVID only). +/// Default inverse telecine flag (CUVID only). static char VideoInverseTelecine[VideoResolutionMax]; - /// Default amount of noise reduction algorithm to apply (0 .. 1000). +/// Default amount of noise reduction algorithm to apply (0 .. 1000). static int VideoDenoise[VideoResolutionMax]; - /// Default amount of sharpening, or blurring, to apply (-1000 .. 1000). +/// Default amount of sharpening, or blurring, to apply (-1000 .. 1000). static int VideoSharpen[VideoResolutionMax]; - /// Default cut top and bottom in pixels +/// Default cut top and bottom in pixels static int VideoCutTopBottom[VideoResolutionMax]; - /// Default cut left and right in pixels +/// Default cut left and right in pixels static int VideoCutLeftRight[VideoResolutionMax]; - /// Default scaling mode +/// Default scaling mode static VideoScalingModes VideoScaling[VideoResolutionMax]; - /// Default audio/video delay +/// Default audio/video delay int VideoAudioDelay; - /// Default zoom mode for 4:3 +/// Default zoom mode for 4:3 static VideoZoomModes Video4to3ZoomMode; - /// Default zoom mode for 16:9 and others +/// Default zoom mode for 16:9 and others static VideoZoomModes VideoOtherZoomMode; static char Video60HzMode; ///< handle 60hz displays @@ -452,9 +452,9 @@ pthread_mutex_t OSDMutex; ///< OSD update mutex static pthread_t VideoDisplayThread; ///< video display thread -//static pthread_cond_t VideoDisplayWakeupCond; ///< wakeup condition variable -//static pthread_mutex_t VideoDisplayMutex; ///< video condition mutex -//static pthread_mutex_t VideoDisplayLockMutex; ///< video lock mutex +// static pthread_cond_t VideoDisplayWakeupCond; ///< wakeup condition variable +// static pthread_mutex_t VideoDisplayMutex; ///< video condition mutex +// static pthread_mutex_t VideoDisplayLockMutex; ///< video lock mutex static int OsdConfigWidth; ///< osd configured width static int OsdConfigHeight; ///< osd configured height @@ -546,21 +546,21 @@ static void VideoSetPts(int64_t * pts_p, int interlaced, const AVCodecContext * // FIXME: using framerate as workaround for av_frame_get_pkt_duration // -// if (video_ctx->framerate.num && video_ctx->framerate.den) { -// duration = 1000 * video_ctx->framerate.den / video_ctx->framerate.num; -// } else { + // if (video_ctx->framerate.num && video_ctx->framerate.den) { + // duration = 1000 * video_ctx->framerate.den / video_ctx->framerate.num; + // } 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 if (*pts_p != (int64_t) AV_NOPTS_VALUE) { *pts_p += duration * 90; //Info("video: %s +pts\n", Timestamp2String(*pts_p)); } - //av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp"); - //pts = frame->best_effort_timestamp; -// pts = frame->pkt_pts; + // av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp"); + // pts = frame->best_effort_timestamp; + // pts = frame->pkt_pts; pts = frame->pts; if (pts == (int64_t) AV_NOPTS_VALUE || !pts) { // libav: 0.8pre didn't set pts @@ -672,7 +672,6 @@ static void VideoUpdateOutput(AVRational input_aspect_ratio, int input_width, in (video_height * display_aspect_ratio.num + display_aspect_ratio.den - 1) / display_aspect_ratio.den; *output_height = (video_width * display_aspect_ratio.den + display_aspect_ratio.num - 1) / display_aspect_ratio.num; -// JOJO if (*output_width > video_width) { *output_width = video_width; *output_y += (video_height - *output_height) / 2; @@ -744,25 +743,25 @@ static uint64_t test_time = 0; #define VideoThreadLock(void)\ {\ if (VideoThread) {\ - if (pthread_mutex_lock(&VideoLockMutex)) {\ - Error(_("video: can't lock thread\n"));\ - }\ + if (pthread_mutex_lock(&VideoLockMutex)) {\ + Error(_("video: can't lock thread\n"));\ + }\ }\ } -// test_time = GetusTicks(); -// printf("Lock start...."); +// test_time = GetusTicks(); +// printf("Lock start...."); /// /// Unlock video thread. /// #define VideoThreadUnlock(void)\ {\ if (VideoThread) {\ - if (pthread_mutex_unlock(&VideoLockMutex)) {\ - Error(_("video: can't unlock thread\n"));\ - }\ - }\ + if (pthread_mutex_unlock(&VideoLockMutex)) {\ + Error(_("video: can't unlock thread\n"));\ + }\ + }\ } -// printf("Video Locked for %d\n",(GetusTicks()-test_time)/1000); +// printf("Video Locked for %d\n",(GetusTicks()-test_time)/1000); //---------------------------------------------------------------------------- // GLX @@ -791,7 +790,7 @@ static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI; GLenum err;\ \ if ((err = glGetError()) != GL_NO_ERROR) {\ - Debug(3, "video/glx: error %s:%d %d '%s'\n",__FILE__,__LINE__, err, gluErrorString(err));\ + Debug(3, "video/glx: error %s:%d %d '%s'\n",__FILE__,__LINE__, err, gluErrorString(err));\ }\ } @@ -840,7 +839,7 @@ char *eglErrorString(EGLint error) EGLint err;\ \ if ((err = eglGetError()) != EGL_SUCCESS) {\ - Debug(3, "video/egl: %s:%d error %d %s\n", __FILE__,__LINE__,err,eglErrorString(err));\ + Debug(3, "video/egl: %s:%d error %d %s\n", __FILE__,__LINE__,err,eglErrorString(err));\ }\ } @@ -849,19 +848,19 @@ char *eglErrorString(EGLint error) void OSD_get_shared_context() { eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext); -// EglCheck(); + // EglCheck(); } void OSD_get_context() { eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, OSDcontext); -// EglCheck(); + // EglCheck(); } void OSD_release_context() { eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); -// EglCheck(); + // EglCheck(); } #endif @@ -968,7 +967,7 @@ static void EglInit(void) return; #endif - //The desired 30-bit color visual + // The desired 30-bit color visual int attributeList10[] = { GLX_DRAWABLE_TYPE, GLX_WINDOW_BIT, GLX_RENDER_TYPE, GLX_RGBA_BIT, @@ -1186,10 +1185,10 @@ static void EglExit(void) // must destroy contet #ifdef CUVID // must destroy glx -// if (glXGetCurrentContext() == glxContext) { + // if (glXGetCurrentContext() == glxContext) { // if currently used, set to none glXMakeCurrent(XlibDisplay, None, NULL); -// } + // } if (OSDcontext) { glXDestroyContext(XlibDisplay, OSDcontext); GlxCheck(); @@ -1342,10 +1341,10 @@ typedef struct _cuvid_decoder_ int SurfacesFree[CODEC_SURFACES_MAX]; /// video surface ring buffer int SurfacesRb[VIDEO_SURFACES_MAX]; -// CUcontext cuda_ctx; + // CUcontext cuda_ctx; -// cudaStream_t stream; // make my own cuda stream -// CUgraphicsResource cuResource; + // cudaStream_t stream; // make my own cuda stream + // CUgraphicsResource cuResource; int SurfaceWrite; ///< write pointer int SurfaceRead; ///< read pointer atomic_t SurfacesFilled; ///< how many of the buffer is used @@ -1406,11 +1405,11 @@ typedef struct priv struct pl_renderer *renderertest; const struct pl_swapchain *swapchain; struct pl_context_params context; -// struct pl_render_target r_target; -// struct pl_render_params r_params; -// struct pl_tex final_fbo; + // struct pl_render_target r_target; + // struct pl_render_params r_params; + // struct pl_tex final_fbo; VkSurfaceKHR pSurface; -// VkSemaphore sig_in; + // VkSemaphore sig_in; int has_dma_buf; } priv; static priv *p; @@ -1420,9 +1419,9 @@ static int semid; struct itimerval itimer; #endif -GLuint vao_buffer; // +GLuint vao_buffer; -//GLuint vao_vao[4]; // +//GLuint vao_vao[4]; GLuint gl_shader = 0, gl_prog = 0, gl_fbo = 0; // shader programm GLint gl_colormatrix, gl_colormatrix_c; GLuint OSDfb = 0; @@ -1619,7 +1618,7 @@ static int CuvidGetVideoSurface0(CuvidDecoder * decoder) int i; if (!decoder->SurfaceFreeN) { -// Error(_("video/cuvid: out of surfaces\n")); + // Error(_("video/cuvid: out of surfaces\n")); return -1; } // use oldest surface @@ -1739,9 +1738,9 @@ static const struct mp_egl_config_attr mp_egl_attribs[] = { }; const int mpgl_preferred_gl_versions[] = { -// 440, -// 430, -// 400, + // 440, + // 430, + // 400, 330, 320, 310, @@ -1923,7 +1922,7 @@ static CuvidDecoder *CuvidNewHwDecoder(VideoStream * stream) int i = 0; -// setenv ("DISPLAY", ":0", 0); + // setenv ("DISPLAY", ":0", 0); Debug(3, "Cuvid New HW Decoder\n"); if ((unsigned)CuvidDecoderN >= sizeof(CuvidDecoders) / sizeof(*CuvidDecoders)) { @@ -1936,8 +1935,8 @@ static CuvidDecoder *CuvidNewHwDecoder(VideoStream * stream) } #endif #ifdef VAAPI + // if ((i = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, ":0.0" , NULL, 0)) != 0 ) { if ((i = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, "/dev/dri/renderD128", NULL, 0)) != 0) { -// if ((i = av_hwdevice_ctx_create(&hw_device_ctx, AV_HWDEVICE_TYPE_VAAPI, ":0.0" , NULL, 0)) != 0 ) { Fatal("codec: can't allocate HW video codec context err %04x", i); } #endif @@ -1952,8 +1951,8 @@ static CuvidDecoder *CuvidNewHwDecoder(VideoStream * stream) decoder->VaDisplay = VaDisplay; #endif decoder->Window = VideoWindow; - //decoder->VideoX = 0; // done by calloc - //decoder->VideoY = 0; + // decoder->VideoX = 0; // done by calloc + // decoder->VideoY = 0; decoder->VideoWidth = VideoWindowWidth; decoder->VideoHeight = VideoWindowHeight; @@ -2049,7 +2048,7 @@ static void CuvidDelHwDecoder(CuvidDecoder * decoder) if (decoder == CuvidDecoders[0]) VideoThreadUnlock(); -// glXMakeCurrent(XlibDisplay, None, NULL); + // glXMakeCurrent(XlibDisplay, None, NULL); for (i = 0; i < CuvidDecoderN; ++i) { if (CuvidDecoders[i] == decoder) { CuvidDecoders[i] = NULL; @@ -2057,7 +2056,7 @@ static void CuvidDelHwDecoder(CuvidDecoder * decoder) if (i < --CuvidDecoderN) { CuvidDecoders[i] = CuvidDecoders[CuvidDecoderN]; } -// CuvidCleanup(decoder); + // CuvidCleanup(decoder); CuvidPrintFrames(decoder); #ifdef CUVID if (decoder->cuda_ctx && CuvidDecoderN == 1) { @@ -2143,7 +2142,7 @@ void generateCUDAImage(CuvidDecoder * decoder, int index, const AVFrame * frame, { int n; - for (n = 0; n < 2; n++) { // + for (n = 0; n < 2; n++) { // widthInBytes must account for the chroma plane // elements being two samples wide. CUDA_MEMCPY2D cpy = { @@ -2172,7 +2171,7 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi struct pl_image *img; struct pl_plane *pl; -//printf("Create textures and planes %d %d\n",size_x,size_y); + // printf("Create textures and planes %d %d\n",size_x,size_y); Debug(3, "video/vulkan: create %d Textures Format %s w %d h %d \n", anz, PixFmt == AV_PIX_FMT_NV12 ? "NV12" : "P010", size_x, size_y); @@ -2192,11 +2191,11 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi size = 2; } if (decoder->pl_images[i].planes[n].texture) { -//#ifdef VAAPI +// #ifdef VAAPI if (decoder->pl_images[i].planes[n].texture->params.shared_mem.handle.fd) { close(decoder->pl_images[i].planes[n].texture->params.shared_mem.handle.fd); } -//#endif +// #endif pl_tex_destroy(p->gpu, &decoder->pl_images[i].planes[n].texture); // delete old texture } @@ -2335,7 +2334,7 @@ void generateVAAPIImage(CuvidDecoder * decoder, int index, const AVFrame * frame }, }; -//printf("vor create Object %d with fd %d import size %u offset %d %dx%d\n",id,fd,size,offset, tex_params.w,tex_params.h); + // printf("vor create Object %d with fd %d import size %u offset %d %dx%d\n",id,fd,size,offset, tex_params.w,tex_params.h); if (decoder->pl_images[index].planes[n].texture) { pl_tex_destroy(p->gpu, &decoder->pl_images[index].planes[n].texture); @@ -2409,21 +2408,21 @@ void createTextureDst(CuvidDecoder * decoder, int anz, unsigned int size_x, unsi #ifdef VAAPI #define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0])) -#define ADD_ATTRIB(name, value) \ - do { \ - assert(num_attribs + 3 < MP_ARRAY_SIZE(attribs)); \ - attribs[num_attribs++] = (name); \ - attribs[num_attribs++] = (value); \ - attribs[num_attribs] = EGL_NONE; \ +#define ADD_ATTRIB(name, value) \ + do { \ + assert(num_attribs + 3 < MP_ARRAY_SIZE(attribs)); \ + attribs[num_attribs++] = (name); \ + attribs[num_attribs++] = (value); \ + attribs[num_attribs] = EGL_NONE; \ } while(0) #define ADD_PLANE_ATTRIBS(plane) do { \ ADD_ATTRIB(EGL_DMA_BUF_PLANE ## plane ## _FD_EXT, \ - desc.objects[desc.layers[n].object_index[plane]].fd); \ + desc.objects[desc.layers[n].object_index[plane]].fd); \ ADD_ATTRIB(EGL_DMA_BUF_PLANE ## plane ## _OFFSET_EXT, \ - desc.layers[n].offset[plane]); \ + desc.layers[n].offset[plane]); \ ADD_ATTRIB(EGL_DMA_BUF_PLANE ## plane ## _PITCH_EXT, \ - desc.layers[n].pitch[plane]); \ + desc.layers[n].pitch[plane]); \ } while (0) void generateVAAPIImage(CuvidDecoder * decoder, int index, const AVFrame * frame, int image_width, int image_height) @@ -2528,12 +2527,12 @@ int push_filters(AVCodecContext * dec_ctx, CuvidDecoder * decoder, AVFrame * fra av_log(NULL, AV_LOG_ERROR, "Error while feeding the filtergraph\n"); } - //printf("Interlaced %d tff %d\n",frame->interlaced_frame,frame->top_field_first); + // printf("Interlaced %d tff %d\n",frame->interlaced_frame,frame->top_field_first); /* pull filtered frames from the filtergraph */ while ((ret = av_buffersink_get_frame(decoder->buffersink_ctx, filt_frame)) >= 0) { filt_frame->pts /= 2; decoder->Interlaced = 0; -// printf("vaapideint video:new %#012" PRIx64 " old %#012" PRIx64 "\n",filt_frame->pts,frame->pts); + // printf("vaapideint video:new %#012" PRIx64 " old %#012" PRIx64 "\n",filt_frame->pts,frame->pts); CuvidSyncRenderFrame(decoder, dec_ctx, filt_frame); filt_frame = av_frame_alloc(); // get new frame @@ -2592,7 +2591,7 @@ int init_filters(AVCodecContext * dec_ctx, CuvidDecoder * decoder, AVFrame * fra src_params->frame_rate.den = 1; src_params->sample_aspect_ratio = dec_ctx->sample_aspect_ratio; -//printf("width %d height %d hw_frames_ctx %p\n",dec_ctx->width,dec_ctx->height ,frame->hw_frames_ctx); + // printf("width %d height %d hw_frames_ctx %p\n",dec_ctx->width,dec_ctx->height ,frame->hw_frames_ctx); ret = av_buffersrc_parameters_set(decoder->buffersrc_ctx, src_params); if (ret < 0) { Debug(3, "Cannot set hw_frames_ctx to src\n"); @@ -2714,7 +2713,7 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder * decoder, AVCodecContex ist->GetFormatDone = 1; - Debug(3, "video: create decoder 16bit?=%d %dx%d old %d %d\n", bitformat16, video_ctx->width, video_ctx->height, + Debug(3, "video: create decoder 16bit?=%d %dx%d old %d %d\n", bitformat16, video_ctx->width, video_ctx->height, decoder->InputWidth, decoder->InputHeight); if (*fmt_idx == PIXEL_FORMAT) { // HWACCEL used @@ -2729,8 +2728,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 @@ -2812,7 +2811,7 @@ int get_RGB(CuvidDecoder * decoder) #ifndef PLACEBO -// eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext); + // eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, eglSharedContext); glGenTextures(1, &texture); GlxCheck(); glBindTexture(GL_TEXTURE_2D, texture); @@ -2860,7 +2859,7 @@ int get_RGB(CuvidDecoder * decoder) GLint texLoc; #ifdef CUVID -// glXMakeCurrent(XlibDisplay, VideoWindow, glxSharedContext); + // glXMakeCurrent(XlibDisplay, VideoWindow, glxSharedContext); GlxCheck(); #endif glEnable(GL_BLEND); @@ -2884,9 +2883,9 @@ int get_RGB(CuvidDecoder * decoder) glUseProgram(0); glActiveTexture(GL_TEXTURE0); #ifdef CUVID -// glXMakeCurrent(XlibDisplay, VideoWindow, glxThreadContext); + // glXMakeCurrent(XlibDisplay, VideoWindow, glxThreadContext); #else -// eglMakeCurrent(eglDisplay, eglSurface,eglSurface, eglThreadContext); + // eglMakeCurrent(eglDisplay, eglSurface,eglSurface, eglThreadContext); #endif } glFlush(); @@ -2992,9 +2991,9 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int if (decoder == NULL) // no video aktiv return NULL; -// surface = CuvidSurfacesRb[CuvidOutputSurfaceIndex]; + // surface = CuvidSurfacesRb[CuvidOutputSurfaceIndex]; - // get real surface size + // get real surface size #ifdef PLACEBO width = decoder->VideoWidth; height = decoder->VideoHeight; @@ -3003,7 +3002,7 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int height = decoder->InputHeight; #endif -// Debug(3, "video/cuvid: grab %dx%d\n", width, height); + // Debug(3, "video/cuvid: grab %dx%d\n", width, height); source_rect.x0 = 0; source_rect.y0 = 0; @@ -3036,7 +3035,7 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int } } -// printf("video/cuvid: grab source dim %dx%d\n", width, height); + // printf("video/cuvid: grab source dim %dx%d\n", width, height); size = width * height * sizeof(uint32_t); @@ -3057,7 +3056,7 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int while (decoder->grab) { usleep(1000); // wait for data } -// Debug(3,"got grab data\n"); + // Debug(3,"got grab data\n"); if (ret_size) { *ret_size = size; @@ -3120,7 +3119,7 @@ static void CuvidQueueVideoSurface(CuvidDecoder * decoder, int surface, int soft return; } // - // Check and release, old surface + // Check and release, old surface // if ((old = decoder->SurfacesRb[decoder->SurfaceWrite]) != -1) { // now we can release the surface, software surfaces only @@ -3172,7 +3171,7 @@ static void CuvidRenderFrame(CuvidDecoder * decoder, const AVCodecContext * vide Debug(3, "video/vdpau: aspect ratio changed\n"); decoder->InputAspect = frame->sample_aspect_ratio; -//printf("new aspect %d:%d\n",frame->sample_aspect_ratio.num,frame->sample_aspect_ratio.den); + // printf("new aspect %d:%d\n",frame->sample_aspect_ratio.num,frame->sample_aspect_ratio.den); CuvidUpdateOutput(decoder); } @@ -3185,9 +3184,9 @@ static void CuvidRenderFrame(CuvidDecoder * decoder, const AVCodecContext * vide // if ( // decoder->PixFmt != video_ctx->pix_fmt video_ctx->width != decoder->InputWidth -// || decoder->ColorSpace != color + // || 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->InputWidth = video_ctx->width; decoder->InputHeight = video_ctx->height; @@ -3236,7 +3235,7 @@ static void CuvidRenderFrame(CuvidDecoder * decoder, const AVCodecContext * vide output = av_frame_alloc(); av_hwframe_transfer_data(output, frame, 0); av_frame_copy_props(output, frame); -// printf("Save Surface ID %d %p %p\n",surface,decoder->pl_images[surface].planes[0].texture,decoder->pl_images[surface].planes[1].texture); + // printf("Save Surface ID %d %p %p\n",surface,decoder->pl_images[surface].planes[0].texture,decoder->pl_images[surface].planes[1].texture); bool ok = pl_tex_upload(p->gpu, &(struct pl_tex_transfer_params) { .tex = decoder->pl_images[surface].planes[0].texture, .stride_w = output->linesize[0], @@ -3287,7 +3286,7 @@ static void *CuvidGetHwAccelContext(CuvidDecoder * decoder) unsigned int version; Debug(3, "Initializing cuvid hwaccel thread ID:%ld\n", (long int)syscall(186)); -//turn NULL; + // turn NULL; #ifdef CUVID if (decoder->cuda_ctx) { Debug(3, "schon passiert\n"); @@ -3345,9 +3344,9 @@ static void CuvidAdvanceDecoderFrame(CuvidDecoder * decoder) // keep use of last surface ++decoder->FramesDuped; // FIXME: don't warn after stream start, don't warn during pause -// printf("video: display buffer empty, duping frame (%d/%d) %d\n", -// decoder->FramesDuped, decoder->FrameCounter, -// VideoGetBuffers(decoder->Stream)); + // printf("video: display buffer empty, duping frame (%d/%d) %d\n", + // decoder->FramesDuped, decoder->FrameCounter, + // VideoGetBuffers(decoder->Stream)); return; } @@ -3470,10 +3469,10 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused)) case AVCOL_SPC_UNSPECIFIED: // comes with UHD img->repr.sys = PL_COLOR_SYSTEM_BT_709; memcpy(&img->color, &pl_color_space_bt709, sizeof(struct pl_color_space)); -// img->color.primaries = PL_COLOR_PRIM_BT_709; -// img->color.transfer = PL_COLOR_TRC_BT_1886; -// img->color.light = PL_COLOR_LIGHT_SCENE_709_1886; -// img->color.light = PL_COLOR_LIGHT_DISPLAY; + // img->color.primaries = PL_COLOR_PRIM_BT_709; + // img->color.transfer = PL_COLOR_TRC_BT_1886; + // img->color.light = PL_COLOR_LIGHT_SCENE_709_1886; + // img->color.light = PL_COLOR_LIGHT_DISPLAY; break; case AVCOL_SPC_BT2020_NCL: @@ -3485,22 +3484,22 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused)) #ifdef VAAPI render_params.peak_detect_params = NULL; #endif -// img->color.primaries = PL_COLOR_PRIM_BT_2020; -// img->color.transfer = PL_COLOR_TRC_HLG; -// img->color.light = PL_COLOR_LIGHT_SCENE_HLG; + // img->color.primaries = PL_COLOR_PRIM_BT_2020; + // img->color.transfer = PL_COLOR_TRC_HLG; + // img->color.light = PL_COLOR_LIGHT_SCENE_HLG; break; default: // fallback img->repr.sys = PL_COLOR_SYSTEM_BT_709; memcpy(&img->color, &pl_color_space_bt709, sizeof(struct pl_color_space)); -// img->color.primaries = PL_COLOR_PRIM_BT_709; -// img->color.transfer = PL_COLOR_TRC_BT_1886; -// img->color.light = PL_COLOR_LIGHT_DISPLAY; + // img->color.primaries = PL_COLOR_PRIM_BT_709; + // img->color.transfer = PL_COLOR_TRC_BT_1886; + // img->color.light = PL_COLOR_LIGHT_DISPLAY; break; } // Source crop if (VideoScalerTest) { // right side defnied scaler -// pl_tex_clear(p->gpu,target->fbo,(float[4]){0}); // clear frame + // pl_tex_clear(p->gpu,target->fbo,(float[4]){0}); // clear frame img->src_rect.x0 = video_src_rect.x1 / 2 + 1; img->src_rect.y0 = video_src_rect.y0; img->src_rect.x1 = video_src_rect.x1; @@ -3551,7 +3550,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, __attribute__((unused)) render_params.cone_params = NULL; } -// render_params.upscaler = &pl_filter_ewa_lanczos; + // render_params.upscaler = &pl_filter_ewa_lanczos; render_params.upscaler = pl_named_filters[VideoScaling[decoder->Resolution]].filter; render_params.downscaler = pl_named_filters[VideoScaling[decoder->Resolution]].filter; @@ -3722,10 +3721,10 @@ static void CuvidDisplayFrame(void) #if 1 diff = (GetusTicks() - last_time) / 1000; -// last_time = GetusTicks(); -//printf("Roundtrip Displayframe %d\n",diff); + // last_time = GetusTicks(); + // printf("Roundtrip Displayframe %d\n",diff); if (diff < 15000 && diff > 0) { -//printf("Sleep %d\n",15000-diff); + // printf("Sleep %d\n",15000-diff); usleep((15000 - diff)); // * 1000); } @@ -3733,17 +3732,17 @@ static void CuvidDisplayFrame(void) if (!p->swapchain) return; -//last_time = GetusTicks(); + // last_time = GetusTicks(); #ifdef CUVID - //first_time = GetusTicks(); + // first_time = GetusTicks(); VideoThreadLock(); if (!first) { -// last_time = GetusTicks(); + // last_time = GetusTicks(); if (!pl_swapchain_submit_frame(p->swapchain)) Error(_("Failed to submit swapchain buffer\n")); pl_swapchain_swap_buffers(p->swapchain); // swap buffers -// printf("submit and swap %d\n",(GetusTicks()-last_time)/1000000); + // printf("submit and swap %d\n",(GetusTicks()-last_time)/1000000); } #endif @@ -3782,9 +3781,9 @@ static void CuvidDisplayFrame(void) else target.repr.levels = PL_COLOR_LEVELS_TV; target.repr.alpha = PL_ALPHA_UNKNOWN; -// target.repr.bits.sample_depth = 16; -// target.repr.bits.color_depth = 16; -// target.repr.bits.bit_shift =0; + // target.repr.bits.sample_depth = 16; + // target.repr.bits.color_depth = 16; + // target.repr.bits.bit_shift =0; switch (VulkanTargetColorSpace) { case 0: @@ -3877,7 +3876,7 @@ static void CuvidDisplayFrame(void) GlxCheck(); #endif #ifdef VAAPI -// eglMakeCurrent(eglDisplay, eglSurface, eglSurface, OSDcontext); + // eglMakeCurrent(eglDisplay, eglSurface, eglSurface, OSDcontext); #endif glEnable(GL_BLEND); GlxCheck(); @@ -3905,21 +3904,21 @@ static void CuvidDisplayFrame(void) glXMakeCurrent(XlibDisplay, VideoWindow, glxThreadContext); #endif #ifdef VAAPI -// eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext); + // eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglThreadContext); #endif } #endif #ifdef PLACEBO #ifdef VAAPI - // first_time = GetusTicks(); + // first_time = GetusTicks(); if (!pl_swapchain_submit_frame(p->swapchain)) Fatal(_("Failed to submit swapchain buffer\n")); pl_swapchain_swap_buffers(p->swapchain); // swap buffers - // printf("submit and swap %d us\n",(GetusTicks()-first_time)/1000); + // printf("submit and swap %d us\n",(GetusTicks()-first_time)/1000); #endif VideoThreadUnlock(); -// printf("Display time %d\n",(GetusTicks()-first_time)/1000000); + // printf("Display time %d\n",(GetusTicks()-first_time)/1000000); #else #ifdef CUVID glXGetVideoSyncSGI(&Count); // get current frame @@ -4053,7 +4052,7 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) int err = 0; static uint64_t last_time; -// video_clock = CuvidGetClock(decoder); + // video_clock = CuvidGetClock(decoder); video_clock = decoder->PTS - (90 * 20 * 1); // 1 Frame in Output filled = atomic_read(&decoder->SurfacesFilled); @@ -4063,7 +4062,7 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) goto skip_sync; } audio_clock = AudioGetClock(); -//printf("Diff %d %ld %ld filled %d \n",(video_clock - audio_clock - VideoAudioDelay)/90,video_clock,audio_clock,filled); + // printf("Diff %d %ld %ld filled %d \n",(video_clock - audio_clock - VideoAudioDelay)/90,video_clock,audio_clock,filled); // 60Hz: repeat every 5th field if (Video60HzMode && !(decoder->FramesDisplayed % 6)) { if (audio_clock == (int64_t) AV_NOPTS_VALUE || video_clock == (int64_t) AV_NOPTS_VALUE) { @@ -4105,19 +4104,19 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) diff = (decoder->LastAVDiff + diff) / 2; decoder->LastAVDiff = diff; -// if (CuvidDecoderN) { -// CuvidDecoders[0]->Frameproc = (float)(diff / 90); -// } + // if (CuvidDecoderN) { + // CuvidDecoders[0]->Frameproc = (float)(diff / 90); + // } #if 0 if (abs(diff / 90) > 0) { - printf(" Diff %d filled %d \n", diff / 90, filled); + printf(" Diff %d filled %d \n", diff / 90, filled); } #endif if (abs(diff) > 5000 * 90) { // more than 5s err = CuvidMessage(2, "video: audio/video difference too big\n"); -// decoder->SyncCounter = 1; -// usleep(10); -// goto out; + // decoder->SyncCounter = 1; + // usleep(10); + // goto out; } else if (diff > 100 * 90) { // FIXME: this quicker sync step, did not work with new code! err = CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90); @@ -4154,8 +4153,6 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) skip_sync: // check if next field is available -//JOJO if (decoder->SurfaceField && filled <= 1 + 2 * decoder->Interlaced) { - if (decoder->SurfaceField && filled <= 1 + 2 * decoder->Interlaced) { if (filled < 1 + 2 * decoder->Interlaced) { ++decoder->FramesDuped; @@ -4171,8 +4168,8 @@ static void CuvidSyncDecoder(CuvidDecoder * decoder) } #endif } -// Debug(3,"filled zu klein %d Field %d Interlaced %d\n",filled,decoder->SurfaceField,decoder->Interlaced); -// goto out; + // Debug(3,"filled zu klein %d Field %d Interlaced %d\n",filled,decoder->SurfaceField,decoder->Interlaced); + // goto out; } CuvidAdvanceDecoderFrame(decoder); @@ -4252,8 +4249,8 @@ static void CuvidSyncRenderFrame(CuvidDecoder * decoder, const AVCodecContext * } // if (!decoder->Closing) { -// VideoSetPts(&decoder->PTS, decoder->Interlaced, video_ctx, frame); -// } + // VideoSetPts(&decoder->PTS, decoder->Interlaced, video_ctx, frame); + // } CuvidRenderFrame(decoder, video_ctx, frame); } @@ -4320,7 +4317,7 @@ static void CuvidDisplayHandlerThread(void) // fill frame output ring buffer // filled = atomic_read(&decoder->SurfacesFilled); -//if (filled <= 1 + 2 * decoder->Interlaced) { + //if (filled <= 1 + 2 * decoder->Interlaced) { if (filled < 4) { // FIXME: hot polling // fetch+decode or reopen @@ -4436,14 +4433,14 @@ static const VideoModule CuvidModule = { .SetVideoMode = CuvidSetVideoMode, .DisplayHandlerThread = CuvidDisplayHandlerThread, -// .OsdClear = GlxOsdClear, -// .OsdDrawARGB = GlxOsdDrawARGB, -// .OsdInit = GlxOsdInit, -// .OsdExit = GlxOsdExit, -// .OsdClear = CuvidOsdClear, -// .OsdDrawARGB = CuvidOsdDrawARGB, -// .OsdInit = CuvidOsdInit, -// .OsdExit = CuvidOsdExit, + // .OsdClear = GlxOsdClear, + // .OsdDrawARGB = GlxOsdDrawARGB, + // .OsdInit = GlxOsdInit, + // .OsdExit = GlxOsdExit, + // .OsdClear = CuvidOsdClear, + // .OsdDrawARGB = CuvidOsdDrawARGB, + // .OsdInit = CuvidOsdInit, + // .OsdExit = CuvidOsdExit, .Exit = CuvidExit, .Init = CuvidGlxInit, }; @@ -4560,7 +4557,7 @@ static void NoopDisplayHandlerThread(void) #else -#define NoopDisplayHandlerThread NULL +#define NoopDisplayHandlerThread NULL #endif @@ -4630,7 +4627,7 @@ void VideoOsdClear(void) OsdShown = 0; #else VideoThreadLock(); -// VideoUsedModule->OsdClear(); + // VideoUsedModule->OsdClear(); OsdDirtyX = OsdWidth; // reset dirty area OsdDirtyY = OsdHeight; OsdDirtyWidth = 0; @@ -4829,20 +4826,20 @@ static void VideoEvent(void) case MapNotify: Debug(3, "video/event: MapNotify\n"); - // �wm workaround + // wm workaround VideoThreadLock(); xcb_change_window_attributes(Connection, VideoWindow, XCB_CW_CURSOR, &VideoBlankCursor); VideoThreadUnlock(); VideoBlankTick = 0; break; case Expose: - //Debug(3, "video/event: Expose\n"); + // Debug(3, "video/event: Expose\n"); break; case ReparentNotify: Debug(3, "video/event: ReparentNotify\n"); break; case ConfigureNotify: - //Debug(3, "video/event: ConfigureNotify\n"); + // Debug(3, "video/event: ConfigureNotify\n"); VideoSetVideoMode(event.xconfigure.x, event.xconfigure.y, event.xconfigure.width, event.xconfigure.height); break; case ButtonPress: @@ -4966,7 +4963,7 @@ void delete_placebo() vkDestroySurfaceKHR(p->vk_inst->instance, p->pSurface, NULL); pl_vk_inst_destroy(&p->vk_inst); -// pl_vulkan_destroy(&p->vk); + // pl_vulkan_destroy(&p->vk); pl_context_destroy(&p->ctx); free(p); p = NULL; @@ -4999,7 +4996,7 @@ void InitPlacebo() // create Vulkan instance memcpy(&iparams, &pl_vk_inst_default_params, sizeof(iparams)); -// iparams.debug = true; + // iparams.debug = true; iparams.num_extensions = 2; iparams.extensions = malloc(2 * sizeof(const char *)); *iparams.extensions = surfext; @@ -5130,10 +5127,10 @@ static void *VideoHandlerThread(void *dummy) VideoPollEvent(); -// first_time = GetusTicks(); + // first_time = GetusTicks(); CuvidSyncDisplayFrame(); -// printf("syncdisplayframe exec %d\n",(GetusTicks()-first_time)/1000); + // printf("syncdisplayframe exec %d\n",(GetusTicks()-first_time)/1000); } pthread_cleanup_pop(NULL); @@ -5290,9 +5287,9 @@ void VideoDelHwDecoder(VideoHwDecoder * hw_decoder) } #endif // only called from inside the thread - //VideoThreadLock(); + // VideoThreadLock(); VideoUsedModule->DelHwDecoder(hw_decoder); - //VideoThreadUnlock(); + // VideoThreadUnlock(); } } @@ -5573,7 +5570,7 @@ uint8_t *VideoGrab(int *size, int *width, int *height, int write_header) /// uint8_t *VideoGrabService(int *size, int *width, int *height) { -// Debug(3, "video: grab service\n"); + // Debug(3, "video: grab service\n"); #ifdef USE_GRAB if (VideoUsedModule->GrabOutput) { @@ -5746,11 +5743,11 @@ static void X11DPMSReenable(xcb_connection_t * connection) #else - /// dummy function: Suspend X11 screen saver. +/// dummy function: Suspend X11 screen saver. #define X11SuspendScreenSaver(connection, suspend) - /// dummy function: Disable X11 DPMS. +/// dummy function: Disable X11 DPMS. #define X11DPMSDisable(connection) - /// dummy function: Reenable X11 DPMS. +/// dummy function: Reenable X11 DPMS. #define X11DPMSReenable(connection) #endif @@ -6456,7 +6453,7 @@ void VideoInit(const char *display_name) return; } // prefetch extensions - //xcb_prefetch_extension_data(Connection, &xcb_big_requests_id); + // xcb_prefetch_extension_data(Connection, &xcb_big_requests_id); #ifdef xcb_USE_GLX xcb_prefetch_extension_data(Connection, &xcb_glx_id); #endif @@ -6575,7 +6572,7 @@ void VideoExit(void) // // FIXME: cleanup. // - //RandrExit(); + // RandrExit(); // // X11/xcb cleanup diff --git a/video.h b/video.h index b478b11..84a81c1 100644 --- a/video.h +++ b/video.h @@ -30,10 +30,10 @@ // Typedefs //---------------------------------------------------------------------------- - /// Video hardware decoder typedef +/// Video hardware decoder typedef typedef struct _video_hw_decoder_ VideoHwDecoder; - /// Video output stream typedef +/// Video output stream typedef typedef struct __video_stream__ VideoStream; //---------------------------------------------------------------------------- @@ -49,179 +49,179 @@ extern char ConfigStartX11Server; ///< flag start the x11 server // Prototypes //---------------------------------------------------------------------------- - /// Allocate new video hardware decoder. +/// Allocate new video hardware decoder. extern VideoHwDecoder *VideoNewHwDecoder(VideoStream *); - /// Deallocate video hardware decoder. +/// Deallocate video hardware decoder. extern void VideoDelHwDecoder(VideoHwDecoder *); - /// Get and allocate a video hardware surface. +/// Get and allocate a video hardware surface. extern unsigned VideoGetSurface(VideoHwDecoder *, const AVCodecContext *); - /// Release a video hardware surface +/// Release a video hardware surface extern void VideoReleaseSurface(VideoHwDecoder *, unsigned); - /// Callback to negotiate the PixelFormat. +/// Callback to negotiate the PixelFormat. extern enum AVPixelFormat Video_get_format(VideoHwDecoder *, AVCodecContext *, const enum AVPixelFormat *); - /// Render a ffmpeg frame. +/// Render a ffmpeg frame. extern void VideoRenderFrame(VideoHwDecoder *, const AVCodecContext *, const AVFrame *); - /// Get hwaccel context for ffmpeg. +/// Get hwaccel context for ffmpeg. extern void *VideoGetHwAccelContext(VideoHwDecoder *); #ifdef AVCODEC_VDPAU_H - /// Draw vdpau render state. +/// Draw vdpau render state. extern void VideoDrawRenderState(VideoHwDecoder *, struct vdpau_render_state *); #endif #ifdef USE_OPENGLOSD - /// Set callback funktion to notify VDR about VideoEvents +/// Set callback funktion to notify VDR about VideoEvents extern void VideoSetVideoEventCallback(void (*)(void)); #endif - /// Poll video events. +/// Poll video events. extern void VideoPollEvent(void); - /// Wakeup display handler. +/// Wakeup display handler. extern void VideoDisplayWakeup(void); - /// Set video device. +/// Set video device. extern void VideoSetDevice(const char *); - /// Get video driver name. +/// Get video driver name. extern const char *VideoGetDriverName(void); - /// Set video geometry. +/// Set video geometry. extern int VideoSetGeometry(const char *); - /// Set 60Hz display mode. +/// Set 60Hz display mode. extern void VideoSet60HzMode(int); - /// Set soft start audio/video sync. +/// Set soft start audio/video sync. extern void VideoSetSoftStartSync(int); - /// Set show black picture during channel switch. +/// Set show black picture during channel switch. extern void VideoSetBlackPicture(int); - /// Set brightness adjustment. +/// Set brightness adjustment. extern void VideoSetBrightness(int); - /// Set contrast adjustment. +/// Set contrast adjustment. extern void VideoSetContrast(int); - /// Set saturation adjustment. +/// Set saturation adjustment. extern void VideoSetSaturation(int); - /// Set Gamm. +/// Set Gamma. extern void VideoSetGamma(int); - /// Set ColorSpace. +/// Set ColorSpace. extern void VideoSetTargetColor(int); - /// Set hue adjustment. +/// Set hue adjustment. extern void VideoSetHue(int); - /// Set Color Blindness. +/// Set Color Blindness. extern void VideoSetColorBlindness(int); - /// Set Color Blindness Faktor +/// Set Color Blindness Faktor extern void VideoSetColorBlindnessFaktor(int); - /// Set video output position. +/// Set video output position. extern void VideoSetOutputPosition(VideoHwDecoder *, int, int, int, int); - /// Set video mode. +/// Set video mode. extern void VideoSetVideoMode(int, int, int, int); - /// Set 4:3 display format. +/// Set 4:3 display format. extern void VideoSet4to3DisplayFormat(int); - /// Set other display format. +/// Set other display format. extern void VideoSetOtherDisplayFormat(int); - /// Set video fullscreen mode. +/// Set video fullscreen mode. extern void VideoSetFullscreen(int); - /// Set deinterlace. +/// Set deinterlace. extern void VideoSetDeinterlace(int[]); - /// Set skip chroma deinterlace. +/// Set skip chroma deinterlace. extern void VideoSetSkipChromaDeinterlace(int[]); - /// Set inverse telecine. +/// Set inverse telecine. extern void VideoSetInverseTelecine(int[]); - /// Set scaling. +/// Set scaling. extern void VideoSetScaling(int[]); - /// Set scaler test. +/// Set scaler test. extern void VideoSetScalerTest(int); - /// Set denoise. +/// Set denoise. extern void VideoSetDenoise(int[]); - /// Set sharpen. +/// Set sharpen. extern void VideoSetSharpen(int[]); - /// Set cut top and bottom. +/// Set cut top and bottom. extern void VideoSetCutTopBottom(int[]); - /// Set cut left and right. +/// Set cut left and right. extern void VideoSetCutLeftRight(int[]); - /// Set studio levels. +/// Set studio levels. extern void VideoSetStudioLevels(int); - /// Set background. +/// Set background. extern void VideoSetBackground(uint32_t); - /// Set audio delay. +/// Set audio delay. extern void VideoSetAudioDelay(int); - /// Set auto-crop parameters. +/// Set auto-crop parameters. extern void VideoSetAutoCrop(int, int, int); - /// Clear OSD. +/// Clear OSD. extern void VideoOsdClear(void); - /// Draw an OSD ARGB image. +/// Draw an OSD ARGB image. extern void VideoOsdDrawARGB(int, int, int, int, int, const uint8_t *, int, int); - /// Get OSD size. +/// Get OSD size. extern void VideoGetOsdSize(int *, int *); - /// Set OSD size. +/// Set OSD size. extern void VideoSetOsdSize(int, int); - /// Set Osd 3D Mode +/// Set Osd 3D Mode extern void VideoSetOsd3DMode(int); - /// Set video clock. +/// Set video clock. extern void VideoSetClock(VideoHwDecoder *, int64_t); - /// Get video clock. +/// Get video clock. extern int64_t VideoGetClock(const VideoHwDecoder *); - /// Set closing flag. +/// Set closing flag. extern void VideoSetClosing(VideoHwDecoder *); - /// Reset start of frame counter +/// Reset start of frame counter extern void VideoResetStart(VideoHwDecoder *); - /// Set trick play speed. +/// Set trick play speed. extern void VideoSetTrickSpeed(VideoHwDecoder *, int); - /// Grab screen. +/// Grab screen. extern uint8_t *VideoGrab(int *, int *, int *, int); - /// Grab screen raw. +/// Grab screen raw. extern uint8_t *VideoGrabService(int *, int *, int *); - /// Get decoder statistics. +/// Get decoder statistics. extern void VideoGetStats(VideoHwDecoder *, int *, int *, int *, int *, float *); - /// Get video stream size +/// Get video stream size extern void VideoGetVideoSize(VideoHwDecoder *, int *, int *, int *, int *); extern void VideoOsdInit(void); ///< Setup osd. @@ -230,19 +230,19 @@ extern void VideoOsdExit(void); ///< Cleanup osd. extern void VideoInit(const char *); ///< Setup video module. extern void VideoExit(void); ///< Cleanup and exit video module. - /// Poll video input buffers. +/// Poll video input buffers. extern int VideoPollInput(VideoStream *); - /// Decode video input buffers. +/// Decode video input buffers. extern int VideoDecodeInput(VideoStream *); - /// Get number of input buffers. +/// Get number of input buffers. extern int VideoGetBuffers(const VideoStream *); - /// Set DPMS at Blackscreen switch +/// Set DPMS at Blackscreen switch extern void SetDPMSatBlackScreen(int); - /// Raise the frontend window +/// Raise the frontend window extern int VideoRaiseWindow(void); #ifdef USE_OPENGLOSD