From bf8b647856aea6b4c76aea27f1dcd2c12a2c7495 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 17 Sep 2021 13:50:45 -0700 Subject: [PATCH] media: Add media_player prefix for callback This adds media_player prefix to callback so it is inline with pause which now uses such callback due to possible clash with libc definition. Signed-off-by: Anuj Jain Signed-off-by: Ayush Garg --- profiles/audio/media.c | 84 ++++++++++++++++++++++++++------------------------ 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/profiles/audio/media.c b/profiles/audio/media.c index b71b8fc..14d701d 100644 --- a/profiles/audio/media.c +++ b/profiles/audio/media.c @@ -159,7 +159,7 @@ static void media_sink_state_changed_cb(struct btd_service *service, void media_stop_suspend_timer(void); struct media_player *media_adapter_get_player(struct media_adapter *adapter); static struct media_adapter *find_adapter(struct btd_device *device); -static uint32_t get_position(void *user_data); +static uint32_t media_player_get_position(void *user_data); #endif static void endpoint_request_free(struct endpoint_request *request) @@ -522,7 +522,7 @@ gboolean media_reset_mp_status(gpointer user_data) if (g_strcmp0(mp->status, "playing") != 0) return FALSE; - mp->position = get_position(mp); + mp->position = media_player_get_position(mp); g_timer_start(mp->timer); g_free(mp->status); @@ -1376,7 +1376,7 @@ static void media_player_remove(void *data) media_player_destroy(mp); } -static GList *list_settings(void *user_data) +static GList *media_player_list_settings(void *user_data) { struct media_player *mp = user_data; @@ -1388,7 +1388,7 @@ static GList *list_settings(void *user_data) return g_hash_table_get_keys(mp->settings); } -static const char *get_setting(const char *key, void *user_data) +static const char *media_player_get_setting(const char *key, void *user_data) { struct media_player *mp = user_data; @@ -1397,7 +1397,7 @@ static const char *get_setting(const char *key, void *user_data) return g_hash_table_lookup(mp->settings, key); } -static const char *get_player_name(void *user_data) +static const char *media_player_get_player_name(void *user_data) { struct media_player *mp = user_data; @@ -1451,7 +1451,8 @@ static void set_repeat_setting(DBusMessageIter *iter, const char *value) dbus_message_iter_close_container(iter, &var); } -static int set_setting(const char *key, const char *value, void *user_data) +static int media_player_set_setting(const char *key, const char *value, + void *user_data) { struct media_player *mp = user_data; const char *iface = MEDIA_PLAYER_INTERFACE; @@ -1488,7 +1489,7 @@ static int set_setting(const char *key, const char *value, void *user_data) return 0; } -static GList *list_metadata(void *user_data) +static GList *media_player_list_metadata(void *user_data) { struct media_player *mp = user_data; @@ -1500,7 +1501,7 @@ static GList *list_metadata(void *user_data) return g_hash_table_get_keys(mp->track); } -static uint64_t get_uid(void *user_data) +static uint64_t media_player_get_uid(void *user_data) { struct media_player *mp = user_data; @@ -1517,7 +1518,7 @@ static uint64_t get_uid(void *user_data) return 0; } -static const char *get_metadata(const char *key, void *user_data) +static const char *media_player_get_metadata(const char *key, void *user_data) { struct media_player *mp = user_data; @@ -1529,14 +1530,14 @@ static const char *get_metadata(const char *key, void *user_data) return g_hash_table_lookup(mp->track, key); } -static const char *get_status(void *user_data) +static const char *media_player_get_status(void *user_data) { struct media_player *mp = user_data; return mp->status; } -static uint32_t get_position(void *user_data) +static uint32_t media_player_get_position(void *user_data) { struct media_player *mp = user_data; double timedelta; @@ -1553,14 +1554,15 @@ static uint32_t get_position(void *user_data) return mp->position + sec * 1000 + msec; } -static uint32_t get_duration(void *user_data) +static uint32_t media_player_get_duration(void *user_data) { struct media_player *mp = user_data; return mp->duration; } -static void set_volume(int8_t volume, struct btd_device *dev, void *user_data) +static void media_player_set_volume(int8_t volume, struct btd_device *dev, + void *user_data) { struct media_player *mp = user_data; @@ -1593,7 +1595,7 @@ static bool media_player_send(struct media_player *mp, const char *name) return true; } -static bool play(void *user_data) +static bool media_player_play(void *user_data) { struct media_player *mp = user_data; @@ -1605,7 +1607,7 @@ static bool play(void *user_data) return media_player_send(mp, "Play"); } -static bool stop(void *user_data) +static bool media_player_stop(void *user_data) { struct media_player *mp = user_data; @@ -1629,7 +1631,7 @@ static bool media_player_pause(void *user_data) return media_player_send(mp, "Pause"); } -static bool next(void *user_data) +static bool media_player_next(void *user_data) { struct media_player *mp = user_data; @@ -1641,7 +1643,7 @@ static bool next(void *user_data) return media_player_send(mp, "Next"); } -static bool previous(void *user_data) +static bool media_player_previous(void *user_data) { struct media_player *mp = user_data; @@ -1654,25 +1656,25 @@ static bool previous(void *user_data) } static struct avrcp_player_cb player_cb = { - .list_settings = list_settings, - .get_setting = get_setting, - .set_setting = set_setting, - .list_metadata = list_metadata, - .get_uid = get_uid, - .get_metadata = get_metadata, - .get_position = get_position, - .get_duration = get_duration, - .get_status = get_status, - .get_name = get_player_name, - .set_volume = set_volume, + .list_settings = media_player_list_settings, + .get_setting = media_player_get_setting, + .set_setting = media_player_set_setting, + .list_metadata = media_player_list_metadata, + .get_uid = media_player_get_uid, + .get_metadata = media_player_get_metadata, + .get_position = media_player_get_position, + .get_duration = media_player_get_duration, + .get_status = media_player_get_status, + .get_name = media_player_get_player_name, + .set_volume = media_player_set_volume, #ifdef TIZEN_FEATURE_BLUEZ_MODIFY .get_volume = get_volume, #endif - .play = play, - .stop = stop, + .play = media_player_play, + .stop = media_player_stop, .pause = media_player_pause, - .next = next, - .previous = previous, + .next = media_player_next, + .previous = media_player_previous, }; static void media_player_exit(DBusConnection *connection, void *user_data) @@ -1699,7 +1701,7 @@ static gboolean set_status(struct media_player *mp, DBusMessageIter *iter) if (g_strcmp0(mp->status, value) == 0) return TRUE; - mp->position = get_position(mp); + mp->position = media_player_get_position(mp); g_timer_start(mp->timer); g_free(mp->status); @@ -1709,7 +1711,7 @@ static gboolean set_status(struct media_player *mp, DBusMessageIter *iter) #ifdef TIZEN_FEATURE_BLUEZ_MODIFY if (strcasecmp(mp->status, "reverse-seek") != 0 && strcasecmp(mp->status, "playing") != 0) { - playback_position = get_position(mp); + playback_position = media_player_get_position(mp); avrcp_player_event(mp->player, AVRCP_EVENT_PLAYBACK_POS_CHANGED, &playback_position); } @@ -1744,7 +1746,7 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter) #endif DBG("Value %d", value); #ifndef TIZEN_FEATURE_BLUEZ_MODIFY - if (value > get_position(mp)) + if (value > media_player_get_position(mp)) status = "forward-seek"; else status = "reverse-seek"; @@ -1759,7 +1761,7 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter) avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_REACHED_START, NULL); #ifdef TIZEN_FEATURE_BLUEZ_MODIFY - playback_position = get_position(mp); + playback_position = media_player_get_position(mp); avrcp_player_event(mp->player, AVRCP_EVENT_PLAYBACK_POS_CHANGED, &playback_position); #endif @@ -1775,7 +1777,7 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter) avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_REACHED_END, NULL); #ifdef TIZEN_FEATURE_BLUEZ_MODIFY - playback_position = get_position(mp); + playback_position = media_player_get_position(mp); avrcp_player_event(mp->player, AVRCP_EVENT_PLAYBACK_POS_CHANGED, &playback_position); #endif @@ -1787,7 +1789,7 @@ static gboolean set_position(struct media_player *mp, DBusMessageIter *iter) avrcp_player_event(mp->player, AVRCP_EVENT_STATUS_CHANGED, status); #endif #ifdef TIZEN_FEATURE_BLUEZ_MODIFY - playback_position = get_position(mp); + playback_position = media_player_get_position(mp); avrcp_player_event(mp->player, AVRCP_EVENT_PLAYBACK_POS_CHANGED, &playback_position); #endif @@ -1983,19 +1985,19 @@ static gboolean parse_player_metadata(struct media_player *mp, #ifdef TIZEN_FEATURE_BLUEZ_MODIFY if (send_track_changed_event) { - uid = get_uid(mp); + uid = media_player_get_uid(mp); avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_CHANGED, &uid); send_track_changed_event = FALSE; - playback_position = get_position(mp); + playback_position = media_player_get_position(mp); avrcp_player_event(mp->player, AVRCP_EVENT_PLAYBACK_POS_CHANGED, &playback_position); } #else mp->position = 0; g_timer_start(mp->timer); - uid = get_uid(mp); + uid = media_player_get_uid(mp); avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_CHANGED, &uid); avrcp_player_event(mp->player, AVRCP_EVENT_TRACK_REACHED_START, NULL); -- 2.7.4