brasero r825 - in trunk: . src
- From: philippr svn gnome org
- To: svn-commits-list gnome org
- Subject: brasero r825 - in trunk: . src
- Date: Wed, 21 May 2008 14:36:58 +0000 (UTC)
Author: philippr
Date: Wed May 21 14:36:57 2008
New Revision: 825
URL: http://svn.gnome.org/viewvc/brasero?rev=825&view=rev
Log:
Adds automatic gstreamer plugin installation for audio (Ã la totem)
NOTE: since I have fedora 8 I have just been able to test the case where nothing happens
I have to upgrade
* configure.in:
* src/brasero-audio-disc.c (brasero_audio_disc_visit_dir_async),
(brasero_audio_disc_add_playlist),
(brasero_audio_disc_add_uri_real):
* src/brasero-io.c (brasero_io_get_file_info_thread),
(brasero_io_get_file_count_process_playlist),
(brasero_io_get_file_count_process_file),
(brasero_io_load_directory_playlist),
(brasero_io_load_directory_thread):
* src/brasero-io.h:
* src/brasero-metadata.c (brasero_metadata_stop),
(brasero_metadata_install_plugins_add_downloaded),
(brasero_metadata_install_plugins_free_data),
(brasero_metadata_install_plugins_success),
(brasero_metadata_install_plugins_abort),
(brasero_metadata_install_plugins_completed),
(brasero_metadata_install_plugins_result),
(brasero_metadata_is_downloading),
(brasero_metadata_install_missing_plugins),
(brasero_metadata_bus_messages):
* src/brasero-metadata.h:
* src/main.c (main):
Modified:
trunk/ChangeLog
trunk/configure.in
trunk/src/brasero-audio-disc.c
trunk/src/brasero-io.c
trunk/src/brasero-io.h
trunk/src/brasero-metadata.c
trunk/src/brasero-metadata.h
trunk/src/main.c
Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in (original)
+++ trunk/configure.in Wed May 21 14:36:57 2008
@@ -107,6 +107,8 @@
gstreamer-0.10 >= $GSTREAMER_REQUIRED \
gstreamer-plugins-base-0.10 >= $GSTREAMER_BASE_REQUIRED)
echo $CFLAGS
+BRASERO_GSTREAMER_LIBS="$BRASERO_GSTREAMER_LIBS -lgstpbutils-0.10"
+
AC_SUBST(BRASERO_GSTREAMER_CFLAGS)
AC_SUBST(BRASERO_GSTREAMER_LIBS)
Modified: trunk/src/brasero-audio-disc.c
==============================================================================
--- trunk/src/brasero-audio-disc.c (original)
+++ trunk/src/brasero-audio-disc.c Wed May 21 14:36:57 2008
@@ -1477,6 +1477,7 @@
BRASERO_IO_INFO_MIME|
BRASERO_IO_INFO_PERM|
BRASERO_IO_INFO_METADATA|
+ BRASERO_IO_INFO_METADATA_MISSING_CODEC|
BRASERO_IO_INFO_RECURSIVE,
NULL);
return result;
@@ -1540,7 +1541,8 @@
disc->priv->add_playlist,
BRASERO_IO_INFO_PERM|
BRASERO_IO_INFO_MIME|
- BRASERO_IO_INFO_METADATA,
+ BRASERO_IO_INFO_METADATA|
+ BRASERO_IO_INFO_METADATA_MISSING_CODEC,
NULL);
return BRASERO_DISC_OK;
@@ -1780,7 +1782,8 @@
disc->priv->add_uri,
BRASERO_IO_INFO_PERM|
BRASERO_IO_INFO_MIME|
- BRASERO_IO_INFO_METADATA,
+ BRASERO_IO_INFO_METADATA|
+ BRASERO_IO_INFO_METADATA_MISSING_CODEC,
ref);
return BRASERO_DISC_OK;
Modified: trunk/src/brasero-io.c
==============================================================================
--- trunk/src/brasero-io.c (original)
+++ trunk/src/brasero-io.c Wed May 21 14:36:57 2008
@@ -793,7 +793,7 @@
cancel,
file_uri?file_uri:job->uri,
info,
- BRASERO_METADATA_FLAG_NONE,
+ (job->options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0,
&metadata);
if (result)
@@ -1084,6 +1084,7 @@
cancel,
child_uri,
info,
+ ((data->job.options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0) |
BRASERO_METADATA_FLAG_FAST,
&metadata);
@@ -1119,7 +1120,7 @@
cancel,
child_uri,
info,
- BRASERO_METADATA_FLAG_NONE,
+ (data->job.options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0,
&metadata);
if (result)
data->total_b += metadata.len;
@@ -1413,6 +1414,7 @@
cancel,
child_uri,
info,
+ ((data->job.options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0) |
BRASERO_METADATA_FLAG_FAST,
&metadata);
@@ -1569,7 +1571,7 @@
cancel,
child_uri,
info,
- BRASERO_METADATA_FLAG_NONE,
+ (data->job.options & BRASERO_IO_INFO_METADATA_MISSING_CODEC) ? BRASERO_METADATA_FLAG_MISSING : 0,
&metadata);
if (result)
Modified: trunk/src/brasero-io.h
==============================================================================
--- trunk/src/brasero-io.h (original)
+++ trunk/src/brasero-io.h Wed May 21 14:36:57 2008
@@ -61,9 +61,10 @@
BRASERO_IO_INFO_METADATA = 1 << 2,
BRASERO_IO_INFO_RECURSIVE = 1 << 3,
BRASERO_IO_INFO_CHECK_PARENT_SYMLINK = 1 << 4,
+ BRASERO_IO_INFO_METADATA_MISSING_CODEC = 1 << 5,
- BRASERO_IO_INFO_URGENT = 1 << 5,
- BRASERO_IO_INFO_IDLE = 1 << 6
+ BRASERO_IO_INFO_URGENT = 1 << 9,
+ BRASERO_IO_INFO_IDLE = 1 << 10
} BraseroIOFlags;
typedef enum {
Modified: trunk/src/brasero-metadata.c
==============================================================================
--- trunk/src/brasero-metadata.c (original)
+++ trunk/src/brasero-metadata.c Wed May 21 14:36:57 2008
@@ -34,6 +34,8 @@
#include <gst/gst.h>
#include <gst/base/gstbasesink.h>
+#include <gst/pbutils/install-plugins.h>
+#include <gst/pbutils/missing-plugins.h>
#include <gst/tag/tag.h>
#include "brasero-metadata.h"
@@ -65,6 +67,10 @@
BraseroMetadataFlag flags;
BraseroMetadataInfo *info;
+ /* This is for automatic missing plugin install */
+ GSList *missing_plugins;
+ GSList *downloads;
+
GMutex *mutex;
GCond *cond;
@@ -94,6 +100,17 @@
static GObjectClass *parent_class = NULL;
+static GSList *downloading = NULL;
+static GSList *downloaded = NULL;
+
+struct _BraseroMetadataGstDownload {
+ gchar *detail;
+
+ /* These are all metadata objects waiting */
+ GSList *objects;
+};
+typedef struct _BraseroMetadataGstDownload BraseroMetadataGstDownload;
+
void
brasero_metadata_info_clear (BraseroMetadataInfo *info)
{
@@ -159,6 +176,27 @@
priv->watch = 0;
}
+ /* That's automatic missing plugin installation */
+ if (priv->missing_plugins) {
+ g_slist_foreach (priv->missing_plugins, (GFunc) gst_mini_object_unref, NULL);
+ g_slist_free (priv->missing_plugins);
+ priv->missing_plugins = NULL;
+ }
+
+ if (priv->downloads) {
+ GSList *iter;
+
+ for (iter = priv->downloads; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+
+ download = iter->data;
+ download->objects = g_slist_remove (download->objects, self);
+ }
+
+ g_slist_free (priv->downloads);
+ priv->downloads = NULL;
+ }
+
/* stop the pipeline */
priv->started = 0;
@@ -442,6 +480,246 @@
return brasero_metadata_completed (self);
}
+static void
+brasero_metadata_install_plugins_add_downloaded (GSList *downloads)
+{
+ GSList *iter;
+
+ for (iter = downloads; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+
+ download = iter->data;
+ downloaded = g_slist_prepend (downloaded, download->detail);
+ download->detail = NULL;
+ }
+}
+
+static void
+brasero_metadata_install_plugins_free_data (GSList *downloads)
+{
+ GSList *iter;
+
+ for (iter = downloads; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+ GSList *meta;
+
+ download = iter->data;
+ if (download->detail)
+ g_free (download->detail);
+
+ for (meta = download->objects; meta; meta = meta->next) {
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (meta->data);
+ priv->downloads = g_slist_remove (priv->downloads, download);
+ }
+
+ downloading = g_slist_remove (downloading, download);
+
+ g_slist_free (download->objects);
+
+ g_free (download);
+ }
+
+ g_slist_free (downloads);
+}
+
+static void
+brasero_metadata_install_plugins_success (BraseroMetadataGstDownload *download)
+{
+ GSList *iter;
+
+ for (iter = download->objects; iter; iter = iter->next) {
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (iter->data);
+
+ /* free previously saved error message */
+ g_error_free (priv->error);
+ priv->error = NULL;
+
+ gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_NULL);
+ gst_element_set_state (GST_ELEMENT (priv->pipeline), GST_STATE_PLAYING);
+ }
+}
+
+static void
+brasero_metadata_install_plugins_abort (BraseroMetadataGstDownload *download)
+{
+ GSList *iter;
+
+ for (iter = download->objects; iter; iter = iter->next) {
+ BraseroMetadataPrivate *priv;
+
+ priv = BRASERO_METADATA_PRIVATE (iter->data);
+
+ g_error_free (priv->error);
+ priv->error = NULL;
+ brasero_metadata_completed (BRASERO_METADATA (iter->data));
+ }
+}
+
+static void
+brasero_metadata_install_plugins_completed (BraseroMetadataGstDownload *download)
+{
+ GSList *iter;
+
+ for (iter = download->objects; iter; iter = iter->next)
+ brasero_metadata_completed (BRASERO_METADATA (iter->data));
+}
+
+static void
+brasero_metadata_install_plugins_result (GstInstallPluginsReturn res,
+ gpointer data)
+{
+ GSList *downloads = data;
+ GSList *iter;
+
+ switch (res) {
+ case GST_INSTALL_PLUGINS_PARTIAL_SUCCESS:
+ case GST_INSTALL_PLUGINS_SUCCESS:
+ brasero_metadata_install_plugins_add_downloaded (downloads);
+
+ /* force gst to update plugin list */
+ gst_update_registry ();
+
+ /* restart metadata search */
+ for (iter = downloads; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+
+ download = iter->data;
+ brasero_metadata_install_plugins_success (download);
+ }
+ break;
+
+ case GST_INSTALL_PLUGINS_NOT_FOUND:
+ brasero_metadata_install_plugins_add_downloaded (downloads);
+
+ /* stop everything */
+ for (iter = downloads; iter; iter = iter->next)
+ brasero_metadata_install_plugins_completed (iter->data);
+ break;
+
+ case GST_INSTALL_PLUGINS_USER_ABORT:
+ brasero_metadata_install_plugins_add_downloaded (downloads);
+
+ /* free previously saved error message */
+ for (iter = downloads; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+
+ download = iter->data;
+ brasero_metadata_install_plugins_abort (download);
+ }
+ break;
+
+ case GST_INSTALL_PLUGINS_ERROR:
+ case GST_INSTALL_PLUGINS_CRASHED:
+ default:
+ for (iter = downloads; iter; iter = iter->next)
+ brasero_metadata_install_plugins_completed (iter->data);
+
+ break;
+ }
+
+ brasero_metadata_install_plugins_free_data (downloads);
+}
+
+BraseroMetadataGstDownload *
+brasero_metadata_is_downloading (const gchar *detail)
+{
+ GSList *iter;
+
+ for (iter = downloading; iter; iter = iter->next) {
+ BraseroMetadataGstDownload *download;
+
+ download = iter->data;
+ if (!strcmp (download->detail, detail))
+ return download;
+ }
+ return NULL;
+}
+
+static gboolean
+brasero_metadata_install_missing_plugins (BraseroMetadata *self)
+{
+ GstInstallPluginsContext *context;
+ GstInstallPluginsReturn status;
+ BraseroMetadataPrivate *priv;
+ GSList *downloads = NULL;
+ GPtrArray *details;
+ GSList *iter;
+
+ priv = BRASERO_METADATA_PRIVATE (self);
+
+ BRASERO_BURN_LOG ("Starting to download missing plugins");
+
+ details = g_ptr_array_new ();
+ for (iter = priv->missing_plugins; iter; iter = iter->next) {
+ gchar *detail;
+ BraseroMetadataGstDownload *download;
+
+ /* Check if this plugin:
+ * - has already been downloaded (whether it was successful or not)
+ * - is being downloaded
+ * If so don't do anything.
+ */
+ detail = gst_missing_plugin_message_get_installer_detail (iter->data);
+ download = brasero_metadata_is_downloading (detail);
+ if (download) {
+ download->objects = g_slist_prepend (download->objects, self);
+ priv->downloads = g_slist_prepend (priv->downloads, download);
+ g_free (detail);
+ continue;
+ }
+
+ if (g_slist_find_custom (downloaded, detail, (GCompareFunc) strcmp)) {
+ g_free (detail);
+ continue;
+ }
+
+ download = g_new0 (BraseroMetadataGstDownload, 1);
+ download->detail = detail;
+ download->objects = g_slist_prepend (download->objects, self);
+ priv->downloads = g_slist_prepend (priv->downloads, download);
+
+ downloads = g_slist_prepend (downloads, download);
+ downloading = g_slist_prepend (downloading, download);
+
+ g_ptr_array_add (details, detail);
+ }
+
+ if (!details->len) {
+ /* either these plugins were downloaded or are being downloaded */
+ g_ptr_array_free (details, TRUE);
+ if (!priv->downloads)
+ return FALSE;
+
+ return TRUE;
+ }
+
+ g_ptr_array_add (details, NULL);
+
+ /* FIXME: we'd need the main window here to set it modal */
+
+ context = gst_install_plugins_context_new ();
+ status = gst_install_plugins_async ((gchar **) details->pdata,
+ context,
+ brasero_metadata_install_plugins_result,
+ downloads);
+
+ gst_install_plugins_context_free (context);
+ g_ptr_array_free (details, FALSE);
+
+ BRASERO_BURN_LOG ("Download status %i", status);
+
+ if (status != GST_INSTALL_PLUGINS_STARTED_OK) {
+ brasero_metadata_install_plugins_free_data (downloads);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static gboolean
brasero_metadata_bus_messages (GstBus *bus,
GstMessage *msg,
@@ -458,8 +736,12 @@
switch (GST_MESSAGE_TYPE (msg)) {
case GST_MESSAGE_ELEMENT:
- if (!strcmp (gst_structure_get_name (msg->structure), "level")
- && gst_structure_has_field (msg->structure, "peak")) {
+ /* here we just want to check if that's a missing codec */
+ if ((priv->flags & BRASERO_METADATA_FLAG_MISSING)
+ && gst_is_missing_plugin_message (msg))
+ priv->missing_plugins = g_slist_prepend (priv->missing_plugins, gst_message_ref (msg));
+ else if (!strcmp (gst_structure_get_name (msg->structure), "level")
+ && gst_structure_has_field (msg->structure, "peak")) {
const GValue *value;
const GValue *list;
gdouble peak;
@@ -510,13 +792,21 @@
break;
case GST_MESSAGE_ERROR:
+ /* save the error message */
gst_message_parse_error (msg, &error, &debug_string);
BRASERO_BURN_LOG (debug_string);
g_free (debug_string);
if (!priv->error && error)
priv->error = error;
- brasero_metadata_completed (self);
+ /* See if we have missing plugins */
+ if (priv->missing_plugins) {
+ if (!brasero_metadata_install_missing_plugins (self))
+ brasero_metadata_completed (self);
+ }
+ else
+ brasero_metadata_completed (self);
+
break;
case GST_MESSAGE_EOS:
Modified: trunk/src/brasero-metadata.h
==============================================================================
--- trunk/src/brasero-metadata.h (original)
+++ trunk/src/brasero-metadata.h Wed May 21 14:36:57 2008
@@ -35,8 +35,9 @@
typedef enum {
BRASERO_METADATA_FLAG_NONE = 0,
- BRASERO_METADATA_FLAG_FAST,
- BRASERO_METADATA_FLAG_SILENCES
+ BRASERO_METADATA_FLAG_FAST = 1,
+ BRASERO_METADATA_FLAG_SILENCES = 1 << 1,
+ BRASERO_METADATA_FLAG_MISSING = 1 << 2
} BraseroMetadataFlag;
#define BRASERO_TYPE_METADATA (brasero_metadata_get_type ())
Modified: trunk/src/main.c
==============================================================================
--- trunk/src/main.c (original)
+++ trunk/src/main.c Wed May 21 14:36:57 2008
@@ -37,6 +37,7 @@
#include <gtk/gtk.h>
#include <gst/gst.h>
+#include <gst/pbutils/pbutils.h>
#include <libgnome/gnome-help.h>
#include <libgnomeui/libgnomeui.h>
@@ -782,6 +783,9 @@
gst_init (&argc, &argv);
+ /* This is for missing codec automatic install */
+ gst_pb_utils_init ();
+
brasero_burn_set_debug (debug);
brasero_burn_library_init ();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]