00001 #include <fstream>
00002 #include "yapi.h"
00003 #include "videomux_app.h"
00004 #include "parse_options.h"
00005
00006 using namespace std;
00007
00008 int main(int argc, char *argv[])
00009 {
00010 static struct
00011 {
00012 char* path;
00013 char* fefile;
00014 char* mxfile;
00015 char* befile;
00016 } cmdl;
00017 char fefile[256];
00018 char mxfile[256];
00019 char befile[256];
00020
00021 option_t options[] =
00022 {
00023 { "-path", "str", "srcdir", &cmdl.path, "Environment variable containing path to files"},
00024 { "-fe-file", "str", "videomux.fe.ini", &cmdl.fefile, "Ini file for frontend"},
00025 { "-mx-file", "str", "videomux.mux.ini",&cmdl.mxfile, "Ini file for videomux"},
00026 { "-be-file", "str", "videomux.be.ini", &cmdl.befile, "Ini file for backend"},
00027 { NULL, NULL, NULL, NULL, NULL}
00028 };
00029
00030 if (parse_options("videomux", argc, argv, options))
00031 {
00032 #ifdef VERBOSE
00033 fprintf(stderr, "(use \"-help\" for help)\n");
00034 #endif
00035 exit(1);
00036 }
00037 #ifdef VERBOSE
00038 print_option_values("videomux", options);
00039 #endif
00040
00041 if (getenv(cmdl.path))
00042 {
00043 strcpy(fefile, getenv(cmdl.path));
00044 strcat(fefile, "/");
00045 strcat(fefile, cmdl.fefile);
00046
00047 strcpy(mxfile, getenv(cmdl.path));
00048 strcat(mxfile, "/");
00049 strcat(mxfile, cmdl.mxfile);
00050
00051 strcpy(befile, getenv(cmdl.path));
00052 strcat(befile, "/");
00053 strcat(befile, cmdl.befile);
00054 }
00055 else
00056 {
00057 strcpy(fefile, cmdl.fefile);
00058 strcpy(mxfile, cmdl.mxfile);
00059 strcpy(befile, cmdl.befile);
00060 }
00061
00062
00063 RTE rte;
00064
00065 ofstream f("./Results/videomux.out");
00066 rte.setOutStream(f);
00067
00068 ofstream g("./Results/videomux.err");
00069 rte.setErrorStream(g);
00070
00071 VideoMuxApp *videomuxapp = new VideoMuxApp(
00072 id("videomuxapp"),
00073 fefile,
00074 mxfile,
00075 befile
00076 );
00077
00078 rte.start(*videomuxapp);
00079
00080 ofstream h("./Results/videomux.wrk");
00081 printWorkload(*videomuxapp, h);
00082
00083 ofstream i("./Results/videomux.dot");
00084 printDotty(*videomuxapp, i);
00085
00086 f.close();
00087 g.close();
00088 h.close();
00089 i.close();
00090
00091 delete videomuxapp;
00092 }