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