[MPlayer-dev-eng] Synchronization of players in LAN

J.A. Gutierrez spd at shiva.cps.unizar.es
Tue Nov 25 20:59:55 CET 2003


On Thu, Nov 20, 2003 at 01:20:47PM +0100, Attila Kinali wrote:
> On Thu, 20 Nov 2003 10:14:24 +0100
> "J.A. Gutierrez" <spd at shiva.cps.unizar.es> wrote:
> 
> > 	I'm trying to synchronise several players running on several
> > 	computers connected to a dedicated 10/100 Ethernet switch. Each
> > 	one reads a different movie (video only) from its internal hard
> > 	disk, and resolution will be 768x576.
> 

> Mplayer does not sync against an external clock but syncs video to audio.
> RTC is only used for sleeping, nothing more. See mplayer.c:2205

	OK, I've reading the source, and it seems it does synchronize
	to system clock (providing the movie has no audio; which is
	perfect for my setup).

	In mplayer.c, it starts getting current time:

	total_time_usage_start=GetTimer();

	which in osdep/timer-lx.c calls gettimeofday(), which returns
	current time, which is fixed by NTP.

	Right after the "PLAY VIDEO" comment, it starts decoding
	video. It reads and decodes the frame; and then "It's time
	to sleep..." where calculates remaining time with
	time_frame-=GetRelativeTime();
	and if there is no sound, it will sleep for frame_time.


	

	So, this is what I've done so far:


	- Setup NTP for system clock synchronisation.

	- Add some network code to make an udp server.
	(two files, network.c/network.h)

	- Add some lines to mplayer.c so it:

		* On start will wait for an UDP broadcast packet.
		* Once the packet has arrived, will wait for the next second
		boundary (i.e. 0 == GetTimerMS() % 1000)


	- A minimal program which sends the broadcast packet.

	If there is someone interested I could make the files available.
	By now it seems good enough for me, but my in code in mplayer.c
	is really quick and dirty:
	
		* doesn't use options, it always wait for udp, and then
		for %1000 ms. Should use command line options.

		* uses RTC only.

		* about ten lines of new code.

-- 
finger spd at shiva.cps.unizar.es for PGP      /
.mailcap tip of the day:                   /             La vida es una carcel
application/ms-tnef; cat '%s' > /dev/null /           con las puertas abiertas
text/x-vcard; cat '%s' > /dev/null       /            (A. Calamaro)



More information about the MPlayer-dev-eng mailing list