OpenTV
|
OpenTV Template:Nasdaq is an interactive television company founded in 1996.
They sell a collection of set-top box operating systems and development tools used to provide interactive television. From an application developer’s point of view, it is a middleware software layer that defines a specific Application Programming Interface (API). The OpenTV API provides a large library of functions that can display graphics on the television screen, control audio/video services, accept and respond to user input, and communicate with the outside world. Communication to the outside world is done through medium-independent sockets that shield an application from details of the physical communication link being used. OpenTV communication protocols support one-way satellite broadcasts, full bi-directional links such as a modem or hard-wired serial port, and high-speed broadband networks.
OpenTV applications are written in ANSI C. ANSI C source code is compiled using the OpenTV development kit compiler gcco. The output from the compiler is called o-code. This is a portable language interpreted at runtime by the o-code interpreter executing on the set-top box. The o-code interpreter reads o-code functions and calls the corresponding native implementation of the routine. The same OpenTV application o-code can run on a variety of set-top boxes, even though the set-top boxes have different processors.
OpenTV is a compact, micro-kernel based operating system that is ported to the host real-time operating system of a set-top box using OpenTV’s Hardware Porting Kit (HPK). Development tasks involve writing code for a C compiler that outputs o-code. The SDK uses the gcco, compiler and other SDK Tools to create an application flow file. The application flow is then muxed with audio and video tracks and transmitted with other muxed tracks and application flows from the head-end to the set-top box in the viewer’s home. The set-top box separates the OpenTV application from the audio and video tracks and stores it in application memory (RAM). The OpenTV interpreter executes the application after it has been activated by the viewer.
The OpenTV programming model is an asynchronous message-based environment. OpenTV applications make o-code function calls to the OpenTV library. The library routines initiate operations or requests. They do not block until the operation has completed; they return immediately. When an operation or request completes, a message is sent to the application indicating completion. Applications consist primarily of a message loop, which retrieves messages from the single message queue. Messages are used for notification of external events, such as key presses on the remote control or completion of function call requests.
OpenTV applications consist of two or more modules: 1) The directory module contains information about the application and the other modules comprising the application. The directory module is required and must be transmitted before any other module. 2) One or more modules containing the application’s code and data. Modules contain either application o-code or application data. An application main module is automatically loaded by the set-top box. Other modules containing data and optionally executed code, such as error handling code, may be dynamically loaded by the application. Modules can be transmitted over the duration of the television program. This reduces the start-up time for OpenTV applications, and the memory size requirements for large, complex programs. Applications can be divided into smaller pieces (modules), which can be individually requested, loaded, used and unloaded as needed.
OpenTV application source code is edited on the development platform and is compiled and linked to create .otv files. C code is created using a standard text editor and compiled into o-code using the c to o-code compiler. The resulting .o file, which contains o-code, is run through several stages of linking to produce objects which are processed with a postlinker to reduce the size. This part of the process is similar to application development in other environments. However, the .otv file must be combined with control information that synchronizes its transmission to the set-top box with the regular TV audio and video signals. This stream of application data is known as a flow. The flow is ready to be multiplexed with audio and video stream to create a complete OpenTV broadcast stream. During the debugging cycle, the flow is used as is to download and test the interactive application over a blank screen, assuming that the TV signals are not essential to the functional behavior of the application.
/* * Displays Hello World on the TV screen, then * waits for Quit message, and exits. * */ #include "opentv.h" #include "classes.h" #include "texter.h" int main (void) { texter_resource hellodata = {"Hello OpenTV World\n", 1, 200, 300}; texter *hellotxt; O_debug ("Starting.\n"); /* Initialize ALL the gadget classes we use in this program */ init_texter_class (texter_ID); /* * Now create the text (string, color, x, y) */ hellotxt = (texter *) O_gadget_new( texter_ID, hello_world_ID, &hellodata ); /* set UIMS tree */ O_ui_set_root( hellotxt ); /* Activate gadget */ O_gadget_activate( hellotxt ); for ( ; ; ) { o_message msg; O_ui_get_event_wait ( &msg ); switch ( O_msg_class ( &msg )) { case MSG_CLASS_CONTROL : if( O_msg_type(&msg) == MSG_TYPE_QUIT ) { O_debug ("Quitting.\n"); O_exit (); } break; } } }
External links
- OpenTV Inc. (http://www.opentv.com)