mirror of
https://github.com/libretro/RetroArch.git
synced 2025-01-22 01:07:37 +00:00
Rename content_playlist_ to playlist_
This commit is contained in:
parent
c0e447a3af
commit
449c7483cd
@ -1942,8 +1942,8 @@ bool command_event(enum event_command cmd, void *data)
|
||||
case CMD_EVENT_HISTORY_DEINIT:
|
||||
if (g_defaults.history)
|
||||
{
|
||||
content_playlist_write_file(g_defaults.history);
|
||||
content_playlist_free(g_defaults.history);
|
||||
playlist_write_file(g_defaults.history);
|
||||
playlist_free(g_defaults.history);
|
||||
}
|
||||
g_defaults.history = NULL;
|
||||
break;
|
||||
@ -1954,7 +1954,7 @@ bool command_event(enum event_command cmd, void *data)
|
||||
RARCH_LOG("%s: [%s].\n",
|
||||
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
|
||||
settings->path.content_history);
|
||||
g_defaults.history = content_playlist_init(
|
||||
g_defaults.history = playlist_init(
|
||||
settings->path.content_history,
|
||||
settings->content_history_size);
|
||||
break;
|
||||
|
@ -776,7 +776,7 @@ void content_push_to_history_playlist(bool do_push,
|
||||
if (!do_push)
|
||||
return;
|
||||
|
||||
content_playlist_push(g_defaults.history,
|
||||
playlist_push(g_defaults.history,
|
||||
path,
|
||||
NULL,
|
||||
settings->path.libretro,
|
||||
|
@ -72,7 +72,7 @@ struct defaults
|
||||
} settings;
|
||||
|
||||
#ifndef IS_SALAMANDER
|
||||
content_playlist_t *history;
|
||||
playlist_t *history;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -566,13 +566,13 @@ static int action_ok_playlist_entry(const char *path,
|
||||
menu_content_ctx_playlist_info_t playlist_info;
|
||||
uint32_t core_name_hash, core_path_hash;
|
||||
size_t selection_ptr = 0;
|
||||
content_playlist_t *playlist = g_defaults.history;
|
||||
playlist_t *playlist = g_defaults.history;
|
||||
bool is_history = true;
|
||||
const char *entry_path = NULL;
|
||||
const char *entry_label = NULL;
|
||||
const char *core_path = NULL;
|
||||
const char *core_name = NULL;
|
||||
content_playlist_t *tmp_playlist = NULL;
|
||||
playlist_t *tmp_playlist = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
uint32_t hash_label = menu_hash_calculate(label);
|
||||
|
||||
@ -589,7 +589,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
if (!tmp_playlist)
|
||||
{
|
||||
tmp_playlist = content_playlist_init(
|
||||
tmp_playlist = playlist_init(
|
||||
menu->db_playlist_file, COLLECTION_SIZE);
|
||||
|
||||
if (!tmp_playlist)
|
||||
@ -610,7 +610,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
break;
|
||||
}
|
||||
|
||||
content_playlist_get_index(playlist, selection_ptr,
|
||||
playlist_get_index(playlist, selection_ptr,
|
||||
&entry_path, &entry_label, &core_path, &core_name, NULL, NULL);
|
||||
|
||||
#if 0
|
||||
@ -650,11 +650,11 @@ static int action_ok_playlist_entry(const char *path,
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &tmp_playlist);
|
||||
|
||||
content_playlist_get_index(tmp_playlist, selection_ptr,
|
||||
playlist_get_index(tmp_playlist, selection_ptr,
|
||||
&entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name);
|
||||
|
||||
strlcpy(new_display_name, core_info.inf->display_name, sizeof(new_display_name));
|
||||
content_playlist_update(tmp_playlist,
|
||||
playlist_update(tmp_playlist,
|
||||
selection_ptr,
|
||||
entry_path,
|
||||
entry_label,
|
||||
@ -662,7 +662,7 @@ static int action_ok_playlist_entry(const char *path,
|
||||
new_display_name,
|
||||
entry_crc32,
|
||||
db_name);
|
||||
content_playlist_write_file(tmp_playlist);
|
||||
playlist_write_file(tmp_playlist);
|
||||
}
|
||||
|
||||
playlist_info.data = playlist;
|
||||
@ -1092,7 +1092,7 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
const char *entry_label = NULL;
|
||||
const char *entry_crc32 = NULL;
|
||||
const char *db_name = NULL;
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
if (!menu_navigation_ctl(MENU_NAVIGATION_CTL_GET_SELECTION, &selection))
|
||||
return menu_cbs_exit();
|
||||
@ -1105,16 +1105,16 @@ static int action_ok_core_deferred_set(const char *path,
|
||||
|
||||
idx = rdb_entry_start_game_selection_ptr;
|
||||
|
||||
content_playlist_get_index(playlist, idx,
|
||||
playlist_get_index(playlist, idx,
|
||||
&entry_path, &entry_label, NULL, NULL, &entry_crc32, &db_name);
|
||||
|
||||
content_playlist_update(playlist, idx,
|
||||
playlist_update(playlist, idx,
|
||||
entry_path, entry_label,
|
||||
path , core_display_name,
|
||||
entry_crc32,
|
||||
db_name);
|
||||
|
||||
content_playlist_write_file(playlist);
|
||||
playlist_write_file(playlist);
|
||||
|
||||
menu_entries_pop_stack(&selection, 0, 1);
|
||||
menu_navigation_ctl(MENU_NAVIGATION_CTL_SET_SELECTION, &selection);
|
||||
|
@ -120,7 +120,7 @@ static bool menu_content_load(void)
|
||||
menu_driver_ctl(RARCH_MENU_CTL_SYSTEM_INFO_GET,
|
||||
&info);
|
||||
content_push_to_history_playlist(true, fullpath, info);
|
||||
content_playlist_write_file(g_defaults.history);
|
||||
playlist_write_file(g_defaults.history);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -145,18 +145,18 @@ static bool menu_content_load_from_playlist(void *data)
|
||||
const char *path = NULL;
|
||||
menu_content_ctx_playlist_info_t *info =
|
||||
(menu_content_ctx_playlist_info_t *)data;
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
if (!info)
|
||||
return false;
|
||||
|
||||
playlist = (content_playlist_t*)info->data;
|
||||
playlist = (playlist_t*)info->data;
|
||||
idx = info->idx;
|
||||
|
||||
if (!playlist)
|
||||
return false;
|
||||
|
||||
content_playlist_get_index(playlist,
|
||||
playlist_get_index(playlist,
|
||||
idx, &path, NULL, &core_path, NULL, NULL, NULL);
|
||||
|
||||
if (!string_is_empty(path))
|
||||
|
@ -1276,7 +1276,7 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
|
||||
}
|
||||
|
||||
static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
content_playlist_t *playlist, const char *path_playlist, bool is_history)
|
||||
playlist_t *playlist, const char *path_playlist, bool is_history)
|
||||
{
|
||||
unsigned i;
|
||||
size_t list_size = 0;
|
||||
@ -1284,7 +1284,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
if (!playlist)
|
||||
return -1;
|
||||
|
||||
list_size = content_playlist_size(playlist);
|
||||
list_size = playlist_size(playlist);
|
||||
|
||||
if (list_size == 0)
|
||||
{
|
||||
@ -1309,7 +1309,7 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info,
|
||||
|
||||
path = path_copy;
|
||||
|
||||
content_playlist_get_index(playlist, i,
|
||||
playlist_get_index(playlist, i,
|
||||
&path, &label, NULL, &core_name, &crc32, &db_name);
|
||||
strlcpy(fill_buf, core_name, sizeof(fill_buf));
|
||||
|
||||
@ -1512,7 +1512,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
char path_base[PATH_MAX_LENGTH] = {0};
|
||||
char query[PATH_MAX_LENGTH] = {0};
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
database_info_list_t *db_info = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -1534,7 +1534,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
fill_pathname_join(path_playlist, settings->directory.playlist, path_base,
|
||||
sizeof(path_playlist));
|
||||
|
||||
playlist = content_playlist_init(path_playlist, COLLECTION_SIZE);
|
||||
playlist = playlist_init(path_playlist, COLLECTION_SIZE);
|
||||
|
||||
if (playlist)
|
||||
strlcpy(menu->db_playlist_file, path_playlist,
|
||||
@ -1558,7 +1558,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
|
||||
if (playlist)
|
||||
{
|
||||
for (j = 0; j < content_playlist_size(playlist); j++)
|
||||
for (j = 0; j < playlist_size(playlist); j++)
|
||||
{
|
||||
const char *crc32 = NULL;
|
||||
char elem0[PATH_MAX_LENGTH] = {0};
|
||||
@ -1567,7 +1567,7 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
struct string_list *tmp_str_list = NULL;
|
||||
uint32_t hash_value = 0;
|
||||
|
||||
content_playlist_get_index(playlist, j,
|
||||
playlist_get_index(playlist, j,
|
||||
NULL, NULL, NULL, NULL,
|
||||
NULL, &crc32);
|
||||
|
||||
@ -1865,13 +1865,13 @@ static int menu_displaylist_parse_database_entry(menu_displaylist_info_t *info)
|
||||
menu_hash_to_str(MENU_LABEL_NO_PLAYLIST_ENTRIES_AVAILABLE),
|
||||
0, 0, 0);
|
||||
|
||||
content_playlist_free(playlist);
|
||||
playlist_free(playlist);
|
||||
database_info_list_free(db_info);
|
||||
|
||||
return 0;
|
||||
|
||||
error:
|
||||
content_playlist_free(playlist);
|
||||
playlist_free(playlist);
|
||||
|
||||
return -1;
|
||||
#else
|
||||
@ -2069,11 +2069,11 @@ loop:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int menu_displaylist_sort_playlist(const content_playlist_entry_t *a,
|
||||
const content_playlist_entry_t *b)
|
||||
static int menu_displaylist_sort_playlist(const playlist_entry_t *a,
|
||||
const playlist_entry_t *b)
|
||||
{
|
||||
const char *a_label = content_playlist_entry_get_label(a);
|
||||
const char *b_label = content_playlist_entry_get_label(b);
|
||||
const char *a_label = playlist_entry_get_label(a);
|
||||
const char *b_label = playlist_entry_get_label(b);
|
||||
|
||||
if (!a_label || !b_label)
|
||||
return 0;
|
||||
@ -2088,7 +2088,7 @@ static int menu_displaylist_parse_horizontal_list(
|
||||
menu_ctx_list_t list_horiz_info;
|
||||
char path_playlist[PATH_MAX_LENGTH], lpl_basename[PATH_MAX_LENGTH];
|
||||
bool is_historylist = false;
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
menu_handle_t *menu = NULL;
|
||||
struct item_file *item = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
@ -2132,7 +2132,7 @@ static int menu_displaylist_parse_horizontal_list(
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
|
||||
|
||||
content_playlist_qsort(playlist, menu_displaylist_sort_playlist);
|
||||
playlist_qsort(playlist, menu_displaylist_sort_playlist);
|
||||
|
||||
if (string_is_equal(lpl_basename, "content_history"))
|
||||
is_historylist = true;
|
||||
@ -2246,7 +2246,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
const char *core_name = NULL;
|
||||
const char *db_name = NULL;
|
||||
char *fullpath = NULL;
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
|
||||
if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu))
|
||||
@ -2263,7 +2263,7 @@ static int menu_displaylist_parse_horizontal_content_actions(
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
|
||||
|
||||
content_playlist_get_index(playlist, idx,
|
||||
playlist_get_index(playlist, idx,
|
||||
NULL, &label, &core_path, &core_name, NULL, &db_name);
|
||||
|
||||
if (!string_is_empty(db_name))
|
||||
@ -3735,7 +3735,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
else
|
||||
{
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_FREE, NULL);
|
||||
|
||||
@ -3756,7 +3756,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
|
||||
menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist);
|
||||
|
||||
content_playlist_qsort(playlist, menu_displaylist_sort_playlist);
|
||||
playlist_qsort(playlist, menu_displaylist_sort_playlist);
|
||||
|
||||
ret = menu_displaylist_parse_playlist(info,
|
||||
playlist, path_playlist, false);
|
||||
@ -3772,7 +3772,7 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data)
|
||||
case DISPLAYLIST_HISTORY:
|
||||
{
|
||||
char path_playlist[PATH_MAX_LENGTH];
|
||||
content_playlist_t *playlist = g_defaults.history;
|
||||
playlist_t *playlist = g_defaults.history;
|
||||
|
||||
if (!playlist)
|
||||
command_event(CMD_EVENT_HISTORY_INIT, NULL);
|
||||
|
@ -291,7 +291,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
static bool menu_driver_data_own = false;
|
||||
static bool menu_driver_pending_quit = false;
|
||||
static bool menu_driver_pending_shutdown = false;
|
||||
static content_playlist_t *menu_driver_playlist = NULL;
|
||||
static playlist_t *menu_driver_playlist = NULL;
|
||||
static struct video_shader *menu_driver_shader = NULL;
|
||||
static menu_handle_t *menu_driver_data = NULL;
|
||||
static const menu_ctx_driver_t *menu_driver_ctx = NULL;
|
||||
@ -357,7 +357,7 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
break;
|
||||
case RARCH_MENU_CTL_PLAYLIST_FREE:
|
||||
if (menu_driver_playlist)
|
||||
content_playlist_free(menu_driver_playlist);
|
||||
playlist_free(menu_driver_playlist);
|
||||
menu_driver_playlist = NULL;
|
||||
break;
|
||||
case RARCH_MENU_CTL_FIND_DRIVER:
|
||||
@ -402,13 +402,13 @@ bool menu_driver_ctl(enum rarch_menu_ctl_state state, void *data)
|
||||
const char *path = (const char*)data;
|
||||
if (string_is_empty(path))
|
||||
return false;
|
||||
menu_driver_playlist = content_playlist_init(path,
|
||||
menu_driver_playlist = playlist_init(path,
|
||||
COLLECTION_SIZE);
|
||||
}
|
||||
break;
|
||||
case RARCH_MENU_CTL_PLAYLIST_GET:
|
||||
{
|
||||
content_playlist_t **playlist = (content_playlist_t**)data;
|
||||
playlist_t **playlist = (playlist_t**)data;
|
||||
if (!playlist)
|
||||
return false;
|
||||
*playlist = menu_driver_playlist;
|
||||
|
78
playlist.c
78
playlist.c
@ -30,7 +30,7 @@
|
||||
#define PLAYLIST_ENTRIES 6
|
||||
#endif
|
||||
|
||||
struct content_playlist_entry
|
||||
struct playlist_entry
|
||||
{
|
||||
char *path;
|
||||
char *label;
|
||||
@ -42,7 +42,7 @@ struct content_playlist_entry
|
||||
|
||||
struct content_playlist
|
||||
{
|
||||
struct content_playlist_entry *entries;
|
||||
struct playlist_entry *entries;
|
||||
size_t size;
|
||||
size_t cap;
|
||||
|
||||
@ -50,7 +50,7 @@ struct content_playlist
|
||||
};
|
||||
|
||||
/**
|
||||
* content_playlist_get_index:
|
||||
* playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
* @idx : Index of playlist entry.
|
||||
* @path : Path of playlist entry.
|
||||
@ -59,7 +59,7 @@ struct content_playlist
|
||||
*
|
||||
* Gets values of playlist index:
|
||||
**/
|
||||
void content_playlist_get_index(content_playlist_t *playlist,
|
||||
void playlist_get_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
@ -83,7 +83,7 @@ void content_playlist_get_index(content_playlist_t *playlist,
|
||||
*crc32 = playlist->entries[idx].crc32;
|
||||
}
|
||||
|
||||
void content_playlist_get_index_by_path(content_playlist_t *playlist,
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
@ -115,7 +115,7 @@ void content_playlist_get_index_by_path(content_playlist_t *playlist,
|
||||
}
|
||||
}
|
||||
|
||||
bool content_playlist_entry_exists(content_playlist_t *playlist,
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *crc32)
|
||||
{
|
||||
@ -131,12 +131,12 @@ bool content_playlist_entry_exists(content_playlist_t *playlist,
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_free_entry:
|
||||
* playlist_free_entry:
|
||||
* @entry : Playlist entry handle.
|
||||
*
|
||||
* Frees playlist entry.
|
||||
**/
|
||||
static void content_playlist_free_entry(content_playlist_entry_t *entry)
|
||||
static void playlist_free_entry(playlist_entry_t *entry)
|
||||
{
|
||||
if (!entry)
|
||||
return;
|
||||
@ -168,13 +168,13 @@ static void content_playlist_free_entry(content_playlist_entry_t *entry)
|
||||
memset(entry, 0, sizeof(*entry));
|
||||
}
|
||||
|
||||
void content_playlist_update(content_playlist_t *playlist, size_t idx,
|
||||
void playlist_update(playlist_t *playlist, size_t idx,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
const char *db_name)
|
||||
{
|
||||
content_playlist_entry_t *entry = NULL;
|
||||
playlist_entry_t *entry = NULL;
|
||||
if (!playlist)
|
||||
return;
|
||||
if (idx > playlist->size)
|
||||
@ -194,7 +194,7 @@ void content_playlist_update(content_playlist_t *playlist, size_t idx,
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_push:
|
||||
* playlist_push:
|
||||
* @playlist : Playlist handle.
|
||||
* @path : Path of new playlist entry.
|
||||
* @core_path : Core path of new playlist entry.
|
||||
@ -202,7 +202,7 @@ void content_playlist_update(content_playlist_t *playlist, size_t idx,
|
||||
*
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
void content_playlist_push(content_playlist_t *playlist,
|
||||
void playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *crc32,
|
||||
@ -224,7 +224,7 @@ void content_playlist_push(content_playlist_t *playlist,
|
||||
|
||||
for (i = 0; i < playlist->size; i++)
|
||||
{
|
||||
content_playlist_entry_t tmp;
|
||||
playlist_entry_t tmp;
|
||||
bool equal_path = (!path && !playlist->entries[i].path) ||
|
||||
(path && playlist->entries[i].path &&
|
||||
string_is_equal(path,playlist->entries[i].path));
|
||||
@ -245,7 +245,7 @@ void content_playlist_push(content_playlist_t *playlist,
|
||||
/* Seen it before, bump to top. */
|
||||
tmp = playlist->entries[i];
|
||||
memmove(playlist->entries + 1, playlist->entries,
|
||||
i * sizeof(content_playlist_entry_t));
|
||||
i * sizeof(playlist_entry_t));
|
||||
playlist->entries[0] = tmp;
|
||||
|
||||
return;
|
||||
@ -253,12 +253,12 @@ void content_playlist_push(content_playlist_t *playlist,
|
||||
|
||||
if (playlist->size == playlist->cap)
|
||||
{
|
||||
content_playlist_free_entry(&playlist->entries[playlist->cap - 1]);
|
||||
playlist_free_entry(&playlist->entries[playlist->cap - 1]);
|
||||
playlist->size--;
|
||||
}
|
||||
|
||||
memmove(playlist->entries + 1, playlist->entries,
|
||||
(playlist->cap - 1) * sizeof(content_playlist_entry_t));
|
||||
(playlist->cap - 1) * sizeof(playlist_entry_t));
|
||||
|
||||
playlist->entries[0].path = path ? strdup(path) : NULL;
|
||||
playlist->entries[0].label = label ? strdup(label) : NULL;
|
||||
@ -269,7 +269,7 @@ void content_playlist_push(content_playlist_t *playlist,
|
||||
playlist->size++;
|
||||
}
|
||||
|
||||
void content_playlist_write_file(content_playlist_t *playlist)
|
||||
void playlist_write_file(playlist_t *playlist)
|
||||
{
|
||||
size_t i;
|
||||
FILE *file = NULL;
|
||||
@ -296,12 +296,12 @@ void content_playlist_write_file(content_playlist_t *playlist)
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_free:
|
||||
* playlist_free:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Frees playlist handle.
|
||||
*/
|
||||
void content_playlist_free(content_playlist_t *playlist)
|
||||
void playlist_free(playlist_t *playlist)
|
||||
{
|
||||
size_t i;
|
||||
|
||||
@ -314,7 +314,7 @@ void content_playlist_free(content_playlist_t *playlist)
|
||||
playlist->conf_path = NULL;
|
||||
|
||||
for (i = 0; i < playlist->cap; i++)
|
||||
content_playlist_free_entry(&playlist->entries[i]);
|
||||
playlist_free_entry(&playlist->entries[i]);
|
||||
|
||||
free(playlist->entries);
|
||||
playlist->entries = NULL;
|
||||
@ -323,50 +323,50 @@ void content_playlist_free(content_playlist_t *playlist)
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_clear:
|
||||
* playlist_clear:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Clears all playlist entries in playlist.
|
||||
**/
|
||||
void content_playlist_clear(content_playlist_t *playlist)
|
||||
void playlist_clear(playlist_t *playlist)
|
||||
{
|
||||
size_t i;
|
||||
if (!playlist)
|
||||
return;
|
||||
|
||||
for (i = 0; i < playlist->cap; i++)
|
||||
content_playlist_free_entry(&playlist->entries[i]);
|
||||
playlist_free_entry(&playlist->entries[i]);
|
||||
playlist->size = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_size:
|
||||
* playlist_size:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Gets size of playlist.
|
||||
* Returns: size of playlist.
|
||||
**/
|
||||
size_t content_playlist_size(content_playlist_t *playlist)
|
||||
size_t playlist_size(playlist_t *playlist)
|
||||
{
|
||||
if (!playlist)
|
||||
return 0;
|
||||
return playlist->size;
|
||||
}
|
||||
|
||||
const char *content_playlist_entry_get_label(
|
||||
const content_playlist_entry_t *entry)
|
||||
const char *playlist_entry_get_label(
|
||||
const playlist_entry_t *entry)
|
||||
{
|
||||
if (!entry)
|
||||
return NULL;
|
||||
return entry->label;
|
||||
}
|
||||
|
||||
static bool content_playlist_read_file(
|
||||
content_playlist_t *playlist, const char *path)
|
||||
static bool playlist_read_file(
|
||||
playlist_t *playlist, const char *path)
|
||||
{
|
||||
unsigned i;
|
||||
char buf[PLAYLIST_ENTRIES][1024] = {{0}};
|
||||
content_playlist_entry_t *entry = NULL;
|
||||
playlist_entry_t *entry = NULL;
|
||||
char *last = NULL;
|
||||
FILE *file = fopen(path, "r");
|
||||
|
||||
@ -414,7 +414,7 @@ end:
|
||||
}
|
||||
|
||||
/**
|
||||
* content_playlist_init:
|
||||
* playlist_init:
|
||||
* @path : Path to playlist contents file.
|
||||
* @size : Maximum capacity of playlist size.
|
||||
*
|
||||
@ -422,34 +422,34 @@ end:
|
||||
*
|
||||
* Returns: handle to new playlist if successful, otherwise NULL
|
||||
**/
|
||||
content_playlist_t *content_playlist_init(const char *path, size_t size)
|
||||
playlist_t *playlist_init(const char *path, size_t size)
|
||||
{
|
||||
content_playlist_t *playlist = (content_playlist_t*)
|
||||
playlist_t *playlist = (playlist_t*)
|
||||
calloc(1, sizeof(*playlist));
|
||||
if (!playlist)
|
||||
return NULL;
|
||||
|
||||
playlist->entries = (content_playlist_entry_t*)calloc(size,
|
||||
playlist->entries = (playlist_entry_t*)calloc(size,
|
||||
sizeof(*playlist->entries));
|
||||
if (!playlist->entries)
|
||||
goto error;
|
||||
|
||||
playlist->cap = size;
|
||||
|
||||
content_playlist_read_file(playlist, path);
|
||||
playlist_read_file(playlist, path);
|
||||
|
||||
playlist->conf_path = strdup(path);
|
||||
return playlist;
|
||||
|
||||
error:
|
||||
content_playlist_free(playlist);
|
||||
playlist_free(playlist);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void content_playlist_qsort(content_playlist_t *playlist,
|
||||
content_playlist_sort_fun_t *fn)
|
||||
void playlist_qsort(playlist_t *playlist,
|
||||
playlist_sort_fun_t *fn)
|
||||
{
|
||||
qsort(playlist->entries, playlist->size,
|
||||
sizeof(content_playlist_entry_t),
|
||||
sizeof(playlist_entry_t),
|
||||
(int (*)(const void *, const void *))fn);
|
||||
}
|
||||
|
54
playlist.h
54
playlist.h
@ -15,8 +15,8 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CONTENT_HISTORY_H__
|
||||
#define CONTENT_HISTORY_H__
|
||||
#ifndef _PLAYLIST_H__
|
||||
#define _PLAYLIST_H__
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
@ -24,15 +24,15 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct content_playlist_entry content_playlist_entry_t;
|
||||
typedef struct content_playlist content_playlist_t;
|
||||
typedef struct playlist_entry playlist_entry_t;
|
||||
typedef struct content_playlist playlist_t;
|
||||
|
||||
typedef int (content_playlist_sort_fun_t)(
|
||||
const content_playlist_entry_t *a,
|
||||
const content_playlist_entry_t *b);
|
||||
typedef int (playlist_sort_fun_t)(
|
||||
const playlist_entry_t *a,
|
||||
const playlist_entry_t *b);
|
||||
|
||||
/**
|
||||
* content_playlist_init:
|
||||
* playlist_init:
|
||||
* @path : Path to playlist contents file.
|
||||
* @size : Maximum capacity of playlist size.
|
||||
*
|
||||
@ -40,38 +40,38 @@ typedef int (content_playlist_sort_fun_t)(
|
||||
*
|
||||
* Returns: handle to new playlist if successful, otherwise NULL
|
||||
**/
|
||||
content_playlist_t *content_playlist_init(const char *path, size_t size);
|
||||
playlist_t *playlist_init(const char *path, size_t size);
|
||||
|
||||
/**
|
||||
* content_playlist_free:
|
||||
* playlist_free:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Frees playlist handle.
|
||||
*/
|
||||
void content_playlist_free(content_playlist_t *playlist);
|
||||
void playlist_free(playlist_t *playlist);
|
||||
|
||||
/**
|
||||
* content_playlist_clear:
|
||||
* playlist_clear:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Clears all playlist entries in playlist.
|
||||
**/
|
||||
void content_playlist_clear(content_playlist_t *playlist);
|
||||
void playlist_clear(playlist_t *playlist);
|
||||
|
||||
/**
|
||||
* content_playlist_size:
|
||||
* playlist_size:
|
||||
* @playlist : Playlist handle.
|
||||
*
|
||||
* Gets size of playlist.
|
||||
* Returns: size of playlist.
|
||||
**/
|
||||
size_t content_playlist_size(content_playlist_t *playlist);
|
||||
size_t playlist_size(playlist_t *playlist);
|
||||
|
||||
const char *content_playlist_entry_get_label(
|
||||
const content_playlist_entry_t *entry);
|
||||
const char *playlist_entry_get_label(
|
||||
const playlist_entry_t *entry);
|
||||
|
||||
/**
|
||||
* content_playlist_get_index:
|
||||
* playlist_get_index:
|
||||
* @playlist : Playlist handle.
|
||||
* @idx : Index of playlist entry.
|
||||
* @path : Path of playlist entry.
|
||||
@ -80,7 +80,7 @@ const char *content_playlist_entry_get_label(
|
||||
*
|
||||
* Gets values of playlist index:
|
||||
**/
|
||||
void content_playlist_get_index(content_playlist_t *playlist,
|
||||
void playlist_get_index(playlist_t *playlist,
|
||||
size_t idx,
|
||||
const char **path, const char **label,
|
||||
const char **core_path, const char **core_name,
|
||||
@ -88,7 +88,7 @@ void content_playlist_get_index(content_playlist_t *playlist,
|
||||
const char **crc32);
|
||||
|
||||
/**
|
||||
* content_playlist_push:
|
||||
* playlist_push:
|
||||
* @playlist : Playlist handle.
|
||||
* @path : Path of new playlist entry.
|
||||
* @core_path : Core path of new playlist entry.
|
||||
@ -96,33 +96,33 @@ void content_playlist_get_index(content_playlist_t *playlist,
|
||||
*
|
||||
* Push entry to top of playlist.
|
||||
**/
|
||||
void content_playlist_push(content_playlist_t *playlist,
|
||||
void playlist_push(playlist_t *playlist,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *db_name,
|
||||
const char *crc32);
|
||||
|
||||
void content_playlist_update(content_playlist_t *playlist, size_t idx,
|
||||
void playlist_update(playlist_t *playlist, size_t idx,
|
||||
const char *path, const char *label,
|
||||
const char *core_path, const char *core_name,
|
||||
const char *db_name,
|
||||
const char *crc32);
|
||||
|
||||
void content_playlist_get_index_by_path(content_playlist_t *playlist,
|
||||
void playlist_get_index_by_path(playlist_t *playlist,
|
||||
const char *search_path,
|
||||
char **path, char **label,
|
||||
char **core_path, char **core_name,
|
||||
char **db_name,
|
||||
char **crc32);
|
||||
|
||||
bool content_playlist_entry_exists(content_playlist_t *playlist,
|
||||
bool playlist_entry_exists(playlist_t *playlist,
|
||||
const char *path,
|
||||
const char *crc32);
|
||||
|
||||
void content_playlist_write_file(content_playlist_t *playlist);
|
||||
void playlist_write_file(playlist_t *playlist);
|
||||
|
||||
void content_playlist_qsort(content_playlist_t *playlist,
|
||||
content_playlist_sort_fun_t *fn);
|
||||
void playlist_qsort(playlist_t *playlist,
|
||||
playlist_sort_fun_t *fn);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
@ -287,7 +287,7 @@ static int database_info_list_iterate_found_match(
|
||||
char db_playlist_path[PATH_MAX_LENGTH] = {0};
|
||||
char db_playlist_base_str[PATH_MAX_LENGTH] = {0};
|
||||
char entry_path_str[PATH_MAX_LENGTH] = {0};
|
||||
content_playlist_t *playlist = NULL;
|
||||
playlist_t *playlist = NULL;
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *db_path = db_state->list->elems[
|
||||
db_state->list_index].data;
|
||||
@ -305,7 +305,7 @@ static int database_info_list_iterate_found_match(
|
||||
fill_pathname_join(db_playlist_path, settings->directory.playlist,
|
||||
db_playlist_base_str, sizeof(db_playlist_path));
|
||||
|
||||
playlist = content_playlist_init(db_playlist_path, COLLECTION_SIZE);
|
||||
playlist = playlist_init(db_playlist_path, COLLECTION_SIZE);
|
||||
|
||||
|
||||
snprintf(db_crc, sizeof(db_crc), "%08X|crc", db_info_entry->crc32);
|
||||
@ -328,15 +328,15 @@ static int database_info_list_iterate_found_match(
|
||||
RARCH_LOG("entry path str: %s\n", entry_path_str);
|
||||
#endif
|
||||
|
||||
if(!content_playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
if(!playlist_entry_exists(playlist, entry_path_str, db_crc))
|
||||
{
|
||||
content_playlist_push(playlist, entry_path_str,
|
||||
playlist_push(playlist, entry_path_str,
|
||||
db_info_entry->name, "DETECT", "DETECT",
|
||||
db_crc, db_playlist_base_str);
|
||||
}
|
||||
|
||||
content_playlist_write_file(playlist);
|
||||
content_playlist_free(playlist);
|
||||
playlist_write_file(playlist);
|
||||
playlist_free(playlist);
|
||||
|
||||
database_info_list_free(db_state->info);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user