[112] | 1 | /* smplayer, GUI front-end for mplayer.
|
---|
[188] | 2 | Copyright (C) 2006-2017 Ricardo Villalba <rvm@users.sourceforge.net>
|
---|
[112] | 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 | #include "mediasettings.h"
|
---|
| 20 | #include "preferences.h"
|
---|
| 21 | #include "global.h"
|
---|
| 22 | #include <QSettings>
|
---|
| 23 |
|
---|
| 24 | using namespace Global;
|
---|
| 25 |
|
---|
| 26 | MediaSettings::MediaSettings() {
|
---|
| 27 | reset();
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | MediaSettings::~MediaSettings() {
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | void MediaSettings::reset() {
|
---|
[176] | 34 | qDebug("MediaSettings::reset");
|
---|
| 35 |
|
---|
[112] | 36 | current_sec = 0;
|
---|
| 37 | //current_sub_id = SubNone;
|
---|
| 38 | current_sub_id = NoneSelected;
|
---|
[176] | 39 | #ifdef MPV_SUPPORT
|
---|
| 40 | current_secondary_sub_id = NoneSelected;
|
---|
| 41 | #endif
|
---|
[112] | 42 | #if PROGRAM_SWITCH
|
---|
| 43 | current_program_id = NoneSelected;
|
---|
| 44 | #endif
|
---|
| 45 | current_video_id = NoneSelected;
|
---|
| 46 | current_audio_id = NoneSelected;
|
---|
| 47 | current_title_id = NoneSelected;
|
---|
| 48 | current_angle_id = NoneSelected;
|
---|
| 49 |
|
---|
| 50 | aspect_ratio_id = AspectAuto;
|
---|
| 51 |
|
---|
[165] | 52 | //fullscreen = false;
|
---|
[112] | 53 | volume = pref->initial_volume;
|
---|
| 54 | mute = false;
|
---|
| 55 | external_subtitles = "";
|
---|
[142] | 56 | external_subtitles_fps = SFPS_None;
|
---|
[112] | 57 | external_audio = "";
|
---|
| 58 | sub_delay=0;
|
---|
| 59 | audio_delay=0;
|
---|
| 60 | sub_pos = pref->initial_sub_pos; // 100% by default
|
---|
| 61 | sub_scale = pref->initial_sub_scale;
|
---|
| 62 | sub_scale_ass = pref->initial_sub_scale_ass;
|
---|
| 63 |
|
---|
[119] | 64 | closed_caption_channel = 0; // disabled
|
---|
| 65 |
|
---|
[112] | 66 | brightness = pref->initial_brightness;
|
---|
| 67 | contrast = pref->initial_contrast;
|
---|
| 68 | gamma = pref->initial_gamma;
|
---|
| 69 | hue = pref->initial_hue;
|
---|
| 70 | saturation = pref->initial_saturation;
|
---|
| 71 |
|
---|
| 72 | audio_equalizer = pref->initial_audio_equalizer;
|
---|
| 73 |
|
---|
| 74 | speed = 1.0;
|
---|
| 75 |
|
---|
| 76 | phase_filter = false;
|
---|
[128] | 77 | deblock_filter = false;
|
---|
[112] | 78 | dering_filter = false;
|
---|
[128] | 79 | gradfun_filter = false;
|
---|
[112] | 80 | noise_filter = false;
|
---|
| 81 | postprocessing_filter = pref->initial_postprocessing;
|
---|
| 82 | upscaling_filter = false;
|
---|
[128] | 83 | current_denoiser = NoDenoise;
|
---|
| 84 | current_unsharp = 0;
|
---|
[112] | 85 |
|
---|
[176] | 86 | stereo3d_in = "none";
|
---|
| 87 | stereo3d_out = QString::null;
|
---|
| 88 |
|
---|
[112] | 89 | //current_deinterlacer = NoDeinterlace;
|
---|
| 90 | current_deinterlacer = pref->initial_deinterlace;
|
---|
| 91 |
|
---|
[188] | 92 | #ifdef INITIAL_BLACKBORDERS
|
---|
| 93 | add_letterbox = pref->initial_blackborders;
|
---|
| 94 | #else
|
---|
[112] | 95 | add_letterbox = false;
|
---|
[188] | 96 | #endif
|
---|
[112] | 97 |
|
---|
[176] | 98 | #ifdef MPLAYER_SUPPORT
|
---|
| 99 | karaoke_filter = false;
|
---|
| 100 | #endif
|
---|
[112] | 101 | extrastereo_filter = false;
|
---|
| 102 | volnorm_filter = pref->initial_volnorm;
|
---|
| 103 |
|
---|
| 104 | audio_use_channels = pref->initial_audio_channels; //ChDefault; // (0)
|
---|
| 105 | stereo_mode = pref->initial_stereo_mode; //Stereo; // (0)
|
---|
| 106 |
|
---|
| 107 | zoom_factor = pref->initial_zoom_factor; // 1.0;
|
---|
| 108 |
|
---|
[188] | 109 | #ifdef MSET_USE_STARTING_TIME
|
---|
[112] | 110 | starting_time = -1; // Not set yet.
|
---|
[188] | 111 | #endif
|
---|
[112] | 112 |
|
---|
| 113 | rotate = NoRotate;
|
---|
| 114 | flip = false;
|
---|
| 115 | mirror = false;
|
---|
| 116 |
|
---|
| 117 | loop = false;
|
---|
| 118 | A_marker = -1;
|
---|
| 119 | B_marker = -1;
|
---|
| 120 |
|
---|
[176] | 121 | #ifdef BOOKMARKS
|
---|
| 122 | // Initialize bookmarks
|
---|
| 123 | bookmarks.clear();
|
---|
| 124 | bookmarks.insert(0, "");
|
---|
| 125 | #endif
|
---|
| 126 |
|
---|
[112] | 127 | is264andHD = false;
|
---|
| 128 |
|
---|
[176] | 129 | current_demuxer = "unknown";
|
---|
| 130 |
|
---|
| 131 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
[112] | 132 | forced_demuxer="";
|
---|
[165] | 133 | if (pref->use_lavf_demuxer) forced_demuxer = "lavf";
|
---|
[112] | 134 |
|
---|
[165] | 135 | forced_video_codec="";
|
---|
| 136 | forced_audio_codec="";
|
---|
| 137 |
|
---|
[112] | 138 | original_demuxer="";
|
---|
[165] | 139 | original_video_codec="";
|
---|
| 140 | original_audio_codec="";
|
---|
[176] | 141 | #endif
|
---|
[112] | 142 |
|
---|
| 143 | mplayer_additional_options="";
|
---|
| 144 | mplayer_additional_video_filters="";
|
---|
| 145 | mplayer_additional_audio_filters="";
|
---|
| 146 |
|
---|
| 147 | win_width=400;
|
---|
| 148 | win_height=300;
|
---|
| 149 | }
|
---|
| 150 |
|
---|
| 151 | double MediaSettings::win_aspect() {
|
---|
| 152 | return (double) win_width / win_height;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | double MediaSettings::aspectToNum(Aspect aspect) {
|
---|
| 156 | double asp;
|
---|
| 157 |
|
---|
| 158 | switch (aspect) {
|
---|
| 159 | case MediaSettings::AspectNone: asp = 0; break;
|
---|
| 160 | case MediaSettings::Aspect43: asp = (double) 4 / 3; break;
|
---|
| 161 | case MediaSettings::Aspect169: asp = (double) 16 / 9; break;
|
---|
| 162 | case MediaSettings::Aspect149: asp = (double) 14 / 9; break;
|
---|
| 163 | case MediaSettings::Aspect1610: asp = (double) 16 / 10; break;
|
---|
| 164 | case MediaSettings::Aspect54: asp = (double) 5 / 4; break;
|
---|
| 165 | case MediaSettings::Aspect235: asp = 2.35; break;
|
---|
| 166 | case MediaSettings::Aspect11: asp = 1; break;
|
---|
| 167 | case MediaSettings::Aspect32: asp = (double) 3 / 2; break;
|
---|
| 168 | case MediaSettings::Aspect1410: asp = (double) 14 / 10; break;
|
---|
[165] | 169 | case MediaSettings::Aspect118: asp = (double) 11 / 8; break;
|
---|
[112] | 170 | case MediaSettings::AspectAuto: asp = win_aspect(); break;
|
---|
| 171 | default: asp = win_aspect();
|
---|
| 172 | qWarning("MediaSettings::aspectToNum: invalid aspect: %d", aspect);
|
---|
| 173 | }
|
---|
| 174 |
|
---|
| 175 | return asp;
|
---|
| 176 | }
|
---|
| 177 |
|
---|
| 178 | QString MediaSettings::aspectToString(Aspect aspect) {
|
---|
| 179 | QString asp_name;
|
---|
| 180 |
|
---|
| 181 | switch (aspect) {
|
---|
| 182 | case MediaSettings::AspectNone: asp_name = QObject::tr("disabled", "aspect_ratio"); break;
|
---|
| 183 | case MediaSettings::Aspect43: asp_name = "4:3"; break;
|
---|
| 184 | case MediaSettings::Aspect169: asp_name = "16:9"; break;
|
---|
| 185 | case MediaSettings::Aspect149: asp_name = "14:9"; break;
|
---|
| 186 | case MediaSettings::Aspect1610: asp_name = "16:10"; break;
|
---|
| 187 | case MediaSettings::Aspect54: asp_name = "5:4"; break;
|
---|
| 188 | case MediaSettings::Aspect235: asp_name = "2.35:1"; break;
|
---|
| 189 | case MediaSettings::Aspect11: asp_name = "1:1"; break;
|
---|
| 190 | case MediaSettings::Aspect32: asp_name = "3:2"; break;
|
---|
| 191 | case MediaSettings::Aspect1410: asp_name = "14:10"; break;
|
---|
[165] | 192 | case MediaSettings::Aspect118: asp_name = "11:8"; break;
|
---|
[112] | 193 | case MediaSettings::AspectAuto: asp_name = QObject::tr("auto", "aspect_ratio"); break;
|
---|
| 194 | default: asp_name = QObject::tr("unknown", "aspect_ratio");
|
---|
| 195 | }
|
---|
| 196 |
|
---|
| 197 | return asp_name;
|
---|
| 198 | }
|
---|
| 199 |
|
---|
| 200 | void MediaSettings::list() {
|
---|
| 201 | qDebug("MediaSettings::list");
|
---|
| 202 |
|
---|
| 203 | qDebug(" current_sec: %f", current_sec);
|
---|
| 204 | qDebug(" current_sub_id: %d", current_sub_id);
|
---|
[176] | 205 | #ifdef MPV_SUPPORT
|
---|
| 206 | qDebug(" current_secondary_sub_id: %d", current_secondary_sub_id);
|
---|
| 207 | #endif
|
---|
[112] | 208 | #if PROGRAM_SWITCH
|
---|
| 209 | qDebug(" current_program_id: %d", current_program_id);
|
---|
| 210 | #endif
|
---|
| 211 | qDebug(" current_video_id: %d", current_video_id);
|
---|
| 212 | qDebug(" current_audio_id: %d", current_audio_id);
|
---|
| 213 | qDebug(" current_title_id: %d", current_title_id);
|
---|
| 214 | qDebug(" current_angle_id: %d", current_angle_id);
|
---|
| 215 |
|
---|
| 216 | qDebug(" aspect_ratio_id: %d", aspect_ratio_id);
|
---|
| 217 | //qDebug(" fullscreen: %d", fullscreen);
|
---|
| 218 | qDebug(" volume: %d", volume);
|
---|
| 219 | qDebug(" mute: %d", mute);
|
---|
| 220 | qDebug(" external_subtitles: '%s'", external_subtitles.toUtf8().data());
|
---|
[142] | 221 | qDebug(" external_subtitles_fps: '%d'", external_subtitles_fps);
|
---|
[112] | 222 | qDebug(" external_audio: '%s'", external_audio.toUtf8().data());
|
---|
| 223 | qDebug(" sub_delay: %d", sub_delay);
|
---|
| 224 | qDebug(" audio_delay: %d", sub_delay);
|
---|
| 225 | qDebug(" sub_pos: %d", sub_pos);
|
---|
| 226 | qDebug(" sub_scale: %f", sub_scale);
|
---|
| 227 | qDebug(" sub_scale_ass: %f", sub_scale_ass);
|
---|
| 228 |
|
---|
[119] | 229 | qDebug(" closed_caption_channel: %d", closed_caption_channel);
|
---|
| 230 |
|
---|
[112] | 231 | qDebug(" brightness: %d", brightness);
|
---|
| 232 | qDebug(" contrast: %d", contrast);
|
---|
| 233 | qDebug(" gamma: %d", gamma);
|
---|
| 234 | qDebug(" hue: %d", hue);
|
---|
| 235 | qDebug(" saturation: %d", saturation);
|
---|
| 236 |
|
---|
| 237 | qDebug(" speed: %f", speed);
|
---|
| 238 |
|
---|
| 239 | qDebug(" phase_filter: %d", phase_filter);
|
---|
| 240 | qDebug(" deblock_filter: %d", deblock_filter);
|
---|
| 241 | qDebug(" dering_filter: %d", dering_filter);
|
---|
[128] | 242 | qDebug(" gradfun_filter: %d", gradfun_filter);
|
---|
[112] | 243 | qDebug(" noise_filter: %d", noise_filter);
|
---|
| 244 | qDebug(" postprocessing_filter: %d", postprocessing_filter);
|
---|
| 245 | qDebug(" upscaling_filter: %d", upscaling_filter);
|
---|
[128] | 246 | qDebug(" current_denoiser: %d", current_denoiser);
|
---|
| 247 | qDebug(" current_unsharp: %d", current_unsharp);
|
---|
[112] | 248 |
|
---|
[176] | 249 | qDebug(" stereo3d_in: %s", stereo3d_in.toUtf8().constData());
|
---|
| 250 | qDebug(" stereo3d_out: %s", stereo3d_out.toUtf8().constData());
|
---|
| 251 |
|
---|
[112] | 252 | qDebug(" current_deinterlacer: %d", current_deinterlacer);
|
---|
| 253 |
|
---|
| 254 | qDebug(" add_letterbox: %d", add_letterbox);
|
---|
| 255 |
|
---|
[176] | 256 | #ifdef MPLAYER_SUPPORT
|
---|
[112] | 257 | qDebug(" karaoke_filter: %d", karaoke_filter);
|
---|
[176] | 258 | #endif
|
---|
[112] | 259 | qDebug(" extrastereo_filter: %d", extrastereo_filter);
|
---|
| 260 | qDebug(" volnorm_filter: %d", volnorm_filter);
|
---|
| 261 |
|
---|
| 262 | qDebug(" audio_use_channels: %d", audio_use_channels);
|
---|
| 263 | qDebug(" stereo_mode: %d", stereo_mode);
|
---|
| 264 |
|
---|
| 265 | qDebug(" zoom_factor: %f", zoom_factor);
|
---|
| 266 |
|
---|
| 267 | qDebug(" rotate: %d", rotate);
|
---|
| 268 | qDebug(" flip: %d", flip);
|
---|
| 269 | qDebug(" mirror: %d", mirror);
|
---|
| 270 |
|
---|
| 271 | qDebug(" loop: %d", loop);
|
---|
| 272 | qDebug(" A_marker: %d", A_marker);
|
---|
| 273 | qDebug(" B_marker: %d", B_marker);
|
---|
| 274 |
|
---|
[176] | 275 | qDebug(" current_demuxer: '%s'", current_demuxer.toUtf8().data());
|
---|
| 276 |
|
---|
| 277 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
[112] | 278 | qDebug(" forced_demuxer: '%s'", forced_demuxer.toUtf8().data());
|
---|
| 279 | qDebug(" forced_video_codec: '%s'", forced_video_codec.toUtf8().data());
|
---|
| 280 | qDebug(" forced_audio_codec: '%s'", forced_video_codec.toUtf8().data());
|
---|
| 281 |
|
---|
| 282 | qDebug(" original_demuxer: '%s'", original_demuxer.toUtf8().data());
|
---|
| 283 | qDebug(" original_video_codec: '%s'", original_video_codec.toUtf8().data());
|
---|
| 284 | qDebug(" original_audio_codec: '%s'", original_video_codec.toUtf8().data());
|
---|
[176] | 285 | #endif
|
---|
[112] | 286 |
|
---|
| 287 | qDebug(" mplayer_additional_options: '%s'", mplayer_additional_options.toUtf8().data());
|
---|
| 288 | qDebug(" mplayer_additional_video_filters: '%s'", mplayer_additional_video_filters.toUtf8().data());
|
---|
| 289 | qDebug(" mplayer_additional_audio_filters: '%s'", mplayer_additional_audio_filters.toUtf8().data());
|
---|
| 290 |
|
---|
| 291 | qDebug(" win_width: %d", win_width);
|
---|
| 292 | qDebug(" win_height: %d", win_height);
|
---|
| 293 | qDebug(" win_aspect(): %f", win_aspect());
|
---|
| 294 |
|
---|
[188] | 295 | #ifdef MSET_USE_STARTING_TIME
|
---|
[112] | 296 | qDebug(" starting_time: %f", starting_time);
|
---|
[188] | 297 | #endif
|
---|
| 298 |
|
---|
[112] | 299 | qDebug(" is264andHD: %d", is264andHD);
|
---|
| 300 | }
|
---|
| 301 |
|
---|
[176] | 302 | void MediaSettings::save(QSettings * set, int player_id) {
|
---|
[112] | 303 | qDebug("MediaSettings::save");
|
---|
| 304 |
|
---|
[176] | 305 | set->beginGroup("player_" + QString::number(player_id));
|
---|
[112] | 306 |
|
---|
[176] | 307 | set->setValue( "current_demuxer", current_demuxer);
|
---|
| 308 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
| 309 | set->setValue( "forced_demuxer", forced_demuxer);
|
---|
| 310 | set->setValue( "forced_video_codec", forced_video_codec);
|
---|
| 311 | set->setValue( "forced_audio_codec", forced_audio_codec);
|
---|
| 312 | set->setValue( "original_demuxer", original_demuxer);
|
---|
| 313 | set->setValue( "original_video_codec", original_video_codec);
|
---|
| 314 | set->setValue( "original_audio_codec", original_audio_codec);
|
---|
| 315 | #endif
|
---|
[112] | 316 |
|
---|
[176] | 317 | // Save the tracks ID in a demuxer section
|
---|
| 318 | QString demuxer_section = QString("demuxer_%1").arg(current_demuxer);
|
---|
| 319 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
| 320 | if (!forced_demuxer.isEmpty()) {
|
---|
| 321 | demuxer_section = QString("demuxer_%1").arg(forced_demuxer);
|
---|
| 322 | }
|
---|
| 323 | #endif
|
---|
[165] | 324 |
|
---|
| 325 | set->beginGroup(demuxer_section);
|
---|
[112] | 326 | set->setValue( "current_sub_id", current_sub_id );
|
---|
[176] | 327 | #ifdef MPV_SUPPORT
|
---|
| 328 | set->setValue( "current_secondary_sub_id", current_secondary_sub_id );
|
---|
| 329 | #endif
|
---|
[165] | 330 | #if PROGRAM_SWITCH
|
---|
[112] | 331 | set->setValue( "current_program_id", current_program_id );
|
---|
[165] | 332 | #endif
|
---|
[112] | 333 | set->setValue( "current_video_id", current_video_id );
|
---|
| 334 | set->setValue( "current_audio_id", current_audio_id );
|
---|
[165] | 335 | set->endGroup();
|
---|
| 336 |
|
---|
[176] | 337 | set->endGroup(); // player
|
---|
| 338 |
|
---|
| 339 |
|
---|
| 340 | set->setValue( "current_sec", current_sec );
|
---|
| 341 |
|
---|
[112] | 342 | set->setValue( "current_title_id", current_title_id );
|
---|
| 343 | set->setValue( "current_angle_id", current_angle_id );
|
---|
| 344 |
|
---|
| 345 | set->setValue( "aspect_ratio", aspect_ratio_id );
|
---|
| 346 | //set->setValue( "fullscreen", fullscreen );
|
---|
| 347 | set->setValue( "volume", volume );
|
---|
| 348 | set->setValue( "mute", mute );
|
---|
| 349 | set->setValue( "external_subtitles", external_subtitles );
|
---|
[142] | 350 | set->setValue( "external_subtitles_fps", external_subtitles_fps );
|
---|
[112] | 351 | set->setValue( "external_audio", external_audio );
|
---|
| 352 | set->setValue( "sub_delay", sub_delay);
|
---|
| 353 | set->setValue( "audio_delay", audio_delay);
|
---|
| 354 | set->setValue( "sub_pos", sub_pos);
|
---|
| 355 | set->setValue( "sub_scale", sub_scale);
|
---|
| 356 | set->setValue( "sub_scale_ass", sub_scale_ass);
|
---|
| 357 |
|
---|
[119] | 358 | set->setValue( "closed_caption_channel", closed_caption_channel);
|
---|
| 359 |
|
---|
[112] | 360 | set->setValue( "brightness", brightness);
|
---|
| 361 | set->setValue( "contrast", contrast);
|
---|
| 362 | set->setValue( "gamma", gamma);
|
---|
| 363 | set->setValue( "hue", hue);
|
---|
| 364 | set->setValue( "saturation", saturation);
|
---|
| 365 |
|
---|
[128] | 366 | set->setValue("audio_equalizer", audio_equalizer );
|
---|
[112] | 367 |
|
---|
| 368 | set->setValue( "speed", speed);
|
---|
| 369 |
|
---|
| 370 | set->setValue( "phase_filter", phase_filter);
|
---|
| 371 | set->setValue( "deblock_filter", deblock_filter);
|
---|
| 372 | set->setValue( "dering_filter", dering_filter);
|
---|
[128] | 373 | set->setValue( "gradfun_filter", gradfun_filter);
|
---|
[112] | 374 | set->setValue( "noise_filter", noise_filter);
|
---|
| 375 | set->setValue( "postprocessing_filter", postprocessing_filter);
|
---|
| 376 | set->setValue( "upscaling_filter", upscaling_filter);
|
---|
[128] | 377 | set->setValue( "current_denoiser", current_denoiser);
|
---|
| 378 | set->setValue( "current_unsharp", current_unsharp);
|
---|
[112] | 379 |
|
---|
[176] | 380 | set->setValue( "stereo3d_in", stereo3d_in);
|
---|
| 381 | set->setValue( "stereo3d_out", stereo3d_out);
|
---|
| 382 |
|
---|
[112] | 383 | set->setValue( "current_deinterlacer", current_deinterlacer);
|
---|
| 384 |
|
---|
| 385 | set->setValue( "add_letterbox", add_letterbox );
|
---|
| 386 |
|
---|
[176] | 387 | #ifdef MPLAYER_SUPPORT
|
---|
[112] | 388 | set->setValue( "karaoke_filter", karaoke_filter);
|
---|
[176] | 389 | #endif
|
---|
[112] | 390 | set->setValue( "extrastereo_filter", extrastereo_filter);
|
---|
| 391 | set->setValue( "volnorm_filter", volnorm_filter);
|
---|
| 392 |
|
---|
| 393 | set->setValue( "audio_use_channels", audio_use_channels);
|
---|
| 394 | set->setValue( "stereo_mode", stereo_mode);
|
---|
| 395 |
|
---|
| 396 | set->setValue( "zoom_factor", zoom_factor);
|
---|
| 397 |
|
---|
| 398 | set->setValue( "rotate", rotate );
|
---|
| 399 | set->setValue( "flip", flip);
|
---|
| 400 | set->setValue( "mirror", mirror);
|
---|
| 401 |
|
---|
| 402 | set->setValue( "loop", loop);
|
---|
| 403 | set->setValue( "A_marker", A_marker);
|
---|
| 404 | set->setValue( "B_marker", B_marker);
|
---|
| 405 |
|
---|
[176] | 406 | #ifdef BOOKMARKS
|
---|
| 407 | // Save bookmarks
|
---|
| 408 | bool save_bookmarks = true;
|
---|
| 409 | QMap<int, QString>::const_iterator i = bookmarks.constBegin();
|
---|
| 410 | if (save_bookmarks) {
|
---|
| 411 | set->beginWriteArray("bookmarks");
|
---|
| 412 | int count = 0;
|
---|
| 413 | while (i != bookmarks.constEnd()) {
|
---|
| 414 | set->setArrayIndex(count);
|
---|
| 415 | set->setValue("time", i.key());
|
---|
| 416 | set->setValue("name", i.value());
|
---|
| 417 | i++;
|
---|
| 418 | count++;
|
---|
| 419 | }
|
---|
| 420 | set->endArray();
|
---|
| 421 | }
|
---|
| 422 | #endif
|
---|
[112] | 423 |
|
---|
| 424 | set->setValue( "mplayer_additional_options", mplayer_additional_options);
|
---|
| 425 | set->setValue( "mplayer_additional_video_filters", mplayer_additional_video_filters);
|
---|
| 426 | set->setValue( "mplayer_additional_audio_filters", mplayer_additional_audio_filters);
|
---|
| 427 |
|
---|
| 428 | set->setValue( "win_width", win_width );
|
---|
| 429 | set->setValue( "win_height", win_height );
|
---|
| 430 |
|
---|
[188] | 431 | #ifdef MSET_USE_STARTING_TIME
|
---|
[112] | 432 | set->setValue( "starting_time", starting_time );
|
---|
[188] | 433 | #endif
|
---|
[112] | 434 |
|
---|
| 435 | set->setValue( "is264andHD", is264andHD );
|
---|
| 436 | }
|
---|
| 437 |
|
---|
[176] | 438 | void MediaSettings::load(QSettings * set, int player_id) {
|
---|
[112] | 439 | qDebug("MediaSettings::load");
|
---|
| 440 |
|
---|
[176] | 441 | set->beginGroup("player_" + QString::number(player_id));
|
---|
[112] | 442 |
|
---|
[176] | 443 | current_demuxer = set->value( "current_demuxer", current_demuxer).toString();
|
---|
| 444 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
[165] | 445 | forced_demuxer = set->value( "forced_demuxer", forced_demuxer).toString();
|
---|
| 446 | if (pref->use_lavf_demuxer) forced_demuxer = "lavf";
|
---|
[176] | 447 | forced_video_codec = set->value( "forced_video_codec", forced_video_codec).toString();
|
---|
| 448 | forced_audio_codec = set->value( "forced_audio_codec", forced_audio_codec).toString();
|
---|
| 449 | original_demuxer = set->value( "original_demuxer", original_demuxer).toString();
|
---|
| 450 | original_video_codec = set->value( "original_video_codec", original_video_codec).toString();
|
---|
| 451 | original_audio_codec = set->value( "original_audio_codec", original_audio_codec).toString();
|
---|
| 452 | #endif
|
---|
[165] | 453 |
|
---|
[176] | 454 | // Load the tracks ID from a demuxer section
|
---|
| 455 | QString demuxer_section = QString("demuxer_%1").arg(current_demuxer);
|
---|
| 456 | #if ALLOW_DEMUXER_CODEC_CHANGE
|
---|
| 457 | if (!forced_demuxer.isEmpty()) {
|
---|
| 458 | demuxer_section = QString("demuxer_%1").arg(forced_demuxer);
|
---|
| 459 | }
|
---|
| 460 | #endif
|
---|
| 461 | qDebug("MediaSettings::load: demuxer_section: %s", demuxer_section.toUtf8().constData());
|
---|
[165] | 462 |
|
---|
| 463 | set->beginGroup(demuxer_section);
|
---|
[176] | 464 | current_sub_id = set->value( "current_sub_id", NoneSelected ).toInt();
|
---|
| 465 | #ifdef MPV_SUPPORT
|
---|
| 466 | current_secondary_sub_id = set->value( "current_secondary_sub_id", NoneSelected ).toInt();
|
---|
| 467 | #endif
|
---|
[165] | 468 | #if PROGRAM_SWITCH
|
---|
[176] | 469 | current_program_id = set->value( "current_program_id", NoneSelected ).toInt();
|
---|
[165] | 470 | #endif
|
---|
[176] | 471 | current_video_id = set->value( "current_video_id", NoneSelected ).toInt();
|
---|
| 472 | current_audio_id = set->value( "current_audio_id", NoneSelected ).toInt();
|
---|
[165] | 473 | set->endGroup();
|
---|
| 474 |
|
---|
[176] | 475 | set->endGroup(); // player
|
---|
| 476 |
|
---|
| 477 |
|
---|
| 478 | current_sec = set->value( "current_sec", current_sec).toDouble();
|
---|
| 479 |
|
---|
[112] | 480 | current_title_id = set->value( "current_title_id", current_title_id ).toInt();
|
---|
| 481 | current_angle_id = set->value( "current_angle_id", current_angle_id ).toInt();
|
---|
| 482 |
|
---|
| 483 | aspect_ratio_id = set->value( "aspect_ratio", aspect_ratio_id ).toInt();
|
---|
| 484 | //fullscreen = set->value( "fullscreen", fullscreen ).toBool();
|
---|
| 485 | volume = set->value( "volume", volume ).toInt();
|
---|
| 486 | mute = set->value( "mute", mute ).toBool();
|
---|
| 487 | external_subtitles = set->value( "external_subtitles", external_subtitles ).toString();
|
---|
[142] | 488 | external_subtitles_fps = set->value( "external_subtitles_fps", external_subtitles_fps ).toInt();
|
---|
[112] | 489 | external_audio = set->value( "external_audio", external_audio ).toString();
|
---|
| 490 | sub_delay = set->value( "sub_delay", sub_delay).toInt();
|
---|
| 491 | audio_delay = set->value( "audio_delay", audio_delay).toInt();
|
---|
| 492 | sub_pos = set->value( "sub_pos", sub_pos).toInt();
|
---|
| 493 | sub_scale = set->value( "sub_scale", sub_scale).toDouble();
|
---|
| 494 | sub_scale_ass = set->value( "sub_scale_ass", sub_scale_ass).toDouble();
|
---|
| 495 |
|
---|
[119] | 496 | closed_caption_channel = set->value( "closed_caption_channel", closed_caption_channel).toInt();
|
---|
| 497 |
|
---|
[112] | 498 | brightness = set->value( "brightness", brightness).toInt();
|
---|
| 499 | contrast = set->value( "contrast", contrast).toInt();
|
---|
| 500 | gamma = set->value( "gamma", gamma).toInt();
|
---|
| 501 | hue = set->value( "hue", hue).toInt();
|
---|
| 502 | saturation = set->value( "saturation", saturation).toInt();
|
---|
| 503 |
|
---|
| 504 | audio_equalizer = set->value("audio_equalizer", audio_equalizer ).toList();
|
---|
| 505 |
|
---|
| 506 | speed = set->value( "speed", speed ).toDouble();
|
---|
| 507 |
|
---|
| 508 | phase_filter = set->value( "phase_filter", phase_filter ).toBool();
|
---|
| 509 | deblock_filter = set->value( "deblock_filter", deblock_filter).toBool();
|
---|
| 510 | dering_filter = set->value( "dering_filter", dering_filter).toBool();
|
---|
[128] | 511 | gradfun_filter = set->value( "gradfun_filter", gradfun_filter).toBool();
|
---|
[112] | 512 | noise_filter = set->value( "noise_filter", noise_filter).toBool();
|
---|
| 513 | postprocessing_filter = set->value( "postprocessing_filter", postprocessing_filter).toBool();
|
---|
| 514 | upscaling_filter = set->value( "upscaling_filter", upscaling_filter).toBool();
|
---|
[128] | 515 | current_denoiser = set->value( "current_denoiser", current_denoiser).toInt();
|
---|
| 516 | current_unsharp = set->value( "current_unsharp", current_unsharp).toInt();
|
---|
[112] | 517 |
|
---|
[176] | 518 | stereo3d_in = set->value( "stereo3d_in", stereo3d_in).toString();
|
---|
| 519 | stereo3d_out = set->value( "stereo3d_out", stereo3d_out).toString();
|
---|
| 520 |
|
---|
[112] | 521 | current_deinterlacer = set->value( "current_deinterlacer", current_deinterlacer ).toInt();
|
---|
| 522 |
|
---|
| 523 | add_letterbox = set->value( "add_letterbox", add_letterbox ).toBool();
|
---|
| 524 |
|
---|
[176] | 525 | #ifdef MPLAYER_SUPPORT
|
---|
[112] | 526 | karaoke_filter = set->value( "karaoke_filter", karaoke_filter).toBool();
|
---|
[176] | 527 | #endif
|
---|
[112] | 528 | extrastereo_filter = set->value( "extrastereo_filter", extrastereo_filter).toBool();
|
---|
| 529 | volnorm_filter = set->value( "volnorm_filter", volnorm_filter).toBool();
|
---|
| 530 |
|
---|
| 531 | audio_use_channels = set->value( "audio_use_channels", audio_use_channels).toInt();
|
---|
| 532 | stereo_mode = set->value( "stereo_mode", stereo_mode).toInt();
|
---|
| 533 |
|
---|
| 534 | zoom_factor = set->value( "zoom_factor", zoom_factor).toDouble();
|
---|
| 535 |
|
---|
| 536 | rotate = set->value( "rotate", rotate).toInt();
|
---|
| 537 | flip = set->value( "flip", flip).toBool();
|
---|
| 538 | mirror = set->value( "mirror", mirror).toBool();
|
---|
| 539 |
|
---|
| 540 | loop = set->value( "loop", loop).toBool();
|
---|
| 541 | A_marker = set->value( "A_marker", A_marker).toInt();
|
---|
| 542 | B_marker = set->value( "B_marker", B_marker).toInt();
|
---|
| 543 |
|
---|
[176] | 544 | #ifdef BOOKMARKS
|
---|
| 545 | // Load bookmarks
|
---|
| 546 | int n_bookmarks = set->beginReadArray("bookmarks");
|
---|
| 547 | if (n_bookmarks > 0) {
|
---|
| 548 | bookmarks.clear();
|
---|
| 549 | for (int i = 0; i < n_bookmarks; ++i) {
|
---|
| 550 | set->setArrayIndex(i);
|
---|
| 551 | int time = set->value("time").toInt();
|
---|
| 552 | QString name = set->value("name").toString();
|
---|
| 553 | bookmarks.insert(time, name);
|
---|
| 554 | }
|
---|
| 555 | }
|
---|
| 556 | set->endArray();
|
---|
| 557 | #endif
|
---|
[112] | 558 |
|
---|
| 559 | mplayer_additional_options = set->value( "mplayer_additional_options", mplayer_additional_options).toString();
|
---|
| 560 | mplayer_additional_video_filters = set->value( "mplayer_additional_video_filters", mplayer_additional_video_filters).toString();
|
---|
| 561 | mplayer_additional_audio_filters = set->value( "mplayer_additional_audio_filters", mplayer_additional_audio_filters).toString();
|
---|
| 562 |
|
---|
| 563 | win_width = set->value( "win_width", win_width ).toInt();
|
---|
| 564 | win_height = set->value( "win_height", win_height ).toInt();
|
---|
| 565 |
|
---|
[188] | 566 | #ifdef MSET_USE_STARTING_TIME
|
---|
[112] | 567 | starting_time = set->value( "starting_time", starting_time ).toDouble();
|
---|
[188] | 568 | #endif
|
---|
[112] | 569 |
|
---|
| 570 | is264andHD = set->value( "is264andHD", is264andHD ).toBool();
|
---|
| 571 |
|
---|
| 572 | // ChDefault not used anymore
|
---|
| 573 | if (audio_use_channels == ChDefault) audio_use_channels = ChStereo;
|
---|
| 574 | }
|
---|
| 575 |
|
---|