uint8_t DIA_getMSmooth(MSMOOTH_PARAM *param) { GtkWidget *dialog; int ret=0; dialog=create_dialog1(); // Update CHECK_SET(checkbuttonHQ,highq); CHECK_SET(checkbuttonShowMask,showmask); SPIN_SET(spinbuttonThresh,threshold); SPIN_SET(spinbuttonStrength,strength); gtk_register_dialog(dialog); if(gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_OK) { CHECK_GET(checkbuttonHQ,highq); CHECK_GET(checkbuttonShowMask,showmask); SPIN_GET(spinbuttonThresh,threshold); SPIN_GET(spinbuttonStrength,strength); ret=1; } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); return ret; }
void upload( void) { // SPIN_SET(t,spinbuttonT); SPIN_SET(d,spinbuttonD); SPIN_SET(b,spinbuttonB); CHECK_SET(bf,checkbuttonBF); }
uint8_t flyASharp::upload(void) { lock++; SPIN_SET(t,spinbuttonT); SPIN_SET(d,spinbuttonD); SPIN_SET(b,spinbuttonB); CHECK_SET(bf,checkbuttonBF); lock--; return 1; }
uint8_t DIA_lavDecoder(uint32_t *swapUv, uint32_t *showU) { GtkWidget *dialog; int ret; dialog=create_dialog1(); gtk_transient(dialog); CHECK_SET(checkbuttonSwap,swapUv); CHECK_SET(checkbutton2,showU); ret=0; if(gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_OK) { CHECK_GET(checkbuttonSwap,swapUv); CHECK_GET(checkbutton2,showU); } gtk_widget_destroy(dialog); return ret; }
void parse_options(int argc, char**argv) { int c, done = 0; int lopts = 0, notlopts = 0; progname = argv[0]; while (!done) { c = getopt(argc, argv, "A:B:l:vhHr:s:d:e:wDFRcCi:n:S:O:"); switch (c) { case 'A': api_IP_set = 1; api_IP = optarg; break; case 'B': api_port = atoi(optarg); break; case 'l': from_bundles_flag = 1; arg_receive = optarg; break; case 'v': verbose = 1; break; case 'h': case 'H': print_usage(); exit(EXIT_SUCCESS); return; case 'r': arg_replyto = optarg; lopts++; break; case 's': arg_source = optarg; notlopts++; break; case 'd': arg_dest = optarg; notlopts++; break; case 'e': expiration = atoi(optarg); notlopts++; break; case 'w': wait_for_report = 1; notlopts++; break; case 'D': delivery_receipts = 1; notlopts++; break; case 'F': forwarding_receipts = 1; notlopts++; break; case 'R': receive_receipts = 1; notlopts++; break; case 'c': custody = 1; notlopts++; break; case 'C': custody_receipts = 1; notlopts++; break; case 'i': regid = atoi(optarg); notlopts++; break; case 'n': bundle_count = atoi(optarg); lopts++; break; case 'S': sequence_id = optarg; break; case 'O': obsoletes_id = optarg; break; case -1: done = 1; break; default: // getopt already prints an error message for unknown // option characters print_usage(); exit(EXIT_FAILURE); } } if (from_bundles_flag && (notlopts > 0)) { fprintf(stderr, "%s: error: transmission options specified when using -l flag\n", progname); print_usage(); exit(EXIT_FAILURE); } if (!from_bundles_flag && (lopts > 0)) { fprintf(stderr, "%s: error: receive option specified but -l option not selected\n", progname); print_usage(); exit(EXIT_FAILURE); } #define CHECK_SET(_arg, _what) \ if (_arg == 0) { \ fprintf(stderr, "%s: %s must be specified\n", progname, _what); \ print_usage(); \ exit(EXIT_FAILURE); \ } if (!from_bundles_flag) { /* transmitting to bundles - no -l option */ CHECK_SET(arg_source, "source eid"); CHECK_SET(arg_dest, "destination eid"); } else { /* receiving from bundles - -l option specified */ CHECK_SET(arg_receive, "receive eid"); if (bundle_count == -1) { bundle_count = DEFAULT_BUNDLE_COUNT; } } }
void parse_client_options(int argc, char ** argv, dtnperf_global_options_t * perf_g_opt) { char c, done = 0; dtnperf_options_t * perf_opt = perf_g_opt->perf_opt; dtnperf_connection_options_t * conn_opt = perf_g_opt->conn_opt; boolean_t w = FALSE, r = FALSE; boolean_t set_ack_priority_as_bundle = FALSE; while (!done) { static struct option long_options[] = { {"help", no_argument, 0, 'h'}, {"verbose", no_argument, 0, 'v'}, {"memory", no_argument, 0, 'M'}, {"custody", no_argument, 0, 'C'}, {"window", required_argument, 0, 'W'}, {"destination", required_argument, 0, 'd'}, {"monitor", required_argument, 0, 'm'}, {"exitinterval", required_argument, 0, 'i'}, // interval before exit {"time", required_argument, 0, 'T'}, // time mode {"data", required_argument, 0, 'D'}, // data mode {"file", required_argument, 0, 'F'}, // file mode {"payload", required_argument, 0, 'P'}, {"lifetime", required_argument, 0, 'l'}, {"rate", required_argument, 0, 'R'}, {"debug", optional_argument, 0, 33}, // 33 because D is for data mode {"priority", required_argument, 0, 'p'}, {"nofragment", no_argument, 0, 'N'}, {"received", no_argument, 0, 'r'}, {"forwarded", no_argument, 0, 'f'}, {"log", optional_argument, 0, 'L'}, // create log file {"ldir", required_argument, 0, 40}, {"ip-addr", required_argument, 0, 37}, {"ip-port", required_argument, 0, 38}, {"ack-to-mon", no_argument, 0, 44}, // force server to send acks to monitor {"no-ack-to-mon", no_argument, 0, 45}, // force server to NOT send acks to monitor {"ack-lifetime", no_argument, 0, 46} , // set server ack expiration equal to client bundles {"ack-priority", optional_argument, 0, 47}, // set server ack priority as indicated or equal to client bundles {0,0,0,0} // The last element of the array has to be filled with zeros. }; int option_index = 0; c = getopt_long(argc, argv, "hvMCW:d:m:i:T:D:F:P:l:R:p:NrfL::", long_options, &option_index); switch (c) { case 'h': print_client_usage(argv[0]); exit(0); return ; case 'v': perf_opt->verbose = TRUE; break; case 'M': perf_opt->use_file = 0; perf_opt->payload_type = BP_PAYLOAD_MEM; break; case 'C': conn_opt->custody_transfer = 1; conn_opt->custody_receipts = 1; break; case 'W': perf_opt->congestion_ctrl = 'w'; perf_opt->window = atoi(optarg); w = TRUE; break; case 'd': strncpy(perf_opt->dest_eid, optarg, BP_MAX_ENDPOINT_ID); break; case 'm': strncpy(perf_opt->mon_eid, optarg, BP_MAX_ENDPOINT_ID); break; case 'i': perf_opt->wait_before_exit = atoi(optarg)*1000; break; case 'T': perf_opt->op_mode = 'T'; perf_opt->transmission_time = atoi(optarg); break; case 'D': perf_opt->op_mode = 'D'; perf_opt->D_arg = strdup(optarg); perf_opt->data_unit = find_data_unit(perf_opt->D_arg); switch (perf_opt->data_unit) { case 'B': perf_opt->data_qty = atol(perf_opt->D_arg); break; case 'k': perf_opt->data_qty = kilo2byte(atol(perf_opt->D_arg)); break; case 'M': perf_opt->data_qty = mega2byte(atol(perf_opt->D_arg)); break; default: printf("\nWARNING: (-D option) invalid data unit, assuming 'M' (MBytes)\n\n"); perf_opt->data_qty = mega2byte(atol(perf_opt->D_arg)); break; } break; case 'F': perf_opt->op_mode = 'F'; perf_opt->F_arg = strdup(optarg); if(!file_exists(perf_opt->F_arg)) { fprintf(stderr, "ERROR: Unable to open file %s: %s\n", perf_opt->F_arg, strerror(errno)); exit(1); } break; case 'P': perf_opt->p_arg = optarg; perf_opt->data_unit = find_data_unit(perf_opt->p_arg); switch (perf_opt->data_unit) { case 'B': perf_opt->bundle_payload = atol(perf_opt->p_arg); break; case 'k': perf_opt->bundle_payload = kilo2byte(atol(perf_opt->p_arg)); break; case 'M': perf_opt->bundle_payload = mega2byte(atol(perf_opt->p_arg)); break; default: printf("\nWARNING: (-p option) invalid data unit, assuming 'K' (KBytes)\n\n"); perf_opt->bundle_payload = kilo2byte(atol(perf_opt->p_arg)); break; } break; case 'l': conn_opt->expiration = atoi(optarg); break; case 'R': perf_opt->rate_arg = strdup(optarg); perf_opt->rate_unit = find_rate_unit(perf_opt->rate_arg); perf_opt->rate = atoi(perf_opt->rate_arg); perf_opt->congestion_ctrl = 'r'; r = TRUE; break; case 'p': if (!strcasecmp(optarg, "bulk")) { conn_opt->priority = BP_PRIORITY_BULK; } else if (!strcasecmp(optarg, "normal")) { conn_opt->priority = BP_PRIORITY_NORMAL; } else if (!strcasecmp(optarg, "expedited")) { conn_opt->priority = BP_PRIORITY_EXPEDITED; } else if (!strcasecmp(optarg, "reserved")) { conn_opt->priority = BP_PRIORITY_RESERVED; } else { fprintf(stderr, "Invalid priority value %s\n", optarg); exit(1); } break; case 'N': conn_opt->disable_fragmentation = TRUE; break; case 'f': conn_opt->forwarding_receipts = TRUE; break; case 'r': conn_opt->receive_receipts = TRUE; break; case 'L': perf_opt->create_log = TRUE; if (optarg != NULL) perf_opt->log_filename = strdup(optarg); break; case 40: perf_opt->logs_dir = strdup(optarg); break; case 33: // debug perf_opt->debug = TRUE; if (optarg){ int debug_level = atoi(optarg); if (debug_level >= 1 && debug_level <= 2) perf_opt->debug_level = atoi(optarg) - 1; else { fprintf(stderr, "wrong --debug argument\n"); exit(1); return; } } else perf_opt->debug_level = 2; break; case 34: // incoming bundle destination directory perf_opt->dest_dir = strdup(optarg); break; case 37: perf_opt->ip_addr = strdup(optarg); perf_opt->use_ip = TRUE; break; case 38: perf_opt->ip_port = atoi(optarg); perf_opt->use_ip = TRUE; break; case 44: perf_opt->bundle_ack_options.ack_to_mon = ATM_FORCE_YES; break; case 45: perf_opt->bundle_ack_options.ack_to_mon = ATM_FORCE_NO; break; case 46: perf_opt->bundle_ack_options.set_ack_expiration = TRUE; break; case 47: perf_opt->bundle_ack_options.set_ack_priority = TRUE; if (!optarg) set_ack_priority_as_bundle = TRUE; else { if (!strcasecmp(optarg, "bulk")) { perf_opt->bundle_ack_options.priority = BP_PRIORITY_BULK; } else if (!strcasecmp(optarg, "normal")) { perf_opt->bundle_ack_options.priority = BP_PRIORITY_NORMAL; } else if (!strcasecmp(optarg, "expedited")) { perf_opt->bundle_ack_options.priority = BP_PRIORITY_EXPEDITED; } else if (!strcasecmp(optarg, "reserved")) { perf_opt->bundle_ack_options.priority = BP_PRIORITY_RESERVED; } else { fprintf(stderr, "Invalid ack priority value %s\n", optarg); exit(1); } } break; case '?': fprintf(stderr, "Unknown option: %c\n", optopt); exit(1); break; case (char)(-1): done = 1; done = 1; break; default: // getopt already prints an error message for unknown option characters print_client_usage(argv[0]); exit(1); } // --switch } // -- while // if mode is client and monitor eid is not specified, client node must be also monitor. if(perf_g_opt->mode == DTNPERF_CLIENT && perf_opt->mon_eid == NULL) { perf_g_opt->mode = DTNPERF_CLIENT_MONITOR; } // set ack-to-client request if (perf_opt->congestion_ctrl == 'w') perf_opt->bundle_ack_options.ack_to_client = TRUE; else perf_opt->bundle_ack_options.ack_to_client = FALSE; // set bundle ack priority as the same of bundle one if (set_ack_priority_as_bundle) perf_opt->bundle_ack_options.priority = conn_opt->priority; #define CHECK_SET(_arg, _what) \ if (_arg == 0) { \ fprintf(stderr, "\nSYNTAX ERROR: %s must be specified\n", _what); \ print_client_usage(argv[0]); \ exit(1); \ } CHECK_SET(perf_opt->dest_eid[0], "destination eid"); CHECK_SET(perf_opt->op_mode, "-T or -D or -F"); if (w && r) { fprintf(stderr, "\nSYNTAX ERROR: -w and -r options are mutually exclusive\n"); \ print_client_usage(argv[0]); \ exit(1); } // check command line options check_options(perf_g_opt); }
uint8_t DIA_animated(ANIMATED_PARAM *param) { uint8_t ret=0; GtkWidget *dialog; const char *entries[MAX_VIGNETTE]={"spinbuttonTC0","spinbuttonTC1","spinbuttonTC2", "spinbuttonTC3","spinbuttonTC4","spinbuttonTC5" }; dialog=create_dialog1(); gtk_register_dialog(dialog); CHECK_SET(checkbuttonStd,isNTSC); SPIN_SET(spinbuttonvignetteW,vignetteW); SPIN_SET(spinbuttonvignetteH,vignetteH); if(param->backgroundImg) ENTRY_SET(entryBgd,param->backgroundImg); for(int i=0;i<MAX_VIGNETTE;i++) { gtk_spin_button_set_value(GTK_SPIN_BUTTON(lookup_widget(dialog,entries[i])), (gfloat)param->timecode[i]) ; } ASSOCIATE(button1,LOAD_BGD); //gtk_widget_show(dialog); int action; while(1) { action=gtk_dialog_run(GTK_DIALOG(dialog)); if(action==LOAD_BGD) { char *nw; GUI_FileSelRead(_("Select background picture"), &nw); if(nw) { ENTRY_SET(entryBgd,nw); ADM_dealloc(nw); } continue; } break; } if(action==GTK_RESPONSE_OK) { CHECK_GET(checkbuttonStd,isNTSC); SPIN_GET(spinbuttonvignetteW,vignetteW); SPIN_GET(spinbuttonvignetteH,vignetteH); if(param->backgroundImg) ADM_dealloc(param->backgroundImg); param->backgroundImg=NULL; ENTRY_GET(entryBgd,param->backgroundImg); for(int i=0;i<MAX_VIGNETTE;i++) { param->timecode[i]=(uint32_t)gtk_spin_button_get_value(GTK_SPIN_BUTTON(lookup_widget(dialog,entries[i]))) ; } ret=1; } gtk_unregister_dialog(dialog); gtk_widget_destroy(dialog); return ret; }
uint8_t DIA_XVCDParam(char *title,COMPRESSION_MODE * mode, uint32_t * qz, uint32_t * br,uint32_t *fsize,FFcodecSetting *conf) { GtkWidget *dialog; gchar *str; char string[200]; int ret; gint r,b; #define WID(x) lookup_widget(dialog,#x) #define CHECK_GET(x,y) {y=gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(WID(x)));} #define CHECK_SET(x,y) {gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON(WID(x)),y);} ret=-1; while(ret==-1) { dialog=create_dialog1(); // gtk_transient(dialog); gtk_register_dialog(dialog); gtk_window_set_title (GTK_WINDOW (dialog), title); // set the right select button switch (*mode) { case COMPRESS_CBR: RADIO_SET(radioCBR,1); b=*br/1000; gtk_write_entry(WID(entryCBR),(int)b); break; case COMPRESS_2PASS: RADIO_SET(radio2Pass,1); gtk_write_entry(WID(entry2Pass),(int)*fsize); break; case COMPRESS_CQ: RADIO_SET(radioCQ,1); gtk_write_entry(WID(entryCQ),(int)*qz); break; } gtk_write_entry(WID(entry_min),(int) (conf->minBitrate *8)/1000); gtk_write_entry(WID(entry_max),(int) (conf->maxBitrate *8)/1000); gtk_option_menu_set_history (GTK_OPTION_MENU (WID(optionmenu1)),conf->user_matrix); gtk_option_menu_set_history (GTK_OPTION_MENU (WID(optionmenu1)),conf->user_matrix); gtk_spin_button_set_value(GTK_SPIN_BUTTON(WID(spinbutton1)),(float)conf->gop_size) ; CHECK_SET(checkbuttonxvid,conf->use_xvid_ratecontrol); if(gtk_dialog_run(GTK_DIALOG(dialog))==GTK_RESPONSE_OK) { int r,value=0; ret=1; conf->minBitrate=(gtk_read_entry(WID(entry_min))*1000)>>3; conf->maxBitrate=(gtk_read_entry(WID(entry_max))*1000)>>3; conf->user_matrix= getRangeInMenu(WID(optionmenu1)); conf->gop_size= gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(WID(spinbutton1))); CHECK_GET(checkbuttonxvid,conf->use_xvid_ratecontrol); r=RADIO_GET(radioCQ)+(2*RADIO_GET(radioCBR))+(4*RADIO_GET(radio2Pass)); printf("\n r: %d \n",r); switch(r) { case 2: *mode = COMPRESS_CBR; value = gtk_read_entry(WID(entryCBR)); if (value < 9000) { value *= 1000; } if (value > 16 && value < 9000000) { *br = value; ret = 1; } else ret = -1; break; case 1: *mode = COMPRESS_CQ; value = gtk_read_entry(WID(entryCQ)); if (value >= 2 && value <= 32) { *qz = value; ret = 1; } else { printf("\n incorrect Q parameter\n"); ret =-1; } break; case 4: *mode = COMPRESS_2PASS; value = gtk_read_entry(WID(entry2Pass)); if((value>0)&&(value<4000)) { *fsize=value; ret=1; } else ret=-1; break; default: ADM_assert(0); } } else