File indexing completed on 2024-04-28 04:49:52
0001 /* 0002 SPDX-FileCopyrightText: 2005-2009 Sebastian Trueg <trueg@k3b.org> 0003 SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org> 0004 0005 SPDX-License-Identifier: GPL-2.0-or-later 0006 */ 0007 0008 #ifndef _K3B_ISO9660_BACKEND_H_ 0009 #define _K3B_ISO9660_BACKEND_H_ 0010 0011 #include "k3b_export.h" 0012 0013 #include <QString> 0014 0015 namespace K3b { 0016 namespace Device { 0017 class Device; 0018 } 0019 0020 class LibDvdCss; 0021 0022 class LIBK3B_EXPORT Iso9660Backend 0023 { 0024 public: 0025 Iso9660Backend() {} 0026 virtual ~Iso9660Backend() {} 0027 0028 virtual bool open() = 0; 0029 virtual void close() = 0; 0030 virtual bool isOpen() const = 0; 0031 virtual int read( unsigned int sector, char* data, int len ) = 0; 0032 }; 0033 0034 class LIBK3B_EXPORT Iso9660DeviceBackend : public Iso9660Backend 0035 { 0036 public: 0037 explicit Iso9660DeviceBackend( Device::Device* dev ); 0038 ~Iso9660DeviceBackend() override; 0039 0040 bool open() override; 0041 void close() override; 0042 bool isOpen() const override { return m_isOpen; } 0043 int read( unsigned int sector, char* data, int len ) override; 0044 0045 private: 0046 Device::Device* m_device; 0047 bool m_isOpen; 0048 }; 0049 0050 class LIBK3B_EXPORT Iso9660FileBackend : public Iso9660Backend 0051 { 0052 public: 0053 explicit Iso9660FileBackend( const QString& filename ); 0054 explicit Iso9660FileBackend( int fd ); 0055 ~Iso9660FileBackend() override; 0056 0057 bool open() override; 0058 void close() override; 0059 bool isOpen() const override; 0060 int read( unsigned int sector, char* data, int len ) override; 0061 0062 private: 0063 QString m_filename; 0064 int m_fd; 0065 bool m_closeFd; 0066 }; 0067 0068 class LIBK3B_EXPORT Iso9660LibDvdCssBackend : public Iso9660Backend 0069 { 0070 public: 0071 explicit Iso9660LibDvdCssBackend( Device::Device* ); 0072 ~Iso9660LibDvdCssBackend() override; 0073 0074 bool open() override; 0075 void close() override; 0076 bool isOpen() const override; 0077 int read( unsigned int sector, char* data, int len ) override; 0078 0079 private: 0080 Device::Device* m_device; 0081 LibDvdCss* m_libDvdCss; 0082 }; 0083 } 0084 0085 #endif