コード例 #1
0
ファイル: wii_dvd.c プロジェクト: Bibamaru/showtime
static event_t *
be_dvd_play(struct backend *be, const char *url, media_pipe_t *mp,
	    int flags, int priority,
	    char *errstr, size_t errlen)
{
  event_t *e;
  int i;

  if(strcmp(url, "dvd:/dev/di")) {
    snprintf(errstr, errlen, "dvd: Invalid URL");
    return NULL;
  }

  for(i = 0; i < 20; i++) {
    if(DI_GetStatus() & DVD_READY)
      break;
    sleep(1);
  }

  e = dvd_play("/dev/di", mp, errstr, errlen, 0);

  if(e != NULL && event_is_action(e, ACTION_EJECT))
    DI_Eject();

  return e;
}
コード例 #2
0
ファイル: linux_dvd.c プロジェクト: CrashSerious/showtime
static event_t *
be_dvd_play(const char *url, media_pipe_t *mp,
	    int flags, int priority,
	    char *errstr, size_t errlen,
	    const char *mimetype,
	    const char *canonical_url)
{
  event_t *e;
  if(strncmp(url, "dvd:", strlen("dvd:"))) {
    snprintf(errstr, errlen, "dvd: Invalid URL");
    return NULL;
  }

  url += 4;

  e = dvd_play(url, mp, errstr, errlen, 0);

  if(e != NULL && event_is_action(e, ACTION_EJECT)) {

    int fd = open(url, O_RDONLY | O_NONBLOCK);
    if(fd != -1) {
      if(ioctl(fd, CDROMEJECT, NULL))
	TRACE(TRACE_ERROR, "DVD", "Eject of %s failed -- %s",
	      url, strerror(errno));
      close(fd);
    } else {
      TRACE(TRACE_ERROR, "DVD", "Unable to open %s for eject -- %s",
	    url, strerror(errno));
    }
  }
  return e;
}
コード例 #3
0
ファイル: linux_dvd.c プロジェクト: Cy-4AH/showtime
static event_t *
be_dvd_play(const char *url, media_pipe_t *mp,
	    char *errstr, size_t errlen,
	    struct video_queue *vq,
	    struct vsource_list *vsl,
	    const video_args_t *va)
{
  event_t *e;
  if(strncmp(url, "dvd:", strlen("dvd:"))) {
    snprintf(errstr, errlen, "dvd: Invalid URL");
    return NULL;
  }

  url += 4;

  mp_set_url(mp, va->canonical_url, va->parent_url, va->parent_title);

  e = dvd_play(url, mp, errstr, errlen, 0);

  if(e != NULL && event_is_action(e, ACTION_EJECT)) {

    int fd = open(url, O_RDONLY | O_NONBLOCK);
    if(fd != -1) {
      if(ioctl(fd, CDROMEJECT, NULL))
	TRACE(TRACE_ERROR, "DVD", "Eject of %s failed -- %s",
	      url, strerror(errno));
      close(fd);
    } else {
      TRACE(TRACE_ERROR, "DVD", "Unable to open %s for eject -- %s",
	    url, strerror(errno));
    }
  }
  return e;
}