Stefan Schuermans
iplemented 1st part of BBM player app: finding files and parsing BBM header
Stefan Schuermans commited 369747f at 2012-05-06 15:16:58
/* flaneth - flash and ethernet
Copyright (C) 2007-2012 Stefan Schuermans <stefan@schuermans.info>
Copyleft: GNU public license V2 - http://www.gnu.org/copyleft/gpl.html
a BlinkenArea project - http://www.blinkenarea.org/ */
#include <stdio.h>
#include <string.h>
#include "apps_tools.h"
#include "app_bbm.h"
#include "debug.h"
#include "dosfs.h"
#include "nethelp.h"
#include "timing.h"
///< BBM file header
typedef struct app_bbm_header {
uint32_t magic;
uint16_t height;
uint16_t width;
uint16_t channels;
uint16_t maxval;
uint32_t framecnt;
uint32_t duration;
uint32_t frameptr;
} AppBbmHeader;
/**
* @brief get name of next file from playlist directory
* @param[in,out] state internal state of application
* @param[out] filename name of file
* @param[in] filename_sz length of filename buffer
* @return 0 if success ful, -1 if not
*/
static char AppBbmNextName(AppBbmState *state, char *filename,
unsigned char filename_sz)
{
// assemble filename of playlist directory
char dirname[10];
sprintf(dirname, "bbm%hhu/pl", state->no);
// open playlist directory
DIRINFO di;
di.scratch = *state->sectorBuf;
if (DFS_OpenDir(state->vi, (uint8_t *)dirname, &di) != DFS_OK) {
// no playlist dir -> deactivate application
state->isInit = 0;
debug_app_bbm_printf("%hhu: cannot open directory %s",
state->no, filename);
return -1;
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX