Atmel Software Framework

play_list.h File Reference
#include "fs_com.h"
#include "conf_explorer.h"

Macros

Options for "pl_add()"
#define PL_ADD_FILE   0x00
 
#define PL_ADD_DIR   0x01
 
#define PL_ADD_SUBDIR   0x02
 

List of supported file extensions

#define PL_FILE_EXT   "m3u,pls,smp"
 
enum  readline_opt_t {
  PL_MAIN_READLINE_OPT_CHECKLINE,
  PL_MAIN_READLINE_OPT_READSTRING,
  PL_MAIN_READLINE_OPT_GOTOPATH
}
 This function reads and checks the next line. More...
 
bool pl_main_isopen (void)
 This function checks if a play list file is already opened. More...
 
bool pl_main_ismodify (void)
 This function checks if the play list file is modified. More...
 
bool pl_main_new (const FS_STRING sz_name, bool b_undo)
 This function creates a new empty play list file. More...
 
bool pl_main_open (bool b_undo)
 This function opens the current selected file in the current navigator. More...
 
bool pl_main_save (void)
 This function saves the play list file. More...
 
bool pl_main_close (void)
 This function closes the play list and selects this one in current navigator. More...
 
bool pl_main_modify (void)
 This function creates a copy of the play list in case of a restore action. More...
 
uint16_t pl_nav_getnbfile (void)
 Return the number of files in play list. More...
 
uint16_t pl_nav_getpos (void)
 Return the position in the play list. More...
 
bool pl_nav_eol (void)
 This function checks the end of the play list. More...
 
bool pl_nav_setpos (uint16_t u16_position)
 This function goes to a position in the play list. More...
 
bool pl_nav_readentry (uint16_t u16_position, FS_STRING *sz_pat, uint16_t *u16_size_line)
 This function read the playlist's entry at a specific position. More...
 
bool pl_main_readline (readline_opt_t opt, uint8_t id_nav, FS_STRING *sz_path, uint16_t *u16_size_line)
 This function reads and checks the next line. More...
 
bool pl_sel_isvalid (void)
 This function tests the valid path in list. More...
 
bool pl_add (const FS_STRING sz_filterext, uint8_t u8_mode)
 This function adds files in play list. More...
 
bool pl_rem_sel_all (void)
 This function removes all files in the list. More...
 
bool pl_rem_sel (void)
 This function removes the selected file in the list. More...
 
bool pl_rem_dead (void)
 This function remove the dead file in the list. More...
 

#define PL_ADD_DIR   0x01
#define PL_ADD_FILE   0x00
#define PL_ADD_SUBDIR   0x02
#define PL_FILE_EXT   "m3u,pls,smp"

This function reads and checks the next line.

Parameters
b_gotopathPL_MAIN_READLINE_OPT_CHECKLINE to check the next line in the file.
PL_MAIN_READLINE_OPT_READSTRING to read the string in the text file.
PL_MAIN_READLINE_OPT_GOTOPATH to read, check and goto the path.
id_navID navigator to update with the selected file (ignore if b_gotopatch == false)
sz_pathAddress of the string returned. It is used only if PL_MAIN_READLINE_OPT_READSTRING or PL_MAIN_READLINE_OPT_GOTOPATH options are specified.
u16_size_lineThe length of the path.
Returns
true if a line with a correct path false line ignored or end of file
Enumerator
PL_MAIN_READLINE_OPT_CHECKLINE 
PL_MAIN_READLINE_OPT_READSTRING 
PL_MAIN_READLINE_OPT_GOTOPATH 

bool pl_add ( const FS_STRING  sz_filterext,
uint8_t  u8_mode 
)

This function adds files in play list.

@param sz_filterext add file only corresponding to the  extension filter
@param u8_mode      PL_ADD_FILE, PL_ADD_DIR, PL_ADD_SUBDIR

@return    false in case of error, see global value "fs_g_status" for more detail
@return    true otherwise
//! It is possible to select a file or all files in a directory
//! 
bool pl_main_close ( void  )

This function closes the play list and selects this one in current navigator.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References _MEM_TYPE_SLOW_, copyfile_index, file_close(), FS_NAME_GET, FS_NAV_ID_PLAYLIST, index, Is_unicode, nav_file_del(), nav_file_name(), nav_file_rename(), nav_get(), nav_getindex(), nav_gotoindex(), nav_select(), nav_string_length_disable(), nav_string_length_enable(), NULL, pl_g_list_is_modify, pl_g_list_is_open, pl_g_list_undo, pl_main_isopen(), PLAYLIST_BUF_ALLOC, and PLAYLIST_BUF_FREE.

Referenced by navauto_close().

bool pl_main_ismodify ( void  )

This function checks if the play list file is modified.

Returns
true the play list file is modified

References pl_g_list_is_modify.

bool pl_main_isopen ( void  )

This function checks if a play list file is already opened.

Returns
true a play list file is opened

References FS_ERR_PL_NOT_OPEN, fs_g_status, and pl_g_list_is_open.

Referenced by ai_usb_ms_specific_nav_getplaylistfile(), pl_main_close(), pl_main_open(), pl_main_save(), and pl_sel_isvalid().

bool pl_main_modify ( void  )

This function creates a copy of the play list in case of a restore action.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

Referenced by pl_rem_sel(), and pl_rem_sel_all().

bool pl_main_new ( const FS_STRING  sz_name,
bool  b_undo 
)

This function creates a new empty play list file.

Parameters
sz_namecontains the file name (ASCII or UNICODE )
b_undotrue to authorize the undo feature
Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise
bool pl_main_open ( bool  b_undo)

This function opens the current selected file in the current navigator.

Parameters
b_undotrue to authorize the undo feature
Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References E_PL_M3U, E_PL_PLS, E_PL_SMP, file_eof(), FS_NAV_ID_PLAYLIST, nav_copy(), nav_file_checkext(), nav_file_isreadonly(), nav_filelist_reset(), nav_get(), nav_select(), NULL, pl_g_list_is_modify, pl_g_list_is_open, pl_g_list_is_readonly, pl_g_list_type, pl_g_list_undo, pl_g_u16_list_sel, pl_g_u16_list_size, pl_main_isopen(), pl_main_readline(), PL_MAIN_READLINE_OPT_CHECKLINE, reader_txt_beg(), and reader_txt_open().

Referenced by navauto_open(), and pl_main_save().

bool pl_main_readline ( readline_opt_t  opt,
uint8_t  id_nav,
FS_STRING sz_path,
uint16_t *  u16_size_line 
)

This function reads and checks the next line.

Parameters
optPL_MAIN_READLINE_OPT_CHECKLINE to check the next line in the file.
PL_MAIN_READLINE_OPT_READSTRING to read the string in the text file.
PL_MAIN_READLINE_OPT_GOTOPATH to read, check and goto the path.
id_navID navigator to update with the selected file (ignore if b_gotopatch == false)
sz_pathAddress of the string returned. It is used only if PL_MAIN_READLINE_OPT_READSTRING or PL_MAIN_READLINE_OPT_GOTOPATH options are specified.
u16_size_lineThe length of the path. If this parameter is NULL, then the length is not returned.
Returns
true if a line with a correct path false line ignored or end of file

References E_PL_M3U, E_PL_PLS, E_PL_SMP, file_getpos(), file_seek(), FS_NAV_ID_PLAYLIST, FS_SEEK_SET, FS_UNICODE, Is_unicode, nav_copy(), nav_filelist_reset(), nav_select(), nav_setcwd(), NULL, pl_g_list_type, PL_MAIN_READLINE_OPT_CHECKLINE, PL_MAIN_READLINE_OPT_READSTRING, PLAYLIST_BUF_ALLOC, and reader_txt_get_line().

Referenced by pl_main_open(), pl_nav_readentry(), and pl_nav_setpos().

bool pl_main_save ( void  )

This function saves the play list file.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References _MEM_TYPE_SLOW_, copyfile_index, file_close(), FS_NAV_ID_PLAYLIST, index, nav_file_del(), nav_get(), nav_getindex(), nav_gotoindex(), nav_select(), pl_g_list_is_modify, pl_g_list_is_open, pl_g_list_undo, pl_g_u16_list_sel, pl_main_isopen(), pl_main_open(), and pl_nav_setpos().

bool pl_nav_eol ( void  )

This function checks the end of the play list.

Returns
true if the position is the last file of the play list

References pl_g_u16_list_sel, and pl_g_u16_list_size.

uint16_t pl_nav_getnbfile ( void  )

Return the number of files in play list.

Returns
number of files in play list

References pl_g_u16_list_size.

Referenced by navauto_mov_playlist(), and navauto_open().

uint16_t pl_nav_getpos ( void  )

Return the position in the play list.

Returns
position in the play list

References pl_g_u16_list_sel.

Referenced by navauto_mov_playlist().

bool pl_nav_readentry ( uint16_t  u16_position,
FS_STRING sz_path,
uint16_t *  u16_size_line 
)

This function read the playlist's entry at a specific position.

Parameters
u16_positionPosition in play list.
sz_pathThe address of the string where is stored the information.
u16_size_lineThe length of the path.

References file_eof(), file_getpos(), file_seek(), FS_ERR_PL_OUT_LST, fs_g_status, FS_NAV_ID_PLAYLIST, FS_SEEK_SET, nav_get(), nav_select(), NULL, pl_g_u16_list_sel, pl_g_u16_list_size, pl_main_readline(), PL_MAIN_READLINE_OPT_CHECKLINE, PL_MAIN_READLINE_OPT_GOTOPATH, and reader_txt_beg().

bool pl_nav_setpos ( uint16_t  u16_position)
bool pl_rem_dead ( void  )

This function remove the dead file in the list.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References FS_NAV_ID_PLAYLIST, nav_get(), nav_gotoindex(), nav_select(), pl_g_u16_list_sel, pl_g_u16_list_size, pl_nav_setpos(), and pl_rem_sel().

bool pl_rem_sel ( void  )

This function removes the selected file in the list.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References file_putc(), file_seek(), FS_ERR_PL_OUT_LST, fs_g_status, FS_NAV_ID_PLAYLIST, FS_SEEK_CUR_RE, FS_SEEK_SET, nav_get(), nav_select(), pl_g_u16_list_sel, pl_g_u16_list_size, and pl_main_modify().

Referenced by pl_rem_dead().

bool pl_rem_sel_all ( void  )

This function removes all files in the list.

Returns
false in case of error, see global value "fs_g_status" for more detail
true otherwise

References file_seek(), file_set_eof(), FS_NAV_ID_PLAYLIST, FS_SEEK_SET, nav_get(), nav_select(), and pl_main_modify().

bool pl_sel_isvalid ( void  )

This function tests the valid path in list.

Returns
false = path is not valid in list - DEAD

References nav_filelist_validpos(), pl_g_u16_list_sel, and pl_main_isopen().