Пример #1
0
/**
 * initialize and open a DVD (device or file or stream_cb)
 */
static dvd_input_t css_open(const char *target,
                            void *stream, dvd_reader_stream_cb *stream_cb)
{
  dvd_input_t dev;

  /* Allocate the handle structure */
  dev = malloc(sizeof(*dev));
  if(dev == NULL) {
    fprintf(stderr, "libdvdread: Could not allocate memory.\n");
    return NULL;
  }

  /* Really open it with libdvdcss */
  if(target)
      dev->dvdcss = DVDcss_open(target);
  else if(stream && stream_cb) {
#ifdef HAVE_DVDCSS_DVDCSS_H
      dev->dvdcss = DVDcss_open_stream(stream, (dvdcss_stream_cb *)stream_cb);
#else
      dev->dvdcss = DVDcss_open_stream ?
                    DVDcss_open_stream(stream, (dvdcss_stream_cb *)stream_cb) :
                    NULL;
#endif
  }
  if(dev->dvdcss == 0) {
    fprintf(stderr, "libdvdread: Could not open %s with libdvdcss.\n", target);
    free(dev);
    return NULL;
  }

  return dev;
}
Пример #2
0
/**
 * initialize and open a DVD device or file.
 */
static dvd_input_t css_open(const char *target)
{
    dvd_input_t dev;

    /* Allocate the handle structure */
    dev = (dvd_input_t) malloc(sizeof(struct dvd_input_s));
    if(dev == NULL) {
        /* malloc has set errno to ENOMEM */
        return NULL;
    }

    /* Really open it with libdvdcss */
    dev->dvdcss = DVDcss_open(target);
    if(dev->dvdcss == 0) {
        free(dev);
        dev = NULL;
    }

    return dev;
}
Пример #3
0
/**
 * initialize and open a DVD device or file.
 */
static dvd_input_t css_open(const char *target)
{
  dvd_input_t dev;

  /* Allocate the handle structure */
  dev = (dvd_input_t) malloc(sizeof(*dev));
  if(dev == NULL) {
    fprintf(stderr, "libdvdread: Could not allocate memory.\n");
    return NULL;
  }

  /* Really open it with libdvdcss */
  dev->dvdcss = DVDcss_open(target);
  if(dev->dvdcss == 0) {
    fprintf(stderr, "libdvdread: Could not open %s with libdvdcss.\n", target);
    free(dev);
    return NULL;
  }

  return dev;
}