Send audio player error message as an argument to onStop(), as discussed with fgerlits.
Refert to #2165
This commit is contained in:
parent
3db4168db1
commit
f458399000
2 changed files with 18 additions and 6 deletions
|
@ -143,14 +143,14 @@ GstreamerPlayer :: errorHandler(GstElement * pipeline,
|
||||||
gpointer self)
|
gpointer self)
|
||||||
throw ()
|
throw ()
|
||||||
{
|
{
|
||||||
|
GstreamerPlayer* const player = (GstreamerPlayer*) self;
|
||||||
|
player->m_errorMessage = error->message;
|
||||||
|
|
||||||
|
std::cerr << "gstreamer error: " << error->message << std::endl;
|
||||||
|
|
||||||
// Important: We *must* use an idle function call here, so that the signal handler returns
|
// Important: We *must* use an idle function call here, so that the signal handler returns
|
||||||
// before fireOnStopEvent() is executed.
|
// before fireOnStopEvent() is executed.
|
||||||
g_idle_add(fireOnStopEvent, self);
|
g_idle_add(fireOnStopEvent, self);
|
||||||
|
|
||||||
std::string str( "Audio Player Error: ");
|
|
||||||
str += error->message;
|
|
||||||
|
|
||||||
throw std::runtime_error(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,11 +223,16 @@ GstreamerPlayer :: fireOnStopEvent(gpointer self) throw (
|
||||||
|
|
||||||
GstreamerPlayer* const player = (GstreamerPlayer*) self;
|
GstreamerPlayer* const player = (GstreamerPlayer*) self;
|
||||||
|
|
||||||
|
Ptr<const std::string>::Ref msg;
|
||||||
|
if (!player->m_errorMessage.empty()) {
|
||||||
|
msg.reset(new const std::string(player->m_errorMessage));
|
||||||
|
}
|
||||||
|
|
||||||
ListenerVector::iterator it = player->m_listeners.begin();
|
ListenerVector::iterator it = player->m_listeners.begin();
|
||||||
ListenerVector::iterator end = player->m_listeners.end();
|
ListenerVector::iterator end = player->m_listeners.end();
|
||||||
|
|
||||||
while (it != end) {
|
while (it != end) {
|
||||||
(*it)->onStop();
|
(*it)->onStop(msg);
|
||||||
++it;
|
++it;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,6 +330,8 @@ GstreamerPlayer :: open(const std::string fileUrl)
|
||||||
debug() << "Opening URL: " << fileUrl << endl;
|
debug() << "Opening URL: " << fileUrl << endl;
|
||||||
debug() << "Timestamp: " << *TimeConversion::now() << endl;
|
debug() << "Timestamp: " << *TimeConversion::now() << endl;
|
||||||
|
|
||||||
|
m_errorMessage.clear();
|
||||||
|
|
||||||
std::string filePath;
|
std::string filePath;
|
||||||
|
|
||||||
if (fileUrl.find("file://") == 0) {
|
if (fileUrl.find("file://") == 0) {
|
||||||
|
|
|
@ -150,6 +150,11 @@ class GstreamerPlayer : virtual public Configurable,
|
||||||
*/
|
*/
|
||||||
std::string m_audioDevice;
|
std::string m_audioDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains runtime error messages from GStreamer.
|
||||||
|
*/
|
||||||
|
std::string m_errorMessage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The URL of the preloaded file. Empty if nothing is preloaded.
|
* The URL of the preloaded file. Empty if nothing is preloaded.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue