Ticket #5734: 5734_transcode_profiles_v1.patch
File 5734_transcode_profiles_v1.patch, 6.6 KB (added by , 16 years ago) |
---|
-
libs/libmythtv/programinfo.h
228 228 void ApplyRecordRecTitleChange(const QString &newTitle, 229 229 const QString &newSubtitle); 230 230 void ApplyTranscoderProfileChange(QString); 231 void ApplyTranscoderProfileChangeById(int); 231 232 232 233 // Quick gets 233 234 bool SetRecordBasename(QString basename); -
libs/libmythtv/programinfo.cpp
1263 1263 subtitle = newSubtitle; 1264 1264 } 1265 1265 1266 /* \fn ProgramInfo::ApplyTranscoderProfileChangeById(int id) 1267 * \brief Sets the transcoder profile for a recording 1268 * \param profileid is the 'id' field from recordingprofiles table. 1269 */ 1270 void ProgramInfo::ApplyTranscoderProfileChangeById(int id) 1271 { 1272 MSqlQuery query(MSqlQuery::InitCon()); 1273 1274 query.prepare("UPDATE recorded " 1275 "SET transcoder = :PROFILEID " 1276 "WHERE chanid = :CHANID " 1277 "AND starttime = :START"); 1278 query.bindValue(":PROFILEID", id); 1279 query.bindValue(":CHANID", chanid); 1280 query.bindValue(":START", recstartts); 1281 1282 if (!query.exec()) 1283 MythDB::DBError(LOC + "unable to update transcoder " 1284 "in recorded table", query); 1285 } 1286 1266 1287 /* \fn ProgramInfo::ApplyTranscoderProfileChange(QString profile) 1267 1288 * \brief Sets the transcoder profile for a recording 1268 1289 * \param profile Descriptive name of the profile. ie: Autodetect -
programs/mythfrontend/playbackbox.cpp
52 52 #include "util.h" 53 53 #include "x11colors.h" 54 54 #include "mythuihelper.h" 55 #include "libmythdb/mythdb.h" 55 56 56 57 #define LOC QString("PlaybackBox: ") 57 58 #define LOC_ERR QString("PlaybackBox Error: ") … … 3362 3363 if (!curitem) 3363 3364 return; 3364 3365 3366 int buttonCount = kDialogCodeListStart; 3367 m_transcodeProfileMap.clear(); 3368 3365 3369 popup = new MythPopupBox(gContext->GetMainWindow(), drawPopupSolid, 3366 3370 drawPopupFgColor, drawPopupBgColor, 3367 3371 drawPopupSelColor, "transcode popup"); … … 3370 3374 3371 3375 QAbstractButton *defaultButton; 3372 3376 3373 defaultButton = popup->addButton(tr("Default"), this, 3374 SLOT(doBeginTranscoding())); 3375 popup->addButton(tr("Autodetect"), this, 3376 SLOT(changeProfileAndTranscodeAuto())); 3377 popup->addButton(tr("High Quality"), this, 3378 SLOT(changeProfileAndTranscodeHigh())); 3379 popup->addButton(tr("Medium Quality"), this, 3380 SLOT(changeProfileAndTranscodeMedium())); 3381 popup->addButton(tr("Low Quality"), this, 3382 SLOT(changeProfileAndTranscodeLow())); 3377 m_transcodeProfileMap.insert(buttonCount++, -1); 3378 defaultButton = popup->addButton( tr("Default") ); 3383 3379 3384 popup->ShowPopup(this, SLOT(PopupDone(int))); 3380 m_transcodeProfileMap.insert(buttonCount++, 0); 3381 popup->addButton( tr("Autodetect") ); 3382 3383 MSqlQuery query(MSqlQuery::InitCon()); 3384 query.prepare("SELECT r.name, r.id " 3385 "FROM recordingprofiles r, profilegroups p " 3386 "WHERE p.name = 'Transcoders' " 3387 "AND r.profilegroup = p.id " 3388 "AND r.name != 'RTjpeg/MPEG4' " 3389 "AND r.name != 'MPEG2' "); 3390 3391 if (!query.exec()) 3392 { 3393 MythDB::DBError(LOC + "unable to query transcoders", query); 3394 return; 3395 } 3396 3397 while (query.next()) 3398 { 3399 QString transcoder_name = query.value(0).toString(); 3400 int transcoder_id = query.value(1).toInt(); 3401 3402 // Translatable strings for known profiles 3403 m_transcodeProfileMap.insert(buttonCount++, transcoder_id); 3404 if (transcoder_name == "High Quality") 3405 popup->addButton( tr("High Quality") ); 3406 else if (transcoder_name == "Medium Quality") 3407 popup->addButton( tr("Medium Quality") ); 3408 else if (transcoder_name == "Low Quality") 3409 popup->addButton( tr("Low Quality") ); 3410 else 3411 popup->addButton( transcoder_name ); 3412 } 3413 3414 popup->ShowPopup(this, SLOT(transcodePopupDone(int))); 3385 3415 defaultButton->setFocus(); 3386 3416 3387 3417 expectingPopup = true; 3388 3418 } 3389 3419 3390 void PlaybackBox:: changeProfileAndTranscode(QString profile)3420 void PlaybackBox::transcodePopupDone(int id) 3391 3421 { 3392 curitem->ApplyTranscoderProfileChange(profile); 3393 doBeginTranscoding(); 3422 if ((MythDialog::Rejected == id) && expectingPopup) 3423 { 3424 cancelPopup(); 3425 return; 3426 } 3427 3428 if (m_transcodeProfileMap.contains(id)) 3429 { 3430 if (m_transcodeProfileMap.value(id) >= 0) 3431 { 3432 curitem->ApplyTranscoderProfileChangeById(m_transcodeProfileMap.value(id)); 3433 } 3434 doBeginTranscoding(); 3435 } 3394 3436 } 3395 3437 3396 3438 void PlaybackBox::showActionPopup(ProgramInfo *program) -
programs/mythfrontend/playbackbox.h
167 167 void showRecordingPopup(); 168 168 void showJobPopup(); 169 169 void showTranscodingProfiles(); 170 void changeProfileAndTranscode(QString profile);171 void changeProfileAndTranscodeAuto()172 { changeProfileAndTranscode("Autodetect"); }173 void changeProfileAndTranscodeHigh()174 { changeProfileAndTranscode("High Quality"); }175 void changeProfileAndTranscodeMedium()176 { changeProfileAndTranscode("Medium Quality"); }177 void changeProfileAndTranscodeLow()178 { changeProfileAndTranscode("Low Quality"); }179 170 void showStoragePopup(); 180 171 void showPlaylistPopup(); 181 172 void showPlaylistJobPopup(); … … 207 198 void togglePreserveEpisode(bool turnOn); 208 199 209 200 void PopupDone(int r); 201 void transcodePopupDone(int id); 210 202 void toggleView(ViewMask itemMask, bool setOn); 211 203 void toggleTitleView(bool setOn) { toggleView(VIEW_TITLES, setOn); } 212 204 void toggleCategoryView(bool setOn) { toggleView(VIEW_CATEGORIES, setOn); } … … 510 502 Q3ValueList<QString> networkControlCommands; 511 503 bool underNetworkControl; 512 504 505 // Transcoding Profiles Variables////////////////////////////////////////// 506 QMap<int,int> m_transcodeProfileMap; 507 513 508 TV *m_player; 514 509 }; 515 510