1 /* 2 SPDX-FileCopyrightText: 2003 Christian Kvasny <chris@k3b.org> 3 SPDX-FileCopyrightText: 2010 Michal Malek <michalm@jabster.pl> 4 SPDX-FileCopyrightText: 1998-2010 Sebastian Trueg <trueg@k3b.org> 5 6 SPDX-License-Identifier: GPL-2.0-or-later 7 */ 8 9 10 #ifndef K3BVIDEOCDINFO_H 11 #define K3BVIDEOCDINFO_H 12 13 #include <QList> 14 #include <QObject> 15 #include <QProcess> 16 #include <QString> 17 18 namespace K3b { 19 20 class Process; 21 22 class VideoCdInfoResultEntry 23 { 24 public: VideoCdInfoResultEntry()25 VideoCdInfoResultEntry() : name(), id() 26 {} 27 VideoCdInfoResultEntry(const QString & name,const QString & id)28 VideoCdInfoResultEntry( const QString& name, const QString& id ) 29 : name( name ), id( id ) 30 {} 31 32 QString name; 33 QString id; 34 35 long size; 36 }; 37 38 class VideoCdInfoResult 39 { 40 public: VideoCdInfoResult()41 VideoCdInfoResult() 42 {} 43 44 enum type {NONE = 0, FILE, SEGMENT, SEQUENCE}; 45 46 void addEntry( const VideoCdInfoResultEntry& = VideoCdInfoResultEntry(), int type = VideoCdInfoResult::SEQUENCE ); 47 const VideoCdInfoResultEntry& entry( int number = 0 , int type = VideoCdInfoResult::SEQUENCE ) const; 48 int foundEntries( int type = VideoCdInfoResult::SEQUENCE ) const; 49 50 QString volumeId; 51 QString type; 52 QString version; 53 54 QString xmlData; 55 56 private: 57 QList<VideoCdInfoResultEntry> m_fileEntry; 58 QList<VideoCdInfoResultEntry> m_segmentEntry; 59 QList<VideoCdInfoResultEntry> m_sequenceEntry; 60 61 VideoCdInfoResultEntry m_emptyEntry; 62 }; 63 64 class VideoCdInfo : public QObject 65 { 66 Q_OBJECT 67 68 public: 69 explicit VideoCdInfo( QObject* parent = 0 ); 70 ~VideoCdInfo() override; 71 72 /** 73 * Do NOT call this before queryResult has 74 * been emitted 75 */ 76 const VideoCdInfoResult& result() const; 77 78 void info( const QString& ); 79 80 Q_SIGNALS: 81 void infoFinished( bool success ); 82 83 private Q_SLOTS: 84 void slotInfoFinished( int exitCode, QProcess::ExitStatus exitStatus ); 85 void slotParseOutput( const QString& inp ); 86 87 private: 88 void cancelAll(); 89 90 VideoCdInfoResult m_Result; 91 void parseXmlData(); 92 93 Process* m_process; 94 95 QString m_xmlData; 96 bool m_isXml; 97 98 }; 99 100 } // namespace K3b 101 102 #endif 103