stream_file: Simplify and document MinGW stdin hack
[mplayer.git] / DOCS / tech / slave.txt
blob73deb5e3a2594c487b6c6a81fc5a0e902b73e5c1
1 SLAVE MODE PROTOCOL
2 -------------------
4 The -slave option switches on slave mode, in which MPlayer works as a backend
5 for other programs. Instead of intercepting keyboard events, MPlayer will read
6 commands separated by a newline (\n) from stdin.
8 To try slave mode out by hand, run
10   mplayer -slave -quiet <movie>
12 and type slave commands into the console window.
14 You can also use a fifo file (named pipe):
16   mkfifo </tmp/fifofile>
17   mplayer -slave -input file=</tmp/fifofile> <movie>
19 Most slave mode commands are equivalent to command line options, though not
20 necessarily under the same name. Detailed descriptions can be found in the
21 man page.
23 All commands can be prefixed with one of "pausing ", "pausing_keep ", or
24 "pausing_toggle ". "pausing " tells MPlayer to pause as soon as possible
25 after processing the command. "pausing_keep " tells MPlayer to do so only if
26 it was already in paused mode. "pausing_toggle " tells MPlayer to do so
27 only if it was not already in paused mode. Please note that "as soon as
28 possible" can be before the command is fully executed.
29 As a temporary hack, there is also the _experimental_ "pausing_keep_force "
30 prefix, with which MPlayer will not exit the pause loop at all.
31 Like this you can avoid the "frame stepping" effect of "pausing_keep "
32 but most commands will either not work at all or behave in unexpected ways.
33 For "set_mouse_pos" and "key_down_event", "pausing_keep_force" is the default
34 since other values do not make much sense for them.
37 Various tips and tricks (please help expand it!):
39 - Try using something like
40     pausing_keep_force pt_step 1
41     get_property pause
42   to switch to the next file. It avoids audio playback starting to play
43   the old file for a short time before switching to the new one.
44 - To ensure the user can't control MPlayer "behind your back" use
45   something like -input nodefault-bindings -noconfig all
48 Available commands ('mplayer -input cmdlist' will print a list):
50 af_add <filter_arguments_list>  (comma separated list of audio filters with parameters)
51     (experimental) Load the given list of audio filters.
53 af_clr
54     (experimental) Unload all loaded audio filters.
56 af_del <filter_name_list> (comma separated list of audio filter's names)
57     (experimental) Unload the first occurrence of the filters, if loaded.
59 af_switch <filter_arguments_list> (comma separated list of audio filters with parameters)
60     (experimental) Remove all the audio filters and replace them with the given list.
62 alt_src_step <value> (ASX playlist only)
63     When more than one source is available it selects the next/previous one.
65 audio_delay <value> [abs]
66     Set/adjust the audio delay.
67     If [abs] is not given or is zero, adjust the delay by <value> seconds.
68     If [abs] is nonzero, set the delay to <value> seconds.
70 [brightness|contrast|gamma|hue|saturation] <value> [abs]
71     Set/adjust video parameters.
72     If [abs] is not given or is zero, modifies parameter by <value>.
73     If [abs] is non-zero, parameter is set to <value>.
74     <value> is in the range [-100, 100].
76 change_rectangle <val1> <val2>
77     Change the position of the rectangle filter rectangle.
78         <val1>
79             Must be one of the following:
80                 0 = width
81                 1 = height
82                 2 = x position
83                 3 = y position
84         <val2>
85             If <val1> is 0 or 1:
86                 Integer amount to add/subtract from the width/height.
87                 Positive values add to width/height and negative values
88                 subtract from it.
89             If <val1> is 2 or 3:
90                 Relative integer amount by which to move the upper left
91                 rectangle corner. Positive values move the rectangle
92                 right/down and negative values move the rectangle left/up.
94 dvb_set_channel <channel_number> <card_number>
95     Set DVB channel.
97 dvdnav <button_name>
98     Press the given dvdnav button.
99         up
100         down
101         left
102         right
103         menu
104         select
105         prev
106         mouse
108 edl_mark
109     Write the current position into the EDL file.
111 frame_drop [value]
112     Toggle/set frame dropping mode.
114 get_audio_bitrate
115     Print out the audio bitrate of the current file.
117 get_audio_codec
118     Print out the audio codec name of the current file.
120 get_audio_samples
121     Print out the audio frequency and number of channels of the current file.
123 get_file_name
124     Print out the name of the current file.
126 get_meta_album
127     Print out the 'Album' metadata of the current file.
129 get_meta_artist
130     Print out the 'Artist' metadata of the current file.
132 get_meta_comment
133     Print out the 'Comment' metadata of the current file.
135 get_meta_genre
136     Print out the 'Genre' metadata of the current file.
138 get_meta_title
139     Print out the 'Title' metadata of the current file.
141 get_meta_track
142     Print out the 'Track Number' metadata of the current file.
144 get_meta_year
145     Print out the 'Year' metadata of the current file.
147 get_percent_pos
148     Print out the current position in the file, as integer percentage [0-100).
150 get_property <property>
151     Print out the current value of a property.
153 get_sub_visibility
154     Print out subtitle visibility (1 == on, 0 == off).
156 get_time_length
157     Print out the length of the current file in seconds.
159 get_time_pos
160     Print out the current position in the file in seconds, as float.
162 get_vo_fullscreen
163     Print out fullscreen status (1 == fullscreened, 0 == windowed).
165 get_video_bitrate
166     Print out the video bitrate of the current file.
168 get_video_codec
169     Print out the video codec name of the current file.
171 get_video_resolution
172     Print out the video resolution of the current file.
174 screenshot <value>
175     Take a screenshot. Requires the screenshot filter to be loaded.
176         0 Take a single screenshot.
177         1 Start/stop taking screenshot of each frame.
179 gui_[about|loadfile|loadsubtitle|play|playlist|preferences|skinbrowser|stop]
180     GUI actions
182 key_down_event <value>
183     Inject <value> key code event into MPlayer.
185 loadfile <file|url> <append>
186     Load the given file/URL, stopping playback of the current file/URL.
187     If <append> is nonzero playback continues and the file/URL is
188     appended to the current playlist instead.
190 loadlist <file> <append>
191     Load the given playlist file, stopping playback of the current file.
192     If <append> is nonzero playback continues and the playlist file is
193     appended to the current playlist instead.
195 loop <value> [abs]
196     Adjust/set how many times the movie should be looped. -1 means no loop,
197     and 0 forever.
199 menu <command>
200     Execute an OSD menu command.
201         up     Move cursor up.
202         down   Move cursor down.
203         ok     Accept selection.
204         cancel Cancel selection.
205         hide   Hide the OSD menu.
207 set_menu <menu_name>
208     Display the menu named <menu_name>.
210 mute [value]
211     Toggle sound output muting or set it to [value] when [value] >= 0
212     (1 == on, 0 == off).
214 osd [level]
215     Toggle OSD mode or set it to [level] when [level] >= 0.
217 osd_show_progression
218     Show the progression bar, the elapsed time and the total duration of the
219     movie on the OSD.
221 osd_show_property_text <string> [duration] [level]
222     Show an expanded property string on the OSD, see -playing-msg for a
223     description of the available expansions. If [duration] is >= 0 the text
224     is shown for [duration] ms. [level] sets the minimum OSD level needed
225     for the message to be visible (default: 0 - always show).
227 osd_show_text <string> [duration] [level]
228     Show <string> on the OSD.
230 panscan <-1.0 - 1.0> | <0.0 - 1.0> <abs>
231     Increase or decrease the pan-and-scan range by <value>, 1.0 is the maximum.
232     Negative values decrease the pan-and-scan range.
233     If <abs> is != 0, then the pan-and scan range is interpreted as an
234     absolute range.
236 pause
237     Pause/unpause the playback.
239 frame_step
240     Play one frame, then pause again.
242 pt_step <value> [force]
243     Go to the next/previous entry in the playtree. The sign of <value> tells
244     the direction.  If no entry is available in the given direction it will do
245     nothing unless [force] is non-zero.
247 pt_up_step <value> [force]
248     Similar to pt_step but jumps to the next/previous entry in the parent list.
249     Useful to break out of the inner loop in the playtree.
251 quit [value]
252     Quit MPlayer. The optional integer [value] is used as the return code
253     for the mplayer process (default: 0).
255 radio_set_channel <channel>
256     Switch to <channel>. The 'channels' radio parameter needs to be set.
258 radio_set_freq <frequency in MHz>
259     Set the radio tuner frequency.
261 radio_step_channel <-1|1>
262     Step forwards (1) or backwards (-1) in channel list. Works only when the
263     'channels' radio parameter was set.
265 radio_step_freq <value>
266     Tune frequency by the <value> (positive - up, negative - down).
268 seek <value> [type]
269     Seek to some place in the movie.
270         0 is a relative seek of +/- <value> seconds (default).
271         1 is a seek to <value> % in the movie.
272         2 is a seek to an absolute position of <value> seconds.
274 seek_chapter <value> [type]
275     Seek to the start of a chapter.
276         0 is a relative seek of +/- <value> chapters (default).
277         1 is a seek to chapter <value>.
279 switch_angle <value>
280     Switch to the angle with the ID [value]. Cycle through the
281     available angles if [value] is omitted or negative.
283 set_mouse_pos <x> <y>
284     Tells MPlayer the coordinates of the mouse in the window.
285     This command doesn't move the mouse!
287 set_property <property> <value>
288     Set a property.
290 set_property_osd <property> <value>
291     Same as above, but show the new value on the OSD in the standard
292     manner defined for that property (if any).
294 speed_incr <value>
295     Add <value> to the current playback speed.
297 speed_mult <value>
298     Multiply the current speed by <value>.
300 speed_set <value>
301     Set the speed to <value>.
303 step_property <property> [value] [direction]
304     Change a property by value, or increase by a default if value is
305     not given or zero. The direction is reversed if direction is less
306     than zero.
308 step_property_osd <property> [value] [direction]
309     Same as above, but show the new value on the OSD in the standard
310     manner defined for that property (if any).
312 stop
313     Stop playback.
315 sub_alignment [value]
316     Toggle/set subtitle alignment.
317         0 top alignment
318         1 center alignment
319         2 bottom alignment
321 sub_delay <value> [abs]
322     Adjust the subtitle delay by +/- <value> seconds or set it to <value>
323     seconds when [abs] is nonzero.
325 sub_load <subtitle_file>
326     Loads subtitles from <subtitle_file>.
328 sub_log
329     Logs the current or last displayed subtitle together with filename
330     and time information to ~/.mplayer/subtitle_log. Intended purpose
331     is to allow convenient marking of bogus subtitles which need to be
332     fixed while watching the movie.
334 sub_pos <value> [abs]
335     Adjust/set subtitle position.
337 sub_remove [value]
338     If the [value] argument is present and non-negative, removes the subtitle
339     file with index [value]. If the argument is omitted or negative, removes
340     all subtitle files.
342 sub_select [value]
343     Display subtitle with index [value]. Turn subtitle display off if
344     [value] is -1 or greater than the highest available subtitle index.
345     Cycle through the available subtitles if [value] is omitted or less
346     than -1. Supported subtitle sources are -sub options on the command
347     line, VOBsubs, DVD subtitles, and Ogg and Matroska text streams.
348     This command is mainly for cycling all subtitles, if you want to set
349     a specific subtitle, use sub_file, sub_vob, or sub_demux.
351 sub_source [source]
352     Display first subtitle from [source]. Here [source] is an integer:
353     SUB_SOURCE_SUBS   (0) for file subs
354     SUB_SOURCE_VOBSUB (1) for VOBsub files
355     SUB_SOURCE_DEMUX  (2) for subtitle embedded in the media file or DVD subs.
356     If [source] is -1, will turn off subtitle display. If [source] less than -1,
357     will cycle between the first subtitle of each currently available sources.
359 sub_file [value]
360     Display subtitle specifid by [value] for file subs. The [value] is
361     corresponding to ID_FILE_SUB_ID values reported by '-identify'.
362     If [value] is -1, will turn off subtitle display. If [value] less than -1,
363     will cycle all file subs.
365 sub_vob [value]
366     Display subtitle specifid by [value] for vobsubs. The [value] is
367     corresponding to ID_VOBSUB_ID values reported by '-identify'.
368     If [value] is -1, will turn off subtitle display. If [value] less than -1,
369     will cycle all vobsubs.
371 sub_demux [value]
372     Display subtitle specifid by [value] for subtitles from DVD or embedded
373     in media file. The [value] is corresponding to ID_SUBTITLE_ID values
374     reported by '-identify'. If [value] is -1, will turn off subtitle display.
375     If [value] less than -1, will cycle all DVD subs or embedded subs.
377 sub_scale <value> [abs]
378     Adjust the subtitle size by +/- <value> or set it to <value> when [abs]
379     is nonzero.
381 vobsub_lang
382     This is a stub linked to sub_select for backwards compatibility.
384 sub_step <value>
385     Step forward in the subtitle list by <value> steps or backwards if <value>
386     is negative.
388 sub_visibility [value]
389     Toggle/set subtitle visibility.
391 forced_subs_only [value]
392     Toggle/set forced subtitles only.
394 switch_audio [value] (currently MPEG*, AVI, Matroska and streams handled by libavformat)
395     Switch to the audio track with the ID [value]. Cycle through the
396     available tracks if [value] is omitted or negative.
398 switch_angle [value] (DVDs only)
399     Switch to the DVD angle with the ID [value]. Cycle through the
400     available angles if [value] is omitted or negative.
402 switch_ratio [value]
403     Change aspect ratio at runtime. [value] is the new aspect ratio expressed
404     as a float (e.g. 1.77778 for 16/9).
405     There might be problems with some video filters.
407 switch_title [value] (DVDNAV only)
408     Switch to the DVD title with the ID [value]. Cycle through the
409     available titles if [value] is omitted or negative.
411 switch_vsync [value]
412     Toggle vsync (1 == on, 0 == off). If [value] is not provided,
413     vsync status is inverted.
415 teletext_add_digit <value>
416     Enter/leave teletext page number editing mode and append given digit to
417     previously entered one.
418     0..9 - Append apropriate digit. (Enables editing mode if called from normal
419            mode, and switches to normal mode when third digit is entered.)
420     -    - Delete last digit from page number. (Backspace emulation, works only
421            in page number editing mode.)
423 teletext_go_link <1-6>
424     Follow given link on current teletext page.
426 tv_start_scan
427     Start automatic TV channel scanning.
429 tv_step_channel <channel>
430     Select next/previous TV channel.
432 tv_step_norm
433     Change TV norm.
435 tv_step_chanlist
436     Change channel list.
438 tv_set_channel <channel>
439     Set the current TV channel.
441 tv_last_channel
442     Set the current TV channel to the last one.
444 tv_set_freq <frequency in MHz>
445     Set the TV tuner frequency.
447 tv_step_freq <frequency offset in MHz>
448     Set the TV tuner frequency relative to current value.
450 tv_set_norm <norm>
451     Set the TV tuner norm (PAL, SECAM, NTSC, ...).
453 tv_set_brightness <-100 - 100> [abs]
454     Set TV tuner brightness or adjust it if [abs] is set to 0.
456 tv_set_contrast <-100 -100> [abs]
457     Set TV tuner contrast or adjust it if [abs] is set to 0.
459 tv_set_hue <-100 - 100> [abs]
460     Set TV tuner hue or adjust it if [abs] is set to 0.
462 tv_set_saturation <-100 - 100> [abs]
463     Set TV tuner saturation or adjust it if [abs] is set to 0.
465 use_master
466     Switch volume control between master and PCM.
468 vo_border [value]
469     Toggle/set borderless display.
471 vo_fullscreen [value]
472     Toggle/set fullscreen mode.
474 vo_ontop [value]
475     Toggle/set stay-on-top.
477 vo_rootwin [value]
478     Toggle/set playback on the root window.
480 volume <value> [abs]
481     Increase/decrease volume or set it to <value> if [abs] is nonzero.
484 The following commands are really only useful for OSD menu console mode:
486 help
487     Displays help text, currently empty.
489 exit
490     Exits from OSD menu console. Unlike 'quit', does not quit MPlayer.
492 hide
493     Hides the OSD menu console. Clicking a menu command unhides it. Other
494     keybindings act as usual.
496 run <value>
497     Run <value> as shell command. In OSD menu console mode stdout and stdin
498     are through the video output driver.
501 Available properties:
503 name               type      min     max     get set step comment
504 =================================================================
506 osdlevel           int       0       3       X   X   X    as -osdlevel
507 speed              float     0.01    100     X   X   X    as -speed
508 loop               int       -1              X   X   X    as -loop
509 pause              flag      0       1       X            1 if paused, use with pausing_keep_force
510 filename           string                    X            file playing wo path
511 path               string                    X            file playing
512 demuxer            string                    X            demuxer used
513 stream_pos         pos       0               X   X        position in stream
514 stream_start       pos       0               X            start pos in stream
515 stream_end         pos       0               X            end pos in stream
516 stream_length      pos       0               X            (end - start)
517 stream_time_pos    time      0               X            present position in stream (in seconds)
518 chapter            int       0               X   X   X    select chapter
519 chapters           int                       X            number of chapters
520 angle              int       0               X   X   X    select angle
521 length             time                      X            length of file in seconds
522 percent_pos        int       0       100     X   X   X    position in percent
523 time_pos           time      0               X   X   X    position in seconds
524 metadata           str list                  X            list of metadata key/value
525 metadata/*         string                    X            metadata values
526 volume             float     0       100     X   X   X    change volume
527 balance            float     -1      1       X   X   X    change audio balance
528 mute               flag      0       1       X   X   X
529 audio_delay        float     -100    100     X   X   X
530 audio_format       int                       X
531 audio_codec        string                    X
532 audio_bitrate      int                       X
533 samplerate         int                       X
534 channels           int                       X
535 switch_audio       int       -2      255     X   X   X    select audio stream
536 switch_angle       int       -2      255     X   X   X    select DVD angle
537 switch_title       int       -2      255     X   X   X    select DVD title
538 fullscreen         flag      0       1       X   X   X
539 deinterlace        flag      0       1       X   X   X
540 ontop              flag      0       1       X   X   X
541 rootwin            flag      0       1       X   X   X
542 border             flag      0       1       X   X   X
543 framedropping      int       0       2       X   X   X    1 = soft, 2 = hard
544 gamma              int       -100    100     X   X   X
545 brightness         int       -100    100     X   X   X
546 contrast           int       -100    100     X   X   X
547 saturation         int       -100    100     X   X   X
548 hue                int       -100    100     X   X   X
549 panscan            float     0       1       X   X   X
550 vsync              flag      0       1       X   X   X
551 video_format       int                       X
552 video_codec        string                    X
553 video_bitrate      int                       X
554 width              int                       X            "display" width
555 height             int                       X            "display" height
556 fps                float                     X
557 aspect             float                     X
558 switch_video       int       -2      255     X   X   X    select video stream
559 switch_program     int       -1      65535   X   X   X    (see TAB default keybind)
560 sub                int       -1              X   X   X    select subtitle stream
561 sub_source         int       -1      2       X   X   X    select subtitle source
562 sub_file           int       -1              X   X   X    select file subtitles
563 sub_vob            int       -1              X   X   X    select vobsubs
564 sub_demux          int       -1              X   X   X    select subs from demux
565 sub_delay          float                     X   X   X
566 sub_pos            int       0       100     X   X   X    subtitle position
567 sub_alignment      int       0       2       X   X   X    subtitle alignment
568 sub_visibility     flag      0       1       X   X   X    show/hide subtitles
569 sub_forced_only    flag      0       1       X   X   X
570 sub_scale          float     0       100     X   X   X    subtitles font size
571 tv_brightness      int       -100    100     X   X   X
572 tv_contrast        int       -100    100     X   X   X
573 tv_saturation      int       -100    100     X   X   X
574 tv_hue             int       -100    100     X   X   X
575 teletext_page      int       0       799     X   X   X
576 teletext_subpage   int       0       64      X   X   X
577 teletext_mode      flag      0       1       X   X   X    0 - off, 1 - on
578 teletext_format    int       0       3       X   X   X    0 - opaque,
579                                                           1 - transparent,
580                                                           2 - opaque inverted,
581                                                           3 - transp. inv.
582 teletext_half_page int       0       2       X   X   X    0 - off, 1 - top half,
583                                                           2- bottom half