File indexing completed on 2024-04-28 04:50:22
0001 /* 0002 SPDX-FileCopyrightText: 2003 Christian Kvasny <chris@k3b.org> 0003 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 0004 SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-or-later 0007 */ 0008 0009 0010 #ifndef K3BVIDEOCDINFO_H 0011 #define K3BVIDEOCDINFO_H 0012 0013 #include <QList> 0014 #include <QObject> 0015 #include <QProcess> 0016 #include <QString> 0017 0018 namespace K3b { 0019 0020 class Process; 0021 0022 class VideoCdInfoResultEntry 0023 { 0024 public: 0025 VideoCdInfoResultEntry() : name(), id() 0026 {} 0027 0028 VideoCdInfoResultEntry( const QString& name, const QString& id ) 0029 : name( name ), id( id ) 0030 {} 0031 0032 QString name; 0033 QString id; 0034 0035 long size; 0036 }; 0037 0038 class VideoCdInfoResult 0039 { 0040 public: 0041 VideoCdInfoResult() 0042 {} 0043 0044 enum type {NONE = 0, FILE, SEGMENT, SEQUENCE}; 0045 0046 void addEntry( const VideoCdInfoResultEntry& = VideoCdInfoResultEntry(), int type = VideoCdInfoResult::SEQUENCE ); 0047 const VideoCdInfoResultEntry& entry( int number = 0 , int type = VideoCdInfoResult::SEQUENCE ) const; 0048 int foundEntries( int type = VideoCdInfoResult::SEQUENCE ) const; 0049 0050 QString volumeId; 0051 QString type; 0052 QString version; 0053 0054 QString xmlData; 0055 0056 private: 0057 QList<VideoCdInfoResultEntry> m_fileEntry; 0058 QList<VideoCdInfoResultEntry> m_segmentEntry; 0059 QList<VideoCdInfoResultEntry> m_sequenceEntry; 0060 0061 VideoCdInfoResultEntry m_emptyEntry; 0062 }; 0063 0064 class VideoCdInfo : public QObject 0065 { 0066 Q_OBJECT 0067 0068 public: 0069 explicit VideoCdInfo( QObject* parent = 0 ); 0070 ~VideoCdInfo() override; 0071 0072 /** 0073 * Do NOT call this before queryResult has 0074 * been emitted 0075 */ 0076 const VideoCdInfoResult& result() const; 0077 0078 void info( const QString& ); 0079 0080 Q_SIGNALS: 0081 void infoFinished( bool success ); 0082 0083 private Q_SLOTS: 0084 void slotInfoFinished( int exitCode, QProcess::ExitStatus exitStatus ); 0085 void slotParseOutput( const QString& inp ); 0086 0087 private: 0088 void cancelAll(); 0089 0090 VideoCdInfoResult m_Result; 0091 void parseXmlData(); 0092 0093 Process* m_process; 0094 0095 QString m_xmlData; 0096 bool m_isXml; 0097 0098 }; 0099 0100 } // namespace K3b 0101 0102 #endif