Lines Matching full:group

48 /* There is one parent group, which is the parent of a number of groups. */
51 /* The first track of the first group has track segments, other tracks not. */
215 .title = "Group 2",
223 .title = "Group 3",
231 .title = "Group 4",
239 .title = "Parent group",
249 .group = &group_1,
306 /* Pointer to group being added */
406 /* Set up content buffer for the parent group object */
407 static uint32_t setup_parent_group_object(struct mpl_group *group) in setup_parent_group_object() argument
411 /* The implementation has a fixed structure, with one parent group, */ in setup_parent_group_object()
415 /* the parent group to a group of tracks. */ in setup_parent_group_object()
423 if (group) { in setup_parent_group_object()
424 while (group->prev) { in setup_parent_group_object()
425 group = group->prev; in setup_parent_group_object()
427 /* While there is a group, and the record fits in the object */ in setup_parent_group_object()
428 while (group && (next_size <= obj.content->size)) { in setup_parent_group_object()
430 net_buf_simple_add_le48(obj.content, group->id); in setup_parent_group_object()
431 group = group->next; in setup_parent_group_object()
435 LOG_WRN("Not room for full group in object"); in setup_parent_group_object()
437 LOG_HEXDUMP_DBG(obj.content->data, obj.content->len, "Parent Group Object"); in setup_parent_group_object()
438 LOG_DBG("Group object length: %d", obj.content->len); in setup_parent_group_object()
443 /* Set up contents for a group object */
444 /* The group object contains a concatenated list of records, where each */
446 static uint32_t setup_group_object(struct mpl_group *group) in setup_group_object() argument
448 struct mpl_track *track = group->track; in setup_group_object()
467 LOG_WRN("Not room for full group in object"); in setup_group_object()
469 LOG_HEXDUMP_DBG(obj.content->data, obj.content->len, "Group Object"); in setup_group_object()
470 LOG_DBG("Group object length: %d", obj.content->len); in setup_group_object()
516 obj.desc->size.alloc = obj.desc->size.cur = setup_segments_object(pl->group->track); in add_current_track_segments_object()
517 obj.desc->name = pl->group->track->title; in add_current_track_segments_object()
569 /* Add the parent group to the OTS */
580 obj.desc->size.alloc = obj.desc->size.cur = setup_parent_group_object(pl->group); in add_parent_group_object()
581 obj.desc->name = pl->group->parent->title; in add_parent_group_object()
590 LOG_WRN("Unable to add parent group object"); in add_parent_group_object()
598 /* Add a single group to the OTS */
599 static int add_group_object(struct mpl_group *group) in add_group_object() argument
606 if (!group) { in add_group_object()
607 LOG_ERR("No group"); in add_group_object()
612 obj.add_group = group; in add_group_object()
615 obj.desc->size.alloc = obj.desc->size.cur = setup_group_object(group); in add_group_object()
616 obj.desc->name = group->title; in add_group_object()
625 LOG_WRN("Unable to add group object: %d", ret); in add_group_object()
633 /* Add all tracks of a group to the OTS */
634 static int add_group_tracks(struct mpl_group *group) in add_group_tracks() argument
637 struct mpl_track *track = group->track; in add_group_tracks()
656 /* Add all groups (except the parent group) and their tracks to the OTS */
661 struct mpl_group *group = pl->group; in add_group_and_track_objects() local
663 if (group) { in add_group_and_track_objects()
664 while (group->prev) { in add_group_and_track_objects()
665 group = group->prev; in add_group_and_track_objects()
668 while (group) { in add_group_and_track_objects()
669 ret = add_group_tracks(group); in add_group_and_track_objects()
674 ret = add_group_object(group); in add_group_and_track_objects()
678 group = group->next; in add_group_and_track_objects()
715 } else if (id == media_player.group->track->segments_id) { in on_obj_selected()
717 (void)setup_segments_object(media_player.group->track); in on_obj_selected()
718 } else if (id == media_player.group->track->id) { in on_obj_selected()
720 (void)setup_track_object(media_player.group->track); in on_obj_selected()
725 } else if (id == media_player.group->track->next->id) { in on_obj_selected()
728 (void)setup_track_object(media_player.group->track->next); in on_obj_selected()
729 } else if (id == media_player.group->parent->id) { in on_obj_selected()
730 LOG_DBG("Parent Group Object ID"); in on_obj_selected()
731 (void)setup_parent_group_object(media_player.group); in on_obj_selected()
732 } else if (id == media_player.group->id) { in on_obj_selected()
733 LOG_DBG("Current Group Object ID"); in on_obj_selected()
734 (void)setup_group_object(media_player.group); in on_obj_selected()
769 media_player.group->track->segments_id = id; in on_obj_created()
787 LOG_DBG("Group Obj Type"); in on_obj_created()
789 LOG_DBG("Parent group"); in on_obj_created()
791 media_player.group->parent->id = id; in on_obj_created()
793 LOG_DBG("Other group"); in on_obj_created()
871 LOG_DBG("Segment name before: %s", pl->group->track->segment->name); in do_prev_segment()
873 if (pl->group->track->segment->prev != NULL) { in do_prev_segment()
874 pl->group->track->segment = pl->group->track->segment->prev; in do_prev_segment()
877 LOG_DBG("Segment name after: %s", pl->group->track->segment->name); in do_prev_segment()
882 LOG_DBG("Segment name before: %s", pl->group->track->segment->name); in do_next_segment()
884 if (pl->group->track->segment->next != NULL) { in do_next_segment()
885 pl->group->track->segment = pl->group->track->segment->next; in do_next_segment()
888 LOG_DBG("Segment name after: %s", pl->group->track->segment->name); in do_next_segment()
893 LOG_DBG("Segment name before: %s", pl->group->track->segment->name); in do_first_segment()
895 while (pl->group->track->segment->prev != NULL) { in do_first_segment()
896 pl->group->track->segment = pl->group->track->segment->prev; in do_first_segment()
899 LOG_DBG("Segment name after: %s", pl->group->track->segment->name); in do_first_segment()
904 LOG_DBG("Segment name before: %s", pl->group->track->segment->name); in do_last_segment()
906 while (pl->group->track->segment->next != NULL) { in do_last_segment()
907 pl->group->track->segment = pl->group->track->segment->next; in do_last_segment()
910 LOG_DBG("Segment name after: %s", pl->group->track->segment->name); in do_last_segment()
917 LOG_DBG("Segment name before: %s", pl->group->track->segment->name); in do_goto_segment()
921 while (pl->group->track->segment->prev != NULL) { in do_goto_segment()
922 pl->group->track->segment = in do_goto_segment()
923 pl->group->track->segment->prev; in do_goto_segment()
928 if (pl->group->track->segment->next != NULL) { in do_goto_segment()
929 pl->group->track->segment = in do_goto_segment()
930 pl->group->track->segment->next; in do_goto_segment()
935 while (pl->group->track->segment->next != NULL) { in do_goto_segment()
936 pl->group->track->segment = in do_goto_segment()
937 pl->group->track->segment->next; in do_goto_segment()
942 if (pl->group->track->segment->prev != NULL) { in do_goto_segment()
943 pl->group->track->segment = in do_goto_segment()
944 pl->group->track->segment->prev; in do_goto_segment()
949 LOG_DBG("Segment name after: %s", pl->group->track->segment->name); in do_goto_segment()
951 set_track_position(pl->group->track->segment->pos); in do_goto_segment()
957 LOG_DBG_OBJ_ID("Track ID before: ", pl->group->track->id); in do_prev_track()
960 if (pl->group->track->prev != NULL) { in do_prev_track()
961 pl->group->track = pl->group->track->prev; in do_prev_track()
972 LOG_DBG_OBJ_ID("Track ID after: ", pl->group->track->id); in do_prev_track()
980 LOG_DBG_OBJ_ID("Track ID before: ", pl->group->track->id); in do_next_track_normal_order()
983 if (pl->group->track->next != NULL) { in do_next_track_normal_order()
984 pl->group->track = pl->group->track->next; in do_next_track_normal_order()
990 LOG_DBG_OBJ_ID("Track ID after: ", pl->group->track->id); in do_next_track_normal_order()
996 * ALWAYS changes the track, changes the group if required
1003 if (pl->next.group != pl->group) { in do_next_track_next_track_set()
1004 pl->group = pl->next.group; in do_next_track_next_track_set()
1008 pl->group->track = pl->next.track; in do_next_track_next_track_set()
1011 pl->next.group = NULL; in do_next_track_next_track_set()
1032 LOG_DBG_OBJ_ID("Track ID before: ", pl->group->track->id); in do_first_track()
1036 while (pl->group->track->prev != NULL) { in do_first_track()
1037 pl->group->track = pl->group->track->prev; in do_first_track()
1052 LOG_DBG_OBJ_ID("Track ID after: ", pl->group->track->id); in do_first_track()
1059 LOG_DBG_OBJ_ID("Track ID before: ", pl->group->track->id); in do_last_track()
1062 if (pl->group->track->next != NULL) { in do_last_track()
1063 pl->group->track = pl->group->track->next; in do_last_track()
1073 while (pl->group->track->next != NULL) { in do_last_track()
1074 pl->group->track = pl->group->track->next; in do_last_track()
1078 LOG_DBG_OBJ_ID("Track ID after: ", pl->group->track->id); in do_last_track()
1088 LOG_DBG_OBJ_ID("Track ID before: ", pl->group->track->id); in do_goto_track()
1093 while (pl->group->track->prev != NULL) { in do_goto_track()
1094 pl->group->track = pl->group->track->prev; in do_goto_track()
1100 if (pl->group->track->next != NULL) { in do_goto_track()
1101 pl->group->track = pl->group->track->next; in do_goto_track()
1107 while (pl->group->track->next != NULL) { in do_goto_track()
1108 pl->group->track = pl->group->track->next; in do_goto_track()
1114 if (pl->group->track->prev != NULL) { in do_goto_track()
1115 pl->group->track = pl->group->track->prev; in do_goto_track()
1122 LOG_DBG_OBJ_ID("Track ID after: ", pl->group->track->id); in do_goto_track()
1141 LOG_DBG_OBJ_ID("Group ID before: ", pl->group->id); in do_prev_group()
1144 if (pl->group->prev != NULL) { in do_prev_group()
1145 pl->group = pl->group->prev; in do_prev_group()
1150 LOG_DBG_OBJ_ID("Group ID after: ", pl->group->id); in do_prev_group()
1158 LOG_DBG_OBJ_ID("Group ID before: ", pl->group->id); in do_next_group()
1161 if (pl->group->next != NULL) { in do_next_group()
1162 pl->group = pl->group->next; in do_next_group()
1167 LOG_DBG_OBJ_ID("Group ID after: ", pl->group->id); in do_next_group()
1174 LOG_DBG_OBJ_ID("Group ID before: ", pl->group->id); in do_first_group()
1177 if (pl->group->prev != NULL) { in do_first_group()
1178 pl->group = pl->group->prev; in do_first_group()
1182 while (pl->group->prev != NULL) { in do_first_group()
1183 pl->group = pl->group->prev; in do_first_group()
1187 LOG_DBG_OBJ_ID("Group ID after: ", pl->group->id); in do_first_group()
1194 LOG_DBG_OBJ_ID("Group ID before: ", pl->group->id); in do_last_group()
1197 if (pl->group->next != NULL) { in do_last_group()
1198 pl->group = pl->group->next; in do_last_group()
1202 while (pl->group->next != NULL) { in do_last_group()
1203 pl->group = pl->group->next; in do_last_group()
1207 LOG_DBG_OBJ_ID("Group ID after: ", pl->group->id); in do_last_group()
1217 LOG_DBG_OBJ_ID("Group ID before: ", pl->group->id); in do_goto_group()
1221 /* Goto first group */ in do_goto_group()
1222 while (pl->group->prev != NULL) { in do_goto_group()
1223 pl->group = pl->group->prev; in do_goto_group()
1229 if (pl->group->next != NULL) { in do_goto_group()
1230 pl->group = pl->group->next; in do_goto_group()
1235 /* Goto last group */ in do_goto_group()
1236 while (pl->group->next != NULL) { in do_goto_group()
1237 pl->group = pl->group->next; in do_goto_group()
1243 if (pl->group->prev != NULL) { in do_goto_group()
1244 pl->group = pl->group->prev; in do_goto_group()
1251 LOG_DBG_OBJ_ID("Group ID after: ", pl->group->id); in do_goto_group()
1254 /* The group has changed if we have moved more in one direction */ in do_goto_group()
1264 media_proxy_pl_track_title_cb(pl->group->track->title); in do_track_change_notifications()
1265 media_proxy_pl_track_duration_cb(pl->group->track->duration); in do_track_change_notifications()
1268 media_proxy_pl_current_track_id_cb(pl->group->track->id); in do_track_change_notifications()
1269 if (pl->group->track->next) { in do_track_change_notifications()
1270 media_proxy_pl_next_track_id_cb(pl->group->track->next->id); in do_track_change_notifications()
1281 media_proxy_pl_current_group_id_cb(pl->group->id); in do_group_change_notifications()
1287 /* Change the group (if not already on first group) */ in do_full_prev_group()
1290 /* Whether there is a group change or not, we always go to the first track */ in do_full_prev_group()
1296 /* Change the group (if not already on last group) */ in do_full_next_group()
1299 /* Whether there is a group change or not, we always go to the first track */ in do_full_next_group()
1305 /* Change the group (if not already on first group) */ in do_full_first_group()
1308 /* Whether there is a group change or not, we always go to the first track */ in do_full_first_group()
1314 /* Change the group (if not already on last group) */ in do_full_last_group()
1317 /* Whether there is a group change or not, we always go to the first track */ in do_full_last_group()
1323 /* Change the group (if not already on given group) */ in do_full_goto_group()
1326 /* Whether there is a group change or not, we always go to the first track */ in do_full_goto_group()
1381 * with the "next" order hardcoded into the group and track structure in inactive_state_command_handler()
1485 media_player.group->track->segment->pos) { in playing_state_command_handler()
1488 set_track_position(media_player.group->track->segment->pos); in playing_state_command_handler()
1492 set_track_position(media_player.group->track->segment->pos); in playing_state_command_handler()
1496 set_track_position(media_player.group->track->segment->pos); in playing_state_command_handler()
1500 set_track_position(media_player.group->track->segment->pos); in playing_state_command_handler()
1608 if (media_player.group->track->segment != NULL) { in paused_state_command_handler()
1610 media_player.group->track->segment->pos) { in paused_state_command_handler()
1614 set_track_position(media_player.group->track->segment->pos); in paused_state_command_handler()
1621 if (media_player.group->track->segment != NULL) { in paused_state_command_handler()
1623 set_track_position(media_player.group->track->segment->pos); in paused_state_command_handler()
1630 if (media_player.group->track->segment != NULL) { in paused_state_command_handler()
1632 set_track_position(media_player.group->track->segment->pos); in paused_state_command_handler()
1639 if (media_player.group->track->segment != NULL) { in paused_state_command_handler()
1641 set_track_position(media_player.group->track->segment->pos); in paused_state_command_handler()
1648 if (command->use_param && media_player.group->track->segment != NULL) { in paused_state_command_handler()
1773 media_player.group->track->segment->pos) { in seeking_state_command_handler()
1776 set_track_position(media_player.group->track->segment->pos); in seeking_state_command_handler()
1780 set_track_position(media_player.group->track->segment->pos); in seeking_state_command_handler()
1784 set_track_position(media_player.group->track->segment->pos); in seeking_state_command_handler()
1788 set_track_position(media_player.group->track->segment->pos); in seeking_state_command_handler()
1876 * If found, return pointers to the group of the track and the track,
1882 struct mpl_group **group, struct mpl_track **track) in find_track_by_id() argument
1884 struct mpl_group *tmp_group = pl->group; in find_track_by_id()
1901 *group = tmp_group; in find_track_by_id()
1913 *group = NULL; in find_track_by_id()
1918 /* Find a group by ID
1920 * If found, return pointer to the group, otherwise, the pointer returned is NULL
1925 struct mpl_group **group) in find_group_by_id() argument
1927 struct mpl_group *tmp_group = pl->group; in find_group_by_id()
1935 /* Found the group */ in find_group_by_id()
1936 *group = tmp_group; in find_group_by_id()
1943 /* Group not found */ in find_group_by_id()
1944 *group = NULL; in find_group_by_id()
1968 return media_player.group->track->title; in get_track_title()
1973 return media_player.group->track->duration; in get_track_duration()
1987 if (position > media_player.group->track->duration) { in set_track_position()
1989 new_pos = media_player.group->track->duration; in set_track_position()
1996 if (position < -media_player.group->track->duration) { in set_track_position()
2000 new_pos = media_player.group->track->duration + position; in set_track_position()
2005 media_player.group->track->duration); in set_track_position()
2009 * changed. Since this might occur when media_player.group->track->duration is still 0, we in set_track_position()
2033 pos = CLAMP(pos, 0, media_player.group->track->duration); in set_relative_track_position()
2060 return media_player.group->track->segments_id; in get_track_segments_id()
2065 return media_player.group->track->id; in get_current_track_id()
2070 struct mpl_group *group; in set_current_track_id() local
2075 if (find_track_by_id(&media_player, id, &group, &track)) { in set_current_track_id()
2076 if (media_player.group != group) { in set_current_track_id()
2077 media_player.group = group; in set_current_track_id()
2080 /* Group change implies track change (even if same track in other group) */ in set_current_track_id()
2081 media_player.group->track = track; in set_current_track_id()
2084 } else if (media_player.group->track != track) { in set_current_track_id()
2085 media_player.group->track = track; in set_current_track_id()
2106 if (media_player.group->track->next) { in get_next_track_id()
2107 return media_player.group->track->next->id; in get_next_track_id()
2116 struct mpl_group *group; in set_next_track_id() local
2121 if (find_track_by_id(&media_player, id, &group, &track)) { in set_next_track_id()
2124 media_player.next.group = group; in set_next_track_id()
2135 return media_player.group->parent->id; in get_parent_group_id()
2140 return media_player.group->id; in get_current_group_id()
2145 struct mpl_group *group; in set_current_group_id() local
2147 LOG_DBG_OBJ_ID("Group ID to set: ", id); in set_current_group_id()
2149 if (find_group_by_id(&media_player, id, &group)) { in set_current_group_id()
2151 if (media_player.group != group) { in set_current_group_id()
2152 /* Change to found group */ in set_current_group_id()
2153 media_player.group = group; in set_current_group_id()
2156 /* And change to first track in group */ in set_current_group_id()
2162 LOG_DBG("Group not found"); in set_current_group_id()
2262 /* Use current group as search result for now */ in parse_search()
2263 media_player.search_results_id = media_player.group->id; in parse_search()
2303 if (media_player.track_pos == media_player.group->track->duration) { in pos_work_cb()
2449 struct mpl_group *group; in mpl_debug_dump_state() local
2471 (void)bt_ots_obj_id_to_str(media_player.group->parent->id, t, sizeof(t)); in mpl_debug_dump_state()
2472 LOG_DBG("Current group's parent: %s", t); in mpl_debug_dump_state()
2474 (void)bt_ots_obj_id_to_str(media_player.group->id, t, sizeof(t)); in mpl_debug_dump_state()
2475 LOG_DBG("Current group: %s", t); in mpl_debug_dump_state()
2477 (void)bt_ots_obj_id_to_str(media_player.group->track->id, t, sizeof(t)); in mpl_debug_dump_state()
2483 } else if (media_player.group->track->next) { in mpl_debug_dump_state()
2484 (void)bt_ots_obj_id_to_str(media_player.group->track->next->id, t, in mpl_debug_dump_state()
2499 group = media_player.group; in mpl_debug_dump_state()
2501 while (group->prev != NULL) { in mpl_debug_dump_state()
2502 group = group->prev; in mpl_debug_dump_state()
2505 while (group) { in mpl_debug_dump_state()
2506 (void)bt_ots_obj_id_to_str(group->id, t, sizeof(t)); in mpl_debug_dump_state()
2507 LOG_DBG("Group: %s, %s", t, group->title); in mpl_debug_dump_state()
2509 (void)bt_ots_obj_id_to_str(group->parent->id, t, sizeof(t)); in mpl_debug_dump_state()
2510 LOG_DBG("\tParent: %s, %s", t, group->parent->title); in mpl_debug_dump_state()
2512 track = group->track; in mpl_debug_dump_state()
2523 group = group->next; in mpl_debug_dump_state()
2535 LOG_DBG("Setting current group to be it's own parent"); in mpl_test_unset_parent_group()
2536 media_player.group->parent = media_player.group; in mpl_test_unset_parent_group()
2562 media_proxy_pl_track_title_cb(media_player.group->track->title); in mpl_test_title_changed_cb()
2567 media_proxy_pl_track_duration_cb(media_player.group->track->duration); in mpl_test_duration_changed_cb()
2588 media_proxy_pl_current_track_id_cb(media_player.group->track->id); in mpl_test_current_track_id_changed_cb()
2593 media_proxy_pl_next_track_id_cb(media_player.group->track->next->id); in mpl_test_next_track_id_changed_cb()
2598 media_proxy_pl_parent_group_id_cb(media_player.group->id); in mpl_test_parent_group_id_changed_cb()
2603 media_proxy_pl_current_group_id_cb(media_player.group->id); in mpl_test_current_group_id_changed_cb()