mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
Fixes for drm Aspectratio and UHD HDR
This commit is contained in:
parent
269c396a2c
commit
1674600882
13
codec.c
13
codec.c
@ -502,6 +502,7 @@ extern int CuvidTestSurfaces();
|
||||
extern int init_filters(AVCodecContext * dec_ctx, void *decoder, AVFrame * frame);
|
||||
extern int push_filters(AVCodecContext * dec_ctx, void *decoder, AVFrame * frame);
|
||||
#endif
|
||||
|
||||
#ifdef VAAPI
|
||||
void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
{
|
||||
@ -522,8 +523,11 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
if (!CuvidTestSurfaces())
|
||||
usleep(1000);
|
||||
|
||||
ret = 0;
|
||||
while (ret >= 0) {
|
||||
frame = av_frame_alloc();
|
||||
ret = avcodec_receive_frame(video_ctx, frame);
|
||||
|
||||
if (ret < 0 && ret != AVERROR(EAGAIN) && ret != AVERROR_EOF) {
|
||||
Debug(4, "codec: receiving video frame failed");
|
||||
av_frame_free(&frame);
|
||||
@ -541,17 +545,20 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
}
|
||||
}
|
||||
if (frame->interlaced_frame && decoder->filter == 2 && (frame->height != 720)) { // broken ZDF sends Interlaced flag
|
||||
ret = push_filters(video_ctx, decoder->HwDecoder, frame);
|
||||
return;
|
||||
push_filters(video_ctx, decoder->HwDecoder, frame);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
VideoRenderFrame(decoder->HwDecoder, video_ctx, frame);
|
||||
} else {
|
||||
av_frame_free(&frame);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CUVID
|
||||
|
||||
void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
@ -582,7 +589,7 @@ void CodecVideoDecode(VideoDecoder * decoder, const AVPacket * avpkt)
|
||||
if (!CuvidTestSurfaces())
|
||||
usleep(1000);
|
||||
|
||||
// printf("send packet to decode %s\n",consumed?"ok":"Full");
|
||||
// printf("send packet to decode %s %04x\n",consumed?"ok":"Full",ret1);
|
||||
|
||||
if ((ret1 == AVERROR(EAGAIN) || ret1 == AVERROR_EOF || ret1 >= 0) && CuvidTestSurfaces()) {
|
||||
ret = 0;
|
||||
|
9
drm.c
9
drm.c
@ -257,10 +257,15 @@ static int FindDevice(VideoRender * render)
|
||||
continue;
|
||||
|
||||
if (connector->connection == DRM_MODE_CONNECTED && connector->count_modes > 0) {
|
||||
render->connector_id = connector->connector_id;
|
||||
float aspect = (float)connector->mmWidth / (float)connector->mmHeight;
|
||||
if ((aspect > 1.70) && (aspect < 1.85)) {
|
||||
render->mmHeight = 90;
|
||||
render->mmWidth = 160;
|
||||
} else {
|
||||
render->mmHeight = connector->mmHeight;
|
||||
render->mmWidth = connector->mmWidth;
|
||||
|
||||
}
|
||||
render->connector_id = connector->connector_id;
|
||||
// FIXME: use default encoder/crtc pair
|
||||
if ((encoder = drmModeGetEncoder(render->fd_drm, connector->encoder_id)) == NULL){
|
||||
fprintf(stderr, "FindDevice: cannot retrieve encoder (%d): %m\n", errno);
|
||||
|
7
video.c
7
video.c
@ -1168,6 +1168,7 @@ static void EglInit(void)
|
||||
|
||||
// create egl context
|
||||
setenv("MESA_GL_VERSION_OVERRIDE","3.3",0);
|
||||
setenv("V3D_DOUBLE_BUFFER","1",0);
|
||||
make_egl();
|
||||
|
||||
if (!glewdone) {
|
||||
@ -1700,7 +1701,7 @@ static void CuvidReleaseSurface(CuvidDecoder * decoder, int surface)
|
||||
#endif
|
||||
if (decoder->fds[surface*Planes]) {
|
||||
close(decoder->fds[surface*Planes]);
|
||||
close(decoder->fds[surface*Planes+1]);
|
||||
// close(decoder->fds[surface*Planes+1]);
|
||||
#ifdef RASPI
|
||||
close(decoder->fds[surface*Planes+2]);
|
||||
#endif
|
||||
@ -2550,10 +2551,9 @@ void generateVAAPIImage(CuvidDecoder * decoder, int index, const AVFrame * frame
|
||||
EGLImageTargetTexture2DOES(GL_TEXTURE_2D, decoder->images[index * Planes + n]);
|
||||
#ifdef RASPI
|
||||
decoder->fds[index*Planes+n] = fd;
|
||||
#else
|
||||
decoder->fds[index*Planes+n] = desc.objects[desc.layers[n].object_index[0]].fd;
|
||||
#endif
|
||||
}
|
||||
decoder->fds[index*Planes+n] = desc.objects[0].fd;
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
eglMakeCurrent(eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
EglCheck();
|
||||
@ -5255,6 +5255,7 @@ void exit_display()
|
||||
}
|
||||
#endif
|
||||
Debug(3,"display thread exit\n");
|
||||
|
||||
}
|
||||
|
||||
static void *VideoHandlerThread(void *dummy)
|
||||
|
Loading…
Reference in New Issue
Block a user