3#include "libmythbase/mythconfig.h"
16#include <libbluray/filesystem.h>
18#include "file/filesystem.h"
21#define LOC QString("BDIOWrapper: ")
30 MythDirClose(
static_cast<int>(
reinterpret_cast<intptr_t
>(Dir->internal)));
31 LOG(VB_FILE, LOG_DEBUG,
LOC +
"Closed mythdir dir");
38 std::string
filename =
MythDirRead(
static_cast<int>(
reinterpret_cast<intptr_t
>(Dir->internal)));
41 Entry->d_name[255] =
'\0';
42 strncpy(Entry->d_name,
filename.c_str(), 255);
51 if ((strncmp(DirName,
"myth://", 7) != 0) && (
sDefaultDirOpen !=
nullptr))
59 auto *dir =
new BD_DIR_H;
61 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Opening mythdir '%1'").arg(DirName));
69 dir->internal =
reinterpret_cast<void*
>(
static_cast<intptr_t
>(dirID));
73 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Error opening dir '%1'").arg(DirName));
83 MythfileClose(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)));
84 LOG(VB_FILE, LOG_DEBUG,
LOC +
"Closed mythfile file");
89static int64_t
MythBDFileSeek(BD_FILE_H *File, int64_t Offset, int32_t Origin)
91 return MythFileSeek(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)), Offset, Origin);
96 return MythFileTell(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)));
101 return MythFileRead(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)),
102 Buffer,
static_cast<size_t>(Size));
107 return MythFileWrite(
static_cast<int>(
reinterpret_cast<intptr_t
>(File->internal)),
108 reinterpret_cast<void*
>(
const_cast<uint8_t*
>(
Buffer)),
109 static_cast<size_t>(Size));
114 if ((strncmp(FileName,
"myth://", 7) != 0) && (
sDefaultFileOpen !=
nullptr))
122 auto *
file =
new BD_FILE_H;
124 LOG(VB_FILE, LOG_DEBUG,
LOC + QString(
"Opening mythfile file '%1'").arg(FileName));
132 int intMode = O_RDONLY;
133 if (strcasecmp(CMode,
"wb") == 0)
140 file->internal =
reinterpret_cast<void*
>(
static_cast<intptr_t
>(fd));
144 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
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)
std::string MythDirRead(int DirID)
ssize_t MythFileWrite(int FileID, void *Buffer, size_t Count)
off_t MythFileTell(int FileID)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)