From d6d2674d2352dfd4028d92f0620ddf9c8efafc9d Mon Sep 17 00:00:00 2001 From: jojo61 Date: Mon, 20 Aug 2018 17:25:39 +0200 Subject: [PATCH] fix for jumpmarks and Screensaver --- Makefile | 16 +++++--- codec.c | 7 ++-- softhddev.c | 107 +++++++++++++++++++++++++--------------------------- video.c | 4 +- 4 files changed, 66 insertions(+), 68 deletions(-) diff --git a/Makefile b/Makefile index 03ce554..769721a 100644 --- a/Makefile +++ b/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): diff --git a/codec.c b/codec.c index 8f38eb2..2cc826e 100644 --- a/codec.c +++ b/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; diff --git a/softhddev.c b/softhddev.c index 2162ecd..b52d852 100644 --- a/softhddev.c +++ b/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); } diff --git a/video.c b/video.c index 24fde59..d7beb27 100644 --- a/video.c +++ b/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;