You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by da...@apache.org on 2018/03/02 06:14:01 UTC
svn commit: r1825700 - in /openoffice/trunk/main:
avmedia/Library_avmediagst.mk avmedia/source/gstreamer/gstframegrabber.cxx
avmedia/source/gstreamer/gstplayer.cxx configure.ac
Author: damjan
Date: Fri Mar 2 06:14:01 2018
New Revision: 1825700
URL: http://svn.apache.org/viewvc?rev=1825700&view=rev
Log:
Use gstreamer 1.0 instead of the long obsolete
version 0.1.
Embed the window into the document properly,
by setting the window id on the GstVideoOverlay
using gst_video_overlay_set_window_handle()
after window creation in Player::createPlayerWindow().
Add better logging.
Patch by: me
Modified:
openoffice/trunk/main/avmedia/Library_avmediagst.mk
openoffice/trunk/main/avmedia/source/gstreamer/gstframegrabber.cxx
openoffice/trunk/main/avmedia/source/gstreamer/gstplayer.cxx
openoffice/trunk/main/configure.ac
Modified: openoffice/trunk/main/avmedia/Library_avmediagst.mk
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/avmedia/Library_avmediagst.mk?rev=1825700&r1=1825699&r2=1825700&view=diff
==============================================================================
--- openoffice/trunk/main/avmedia/Library_avmediagst.mk (original)
+++ openoffice/trunk/main/avmedia/Library_avmediagst.mk Fri Mar 2 06:14:01 2018
@@ -31,12 +31,11 @@ $(eval $(call gb_Library_set_include,avm
$$(INCLUDE) \
-I$(SRCDIR)/avmedia/inc \
-I$(SRCDIR)/avmedia/source/inc \
- $(filter -I%,$(GTK_CFLAGS)) \
- $(shell pkg-config --cflags-only-I gstreamer-0.10 gstreamer-interfaces-0.10) \
+ $(filter -I%,$(GSTREAMER_CFLAGS)) \
))
$(eval $(call gb_Library_add_cflags,avmediagst,\
- $(filter-out -I%,$(GTK_CFLAGS)) \
+ $(filter-out -I%,$(GSTREAMER_CFLAGS)) \
))
ifeq ($(OS),MACOSX)
@@ -62,8 +61,7 @@ $(eval $(call gb_Library_add_linked_libs
))
$(eval $(call gb_Library_add_libs,avmediagst,\
- $(GTK_LIBS) \
- $(shell pkg-config --libs gstreamer-0.10 gstreamer-interfaces-0.10) \
+ $(GSTREAMER_LIBS) \
))
$(eval $(call gb_Library_add_exception_objects,avmediagst,\
Modified: openoffice/trunk/main/avmedia/source/gstreamer/gstframegrabber.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/avmedia/source/gstreamer/gstframegrabber.cxx?rev=1825700&r1=1825699&r2=1825700&view=diff
==============================================================================
--- openoffice/trunk/main/avmedia/source/gstreamer/gstframegrabber.cxx (original)
+++ openoffice/trunk/main/avmedia/source/gstreamer/gstframegrabber.cxx Fri Mar 2 06:14:01 2018
@@ -130,9 +130,9 @@ gboolean FrameGrabber::busCallback( GstB
{
bool bDone = false;
- if( pMsg && pMsg->structure )
+ if( pMsg && gst_message_get_structure( pMsg ) )
{
- GstStructure* pStruct = pMsg->structure;
+ const GstStructure* pStruct = gst_message_get_structure( pMsg );
const gchar* pStructName = gst_structure_get_name( pStruct );
if( ( ::std::string( pStructName ).find( "pixbuf" ) != ::std::string::npos ) &&
Modified: openoffice/trunk/main/avmedia/source/gstreamer/gstplayer.cxx
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/avmedia/source/gstreamer/gstplayer.cxx?rev=1825700&r1=1825699&r2=1825700&view=diff
==============================================================================
--- openoffice/trunk/main/avmedia/source/gstreamer/gstplayer.cxx (original)
+++ openoffice/trunk/main/avmedia/source/gstreamer/gstplayer.cxx Fri Mar 2 06:14:01 2018
@@ -29,7 +29,7 @@
#include <math.h>
#include <string>
#include <gst/gstelement.h>
-#include <gst/interfaces/xoverlay.h>
+#include <gst/video/videooverlay.h>
// maximum timeout time in nanoseconds
@@ -312,10 +312,7 @@ double SAL_CALL Player::getDuration()
if( implInitPlayer() )
{
- GstFormat aFormat = GST_FORMAT_TIME;
-
- if( !gst_element_query_duration( mpPlayer, &aFormat, &nDuration ) ||
- ( GST_FORMAT_TIME != aFormat ) ||
+ if( !gst_element_query_duration( mpPlayer, GST_FORMAT_TIME, &nDuration ) ||
( nDuration < 0 ) )
{
nDuration = 0;
@@ -348,11 +345,9 @@ double SAL_CALL Player::getMediaTime()
::osl::MutexGuard aGuard(m_aMutex);
if( implInitPlayer() )
{
- GstFormat aFormat = GST_FORMAT_TIME;
gint64 nCurTime = 0;
- if( gst_element_query_position( mpPlayer, &aFormat, &nCurTime ) &&
- ( GST_FORMAT_TIME == aFormat ) &&
+ if( gst_element_query_position( mpPlayer, GST_FORMAT_TIME, &nCurTime ) &&
( nCurTime >= 0 ) )
{
fRet = static_cast< double >( nCurTime ) / NANO_TIME_FACTOR;
@@ -539,6 +534,7 @@ uno::Reference< ::media::XPlayerWindow >
if( !pPlayerWindow->create( rArguments ) )
{
+ OSL_ENSURE( false, "could not create player window\n" );
xRet.clear();
}
else
@@ -557,8 +553,12 @@ uno::Reference< ::media::XPlayerWindow >
gst_element_get_state( mpPlayer, &aOldState, NULL, GST_MAX_TIMEOUT );
gst_element_set_state( mpPlayer, GST_STATE_READY );
g_object_set( mpPlayer, "video-sink", pVideoSink, NULL );
+ gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( mpPlayer ),
+ pPlayerWindow->getXWindowHandle() );
gst_element_set_state( mpPlayer, aOldState );
}
+ else
+ OSL_ENSURE( false, "no video sink available\n" );
}
}
@@ -756,7 +756,7 @@ void Player::implHandleNewPadFunc( GstEl
g_free( pElementName );
#endif
- GstCaps* pCaps = gst_pad_get_caps( pPad );
+ GstCaps* pCaps = gst_pad_get_current_caps( pPad );
// we are interested only in getting video properties
// width and height or if we have a video source at all
@@ -863,7 +863,7 @@ gpointer Player::run()
// add bus sync handler to intercept video window creation for setting our own window
gst_bus_set_sync_handler( static_cast< GstBusSource* >( pBusSource )->mpBus,
- &lcl_implHandleCreateWindowFunc, this );
+ &lcl_implHandleCreateWindowFunc, this, NULL );
// watch for all elements (and pads) that will be added to the playbin,
// in order to retrieve properties like video width and height
@@ -877,6 +877,14 @@ gpointer Player::run()
// and don't want to have the gstreamer default window appearing
g_object_set( mpPlayer, "video-sink", gst_element_factory_make( "fakesink", NULL ), NULL );
+ // This isn't ever going to happen, as createPlayerWindow() has to be called first
+ // to set the mpPlayerWindow, but let's keep it here in case it is called first some day:
+ if ( g_atomic_pointer_get( &mpPlayerWindow ) )
+ {
+ gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( mpPlayer ), static_cast< Window* >( g_atomic_pointer_get(
+ &mpPlayerWindow ) )->getXWindowHandle() );
+ }
+
// set state of player to READY or destroy object in case of FAILURE
if( gst_element_set_state( mpPlayer, GST_STATE_READY ) == GST_STATE_CHANGE_FAILURE )
{
@@ -928,13 +936,12 @@ GstBusSyncReply Player::handleCreateWind
GstBusSyncReply eRet = GST_BUS_PASS;
if( pMsg &&
- ( GST_MESSAGE_TYPE( pMsg ) == GST_MESSAGE_ELEMENT ) &&
- gst_structure_has_name( pMsg->structure, "prepare-xwindow-id" ) &&
+ gst_is_video_overlay_prepare_window_handle_message( pMsg ) &&
g_atomic_pointer_get( &mpPlayerWindow ) )
{
OSL_TRACE( ">>> Got Request to create XOverlay" );
- gst_x_overlay_set_xwindow_id( GST_X_OVERLAY( GST_MESSAGE_SRC( pMsg ) ),
+ gst_video_overlay_set_window_handle( GST_VIDEO_OVERLAY( GST_MESSAGE_SRC( pMsg ) ),
static_cast< Window* >( g_atomic_pointer_get(
&mpPlayerWindow ) )->getXWindowHandle() );
Modified: openoffice/trunk/main/configure.ac
URL: http://svn.apache.org/viewvc/openoffice/trunk/main/configure.ac?rev=1825700&r1=1825699&r2=1825700&view=diff
==============================================================================
--- openoffice/trunk/main/configure.ac (original)
+++ openoffice/trunk/main/configure.ac Fri Mar 2 06:14:01 2018
@@ -5847,7 +5847,7 @@ ENABLE_GSTREAMER=""
if test "$test_gstreamer" = "yes"; then
AC_MSG_CHECKING([whether to build the GStreamer media backend])
if test "x$enable_gstreamer" != "xno" ; then
- PKG_CHECK_MODULES( GSTREAMER, gtk+-2.0 >= 2.4 gthread-2.0 gstreamer-0.10 gstreamer-interfaces-0.10 ,,AC_MSG_ERROR([requirements to build the GStreamer media backend not met. Do not use --enable-gstreamer or install the missing packages]))
+ PKG_CHECK_MODULES( GSTREAMER, gtk+-2.0 >= 2.4 gthread-2.0 gstreamer-1.0 gstreamer-video-1.0,,AC_MSG_ERROR([requirements to build the GStreamer media backend not met. Do not use --enable-gstreamer or install the missing packages]))
ENABLE_GSTREAMER="TRUE"
AC_MSG_RESULT([yes])
else