1
0
mirror of https://github.com/jojo61/vdr-plugin-softhdcuvid.git synced 2023-10-10 13:37:41 +02:00

fixed GRAB

This commit is contained in:
jojo61 2018-12-11 17:29:01 +01:00
parent b510de5728
commit 56ee6f0cec

25
video.c
View File

@ -2715,10 +2715,10 @@ int get_RGB(CuvidDecoder *decoder) {
.sample_mode = PL_TEX_SAMPLE_LINEAR, .sample_mode = PL_TEX_SAMPLE_LINEAR,
.address_mode = PL_TEX_ADDRESS_CLAMP, .address_mode = PL_TEX_ADDRESS_CLAMP,
}); });
target.dst_rect.x0 = 0; target.dst_rect.x0 = decoder->OutputX;
target.dst_rect.y0 = 0; target.dst_rect.y0 = decoder->OutputY;
target.dst_rect.x1= width; target.dst_rect.x1= decoder->OutputX + decoder->OutputWidth;
target.dst_rect.y1= height; target.dst_rect.y1= decoder->OutputY + decoder->OutputHeight;
target.repr.sys = PL_COLOR_SYSTEM_RGB; target.repr.sys = PL_COLOR_SYSTEM_RGB;
target.repr.levels = PL_COLOR_LEVELS_PC; target.repr.levels = PL_COLOR_LEVELS_PC;
target.repr.alpha = PL_ALPHA_UNKNOWN; target.repr.alpha = PL_ALPHA_UNKNOWN;
@ -2787,8 +2787,8 @@ static uint8_t *CuvidGrabOutputSurfaceLocked(int *ret_size, int *ret_width, int
// get real surface size // get real surface size
#ifdef PLACEBO #ifdef PLACEBO
width = decoder->OutputWidth; width = decoder->VideoWidth;
height = decoder->OutputHeight; height = decoder->VideoHeight;
#else #else
width = decoder->InputWidth; width = decoder->InputWidth;
height = decoder->InputHeight; height = decoder->InputHeight;
@ -3562,7 +3562,7 @@ static void CuvidMixVideo(CuvidDecoder * decoder, int level)
return; return;
decoder->newchannel = 0; decoder->newchannel = 0;
pl_tex_clear(p->gpu,target->fbo,(float[4]){0});
if (!pl_render_image(p->renderer, &decoder->pl_images[current], target, &render_params)) { if (!pl_render_image(p->renderer, &decoder->pl_images[current], target, &render_params)) {
Fatal(_("Failed rendering frame!\n")); Fatal(_("Failed rendering frame!\n"));
} }
@ -3683,8 +3683,14 @@ static void CuvidDisplayFrame(void)
last_time = GetusTicks(); last_time = GetusTicks();
glClear(GL_COLOR_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT);
#else #else
pl_swapchain_swap_buffers(p->swapchain);
// last_time = GetusTicks(); diff = (GetusTicks()-last_time)/1000000;
// printf("Time wait %2.2f \n",(float)(diff));
last_time = GetusTicks();
pl_swapchain_swap_buffers(p->swapchain); // swap buffers
// printf(" Latency %d Time wait %2.2f\n",pl_swapchain_latency(p->swapchain),(float)(GetusTicks()-last_time)/1000000.0); // printf(" Latency %d Time wait %2.2f\n",pl_swapchain_latency(p->swapchain),(float)(GetusTicks()-last_time)/1000000.0);
last_time = GetusTicks(); last_time = GetusTicks();
@ -3752,6 +3758,7 @@ static void CuvidDisplayFrame(void)
decoder->StartCounter++; decoder->StartCounter++;
filled = atomic_read(&decoder->SurfacesFilled); filled = atomic_read(&decoder->SurfacesFilled);
//printf("Filled %d\n",filled);
// need 1 frame for progressive, 3 frames for interlaced // need 1 frame for progressive, 3 frames for interlaced
if (filled < 1 + 2 * decoder->Interlaced) { if (filled < 1 + 2 * decoder->Interlaced) {
// FIXME: rewrite MixVideo to support less surfaces // FIXME: rewrite MixVideo to support less surfaces