Mercurial > pt1.oyama
annotate src/recpt1.h @ 176:2ae60285f383
Change DLNA display name.
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Mon, 05 Nov 2012 23:11:32 +0900 |
parents | 4f3640bf350d |
children |
rev | line source |
---|---|
100
aeba1988234f
support macros to specify sid:
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
96
diff
changeset
|
1 /* -*- tab-width: 4; indent-tabs-mode: nil -*- */ |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
2 #ifndef _RECPT1_H_ |
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
3 #define _RECPT1_H_ |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
4 #include <sys/types.h> |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
5 #include <netdb.h> |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
6 #include <arpa/inet.h> |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
7 #include <netinet/in.h> |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
8 #include "decoder.h" |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
9 #include "tssplitter_lite.h" |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
10 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
11 #define HAVE_LIBARIB25 1 |
139 | 12 #define NUM_BSDEV 16 |
13 #define NUM_ISDB_T_DEV 16 | |
18
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
14 #define CHTYPE_SATELLITE 0 /* satellite digital */ |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
15 #define CHTYPE_GROUND 1 /* terrestrial digital */ |
11
4615eaf04415
support signal strength calculation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
16 #define MAX_QUEUE 8192 |
96
52f8e081763d
add an option to specify the necessary service IDs.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
87
diff
changeset
|
17 #define MAX_READ_SIZE (188 * 87) /* 188*87=16356 splitterが188アライメントを期待しているのでこの数字とする*/ |
11
4615eaf04415
support signal strength calculation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
18 #define WRITE_SIZE (1024 * 1024 * 2) |
4615eaf04415
support signal strength calculation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
19 #define TRUE 1 |
4615eaf04415
support signal strength calculation.
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
6
diff
changeset
|
20 #define FALSE 0 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
21 #define STREAM_MAX (16) |
152
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
22 #define CHANNEL_MAX (256) |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
23 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
24 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
25 /* type definitions */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
26 typedef int boolean; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
27 |
4 | 28 typedef struct _BUFSZ { |
6 | 29 int size; |
4 | 30 u_char buffer[MAX_READ_SIZE]; |
3 | 31 } BUFSZ; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
32 |
4 | 33 typedef struct _QUEUE_T { |
18
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
34 unsigned int in; // 次に入れるインデックス |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
35 unsigned int out; // 次に出すインデックス |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
36 unsigned int size; // キューのサイズ |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
37 unsigned int num_avail; // 満タンになると 0 になる |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
38 unsigned int num_used; // 空っぽになると 0 になる |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
39 pthread_mutex_t mutex; |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
40 pthread_cond_t cond_avail; // データが満タンのときに待つための cond |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
41 pthread_cond_t cond_used; // データが空のときに待つための cond |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
42 BUFSZ *buffer[1]; // バッファポインタ |
3 | 43 } QUEUE_T; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
44 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
45 typedef struct _STREAM_QUEUE_T { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
46 unsigned int in; // 次に入れるインデックス |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
47 unsigned int out; // 次に出すインデックス |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
48 unsigned int size; // キューのサイズ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
49 unsigned int num_avail; // 満タンになると 0 になる |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
50 unsigned int num_used; // 空っぽになると 0 になる |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
51 pthread_mutex_t mutex; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
52 pthread_cond_t cond_avail; // データが満タンのときに待つための cond |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
53 pthread_cond_t cond_used; // データが空のときに待つための cond |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
54 ARIB_STD_B25_BUFFER *buffer[1]; // バッファポインタ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
55 } STREAM_QUEUE_T; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
56 |
4 | 57 typedef struct _ISDB_T_FREQ_CONV_TABLE { |
18
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
58 int set_freq; // 実際にioctl()を行う値 |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
59 int type; // チャンネルタイプ |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
60 int add_freq; // 追加する周波数(BS/CSの場合はスロット番号) |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
61 char *parm_freq; // パラメータで受ける値 |
3 | 62 } ISDB_T_FREQ_CONV_TABLE; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
63 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
64 typedef struct sock_data { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
65 int sfd; /* socket fd */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
66 struct sockaddr_in addr; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
67 } sock_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
68 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
69 typedef struct _session { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
70 int id; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
71 int is_valid; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
72 QUEUE_T *p_queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
73 } session; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
74 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
75 typedef struct _streamer { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
76 pthread_mutex_t mutex; //open、close、(recpt1からの)write |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
77 int stream_nr; |
127
5a380559a61e
modify calclate bitrate mechanism.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
78 size_t total_byte; // 送信BYTE数 |
5a380559a61e
modify calclate bitrate mechanism.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
79 struct timespec start; // 開始時刻 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
80 session *stream_session[STREAM_MAX]; //NULL止めの配列 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
81 } streamer; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
82 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
83 typedef struct thread_data { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
84 QUEUE_T *queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
85 QUEUE_T *stream_queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
86 decoder *decoder; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
87 decoder_options *dopt; |
164
7d8a5bb874ad
EXPERIMENTAL: Change phisical channel by mq_recv().
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
155
diff
changeset
|
88 char ch[16]; /* channel is one of the following. Number, C00, BS0_0, CS0 */ |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
89 int lnb; /* LNB voltage */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
90 int tfd; /* tuner fd */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
91 int wfd; /* output file fd */ |
170
4f3640bf350d
Change display name of DLNA.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
164
diff
changeset
|
92 char *device_name; /* "/dev/ptXvideoY" */ |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
93 ISDB_T_FREQ_CONV_TABLE *table; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
94 sock_data *sock_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
95 pthread_t signal_thread; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
96 int recsec; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
97 time_t start_time; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
98 boolean indefinite; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
99 int msqid; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
100 splitter *splitter; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
101 streamer *streamer; |
164
7d8a5bb874ad
EXPERIMENTAL: Change phisical channel by mq_recv().
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
155
diff
changeset
|
102 char sid_list[256]; |
7d8a5bb874ad
EXPERIMENTAL: Change phisical channel by mq_recv().
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
155
diff
changeset
|
103 pthread_mutex_t splitter_mutex; |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
104 } thread_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
105 |
152
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
106 struct channel_info { |
155
5d010d0ff6a1
Change line number of the CSV file to be used for ID management.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
152
diff
changeset
|
107 int id; |
152
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
108 char *sid; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
109 char *tp; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
110 char *name; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
111 }; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
112 |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
113 struct channel_info_list { |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
114 int nr_channel; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
115 struct channel_info *channel_info[CHANNEL_MAX]; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
116 }; |
30e91361506a
EXPERIMENTAL: Enable change phisical channel by DLNA.(ISDB-T only)
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
139
diff
changeset
|
117 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
118 QUEUE_T *create_queue(size_t size); |
135
1d343a4eb657
modify function prototype.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
133
diff
changeset
|
119 BUFSZ *dequeue(QUEUE_T *p_queue); |
1d343a4eb657
modify function prototype.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
133
diff
changeset
|
120 ARIB_STD_B25_BUFFER *stream_dequeue(STREAM_QUEUE_T *p_queue); |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
121 void destroy_queue(QUEUE_T *p_queue); |
125
e413158cae13
Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
124
diff
changeset
|
122 void destroy_stream_queue(STREAM_QUEUE_T *p_queue); |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
123 |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
124 #endif |