comparison recpt1/recpt1.c @ 6:d898fd27547f

cleanups
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 17 Feb 2009 11:39:26 +0900
parents 97fd2315114e
children 407af34cfbd9
comparison
equal deleted inserted replaced
5:97fd2315114e 6:d898fd27547f
22 QUEUE_T *queue; 22 QUEUE_T *queue;
23 decoder *decoder; 23 decoder *decoder;
24 int fd; 24 int fd;
25 } thread_data; 25 } thread_data;
26 26
27 // 周波数テーブル変換 27 /* lookup frequency conversion table*/
28 ISDB_T_FREQ_CONV_TABLE * 28 ISDB_T_FREQ_CONV_TABLE *
29 searchrecoff(char *channel) 29 searchrecoff(char *channel)
30 { 30 {
31 int lp; 31 int lp;
32 32
33 for(lp = 0; isdb_t_conv_table[lp].parm_freq != NULL; lp++){ 33 for(lp = 0; isdb_t_conv_table[lp].parm_freq != NULL; lp++){
34 // 文字列&長さ一致したら周波数テーブル番号を返却する 34 /* return entry number in the table when strings match and
35 * lengths are same. */
35 if((memcmp(isdb_t_conv_table[lp].parm_freq, channel, 36 if((memcmp(isdb_t_conv_table[lp].parm_freq, channel,
36 strlen(channel)) == 0) && 37 strlen(channel)) == 0) &&
37 (strlen(channel) == strlen(isdb_t_conv_table[lp].parm_freq))){ 38 (strlen(channel) == strlen(isdb_t_conv_table[lp].parm_freq))){
38 return &isdb_t_conv_table[lp]; 39 return &isdb_t_conv_table[lp];
39 } 40 }
114 } 115 }
115 116
116 /* take buffer address */ 117 /* take buffer address */
117 buffer = p_queue->buffer[p_queue->out]; 118 buffer = p_queue->buffer[p_queue->out];
118 119
119 // 次にデータを取り出す場所をインクリメント 120 /* move location marker to next position */
120 p_queue->out++; 121 p_queue->out++;
121 p_queue->out %= p_queue->size; 122 p_queue->out %= p_queue->size;
122 123
123 /* update flags */ 124 /* update flags */
124 p_queue->no_full++; 125 p_queue->no_full++;
129 pthread_cond_signal(&p_queue->cond_full); 130 pthread_cond_signal(&p_queue->cond_full);
130 131
131 return buffer; 132 return buffer;
132 } 133 }
133 134
134 /* this function will be a writing thread */ 135 /* this function will be reader thread */
135 void * 136 void *
136 write_func(void *p) 137 write_func(void *p)
137 { 138 {
138 thread_data *data = (thread_data *)p; 139 thread_data *data = (thread_data *)p;
139 QUEUE_T *p_queue = data->queue; 140 QUEUE_T *p_queue = data->queue;
369 } 370 }
370 } 371 }
371 /* close tuner */ 372 /* close tuner */
372 close(fd); 373 close(fd);
373 374
374 /* wait reading thread */ 375 /* wait reader thread */
375 pthread_join(dequeue_threads, NULL); 376 pthread_join(dequeue_threads, NULL);
376 destroy_queue(p_queue); 377 destroy_queue(p_queue);
377 378
378 /* release decoder */ 379 /* release decoder */
379 if(use_b25) { 380 if(use_b25) {