rockbox/lib/rbcodec/metadata/hes.c
Sean Bartell b5716df4cb Build librbcodec with DSP and metadata.
All associated files are moved to /lib/rbcodec.

Change-Id: I572ddd2b8a996aae1e98c081d06b1ed356dce222
2012-03-18 12:00:39 +01:00

39 lines
915 B
C

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <inttypes.h>
#include "system.h"
#include "metadata.h"
#include "metadata_common.h"
#include "metadata_parsers.h"
#include "rbunicode.h"
#include "plugin.h"
bool get_hes_metadata(int fd, struct mp3entry* id3)
{
/* Use the id3v2 buffer part of the id3 structure as a temporary buffer */
unsigned char* buf = (unsigned char *)id3->id3v2buf;
int read_bytes;
if ((lseek(fd, 0, SEEK_SET) < 0)
|| ((read_bytes = read(fd, buf, 4)) < 4))
return false;
/* Verify this is a HES file */
if (memcmp(buf,"HESM",4) != 0)
return false;
id3->vbr = false;
id3->filesize = filesize(fd);
/* we only render 16 bits, 44.1KHz, Stereo */
id3->bitrate = 706;
id3->frequency = 44100;
/* Set default track count (length)*/
id3->length = 255 * 1000;
return true;
}