Ticket #5734: 5734_transcode_profiles_v2.patch
File 5734_transcode_profiles_v2.patch, 6.6 KB (added by , 14 years ago) |
---|
-
libs/libmythtv/recordinginfo.h
68 68 void ApplyRecordRecTitleChange(const QString &newTitle, 69 69 const QString &newSubtitle); 70 70 void ApplyTranscoderProfileChange(const QString &profile) const;//pi 71 void ApplyTranscoderProfileChangeById(int); 71 72 72 73 static void signalChange(int recordid); 73 74 -
libs/libmythtv/recordinginfo.cpp
298 298 subtitle = newSubtitle; 299 299 } 300 300 301 /* \fn RecordingInfo::ApplyTranscoderProfileChangeById(int id) 302 * \brief Sets the transcoder profile for a recording 303 * \param profileid is the 'id' field from recordingprofiles table. 304 */ 305 void RecordingInfo::ApplyTranscoderProfileChangeById(int id) 306 { 307 MSqlQuery query(MSqlQuery::InitCon()); 308 309 query.prepare("UPDATE recorded " 310 "SET transcoder = :PROFILEID " 311 "WHERE chanid = :CHANID " 312 "AND starttime = :START"); 313 query.bindValue(":PROFILEID", id); 314 query.bindValue(":CHANID", chanid); 315 query.bindValue(":START", recstartts); 316 317 if (!query.exec()) 318 MythDB::DBError(LOC + "unable to update transcoder " 319 "in recorded table", query); 320 } 321 301 322 /** \brief Sets the transcoder profile for a recording 302 323 * \param profile Descriptive name of the profile. ie: Autodetect 303 324 */ -
programs/mythfrontend/playbackbox.cpp
2748 2748 if (!(m_popupMenu = createPopupMenu(tr("Transcoding profiles")))) 2749 2749 return; 2750 2750 2751 m_popupMenu->AddButton(tr("Default"), SLOT(doBeginTranscoding())); 2752 m_popupMenu->AddButton(tr("Autodetect"), 2753 SLOT(changeProfileAndTranscodeAuto())); 2754 m_popupMenu->AddButton(tr("High Quality"), 2755 SLOT(changeProfileAndTranscodeHigh())); 2756 m_popupMenu->AddButton(tr("Medium Quality"), 2757 SLOT(changeProfileAndTranscodeMedium())); 2758 m_popupMenu->AddButton(tr("Low Quality"), 2759 SLOT(changeProfileAndTranscodeLow())); 2751 int buttonCount = kDialogCodeListStart; 2752 m_transcodeProfileMap.clear(); 2753 2754 m_popupMenu->AddButton(tr("Default"),qVariantFromValue(buttonCount)); 2755 m_transcodeProfileMap.insert(buttonCount++, -1); 2756 2757 m_popupMenu->AddButton(tr("Autodetect"),qVariantFromValue(buttonCount)); 2758 m_transcodeProfileMap.insert(buttonCount++, 0); 2759 2760 MSqlQuery query(MSqlQuery::InitCon()); 2761 query.prepare("SELECT r.name, r.id " 2762 "FROM recordingprofiles r, profilegroups p " 2763 "WHERE p.name = 'Transcoders' " 2764 "AND r.profilegroup = p.id " 2765 "AND r.name != 'RTjpeg/MPEG4' " 2766 "AND r.name != 'MPEG2' "); 2767 2768 if (!query.exec()) 2769 { 2770 MythDB::DBError(LOC + "unable to query transcoders", query); 2771 return; 2772 } 2773 2774 while (query.next()) 2775 { 2776 QString transcoder_name = query.value(0).toString(); 2777 int transcoder_id = query.value(1).toInt(); 2778 2779 // Translatable strings for known profiles 2780 if (transcoder_name == "High Quality") 2781 m_popupMenu->AddButton(tr("High Quality"),qVariantFromValue(buttonCount)); 2782 else if (transcoder_name == "Medium Quality") 2783 m_popupMenu->AddButton(tr("Medium Quality"),qVariantFromValue(buttonCount)); 2784 else if (transcoder_name == "Low Quality") 2785 m_popupMenu->AddButton(tr("Low Quality"),qVariantFromValue(buttonCount)); 2786 else 2787 m_popupMenu->AddButton(transcoder_name,qVariantFromValue(buttonCount)); 2788 m_transcodeProfileMap.insert(buttonCount++, transcoder_id); 2789 } 2790 m_popupMenu->SetReturnEvent(this, "TRANSCODE"); 2760 2791 } 2761 2792 2762 void PlaybackBox::changeProfileAndTranscode( const QString &profile)2793 void PlaybackBox::changeProfileAndTranscode(int id) 2763 2794 { 2764 ProgramInfo *pginfo = CurrentItem();2795 ProgramInfo *pginfo = CurrentItem(); 2765 2796 2766 2797 if (!pginfo) 2767 2798 return; 2768 2799 2769 const RecordingInfo ri(*pginfo); 2770 ri.ApplyTranscoderProfileChange(profile); 2771 doBeginTranscoding(); 2800 if (m_transcodeProfileMap.contains(id)) 2801 { 2802 if (m_transcodeProfileMap.value(id) >= 0) 2803 { 2804 RecordingInfo ri(*pginfo); 2805 ri.ApplyTranscoderProfileChangeById(m_transcodeProfileMap.value(id)); 2806 } 2807 doBeginTranscoding(); 2808 } 2772 2809 } 2773 2810 2774 2811 void PlaybackBox::showActionPopup(ProgramInfo *pginfo) … … 3600 3637 3601 3638 void PlaybackBox::customEvent(QEvent *event) 3602 3639 { 3640 if (event->type() == kMythDialogBoxCompletionEventType) 3641 { 3642 DialogCompletionEvent *dce = 3643 dynamic_cast<DialogCompletionEvent*>(event); 3644 3645 QString resultid= dce->GetId(); 3646 3647 if (resultid == "TRANSCODE") 3648 { 3649 int profileid = dce->GetData().toInt(); 3650 changeProfileAndTranscode(profileid); 3651 } 3652 } 3653 3603 3654 if ((MythEvent::Type)(event->type()) == MythEvent::MythEventMessage) 3604 3655 { 3605 3656 MythEvent *me = (MythEvent *)event; -
programs/mythfrontend/playbackbox.h
158 158 void showRecordingPopup(); 159 159 void showJobPopup(); 160 160 void showTranscodingProfiles(); 161 void changeProfileAndTranscode(const QString &profile); 162 void changeProfileAndTranscodeAuto() 163 { changeProfileAndTranscode("Autodetect"); } 164 void changeProfileAndTranscodeHigh() 165 { changeProfileAndTranscode("High Quality"); } 166 void changeProfileAndTranscodeMedium() 167 { changeProfileAndTranscode("Medium Quality"); } 168 void changeProfileAndTranscodeLow() 169 { changeProfileAndTranscode("Low Quality"); } 161 void changeProfileAndTranscode(int id); 170 162 void showStoragePopup(); 171 163 void showPlaylistPopup(); 172 164 void showPlaylistStoragePopup(); … … 452 444 deque<QString> m_networkControlCommands; 453 445 bool m_underNetworkControl; 454 446 447 // Transcoding Profiles Variables////////////////////////////////////////// 448 QMap<int,int> m_transcodeProfileMap; 449 455 450 TV *m_player; 456 451 }; 457 452