Mercurial > mplayer.hg
annotate command.c @ 22551:45d3681feb02
major man page update
patch by Fernando Tarn (icemanf gmail com) with some fixes by me
(this patch still needs some review; note the added FIXME comment..)
author | kraymer |
---|---|
date | Wed, 14 Mar 2007 14:55:14 +0000 |
parents | b6aa3eedf49b |
children | e1859558b37d |
rev | line source |
---|---|
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1 #include <stdlib.h> |
22478 | 2 #include <inttypes.h> |
3 #include <unistd.h> | |
22483 | 4 #include <string.h> |
22478 | 5 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
6 #include "config.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
7 #include "input/input.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
8 #include "stream/stream.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
9 #include "libmpdemux/demuxer.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
10 #include "libmpdemux/stheader.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
11 #include "mplayer.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
12 #include "libvo/sub.h" |
22478 | 13 #include "m_option.h" |
14 #include "m_property.h" | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
15 #include "help_mp.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
16 #include "metadata.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
17 #include "libmpcodecs/mp_image.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
18 #include "libmpcodecs/vf.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
19 #include "libmpcodecs/vd.h" |
22478 | 20 #include "libvo/video_out.h" |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
21 #include "playtree.h" |
22478 | 22 #include "libao2/audio_out.h" |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
23 #include "mpcommon.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
24 #include "mixer.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
25 #include "libmpdemux/matroska.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
26 #include "libmpcodecs/dec_video.h" |
22478 | 27 #include "vobsub.h" |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
28 #include "spudec.h" |
22478 | 29 #ifdef USE_TV |
30 #include "stream/tv.h" | |
31 #endif | |
32 #ifdef USE_RADIO | |
33 #include "stream/stream_radio.h" | |
34 #endif | |
35 #ifdef HAS_DVBIN_SUPPORT | |
36 #include "stream/dvbin.h" | |
37 #endif | |
38 #ifdef USE_DVDREAD | |
39 #include "stream/stream_dvd.h" | |
40 #endif | |
41 #ifdef USE_DVDNAV | |
42 #include "stream/stream_dvdnav.h" | |
43 #endif | |
44 #ifdef USE_ASS | |
45 #include "libass/ass.h" | |
46 #include "libass/ass_mp.h" | |
47 #endif | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
48 #ifdef HAVE_NEW_GUI |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
49 #include "Gui/interface.h" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
50 #endif |
22478 | 51 |
52 #include "mp_core.h" | |
53 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
54 #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
55 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
56 static void rescale_input_coordinates(int ix, int iy, double *dx, double *dy) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
57 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
58 //remove the borders, if any, and rescale to the range [0,1],[0,1] |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
59 if (vo_fs) { //we are in full-screen mode |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
60 if (vo_screenwidth > vo_dwidth) //there are borders along the x axis |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
61 ix -= (vo_screenwidth - vo_dwidth) / 2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
62 if (vo_screenheight > vo_dheight) //there are borders along the y axis (usual way) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
63 iy -= (vo_screenheight - vo_dheight) / 2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
64 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
65 if (ix < 0 || ix > vo_dwidth) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
66 *dx = *dy = -1.0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
67 return; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
68 } //we are on one of the borders |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
69 if (iy < 0 || iy > vo_dheight) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
70 *dx = *dy = -1.0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
71 return; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
72 } //we are on one of the borders |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
73 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
74 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
75 *dx = (double) ix / (double) vo_dwidth; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
76 *dy = (double) iy / (double) vo_dheight; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
77 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
78 mp_msg(MSGT_CPLAYER, MSGL_V, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
79 "\r\nrescaled coordinates: %.3lf, %.3lf, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
80 *dx, *dy, vo_screenwidth, vo_screenheight, vo_dwidth, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
81 vo_dheight, vo_fs); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
82 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
83 |
22478 | 84 static int sub_source(MPContext * mpctx) |
85 { | |
86 int source = -1; | |
87 int top = -1; | |
88 int i; | |
89 for (i = 0; i < SUB_SOURCES; i++) { | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
90 int j = mpctx->global_sub_indices[i]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
91 if ((j >= 0) && (j > top) && (mpctx->global_sub_pos >= j)) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
92 source = i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
93 top = j; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
94 } |
22478 | 95 } |
96 return source; | |
97 } | |
98 | |
99 /** | |
100 * \brief Log the currently displayed subtitle to a file | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
101 * |
22478 | 102 * Logs the current or last displayed subtitle together with filename |
103 * and time information to ~/.mplayer/subtitle_log | |
104 * | |
105 * Intended purpose is to allow convenient marking of bogus subtitles | |
106 * which need to be fixed while watching the movie. | |
107 */ | |
108 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
109 static void log_sub(void) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
110 { |
22478 | 111 char *fname; |
112 FILE *f; | |
113 int i; | |
114 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
115 if (subdata == NULL || vo_sub_last == NULL) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
116 return; |
22478 | 117 fname = get_path("subtitle_log"); |
118 f = fopen(fname, "a"); | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
119 if (!f) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
120 return; |
22478 | 121 fprintf(f, "----------------------------------------------------------\n"); |
122 if (subdata->sub_uses_time) { | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
123 fprintf(f, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
124 "N: %s S: %02ld:%02ld:%02ld.%02ld E: %02ld:%02ld:%02ld.%02ld\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
125 filename, vo_sub_last->start / 360000, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
126 (vo_sub_last->start / 6000) % 60, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
127 (vo_sub_last->start / 100) % 60, vo_sub_last->start % 100, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
128 vo_sub_last->end / 360000, (vo_sub_last->end / 6000) % 60, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
129 (vo_sub_last->end / 100) % 60, vo_sub_last->end % 100); |
22478 | 130 } else { |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
131 fprintf(f, "N: %s S: %ld E: %ld\n", filename, vo_sub_last->start, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
132 vo_sub_last->end); |
22478 | 133 } |
134 for (i = 0; i < vo_sub_last->lines; i++) { | |
135 fprintf(f, "%s\n", vo_sub_last->text[i]); | |
136 } | |
137 fclose(f); | |
138 } | |
139 | |
140 | |
141 /// \defgroup Properties | |
142 ///@{ | |
143 | |
144 /// \defgroup GeneralProperties General properties | |
145 /// \ingroup Properties | |
146 ///@{ | |
147 | |
148 /// OSD level (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
149 static int mp_property_osdlevel(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
150 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
151 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
152 return m_property_choice(prop, action, arg, &osd_level); |
22478 | 153 } |
154 | |
155 /// Playback speed (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
156 static int mp_property_playback_speed(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
157 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
158 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
159 switch (action) { |
22478 | 160 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
161 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
162 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
163 M_PROPERTY_CLAMP(prop, *(float *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
164 playback_speed = *(float *) arg; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
165 build_afilter_chain(mpctx->sh_audio, &ao_data); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
166 return M_PROPERTY_OK; |
22478 | 167 case M_PROPERTY_STEP_UP: |
168 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
169 playback_speed += (arg ? *(float *) arg : 0.1) * |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
170 (action == M_PROPERTY_STEP_DOWN ? -1 : 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
171 M_PROPERTY_CLAMP(prop, playback_speed); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
172 build_afilter_chain(mpctx->sh_audio, &ao_data); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
173 return M_PROPERTY_OK; |
22478 | 174 } |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
175 return m_property_float_range(prop, action, arg, &playback_speed); |
22478 | 176 } |
177 | |
178 /// filename with path (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
179 static int mp_property_path(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
180 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
181 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
182 return m_property_string_ro(prop, action, arg, filename); |
22478 | 183 } |
184 | |
185 /// filename without path (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
186 static int mp_property_filename(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
187 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
188 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
189 char *f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
190 if (!filename) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
191 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
192 if (((f = strrchr(filename, '/')) || (f = strrchr(filename, '\\'))) && f[1]) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
193 f++; |
22478 | 194 else |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
195 f = filename; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
196 return m_property_string_ro(prop, action, arg, f); |
22478 | 197 } |
198 | |
199 /// Demuxer name (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
200 static int mp_property_demuxer(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
201 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
202 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
203 if (!mpctx->demuxer) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
204 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
205 return m_property_string_ro(prop, action, arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
206 (char *) mpctx->demuxer->desc->name); |
22478 | 207 } |
208 | |
209 /// Position in the stream (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
210 static int mp_property_stream_pos(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
211 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
212 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
213 if (!mpctx->demuxer || !mpctx->demuxer->stream) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
214 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
215 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
216 return M_PROPERTY_ERROR; |
22478 | 217 switch (action) { |
218 case M_PROPERTY_GET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
219 *(off_t *) arg = stream_tell(mpctx->demuxer->stream); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
220 return M_PROPERTY_OK; |
22478 | 221 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
222 M_PROPERTY_CLAMP(prop, *(off_t *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
223 stream_seek(mpctx->demuxer->stream, *(off_t *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
224 return M_PROPERTY_OK; |
22478 | 225 } |
226 return M_PROPERTY_NOT_IMPLEMENTED; | |
227 } | |
228 | |
229 /// Stream start offset (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
230 static int mp_property_stream_start(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
231 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
232 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
233 if (!mpctx->demuxer || !mpctx->demuxer->stream) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
234 return M_PROPERTY_UNAVAILABLE; |
22478 | 235 switch (action) { |
236 case M_PROPERTY_GET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
237 *(off_t *) arg = mpctx->demuxer->stream->start_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
238 return M_PROPERTY_OK; |
22478 | 239 } |
240 return M_PROPERTY_NOT_IMPLEMENTED; | |
241 } | |
242 | |
243 /// Stream end offset (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
244 static int mp_property_stream_end(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
245 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
246 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
247 if (!mpctx->demuxer || !mpctx->demuxer->stream) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
248 return M_PROPERTY_UNAVAILABLE; |
22478 | 249 switch (action) { |
250 case M_PROPERTY_GET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
251 *(off_t *) arg = mpctx->demuxer->stream->end_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
252 return M_PROPERTY_OK; |
22478 | 253 } |
254 return M_PROPERTY_NOT_IMPLEMENTED; | |
255 } | |
256 | |
257 /// Stream length (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
258 static int mp_property_stream_length(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
259 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
260 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
261 if (!mpctx->demuxer || !mpctx->demuxer->stream) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
262 return M_PROPERTY_UNAVAILABLE; |
22478 | 263 switch (action) { |
264 case M_PROPERTY_GET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
265 *(off_t *) arg = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
266 mpctx->demuxer->stream->end_pos - mpctx->demuxer->stream->start_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
267 return M_PROPERTY_OK; |
22478 | 268 } |
269 return M_PROPERTY_NOT_IMPLEMENTED; | |
270 } | |
271 | |
272 /// Media length in seconds (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
273 static int mp_property_length(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
274 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
275 { |
22478 | 276 double len; |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
277 |
22478 | 278 if (!mpctx->demuxer || |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
279 !(int) (len = demuxer_get_time_length(mpctx->demuxer))) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
280 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
281 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
282 switch (action) { |
22478 | 283 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
284 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
285 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
286 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
287 int h, m, s = len; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
288 h = s / 3600; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
289 s -= h * 3600; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
290 m = s / 60; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
291 s -= m * 60; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
292 *(char **) arg = malloc(20); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
293 if (h > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
294 sprintf(*(char **) arg, "%d:%02d:%02d", h, m, s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
295 else if (m > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
296 sprintf(*(char **) arg, "%d:%02d", m, s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
297 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
298 sprintf(*(char **) arg, "%d", s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
299 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
300 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
301 break; |
22478 | 302 } |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
303 return m_property_double_ro(prop, action, arg, len); |
22478 | 304 } |
305 | |
306 ///@} | |
307 | |
308 /// \defgroup AudioProperties Audio properties | |
309 /// \ingroup Properties | |
310 ///@{ | |
311 | |
312 /// Volume (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
313 static int mp_property_volume(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
314 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
315 { |
22478 | 316 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
317 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
318 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
319 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
320 switch (action) { |
22478 | 321 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
322 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
323 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
324 mixer_getbothvolume(&mpctx->mixer, arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
325 return M_PROPERTY_OK; |
22478 | 326 case M_PROPERTY_PRINT:{ |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
327 float vol; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
328 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
329 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
330 mixer_getbothvolume(&mpctx->mixer, &vol); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
331 return m_property_float_range(prop, action, arg, &vol); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
332 } |
22478 | 333 case M_PROPERTY_STEP_UP: |
334 case M_PROPERTY_STEP_DOWN: | |
335 case M_PROPERTY_SET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
336 break; |
22478 | 337 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
338 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 339 } |
340 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
341 if (mpctx->edl_muted) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
342 return M_PROPERTY_DISABLED; |
22478 | 343 mpctx->user_muted = 0; |
344 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
345 switch (action) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
346 case M_PROPERTY_SET: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
347 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
348 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
349 M_PROPERTY_CLAMP(prop, *(float *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
350 mixer_setvolume(&mpctx->mixer, *(float *) arg, *(float *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
351 return M_PROPERTY_OK; |
22478 | 352 case M_PROPERTY_STEP_UP: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
353 if (arg && *(float *) arg <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
354 mixer_decvolume(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
355 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
356 mixer_incvolume(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
357 return M_PROPERTY_OK; |
22478 | 358 case M_PROPERTY_STEP_DOWN: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
359 if (arg && *(float *) arg <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
360 mixer_incvolume(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
361 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
362 mixer_decvolume(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
363 return M_PROPERTY_OK; |
22478 | 364 } |
365 return M_PROPERTY_NOT_IMPLEMENTED; | |
366 } | |
367 | |
368 /// Mute (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
369 static int mp_property_mute(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
370 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
371 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
372 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
373 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
374 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
375 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
376 switch (action) { |
22478 | 377 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
378 if (mpctx->edl_muted) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
379 return M_PROPERTY_DISABLED; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
380 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
381 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
382 if ((!!*(int *) arg) != mpctx->mixer.muted) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
383 mixer_mute(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
384 mpctx->user_muted = mpctx->mixer.muted; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
385 return M_PROPERTY_OK; |
22478 | 386 case M_PROPERTY_STEP_UP: |
387 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
388 if (mpctx->edl_muted) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
389 return M_PROPERTY_DISABLED; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
390 mixer_mute(&mpctx->mixer); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
391 mpctx->user_muted = mpctx->mixer.muted; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
392 return M_PROPERTY_OK; |
22478 | 393 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
394 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
395 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
396 if (mpctx->edl_muted) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
397 *(char **) arg = strdup(MSGTR_EnabledEdl); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
398 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
399 } |
22478 | 400 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
401 return m_property_flag(prop, action, arg, &mpctx->mixer.muted); |
22478 | 402 |
403 } | |
404 } | |
405 | |
406 /// Audio delay (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
407 static int mp_property_audio_delay(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
408 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
409 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
410 if (!(mpctx->sh_audio && mpctx->sh_video)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
411 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
412 switch (action) { |
22478 | 413 case M_PROPERTY_SET: |
414 case M_PROPERTY_STEP_UP: | |
415 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
416 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
417 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
418 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
419 float delay = audio_delay; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
420 m_property_delay(prop, action, arg, &audio_delay); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
421 if (mpctx->sh_audio) |
22488 | 422 mpctx->delay -= audio_delay - delay; |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
423 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
424 return M_PROPERTY_OK; |
22478 | 425 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
426 return m_property_delay(prop, action, arg, &audio_delay); |
22478 | 427 } |
428 } | |
429 | |
430 /// Audio codec tag (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
431 static int mp_property_audio_format(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
432 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
433 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
434 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
435 return M_PROPERTY_UNAVAILABLE; |
22478 | 436 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->format); |
437 } | |
438 | |
439 /// Audio bitrate (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
440 static int mp_property_audio_bitrate(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
441 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
442 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
443 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
444 return M_PROPERTY_UNAVAILABLE; |
22478 | 445 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->i_bps); |
446 } | |
447 | |
448 /// Samplerate (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
449 static int mp_property_samplerate(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
450 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
451 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
452 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
453 return M_PROPERTY_UNAVAILABLE; |
22478 | 454 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->samplerate); |
455 } | |
456 | |
457 /// Number of channels (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
458 static int mp_property_channels(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
459 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
460 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
461 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
462 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
463 switch (action) { |
22478 | 464 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
465 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
466 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
467 switch (mpctx->sh_audio->channels) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
468 case 1: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
469 *(char **) arg = strdup("mono"); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
470 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
471 case 2: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
472 *(char **) arg = strdup("stereo"); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
473 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
474 default: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
475 *(char **) arg = malloc(32); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
476 sprintf(*(char **) arg, "%d channels", mpctx->sh_audio->channels); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
477 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
478 return M_PROPERTY_OK; |
22478 | 479 } |
480 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->channels); | |
481 } | |
482 | |
483 /// Selected audio id (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
484 static int mp_property_audio(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
485 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
486 { |
22478 | 487 int current_id = -1, tmp; |
488 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
489 switch (action) { |
22478 | 490 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
491 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
492 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
493 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
494 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
495 *(int *) arg = audio_id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
496 return M_PROPERTY_OK; |
22478 | 497 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
498 if (!mpctx->sh_audio) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
499 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
500 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
501 return M_PROPERTY_ERROR; |
22478 | 502 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
503 if (audio_id < 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
504 *(char **) arg = strdup(MSGTR_Disabled); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
505 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
506 char lang[40] = MSGTR_Unknown; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
507 if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
508 demux_mkv_get_audio_lang(mpctx->demuxer, audio_id, lang, 9); |
22478 | 509 #ifdef USE_DVDREAD |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
510 else if (mpctx->stream->type == STREAMTYPE_DVD) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
511 int code = dvd_lang_from_aid(mpctx->stream, audio_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
512 if (code) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
513 lang[0] = code >> 8; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
514 lang[1] = code; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
515 lang[2] = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
516 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
517 } |
22478 | 518 #endif |
519 | |
520 #ifdef USE_DVDNAV | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
521 else if (mpctx->stream->type == STREAMTYPE_DVDNAV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
522 dvdnav_lang_from_aid(mpctx->stream, audio_id, lang); |
22478 | 523 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
524 *(char **) arg = malloc(64); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
525 snprintf(*(char **) arg, 64, "(%d) %s", audio_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
526 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
527 return M_PROPERTY_OK; |
22478 | 528 |
529 case M_PROPERTY_STEP_UP: | |
530 case M_PROPERTY_SET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
531 if (action == M_PROPERTY_SET && arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
532 tmp = *((int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
533 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
534 tmp = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
535 current_id = mpctx->demuxer->audio->id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
536 audio_id = demuxer_switch_audio(mpctx->demuxer, tmp); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
537 if (audio_id == -2 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
538 || (audio_id > -1 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
539 && mpctx->demuxer->audio->id != current_id && current_id != -2)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
540 uninit_player(INITED_AO | INITED_ACODEC); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
541 if (audio_id > -1 && mpctx->demuxer->audio->id != current_id) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
542 sh_audio_t *sh2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
543 sh2 = mpctx->demuxer->a_streams[mpctx->demuxer->audio->id]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
544 if (sh2) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
545 sh2->ds = mpctx->demuxer->audio; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
546 mpctx->sh_audio = sh2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
547 reinit_audio_chain(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
548 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
549 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
550 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_TRACK=%d\n", audio_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
551 return M_PROPERTY_OK; |
22478 | 552 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
553 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 554 } |
555 | |
556 } | |
557 | |
558 /// Selected video id (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
559 static int mp_property_video(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
560 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
561 { |
22478 | 562 int current_id = -1, tmp; |
563 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
564 switch (action) { |
22478 | 565 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
566 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
567 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
568 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
569 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
570 *(int *) arg = video_id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
571 return M_PROPERTY_OK; |
22478 | 572 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
573 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
574 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
575 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
576 return M_PROPERTY_ERROR; |
22478 | 577 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
578 if (video_id < 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
579 *(char **) arg = strdup(MSGTR_Disabled); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
580 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
581 char lang[40] = MSGTR_Unknown; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
582 *(char **) arg = malloc(64); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
583 snprintf(*(char **) arg, 64, "(%d) %s", video_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
584 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
585 return M_PROPERTY_OK; |
22478 | 586 |
587 case M_PROPERTY_STEP_UP: | |
588 case M_PROPERTY_SET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
589 current_id = mpctx->demuxer->video->id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
590 if (action == M_PROPERTY_SET && arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
591 tmp = *((int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
592 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
593 tmp = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
594 video_id = demuxer_switch_video(mpctx->demuxer, tmp); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
595 if (video_id == -2 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
596 || (video_id > -1 && mpctx->demuxer->video->id != current_id |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
597 && current_id != -2)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
598 uninit_player(INITED_VCODEC | |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
599 (fixed_vo && video_id != -2 ? 0 : INITED_VO)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
600 if (video_id > -1 && mpctx->demuxer->video->id != current_id) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
601 sh_video_t *sh2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
602 sh2 = mpctx->demuxer->v_streams[mpctx->demuxer->video->id]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
603 if (sh2) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
604 sh2->ds = mpctx->demuxer->video; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
605 mpctx->sh_video = sh2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
606 reinit_video_chain(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
607 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
608 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
609 mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_VIDEO_TRACK=%d\n", video_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
610 return M_PROPERTY_OK; |
22478 | 611 |
612 default: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
613 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 614 } |
615 } | |
616 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
617 static int mp_property_program(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
618 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
619 { |
22478 | 620 demux_program_t prog; |
621 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
622 switch (action) { |
22478 | 623 case M_PROPERTY_STEP_UP: |
624 case M_PROPERTY_SET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
625 if (action == M_PROPERTY_SET && arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
626 prog.progid = *((int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
627 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
628 prog.progid = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
629 if (demux_control |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
630 (mpctx->demuxer, DEMUXER_CTRL_IDENTIFY_PROGRAM, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
631 &prog) == DEMUXER_CTRL_NOTIMPL) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
632 return M_PROPERTY_ERROR; |
22478 | 633 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
634 mp_property_do("switch_audio", M_PROPERTY_SET, &prog.aid, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
635 mp_property_do("switch_video", M_PROPERTY_SET, &prog.vid, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
636 return M_PROPERTY_OK; |
22478 | 637 |
638 default: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
639 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 640 } |
641 } | |
642 | |
643 ///@} | |
644 | |
645 /// \defgroup VideoProperties Video properties | |
646 /// \ingroup Properties | |
647 ///@{ | |
648 | |
649 /// Fullscreen state (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
650 static int mp_property_fullscreen(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
651 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
652 { |
22478 | 653 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
654 if (!mpctx->video_out) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
655 return M_PROPERTY_UNAVAILABLE; |
22478 | 656 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
657 switch (action) { |
22478 | 658 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
659 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
660 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
661 M_PROPERTY_CLAMP(prop, *(int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
662 if (vo_fs == !!*(int *) arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
663 return M_PROPERTY_OK; |
22478 | 664 case M_PROPERTY_STEP_UP: |
665 case M_PROPERTY_STEP_DOWN: | |
666 #ifdef HAVE_NEW_GUI | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
667 if (use_gui) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
668 guiGetEvent(guiIEvent, (char *) MP_CMD_GUI_FULLSCREEN); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
669 else |
22478 | 670 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
671 if (vo_config_count) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
672 mpctx->video_out->control(VOCTRL_FULLSCREEN, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
673 return M_PROPERTY_OK; |
22478 | 674 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
675 return m_property_flag(prop, action, arg, &vo_fs); |
22478 | 676 } |
677 } | |
678 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
679 static int mp_property_deinterlace(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
680 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
681 { |
22478 | 682 int deinterlace; |
683 vf_instance_t *vf; | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
684 if (!mpctx->sh_video || !mpctx->sh_video->vfilter) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
685 return M_PROPERTY_UNAVAILABLE; |
22478 | 686 vf = mpctx->sh_video->vfilter; |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
687 switch (action) { |
22478 | 688 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
689 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
690 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
691 vf->control(vf, VFCTRL_GET_DEINTERLACE, arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
692 return M_PROPERTY_OK; |
22478 | 693 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
694 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
695 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
696 M_PROPERTY_CLAMP(prop, *(int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
697 vf->control(vf, VFCTRL_SET_DEINTERLACE, arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
698 return M_PROPERTY_OK; |
22478 | 699 case M_PROPERTY_STEP_UP: |
700 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
701 vf->control(vf, VFCTRL_GET_DEINTERLACE, &deinterlace); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
702 deinterlace = !deinterlace; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
703 vf->control(vf, VFCTRL_SET_DEINTERLACE, &deinterlace); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
704 return M_PROPERTY_OK; |
22478 | 705 } |
706 return M_PROPERTY_NOT_IMPLEMENTED; | |
707 } | |
708 | |
709 /// Panscan (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
710 static int mp_property_panscan(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
711 MPContext * mpctx) |
22478 | 712 { |
713 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
714 if (!mpctx->video_out |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
715 || mpctx->video_out->control(VOCTRL_GET_PANSCAN, NULL) != VO_TRUE) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
716 return M_PROPERTY_UNAVAILABLE; |
22478 | 717 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
718 switch (action) { |
22478 | 719 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
720 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
721 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
722 M_PROPERTY_CLAMP(prop, *(float *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
723 vo_panscan = *(float *) arg; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
724 mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
725 return M_PROPERTY_OK; |
22478 | 726 case M_PROPERTY_STEP_UP: |
727 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
728 vo_panscan += (arg ? *(float *) arg : 0.1) * |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
729 (action == M_PROPERTY_STEP_DOWN ? -1 : 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
730 if (vo_panscan > 1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
731 vo_panscan = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
732 else if (vo_panscan < 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
733 vo_panscan = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
734 mpctx->video_out->control(VOCTRL_SET_PANSCAN, NULL); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
735 return M_PROPERTY_OK; |
22478 | 736 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
737 return m_property_float_range(prop, action, arg, &vo_panscan); |
22478 | 738 } |
739 } | |
740 | |
741 /// Helper to set vo flags. | |
742 /** \ingroup PropertyImplHelper | |
743 */ | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
744 static int mp_property_vo_flag(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
745 int vo_ctrl, int *vo_var, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
746 { |
22478 | 747 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
748 if (!mpctx->video_out) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
749 return M_PROPERTY_UNAVAILABLE; |
22478 | 750 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
751 switch (action) { |
22478 | 752 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
753 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
754 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
755 M_PROPERTY_CLAMP(prop, *(int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
756 if (*vo_var == !!*(int *) arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
757 return M_PROPERTY_OK; |
22478 | 758 case M_PROPERTY_STEP_UP: |
759 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
760 if (vo_config_count) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
761 mpctx->video_out->control(vo_ctrl, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
762 return M_PROPERTY_OK; |
22478 | 763 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
764 return m_property_flag(prop, action, arg, vo_var); |
22478 | 765 } |
766 } | |
767 | |
768 /// Window always on top (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
769 static int mp_property_ontop(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
770 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
771 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
772 return mp_property_vo_flag(prop, action, arg, VOCTRL_ONTOP, &vo_ontop, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
773 mpctx); |
22478 | 774 } |
775 | |
776 /// Display in the root window (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
777 static int mp_property_rootwin(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
778 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
779 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
780 return mp_property_vo_flag(prop, action, arg, VOCTRL_ROOTWIN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
781 &vo_rootwin, mpctx); |
22478 | 782 } |
783 | |
784 /// Show window borders (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
785 static int mp_property_border(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
786 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
787 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
788 return mp_property_vo_flag(prop, action, arg, VOCTRL_BORDER, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
789 &vo_border, mpctx); |
22478 | 790 } |
791 | |
792 /// Framedropping state (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
793 static int mp_property_framedropping(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
794 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
795 { |
22478 | 796 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
797 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
798 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
799 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
800 switch (action) { |
22478 | 801 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
802 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
803 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
804 *(char **) arg = strdup(frame_dropping == 1 ? MSGTR_Enabled : |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
805 (frame_dropping == 2 ? MSGTR_HardFrameDrop : |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
806 MSGTR_Disabled)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
807 return M_PROPERTY_OK; |
22478 | 808 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
809 return m_property_choice(prop, action, arg, &frame_dropping); |
22478 | 810 } |
811 } | |
812 | |
813 /// Color settings, try to use vf/vo then fall back on TV. (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
814 static int mp_property_gamma(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
815 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
816 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
817 int *gamma = prop->priv, r; |
22478 | 818 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
819 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
820 return M_PROPERTY_UNAVAILABLE; |
22478 | 821 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
822 if (gamma[0] == 1000) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
823 gamma[0] = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
824 get_video_colors(mpctx->sh_video, prop->name, gamma); |
22478 | 825 } |
826 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
827 switch (action) { |
22478 | 828 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
829 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
830 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
831 M_PROPERTY_CLAMP(prop, *(int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
832 *gamma = *(int *) arg; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
833 r = set_video_colors(mpctx->sh_video, prop->name, *gamma); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
834 if (r <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
835 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
836 return r; |
22478 | 837 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
838 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
839 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
840 r = get_video_colors(mpctx->sh_video, prop->name, arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
841 if (r <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
842 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
843 return r; |
22478 | 844 case M_PROPERTY_STEP_UP: |
845 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
846 *gamma += (arg ? *(int *) arg : 1) * |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
847 (action == M_PROPERTY_STEP_DOWN ? -1 : 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
848 M_PROPERTY_CLAMP(prop, *gamma); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
849 r = set_video_colors(mpctx->sh_video, prop->name, *gamma); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
850 if (r <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
851 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
852 return r; |
22478 | 853 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
854 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 855 } |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
856 |
22478 | 857 #ifdef USE_TV |
858 if (mpctx->demuxer->type == DEMUXER_TYPE_TV) { | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
859 int l = strlen(prop->name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
860 char tv_prop[3 + l + 1]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
861 sprintf(tv_prop, "tv_%s", prop->name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
862 return mp_property_do(tv_prop, action, arg, mpctx); |
22478 | 863 } |
864 #endif | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
865 |
22478 | 866 return M_PROPERTY_UNAVAILABLE; |
867 } | |
868 | |
869 /// VSync (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
870 static int mp_property_vsync(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
871 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
872 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
873 return m_property_flag(prop, action, arg, &vo_vsync); |
22478 | 874 } |
875 | |
876 /// Video codec tag (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
877 static int mp_property_video_format(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
878 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
879 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
880 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
881 return M_PROPERTY_UNAVAILABLE; |
22478 | 882 return m_property_int_ro(prop, action, arg, mpctx->sh_video->format); |
883 } | |
884 | |
885 /// Video bitrate (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
886 static int mp_property_video_bitrate(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
887 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
888 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
889 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
890 return M_PROPERTY_UNAVAILABLE; |
22478 | 891 return m_property_int_ro(prop, action, arg, mpctx->sh_video->i_bps); |
892 } | |
893 | |
894 /// Video display width (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
895 static int mp_property_width(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
896 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
897 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
898 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
899 return M_PROPERTY_UNAVAILABLE; |
22478 | 900 return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_w); |
901 } | |
902 | |
903 /// Video display height (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
904 static int mp_property_height(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
905 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
906 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
907 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
908 return M_PROPERTY_UNAVAILABLE; |
22478 | 909 return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_h); |
910 } | |
911 | |
912 /// Video fps (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
913 static int mp_property_fps(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
914 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
915 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
916 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
917 return M_PROPERTY_UNAVAILABLE; |
22478 | 918 return m_property_float_ro(prop, action, arg, mpctx->sh_video->fps); |
919 } | |
920 | |
921 /// Video aspect (RO) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
922 static int mp_property_aspect(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
923 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
924 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
925 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
926 return M_PROPERTY_UNAVAILABLE; |
22478 | 927 return m_property_float_ro(prop, action, arg, mpctx->sh_video->aspect); |
928 } | |
929 | |
930 ///@} | |
931 | |
932 /// \defgroup SubProprties Subtitles properties | |
933 /// \ingroup Properties | |
934 ///@{ | |
935 | |
936 /// Text subtitle position (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
937 static int mp_property_sub_pos(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
938 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
939 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
940 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
941 return M_PROPERTY_UNAVAILABLE; |
22478 | 942 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
943 switch (action) { |
22478 | 944 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
945 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
946 return M_PROPERTY_ERROR; |
22478 | 947 case M_PROPERTY_STEP_UP: |
948 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
949 vo_osd_changed(OSDTYPE_SUBTITLE); |
22478 | 950 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
951 return m_property_int_range(prop, action, arg, &sub_pos); |
22478 | 952 } |
953 } | |
954 | |
955 /// Selected subtitles (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
956 static int mp_property_sub(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
957 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
958 { |
22478 | 959 demux_stream_t *const d_sub = mpctx->d_sub; |
960 const int global_sub_size = mpctx->global_sub_size; | |
961 int source = -1, reset_spu = 0; | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
962 char *sub_name; |
22478 | 963 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
964 if (global_sub_size <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
965 return M_PROPERTY_UNAVAILABLE; |
22478 | 966 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
967 switch (action) { |
22478 | 968 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
969 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
970 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
971 *(int *) arg = mpctx->global_sub_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
972 return M_PROPERTY_OK; |
22478 | 973 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
974 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
975 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
976 *(char **) arg = malloc(64); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
977 (*(char **) arg)[63] = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
978 sub_name = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
979 if (subdata) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
980 sub_name = subdata->filename; |
22478 | 981 #ifdef USE_ASS |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
982 if (ass_track && ass_track->name) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
983 sub_name = ass_track->name; |
22478 | 984 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
985 if (sub_name) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
986 char *tmp, *tmp2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
987 tmp = sub_name; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
988 if ((tmp2 = strrchr(tmp, '/'))) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
989 tmp = tmp2 + 1; |
22478 | 990 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
991 snprintf(*(char **) arg, 63, "(%d) %s%s", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
992 mpctx->set_of_sub_pos + 1, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
993 strlen(tmp) < 20 ? "" : "...", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
994 strlen(tmp) < 20 ? tmp : tmp + strlen(tmp) - 19); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
995 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
996 } |
22478 | 997 #ifdef USE_DVDNAV |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
998 if (mpctx->stream->type == STREAMTYPE_DVDNAV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
999 if (vo_spudec && dvdsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1000 unsigned char lang[3]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1001 if (dvdnav_lang_from_sid(mpctx->stream, dvdsub_id, lang)) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1002 snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1003 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1004 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1005 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1006 } |
22478 | 1007 #endif |
1008 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1009 if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA && dvdsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1010 char lang[40] = MSGTR_Unknown; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1011 demux_mkv_get_sub_lang(mpctx->demuxer, dvdsub_id, lang, 9); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1012 snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1013 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1014 } |
22478 | 1015 #ifdef HAVE_OGGVORBIS |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1016 if (mpctx->demuxer->type == DEMUXER_TYPE_OGG && d_sub && dvdsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1017 char *lang = demux_ogg_sub_lang(mpctx->demuxer, dvdsub_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1018 if (!lang) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1019 lang = MSGTR_Unknown; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1020 snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1021 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1022 } |
22478 | 1023 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1024 if (vo_vobsub && vobsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1025 const char *language = MSGTR_Unknown; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1026 language = vobsub_get_id(vo_vobsub, (unsigned int) vobsub_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1027 snprintf(*(char **) arg, 63, "(%d) %s", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1028 vobsub_id, language ? language : MSGTR_Unknown); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1029 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1030 } |
22478 | 1031 #ifdef USE_DVDREAD |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1032 if (vo_spudec && mpctx->stream->type == STREAMTYPE_DVD |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1033 && dvdsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1034 char lang[3]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1035 int code = dvd_lang_from_sid(mpctx->stream, dvdsub_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1036 lang[0] = code >> 8; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1037 lang[1] = code; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1038 lang[2] = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1039 snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, lang); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1040 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1041 } |
22478 | 1042 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1043 if (dvdsub_id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1044 snprintf(*(char **) arg, 63, "(%d) %s", dvdsub_id, MSGTR_Unknown); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1045 return M_PROPERTY_OK; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1046 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1047 snprintf(*(char **) arg, 63, MSGTR_Disabled); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1048 return M_PROPERTY_OK; |
22478 | 1049 |
1050 case M_PROPERTY_SET: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1051 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1052 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1053 if (*(int *) arg < -1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1054 *(int *) arg = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1055 else if (*(int *) arg >= global_sub_size) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1056 *(int *) arg = global_sub_size - 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1057 mpctx->global_sub_pos = *(int *) arg; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1058 break; |
22478 | 1059 case M_PROPERTY_STEP_UP: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1060 mpctx->global_sub_pos += 2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1061 mpctx->global_sub_pos = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1062 (mpctx->global_sub_pos % (global_sub_size + 1)) - 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1063 break; |
22478 | 1064 case M_PROPERTY_STEP_DOWN: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1065 mpctx->global_sub_pos += global_sub_size + 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1066 mpctx->global_sub_pos = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1067 (mpctx->global_sub_pos % (global_sub_size + 1)) - 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1068 break; |
22478 | 1069 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1070 return M_PROPERTY_NOT_IMPLEMENTED; |
22478 | 1071 } |
1072 | |
1073 if (mpctx->global_sub_pos >= 0) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1074 source = sub_source(mpctx); |
22478 | 1075 |
1076 mp_msg(MSGT_CPLAYER, MSGL_DBG3, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1077 "subtitles: %d subs, (v@%d s@%d d@%d), @%d, source @%d\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1078 global_sub_size, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1079 mpctx->global_sub_indices[SUB_SOURCE_VOBSUB], |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1080 mpctx->global_sub_indices[SUB_SOURCE_SUBS], |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1081 mpctx->global_sub_indices[SUB_SOURCE_DEMUX], |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1082 mpctx->global_sub_pos, source); |
22478 | 1083 |
1084 mpctx->set_of_sub_pos = -1; | |
1085 subdata = NULL; | |
1086 vo_sub_last = vo_sub = NULL; | |
1087 | |
1088 vobsub_id = -1; | |
1089 dvdsub_id = -1; | |
1090 if (d_sub) { | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1091 if (d_sub->id > -2) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1092 reset_spu = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1093 d_sub->id = -2; |
22478 | 1094 } |
1095 #ifdef USE_ASS | |
1096 ass_track = 0; | |
1097 #endif | |
1098 | |
1099 if (source == SUB_SOURCE_VOBSUB) { | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1100 vobsub_id = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1101 mpctx->global_sub_pos - |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1102 mpctx->global_sub_indices[SUB_SOURCE_VOBSUB]; |
22478 | 1103 } else if (source == SUB_SOURCE_SUBS) { |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1104 mpctx->set_of_sub_pos = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1105 mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_SUBS]; |
22478 | 1106 #ifdef USE_ASS |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1107 if (ass_enabled && mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos]) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1108 ass_track = mpctx->set_of_ass_tracks[mpctx->set_of_sub_pos]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1109 else |
22478 | 1110 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1111 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1112 subdata = mpctx->set_of_subtitles[mpctx->set_of_sub_pos]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1113 vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1114 } |
22478 | 1115 } else if (source == SUB_SOURCE_DEMUX) { |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1116 dvdsub_id = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1117 mpctx->global_sub_pos - mpctx->global_sub_indices[SUB_SOURCE_DEMUX]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1118 if (d_sub) { |
22478 | 1119 #ifdef USE_DVDREAD |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1120 if (vo_spudec && mpctx->stream->type == STREAMTYPE_DVD) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1121 d_sub->id = dvdsub_id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1122 } |
22478 | 1123 #endif |
1124 | |
1125 #ifdef USE_DVDNAV | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1126 if (vo_spudec && mpctx->stream->type == STREAMTYPE_DVDNAV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1127 d_sub->id = dvdsub_id; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1128 } |
22478 | 1129 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1130 if (mpctx->stream->type != STREAMTYPE_DVD |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1131 && mpctx->stream->type != STREAMTYPE_DVDNAV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1132 int i = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1133 for (d_sub->id = 0; d_sub->id < MAX_S_STREAMS; d_sub->id++) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1134 if (mpctx->demuxer->s_streams[d_sub->id]) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1135 if (i == dvdsub_id) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1136 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1137 i++; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1138 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1139 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1140 d_sub->sh = mpctx->demuxer->s_streams[d_sub->id]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1141 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1142 if (mpctx->demuxer->type == DEMUXER_TYPE_MATROSKA) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1143 d_sub->id = demux_mkv_change_subs(mpctx->demuxer, dvdsub_id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1144 if (d_sub->sh && d_sub->id >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1145 sh_sub_t *sh = d_sub->sh; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1146 if (sh->type == 'v') |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1147 init_vo_spudec(); |
22478 | 1148 #ifdef USE_ASS |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1149 else if (ass_enabled && sh->type == 'a') |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1150 ass_track = sh->ass_track; |
22478 | 1151 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1152 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1153 } |
22478 | 1154 } |
1155 #ifdef USE_DVDREAD | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1156 if (vo_spudec |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1157 && (mpctx->stream->type == STREAMTYPE_DVD |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1158 || mpctx->stream->type == STREAMTYPE_DVDNAV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1159 && dvdsub_id < 0 && reset_spu) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1160 dvdsub_id = -2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1161 d_sub->id = dvdsub_id; |
22478 | 1162 } |
1163 #endif | |
1164 update_subtitles(mpctx->sh_video, d_sub, 1); | |
1165 | |
1166 return M_PROPERTY_OK; | |
1167 } | |
1168 | |
1169 /// Subtitle delay (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1170 static int mp_property_sub_delay(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1171 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1172 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1173 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1174 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1175 return m_property_delay(prop, action, arg, &sub_delay); |
22478 | 1176 } |
1177 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1178 /// Alignment of text subtitles (RW) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1179 static int mp_property_sub_alignment(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1180 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1181 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1182 char *name[] = { MSGTR_Top, MSGTR_Center, MSGTR_Bottom }; |
22478 | 1183 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1184 if (!mpctx->sh_video || mpctx->global_sub_pos < 0 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1185 || sub_source(mpctx) != SUB_SOURCE_SUBS) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1186 return M_PROPERTY_UNAVAILABLE; |
22478 | 1187 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1188 switch (action) { |
22478 | 1189 case M_PROPERTY_PRINT: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1190 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1191 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1192 M_PROPERTY_CLAMP(prop, sub_alignment); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1193 *(char **) arg = strdup(name[sub_alignment]); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1194 return M_PROPERTY_OK; |
22478 | 1195 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1196 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1197 return M_PROPERTY_ERROR; |
22478 | 1198 case M_PROPERTY_STEP_UP: |
1199 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1200 vo_osd_changed(OSDTYPE_SUBTITLE); |
22478 | 1201 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1202 return m_property_choice(prop, action, arg, &sub_alignment); |
22478 | 1203 } |
1204 } | |
1205 | |
1206 /// Subtitle visibility (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1207 static int mp_property_sub_visibility(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1208 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1209 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1210 if (!mpctx->sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1211 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1212 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1213 switch (action) { |
22478 | 1214 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1215 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1216 return M_PROPERTY_ERROR; |
22478 | 1217 case M_PROPERTY_STEP_UP: |
1218 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1219 vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1220 if (vo_spudec) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1221 vo_osd_changed(OSDTYPE_SPU); |
22478 | 1222 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1223 return m_property_flag(prop, action, arg, &sub_visibility); |
22478 | 1224 } |
1225 } | |
1226 | |
1227 /// Show only forced subtitles (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1228 static int mp_property_sub_forced_only(m_option_t * prop, int action, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1229 void *arg, MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1230 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1231 if (!vo_spudec) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1232 return M_PROPERTY_UNAVAILABLE; |
22478 | 1233 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1234 switch (action) { |
22478 | 1235 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1236 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1237 return M_PROPERTY_ERROR; |
22478 | 1238 case M_PROPERTY_STEP_UP: |
1239 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1240 m_property_flag(prop, action, arg, &forced_subs_only); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1241 spudec_set_forced_subs_only(vo_spudec, forced_subs_only); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1242 return M_PROPERTY_OK; |
22478 | 1243 default: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1244 return m_property_flag(prop, action, arg, &forced_subs_only); |
22478 | 1245 } |
1246 | |
1247 } | |
1248 | |
1249 ///@} | |
1250 | |
1251 /// \defgroup TVProperties TV properties | |
1252 /// \ingroup Properties | |
1253 ///@{ | |
1254 | |
1255 #ifdef USE_TV | |
1256 | |
1257 /// TV color settings (RW) | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1258 static int mp_property_tv_color(m_option_t * prop, int action, void *arg, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1259 MPContext * mpctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1260 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1261 int r, val; |
22478 | 1262 tvi_handle_t *tvh = mpctx->demuxer->priv; |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1263 if (mpctx->demuxer->type != DEMUXER_TYPE_TV || !tvh) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1264 return M_PROPERTY_UNAVAILABLE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1265 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1266 switch (action) { |
22478 | 1267 case M_PROPERTY_SET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1268 if (!arg) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1269 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1270 M_PROPERTY_CLAMP(prop, *(int *) arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1271 return tv_set_color_options(tvh, (int) prop->priv, *(int *) arg); |
22478 | 1272 case M_PROPERTY_GET: |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1273 return tv_get_color_options(tvh, (int) prop->priv, arg); |
22478 | 1274 case M_PROPERTY_STEP_UP: |
1275 case M_PROPERTY_STEP_DOWN: | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1276 if ((r = tv_get_color_options(tvh, (int) prop->priv, &val)) >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1277 if (!r) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1278 return M_PROPERTY_ERROR; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1279 val += (arg ? *(int *) arg : 1) * |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1280 (action == M_PROPERTY_STEP_DOWN ? -1 : 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1281 M_PROPERTY_CLAMP(prop, val); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1282 return tv_set_color_options(tvh, (int) prop->priv, val); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1283 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1284 return M_PROPERTY_ERROR; |
22478 | 1285 } |
1286 return M_PROPERTY_NOT_IMPLEMENTED; | |
1287 } | |
1288 | |
1289 #endif | |
1290 | |
1291 ///@} | |
1292 | |
1293 /// All properties available in MPlayer. | |
1294 /** \ingroup Properties | |
1295 */ | |
1296 static m_option_t mp_properties[] = { | |
1297 // General | |
1298 { "osdlevel", mp_property_osdlevel, CONF_TYPE_INT, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1299 M_OPT_RANGE, 0, 3, NULL }, |
22478 | 1300 { "speed", mp_property_playback_speed, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1301 M_OPT_RANGE, 0.01, 100.0, NULL }, |
22478 | 1302 { "filename", mp_property_filename, CONF_TYPE_STRING, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1303 0, 0, 0, NULL }, |
22478 | 1304 { "path", mp_property_path, CONF_TYPE_STRING, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1305 0, 0, 0, NULL }, |
22478 | 1306 { "demuxer", mp_property_demuxer, CONF_TYPE_STRING, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1307 0, 0, 0, NULL }, |
22478 | 1308 { "stream_pos", mp_property_stream_pos, CONF_TYPE_POSITION, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1309 M_OPT_MIN, 0, 0, NULL }, |
22478 | 1310 { "stream_start", mp_property_stream_start, CONF_TYPE_POSITION, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1311 M_OPT_MIN, 0, 0, NULL }, |
22478 | 1312 { "stream_end", mp_property_stream_end, CONF_TYPE_POSITION, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1313 M_OPT_MIN, 0, 0, NULL }, |
22478 | 1314 { "stream_length", mp_property_stream_length, CONF_TYPE_POSITION, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1315 M_OPT_MIN, 0, 0, NULL }, |
22478 | 1316 { "length", mp_property_length, CONF_TYPE_DOUBLE, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1317 0, 0, 0, NULL }, |
22478 | 1318 |
1319 // Audio | |
1320 { "volume", mp_property_volume, CONF_TYPE_FLOAT, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1321 M_OPT_RANGE, 0, 100, NULL }, |
22478 | 1322 { "mute", mp_property_mute, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1323 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1324 { "audio_delay", mp_property_audio_delay, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1325 M_OPT_RANGE, -100, 100, NULL }, |
22478 | 1326 { "audio_format", mp_property_audio_format, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1327 0, 0, 0, NULL }, |
22478 | 1328 { "audio_bitrate", mp_property_audio_bitrate, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1329 0, 0, 0, NULL }, |
22478 | 1330 { "samplerate", mp_property_samplerate, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1331 0, 0, 0, NULL }, |
22478 | 1332 { "channels", mp_property_channels, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1333 0, 0, 0, NULL }, |
22478 | 1334 { "switch_audio", mp_property_audio, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1335 CONF_RANGE, -2, MAX_A_STREAMS - 1, NULL }, |
22478 | 1336 |
1337 // Video | |
1338 { "fullscreen", mp_property_fullscreen, CONF_TYPE_FLAG, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1339 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1340 { "deinterlace", mp_property_deinterlace, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1341 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1342 { "ontop", mp_property_ontop, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1343 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1344 { "rootwin", mp_property_rootwin, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1345 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1346 { "border", mp_property_border, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1347 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1348 { "framedropping", mp_property_framedropping, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1349 M_OPT_RANGE, 0, 2, NULL }, |
22478 | 1350 { "gamma", mp_property_gamma, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1351 M_OPT_RANGE, -100, 100, &vo_gamma_gamma }, |
22478 | 1352 { "brightness", mp_property_gamma, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1353 M_OPT_RANGE, -100, 100, &vo_gamma_brightness }, |
22478 | 1354 { "contrast", mp_property_gamma, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1355 M_OPT_RANGE, -100, 100, &vo_gamma_contrast }, |
22478 | 1356 { "saturation", mp_property_gamma, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1357 M_OPT_RANGE, -100, 100, &vo_gamma_saturation }, |
22478 | 1358 { "hue", mp_property_gamma, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1359 M_OPT_RANGE, -100, 100, &vo_gamma_hue }, |
22478 | 1360 { "panscan", mp_property_panscan, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1361 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1362 { "vsync", mp_property_vsync, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1363 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1364 { "video_format", mp_property_video_format, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1365 0, 0, 0, NULL }, |
22478 | 1366 { "video_bitrate", mp_property_video_bitrate, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1367 0, 0, 0, NULL }, |
22478 | 1368 { "width", mp_property_width, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1369 0, 0, 0, NULL }, |
22478 | 1370 { "height", mp_property_height, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1371 0, 0, 0, NULL }, |
22478 | 1372 { "fps", mp_property_fps, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1373 0, 0, 0, NULL }, |
22478 | 1374 { "aspect", mp_property_aspect, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1375 0, 0, 0, NULL }, |
22478 | 1376 { "switch_video", mp_property_video, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1377 CONF_RANGE, -2, MAX_V_STREAMS - 1, NULL }, |
22478 | 1378 { "switch_program", mp_property_program, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1379 CONF_RANGE, -1, 65535, NULL }, |
22478 | 1380 |
1381 // Subs | |
1382 { "sub", mp_property_sub, CONF_TYPE_INT, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1383 M_OPT_MIN, -1, 0, NULL }, |
22478 | 1384 { "sub_delay", mp_property_sub_delay, CONF_TYPE_FLOAT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1385 0, 0, 0, NULL }, |
22478 | 1386 { "sub_pos", mp_property_sub_pos, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1387 M_OPT_RANGE, 0, 100, NULL }, |
22478 | 1388 { "sub_alignment", mp_property_sub_alignment, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1389 M_OPT_RANGE, 0, 2, NULL }, |
22478 | 1390 { "sub_visibility", mp_property_sub_visibility, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1391 M_OPT_RANGE, 0, 1, NULL }, |
22478 | 1392 { "sub_forced_only", mp_property_sub_forced_only, CONF_TYPE_FLAG, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1393 M_OPT_RANGE, 0, 1, NULL }, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1394 |
22478 | 1395 #ifdef USE_TV |
1396 { "tv_brightness", mp_property_tv_color, CONF_TYPE_INT, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1397 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_BRIGHTNESS }, |
22478 | 1398 { "tv_contrast", mp_property_tv_color, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1399 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_CONTRAST }, |
22478 | 1400 { "tv_saturation", mp_property_tv_color, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1401 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_SATURATION }, |
22478 | 1402 { "tv_hue", mp_property_tv_color, CONF_TYPE_INT, |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1403 M_OPT_RANGE, -100, 100, (void *) TV_COLOR_HUE }, |
22478 | 1404 #endif |
1405 | |
1406 { NULL, NULL, NULL, 0, 0, 0, NULL } | |
1407 }; | |
1408 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1409 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1410 m_option_t *mp_property_find(const char *name) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1411 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1412 return m_option_list_find(mp_properties, name); |
22478 | 1413 } |
1414 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1415 int mp_property_do(const char *name, int action, void *val, void *ctx) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1416 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1417 m_option_t *p = mp_property_find(name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1418 if (!p) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1419 return M_PROPERTY_UNAVAILABLE; |
22478 | 1420 return m_property_do(p, action, val, ctx); |
1421 } | |
1422 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1423 char *property_expand_string(MPContext * mpctx, char *str) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1424 { |
22478 | 1425 return m_properties_expand_string(mp_properties, str, mpctx); |
1426 } | |
1427 | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1428 void property_print_help(void) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1429 { |
22478 | 1430 m_properties_print_help_list(mp_properties); |
1431 } | |
1432 | |
1433 | |
1434 ///@} | |
1435 // Properties group | |
1436 | |
1437 | |
1438 /** | |
1439 * \defgroup Command2Property Command to property bridge | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1440 * |
22478 | 1441 * It is used to handle most commands that just set a property |
1442 * and optionally display something on the OSD. | |
1443 * Two kinds of commands are handled: adjust or toggle. | |
1444 * | |
1445 * Adjust commands take 1 or 2 parameters: <value> <abs> | |
1446 * If <abs> is non-zero the property is set to the given value | |
1447 * otherwise it is adjusted. | |
1448 * | |
1449 * Toggle commands take 0 or 1 parameters. With no parameter | |
1450 * or a value less than the property minimum it just steps the | |
1451 * property to its next value. Otherwise it sets it to the given | |
1452 * value. | |
1453 * | |
1454 *@{ | |
1455 */ | |
1456 | |
1457 /// List of the commands that can be handled by setting a property. | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1458 static struct { |
22478 | 1459 /// property name |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1460 const char *name; |
22478 | 1461 /// cmd id |
1462 int cmd; | |
1463 /// set/adjust or toggle command | |
1464 int toggle; | |
1465 /// progressbar type | |
1466 int osd_progbar; | |
1467 /// osd msg id if it must be shared | |
1468 int osd_id; | |
1469 /// osd msg template | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1470 const char *osd_msg; |
22478 | 1471 } set_prop_cmd[] = { |
1472 // audio | |
1473 { "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume }, | |
1474 { "mute", MP_CMD_MUTE, 1, 0, -1, MSGTR_MuteStatus }, | |
1475 { "audio_delay", MP_CMD_AUDIO_DELAY, 0, 0, -1, MSGTR_AVDelayStatus }, | |
1476 { "switch_audio", MP_CMD_SWITCH_AUDIO, 1, 0, -1, MSGTR_OSDAudio }, | |
1477 // video | |
1478 { "fullscreen", MP_CMD_VO_FULLSCREEN, 1, 0, -1, NULL }, | |
1479 { "panscan", MP_CMD_PANSCAN, 0, OSD_PANSCAN, -1, MSGTR_Panscan }, | |
1480 { "ontop", MP_CMD_VO_ONTOP, 1, 0, -1, MSGTR_OnTopStatus }, | |
1481 { "rootwin", MP_CMD_VO_ROOTWIN, 1, 0, -1, MSGTR_RootwinStatus }, | |
1482 { "border", MP_CMD_VO_BORDER, 1, 0, -1, MSGTR_BorderStatus }, | |
1483 { "framedropping", MP_CMD_FRAMEDROPPING, 1, 0, -1, MSGTR_FramedroppingStatus }, | |
1484 { "gamma", MP_CMD_GAMMA, 0, OSD_BRIGHTNESS, -1, MSGTR_Gamma }, | |
1485 { "brightness", MP_CMD_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness }, | |
1486 { "contrast", MP_CMD_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast }, | |
1487 { "saturation", MP_CMD_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation }, | |
1488 { "hue", MP_CMD_HUE, 0, OSD_HUE, -1, MSGTR_Hue }, | |
1489 { "vsync", MP_CMD_SWITCH_VSYNC, 1, 0, -1, MSGTR_VSyncStatus }, | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1490 // subs |
22478 | 1491 { "sub", MP_CMD_SUB_SELECT, 1, 0, -1, MSGTR_SubSelectStatus }, |
1492 { "sub_pos", MP_CMD_SUB_POS, 0, 0, -1, MSGTR_SubPosStatus }, | |
1493 { "sub_alignment", MP_CMD_SUB_ALIGNMENT, 1, 0, -1, MSGTR_SubAlignStatus }, | |
1494 { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus }, | |
1495 { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus }, | |
1496 { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1, 0, -1, MSGTR_SubForcedOnlyStatus }, | |
1497 #ifdef USE_TV | |
1498 { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness }, | |
1499 { "tv_hue", MP_CMD_TV_SET_HUE, 0, OSD_HUE, -1, MSGTR_Hue }, | |
1500 { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation }, | |
1501 { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast }, | |
1502 #endif | |
1503 { NULL, 0, 0, 0, -1, NULL } | |
1504 }; | |
1505 | |
1506 | |
1507 /// Handle commands that set a property. | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1508 static int set_property_command(MPContext * mpctx, mp_cmd_t * cmd) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1509 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1510 int i, r; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1511 m_option_t *prop; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1512 |
22478 | 1513 // look for the command |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1514 for (i = 0; set_prop_cmd[i].name; i++) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1515 if (set_prop_cmd[i].cmd == cmd->id) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1516 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1517 if (!set_prop_cmd[i].name) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1518 return 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1519 |
22478 | 1520 // get the property |
1521 prop = mp_property_find(set_prop_cmd[i].name); | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1522 if (!prop) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1523 return 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1524 |
22478 | 1525 // toggle command |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1526 if (set_prop_cmd[i].toggle) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1527 // set to value |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1528 if (cmd->nargs > 0 && cmd->args[0].v.i >= prop->min) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1529 r = m_property_do(prop, M_PROPERTY_SET, &cmd->args[0].v.i, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1530 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1531 r = m_property_do(prop, M_PROPERTY_STEP_UP, NULL, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1532 } else if (cmd->args[1].v.i) //set |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1533 r = m_property_do(prop, M_PROPERTY_SET, &cmd->args[0].v, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1534 else // adjust |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1535 r = m_property_do(prop, M_PROPERTY_STEP_UP, &cmd->args[0].v, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1536 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1537 if (r <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1538 return 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1539 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1540 if (set_prop_cmd[i].osd_progbar) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1541 if (prop->type == CONF_TYPE_INT) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1542 if (m_property_do(prop, M_PROPERTY_GET, &r, mpctx) > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1543 set_osd_bar(set_prop_cmd[i].osd_progbar, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1544 set_prop_cmd[i].osd_msg, prop->min, prop->max, r); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1545 } else if (prop->type == CONF_TYPE_FLOAT) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1546 float f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1547 if (m_property_do(prop, M_PROPERTY_GET, &f, mpctx) > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1548 set_osd_bar(set_prop_cmd[i].osd_progbar, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1549 set_prop_cmd[i].osd_msg, prop->min, prop->max, f); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1550 } else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1551 mp_msg(MSGT_CPLAYER, MSGL_ERR, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1552 "Property use an unsupported type.\n"); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1553 return 1; |
22478 | 1554 } |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1555 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1556 if (set_prop_cmd[i].osd_msg) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1557 char *val = m_property_print(prop, mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1558 if (val) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1559 set_osd_msg(set_prop_cmd[i].osd_id >= |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1560 0 ? set_prop_cmd[i].osd_id : OSD_MSG_PROPERTY + i, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1561 1, osd_duration, set_prop_cmd[i].osd_msg, val); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1562 free(val); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1563 } |
22478 | 1564 } |
1565 return 1; | |
1566 } | |
1567 | |
1568 | |
1569 int run_command(MPContext * mpctx, mp_cmd_t * cmd) | |
1570 { | |
1571 sh_audio_t * const sh_audio = mpctx->sh_audio; | |
1572 sh_video_t * const sh_video = mpctx->sh_video; | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1573 int brk_cmd = 0; |
22478 | 1574 if (!set_property_command(mpctx, cmd)) |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1575 switch (cmd->id) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1576 case MP_CMD_SEEK:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1577 float v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1578 int abs; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1579 if (sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1580 mpctx->osd_show_percentage = sh_video->fps; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1581 v = cmd->args[0].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1582 abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1583 if (abs == 2) { /* Absolute seek to a specific timestamp in seconds */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1584 abs_seek_pos = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1585 if (sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1586 mpctx->osd_function = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1587 (v > sh_video->pts) ? OSD_FFW : OSD_REW; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1588 rel_seek_secs = v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1589 } else if (abs) { /* Absolute seek by percentage */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1590 abs_seek_pos = 3; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1591 if (sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1592 mpctx->osd_function = OSD_FFW; // Direction isn't set correctly |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1593 rel_seek_secs = v / 100.0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1594 } else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1595 rel_seek_secs += v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1596 mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1597 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1598 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1599 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1600 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1601 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1602 case MP_CMD_SET_PROPERTY:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1603 m_option_t *prop = mp_property_find(cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1604 if (!prop) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1605 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1606 "Unknown property: '%s'\n", cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1607 else if (m_property_parse(prop, cmd->args[1].v.s, mpctx) <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1608 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1609 "Failed to set property '%s' to '%s'.\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1610 cmd->args[0].v.s, cmd->args[1].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1611 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1612 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1613 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1614 case MP_CMD_STEP_PROPERTY:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1615 m_option_t *prop = mp_property_find(cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1616 float arg = cmd->args[1].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1617 if (!prop) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1618 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1619 "Unknown property: '%s'\n", cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1620 else if (m_property_do |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1621 (prop, M_PROPERTY_STEP_UP, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1622 arg ? &arg : NULL, mpctx) <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1623 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1624 "Failed to increment property '%s' by %f.\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1625 cmd->args[0].v.s, arg); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1626 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1627 break; |
22478 | 1628 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1629 case MP_CMD_GET_PROPERTY:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1630 m_option_t *prop; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1631 void *val; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1632 char *tmp; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1633 prop = mp_property_find(cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1634 if (!prop) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1635 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1636 "Unknown property: '%s'\n", cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1637 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1638 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1639 /* Use m_option_print directly to get easily parseable values. */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1640 val = calloc(1, prop->type->size); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1641 if (m_property_do(prop, M_PROPERTY_GET, val, mpctx) <= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1642 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1643 "Failed to get value of property '%s'.\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1644 cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1645 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1646 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1647 tmp = m_option_print(prop, val); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1648 if (!tmp || tmp == (char *) -1) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1649 mp_msg(MSGT_CPLAYER, MSGL_WARN, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1650 "Failed to print value of property '%s'.\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1651 cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1652 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1653 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1654 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_%s=%s\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1655 cmd->args[0].v.s, tmp); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1656 free(tmp); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1657 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1658 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1659 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1660 case MP_CMD_EDL_MARK: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1661 if (edl_fd) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1662 float v = sh_video ? sh_video->pts : |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1663 playing_audio_pts(sh_audio, mpctx->d_audio, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1664 mpctx->audio_out); |
22478 | 1665 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1666 if (mpctx->begin_skip == MP_NOPTS_VALUE) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1667 mpctx->begin_skip = v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1668 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutStartSkip); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1669 } else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1670 if (mpctx->begin_skip > v) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1671 mp_msg(MSGT_CPLAYER, MSGL_WARN, MSGTR_EdloutBadStop); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1672 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1673 fprintf(edl_fd, "%f %f %d\n", mpctx->begin_skip, v, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1674 mp_msg(MSGT_CPLAYER, MSGL_INFO, MSGTR_EdloutEndSkip); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1675 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1676 mpctx->begin_skip = MP_NOPTS_VALUE; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1677 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1678 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1679 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1680 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1681 case MP_CMD_SWITCH_RATIO: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1682 if (cmd->nargs == 0 || cmd->args[0].v.f == -1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1683 movie_aspect = (float) sh_video->disp_w / sh_video->disp_h; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1684 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1685 movie_aspect = cmd->args[0].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1686 mpcodecs_config_vo(sh_video, sh_video->disp_w, sh_video->disp_h, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1687 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1688 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1689 case MP_CMD_SPEED_INCR:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1690 float v = cmd->args[0].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1691 playback_speed += v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1692 build_afilter_chain(sh_audio, &ao_data); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1693 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1694 playback_speed); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1695 } break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1696 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1697 case MP_CMD_SPEED_MULT:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1698 float v = cmd->args[0].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1699 playback_speed *= v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1700 build_afilter_chain(sh_audio, &ao_data); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1701 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1702 playback_speed); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1703 } break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1704 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1705 case MP_CMD_SPEED_SET:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1706 float v = cmd->args[0].v.f; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1707 playback_speed = v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1708 build_afilter_chain(sh_audio, &ao_data); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1709 set_osd_msg(OSD_MSG_SPEED, 1, osd_duration, MSGTR_OSDSpeed, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1710 playback_speed); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1711 } break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1712 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1713 case MP_CMD_FRAME_STEP: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1714 case MP_CMD_PAUSE: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1715 cmd->pausing = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1716 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1717 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1718 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1719 case MP_CMD_FILE_FILTER: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1720 file_filter = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1721 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1722 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1723 case MP_CMD_QUIT: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1724 exit_player_with_rc(MSGTR_Exit_quit, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1725 (cmd->nargs > 0) ? cmd->args[0].v.i : 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1726 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1727 case MP_CMD_PLAY_TREE_STEP:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1728 int n = cmd->args[0].v.i == 0 ? 1 : cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1729 int force = cmd->args[1].v.i; |
22478 | 1730 |
1731 #ifdef HAVE_NEW_GUI | |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1732 if (use_gui) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1733 int i = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1734 if (n > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1735 for (i = 0; i < n; i++) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1736 mplNext(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1737 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1738 for (i = 0; i < -1 * n; i++) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1739 mplPrev(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1740 } else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1741 #endif |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1742 { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1743 if (!force && mpctx->playtree_iter) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1744 play_tree_iter_t *i = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1745 play_tree_iter_new_copy(mpctx->playtree_iter); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1746 if (play_tree_iter_step(i, n, 0) == |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1747 PLAY_TREE_ITER_ENTRY) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1748 mpctx->eof = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1749 (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1750 play_tree_iter_free(i); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1751 } else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1752 mpctx->eof = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1753 if (mpctx->eof) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1754 mpctx->play_tree_step = n; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1755 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1756 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1757 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1758 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1759 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1760 case MP_CMD_PLAY_TREE_UP_STEP:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1761 int n = cmd->args[0].v.i > 0 ? 1 : -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1762 int force = cmd->args[1].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1763 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1764 if (!force && mpctx->playtree_iter) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1765 play_tree_iter_t *i = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1766 play_tree_iter_new_copy(mpctx->playtree_iter); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1767 if (play_tree_iter_up_step(i, n, 0) == PLAY_TREE_ITER_ENTRY) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1768 mpctx->eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1769 play_tree_iter_free(i); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1770 } else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1771 mpctx->eof = (n > 0) ? PT_UP_NEXT : PT_UP_PREV; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1772 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1773 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1774 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1775 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1776 case MP_CMD_PLAY_ALT_SRC_STEP: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1777 if (mpctx->playtree_iter && mpctx->playtree_iter->num_files > 1) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1778 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1779 if (v > 0 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1780 && mpctx->playtree_iter->file < |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1781 mpctx->playtree_iter->num_files) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1782 mpctx->eof = PT_NEXT_SRC; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1783 else if (v < 0 && mpctx->playtree_iter->file > 1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1784 mpctx->eof = PT_PREV_SRC; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1785 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1786 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1787 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1788 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1789 case MP_CMD_SUB_STEP: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1790 if (sh_video) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1791 int movement = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1792 step_sub(subdata, sh_video->pts, movement); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1793 #ifdef USE_ASS |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1794 if (ass_track) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1795 sub_delay += |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1796 ass_step_sub(ass_track, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1797 (sh_video->pts + |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1798 sub_delay) * 1000 + .5, movement) / 1000.; |
22478 | 1799 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1800 set_osd_msg(OSD_MSG_SUB_DELAY, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1801 MSGTR_OSDSubDelay, ROUND(sub_delay * 1000)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1802 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1803 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1804 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1805 case MP_CMD_SUB_LOG: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1806 log_sub(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1807 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1808 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1809 case MP_CMD_OSD:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1810 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1811 int max = (term_osd |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1812 && !sh_video) ? MAX_TERM_OSD_LEVEL : MAX_OSD_LEVEL; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1813 if (osd_level > max) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1814 osd_level = max; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1815 if (v < 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1816 osd_level = (osd_level + 1) % (max + 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1817 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1818 osd_level = v > max ? max : v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1819 /* Show OSD state when disabled, but not when an explicit |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1820 argument is given to the OSD command, i.e. in slave mode. */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1821 if (v == -1 && osd_level <= 1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1822 set_osd_msg(OSD_MSG_OSD_STATUS, 0, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1823 MSGTR_OSDosd, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1824 osd_level ? MSGTR_OSDenabled : |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1825 MSGTR_OSDdisabled); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1826 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1827 rm_osd_msg(OSD_MSG_OSD_STATUS); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1828 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1829 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1830 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1831 case MP_CMD_OSD_SHOW_TEXT: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1832 set_osd_msg(OSD_MSG_TEXT, cmd->args[2].v.i, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1833 (cmd->args[1].v.i < |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1834 0 ? osd_duration : cmd->args[1].v.i), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1835 "%-.63s", cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1836 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1837 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1838 case MP_CMD_OSD_SHOW_PROPERTY_TEXT:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1839 char *txt = m_properties_expand_string(mp_properties, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1840 cmd->args[0].v.s, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1841 mpctx); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1842 /* if no argument supplied take default osd_duration, else <arg> ms. */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1843 if (txt) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1844 set_osd_msg(OSD_MSG_TEXT, cmd->args[2].v.i, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1845 (cmd->args[1].v.i < |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1846 0 ? osd_duration : cmd->args[1].v.i), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1847 "%-.63s", txt); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1848 free(txt); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1849 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1850 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1851 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1852 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1853 case MP_CMD_LOADFILE:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1854 play_tree_t *e = play_tree_new(); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1855 play_tree_add_file(e, cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1856 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1857 if (cmd->args[1].v.i) // append |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1858 play_tree_append_entry(mpctx->playtree, e); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1859 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1860 // Go back to the starting point. |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1861 while (play_tree_iter_up_step |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1862 (mpctx->playtree_iter, 0, 1) != PLAY_TREE_ITER_END) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1863 /* NOP */ ; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1864 play_tree_free_list(mpctx->playtree->child, 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1865 play_tree_set_child(mpctx->playtree, e); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1866 play_tree_iter_step(mpctx->playtree_iter, 0, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1867 mpctx->eof = PT_NEXT_SRC; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1868 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1869 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1870 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1871 break; |
22478 | 1872 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1873 case MP_CMD_LOADLIST:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1874 play_tree_t *e = parse_playlist_file(cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1875 if (!e) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1876 mp_msg(MSGT_CPLAYER, MSGL_ERR, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1877 MSGTR_PlaylistLoadUnable, cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1878 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1879 if (cmd->args[1].v.i) // append |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1880 play_tree_append_entry(mpctx->playtree, e); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1881 else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1882 // Go back to the starting point. |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1883 while (play_tree_iter_up_step |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1884 (mpctx->playtree_iter, 0, 1) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1885 != PLAY_TREE_ITER_END) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1886 /* NOP */ ; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1887 play_tree_free_list(mpctx->playtree->child, 1); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1888 play_tree_set_child(mpctx->playtree, e); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1889 play_tree_iter_step(mpctx->playtree_iter, 0, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1890 mpctx->eof = PT_NEXT_SRC; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1891 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1892 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1893 brk_cmd = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1894 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1895 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1896 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1897 #ifdef USE_RADIO |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1898 case MP_CMD_RADIO_STEP_CHANNEL: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1899 if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1900 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1901 if (v > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1902 radio_step_channel(mpctx->demuxer->stream, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1903 RADIO_CHANNEL_HIGHER); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1904 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1905 radio_step_channel(mpctx->demuxer->stream, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1906 RADIO_CHANNEL_LOWER); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1907 if (radio_get_channel_name(mpctx->demuxer->stream)) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1908 set_osd_msg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1909 MSGTR_OSDChannel, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1910 radio_get_channel_name(mpctx->demuxer->stream)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1911 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1912 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1913 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1914 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1915 case MP_CMD_RADIO_SET_CHANNEL: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1916 if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1917 radio_set_channel(mpctx->demuxer->stream, cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1918 if (radio_get_channel_name(mpctx->demuxer->stream)) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1919 set_osd_msg(OSD_MSG_RADIO_CHANNEL, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1920 MSGTR_OSDChannel, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1921 radio_get_channel_name(mpctx->demuxer->stream)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1922 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1923 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1924 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1925 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1926 case MP_CMD_RADIO_SET_FREQ: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1927 if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1928 radio_set_freq(mpctx->demuxer->stream, cmd->args[0].v.f); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1929 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1930 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1931 case MP_CMD_RADIO_STEP_FREQ: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1932 if (mpctx->demuxer->stream->type == STREAMTYPE_RADIO) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1933 radio_step_freq(mpctx->demuxer->stream, cmd->args[0].v.f); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1934 break; |
22478 | 1935 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1936 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1937 #ifdef USE_TV |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1938 case MP_CMD_TV_SET_FREQ: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1939 if (mpctx->file_format == DEMUXER_TYPE_TV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1940 tv_set_freq((tvi_handle_t *) (mpctx->demuxer->priv), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1941 cmd->args[0].v.f * 16.0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1942 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1943 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1944 case MP_CMD_TV_SET_NORM: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1945 if (mpctx->file_format == DEMUXER_TYPE_TV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1946 tv_set_norm((tvi_handle_t *) (mpctx->demuxer->priv), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1947 cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1948 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1949 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1950 case MP_CMD_TV_STEP_CHANNEL:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1951 if (mpctx->file_format == DEMUXER_TYPE_TV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1952 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1953 if (v > 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1954 tv_step_channel((tvi_handle_t *) (mpctx-> |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1955 demuxer->priv), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1956 TV_CHANNEL_HIGHER); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1957 } else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1958 tv_step_channel((tvi_handle_t *) (mpctx-> |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1959 demuxer->priv), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1960 TV_CHANNEL_LOWER); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1961 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1962 if (tv_channel_list) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1963 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1964 MSGTR_OSDChannel, tv_channel_current->name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1965 //vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1966 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1967 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1968 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1969 #ifdef HAS_DVBIN_SUPPORT |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1970 if ((mpctx->stream->type == STREAMTYPE_DVB) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1971 && mpctx->stream->priv) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1972 dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1973 if (priv->is_on) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1974 int dir; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1975 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1976 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1977 mpctx->last_dvb_step = v; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1978 if (v > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1979 dir = DVB_CHANNEL_HIGHER; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1980 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1981 dir = DVB_CHANNEL_LOWER; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1982 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1983 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1984 if (dvb_step_channel(priv, dir)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1985 mpctx->eof = mpctx->dvbin_reopen = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1986 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1987 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1988 #endif /* HAS_DVBIN_SUPPORT */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1989 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1990 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1991 case MP_CMD_TV_SET_CHANNEL: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1992 if (mpctx->file_format == DEMUXER_TYPE_TV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1993 tv_set_channel((tvi_handle_t *) (mpctx->demuxer->priv), |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1994 cmd->args[0].v.s); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1995 if (tv_channel_list) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1996 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1997 MSGTR_OSDChannel, tv_channel_current->name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1998 //vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
1999 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2000 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2001 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2002 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2003 #ifdef HAS_DVBIN_SUPPORT |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2004 case MP_CMD_DVB_SET_CHANNEL: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2005 if ((mpctx->stream->type == STREAMTYPE_DVB) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2006 && mpctx->stream->priv) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2007 dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2008 if (priv->is_on) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2009 if (priv->list->current <= cmd->args[0].v.i) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2010 mpctx->last_dvb_step = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2011 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2012 mpctx->last_dvb_step = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2013 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2014 if (dvb_set_channel |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2015 (priv, cmd->args[1].v.i, cmd->args[0].v.i)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2016 mpctx->eof = mpctx->dvbin_reopen = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2017 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2018 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2019 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2020 #endif /* HAS_DVBIN_SUPPORT */ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2021 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2022 case MP_CMD_TV_LAST_CHANNEL: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2023 if (mpctx->file_format == DEMUXER_TYPE_TV) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2024 tv_last_channel((tvi_handle_t *) (mpctx->demuxer->priv)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2025 if (tv_channel_list) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2026 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2027 MSGTR_OSDChannel, tv_channel_current->name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2028 //vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2029 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2030 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2031 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2032 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2033 case MP_CMD_TV_STEP_NORM: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2034 if (mpctx->file_format == DEMUXER_TYPE_TV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2035 tv_step_norm((tvi_handle_t *) (mpctx->demuxer->priv)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2036 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2037 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2038 case MP_CMD_TV_STEP_CHANNEL_LIST: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2039 if (mpctx->file_format == DEMUXER_TYPE_TV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2040 tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2041 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2042 #endif /* USE_TV */ |
22478 | 2043 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2044 case MP_CMD_SUB_LOAD: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2045 if (sh_video) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2046 int n = mpctx->set_of_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2047 add_subtitles(cmd->args[0].v.s, sh_video->fps, 0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2048 if (n != mpctx->set_of_sub_size) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2049 if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] < 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2050 mpctx->global_sub_indices[SUB_SOURCE_SUBS] = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2051 mpctx->global_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2052 ++mpctx->global_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2053 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2054 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2055 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2056 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2057 case MP_CMD_SUB_REMOVE: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2058 if (sh_video) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2059 int v = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2060 sub_data *subd; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2061 if (v < 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2062 for (v = 0; v < mpctx->set_of_sub_size; ++v) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2063 subd = mpctx->set_of_subtitles[v]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2064 mp_msg(MSGT_CPLAYER, MSGL_STATUS, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2065 MSGTR_RemovedSubtitleFile, v + 1, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2066 filename_recode(subd->filename)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2067 sub_free(subd); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2068 mpctx->set_of_subtitles[v] = NULL; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2069 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2070 mpctx->global_sub_indices[SUB_SOURCE_SUBS] = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2071 mpctx->global_sub_size -= mpctx->set_of_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2072 mpctx->set_of_sub_size = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2073 if (mpctx->set_of_sub_pos >= 0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2074 mpctx->global_sub_pos = -2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2075 vo_sub_last = vo_sub = NULL; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2076 vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2077 vo_update_osd(sh_video->disp_w, sh_video->disp_h); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2078 mp_input_queue_cmd(mp_input_parse_cmd("sub_select")); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2079 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2080 } else if (v < mpctx->set_of_sub_size) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2081 subd = mpctx->set_of_subtitles[v]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2082 mp_msg(MSGT_CPLAYER, MSGL_STATUS, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2083 MSGTR_RemovedSubtitleFile, v + 1, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2084 filename_recode(subd->filename)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2085 sub_free(subd); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2086 if (mpctx->set_of_sub_pos == v) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2087 mpctx->global_sub_pos = -2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2088 vo_sub_last = vo_sub = NULL; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2089 vo_osd_changed(OSDTYPE_SUBTITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2090 vo_update_osd(sh_video->disp_w, sh_video->disp_h); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2091 mp_input_queue_cmd(mp_input_parse_cmd("sub_select")); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2092 } else if (mpctx->set_of_sub_pos > v) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2093 --mpctx->set_of_sub_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2094 --mpctx->global_sub_pos; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2095 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2096 while (++v < mpctx->set_of_sub_size) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2097 mpctx->set_of_subtitles[v - 1] = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2098 mpctx->set_of_subtitles[v]; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2099 --mpctx->set_of_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2100 --mpctx->global_sub_size; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2101 if (mpctx->set_of_sub_size <= 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2102 mpctx->global_sub_indices[SUB_SOURCE_SUBS] = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2103 mpctx->set_of_subtitles[mpctx->set_of_sub_size] = NULL; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2104 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2105 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2106 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2107 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2108 case MP_CMD_GET_SUB_VISIBILITY: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2109 if (sh_video) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2110 mp_msg(MSGT_GLOBAL, MSGL_INFO, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2111 "ANS_SUB_VISIBILITY=%d\n", sub_visibility); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2112 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2113 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2114 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2115 case MP_CMD_SCREENSHOT: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2116 if (vo_config_count) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2117 mp_msg(MSGT_CPLAYER, MSGL_INFO, "sending VFCTRL_SCREENSHOT!\n"); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2118 if (CONTROL_OK != |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2119 ((vf_instance_t *) sh_video->vfilter)-> |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2120 control(sh_video->vfilter, VFCTRL_SCREENSHOT, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2121 &cmd->args[0].v.i)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2122 mpctx->video_out->control(VOCTRL_SCREENSHOT, NULL); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2123 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2124 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2125 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2126 case MP_CMD_VF_CHANGE_RECTANGLE: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2127 set_rectangle(sh_video, cmd->args[0].v.i, cmd->args[1].v.i); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2128 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2129 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2130 case MP_CMD_GET_TIME_LENGTH:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2131 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2lf\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2132 demuxer_get_time_length(mpctx->demuxer)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2133 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2134 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2135 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2136 case MP_CMD_GET_FILENAME:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2137 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_FILENAME='%s'\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2138 get_metadata(META_NAME)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2139 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2140 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2141 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2142 case MP_CMD_GET_VIDEO_CODEC:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2143 char *inf = get_metadata(META_VIDEO_CODEC); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2144 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2145 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2146 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_CODEC='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2147 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2148 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2149 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2150 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2151 case MP_CMD_GET_VIDEO_BITRATE:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2152 char *inf = get_metadata(META_VIDEO_BITRATE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2153 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2154 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2155 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VIDEO_BITRATE='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2156 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2157 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2158 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2159 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2160 case MP_CMD_GET_VIDEO_RESOLUTION:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2161 char *inf = get_metadata(META_VIDEO_RESOLUTION); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2162 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2163 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2164 mp_msg(MSGT_GLOBAL, MSGL_INFO, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2165 "ANS_VIDEO_RESOLUTION='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2166 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2167 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2168 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2169 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2170 case MP_CMD_GET_AUDIO_CODEC:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2171 char *inf = get_metadata(META_AUDIO_CODEC); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2172 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2173 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2174 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_CODEC='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2175 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2176 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2177 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2178 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2179 case MP_CMD_GET_AUDIO_BITRATE:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2180 char *inf = get_metadata(META_AUDIO_BITRATE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2181 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2182 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2183 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_BITRATE='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2184 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2185 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2186 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2187 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2188 case MP_CMD_GET_AUDIO_SAMPLES:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2189 char *inf = get_metadata(META_AUDIO_SAMPLES); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2190 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2191 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2192 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_AUDIO_SAMPLES='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2193 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2194 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2195 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2196 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2197 case MP_CMD_GET_META_TITLE:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2198 char *inf = get_metadata(META_INFO_TITLE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2199 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2200 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2201 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TITLE='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2202 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2203 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2204 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2205 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2206 case MP_CMD_GET_META_ARTIST:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2207 char *inf = get_metadata(META_INFO_ARTIST); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2208 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2209 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2210 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ARTIST='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2211 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2212 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2213 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2214 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2215 case MP_CMD_GET_META_ALBUM:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2216 char *inf = get_metadata(META_INFO_ALBUM); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2217 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2218 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2219 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_ALBUM='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2220 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2221 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2222 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2223 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2224 case MP_CMD_GET_META_YEAR:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2225 char *inf = get_metadata(META_INFO_YEAR); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2226 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2227 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2228 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_YEAR='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2229 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2230 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2231 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2232 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2233 case MP_CMD_GET_META_COMMENT:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2234 char *inf = get_metadata(META_INFO_COMMENT); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2235 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2236 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2237 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_COMMENT='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2238 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2239 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2240 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2241 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2242 case MP_CMD_GET_META_TRACK:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2243 char *inf = get_metadata(META_INFO_TRACK); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2244 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2245 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2246 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_TRACK='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2247 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2248 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2249 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2250 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2251 case MP_CMD_GET_META_GENRE:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2252 char *inf = get_metadata(META_INFO_GENRE); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2253 if (!inf) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2254 inf = strdup(""); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2255 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_META_GENRE='%s'\n", inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2256 free(inf); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2257 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2258 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2259 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2260 case MP_CMD_GET_VO_FULLSCREEN: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2261 if (mpctx->video_out && vo_config_count) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2262 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_VO_FULLSCREEN=%d\n", vo_fs); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2263 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2264 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2265 case MP_CMD_GET_PERCENT_POS: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2266 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_PERCENT_POSITION=%d\n", |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2267 demuxer_get_percent_pos(mpctx->demuxer)); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2268 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2269 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2270 case MP_CMD_GET_TIME_POS:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2271 float pos = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2272 if (sh_video) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2273 pos = sh_video->pts; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2274 else if (sh_audio && mpctx->audio_out) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2275 pos = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2276 playing_audio_pts(sh_audio, mpctx->d_audio, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2277 mpctx->audio_out); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2278 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_TIME_POSITION=%.1f\n", pos); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2279 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2280 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2281 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2282 case MP_CMD_RUN: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2283 #ifndef __MINGW32__ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2284 if (!fork()) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2285 execl("/bin/sh", "sh", "-c", cmd->args[0].v.s, NULL); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2286 exit(0); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2287 } |
22478 | 2288 #endif |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2289 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2290 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2291 case MP_CMD_KEYDOWN_EVENTS: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2292 mplayer_put_key(cmd->args[0].v.i); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2293 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2294 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2295 case MP_CMD_SEEK_CHAPTER:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2296 int seek = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2297 int abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2298 int chap; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2299 float next_pts = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2300 int num_chapters; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2301 char *chapter_name; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2302 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2303 rel_seek_secs = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2304 abs_seek_pos = 0; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2305 chap = |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2306 demuxer_seek_chapter(mpctx->demuxer, seek, abs, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2307 &next_pts, &num_chapters, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2308 &chapter_name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2309 if (chap != -1) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2310 if (next_pts > -1.0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2311 abs_seek_pos = 1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2312 rel_seek_secs = next_pts; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2313 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2314 if (chapter_name) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2315 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2316 MSGTR_OSDChapter, chap + 1, chapter_name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2317 free(chapter_name); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2318 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2319 } else { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2320 if (seek > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2321 rel_seek_secs = 1000000000.; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2322 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2323 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2324 MSGTR_OSDChapter, 0, MSGTR_Unknown); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2325 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2326 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2327 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2328 break; |
22478 | 2329 |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2330 case MP_CMD_SET_MOUSE_POS:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2331 int button = -1, pointer_x, pointer_y; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2332 double dx, dy; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2333 pointer_x = cmd->args[0].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2334 pointer_y = cmd->args[1].v.i; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2335 rescale_input_coordinates(pointer_x, pointer_y, &dx, &dy); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2336 #ifdef USE_DVDNAV |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2337 if (mpctx->stream->type == STREAMTYPE_DVDNAV |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2338 && dx > 0.0 && dy > 0.0) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2339 pointer_x = (int) (dx * (double) sh_video->disp_w); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2340 pointer_y = (int) (dy * (double) sh_video->disp_h); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2341 mp_dvdnav_update_mouse_pos(mpctx->stream, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2342 pointer_x, pointer_y, &button); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2343 if (button > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2344 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2345 "Selected button number %d", button); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2346 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2347 #endif |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2348 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2349 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2350 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2351 #ifdef USE_DVDNAV |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2352 case MP_CMD_DVDNAV:{ |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2353 int button = -1; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2354 if (mpctx->stream->type != STREAMTYPE_DVDNAV) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2355 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2356 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2357 if (mp_dvdnav_handle_input |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2358 (mpctx->stream, cmd->args[0].v.i, &button)) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2359 uninit_player(INITED_ALL - (INITED_STREAM | INITED_INPUT | |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2360 (fixed_vo ? INITED_VO : 0))); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2361 brk_cmd = 2; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2362 } else if (button > 0) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2363 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2364 "Selected button number %d", button); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2365 } |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2366 break; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2367 #endif |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2368 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2369 default: |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2370 #ifdef HAVE_NEW_GUI |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2371 if ((use_gui) && (cmd->id > MP_CMD_GUI_EVENTS)) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2372 guiGetEvent(guiIEvent, (char *) cmd->id); |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2373 else |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2374 #endif |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2375 mp_msg(MSGT_CPLAYER, MSGL_V, |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2376 "Received unknown cmd %s\n", cmd->name); |
22478 | 2377 } |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2378 |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2379 switch (cmd->pausing) { |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2380 case 1: // "pausing" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2381 mpctx->osd_function = OSD_PAUSE; |
22478 | 2382 break; |
22479
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2383 case 3: // "pausing_toggle" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2384 mpctx->was_paused = !mpctx->was_paused; |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2385 // fall through |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2386 case 2: // "pausing_keep" |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2387 if (mpctx->was_paused) |
a99ddf2ece25
Change to match current command.c (same functionality).
uau
parents:
22478
diff
changeset
|
2388 mpctx->osd_function = OSD_PAUSE; |
22478 | 2389 } |
2390 return brk_cmd; | |
2391 } |