static void handle_missing_plugin_message (RBPlayerGst *player, GstMessage *message) { char **details; char **descriptions; char *detail; char *description; int count; rb_debug ("got missing-plugin message from %s: %s", GST_OBJECT_NAME (GST_MESSAGE_SRC (message)), gst_missing_plugin_message_get_installer_detail (message)); /* probably need to wait to collect any subsequent missing-plugin * messages, but I think we'd need to wait for state changes to do * that. for now, we can only handle a single message. */ count = 1; details = g_new0 (char *, count + 1); descriptions = g_new0 (char *, count + 1); detail = gst_missing_plugin_message_get_installer_detail (message); description = gst_missing_plugin_message_get_description (message); details[0] = g_strdup (detail); descriptions[0] = g_strdup (description); g_signal_emit (player, signals[MISSING_PLUGINS], 0, player->priv->stream_data, details, descriptions); g_strfreev (details); g_strfreev (descriptions); }
static VALUE missing_message_get_installer_detail(VALUE self) { gchar *detail; detail = gst_missing_plugin_message_get_installer_detail(SELF(self)); return CSTR2RVAL_FREE(detail); }
static void missing_msg_check_getters (GstMessage * msg) { gchar *str; str = gst_missing_plugin_message_get_installer_detail (msg); fail_unless (str != NULL); fail_unless (*str != '\0'); fail_unless (g_str_has_prefix (str, "gstreamer|")); g_free (str); str = gst_missing_plugin_message_get_description (msg); fail_unless (str != NULL); fail_unless (*str != '\0'); g_free (str); }
void _bp_missing_elements_process_message (BansheePlayer *player, GstMessage *message) { g_return_if_fail (IS_BANSHEE_PLAYER (player)); g_return_if_fail (message != NULL); if (gst_is_missing_plugin_message (message)) { gchar *detail = gst_missing_plugin_message_get_installer_detail (message); GSList *node = player->missing_element_details_handled; player->handle_missing_elements = TRUE; // Only save the error if we've never encounted it before for (; node != NULL; node = node->next) { if (g_ascii_strcasecmp (node->data, detail) == 0) { bp_debug2 ("Ignoring missing element details, already prompted ('%s')", detail); return; } } bp_debug2 ("Saving missing element details ('%s')", detail); player->missing_element_details = g_slist_append (player->missing_element_details, detail); } }
gboolean check_missing_plugins(GstEncodingProfile *profile, char ***details, char ***descriptions) { GstElement *encodebin; GstBus *bus; GstPad *pad; gboolean ret; ret = FALSE; encodebin = gst_element_factory_make("encodebin", NULL); if (encodebin == NULL) { g_warning("Unable to create encodebin"); return TRUE; } bus = gst_bus_new(); gst_element_set_bus(encodebin, bus); gst_bus_set_flushing(bus, FALSE); /* necessary? */ g_object_set(encodebin, "profile", profile, NULL); pad = gst_element_get_static_pad(encodebin, "audio_0"); if (pad == NULL) { GstMessage *message; GList *messages = NULL; GList *m; message = gst_bus_pop(bus); while (message != NULL) { if (gst_is_missing_plugin_message(message)) messages = g_list_append(messages, message); else gst_message_unref(message); message = gst_bus_pop(bus); } if (messages != NULL) { int i; if (details != NULL) *details = g_new0(char *, g_list_length(messages)+1); if (descriptions != NULL) *descriptions = g_new0(char *, g_list_length(messages)+1); i = 0; for (m = messages; m != NULL; m = m->next) { char *str; if (details != NULL) { str = gst_missing_plugin_message_get_installer_detail(m->data); (*details)[i] = str; } if (descriptions != NULL) { str = gst_missing_plugin_message_get_description(m->data); (*descriptions)[i] = str; } i++; } ret = TRUE; g_list_foreach(messages,(GFunc)gst_message_unref, NULL); g_list_free(messages); }