ocarina/lib/driver.cpp

55 lines
1.3 KiB
C++

/*
* Copyright 2014 (c) Anna Schumaker.
*/
#include <driver.h>
Driver :: Driver() {}
Driver :: ~Driver() {}
#ifdef CONFIG_TEST
TestDriver :: TestDriver() : playing(false), cur_pos(0), cur_duration(0) {}
TestDriver :: ~TestDriver() {}
void TestDriver :: init(int *argc, char ***argv, void (*eos_cb)()) { on_eos = eos_cb; }
void TestDriver :: load(const std::string &file) { cur_file = file; }
void TestDriver :: play() { playing = true; }
void TestDriver :: pause() { playing = false; }
void TestDriver :: seek_to(long pos) { cur_pos = pos; }
long TestDriver :: position() { return cur_pos; }
long TestDriver :: duration() { return cur_duration; }
void TestDriver :: eos() { on_eos(); }
#else /* CONFIG_TEST */
GSTDriver :: GSTDriver() {}
GSTDriver :: ~GSTDriver() {}
void GSTDriver :: init(int argc, char **argv, void (*eos_cb)()) { }
void GSTDriver :: load(const std::string &file) { }
void GSTDriver :: play() { }
void GSTDriver :: pause() { }
void GSTDriver :: seek_to(long pos) { }
long GSTDriver :: position() { return 0; }
long GSTDriver :: duration() { return 0; }
#endif /* CONFIG_TEST */
#ifdef CONFIG_TEST
static TestDriver cur_driver;
#else /* CONFIG_TEST */
static GSTDriver cur_driver;
#endif /* CONFIG_TEST */
Driver *driver :: get_driver()
{
return &cur_driver;
}