/*get the channel current in use*/ int get_extchannel(int radio, Channel_t *extchannel_get) { int ret = 0; int bandWidth = 0; int wlan_mode = 0; FILE *fin; char c; char str[256] = {0}; char cmd[256] = {0}; char exchannel[8] = {0}; char vap_name[8] = {0}; Channel_t channel_get; memset(&channel_get, 0, sizeof(Channel_t)); ret = get_bandwidth(radio, &bandWidth); if (ret == T_FAILURE) { printf("Error: Get BandWidth Failure\n"); return T_FAILURE; } if (BANDWIDTH_40 == bandWidth) { ret = get_current_channel(radio, &channel_get); if (T_FAILURE == ret) { printf("Error:Get Operation Channel Failure\n"); return T_FAILURE; } else { nvram_get_wlan_mode(radio, &wlan_mode); ret = construct_vap(vap_name, radio, 0, wlan_mode); if (T_FAILURE == ret) { printf("Error:Get Vap Name Failure\n"); return T_FAILURE; } //iwpriv athN get_chextoffset | awk '{gsub(/get_chextoffset:/,"");print}' | awk '{print $2}' > /tmp/extchannel sprintf(cmd, "iwpriv %s get_chextoffset | awk '{gsub(/get_chextoffset:/,\"\");print}' | awk '{print $2}' > /tmp/extchannel", vap_name); EXE_COMMAND(cmd); fin = fopen("/tmp/extchannel","r"); while ((c=fgetc(fin)) != EOF){ ungetc(c,fin); readline(str,fin); strcpy_delspace(str, exchannel); } fclose(fin); EXE_COMMAND("rm -fr /tmp/extchannel"); if (!strcmp(exchannel, "1")) { extchannel_get->chan_number = channel_get.chan_number + 4; extchannel_get->frequency = channel_get.frequency + 20; } else if (!strcmp(exchannel, "-1")) { extchannel_get->chan_number = channel_get.chan_number - 4; extchannel_get->frequency = channel_get.frequency - 20; } else { printf("Error: CMD get_chextoffset Failure\n"); return T_FAILURE; } } } else { printf("Get BandWidth Not 40MHz\n"); return T_FAILURE; } return T_SUCCESS; }
int RenderEngine::open_output() { if(command->realtime) { // Allocate devices if(do_audio) { audio = new AudioDevice; if (audio->open_output(config->aconfig, edl->session->sample_rate, adjusted_fragment_len, edl->session->audio_channels, edl->session->real_time_playback)) { do_audio = 0; delete audio; audio = 0; } } if(do_video) { video = new VideoDevice; } // Initialize sharing // Start playback if(do_audio && do_video) { video->set_adevice(audio); audio->set_vdevice(video); } // Retool playback configuration if(do_audio) { audio->set_software_positioning(edl->session->playback_software_position); audio->start_playback(); } if(do_video) { video->open_output(config->vconfig, edl->session->frame_rate, get_output_w(), get_output_h(), output, command->single_frame()); Channel *channel = get_current_channel(); if(channel) video->set_channel(channel); video->set_quality(80); video->set_cpus(preferences->processors); } } return 0; }