diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-12-20 10:57:12 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-12-20 10:57:16 +0200 |
commit | d0652bfd2b87fad10c141e3bf3f5d0c0a8683cb5 (patch) | |
tree | 4d46ca6ebfbdf4b96af305d9a8cdcce9892961ca /avmedia | |
parent | ce52f6573b8bbdaa68dbb4e89b08543025ee4ba7 (diff) |
Change a local DBG macro to SAL_INFO
But actually, I am starting to lean more and more towards the opinion
that very little of our debug output code is actually useful to keep
in the sources permanently. When somebody wants to debug some part of
the code, they will very likely want to add much more detailled
tracing anyway, temporarily.
Change-Id: I6a60a130e3b72ba3d6ad32a1b22a2a9f3ac66b27
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/gstreamer/gstplayer.cxx | 66 |
1 files changed, 26 insertions, 40 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 4e220866f8d1..158767c4c795 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -53,18 +53,11 @@ #include <gst/pbutils/missing-plugins.h> #include <gst/pbutils/pbutils.h> -#if !defined DBG -# if OSL_DEBUG_LEVEL > 2 #ifdef AVMEDIA_GST_0_10 # define AVVERSION "gst 0.10: " #else # define AVVERSION "gst 1.0: " #endif -#define DBG(...) do { fprintf (stderr, "%s", AVVERSION); fprintf (stderr, __VA_ARGS__); fprintf (stderr, "\n"); } while (0); -# else -#define DBG(...) -# endif -#endif using namespace ::com::sun::star; @@ -312,12 +305,12 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : mbInitialized = gst_init_check( &argc, &argv, &pError ); - DBG( "%p Player::Player", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::Player" ); if (pError != nullptr) { // TODO: throw an exception? - DBG( "%p Player::Player error '%s'", this, pError->message ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::Player error '" << pError->message << "'" ); g_error_free (pError); } } @@ -326,7 +319,7 @@ Player::Player( const uno::Reference< lang::XMultiServiceFactory >& rxMgr ) : Player::~Player() { - DBG( "%p Player::~Player", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::~Player" ); if( mbInitialized ) disposing(); } @@ -339,7 +332,7 @@ void SAL_CALL Player::disposing() stop(); - DBG( "%p Player::disposing", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::disposing" ); // Release the elements and pipeline if( mbInitialized ) @@ -431,8 +424,6 @@ static gboolean wrap_element_query_duration (GstElement *element, GstFormat form GstBusSyncReply Player::processSyncMessage( GstMessage *message ) { -// DBG( "%p processSyncMessage has handle: %s", this, GST_MESSAGE_TYPE_NAME( message ) ); - #if OSL_DEBUG_LEVEL > 0 if ( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) { @@ -441,8 +432,8 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) gst_message_parse_error( message, &error, &error_debug ); SAL_WARN( - "avmedia", - "gstreamer error: '" << error->message << "' debug: '" + "avmedia.gstreamer", + "error: '" << error->message << "' debug: '" << error_debug << "'"); } #endif @@ -454,8 +445,8 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) if (gst_is_video_overlay_prepare_window_handle_message (message) ) #endif { - DBG( "%p processSyncMessage prepare window id: %s %d", this, - GST_MESSAGE_TYPE_NAME( message ), (int)mnWindowID ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " processSyncMessage prepare window id: " << + GST_MESSAGE_TYPE_NAME( message ) << " " << (int)mnWindowID ); if( mpXOverlay ) g_object_unref( G_OBJECT ( mpXOverlay ) ); g_object_set( GST_MESSAGE_SRC( message ), "force-aspect-ratio", FALSE, nullptr ); @@ -473,12 +464,11 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) gst_message_parse_state_changed (message, nullptr, &newstate, &pendingstate); - DBG( "%p state change received, new state %d pending %d", this, - (int)newstate, (int)pendingstate ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " state change received, new state " << (int)newState << " pending " << (int)pendingstate ); if( newstate == GST_STATE_PAUSED && pendingstate == GST_STATE_VOID_PENDING ) { - DBG( "%p change to paused received", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " change to paused received" ); if( mnDuration == 0) { gint64 gst_duration = 0L; @@ -511,7 +501,7 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) if( pStructure ) { gst_structure_get_int( pStructure, "width", &mnWidth ); gst_structure_get_int( pStructure, "height", &mnHeight ); - DBG( "queried size: %d x %d", mnWidth, mnHeight ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "queried size: " << mnWidth << "x" << mnHeight ); } g_object_unref (pPad); } @@ -546,7 +536,7 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) mnWidth = w; mnHeight = h; - DBG( "queried size: %d x %d", mnWidth, mnHeight ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "queried size: " << mnWidth << "x" << mnHeight ); maSizeCondition.set(); } @@ -562,7 +552,6 @@ GstBusSyncReply Player::processSyncMessage( GstMessage *message ) maSizeCondition.set(); } } else if( GST_MESSAGE_TYPE( message ) == GST_MESSAGE_ERROR ) { - DBG( "Error !\n" ); if( mnWidth == 0 ) { // an error occurred, set condition so that OOo thread doesn't wait for us maSizeCondition.set(); @@ -602,7 +591,7 @@ void Player::preparePlaybin( const OUString& rURL, GstElement *pSink ) } mnWatchID = gst_bus_add_watch( pBus, pipeline_bus_callback, this ); mbWatchID = true; - DBG( "%p set sync handler", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " set sync handler" ); #ifdef AVMEDIA_GST_0_10 gst_bus_set_sync_handler( pBus, pipeline_bus_sync_handler, this ); #else @@ -617,7 +606,7 @@ bool Player::create( const OUString& rURL ) // create all the elements and link them - DBG("create player, URL: %s", OUStringToOString( rURL, RTL_TEXTENCODING_UTF8 ).getStr()); + SAL_INFO( "avmedia.gstreamer", "create player, URL: '" << rURL << "'" ); if( mbInitialized && !rURL.isEmpty() ) { @@ -665,7 +654,7 @@ void SAL_CALL Player::stop() gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); mbPlayPending = false; - DBG( "stop %p", mpPlaybin ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "stop " << mpPlaybin ); } @@ -683,7 +672,7 @@ sal_Bool SAL_CALL Player::isPlaying() bRet = GST_STATE_PLAYING == GST_STATE( mpPlaybin ); } - DBG( "isPlaying %d", bRet ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "isPlaying " << bRet ); return bRet; } @@ -723,7 +712,7 @@ void SAL_CALL Player::setMediaTime( double fTime ) if( !isPlaying() ) gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); - DBG( "seek to: %" SAL_PRIdINT64 " ns original: %lf s", gst_position, fTime ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "seek to: " << gst_position << " ns original: " << fTime << " s" ); } } @@ -771,7 +760,7 @@ void SAL_CALL Player::setMute( sal_Bool bSet ) { ::osl::MutexGuard aGuard(m_aMutex); - DBG( "set mute: %d muted: %d unmuted volume: %lf", bSet, mbMuted, mnUnmutedVolume ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "set mute: " << bSet << " muted: " << mbMuted << " unmuted volume: " << mnUnmutedVolume ); // change the volume to 0 or the unmuted volume if( mpPlaybin && mbMuted != bool(bSet) ) @@ -807,7 +796,7 @@ void SAL_CALL Player::setVolumeDB( sal_Int16 nVolumeDB ) mnUnmutedVolume = pow( 10.0, nVolumeDB / 20.0 ); - DBG( "set volume: %d gst volume: %lf", nVolumeDB, mnUnmutedVolume ); + SAL_INFO( "avmedia.gstreamer", AVVERSION "set volume: " << nVolumeDB << " gst volume: " << mnUnmutedVolume ); // change volume if( !mbMuted && mpPlaybin ) @@ -847,18 +836,15 @@ awt::Size SAL_CALL Player::getPreferredPlayerWindowSize() if( maURL.isEmpty() ) { - DBG( "%p Player::getPreferredPlayerWindowSize - empty URL => 0x0", this ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::getPreferredPlayerWindowSize - empty URL => 0x0" ); return aSize; } - DBG( "%p pre-Player::getPreferredPlayerWindowSize, member %d x %d", this, mnWidth, mnHeight ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " pre-Player::getPreferredPlayerWindowSize, member " << mnWidth << "x" << mnHeight ); -#if OSL_DEBUG_LEVEL > 2 - osl::Condition::Result aResult = -#endif - maSizeCondition.wait( std::chrono::seconds(10) ); + osl::Condition::Result aResult = maSizeCondition.wait( std::chrono::seconds(10) ); - DBG( "%p Player::getPreferredPlayerWindowSize after waitCondition %d, member %d x %d", this, aResult, mnWidth, mnHeight ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << this << " Player::getPreferredPlayerWindowSize after waitCondition " << aResult << ", member " << mnWidth << "x" << mnHeight ); if( mnWidth != 0 && mnHeight != 0 ) { aSize.Width = mnWidth; @@ -881,7 +867,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co if( mbFakeVideo ) preparePlaybin( maURL, nullptr ); - DBG( "Player::createPlayerWindow %d %d length: %d", aSize.Width, aSize.Height, rArguments.getLength() ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << "Player::createPlayerWindow " << aSize.Width << "x" << aSize.Height << " length: " << rArguments.getLength() ); if( aSize.Width > 0 && aSize.Height > 0 ) { @@ -899,7 +885,7 @@ uno::Reference< ::media::XPlayerWindow > SAL_CALL Player::createPlayerWindow( co if (pEnvData) { mnWindowID = pEnvData->aWindow; - DBG( "set window id to %d XOverlay %p\n", (int)mnWindowID, mpXOverlay); + SAL_INFO( "avmedia.gstreamer", AVVERSION << "set window id to " << (int)mnWindowID << " XOverlay " << mpXOverlay); gst_element_set_state( mpPlaybin, GST_STATE_PAUSED ); if ( mpXOverlay != nullptr ) gst_video_overlay_set_window_handle( mpXOverlay, mnWindowID ); @@ -921,7 +907,7 @@ uno::Reference< media::XFrameGrabber > SAL_CALL Player::createFrameGrabber() if( ( aPrefSize.Width > 0 ) && ( aPrefSize.Height > 0 ) ) pFrameGrabber = FrameGrabber::create( maURL ); - DBG( "created FrameGrabber %p", pFrameGrabber ); + SAL_INFO( "avmedia.gstreamer", AVVERSION << "created FrameGrabber " << pFrameGrabber ); return pFrameGrabber; } |