summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjaromil <jaromil@localhost.localdomain>2008-08-22 16:16:50 (GMT)
committer jaromil <jaromil@localhost.localdomain>2008-08-22 16:16:50 (GMT)
commit119f192fc883478c9dce792753faf90964213552 (patch)
treecaff563760c3e45bea3b1913e5f81bfbf1dfe136
parent47437ec8341bc1ed37e18ebe077d987d0fe45336 (diff)
new binary without GUI (no dependencies on X for embedded systems)
-rw-r--r--Makefile12
-rw-r--r--cmdline.cpp26
-rw-r--r--decoder.cpp17
-rw-r--r--decoder.h7
-rw-r--r--linklist.h2
-rw-r--r--utils.cpp12
-rw-r--r--utils.h10
7 files changed, 62 insertions, 24 deletions
diff --git a/Makefile b/Makefile
index 327f6dd..8c981ba 100644
--- a/Makefile
+++ b/Makefile
@@ -14,23 +14,27 @@ GTKLIBS = `pkg-config --libs gtk+-2.0`
# debugging flags:
#CPPFLAGS = -I. -Ixmlrpc++ -Wall -g -ggdb $(GTKFLAGS)
# optimized flags:
-CPPFLAGS = -I. -Ixmlrpc++ -Wall -O2 -fomit-frame-pointer -ffast-math $(GTKFLAGS)
+CPPFLAGS = -I. -Ixmlrpc++ -Wall -O2 -fomit-frame-pointer -ffast-math
LIBS = xmlrpc++/libxmlrpc++.a -lpthread -lssl
-IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o gui.o xmlrpc.o
+IVYSYNC_OBJ = decoder.o thread.o linklist.o utils.o cmdline.o xmlrpc.o
-all: xmlrpc ivysync
+all: xmlrpc ivysync ivysync-nox
xmlrpc:
cd xmlrpc++ && $(MAKE)
-ivysync: $(IVYSYNC_OBJ)
+ivysync: $(IVYSYNC_OBJ) gui.o
$(CPP) $(CPPFLAGS) -o ivysync $(IVYSYNC_OBJ) $(LIBS) $(GTKLIBS)
+ivysync-nox: $(IVYSYNC_OBJ)
+ $(CPP) $(CPPFLAGS) -o ivysync-nox $(IVYSYNC_OBJ) $(LIBS)
+
+
#make clean
clean:
rm -rf *.o *~ ivysync
diff --git a/cmdline.cpp b/cmdline.cpp
index c73ea80..61519f8 100644
--- a/cmdline.cpp
+++ b/cmdline.cpp
@@ -35,7 +35,11 @@
#include <decoder.h>
#include <xmlrpc.h>
+
+#ifdef WITH_GUI
#include <gui.h>
+#endif
+
#include <utils.h>
@@ -50,8 +54,10 @@ int videobuf = 64;
// our global linklist holding all instantiated decoders
Linklist decoders;
+#ifdef WITH_GUI
// graphical interface
Gui *gui;
+#endif
// xmlrpc interface
XmlRpcServer *xmlrpc;
@@ -59,7 +65,7 @@ XmlRpcServer *xmlrpc;
// Threaded daemon
IvySyncDaemon *ivydaemon;
-char *help =
+const char *help =
"Usage: ivysync [-hsDgt] [ -d /dev/video16 [ -p playmode files ] ]\n"
" -h --help show this help\n"
" -t --test dummy testrun: don't open devices\n"
@@ -68,10 +74,13 @@ char *help =
" -d --device activate a device (i.e. /dev/video16)\n"
" -b --buffer size of video buffer in KB (default 64)\n"
" -p --playmode playlist mode (play|cont|loop|rand)\n"
-" -x --xmlrpc run XmlRpc daemon on a network port\n"
-" -g --gui start the graphical user interface\n";
+#ifdef WITH_GUI
+" -g --gui start the graphical user interface\n"
+#endif
+" -x --xmlrpc run XmlRpc daemon on a network port\n";
+
+const char *short_options = "-hd:sb:x:p:gtD:";
-char *short_options = "-hd:sb:x:p:gtD:";
const struct option long_options[] = {
{ "help", no_argument, NULL, 'h'},
{ "device", required_argument, NULL, 'd'},
@@ -79,7 +88,9 @@ const struct option long_options[] = {
{ "buffer", required_argument, NULL, 'b'},
{ "xmlrpc", required_argument, NULL, 'x'},
{ "playmode", required_argument, NULL, 'p'},
+#ifdef WITH_GUI
{ "gui", no_argument, NULL, 'g'},
+#endif
{ "test", no_argument, NULL, 't'},
{ "debug", required_argument, NULL, 'D'},
{0, 0, 0, 0}
@@ -90,7 +101,9 @@ void quitproc (int Sig) { /* signal handling */
N("received signal %u on process %u",Sig,getpid());
A("please wait while quitting threads");
+#ifdef WITH_GUI
if(graphical) gtk_main_quit();
+#endif
Decoder *dec;
dec = (Decoder*)decoders.begin();
@@ -122,7 +135,7 @@ int cmdline(int argc, char **argv) {
int c;
int res;
- N("IvySync 0.3 / (c)2004-2006 Denis Rojo <jaromil@dyne.org>");
+ N("IvySync 0.5 / (c)2004-2008 Denis Roio <jaromil@dyne.org>");
do {
res = getopt_long(argc, argv, short_options, long_options, NULL);
@@ -283,6 +296,8 @@ int main(int argc, char **argv) {
exit(0);
}
+#ifdef WITH_GUI
+
/////////////////////////////////
// setup the graphical interface
if(graphical)
@@ -305,6 +320,7 @@ int main(int argc, char **argv) {
}
////////////////////////////////
+#endif
////////////////////////////////
/// setup the XMLRPC interface
diff --git a/decoder.cpp b/decoder.cpp
index ecdd300..d147ba7 100644
--- a/decoder.cpp
+++ b/decoder.cpp
@@ -18,6 +18,9 @@
* Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
+#include <stdlib.h>
+#include <string.h>
+
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@@ -29,8 +32,10 @@
#include <decoder.h>
#include <utils.h>
-#include <gui.h>
+#ifdef WITH_GUI
+#include <gui.h>
+#endif
Decoder::Decoder()
@@ -41,7 +46,9 @@ Decoder::Decoder()
playing = false;
stopped = false;
dummy = false;
+#ifdef WITH_GUI
gui = false;
+#endif
quit = true;
filesize = 0L;
@@ -59,7 +66,7 @@ Decoder::~Decoder() {
quit = true;
}
-bool Decoder::init(char *dev) {
+bool Decoder::init(const char *dev) {
int len;
if(dummy) {
@@ -186,8 +193,10 @@ void Decoder::update() {
}
}
+#ifdef WITH_GUI
// refresh the GUI if present
if(gui) gui->refresh();
+#endif
}
@@ -291,8 +300,10 @@ void Decoder::run() {
do { // inner reading loop
+#ifdef WITH_GUI
// update the GUI
if(gui) gui->refresh();
+#endif
// process asynchronous flags
if(quit || stopped) break;
@@ -651,6 +662,7 @@ int Decoder::load() {
return c;
}
+#ifdef WITH_GUI
int Decoder::save() {
FILE *fd;
char *home = getenv("HOME");
@@ -693,3 +705,4 @@ int Decoder::save() {
fclose(fd);
return c;
}
+#endif
diff --git a/decoder.h b/decoder.h
index dee8c59..6af8003 100644
--- a/decoder.h
+++ b/decoder.h
@@ -51,7 +51,10 @@
// maximum path lenght
#define MAXPATH 512
+#ifdef WITH_GUI
class Playlist; // graphical interface
+#endif
+
class Decoder : public Thread, public Entry {
@@ -59,7 +62,7 @@ class Decoder : public Thread, public Entry {
Decoder();
~Decoder();
- bool init(char *dev);
+ bool init(const char *dev);
bool setup(bool *sync, int bufsize);
@@ -106,7 +109,9 @@ class Decoder : public Thread, public Entry {
Linklist playlist;
Entry *current; ///< path of movie currently playing
+#ifdef WITH_GUI
Playlist *gui; ///< pointer to the GUI, NULL if none
+#endif
bool dummy; // for dummy test run without devices
diff --git a/linklist.h b/linklist.h
index db030e5..1b06b86 100644
--- a/linklist.h
+++ b/linklist.h
@@ -60,7 +60,7 @@ class Linklist {
Entry *search(char *name);
int *completion(char *needle);
- Entry *Linklist::selected();
+ Entry *selected();
Entry *operator[](int pos) { return pick(pos); };
diff --git a/utils.cpp b/utils.cpp
index bfda08d..e169ad8 100644
--- a/utils.cpp
+++ b/utils.cpp
@@ -17,7 +17,7 @@
*/
#include <iostream>
-#include <string>
+#include <string.h>
#include <cstdio>
#include <stdlib.h>
#include <stdarg.h>
@@ -44,7 +44,7 @@ int get_debug() {
return(verbosity);
}
-void N(char *format, ...) {
+void N(const char *format, ...) {
va_list arg;
va_start(arg, format);
@@ -54,7 +54,7 @@ void N(char *format, ...) {
va_end(arg);
}
-void D(char *format, ...) {
+void D(const char *format, ...) {
if(verbosity>=FUNC) {
va_list arg;
va_start(arg, format);
@@ -66,7 +66,7 @@ void D(char *format, ...) {
}
}
-void E(char *format, ...) {
+void E(const char *format, ...) {
va_list arg;
va_start(arg, format);
@@ -76,7 +76,7 @@ void E(char *format, ...) {
va_end(arg);
}
-void A(char *format, ...) {
+void A(const char *format, ...) {
va_list arg;
va_start(arg, format);
@@ -86,7 +86,7 @@ void A(char *format, ...) {
va_end(arg);
}
-void W(char *format, ...) {
+void W(const char *format, ...) {
if(verbosity>=WARN) {
va_list arg;
va_start(arg, format);
diff --git a/utils.h b/utils.h
index 30684bd..944a1af 100644
--- a/utils.h
+++ b/utils.h
@@ -24,11 +24,11 @@
void set_debug(int lev);
int get_debug();
-void N(char *format, ...);
-void A(char *format, ...);
-void W(char *format, ...);
-void E(char *format, ...);
-void D(char *format, ...);
+void N(const char *format, ...);
+void A(const char *format, ...);
+void W(const char *format, ...);
+void E(const char *format, ...);
+void D(const char *format, ...);
void jsleep(int sec, long nsec);