Annotation of multiplexer/init.c, revision 1.8
1.1 oskar 1: /*
2: * ISO 13818 stream multiplexer
3: * Copyright (C) 2001 Convergence Integrated Media GmbH Berlin
1.7 oskar 4: * Author: Oskar Schirmer (schirmer@scara.com)
1.6 oskar 5: *
6: * This program is free software; you can redistribute it and/or modify
7: * it under the terms of the GNU General Public License as published by
8: * the Free Software Foundation; either version 2 of the License, or
9: * (at your option) any later version.
10: *
11: * This program is distributed in the hope that it will be useful,
12: * but WITHOUT ANY WARRANTY; without even the implied warranty of
13: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14: * GNU General Public License for more details.
15: *
16: * You should have received a copy of the GNU General Public License
17: * along with this program; if not, write to the Free Software
18: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1.1 oskar 19: */
20:
21: /*
22: * Module: Init
23: * Purpose: Initialization and start the dispatcher loop.
24: */
25:
1.7 oskar 26: #include <signal.h>
1.1 oskar 27: #include "global.h"
1.8 ! oskar 28: #include "crc32.h"
1.1 oskar 29: #include "error.h"
30: #include "input.h"
31: #include "output.h"
32: #include "splice.h"
33: #include "command.h"
34: #include "dispatch.h"
35:
1.7 oskar 36: static void signalhandler(int sig)
37: {
38: exit (0);
39: }
40:
41: static void system_init ()
42: {
43: signal (SIGINT, (void *) (*signalhandler));
44: signal (SIGPIPE, SIG_IGN);
45: }
46:
1.4 oskar 47: int main (int argc,
1.1 oskar 48: char *argv[])
49: {
50: int a;
1.7 oskar 51: system_init ();
1.1 oskar 52: global_init ();
53: a = msec_now ();
1.8 ! oskar 54: gen_crc32_table ();
1.1 oskar 55: if (input_init ()) {
56: if (output_init ()) {
57: if (splice_init ()) {
58: if (dispatch_init ()) {
59: if (command_init (argc,&argv[0])) {
60: dispatch ();
1.3 oskar 61: #ifdef DEBUG_TIMEPOLL
1.1 oskar 62: warn (LDEB,"Global delta",EINI,0,0,global_delta);
1.3 oskar 63: warn (LERR,"(msec) Exit Time ",EINI,0,0,
1.1 oskar 64: msec_now () - a);
1.3 oskar 65: warn (LERR,"(msec) Exit Clock",EINI,0,0,
1.1 oskar 66: clock ()/(CLOCKS_PER_SEC/1000));
1.3 oskar 67: #endif
1.1 oskar 68: }
1.2 oskar 69: exit (EXIT_SUCCESS);
1.1 oskar 70: } else {
71: warn (LERR,"Dispatch Fail",EINI,0,6,0);
72: }
73: } else {
74: warn (LERR,"Splice Fail",EINI,0,5,0);
75: }
76: } else {
77: warn (LERR,"Output Fail",EINI,0,4,0);
78: }
79: } else {
80: warn (LERR,"Input Fail",EINI,0,3,0);
81: }
82: exit (EXIT_FAILURE);
83: }
84:
LinuxTV legacy CVS <linuxtv.org/cvs>