00001 /* 00002 dvdinfo.cpp 00003 00004 (c) 2003 Thor Sigvaldason and Isaac Richards 00005 Part of the mythTV project 00006 00007 implementation for dvd "struct" 00008 */ 00009 00010 #include <iostream> 00011 using namespace std; 00012 #include <stdio.h> 00013 00014 #include "dvdinfo.h" 00015 00016 #include <mythtv/mythcontext.h> 00017 00018 DVDAudioInfo::DVDAudioInfo(int track_number, const QString &audio_description) 00019 { 00020 track = track_number; 00021 description = audio_description; 00022 } 00023 00024 DVDAudioInfo::~DVDAudioInfo() 00025 { 00026 } 00027 00028 /* 00029 --------------------------------------------------------------------- 00030 */ 00031 00032 DVDTitleInfo::DVDTitleInfo() 00033 { 00034 numb_chapters = 0; 00035 numb_angles = 0; 00036 track_number = 0; 00037 hours = 0; 00038 minutes = 0; 00039 seconds = 0; 00040 audio_tracks.clear(); 00041 audio_tracks.setAutoDelete(true); 00042 subtitles.clear(); 00043 subtitles.setAutoDelete(true); 00044 00045 is_selected = false; 00046 selected_quality = -1; 00047 00048 selected_audio = 1; 00049 selected_subtitle = -1; 00050 use_ac3 = gContext->GetNumSetting("MTDac3flag"); 00051 name = ""; 00052 } 00053 00054 void DVDTitleInfo::setTime(uint h, uint m, uint s) 00055 { 00056 hours = h; 00057 minutes = m; 00058 seconds = s; 00059 } 00060 00061 uint DVDTitleInfo::getPlayLength() 00062 { 00063 return seconds + (60 * minutes) + (60 * 60 * hours); 00064 } 00065 00066 QString DVDTitleInfo::getTimeString() 00067 { 00068 QString a_string; 00069 a_string.sprintf("%d:%02d:%02d", hours, minutes, seconds); 00070 return a_string; 00071 } 00072 00073 void DVDTitleInfo::addAudio(DVDAudioInfo *new_audio_track) 00074 { 00075 audio_tracks.append(new_audio_track); 00076 } 00077 00078 void DVDTitleInfo::addSubTitle(DVDSubTitleInfo *new_subtitle) 00079 { 00080 subtitles.append(new_subtitle); 00081 } 00082 00083 DVDTitleInfo::~DVDTitleInfo() 00084 { 00085 audio_tracks.clear(); 00086 subtitles.clear(); 00087 } 00088 00089 /* 00090 --------------------------------------------------------------------- 00091 */ 00092 00093 00094 DVDInfo::DVDInfo(const QString &new_name) 00095 { 00096 // 00097 // This object just figures out what's on a disc 00098 // and tells whoever asks about it. 00099 // 00100 00101 titles.setAutoDelete(true); 00102 titles.clear(); 00103 volume_name = new_name; 00104 } 00105 00106 DVDTitleInfo* DVDInfo::getTitle(uint which_one) 00107 { 00108 DVDTitleInfo *iter; 00109 for(iter = titles.first(); iter; iter = titles.next()) 00110 { 00111 if(iter->getTrack() == which_one) 00112 { 00113 return iter; 00114 } 00115 } 00116 return NULL; 00117 } 00118 00119 00120 DVDInfo::~DVDInfo() 00121 { 00122 titles.clear(); 00123 } 00124 00125 00126
1.5.5