summaryrefslogtreecommitdiffstats
path: root/libk9copy/k9dvd.h
blob: e8c7d2e7136e9077e7546b1293843a02f79c20e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/**************************************************************************
*   Copyright (C) 2005 by Jean-Michel Petit                               *
*   jm_petit@laposte.net                                                  *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
*                                                                         *
*   This program is distributed in the hope that it will be useful,       *
*   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
*   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
*   GNU General Public License for more details.                          *
*                                                                         *
*   You should have received a copy of the GNU General Public License     *
*   along with this program; if not, write to the                         *
*   Free Software Foundation, Inc.,                                       *
*   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.             *
***************************************************************************/
#ifndef K9DVD_H
#define K9DVD_H
#include "k9common.h"
#include "k9dvdread.h"
#include <tqstringlist.h>
#include <tqdatetime.h>
#include <tqvaluelist.h>


struct streamSize {
   unsigned char id;
   float size_mb;
   float percent;
};

struct stream_counter {
   unsigned char id;
   int count;
   float size_mb;
   float percent;
};

class k9DVDProgress;
class k9DVDChapter;
class k9DVDTitle;
class k9DVDTitleset;

/** get the DVD structure with titles lengths and streams lengths.
  *@author 
  */

class k9DVD : public TQObject  {
Q_OBJECT
TQ_OBJECT
private:
  TQObjectList m_titles;
  TQPtrList<k9DVDTitleset> m_titlesets;
  TQString m_title;
  int m_titleCount;
  k9DVDTitle *m_longestTitle;
  TQStringList m_lvideoFormat;
  TQStringList m_laspectRatio;
  TQStringList m_lquantization;
  TQStringList m_lmpegVersion;
  TQStringList m_lvideoHeight;
  TQStringList m_lvideoWidth;
  TQStringList m_lpermittedDf;
  TQStringList m_laudioFormat;
  TQStringList m_lsampleFreq;
  TQStringList m_laudioType;
  TQStringList m_lsubpType;
  TQStringList m_langCode;
  TQStringList m_langName;
  double m_frames_per_s[4];
  uint m_menuSize;
  k9DVDProgress *m_progressDlg; 
  TQString m_Device;
  bool m_error;
  TQString m_errMsg;
  bool m_opened;
  TQString m_format;
  k9DVDTitle* m_start;
  int m_titlesetCount;
public: 
  k9DVD(TQObject  *parent=0,const char *name=0,const TQStringList args=0) ;
  ~k9DVD();

  /**
   * Opens and estimates the size of each stream
   * @param device input device
   * @return return code (0=ok)
   */
  virtual int scandvd (const TQString & device,bool _quickScan);
 
  /**
   * gets the title of the DVD
   * @return DVD title
   */
  virtual const TQString& getDVDTitle();
  
  /**
   * set the title of the DVD 
   * @param _newVal the new DVD title
   */
  virtual void setDVDTitle(const TQString &_newVal);
  
  /**
   * 
   * @return returns the number of titles
   */
  virtual const int& gettitleCount();

  /**
   * 
   * @return returns the number of titlesets
   */
  virtual const int& gettitlesetCount();


  /**
   * returns a title of the DVD
   * @param num the title number
   * @return the title
   */
  virtual k9DVDTitle* gettitle(int num);
  
  /**
   * returns a title (which is in tt_srpt)  
   * @param num the title number 
   * @return the title
   */
  virtual k9DVDTitle* gettitleByNum(int num);
  virtual k9DVDTitle *getlongestTitle();
  virtual float getfactor(bool withMenus,bool _streams,bool _useDvdAuthor);
  virtual const TQString& getDevice();
  virtual const bool& geterror();
  virtual const TQString& geterrMsg();
  virtual const bool& getopened();
  virtual uint64_t getsizeSelected(bool _streams);
  virtual TQString &getFormat();
  virtual k9DVDTitle* getstart();
  virtual void setstart(k9DVDTitle* title);
  virtual int getnewTitleNum(k9DVDTitle *title);
  virtual int getmenuSize();
  virtual void close();
  virtual k9DVDTitleset *gettitleset(int num);
  virtual k9DVDRead * getdvd() {return &m_dvd;}
  static TQString lang_name(const TQString & code,const TQString & name);
private: // Private methods
  k9DVDRead  m_dvd;
  k9DVDTitle* addTitle(k9DVDTitleset *titleset,int id,int num,int _VTS,int _pgc,uint32_t _startSector, bool _indexed);
  float calcVobuSize(ifo_handle_t *_ifo,k9DVDChapter *_chapter);
  long stream_vob( int title, unsigned long startblock, unsigned long lastblock, struct stream_counter *sc);
  int identify_stream( unsigned char *buffer ) ;
  int dvdtime2msec(dvd_time_t *dt);
  int get_title_name(const char* dvd_device, char* title);
  void calcStreamSize(k9DVDTitle & title);
  void setError(const TQString &err);
  int getVampsID(int type);
  int calcNumTitle(ifo_handle_t *ifo,int _vts,int _ttn);
public slots: // Public slots
  void slotVobProgress(unsigned int position,unsigned int total);
  void slotTitleProgress(unsigned int position,unsigned int total);
  void slotTitleText(TQString &text);
  void slotTotalText(TQString &text);
signals: // Signals
  void sigVobProgress(unsigned int position,unsigned int total);
  void sigTitleProgress(unsigned int position,unsigned int total);
  void sigTitleText(TQString &text);
  void sigTotalText(TQString &text);
};

typedef struct lng { char code[3];	TQString name;};

#endif