RetroArch/playlist.h

130 lines
3.6 KiB
C
Raw Normal View History

2013-04-27 22:15:59 +00:00
/* RetroArch - A frontend for libretro.
2014-01-01 00:50:59 +00:00
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
2016-01-10 03:06:50 +00:00
* Copyright (C) 2011-2016 - Daniel De Matteis
2015-01-07 16:46:50 +00:00
* Copyright (C) 2013-2014 - Jason Fetters
2013-04-27 22:15:59 +00:00
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
* of the GNU General Public License as published by the Free Software Found-
* ation, either version 3 of the License, or (at your option) any later version.
*
* RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with RetroArch.
* If not, see <http://www.gnu.org/licenses/>.
*/
2016-05-16 07:07:44 +00:00
#ifndef _PLAYLIST_H__
#define _PLAYLIST_H__
2013-04-27 22:15:59 +00:00
#include <stddef.h>
2016-06-03 00:39:35 +00:00
#include <retro_common_api.h>
RETRO_BEGIN_DECLS
2013-04-28 00:01:25 +00:00
2016-05-16 07:07:44 +00:00
typedef struct playlist_entry playlist_entry_t;
typedef struct content_playlist playlist_t;
2013-04-27 22:15:59 +00:00
2016-05-16 07:07:44 +00:00
typedef int (playlist_sort_fun_t)(
const playlist_entry_t *a,
const playlist_entry_t *b);
/**
2016-05-16 07:07:44 +00:00
* playlist_init:
2015-01-17 02:48:59 +00:00
* @path : Path to playlist contents file.
* @size : Maximum capacity of playlist size.
*
* Creates and initializes a playlist.
*
* Returns: handle to new playlist if successful, otherwise NULL
**/
2016-05-16 07:07:44 +00:00
playlist_t *playlist_init(const char *path, size_t size);
2014-09-02 03:32:04 +00:00
/**
2016-05-16 07:07:44 +00:00
* playlist_free:
2015-01-17 02:48:59 +00:00
* @playlist : Playlist handle.
*
* Frees playlist handle.
*/
2016-05-16 07:07:44 +00:00
void playlist_free(playlist_t *playlist);
2013-04-27 22:15:59 +00:00
/**
2016-05-16 07:07:44 +00:00
* playlist_clear:
2015-01-17 02:48:59 +00:00
* @playlist : Playlist handle.
*
* Clears all playlist entries in playlist.
**/
2016-05-16 07:07:44 +00:00
void playlist_clear(playlist_t *playlist);
/**
2016-05-16 07:07:44 +00:00
* playlist_size:
2015-01-17 02:48:59 +00:00
* @playlist : Playlist handle.
*
* Gets size of playlist.
* Returns: size of playlist.
**/
2016-05-16 07:07:44 +00:00
size_t playlist_size(playlist_t *playlist);
2013-04-27 22:15:59 +00:00
2016-05-16 07:07:44 +00:00
const char *playlist_entry_get_label(
const playlist_entry_t *entry);
/**
2016-05-16 07:07:44 +00:00
* playlist_get_index:
2015-01-17 02:48:59 +00:00
* @playlist : Playlist handle.
* @idx : Index of playlist entry.
* @path : Path of playlist entry.
* @core_path : Core path of playlist entry.
* @core_name : Core name of playlist entry.
*
* Gets values of playlist index:
**/
2016-05-16 07:07:44 +00:00
void playlist_get_index(playlist_t *playlist,
2015-05-25 22:12:49 +00:00
size_t idx,
const char **path, const char **label,
const char **core_path, const char **core_name,
const char **db_name,
2015-05-25 22:12:49 +00:00
const char **crc32);
2013-04-27 22:15:59 +00:00
2015-01-16 20:09:05 +00:00
/**
2016-05-16 07:07:44 +00:00
* playlist_push:
2015-01-17 02:48:59 +00:00
* @playlist : Playlist handle.
2015-01-16 20:09:05 +00:00
* @path : Path of new playlist entry.
* @core_path : Core path of new playlist entry.
* @core_name : Core name of new playlist entry.
*
* Push entry to top of playlist.
**/
2016-05-16 07:07:44 +00:00
void playlist_push(playlist_t *playlist,
2015-05-25 22:12:49 +00:00
const char *path, const char *label,
const char *core_path, const char *core_name,
const char *db_name,
2015-05-25 22:12:49 +00:00
const char *crc32);
2013-04-27 22:15:59 +00:00
2016-05-16 07:07:44 +00:00
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);
2016-05-16 07:07:44 +00:00
void playlist_get_index_by_path(playlist_t *playlist,
const char *search_path,
2015-05-25 22:12:49 +00:00
char **path, char **label,
char **core_path, char **core_name,
char **db_name,
2015-05-25 22:12:49 +00:00
char **crc32);
2016-05-16 07:07:44 +00:00
bool playlist_entry_exists(playlist_t *playlist,
const char *path,
const char *crc32);
2016-05-16 07:07:44 +00:00
void playlist_write_file(playlist_t *playlist);
2016-05-16 07:07:44 +00:00
void playlist_qsort(playlist_t *playlist,
playlist_sort_fun_t *fn);
2016-06-03 00:39:35 +00:00
RETRO_END_DECLS
2013-04-28 00:01:25 +00:00
2013-04-27 22:15:59 +00:00
#endif