14#include <libbluray/filesystem.h>
16#include "file/filesystem.h"
19#define LOC QString("BDIOWrapper: ")
28 MythDirClose(
static_cast<int>(
reinterpret_cast<intptr_t
>(Dir->internal)));
29 LOG(VB_FILE, LOG_DEBUG,
LOC +
"Closed mythdir dir");
39 Entry->d_name[255] =
'\0';
40 strncpy(Entry->d_name,
filename, 255);
50 if ((strncmp(DirName,
"myth://", 7) != 0) && (
sDefaultDirOpen !=
nullptr))
57 auto *dir =
static_cast<BD_DIR_H*
>(calloc(1,
sizeof(BD_DIR_H)));
59 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Opening mythdir '%1'").arg(DirName));
67 dir->internal =
reinterpret_cast<void*
>(
static_cast<intptr_t
>(dirID));
71 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Error opening dir '%1'").arg(DirName));
81 MythfileClose(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)));
82 LOG(VB_FILE, LOG_DEBUG,
LOC +
"Closed mythfile file");
87static int64_t
MythBDFileSeek(BD_FILE_H *File, int64_t Offset, int32_t Origin)
89 return MythFileSeek(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)), Offset, Origin);
94 return MythFileTell(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)));
99 return MythFileRead(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)),
100 Buffer,
static_cast<size_t>(Size));
105 return MythFileWrite(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)),
106 reinterpret_cast<void*
>(
const_cast<uint8_t*
>(
Buffer)),
107 static_cast<size_t>(Size));
112 if ((strncmp(FileName,
"myth://", 7) != 0) && (
sDefaultFileOpen !=
nullptr))
119 auto *
file =
static_cast<BD_FILE_H*
>(calloc(1,
sizeof(BD_FILE_H)));
121 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Opening mythfile file '%1'").arg(FileName));
129 int intMode = O_RDONLY;
130 if (strcasecmp(CMode,
"wb") == 0)
137 file->internal =
reinterpret_cast<void*
>(
static_cast<intptr_t
>(fd));
141 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Error opening file '%1'").arg(FileName));
static int64_t MythBDFileWrite(BD_FILE_H *File, const uint8_t *Buffer, int64_t Size)
static int64_t MythBDFileRead(BD_FILE_H *File, uint8_t *Buffer, int64_t Size)
static void MythBDDirClose(BD_DIR_H *Dir)
static BD_FILE_OPEN sDefaultFileOpen
static int MythBDDirRead(BD_DIR_H *Dir, BD_DIRENT *Entry)
void MythBDIORedirect(void)
static BD_DIR_H * MythBDDirOpen(const char *DirName)
static int64_t MythBDFileSeek(BD_FILE_H *File, int64_t Offset, int32_t Origin)
static int64_t MythBDFileTell(BD_FILE_H *File)
static void MythBDFileClose(BD_FILE_H *File)
static BD_FILE_H * MythBDFileOpen(const char *FileName, const char *CMode)
static BD_DIR_OPEN sDefaultDirOpen
char * MythDirRead(int DirID)
int MythDirClose(int DirID)
ssize_t MythFileRead(int FileID, void *Buffer, size_t Count)
int MythDirOpen(const char *DirName)
off_t MythFileSeek(int FileID, off_t Offset, int Whence)
int MythfileClose(int FileID)
int MythFileOpen(const char *Pathname, int Flags)
ssize_t MythFileWrite(int FileID, void *Buffer, size_t Count)
off_t MythFileTell(int FileID)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)