diff options
author | deva <deva> | 2005-03-26 10:32:50 +0000 |
---|---|---|
committer | deva <deva> | 2005-03-26 10:32:50 +0000 |
commit | 63ac729b32331438a607ec5b8be046143c7592e6 (patch) | |
tree | 4f4606119fe178024ccd9b27a0e44757a572d3ad /src/player.cc | |
parent | 13149f3c34de4cad937b1866778030d540674a06 (diff) |
Added an error object for genereic error message handling.
Diffstat (limited to 'src/player.cc')
-rw-r--r-- | src/player.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/player.cc b/src/player.cc index a860afa..9a697f9 100644 --- a/src/player.cc +++ b/src/player.cc @@ -25,11 +25,15 @@ #include "player.h" -Player::Player(volatile int *grunning, +Player::Player(Error *err, + volatile int *grunning, sem_t *gsem, Queue<FFFrame> *gqueue, pthread_mutex_t *gmutex) { + char errbuf[256]; + errobj = err; + running = grunning; sem = gsem; queue = gqueue; @@ -38,17 +42,19 @@ Player::Player(volatile int *grunning, sem_init(&play_sem, 0, 1); if(SDL_Init(SDL_INIT_VIDEO) < 0) { - fprintf(stderr, "Unable to init SDL: %s\n", SDL_GetError()); - exit(1); + sprintf(errbuf, "Unable to init SDL: %s\n", SDL_GetError()); + errobj->setError(errbuf); + return; } screen = SDL_SetVideoMode(DISPLAYWIDTH, DISPLAYHEIGHT, 16, SDL_HWSURFACE|SDL_ANYFORMAT|SDL_HWACCEL); if(!screen) { - fprintf(stderr, "Unable to set %dx%d video: %s\n", + sprintf(errbuf, "Unable to set %dx%d video: %s\n", DISPLAYWIDTH, DISPLAYHEIGHT, SDL_GetError()); - exit(1); + errobj->setError(errbuf); + return; } overlay = SDL_CreateYUVOverlay(DISPLAYWIDTH, DISPLAYHEIGHT, SDL_IYUV_OVERLAY, screen); |