[MPlayer-DOCS] r32066 - in trunk: AUTHORS DOCS/man/en/mplayer.1 DOCS/xml/en/usage.xml Makefile cfg-mplayer.h help/help_mp-en.h mplayer.c udp_sync.c udp_sync.h

reimar subversion at mplayerhq.hu
Wed Sep 8 07:29:05 CEST 2010


Author: reimar
Date: Wed Sep  8 07:29:05 2010
New Revision: 32066

Log:
Add synchronization of multiple MPlayer instances over UDP.
Patch by Jason Holt [jholt google com]

Modified:
   trunk/DOCS/man/en/mplayer.1
   trunk/DOCS/xml/en/usage.xml
   trunk/help/help_mp-en.h

Changes in other areas also in this revision:
Added:
   trunk/udp_sync.c
   trunk/udp_sync.h
Modified:
   trunk/AUTHORS
   trunk/Makefile
   trunk/cfg-mplayer.h
   trunk/mplayer.c

Modified: trunk/DOCS/man/en/mplayer.1
==============================================================================
--- trunk/DOCS/man/en/mplayer.1	Wed Sep  8 01:46:14 2010	(r32065)
+++ trunk/DOCS/man/en/mplayer.1	Wed Sep  8 07:29:05 2010	(r32066)
@@ -1195,6 +1195,34 @@ Skip <sec> seconds after every frame.
 The normal framerate of the movie is kept, so playback is accelerated.
 Since MPlayer can only seek to the next keyframe this may be inexact.
 .
+.TP
+.B \-udp\-ip <ip>
+Sets the destination address for datagrams sent by the \-udp\-master.
+Setting it to a broadcast address allows multiple slaves having the same
+broadcast address to sync to the master (default: 127.0.0.1).
+.
+.TP
+.B \-udp\-master
+Send a datagram to \-udp\-ip on \-udp\-port just before playing each frame.
+The datagram indicates the master's position in the file.
+.
+.TP
+.B \-udp\-port <port>
+Sets the destination port for datagrams sent by the \-udp\-master, and the
+port a \-udp\-slave listens on (default: 23867).
+.
+.TP
+.B \-udp\-seek\-threshold <sec>
+When the master seeks, the slave has to decide whether to seek as
+well, or to catch up by decoding frames without pausing between frames.
+If the master is more than <sec> seconds away from the
+slave, the slave seeks.
+Otherwise, it "runs" to catch up or waits for the master.
+This should almost always be left at its default setting of 1 second.
+.
+.TP
+.B \-udp\-slave
+Listen on \-udp\-port and match the master's position.
 .
 .
 .SH "DEMUXER/STREAM OPTIONS"

Modified: trunk/DOCS/xml/en/usage.xml
==============================================================================
--- trunk/DOCS/xml/en/usage.xml	Wed Sep  8 01:46:14 2010	(r32065)
+++ trunk/DOCS/xml/en/usage.xml	Wed Sep  8 07:29:05 2010	(r32066)
@@ -686,9 +686,69 @@ change the default operation which is to
 </sect2>
 </sect1>
 
-
 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
+<sect1 id="networksync" xreflabel="Network Synchronized Playback">
+<title>Synchronized playback over a network</title>
+
+<para>
+Multiple instances of <application>MPlayer</application> can synchronize
+playback over a network. This is useful for creating "video walls" with
+multiple screens controlled by different computers. Each
+<application>MPlayer</application> instance can
+play a different video, but they all will try to stay at the same time offset
+in the file. It is recommended but not necessary to encode the video files
+using the same codec and parameters.
+</para>
+
+<para>The relevant options are <option>-udp-master</option>,
+  <option>-udp-slave</option>, <option>-udp-ip</option>,
+  <option>-udp-port</option>, and <option>-udp-seek-threshold</option>.
+</para>
+
+<para>
+If <option>-udp-master</option> is given, <application>MPlayer</application>
+sends a datagram to <option>-udp-ip</option> (default: 127.0.0.1)
+on <option>-udp-port</option> (default: 23867) just before playing each frame.
+The datagram indicates the master's position in the file. If
+<option>-udp-slave</option> is given, <application>MPlayer</application> listens on
+<option>-udp-ip</option>/<option>-udp-port</option>
+and matches the master's position. Setting <option>-udp-ip</option> to the
+master's broadcast address allows multiple slaves having the same broadcast
+address to sync to the master.  Note that this feature assumes an
+ethernet-like low-latency network connection.  Your mileage may vary on high
+latency networks.
+</para>
+
+<para>
+For example, assume 8 computers are on a network, with IP addresses 192.168.0.1
+through 192.168.0.8. Assume the first computer is to be the master. Running
+ifconfig on all the machines lists "Bcast:192.168.0.255". On the master, run:
+</para>
+
+<screen>
+mplayer -udp-master -udp-ip 192.168.0.255 video1.mpg
+</screen>
+
+<para>
+On each slave, run:
+</para>
+
+<screen>
+mplayer -udp-slave videoN.mpg
+</screen>
+
+<para>
+Seeking, pausing and even playback speed adjustment (see the
+<option>-input</option> option) can be done on the master, and all the slaves
+will follow. When the master exits, it sends out a "bye" message which causes
+the slaves to exit as well.
+</para>
+
+</sect1>
+</chapter>
+
+<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -->
 
 <sect1 id="advaudio-surround">
 <title>Surround/Multichannel playback</title>

Modified: trunk/help/help_mp-en.h
==============================================================================
--- trunk/help/help_mp-en.h	Wed Sep  8 01:46:14 2010	(r32065)
+++ trunk/help/help_mp-en.h	Wed Sep  8 07:29:05 2010	(r32066)
@@ -180,6 +180,8 @@ static const char help_text[]=
 #define MSGTR_DvdnavNavSpuClutChange "DVDNAV Event: Nav SPU CLUT Change\n"
 #define MSGTR_DvdnavNavSeekDone "DVDNAV Event: Nav Seek Done\n"
 #define MSGTR_MenuCall "Menu call\n"
+#define MSGTR_MasterQuit "Option -udp_slave: exiting because master exited\n"
+#define MSGTR_InvalidIP "Option -udp-ip: invalid IP address\n"
 
 // --- edit decision lists
 #define MSGTR_EdlOutOfMem "Can't allocate enough memory to hold EDL data.\n"


More information about the MPlayer-DOCS mailing list