mirror of
				https://github.com/jojo61/vdr-plugin-softhdcuvid.git
				synced 2025-03-01 10:39:28 +00:00 
			
		
		
		
	Compare commits
	
		
			8 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 2c8e75e3ff | ||
|  | e3fe68d7e6 | ||
|  | 41da5ca526 | ||
|  | 68fc7e4511 | ||
|  | 46df18afe0 | ||
|  | 0ff83f0e31 | ||
|  | 230bb5ca11 | ||
|  | f026e8e86d | 
							
								
								
									
										4
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								Makefile
									
									
									
									
									
								
							| @@ -113,8 +113,8 @@ TMPDIR ?= /tmp | |||||||
|  |  | ||||||
| ### The compiler options: | ### The compiler options: | ||||||
|  |  | ||||||
| export CFLAGS	= $(call PKGCFG,cflags) | export CFLAGS	= $(call PKGCFG,cflags) -fpermissive | ||||||
| export CXXFLAGS = $(call PKGCFG,cxxflags) | export CXXFLAGS = $(call PKGCFG,cxxflags) -fpermissive | ||||||
|  |  | ||||||
| ifeq ($(CFLAGS),) | ifeq ($(CFLAGS),) | ||||||
| $(warning CFLAGS not set) | $(warning CFLAGS not set) | ||||||
|   | |||||||
| @@ -251,8 +251,8 @@ Setup: /etc/vdr/setup.conf | |||||||
| 	(Red * 65536 +  Green * 256 + Blue) | 	(Red * 65536 +  Green * 256 + Blue) | ||||||
|  |  | ||||||
| 	softhddevice.StudioLevels = 0 | 	softhddevice.StudioLevels = 0 | ||||||
| 		0 use PC levels (0-255) with vdpau. | 	0 use limited RGB (16-235) with vdpau. | ||||||
| 		1 use studio levels (16-235) with vdpau. | 	1 use full RGB (0-255) with vdpau. | ||||||
|  |  | ||||||
| 	softhddevice.Suspend.Close = 0 | 	softhddevice.Suspend.Close = 0 | ||||||
| 	1 suspend closes x11 window, connection and audio device. | 	1 suspend closes x11 window, connection and audio device. | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								audio.c
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								audio.c
									
									
									
									
									
								
							| @@ -2283,26 +2283,31 @@ found: | |||||||
|                                 AudioChannelMatrix[u][chan] = 4; |                                 AudioChannelMatrix[u][chan] = 4; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|  |                             __attribute__ ((fallthrough)); | ||||||
|                         case 4: |                         case 4: | ||||||
|                             if (AudioChannelsInHw[5]) { |                             if (AudioChannelsInHw[5]) { | ||||||
|                                 AudioChannelMatrix[u][chan] = 5; |                                 AudioChannelMatrix[u][chan] = 5; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|  |                             __attribute__ ((fallthrough)); | ||||||
|                         case 5: |                         case 5: | ||||||
|                             if (AudioChannelsInHw[6]) { |                             if (AudioChannelsInHw[6]) { | ||||||
|                                 AudioChannelMatrix[u][chan] = 6; |                                 AudioChannelMatrix[u][chan] = 6; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|  |                             __attribute__ ((fallthrough)); | ||||||
|                         case 6: |                         case 6: | ||||||
|                             if (AudioChannelsInHw[7]) { |                             if (AudioChannelsInHw[7]) { | ||||||
|                                 AudioChannelMatrix[u][chan] = 7; |                                 AudioChannelMatrix[u][chan] = 7; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|  |                             __attribute__ ((fallthrough)); | ||||||
|                         case 7: |                         case 7: | ||||||
|                             if (AudioChannelsInHw[8]) { |                             if (AudioChannelsInHw[8]) { | ||||||
|                                 AudioChannelMatrix[u][chan] = 8; |                                 AudioChannelMatrix[u][chan] = 8; | ||||||
|                                 break; |                                 break; | ||||||
|                             } |                             } | ||||||
|  |                             __attribute__ ((fallthrough)); | ||||||
|                         case 8: |                         case 8: | ||||||
|                             if (AudioChannelsInHw[6]) { |                             if (AudioChannelsInHw[6]) { | ||||||
|                                 AudioChannelMatrix[u][chan] = 6; |                                 AudioChannelMatrix[u][chan] = 6; | ||||||
|   | |||||||
							
								
								
									
										46
									
								
								codec.c
									
									
									
									
									
								
							
							
						
						
									
										46
									
								
								codec.c
									
									
									
									
									
								
							| @@ -125,7 +125,7 @@ struct _video_decoder_ | |||||||
| */ | */ | ||||||
| static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) { | static enum AVPixelFormat Codec_get_format(AVCodecContext *video_ctx, const enum AVPixelFormat *fmt) { | ||||||
|     VideoDecoder *decoder; |     VideoDecoder *decoder; | ||||||
|     enum AVPixelFormat fmt1; |  | ||||||
|  |  | ||||||
|     decoder = video_ctx->opaque; |     decoder = video_ctx->opaque; | ||||||
|     // bug in ffmpeg 1.1.1, called with zero width or height |     // bug in ffmpeg 1.1.1, called with zero width or height | ||||||
| @@ -208,9 +208,13 @@ void CodecVideoDelDecoder(VideoDecoder *decoder) { free(decoder); } | |||||||
| **  @param codec_id video codec id | **  @param codec_id video codec id | ||||||
| */ | */ | ||||||
| void CodecVideoOpen(VideoDecoder *decoder, int codec_id) { | void CodecVideoOpen(VideoDecoder *decoder, int codec_id) { | ||||||
|  | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) | ||||||
|     AVCodec *video_codec; |     AVCodec *video_codec; | ||||||
|  | #else | ||||||
|  |     const AVCodec *video_codec; | ||||||
|  | #endif | ||||||
|     const char *name; |     const char *name; | ||||||
|     int ret, deint = 2; |     int ret; | ||||||
|  |  | ||||||
|     Debug(3, "***************codec: Video Open using video codec ID %#06x (%s)\n", codec_id, |     Debug(3, "***************codec: Video Open using video codec ID %#06x (%s)\n", codec_id, | ||||||
|           avcodec_get_name(codec_id)); |           avcodec_get_name(codec_id)); | ||||||
| @@ -265,9 +269,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) { | |||||||
|  |  | ||||||
|     pthread_mutex_lock(&CodecLockMutex); |     pthread_mutex_lock(&CodecLockMutex); | ||||||
|     // open codec |     // open codec | ||||||
| #ifdef YADIF |  | ||||||
|     deint = 2; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined VAAPI | #if defined VAAPI | ||||||
| #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100) | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,8,100) | ||||||
| @@ -305,6 +307,7 @@ void CodecVideoOpen(VideoDecoder *decoder, int codec_id) { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|  |     int deint = 2; | ||||||
|     if (strcmp(decoder->VideoCodec->long_name, |     if (strcmp(decoder->VideoCodec->long_name, | ||||||
|                "Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken |                "Nvidia CUVID MPEG2VIDEO decoder") == 0) { // deinterlace for mpeg2 is somehow broken | ||||||
|         if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", deint, 0) < 0) { // adaptive |         if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", deint, 0) < 0) { // adaptive | ||||||
| @@ -389,15 +392,19 @@ void CodecVideoClose(VideoDecoder *video_decoder) { | |||||||
|     Debug(3, "CodecVideoClose\n"); |     Debug(3, "CodecVideoClose\n"); | ||||||
|     if (video_decoder->VideoCtx) { |     if (video_decoder->VideoCtx) { | ||||||
|         pthread_mutex_lock(&CodecLockMutex); |         pthread_mutex_lock(&CodecLockMutex); | ||||||
| #if 1 |  | ||||||
|         frame = av_frame_alloc(); |         frame = av_frame_alloc(); | ||||||
|         avcodec_send_packet(video_decoder->VideoCtx, NULL); |         avcodec_send_packet(video_decoder->VideoCtx, NULL); | ||||||
|         while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0) |         while (avcodec_receive_frame(video_decoder->VideoCtx, frame) >= 0) | ||||||
|             ; |             ; | ||||||
|         av_frame_free(&frame); |         av_frame_free(&frame); | ||||||
|  |  | ||||||
|  | #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100) | ||||||
|  | 	    avcodec_close(video_decoder->VideoCtx); | ||||||
|  | 	    av_freep(&video_decoder->VideoCtx); | ||||||
|  | #else | ||||||
|  | 	    avcodec_free_context(&video_decoder->VideoCtx); | ||||||
| #endif | #endif | ||||||
|         avcodec_close(video_decoder->VideoCtx); |  | ||||||
|         av_freep(&video_decoder->VideoCtx); |  | ||||||
|         pthread_mutex_unlock(&CodecLockMutex); |         pthread_mutex_unlock(&CodecLockMutex); | ||||||
|     } |     } | ||||||
| } | } | ||||||
| @@ -513,7 +520,7 @@ void CodecVideoDecode(VideoDecoder *decoder, const AVPacket *avpkt) { | |||||||
|     int ret, ret1; |     int ret, ret1; | ||||||
|     int got_frame; |     int got_frame; | ||||||
|     int consumed = 0; |     int consumed = 0; | ||||||
|     static uint64_t first_time = 0; |     //static uint64_t first_time = 0; | ||||||
|     const AVPacket *pkt; |     const AVPacket *pkt; | ||||||
|  |  | ||||||
| next_part: | next_part: | ||||||
| @@ -541,7 +548,7 @@ next_part: | |||||||
|             frame = av_frame_alloc(); |             frame = av_frame_alloc(); | ||||||
|             ret = avcodec_receive_frame(video_ctx, frame); // get new frame |             ret = avcodec_receive_frame(video_ctx, frame); // get new frame | ||||||
|             if (ret >= 0) {                                // one is avail. |             if (ret >= 0) {                                // one is avail. | ||||||
|             first_time = frame->pts; |                 //first_time = frame->pts; | ||||||
|                 got_frame = 1; |                 got_frame = 1; | ||||||
|             } else { |             } else { | ||||||
|                 got_frame = 0; |                 got_frame = 0; | ||||||
| @@ -615,7 +622,11 @@ typedef struct _audio_decoder_ AudioDecoder; | |||||||
| /// Audio decoder structure. | /// Audio decoder structure. | ||||||
| /// | /// | ||||||
| struct _audio_decoder_ { | struct _audio_decoder_ { | ||||||
|     AVCodec *AudioCodec;      ///< audio codec | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) | ||||||
|  |     AVCodec *AudioCodec;		///< audio codec | ||||||
|  | #else | ||||||
|  |     const AVCodec *AudioCodec;		///< audio codec | ||||||
|  | #endif | ||||||
|     AVCodecContext *AudioCtx; ///< audio codec context |     AVCodecContext *AudioCtx; ///< audio codec context | ||||||
|  |  | ||||||
|     char Passthrough; ///< current pass-through flags |     char Passthrough; ///< current pass-through flags | ||||||
| @@ -702,8 +713,11 @@ void CodecAudioDelDecoder(AudioDecoder *decoder) { | |||||||
| **  @param codec_id audio   codec id | **  @param codec_id audio   codec id | ||||||
| */ | */ | ||||||
| void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) { | void CodecAudioOpen(AudioDecoder *audio_decoder, int codec_id) { | ||||||
|  | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) | ||||||
|     AVCodec *audio_codec; |     AVCodec *audio_codec; | ||||||
|  | #else | ||||||
|  |     const AVCodec *audio_codec; | ||||||
|  | #endif | ||||||
|     Debug(3, "codec: using audio codec ID %#06x (%s)\n", codec_id, avcodec_get_name(codec_id)); |     Debug(3, "codec: using audio codec ID %#06x (%s)\n", codec_id, avcodec_get_name(codec_id)); | ||||||
|     if (!(audio_codec = avcodec_find_decoder(codec_id))) { |     if (!(audio_codec = avcodec_find_decoder(codec_id))) { | ||||||
|         // if (!(audio_codec = avcodec_find_decoder(codec_id))) { |         // if (!(audio_codec = avcodec_find_decoder(codec_id))) { | ||||||
| @@ -755,8 +769,12 @@ void CodecAudioClose(AudioDecoder *audio_decoder) { | |||||||
|     } |     } | ||||||
|     if (audio_decoder->AudioCtx) { |     if (audio_decoder->AudioCtx) { | ||||||
|         pthread_mutex_lock(&CodecLockMutex); |         pthread_mutex_lock(&CodecLockMutex); | ||||||
|         avcodec_close(audio_decoder->AudioCtx); | #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(55,63,100) | ||||||
|         av_freep(&audio_decoder->AudioCtx); | 	    avcodec_close(audio_decoder->AudioCtx); | ||||||
|  | 	    av_freep(&audio_decoder->AudioCtx); | ||||||
|  | #else | ||||||
|  | 	    avcodec_free_context(&audio_decoder->AudioCtx); | ||||||
|  | #endif | ||||||
|         pthread_mutex_unlock(&CodecLockMutex); |         pthread_mutex_unlock(&CodecLockMutex); | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
							
								
								
									
										6
									
								
								codec.h
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								codec.h
									
									
									
									
									
								
							| @@ -56,7 +56,11 @@ struct _video_decoder_ { | |||||||
|     VideoHwDecoder *HwDecoder; ///< video hardware decoder |     VideoHwDecoder *HwDecoder; ///< video hardware decoder | ||||||
|  |  | ||||||
|     int GetFormatDone;        ///< flag get format called! |     int GetFormatDone;        ///< flag get format called! | ||||||
|     AVCodec *VideoCodec;      ///< video codec | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(59,0,100) | ||||||
|  |      AVCodec *VideoCodec;                ///< video codec | ||||||
|  | #else | ||||||
|  |      const AVCodec *VideoCodec;          ///< video codec | ||||||
|  | #endif | ||||||
|     AVCodecContext *VideoCtx; ///< video codec context |     AVCodecContext *VideoCtx; ///< video codec context | ||||||
|     // #ifdef FFMPEG_WORKAROUND_ARTIFACTS |     // #ifdef FFMPEG_WORKAROUND_ARTIFACTS | ||||||
|     int FirstKeyFrame; ///< flag first frame |     int FirstKeyFrame; ///< flag first frame | ||||||
|   | |||||||
| @@ -126,7 +126,7 @@ void pl_shader_append_v(const char *fmt, ...) { | |||||||
|         Fatal(_("Shaderlenght fault\n")); |         Fatal(_("Shaderlenght fault\n")); | ||||||
|     strcat(shv, temp); |     strcat(shv, temp); | ||||||
| } | } | ||||||
|  | #ifndef PLACEBO | ||||||
| static void compile_attach_shader(GLuint program, GLenum type, const char *source) { | static void compile_attach_shader(GLuint program, GLenum type, const char *source) { | ||||||
|     GLuint shader; |     GLuint shader; | ||||||
|     GLint status = 1234, log_length; |     GLint status = 1234, log_length; | ||||||
| @@ -159,6 +159,7 @@ static void link_shader(GLuint program) { | |||||||
|     Debug(3, "Link Status %d loglen %d\n", status, log_length); |     Debug(3, "Link Status %d loglen %d\n", status, log_length); | ||||||
| } | } | ||||||
|  |  | ||||||
|  |  | ||||||
| static GLuint sc_generate_osd(GLuint gl_prog) { | static GLuint sc_generate_osd(GLuint gl_prog) { | ||||||
|  |  | ||||||
|     Debug(3, "vor create osd\n"); |     Debug(3, "vor create osd\n"); | ||||||
| @@ -209,7 +210,7 @@ static GLuint sc_generate(GLuint gl_prog, enum AVColorSpace colorspace) { | |||||||
|     int n; |     int n; | ||||||
|     GLint cmsLoc; |     GLint cmsLoc; | ||||||
|     float *m, *c, *cms; |     float *m, *c, *cms; | ||||||
|     char *frag; |     //char *frag; | ||||||
|  |  | ||||||
|     GL_init(); |     GL_init(); | ||||||
|     GLSL("%s\n", gl_version); |     GLSL("%s\n", gl_version); | ||||||
| @@ -446,3 +447,4 @@ static void render_pass_quad(int flip, float xcrop, float ycrop) { | |||||||
|     for (n = 0; vertex_vao[n].name; n++) |     for (n = 0; vertex_vao[n].name; n++) | ||||||
|         glDisableVertexAttribArray(n); |         glDisableVertexAttribArray(n); | ||||||
| } | } | ||||||
|  | #endif | ||||||
|   | |||||||
| @@ -61,7 +61,7 @@ extern void ToggleLUT(); | |||||||
| /// vdr-plugin version number. | /// vdr-plugin version number. | ||||||
| /// Makefile extracts the version number for generating the file name | /// Makefile extracts the version number for generating the file name | ||||||
| /// for the distribution archive. | /// for the distribution archive. | ||||||
| static const char *const VERSION = "3.23" | static const char *const VERSION = "3.27" | ||||||
| #ifdef GIT_REV | #ifdef GIT_REV | ||||||
|                                    "-GIT" GIT_REV |                                    "-GIT" GIT_REV | ||||||
| #endif | #endif | ||||||
| @@ -1226,7 +1226,7 @@ void cMenuSetupSoft::Create(void) { | |||||||
| 	Add(new cMenuEditIntItem(tr("Video background color (Alpha)"), (int *)&BackgroundAlpha, 0, 0xFF)); | 	Add(new cMenuEditIntItem(tr("Video background color (Alpha)"), (int *)&BackgroundAlpha, 0, 0xFF)); | ||||||
| #endif | #endif | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
|         Add(new cMenuEditBoolItem(tr("Use studio levels"), &StudioLevels, trVDR("no"), trVDR("yes"))); |         Add(new cMenuEditBoolItem(tr("RGB Level"), &StudioLevels, trVDR("limited RGB"), trVDR("Full RGB"))); | ||||||
| #endif | #endif | ||||||
|         Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode, trVDR("no"), trVDR("yes"))); |         Add(new cMenuEditBoolItem(tr("60hz display mode"), &_60HzMode, trVDR("no"), trVDR("yes"))); | ||||||
|         Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync, trVDR("no"), trVDR("yes"))); |         Add(new cMenuEditBoolItem(tr("Soft start a/v sync"), &SoftStartSync, trVDR("no"), trVDR("yes"))); | ||||||
|   | |||||||
							
								
								
									
										31
									
								
								softhddev.c
									
									
									
									
									
								
							
							
						
						
									
										31
									
								
								softhddev.c
									
									
									
									
									
								
							| @@ -60,7 +60,7 @@ | |||||||
| #include "codec.h" | #include "codec.h" | ||||||
| // clang-format on | // clang-format on | ||||||
|  |  | ||||||
| #ifdef DEBUG | #if 0 | ||||||
| static int DumpH264(const uint8_t *data, int size); | static int DumpH264(const uint8_t *data, int size); | ||||||
| static void DumpMpeg(const uint8_t *data, int size); | static void DumpMpeg(const uint8_t *data, int size); | ||||||
| #endif | #endif | ||||||
| @@ -662,7 +662,13 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star | |||||||
|                         break; |                         break; | ||||||
|                     } |                     } | ||||||
|                     if (r > 0) { |                     if (r > 0) { | ||||||
|                         AVPacket avpkt[1]; | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100) | ||||||
|  | 				        AVPacket avpkt[1]; | ||||||
|  | 				        av_init_packet(avpkt); | ||||||
|  | #else | ||||||
|  |                         AVPacket * avpkt; | ||||||
|  | 				        avpkt = av_packet_alloc(); | ||||||
|  | #endif | ||||||
|  |  | ||||||
|                         // new codec id, close and open new |                         // new codec id, close and open new | ||||||
|                         if (AudioCodecID != codec_id) { |                         if (AudioCodecID != codec_id) { | ||||||
| @@ -671,13 +677,15 @@ static void PesParse(PesDemux *pesdx, const uint8_t *data, int size, int is_star | |||||||
|                             CodecAudioOpen(MyAudioDecoder, codec_id); |                             CodecAudioOpen(MyAudioDecoder, codec_id); | ||||||
|                             AudioCodecID = codec_id; |                             AudioCodecID = codec_id; | ||||||
|                         } |                         } | ||||||
|                         av_init_packet(avpkt); |  | ||||||
|                         avpkt->data = (void *)q; |                         avpkt->data = (void *)q; | ||||||
|                         avpkt->size = r; |                         avpkt->size = r; | ||||||
|                         avpkt->pts = pesdx->PTS; |                         avpkt->pts = pesdx->PTS; | ||||||
|                         avpkt->dts = pesdx->DTS; |                         avpkt->dts = pesdx->DTS; | ||||||
|                         // FIXME: not aligned for ffmpeg |                         // FIXME: not aligned for ffmpeg | ||||||
|                         CodecAudioDecode(MyAudioDecoder, avpkt); |                         CodecAudioDecode(MyAudioDecoder, avpkt); | ||||||
|  | #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100) | ||||||
|  | 				        av_packet_free(&avpkt); | ||||||
|  | #endif | ||||||
|                         pesdx->PTS = AV_NOPTS_VALUE; |                         pesdx->PTS = AV_NOPTS_VALUE; | ||||||
|                         pesdx->DTS = AV_NOPTS_VALUE; |                         pesdx->DTS = AV_NOPTS_VALUE; | ||||||
|                         pesdx->Skip += r; |                         pesdx->Skip += r; | ||||||
| @@ -1147,21 +1155,28 @@ int PlayAudio(const uint8_t *data, int size, uint8_t id) { | |||||||
|             break; |             break; | ||||||
|         } |         } | ||||||
|         if (r > 0) { |         if (r > 0) { | ||||||
|             AVPacket avpkt[1]; | #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(58,33,100) | ||||||
|  | 	        AVPacket avpkt[1]; | ||||||
|  | 	        av_init_packet(avpkt); | ||||||
|  | #else | ||||||
|  | 	        AVPacket * avpkt; | ||||||
|  | 	        avpkt = av_packet_alloc(); | ||||||
|  | #endif | ||||||
|             // new codec id, close and open new |             // new codec id, close and open new | ||||||
|             if (AudioCodecID != codec_id) { |             if (AudioCodecID != codec_id) { | ||||||
|                 CodecAudioClose(MyAudioDecoder); |                 CodecAudioClose(MyAudioDecoder); | ||||||
|                 CodecAudioOpen(MyAudioDecoder, codec_id); |                 CodecAudioOpen(MyAudioDecoder, codec_id); | ||||||
|                 AudioCodecID = codec_id; |                 AudioCodecID = codec_id; | ||||||
|             } |             } | ||||||
|             av_init_packet(avpkt); |  | ||||||
|             avpkt->data = (void *)p; |             avpkt->data = (void *)p; | ||||||
|             avpkt->size = r; |             avpkt->size = r; | ||||||
|             avpkt->pts = AudioAvPkt->pts; |             avpkt->pts = AudioAvPkt->pts; | ||||||
|             avpkt->dts = AudioAvPkt->dts; |             avpkt->dts = AudioAvPkt->dts; | ||||||
|             // FIXME: not aligned for ffmpeg |             // FIXME: not aligned for ffmpeg | ||||||
|             CodecAudioDecode(MyAudioDecoder, avpkt); |             CodecAudioDecode(MyAudioDecoder, avpkt); | ||||||
|  | #if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(58,33,100) | ||||||
|  | 	        av_packet_free(&avpkt); | ||||||
|  | #endif | ||||||
|             AudioAvPkt->pts = AV_NOPTS_VALUE; |             AudioAvPkt->pts = AV_NOPTS_VALUE; | ||||||
|             AudioAvPkt->dts = AV_NOPTS_VALUE; |             AudioAvPkt->dts = AV_NOPTS_VALUE; | ||||||
|             p += r; |             p += r; | ||||||
| @@ -1625,7 +1640,7 @@ static void VideoMpegEnqueue(VideoStream *stream, int64_t pts, int64_t dts, cons | |||||||
| **  @param avpkt    ffmpeg a/v packet | **  @param avpkt    ffmpeg a/v packet | ||||||
| */ | */ | ||||||
|  |  | ||||||
| #ifndef USE_PIP | #if !defined USE_PIP &&  !defined VAAPI | ||||||
| static void FixPacketForFFMpeg(VideoDecoder *vdecoder, AVPacket *avpkt) { | static void FixPacketForFFMpeg(VideoDecoder *vdecoder, AVPacket *avpkt) { | ||||||
|     uint8_t *p; |     uint8_t *p; | ||||||
|     int n; |     int n; | ||||||
| @@ -1993,7 +2008,7 @@ static void StopVideo(void) { | |||||||
| #endif | #endif | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef DEBUG | #if 0 | ||||||
|  |  | ||||||
| /** | /** | ||||||
| **  Dump mpeg video packet. | **  Dump mpeg video packet. | ||||||
|   | |||||||
							
								
								
									
										327
									
								
								video.c
									
									
									
									
									
								
							
							
						
						
									
										327
									
								
								video.c
									
									
									
									
									
								
							| @@ -172,6 +172,7 @@ typedef enum { | |||||||
| #if !defined PLACEBO_GL | #if !defined PLACEBO_GL | ||||||
| #include <EGL/egl.h> | #include <EGL/egl.h> | ||||||
| #include <EGL/eglext.h> | #include <EGL/eglext.h> | ||||||
|  |  | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef GL_OES_EGL_image | #ifndef GL_OES_EGL_image | ||||||
| @@ -183,6 +184,7 @@ typedef void *EGLImageKHR; | |||||||
|  |  | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
| #ifdef PLACEBO_GL | #ifdef PLACEBO_GL | ||||||
|  | GLenum glewInit(void); | ||||||
| #include <libplacebo/opengl.h> | #include <libplacebo/opengl.h> | ||||||
| #else | #else | ||||||
| #define VK_USE_PLATFORM_XCB_KHR | #define VK_USE_PLATFORM_XCB_KHR | ||||||
| @@ -380,18 +382,12 @@ signed char VideoHardwareDecoder = -1; ///< flag use hardware decoder | |||||||
|  |  | ||||||
| static char VideoSurfaceModesChanged; ///< flag surface modes changed | static char VideoSurfaceModesChanged; ///< flag surface modes changed | ||||||
|  |  | ||||||
| /// flag use transparent OSD. |  | ||||||
| static const char VideoTransparentOsd = 1; |  | ||||||
|  |  | ||||||
| static uint32_t VideoBackground; ///< video background color | static uint32_t VideoBackground; ///< video background color | ||||||
| char VideoStudioLevels;          ///< flag use studio levels | char VideoStudioLevels;          ///< flag use studio levels | ||||||
|  |  | ||||||
| /// Default deinterlace mode. | /// Default deinterlace mode. | ||||||
| static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax]; | static VideoDeinterlaceModes VideoDeinterlace[VideoResolutionMax]; | ||||||
|  |  | ||||||
| /// Default number of deinterlace surfaces |  | ||||||
| static const int VideoDeinterlaceSurfaces = 4; |  | ||||||
|  |  | ||||||
| /// Default skip chroma deinterlace flag (CUVID only). | /// Default skip chroma deinterlace flag (CUVID only). | ||||||
| static char VideoSkipChromaDeinterlace[VideoResolutionMax]; | static char VideoSkipChromaDeinterlace[VideoResolutionMax]; | ||||||
|  |  | ||||||
| @@ -430,7 +426,7 @@ static int DRMRefresh = 50; | |||||||
|  |  | ||||||
| static char Video60HzMode;                   ///< handle 60hz displays | static char Video60HzMode;                   ///< handle 60hz displays | ||||||
| static char VideoSoftStartSync;              ///< soft start sync audio/video | static char VideoSoftStartSync;              ///< soft start sync audio/video | ||||||
| static const int VideoSoftStartFrames = 100; ///< soft start frames | //static const int VideoSoftStartFrames = 100; ///< soft start frames | ||||||
| static char VideoShowBlackPicture;           ///< flag show black picture | static char VideoShowBlackPicture;           ///< flag show black picture | ||||||
|  |  | ||||||
| static float VideoBrightness = 0.0f; | static float VideoBrightness = 0.0f; | ||||||
| @@ -442,11 +438,14 @@ static float VideoTemperature = 0.0f; | |||||||
| static int VulkanTargetColorSpace = 0; | static int VulkanTargetColorSpace = 0; | ||||||
| static int VideoScalerTest = 0; | static int VideoScalerTest = 0; | ||||||
| static int VideoColorBlindness = 0; | static int VideoColorBlindness = 0; | ||||||
| static float VideoColorBlindnessFaktor = 1.0f; | static float VideoColorBlindnessFaktor = 1.0; | ||||||
|  |  | ||||||
|  | #ifdef PLACEBO | ||||||
| static char *shadersp[NUM_SHADERS]; | static char *shadersp[NUM_SHADERS]; | ||||||
| char MyConfigDir[200]; | char MyConfigDir[200]; | ||||||
| static int num_shaders = 0; | static int num_shaders = 0; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| static int LUTon = -1; | static int LUTon = -1; | ||||||
|  |  | ||||||
| static xcb_atom_t WmDeleteWindowAtom;   ///< WM delete message atom | static xcb_atom_t WmDeleteWindowAtom;   ///< WM delete message atom | ||||||
| @@ -494,11 +493,11 @@ static char DPMSDisabled;            ///< flag we have disabled dpms | |||||||
| static char EnableDPMSatBlackScreen; ///< flag we should enable dpms at black screen | static char EnableDPMSatBlackScreen; ///< flag we should enable dpms at black screen | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static unsigned int Count; |  | ||||||
| static int EglEnabled;          ///< use EGL | static int EglEnabled;          ///< use EGL | ||||||
| static int GlxVSyncEnabled = 1; ///< enable/disable v-sync |  | ||||||
|  |  | ||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|  | static int GlxVSyncEnabled = 1; ///< enable/disable v-sync | ||||||
|  | static unsigned int Count; | ||||||
| static GLXContext glxSharedContext; ///< shared gl context | static GLXContext glxSharedContext; ///< shared gl context | ||||||
| static GLXContext glxContext;       ///< our gl context | static GLXContext glxContext;       ///< our gl context | ||||||
|  |  | ||||||
| @@ -509,11 +508,13 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex | |||||||
| GLXContext OSDcontext; | GLXContext OSDcontext; | ||||||
| #else | #else | ||||||
| static EGLContext eglSharedContext;     ///< shared gl context | static EGLContext eglSharedContext;     ///< shared gl context | ||||||
|  | #ifdef USE_DRM | ||||||
| static EGLContext eglOSDContext = NULL; ///< our gl context for the thread | static EGLContext eglOSDContext = NULL; ///< our gl context for the thread | ||||||
|  | #endif | ||||||
| static EGLContext eglContext;           ///< our gl context | static EGLContext eglContext;           ///< our gl context | ||||||
| static EGLConfig eglConfig; | static EGLConfig eglConfig; | ||||||
| static EGLDisplay eglDisplay; | static EGLDisplay eglDisplay; | ||||||
| static EGLSurface eglSurface, eglOSDSurface; | static EGLSurface eglSurface; | ||||||
| static EGLint eglAttrs[10]; | static EGLint eglAttrs[10]; | ||||||
| static int eglVersion = 2; | static int eglVersion = 2; | ||||||
| static EGLImageKHR(EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *); | static EGLImageKHR(EGLAPIENTRY *CreateImageKHR)(EGLDisplay, EGLContext, EGLenum, EGLClientBuffer, const EGLint *); | ||||||
| @@ -531,9 +532,6 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContex | |||||||
| EGLContext OSDcontext; | EGLContext OSDcontext; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static GLuint OsdGlTextures[2]; ///< gl texture for OSD |  | ||||||
| static int OsdIndex = 0;        ///< index into OsdGlTextures |  | ||||||
|  |  | ||||||
| //---------------------------------------------------------------------------- | //---------------------------------------------------------------------------- | ||||||
| //  Common Functions | //  Common Functions | ||||||
| //---------------------------------------------------------------------------- | //---------------------------------------------------------------------------- | ||||||
| @@ -630,8 +628,8 @@ static void VideoSetPts(int64_t *pts_p, int interlaced, const AVCodecContext *vi | |||||||
|     // } else { |     // } else { | ||||||
|     duration = interlaced ? 40 : 20; // 50Hz -> 20ms default |     duration = interlaced ? 40 : 20; // 50Hz -> 20ms default | ||||||
|     // } |     // } | ||||||
|     // Debug(4, "video: %d/%d %" PRIx64 " -> %d\n", video_ctx->framerate.den, |     Debug(4, "video: Framerate %d/%d \n", video_ctx->framerate.den, | ||||||
|     // video_ctx->framerate.num, av_frame_get_pkt_duration(frame), duration); |      video_ctx->framerate.num); | ||||||
|  |  | ||||||
|     // update video clock |     // update video clock | ||||||
|     if (*pts_p != (int64_t)AV_NOPTS_VALUE) { |     if (*pts_p != (int64_t)AV_NOPTS_VALUE) { | ||||||
| @@ -793,7 +791,7 @@ video_none: | |||||||
|     return; |     return; | ||||||
| } | } | ||||||
|  |  | ||||||
| static uint64_t test_time = 0; | //static uint64_t test_time = 0; | ||||||
|  |  | ||||||
| /// | /// | ||||||
| /// Lock video thread. | /// Lock video thread. | ||||||
| @@ -871,18 +869,7 @@ static uint64_t test_time = 0; | |||||||
|  |  | ||||||
| #ifdef USE_GLX | #ifdef USE_GLX | ||||||
|  |  | ||||||
| /// |  | ||||||
| /// GLX extension functions |  | ||||||
| ///@{ |  | ||||||
| #ifdef GLX_MESA_swap_control |  | ||||||
| static PFNGLXSWAPINTERVALMESAPROC GlxSwapIntervalMESA; |  | ||||||
| #endif |  | ||||||
| #ifdef GLX_SGI_video_sync |  | ||||||
| static PFNGLXGETVIDEOSYNCSGIPROC GlxGetVideoSyncSGI; |  | ||||||
| #endif |  | ||||||
| #ifdef GLX_SGI_swap_control |  | ||||||
| static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI; |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| /// | /// | ||||||
| /// GLX check error. | /// GLX check error. | ||||||
| @@ -896,6 +883,21 @@ static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI; | |||||||
|         }                                                                                                             \ |         }                                                                                                             \ | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  | #ifdef CUVID | ||||||
|  | /// | ||||||
|  | /// GLX extension functions | ||||||
|  | ///@{ | ||||||
|  | #ifdef GLX_MESA_swap_control | ||||||
|  | static PFNGLXSWAPINTERVALMESAPROC GlxSwapIntervalMESA; | ||||||
|  | #endif | ||||||
|  | #ifdef GLX_SGI_video_sync | ||||||
|  | static PFNGLXGETVIDEOSYNCSGIPROC GlxGetVideoSyncSGI; | ||||||
|  | #endif | ||||||
|  | #ifdef GLX_SGI_swap_control | ||||||
|  | static PFNGLXSWAPINTERVALSGIPROC GlxSwapIntervalSGI; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| /// | /// | ||||||
| /// GLX check if a GLX extension is supported. | /// GLX check if a GLX extension is supported. | ||||||
| /// | /// | ||||||
| @@ -915,6 +917,7 @@ static int GlxIsExtensionSupported(const char *ext) { | |||||||
|     } |     } | ||||||
|     return 0; |     return 0; | ||||||
| } | } | ||||||
|  | #endif | ||||||
|  |  | ||||||
| /// | /// | ||||||
| /// Setup GLX window. | /// Setup GLX window. | ||||||
| @@ -930,11 +933,12 @@ static void GlxSetupWindow(xcb_window_t window, int width, int height, GLXContex | |||||||
| static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context) | static void GlxSetupWindow(xcb_window_t window, int width, int height, EGLContext context) | ||||||
| #endif | #endif | ||||||
| { | { | ||||||
|  | #ifdef CUVID | ||||||
|     uint32_t start; |     uint32_t start; | ||||||
|     uint32_t end; |     uint32_t end; | ||||||
|     int i; |     int i; | ||||||
|     unsigned count; |     unsigned count; | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifdef PLACEBO_ | #ifdef PLACEBO_ | ||||||
|     return; |     return; | ||||||
| @@ -1170,6 +1174,7 @@ static void EglInit(void) { | |||||||
| } | } | ||||||
|  |  | ||||||
| #else // VAAPI | #else // VAAPI | ||||||
|  | extern void make_egl(void); | ||||||
| static void EglInit(void) { | static void EglInit(void) { | ||||||
|     int redSize, greenSize, blueSize, alphaSize; |     int redSize, greenSize, blueSize, alphaSize; | ||||||
|     static int glewdone = 0; |     static int glewdone = 0; | ||||||
| @@ -1185,7 +1190,8 @@ static void EglInit(void) { | |||||||
|     make_egl(); |     make_egl(); | ||||||
|  |  | ||||||
|     if (!glewdone) { |     if (!glewdone) { | ||||||
|         GLenum err = glewInit(); |         //GLenum err = glewInit(); | ||||||
|  |         glewInit(); | ||||||
|  |  | ||||||
|         glewdone = 1; |         glewdone = 1; | ||||||
|         //	  if (err != GLEW_OK) { |         //	  if (err != GLEW_OK) { | ||||||
| @@ -1258,19 +1264,17 @@ static void EglExit(void) { | |||||||
|         EglCheck(); |         EglCheck(); | ||||||
|         eglSurface = NULL; |         eglSurface = NULL; | ||||||
|     } |     } | ||||||
|      |  | ||||||
|     if (eglContext) { |  | ||||||
|         eglDestroyContext(eglDisplay, eglContext); |  | ||||||
|         EglCheck(); |  | ||||||
|         eglContext = NULL; |  | ||||||
|     } |  | ||||||
|     if (eglSharedContext) { |     if (eglSharedContext) { | ||||||
|         eglDestroyContext(eglDisplay, eglSharedContext); |         eglDestroyContext(eglDisplay, eglSharedContext); | ||||||
|         EglCheck(); |         EglCheck(); | ||||||
|         eglSharedContext = NULL; |         eglSharedContext = NULL; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|      |     if (eglContext) { | ||||||
|  |         eglDestroyContext(eglDisplay, eglContext); | ||||||
|  |         EglCheck(); | ||||||
|  |         eglContext = NULL; | ||||||
|  |     } | ||||||
|     eglTerminate(eglDisplay); |     eglTerminate(eglDisplay); | ||||||
|     eglDisplay = NULL; |     eglDisplay = NULL; | ||||||
|  |  | ||||||
| @@ -1458,11 +1462,11 @@ typedef struct priv { | |||||||
|     const struct pl_vulkan *vk; |     const struct pl_vulkan *vk; | ||||||
|     const struct pl_vk_inst *vk_inst; |     const struct pl_vk_inst *vk_inst; | ||||||
| #endif | #endif | ||||||
|     struct pl_context *ctx; |     const struct pl_log_t *ctx; | ||||||
|     struct pl_custom_lut *lut; |     struct pl_custom_lut *lut; | ||||||
|     struct pl_renderer *renderer; |     struct pl_renderer_t *renderer; | ||||||
|     struct pl_renderer *renderertest; |     struct pl_renderer_t *renderertest; | ||||||
|     const struct pl_swapchain *swapchain; |     const struct pl_swapchain_t *swapchain; | ||||||
|     struct pl_log_params context; |     struct pl_log_params context; | ||||||
| #ifndef PLACEBO_GL | #ifndef PLACEBO_GL | ||||||
|     VkSurfaceKHR pSurface; |     VkSurfaceKHR pSurface; | ||||||
| @@ -1470,7 +1474,7 @@ typedef struct priv { | |||||||
|     int has_dma_buf; |     int has_dma_buf; | ||||||
| #ifdef PLACEBO_GL | #ifdef PLACEBO_GL | ||||||
| #if PL_API_VER >= 229 | #if PL_API_VER >= 229 | ||||||
|     struct pl_opengl_t *gl; |     const struct pl_opengl_t *gl; | ||||||
| #else | #else | ||||||
|     struct pl_opengl *gl; |     struct pl_opengl *gl; | ||||||
| #endif | #endif | ||||||
| @@ -1486,7 +1490,6 @@ static struct pl_overlay osdoverlay; | |||||||
| static struct pl_overlay_part part; | static struct pl_overlay_part part; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static int semid; |  | ||||||
| struct itimerval itimer; | struct itimerval itimer; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -1818,11 +1821,6 @@ struct mp_egl_config_attr { | |||||||
| #define MP_EGL_ATTRIB(id)                                                                                             \ | #define MP_EGL_ATTRIB(id)                                                                                             \ | ||||||
|     { id, #id } |     { id, #id } | ||||||
|  |  | ||||||
| static const struct mp_egl_config_attr mp_egl_attribs[] = { |  | ||||||
|     MP_EGL_ATTRIB(EGL_CONFIG_ID),     MP_EGL_ATTRIB(EGL_RED_SIZE),   MP_EGL_ATTRIB(EGL_GREEN_SIZE), |  | ||||||
|     MP_EGL_ATTRIB(EGL_BLUE_SIZE),     MP_EGL_ATTRIB(EGL_ALPHA_SIZE), MP_EGL_ATTRIB(EGL_COLOR_BUFFER_TYPE), |  | ||||||
|     MP_EGL_ATTRIB(EGL_CONFIG_CAVEAT), MP_EGL_ATTRIB(EGL_CONFORMANT), |  | ||||||
| }; |  | ||||||
|  |  | ||||||
| const int mpgl_preferred_gl_versions[] = {460, 440, 430, 400, 330, 320, 310, 300, 210, 0}; | const int mpgl_preferred_gl_versions[] = {460, 440, 430, 400, 330, 320, 310, 300, 210, 0}; | ||||||
|  |  | ||||||
| @@ -1954,7 +1952,7 @@ static bool create_context_cb(EGLDisplay display, int es_version, EGLContext *ou | |||||||
|     return true; |     return true; | ||||||
| } | } | ||||||
|  |  | ||||||
| make_egl() { | void make_egl(void) { | ||||||
|     int bpp; |     int bpp; | ||||||
|  |  | ||||||
|     CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR"); |     CreateImageKHR = (void *)eglGetProcAddress("eglCreateImageKHR"); | ||||||
| @@ -1978,7 +1976,7 @@ make_egl() { | |||||||
|     if (!create_context_cb(eglDisplay, 0, &eglContext, &eglConfig, &bpp)) { |     if (!create_context_cb(eglDisplay, 0, &eglContext, &eglConfig, &bpp)) { | ||||||
|         Fatal(_("Could not create EGL Context\n")); |         Fatal(_("Could not create EGL Context\n")); | ||||||
|     } |     } | ||||||
|     int vID, n; |     int vID; | ||||||
|  |  | ||||||
|     eglGetConfigAttrib(eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &vID); |     eglGetConfigAttrib(eglDisplay, eglConfig, EGL_NATIVE_VISUAL_ID, &vID); | ||||||
|     Debug(3, "chose visual 0x%x bpp %d\n", vID, bpp); |     Debug(3, "chose visual 0x%x bpp %d\n", vID, bpp); | ||||||
| @@ -2251,9 +2249,9 @@ void generateCUDAImage(CuvidDecoder *decoder, int index, const AVFrame *frame, i | |||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
| void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsigned int size_y, | void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsigned int size_y, | ||||||
|                       enum AVPixelFormat PixFmt) { |                       enum AVPixelFormat PixFmt) { | ||||||
|     int n, i, size = 1, fd; |     int n, i;  | ||||||
|     const struct pl_fmt *fmt; |     const struct pl_fmt_t *fmt; | ||||||
|     struct pl_tex *tex; |     //struct pl_tex *tex; | ||||||
|     struct pl_frame *img; |     struct pl_frame *img; | ||||||
|     struct pl_plane *pl; |     struct pl_plane *pl; | ||||||
|  |  | ||||||
| @@ -2272,10 +2270,8 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig | |||||||
|  |  | ||||||
|             if (PixFmt == AV_PIX_FMT_NV12) { |             if (PixFmt == AV_PIX_FMT_NV12) { | ||||||
|                 fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV |                 fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV | ||||||
|                 size = 1; |  | ||||||
|             } else { |             } else { | ||||||
|                 fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r16" : "rg16"); // 10 Bit YUV |                 fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r16" : "rg16"); // 10 Bit YUV | ||||||
|                 size = 2; |  | ||||||
|             } |             } | ||||||
|             if (decoder->pl_frames[i].planes[n].texture) { |             if (decoder->pl_frames[i].planes[n].texture) { | ||||||
|                 // #ifdef VAAPI |                 // #ifdef VAAPI | ||||||
| @@ -2322,7 +2318,7 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig | |||||||
|                 Fatal(_("Unable to create placebo textures")); |                 Fatal(_("Unable to create placebo textures")); | ||||||
|             } |             } | ||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|             fd = dup(decoder->pl_frames[i].planes[n].texture->shared_mem.handle.fd); |             int fd = dup(decoder->pl_frames[i].planes[n].texture->shared_mem.handle.fd); | ||||||
|             CUDA_EXTERNAL_MEMORY_HANDLE_DESC ext_desc = { |             CUDA_EXTERNAL_MEMORY_HANDLE_DESC ext_desc = { | ||||||
|                 .type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD, |                 .type = CU_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD, | ||||||
|                 .handle.fd = fd, |                 .handle.fd = fd, | ||||||
| @@ -2374,10 +2370,8 @@ void createTextureDst(CuvidDecoder *decoder, int anz, unsigned int size_x, unsig | |||||||
| void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, int image_width, int image_height) { | void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, int image_width, int image_height) { | ||||||
|     int n; |     int n; | ||||||
|     VAStatus status; |     VAStatus status; | ||||||
|     int toggle = 0; |  | ||||||
|     uint64_t first_time; |  | ||||||
|     VADRMPRIMESurfaceDescriptor desc; |     VADRMPRIMESurfaceDescriptor desc; | ||||||
|  |      | ||||||
|     vaSyncSurface(decoder->VaDisplay, (unsigned int)frame->data[3]); |     vaSyncSurface(decoder->VaDisplay, (unsigned int)frame->data[3]); | ||||||
|     status = |     status = | ||||||
|         vaExportSurfaceHandle(decoder->VaDisplay, (unsigned int)frame->data[3], VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, |         vaExportSurfaceHandle(decoder->VaDisplay, (unsigned int)frame->data[3], VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME_2, | ||||||
| @@ -2396,11 +2390,8 @@ void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, | |||||||
|         int fd = desc.objects[id].fd; |         int fd = desc.objects[id].fd; | ||||||
|         uint32_t size = desc.objects[id].size; |         uint32_t size = desc.objects[id].size; | ||||||
|         uint32_t offset = desc.layers[n].offset[0]; |         uint32_t offset = desc.layers[n].offset[0]; | ||||||
| #if PL_API_VER < 229 |  | ||||||
|         struct pl_fmt *fmt; |  | ||||||
| #else |  | ||||||
|         struct pl_fmt_t *fmt; |         struct pl_fmt_t *fmt; | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         if (fd == -1) { |         if (fd == -1) { | ||||||
|             printf("Fehler beim Import von Surface %d\n", index); |             printf("Fehler beim Import von Surface %d\n", index); | ||||||
| @@ -2411,15 +2402,14 @@ void generateVAAPIImage(CuvidDecoder *decoder, int index, const AVFrame *frame, | |||||||
|             size = n == 0 ? desc.width * desc.height : desc.width * desc.height / 2; |             size = n == 0 ? desc.width * desc.height : desc.width * desc.height / 2; | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         //	fmt = pl_find_fourcc(p->gpu,desc.layers[n].drm_format); |         //	fmt = pl_find_fourcc(p->gpu,desc.lsayers[n].drm_format); | ||||||
| #if 1 |  | ||||||
|         if (decoder->PixFmt == AV_PIX_FMT_NV12) { |         if (decoder->PixFmt == AV_PIX_FMT_NV12) { | ||||||
|             fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV |             fmt = pl_find_named_fmt(p->gpu, n == 0 ? "r8" : "rg8"); // 8 Bit YUV | ||||||
|         } else { |         } else { | ||||||
|             fmt = pl_find_fourcc(p->gpu, |             fmt = pl_find_fourcc(p->gpu, | ||||||
|                                  n == 0 ? 0x20363152 : 0x32335247); // 10 Bit YUV |                                  n == 0 ? 0x20363152 : 0x32335247); // 10 Bit YUV | ||||||
|         } |         } | ||||||
| #endif |  | ||||||
|  |  | ||||||
|         assert(fmt != NULL); |         assert(fmt != NULL); | ||||||
| #ifdef PLACEBO_GL | #ifdef PLACEBO_GL | ||||||
| @@ -2572,8 +2562,6 @@ void generateVAAPIImage(CuvidDecoder *decoder, VASurfaceID index, const AVFrame | |||||||
|                         int image_height) { |                         int image_height) { | ||||||
|     VAStatus status; |     VAStatus status; | ||||||
|  |  | ||||||
|     uint64_t first_time; |  | ||||||
|  |  | ||||||
| #if defined(VAAPI) | #if defined(VAAPI) | ||||||
|     VADRMPRIMESurfaceDescriptor desc; |     VADRMPRIMESurfaceDescriptor desc; | ||||||
|  |  | ||||||
| @@ -2842,7 +2830,7 @@ static int init_generic_hwaccel(CuvidDecoder *decoder, enum AVPixelFormat hw_fmt | |||||||
|     if (decoder->cached_hw_frames_ctx) { |     if (decoder->cached_hw_frames_ctx) { | ||||||
|         AVHWFramesContext *old_fctx = (void *)decoder->cached_hw_frames_ctx->data; |         AVHWFramesContext *old_fctx = (void *)decoder->cached_hw_frames_ctx->data; | ||||||
|  |  | ||||||
|         Debug(3, "CMP %d:%d %d:%d %d:%d %d:%d %d:%d\,", new_fctx->format, old_fctx->format, new_fctx->sw_format, |         Debug(3, "CMP %d:%d %d:%d %d:%d %d:%d %d:%d\n,", new_fctx->format, old_fctx->format, new_fctx->sw_format, | ||||||
|               old_fctx->sw_format, new_fctx->width, old_fctx->width, new_fctx->height, old_fctx->height, |               old_fctx->sw_format, new_fctx->width, old_fctx->width, new_fctx->height, old_fctx->height, | ||||||
|               new_fctx->initial_pool_size, old_fctx->initial_pool_size); |               new_fctx->initial_pool_size, old_fctx->initial_pool_size); | ||||||
|         if (new_fctx->format != old_fctx->format || new_fctx->sw_format != old_fctx->sw_format || |         if (new_fctx->format != old_fctx->format || new_fctx->sw_format != old_fctx->sw_format || | ||||||
| @@ -2891,7 +2879,7 @@ error: | |||||||
| static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext *video_ctx, | static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext *video_ctx, | ||||||
|                                            const enum AVPixelFormat *fmt) { |                                            const enum AVPixelFormat *fmt) { | ||||||
|     const enum AVPixelFormat *fmt_idx; |     const enum AVPixelFormat *fmt_idx; | ||||||
|     int bitformat16 = 0, deint = 0; |     int bitformat16 = 0; | ||||||
|  |  | ||||||
|     VideoDecoder *ist = video_ctx->opaque; |     VideoDecoder *ist = video_ctx->opaque; | ||||||
|  |  | ||||||
| @@ -2988,6 +2976,7 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext | |||||||
|         } |         } | ||||||
|  |  | ||||||
| #if defined YADIF && defined CUVID | #if defined YADIF && defined CUVID | ||||||
|  |         int deint; | ||||||
|         if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) { |         if (VideoDeinterlace[decoder->Resolution] == VideoDeinterlaceYadif) { | ||||||
|             deint = 0; |             deint = 0; | ||||||
|             ist->filter = 1; // init yadif_cuda |             ist->filter = 1; // init yadif_cuda | ||||||
| @@ -3006,7 +2995,10 @@ static enum AVPixelFormat Cuvid_get_format(CuvidDecoder *decoder, AVCodecContext | |||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|         ist->active_hwaccel_id = HWACCEL_CUVID; |         ist->active_hwaccel_id = HWACCEL_CUVID; | ||||||
| #else | #else | ||||||
|         if (VideoDeinterlace[decoder->Resolution]) {// need deinterlace |         if (video_ctx->codec_id == AV_CODEC_ID_HEVC) { | ||||||
|  |             ist->filter = 0; | ||||||
|  |         } | ||||||
|  |         else if (VideoDeinterlace[decoder->Resolution]) {// need deinterlace | ||||||
|             ist->filter = 1;                       // init deint vaapi |             ist->filter = 1;                       // init deint vaapi | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
| @@ -3039,18 +3031,18 @@ int get_RGB(CuvidDecoder *decoder) { | |||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
|     struct pl_render_params render_params = pl_render_default_params; |     struct pl_render_params render_params = pl_render_default_params; | ||||||
|     struct pl_frame target = {0}; |     struct pl_frame target = {0}; | ||||||
|     const struct pl_fmt *fmt; |     const struct pl_fmt_t *fmt; | ||||||
|  |  | ||||||
|     int offset, x1, y1, x0, y0; |     int  x1=0, y1=0, x0=0, y0=0; | ||||||
|     float faktorx, faktory; |     float faktorx, faktory; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     uint8_t *base; |     uint8_t *base; | ||||||
|     int width; |     int width; | ||||||
|     int height; |     int height; | ||||||
|     GLuint fb, texture; |      | ||||||
|     int current; |     int current; | ||||||
|     GLint texLoc; |      | ||||||
|  |  | ||||||
|     base = decoder->grabbase; |     base = decoder->grabbase; | ||||||
|     width = decoder->grabwidth; |     width = decoder->grabwidth; | ||||||
| @@ -3059,7 +3051,8 @@ int get_RGB(CuvidDecoder *decoder) { | |||||||
|     current = decoder->SurfacesRb[decoder->SurfaceRead]; |     current = decoder->SurfacesRb[decoder->SurfaceRead]; | ||||||
|  |  | ||||||
| #ifndef PLACEBO | #ifndef PLACEBO | ||||||
|  |     GLint texLoc; | ||||||
|  |     GLuint fb, texture; | ||||||
|     glGenTextures(1, &texture); |     glGenTextures(1, &texture); | ||||||
|     GlxCheck(); |     GlxCheck(); | ||||||
|     glBindTexture(GL_TEXTURE_2D, texture); |     glBindTexture(GL_TEXTURE_2D, texture); | ||||||
| @@ -3498,7 +3491,6 @@ extern void cudaLaunchNV12toARGBDrv(uint32_t * d_srcNV12, size_t nSourcePitch, u | |||||||
| /// @param frame    frame to display | /// @param frame    frame to display | ||||||
| /// | /// | ||||||
| static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame) { | static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ctx, AVFrame *frame) { | ||||||
|     uint64_t first_time; |  | ||||||
|     int surface; |     int surface; | ||||||
|     enum AVColorSpace color; |     enum AVColorSpace color; | ||||||
|  |  | ||||||
| @@ -3526,33 +3518,40 @@ static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ | |||||||
|  |  | ||||||
|     // Fix libav colorspace failure |     // Fix libav colorspace failure | ||||||
|     color = frame->colorspace; |     color = frame->colorspace; | ||||||
|     if (color == AVCOL_SPC_UNSPECIFIED) // failure with RTL HD and all SD channels |     if (color == AVCOL_SPC_UNSPECIFIED) { // failure with RTL HD and all SD channels | ||||||
|                                         // with vaapi |                                         // with vaapi | ||||||
|         if (frame->width > 720) |         if (frame->width > 720) { | ||||||
|             color = AVCOL_SPC_BT709; |             color = AVCOL_SPC_BT709; | ||||||
|         else |         } else { | ||||||
|             color = AVCOL_SPC_BT470BG; |             color = AVCOL_SPC_BT470BG; | ||||||
|     if (color == AVCOL_SPC_RGB) // Cuvid decoder failure with SD channels |         } | ||||||
|  |     } | ||||||
|  |     if (color == AVCOL_SPC_RGB) { // Cuvid decoder failure with SD channels | ||||||
|         color = AVCOL_SPC_BT470BG; |         color = AVCOL_SPC_BT470BG; | ||||||
|  |     } | ||||||
|     frame->colorspace = color; |     frame->colorspace = color; | ||||||
|  |  | ||||||
|     // Fix libav Color primaries failures |     // Fix libav Color primaries failures | ||||||
|     if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED) // failure with RTL HD and all SD channels with |     if (frame->color_primaries == AVCOL_PRI_UNSPECIFIED) { // failure with RTL HD and all SD channels with | ||||||
|                                                          // vaapi |                                                          // vaapi | ||||||
|         if (frame->width > 720) |         if (frame->width > 720) { | ||||||
|             frame->color_primaries = AVCOL_PRI_BT709; |             frame->color_primaries = AVCOL_PRI_BT709; | ||||||
|         else |         } else { | ||||||
|             frame->color_primaries = AVCOL_PRI_BT470BG; |             frame->color_primaries = AVCOL_PRI_BT470BG; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     if (frame->color_primaries == AVCOL_PRI_RESERVED0) // cuvid decoder failure with SD channels |     if (frame->color_primaries == AVCOL_PRI_RESERVED0) // cuvid decoder failure with SD channels | ||||||
|         frame->color_primaries = AVCOL_PRI_BT470BG; |         frame->color_primaries = AVCOL_PRI_BT470BG; | ||||||
|  |  | ||||||
|     // Fix libav Color TRC failures |     // Fix libav Color TRC failures | ||||||
|     if (frame->color_trc == AVCOL_TRC_UNSPECIFIED) // failure with RTL HD and all |     if (frame->color_trc == AVCOL_TRC_UNSPECIFIED) { // failure with RTL HD and all | ||||||
|                                                    // SD channels with vaapi |                                                    // SD channels with vaapi | ||||||
|         if (frame->width > 720) |         if (frame->width > 720) { | ||||||
|             frame->color_trc = AVCOL_TRC_BT709; |             frame->color_trc = AVCOL_TRC_BT709; | ||||||
|         else |         } else { | ||||||
|             frame->color_trc = AVCOL_TRC_SMPTE170M; |             frame->color_trc = AVCOL_TRC_SMPTE170M; | ||||||
|  |         } | ||||||
|  |     } | ||||||
|     if (frame->color_trc == AVCOL_TRC_RESERVED0) // cuvid decoder failure with SD channels |     if (frame->color_trc == AVCOL_TRC_RESERVED0) // cuvid decoder failure with SD channels | ||||||
|         frame->color_trc = AVCOL_TRC_SMPTE170M; |         frame->color_trc = AVCOL_TRC_SMPTE170M; | ||||||
|  |  | ||||||
| @@ -3647,10 +3646,10 @@ static void CuvidRenderFrame(CuvidDecoder *decoder, const AVCodecContext *video_ | |||||||
| /// @param decoder  CUVID hw decoder | /// @param decoder  CUVID hw decoder | ||||||
| /// | /// | ||||||
| static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) { | static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) { | ||||||
|     unsigned int version, ret; |      | ||||||
|  |     (void)decoder; | ||||||
|     Debug(3, "Initializing cuvid hwaccel thread ID:%ld\n", (long int)syscall(186)); |     Debug(3, "Initializing cuvid hwaccel thread ID:%ld\n", (long int)syscall(186)); | ||||||
|     // turn NULL; |      | ||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|     if (decoder->cuda_ctx) { |     if (decoder->cuda_ctx) { | ||||||
|         Debug(3, "schon passiert\n"); |         Debug(3, "schon passiert\n"); | ||||||
| @@ -3658,7 +3657,7 @@ static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (!cu) { |     if (!cu) { | ||||||
|         ret = cuda_load_functions(&cu, NULL); |         int ret = cuda_load_functions(&cu, NULL); | ||||||
|         if (ret < 0) { |         if (ret < 0) { | ||||||
|             Error(_("Could not dynamically load CUDA\n")); |             Error(_("Could not dynamically load CUDA\n")); | ||||||
|             return 0; |             return 0; | ||||||
| @@ -3670,7 +3669,7 @@ static void *CuvidGetHwAccelContext(CuvidDecoder *decoder) { | |||||||
|  |  | ||||||
|     if (decoder->cuda_ctx == NULL) |     if (decoder->cuda_ctx == NULL) | ||||||
|         Fatal(_("Kein Cuda device gefunden")); |         Fatal(_("Kein Cuda device gefunden")); | ||||||
|  | //    unsigned int version; | ||||||
| //    cu->cuCtxGetApiVersion(decoder->cuda_ctx, &version); | //    cu->cuCtxGetApiVersion(decoder->cuda_ctx, &version); | ||||||
| //    Debug(3, "***********CUDA API Version %d\n", version); | //    Debug(3, "***********CUDA API Version %d\n", version); | ||||||
| #endif | #endif | ||||||
| @@ -3729,7 +3728,7 @@ static void CuvidAdvanceDecoderFrame(CuvidDecoder *decoder) { | |||||||
| #if defined PLACEBO && PL_API_VER >= 58 | #if defined PLACEBO && PL_API_VER >= 58 | ||||||
|  |  | ||||||
| static const struct pl_hook *parse_user_shader(char *shader) { | static const struct pl_hook *parse_user_shader(char *shader) { | ||||||
|     char tmp[200]; |     char tmp[400]; | ||||||
|  |  | ||||||
|     if (!shader) |     if (!shader) | ||||||
|         return NULL; |         return NULL; | ||||||
| @@ -3792,26 +3791,23 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|     struct pl_deband_params deband; |     struct pl_deband_params deband; | ||||||
|     struct pl_color_adjustment colors; |     struct pl_color_adjustment colors; | ||||||
|     struct pl_cone_params cone; |     struct pl_cone_params cone; | ||||||
|     struct pl_tex_vk *vkp; |     //struct pl_tex_vk *vkp; | ||||||
|     struct pl_plane *pl; |     struct pl_plane *pl; | ||||||
|     struct pl_tex *tex0, *tex1; |     //struct pl_tex *tex0, *tex1; | ||||||
|  |  | ||||||
|     struct pl_frame *img; |     struct pl_frame *img; | ||||||
|     bool ok; |     //bool ok; | ||||||
|     VdpRect video_src_rect; |     VdpRect video_src_rect; | ||||||
|     VdpRect dst_rect; |     //VdpRect dst_rect; | ||||||
|     VdpRect dst_video_rect; |     VdpRect dst_video_rect; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     int current; |     int current; | ||||||
|     int y; |  | ||||||
|     float xcropf, ycropf; |  | ||||||
|     GLint texLoc; |  | ||||||
|     AVFrame *frame; |  | ||||||
|     AVFrameSideData *sd, *sd1 = NULL, *sd2 = NULL; |  | ||||||
|  |  | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
|  |      | ||||||
|  |   | ||||||
|  | #if 0 | ||||||
|     if (level) { |     if (level) { | ||||||
|         dst_rect.x0 = decoder->VideoX; // video window output (clip) |         dst_rect.x0 = decoder->VideoX; // video window output (clip) | ||||||
|         dst_rect.y0 = decoder->VideoY; |         dst_rect.y0 = decoder->VideoY; | ||||||
| @@ -3823,7 +3819,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|         dst_rect.x1 = VideoWindowWidth; |         dst_rect.x1 = VideoWindowWidth; | ||||||
|         dst_rect.y1 = VideoWindowHeight; |         dst_rect.y1 = VideoWindowHeight; | ||||||
|     } |     } | ||||||
|  | #endif | ||||||
|     video_src_rect.x0 = decoder->CropX; // video source (crop) |     video_src_rect.x0 = decoder->CropX; // video source (crop) | ||||||
|     video_src_rect.y0 = decoder->CropY; |     video_src_rect.y0 = decoder->CropY; | ||||||
|     video_src_rect.x1 = decoder->CropX + decoder->CropWidth; |     video_src_rect.x1 = decoder->CropX + decoder->CropWidth; | ||||||
| @@ -3835,12 +3831,13 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|     dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight; |     dst_video_rect.y1 = decoder->OutputY + decoder->OutputHeight; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     xcropf = (float)decoder->CropX / (float)decoder->InputWidth; |     | ||||||
|     ycropf = (float)decoder->CropY / (float)decoder->InputHeight; |  | ||||||
|  |  | ||||||
|     current = decoder->SurfacesRb[decoder->SurfaceRead]; |     current = decoder->SurfacesRb[decoder->SurfaceRead]; | ||||||
|  |  | ||||||
| #ifdef USE_DRM | #ifdef USE_DRM | ||||||
|  |      | ||||||
|  |     AVFrameSideData *sd, *sd1 = NULL, *sd2 = NULL; | ||||||
|     if (!decoder->Closing) { |     if (!decoder->Closing) { | ||||||
|         frame = decoder->frames[current]; |         frame = decoder->frames[current]; | ||||||
|         sd1 = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); |         sd1 = av_frame_get_side_data(frame, AV_FRAME_DATA_MASTERING_DISPLAY_METADATA); | ||||||
| @@ -3852,6 +3849,14 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|  |  | ||||||
|     // Render Progressive frame |     // Render Progressive frame | ||||||
| #ifndef PLACEBO | #ifndef PLACEBO | ||||||
|  |      | ||||||
|  |     GLint texLoc; | ||||||
|  |     int y;  | ||||||
|  |     float xcropf, ycropf; | ||||||
|  |  | ||||||
|  |     xcropf = (float)decoder->CropX / (float)decoder->InputWidth; | ||||||
|  |     ycropf = (float)decoder->CropY / (float)decoder->InputHeight; | ||||||
|  |  | ||||||
|     y = VideoWindowHeight - decoder->OutputY - decoder->OutputHeight; |     y = VideoWindowHeight - decoder->OutputY - decoder->OutputHeight; | ||||||
|     if (y < 0) |     if (y < 0) | ||||||
|         y = 0; |         y = 0; | ||||||
| @@ -3890,8 +3895,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|     else |     else | ||||||
|         render_params.lut = NULL; |         render_params.lut = NULL; | ||||||
|          |          | ||||||
|     frame = decoder->frames[current]; |     | ||||||
|  |  | ||||||
|     // Fix Color Parameters |     // Fix Color Parameters | ||||||
|  |  | ||||||
|     switch (decoder->ColorSpace) { |     switch (decoder->ColorSpace) { | ||||||
| @@ -3974,6 +3978,9 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|     // target.repr.bits.bit_shift =0; |     // target.repr.bits.bit_shift =0; | ||||||
|  |  | ||||||
| #if USE_DRM | #if USE_DRM | ||||||
|  |     AVFrame *frame; | ||||||
|  |     frame = decoder->frames[current]; | ||||||
|  |  | ||||||
|     switch (VulkanTargetColorSpace) { |     switch (VulkanTargetColorSpace) { | ||||||
|         case 0: // Monitor |         case 0: // Monitor | ||||||
|             memcpy(&target->color, &pl_color_space_monitor, sizeof(struct pl_color_space)); |             memcpy(&target->color, &pl_color_space_monitor, sizeof(struct pl_color_space)); | ||||||
| @@ -4102,7 +4109,11 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|     render_params.downscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter; |     render_params.downscaler = pl_filter_presets[VideoScaling[decoder->Resolution]].filter; | ||||||
|  |  | ||||||
|     if (level) |     if (level) | ||||||
|  | #if PL_API_VER < 346 | ||||||
|         render_params.skip_target_clearing = 1; |         render_params.skip_target_clearing = 1; | ||||||
|  | #else | ||||||
|  |         render_params.border = PL_CLEAR_SKIP; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|     render_params.color_adjustment = &colors; |     render_params.color_adjustment = &colors; | ||||||
|  |  | ||||||
| @@ -4198,7 +4209,11 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|  |  | ||||||
|         //	render_params.lut = NULL; |         //	render_params.lut = NULL; | ||||||
|         render_params.num_hooks = 0; |         render_params.num_hooks = 0; | ||||||
|  | #if PL_API_VER < 346 | ||||||
|         render_params.skip_target_clearing = 1; |         render_params.skip_target_clearing = 1; | ||||||
|  | #else | ||||||
|  |         render_params.border = PL_CLEAR_SKIP; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|         if (!p->renderertest) |         if (!p->renderertest) | ||||||
|             p->renderertest = pl_renderer_create(p->ctx, p->gpu); |             p->renderertest = pl_renderer_create(p->ctx, p->gpu); | ||||||
| @@ -4211,7 +4226,7 @@ static void CuvidMixVideo(CuvidDecoder *decoder, __attribute__((unused)) int lev | |||||||
|         p->renderertest = NULL; |         p->renderertest = NULL; | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
|     Debug(4, "video/cuvid: yy video surface %p displayed\n", current, decoder->SurfaceRead); |      | ||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
| @@ -4219,7 +4234,7 @@ void make_osd_overlay(int x, int y, int width, int height) { | |||||||
|     const struct pl_fmt *fmt; |     const struct pl_fmt *fmt; | ||||||
|     struct pl_overlay *pl; |     struct pl_overlay *pl; | ||||||
|  |  | ||||||
|     int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y); |      | ||||||
|  |  | ||||||
|     fmt = pl_find_named_fmt(p->gpu, "rgba8"); // 8 Bit RGB |     fmt = pl_find_named_fmt(p->gpu, "rgba8"); // 8 Bit RGB | ||||||
|  |  | ||||||
| @@ -4284,7 +4299,7 @@ void make_osd_overlay(int x, int y, int width, int height) { | |||||||
|     pl->rect.x1 = x + width; |     pl->rect.x1 = x + width; | ||||||
|     pl->rect.y0 = VideoWindowHeight - height - y; |     pl->rect.y0 = VideoWindowHeight - height - y; | ||||||
| #else | #else | ||||||
|  |     int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y); | ||||||
|     pl->rect.x0 = x; |     pl->rect.x0 = x; | ||||||
|     pl->rect.y0 = VideoWindowHeight - y + offset; // Boden von oben |     pl->rect.y0 = VideoWindowHeight - y + offset; // Boden von oben | ||||||
|     pl->rect.x1 = x + width; |     pl->rect.x1 = x + width; | ||||||
| @@ -4299,6 +4314,7 @@ void make_osd_overlay(int x, int y, int width, int height) { | |||||||
|     part.dst.x1 = x + width; |     part.dst.x1 = x + width; | ||||||
|     part.dst.y0 = VideoWindowHeight - height - y; |     part.dst.y0 = VideoWindowHeight - height - y; | ||||||
| #else | #else | ||||||
|  |     int offset = VideoWindowHeight - (VideoWindowHeight - height - y) - (VideoWindowHeight - y); | ||||||
|     part.dst.x0 = x; |     part.dst.x0 = x; | ||||||
|     part.dst.y0 = VideoWindowHeight - y + offset; // Boden von oben |     part.dst.y0 = VideoWindowHeight - y + offset; // Boden von oben | ||||||
|     part.dst.x1 = x + width; |     part.dst.x1 = x + width; | ||||||
| @@ -4313,30 +4329,33 @@ void make_osd_overlay(int x, int y, int width, int height) { | |||||||
|  |  | ||||||
| static void CuvidDisplayFrame(void) { | static void CuvidDisplayFrame(void) { | ||||||
|  |  | ||||||
|     static uint64_t first_time = 0, round_time = 0; |      | ||||||
|     static uint64_t last_time = 0; |      | ||||||
|     int i; |     int i; | ||||||
|  |  | ||||||
|  | #if defined PLACEBO_GL || defined CUVID | ||||||
|  |     static uint64_t round_time = 0; | ||||||
|  |     //static uint64_t first_time = 0; | ||||||
|  | #endif | ||||||
|  |  | ||||||
|     int filled; |     int filled; | ||||||
|     CuvidDecoder *decoder; |     CuvidDecoder *decoder; | ||||||
|     int RTS_flag; |      | ||||||
|     int valid_frame = 0; |  | ||||||
|     float ldiff; |  | ||||||
|     float turnaround; |  | ||||||
|  |  | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
|     uint64_t diff; |     //uint64_t diff; | ||||||
|     static float fdiff = 23000.0; |     //static float fdiff = 23000.0; | ||||||
|     struct pl_swapchain_frame frame; |     struct pl_swapchain_frame frame; | ||||||
|     struct pl_frame target; |     struct pl_frame target; | ||||||
|     bool ok; |     //bool ok; | ||||||
|  |  | ||||||
|     const struct pl_fmt *fmt; |     //const struct pl_fmt *fmt; | ||||||
|     const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; |     //const float black[4] = {0.0f, 0.0f, 0.0f, 1.0f}; | ||||||
|  | #else | ||||||
|  |     int valid_frame = 0; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifndef PLACEBO | #ifndef PLACEBO | ||||||
|  |     static uint64_t last_time = 0; | ||||||
|     if (CuvidDecoderN) |     if (CuvidDecoderN) | ||||||
|         CuvidDecoders[0]->Frameproc = (float)(GetusTicks() - last_time) / 1000000.0; |         CuvidDecoders[0]->Frameproc = (float)(GetusTicks() - last_time) / 1000000.0; | ||||||
|  |  | ||||||
| @@ -4372,7 +4391,7 @@ static void CuvidDisplayFrame(void) { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     if (CuvidDecoderN) { |     if (CuvidDecoderN) { | ||||||
|         ldiff = (float)(GetusTicks() - round_time) / 1000000.0; |         float ldiff = (float)(GetusTicks() - round_time) / 1000000.0; | ||||||
|         if (ldiff < 100.0 && ldiff > 0.0) |         if (ldiff < 100.0 && ldiff > 0.0) | ||||||
|             CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0; |             CuvidDecoders[0]->Frameproc = (CuvidDecoders[0]->Frameproc + ldiff + ldiff) / 3.0; | ||||||
|     } |     } | ||||||
| @@ -4386,7 +4405,7 @@ static void CuvidDisplayFrame(void) { | |||||||
|     VideoThreadLock(); |     VideoThreadLock(); | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|     last_time = GetusTicks(); |     //last_time = GetusTicks(); | ||||||
|  |  | ||||||
|     while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap |     while (!pl_swapchain_start_frame(p->swapchain, &frame)) { // get new frame wait for previous to swap | ||||||
|         usleep(5); |         usleep(5); | ||||||
| @@ -4441,7 +4460,7 @@ static void CuvidDisplayFrame(void) { | |||||||
|             } |             } | ||||||
|             continue; |             continue; | ||||||
|         } |         } | ||||||
|         valid_frame = 1; |          | ||||||
| #ifdef PLACEBO | #ifdef PLACEBO | ||||||
|         //pthread_mutex_lock(&OSDMutex); |         //pthread_mutex_lock(&OSDMutex); | ||||||
|         if (OsdShown == 1) { // New OSD opened |         if (OsdShown == 1) { // New OSD opened | ||||||
| @@ -4469,6 +4488,7 @@ static void CuvidDisplayFrame(void) { | |||||||
|         } |         } | ||||||
|         //pthread_mutex_unlock(&OSDMutex); |         //pthread_mutex_unlock(&OSDMutex); | ||||||
| #else | #else | ||||||
|  |         valid_frame = 1; | ||||||
|         CuvidMixVideo(decoder, i); |         CuvidMixVideo(decoder, i); | ||||||
| #endif | #endif | ||||||
|         if (i == 0 && decoder->grab) { // Grab frame |         if (i == 0 && decoder->grab) { // Grab frame | ||||||
| @@ -4585,7 +4605,7 @@ static void CuvidDisplayFrame(void) { | |||||||
| } | } | ||||||
|  |  | ||||||
| #ifdef PLACEBO_GL | #ifdef PLACEBO_GL | ||||||
| CuvidSwapBuffer() { | void CuvidSwapBuffer() { | ||||||
| #ifndef USE_DRM | #ifndef USE_DRM | ||||||
|     eglSwapBuffers(eglDisplay, eglSurface); |     eglSwapBuffers(eglDisplay, eglSurface); | ||||||
| //    eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, | //    eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, | ||||||
| @@ -4701,7 +4721,6 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) { | |||||||
|     int filled; |     int filled; | ||||||
|     int64_t audio_clock; |     int64_t audio_clock; | ||||||
|     int64_t video_clock; |     int64_t video_clock; | ||||||
|     int err = 0; |  | ||||||
|     static int speedup = 3; |     static int speedup = 3; | ||||||
|  |  | ||||||
| #ifdef GAMMA | #ifdef GAMMA | ||||||
| @@ -4769,14 +4788,14 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) { | |||||||
| 	} | 	} | ||||||
| #endif | #endif | ||||||
|         if (abs(diff) > 5000 * 90) { // more than 5s |         if (abs(diff) > 5000 * 90) { // more than 5s | ||||||
|             err = CuvidMessage(2, "video: audio/video difference too big %d\n", diff / 90); |             CuvidMessage(2, "video: audio/video difference too big %d\n", diff / 90); | ||||||
|             // decoder->SyncCounter = 1; |             // decoder->SyncCounter = 1; | ||||||
|             // usleep(10); |             // usleep(10); | ||||||
|             goto skip_sync; |             goto skip_sync; | ||||||
|  |  | ||||||
|         } else if (diff > 100 * 90) { |         } else if (diff > 100 * 90) { | ||||||
|  |  | ||||||
|             err = CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90); |             CuvidMessage(4, "video: slow down video, duping frame %d\n", diff / 90); | ||||||
|             ++decoder->FramesDuped; |             ++decoder->FramesDuped; | ||||||
|             if ((speedup && --speedup) || VideoSoftStartSync) |             if ((speedup && --speedup) || VideoSoftStartSync) | ||||||
|                 decoder->SyncCounter = 1; |                 decoder->SyncCounter = 1; | ||||||
| @@ -4785,13 +4804,13 @@ static void CuvidSyncDecoder(CuvidDecoder *decoder) { | |||||||
|             goto out; |             goto out; | ||||||
|  |  | ||||||
|         } else if (diff > 25 * 90) { |         } else if (diff > 25 * 90) { | ||||||
|             err = CuvidMessage(3, "video: slow down video, duping frame %d \n", diff / 90); |             CuvidMessage(3, "video: slow down video, duping frame %d \n", diff / 90); | ||||||
|             ++decoder->FramesDuped; |             ++decoder->FramesDuped; | ||||||
|             decoder->SyncCounter = 1; |             decoder->SyncCounter = 1; | ||||||
|             goto out; |             goto out; | ||||||
|         } else if ((diff < -100 * 90)) { |         } else if ((diff < -100 * 90)) { | ||||||
|             if (filled > 2) { |             if (filled > 2) { | ||||||
|                 err = CuvidMessage(3, "video: speed up video, droping frame %d\n", diff / 90); |                 CuvidMessage(3, "video: speed up video, droping frame %d\n", diff / 90); | ||||||
|                 ++decoder->FramesDropped; |                 ++decoder->FramesDropped; | ||||||
|                 CuvidAdvanceDecoderFrame(decoder); |                 CuvidAdvanceDecoderFrame(decoder); | ||||||
|             } else if ((diff < -100 * 90)) { // give it some time to get frames to drop |             } else if ((diff < -100 * 90)) { // give it some time to get frames to drop | ||||||
| @@ -5281,7 +5300,7 @@ void VideoOsdDrawARGB(int xi, int yi, int width, int height, int pitch, const ui | |||||||
|     } |     } | ||||||
|     Debug(3, "video: osd dirty %dx%d%+d%+d -> %dx%d%+d%+d\n", width, height, x, y, OsdDirtyWidth, OsdDirtyHeight, |     Debug(3, "video: osd dirty %dx%d%+d%+d -> %dx%d%+d%+d\n", width, height, x, y, OsdDirtyWidth, OsdDirtyHeight, | ||||||
|           OsdDirtyX, OsdDirtyY); |           OsdDirtyX, OsdDirtyY); | ||||||
|  |     Debug(4," dummy print %d %d %d %s",xi,yi,pitch,argb); | ||||||
|     VideoThreadUnlock(); |     VideoThreadUnlock(); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -5585,7 +5604,7 @@ void pl_log_intern(void *stream, enum pl_log_level level, const char *msg) { | |||||||
|         [PL_LOG_FATAL] = "fatal", [PL_LOG_ERR] = "error",   [PL_LOG_WARN] = "warn", |         [PL_LOG_FATAL] = "fatal", [PL_LOG_ERR] = "error",   [PL_LOG_WARN] = "warn", | ||||||
|         [PL_LOG_INFO] = "info",   [PL_LOG_DEBUG] = "debug", [PL_LOG_TRACE] = "trace", |         [PL_LOG_INFO] = "info",   [PL_LOG_DEBUG] = "debug", [PL_LOG_TRACE] = "trace", | ||||||
|     }; |     }; | ||||||
|  |     (void)stream; | ||||||
|     printf("%5s: %s\n", prefix[level], msg); |     printf("%5s: %s\n", prefix[level], msg); | ||||||
| } | } | ||||||
|  |  | ||||||
| @@ -5695,7 +5714,8 @@ void InitPlacebo() { | |||||||
|     if (!p->swapchain) { |     if (!p->swapchain) { | ||||||
|         Fatal(_("Failed creating vulkan swapchain!")); |         Fatal(_("Failed creating vulkan swapchain!")); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  | #ifdef VAAPI | ||||||
|     if (!(p->gpu->import_caps.tex & PL_HANDLE_DMA_BUF)) { |     if (!(p->gpu->import_caps.tex & PL_HANDLE_DMA_BUF)) { | ||||||
|         p->has_dma_buf = 0; |         p->has_dma_buf = 0; | ||||||
|         Debug(3, "No support for dma_buf import \n"); |         Debug(3, "No support for dma_buf import \n"); | ||||||
| @@ -5703,16 +5723,20 @@ void InitPlacebo() { | |||||||
|         p->has_dma_buf = 1; |         p->has_dma_buf = 1; | ||||||
|         Debug(3, "dma_buf support available\n"); |         Debug(3, "dma_buf support available\n"); | ||||||
|     } |     } | ||||||
|  | #else | ||||||
|  |     p->has_dma_buf = 0; | ||||||
|  |     Debug(3, "No support for dma_buf import \n"); | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #ifdef PLACEBO_GL | #ifdef PLACEBO_GL | ||||||
|     if (!pl_swapchain_resize(p->swapchain, &VideoWindowWidth, &VideoWindowHeight)) { |     if (!pl_swapchain_resize(p->swapchain, (int *)&VideoWindowWidth, (int *)&VideoWindowHeight)) { | ||||||
|         Fatal(_("libplacebo: failed initializing swapchain\n")); |         Fatal(_("libplacebo: failed initializing swapchain\n")); | ||||||
|     } |     } | ||||||
| #endif | #endif | ||||||
| #if PL_API_VER >= 113 | #if PL_API_VER >= 113 | ||||||
|     // load LUT File |     // load LUT File | ||||||
|     struct file lutf; |     struct file lutf; | ||||||
|     char tmp[200]; |     char tmp[400]; | ||||||
|  |  | ||||||
|     sprintf(tmp, "%s/%s", MyConfigDir, lut_file); |     sprintf(tmp, "%s/%s", MyConfigDir, lut_file); | ||||||
|     if (open_file(tmp, &lutf) && lutf.size) { |     if (open_file(tmp, &lutf) && lutf.size) { | ||||||
| @@ -5818,10 +5842,9 @@ void exit_display() { | |||||||
| } | } | ||||||
|  |  | ||||||
| static void *VideoHandlerThread(void *dummy) { | static void *VideoHandlerThread(void *dummy) { | ||||||
| #ifdef VAAPI | #if defined VAAPI && !defined PLACEBO_GL | ||||||
|     EGLint contextAttrs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; |     EGLint contextAttrs[] = {EGL_CONTEXT_CLIENT_VERSION, 3, EGL_NONE}; | ||||||
| #endif | #endif | ||||||
|     int redSize, greenSize, blueSize, alphaSize; |  | ||||||
|  |  | ||||||
|     prctl(PR_SET_NAME, "video display", 0, 0, 0); |     prctl(PR_SET_NAME, "video display", 0, 0, 0); | ||||||
|  |  | ||||||
| @@ -6585,13 +6608,13 @@ int VideoSetShader(char *s) { | |||||||
| #if defined PLACEBO && PL_API_VER >= 58 | #if defined PLACEBO && PL_API_VER >= 58 | ||||||
|     if (num_shaders == NUM_SHADERS) |     if (num_shaders == NUM_SHADERS) | ||||||
|         return -1; |         return -1; | ||||||
|     p = malloc(strlen(s) + 1); |     char *p = malloc(strlen(s) + 1); | ||||||
|     memcpy(p, s, strlen(s) + 1); |     memcpy(p, s, strlen(s) + 1); | ||||||
|     shadersp[num_shaders++] = p; |     shadersp[num_shaders++] = p; | ||||||
|     CuvidMessage(2, "Use Shader %s\n", s); |     CuvidMessage(2, "Use Shader %s\n", s); | ||||||
|     return 0; |     return 0; | ||||||
| #else | #else | ||||||
|     printf("Shaders are only support with placebo\n"); |     printf("Shaders are only support with placebo (%s)\n",s); | ||||||
|     return -1; |     return -1; | ||||||
| #endif | #endif | ||||||
| } | } | ||||||
| @@ -6907,7 +6930,8 @@ void VideoSetAbove() { | |||||||
| /// | /// | ||||||
| /// Set deinterlace mode. | /// Set deinterlace mode. | ||||||
| /// | /// | ||||||
| void VideoSetDeinterlace(int mode[VideoResolutionMax]) { | void VideoSetDeinterlace(int mode[]) { | ||||||
|  |      | ||||||
| #ifdef CUVID | #ifdef CUVID | ||||||
|     VideoDeinterlace[0] = mode[0]; // 576i |     VideoDeinterlace[0] = mode[0]; // 576i | ||||||
|     VideoDeinterlace[1] = 0;       // mode[1];  // 720p |     VideoDeinterlace[1] = 0;       // mode[1];  // 720p | ||||||
| @@ -6915,6 +6939,7 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax]) { | |||||||
|     VideoDeinterlace[3] = mode[3]; // 1080 |     VideoDeinterlace[3] = mode[3]; // 1080 | ||||||
|     VideoDeinterlace[4] = 0;       // mode[4];  2160p |     VideoDeinterlace[4] = 0;       // mode[4];  2160p | ||||||
| #else | #else | ||||||
|  |     (void)mode; | ||||||
|     VideoDeinterlace[0] = 1; // 576i |     VideoDeinterlace[0] = 1; // 576i | ||||||
|     VideoDeinterlace[1] = 0; // mode[1];  // 720p |     VideoDeinterlace[1] = 0; // mode[1];  // 720p | ||||||
|     VideoDeinterlace[2] = 1; // fake 1080 |     VideoDeinterlace[2] = 1; // fake 1080 | ||||||
| @@ -6927,7 +6952,7 @@ void VideoSetDeinterlace(int mode[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// Set skip chroma deinterlace on/off. | /// Set skip chroma deinterlace on/off. | ||||||
| /// | /// | ||||||
| void VideoSetSkipChromaDeinterlace(int onoff[VideoResolutionMax]) { | void VideoSetSkipChromaDeinterlace(int onoff[]) { | ||||||
|     VideoSkipChromaDeinterlace[0] = onoff[0]; |     VideoSkipChromaDeinterlace[0] = onoff[0]; | ||||||
|     VideoSkipChromaDeinterlace[1] = onoff[1]; |     VideoSkipChromaDeinterlace[1] = onoff[1]; | ||||||
|     VideoSkipChromaDeinterlace[2] = onoff[2]; |     VideoSkipChromaDeinterlace[2] = onoff[2]; | ||||||
| @@ -6939,7 +6964,7 @@ void VideoSetSkipChromaDeinterlace(int onoff[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// Set inverse telecine on/off. | /// Set inverse telecine on/off. | ||||||
| /// | /// | ||||||
| void VideoSetInverseTelecine(int onoff[VideoResolutionMax]) { | void VideoSetInverseTelecine(int onoff[]) { | ||||||
|     VideoInverseTelecine[0] = onoff[0]; |     VideoInverseTelecine[0] = onoff[0]; | ||||||
|     VideoInverseTelecine[1] = onoff[1]; |     VideoInverseTelecine[1] = onoff[1]; | ||||||
|     VideoInverseTelecine[2] = onoff[2]; |     VideoInverseTelecine[2] = onoff[2]; | ||||||
| @@ -6951,7 +6976,7 @@ void VideoSetInverseTelecine(int onoff[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// Set denoise level (0 .. 1000). | /// Set denoise level (0 .. 1000). | ||||||
| /// | /// | ||||||
| void VideoSetDenoise(int level[VideoResolutionMax]) { | void VideoSetDenoise(int level[]) { | ||||||
|     VideoDenoise[0] = level[0]; |     VideoDenoise[0] = level[0]; | ||||||
|     VideoDenoise[1] = level[1]; |     VideoDenoise[1] = level[1]; | ||||||
|     VideoDenoise[2] = level[2]; |     VideoDenoise[2] = level[2]; | ||||||
| @@ -6963,7 +6988,7 @@ void VideoSetDenoise(int level[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// Set sharpness level (-1000 .. 1000). | /// Set sharpness level (-1000 .. 1000). | ||||||
| /// | /// | ||||||
| void VideoSetSharpen(int level[VideoResolutionMax]) { | void VideoSetSharpen(int level[]) { | ||||||
|     VideoSharpen[0] = level[0]; |     VideoSharpen[0] = level[0]; | ||||||
|     VideoSharpen[1] = level[1]; |     VideoSharpen[1] = level[1]; | ||||||
|     VideoSharpen[2] = level[2]; |     VideoSharpen[2] = level[2]; | ||||||
| @@ -6977,7 +7002,7 @@ void VideoSetSharpen(int level[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// @param mode table with VideoResolutionMax values | /// @param mode table with VideoResolutionMax values | ||||||
| /// | /// | ||||||
| void VideoSetScaling(int mode[VideoResolutionMax]) { | void VideoSetScaling(int mode[]) { | ||||||
|     VideoScaling[0] = mode[0]; |     VideoScaling[0] = mode[0]; | ||||||
|     VideoScaling[1] = mode[1]; |     VideoScaling[1] = mode[1]; | ||||||
|     VideoScaling[2] = mode[2]; |     VideoScaling[2] = mode[2]; | ||||||
| @@ -6991,7 +7016,7 @@ void VideoSetScaling(int mode[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// @param pixels table with VideoResolutionMax values | /// @param pixels table with VideoResolutionMax values | ||||||
| /// | /// | ||||||
| void VideoSetCutTopBottom(int pixels[VideoResolutionMax]) { | void VideoSetCutTopBottom(int pixels[]) { | ||||||
|     VideoCutTopBottom[0] = pixels[0]; |     VideoCutTopBottom[0] = pixels[0]; | ||||||
|     VideoCutTopBottom[1] = pixels[1]; |     VideoCutTopBottom[1] = pixels[1]; | ||||||
|     VideoCutTopBottom[2] = pixels[2]; |     VideoCutTopBottom[2] = pixels[2]; | ||||||
| @@ -7005,7 +7030,7 @@ void VideoSetCutTopBottom(int pixels[VideoResolutionMax]) { | |||||||
| /// | /// | ||||||
| /// @param pixels   table with VideoResolutionMax values | /// @param pixels   table with VideoResolutionMax values | ||||||
| /// | /// | ||||||
| void VideoSetCutLeftRight(int pixels[VideoResolutionMax]) { | void VideoSetCutLeftRight(int pixels[]) { | ||||||
|     VideoCutLeftRight[0] = pixels[0]; |     VideoCutLeftRight[0] = pixels[0]; | ||||||
|     VideoCutLeftRight[1] = pixels[1]; |     VideoCutLeftRight[1] = pixels[1]; | ||||||
|     VideoCutLeftRight[2] = pixels[2]; |     VideoCutLeftRight[2] = pixels[2]; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user