| 1 | /* smplayer, GUI front-end for mplayer.
|
|---|
| 2 | Copyright (C) 2006-2010 Ricardo Villalba <rvm@escomposlinux.org>
|
|---|
| 3 |
|
|---|
| 4 | This program is free software; you can redistribute it and/or modify
|
|---|
| 5 | it under the terms of the GNU General Public License as published by
|
|---|
| 6 | the Free Software Foundation; either version 2 of the License, or
|
|---|
| 7 | (at your option) any later version.
|
|---|
| 8 |
|
|---|
| 9 | This program is distributed in the hope that it will be useful,
|
|---|
| 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 12 | GNU General Public License for more details.
|
|---|
| 13 |
|
|---|
| 14 | You should have received a copy of the GNU General Public License
|
|---|
| 15 | along with this program; if not, write to the Free Software
|
|---|
| 16 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|---|
| 17 | */
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 | #include "prefperformance.h"
|
|---|
| 21 | #include "images.h"
|
|---|
| 22 | #include "global.h"
|
|---|
| 23 | #include "preferences.h"
|
|---|
| 24 |
|
|---|
| 25 | using namespace Global;
|
|---|
| 26 |
|
|---|
| 27 | PrefPerformance::PrefPerformance(QWidget * parent, Qt::WindowFlags f)
|
|---|
| 28 | : PrefWidget(parent, f )
|
|---|
| 29 | {
|
|---|
| 30 | setupUi(this);
|
|---|
| 31 |
|
|---|
| 32 | // Priority is only for windows, so we disable for other systems
|
|---|
| 33 | #ifndef Q_OS_WIN
|
|---|
| 34 | priority_group->hide();
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | #if SMART_DVD_CHAPTERS
|
|---|
| 38 | fast_chapter_check->hide();
|
|---|
| 39 | #endif
|
|---|
| 40 |
|
|---|
| 41 | retranslateStrings();
|
|---|
| 42 | }
|
|---|
| 43 |
|
|---|
| 44 | PrefPerformance::~PrefPerformance()
|
|---|
| 45 | {
|
|---|
| 46 | }
|
|---|
| 47 |
|
|---|
| 48 | QString PrefPerformance::sectionName() {
|
|---|
| 49 | return tr("Performance");
|
|---|
| 50 | }
|
|---|
| 51 |
|
|---|
| 52 | QPixmap PrefPerformance::sectionIcon() {
|
|---|
| 53 | return Images::icon("pref_performance");
|
|---|
| 54 | }
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 | void PrefPerformance::retranslateStrings() {
|
|---|
| 58 | int priority = priority_combo->currentIndex();
|
|---|
| 59 | int loop_filter = loopfilter_combo->currentIndex();
|
|---|
| 60 |
|
|---|
| 61 | retranslateUi(this);
|
|---|
| 62 |
|
|---|
| 63 | loopfilter_combo->clear();
|
|---|
| 64 | loopfilter_combo->addItem( tr("Enabled"), Preferences::LoopEnabled );
|
|---|
| 65 | loopfilter_combo->addItem( tr("Skip (always)"), Preferences::LoopDisabled );
|
|---|
| 66 | loopfilter_combo->addItem( tr("Skip only on HD videos"), Preferences::LoopDisabledOnHD );
|
|---|
| 67 |
|
|---|
| 68 | priority_combo->setCurrentIndex(priority);
|
|---|
| 69 | loopfilter_combo->setCurrentIndex(loop_filter);
|
|---|
| 70 |
|
|---|
| 71 | createHelp();
|
|---|
| 72 | }
|
|---|
| 73 |
|
|---|
| 74 | void PrefPerformance::setData(Preferences * pref) {
|
|---|
| 75 | setCacheForFiles( pref->cache_for_files );
|
|---|
| 76 | setCacheForStreams( pref->cache_for_streams );
|
|---|
| 77 | setCacheForDVDs( pref->cache_for_dvds );
|
|---|
| 78 | setCacheForAudioCDs( pref->cache_for_audiocds );
|
|---|
| 79 | setCacheForVCDs( pref->cache_for_vcds );
|
|---|
| 80 | setCacheForTV( pref->cache_for_tv );
|
|---|
| 81 |
|
|---|
| 82 | setPriority( pref->priority );
|
|---|
| 83 | setFrameDrop( pref->frame_drop );
|
|---|
| 84 | setHardFrameDrop( pref->hard_frame_drop );
|
|---|
| 85 | setCoreavcUsage( pref->coreavc );
|
|---|
| 86 | setSkipLoop( pref->h264_skip_loop_filter );
|
|---|
| 87 | #if !SMART_DVD_CHAPTERS
|
|---|
| 88 | setFastChapterSeeking( pref->fast_chapter_change );
|
|---|
| 89 | #endif
|
|---|
| 90 | setFastAudioSwitching( pref->fast_audio_change );
|
|---|
| 91 | setThreads( pref->threads );
|
|---|
| 92 | }
|
|---|
| 93 |
|
|---|
| 94 | void PrefPerformance::getData(Preferences * pref) {
|
|---|
| 95 | requires_restart = false;
|
|---|
| 96 |
|
|---|
| 97 | TEST_AND_SET(pref->cache_for_files, cacheForFiles());
|
|---|
| 98 | TEST_AND_SET(pref->cache_for_streams, cacheForStreams());
|
|---|
| 99 | TEST_AND_SET(pref->cache_for_dvds, cacheForDVDs());
|
|---|
| 100 | TEST_AND_SET(pref->cache_for_audiocds, cacheForAudioCDs());
|
|---|
| 101 | TEST_AND_SET(pref->cache_for_vcds, cacheForVCDs());
|
|---|
| 102 | TEST_AND_SET(pref->cache_for_tv, cacheForTV());
|
|---|
| 103 |
|
|---|
| 104 | TEST_AND_SET(pref->priority, priority());
|
|---|
| 105 | TEST_AND_SET(pref->frame_drop, frameDrop());
|
|---|
| 106 | TEST_AND_SET(pref->hard_frame_drop, hardFrameDrop());
|
|---|
| 107 | TEST_AND_SET(pref->coreavc, coreavcUsage())
|
|---|
| 108 | TEST_AND_SET(pref->h264_skip_loop_filter, skipLoop());
|
|---|
| 109 | #if !SMART_DVD_CHAPTERS
|
|---|
| 110 | TEST_AND_SET(pref->fast_chapter_change, fastChapterSeeking());
|
|---|
| 111 | #endif
|
|---|
| 112 | pref->fast_audio_change = fastAudioSwitching();
|
|---|
| 113 | TEST_AND_SET(pref->threads, threads());
|
|---|
| 114 | }
|
|---|
| 115 |
|
|---|
| 116 | void PrefPerformance::setCacheForFiles(int n) {
|
|---|
| 117 | cache_files_spin->setValue(n);
|
|---|
| 118 | }
|
|---|
| 119 |
|
|---|
| 120 | int PrefPerformance::cacheForFiles() {
|
|---|
| 121 | return cache_files_spin->value();
|
|---|
| 122 | }
|
|---|
| 123 |
|
|---|
| 124 | void PrefPerformance::setCacheForStreams(int n) {
|
|---|
| 125 | cache_streams_spin->setValue(n);
|
|---|
| 126 | }
|
|---|
| 127 |
|
|---|
| 128 | int PrefPerformance::cacheForStreams() {
|
|---|
| 129 | return cache_streams_spin->value();
|
|---|
| 130 | }
|
|---|
| 131 |
|
|---|
| 132 | void PrefPerformance::setCacheForDVDs(int n) {
|
|---|
| 133 | cache_dvds_spin->setValue(n);
|
|---|
| 134 | }
|
|---|
| 135 |
|
|---|
| 136 | int PrefPerformance::cacheForDVDs() {
|
|---|
| 137 | return cache_dvds_spin->value();
|
|---|
| 138 | }
|
|---|
| 139 |
|
|---|
| 140 | void PrefPerformance::setCacheForAudioCDs(int n) {
|
|---|
| 141 | cache_cds_spin->setValue(n);
|
|---|
| 142 | }
|
|---|
| 143 |
|
|---|
| 144 | int PrefPerformance::cacheForAudioCDs() {
|
|---|
| 145 | return cache_cds_spin->value();
|
|---|
| 146 | }
|
|---|
| 147 |
|
|---|
| 148 | void PrefPerformance::setCacheForVCDs(int n) {
|
|---|
| 149 | cache_vcds_spin->setValue(n);
|
|---|
| 150 | }
|
|---|
| 151 |
|
|---|
| 152 | int PrefPerformance::cacheForVCDs() {
|
|---|
| 153 | return cache_vcds_spin->value();
|
|---|
| 154 | }
|
|---|
| 155 |
|
|---|
| 156 | void PrefPerformance::setCacheForTV(int n) {
|
|---|
| 157 | cache_tv_spin->setValue(n);
|
|---|
| 158 | }
|
|---|
| 159 |
|
|---|
| 160 | int PrefPerformance::cacheForTV() {
|
|---|
| 161 | return cache_tv_spin->value();
|
|---|
| 162 | }
|
|---|
| 163 |
|
|---|
| 164 | void PrefPerformance::setPriority(int n) {
|
|---|
| 165 | priority_combo->setCurrentIndex(n);
|
|---|
| 166 | }
|
|---|
| 167 |
|
|---|
| 168 | int PrefPerformance::priority() {
|
|---|
| 169 | return priority_combo->currentIndex();
|
|---|
| 170 | }
|
|---|
| 171 |
|
|---|
| 172 | void PrefPerformance::setFrameDrop(bool b) {
|
|---|
| 173 | framedrop_check->setChecked(b);
|
|---|
| 174 | }
|
|---|
| 175 |
|
|---|
| 176 | bool PrefPerformance::frameDrop() {
|
|---|
| 177 | return framedrop_check->isChecked();
|
|---|
| 178 | }
|
|---|
| 179 |
|
|---|
| 180 | void PrefPerformance::setHardFrameDrop(bool b) {
|
|---|
| 181 | hardframedrop_check->setChecked(b);
|
|---|
| 182 | }
|
|---|
| 183 |
|
|---|
| 184 | bool PrefPerformance::hardFrameDrop() {
|
|---|
| 185 | return hardframedrop_check->isChecked();
|
|---|
| 186 | }
|
|---|
| 187 |
|
|---|
| 188 | void PrefPerformance::setCoreavcUsage(bool b) {
|
|---|
| 189 | coreavc_check->setChecked(b);
|
|---|
| 190 | }
|
|---|
| 191 |
|
|---|
| 192 | bool PrefPerformance::coreavcUsage() {
|
|---|
| 193 | return coreavc_check->isChecked();
|
|---|
| 194 | }
|
|---|
| 195 |
|
|---|
| 196 | void PrefPerformance::setSkipLoop(Preferences::H264LoopFilter value) {
|
|---|
| 197 | loopfilter_combo->setCurrentIndex(loopfilter_combo->findData(value));
|
|---|
| 198 | }
|
|---|
| 199 |
|
|---|
| 200 | Preferences::H264LoopFilter PrefPerformance::skipLoop() {
|
|---|
| 201 | return (Preferences::H264LoopFilter) loopfilter_combo->itemData(loopfilter_combo->currentIndex()).toInt();
|
|---|
| 202 | }
|
|---|
| 203 |
|
|---|
| 204 | #if !SMART_DVD_CHAPTERS
|
|---|
| 205 | void PrefPerformance::setFastChapterSeeking(bool b) {
|
|---|
| 206 | fast_chapter_check->setChecked(b);
|
|---|
| 207 | }
|
|---|
| 208 |
|
|---|
| 209 | bool PrefPerformance::fastChapterSeeking() {
|
|---|
| 210 | return fast_chapter_check->isChecked();
|
|---|
| 211 | }
|
|---|
| 212 | #endif
|
|---|
| 213 |
|
|---|
| 214 | void PrefPerformance::setFastAudioSwitching(Preferences::OptionState value) {
|
|---|
| 215 | fast_audio_combo->setState(value);
|
|---|
| 216 | }
|
|---|
| 217 |
|
|---|
| 218 | Preferences::OptionState PrefPerformance::fastAudioSwitching() {
|
|---|
| 219 | return fast_audio_combo->state();
|
|---|
| 220 | }
|
|---|
| 221 |
|
|---|
| 222 | void PrefPerformance::setThreads(int v) {
|
|---|
| 223 | threads_spin->setValue(v);
|
|---|
| 224 | }
|
|---|
| 225 |
|
|---|
| 226 | int PrefPerformance::threads() {
|
|---|
| 227 | return threads_spin->value();
|
|---|
| 228 | }
|
|---|
| 229 |
|
|---|
| 230 | void PrefPerformance::createHelp() {
|
|---|
| 231 | clearHelp();
|
|---|
| 232 |
|
|---|
| 233 | addSectionTitle(tr("Performance"));
|
|---|
| 234 |
|
|---|
| 235 | // Performance tab
|
|---|
| 236 | #ifdef Q_OS_WIN
|
|---|
| 237 | setWhatsThis(priority_combo, tr("Priority"),
|
|---|
| 238 | tr("Set process priority for mplayer according to the predefined "
|
|---|
| 239 | "priorities available under Windows.<br>"
|
|---|
| 240 | "<b>Warning:</b> Using realtime priority can cause system lockup."));
|
|---|
| 241 | #endif
|
|---|
| 242 |
|
|---|
| 243 | setWhatsThis(framedrop_check, tr("Allow frame drop"),
|
|---|
| 244 | tr("Skip displaying some frames to maintain A/V sync on slow systems." ) );
|
|---|
| 245 |
|
|---|
| 246 | setWhatsThis(hardframedrop_check, tr("Allow hard frame drop"),
|
|---|
| 247 | tr("More intense frame dropping (breaks decoding). "
|
|---|
| 248 | "Leads to image distortion!") );
|
|---|
| 249 |
|
|---|
| 250 | setWhatsThis(threads_spin, tr("Threads for decoding"),
|
|---|
| 251 | tr("Sets the number of threads to use for decoding. Only for "
|
|---|
| 252 | "MPEG-1/2 and H.264") );
|
|---|
| 253 |
|
|---|
| 254 | setWhatsThis(coreavc_check, tr("Use CoreAVC if no other codec specified"),
|
|---|
| 255 | tr("Try to use non-free CoreAVC codec with no other codec is specified and non-VDPAU video output selected. Requires MPlayer build with CoreAVC support."));
|
|---|
| 256 |
|
|---|
| 257 | setWhatsThis(loopfilter_combo, tr("Skip loop filter"),
|
|---|
| 258 | tr("This option allows to skips the loop filter (AKA deblocking) "
|
|---|
| 259 | "during H.264 decoding. "
|
|---|
| 260 | "Since the filtered frame is supposed to be used as reference "
|
|---|
| 261 | "for decoding dependent frames this has a worse effect on quality "
|
|---|
| 262 | "than not doing deblocking on e.g. MPEG-2 video. But at least for "
|
|---|
| 263 | "high bitrate HDTV this provides a big speedup with no visible "
|
|---|
| 264 | "quality loss.") +"<br>"+
|
|---|
| 265 | tr("Possible values:") +"<br>" +
|
|---|
| 266 | tr("<b>Enabled</b>: the loop filter is not skipped")+"<br>"+
|
|---|
| 267 | tr("<b>Skip (always)</b>: the loop filter is skipped no matter the "
|
|---|
| 268 | "resolution of the video")+"<br>"+
|
|---|
| 269 | tr("<b>Skip only on HD videos</b>: the loop filter will be "
|
|---|
| 270 | "skipped only on videos which height is %1 or "
|
|---|
| 271 | "greater.").arg(pref->HD_height) +"<br>" );
|
|---|
| 272 |
|
|---|
| 273 | setWhatsThis(fast_audio_combo, tr("Fast audio track switching"),
|
|---|
| 274 | tr("Possible values:<br> "
|
|---|
| 275 | "<b>Yes</b>: it will try the fastest method "
|
|---|
| 276 | "to switch the audio track (it might not work with some formats).<br> "
|
|---|
| 277 | "<b>No</b>: the MPlayer process will be restarted whenever you "
|
|---|
| 278 | "change the audio track.<br> "
|
|---|
| 279 | "<b>Auto</b>: SMPlayer will decide what to do according to the "
|
|---|
| 280 | "MPlayer version." ) );
|
|---|
| 281 |
|
|---|
| 282 | #if !SMART_DVD_CHAPTERS
|
|---|
| 283 | setWhatsThis(fast_chapter_check, tr("Fast seek to chapters in dvds"),
|
|---|
| 284 | tr("If checked, it will try the fastest method to seek to chapters "
|
|---|
| 285 | "but it might not work with some discs.") );
|
|---|
| 286 | #endif
|
|---|
| 287 |
|
|---|
| 288 | addSectionTitle(tr("Cache"));
|
|---|
| 289 |
|
|---|
| 290 | setWhatsThis(cache_files_spin, tr("Cache for files"),
|
|---|
| 291 | tr("This option specifies how much memory (in kBytes) to use when "
|
|---|
| 292 | "precaching a file.") );
|
|---|
| 293 |
|
|---|
| 294 | setWhatsThis(cache_streams_spin, tr("Cache for streams"),
|
|---|
| 295 | tr("This option specifies how much memory (in kBytes) to use when "
|
|---|
| 296 | "precaching a URL.") );
|
|---|
| 297 |
|
|---|
| 298 | setWhatsThis(cache_dvds_spin, tr("Cache for DVDs"),
|
|---|
| 299 | tr("This option specifies how much memory (in kBytes) to use when "
|
|---|
| 300 | "precaching a DVD.<br><b>Warning:</b> Seeking might not work "
|
|---|
| 301 | "properly (including chapter switching) when using a cache for DVDs.") );
|
|---|
| 302 |
|
|---|
| 303 | setWhatsThis(cache_cds_spin, tr("Cache for audio CDs"),
|
|---|
| 304 | tr("This option specifies how much memory (in kBytes) to use when "
|
|---|
| 305 | "precaching an audio CD.") );
|
|---|
| 306 |
|
|---|
| 307 | setWhatsThis(cache_vcds_spin, tr("Cache for VCDs"),
|
|---|
| 308 | tr("This option specifies how much memory (in kBytes) to use when "
|
|---|
| 309 | "precaching a VCD.") );
|
|---|
| 310 | }
|
|---|
| 311 |
|
|---|
| 312 | #include "moc_prefperformance.cpp"
|
|---|