#include "al.h"
#include "al_sending.h"
#include "al_receiving.h"
#include "mux.h"
#include "demux.h"
#include "video_codec.h"
#include "audio.h"
Go to the source code of this file.
Classes | |
struct | data_codec |
struct | control |
struct | _side |
struct | _session |
Defines | |
#define | MAX_VIDEO_CODECS 10 |
#define | MAX_AUDIO_CODECS 10 |
#define | MAX_DATA_CODECS 10 |
Functions | |
void | usage (void) |
void | add_alse (mux *m, al_sending_entity *alse) |
void | add_alre (demux *d, al_receiving_entity *alre) |
control * | new_control (void) |
void | parse_line (char *s, char *name, char *arg) |
void | video_config (video_codec *video) |
void | audio_config (audio_codec *A) |
void | control_config (control *C) |
void | mux_table_config (mux *M) |
void | mux_config (mux *M) |
void | channel_config (channel *C) |
void | side_config (_side *side) |
void | get_config () |
void | start_config () |
void | finish_config () |
void | set_config (int argc, char *argv[]) |
|
|
|
|
|
|
|
Referenced by finish_config(). |
|
Referenced by finish_config(). |
|
Definition at line 148 of file config.c. References eof_input_file(), equals(), error(), get_str(), audio_codec::input_filename, audio_codec::output_filename, and parse_line(). Referenced by side_config(). 00149 { 00150 char str[STRLEN]; 00151 char name[STRLEN]; 00152 char arg[STRLEN]; 00153 int done=0; 00154 FILE *fp; 00155 00156 while (!done && !eof_input_file()) { 00157 00158 get_str(str); 00159 00160 parse_line(str, name, arg); 00161 00162 if (equals(name, "end")) { 00163 done = 1; 00164 } 00165 else if (equals(name, "inputfile")) { 00166 strcpy(A->input_filename, arg); 00167 } 00168 else if (equals(name, "outputfile")) { 00169 strcpy(A->output_filename, arg); 00170 00171 /* clear the output file */ 00172 fp = fopen(A->output_filename,"w"); 00173 if (fp==NULL) error("audio_config","Can't open output file"); 00174 fclose(fp); 00175 } 00176 } 00177 }
|
|
Definition at line 298 of file config.c. References channel::bit_error_rate, eof_input_file(), equals(), channel::error, channel::error_offset, channel::filename, get_str(), parse_line(), channel::transmission_delay, and channel::transmission_speed. Referenced by side_config(). 00299 { 00300 char str[STRLEN]; 00301 char name[STRLEN]; 00302 char arg[STRLEN]; 00303 int done=0; 00304 00305 while (!done && !eof_input_file()) { 00306 get_str(str); 00307 parse_line(str, name, arg); 00308 if (equals(name, "end")) { 00309 done = 1; 00310 } 00311 else if (equals(name, "errortype")) { 00312 if (equals(arg, "none")) 00313 C->error=NoErrors; 00314 else if (equals(arg, "random")) 00315 C->error=Random; 00316 else if (equals(arg, "file")) 00317 C->error=File; 00318 } 00319 else if (equals(name, "errorrate")) { 00320 C->bit_error_rate = atof(arg); 00321 } 00322 else if (equals(name, "errorfile")) { 00323 strcpy(C->filename, arg); 00324 } 00325 else if (equals(name, "speed")) { 00326 C->transmission_speed = atoi(arg); 00327 } 00328 else if (equals(name, "delay")) { 00329 C->transmission_delay = atoi(arg); 00330 } 00331 else if (equals(name, "error_offset")) { 00332 C->error_offset = atoi(arg); 00333 } 00334 } 00335 }
|
|
Definition at line 180 of file config.c. References eof_input_file(), equals(), get_str(), and parse_line(). Referenced by side_config(). 00181 { 00182 char str[STRLEN]; 00183 char name[STRLEN]; 00184 char arg[STRLEN]; 00185 int done=0; 00186 00187 while (!done && !eof_input_file()) { 00188 00189 get_str(str); 00190 00191 parse_line(str, name, arg); 00192 00193 if (equals(name, "end")) { 00194 done = 1; 00195 } 00196 else if (equals(name, "")) { 00197 00198 } 00199 } 00200 }
|
|
|
Definition at line 383 of file config.c. References eof_input_file(), equals(), get_str(), _session::local, parse_line(), _session::remote, session, and side_config(). Referenced by set_config(). 00384 { 00385 char str[STRLEN]; 00386 char name[STRLEN]; 00387 char arg[STRLEN]; 00388 void *data; 00389 00390 while (!eof_input_file()) { 00391 00392 get_str(str); 00393 00394 parse_line(str, name, arg); 00395 00396 if (equals(name, "local")) { 00397 if (debug) { 00398 printf("# %s side config \n", name); 00399 } 00400 side_config(&session.local); 00401 } 00402 else if (equals(name, "remote")) { 00403 if (debug) { 00404 printf("# %s side config\n", name); 00405 } 00406 side_config(&session.remote); 00407 } 00408 } 00409 }
|
|
Definition at line 225 of file config.c. References eof_input_file(), equals(), get_str(), mux_parameters::head_t, mux_parameters::header_code, mux_parameters::level, mux_parameters::mpl_code, mux_parameters::mpl_sync_threshold, mux_parameters::mpl_t, mux_table_config(), mux::params, parse_line(), mux_parameters::payload_max, mux_parameters::payload_min, mux_parameters::stat_file, strtobch_type(), mux_parameters::sync_flag_length, mux_parameters::sync_threshold, and mux_parameters::use_mpl. Referenced by side_config(). 00226 { 00227 char str[STRLEN]; 00228 char name[STRLEN]; 00229 char arg[STRLEN]; 00230 int done=0; 00231 00232 FILE *fp; 00233 while (!done && !eof_input_file()) { 00234 get_str(str); 00235 parse_line(str, name, arg); 00236 00237 if (equals(name, "end")) { 00238 done = 1; 00239 } 00240 else if (equals(name, "table")) { 00241 mux_table_config(M); 00242 } 00243 else if (equals(name, "sync_flag_length")) { 00244 if (equals(arg,"16d")) 00245 M->params->sync_flag_length = 32; 00246 else 00247 M->params->sync_flag_length = atoi(arg); 00248 } 00249 else if (equals(name, "sync_threshold")) { 00250 M->params->sync_threshold = atoi(arg); 00251 } 00252 else if (equals(name, "header_code")) { 00253 M->params->header_code = strtobch_type(arg); 00254 } 00255 else if (equals(name, "level2")) { 00256 M->params->use_mpl = 1; 00257 M->params->level = 2; 00258 /* hard code some level 2 things. could remove */ 00259 M->params->header_code = GOLAY23_12; 00260 M->params->use_mpl = 0; 00261 } 00262 else if (equals(name, "level1")) { 00263 M->params->use_mpl = 0; 00264 M->params->level = 1; 00265 } 00266 else if (equals(name, "level0")) { 00267 M->params->use_mpl = 0; 00268 M->params->level = 1; /* uses same logic as level 1 */ 00269 } 00270 else if (equals(name, "mpl_code")) { 00271 M->params->mpl_code = strtobch_type(arg); 00272 } 00273 else if (equals(name, "payload_min")) { 00274 M->params->payload_min = atoi(arg); 00275 } 00276 else if (equals(name, "payload_max")) { 00277 M->params->payload_max = atoi(arg); 00278 } 00279 else if (equals(name, "stat_file")) { 00280 strcpy(M->params->stat_file,arg); 00281 fp = fopen(M->params->stat_file,"w"); /* delete this file if exists */ 00282 assert(fp!=NULL); 00283 fclose(fp); 00284 } 00285 else if (equals(name, "mpl_t")) { 00286 M->params->mpl_t = atoi(arg); 00287 } 00288 else if (equals(name, "head_t")) { 00289 M->params->head_t = atoi(arg); 00290 } 00291 else if (equals(name, "mpl_sync_threshold")) { 00292 M->params->mpl_sync_threshold = atoi(arg); 00293 } 00294 } 00295 }
|
|
Definition at line 203 of file config.c. References add_to_mux_table(), eof_input_file(), equals(), get_str(), mux_parameters::mux_table, mux_parameters::mux_table_size, mux::params, and parse_line(). Referenced by mux_config(). 00204 { 00205 char str[STRLEN]; 00206 char name[STRLEN]; 00207 char arg[STRLEN]; 00208 int done=0; 00209 00210 while (!done && !eof_input_file()) { 00211 get_str(str); 00212 parse_line(str, name, arg); 00213 if (equals(name, "end")) { 00214 done = 1; 00215 } 00216 else if (equals(name, "entry")) { 00217 if (M->params->mux_table_size < MAX_MUX_TABLE_SIZE) 00218 add_to_mux_table(M->params->mux_table, 00219 &(M->params->mux_table_size), arg); 00220 } 00221 } 00222 }
|
|
Definition at line 62 of file config.c. Referenced by start_config(). 00063 { 00064 control *bob = malloc(sizeof(control)); 00065 if (bob != NULL) { 00066 00067 } 00068 return(bob); 00069 }
|
|
Referenced by audio_config(), channel_config(), control_config(), get_config(), mux_config(), mux_table_config(), side_config(), and video_config(). |
|
Definition at line 526 of file config.c. References close_input_file(), debug, DEF_CONFIG_FILE, equals(), finish_config(), get_config(), open_input_file(), prefix(), start_config(), STRLEN, and usage(). Referenced by main(). 00531 { 00532 int i; 00533 char config_file[STRLEN]; 00534 00535 strcpy(config_file, DEF_CONFIG_FILE); 00536 00537 /* 00538 * Check if we should print out usage thing. 00539 */ 00540 00541 if (argc > 1 && prefix("-h", argv[1])) { 00542 usage(); 00543 exit(0); 00544 } 00545 00546 if (argc > 1 && strcmp(argv[1], "-advice")==0) { 00547 printf("\aDon't Panic!\n"); 00548 exit(42); 00549 } 00550 00551 /* 00552 * Process command line arguments. 00553 */ 00554 00555 for (i = 1; i < argc; i++) { 00556 if (argv[i][0]=='-') { 00557 if (strcmp(argv[i], "-c")==0) { 00558 i++; 00559 if (i < argc) { 00560 config_file[STRLEN-1]='\0'; 00561 strncpy(config_file, argv[i], STRLEN-1); 00562 } 00563 } 00564 else if (equals(argv[i], "-d")) { 00565 if (i < (argc - 1)) { 00566 if (argv[i+1][0]!='-') { 00567 i++; 00568 debug = atoi(argv[i]); 00569 } 00570 } 00571 else { 00572 debug = 0; 00573 } 00574 } 00575 } 00576 else { 00577 fprintf(stderr, "Invalid command line option: %s\n", argv[i]); 00578 exit(1); 00579 } 00580 } 00581 00582 /* 00583 * Open the config file. 00584 */ 00585 00586 open_input_file(config_file); 00587 00588 start_config(); 00589 get_config(); 00590 finish_config(); 00591 00592 close_input_file(); 00593 }
|
|
Definition at line 338 of file config.c. References _side::Audio, audio_config(), _side::Channel, channel_config(), _side::Control, control_config(), eof_input_file(), equals(), get_str(), _side::Mux, mux_config(), parse_line(), _side::Video, and video_config(). Referenced by get_config(). 00339 { 00340 char str[STRLEN]; 00341 char name[STRLEN]; 00342 char arg[STRLEN]; 00343 00344 int done=0; 00345 00346 while (!done && !eof_input_file()) { 00347 00348 get_str(str); 00349 parse_line(str, name, arg); 00350 00351 if (equals(name, "end")) { 00352 done = 1; 00353 } 00354 else if (equals(name, "video")) { 00355 if (debug) 00356 printf("\t# entering %s section\n", name); 00357 video_config(side->Video); 00358 } 00359 else if (equals(name, "audio")) { 00360 if (debug) 00361 printf("\t# entering %s section\n", name); 00362 audio_config(side->Audio); 00363 } 00364 else if (equals(name, "control")) { 00365 if (debug) 00366 printf("\t# entering %s section\n", name); 00367 control_config(side->Control); 00368 } 00369 else if (equals(name, "mux")) { 00370 if (debug) 00371 printf("\t# entering %s section\n", name); 00372 mux_config(side->Mux); 00373 } 00374 else if (equals(name, "channel")) { 00375 if (debug) 00376 printf("\t# entering %s section\n", name); 00377 channel_config(side->Channel); 00378 } 00379 } 00380 }
|
|
|
|
|
Definition at line 95 of file config.c. References eof_input_file(), equals(), error(), get_str(), video_codec::input_file, video_codec::no_coding, video_codec::output_file, parse_line(), video_codec::retransmit, video_codec::sequenced, video_codec::streamname, video_codec::targetrate, and video_codec::tmndecode. Referenced by side_config(). 00096 { 00097 char str[STRLEN]; 00098 char name[STRLEN]; 00099 char arg[STRLEN]; 00100 int done=0; 00101 FILE *fp; 00102 00103 while (!done && !eof_input_file()) { 00104 00105 get_str(str); 00106 00107 parse_line(str, name, arg); 00108 00109 if (equals(name, "end")) { 00110 done = 1; 00111 } 00112 else if (equals(name, "inputfile")) { 00113 strcpy(video->input_file, arg); 00114 } 00115 else if (equals(name, "no_coding")) { 00116 video->no_coding = 1; 00117 } 00118 else if (equals(name, "outputfile")) { 00119 strcpy(video->output_file, arg); 00120 00121 /* clear the output file */ 00122 fp = fopen(video->output_file,"w"); 00123 if (fp==NULL) error("video_config","Can't open output file"); 00124 fclose(fp); 00125 } 00126 else if (equals(name, "streamfile")) { 00127 strcpy(video->streamname, arg); 00128 } 00129 else if (equals(name, "bitrate")) { 00130 video->targetrate = atoi(arg); 00131 } 00132 00133 /* the rest of these are logical channel params */ 00134 00135 else if (equals(name, "sequenced")) { 00136 video->sequenced=1; 00137 } 00138 else if (equals(name, "retransmit")) { 00139 video->retransmit=1; 00140 } 00141 else if (equals(name, "tmndecode")) { 00142 video->tmndecode=1; 00143 } 00144 } 00145 }
|