[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r9974: Bring back support for missin
From: |
Bastiaan Jacques |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r9974: Bring back support for missing-plugins installation. |
Date: |
Wed, 08 Oct 2008 20:38:02 +0200 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 9974
committer: Bastiaan Jacques <address@hidden>
branch nick: trunk
timestamp: Wed 2008-10-08 20:38:02 +0200
message:
Bring back support for missing-plugins installation.
modified:
libmedia/gst/AudioDecoderGst.cpp
libmedia/gst/GstUtil.cpp
libmedia/gst/GstUtil.h
libmedia/gst/VideoDecoderGst.cpp
------------------------------------------------------------
revno: 9946.1.1
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Tue 2008-10-07 21:16:42 +0200
message:
Add check_missing_plugins, which will fire a missing-plugins dialog if
necessary and available.
modified:
libmedia/gst/GstUtil.cpp
libmedia/gst/GstUtil.h
------------------------------------------------------------
revno: 9946.1.2
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Tue 2008-10-07 21:17:59 +0200
message:
Remove defunct plugin loading code.
modified:
libmedia/gst/GstUtil.cpp
libmedia/gst/GstUtil.h
------------------------------------------------------------
revno: 9946.1.3
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Tue 2008-10-07 21:32:41 +0200
message:
Start using check_missing_plugins.
modified:
libmedia/gst/GstUtil.cpp
libmedia/gst/VideoDecoderGst.cpp
------------------------------------------------------------
revno: 9946.1.4
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Tue 2008-10-07 21:51:29 +0200
message:
AudioDecoderGst.cpp: Start using check_missing_plugins.
GstUtil.h: Document check_missing_plugins.
modified:
libmedia/gst/AudioDecoderGst.cpp
libmedia/gst/GstUtil.h
------------------------------------------------------------
revno: 9946.1.5
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Wed 2008-10-08 20:33:49 +0200
message:
Merge trunk.
modified:
README
macros/xpcom.m4
packaging/xpi.am
plugin/Makefile.am
plugin/plugin.cpp
plugin/plugin.h
------------------------------------------------------------
revno: 9946.1.6
committer: Bastiaan Jacques <address@hidden>
branch nick: gst-release
timestamp: Wed 2008-10-08 20:34:42 +0200
message:
Proper pbutils init and update the registry if needed.
modified:
libmedia/gst/GstUtil.cpp
=== modified file 'libmedia/gst/AudioDecoderGst.cpp'
--- a/libmedia/gst/AudioDecoderGst.cpp 2008-10-06 19:17:38 +0000
+++ b/libmedia/gst/AudioDecoderGst.cpp 2008-10-07 19:51:29 +0000
@@ -25,6 +25,7 @@
#include "AudioDecoderGst.h"
#include "MediaParser.h"
#include "MediaParserGst.h"
+#include "GstUtil.h"
namespace gnash {
namespace media {
@@ -127,6 +128,13 @@
throw MediaException(_("AudioDecoderGst: internal error (caps creation
failed)"));
}
+ bool success = GstUtil::check_missing_plugins(srccaps);
+ if (!success) {
+ gst_caps_unref(srccaps);
+ throw MediaException(_("Couldn't find a plugin for video type ..."));
+ }
+
+
GstCaps* sinkcaps = gst_caps_from_string ("audio/x-raw-int,
endianness=byte_order, signed=(boolean)true, width=16, depth=16, rate=44100,
channels=2");
if (!sinkcaps) {
throw MediaException(_("AudioDecoderGst: internal error (caps creation
failed)"));
@@ -134,8 +142,8 @@
std::string resampler = findResampler();
- bool rv = swfdec_gst_decoder_init (&_decoder, srccaps, sinkcaps,
"audioconvert", resampler.c_str(), NULL);
- if (!rv) {
+ success = swfdec_gst_decoder_init (&_decoder, srccaps, sinkcaps,
"audioconvert", resampler.c_str(), NULL);
+ if (!success) {
throw MediaException(_("AudioDecoderGst: initialisation failed."));
}
=== modified file 'libmedia/gst/GstUtil.cpp'
--- a/libmedia/gst/GstUtil.cpp 2008-09-29 18:35:49 +0000
+++ b/libmedia/gst/GstUtil.cpp 2008-10-08 18:34:42 +0000
@@ -22,11 +22,18 @@
#include "gnashconfig.h"
#endif
+#include <sstream>
+
#include "GstUtil.h"
#include "log.h"
-#include <gst/gst.h>
-#include <sstream>
+#include "swfdec_codec_gst.h"
+
+#ifdef GST_HAS_MODERN_PBUTILS
+#include <gst/pbutils/pbutils.h>
+#include <gst/pbutils/missing-plugins.h>
+#include <gst/pbutils/install-plugins.h>
+#endif // GST_HAS_MODERN_PBUTILS
namespace gnash {
@@ -88,24 +95,52 @@
return element;
}
-
-// FIXME: decide on a single style for this file...
-void
-GstUtil::ensure_plugin_registered(const char* name, GType type)
+// static
+bool
+GstUtil::check_missing_plugins(GstCaps* caps)
{
- GstElementFactory* factory = gst_element_factory_find (name);
-
- if (!factory) {
- if (!gst_element_register (NULL, name, GST_RANK_PRIMARY,
- type)) {
- log_error("Failed to register our plugin %s. This may inhibit media "
- "playback.", name);
- }
- } else {
- gst_object_unref(GST_OBJECT(factory));
- }
-
- log_debug("element %s should now be registered", name);
+ GstElementFactory * factory = swfdec_gst_get_element_factory (caps);
+
+ if (factory) {
+ gst_object_unref(factory);
+ return true;
+ }
+
+#ifdef GST_HAS_MODERN_PBUTILS
+ gst_pb_utils_init();
+
+
+ if (!gst_install_plugins_supported()) {
+ log_error(_("Missing plugin, but plugin installing not supported."
+ " Will try anyway, but expect failure."));
+ }
+
+ char* detail = gst_missing_decoder_installer_detail_new (caps);
+ if (!detail) {
+ log_error(_("Missing plugin, but failed to convert it to gst"
+ " missing plugin detail."));
+ return false;
+ }
+
+ char* details[] = { detail, 0 };
+
+ GstInstallPluginsReturn ret = gst_install_plugins_sync(details, NULL);
+ g_free(details[0]);
+
+ // FIXME: what about partial success?
+ if (ret == GST_INSTALL_PLUGINS_SUCCESS) {
+ if (! gst_update_registry()) {
+ log_error(_("gst_update_registry failed. You'll need to "
+ "restart Gnash to use the new plugins."));
+ }
+
+ return true;
+ }
+#else
+ log_error(_("Missing plugin, but plugin installation not available."));
+#endif
+
+ return false;
}
=== modified file 'libmedia/gst/GstUtil.h'
--- a/libmedia/gst/GstUtil.h 2008-10-06 09:59:04 +0000
+++ b/libmedia/gst/GstUtil.h 2008-10-07 19:51:29 +0000
@@ -24,11 +24,7 @@
#include "gnashconfig.h"
#endif
-#include "log.h"
-#include <rc.h>
-
#include <gst/gst.h>
-#include "image.h"
#include "dsodefs.h" // DSOEXPORT
// GST_TIME_AS_MSECONDS not defined as of gst 0.10.9
@@ -67,9 +63,18 @@
* a number based on the number of gnashrcsinks that have been allocated so
* far.
*/
- static GstElement* get_audiosink_element();
-
- static void ensure_plugin_registered(const char* name, GType type);
+ static GstElement* get_audiosink_element();
+
+
+ /// Check for missing plugins and try to install them if necessary.
+ //
+ /// The installation, if applicable, will happen synchronously!
+ ///
+ /// @param caps Indicates the type of media to search for.
+ /// @return if there is a decoder available to decode the passed type,
+ /// or if we succeeded in installing one, returns true. Otherwise,
+ /// returns false.
+ static bool check_missing_plugins(GstCaps* caps);
private:
=== modified file 'libmedia/gst/VideoDecoderGst.cpp'
--- a/libmedia/gst/VideoDecoderGst.cpp 2008-10-06 23:12:23 +0000
+++ b/libmedia/gst/VideoDecoderGst.cpp 2008-10-07 19:32:41 +0000
@@ -23,7 +23,7 @@
#include "VideoDecoderGst.h"
#include "MediaParserGst.h"
-
+#include "GstUtil.h"
namespace gnash {
namespace media {
@@ -91,6 +91,11 @@
throw MediaException(_("VideoDecoderGst: internal error (caps creation
failed)"));
}
+ bool success = GstUtil::check_missing_plugins(srccaps);
+ if (!success) {
+ throw MediaException(_("Couldn't find a plugin for video type ..."));
+ }
+
GstCaps* sinkcaps = gst_caps_new_simple ("video/x-raw-rgb", "bpp",
G_TYPE_INT, 24,
"depth", G_TYPE_INT, 24,
NULL);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r9974: Bring back support for missing-plugins installation.,
Bastiaan Jacques <=