mirror of
				https://github.com/jojo61/vdr-plugin-softhdcuvid.git
				synced 2025-03-01 10:39:28 +00:00 
			
		
		
		
	fix for jumpmarks and Screensaver
This commit is contained in:
		
							
								
								
									
										16
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								Makefile
									
									
									
									
									
								
							@@ -124,11 +124,11 @@ CONFIG += -DUSE_GLX
 | 
			
		||||
_CFLAGS += $(shell pkg-config --cflags gl glu)
 | 
			
		||||
LIBS += $(shell pkg-config --libs gl glu)
 | 
			
		||||
endif
 | 
			
		||||
ifeq ($(SCREENSAVER),1)
 | 
			
		||||
CONFIG += -DUSE_SCREENSAVER
 | 
			
		||||
_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
 | 
			
		||||
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
 | 
			
		||||
endif
 | 
			
		||||
#ifeq ($(SCREENSAVER),1)
 | 
			
		||||
#CONFIG += -DUSE_SCREENSAVER
 | 
			
		||||
#_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
 | 
			
		||||
#LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
 | 
			
		||||
#endif
 | 
			
		||||
ifeq ($(SWRESAMPLE),1)
 | 
			
		||||
CONFIG += -DUSE_SWRESAMPLE
 | 
			
		||||
#_CFLAGS += $(shell pkg-config --cflags libswresample)
 | 
			
		||||
@@ -151,7 +151,11 @@ _CFLAGS += -I/usr/include/libavresample
 | 
			
		||||
#LIBS += -lavresample
 | 
			
		||||
_CFLAGS += -I/usr/include/libswresample
 | 
			
		||||
_CFLAGS += -I./opengl -I./ -std=c99 -Wdeclaration-after-statement
 | 
			
		||||
LIBS += -lavutil -lswresample -lswscale  -lGLEW  -lGLX -ldl -lcuda  -L/usr/local/cuda-8.0/targets/x86_64-linux/lib -lcudart  -lnvcuvid  
 | 
			
		||||
 | 
			
		||||
LIBS += -L/usr/lib64/opengl/nvidia/lib
 | 
			
		||||
LIBS += -L/usr/local/cuda/lib64
 | 
			
		||||
 | 
			
		||||
LIBS += -lavutil -lswresample -lswscale  -lGLEW  -lGLX -ldl -lcuda  -L/usr/local/cuda/targets/x86_64-linux/lib -lcudart  -lnvcuvid  
 | 
			
		||||
 | 
			
		||||
### Includes and Defines (add further entries here):
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										7
									
								
								codec.c
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								codec.c
									
									
									
									
									
								
							@@ -269,7 +269,7 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
 | 
			
		||||
	int ret;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    Debug(3, "codec: 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));
 | 
			
		||||
 | 
			
		||||
    if (decoder->VideoCtx) {
 | 
			
		||||
@@ -316,12 +316,12 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
 | 
			
		||||
    
 | 
			
		||||
    if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", 2 ,0) < 0) {
 | 
			
		||||
  	  pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
	  Fatal(_("codec: can't set options to video codec!\n"));
 | 
			
		||||
	  Fatal(_("codec: can't set option deint to video codec!\n"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false" ,0) < 0) {
 | 
			
		||||
  	  pthread_mutex_unlock(&CodecLockMutex);
 | 
			
		||||
	  Fatal(_("codec: can't set options to video codec!\n"));
 | 
			
		||||
	  Fatal(_("codec: can't set option drop 2.field  to video codec!\n"));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -457,7 +457,6 @@ next_part:
 | 
			
		||||
	
 | 
			
		||||
	if (ret1 >= 0) {
 | 
			
		||||
		consumed = 1;
 | 
			
		||||
//		return;
 | 
			
		||||
	}		
 | 
			
		||||
	if (ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) {  // decoder is full 
 | 
			
		||||
		ret = 0;
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										107
									
								
								softhddev.c
									
									
									
									
									
								
							
							
						
						
									
										107
									
								
								softhddev.c
									
									
									
									
									
								
							@@ -2690,12 +2690,9 @@ void StillPicture(const uint8_t * data, int size)
 | 
			
		||||
#endif
 | 
			
		||||
    VideoSetTrickSpeed(MyVideoStream->HwDecoder, 1);
 | 
			
		||||
    VideoResetPacket(MyVideoStream);
 | 
			
		||||
    old_video_hardware_decoder = VideoHardwareDecoder;
 | 
			
		||||
    // enable/disable hardware decoder for still picture
 | 
			
		||||
    if (VideoHardwareDecoder != ConfigStillDecoder) {
 | 
			
		||||
	VideoHardwareDecoder = ConfigStillDecoder;
 | 
			
		||||
 | 
			
		||||
	VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE);	// close last stream
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    if (MyVideoStream->CodecID == AV_CODEC_ID_NONE) {
 | 
			
		||||
	// FIXME: should detect codec, see PlayVideo
 | 
			
		||||
@@ -2706,60 +2703,59 @@ void StillPicture(const uint8_t * data, int size)
 | 
			
		||||
#ifdef STILL_DEBUG
 | 
			
		||||
    fprintf(stderr, "still-picture\n");
 | 
			
		||||
#endif
 | 
			
		||||
    for (i = 0; i < (MyVideoStream->CodecID == AV_CODEC_ID_HEVC ? 3 : 4);
 | 
			
		||||
	++i) {
 | 
			
		||||
	const uint8_t *split;
 | 
			
		||||
	int n;
 | 
			
		||||
    for (i = 0; i < (MyVideoStream->CodecID == AV_CODEC_ID_HEVC ? 8 : 10);	++i) {
 | 
			
		||||
		const uint8_t *split;
 | 
			
		||||
		int n;
 | 
			
		||||
 | 
			
		||||
	// FIXME: vdr pes recordings sends mixed audio/video
 | 
			
		||||
	if ((data[3] & 0xF0) == 0xE0) {	// PES packet
 | 
			
		||||
	    split = data;
 | 
			
		||||
	    n = size;
 | 
			
		||||
	    // split the I-frame into single pes packets
 | 
			
		||||
	    do {
 | 
			
		||||
		int len;
 | 
			
		||||
		// FIXME: vdr pes recordings sends mixed audio/video
 | 
			
		||||
		if ((data[3] & 0xF0) == 0xE0) {	// PES packet
 | 
			
		||||
			split = data;
 | 
			
		||||
			n = size;
 | 
			
		||||
			// split the I-frame into single pes packets
 | 
			
		||||
			do {
 | 
			
		||||
			int len;
 | 
			
		||||
 | 
			
		||||
#ifdef DEBUG
 | 
			
		||||
		if (split[0] || split[1] || split[2] != 0x01) {
 | 
			
		||||
		    Error(_("[softhddev] invalid still video packet\n"));
 | 
			
		||||
		    break;
 | 
			
		||||
		}
 | 
			
		||||
			if (split[0] || split[1] || split[2] != 0x01) {
 | 
			
		||||
				Error(_("[softhddev] invalid still video packet\n"));
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		len = (split[4] << 8) + split[5];
 | 
			
		||||
		if (!len || len + 6 > n) {
 | 
			
		||||
		    if ((split[3] & 0xF0) == 0xE0) {
 | 
			
		||||
			// video only
 | 
			
		||||
			while (!PlayVideo3(MyVideoStream, split, n)) {	// feed remaining bytes
 | 
			
		||||
			len = (split[4] << 8) + split[5];
 | 
			
		||||
			if (!len || len + 6 > n) {
 | 
			
		||||
				if ((split[3] & 0xF0) == 0xE0) {
 | 
			
		||||
				// video only
 | 
			
		||||
				while (!PlayVideo3(MyVideoStream, split, n)) {	// feed remaining bytes
 | 
			
		||||
				}
 | 
			
		||||
				}
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		    }
 | 
			
		||||
		    break;
 | 
			
		||||
		}
 | 
			
		||||
		if ((split[3] & 0xF0) == 0xE0) {
 | 
			
		||||
		    // video only
 | 
			
		||||
		    while (!PlayVideo3(MyVideoStream, split, len + 6)) {	// feed it
 | 
			
		||||
		    }
 | 
			
		||||
		}
 | 
			
		||||
		split += 6 + len;
 | 
			
		||||
		n -= 6 + len;
 | 
			
		||||
	    } while (n > 6);
 | 
			
		||||
			if ((split[3] & 0xF0) == 0xE0) {
 | 
			
		||||
				// video only
 | 
			
		||||
				while (!PlayVideo3(MyVideoStream, split, len + 6)) {	// feed it
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			split += 6 + len;
 | 
			
		||||
			n -= 6 + len;
 | 
			
		||||
			} while (n > 6);
 | 
			
		||||
 | 
			
		||||
	    VideoNextPacket(MyVideoStream, MyVideoStream->CodecID);	// terminate last packet
 | 
			
		||||
	} else {			// ES packet
 | 
			
		||||
	    if (MyVideoStream->CodecID != AV_CODEC_ID_MPEG2VIDEO) {
 | 
			
		||||
		VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE);	// close last stream
 | 
			
		||||
		MyVideoStream->CodecID = AV_CODEC_ID_MPEG2VIDEO;
 | 
			
		||||
	    }
 | 
			
		||||
	    VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE,AV_NOPTS_VALUE, data, size);
 | 
			
		||||
	}
 | 
			
		||||
	if (MyVideoStream->CodecID == AV_CODEC_ID_H264) {
 | 
			
		||||
	    VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h264,sizeof(seq_end_h264));
 | 
			
		||||
	} else if (MyVideoStream->CodecID == AV_CODEC_ID_HEVC) {
 | 
			
		||||
	    VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h265,sizeof(seq_end_h265));
 | 
			
		||||
	} else {
 | 
			
		||||
	    VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg));
 | 
			
		||||
	}
 | 
			
		||||
	VideoNextPacket(MyVideoStream, MyVideoStream->CodecID);	// terminate last packet
 | 
			
		||||
			VideoNextPacket(MyVideoStream, MyVideoStream->CodecID);	// terminate last packet
 | 
			
		||||
		} else {			// ES packet
 | 
			
		||||
			if (MyVideoStream->CodecID != AV_CODEC_ID_MPEG2VIDEO) {
 | 
			
		||||
			VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE);	// close last stream
 | 
			
		||||
			MyVideoStream->CodecID = AV_CODEC_ID_MPEG2VIDEO;
 | 
			
		||||
			}
 | 
			
		||||
			VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE,AV_NOPTS_VALUE, data, size);
 | 
			
		||||
		}
 | 
			
		||||
		if (MyVideoStream->CodecID == AV_CODEC_ID_H264) {
 | 
			
		||||
			VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h264,sizeof(seq_end_h264));
 | 
			
		||||
		} else if (MyVideoStream->CodecID == AV_CODEC_ID_HEVC) {
 | 
			
		||||
			VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h265,sizeof(seq_end_h265));
 | 
			
		||||
		} else {
 | 
			
		||||
			VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg));
 | 
			
		||||
		}
 | 
			
		||||
		VideoNextPacket(MyVideoStream, MyVideoStream->CodecID);	// terminate last packet
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // wait for empty buffers
 | 
			
		||||
@@ -2771,10 +2767,9 @@ void StillPicture(const uint8_t * data, int size)
 | 
			
		||||
#ifdef STILL_DEBUG
 | 
			
		||||
    InStillPicture = 0;
 | 
			
		||||
#endif
 | 
			
		||||
    if (VideoHardwareDecoder != old_video_hardware_decoder) {
 | 
			
		||||
		VideoHardwareDecoder = old_video_hardware_decoder;
 | 
			
		||||
		VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE);	// close last stream
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
	VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE);	// close last stream
 | 
			
		||||
 | 
			
		||||
    VideoSetTrickSpeed(MyVideoStream->HwDecoder, 0);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										4
									
								
								video.c
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								video.c
									
									
									
									
									
								
							@@ -1185,7 +1185,7 @@ int redSize, greenSize, blueSize;
 | 
			
		||||
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize); 
 | 
			
		||||
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize); 
 | 
			
		||||
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize); 
 | 
			
		||||
printf("RGB size %d:%d:%d\n",redSize, greenSize, blueSize); 
 | 
			
		||||
//printf("RGB size %d:%d:%d\n",redSize, greenSize, blueSize); 
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
	
 | 
			
		||||
@@ -1200,7 +1200,7 @@ printf("RGB size %d:%d:%d\n",redSize, greenSize, blueSize);
 | 
			
		||||
		GlxEnabled = 0;
 | 
			
		||||
		return;
 | 
			
		||||
    }
 | 
			
		||||
printf("bits per RGB %d\n",vi->bits_per_rgb);
 | 
			
		||||
//printf("bits per RGB %d\n",vi->bits_per_rgb);
 | 
			
		||||
    if (vi->bits_per_rgb < 8) {
 | 
			
		||||
		Error(_("video/glx: need atleast 8-bits per RGB\n"));
 | 
			
		||||
		GlxEnabled = 0;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user