Ticket #2497: get_correct_file_extension.patch
File get_correct_file_extension.patch, 3.3 KB (added by , 18 years ago) |
---|
-
libs/libmythtv/tv_rec.cpp
136 136 // tvchain 137 137 tvchain(NULL), 138 138 // RingBuffer info 139 ringBuffer(NULL), rbFilePrefix("") , rbFileExt("mpg")139 ringBuffer(NULL), rbFilePrefix("") 140 140 { 141 141 } 142 142 143 143 bool TVRec::CreateChannel(const QString &startchannel) 144 144 { 145 rbFileExt = "mpg";146 145 bool init_run = false; 147 146 if (genOpt.cardtype == "DVB") 148 147 { … … 227 226 CloseChannel(); 228 227 init_run = true; 229 228 #endif 230 if (genOpt.cardtype != "HDTV" && genOpt.cardtype != "MPEG")231 rbFileExt = "nuv";232 229 } 233 230 234 231 if (!init_run) … … 641 638 { 642 639 if (!curRec) 643 640 return; 641 642 QString rbFileExt; 643 644 GetChannelFileExtension(curRec, rbFileExt); 644 645 645 646 curRec->StartedRecording(rbFilePrefix, rbFileExt); 646 647 VERBOSE(VB_RECORD, LOC + "StartedRecording("<<curRec<<") fn(" … … 1115 1116 channel->Close(); 1116 1117 } 1117 1118 1119 /** \fn TVRec::GetChannelFileExtension(const ProgramInfo *pi, QString &rbFileExt) const 1120 * \brief Returns the file extension for the corresponding recording. 1121 * By default, mpg is used. Only if a V4L card is detected is the extension changed to nuv. 1122 * \param chanId Channel 1123 * \param fileExt Recording file extension. 1124 */ 1125 bool TVRec::GetChannelFileExtension(const QString& chanId, QString& fileExt) const 1126 { 1127 QString test; 1128 1129 fileExt = "mpg"; 1130 1131 MSqlQuery query(MSqlQuery::InitCon()); 1132 query.prepare("SELECT cc.cardtype " 1133 "FROM channel ch " 1134 "JOIN cardinput ci " 1135 "ON ch.sourceid = ci.sourceid " 1136 "JOIN capturecard cc " 1137 "ON ( (ci.childcardid <> 0) AND " 1138 "(ci.childcardid = cc.cardid) )" 1139 "OR " 1140 "( (ci.childcardid = 0) AND " 1141 "(ci.cardid = cc.cardid) ) " 1142 "WHERE ch.chanid = :CHANID"); 1143 query.bindValue(":CHANID", chanId); 1144 1145 if (!query.exec() || !query.isActive()) 1146 { 1147 MythContext::DBError("GetRecordingFileExtension", query); 1148 return false; 1149 } 1150 1151 if (!query.next()) 1152 return false; 1153 1154 test = query.value(0).toString(); 1155 if (test != QString::null) 1156 { 1157 if (test == "V4L") 1158 fileExt = "nuv"; 1159 } 1160 1161 return true; 1162 } 1163 1118 1164 DBox2Channel *TVRec::GetDBox2Channel(void) 1119 1165 { 1120 1166 #ifdef USING_DBOX2 -
libs/libmythtv/tv_rec.h
254 254 bool CreateChannel(const QString &startChanNum); 255 255 void InitChannel(const QString &inputname, const QString &startchannel); 256 256 void CloseChannel(void); 257 bool GetChannelFileExtension(const QString& chanId, QString& fileExt) const; 257 258 DBox2Channel *GetDBox2Channel(void); 258 259 HDHRChannel *GetHDHRChannel(void); 259 260 DVBChannel *GetDVBChannel(void); … … 367 368 // RingBuffer info 368 369 RingBuffer *ringBuffer; 369 370 QString rbFilePrefix; 370 QString rbFileExt;371 371 372 372 public: 373 373 static const uint kSignalMonitoringRate;