示例#1
0
static event_t *
be_gmeplayer_play(const char *url0, media_pipe_t *mp, 
		  char *errbuf, size_t errlen, int hold,
		  const char *mimetype)
{
  event_t *e;
  char *url, *p;
  int track;

  url0 += strlen("gmeplayer:");

  url = mystrdupa(url0);
  p = strrchr(url, '/');
  if(p == NULL) {
    snprintf(errbuf, errlen, "Invalid filename");
    return NULL;
  }

  *p++= 0;
  track = atoi(p) - 1;
  buf_t *b;
  if((b = fa_load(url, NULL, errbuf, errlen, NULL, 0, NULL, NULL)) == NULL)
    return NULL;

  e = fa_gme_playfile_internal(mp, b->b_ptr, b->b_size,
			       errbuf, errlen, hold, track, url0);
  buf_release(b);
  return e;
}
示例#2
0
event_t *
fa_gme_playfile(media_pipe_t *mp, void *fh,
		char *errbuf, size_t errlen, int hold)
{
  return fa_gme_playfile_internal(mp, fh, errbuf, errlen, hold, 0);

}
示例#3
0
static event_t *
be_gmeplayer_play(const char *url0, media_pipe_t *mp, 
		  char *errbuf, size_t errlen, int hold)
{
  event_t *e;
  char *url, *p;
  int track;
  void *fh;

  url0 += strlen("gmeplayer:");

  url = mystrdupa(url0);
  p = strrchr(url, '/');
  if(p == NULL) {
    snprintf(errbuf, errlen, "Invalid filename");
    return NULL;
  }

  *p++= 0;
  track = atoi(p) - 1;

  if((fh = fa_open(url, errbuf, errlen)) == NULL)
    return NULL;

  e = fa_gme_playfile_internal(mp, fh, errbuf, errlen, hold, track);
  fa_close(fh);
  return e;

}
示例#4
0
event_t *
fa_gme_playfile(media_pipe_t *mp, fa_handle_t *fh,
		char *errbuf, size_t errlen, int hold, const char *url)
{
  buf_t *b;
  event_t *e;

  if((b = fa_load_and_close(fh)) == NULL) {
    snprintf(errbuf, errlen, "Unable to read data from file");
    return NULL;
  }

  e = fa_gme_playfile_internal(mp, b->b_ptr, b->b_size, errbuf, errlen,
			       hold, 0, url);
  buf_release(b);
  return e;
}
示例#5
0
event_t *
fa_gme_playfile(media_pipe_t *mp, fa_handle_t *fh,
		char *errbuf, size_t errlen, int hold, const char *url)
{
  uint8_t *mem;
  size_t size;
  event_t *e;

  if((mem = fa_load_and_close(fh, &size)) == NULL) {
    snprintf(errbuf, errlen, "Unable to read data from file");
    return NULL;
  }

  e = fa_gme_playfile_internal(mp, mem, size, errbuf, errlen, hold, 0, url);
  free(mem);
  return e;
}