From d5e0019acc2bccca94e700b0933df0d96558283e Mon Sep 17 00:00:00 2001 From: xliska Date: Fri, 7 Mar 2008 14:00:17 +0000 Subject: [PATCH] ifdefed one sem_getvalue in gl_sdl on MacOSX moved some stuff from display_kona_probe to display_kona init so that ultragrid is not reporting on kona when probing all displays Sill playing with DecompressSequenceBeginS and DecompressSequenceFrameS - DecompressSequenceFrameS returns codecNothingToBlitErr --- ultragrid/src/video_display/gl_sdl.c | 5 +++- ultragrid/src/video_display/kona.c | 39 +++++++++++++++++++--------- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/ultragrid/src/video_display/gl_sdl.c b/ultragrid/src/video_display/gl_sdl.c index 40ee9bb56..c26f96409 100644 --- a/ultragrid/src/video_display/gl_sdl.c +++ b/ultragrid/src/video_display/gl_sdl.c @@ -125,7 +125,7 @@ void * display_gl_init(void) s->magic = MAGIC_GL; if (!(s->display = XOpenDisplay(NULL))) { - printf("Unable to open display.\n"); + printf("Unable to open display GL: XOpenDisplay.\n"); return NULL; } @@ -435,12 +435,15 @@ static void * display_thread_gl(void *arg) } /* Check to see if we have data yet, if not, just chillax */ + /* TODO: we need some solution (TM) for sem_getvalue on MacOS X */ +#ifndef HAVE_MACOSX sem_getvalue(&s->semaphore,&i); while(i<1) { display_gl_handle_events(s); usleep(1000); sem_getvalue(&s->semaphore,&i); } +#endif /* HAVE_MACOSX */ while(1) { GLubyte *line1, *line2; diff --git a/ultragrid/src/video_display/kona.c b/ultragrid/src/video_display/kona.c index f2e78d2a5..38ac5605e 100644 --- a/ultragrid/src/video_display/kona.c +++ b/ultragrid/src/video_display/kona.c @@ -37,6 +37,7 @@ struct state_kona { uint32_t magic; }; + static void* display_thread_kona(void *arg) { @@ -51,8 +52,19 @@ display_thread_kona(void *arg) imageDesc = (ImageDescriptionHandle)NewHandle(0); - ret = DecompressSequenceBegin(&(s->seqID), imageDesc, s->gworld, NULL, NULL, - NULL, srcCopy, NULL, 0, codecNormalQuality, bestSpeedCodec); + ret = DecompressSequenceBeginS(&(s->seqID), + imageDesc, + NULL, + NULL, + s->gworld, + NULL, + NULL, + NULL, + srcCopy, + NULL, + NULL, + codecNormalQuality, + anyCodec); if (ret != noErr) { fprintf(stderr, "Failed DecompressSequenceBeginS\n"); } @@ -65,15 +77,14 @@ display_thread_kona(void *arg) /* TODO */ // memcpy(GetPixBaseAddr(GetGWorldPixMap(s->gworld)), s->buffers[s->image_display], hd_size_x*hd_size_y*hd_color_bpp); - ret = DecompressSequenceFrameWhen(s->seqID, - s->buffers[s->image_display], - hd_size_x*hd_size_y*hd_color_bpp, - 0, - &ignore, - NULL, - nil); + ret = DecompressSequenceFrameS(s->seqID, + s->buffers[s->image_display], + hd_size_x*hd_size_y*hd_color_bpp, + 0, + &ignore, + nil); if (ret != noErr) { - fprintf(stderr, "Failed DecompressSequenceFrameWhen\n"); + fprintf(stderr, "Failed DecompressSequenceFrameS: %d\n", ret); } frames++; @@ -158,9 +169,13 @@ display_kona_init(void) DisposeHandle(componentNameHandle); if (strcmp(cName, "AJA")) { + fprintf(stdout, "Found video output component: %s\n", cName); s->videoDisplayComponent = c; s->videoDisplayComponentInstance = OpenComponent(s->videoDisplayComponent); break; + } else { + fprintf(stderr, "AJA Kona3 not found!\n"); + return NULL; } } @@ -288,6 +303,8 @@ display_kona_done(void *state) if (ret != noErr) { fprintf(stderr, "Failed to close the video output component.\n"); } + + DisposeGWorld(s->gworld); } display_colour_t @@ -325,13 +342,11 @@ display_kona_probe(void) int len = *cName++; cName[len] = 0; - fprintf(stdout, "Found video output component: %s\n", cName); DisposeHandle(componentNameHandle); } if (!foundAJAKona) { - fprintf(stderr, "AJA Kona3 not found!\n"); return NULL; }