1 /*  smplayer, GUI front-end for mplayer.
2     Copyright (C) 2006-2021 Ricardo Villalba <ricardo@smplayer.info>
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 #ifndef MEDIASETTINGS_H
20 #define MEDIASETTINGS_H
21 
22 
23 /* Settings the user has set for this file, and that we need to */
24 /* restore the video after a restart */
25 
26 #include <QString>
27 #include <QSize>
28 #include "config.h"
29 #include "audioequalizerlist.h"
30 #include "tracks.h"
31 #include "subtracks.h"
32 
33 //#define MSET_USE_STARTING_TIME
34 
35 class QSettings;
36 
37 class MediaSettings {
38 
39 public:
40 	enum Denoise { NoDenoise = 0, DenoiseNormal = 1, DenoiseSoft = 2 };
41 	enum Aspect { AspectAuto = 1, Aspect43 = 2, Aspect54 = 3, Aspect149 = 4,
42                   Aspect169 = 5, Aspect1610 = 6, Aspect235 = 7, Aspect11 = 8,
43                   Aspect32 = 9, Aspect1410 = 10, Aspect118 = 11,
44                   AspectNone = 0 };
45 	enum Deinterlace { NoDeinterlace = 0, L5 = 1, Yadif = 2, LB = 3,
46                        Yadif_1 = 4, Kerndeint = 5 };
47 	enum AudioChannels { ChDefault = 0, ChStereo = 2, ChSurround = 4,
48                          ChFull51 = 6, ChFull61 = 7, ChFull71 = 8 };
49 	enum StereoMode { Stereo = 0, Left = 1, Right = 2, Mono = 3, Reverse = 4 };
50 
51 	enum Rotate { NoRotate = -1, Clockwise_flip = 0, Clockwise = 1,
52                   Counterclockwise = 2, Counterclockwise_flip = 3, Rotate_180 = 4 };
53 
54 	enum IDs { NoneSelected = -1000, SubNone = 90000 };
55 
56 	enum SubFPS { SFPS_None, SFPS_23, SFPS_24, SFPS_25, SFPS_30, SFPS_23976, SFPS_29970 };
57 
58 	MediaSettings();
59 	virtual ~MediaSettings();
60 
61 	virtual void reset();
62 
63 	double current_sec;
64 
65 	int current_subtitle_track;
66 #ifdef MPV_SUPPORT
67 	int current_secondary_subtitle_track;
68 #endif
69 
70 #if PROGRAM_SWITCH
71 	int current_program_id;
72 #endif
73 
74 	int current_video_id;
75 	int current_audio_id;
76 
77 	int current_title_id;
78 	int current_angle_id;
79 
80 	int aspect_ratio_id;
81 
82 	//bool fullscreen;
83 
84 	int volume;
85 	bool mute;
86 
87 	int brightness, contrast, gamma, hue, saturation;
88 
89 	AudioEqualizerList audio_equalizer;
90 
91 	QString external_subtitles;
92 	int external_subtitles_fps;
93 	QString external_audio; // external audio file
94 
95 	int sub_delay;
96 	int audio_delay;
97 
98 	// Subtitles position (0-100)
99 	int sub_pos;
100 	double sub_scale;
101 	double sub_scale_ass;
102 
103 	int closed_caption_channel; // 0 = disabled
104 
105 	double speed; // Speed of playback: 1.0 = normal speed
106 
107 	int current_deinterlacer;
108 
109 	bool add_letterbox;
110 
111 	// Filters in menu
112 	bool phase_filter;
113 	bool deblock_filter;
114 	bool dering_filter;
115 	bool gradfun_filter;
116 	bool noise_filter;
117 	bool postprocessing_filter;
118 	bool upscaling_filter; //!< Software scaling
119 
120 	int current_denoiser;
121 	int current_unsharp;
122 
123 	QString stereo3d_in;
124 	QString stereo3d_out;
125 
126 	bool karaoke_filter;
127 	bool extrastereo_filter;
128 	bool volnorm_filter;
129 #ifdef MPV_SUPPORT
130 	bool earwax_filter;
131 #endif
132 
133 	int audio_use_channels;
134 	int stereo_mode;
135 
136 	double zoom_factor; // mplayerwindow zoom
137 
138 	int rotate;
139 	bool flip; //!< Flip image
140 	bool mirror; //!< Mirrors the image on the Y axis.
141 
142 	bool loop; //!< Loop. If true repeat the file
143 	int A_marker;
144 	int B_marker;
145 
146 #ifdef BOOKMARKS
147 	QMap<int, QString> bookmarks;
148 #endif
149 
150 #ifdef MSET_USE_STARTING_TIME
151 	// This a property of the video and it should be
152 	// in mediadata, but we have to save it to preserve
153 	// this data among restarts.
154 	double starting_time; // Some videos don't start at 0
155 #endif
156 
157 	//! The codec of the video is ffh264 and it's high definition
158 	bool is264andHD;
159 
160 	QString current_demuxer;
161 
162 #if ALLOW_DEMUXER_CODEC_CHANGE
163 	// Advanced settings
164 	QString forced_demuxer;
165 	QString forced_video_codec;
166 	QString forced_audio_codec;
167 
168 	// A copy of the original values, so we can restore them.
169 	QString original_demuxer;
170 	QString original_video_codec;
171 	QString original_audio_codec;
172 #endif
173 
174 	// Options to mplayer (for this file only)
175 	QString mplayer_additional_options;
176 	QString mplayer_additional_video_filters;
177 	QString mplayer_additional_audio_filters;
178 
179 	Tracks videos;
180 	Tracks audios;
181 	SubTracks subs;
182 
183 	// Some things that were before in mediadata
184 	// They can vary, because of filters, so better here
185 
186 	// Resolution used by mplayer
187 	// Can be bigger that video resolution
188 	// because of the aspect ratio or expand filter
189 	int win_width;
190 	int win_height;
191 	double win_aspect();
192 
193 	//! Returns the aspect as a double. Returns 0 if aspect == AspectNone.
194 	double aspectToNum(Aspect aspect);
195 	static QString aspectToString(Aspect aspect);
196 
197 	void list();
198 
199 	void save(QSettings * set, int player_id);
200 	void load(QSettings * set, int player_id);
201 };
202 
203 #endif
204