fix for jumpmarks and Screensaver

This commit is contained in:
jojo61 2018-08-20 17:25:39 +02:00
parent ac3845c79d
commit d6d2674d23
4 changed files with 66 additions and 68 deletions

View File

@ -124,11 +124,11 @@ CONFIG += -DUSE_GLX
_CFLAGS += $(shell pkg-config --cflags gl glu) _CFLAGS += $(shell pkg-config --cflags gl glu)
LIBS += $(shell pkg-config --libs gl glu) LIBS += $(shell pkg-config --libs gl glu)
endif endif
ifeq ($(SCREENSAVER),1) #ifeq ($(SCREENSAVER),1)
CONFIG += -DUSE_SCREENSAVER #CONFIG += -DUSE_SCREENSAVER
_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms) #_CFLAGS += $(shell pkg-config --cflags xcb-screensaver xcb-dpms)
LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms) #LIBS += $(shell pkg-config --libs xcb-screensaver xcb-dpms)
endif #endif
ifeq ($(SWRESAMPLE),1) ifeq ($(SWRESAMPLE),1)
CONFIG += -DUSE_SWRESAMPLE CONFIG += -DUSE_SWRESAMPLE
#_CFLAGS += $(shell pkg-config --cflags libswresample) #_CFLAGS += $(shell pkg-config --cflags libswresample)
@ -151,7 +151,11 @@ _CFLAGS += -I/usr/include/libavresample
#LIBS += -lavresample #LIBS += -lavresample
_CFLAGS += -I/usr/include/libswresample _CFLAGS += -I/usr/include/libswresample
_CFLAGS += -I./opengl -I./ -std=c99 -Wdeclaration-after-statement _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): ### Includes and Defines (add further entries here):

View File

@ -269,7 +269,7 @@ void CodecVideoOpen(VideoDecoder * decoder, int codec_id)
int ret; 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)); avcodec_get_name(codec_id));
if (decoder->VideoCtx) { 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) { if (av_opt_set_int(decoder->VideoCtx->priv_data, "deint", 2 ,0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); 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) { if (av_opt_set(decoder->VideoCtx->priv_data, "drop_second_field", "false" ,0) < 0) {
pthread_mutex_unlock(&CodecLockMutex); 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) { if (ret1 >= 0) {
consumed = 1; consumed = 1;
// return;
} }
if (ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) { // decoder is full if (ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) { // decoder is full
ret = 0; ret = 0;

View File

@ -2690,12 +2690,9 @@ void StillPicture(const uint8_t * data, int size)
#endif #endif
VideoSetTrickSpeed(MyVideoStream->HwDecoder, 1); VideoSetTrickSpeed(MyVideoStream->HwDecoder, 1);
VideoResetPacket(MyVideoStream); 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 VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE); // close last stream
}
if (MyVideoStream->CodecID == AV_CODEC_ID_NONE) { if (MyVideoStream->CodecID == AV_CODEC_ID_NONE) {
// FIXME: should detect codec, see PlayVideo // FIXME: should detect codec, see PlayVideo
@ -2706,60 +2703,59 @@ void StillPicture(const uint8_t * data, int size)
#ifdef STILL_DEBUG #ifdef STILL_DEBUG
fprintf(stderr, "still-picture\n"); fprintf(stderr, "still-picture\n");
#endif #endif
for (i = 0; i < (MyVideoStream->CodecID == AV_CODEC_ID_HEVC ? 3 : 4); for (i = 0; i < (MyVideoStream->CodecID == AV_CODEC_ID_HEVC ? 8 : 10); ++i) {
++i) { const uint8_t *split;
const uint8_t *split; int n;
int n;
// FIXME: vdr pes recordings sends mixed audio/video // FIXME: vdr pes recordings sends mixed audio/video
if ((data[3] & 0xF0) == 0xE0) { // PES packet if ((data[3] & 0xF0) == 0xE0) { // PES packet
split = data; split = data;
n = size; n = size;
// split the I-frame into single pes packets // split the I-frame into single pes packets
do { do {
int len; int len;
#ifdef DEBUG #ifdef DEBUG
if (split[0] || split[1] || split[2] != 0x01) { if (split[0] || split[1] || split[2] != 0x01) {
Error(_("[softhddev] invalid still video packet\n")); Error(_("[softhddev] invalid still video packet\n"));
break; break;
} }
#endif #endif
len = (split[4] << 8) + split[5]; len = (split[4] << 8) + split[5];
if (!len || len + 6 > n) { if (!len || len + 6 > n) {
if ((split[3] & 0xF0) == 0xE0) { if ((split[3] & 0xF0) == 0xE0) {
// video only // video only
while (!PlayVideo3(MyVideoStream, split, n)) { // feed remaining bytes while (!PlayVideo3(MyVideoStream, split, n)) { // feed remaining bytes
}
}
break;
} }
} if ((split[3] & 0xF0) == 0xE0) {
break; // video only
} while (!PlayVideo3(MyVideoStream, split, len + 6)) { // feed it
if ((split[3] & 0xF0) == 0xE0) { }
// video only }
while (!PlayVideo3(MyVideoStream, split, len + 6)) { // feed it split += 6 + len;
} n -= 6 + len;
} } while (n > 6);
split += 6 + len;
n -= 6 + len;
} while (n > 6);
VideoNextPacket(MyVideoStream, MyVideoStream->CodecID); // terminate last packet VideoNextPacket(MyVideoStream, MyVideoStream->CodecID); // terminate last packet
} else { // ES packet } else { // ES packet
if (MyVideoStream->CodecID != AV_CODEC_ID_MPEG2VIDEO) { if (MyVideoStream->CodecID != AV_CODEC_ID_MPEG2VIDEO) {
VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE); // close last stream VideoNextPacket(MyVideoStream, AV_CODEC_ID_NONE); // close last stream
MyVideoStream->CodecID = AV_CODEC_ID_MPEG2VIDEO; MyVideoStream->CodecID = AV_CODEC_ID_MPEG2VIDEO;
} }
VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE,AV_NOPTS_VALUE, data, size); VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE,AV_NOPTS_VALUE, data, size);
} }
if (MyVideoStream->CodecID == AV_CODEC_ID_H264) { if (MyVideoStream->CodecID == AV_CODEC_ID_H264) {
VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h264,sizeof(seq_end_h264)); VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h264,sizeof(seq_end_h264));
} else if (MyVideoStream->CodecID == AV_CODEC_ID_HEVC) { } else if (MyVideoStream->CodecID == AV_CODEC_ID_HEVC) {
VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h265,sizeof(seq_end_h265)); VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE,seq_end_h265,sizeof(seq_end_h265));
} else { } else {
VideoEnqueue(MyVideoStream, AV_NOPTS_VALUE, AV_NOPTS_VALUE, seq_end_mpeg, sizeof(seq_end_mpeg)); 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
} }
// wait for empty buffers // wait for empty buffers
@ -2771,10 +2767,9 @@ void StillPicture(const uint8_t * data, int size)
#ifdef STILL_DEBUG #ifdef STILL_DEBUG
InStillPicture = 0; InStillPicture = 0;
#endif #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); VideoSetTrickSpeed(MyVideoStream->HwDecoder, 0);
} }

View File

@ -1185,7 +1185,7 @@ int redSize, greenSize, blueSize;
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize); glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_RED_SIZE, &redSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize); glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_GREEN_SIZE, &greenSize);
glXGetFBConfigAttrib(XlibDisplay, fbc[0], GLX_BLUE_SIZE, &blueSize); 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; GlxEnabled = 0;
return; 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) { if (vi->bits_per_rgb < 8) {
Error(_("video/glx: need atleast 8-bits per RGB\n")); Error(_("video/glx: need atleast 8-bits per RGB\n"));
GlxEnabled = 0; GlxEnabled = 0;