Пример #1
0
int TrackCount(const char* strFile)
{
  void* file = XBMC->OpenFile(strFile, 0);
  if (!file)
    return 1;

  int len = XBMC->GetFileLength(file);
  uint8_t* data = new uint8_t[len];
  XBMC->ReadFile(file, data, len);
  XBMC->CloseFile(file);

  ASAP* asap = ASAP_New();

  // Now load the module
  if (!ASAP_Load(asap, strFile, data, len))
  {
    ASAP_Delete(asap);
    delete[] data;
    return 1;
  }
  delete[] data;

  const ASAPInfo* info = ASAP_GetInfo(asap);
  int result = ASAPInfo_GetSongs(info);
  ASAP_Delete(asap);

  return result;
}
Пример #2
0
cibool EMSCRIPTEN_KEEPALIVE asap_load(const char *filename, unsigned char *buf, long len) {
	if (asap != 0) {
		ASAP_Delete(asap);
		asap= 0;
	}
	return ASAP_Load(getAsap(), filename, buf, len);
}
Пример #3
0
	~input_asap()
	{
		ASAP_Delete(asap);
		free(filename);
		if (prev != NULL)
			prev->next = next;
		if (next != NULL)
			next->prev = prev;
		if (head == this)
			head = next;
	}
Пример #4
0
bool DeInit(void* context)
{
  if (!context)
    return 1;

  ASAPContext* ctx = (ASAPContext*)context;
  ASAP_Delete(ctx->asap);
  delete ctx;

  return true;
}
Пример #5
0
static void asap_info(const char *file, struct file_tags *tags, const int tags_sel)
{
	ASAP_Decoder d;
	if (asap_load(&d, file)) {
		if ((tags_sel & TAGS_COMMENTS) != 0) {
			const ASAPInfo *info = ASAP_GetInfo(d.asap);
			tags->title = xstrdup(ASAPInfo_GetTitleOrFilename(info));
			tags->artist = xstrdup(ASAPInfo_GetAuthor(info));
			tags->filled |= TAGS_COMMENTS;
		}
		if ((tags_sel & TAGS_TIME) != 0) {
			tags->time = d.duration / 1000;
			tags->filled |= TAGS_TIME;
		}
	}
	ASAP_Delete(d.asap);
}
Пример #6
0
static void quit(void)
{
	ASAP_Delete(asap);
}
Пример #7
0
static void asap_close(void *data)
{
	ASAP_Decoder *d = (ASAP_Decoder *) data;
	ASAP_Delete(d->asap);
	free(d);
}
Пример #8
0
static void plugin_cleanup(void)
{
	ASAP_Delete(asap);
}