8 #include "input/input.h"
9 #include "stream/stream.h"
10 #include "libmpdemux/demuxer.h"
11 #include "libmpdemux/stheader.h"
12 #include "codec-cfg.h"
14 #include "libvo/sub.h"
16 #include "m_property.h"
19 #include "libmpcodecs/vf.h"
20 #include "libmpcodecs/vd.h"
22 #include "libvo/video_out.h"
23 #include "libvo/font_load.h"
25 #include "libao2/audio_out.h"
28 #include "libmpcodecs/dec_video.h"
33 #include "stream/tv.h"
36 #include "stream/stream_radio.h"
39 #include "stream/pvr.h"
42 #include "stream/dvbin.h"
45 #include "stream/stream_dvd.h"
48 #include "stream/stream_dvdnav.h"
51 #include "libass/ass.h"
52 #include "libass/ass_mp.h"
56 #include "libmenu/menu.h"
59 #include "gui/interface.h"
64 #include "libavutil/avstring.h"
66 #define ROUND(x) ((int)((x)<0 ? (x)-0.5 : (x)+0.5))
70 static void rescale_input_coordinates(struct MPContext
*mpctx
, int ix
, int iy
,
71 double *dx
, double *dy
)
73 struct MPOpts
*opts
= &mpctx
->opts
;
74 struct vo
*vo
= mpctx
->video_out
;
75 //remove the borders, if any, and rescale to the range [0,1],[0,1]
76 if (vo_fs
) { //we are in full-screen mode
77 if (opts
->vo_screenwidth
> vo
->dwidth
) //there are borders along the x axis
78 ix
-= (opts
->vo_screenwidth
- vo
->dwidth
) / 2;
79 if (opts
->vo_screenheight
> vo
->dheight
) //there are borders along the y axis (usual way)
80 iy
-= (opts
->vo_screenheight
- vo
->dheight
) / 2;
82 if (ix
< 0 || ix
> vo
->dwidth
) {
85 } //we are on one of the borders
86 if (iy
< 0 || iy
> vo
->dheight
) {
89 } //we are on one of the borders
92 *dx
= (double) ix
/ (double) vo
->dwidth
;
93 *dy
= (double) iy
/ (double) vo
->dheight
;
95 mp_msg(MSGT_CPLAYER
, MSGL_V
,
96 "\r\nrescaled coordinates: %.3lf, %.3lf, screen (%d x %d), vodisplay: (%d, %d), fullscreen: %d\r\n",
97 *dx
, *dy
, opts
->vo_screenwidth
, opts
->vo_screenheight
, vo
->dwidth
,
101 static int sub_source_by_pos(MPContext
*mpctx
, int pos
)
106 for (i
= 0; i
< SUB_SOURCES
; i
++) {
107 int j
= mpctx
->global_sub_indices
[i
];
108 if ((j
>= 0) && (j
> top
) && (pos
>= j
)) {
116 static int sub_source(MPContext
*mpctx
)
118 return sub_source_by_pos(mpctx
, mpctx
->global_sub_pos
);
122 * \brief Log the currently displayed subtitle to a file
124 * Logs the current or last displayed subtitle together with filename
125 * and time information to ~/.mplayer/subtitle_log
127 * Intended purpose is to allow convenient marking of bogus subtitles
128 * which need to be fixed while watching the movie.
131 static void log_sub(struct MPContext
*mpctx
)
137 if (subdata
== NULL
|| vo_sub_last
== NULL
)
139 fname
= get_path("subtitle_log");
140 f
= fopen(fname
, "a");
143 fprintf(f
, "----------------------------------------------------------\n");
144 if (subdata
->sub_uses_time
) {
146 "N: %s S: %02ld:%02ld:%02ld.%02ld E: %02ld:%02ld:%02ld.%02ld\n",
147 mpctx
->filename
, vo_sub_last
->start
/ 360000,
148 (vo_sub_last
->start
/ 6000) % 60,
149 (vo_sub_last
->start
/ 100) % 60, vo_sub_last
->start
% 100,
150 vo_sub_last
->end
/ 360000, (vo_sub_last
->end
/ 6000) % 60,
151 (vo_sub_last
->end
/ 100) % 60, vo_sub_last
->end
% 100);
153 fprintf(f
, "N: %s S: %ld E: %ld\n", mpctx
->filename
,
154 vo_sub_last
->start
, vo_sub_last
->end
);
156 for (i
= 0; i
< vo_sub_last
->lines
; i
++) {
157 fprintf(f
, "%s\n", vo_sub_last
->text
[i
]);
163 /// \defgroup Properties
166 /// \defgroup GeneralProperties General properties
167 /// \ingroup Properties
171 static int mp_property_osdlevel(m_option_t
*prop
, int action
, void *arg
,
174 return m_property_choice(prop
, action
, arg
, &osd_level
);
178 static int mp_property_loop(m_option_t
*prop
, int action
, void *arg
,
181 struct MPOpts
*opts
= &mpctx
->opts
;
183 case M_PROPERTY_PRINT
:
184 if (!arg
) return M_PROPERTY_ERROR
;
185 if (opts
->loop_times
< 0)
186 *(char**)arg
= strdup("off");
187 else if (opts
->loop_times
== 0)
188 *(char**)arg
= strdup("inf");
191 return M_PROPERTY_OK
;
193 return m_property_int_range(prop
, action
, arg
, &opts
->loop_times
);
196 /// Playback speed (RW)
197 static int mp_property_playback_speed(m_option_t
*prop
, int action
,
198 void *arg
, MPContext
*mpctx
)
200 struct MPOpts
*opts
= &mpctx
->opts
;
204 return M_PROPERTY_ERROR
;
205 M_PROPERTY_CLAMP(prop
, *(float *) arg
);
206 opts
->playback_speed
= *(float *) arg
;
207 build_afilter_chain(mpctx
, mpctx
->sh_audio
, &ao_data
);
208 return M_PROPERTY_OK
;
209 case M_PROPERTY_STEP_UP
:
210 case M_PROPERTY_STEP_DOWN
:
211 opts
->playback_speed
+= (arg
? *(float *) arg
: 0.1) *
212 (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
213 M_PROPERTY_CLAMP(prop
, opts
->playback_speed
);
214 build_afilter_chain(mpctx
, mpctx
->sh_audio
, &ao_data
);
215 return M_PROPERTY_OK
;
217 return m_property_float_range(prop
, action
, arg
, &opts
->playback_speed
);
220 /// filename with path (RO)
221 static int mp_property_path(m_option_t
*prop
, int action
, void *arg
,
224 return m_property_string_ro(prop
, action
, arg
, mpctx
->filename
);
227 /// filename without path (RO)
228 static int mp_property_filename(m_option_t
*prop
, int action
, void *arg
,
232 if (!mpctx
->filename
)
233 return M_PROPERTY_UNAVAILABLE
;
234 if (((f
= strrchr(mpctx
->filename
, '/'))
235 || (f
= strrchr(mpctx
->filename
, '\\'))) && f
[1])
239 return m_property_string_ro(prop
, action
, arg
, f
);
242 /// Demuxer name (RO)
243 static int mp_property_demuxer(m_option_t
*prop
, int action
, void *arg
,
247 return M_PROPERTY_UNAVAILABLE
;
248 return m_property_string_ro(prop
, action
, arg
,
249 (char *) mpctx
->demuxer
->desc
->name
);
252 /// Position in the stream (RW)
253 static int mp_property_stream_pos(m_option_t
*prop
, int action
, void *arg
,
256 if (!mpctx
->demuxer
|| !mpctx
->demuxer
->stream
)
257 return M_PROPERTY_UNAVAILABLE
;
259 return M_PROPERTY_ERROR
;
262 *(off_t
*) arg
= stream_tell(mpctx
->demuxer
->stream
);
263 return M_PROPERTY_OK
;
265 M_PROPERTY_CLAMP(prop
, *(off_t
*) arg
);
266 stream_seek(mpctx
->demuxer
->stream
, *(off_t
*) arg
);
267 return M_PROPERTY_OK
;
269 return M_PROPERTY_NOT_IMPLEMENTED
;
272 /// Stream start offset (RO)
273 static int mp_property_stream_start(m_option_t
*prop
, int action
,
274 void *arg
, MPContext
*mpctx
)
276 if (!mpctx
->demuxer
|| !mpctx
->demuxer
->stream
)
277 return M_PROPERTY_UNAVAILABLE
;
280 *(off_t
*) arg
= mpctx
->demuxer
->stream
->start_pos
;
281 return M_PROPERTY_OK
;
283 return M_PROPERTY_NOT_IMPLEMENTED
;
286 /// Stream end offset (RO)
287 static int mp_property_stream_end(m_option_t
*prop
, int action
, void *arg
,
290 if (!mpctx
->demuxer
|| !mpctx
->demuxer
->stream
)
291 return M_PROPERTY_UNAVAILABLE
;
294 *(off_t
*) arg
= mpctx
->demuxer
->stream
->end_pos
;
295 return M_PROPERTY_OK
;
297 return M_PROPERTY_NOT_IMPLEMENTED
;
300 /// Stream length (RO)
301 static int mp_property_stream_length(m_option_t
*prop
, int action
,
302 void *arg
, MPContext
*mpctx
)
304 if (!mpctx
->demuxer
|| !mpctx
->demuxer
->stream
)
305 return M_PROPERTY_UNAVAILABLE
;
309 mpctx
->demuxer
->stream
->end_pos
- mpctx
->demuxer
->stream
->start_pos
;
310 return M_PROPERTY_OK
;
312 return M_PROPERTY_NOT_IMPLEMENTED
;
315 /// Media length in seconds (RO)
316 static int mp_property_length(m_option_t
*prop
, int action
, void *arg
,
321 if (!mpctx
->demuxer
||
322 !(int) (len
= demuxer_get_time_length(mpctx
->demuxer
)))
323 return M_PROPERTY_UNAVAILABLE
;
325 return m_property_time_ro(prop
, action
, arg
, len
);
328 /// Current position in percent (RW)
329 static int mp_property_percent_pos(m_option_t
*prop
, int action
,
330 void *arg
, MPContext
*mpctx
) {
334 return M_PROPERTY_UNAVAILABLE
;
338 if(!arg
) return M_PROPERTY_ERROR
;
339 M_PROPERTY_CLAMP(prop
, *(int*)arg
);
342 case M_PROPERTY_STEP_UP
:
343 case M_PROPERTY_STEP_DOWN
:
344 pos
= demuxer_get_percent_pos(mpctx
->demuxer
);
345 pos
+= (arg
? *(int*)arg
: 10) *
346 (action
== M_PROPERTY_STEP_UP
? 1 : -1);
347 M_PROPERTY_CLAMP(prop
, pos
);
350 return m_property_int_ro(prop
, action
, arg
,
351 demuxer_get_percent_pos(mpctx
->demuxer
));
354 mpctx
->abs_seek_pos
= SEEK_ABSOLUTE
| SEEK_FACTOR
;
355 mpctx
->rel_seek_secs
= pos
/ 100.0;
356 return M_PROPERTY_OK
;
359 /// Current position in seconds (RW)
360 static int mp_property_time_pos(m_option_t
*prop
, int action
,
361 void *arg
, MPContext
*mpctx
) {
362 if (!(mpctx
->sh_video
|| (mpctx
->sh_audio
&& mpctx
->audio_out
)))
363 return M_PROPERTY_UNAVAILABLE
;
367 if(!arg
) return M_PROPERTY_ERROR
;
368 M_PROPERTY_CLAMP(prop
, *(double*)arg
);
369 mpctx
->abs_seek_pos
= SEEK_ABSOLUTE
;
370 mpctx
->rel_seek_secs
= *(double*)arg
;
371 return M_PROPERTY_OK
;
372 case M_PROPERTY_STEP_UP
:
373 case M_PROPERTY_STEP_DOWN
:
374 mpctx
->rel_seek_secs
+= (arg
? *(double*)arg
: 10.0) *
375 (action
== M_PROPERTY_STEP_UP
? 1.0 : -1.0);
376 return M_PROPERTY_OK
;
378 return m_property_time_ro(prop
, action
, arg
,
379 mpctx
->sh_video
? mpctx
->sh_video
->pts
:
380 playing_audio_pts(mpctx
));
383 /// Current chapter (RW)
384 static int mp_property_chapter(m_option_t
*prop
, int action
, void *arg
,
391 char *chapter_name
= NULL
;
394 chapter
= demuxer_get_current_chapter(mpctx
->demuxer
);
396 return M_PROPERTY_UNAVAILABLE
;
401 return M_PROPERTY_ERROR
;
402 *(int *) arg
= chapter
;
403 return M_PROPERTY_OK
;
404 case M_PROPERTY_PRINT
: {
406 return M_PROPERTY_ERROR
;
407 chapter_name
= demuxer_chapter_display_name(mpctx
->demuxer
, chapter
);
409 return M_PROPERTY_UNAVAILABLE
;
410 *(char **) arg
= chapter_name
;
411 return M_PROPERTY_OK
;
415 return M_PROPERTY_ERROR
;
416 M_PROPERTY_CLAMP(prop
, *(int*)arg
);
417 step_all
= *(int *)arg
- (chapter
+ 1);
420 case M_PROPERTY_STEP_UP
:
421 case M_PROPERTY_STEP_DOWN
: {
422 step_all
= (arg
&& *(int*)arg
!= 0 ? *(int*)arg
: 1)
423 * (action
== M_PROPERTY_STEP_UP
? 1 : -1);
430 return M_PROPERTY_NOT_IMPLEMENTED
;
432 mpctx
->rel_seek_secs
= 0;
433 mpctx
->abs_seek_pos
= 0;
434 chapter
= demuxer_seek_chapter(mpctx
->demuxer
, chapter
, 1,
435 &next_pts
, &chapter_num
, &chapter_name
);
437 if (next_pts
> -1.0) {
438 mpctx
->abs_seek_pos
= SEEK_ABSOLUTE
;
439 mpctx
->rel_seek_secs
= next_pts
;
442 set_osd_msg(OSD_MSG_TEXT
, 1, osd_duration
,
443 MSGTR_OSDChapter
, chapter
+ 1, chapter_name
);
445 else if (step_all
> 0)
446 mpctx
->rel_seek_secs
= 1000000000.;
448 set_osd_msg(OSD_MSG_TEXT
, 1, osd_duration
,
449 MSGTR_OSDChapter
, 0, MSGTR_Unknown
);
452 return M_PROPERTY_OK
;
455 /// Current dvd angle (RW)
456 static int mp_property_angle(m_option_t
*prop
, int action
, void *arg
,
461 char *angle_name
= NULL
;
464 angle
= demuxer_get_current_angle(mpctx
->demuxer
);
466 return M_PROPERTY_UNAVAILABLE
;
467 angles
= demuxer_angles_count(mpctx
->demuxer
);
469 return M_PROPERTY_UNAVAILABLE
;
474 return M_PROPERTY_ERROR
;
475 *(int *) arg
= angle
;
476 return M_PROPERTY_OK
;
477 case M_PROPERTY_PRINT
: {
479 return M_PROPERTY_ERROR
;
480 angle_name
= calloc(1, 64);
482 return M_PROPERTY_UNAVAILABLE
;
483 snprintf(angle_name
, 64, "%d/%d", angle
, angles
);
484 *(char **) arg
= angle_name
;
485 return M_PROPERTY_OK
;
489 return M_PROPERTY_ERROR
;
491 M_PROPERTY_CLAMP(prop
, angle
);
493 case M_PROPERTY_STEP_UP
:
494 case M_PROPERTY_STEP_DOWN
: {
500 step
*= (action
== M_PROPERTY_STEP_UP
? 1 : -1);
502 if (angle
< 1) //cycle
507 return M_PROPERTY_NOT_IMPLEMENTED
;
509 angle
= demuxer_set_angle(mpctx
->demuxer
, angle
);
510 set_osd_msg(OSD_MSG_TEXT
, 1, osd_duration
,
511 MSGTR_OSDAngle
, angle
, angles
);
514 return M_PROPERTY_OK
;
517 /// Demuxer meta data
518 static int mp_property_metadata(m_option_t
*prop
, int action
, void *arg
,
520 m_property_action_t
* ka
;
522 static const m_option_t key_type
=
523 { "metadata", NULL
, CONF_TYPE_STRING
, 0, 0, 0, NULL
};
525 return M_PROPERTY_UNAVAILABLE
;
529 if(!arg
) return M_PROPERTY_ERROR
;
530 *(char***)arg
= mpctx
->demuxer
->info
;
531 return M_PROPERTY_OK
;
532 case M_PROPERTY_KEY_ACTION
:
533 if(!arg
) return M_PROPERTY_ERROR
;
535 if(!(meta
= demux_info_get(mpctx
->demuxer
,ka
->key
)))
536 return M_PROPERTY_UNKNOWN
;
539 if(!ka
->arg
) return M_PROPERTY_ERROR
;
540 *(char**)ka
->arg
= meta
;
541 return M_PROPERTY_OK
;
542 case M_PROPERTY_GET_TYPE
:
543 if(!ka
->arg
) return M_PROPERTY_ERROR
;
544 *(m_option_t
**)ka
->arg
= &key_type
;
545 return M_PROPERTY_OK
;
548 return M_PROPERTY_NOT_IMPLEMENTED
;
554 /// \defgroup AudioProperties Audio properties
555 /// \ingroup Properties
559 static int mp_property_volume(m_option_t
*prop
, int action
, void *arg
,
563 if (!mpctx
->sh_audio
)
564 return M_PROPERTY_UNAVAILABLE
;
569 return M_PROPERTY_ERROR
;
570 mixer_getbothvolume(&mpctx
->mixer
, arg
);
571 return M_PROPERTY_OK
;
572 case M_PROPERTY_PRINT
:{
575 return M_PROPERTY_ERROR
;
576 mixer_getbothvolume(&mpctx
->mixer
, &vol
);
577 return m_property_float_range(prop
, action
, arg
, &vol
);
579 case M_PROPERTY_STEP_UP
:
580 case M_PROPERTY_STEP_DOWN
:
584 return M_PROPERTY_NOT_IMPLEMENTED
;
587 if (mpctx
->edl_muted
)
588 return M_PROPERTY_DISABLED
;
589 mpctx
->user_muted
= 0;
594 return M_PROPERTY_ERROR
;
595 M_PROPERTY_CLAMP(prop
, *(float *) arg
);
596 mixer_setvolume(&mpctx
->mixer
, *(float *) arg
, *(float *) arg
);
597 return M_PROPERTY_OK
;
598 case M_PROPERTY_STEP_UP
:
599 if (arg
&& *(float *) arg
<= 0)
600 mixer_decvolume(&mpctx
->mixer
);
602 mixer_incvolume(&mpctx
->mixer
);
603 return M_PROPERTY_OK
;
604 case M_PROPERTY_STEP_DOWN
:
605 if (arg
&& *(float *) arg
<= 0)
606 mixer_incvolume(&mpctx
->mixer
);
608 mixer_decvolume(&mpctx
->mixer
);
609 return M_PROPERTY_OK
;
611 return M_PROPERTY_NOT_IMPLEMENTED
;
615 static int mp_property_mute(m_option_t
*prop
, int action
, void *arg
,
619 if (!mpctx
->sh_audio
)
620 return M_PROPERTY_UNAVAILABLE
;
624 if (mpctx
->edl_muted
)
625 return M_PROPERTY_DISABLED
;
627 return M_PROPERTY_ERROR
;
628 if ((!!*(int *) arg
) != mpctx
->mixer
.muted
)
629 mixer_mute(&mpctx
->mixer
);
630 mpctx
->user_muted
= mpctx
->mixer
.muted
;
631 return M_PROPERTY_OK
;
632 case M_PROPERTY_STEP_UP
:
633 case M_PROPERTY_STEP_DOWN
:
634 if (mpctx
->edl_muted
)
635 return M_PROPERTY_DISABLED
;
636 mixer_mute(&mpctx
->mixer
);
637 mpctx
->user_muted
= mpctx
->mixer
.muted
;
638 return M_PROPERTY_OK
;
639 case M_PROPERTY_PRINT
:
641 return M_PROPERTY_ERROR
;
642 if (mpctx
->edl_muted
) {
643 *(char **) arg
= strdup(MSGTR_EnabledEdl
);
644 return M_PROPERTY_OK
;
647 return m_property_flag(prop
, action
, arg
, &mpctx
->mixer
.muted
);
653 static int mp_property_audio_delay(m_option_t
*prop
, int action
,
654 void *arg
, MPContext
*mpctx
)
656 if (!(mpctx
->sh_audio
&& mpctx
->sh_video
))
657 return M_PROPERTY_UNAVAILABLE
;
660 case M_PROPERTY_STEP_UP
:
661 case M_PROPERTY_STEP_DOWN
: {
663 float delay
= audio_delay
;
664 ret
= m_property_delay(prop
, action
, arg
, &audio_delay
);
665 if (ret
!= M_PROPERTY_OK
)
668 mpctx
->delay
-= audio_delay
- delay
;
670 return M_PROPERTY_OK
;
672 return m_property_delay(prop
, action
, arg
, &audio_delay
);
676 /// Audio codec tag (RO)
677 static int mp_property_audio_format(m_option_t
*prop
, int action
,
678 void *arg
, MPContext
*mpctx
)
680 if (!mpctx
->sh_audio
)
681 return M_PROPERTY_UNAVAILABLE
;
682 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_audio
->format
);
685 /// Audio codec name (RO)
686 static int mp_property_audio_codec(m_option_t
*prop
, int action
,
687 void *arg
, MPContext
*mpctx
)
689 if (!mpctx
->sh_audio
|| !mpctx
->sh_audio
->codec
)
690 return M_PROPERTY_UNAVAILABLE
;
691 return m_property_string_ro(prop
, action
, arg
, mpctx
->sh_audio
->codec
->name
);
694 /// Audio bitrate (RO)
695 static int mp_property_audio_bitrate(m_option_t
*prop
, int action
,
696 void *arg
, MPContext
*mpctx
)
698 if (!mpctx
->sh_audio
)
699 return M_PROPERTY_UNAVAILABLE
;
700 return m_property_bitrate(prop
, action
, arg
, mpctx
->sh_audio
->i_bps
);
704 static int mp_property_samplerate(m_option_t
*prop
, int action
, void *arg
,
707 if (!mpctx
->sh_audio
)
708 return M_PROPERTY_UNAVAILABLE
;
710 case M_PROPERTY_PRINT
:
711 if(!arg
) return M_PROPERTY_ERROR
;
712 *(char**)arg
= malloc(16);
713 sprintf(*(char**)arg
,"%d kHz",mpctx
->sh_audio
->samplerate
/1000);
714 return M_PROPERTY_OK
;
716 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_audio
->samplerate
);
719 /// Number of channels (RO)
720 static int mp_property_channels(m_option_t
*prop
, int action
, void *arg
,
723 if (!mpctx
->sh_audio
)
724 return M_PROPERTY_UNAVAILABLE
;
726 case M_PROPERTY_PRINT
:
728 return M_PROPERTY_ERROR
;
729 switch (mpctx
->sh_audio
->channels
) {
731 *(char **) arg
= strdup("mono");
734 *(char **) arg
= strdup("stereo");
737 *(char **) arg
= malloc(32);
738 sprintf(*(char **) arg
, "%d channels", mpctx
->sh_audio
->channels
);
740 return M_PROPERTY_OK
;
742 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_audio
->channels
);
746 static int mp_property_balance(m_option_t
*prop
, int action
, void *arg
,
751 if (!mpctx
->sh_audio
|| mpctx
->sh_audio
->channels
< 2)
752 return M_PROPERTY_UNAVAILABLE
;
757 return M_PROPERTY_ERROR
;
758 mixer_getbalance(&mpctx
->mixer
, arg
);
759 return M_PROPERTY_OK
;
760 case M_PROPERTY_PRINT
: {
763 return M_PROPERTY_ERROR
;
764 mixer_getbalance(&mpctx
->mixer
, &bal
);
766 *str
= strdup("center");
767 else if (bal
== -1.f
)
768 *str
= strdup("left only");
770 *str
= strdup("right only");
772 unsigned right
= (bal
+ 1.f
) / 2.f
* 100.f
;
773 *str
= malloc(sizeof("left xxx%, right xxx%"));
774 sprintf(*str
, "left %d%%, right %d%%", 100 - right
, right
);
776 return M_PROPERTY_OK
;
778 case M_PROPERTY_STEP_UP
:
779 case M_PROPERTY_STEP_DOWN
:
780 mixer_getbalance(&mpctx
->mixer
, &bal
);
781 bal
+= (arg
? *(float*)arg
: .1f
) *
782 (action
== M_PROPERTY_STEP_UP
? 1.f
: -1.f
);
783 M_PROPERTY_CLAMP(prop
, bal
);
784 mixer_setbalance(&mpctx
->mixer
, bal
);
785 return M_PROPERTY_OK
;
788 return M_PROPERTY_ERROR
;
789 M_PROPERTY_CLAMP(prop
, *(float*)arg
);
790 mixer_setbalance(&mpctx
->mixer
, *(float*)arg
);
791 return M_PROPERTY_OK
;
793 return M_PROPERTY_NOT_IMPLEMENTED
;
796 /// Selected audio id (RW)
797 static int mp_property_audio(m_option_t
*prop
, int action
, void *arg
,
800 struct MPOpts
*opts
= &mpctx
->opts
;
801 int current_id
= -1, tmp
;
805 if (!mpctx
->sh_audio
)
806 return M_PROPERTY_UNAVAILABLE
;
808 return M_PROPERTY_ERROR
;
809 *(int *) arg
= opts
->audio_id
;
810 return M_PROPERTY_OK
;
811 case M_PROPERTY_PRINT
:
812 if (!mpctx
->sh_audio
)
813 return M_PROPERTY_UNAVAILABLE
;
815 return M_PROPERTY_ERROR
;
817 if (opts
->audio_id
< 0)
818 *(char **) arg
= strdup(MSGTR_Disabled
);
820 char lang
[40] = MSGTR_Unknown
;
821 sh_audio_t
* sh
= mpctx
->sh_audio
;
823 av_strlcpy(lang
, sh
->lang
, 40);
824 #ifdef CONFIG_DVDREAD
825 else if (mpctx
->stream
->type
== STREAMTYPE_DVD
) {
826 int code
= dvd_lang_from_aid(mpctx
->stream
, opts
->audio_id
);
836 else if (mpctx
->stream
->type
== STREAMTYPE_DVDNAV
)
837 mp_dvdnav_lang_from_aid(mpctx
->stream
, opts
->audio_id
, lang
);
839 *(char **) arg
= malloc(64);
840 snprintf(*(char **) arg
, 64, "(%d) %s", opts
->audio_id
, lang
);
842 return M_PROPERTY_OK
;
844 case M_PROPERTY_STEP_UP
:
847 return M_PROPERTY_UNAVAILABLE
;
848 if (action
== M_PROPERTY_SET
&& arg
)
849 tmp
= *((int *) arg
);
852 current_id
= mpctx
->demuxer
->audio
->id
;
853 opts
->audio_id
= demuxer_switch_audio(mpctx
->demuxer
, tmp
);
854 if (opts
->audio_id
== -2
855 || (opts
->audio_id
> -1
856 && mpctx
->demuxer
->audio
->id
!= current_id
&& current_id
!= -2))
857 uninit_player(mpctx
, INITIALIZED_AO
| INITIALIZED_ACODEC
);
858 if (opts
->audio_id
> -1 && mpctx
->demuxer
->audio
->id
!= current_id
) {
860 sh2
= mpctx
->demuxer
->a_streams
[mpctx
->demuxer
->audio
->id
];
862 sh2
->ds
= mpctx
->demuxer
->audio
;
863 mpctx
->sh_audio
= sh2
;
864 reinit_audio_chain(mpctx
);
867 mp_msg(MSGT_IDENTIFY
, MSGL_INFO
, "ID_AUDIO_TRACK=%d\n", opts
->audio_id
);
868 return M_PROPERTY_OK
;
870 return M_PROPERTY_NOT_IMPLEMENTED
;
875 /// Selected video id (RW)
876 static int mp_property_video(m_option_t
*prop
, int action
, void *arg
,
879 struct MPOpts
*opts
= &mpctx
->opts
;
880 int current_id
= -1, tmp
;
884 if (!mpctx
->sh_video
)
885 return M_PROPERTY_UNAVAILABLE
;
887 return M_PROPERTY_ERROR
;
888 *(int *) arg
= opts
->video_id
;
889 return M_PROPERTY_OK
;
890 case M_PROPERTY_PRINT
:
891 if (!mpctx
->sh_video
)
892 return M_PROPERTY_UNAVAILABLE
;
894 return M_PROPERTY_ERROR
;
896 if (opts
->video_id
< 0)
897 *(char **) arg
= strdup(MSGTR_Disabled
);
899 char lang
[40] = MSGTR_Unknown
;
900 *(char **) arg
= malloc(64);
901 snprintf(*(char **) arg
, 64, "(%d) %s", opts
->video_id
, lang
);
903 return M_PROPERTY_OK
;
905 case M_PROPERTY_STEP_UP
:
907 current_id
= mpctx
->demuxer
->video
->id
;
908 if (action
== M_PROPERTY_SET
&& arg
)
909 tmp
= *((int *) arg
);
912 opts
->video_id
= demuxer_switch_video(mpctx
->demuxer
, tmp
);
913 if (opts
->video_id
== -2
914 || (opts
->video_id
> -1 && mpctx
->demuxer
->video
->id
!= current_id
915 && current_id
!= -2))
916 uninit_player(mpctx
, INITIALIZED_VCODEC
|
917 (mpctx
->opts
.fixed_vo
&& opts
->video_id
!= -2 ? 0 : INITIALIZED_VO
));
918 if (opts
->video_id
> -1 && mpctx
->demuxer
->video
->id
!= current_id
) {
920 sh2
= mpctx
->demuxer
->v_streams
[mpctx
->demuxer
->video
->id
];
922 sh2
->ds
= mpctx
->demuxer
->video
;
923 mpctx
->sh_video
= sh2
;
924 reinit_video_chain(mpctx
);
927 mp_msg(MSGT_IDENTIFY
, MSGL_INFO
, "ID_VIDEO_TRACK=%d\n", opts
->video_id
);
928 return M_PROPERTY_OK
;
931 return M_PROPERTY_NOT_IMPLEMENTED
;
935 static int mp_property_program(m_option_t
*prop
, int action
, void *arg
,
938 demux_program_t prog
;
941 case M_PROPERTY_STEP_UP
:
943 if (action
== M_PROPERTY_SET
&& arg
)
944 prog
.progid
= *((int *) arg
);
948 (mpctx
->demuxer
, DEMUXER_CTRL_IDENTIFY_PROGRAM
,
949 &prog
) == DEMUXER_CTRL_NOTIMPL
)
950 return M_PROPERTY_ERROR
;
952 mp_property_do("switch_audio", M_PROPERTY_SET
, &prog
.aid
, mpctx
);
953 mp_property_do("switch_video", M_PROPERTY_SET
, &prog
.vid
, mpctx
);
954 return M_PROPERTY_OK
;
957 return M_PROPERTY_NOT_IMPLEMENTED
;
963 /// \defgroup VideoProperties Video properties
964 /// \ingroup Properties
967 /// Fullscreen state (RW)
968 static int mp_property_fullscreen(m_option_t
*prop
, int action
, void *arg
,
972 if (!mpctx
->video_out
)
973 return M_PROPERTY_UNAVAILABLE
;
978 return M_PROPERTY_ERROR
;
979 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
980 if (vo_fs
== !!*(int *) arg
)
981 return M_PROPERTY_OK
;
982 case M_PROPERTY_STEP_UP
:
983 case M_PROPERTY_STEP_DOWN
:
986 guiGetEvent(guiIEvent
, (char *) MP_CMD_GUI_FULLSCREEN
);
989 if (mpctx
->video_out
->config_ok
)
990 vo_control(mpctx
->video_out
, VOCTRL_FULLSCREEN
, 0);
991 return M_PROPERTY_OK
;
993 return m_property_flag(prop
, action
, arg
, &vo_fs
);
997 static int mp_property_deinterlace(m_option_t
*prop
, int action
,
998 void *arg
, MPContext
*mpctx
)
1002 if (!mpctx
->sh_video
|| !mpctx
->sh_video
->vfilter
)
1003 return M_PROPERTY_UNAVAILABLE
;
1004 vf
= mpctx
->sh_video
->vfilter
;
1006 case M_PROPERTY_GET
:
1008 return M_PROPERTY_ERROR
;
1009 vf
->control(vf
, VFCTRL_GET_DEINTERLACE
, arg
);
1010 return M_PROPERTY_OK
;
1011 case M_PROPERTY_SET
:
1013 return M_PROPERTY_ERROR
;
1014 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
1015 vf
->control(vf
, VFCTRL_SET_DEINTERLACE
, arg
);
1016 return M_PROPERTY_OK
;
1017 case M_PROPERTY_STEP_UP
:
1018 case M_PROPERTY_STEP_DOWN
:
1019 vf
->control(vf
, VFCTRL_GET_DEINTERLACE
, &deinterlace
);
1020 deinterlace
= !deinterlace
;
1021 vf
->control(vf
, VFCTRL_SET_DEINTERLACE
, &deinterlace
);
1022 return M_PROPERTY_OK
;
1024 return M_PROPERTY_NOT_IMPLEMENTED
;
1028 static int mp_property_panscan(m_option_t
*prop
, int action
, void *arg
,
1032 if (!mpctx
->video_out
1033 || vo_control(mpctx
->video_out
, VOCTRL_GET_PANSCAN
, NULL
) != VO_TRUE
)
1034 return M_PROPERTY_UNAVAILABLE
;
1037 case M_PROPERTY_SET
:
1039 return M_PROPERTY_ERROR
;
1040 M_PROPERTY_CLAMP(prop
, *(float *) arg
);
1041 vo_panscan
= *(float *) arg
;
1042 vo_control(mpctx
->video_out
, VOCTRL_SET_PANSCAN
, NULL
);
1043 return M_PROPERTY_OK
;
1044 case M_PROPERTY_STEP_UP
:
1045 case M_PROPERTY_STEP_DOWN
:
1046 vo_panscan
+= (arg
? *(float *) arg
: 0.1) *
1047 (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
1050 else if (vo_panscan
< 0)
1052 vo_control(mpctx
->video_out
, VOCTRL_SET_PANSCAN
, NULL
);
1053 return M_PROPERTY_OK
;
1055 return m_property_float_range(prop
, action
, arg
, &vo_panscan
);
1059 /// Helper to set vo flags.
1060 /** \ingroup PropertyImplHelper
1062 static int mp_property_vo_flag(m_option_t
*prop
, int action
, void *arg
,
1063 int vo_ctrl
, int *vo_var
, MPContext
*mpctx
)
1066 if (!mpctx
->video_out
)
1067 return M_PROPERTY_UNAVAILABLE
;
1070 case M_PROPERTY_SET
:
1072 return M_PROPERTY_ERROR
;
1073 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
1074 if (*vo_var
== !!*(int *) arg
)
1075 return M_PROPERTY_OK
;
1076 case M_PROPERTY_STEP_UP
:
1077 case M_PROPERTY_STEP_DOWN
:
1078 if (mpctx
->video_out
->config_ok
)
1079 vo_control(mpctx
->video_out
, vo_ctrl
, 0);
1080 return M_PROPERTY_OK
;
1082 return m_property_flag(prop
, action
, arg
, vo_var
);
1086 /// Window always on top (RW)
1087 static int mp_property_ontop(m_option_t
*prop
, int action
, void *arg
,
1090 return mp_property_vo_flag(prop
, action
, arg
, VOCTRL_ONTOP
,
1091 &mpctx
->opts
.vo_ontop
, mpctx
);
1094 /// Display in the root window (RW)
1095 static int mp_property_rootwin(m_option_t
*prop
, int action
, void *arg
,
1098 return mp_property_vo_flag(prop
, action
, arg
, VOCTRL_ROOTWIN
,
1099 &vo_rootwin
, mpctx
);
1102 /// Show window borders (RW)
1103 static int mp_property_border(m_option_t
*prop
, int action
, void *arg
,
1106 return mp_property_vo_flag(prop
, action
, arg
, VOCTRL_BORDER
,
1110 /// Framedropping state (RW)
1111 static int mp_property_framedropping(m_option_t
*prop
, int action
,
1112 void *arg
, MPContext
*mpctx
)
1115 if (!mpctx
->sh_video
)
1116 return M_PROPERTY_UNAVAILABLE
;
1119 case M_PROPERTY_PRINT
:
1121 return M_PROPERTY_ERROR
;
1122 *(char **) arg
= strdup(frame_dropping
== 1 ? MSGTR_Enabled
:
1123 (frame_dropping
== 2 ? MSGTR_HardFrameDrop
:
1125 return M_PROPERTY_OK
;
1127 return m_property_choice(prop
, action
, arg
, &frame_dropping
);
1131 /// Color settings, try to use vf/vo then fall back on TV. (RW)
1132 static int mp_property_gamma(m_option_t
*prop
, int action
, void *arg
,
1135 int *gamma
= (int *)((char *)&mpctx
->opts
+ (int)prop
->priv
);
1138 if (!mpctx
->sh_video
)
1139 return M_PROPERTY_UNAVAILABLE
;
1141 if (gamma
[0] == 1000) {
1143 get_video_colors(mpctx
->sh_video
, prop
->name
, gamma
);
1147 case M_PROPERTY_SET
:
1149 return M_PROPERTY_ERROR
;
1150 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
1151 *gamma
= *(int *) arg
;
1152 r
= set_video_colors(mpctx
->sh_video
, prop
->name
, *gamma
);
1156 case M_PROPERTY_GET
:
1157 if (get_video_colors(mpctx
->sh_video
, prop
->name
, &val
) > 0) {
1159 return M_PROPERTY_ERROR
;
1161 return M_PROPERTY_OK
;
1164 case M_PROPERTY_STEP_UP
:
1165 case M_PROPERTY_STEP_DOWN
:
1166 *gamma
+= (arg
? *(int *) arg
: 1) *
1167 (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
1168 M_PROPERTY_CLAMP(prop
, *gamma
);
1169 r
= set_video_colors(mpctx
->sh_video
, prop
->name
, *gamma
);
1174 return M_PROPERTY_NOT_IMPLEMENTED
;
1178 if (mpctx
->demuxer
->type
== DEMUXER_TYPE_TV
) {
1179 int l
= strlen(prop
->name
);
1180 char tv_prop
[3 + l
+ 1];
1181 sprintf(tv_prop
, "tv_%s", prop
->name
);
1182 return mp_property_do(tv_prop
, action
, arg
, mpctx
);
1186 return M_PROPERTY_UNAVAILABLE
;
1190 static int mp_property_vsync(m_option_t
*prop
, int action
, void *arg
,
1193 return m_property_flag(prop
, action
, arg
, &vo_vsync
);
1196 /// Video codec tag (RO)
1197 static int mp_property_video_format(m_option_t
*prop
, int action
,
1198 void *arg
, MPContext
*mpctx
)
1201 if (!mpctx
->sh_video
)
1202 return M_PROPERTY_UNAVAILABLE
;
1204 case M_PROPERTY_PRINT
:
1206 return M_PROPERTY_ERROR
;
1207 switch(mpctx
->sh_video
->format
) {
1209 meta
= strdup ("mpeg1"); break;
1211 meta
= strdup ("mpeg2"); break;
1213 meta
= strdup ("mpeg4"); break;
1215 meta
= strdup ("h264"); break;
1217 if(mpctx
->sh_video
->format
>= 0x20202020) {
1219 sprintf (meta
, "%.4s", (char *) &mpctx
->sh_video
->format
);
1222 sprintf (meta
, "0x%08X", mpctx
->sh_video
->format
);
1225 *(char**)arg
= meta
;
1226 return M_PROPERTY_OK
;
1228 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_video
->format
);
1231 /// Video codec name (RO)
1232 static int mp_property_video_codec(m_option_t
*prop
, int action
,
1233 void *arg
, MPContext
*mpctx
)
1235 if (!mpctx
->sh_video
|| !mpctx
->sh_video
->codec
)
1236 return M_PROPERTY_UNAVAILABLE
;
1237 return m_property_string_ro(prop
, action
, arg
, mpctx
->sh_video
->codec
->name
);
1241 /// Video bitrate (RO)
1242 static int mp_property_video_bitrate(m_option_t
*prop
, int action
,
1243 void *arg
, MPContext
*mpctx
)
1245 if (!mpctx
->sh_video
)
1246 return M_PROPERTY_UNAVAILABLE
;
1247 return m_property_bitrate(prop
, action
, arg
, mpctx
->sh_video
->i_bps
);
1250 /// Video display width (RO)
1251 static int mp_property_width(m_option_t
*prop
, int action
, void *arg
,
1254 if (!mpctx
->sh_video
)
1255 return M_PROPERTY_UNAVAILABLE
;
1256 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_video
->disp_w
);
1259 /// Video display height (RO)
1260 static int mp_property_height(m_option_t
*prop
, int action
, void *arg
,
1263 if (!mpctx
->sh_video
)
1264 return M_PROPERTY_UNAVAILABLE
;
1265 return m_property_int_ro(prop
, action
, arg
, mpctx
->sh_video
->disp_h
);
1269 static int mp_property_fps(m_option_t
*prop
, int action
, void *arg
,
1272 if (!mpctx
->sh_video
)
1273 return M_PROPERTY_UNAVAILABLE
;
1274 return m_property_float_ro(prop
, action
, arg
, mpctx
->sh_video
->fps
);
1277 /// Video aspect (RO)
1278 static int mp_property_aspect(m_option_t
*prop
, int action
, void *arg
,
1281 if (!mpctx
->sh_video
)
1282 return M_PROPERTY_UNAVAILABLE
;
1283 return m_property_float_ro(prop
, action
, arg
, mpctx
->sh_video
->aspect
);
1288 /// \defgroup SubProprties Subtitles properties
1289 /// \ingroup Properties
1292 /// Text subtitle position (RW)
1293 static int mp_property_sub_pos(m_option_t
*prop
, int action
, void *arg
,
1296 if (!mpctx
->sh_video
)
1297 return M_PROPERTY_UNAVAILABLE
;
1300 case M_PROPERTY_SET
:
1302 return M_PROPERTY_ERROR
;
1303 case M_PROPERTY_STEP_UP
:
1304 case M_PROPERTY_STEP_DOWN
:
1305 vo_osd_changed(OSDTYPE_SUBTITLE
);
1307 return m_property_int_range(prop
, action
, arg
, &sub_pos
);
1311 /// Selected subtitles (RW)
1312 static int mp_property_sub(m_option_t
*prop
, int action
, void *arg
,
1315 struct MPOpts
*opts
= &mpctx
->opts
;
1316 demux_stream_t
*const d_sub
= mpctx
->d_sub
;
1317 const int global_sub_size
= mpctx
->global_sub_size
;
1318 int source
= -1, reset_spu
= 0;
1321 if (global_sub_size
<= 0)
1322 return M_PROPERTY_UNAVAILABLE
;
1325 case M_PROPERTY_GET
:
1327 return M_PROPERTY_ERROR
;
1328 *(int *) arg
= mpctx
->global_sub_pos
;
1329 return M_PROPERTY_OK
;
1330 case M_PROPERTY_PRINT
:
1332 return M_PROPERTY_ERROR
;
1333 *(char **) arg
= malloc(64);
1334 (*(char **) arg
)[63] = 0;
1337 sub_name
= subdata
->filename
;
1339 if (ass_track
&& ass_track
->name
)
1340 sub_name
= ass_track
->name
;
1345 if ((tmp2
= strrchr(tmp
, '/')))
1348 snprintf(*(char **) arg
, 63, "(%d) %s%s",
1349 mpctx
->set_of_sub_pos
+ 1,
1350 strlen(tmp
) < 20 ? "" : "...",
1351 strlen(tmp
) < 20 ? tmp
: tmp
+ strlen(tmp
) - 19);
1352 return M_PROPERTY_OK
;
1354 #ifdef CONFIG_DVDNAV
1355 if (mpctx
->stream
->type
== STREAMTYPE_DVDNAV
) {
1356 if (vo_spudec
&& opts
->sub_id
>= 0) {
1357 unsigned char lang
[3];
1358 if (mp_dvdnav_lang_from_sid(mpctx
->stream
, opts
->sub_id
, lang
)) {
1359 snprintf(*(char **) arg
, 63, "(%d) %s", opts
->sub_id
, lang
);
1360 return M_PROPERTY_OK
;
1366 if ((mpctx
->demuxer
->type
== DEMUXER_TYPE_MATROSKA
1367 || mpctx
->demuxer
->type
== DEMUXER_TYPE_LAVF
1368 || mpctx
->demuxer
->type
== DEMUXER_TYPE_OGG
)
1369 && d_sub
&& d_sub
->sh
&& opts
->sub_id
>= 0) {
1370 const char* lang
= ((sh_sub_t
*)d_sub
->sh
)->lang
;
1371 if (!lang
) lang
= MSGTR_Unknown
;
1372 snprintf(*(char **) arg
, 63, "(%d) %s", opts
->sub_id
, lang
);
1373 return M_PROPERTY_OK
;
1376 if (vo_vobsub
&& vobsub_id
>= 0) {
1377 const char *language
= MSGTR_Unknown
;
1378 language
= vobsub_get_id(vo_vobsub
, (unsigned int) vobsub_id
);
1379 snprintf(*(char **) arg
, 63, "(%d) %s",
1380 vobsub_id
, language
? language
: MSGTR_Unknown
);
1381 return M_PROPERTY_OK
;
1383 #ifdef CONFIG_DVDREAD
1384 if (vo_spudec
&& mpctx
->stream
->type
== STREAMTYPE_DVD
1385 && opts
->sub_id
>= 0) {
1387 int code
= dvd_lang_from_sid(mpctx
->stream
, opts
->sub_id
);
1388 lang
[0] = code
>> 8;
1391 snprintf(*(char **) arg
, 63, "(%d) %s", opts
->sub_id
, lang
);
1392 return M_PROPERTY_OK
;
1395 if (opts
->sub_id
>= 0) {
1396 snprintf(*(char **) arg
, 63, "(%d) %s", opts
->sub_id
, MSGTR_Unknown
);
1397 return M_PROPERTY_OK
;
1399 snprintf(*(char **) arg
, 63, MSGTR_Disabled
);
1400 return M_PROPERTY_OK
;
1402 case M_PROPERTY_SET
:
1404 return M_PROPERTY_ERROR
;
1405 if (*(int *) arg
< -1)
1407 else if (*(int *) arg
>= global_sub_size
)
1408 *(int *) arg
= global_sub_size
- 1;
1409 mpctx
->global_sub_pos
= *(int *) arg
;
1411 case M_PROPERTY_STEP_UP
:
1412 mpctx
->global_sub_pos
+= 2;
1413 mpctx
->global_sub_pos
=
1414 (mpctx
->global_sub_pos
% (global_sub_size
+ 1)) - 1;
1416 case M_PROPERTY_STEP_DOWN
:
1417 mpctx
->global_sub_pos
+= global_sub_size
+ 1;
1418 mpctx
->global_sub_pos
=
1419 (mpctx
->global_sub_pos
% (global_sub_size
+ 1)) - 1;
1422 return M_PROPERTY_NOT_IMPLEMENTED
;
1425 if (mpctx
->global_sub_pos
>= 0)
1426 source
= sub_source(mpctx
);
1428 mp_msg(MSGT_CPLAYER
, MSGL_DBG3
,
1429 "subtitles: %d subs, (v@%d s@%d d@%d), @%d, source @%d\n",
1431 mpctx
->global_sub_indices
[SUB_SOURCE_VOBSUB
],
1432 mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
],
1433 mpctx
->global_sub_indices
[SUB_SOURCE_DEMUX
],
1434 mpctx
->global_sub_pos
, source
);
1436 mpctx
->set_of_sub_pos
= -1;
1450 if (source
== SUB_SOURCE_VOBSUB
) {
1451 vobsub_id
= vobsub_get_id_by_index(vo_vobsub
, mpctx
->global_sub_pos
- mpctx
->global_sub_indices
[SUB_SOURCE_VOBSUB
]);
1452 } else if (source
== SUB_SOURCE_SUBS
) {
1453 mpctx
->set_of_sub_pos
=
1454 mpctx
->global_sub_pos
- mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
];
1456 if (ass_enabled
&& mpctx
->set_of_ass_tracks
[mpctx
->set_of_sub_pos
])
1457 ass_track
= mpctx
->set_of_ass_tracks
[mpctx
->set_of_sub_pos
];
1461 subdata
= mpctx
->set_of_subtitles
[mpctx
->set_of_sub_pos
];
1462 vo_osd_changed(OSDTYPE_SUBTITLE
);
1464 } else if (source
== SUB_SOURCE_DEMUX
) {
1466 mpctx
->global_sub_pos
- mpctx
->global_sub_indices
[SUB_SOURCE_DEMUX
];
1467 if (d_sub
&& opts
->sub_id
< MAX_S_STREAMS
) {
1469 // default: assume 1:1 mapping of sid and stream id
1470 d_sub
->id
= opts
->sub_id
;
1471 d_sub
->sh
= mpctx
->demuxer
->s_streams
[d_sub
->id
];
1472 ds_free_packs(d_sub
);
1473 for (i
= 0; i
< MAX_S_STREAMS
; i
++) {
1474 sh_sub_t
*sh
= mpctx
->demuxer
->s_streams
[i
];
1475 if (sh
&& sh
->sid
== opts
->sub_id
) {
1481 if (d_sub
->sh
&& d_sub
->id
>= 0) {
1482 sh_sub_t
*sh
= d_sub
->sh
;
1483 if (sh
->type
== 'v')
1484 init_vo_spudec(mpctx
);
1486 else if (ass_enabled
)
1487 ass_track
= sh
->ass_track
;
1495 #ifdef CONFIG_DVDREAD
1497 && (mpctx
->stream
->type
== STREAMTYPE_DVD
1498 || mpctx
->stream
->type
== STREAMTYPE_DVDNAV
)
1499 && opts
->sub_id
< 0 && reset_spu
) {
1501 d_sub
->id
= opts
->sub_id
;
1504 update_subtitles(mpctx
->sh_video
, d_sub
, 1);
1506 return M_PROPERTY_OK
;
1509 /// Selected sub source (RW)
1510 static int mp_property_sub_source(m_option_t
*prop
, int action
, void *arg
,
1514 if (!mpctx
->sh_video
|| mpctx
->global_sub_size
<= 0)
1515 return M_PROPERTY_UNAVAILABLE
;
1518 case M_PROPERTY_GET
:
1520 return M_PROPERTY_ERROR
;
1521 *(int *) arg
= sub_source(mpctx
);
1522 return M_PROPERTY_OK
;
1523 case M_PROPERTY_PRINT
:
1525 return M_PROPERTY_ERROR
;
1526 *(char **) arg
= malloc(64);
1527 (*(char **) arg
)[63] = 0;
1528 switch (sub_source(mpctx
))
1530 case SUB_SOURCE_SUBS
:
1531 snprintf(*(char **) arg
, 63, MSGTR_SubSourceFile
);
1533 case SUB_SOURCE_VOBSUB
:
1534 snprintf(*(char **) arg
, 63, MSGTR_SubSourceVobsub
);
1536 case SUB_SOURCE_DEMUX
:
1537 snprintf(*(char **) arg
, 63, MSGTR_SubSourceDemux
);
1540 snprintf(*(char **) arg
, 63, MSGTR_Disabled
);
1542 return M_PROPERTY_OK
;
1543 case M_PROPERTY_SET
:
1545 return M_PROPERTY_ERROR
;
1546 M_PROPERTY_CLAMP(prop
, *(int*)arg
);
1547 if (*(int *) arg
< 0)
1548 mpctx
->global_sub_pos
= -1;
1549 else if (*(int *) arg
!= sub_source(mpctx
)) {
1550 if (*(int *) arg
!= sub_source_by_pos(mpctx
, mpctx
->global_sub_indices
[*(int *) arg
]))
1551 return M_PROPERTY_UNAVAILABLE
;
1552 mpctx
->global_sub_pos
= mpctx
->global_sub_indices
[*(int *) arg
];
1555 case M_PROPERTY_STEP_UP
:
1556 case M_PROPERTY_STEP_DOWN
: {
1557 int step_all
= (arg
&& *(int*)arg
!= 0 ? *(int*)arg
: 1)
1558 * (action
== M_PROPERTY_STEP_UP
? 1 : -1);
1559 int step
= (step_all
> 0) ? 1 : -1;
1560 int cur_source
= sub_source(mpctx
);
1561 source
= cur_source
;
1564 if (source
>= SUB_SOURCES
)
1566 else if (source
< -1)
1567 source
= SUB_SOURCES
- 1;
1568 if (source
== cur_source
|| source
== -1 ||
1569 source
== sub_source_by_pos(mpctx
, mpctx
->global_sub_indices
[source
]))
1572 if (source
== cur_source
)
1573 return M_PROPERTY_OK
;
1575 mpctx
->global_sub_pos
= -1;
1577 mpctx
->global_sub_pos
= mpctx
->global_sub_indices
[source
];
1581 return M_PROPERTY_NOT_IMPLEMENTED
;
1583 --mpctx
->global_sub_pos
;
1584 return mp_property_sub(prop
, M_PROPERTY_STEP_UP
, NULL
, mpctx
);
1587 /// Selected subtitles from specific source (RW)
1588 static int mp_property_sub_by_type(m_option_t
*prop
, int action
, void *arg
,
1591 int source
, is_cur_source
, offset
;
1592 if (!mpctx
->sh_video
|| mpctx
->global_sub_size
<= 0)
1593 return M_PROPERTY_UNAVAILABLE
;
1595 if (!strcmp(prop
->name
, "sub_file"))
1596 source
= SUB_SOURCE_SUBS
;
1597 else if (!strcmp(prop
->name
, "sub_vob"))
1598 source
= SUB_SOURCE_VOBSUB
;
1599 else if (!strcmp(prop
->name
, "sub_demux"))
1600 source
= SUB_SOURCE_DEMUX
;
1602 return M_PROPERTY_ERROR
;
1604 offset
= mpctx
->global_sub_indices
[source
];
1605 if (offset
< 0 || source
!= sub_source_by_pos(mpctx
, offset
))
1606 return M_PROPERTY_UNAVAILABLE
;
1608 is_cur_source
= sub_source(mpctx
) == source
;
1610 case M_PROPERTY_GET
:
1612 return M_PROPERTY_ERROR
;
1613 if (is_cur_source
) {
1614 *(int *) arg
= mpctx
->global_sub_pos
- offset
;
1615 if (source
== SUB_SOURCE_VOBSUB
)
1616 *(int *) arg
= vobsub_get_id_by_index(vo_vobsub
, *(int *) arg
);
1620 return M_PROPERTY_OK
;
1621 case M_PROPERTY_PRINT
:
1623 return M_PROPERTY_ERROR
;
1625 return mp_property_sub(prop
, M_PROPERTY_PRINT
, arg
, mpctx
);
1626 *(char **) arg
= malloc(64);
1627 (*(char **) arg
)[63] = 0;
1628 snprintf(*(char **) arg
, 63, MSGTR_Disabled
);
1629 return M_PROPERTY_OK
;
1630 case M_PROPERTY_SET
:
1632 return M_PROPERTY_ERROR
;
1633 if (*(int *) arg
>= 0) {
1634 int index
= *(int *)arg
;
1635 if (source
== SUB_SOURCE_VOBSUB
)
1636 index
= vobsub_get_index_by_id(vo_vobsub
, index
);
1637 mpctx
->global_sub_pos
= offset
+ index
;
1638 if (index
< 0 || mpctx
->global_sub_pos
>= mpctx
->global_sub_size
1639 || sub_source(mpctx
) != source
) {
1640 mpctx
->global_sub_pos
= -1;
1645 mpctx
->global_sub_pos
= -1;
1647 case M_PROPERTY_STEP_UP
:
1648 case M_PROPERTY_STEP_DOWN
: {
1649 int step_all
= (arg
&& *(int*)arg
!= 0 ? *(int*)arg
: 1)
1650 * (action
== M_PROPERTY_STEP_UP
? 1 : -1);
1651 int step
= (step_all
> 0) ? 1 : -1;
1652 int max_sub_pos_for_source
= -1;
1654 mpctx
->global_sub_pos
= -1;
1656 if (mpctx
->global_sub_pos
== -1) {
1658 mpctx
->global_sub_pos
= offset
;
1659 else if (max_sub_pos_for_source
== -1) {
1660 // Find max pos for specific source
1661 mpctx
->global_sub_pos
= mpctx
->global_sub_size
- 1;
1662 while (mpctx
->global_sub_pos
>= 0
1663 && sub_source(mpctx
) != source
)
1664 --mpctx
->global_sub_pos
;
1667 mpctx
->global_sub_pos
= max_sub_pos_for_source
;
1670 mpctx
->global_sub_pos
+= step
;
1671 if (mpctx
->global_sub_pos
< offset
||
1672 mpctx
->global_sub_pos
>= mpctx
->global_sub_size
||
1673 sub_source(mpctx
) != source
)
1674 mpctx
->global_sub_pos
= -1;
1681 return M_PROPERTY_NOT_IMPLEMENTED
;
1683 --mpctx
->global_sub_pos
;
1684 return mp_property_sub(prop
, M_PROPERTY_STEP_UP
, NULL
, mpctx
);
1687 /// Subtitle delay (RW)
1688 static int mp_property_sub_delay(m_option_t
*prop
, int action
, void *arg
,
1691 if (!mpctx
->sh_video
)
1692 return M_PROPERTY_UNAVAILABLE
;
1693 return m_property_delay(prop
, action
, arg
, &sub_delay
);
1696 /// Alignment of text subtitles (RW)
1697 static int mp_property_sub_alignment(m_option_t
*prop
, int action
,
1698 void *arg
, MPContext
*mpctx
)
1700 char *name
[] = { MSGTR_Top
, MSGTR_Center
, MSGTR_Bottom
};
1702 if (!mpctx
->sh_video
|| mpctx
->global_sub_pos
< 0
1703 || sub_source(mpctx
) != SUB_SOURCE_SUBS
)
1704 return M_PROPERTY_UNAVAILABLE
;
1707 case M_PROPERTY_PRINT
:
1709 return M_PROPERTY_ERROR
;
1710 M_PROPERTY_CLAMP(prop
, sub_alignment
);
1711 *(char **) arg
= strdup(name
[sub_alignment
]);
1712 return M_PROPERTY_OK
;
1713 case M_PROPERTY_SET
:
1715 return M_PROPERTY_ERROR
;
1716 case M_PROPERTY_STEP_UP
:
1717 case M_PROPERTY_STEP_DOWN
:
1718 vo_osd_changed(OSDTYPE_SUBTITLE
);
1720 return m_property_choice(prop
, action
, arg
, &sub_alignment
);
1724 /// Subtitle visibility (RW)
1725 static int mp_property_sub_visibility(m_option_t
*prop
, int action
,
1726 void *arg
, MPContext
*mpctx
)
1728 if (!mpctx
->sh_video
)
1729 return M_PROPERTY_UNAVAILABLE
;
1732 case M_PROPERTY_SET
:
1734 return M_PROPERTY_ERROR
;
1735 case M_PROPERTY_STEP_UP
:
1736 case M_PROPERTY_STEP_DOWN
:
1737 vo_osd_changed(OSDTYPE_SUBTITLE
);
1739 vo_osd_changed(OSDTYPE_SPU
);
1741 return m_property_flag(prop
, action
, arg
, &sub_visibility
);
1746 /// Use margins for libass subtitles (RW)
1747 static int mp_property_ass_use_margins(m_option_t
*prop
, int action
,
1748 void *arg
, MPContext
*mpctx
)
1750 if (!mpctx
->sh_video
)
1751 return M_PROPERTY_UNAVAILABLE
;
1754 case M_PROPERTY_SET
:
1756 return M_PROPERTY_ERROR
;
1757 case M_PROPERTY_STEP_UP
:
1758 case M_PROPERTY_STEP_DOWN
:
1759 ass_force_reload
= 1;
1761 return m_property_flag(prop
, action
, arg
, &ass_use_margins
);
1766 /// Show only forced subtitles (RW)
1767 static int mp_property_sub_forced_only(m_option_t
*prop
, int action
,
1768 void *arg
, MPContext
*mpctx
)
1771 return M_PROPERTY_UNAVAILABLE
;
1774 case M_PROPERTY_SET
:
1776 return M_PROPERTY_ERROR
;
1777 case M_PROPERTY_STEP_UP
:
1778 case M_PROPERTY_STEP_DOWN
:
1779 m_property_flag(prop
, action
, arg
, &forced_subs_only
);
1780 spudec_set_forced_subs_only(vo_spudec
, forced_subs_only
);
1781 return M_PROPERTY_OK
;
1783 return m_property_flag(prop
, action
, arg
, &forced_subs_only
);
1788 #ifdef CONFIG_FREETYPE
1789 /// Subtitle scale (RW)
1790 static int mp_property_sub_scale(m_option_t
*prop
, int action
, void *arg
,
1795 case M_PROPERTY_SET
:
1797 return M_PROPERTY_ERROR
;
1798 M_PROPERTY_CLAMP(prop
, *(float *) arg
);
1801 ass_font_scale
= *(float *) arg
;
1802 ass_force_reload
= 1;
1805 text_font_scale_factor
= *(float *) arg
;
1806 force_load_font
= 1;
1807 return M_PROPERTY_OK
;
1808 case M_PROPERTY_STEP_UP
:
1809 case M_PROPERTY_STEP_DOWN
:
1812 ass_font_scale
+= (arg
? *(float *) arg
: 0.1)*
1813 (action
== M_PROPERTY_STEP_UP
? 1.0 : -1.0);
1814 M_PROPERTY_CLAMP(prop
, ass_font_scale
);
1815 ass_force_reload
= 1;
1818 text_font_scale_factor
+= (arg
? *(float *) arg
: 0.1)*
1819 (action
== M_PROPERTY_STEP_UP
? 1.0 : -1.0);
1820 M_PROPERTY_CLAMP(prop
, text_font_scale_factor
);
1821 force_load_font
= 1;
1822 return M_PROPERTY_OK
;
1826 return m_property_float_ro(prop
, action
, arg
, ass_font_scale
);
1829 return m_property_float_ro(prop
, action
, arg
, text_font_scale_factor
);
1836 /// \defgroup TVProperties TV properties
1837 /// \ingroup Properties
1842 /// TV color settings (RW)
1843 static int mp_property_tv_color(m_option_t
*prop
, int action
, void *arg
,
1847 tvi_handle_t
*tvh
= mpctx
->demuxer
->priv
;
1848 if (mpctx
->demuxer
->type
!= DEMUXER_TYPE_TV
|| !tvh
)
1849 return M_PROPERTY_UNAVAILABLE
;
1852 case M_PROPERTY_SET
:
1854 return M_PROPERTY_ERROR
;
1855 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
1856 return tv_set_color_options(tvh
, (int) prop
->priv
, *(int *) arg
);
1857 case M_PROPERTY_GET
:
1858 return tv_get_color_options(tvh
, (int) prop
->priv
, arg
);
1859 case M_PROPERTY_STEP_UP
:
1860 case M_PROPERTY_STEP_DOWN
:
1861 if ((r
= tv_get_color_options(tvh
, (int) prop
->priv
, &val
)) >= 0) {
1863 return M_PROPERTY_ERROR
;
1864 val
+= (arg
? *(int *) arg
: 1) *
1865 (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
1866 M_PROPERTY_CLAMP(prop
, val
);
1867 return tv_set_color_options(tvh
, (int) prop
->priv
, val
);
1869 return M_PROPERTY_ERROR
;
1871 return M_PROPERTY_NOT_IMPLEMENTED
;
1876 #ifdef CONFIG_TV_TELETEXT
1877 static int mp_property_teletext_common(m_option_t
*prop
, int action
, void *arg
,
1881 int base_ioctl
=(int)prop
->priv
;
1883 for teletext's GET,SET,STEP ioctls this is not 0
1887 tvi_handle_t
*tvh
= mpctx
->demuxer
->priv
;
1888 if (mpctx
->demuxer
->type
!= DEMUXER_TYPE_TV
|| !tvh
)
1889 return M_PROPERTY_UNAVAILABLE
;
1891 return M_PROPERTY_ERROR
;
1894 case M_PROPERTY_GET
:
1896 return M_PROPERTY_ERROR
;
1897 result
=tvh
->functions
->control(tvh
->priv
, base_ioctl
, arg
);
1899 case M_PROPERTY_SET
:
1901 return M_PROPERTY_ERROR
;
1902 M_PROPERTY_CLAMP(prop
, *(int *) arg
);
1903 result
=tvh
->functions
->control(tvh
->priv
, base_ioctl
+1, arg
);
1905 case M_PROPERTY_STEP_UP
:
1906 case M_PROPERTY_STEP_DOWN
:
1907 result
=tvh
->functions
->control(tvh
->priv
, base_ioctl
, &val
);
1908 val
+= (arg
? *(int *) arg
: 1) * (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
1909 result
=tvh
->functions
->control(tvh
->priv
, base_ioctl
+1, &val
);
1912 return M_PROPERTY_NOT_IMPLEMENTED
;
1915 return result
== TVI_CONTROL_TRUE
? M_PROPERTY_OK
: M_PROPERTY_ERROR
;
1918 static int mp_property_teletext_mode(m_option_t
*prop
, int action
, void *arg
,
1921 tvi_handle_t
*tvh
= mpctx
->demuxer
->priv
;
1925 //with tvh==NULL will fail too
1926 result
=mp_property_teletext_common(prop
,action
,arg
,mpctx
);
1927 if(result
!=M_PROPERTY_OK
)
1930 if(tvh
->functions
->control(tvh
->priv
, prop
->priv
, &val
)==TVI_CONTROL_TRUE
&& val
)
1931 mp_input_set_section(mpctx
->input
, "teletext");
1933 mp_input_set_section(mpctx
->input
, "tv");
1934 return M_PROPERTY_OK
;
1937 static int mp_property_teletext_page(m_option_t
*prop
, int action
, void *arg
,
1940 tvi_handle_t
*tvh
= mpctx
->demuxer
->priv
;
1944 case M_PROPERTY_STEP_UP
:
1945 case M_PROPERTY_STEP_DOWN
:
1946 //This should be handled separately
1947 val
= (arg
? *(int *) arg
: 1) * (action
== M_PROPERTY_STEP_DOWN
? -1 : 1);
1948 result
=tvh
->functions
->control(tvh
->priv
, TV_VBI_CONTROL_STEP_PAGE
, &val
);
1951 result
=mp_property_teletext_common(prop
,action
,arg
,mpctx
);
1957 #endif /* CONFIG_TV_TELETEXT */
1961 /// All properties available in MPlayer.
1962 /** \ingroup Properties
1964 static const m_option_t mp_properties
[] = {
1966 { "osdlevel", mp_property_osdlevel
, CONF_TYPE_INT
,
1967 M_OPT_RANGE
, 0, 3, NULL
},
1968 { "loop", mp_property_loop
, CONF_TYPE_INT
,
1969 M_OPT_MIN
, -1, 0, NULL
},
1970 { "speed", mp_property_playback_speed
, CONF_TYPE_FLOAT
,
1971 M_OPT_RANGE
, 0.01, 100.0, NULL
},
1972 { "filename", mp_property_filename
, CONF_TYPE_STRING
,
1974 { "path", mp_property_path
, CONF_TYPE_STRING
,
1976 { "demuxer", mp_property_demuxer
, CONF_TYPE_STRING
,
1978 { "stream_pos", mp_property_stream_pos
, CONF_TYPE_POSITION
,
1979 M_OPT_MIN
, 0, 0, NULL
},
1980 { "stream_start", mp_property_stream_start
, CONF_TYPE_POSITION
,
1981 M_OPT_MIN
, 0, 0, NULL
},
1982 { "stream_end", mp_property_stream_end
, CONF_TYPE_POSITION
,
1983 M_OPT_MIN
, 0, 0, NULL
},
1984 { "stream_length", mp_property_stream_length
, CONF_TYPE_POSITION
,
1985 M_OPT_MIN
, 0, 0, NULL
},
1986 { "length", mp_property_length
, CONF_TYPE_TIME
,
1987 M_OPT_MIN
, 0, 0, NULL
},
1988 { "percent_pos", mp_property_percent_pos
, CONF_TYPE_INT
,
1989 M_OPT_RANGE
, 0, 100, NULL
},
1990 { "time_pos", mp_property_time_pos
, CONF_TYPE_TIME
,
1991 M_OPT_MIN
, 0, 0, NULL
},
1992 { "chapter", mp_property_chapter
, CONF_TYPE_INT
,
1993 M_OPT_MIN
, 1, 0, NULL
},
1994 { "angle", mp_property_angle
, CONF_TYPE_INT
,
1995 CONF_RANGE
, -2, 10, NULL
},
1996 { "metadata", mp_property_metadata
, CONF_TYPE_STRING_LIST
,
2000 { "volume", mp_property_volume
, CONF_TYPE_FLOAT
,
2001 M_OPT_RANGE
, 0, 100, NULL
},
2002 { "mute", mp_property_mute
, CONF_TYPE_FLAG
,
2003 M_OPT_RANGE
, 0, 1, NULL
},
2004 { "audio_delay", mp_property_audio_delay
, CONF_TYPE_FLOAT
,
2005 M_OPT_RANGE
, -100, 100, NULL
},
2006 { "audio_format", mp_property_audio_format
, CONF_TYPE_INT
,
2008 { "audio_codec", mp_property_audio_codec
, CONF_TYPE_STRING
,
2010 { "audio_bitrate", mp_property_audio_bitrate
, CONF_TYPE_INT
,
2012 { "samplerate", mp_property_samplerate
, CONF_TYPE_INT
,
2014 { "channels", mp_property_channels
, CONF_TYPE_INT
,
2016 { "switch_audio", mp_property_audio
, CONF_TYPE_INT
,
2017 CONF_RANGE
, -2, MAX_A_STREAMS
- 1, NULL
},
2018 { "balance", mp_property_balance
, CONF_TYPE_FLOAT
,
2019 M_OPT_RANGE
, -1, 1, NULL
},
2022 { "fullscreen", mp_property_fullscreen
, CONF_TYPE_FLAG
,
2023 M_OPT_RANGE
, 0, 1, NULL
},
2024 { "deinterlace", mp_property_deinterlace
, CONF_TYPE_FLAG
,
2025 M_OPT_RANGE
, 0, 1, NULL
},
2026 { "ontop", mp_property_ontop
, CONF_TYPE_FLAG
,
2027 M_OPT_RANGE
, 0, 1, NULL
},
2028 { "rootwin", mp_property_rootwin
, CONF_TYPE_FLAG
,
2029 M_OPT_RANGE
, 0, 1, NULL
},
2030 { "border", mp_property_border
, CONF_TYPE_FLAG
,
2031 M_OPT_RANGE
, 0, 1, NULL
},
2032 { "framedropping", mp_property_framedropping
, CONF_TYPE_INT
,
2033 M_OPT_RANGE
, 0, 2, NULL
},
2034 { "gamma", mp_property_gamma
, CONF_TYPE_INT
,
2035 M_OPT_RANGE
, -100, 100, (void *)offsetof(struct MPOpts
, vo_gamma_gamma
)},
2036 { "brightness", mp_property_gamma
, CONF_TYPE_INT
,
2037 M_OPT_RANGE
, -100, 100, (void *)offsetof(struct MPOpts
, vo_gamma_brightness
) },
2038 { "contrast", mp_property_gamma
, CONF_TYPE_INT
,
2039 M_OPT_RANGE
, -100, 100, (void *)offsetof(struct MPOpts
, vo_gamma_contrast
) },
2040 { "saturation", mp_property_gamma
, CONF_TYPE_INT
,
2041 M_OPT_RANGE
, -100, 100, (void *)offsetof(struct MPOpts
, vo_gamma_saturation
) },
2042 { "hue", mp_property_gamma
, CONF_TYPE_INT
,
2043 M_OPT_RANGE
, -100, 100, (void *)offsetof(struct MPOpts
, vo_gamma_hue
) },
2044 { "panscan", mp_property_panscan
, CONF_TYPE_FLOAT
,
2045 M_OPT_RANGE
, 0, 1, NULL
},
2046 { "vsync", mp_property_vsync
, CONF_TYPE_FLAG
,
2047 M_OPT_RANGE
, 0, 1, NULL
},
2048 { "video_format", mp_property_video_format
, CONF_TYPE_INT
,
2050 { "video_codec", mp_property_video_codec
, CONF_TYPE_STRING
,
2052 { "video_bitrate", mp_property_video_bitrate
, CONF_TYPE_INT
,
2054 { "width", mp_property_width
, CONF_TYPE_INT
,
2056 { "height", mp_property_height
, CONF_TYPE_INT
,
2058 { "fps", mp_property_fps
, CONF_TYPE_FLOAT
,
2060 { "aspect", mp_property_aspect
, CONF_TYPE_FLOAT
,
2062 { "switch_video", mp_property_video
, CONF_TYPE_INT
,
2063 CONF_RANGE
, -2, MAX_V_STREAMS
- 1, NULL
},
2064 { "switch_program", mp_property_program
, CONF_TYPE_INT
,
2065 CONF_RANGE
, -1, 65535, NULL
},
2068 { "sub", mp_property_sub
, CONF_TYPE_INT
,
2069 M_OPT_MIN
, -1, 0, NULL
},
2070 { "sub_source", mp_property_sub_source
, CONF_TYPE_INT
,
2071 M_OPT_RANGE
, -1, SUB_SOURCES
- 1, NULL
},
2072 { "sub_vob", mp_property_sub_by_type
, CONF_TYPE_INT
,
2073 M_OPT_MIN
, -1, 0, NULL
},
2074 { "sub_demux", mp_property_sub_by_type
, CONF_TYPE_INT
,
2075 M_OPT_MIN
, -1, 0, NULL
},
2076 { "sub_file", mp_property_sub_by_type
, CONF_TYPE_INT
,
2077 M_OPT_MIN
, -1, 0, NULL
},
2078 { "sub_delay", mp_property_sub_delay
, CONF_TYPE_FLOAT
,
2080 { "sub_pos", mp_property_sub_pos
, CONF_TYPE_INT
,
2081 M_OPT_RANGE
, 0, 100, NULL
},
2082 { "sub_alignment", mp_property_sub_alignment
, CONF_TYPE_INT
,
2083 M_OPT_RANGE
, 0, 2, NULL
},
2084 { "sub_visibility", mp_property_sub_visibility
, CONF_TYPE_FLAG
,
2085 M_OPT_RANGE
, 0, 1, NULL
},
2086 { "sub_forced_only", mp_property_sub_forced_only
, CONF_TYPE_FLAG
,
2087 M_OPT_RANGE
, 0, 1, NULL
},
2088 #ifdef CONFIG_FREETYPE
2089 { "sub_scale", mp_property_sub_scale
, CONF_TYPE_FLOAT
,
2090 M_OPT_RANGE
, 0, 100, NULL
},
2093 { "ass_use_margins", mp_property_ass_use_margins
, CONF_TYPE_FLAG
,
2094 M_OPT_RANGE
, 0, 1, NULL
},
2098 { "tv_brightness", mp_property_tv_color
, CONF_TYPE_INT
,
2099 M_OPT_RANGE
, -100, 100, (void *) TV_COLOR_BRIGHTNESS
},
2100 { "tv_contrast", mp_property_tv_color
, CONF_TYPE_INT
,
2101 M_OPT_RANGE
, -100, 100, (void *) TV_COLOR_CONTRAST
},
2102 { "tv_saturation", mp_property_tv_color
, CONF_TYPE_INT
,
2103 M_OPT_RANGE
, -100, 100, (void *) TV_COLOR_SATURATION
},
2104 { "tv_hue", mp_property_tv_color
, CONF_TYPE_INT
,
2105 M_OPT_RANGE
, -100, 100, (void *) TV_COLOR_HUE
},
2108 #ifdef CONFIG_TV_TELETEXT
2109 { "teletext_page", mp_property_teletext_page
, CONF_TYPE_INT
,
2110 M_OPT_RANGE
, 100, 899, (void*)TV_VBI_CONTROL_GET_PAGE
},
2111 { "teletext_subpage", mp_property_teletext_common
, CONF_TYPE_INT
,
2112 M_OPT_RANGE
, 0, 64, (void*)TV_VBI_CONTROL_GET_SUBPAGE
},
2113 { "teletext_mode", mp_property_teletext_mode
, CONF_TYPE_FLAG
,
2114 M_OPT_RANGE
, 0, 1, (void*)TV_VBI_CONTROL_GET_MODE
},
2115 { "teletext_format", mp_property_teletext_common
, CONF_TYPE_INT
,
2116 M_OPT_RANGE
, 0, 3, (void*)TV_VBI_CONTROL_GET_FORMAT
},
2117 { "teletext_half_page", mp_property_teletext_common
, CONF_TYPE_INT
,
2118 M_OPT_RANGE
, 0, 2, (void*)TV_VBI_CONTROL_GET_HALF_PAGE
},
2121 { NULL
, NULL
, NULL
, 0, 0, 0, NULL
}
2125 int mp_property_do(const char *name
, int action
, void *val
, void *ctx
)
2127 return m_property_do(mp_properties
, name
, action
, val
, ctx
);
2130 char* mp_property_print(const char *name
, void* ctx
)
2133 if(mp_property_do(name
,M_PROPERTY_PRINT
,&ret
,ctx
) <= 0)
2138 char *property_expand_string(MPContext
*mpctx
, char *str
)
2140 return m_properties_expand_string(mp_properties
, str
, mpctx
);
2143 void property_print_help(void)
2145 m_properties_print_help_list(mp_properties
);
2154 * \defgroup Command2Property Command to property bridge
2156 * It is used to handle most commands that just set a property
2157 * and optionally display something on the OSD.
2158 * Two kinds of commands are handled: adjust or toggle.
2160 * Adjust commands take 1 or 2 parameters: <value> <abs>
2161 * If <abs> is non-zero the property is set to the given value
2162 * otherwise it is adjusted.
2164 * Toggle commands take 0 or 1 parameters. With no parameter
2165 * or a value less than the property minimum it just steps the
2166 * property to its next value. Otherwise it sets it to the given
2172 /// List of the commands that can be handled by setting a property.
2178 /// set/adjust or toggle command
2180 /// progressbar type
2182 /// osd msg id if it must be shared
2184 /// osd msg template
2185 const char *osd_msg
;
2186 } set_prop_cmd
[] = {
2188 { "loop", MP_CMD_LOOP
, 0, 0, -1, MSGTR_LoopStatus
},
2189 { "chapter", MP_CMD_SEEK_CHAPTER
, 0, 0, -1, NULL
},
2190 { "angle", MP_CMD_SWITCH_ANGLE
, 0, 0, -1, NULL
},
2192 { "volume", MP_CMD_VOLUME
, 0, OSD_VOLUME
, -1, MSGTR_Volume
},
2193 { "mute", MP_CMD_MUTE
, 1, 0, -1, MSGTR_MuteStatus
},
2194 { "audio_delay", MP_CMD_AUDIO_DELAY
, 0, 0, -1, MSGTR_AVDelayStatus
},
2195 { "switch_audio", MP_CMD_SWITCH_AUDIO
, 1, 0, -1, MSGTR_OSDAudio
},
2196 { "balance", MP_CMD_BALANCE
, 0, OSD_BALANCE
, -1, MSGTR_Balance
},
2198 { "fullscreen", MP_CMD_VO_FULLSCREEN
, 1, 0, -1, NULL
},
2199 { "panscan", MP_CMD_PANSCAN
, 0, OSD_PANSCAN
, -1, MSGTR_Panscan
},
2200 { "ontop", MP_CMD_VO_ONTOP
, 1, 0, -1, MSGTR_OnTopStatus
},
2201 { "rootwin", MP_CMD_VO_ROOTWIN
, 1, 0, -1, MSGTR_RootwinStatus
},
2202 { "border", MP_CMD_VO_BORDER
, 1, 0, -1, MSGTR_BorderStatus
},
2203 { "framedropping", MP_CMD_FRAMEDROPPING
, 1, 0, -1, MSGTR_FramedroppingStatus
},
2204 { "gamma", MP_CMD_GAMMA
, 0, OSD_BRIGHTNESS
, -1, MSGTR_Gamma
},
2205 { "brightness", MP_CMD_BRIGHTNESS
, 0, OSD_BRIGHTNESS
, -1, MSGTR_Brightness
},
2206 { "contrast", MP_CMD_CONTRAST
, 0, OSD_CONTRAST
, -1, MSGTR_Contrast
},
2207 { "saturation", MP_CMD_SATURATION
, 0, OSD_SATURATION
, -1, MSGTR_Saturation
},
2208 { "hue", MP_CMD_HUE
, 0, OSD_HUE
, -1, MSGTR_Hue
},
2209 { "vsync", MP_CMD_SWITCH_VSYNC
, 1, 0, -1, MSGTR_VSyncStatus
},
2211 { "sub", MP_CMD_SUB_SELECT
, 1, 0, -1, MSGTR_SubSelectStatus
},
2212 { "sub_source", MP_CMD_SUB_SOURCE
, 1, 0, -1, MSGTR_SubSourceStatus
},
2213 { "sub_vob", MP_CMD_SUB_VOB
, 1, 0, -1, MSGTR_SubSelectStatus
},
2214 { "sub_demux", MP_CMD_SUB_DEMUX
, 1, 0, -1, MSGTR_SubSelectStatus
},
2215 { "sub_file", MP_CMD_SUB_FILE
, 1, 0, -1, MSGTR_SubSelectStatus
},
2216 { "sub_pos", MP_CMD_SUB_POS
, 0, 0, -1, MSGTR_SubPosStatus
},
2217 { "sub_alignment", MP_CMD_SUB_ALIGNMENT
, 1, 0, -1, MSGTR_SubAlignStatus
},
2218 { "sub_delay", MP_CMD_SUB_DELAY
, 0, 0, OSD_MSG_SUB_DELAY
, MSGTR_SubDelayStatus
},
2219 { "sub_visibility", MP_CMD_SUB_VISIBILITY
, 1, 0, -1, MSGTR_SubVisibleStatus
},
2220 { "sub_forced_only", MP_CMD_SUB_FORCED_ONLY
, 1, 0, -1, MSGTR_SubForcedOnlyStatus
},
2221 #ifdef CONFIG_FREETYPE
2222 { "sub_scale", MP_CMD_SUB_SCALE
, 0, 0, -1, MSGTR_SubScale
},
2225 { "ass_use_margins", MP_CMD_ASS_USE_MARGINS
, 1, 0, -1, NULL
},
2228 { "tv_brightness", MP_CMD_TV_SET_BRIGHTNESS
, 0, OSD_BRIGHTNESS
, -1, MSGTR_Brightness
},
2229 { "tv_hue", MP_CMD_TV_SET_HUE
, 0, OSD_HUE
, -1, MSGTR_Hue
},
2230 { "tv_saturation", MP_CMD_TV_SET_SATURATION
, 0, OSD_SATURATION
, -1, MSGTR_Saturation
},
2231 { "tv_contrast", MP_CMD_TV_SET_CONTRAST
, 0, OSD_CONTRAST
, -1, MSGTR_Contrast
},
2233 { NULL
, 0, 0, 0, -1, NULL
}
2237 /// Handle commands that set a property.
2238 static int set_property_command(MPContext
*mpctx
, mp_cmd_t
*cmd
)
2244 // look for the command
2245 for (i
= 0; set_prop_cmd
[i
].name
; i
++)
2246 if (set_prop_cmd
[i
].cmd
== cmd
->id
)
2248 if (!(pname
= set_prop_cmd
[i
].name
))
2251 if (mp_property_do(pname
,M_PROPERTY_GET_TYPE
,&prop
,mpctx
) <= 0 || !prop
)
2255 if (set_prop_cmd
[i
].toggle
) {
2257 if (cmd
->nargs
> 0 && cmd
->args
[0].v
.i
>= prop
->min
)
2258 r
= mp_property_do(pname
, M_PROPERTY_SET
, &cmd
->args
[0].v
.i
, mpctx
);
2260 r
= mp_property_do(pname
, M_PROPERTY_STEP_UP
, NULL
, mpctx
);
2261 } else if (cmd
->args
[1].v
.i
) //set
2262 r
= mp_property_do(pname
, M_PROPERTY_SET
, &cmd
->args
[0].v
, mpctx
);
2264 r
= mp_property_do(pname
, M_PROPERTY_STEP_UP
, &cmd
->args
[0].v
, mpctx
);
2269 if (set_prop_cmd
[i
].osd_progbar
) {
2270 if (prop
->type
== CONF_TYPE_INT
) {
2271 if (mp_property_do(pname
, M_PROPERTY_GET
, &r
, mpctx
) > 0)
2272 set_osd_bar(mpctx
, set_prop_cmd
[i
].osd_progbar
,
2273 set_prop_cmd
[i
].osd_msg
, prop
->min
, prop
->max
, r
);
2274 } else if (prop
->type
== CONF_TYPE_FLOAT
) {
2276 if (mp_property_do(pname
, M_PROPERTY_GET
, &f
, mpctx
) > 0)
2277 set_osd_bar(mpctx
, set_prop_cmd
[i
].osd_progbar
,
2278 set_prop_cmd
[i
].osd_msg
, prop
->min
, prop
->max
, f
);
2280 mp_msg(MSGT_CPLAYER
, MSGL_ERR
,
2281 "Property use an unsupported type.\n");
2285 if (set_prop_cmd
[i
].osd_msg
) {
2286 char *val
= mp_property_print(pname
, mpctx
);
2288 set_osd_msg(set_prop_cmd
[i
].osd_id
>=
2289 0 ? set_prop_cmd
[i
].osd_id
: OSD_MSG_PROPERTY
+ i
,
2290 1, osd_duration
, set_prop_cmd
[i
].osd_msg
, val
);
2297 #ifdef CONFIG_DVDNAV
2298 static const struct {
2300 const mp_command_type cmd
;
2301 } mp_dvdnav_bindings
[] = {
2302 { "up", MP_CMD_DVDNAV_UP
},
2303 { "down", MP_CMD_DVDNAV_DOWN
},
2304 { "left", MP_CMD_DVDNAV_LEFT
},
2305 { "right", MP_CMD_DVDNAV_RIGHT
},
2306 { "menu", MP_CMD_DVDNAV_MENU
},
2307 { "select", MP_CMD_DVDNAV_SELECT
},
2308 { "prev", MP_CMD_DVDNAV_PREVMENU
},
2309 { "mouse", MP_CMD_DVDNAV_MOUSECLICK
},
2312 * keep old dvdnav sub-command options for a while in order not to
2313 * break slave-mode API too suddenly.
2315 { "1", MP_CMD_DVDNAV_UP
},
2316 { "2", MP_CMD_DVDNAV_DOWN
},
2317 { "3", MP_CMD_DVDNAV_LEFT
},
2318 { "4", MP_CMD_DVDNAV_RIGHT
},
2319 { "5", MP_CMD_DVDNAV_MENU
},
2320 { "6", MP_CMD_DVDNAV_SELECT
},
2321 { "7", MP_CMD_DVDNAV_PREVMENU
},
2322 { "8", MP_CMD_DVDNAV_MOUSECLICK
},
2327 int run_command(MPContext
*mpctx
, mp_cmd_t
*cmd
)
2329 struct MPOpts
*opts
= &mpctx
->opts
;
2330 sh_audio_t
* const sh_audio
= mpctx
->sh_audio
;
2331 sh_video_t
* const sh_video
= mpctx
->sh_video
;
2333 if (!set_property_command(mpctx
, cmd
))
2339 mpctx
->osd_show_percentage
= sh_video
->fps
;
2340 v
= cmd
->args
[0].v
.f
;
2341 abs
= (cmd
->nargs
> 1) ? cmd
->args
[1].v
.i
: 0;
2342 if (abs
== 2) { /* Absolute seek to a specific timestamp in seconds */
2343 mpctx
->abs_seek_pos
= SEEK_ABSOLUTE
;
2345 mpctx
->osd_function
=
2346 (v
> sh_video
->pts
) ? OSD_FFW
: OSD_REW
;
2347 mpctx
->rel_seek_secs
= v
;
2348 } else if (abs
) { /* Absolute seek by percentage */
2349 mpctx
->abs_seek_pos
= SEEK_ABSOLUTE
| SEEK_FACTOR
;
2351 mpctx
->osd_function
= OSD_FFW
; // Direction isn't set correctly
2352 mpctx
->rel_seek_secs
= v
/ 100.0;
2354 mpctx
->rel_seek_secs
+= v
;
2355 mpctx
->osd_function
= (v
> 0) ? OSD_FFW
: OSD_REW
;
2361 case MP_CMD_SET_PROPERTY
:{
2362 int r
= mp_property_do(cmd
->args
[0].v
.s
, M_PROPERTY_PARSE
,
2363 cmd
->args
[1].v
.s
, mpctx
);
2364 if (r
== M_PROPERTY_UNKNOWN
)
2365 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2366 "Unknown property: '%s'\n", cmd
->args
[0].v
.s
);
2368 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2369 "Failed to set property '%s' to '%s'.\n",
2370 cmd
->args
[0].v
.s
, cmd
->args
[1].v
.s
);
2374 case MP_CMD_STEP_PROPERTY
:{
2379 if (cmd
->args
[1].v
.f
) {
2381 if((r
= mp_property_do(cmd
->args
[0].v
.s
,
2382 M_PROPERTY_GET_TYPE
,
2383 &prop
, mpctx
)) <= 0)
2385 if(prop
->type
== CONF_TYPE_INT
||
2386 prop
->type
== CONF_TYPE_FLAG
)
2387 i
= cmd
->args
[1].v
.f
, arg
= &i
;
2388 else if(prop
->type
== CONF_TYPE_FLOAT
)
2389 arg
= &cmd
->args
[1].v
.f
;
2390 else if(prop
->type
== CONF_TYPE_DOUBLE
||
2391 prop
->type
== CONF_TYPE_TIME
)
2392 d
= cmd
->args
[1].v
.f
, arg
= &d
;
2393 else if(prop
->type
== CONF_TYPE_POSITION
)
2394 o
= cmd
->args
[1].v
.f
, arg
= &o
;
2396 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2397 "Ignoring step size stepping property '%s'.\n",
2400 r
= mp_property_do(cmd
->args
[0].v
.s
,
2401 cmd
->args
[2].v
.i
< 0 ?
2402 M_PROPERTY_STEP_DOWN
: M_PROPERTY_STEP_UP
,
2405 if (r
== M_PROPERTY_UNKNOWN
)
2406 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2407 "Unknown property: '%s'\n", cmd
->args
[0].v
.s
);
2409 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2410 "Failed to increment property '%s' by %f.\n",
2411 cmd
->args
[0].v
.s
, cmd
->args
[1].v
.f
);
2415 case MP_CMD_GET_PROPERTY
:{
2417 if (mp_property_do(cmd
->args
[0].v
.s
, M_PROPERTY_TO_STRING
,
2418 &tmp
, mpctx
) <= 0) {
2419 mp_msg(MSGT_CPLAYER
, MSGL_WARN
,
2420 "Failed to get value of property '%s'.\n",
2424 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_%s=%s\n",
2425 cmd
->args
[0].v
.s
, tmp
);
2430 case MP_CMD_EDL_MARK
:
2432 float v
= sh_video
? sh_video
->pts
:
2433 playing_audio_pts(mpctx
);
2434 if (mpctx
->begin_skip
== MP_NOPTS_VALUE
) {
2435 mpctx
->begin_skip
= v
;
2436 mp_msg(MSGT_CPLAYER
, MSGL_INFO
, MSGTR_EdloutStartSkip
);
2438 if (mpctx
->begin_skip
> v
)
2439 mp_msg(MSGT_CPLAYER
, MSGL_WARN
, MSGTR_EdloutBadStop
);
2441 fprintf(edl_fd
, "%f %f %d\n", mpctx
->begin_skip
, v
, 0);
2442 mp_msg(MSGT_CPLAYER
, MSGL_INFO
, MSGTR_EdloutEndSkip
);
2444 mpctx
->begin_skip
= MP_NOPTS_VALUE
;
2449 case MP_CMD_SWITCH_RATIO
:
2450 if (cmd
->nargs
== 0 || cmd
->args
[0].v
.f
== -1)
2451 opts
->movie_aspect
= (float) sh_video
->disp_w
/ sh_video
->disp_h
;
2453 opts
->movie_aspect
= cmd
->args
[0].v
.f
;
2454 mpcodecs_config_vo(sh_video
, sh_video
->disp_w
, sh_video
->disp_h
, 0);
2457 case MP_CMD_SPEED_INCR
:{
2458 float v
= cmd
->args
[0].v
.f
;
2459 opts
->playback_speed
+= v
;
2460 build_afilter_chain(mpctx
, sh_audio
, &ao_data
);
2461 set_osd_msg(OSD_MSG_SPEED
, 1, osd_duration
, MSGTR_OSDSpeed
,
2462 opts
->playback_speed
);
2465 case MP_CMD_SPEED_MULT
:{
2466 float v
= cmd
->args
[0].v
.f
;
2467 opts
->playback_speed
*= v
;
2468 build_afilter_chain(mpctx
, sh_audio
, &ao_data
);
2469 set_osd_msg(OSD_MSG_SPEED
, 1, osd_duration
, MSGTR_OSDSpeed
,
2470 opts
->playback_speed
);
2473 case MP_CMD_SPEED_SET
:{
2474 float v
= cmd
->args
[0].v
.f
;
2475 opts
->playback_speed
= v
;
2476 build_afilter_chain(mpctx
, sh_audio
, &ao_data
);
2477 set_osd_msg(OSD_MSG_SPEED
, 1, osd_duration
, MSGTR_OSDSpeed
,
2478 opts
->playback_speed
);
2481 case MP_CMD_FRAME_STEP
:
2487 case MP_CMD_FILE_FILTER
:
2488 file_filter
= cmd
->args
[0].v
.i
;
2492 exit_player_with_rc(mpctx
, MSGTR_Exit_quit
,
2493 (cmd
->nargs
> 0) ? cmd
->args
[0].v
.i
: 0);
2495 case MP_CMD_PLAY_TREE_STEP
:{
2496 int n
= cmd
->args
[0].v
.i
== 0 ? 1 : cmd
->args
[0].v
.i
;
2497 int force
= cmd
->args
[1].v
.i
;
2503 for (i
= 0; i
< n
; i
++)
2506 for (i
= 0; i
< -1 * n
; i
++)
2511 if (!force
&& mpctx
->playtree_iter
) {
2512 play_tree_iter_t
*i
=
2513 play_tree_iter_new_copy(mpctx
->playtree_iter
);
2514 if (play_tree_iter_step(i
, n
, 0) ==
2515 PLAY_TREE_ITER_ENTRY
)
2517 (n
> 0) ? PT_NEXT_ENTRY
: PT_PREV_ENTRY
;
2518 play_tree_iter_free(i
);
2520 mpctx
->eof
= (n
> 0) ? PT_NEXT_ENTRY
: PT_PREV_ENTRY
;
2522 mpctx
->play_tree_step
= n
;
2528 case MP_CMD_PLAY_TREE_UP_STEP
:{
2529 int n
= cmd
->args
[0].v
.i
> 0 ? 1 : -1;
2530 int force
= cmd
->args
[1].v
.i
;
2532 if (!force
&& mpctx
->playtree_iter
) {
2533 play_tree_iter_t
*i
=
2534 play_tree_iter_new_copy(mpctx
->playtree_iter
);
2535 if (play_tree_iter_up_step(i
, n
, 0) == PLAY_TREE_ITER_ENTRY
)
2536 mpctx
->eof
= (n
> 0) ? PT_UP_NEXT
: PT_UP_PREV
;
2537 play_tree_iter_free(i
);
2539 mpctx
->eof
= (n
> 0) ? PT_UP_NEXT
: PT_UP_PREV
;
2544 case MP_CMD_PLAY_ALT_SRC_STEP
:
2545 if (mpctx
->playtree_iter
&& mpctx
->playtree_iter
->num_files
> 1) {
2546 int v
= cmd
->args
[0].v
.i
;
2548 && mpctx
->playtree_iter
->file
<
2549 mpctx
->playtree_iter
->num_files
)
2550 mpctx
->eof
= PT_NEXT_SRC
;
2551 else if (v
< 0 && mpctx
->playtree_iter
->file
> 1)
2552 mpctx
->eof
= PT_PREV_SRC
;
2557 case MP_CMD_SUB_STEP
:
2559 int movement
= cmd
->args
[0].v
.i
;
2560 step_sub(subdata
, sh_video
->pts
, movement
);
2564 ass_step_sub(ass_track
,
2566 sub_delay
) * 1000 + .5, movement
) / 1000.;
2568 set_osd_msg(OSD_MSG_SUB_DELAY
, 1, osd_duration
,
2569 MSGTR_OSDSubDelay
, ROUND(sub_delay
* 1000));
2573 case MP_CMD_SUB_LOG
:
2578 int v
= cmd
->args
[0].v
.i
;
2580 && !sh_video
) ? MAX_TERM_OSD_LEVEL
: MAX_OSD_LEVEL
;
2581 if (osd_level
> max
)
2584 osd_level
= (osd_level
+ 1) % (max
+ 1);
2586 osd_level
= v
> max
? max
: v
;
2587 /* Show OSD state when disabled, but not when an explicit
2588 argument is given to the OSD command, i.e. in slave mode. */
2589 if (v
== -1 && osd_level
<= 1)
2590 set_osd_msg(OSD_MSG_OSD_STATUS
, 0, osd_duration
,
2592 osd_level
? MSGTR_OSDenabled
:
2595 rm_osd_msg(OSD_MSG_OSD_STATUS
);
2599 case MP_CMD_OSD_SHOW_TEXT
:
2600 set_osd_msg(OSD_MSG_TEXT
, cmd
->args
[2].v
.i
,
2602 0 ? osd_duration
: cmd
->args
[1].v
.i
),
2603 "%-.63s", cmd
->args
[0].v
.s
);
2606 case MP_CMD_OSD_SHOW_PROPERTY_TEXT
:{
2607 char *txt
= m_properties_expand_string(mp_properties
,
2610 /* if no argument supplied take default osd_duration, else <arg> ms. */
2612 set_osd_msg(OSD_MSG_TEXT
, cmd
->args
[2].v
.i
,
2614 0 ? osd_duration
: cmd
->args
[1].v
.i
),
2621 case MP_CMD_LOADFILE
:{
2622 play_tree_t
*e
= play_tree_new();
2623 play_tree_add_file(e
, cmd
->args
[0].v
.s
);
2625 if (cmd
->args
[1].v
.i
) // append
2626 play_tree_append_entry(mpctx
->playtree
, e
);
2628 // Go back to the starting point.
2629 while (play_tree_iter_up_step
2630 (mpctx
->playtree_iter
, 0, 1) != PLAY_TREE_ITER_END
)
2632 play_tree_free_list(mpctx
->playtree
->child
, 1);
2633 play_tree_set_child(mpctx
->playtree
, e
);
2634 play_tree_iter_step(mpctx
->playtree_iter
, 0, 0);
2635 mpctx
->eof
= PT_NEXT_SRC
;
2641 case MP_CMD_LOADLIST
:{
2642 play_tree_t
*e
= parse_playlist_file(mpctx
->mconfig
, cmd
->args
[0].v
.s
);
2644 mp_msg(MSGT_CPLAYER
, MSGL_ERR
,
2645 MSGTR_PlaylistLoadUnable
, cmd
->args
[0].v
.s
);
2647 if (cmd
->args
[1].v
.i
) // append
2648 play_tree_append_entry(mpctx
->playtree
, e
);
2650 // Go back to the starting point.
2651 while (play_tree_iter_up_step
2652 (mpctx
->playtree_iter
, 0, 1)
2653 != PLAY_TREE_ITER_END
)
2655 play_tree_free_list(mpctx
->playtree
->child
, 1);
2656 play_tree_set_child(mpctx
->playtree
, e
);
2657 play_tree_iter_step(mpctx
->playtree_iter
, 0, 0);
2658 mpctx
->eof
= PT_NEXT_SRC
;
2666 // Go back to the starting point.
2667 while (play_tree_iter_up_step
2668 (mpctx
->playtree_iter
, 0, 1) != PLAY_TREE_ITER_END
)
2670 mpctx
->eof
= PT_STOP
;
2675 case MP_CMD_RADIO_STEP_CHANNEL
:
2676 if (mpctx
->demuxer
->stream
->type
== STREAMTYPE_RADIO
) {
2677 int v
= cmd
->args
[0].v
.i
;
2679 radio_step_channel(mpctx
->demuxer
->stream
,
2680 RADIO_CHANNEL_HIGHER
);
2682 radio_step_channel(mpctx
->demuxer
->stream
,
2683 RADIO_CHANNEL_LOWER
);
2684 if (radio_get_channel_name(mpctx
->demuxer
->stream
)) {
2685 set_osd_msg(OSD_MSG_RADIO_CHANNEL
, 1, osd_duration
,
2687 radio_get_channel_name(mpctx
->demuxer
->stream
));
2692 case MP_CMD_RADIO_SET_CHANNEL
:
2693 if (mpctx
->demuxer
->stream
->type
== STREAMTYPE_RADIO
) {
2694 radio_set_channel(mpctx
->demuxer
->stream
, cmd
->args
[0].v
.s
);
2695 if (radio_get_channel_name(mpctx
->demuxer
->stream
)) {
2696 set_osd_msg(OSD_MSG_RADIO_CHANNEL
, 1, osd_duration
,
2698 radio_get_channel_name(mpctx
->demuxer
->stream
));
2703 case MP_CMD_RADIO_SET_FREQ
:
2704 if (mpctx
->demuxer
->stream
->type
== STREAMTYPE_RADIO
)
2705 radio_set_freq(mpctx
->demuxer
->stream
, cmd
->args
[0].v
.f
);
2708 case MP_CMD_RADIO_STEP_FREQ
:
2709 if (mpctx
->demuxer
->stream
->type
== STREAMTYPE_RADIO
)
2710 radio_step_freq(mpctx
->demuxer
->stream
, cmd
->args
[0].v
.f
);
2715 case MP_CMD_TV_START_SCAN
:
2716 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2717 tv_start_scan((tvi_handle_t
*) (mpctx
->demuxer
->priv
),1);
2719 case MP_CMD_TV_SET_FREQ
:
2720 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2721 tv_set_freq((tvi_handle_t
*) (mpctx
->demuxer
->priv
),
2722 cmd
->args
[0].v
.f
* 16.0);
2724 else if (mpctx
->stream
&& mpctx
->stream
->type
== STREAMTYPE_PVR
) {
2725 pvr_set_freq (mpctx
->stream
, ROUND (cmd
->args
[0].v
.f
));
2726 set_osd_msg (OSD_MSG_TV_CHANNEL
, 1, osd_duration
, "%s: %s",
2727 pvr_get_current_channelname (mpctx
->stream
),
2728 pvr_get_current_stationname (mpctx
->stream
));
2730 #endif /* CONFIG_PVR */
2733 case MP_CMD_TV_STEP_FREQ
:
2734 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2735 tv_step_freq((tvi_handle_t
*) (mpctx
->demuxer
->priv
),
2736 cmd
->args
[0].v
.f
* 16.0);
2738 else if (mpctx
->stream
&& mpctx
->stream
->type
== STREAMTYPE_PVR
) {
2739 pvr_force_freq_step (mpctx
->stream
, ROUND (cmd
->args
[0].v
.f
));
2740 set_osd_msg (OSD_MSG_TV_CHANNEL
, 1, osd_duration
, "%s: f %d",
2741 pvr_get_current_channelname (mpctx
->stream
),
2742 pvr_get_current_frequency (mpctx
->stream
));
2744 #endif /* CONFIG_PVR */
2747 case MP_CMD_TV_SET_NORM
:
2748 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2749 tv_set_norm((tvi_handle_t
*) (mpctx
->demuxer
->priv
),
2753 case MP_CMD_TV_STEP_CHANNEL
:{
2754 if (mpctx
->file_format
== DEMUXER_TYPE_TV
) {
2755 int v
= cmd
->args
[0].v
.i
;
2757 tv_step_channel((tvi_handle_t
*) (mpctx
->
2761 tv_step_channel((tvi_handle_t
*) (mpctx
->
2765 if (tv_channel_list
) {
2766 set_osd_msg(OSD_MSG_TV_CHANNEL
, 1, osd_duration
,
2767 MSGTR_OSDChannel
, tv_channel_current
->name
);
2768 //vo_osd_changed(OSDTYPE_SUBTITLE);
2772 else if (mpctx
->stream
&&
2773 mpctx
->stream
->type
== STREAMTYPE_PVR
) {
2774 pvr_set_channel_step (mpctx
->stream
, cmd
->args
[0].v
.i
);
2775 set_osd_msg (OSD_MSG_TV_CHANNEL
, 1, osd_duration
, "%s: %s",
2776 pvr_get_current_channelname (mpctx
->stream
),
2777 pvr_get_current_stationname (mpctx
->stream
));
2779 #endif /* CONFIG_PVR */
2782 if (mpctx
->stream
->type
== STREAMTYPE_DVB
) {
2784 int v
= cmd
->args
[0].v
.i
;
2786 mpctx
->last_dvb_step
= v
;
2788 dir
= DVB_CHANNEL_HIGHER
;
2790 dir
= DVB_CHANNEL_LOWER
;
2793 if (dvb_step_channel(mpctx
->stream
, dir
))
2794 mpctx
->eof
= mpctx
->dvbin_reopen
= 1;
2796 #endif /* CONFIG_DVBIN */
2799 case MP_CMD_TV_SET_CHANNEL
:
2800 if (mpctx
->file_format
== DEMUXER_TYPE_TV
) {
2801 tv_set_channel((tvi_handle_t
*) (mpctx
->demuxer
->priv
),
2803 if (tv_channel_list
) {
2804 set_osd_msg(OSD_MSG_TV_CHANNEL
, 1, osd_duration
,
2805 MSGTR_OSDChannel
, tv_channel_current
->name
);
2806 //vo_osd_changed(OSDTYPE_SUBTITLE);
2810 else if (mpctx
->stream
&& mpctx
->stream
->type
== STREAMTYPE_PVR
) {
2811 pvr_set_channel (mpctx
->stream
, cmd
->args
[0].v
.s
);
2812 set_osd_msg (OSD_MSG_TV_CHANNEL
, 1, osd_duration
, "%s: %s",
2813 pvr_get_current_channelname (mpctx
->stream
),
2814 pvr_get_current_stationname (mpctx
->stream
));
2816 #endif /* CONFIG_PVR */
2820 case MP_CMD_DVB_SET_CHANNEL
:
2821 if (mpctx
->stream
->type
== STREAMTYPE_DVB
) {
2822 mpctx
->last_dvb_step
= 1;
2825 (mpctx
->stream
, cmd
->args
[1].v
.i
, cmd
->args
[0].v
.i
))
2826 mpctx
->eof
= mpctx
->dvbin_reopen
= 1;
2829 #endif /* CONFIG_DVBIN */
2831 case MP_CMD_TV_LAST_CHANNEL
:
2832 if (mpctx
->file_format
== DEMUXER_TYPE_TV
) {
2833 tv_last_channel((tvi_handle_t
*) (mpctx
->demuxer
->priv
));
2834 if (tv_channel_list
) {
2835 set_osd_msg(OSD_MSG_TV_CHANNEL
, 1, osd_duration
,
2836 MSGTR_OSDChannel
, tv_channel_current
->name
);
2837 //vo_osd_changed(OSDTYPE_SUBTITLE);
2841 else if (mpctx
->stream
&& mpctx
->stream
->type
== STREAMTYPE_PVR
) {
2842 pvr_set_lastchannel (mpctx
->stream
);
2843 set_osd_msg (OSD_MSG_TV_CHANNEL
, 1, osd_duration
, "%s: %s",
2844 pvr_get_current_channelname (mpctx
->stream
),
2845 pvr_get_current_stationname (mpctx
->stream
));
2847 #endif /* CONFIG_PVR */
2850 case MP_CMD_TV_STEP_NORM
:
2851 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2852 tv_step_norm((tvi_handle_t
*) (mpctx
->demuxer
->priv
));
2855 case MP_CMD_TV_STEP_CHANNEL_LIST
:
2856 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2857 tv_step_chanlist((tvi_handle_t
*) (mpctx
->demuxer
->priv
));
2859 #ifdef CONFIG_TV_TELETEXT
2860 case MP_CMD_TV_TELETEXT_ADD_DEC
:
2862 tvi_handle_t
* tvh
=(tvi_handle_t
*)(mpctx
->demuxer
->priv
);
2863 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2864 tvh
->functions
->control(tvh
->priv
,TV_VBI_CONTROL_ADD_DEC
,&(cmd
->args
[0].v
.s
));
2867 case MP_CMD_TV_TELETEXT_GO_LINK
:
2869 tvi_handle_t
* tvh
=(tvi_handle_t
*)(mpctx
->demuxer
->priv
);
2870 if (mpctx
->file_format
== DEMUXER_TYPE_TV
)
2871 tvh
->functions
->control(tvh
->priv
,TV_VBI_CONTROL_GO_LINK
,&(cmd
->args
[0].v
.i
));
2874 #endif /* CONFIG_TV_TELETEXT */
2875 #endif /* CONFIG_TV */
2877 case MP_CMD_SUB_LOAD
:
2879 int n
= mpctx
->set_of_sub_size
;
2880 add_subtitles(mpctx
, cmd
->args
[0].v
.s
, sh_video
->fps
, 0);
2881 if (n
!= mpctx
->set_of_sub_size
) {
2882 if (mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
] < 0)
2883 mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
] =
2884 mpctx
->global_sub_size
;
2885 ++mpctx
->global_sub_size
;
2890 case MP_CMD_SUB_REMOVE
:
2892 int v
= cmd
->args
[0].v
.i
;
2895 for (v
= 0; v
< mpctx
->set_of_sub_size
; ++v
) {
2896 subd
= mpctx
->set_of_subtitles
[v
];
2897 mp_msg(MSGT_CPLAYER
, MSGL_STATUS
,
2898 MSGTR_RemovedSubtitleFile
, v
+ 1,
2899 filename_recode(subd
->filename
));
2901 mpctx
->set_of_subtitles
[v
] = NULL
;
2903 mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
] = -1;
2904 mpctx
->global_sub_size
-= mpctx
->set_of_sub_size
;
2905 mpctx
->set_of_sub_size
= 0;
2906 if (mpctx
->set_of_sub_pos
>= 0) {
2907 mpctx
->global_sub_pos
= -2;
2909 mp_input_queue_cmd(mpctx
->input
,
2910 mp_input_parse_cmd("sub_select"));
2912 } else if (v
< mpctx
->set_of_sub_size
) {
2913 subd
= mpctx
->set_of_subtitles
[v
];
2914 mp_msg(MSGT_CPLAYER
, MSGL_STATUS
,
2915 MSGTR_RemovedSubtitleFile
, v
+ 1,
2916 filename_recode(subd
->filename
));
2918 if (mpctx
->set_of_sub_pos
== v
) {
2919 mpctx
->global_sub_pos
= -2;
2921 mp_input_queue_cmd(mpctx
->input
,
2922 mp_input_parse_cmd("sub_select"));
2923 } else if (mpctx
->set_of_sub_pos
> v
) {
2924 --mpctx
->set_of_sub_pos
;
2925 --mpctx
->global_sub_pos
;
2927 while (++v
< mpctx
->set_of_sub_size
)
2928 mpctx
->set_of_subtitles
[v
- 1] =
2929 mpctx
->set_of_subtitles
[v
];
2930 --mpctx
->set_of_sub_size
;
2931 --mpctx
->global_sub_size
;
2932 if (mpctx
->set_of_sub_size
<= 0)
2933 mpctx
->global_sub_indices
[SUB_SOURCE_SUBS
] = -1;
2934 mpctx
->set_of_subtitles
[mpctx
->set_of_sub_size
] = NULL
;
2939 case MP_CMD_GET_SUB_VISIBILITY
:
2941 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,
2942 "ANS_SUB_VISIBILITY=%d\n", sub_visibility
);
2946 case MP_CMD_SCREENSHOT
:
2947 if (mpctx
->video_out
&& mpctx
->video_out
->config_ok
) {
2948 mp_msg(MSGT_CPLAYER
, MSGL_INFO
, "sending VFCTRL_SCREENSHOT!\n");
2950 ((vf_instance_t
*) sh_video
->vfilter
)->
2951 control(sh_video
->vfilter
, VFCTRL_SCREENSHOT
,
2953 mp_msg(MSGT_CPLAYER
, MSGL_INFO
, "failed (forgot -vf screenshot?)\n");
2957 case MP_CMD_VF_CHANGE_RECTANGLE
:
2958 set_rectangle(sh_video
, cmd
->args
[0].v
.i
, cmd
->args
[1].v
.i
);
2961 case MP_CMD_GET_TIME_LENGTH
:{
2962 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_LENGTH=%.2lf\n",
2963 demuxer_get_time_length(mpctx
->demuxer
));
2967 case MP_CMD_GET_FILENAME
:{
2968 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_FILENAME='%s'\n",
2969 get_metadata(mpctx
, META_NAME
));
2973 case MP_CMD_GET_VIDEO_CODEC
:{
2974 char *inf
= get_metadata(mpctx
, META_VIDEO_CODEC
);
2977 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_VIDEO_CODEC='%s'\n", inf
);
2982 case MP_CMD_GET_VIDEO_BITRATE
:{
2983 char *inf
= get_metadata(mpctx
, META_VIDEO_BITRATE
);
2986 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_VIDEO_BITRATE='%s'\n", inf
);
2991 case MP_CMD_GET_VIDEO_RESOLUTION
:{
2992 char *inf
= get_metadata(mpctx
, META_VIDEO_RESOLUTION
);
2995 mp_msg(MSGT_GLOBAL
, MSGL_INFO
,
2996 "ANS_VIDEO_RESOLUTION='%s'\n", inf
);
3001 case MP_CMD_GET_AUDIO_CODEC
:{
3002 char *inf
= get_metadata(mpctx
, META_AUDIO_CODEC
);
3005 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_AUDIO_CODEC='%s'\n", inf
);
3010 case MP_CMD_GET_AUDIO_BITRATE
:{
3011 char *inf
= get_metadata(mpctx
, META_AUDIO_BITRATE
);
3014 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_AUDIO_BITRATE='%s'\n", inf
);
3019 case MP_CMD_GET_AUDIO_SAMPLES
:{
3020 char *inf
= get_metadata(mpctx
, META_AUDIO_SAMPLES
);
3023 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_AUDIO_SAMPLES='%s'\n", inf
);
3028 case MP_CMD_GET_META_TITLE
:{
3029 char *inf
= get_metadata(mpctx
, META_INFO_TITLE
);
3032 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_TITLE='%s'\n", inf
);
3037 case MP_CMD_GET_META_ARTIST
:{
3038 char *inf
= get_metadata(mpctx
, META_INFO_ARTIST
);
3041 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_ARTIST='%s'\n", inf
);
3046 case MP_CMD_GET_META_ALBUM
:{
3047 char *inf
= get_metadata(mpctx
, META_INFO_ALBUM
);
3050 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_ALBUM='%s'\n", inf
);
3055 case MP_CMD_GET_META_YEAR
:{
3056 char *inf
= get_metadata(mpctx
, META_INFO_YEAR
);
3059 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_YEAR='%s'\n", inf
);
3064 case MP_CMD_GET_META_COMMENT
:{
3065 char *inf
= get_metadata(mpctx
, META_INFO_COMMENT
);
3068 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_COMMENT='%s'\n", inf
);
3073 case MP_CMD_GET_META_TRACK
:{
3074 char *inf
= get_metadata(mpctx
, META_INFO_TRACK
);
3077 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_TRACK='%s'\n", inf
);
3082 case MP_CMD_GET_META_GENRE
:{
3083 char *inf
= get_metadata(mpctx
, META_INFO_GENRE
);
3086 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_META_GENRE='%s'\n", inf
);
3091 case MP_CMD_GET_VO_FULLSCREEN
:
3092 if (mpctx
->video_out
&& mpctx
->video_out
->config_ok
)
3093 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_VO_FULLSCREEN=%d\n", vo_fs
);
3096 case MP_CMD_GET_PERCENT_POS
:
3097 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_PERCENT_POSITION=%d\n",
3098 demuxer_get_percent_pos(mpctx
->demuxer
));
3101 case MP_CMD_GET_TIME_POS
:{
3104 pos
= sh_video
->pts
;
3105 else if (sh_audio
&& mpctx
->audio_out
)
3106 pos
= playing_audio_pts(mpctx
);
3107 mp_msg(MSGT_GLOBAL
, MSGL_INFO
, "ANS_TIME_POSITION=%.1f\n", pos
);
3114 execl("/bin/sh", "sh", "-c", cmd
->args
[0].v
.s
, NULL
);
3120 case MP_CMD_KEYDOWN_EVENTS
:
3121 mplayer_put_key(mpctx
->key_fifo
, cmd
->args
[0].v
.i
);
3124 case MP_CMD_SET_MOUSE_POS
:{
3125 int pointer_x
, pointer_y
;
3127 pointer_x
= cmd
->args
[0].v
.i
;
3128 pointer_y
= cmd
->args
[1].v
.i
;
3129 rescale_input_coordinates(mpctx
, pointer_x
, pointer_y
, &dx
, &dy
);
3130 #ifdef CONFIG_DVDNAV
3131 if (mpctx
->stream
->type
== STREAMTYPE_DVDNAV
3132 && dx
> 0.0 && dy
> 0.0) {
3134 pointer_x
= (int) (dx
* (double) sh_video
->disp_w
);
3135 pointer_y
= (int) (dy
* (double) sh_video
->disp_h
);
3136 mp_dvdnav_update_mouse_pos(mpctx
->stream
,
3137 pointer_x
, pointer_y
, &button
);
3138 if (osd_level
> 1 && button
> 0)
3139 set_osd_msg(OSD_MSG_TEXT
, 1, osd_duration
,
3140 "Selected button number %d", button
);
3144 if (use_menu
&& dx
>= 0.0 && dy
>= 0.0)
3145 menu_update_mouse_pos(dx
, dy
);
3150 #ifdef CONFIG_DVDNAV
3151 case MP_CMD_DVDNAV
:{
3154 mp_command_type command
= 0;
3155 if (mpctx
->stream
->type
!= STREAMTYPE_DVDNAV
)
3158 for (i
= 0; mp_dvdnav_bindings
[i
].name
; i
++)
3159 if (cmd
->args
[0].v
.s
&&
3160 !strcasecmp (cmd
->args
[0].v
.s
,
3161 mp_dvdnav_bindings
[i
].name
))
3162 command
= mp_dvdnav_bindings
[i
].cmd
;
3164 mp_dvdnav_handle_input(mpctx
->stream
,command
,&button
);
3165 if (osd_level
> 1 && button
> 0)
3166 set_osd_msg(OSD_MSG_TEXT
, 1, osd_duration
,
3167 "Selected button number %d", button
);
3171 case MP_CMD_SWITCH_TITLE
:
3172 if (mpctx
->stream
->type
== STREAMTYPE_DVDNAV
)
3173 mp_dvdnav_switch_title(mpctx
->stream
, cmd
->args
[0].v
.i
);
3180 if ((use_gui
) && (cmd
->id
> MP_CMD_GUI_EVENTS
))
3181 guiGetEvent(guiIEvent
, (char *) cmd
->id
);
3184 mp_msg(MSGT_CPLAYER
, MSGL_V
,
3185 "Received unknown cmd %s\n", cmd
->name
);
3188 switch (cmd
->pausing
) {
3189 case 1: // "pausing"
3190 mpctx
->osd_function
= OSD_PAUSE
;
3192 case 3: // "pausing_toggle"
3193 mpctx
->was_paused
= !mpctx
->was_paused
;
3194 if (mpctx
->was_paused
)
3195 mpctx
->osd_function
= OSD_PAUSE
;
3196 else if (mpctx
->osd_function
== OSD_PAUSE
)
3197 mpctx
->osd_function
= OSD_PLAY
;
3199 case 2: // "pausing_keep"
3200 if (mpctx
->was_paused
)
3201 mpctx
->osd_function
= OSD_PAUSE
;