diff options
-rw-r--r-- | avmedia/source/gstreamer/gstplayer.cxx | 62 | ||||
-rw-r--r-- | configure.ac | 6 | ||||
-rw-r--r-- | include/sal/log-areas.dox | 1 |
3 files changed, 65 insertions, 4 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 1b06c174e759..eea5bb66400b 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 541475429da3..ca530c13a904 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 461fb781b677..d734876a8a75 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 |