Mercurial > pt1.oyama
annotate src/recpt1.h @ 149:a9f60d56d673
Fix DLNA problem
author | Naoya OYAMA <naoya.oyama@gmail.com> |
---|---|
date | Sat, 25 Aug 2012 11:10:24 +0900 |
parents | 5eab7c73a28a |
children | 30e91361506a |
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) |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
22 |
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 /* type definitions */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
25 typedef int boolean; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
26 |
4 | 27 typedef struct _BUFSZ { |
6 | 28 int size; |
4 | 29 u_char buffer[MAX_READ_SIZE]; |
3 | 30 } BUFSZ; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
31 |
4 | 32 typedef struct _QUEUE_T { |
18
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
33 unsigned int in; // 次に入れるインデックス |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
34 unsigned int out; // 次に出すインデックス |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
35 unsigned int size; // キューのサイズ |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
36 unsigned int num_avail; // 満タンになると 0 になる |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
37 unsigned int num_used; // 空っぽになると 0 になる |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
38 pthread_mutex_t mutex; |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
39 pthread_cond_t cond_avail; // データが満タンのときに待つための cond |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
40 pthread_cond_t cond_used; // データが空のときに待つための cond |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
41 BUFSZ *buffer[1]; // バッファポインタ |
3 | 42 } QUEUE_T; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
43 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
44 typedef struct _STREAM_QUEUE_T { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
45 unsigned int in; // 次に入れるインデックス |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
46 unsigned int out; // 次に出すインデックス |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
47 unsigned int size; // キューのサイズ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
48 unsigned int num_avail; // 満タンになると 0 になる |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
49 unsigned int num_used; // 空っぽになると 0 になる |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
50 pthread_mutex_t mutex; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
51 pthread_cond_t cond_avail; // データが満タンのときに待つための cond |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
52 pthread_cond_t cond_used; // データが空のときに待つための cond |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
53 ARIB_STD_B25_BUFFER *buffer[1]; // バッファポインタ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
54 } STREAM_QUEUE_T; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
55 |
4 | 56 typedef struct _ISDB_T_FREQ_CONV_TABLE { |
18
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
57 int set_freq; // 実際にioctl()を行う値 |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
58 int type; // チャンネルタイプ |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
59 int add_freq; // 追加する周波数(BS/CSの場合はスロット番号) |
84ff6ef710ea
- support stdout for output
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
11
diff
changeset
|
60 char *parm_freq; // パラメータで受ける値 |
3 | 61 } ISDB_T_FREQ_CONV_TABLE; |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
62 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
63 typedef struct sock_data { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
64 int sfd; /* socket fd */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
65 struct sockaddr_in addr; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
66 } sock_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
67 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
68 typedef struct _session { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
69 int id; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
70 int is_valid; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
71 QUEUE_T *p_queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
72 } session; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
73 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
74 typedef struct _streamer { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
75 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
|
76 int stream_nr; |
127
5a380559a61e
modify calclate bitrate mechanism.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
77 size_t total_byte; // 送信BYTE数 |
5a380559a61e
modify calclate bitrate mechanism.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
125
diff
changeset
|
78 struct timespec start; // 開始時刻 |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
79 session *stream_session[STREAM_MAX]; //NULL止めの配列 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
80 } streamer; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
81 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
82 typedef struct thread_data { |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
83 QUEUE_T *queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
84 QUEUE_T *stream_queue; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
85 decoder *decoder; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
86 decoder_options *dopt; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
87 int ch; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
88 int lnb; /* LNB voltage */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
89 int tfd; /* tuner fd */ |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
90 int wfd; /* output file fd */ |
133
0db6ccf0fe31
modify DLNA display name & UUID
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
127
diff
changeset
|
91 int device_id; /* /dev/pt1video[N] */ |
124
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
92 ISDB_T_FREQ_CONV_TABLE *table; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
93 sock_data *sock_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
94 pthread_t signal_thread; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
95 int recsec; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
96 time_t start_time; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
97 boolean indefinite; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
98 int msqid; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
99 splitter *splitter; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
100 streamer *streamer; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
101 } thread_data; |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
102 |
9c7bc6c0327e
Add DLNA server function test. (from uShare project)
naoyan@johnstown.minaminoshima.org
parents:
100
diff
changeset
|
103 QUEUE_T *create_queue(size_t size); |
135
1d343a4eb657
modify function prototype.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
133
diff
changeset
|
104 BUFSZ *dequeue(QUEUE_T *p_queue); |
1d343a4eb657
modify function prototype.
Naoya OYAMA <naoya.oyama@gmail.com>
parents:
133
diff
changeset
|
105 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
|
106 void destroy_queue(QUEUE_T *p_queue); |
125
e413158cae13
Add ushare project files.
naoyan@johnstown.minaminoshima.org
parents:
124
diff
changeset
|
107 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
|
108 |
1
29f3b2bbbd67
- rename test.c to recpt1.c
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
diff
changeset
|
109 #endif |