diff --git a/src/musikcore/c_interface_wrappers.cpp b/src/musikcore/c_interface_wrappers.cpp index ff0100cb2..caee7007f 100644 --- a/src/musikcore/c_interface_wrappers.cpp +++ b/src/musikcore/c_interface_wrappers.cpp @@ -1035,11 +1035,11 @@ class mcsdk_audio_player_callback_proxy: public Player::EventListener { } } } - virtual void OnPlayerAlmostEnded(Player *player) { + virtual void OnPlayerStreamEof(Player *player) { std::unique_lock lock(this->context->event_mutex); for (auto c : callbacks) { - if (c->on_almost_ended) { - c->on_almost_ended(mcsdk_audio_player { context }); + if (c->on_stream_eof) { + c->on_stream_eof(mcsdk_audio_player { context }); } } } @@ -1055,18 +1055,18 @@ class mcsdk_audio_player_callback_proxy: public Player::EventListener { std::unique_lock lock(this->context->event_mutex); for (auto c : callbacks) { if (c->on_error) { - c->on_error(mcsdk_audio_player { context }); + c->on_error(mcsdk_audio_player { context }, mcsdk_playback_error_open_failed); } } } virtual void OnPlayerDestroying(Player *player) { std::unique_lock lock(this->context->event_mutex); + this->context->player_finished = true; for (auto c : callbacks) { if (c->on_destroying) { c->on_destroying(mcsdk_audio_player { context }); } } - this->context->player_finished = true; this->context->finished_condition.notify_all(); } virtual void OnPlayerMixPoint(Player *player, int id, double time) { diff --git a/src/musikcore/musikcore_c.h b/src/musikcore/musikcore_c.h index 82e4696c7..37f9e0ed8 100644 --- a/src/musikcore/musikcore_c.h +++ b/src/musikcore/musikcore_c.h @@ -90,6 +90,11 @@ typedef enum mcsdk_audio_output_code { mcsdk_audio_output_error_buffer_written = -1 } mcsdk_audio_output_code; +typedef enum mcsdk_playback_error_code { + mcsdk_playback_error_unknown = -1, + mcsdk_playback_error_open_failed = 0, +} mcsdk_playback_error_code; + typedef enum mcsdk_time_change_mode { mcsdk_time_change_mode_seek = 0, mcsdk_time_change_mode_scrub = 1 @@ -261,9 +266,9 @@ mcsdk_define_handle(mcsdk_db_transaction); typedef struct mcsdk_audio_player_callbacks { void (*on_prepared)(mcsdk_audio_player p); void (*on_started)(mcsdk_audio_player p); - void (*on_almost_ended)(mcsdk_audio_player p); + void (*on_stream_eof)(mcsdk_audio_player p); void (*on_finished)(mcsdk_audio_player p); - void (*on_error)(mcsdk_audio_player p); + void (*on_error)(mcsdk_audio_player p, mcsdk_playback_error_code ec); void (*on_destroying)(mcsdk_audio_player p); void (*on_mixpoint)(mcsdk_audio_player p, int id, double time); } mcsdk_audio_player_callbacks;