00001 /* 00002 dvdprobe.h 00003 00004 (c) 2003 Thor Sigvaldason and Isaac Richards 00005 Part of the mythTV project 00006 00007 header for dvd probing code (libdvdread) 00008 */ 00009 00010 #ifndef DVDPROBE_H_ 00011 #define DVDPROBE_H_ 00012 00013 #include <inttypes.h> 00014 00015 #ifndef UINT8_MAX 00016 #define UINT8_MAX 00017 #define UINT16_MAX 00018 #define INT32_MAX 00019 #define MAXDEFS 00020 #endif 00021 00022 #include <mythtv/dvdnav/ifo_types.h> 00023 #include <mythtv/dvdnav/ifo_read.h> 00024 #include <mythtv/dvdnav/dvd_reader.h> 00025 #include <mythtv/dvdnav/nav_read.h> 00026 00027 #ifdef MAXDEFS 00028 #undef UINT8_MAX 00029 #undef UINT16_MAX 00030 #undef INT32_MAX 00031 #endif 00032 00033 // Qt headers 00034 #include <qstring.h> 00035 #include <qptrlist.h> 00036 00037 class DVDSubTitle 00038 { 00039 // 00040 // A DVDTitle (below) holds zero or more 00041 // of these objects, each describing available 00042 // subtitles. 00043 // 00044 00045 public: 00046 DVDSubTitle(int subtitle_id, const QString &a_language); 00047 00048 void setName(const QString &a_name) { name = a_name; } 00049 QString getLanguage() { return language; } 00050 QString getName() { return name; } 00051 int getID() { return id; } 00052 00053 private: 00054 int id; 00055 QString language; 00056 QString name; 00057 }; 00058 00059 class DVDAudio 00060 { 00061 // 00062 // A DVDTitle (see below) holds a pointer list 00063 // of zero or more DVDAudio objects (one per audio 00064 // track) 00065 // 00066 00067 public: 00068 DVDAudio(); 00069 ~DVDAudio(); 00070 00071 void printYourself(); 00072 void fill(audio_attr_t *audio_attributes); 00073 int getChannels() { return channels; } 00074 QString getAudioString(); 00075 00076 private: 00077 QString audio_format; 00078 bool multichannel_extension; 00079 QString language; 00080 QString application_mode; 00081 QString quantization; 00082 QString sample_frequency; 00083 int channels; 00084 QString language_extension; 00085 }; 00086 00087 class DVDTitle 00088 { 00089 // 00090 // A little "struct" class that holds 00091 // DVD Title informations 00092 // (n.b. a DVD "title" is a logically distinct section 00093 // of video, i.e. A movie, a special, a featurette, etc.) 00094 // 00095 00096 public: 00097 DVDTitle(); 00098 ~DVDTitle(); 00099 00100 // 00101 // Set 00102 // 00103 00104 void setChapters(uint a_uint) { numb_chapters = a_uint; } 00105 void setAngles(uint a_uint) { numb_angles = a_uint; } 00106 void setTrack(uint a_uint) { track_number = a_uint; } 00107 void setTime(uint h, uint m, uint s, double fr); 00108 void setAR(uint n, uint d, const QString &ar); 00109 void setSize(uint h, uint v) { hsize = h; vsize = v; } 00110 void setLBox(bool yes_or_no) { letterbox = yes_or_no; } 00111 void setVFormat(const QString &a_string) { video_format = a_string; } 00112 void determineInputID(); 00113 00114 // 00115 // Get 00116 // 00117 00118 uint getChapters() { return numb_chapters; } 00119 uint getAngles() { return numb_angles; } 00120 uint getTrack() { return track_number; } 00121 uint getPlayLength(); 00122 QString getTimeString(); 00123 uint getHours() { return hours; } 00124 uint getMinutes() { return minutes; } 00125 uint getSeconds() { return seconds; } 00126 uint getInputID() { return dvdinput_id; } 00127 00128 00129 void printYourself(); 00130 void addAudio(DVDAudio *new_audio_track); 00131 QPtrList<DVDAudio> *getAudioTracks() { return &audio_tracks; } 00132 void addSubTitle(DVDSubTitle *new_subitle); 00133 QPtrList<DVDSubTitle> *getSubTitles() { return &subtitles; } 00134 00135 private: 00136 uint numb_chapters; 00137 uint numb_angles; 00138 uint track_number; 00139 00140 uint hours; 00141 uint minutes; 00142 uint seconds; 00143 00144 uint hsize; 00145 uint vsize; 00146 double frame_rate; 00147 int fr_code; 00148 uint ar_numerator; 00149 uint ar_denominator; 00150 QString aspect_ratio; 00151 bool letterbox; 00152 QString video_format; 00153 uint dvdinput_id; 00154 00155 QPtrList<DVDAudio> audio_tracks; 00156 QPtrList<DVDSubTitle> subtitles; 00157 }; 00158 00159 class DVDProbe 00160 { 00161 // 00162 // A little class that figures out what's on that 00163 // disc in the drive (only DVD's) 00164 // 00165 00166 public: 00167 DVDProbe(const QString &dvd_device); 00168 ~DVDProbe(); 00169 00170 bool probe(); 00171 QString getName() { return volume_name; } 00172 QPtrList<DVDTitle> *getTitles() { return &titles; } 00173 DVDTitle *getTitle(uint which_one); 00174 00175 private: 00176 void wipeClean(); 00177 bool first_time; 00178 QString device; 00179 dvd_reader_t *dvd; 00180 00181 QPtrList<DVDTitle> titles; 00182 QString volume_name; 00183 }; 00184 00185 #endif // dvdprobe_h_
1.5.5