File indexing completed on 2025-04-27 07:40:58
0001 /* 0002 SPDX-FileCopyrightText: 2004-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_LIBDVDCSS_H_ 0009 #define _K3B_LIBDVDCSS_H_ 0010 0011 #include "k3b_export.h" 0012 0013 namespace K3b { 0014 namespace Device { 0015 class Device; 0016 } 0017 0018 0019 /** 0020 * Wrapper class for libdvdcss. dynamically opens the library if it 0021 * is available on the system. 0022 */ 0023 class LIBK3B_EXPORT LibDvdCss 0024 { 0025 public: 0026 ~LibDvdCss(); 0027 0028 static const int DVDCSS_BLOCK_SIZE = 2048; 0029 static const int DVDCSS_NOFLAGS = 0; 0030 static const int DVDCSS_READ_DECRYPT = (1 << 0); 0031 static const int DVDCSS_SEEK_MPEG = (1 << 0); 0032 static const int DVDCSS_SEEK_KEY = (1 << 1); 0033 0034 /** 0035 * Try to open a Video DVD and authenticate it. 0036 * @return true if the Video DVD could be authenticated successfully, false otherwise. 0037 */ 0038 bool open( Device::Device* dev ); 0039 void close(); 0040 0041 int seek( int sector, int flags ); 0042 int read( void* buffer, int sectors, int flags ); 0043 0044 /** 0045 * This method optimized the seek calls to maximize reading performance. 0046 * It also makes sure we never read unscrambled and scrambled data at the same time. 0047 * 0048 * You have to call crackAllKeys() before using this. Do never call this in combination 0049 * with seek or read! 0050 */ 0051 int readWrapped( void* buffer, int firstSector, int sectors ); 0052 0053 /** 0054 * Cache all CSS keys to guarantee smooth reading further on. 0055 * This method also creates a title offset list which is needed by readWrapped. 0056 */ 0057 bool crackAllKeys(); 0058 0059 /** 0060 * returns 0 if the libdvdcss could not 0061 * be found on the system. 0062 * Otherwise you have to take care of 0063 * deleting. 0064 */ 0065 static LibDvdCss* create(); 0066 0067 private: 0068 class Private; 0069 Private* d; 0070 0071 LibDvdCss(); 0072 }; 0073 } 0074 0075 #endif