comparison recpt1/recpt1core.h @ 140:c9b1d21c5035

separate common function to core library
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Thu, 25 Apr 2013 16:06:15 +0900
parents
children
comparison
equal deleted inserted replaced
139:61ff9cabf962 140:c9b1d21c5035
1 /* -*- tab-width: 4; indent-tabs-mode: nil -*- */
2 #ifndef _RECPT1_UTIL_H_
3 #define _RECPT1_UTIL_H_
4
5 #include <sys/types.h>
6 #include <sys/ipc.h>
7 #include <sys/msg.h>
8 #include <sys/types.h>
9 #include <sys/stat.h>
10 #include <sys/time.h>
11 #include <sys/ioctl.h>
12 #include <sys/ipc.h>
13 #include <sys/msg.h>
14
15 #include <stdio.h>
16 #include <stdlib.h>
17 #include <string.h>
18 #include <ctype.h>
19 #include <getopt.h>
20 #include <fcntl.h>
21 #include <time.h>
22 #include <pthread.h>
23 #include <math.h>
24 #include <unistd.h>
25 #include <signal.h>
26 #include <errno.h>
27 #include <libgen.h>
28 #include <netdb.h>
29 #include <arpa/inet.h>
30 #include <netinet/in.h>
31
32 #include "pt1_ioctl.h"
33 #include "config.h"
34 #include "decoder.h"
35 #include "recpt1.h"
36 #include "mkpath.h"
37 #include "tssplitter_lite.h"
38
39 /* ipc message size */
40 #define MSGSZ 255
41
42 /* used in checksigna.c */
43 #define MAX_RETRY (2)
44
45 /* type definitions */
46 typedef int boolean;
47
48 typedef struct sock_data {
49 int sfd; /* socket fd */
50 struct sockaddr_in addr;
51 } sock_data;
52
53 typedef struct msgbuf {
54 long mtype;
55 char mtext[MSGSZ];
56 } message_buf;
57
58 typedef struct thread_data {
59 int tfd; /* tuner fd */ //xxx variable
60
61 int wfd; /* output file fd */ //invariable
62 int lnb; /* LNB voltage */ //invariable
63 int msqid; //invariable
64 time_t start_time; //invariable
65
66 int recsec; //xxx variable
67
68 boolean indefinite; //invaliable
69 boolean tune_persistent; //invaliable
70
71 QUEUE_T *queue; //invariable
72 ISDB_T_FREQ_CONV_TABLE *table; //invariable
73 sock_data *sock_data; //invariable
74 pthread_t signal_thread; //invariable
75 decoder *decoder; //invariable
76 decoder_options *dopt; //invariable
77 splitter *splitter; //invariable
78 } thread_data;
79
80 extern const char *version;
81 extern char *bsdev[];
82 extern char *isdb_t_dev[];
83
84 extern boolean f_exit;
85
86 /* prototypes */
87 int tune(char *channel, thread_data *tdata, char *device);
88 int close_tuner(thread_data *tdata);
89 void show_channels(void);
90 ISDB_T_FREQ_CONV_TABLE *searchrecoff(char *channel);
91 void calc_cn(int fd, int type, boolean use_bell);
92 int parse_time(char *rectimestr, int *recsec);
93 void do_bell(int bell);
94
95
96 #endif