summaryrefslogtreecommitdiff
path: root/src/player.cc
diff options
context:
space:
mode:
authordeva <deva>2005-03-26 10:32:50 +0000
committerdeva <deva>2005-03-26 10:32:50 +0000
commit63ac729b32331438a607ec5b8be046143c7592e6 (patch)
tree4f4606119fe178024ccd9b27a0e44757a572d3ad /src/player.cc
parent13149f3c34de4cad937b1866778030d540674a06 (diff)
Added an error object for genereic error message handling.
Diffstat (limited to 'src/player.cc')
-rw-r--r--src/player.cc16
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);