annotate command.c @ 22714:97ad9cecc6d9

Merge CFLAGS lines.
author diego
date Sun, 18 Mar 2007 22:11:32 +0000
parents e1859558b37d
children 17bf4f4b0715
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1 #include <stdlib.h>
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2 #include <inttypes.h>
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
3 #include <unistd.h>
22483
662e7f56ec7f Include <string.h> explicitly.
uau
parents: 22480
diff changeset
4 #include <string.h>
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
13 #include "m_option.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
27 #include "vobsub.h"
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
28 #include "spudec.h"
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
29 #ifdef USE_TV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
30 #include "stream/tv.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
31 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
32 #ifdef USE_RADIO
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
33 #include "stream/stream_radio.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
34 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
35 #ifdef HAS_DVBIN_SUPPORT
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
36 #include "stream/dvbin.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
37 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
38 #ifdef USE_DVDREAD
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
39 #include "stream/stream_dvd.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
40 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
41 #ifdef USE_DVDNAV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
42 #include "stream/stream_dvdnav.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
43 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
44 #ifdef USE_ASS
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
45 #include "libass/ass.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
46 #include "libass/ass_mp.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
51
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
52 #include "mp_core.h"
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
84 static int sub_source(MPContext * mpctx)
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
85 {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
86 int source = -1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
87 int top = -1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
88 int i;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
95 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
96 return source;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
97 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
98
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
99 /**
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
102 * Logs the current or last displayed subtitle together with filename
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
103 * and time information to ~/.mplayer/subtitle_log
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
104 *
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
105 * Intended purpose is to allow convenient marking of bogus subtitles
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
106 * which need to be fixed while watching the movie.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
107 */
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
111 char *fname;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
112 FILE *f;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
113 int i;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
117 fname = get_path("subtitle_log");
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
121 fprintf(f, "----------------------------------------------------------\n");
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
133 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
134 for (i = 0; i < vo_sub_last->lines; i++) {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
135 fprintf(f, "%s\n", vo_sub_last->text[i]);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
136 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
137 fclose(f);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
138 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
139
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
140
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
141 /// \defgroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
142 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
143
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
144 /// \defgroup GeneralProperties General properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
145 /// \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
146 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
147
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
153 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
154
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
167 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
176 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
177
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
183 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
184
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
197 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
198
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
207 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
208
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
217 switch (action) {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
225 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
226 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
227 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
228
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
235 switch (action) {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
239 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
240 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
241 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
242
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
249 switch (action) {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
253 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
254 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
255 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
256
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
263 switch (action) {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
268 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
269 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
270 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
271
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
276 double len;
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
277
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
304 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
305
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
306 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
307
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
308 /// \defgroup AudioProperties Audio properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
309 /// \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
310 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
311
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
333 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
334 case M_PROPERTY_STEP_DOWN:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
335 case M_PROPERTY_SET:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
336 break;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
337 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
338 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
339 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
343 mpctx->user_muted = 0;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
364 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
365 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
366 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
367
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
386 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
402
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
403 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
404 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
405
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
413 case M_PROPERTY_SET:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
414 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
b6aa3eedf49b Move the sh_audio->delay field to mpctx->delay.
uau
parents: 22483
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
427 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
428 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
429
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
436 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->format);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
437 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
438
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
445 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->i_bps);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
446 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
447
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
454 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->samplerate);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
455 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
456
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
479 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
480 return m_property_int_ro(prop, action, arg, mpctx->sh_audio->channels);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
481 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
482
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
487 int current_id = -1, tmp;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
488
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
489 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
518 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
519
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
528
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
529 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
552 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
553 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
554 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
555
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
556 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
557
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
562 int current_id = -1, tmp;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
563
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
564 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
586
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
587 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
611
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
612 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
613 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
614 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
615 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
620 demux_program_t prog;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
621
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
622 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
623 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
637
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
638 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
639 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
640 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
641 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
642
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
643 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
644
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
645 /// \defgroup VideoProperties Video properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
646 /// \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
647 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
648
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
656
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
657 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
664 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
665 case M_PROPERTY_STEP_DOWN:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
676 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
677 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
682 int deinterlace;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
699 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
705 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
706 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
707 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
708
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
712 {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
717
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
718 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
726 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
738 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
739 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
740
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
741 /// Helper to set vo flags.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
742 /** \ingroup PropertyImplHelper
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
750
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
751 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
758 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
765 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
766 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
767
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
774 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
775
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
782 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
783
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
790 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
791
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
810 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
811 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
812
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
825 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
826
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
827 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
844 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
853 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
854 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
855 }
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
856
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
857 #ifdef USE_TV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
863 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
864 #endif
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
865
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
866 return M_PROPERTY_UNAVAILABLE;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
867 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
868
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
874 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
875
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
882 return m_property_int_ro(prop, action, arg, mpctx->sh_video->format);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
883 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
884
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
891 return m_property_int_ro(prop, action, arg, mpctx->sh_video->i_bps);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
892 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
893
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
900 return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_w);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
901 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
902
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
909 return m_property_int_ro(prop, action, arg, mpctx->sh_video->disp_h);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
910 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
911
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
918 return m_property_float_ro(prop, action, arg, mpctx->sh_video->fps);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
919 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
920
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
927 return m_property_float_ro(prop, action, arg, mpctx->sh_video->aspect);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
928 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
929
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
930 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
931
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
932 /// \defgroup SubProprties Subtitles properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
933 /// \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
934 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
935
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
942
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
943 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
947 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
952 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
953 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
954
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
959 demux_stream_t *const d_sub = mpctx->d_sub;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
960 const int global_sub_size = mpctx->global_sub_size;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
966
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
967 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1007 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1049
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1069 default:
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1070 return M_PROPERTY_NOT_IMPLEMENTED;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1071 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1072
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1075
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1083
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1084 mpctx->set_of_sub_pos = -1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1085 subdata = NULL;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1086 vo_sub_last = vo_sub = NULL;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1087
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1088 vobsub_id = -1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1089 dvdsub_id = -1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1094 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1095 #ifdef USE_ASS
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1096 ass_track = 0;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1097 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1098
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1123 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1124
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1154 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1162 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1163 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1164 update_subtitles(mpctx->sh_video, d_sub, 1);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1165
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1166 return M_PROPERTY_OK;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1167 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1168
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1176 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1187
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1188 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1198 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1203 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1204 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1205
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1217 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1224 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1225 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1226
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1233
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1234 switch (action) {
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1238 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1245 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1246
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1247 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1248
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1249 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1250
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1251 /// \defgroup TVProperties TV properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1252 /// \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1253 ///@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1254
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1255 #ifdef USE_TV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1256
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1274 case M_PROPERTY_STEP_UP:
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1285 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1286 return M_PROPERTY_NOT_IMPLEMENTED;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1287 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1288
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1289 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1290
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1291 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1292
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1293 /// All properties available in MPlayer.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1294 /** \ingroup Properties
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1295 */
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1296 static m_option_t mp_properties[] = {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1297 // General
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1318
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1319 // Audio
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1336
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1337 // Video
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1380
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1381 // Subs
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1395 #ifdef USE_TV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1404 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1405
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1406 { NULL, NULL, NULL, 0, 0, 0, NULL }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1407 };
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1413 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1420 return m_property_do(p, action, val, ctx);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1421 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1425 return m_properties_expand_string(mp_properties, str, mpctx);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1426 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1430 m_properties_print_help_list(mp_properties);
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1431 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1432
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1433
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1434 ///@}
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1435 // Properties group
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1436
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1437
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1438 /**
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1439 * \defgroup Command2Property Command to property bridge
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1440 *
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1441 * It is used to handle most commands that just set a property
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1442 * and optionally display something on the OSD.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1443 * Two kinds of commands are handled: adjust or toggle.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1444 *
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1445 * Adjust commands take 1 or 2 parameters: <value> <abs>
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1446 * If <abs> is non-zero the property is set to the given value
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1447 * otherwise it is adjusted.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1448 *
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1449 * Toggle commands take 0 or 1 parameters. With no parameter
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1450 * or a value less than the property minimum it just steps the
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1451 * property to its next value. Otherwise it sets it to the given
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1452 * value.
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1453 *
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1454 *@{
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1455 */
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1456
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1459 /// property name
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1460 const char *name;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1461 /// cmd id
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1462 int cmd;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1463 /// set/adjust or toggle command
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1464 int toggle;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1465 /// progressbar type
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1466 int osd_progbar;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1467 /// osd msg id if it must be shared
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1468 int osd_id;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1471 } set_prop_cmd[] = {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1472 // audio
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1473 { "volume", MP_CMD_VOLUME, 0, OSD_VOLUME, -1, MSGTR_Volume },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1474 { "mute", MP_CMD_MUTE, 1, 0, -1, MSGTR_MuteStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1475 { "audio_delay", MP_CMD_AUDIO_DELAY, 0, 0, -1, MSGTR_AVDelayStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1476 { "switch_audio", MP_CMD_SWITCH_AUDIO, 1, 0, -1, MSGTR_OSDAudio },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1477 // video
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1478 { "fullscreen", MP_CMD_VO_FULLSCREEN, 1, 0, -1, NULL },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1479 { "panscan", MP_CMD_PANSCAN, 0, OSD_PANSCAN, -1, MSGTR_Panscan },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1480 { "ontop", MP_CMD_VO_ONTOP, 1, 0, -1, MSGTR_OnTopStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1481 { "rootwin", MP_CMD_VO_ROOTWIN, 1, 0, -1, MSGTR_RootwinStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1482 { "border", MP_CMD_VO_BORDER, 1, 0, -1, MSGTR_BorderStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1483 { "framedropping", MP_CMD_FRAMEDROPPING, 1, 0, -1, MSGTR_FramedroppingStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1484 { "gamma", MP_CMD_GAMMA, 0, OSD_BRIGHTNESS, -1, MSGTR_Gamma },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1485 { "brightness", MP_CMD_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1486 { "contrast", MP_CMD_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1487 { "saturation", MP_CMD_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1488 { "hue", MP_CMD_HUE, 0, OSD_HUE, -1, MSGTR_Hue },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1491 { "sub", MP_CMD_SUB_SELECT, 1, 0, -1, MSGTR_SubSelectStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1492 { "sub_pos", MP_CMD_SUB_POS, 0, 0, -1, MSGTR_SubPosStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1493 { "sub_alignment", MP_CMD_SUB_ALIGNMENT, 1, 0, -1, MSGTR_SubAlignStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1494 { "sub_delay", MP_CMD_SUB_DELAY, 0, 0, OSD_MSG_SUB_DELAY, MSGTR_SubDelayStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1495 { "sub_visibility", MP_CMD_SUB_VISIBILITY, 1, 0, -1, MSGTR_SubVisibleStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1496 { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY, 1, 0, -1, MSGTR_SubForcedOnlyStatus },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1497 #ifdef USE_TV
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1498 { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS, 0, OSD_BRIGHTNESS, -1, MSGTR_Brightness },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1499 { "tv_hue", MP_CMD_TV_SET_HUE, 0, OSD_HUE, -1, MSGTR_Hue },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1500 { "tv_saturation", MP_CMD_TV_SET_SATURATION, 0, OSD_SATURATION, -1, MSGTR_Saturation },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1501 { "tv_contrast", MP_CMD_TV_SET_CONTRAST, 0, OSD_CONTRAST, -1, MSGTR_Contrast },
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1502 #endif
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1503 { NULL, 0, 0, 0, -1, NULL }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1504 };
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1505
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1506
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1520 // get the property
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1564 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1565 return 1;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1566 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1567
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1568
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1569 int run_command(MPContext * mpctx, mp_cmd_t * cmd)
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1570 {
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1571 sh_audio_t * const sh_audio = mpctx->sh_audio;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
1730
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
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
22667
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1944 case MP_CMD_TV_STEP_FREQ:
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1945 if (mpctx->file_format == DEMUXER_TYPE_TV)
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1946 tv_step_freq((tvi_handle_t *) (mpctx->demuxer->priv),
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1947 cmd->args[0].v.f * 16.0);
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1948 break;
e1859558b37d New slave command: tv_step_freq <offset in MHz>
voroshil
parents: 22488
diff changeset
1949
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1950 case MP_CMD_TV_SET_NORM:
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 tv_set_norm((tvi_handle_t *) (mpctx->demuxer->priv),
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1953 cmd->args[0].v.s);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1954 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1955
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1956 case MP_CMD_TV_STEP_CHANNEL:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1957 if (mpctx->file_format == DEMUXER_TYPE_TV) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1958 int v = cmd->args[0].v.i;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1959 if (v > 0) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1960 tv_step_channel((tvi_handle_t *) (mpctx->
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1961 demuxer->priv),
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1962 TV_CHANNEL_HIGHER);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1963 } else {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1964 tv_step_channel((tvi_handle_t *) (mpctx->
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1965 demuxer->priv),
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1966 TV_CHANNEL_LOWER);
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 if (tv_channel_list) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1969 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1970 MSGTR_OSDChannel, tv_channel_current->name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1971 //vo_osd_changed(OSDTYPE_SUBTITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1972 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1973 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1974 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1975 #ifdef HAS_DVBIN_SUPPORT
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1976 if ((mpctx->stream->type == STREAMTYPE_DVB)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1977 && mpctx->stream->priv) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1978 dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1979 if (priv->is_on) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1980 int dir;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1981 int v = cmd->args[0].v.i;
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 mpctx->last_dvb_step = v;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1984 if (v > 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1985 dir = DVB_CHANNEL_HIGHER;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1986 else
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1987 dir = DVB_CHANNEL_LOWER;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1988
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1989
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1990 if (dvb_step_channel(priv, dir))
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1991 mpctx->eof = mpctx->dvbin_reopen = 1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1992 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1993 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1994 #endif /* HAS_DVBIN_SUPPORT */
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1995 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1996
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1997 case MP_CMD_TV_SET_CHANNEL:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1998 if (mpctx->file_format == DEMUXER_TYPE_TV) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
1999 tv_set_channel((tvi_handle_t *) (mpctx->demuxer->priv),
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2000 cmd->args[0].v.s);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2001 if (tv_channel_list) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2002 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2003 MSGTR_OSDChannel, tv_channel_current->name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2004 //vo_osd_changed(OSDTYPE_SUBTITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2005 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2006 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2007 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2008
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2009 #ifdef HAS_DVBIN_SUPPORT
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2010 case MP_CMD_DVB_SET_CHANNEL:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2011 if ((mpctx->stream->type == STREAMTYPE_DVB)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2012 && mpctx->stream->priv) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2013 dvb_priv_t *priv = (dvb_priv_t *) mpctx->stream->priv;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2014 if (priv->is_on) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2015 if (priv->list->current <= cmd->args[0].v.i)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2016 mpctx->last_dvb_step = 1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2017 else
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2018 mpctx->last_dvb_step = -1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2019
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2020 if (dvb_set_channel
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2021 (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
2022 mpctx->eof = mpctx->dvbin_reopen = 1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2023 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2024 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2025 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2026 #endif /* HAS_DVBIN_SUPPORT */
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2027
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2028 case MP_CMD_TV_LAST_CHANNEL:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2029 if (mpctx->file_format == DEMUXER_TYPE_TV) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2030 tv_last_channel((tvi_handle_t *) (mpctx->demuxer->priv));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2031 if (tv_channel_list) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2032 set_osd_msg(OSD_MSG_TV_CHANNEL, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2033 MSGTR_OSDChannel, tv_channel_current->name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2034 //vo_osd_changed(OSDTYPE_SUBTITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2035 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2036 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2037 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2038
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2039 case MP_CMD_TV_STEP_NORM:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2040 if (mpctx->file_format == DEMUXER_TYPE_TV)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2041 tv_step_norm((tvi_handle_t *) (mpctx->demuxer->priv));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2042 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2043
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2044 case MP_CMD_TV_STEP_CHANNEL_LIST:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2045 if (mpctx->file_format == DEMUXER_TYPE_TV)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2046 tv_step_chanlist((tvi_handle_t *) (mpctx->demuxer->priv));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2047 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2048 #endif /* USE_TV */
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2049
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2050 case MP_CMD_SUB_LOAD:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2051 if (sh_video) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2052 int n = mpctx->set_of_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2053 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
2054 if (n != mpctx->set_of_sub_size) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2055 if (mpctx->global_sub_indices[SUB_SOURCE_SUBS] < 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2056 mpctx->global_sub_indices[SUB_SOURCE_SUBS] =
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2057 mpctx->global_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2058 ++mpctx->global_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2059 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2060 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2061 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2062
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2063 case MP_CMD_SUB_REMOVE:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2064 if (sh_video) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2065 int v = cmd->args[0].v.i;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2066 sub_data *subd;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2067 if (v < 0) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2068 for (v = 0; v < mpctx->set_of_sub_size; ++v) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2069 subd = mpctx->set_of_subtitles[v];
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2070 mp_msg(MSGT_CPLAYER, MSGL_STATUS,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2071 MSGTR_RemovedSubtitleFile, v + 1,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2072 filename_recode(subd->filename));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2073 sub_free(subd);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2074 mpctx->set_of_subtitles[v] = NULL;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2075 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2076 mpctx->global_sub_indices[SUB_SOURCE_SUBS] = -1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2077 mpctx->global_sub_size -= mpctx->set_of_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2078 mpctx->set_of_sub_size = 0;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2079 if (mpctx->set_of_sub_pos >= 0) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2080 mpctx->global_sub_pos = -2;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2081 vo_sub_last = vo_sub = NULL;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2082 vo_osd_changed(OSDTYPE_SUBTITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2083 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
2084 mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2085 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2086 } else if (v < mpctx->set_of_sub_size) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2087 subd = mpctx->set_of_subtitles[v];
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2088 mp_msg(MSGT_CPLAYER, MSGL_STATUS,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2089 MSGTR_RemovedSubtitleFile, v + 1,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2090 filename_recode(subd->filename));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2091 sub_free(subd);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2092 if (mpctx->set_of_sub_pos == v) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2093 mpctx->global_sub_pos = -2;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2094 vo_sub_last = vo_sub = NULL;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2095 vo_osd_changed(OSDTYPE_SUBTITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2096 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
2097 mp_input_queue_cmd(mp_input_parse_cmd("sub_select"));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2098 } else if (mpctx->set_of_sub_pos > v) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2099 --mpctx->set_of_sub_pos;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2100 --mpctx->global_sub_pos;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2101 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2102 while (++v < mpctx->set_of_sub_size)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2103 mpctx->set_of_subtitles[v - 1] =
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2104 mpctx->set_of_subtitles[v];
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2105 --mpctx->set_of_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2106 --mpctx->global_sub_size;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2107 if (mpctx->set_of_sub_size <= 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2108 mpctx->global_sub_indices[SUB_SOURCE_SUBS] = -1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2109 mpctx->set_of_subtitles[mpctx->set_of_sub_size] = NULL;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2110 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2111 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2112 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2113
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2114 case MP_CMD_GET_SUB_VISIBILITY:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2115 if (sh_video) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2116 mp_msg(MSGT_GLOBAL, MSGL_INFO,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2117 "ANS_SUB_VISIBILITY=%d\n", sub_visibility);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2118 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2119 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2120
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2121 case MP_CMD_SCREENSHOT:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2122 if (vo_config_count) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2123 mp_msg(MSGT_CPLAYER, MSGL_INFO, "sending VFCTRL_SCREENSHOT!\n");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2124 if (CONTROL_OK !=
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2125 ((vf_instance_t *) sh_video->vfilter)->
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2126 control(sh_video->vfilter, VFCTRL_SCREENSHOT,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2127 &cmd->args[0].v.i))
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2128 mpctx->video_out->control(VOCTRL_SCREENSHOT, NULL);
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 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2131
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2132 case MP_CMD_VF_CHANGE_RECTANGLE:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2133 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
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_TIME_LENGTH:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2137 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_LENGTH=%.2lf\n",
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2138 demuxer_get_time_length(mpctx->demuxer));
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_FILENAME:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2143 mp_msg(MSGT_GLOBAL, MSGL_INFO, "ANS_FILENAME='%s'\n",
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2144 get_metadata(META_NAME));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2145 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2146 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2147
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2148 case MP_CMD_GET_VIDEO_CODEC:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2149 char *inf = get_metadata(META_VIDEO_CODEC);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2150 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2151 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2152 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
2153 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2154 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2155 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2156
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2157 case MP_CMD_GET_VIDEO_BITRATE:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2158 char *inf = get_metadata(META_VIDEO_BITRATE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2159 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2160 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2161 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
2162 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2163 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2164 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2165
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2166 case MP_CMD_GET_VIDEO_RESOLUTION:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2167 char *inf = get_metadata(META_VIDEO_RESOLUTION);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2168 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2169 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2170 mp_msg(MSGT_GLOBAL, MSGL_INFO,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2171 "ANS_VIDEO_RESOLUTION='%s'\n", inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2172 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2173 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2174 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2175
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2176 case MP_CMD_GET_AUDIO_CODEC:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2177 char *inf = get_metadata(META_AUDIO_CODEC);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2178 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2179 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2180 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
2181 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2182 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2183 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2184
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2185 case MP_CMD_GET_AUDIO_BITRATE:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2186 char *inf = get_metadata(META_AUDIO_BITRATE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2187 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2188 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2189 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
2190 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2191 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2192 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2193
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2194 case MP_CMD_GET_AUDIO_SAMPLES:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2195 char *inf = get_metadata(META_AUDIO_SAMPLES);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2196 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2197 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2198 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
2199 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2200 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2201 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2202
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2203 case MP_CMD_GET_META_TITLE:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2204 char *inf = get_metadata(META_INFO_TITLE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2205 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2206 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2207 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
2208 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2209 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2210 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2211
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2212 case MP_CMD_GET_META_ARTIST:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2213 char *inf = get_metadata(META_INFO_ARTIST);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2214 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2215 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2216 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
2217 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2218 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2219 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2220
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2221 case MP_CMD_GET_META_ALBUM:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2222 char *inf = get_metadata(META_INFO_ALBUM);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2223 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2224 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2225 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
2226 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2227 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2228 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2229
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2230 case MP_CMD_GET_META_YEAR:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2231 char *inf = get_metadata(META_INFO_YEAR);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2232 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2233 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2234 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
2235 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2236 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2237 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2238
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2239 case MP_CMD_GET_META_COMMENT:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2240 char *inf = get_metadata(META_INFO_COMMENT);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2241 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2242 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2243 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
2244 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2245 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2246 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2247
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2248 case MP_CMD_GET_META_TRACK:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2249 char *inf = get_metadata(META_INFO_TRACK);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2250 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2251 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2252 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
2253 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2254 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2255 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2256
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2257 case MP_CMD_GET_META_GENRE:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2258 char *inf = get_metadata(META_INFO_GENRE);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2259 if (!inf)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2260 inf = strdup("");
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2261 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
2262 free(inf);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2263 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2264 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2265
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2266 case MP_CMD_GET_VO_FULLSCREEN:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2267 if (mpctx->video_out && vo_config_count)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2268 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
2269 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2270
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2271 case MP_CMD_GET_PERCENT_POS:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2272 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
2273 demuxer_get_percent_pos(mpctx->demuxer));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2274 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2275
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2276 case MP_CMD_GET_TIME_POS:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2277 float pos = 0;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2278 if (sh_video)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2279 pos = sh_video->pts;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2280 else if (sh_audio && mpctx->audio_out)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2281 pos =
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2282 playing_audio_pts(sh_audio, mpctx->d_audio,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2283 mpctx->audio_out);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2284 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
2285 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2286 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2287
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2288 case MP_CMD_RUN:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2289 #ifndef __MINGW32__
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2290 if (!fork()) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2291 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
2292 exit(0);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2293 }
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2294 #endif
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2295 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2296
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2297 case MP_CMD_KEYDOWN_EVENTS:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2298 mplayer_put_key(cmd->args[0].v.i);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2299 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2300
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2301 case MP_CMD_SEEK_CHAPTER:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2302 int seek = cmd->args[0].v.i;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2303 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
2304 int chap;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2305 float next_pts = 0;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2306 int num_chapters;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2307 char *chapter_name;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2308
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2309 rel_seek_secs = 0;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2310 abs_seek_pos = 0;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2311 chap =
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2312 demuxer_seek_chapter(mpctx->demuxer, seek, abs,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2313 &next_pts, &num_chapters,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2314 &chapter_name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2315 if (chap != -1) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2316 if (next_pts > -1.0) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2317 abs_seek_pos = 1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2318 rel_seek_secs = next_pts;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2319 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2320 if (chapter_name) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2321 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2322 MSGTR_OSDChapter, chap + 1, chapter_name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2323 free(chapter_name);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2324 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2325 } else {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2326 if (seek > 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2327 rel_seek_secs = 1000000000.;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2328 else
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2329 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2330 MSGTR_OSDChapter, 0, MSGTR_Unknown);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2331 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2332 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2333 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2334 break;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2335
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2336 case MP_CMD_SET_MOUSE_POS:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2337 int button = -1, pointer_x, pointer_y;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2338 double dx, dy;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2339 pointer_x = cmd->args[0].v.i;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2340 pointer_y = cmd->args[1].v.i;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2341 rescale_input_coordinates(pointer_x, pointer_y, &dx, &dy);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2342 #ifdef USE_DVDNAV
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2343 if (mpctx->stream->type == STREAMTYPE_DVDNAV
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2344 && dx > 0.0 && dy > 0.0) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2345 pointer_x = (int) (dx * (double) sh_video->disp_w);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2346 pointer_y = (int) (dy * (double) sh_video->disp_h);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2347 mp_dvdnav_update_mouse_pos(mpctx->stream,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2348 pointer_x, pointer_y, &button);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2349 if (button > 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2350 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2351 "Selected button number %d", button);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2352 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2353 #endif
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2354 }
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 #ifdef USE_DVDNAV
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2358 case MP_CMD_DVDNAV:{
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2359 int button = -1;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2360 if (mpctx->stream->type != STREAMTYPE_DVDNAV)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2361 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2362
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2363 if (mp_dvdnav_handle_input
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2364 (mpctx->stream, cmd->args[0].v.i, &button)) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2365 uninit_player(INITED_ALL - (INITED_STREAM | INITED_INPUT |
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2366 (fixed_vo ? INITED_VO : 0)));
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2367 brk_cmd = 2;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2368 } else if (button > 0)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2369 set_osd_msg(OSD_MSG_TEXT, 1, osd_duration,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2370 "Selected button number %d", button);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2371 }
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2372 break;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2373 #endif
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2374
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2375 default:
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2376 #ifdef HAVE_NEW_GUI
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2377 if ((use_gui) && (cmd->id > MP_CMD_GUI_EVENTS))
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2378 guiGetEvent(guiIEvent, (char *) cmd->id);
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2379 else
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2380 #endif
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2381 mp_msg(MSGT_CPLAYER, MSGL_V,
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2382 "Received unknown cmd %s\n", cmd->name);
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2383 }
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2384
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2385 switch (cmd->pausing) {
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2386 case 1: // "pausing"
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2387 mpctx->osd_function = OSD_PAUSE;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2388 break;
22479
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2389 case 3: // "pausing_toggle"
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2390 mpctx->was_paused = !mpctx->was_paused;
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2391 // fall through
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2392 case 2: // "pausing_keep"
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2393 if (mpctx->was_paused)
a99ddf2ece25 Change to match current command.c (same functionality).
uau
parents: 22478
diff changeset
2394 mpctx->osd_function = OSD_PAUSE;
22478
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2395 }
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2396 return brk_cmd;
3501ae650b23 Add alternative way to create command.c to svn history,
uau
parents:
diff changeset
2397 }