annotate command.c @ 22372:915194317cb7

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