Commit 6e53d5fc authored by Petri Hintukainen's avatar Petri Hintukainen

Move _disc_have_file() do dec.c

parent a3fe13c3
......@@ -27,9 +27,10 @@
#include "aacs.h"
#include "bdplus.h"
#include "file/file.h"
#include "util/logging.h"
#include "util/macro.h"
#include "file/file.h"
#include "util/strutl.h"
#include <string.h>
......@@ -146,6 +147,28 @@ BD_FILE_H *dec_open_stream(BD_DEC *dec, BD_FILE_H *fp, uint32_t clip_id)
*
*/
/*
*
*/
static int _bdrom_have_file(void *p, const char *dir, const char *file)
{
struct dec_dev *dev = (struct dec_dev *)p;
BD_FILE_H *fp;
char *path;
path = str_printf("%s" DIR_SEP "%s", dir, file);
fp = dev->pf_file_open_bdrom(dev->file_open_handle, path);
X_FREE(path);
if (fp) {
file_close(fp);
return 1;
}
return 0;
}
static int _libaacs_init(BD_DEC *dec, struct dec_dev *dev,
BD_ENC_INFO *i, const char *keyfile_path)
{
......@@ -154,7 +177,7 @@ static int _libaacs_init(BD_DEC *dec, struct dec_dev *dev,
libaacs_unload(&dec->aacs);
i->aacs_detected = libaacs_required(dev->file_open_handle, dev->pf_file_exists_bdrom);
i->aacs_detected = libaacs_required((void*)dev, _bdrom_have_file);
if (!i->aacs_detected) {
/* no AACS */
return 1; /* no error if libaacs is not needed */
......@@ -193,7 +216,7 @@ static int _libbdplus_init(BD_DEC *dec, struct dec_dev *dev,
{
libbdplus_unload(&dec->bdplus);
i->bdplus_detected = libbdplus_required(dev->file_open_handle, dev->pf_file_exists_bdrom);
i->bdplus_detected = libbdplus_required((void*)dev, _bdrom_have_file);
if (!i->bdplus_detected) {
return 0;
}
......
......@@ -32,12 +32,10 @@ struct bd_file_s;
struct bd_enc_info;
typedef struct bd_file_s * (*file_openFp)(void *, const char *);
typedef int (*have_fileFp)(void *, const char *, const char *);
/* device to use */
struct dec_dev {
void *file_open_handle;
have_fileFp pf_file_exists_bdrom;
file_openFp pf_file_open_bdrom;
file_openFp pf_file_open_vfs;
const char *root; /* may be NULL if disc is not mounted */
......
......@@ -61,24 +61,6 @@ static BD_FILE_H *_bdrom_open_path(void *p, const char *rel_path)
return fp;
}
static int _bdrom_have_file(void *p, const char *dir, const char *file)
{
BD_FILE_H *fp;
char *path;
path = str_printf("%s" DIR_SEP "%s", dir, file);
fp = _bdrom_open_path(p, path);
X_FREE(path);
if (fp) {
file_close(fp);
return 1;
}
return 0;
}
static BD_DIR_H *_bdrom_open_dir(BD_DISC *p, const char *dir)
{
BD_DIR_H *dp;
......@@ -231,7 +213,7 @@ BD_DISC *disc_open(const char *device_path,
bd_mutex_init(&p->ovl_mutex);
struct dec_dev dev = { p, _bdrom_have_file, _bdrom_open_path, (file_openFp)disc_open_path, p->disc_root, p->disc_device };
struct dec_dev dev = { p, _bdrom_open_path, (file_openFp)disc_open_path, p->disc_root, p->disc_device };
p->dec = dec_init(&dev, enc_info, keyfile_path, regs, psr_read, psr_write);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment