回调可以设置空指针

This commit is contained in:
xiongziliang 2020-04-27 09:18:46 +08:00
parent 7272f01ea9
commit aa9bd56c5a

View File

@ -178,7 +178,7 @@ API_EXPORT void API_CALL mk_player_seekto(mk_player ctx, float progress) {
} }
static void mk_player_set_on_event(mk_player ctx, on_mk_play_event cb, void *user_data, int type) { static void mk_player_set_on_event(mk_player ctx, on_mk_play_event cb, void *user_data, int type) {
assert(ctx && cb); assert(ctx);
MediaPlayerForC &obj = **((MediaPlayerForC::Ptr *)ctx); MediaPlayerForC &obj = **((MediaPlayerForC::Ptr *)ctx);
obj.setOnEvent(cb,user_data, type); obj.setOnEvent(cb,user_data, type);
} }
@ -192,7 +192,7 @@ API_EXPORT void API_CALL mk_player_set_on_shutdown(mk_player ctx, on_mk_play_eve
} }
API_EXPORT void API_CALL mk_player_set_on_data(mk_player ctx, on_mk_play_data cb, void *user_data) { API_EXPORT void API_CALL mk_player_set_on_data(mk_player ctx, on_mk_play_data cb, void *user_data) {
assert(ctx && cb); assert(ctx);
MediaPlayerForC &obj = **((MediaPlayerForC::Ptr *)ctx); MediaPlayerForC &obj = **((MediaPlayerForC::Ptr *)ctx);
obj.setOnData(cb,user_data); obj.setOnData(cb,user_data);
} }