Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#

MOS Protocol Fundamentals

Rate me:
Please Sign up or sign in to vote.
4.52/5 (15 votes)
1 Apr 2009CPOL3 min read 56.5K   16   10
MOS protocol from introduction to implementation

Table of Contents

Introduction 

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 Fundamentals 

What is MOS

MOS is a device capable of storing media objects. Media Object refers to Character Generator Objects: CGs, Still Store, Audio and Video.

What is MOS Protocol

MOS protocol is an XML-based protocol used to communicate between NCS (News Room Computer System) and MOS device.

Need of MOS Protocol

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.

Exchange of Data between NCS 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.

mospic1.JPG

MOS Workflow 

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.

workflow.JPG

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.

XML
<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>

MOS Implementation

Since MOS Protocol is an XML based protocol, its implementation is done in the standard way of XML data exchange. 

Basic Strategy

There are many MOS XML messages, e.g. <heartbeat>, <roCreate>, <roStorySend>, <roStoryMove>, etc. and for each message, we use the following strategy:

  1. Create a class that confirms one of the MOS XML message 
  2. Create object of that class and set its properties  
  3. Serialize that object to get the MOS XML message
  4. Convert MOS XML message into stream
  5. Send stream using TCP connection to MOS Device 

An Example using C# .NET 2.0  

We will create the <heartbeat> message and send it to MOS Device. <heartbeat> message is used to verify network and application continuity. 

  1. Create a MOS and heartbeat classes that confirms one of the MOS XML message:
    C#
    //<mos> 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; }
            }
        }
    }
    C#
    //heartbeat message
    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; }
            }
        }
    } 
  2. Create object of mos and set its properties:
    C#
    HeartBeat heartbeat = new cHeartBeat();
    heartbeat.time = DateTime.Now;
    
    //create MOS message and set its heartbeat property
    cMOS mos = new cMOS();
    mos.messageID = 333;
    mos.mosID = "MOSDEVICEID";
    mos.ncsID = "NCSID";
    mos.heartbeat = heartbeat;      
  3. Serialize object into memory stream:
    C#
    //serialize MOS object
    MemoryStream ms = new MemoryStream();
    XmlSerializer xml = new XmlSerializer(typeof(cMOS));
    xml.Serialize(ms, mos);          
  4. Send the stream to MOS device over TCP connection:
    C#
    //create TCP connection with MOS device
    TcpClient mosClient = new TcpClient("10.1.0.94", 10641);
             
    //write MOS object stream to MOS device
    mosClient.GetStream().Write(ms.GetBuffer(),0,ms.GetBuffer().Length);

Reference  

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Chief Technology Officer Neuron Management Services
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionSample Code! Pin
Member 999568816-Feb-18 3:28
Member 999568816-Feb-18 3:28 
GeneralMy vote of 1 Pin
Member 1102269131-Aug-15 8:29
Member 1102269131-Aug-15 8:29 
QuestionThanks Pin
domanz11119-May-12 1:30
domanz11119-May-12 1:30 
GeneralMy vote of 5 Pin
rameshmelam5-Jan-12 9:20
rameshmelam5-Jan-12 9:20 
GeneralMy vote of 1 Pin
mxprml20-Oct-10 21:48
mxprml20-Oct-10 21:48 
incomplete, no code
QuestionSample code Pin
karak26-Apr-09 19:57
karak26-Apr-09 19:57 
AnswerRe: Sample code Pin
Rizwan Qureshi28-Apr-09 19:53
Rizwan Qureshi28-Apr-09 19:53 
GeneralRe: Sample code Pin
Member 999568824-May-19 7:38
Member 999568824-May-19 7:38 
GeneralInteresting reading Pin
SrdjanMK1-Apr-09 6:44
SrdjanMK1-Apr-09 6:44 
GeneralRe: Interesting reading Pin
Rizwan Qureshi1-Apr-09 6:57
Rizwan Qureshi1-Apr-09 6:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.