static void input_stream_ready_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { GnomeGdkPixbufAsyncHandle *handle = user_data; handle->file_input_stream = g_file_read_finish (G_FILE (source_object), res, NULL); if (handle->file_input_stream == NULL) { /* TODO: could map the GError more precisely to the GnomeVFSError */ load_done (handle, GNOME_VFS_ERROR_GENERIC, NULL); return; } handle->loader = gdk_pixbuf_loader_new (); g_input_stream_read_async (G_INPUT_STREAM (handle->file_input_stream), handle->buffer, sizeof (handle->buffer), G_PRIORITY_DEFAULT, handle->cancellable, input_stream_read_callback, handle); }
void settings_load_late(session_t *sp) { /* FIXME: This needs to be updated for the transcoder */ uint32_t my_ssrc; struct utsname u; char hostfmt[] = "RAT v" RAT_VERSION " %s %s (%s)"; char *field, username[32] = ""; load_init(); /* Initial settings come from the common prefs file... */ /* * We check to see it SDES items are set first. If they are * then presumeably it has come from the command line and * so it should override saved settings. */ my_ssrc = rtp_my_ssrc(sp->rtp_session[0]); if (settings_username(username, sizeof(username) - 1) == FALSE) { sprintf(username, "Unknown"); } field = setting_load_str("rtpName", username); if (rtp_get_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_NAME) == NULL) { debug_msg("username %s %s\n", field, username); rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_NAME, field, strlen(field)); } field = setting_load_str("rtpEmail", ""); if (rtp_get_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_EMAIL) == NULL) { rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_EMAIL, field, strlen(field)); } field = setting_load_str("rtpPhone", ""); if (rtp_get_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_PHONE) == NULL) { rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_PHONE, field, strlen(field)); } field = setting_load_str("rtpLoc", ""); if (rtp_get_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_LOC) == NULL) { rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_LOC, field, strlen(field)); } field = setting_load_str("rtpNote", ""); if (rtp_get_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_NOTE) == NULL) { rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_NOTE, field, strlen(field)); } field = (char*)xmalloc(3 * 256 + sizeof(hostfmt)); uname(&u); sprintf(field, hostfmt, u.sysname, u.release, u.machine); rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_TOOL, field, strlen(field)); xfree(field); /* This is evil [csp] */ field = xstrdup(" rattest"); field[0] = 3; rtp_set_sdes(sp->rtp_session[0], my_ssrc, RTCP_SDES_PRIV, field, strlen(field)); xfree(field); init_part_two(); /* Switch to pulling settings from the RAT specific prefs file... */ load_done(); }
static void input_stream_read_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { GnomeGdkPixbufAsyncHandle *handle = user_data; gssize bytes_read; GnomeVFSResult result; bytes_read = g_input_stream_read_finish (G_INPUT_STREAM (source_object), res, NULL); if (bytes_read == -1) { /* TODO: could map the GError more precisely */ result = GNOME_VFS_ERROR_GENERIC; } else if (bytes_read > 0) { if (!gdk_pixbuf_loader_write (handle->loader, (const guchar *) handle->buffer, bytes_read, NULL)) { result = GNOME_VFS_ERROR_WRONG_FORMAT; } else { /* read more */ g_input_stream_read_async (G_INPUT_STREAM (handle->file_input_stream), handle->buffer, sizeof (handle->buffer), G_PRIORITY_DEFAULT, handle->cancellable, input_stream_read_callback, handle); return; } } else { /* EOF */ result = GNOME_VFS_OK; } if (result == GNOME_VFS_OK) { GdkPixbuf *pixbuf; pixbuf = gdk_pixbuf_loader_get_pixbuf (handle->loader); load_done (handle, result, pixbuf); } else { load_done (handle, result, NULL); } }
s32 load_modem_image(void) { TEEC_Session session; TEEC_Context context; s32 ret = SEC_ERROR; mutex_init(&trans_lock); ret = TEEK_init(&session, &context); if(SEC_ERROR == ret) { sec_print_err("TEEK_InitializeContext failed!\n"); return ret; } ret = load_modem_head(); if(SEC_ERROR == ret) { sec_print_err("load_modem_head fail!\n"); return ret; } ret = load_VRL_to_secos(&session); if(SEC_ERROR == ret) { sec_print_err("load_VRL_and_check fail!\n"); return ret; } ret = load_modem_to_secos(&session); if(SEC_ERROR == ret) { sec_print_err("load_modem_to_os fail!\n"); return ret; } ret = load_modem_dsp_to_secos(&session); if(SEC_ERROR == ret) { sec_print_err("load_modem_to_os fail!\n"); return ret; } /*end of trans all data, start verify*/ ret = load_done(&session, SECBOOT_CMD_ID_VERIFY_DATA); if(SEC_ERROR == ret) { sec_print_err("load_done fail!\n"); return ret; } TEEK_CloseSession(&session); TEEK_FinalizeContext(&context); return SEC_OK; }
static void file_read_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { EelPixbufLoadHandle *handle; gssize bytes_read; GError *error; handle = user_data; if (g_cancellable_is_cancelled (handle->cancellable)) { free_pixbuf_load_handle (handle); return; } error = NULL; bytes_read = g_input_stream_read_finish (G_INPUT_STREAM (source_object), res, &error); if (bytes_read > 0) { if (!gdk_pixbuf_loader_write (handle->loader, handle->buffer, bytes_read, &error)) { bytes_read = -1; } else { g_input_stream_read_async (handle->stream, handle->buffer, sizeof (handle->buffer), 0, handle->cancellable, file_read_callback, handle); return; } } load_done (handle, error, bytes_read == 0); if (error != NULL) { g_error_free (error); } }
static void file_opened_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { EelPixbufLoadHandle *handle; GFileInputStream *stream; GError *error; handle = user_data; if (g_cancellable_is_cancelled (handle->cancellable)) { free_pixbuf_load_handle (handle); return; } error = NULL; stream = g_file_read_finish (G_FILE (source_object), res, &error); if (stream == NULL) { load_done (handle, error, FALSE); g_error_free (error); return; } handle->stream = G_INPUT_STREAM (stream); handle->loader = gdk_pixbuf_loader_new (); g_input_stream_read_async (handle->stream, handle->buffer, sizeof (handle->buffer), 0, handle->cancellable, file_read_callback, handle); }
void settings_load_early(session_t *sp) { /* FIXME: This needs to be updated for the transcoder */ char *name, *param, *primary_codec, *port, *silence; int freq, chan, mute; uint32_t i, n, success, device_exists; const cc_details_t *ccd; const audio_device_details_t *add = NULL; const audio_port_details_t *apd = NULL; const converter_details_t *cod = NULL; const repair_details_t *r = NULL; codec_id_t cid; load_init(); /* Initial settings come from the common prefs file... */ init_part_two(); /* Switch to pulling settings from the RAT specific prefs file... */ if (sp->mode == AUDIO_TOOL) { name = setting_load_str("audioDevice", "No Audio Device"); } else { name = (char *) xmalloc(20); sprintf(name, "Transcoder Port %d", sp->id+1); } /* User may not have a (valid) audio device entry in the */ /* settings file, or have "No Audio Device" there. In */ /* either case try to use first available device, if */ /* it's in use we'll fallback to dummy device anyway. */ device_exists = FALSE; n = (int)audio_get_device_count(); for(i = 0; i < n; i++) { add = audio_get_device_details(i); if (strcmp(add->name, name) == 0) { device_exists = TRUE; break; } } if (strcmp(name, "No Audio Device") == 0 || device_exists == FALSE) { add = audio_get_device_details(0); } audio_device_register_change_device(sp, add->descriptor); freq = setting_load_int("audioFrequency", 8000); chan = setting_load_int("audioChannelsIn", 1); primary_codec = setting_load_str("audioPrimary", "GSM"); cid = codec_get_matching(primary_codec, (uint16_t)freq, (uint16_t)chan); if (codec_id_is_valid(cid) == FALSE) { /* Codec name is garbage...should only happen on upgrades */ cid = codec_get_matching("GSM", (uint16_t)freq, (uint16_t)chan); } audio_device_register_change_primary(sp, cid); audio_device_reconfigure(sp); port = setting_load_str("audioOutputPort", "Headphone"); n = audio_get_oport_count(sp->audio_device); for(i = 0; i < n; i++) { apd = audio_get_oport_details(sp->audio_device, i); if (!strcasecmp(port, apd->name)) { break; } } audio_set_oport(sp->audio_device, apd->port); port = setting_load_str("audioInputPort", "Microphone"); n = audio_get_iport_count(sp->audio_device); for(i = 0; i < n; i++) { apd = audio_get_iport_details(sp->audio_device, i); if (!strcasecmp(port, apd->name)) { break; } } audio_set_iport(sp->audio_device, apd->port); audio_set_ogain(sp->audio_device, setting_load_int("audioOutputGain", 75)); audio_set_igain(sp->audio_device, setting_load_int("audioInputGain", 75)); tx_igain_update(sp->tb); name = setting_load_str("audioChannelCoding", "None"); param = setting_load_str("audioChannelParameters", "None"); do { n = channel_get_coder_count(); for (i = 0; i < n; i++ ) { ccd = channel_get_coder_details(i); if (strcmp(ccd->name, name) == 0) { if (sp->channel_coder) { channel_encoder_destroy(&sp->channel_coder); } channel_encoder_create(ccd->descriptor, &sp->channel_coder); break; } } success = channel_encoder_set_parameters(sp->channel_coder, param); if (success == 0) { /* Could not set parameters for channel coder, fall back to "None" */ name = "None"; param = ""; } } while (success == 0); channel_encoder_set_units_per_packet(sp->channel_coder, (uint16_t) setting_load_int("audioUnits", 1)); /* Set default repair to be first available */ r = repair_get_details(0); sp->repair = r->id; name = setting_load_str("audioRepair", "Pattern-Match"); n = (int)repair_get_count(); for(i = 0; i < n; i++) { r = repair_get_details((uint16_t)i); if (strcasecmp(r->name, name) == 0) { sp->repair = r->id; break; } } /* Set default converter to be first available */ cod = converter_get_details(0); sp->converter = cod->id; name = setting_load_str("audioAutoConvert", "High Quality"); n = (int)converter_get_count(); /* If converter setting name matches then override existing choice */ for(i = 0; i < n; i++) { cod = converter_get_details(i); if (strcasecmp(cod->name, name) == 0) { sp->converter = cod->id; break; } } silence = setting_load_str("audioSilence", "Automatic"); sp->silence_detection = sd_name_to_type(silence); sp->manual_sd_thresh = setting_load_int("audioSilenceManualThresh", 100); if (sp->manual_sd) { manual_sd_set_thresh(sp->manual_sd, sp->manual_sd_thresh); } sp->limit_playout = setting_load_int("audioLimitPlayout", 0); sp->min_playout = setting_load_int("audioMinPlayout", 0); sp->max_playout = setting_load_int("audioMaxPlayout", 2000); sp->lecture = setting_load_int("audioLecture", 0); sp->agc_on = setting_load_int("audioAGC", 0); sp->loopback_gain = setting_load_int("audioLoopback", 0); audio_loopback(sp->audio_device, sp->loopback_gain); sp->echo_suppress = setting_load_int("audioEchoSuppress", 0); sp->meter = setting_load_int("audioPowermeters", 1); sp->rtp_promiscuous_mode = setting_load_int("rtpPromiscuousMode", 0); sp->rtp_wait_for_rtcp = setting_load_int("rtpWaitForRTCP", 1); /* Ignore saved render_3d setting. Break initial device config stuff. V.fiddly to fix. */ /* sp->render_3d = setting_load_int("audio3dRendering", 0); */ mute = setting_load_int("audioInputMute", sp->mode==TRANSCODER?0:1); if (mute && tx_is_sending(sp->tb)) { tx_stop(sp->tb); } else if (mute == 0 && tx_is_sending(sp->tb) == 0) { tx_start(sp->tb); } setting_load_int("audioOutputMute", 1); xmemchk(); load_done(); }