MythTV  master
Classes | Macros | Functions | Variables
mythiowrapper.cpp File Reference
#include <QFile>
#include <QMap>
#include <QUrl>
#include <QReadWriteLock>
#include "mythconfig.h"
#include "compat.h"
#include "mythcorecontext.h"
#include "mythlogging.h"
#include "remotefile.h"
#include "io/mythmediabuffer.h"
#include "mythiowrapper.h"
#include <windows.h>
#include <cstdio>
#include <dirent.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
Include dependency graph for mythiowrapper.cpp:

Go to the source code of this file.

Classes

class  MythIOCallback
 

Macros

#define LOC   QString("MythIOWrap: ")
 
#define lseek   _lseeki64
 
#define off_t   off64_t
 

Functions

static int GetNextFileID (void)
 
void MythFileOpenRegisterCallback (const char *Pathname, void *Object, callback_t Func)
 
int MythFileCheck (int Id)
 
int MythFileOpen (const char *Pathname, int Flags)
 
int MythfileClose (int FileID)
 
off_t MythFileSeek (int FileID, off_t Offset, int Whence)
 
off_t MythFileTell (int FileID)
 
ssize_t MythFileRead (int FileID, void *Buffer, size_t Count)
 
ssize_t MythFileWrite (int FileID, void *Buffer, size_t Count)
 
int MythFileStat (const char *Path, struct stat *Buf)
 
int MythFileStatFD (int FileID, struct stat *Buf)
 
int MythFileExists (const char *Path, const char *File)
 
static int GetNextDirID (void)
 
int MythDirCheck (int DirID)
 
int MythDirOpen (const char *DirName)
 
int MythDirClose (int DirID)
 
char * MythDirRead (int DirID)
 

Variables

static const int s_maxID = 1024 * 1024
 
static QReadWriteLock s_fileWrapperLock
 
static QHash< int, MythMediaBuffer * > s_buffers
 
static QHash< int, RemoteFile * > s_remotefiles
 
static QHash< int, int > s_localfiles
 
static QHash< int, QString > s_filenames
 
static QReadWriteLock s_dirWrapperLock
 
static QHash< int, QStringList > s_remotedirs
 
static QHash< int, int > s_remotedirPositions
 
static QHash< int, QString > s_dirnames
 
static QHash< int, DIR * > s_localdirs
 
static QMutex s_callbackLock
 
static QMultiHash< QString, MythIOCallbacks_fileOpenCallbacks
 

Macro Definition Documentation

◆ LOC

#define LOC   QString("MythIOWrap: ")

Definition at line 59 of file mythiowrapper.cpp.

◆ lseek

#define lseek   _lseeki64

Definition at line 236 of file mythiowrapper.cpp.

◆ off_t

#define off_t   off64_t

Definition at line 238 of file mythiowrapper.cpp.

Function Documentation

◆ GetNextFileID()

static int GetNextFileID ( void  )
static

Definition at line 63 of file mythiowrapper.cpp.

Referenced by MythFileOpen().

◆ MythFileOpenRegisterCallback()

void MythFileOpenRegisterCallback ( const char *  Pathname,
void *  Object,
callback_t  Func 
)

Definition at line 78 of file mythiowrapper.cpp.

Referenced by MythBDBuffer::OpenFile().

◆ MythFileCheck()

int MythFileCheck ( int  Id)

Definition at line 105 of file mythiowrapper.cpp.

◆ MythFileOpen()

int MythFileOpen ( const char *  Pathname,
int  Flags 
)

◆ MythfileClose()

int MythfileClose ( int  FileID)

◆ MythFileSeek()

off_t MythFileSeek ( int  FileID,
off_t  Offset,
int  Whence 
)

Definition at line 240 of file mythiowrapper.cpp.

Referenced by BDRead(), MythBDFileSeek(), and MythBDInfo::MythBDInfo().

◆ MythFileTell()

off_t MythFileTell ( int  FileID)

Definition at line 259 of file mythiowrapper.cpp.

Referenced by MythBDFileTell().

◆ MythFileRead()

ssize_t MythFileRead ( int  FileID,
void *  Buffer,
size_t  Count 
)

◆ MythFileWrite()

ssize_t MythFileWrite ( int  FileID,
void *  Buffer,
size_t  Count 
)

Definition at line 301 of file mythiowrapper.cpp.

Referenced by MythBDFileWrite().

◆ MythFileStat()

int MythFileStat ( const char *  Path,
struct stat *  Buf 
)

◆ MythFileStatFD()

int MythFileStatFD ( int  FileID,
struct stat *  Buf 
)

Definition at line 335 of file mythiowrapper.cpp.

◆ MythFileExists()

int MythFileExists ( const char *  Path,
const char *  File 
)

Definition at line 356 of file mythiowrapper.cpp.

◆ GetNextDirID()

static int GetNextDirID ( void  )
static

Definition at line 369 of file mythiowrapper.cpp.

Referenced by MythDirOpen().

◆ MythDirCheck()

int MythDirCheck ( int  DirID)

Definition at line 383 of file mythiowrapper.cpp.

◆ MythDirOpen()

int MythDirOpen ( const char *  DirName)

Definition at line 392 of file mythiowrapper.cpp.

Referenced by MythBDDirOpen().

◆ MythDirClose()

int MythDirClose ( int  DirID)

Definition at line 444 of file mythiowrapper.cpp.

Referenced by MythBDDirClose().

◆ MythDirRead()

char* MythDirRead ( int  DirID)

Definition at line 467 of file mythiowrapper.cpp.

Referenced by MythBDDirRead().

Variable Documentation

◆ s_maxID

const int s_maxID = 1024 * 1024
static

Definition at line 42 of file mythiowrapper.cpp.

Referenced by GetNextDirID(), and GetNextFileID().

◆ s_fileWrapperLock

QReadWriteLock s_fileWrapperLock
static

◆ s_buffers

QHash<int, MythMediaBuffer*> s_buffers
static

◆ s_remotefiles

QHash<int, RemoteFile*> s_remotefiles
static

◆ s_localfiles

QHash<int, int> s_localfiles
static

◆ s_filenames

QHash<int, QString> s_filenames
static

Definition at line 48 of file mythiowrapper.cpp.

Referenced by MythFileOpen(), and MythFileStatFD().

◆ s_dirWrapperLock

QReadWriteLock s_dirWrapperLock
static

Definition at line 50 of file mythiowrapper.cpp.

Referenced by MythDirCheck(), MythDirClose(), MythDirOpen(), and MythDirRead().

◆ s_remotedirs

QHash<int, QStringList> s_remotedirs
static

Definition at line 51 of file mythiowrapper.cpp.

Referenced by GetNextDirID(), MythDirCheck(), MythDirClose(), MythDirOpen(), and MythDirRead().

◆ s_remotedirPositions

QHash<int, int> s_remotedirPositions
static

Definition at line 52 of file mythiowrapper.cpp.

Referenced by MythDirClose(), MythDirOpen(), and MythDirRead().

◆ s_dirnames

QHash<int, QString> s_dirnames
static

Definition at line 53 of file mythiowrapper.cpp.

Referenced by MythDirOpen().

◆ s_localdirs

QHash<int, DIR*> s_localdirs
static

Definition at line 54 of file mythiowrapper.cpp.

Referenced by GetNextDirID(), MythDirCheck(), MythDirClose(), MythDirOpen(), and MythDirRead().

◆ s_callbackLock

QMutex s_callbackLock
static

Definition at line 56 of file mythiowrapper.cpp.

Referenced by MythFileOpen(), and MythFileOpenRegisterCallback().

◆ s_fileOpenCallbacks

QMultiHash<QString, MythIOCallback> s_fileOpenCallbacks
static

Definition at line 57 of file mythiowrapper.cpp.

Referenced by MythFileOpen(), and MythFileOpenRegisterCallback().