avmedia/source/gstreamer/gstplayer.cxx | 62 +++++++++ configure.ac | 6 include/sal/log-areas.dox | 1 shell/source/sessioninstall/SyncDbusSessionHelper.cxx | 121 ++++++++++++++---- shell/source/sessioninstall/SyncDbusSessionHelper.hxx | 36 ++--- 5 files changed, 181 insertions(+), 45 deletions(-)
New commits: commit de8afb9a2b461da4c81e45a7e185b553a5f4c3e7 Author: Stephan Bergmann <[email protected]> Date: Wed May 13 16:44:42 2015 +0200 First cut at reporting missing GStreamer plugins Change-Id: Ia3cd8a2f0979f2312a70b8ee169fe9d6eef85c81 diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 1b06c17..eea5bb6 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -17,12 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/config.h> + +#include <cstddef> +#include <cstring> +#include <set> #include <math.h> #include <cppuhelper/supportsservice.hxx> #include <rtl/string.hxx> - +#include <vcl/svapp.hxx> #include <vcl/syschild.hxx> #include <vcl/sysdata.hxx> @@ -39,6 +44,9 @@ # define AVMEDIA_GST_PLAYER_SERVICENAME "com.sun.star.media.Player_GStreamer" #endif +#include <gst/pbutils/missing-plugins.h> +#include <gst/pbutils/pbutils.h> + #if !defined DBG # if OSL_DEBUG_LEVEL > 2 #ifdef AVMEDIA_GST_0_10 @@ -56,6 +64,56 @@ using namespace ::com::sun::star; namespace avmedia { namespace gstreamer { +namespace { + +class MissingPluginInstaller { +public: + void report(GstMessage * message); + +private: + DECL_STATIC_LINK(MissingPluginInstaller, install, rtl_String *); + + std::set<OString> reported_; +}; + +void MissingPluginInstaller::report(GstMessage * message) { + // assert(gst_is_missing_plugin_message(message)); + gchar * det = gst_missing_plugin_message_get_installer_detail(message); + if (det != nullptr) { + std::size_t len = std::strlen(det); + if (len <= sal_uInt32(SAL_MAX_INT32)) { + OString detStr(det, len); + if (reported_.insert(detStr).second) { + rtl_string_acquire(detStr.pData); + Application::PostUserEvent( + LINK(nullptr, MissingPluginInstaller, install), + detStr.pData); + } + } else { + SAL_WARN( + "avmedia.gstreamer", "detail string too long"); + } + g_free(det); + } else { + SAL_WARN( + "avmedia.gstreamer", + "gst_missing_plugin_message_get_installer_detail failed"); + } +} + +IMPL_STATIC_LINK(MissingPluginInstaller, install, rtl_String *, data) { + OString res(data, SAL_NO_ACQUIRE); + gst_pb_utils_init(); // not thread safe + char * args[]{const_cast<char *>(res.getStr()), nullptr}; + gst_install_plugins_sync(args, nullptr); + return 0; +} + +struct TheMissingPluginInstaller: + public rtl::Static<MissingPluginInstaller, TheMissingPluginInstaller> +{}; + +} // - Player - @@ -328,6 +386,8 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) } } #endif + } else if (gst_is_missing_plugin_message(message)) { + TheMissingPluginInstaller::get().report(message); } else if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) { DBG( "Error !\n" ); if( mnWidth == 0 ) { diff --git a/configure.ac b/configure.ac index 5414754..ca530c1 100644 --- a/configure.ac +++ b/configure.ac @@ -10220,7 +10220,7 @@ if test "$build_gstreamer_1_0" = "yes"; then if test "$enable_avmedia" = yes -a "$enable_gstreamer_1_0" != no; then ENABLE_GSTREAMER_1_0="TRUE" AC_MSG_RESULT([yes]) - PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-video-1.0] ) + PKG_CHECK_MODULES( [GSTREAMER_1_0], [gstreamer-1.0 gstreamer-plugins-base-1.0 gstreamer-pbutils-1.0 gstreamer-video-1.0] ) GSTREAMER_1_0_CFLAGS=$(printf '%s' "$GSTREAMER_1_0_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") else AC_MSG_RESULT([no]) @@ -10238,8 +10238,8 @@ if test "$build_gstreamer_0_10" = "yes"; then if test "$enable_avmedia" = yes -a "$enable_gstreamer_0_10" != no; then ENABLE_GSTREAMER_0_10="TRUE" AC_MSG_RESULT([yes]) - PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-interfaces-0.10],, [ - PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10] ) + PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10 gstreamer-interfaces-0.10],, [ + PKG_CHECK_MODULES( [GSTREAMER_0_10], [gstreamer-0.10 gstreamer-plugins-base-0.10 gstreamer-pbutils-0.10] ) ]) GSTREAMER_0_10_CFLAGS=$(printf '%s' "$GSTREAMER_0_10_CFLAGS" | sed -e "s/-I/${ISYSTEM?}/g") else diff --git a/include/sal/log-areas.dox b/include/sal/log-areas.dox index 461fb78..d734876 100644 --- a/include/sal/log-areas.dox +++ b/include/sal/log-areas.dox @@ -482,6 +482,7 @@ certain functionality. @section avmedia @li @c avmedia +@li @c avmedia.gstreamer @li @c avmedia.opengl - OpenGL models @section other commit 2527a4d5a7cb1a7086129019a29dc063a3a28f63 Author: Stephan Bergmann <[email protected]> Date: Wed May 13 16:29:38 2015 +0200 Implement some more XModify methods Change-Id: I1345d6a3d62f1e5c3353c5412024f6b47f824f7a diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx index ae42358..a45c343 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.cxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.cxx @@ -53,6 +53,32 @@ namespace throw RuntimeException("couldnt get a proxy!"); return proxy; } + +void request( + char const * method, sal_uInt32 xid, + css::uno::Sequence<OUString> const & resources, + OUString const & interaction) +{ + std::vector<OString> resUtf8; + std::shared_ptr<GVariantBuilder> builder( + g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter()); + for (auto & i: resources) { + auto s(OUStringToOString(i, RTL_TEXTENCODING_UTF8)); + resUtf8.push_back(s); + g_variant_builder_add(builder.get(), "s", s.getStr()); + } + auto iactUtf8(OUStringToOString(interaction, RTL_TEXTENCODING_UTF8)); + std::shared_ptr<GDBusProxy> proxy( + lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>()); + GErrorWrapper error(nullptr); + g_dbus_proxy_call_sync( + proxy.get(), method, + g_variant_new( + "(uass)", static_cast<guint32>(xid), builder.get(), + iactUtf8.getStr()), + G_DBUS_CALL_FLAGS_NONE, -1, nullptr, &error.getRef()); +} + } namespace shell { namespace sessioninstall @@ -63,31 +89,78 @@ namespace shell { namespace sessioninstall g_type_init (); #endif } - void SAL_CALL SyncDbusSessionHelper::InstallPackageNames( const ::sal_uInt32 nXid, const Sequence< OUString >& vPackages, const OUString& sInteraction ) throw (RuntimeException, std::exception) - { - vector< OString > vPackagesOString; - vPackagesOString.reserve(vPackages.getLength()); - boost::shared_ptr<GVariantBuilder> pBuilder(g_variant_builder_new(G_VARIANT_TYPE ("as")), GVariantBuilderDeleter()); - for( const OUString* pPackage = vPackages.begin(); pPackage != vPackages.end(); ++pPackage) - { - vPackagesOString.push_back(OUStringToOString(*pPackage, RTL_TEXTENCODING_ASCII_US)); - g_variant_builder_add(pBuilder.get(), "s", vPackagesOString.back().getStr()); - } - const OString sInteractionAscii = OUStringToOString(sInteraction, RTL_TEXTENCODING_ASCII_US); - boost::shared_ptr<GDBusProxy> proxy(lcl_GetPackageKitProxy("Modify"), GObjectDeleter<GDBusProxy>()); - GErrorWrapper error(NULL); - g_dbus_proxy_call_sync (proxy.get(), - "InstallPackageNames", - g_variant_new ("(uass)", - sal::static_int_cast<guint32>(nXid), - pBuilder.get(), - sInteractionAscii.getStr()), - G_DBUS_CALL_FLAGS_NONE, - -1, /* timeout */ - NULL, /* cancellable */ - &error.getRef()); - } +void SyncDbusSessionHelper::InstallPackageFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPackageFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallProvideFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallProvideFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallCatalogs( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallCatalogs", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallPackageNames( + sal_uInt32 xid, css::uno::Sequence<OUString> const & packages, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPackageNames", xid, packages, interaction); +} + +void SyncDbusSessionHelper::InstallMimeTypes( + sal_uInt32 xid, css::uno::Sequence<OUString> const & mimeTypes, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallMimeTypes", xid, mimeTypes, interaction); +} + +void SyncDbusSessionHelper::InstallFontconfigResources( + sal_uInt32 xid, css::uno::Sequence<OUString> const & resources, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallFontconfigResources", xid, resources, interaction); +} + +void SyncDbusSessionHelper::InstallGStreamerResources( + sal_uInt32 xid, css::uno::Sequence<OUString> const & resources, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallGStreamerResources", xid, resources, interaction); +} + +void SyncDbusSessionHelper::RemovePackageByFiles( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("RemovePackageByFiles", xid, files, interaction); +} + +void SyncDbusSessionHelper::InstallPrinterDrivers( + sal_uInt32 xid, css::uno::Sequence<OUString> const & files, + OUString const & interaction) + throw (css::uno::RuntimeException, std::exception) +{ + request("InstallPrinteDrivers", xid, files, interaction); +} void SAL_CALL SyncDbusSessionHelper::IsInstalled( const OUString& sPackagename, const OUString& sInteraction, sal_Bool& o_isInstalled ) throw (RuntimeException, std::exception) { diff --git a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx index 2011652..47c72a8 100644 --- a/shell/source/sessioninstall/SyncDbusSessionHelper.hxx +++ b/shell/source/sessioninstall/SyncDbusSessionHelper.hxx @@ -22,27 +22,29 @@ namespace shell { namespace sessioninstall public: SyncDbusSessionHelper(::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext> const&); virtual ~SyncDbusSessionHelper() {} + // XModify Methods - virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* packages */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallPackageNames( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& packages, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& mimeTypes, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& resources, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; - virtual void SAL_CALL InstallPackageFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallProvideFiles( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallCatalogs( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallMimeTypes( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* mime_types */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallFontconfigResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallGStreamerResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented virtual void SAL_CALL InstallResources( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* types */, const ::com::sun::star::uno::Sequence< OUString >& /* resources */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL RemovePackageByFiles( SAL_UNUSED_PARAMETER ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented - virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 /* xid */, const ::com::sun::star::uno::Sequence< OUString >& /* files */, const OUString& /* interaction */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE - { throw ::com::sun::star::uno::RuntimeException(); } // not implemented + + virtual void SAL_CALL RemovePackageByFiles( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + virtual void SAL_CALL InstallPrinterDrivers( ::sal_uInt32 xid, const ::com::sun::star::uno::Sequence< OUString >& files, const OUString& interaction ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XQuery Methods virtual void SAL_CALL IsInstalled( const OUString& /* package_name */, const OUString& /* interaction */, sal_Bool& /* installed */ ) throw (::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; _______________________________________________ Libreoffice-commits mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
