summaryrefslogtreecommitdiff
path: root/src/player.cc
diff options
context:
space:
mode:
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);