Table of Contents
My inspiration for writing this article is based on my experience. When I started working on MOS protocol, I found myself nowhere on the web. There was only one site www.mosprotocol.com (the official site for MOS protocol and perhaps the only one). I decided then that I would share my experience and thoughts once I implement this.
MOS is a device capable of storing media objects. Media Object refers to Character Generator Objects: CGs, Still Store, Audio and Video.
MOS protocol is an XML-based protocol used to communicate between NCS (News Room Computer System) and MOS device.
News Room Computer System automates that operation of News Room operation that includes script writing/editing to broadcast content. This process includes many devices and each device vendor has his set of protocol to talk to NCS.
The tremendous growth of media industry inspires broadcast industry to introduce a standard protocol for the communication between NRCS and MOS devices.
MOS Protocol allows Newsroom Computer Systems (NCS) and Media Object Servers (MOS) to exchange information using a standard protocol. This protocol enables the exchange of the following type of messages:
1. Descriptive Data for Media Objects
The MOS "pushes" descriptive information and pointers to the NCS as objects are created, modified, or deleted in the MOS. This allows the NCS to be "aware" of the contents of the MOS and enables the NCS to perform searches on and manipulate the data the MOS has sent.
2. Playlist Exchange
The NCS can build and transfer playlist information to the MOS. This allows the NCS to control the sequence in which media objects are played or presented by the MOS.
3. Status Exchange
The MOS can inform the NCS of the status of specific clips or the MOS system in general. The NCS can notify the MOS of the status of specific playlist items or running orders.
Let me share the basic workflow of information exchange between NCS and MOS devices. NCS contain data in the form of Rundown objects (sometime called Runorder as well). A single Rundown can contain multiple stories and a single story can have multiple items. Each item corresponds to media objects, i.e. CGs, video file, audio file or still graphics.
NCS associate metadata to these items. Metadata information includes type, path, time to play and time length, etc.
Example: A Video Item Metadata
FileName: inauguration.mpeg
StartTime: 12:30:35 10-02-2009
Duration:00:10:30
Video Serve: MOSDEVICE
NCS transform this metadata into MOS compliant XML and send it to MOS devices using TCP connection. In return, MOS devices send MOS XML responses to NCS.
A sample MOS XML message of the above metadata.
<mos>
<mosID>MOSDEVICE</mosID>
<ncsID>NCS</ncsID>
<messageID>507891</messageID>
<roStorySend>
<roID>96857485</roID>
<storyID>5983A501:0049B924:8390EF1F</storyID>
<storySlug>Show Open</storySlug>
<storyNum>C8</storyNum>
<storyBody>
<storyItem>
<itemID>1</itemID>
<itemSlug>Hotel Fire vo</itemSlug>
<objID> inauguration</objID>
<mosID>testmos</mosID>
<itemEdStart>12:30:35 10-02-2009</itemEdStart>
<itemEdDur>00:10:30</itemEdDur>
</roStorySend>
</mos>
Since MOS Protocol is an XML based protocol, its implementation is done in the standard way of XML data exchange.
There are many MOS XML messages, e.g. <heartbeat>
, <roCreate>
, <roStorySend>
, <roStoryMove>
, etc. and for each message, we use the following strategy:
- Create a class that confirms one of the MOS XML message
- Create object of that class and set its properties
- Serialize that object to get the MOS XML message
- Convert MOS XML message into stream
- Send stream using TCP connection to MOS Device
We will create the <heartbeat>
message and send it to MOS Device. <heartbeat>
message is used to verify network and application continuity.
- Create a MOS and
heartbeat
classes that confirms one of the MOS XML message:
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace mosprotocol
{
[XmlRoot("mos")]
public class cMOS
{
string _mosID, _ncsID;
long _messageID;
cHeartBeat _heartbeat;
public string mosID
{
get {return _mosID; }
set { _mosID = value; }
}
public string ncsID
{
get { return _ncsID; }
set { _ncsID = value; }
}
public long messageID
{
get { return _messageID; }
set { _messageID = value; }
}
public cHeartBeat heartbeat
{
get { return _heartbeat; }
set { _heartbeat = value; }
}
}
}
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Xml.Serialization;
namespace mosprotocol
{
[XmlRoot("heartbeat")]
public class cHeartBeat
{
DateTime _time;
public DateTime time
{
get { return _time; }
set { _time = value; }
}
}
}
- Create object of
mos
and set its properties:
HeartBeat heartbeat = new cHeartBeat();
heartbeat.time = DateTime.Now;
cMOS mos = new cMOS();
mos.messageID = 333;
mos.mosID = "MOSDEVICEID";
mos.ncsID = "NCSID";
mos.heartbeat = heartbeat;
- Serialize object into memory stream:
MemoryStream ms = new MemoryStream();
XmlSerializer xml = new XmlSerializer(typeof(cMOS));
xml.Serialize(ms, mos);
- Send the stream to MOS device over TCP connection:
TcpClient mosClient = new TcpClient("10.1.0.94", 10641);
mosClient.GetStream().Write(ms.GetBuffer(),0,ms.GetBuffer().Length);