dv1394d GNU/Linux DV Video Server

Copyright (C) 2003 Ushodaya Enterprises Limited
Authors: Dan Dennedy and Charles Yates


dv1394d is a DV video server implemented as a TCP daemon using the Linux 1394 dv1394 driver. Video servers are used by TV broadcasters as a digital playout system for the video to be broadcast. It is also used in live TV environment for news and sports especially as a clip store and on-demand clip playback system.

The server is capable of hosting multiple units (virtual VTRs) and performing simultaneous transmissions using dv1394 and private isochronous channels. Obviously, to maintain this level of throughput the server must have robust disk I/O, which it does, in what we call the dvpump subsystem. Besides the daemon, the package comes with a protocol specification, a client library and an example client.

At this time dv1394d does not support recording, and it does not transfer video files over the TCP network. We suggest NFS or Samba for the latter, and we plan to add recording capabilities. dv1394d provides very nice control over playback with trick play modes, in and out point settings on a clip, and seamless switching and loading in the midst of playback. There is preliminary support for server-side playlists. In the meantime, there is a fairly accurate timecode and transport status feedback mechanism that provides updates whenever the server state changes.



Download the latest stable version
Unpack it:
tar xvfz dv1394d-0.2.1.tar.gz

( run ./bootstrap to regenerate the configure script)
sudo make install

The installer installs the daemon dv1394d to the $(prefix)/sbin directory/ The prefix is usually /usr/local. It also installs libtool libraries to $(prefix)/lib and headers to $(prefix)/include. The libraries are used to build a dv1394d client or complete non-TCP-daemon instance of the dv1394d engine as a utility.


	dv1394d takes the following options:
	-port {number}        Run the daemon listening on a port.
	                      The default is port 5250.
	-proxy {host}[:port]  Run this tcp daemon as a proxy to the real dv1394d
	                      running at host on port.
	-test                 Run this server interactively within the console
	                      sending all log output to stderr instead of syslog.

dv1394d comes with a demonstration client, but it is not installed. Run it from demo/client. It is interactive to guide you. This is the best way to quickly see dv1394d's capabilities.

The dv1394 kernel module must be loaded. dv1394d is hard-coded at this time to use the dv1394 devfs device file names. So, you must create them manually if you are not using devfs:
/dev/ieee1394/dv/host0/NTSC/in c 171 32
/dev/ieee1394/dv/host0/NTSC/out c 171 33
/dev/ieee1394/dv/host0/PAL/in c 171 34
/dev/ieee1394/dv/host0/PAL/out c 171 35
dv1394d supports mutliple ports (1394 host adapters or multi-port host adapters--this is unrelated to physical connectors).

dv1394d reads its configuration from /etc/dv1349d.conf. This file is simply a batch of DVCP commands (doc/dvcp.txt). Comment and empty lines can be added. A comment line has a # in the first column position. Hint: one can add a unit to the server even if the device is not online.

syslog: dv1394d logs information to syslog using the daemon facility. It reserves LOG_INFO (6) for recording each command sent and its result. LOG_NOTICE (5) is used to record server startup and shutdown; clients connecting and disconnecting; and units added, gone offline, and come online. LOG_WARNING, LOG_ERR, and LOG_CRIT are used for obvious reasons. LOG_DEBUG (7) is also used quite a bit, so you may want to configure syslogd to filter out the debug messages or just send them to an xconsole.

Getting Started

After starting the server and connecting with a protocol level client such as telnet or testlocal, the first thing to do is to configure the server. Then, you will know what to put into your /etc/dv1394d.conf file to configure it automatically. First, run the NLS command to get a list of AV/C Tape Recorder Subunit compliant devices on the IEEE 1394 bus. The output contains a 16 character hexadecimal GUID (globally unique identifier). For the device to add as a dv1394d unit, use the UADD command with the GUID of the device as its argument. UADD returns the unit identifier, which should be "U0" for the first unit added.

dv1394d must set a special register on the device for the corresponding unit to tell it which isochronous channel over which to receive the DV stream. If the register does not exist on the device, then dv1394d will fallback to using the standard broadcast channel of 63. Most camera devices do not implement this register and can only work on channel 63. Therefore, it is possible to make dv1394d work with 2 units as long as at least one of them has the channel register. You can review the log output to detect this situation. It will say at LOG_WARNING (4) priority "Failed to get the iMPR plug for node 0." and at LOG_NOTICE (5) priority "Using broadcast channel for node X."

WARNING: When you add a unit, dv1394d sends am AV/C record command to the device. This will initialize most DV/Analog converters to their proper state. However, using a VTR or camera with a tape loaded, you might accidentally overwrite some footage on the tape!

At this point you can add more units or continue. It is useful to know that UADD lets you add a unit for a device that does not currently exist on the 1394 bus--this is a feature. If the device does not exist, then the unit is added, but in an offline state, making it basically useless. If you later add the unit, then dv1394d automatically detects it and puts the corresponding unit into an online state. This lets one designate particular devices and unit identifiers to be "program" and "preview" units. Next, run the ULS command to see the configured units. The last column of the output is a flag (0/1) to indicate if it is online.

The next thing to do is to load the server with some raw DV files and configure the server root. At this time, dv1394d only reads raw DV files and not Quicktime or AVI formats. If you keep your DV files organized under a single subdirectory, then you should configure the dv1394d server root to make accessing clips more convenient. The server root is a configuration property that is configured using the generic SET command for server properties. The property name is ROOT (case insensitive): e.g.,
SET root=/var/dv1394d/
The default value for ROOT is, of course, "/". Verify the server can see the loaded clips using the CLS command with "/" as the argument.

To make dv1394d actually do something interesting, load a clip and play it. First, use the LOAD command supplying the unit identifier as its first argument and the clip's filename (relative to ROOT) as its second argument. If the file name contains a space, surround it with double quotation marks. Next, issue the PLAY command using the unit identifier as argument. You should see video output to an analog monitor connected to your DV device or in the viewfinder of a camera.

Finally, use the BYE command to disconnect the client. Send a SIGINT, SIGTERM, SIGHIP, or SIGSTOP to dv1349d to stop the server: e.g., killall dv1394d

Next Steps

Experiment using the protocol documentation to see what else you can do! Run the demo/client to see the capabilities of both the server and the client API. While doing so, view the log output of dv1394d (running in perhaps -test mode) to the commands being issued as you perform operations. Read doc/api.txt and the source code demo/client.c to learn about the developing a custom client.