static void save_file_create_ready_cb (GObject *source, GAsyncResult *res, gpointer user_data) { ScreenshotApplication *self = user_data; GFileOutputStream *os; GError *error = NULL; gchar *basename = g_file_get_basename (G_FILE (source)); gchar *extension = g_strrstr (basename, "."); gchar *format = NULL; GSList *formats = NULL; if (extension == NULL) extension = "png"; else extension++; format = extension; formats = gdk_pixbuf_get_formats(); g_slist_foreach (formats, find_out_writable_format_by_extension, (gpointer) &format); g_slist_free (formats); g_free (basename); if (self->priv->should_overwrite) os = g_file_replace_finish (G_FILE (source), res, &error); else os = g_file_create_finish (G_FILE (source), res, &error); if (error != NULL) { save_pixbuf_handle_error (self, error); g_error_free (error); return; } if (is_png (format)) { if (has_profile (self)) save_with_description_and_profile (self, os, format); else save_with_description (self, os, format); } else { save_with_no_profile_or_description (self, os, format); } g_object_unref (os); g_free (format); }
void startup( const std::string& profile_name ) { auto btsapp = bts::application::instance(); auto app_config = load_config( profile_name ); btsapp->configure( app_config ); if( btsapp->has_profile() ) { display_login(); } else { start_profile_creation_wizard(btsapp); } }
int vaapi_init_decoder(VAProfile profile, VAEntrypoint entrypoint, unsigned int picture_width, unsigned int picture_height) { VAAPIContext * const vaapi = vaapi_get_context(); VAConfigAttrib attrib; VAConfigID config_id = 0; VAContextID context_id = 0; VASurfaceID surface_id = 0; VAStatus status; if (!vaapi) return -1; #if 0 if (common_init_decoder(picture_width, picture_height) < 0) return -1; #endif if (!has_profile(vaapi, profile)) return -1; if (!has_entrypoint(vaapi, profile, entrypoint)) return -1; if (vaapi->profile != profile || vaapi->entrypoint != entrypoint) { if (vaapi->config_id) vaDestroyConfig(vaapi->display, vaapi->config_id); attrib.type = VAConfigAttribRTFormat; status = vaGetConfigAttributes(vaapi->display, profile, entrypoint, &attrib, 1); if (!vaapi_check_status(status, "vaGetConfigAttributes()")) return -1; if ((attrib.value & VA_RT_FORMAT_YUV420) == 0) return -1; status = vaCreateConfig(vaapi->display, profile, entrypoint, &attrib, 1, &config_id); if (!vaapi_check_status(status, "vaCreateConfig()")) return -1; } else config_id = vaapi->config_id; if (vaapi->picture_width != picture_width || vaapi->picture_height != picture_height) { if (vaapi->surface_id) vaDestroySurfaces(vaapi->display, &vaapi->surface_id, 1); status = vaCreateSurfaces(vaapi->display, picture_width, picture_height, VA_RT_FORMAT_YUV420, 1, &surface_id); if (!vaapi_check_status(status, "vaCreateSurfaces()")) return -1; if (vaapi->context_id) vaDestroyContext(vaapi->display, vaapi->context_id); status = vaCreateContext(vaapi->display, config_id, picture_width, picture_height, VA_PROGRESSIVE, &surface_id, 1, &context_id); if (!vaapi_check_status(status, "vaCreateContext()")) return -1; } else { context_id = vaapi->context_id; surface_id = vaapi->surface_id; } vaapi->config_id = config_id; vaapi->context_id = context_id; vaapi->surface_id = surface_id; vaapi->profile = profile; vaapi->entrypoint = entrypoint; vaapi->picture_width = picture_width; vaapi->picture_height = picture_height; return 0; }