fixed firing of onStop events, that was fires also at pause, and

prematurely (one coudln't call close() from the event handler)
fix for issue #1248, see http://bugs.campware.org/view.php?id=1248
This commit is contained in:
maroy 2005-07-12 06:09:55 +00:00
parent 567da89848
commit 5b751a1809
2 changed files with 4 additions and 38 deletions

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.5 $ Version : $Revision: 1.6 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayer.cxx,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayer.cxx,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -107,7 +107,6 @@ GstreamerPlayer :: initialize(void) throw (std::exception)
gst_object_sink(GST_OBJECT(pipeline)); gst_object_sink(GST_OBJECT(pipeline));
g_signal_connect(pipeline, "error", G_CALLBACK(errorHandler), this); g_signal_connect(pipeline, "error", G_CALLBACK(errorHandler), this);
g_signal_connect(pipeline, "state-change", G_CALLBACK(stateChange), this);
setAudioDevice(audioDevice); setAudioDevice(audioDevice);
@ -132,24 +131,6 @@ GstreamerPlayer :: errorHandler(GstElement * pipeline,
} }
/*------------------------------------------------------------------------------
* Event handler for when the state of the pipeline changes
*----------------------------------------------------------------------------*/
void
GstreamerPlayer :: stateChange(GstElement * element,
gint oldState,
gint newState,
gpointer self)
throw ()
{
GstreamerPlayer * player = (GstreamerPlayer*) self;
if (oldState == GST_STATE_PLAYING && newState != GST_STATE_PLAYING) {
player->fireOnStopEvent();
}
}
/*------------------------------------------------------------------------------ /*------------------------------------------------------------------------------
* De-initialize the Gstreamer Player * De-initialize the Gstreamer Player
*----------------------------------------------------------------------------*/ *----------------------------------------------------------------------------*/
@ -232,6 +213,7 @@ GstreamerPlayer :: eosEventHandler(GstElement * element,
GstreamerPlayer * player = (GstreamerPlayer*) self; GstreamerPlayer * player = (GstreamerPlayer*) self;
gst_element_set_eos(player->pipeline); gst_element_set_eos(player->pipeline);
player->fireOnStopEvent();
} }

View file

@ -22,7 +22,7 @@
Author : $Author: maroy $ Author : $Author: maroy $
Version : $Revision: 1.6 $ Version : $Revision: 1.7 $
Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayer.h,v $ Location : $Source: /home/paul/cvs2svn-livesupport/newcvsrepo/livesupport/modules/playlistExecutor/src/GstreamerPlayer.h,v $
------------------------------------------------------------------------------*/ ------------------------------------------------------------------------------*/
@ -86,7 +86,7 @@ using namespace LiveSupport::Core;
* </code></pre> * </code></pre>
* *
* @author $Author: maroy $ * @author $Author: maroy $
* @version $Revision: 1.6 $ * @version $Revision: 1.7 $
*/ */
class GstreamerPlayer : virtual public Configurable, class GstreamerPlayer : virtual public Configurable,
virtual public AudioPlayerInterface virtual public AudioPlayerInterface
@ -162,22 +162,6 @@ class GstreamerPlayer : virtual public Configurable,
gchar * debug, gchar * debug,
gpointer self) throw (); gpointer self) throw ();
/**
* Event handler for the state change event on the pipeline.
* Use this to catch events like playing has ended.
*
* @param element the pipeline the event change has occured at
* @param oldState the old state
* @param newState the new state
* @param self a pointer to the associated GstreamerPlayer object.
*/
static void
stateChange(GstElement * element,
gint oldState,
gint newState,
gpointer self)
throw ();
/** /**
* An end-of-stream event handler, that will notify our pipeline, * An end-of-stream event handler, that will notify our pipeline,
* that it's all over. * that it's all over.