From 816dc6e910888f63ad8990dc010ebf6da6e5aa21 Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Mon, 23 Dec 2024 17:42:30 +0100 Subject: [PATCH] MT#61630 media_player_init* renaming Rename the following functions into something more relevant so that it doesn't correlate with the general init function `media_player_init()` which isn't call specific. - `media_player_init_file()` > `media_player_add_file()` - `media_player_init_blob()` > `media_player_add_blob()` - `media_player_init_db()` > `media_player_add_db()` Change-Id: I8efd877bfd4c7c300aec7efe6fbbb654f52de460 --- daemon/call.c | 8 ++++---- daemon/media_player.c | 26 +++++++++++++------------- include/media_player.h | 6 +++--- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 11adbedb5..4ffc914a5 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -2761,13 +2761,13 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c .db_id = flags->db_id, ); if (flags->file.len) - ret = media_player_init_file(ml->rec_player, &flags->file, opts); + ret = media_player_add_file(ml->rec_player, &flags->file, opts); else if (flags->blob.len) - ret = media_player_init_blob(ml->rec_player, &flags->blob, opts); + ret = media_player_add_blob(ml->rec_player, &flags->blob, opts); else if (flags->db_id > 0) - ret = media_player_init_db(ml->rec_player, flags->db_id, opts); + ret = media_player_add_db(ml->rec_player, flags->db_id, opts); if (!ret) - ilog(LOG_WARN, "Failed to initialise media player for recording announcement"); + ilog(LOG_WARN, "Failed to add media player for recording announcement"); } #endif } diff --git a/daemon/media_player.c b/daemon/media_player.c index 7e93811e7..f653058c9 100644 --- a/daemon/media_player.c +++ b/daemon/media_player.c @@ -1113,7 +1113,7 @@ static bool media_player_play_start(struct media_player *mp, const rtp_payload_t // call->master_lock held in W -static mp_cached_code __media_player_init_file(struct media_player *mp, const str *file, +static mp_cached_code __media_player_add_file(struct media_player *mp, const str *file, media_player_opts_t opts, const rtp_payload_type *dst_pt) { @@ -1148,7 +1148,7 @@ bool media_player_play_file(struct media_player *mp, const str *file, media_play if (!dst_pt) return false; - mp_cached_code ret = __media_player_init_file(mp, file, opts, dst_pt); + mp_cached_code ret = __media_player_add_file(mp, file, opts, dst_pt); if (ret == MPC_CACHED) return true; if (ret == MPC_ERR) @@ -1161,8 +1161,8 @@ bool media_player_play_file(struct media_player *mp, const str *file, media_play } // call->master_lock held in W -bool media_player_init_file(struct media_player *mp, const str *file, media_player_opts_t opts) { - int ret = __media_player_init_file(mp, file, opts, NULL); +bool media_player_add_file(struct media_player *mp, const str *file, media_player_opts_t opts) { + int ret = __media_player_add_file(mp, file, opts, NULL); return ret == 0; } @@ -1247,7 +1247,7 @@ static int64_t __mp_avio_seek(void *opaque, int64_t offset, int whence) { // call->master_lock held in W -static mp_cached_code __media_player_init_blob_id(struct media_player *mp, const str *blob, +static mp_cached_code __media_player_add_blob_id(struct media_player *mp, const str *blob, media_player_opts_t opts, long long db_id, const rtp_payload_type *dst_pt) { @@ -1317,7 +1317,7 @@ bool media_player_play_blob(struct media_player *mp, const str *blob, media_play if (!dst_pt) return false; - mp_cached_code ret = __media_player_init_blob_id(mp, blob, opts, -1, dst_pt); + mp_cached_code ret = __media_player_add_blob_id(mp, blob, opts, -1, dst_pt); if (ret == MPC_CACHED) return true; if (ret == MPC_ERR) @@ -1327,8 +1327,8 @@ bool media_player_play_blob(struct media_player *mp, const str *blob, media_play } // call->master_lock held in W -bool media_player_init_blob(struct media_player *mp, const str *blob, media_player_opts_t opts) { - int ret = __media_player_init_blob_id(mp, blob, opts, -1, NULL); +bool media_player_add_blob(struct media_player *mp, const str *blob, media_player_opts_t opts) { + int ret = __media_player_add_blob_id(mp, blob, opts, -1, NULL); return ret == 0; } @@ -1356,7 +1356,7 @@ err: // call->master_lock held in W -static mp_cached_code __media_player_init_db(struct media_player *mp, long long id, media_player_opts_t opts, +static mp_cached_code __media_player_add_db(struct media_player *mp, long long id, media_player_opts_t opts, const rtp_payload_type *dst_pt) { const char *err; @@ -1404,7 +1404,7 @@ success:; } str blob = STR_LEN(row[0], lengths[0]); - mp_cached_code ret = __media_player_init_blob_id(mp, &blob, opts, id, dst_pt); + mp_cached_code ret = __media_player_add_blob_id(mp, &blob, opts, id, dst_pt); mysql_free_result(res); @@ -1424,7 +1424,7 @@ bool media_player_play_db(struct media_player *mp, long long id, media_player_op if (!dst_pt) return false; - mp_cached_code ret = __media_player_init_db(mp, id, opts, dst_pt); + mp_cached_code ret = __media_player_add_db(mp, id, opts, dst_pt); if (ret == MPC_CACHED) return true; if (ret == MPC_ERR) @@ -1434,8 +1434,8 @@ bool media_player_play_db(struct media_player *mp, long long id, media_player_op } // call->master_lock held in W -bool media_player_init_db(struct media_player *mp, long long id, media_player_opts_t opts) { - int ret = __media_player_init_db(mp, id, opts, NULL); +bool media_player_add_db(struct media_player *mp, long long id, media_player_opts_t opts) { + int ret = __media_player_add_db(mp, id, opts, NULL); return ret == 0; } diff --git a/include/media_player.h b/include/media_player.h index 8e7b80783..c4dc65219 100644 --- a/include/media_player.h +++ b/include/media_player.h @@ -121,9 +121,9 @@ void media_player_new(struct media_player **, struct call_monologue *); bool media_player_play_file(struct media_player *, const str *, media_player_opts_t); bool media_player_play_blob(struct media_player *, const str *, media_player_opts_t); bool media_player_play_db(struct media_player *, long long, media_player_opts_t); -bool media_player_init_file(struct media_player *, const str *, media_player_opts_t); -bool media_player_init_blob(struct media_player *, const str *, media_player_opts_t); -bool media_player_init_db(struct media_player *, long long, media_player_opts_t); +bool media_player_add_file(struct media_player *, const str *, media_player_opts_t); +bool media_player_add_blob(struct media_player *, const str *, media_player_opts_t); +bool media_player_add_db(struct media_player *, long long, media_player_opts_t); bool media_player_start(struct media_player *); long long media_player_stop(struct media_player *); bool media_player_is_active(struct call_monologue *);