1 /*
2     SPDX-FileCopyrightText: 2006-2009 Sebastian Trueg <trueg@k3b.org>
3     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
4 
5     SPDX-License-Identifier: GPL-2.0-or-later
6 */
7 
8 #ifndef _K3B_VIDEODVD_H_
9 #define _K3B_VIDEODVD_H_
10 
11 #include "k3bvideodvdtitle.h"
12 
13 #include "k3b_export.h"
14 
15 #include <QString>
16 #include <QVector>
17 
18 
19 namespace K3b {
20     namespace Device {
21         class Device;
22     }
23 
24     /**
25      * The VideoDVD classes do not provide a complete playback frontend to
26      * libdvdread but are merely intended for Video DVD analysis.
27      *
28      * They are title based and thus treat a Video DVD to be a set of titles.
29      * Additional Video DVD constructs such as title sets, parts of titles (chapters),
30      * program chains, or cells are not handled explicitly.
31      *
32      * The usage is very simple. One creates a VideoDVD instance and calls the open()
33      * method with a device containing a Video DVD. If the method returns true the
34      * analysis was successful and the structures are filled.
35      *
36      * After open() has returned the device has already been closed.
37      */
38     namespace VideoDVD
39     {
40         /**
41          * libdvdread wrapper class
42          */
43         class LIBK3B_EXPORT VideoDVD
44         {
45         public:
46             VideoDVD();
47             ~VideoDVD();
48 
49             /**
50              * \return true if a Video DVD was successfully opened via open()
51              */
52             bool valid() const;
53 
54             /**
55              * Open a video dvd and parse it's contents. The device will be closed after this
56              * method returns, regardless of it's success.
57              */
58             bool open( Device::Device* dev );
59 
device()60             Device::Device* device() const { return m_device; }
volumeIdentifier()61             const QString& volumeIdentifier() const { return m_volumeIdentifier; }
numTitles()62             unsigned int numTitles() const { return m_titles.count(); }
63 
64             /**
65              * Get a title from the Video DVD. Index starts at 0.
66              */
67             const Title& title( unsigned int num ) const;
68             const Title& operator[]( unsigned int num ) const;
69 
70             void debug() const;
71 
72         private:
73             Device::Device* m_device;
74             QVector<Title> m_titles;
75             QString m_volumeIdentifier;
76         };
77 
78         LIBK3B_EXPORT QString audioFormatString( int format );
79         LIBK3B_EXPORT QString audioCodeExtensionString( int ext );
80         LIBK3B_EXPORT QString subPictureCodeModeString( int mode );
81         LIBK3B_EXPORT QString subPictureCodeExtensionString( int ext );
82     }
83 }
84 
85 #endif
86