[libbluray-devel] Move _disc_have_file() do dec.c

hpi1 git at videolan.org
Fri Feb 6 14:17:23 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Fri Feb  6 10:12:53 2015 +0200| [6e53d5fc8208978825267f665782e677dc14ac30] | committer: hpi1

Move _disc_have_file() do dec.c

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=6e53d5fc8208978825267f665782e677dc14ac30
---

 src/libbluray/disc/dec.c  |   29 ++++++++++++++++++++++++++---
 src/libbluray/disc/dec.h  |    2 --
 src/libbluray/disc/disc.c |   20 +-------------------
 3 files changed, 27 insertions(+), 24 deletions(-)

diff --git a/src/libbluray/disc/dec.c b/src/libbluray/disc/dec.c
index 7a72519..75878ba 100644
--- a/src/libbluray/disc/dec.c
+++ b/src/libbluray/disc/dec.c
@@ -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;
     }
diff --git a/src/libbluray/disc/dec.h b/src/libbluray/disc/dec.h
index 8585b03..961c9c9 100644
--- a/src/libbluray/disc/dec.h
+++ b/src/libbluray/disc/dec.h
@@ -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 */
diff --git a/src/libbluray/disc/disc.c b/src/libbluray/disc/disc.c
index 9b36bea..97e0f69 100644
--- a/src/libbluray/disc/disc.c
+++ b/src/libbluray/disc/disc.c
@@ -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);
     }
 



More information about the libbluray-devel mailing list