News Archive (1999-2012) | 2013-current at LinuxGizmos | Current Tech News Portal |    About   

ELJonline: The Linux4.TV Set-Top Box Open Source Project

Jan 1, 2002 — by LinuxDevices Staff — from the LinuxDevices Archive — 11 views

Here are the details on the new Linux4.TV development kit we're giving away in our development contest. Find out about MPEG playback, video capture, HTML-based interface and more.

Linux is being used in an increasing array of devices outside its origins of desktop and server systems. Enhanced multimedia capabilities, combined with continuing development and support for advanced state-of-the-art hardware, have enabled Linux to be used in TVs and set-top boxes. In this article, I describe a project that I've been involved with for the past year: implementing an open-source, Linux-based, set-top box platform, known as the Linux4.TV Project (www.linux4.tv). Century Embedded Technologies and National Semiconductor Corporation have collaborated to produce Linux4.TV, a completely open-source, open-architecture, set-top box platform with support for digital and audio tuners, DVD, streaming video and other features.

System Architecture

National's Geode SP1SC10 demonstration platform was used as the hardware platform for the first implementation. The Geode SP1SC10 platform CPU is the 266MHz National Geode SC1200, featuring an x86-compatible 32-bit instruction set, MMX support, 2-D graphics acceleration, an integrated NTSC/PAL controller and a CCIR-656-compatible video input port for full-screen video display. The motherboard also hosts a Philips SAA7114 chip for analog NTSC and S-Video input decoding, as well as a Sigma Designs EM8400 chip for real-time hardware decoding of MPEG-2 digital video streams. A block diagram of the SC1200 CPU is shown in Figure 1, and the SP1SC10 platform architecture in Figure 2.

Figure 1. National Semiconductor Geode SC1200 Architecture

This system design allows various analog and digital video inputs to be decoded and routed into the video input processor component of the CPU, where the video data can be scaled, alpha-blended and merged with graphical data from standard framebuffer memory. In this way, windowing systems, widget sets, browsers and other application software can run normally, with the graphics data output combined in real time with the desired video stream by the CPU and other components. The system's software design takes advantage of this architecture allowing applications to be integrated with few, if any, modifications to work with the video subsystem.

Figure 2. Geode STB Platform Architecture

National has developed a lower-cost development platform to replace SP1SC10, allowing more people access to STB technology for evaluation and development. The new board, available later this winter, will be completely open, with the full schematics and technical descriptions available on Linux4.TV. Two PCI-compatible slots also will be included, allowing easy customization of the system with additional chips, such as the Geode CS13x0 multimedia coprocessors.

In addition, several other vendors have platforms based on the Geode SC1200, and porting of the Linux4.TV code is in process. These vendors include VT Media Technologies and Cocom Group. Advantages of third-party vendors include a variety of form factors for set-top box deployment.

Software Architecture

National Semiconductor has invested a large amount of time and money into the development of software technologies running on Geode processors and the SP1SC10 platform and is interested in making these technologies available to the Open Source community. National's Open Source philosophy is represented well by the Linux4.TV Project, in that all of the software running on the demonstration platform is available on the Linux4.TV site, with complete API specifications and documentation.

There are four major layers in the software architecture, as shown in Figure 3: kernel and device driver, Video Middleware, windowing system and WebMedia/applications layers. National Semiconductor contributed the kernel drivers and Video Middleware layers, with Century contributing the WebMedia user interface, windowing system, applications layer and overall distribution. The complete distribution is available both as a bootable system image and as a complete source tree. Following are more technical descriptions of each layer.

Figure 3. Linux4.TV Software Architecture

Kernel and Device-Driver Layer

The lowest-level software is linked with the kernel as various device drivers and provides low-level chip support for the Geode SC1200 CPU, Sigma Designs MPEG-2 decoder and the Philips SAA7114 NTSC decoder. A number of other drivers are included for the MacPHYTER network interface and stereo audio I/O as well. The kernel is based on version 2.4.3 and uses utilities and the filesystem design from Red Hat 6.2. At boot time, the system performs a normal Linux boot, executes device-driver initialization code, initializes the framebuffer to an NTSC or PAL-compatible screen size and then executes the /etc/rc startup script. There are a number of device drivers that must be available to the Linux operating system in order to provide the level of hardware support needed for the National API. These drivers include audio, video, DVB, DVD, video capture and graphics. In addition, supplementary drivers are needed to provide full support for MPEG, DVD and DVB demultiplexers.

Video Middleware Layer

The mid-level layer executes in user mode and implements the device-independent Video Middleware API used to provide a standard interface to the hardware included in the set-top box. The API includes functionality for controlling analog and digital video, selecting the video input, tuner channel selection, DVD, satellite DVB demultiplexing, video blanking interrupt and overlay capabilities. National's Video Middleware uses the Linux Video 4 Linux Two API underneath for interfacing with the kernel drivers. This layer abstracts the operating system and underlying hardware from the application program. Thus, the application programmer need not know which IOCTL for the sound driver sets its frequency; instead, a function call similar to AUD_SetFrequency( ) is used, which in turn communicates with the audio driver. The details of the driver interface are abstracted from the programmer. Following are descriptions of some of the functional areas of the Video Middleware API.

Audio Subsystem

The audio subsystem API uses an abstract device called an audio player to control the playback of multiple applications while masking the differences of underlying hardware implementations. With audio players, applications are assured of consistent audio playback, regardless of the features or limitations of the target audio device. Audio also includes CD-ROM audio support for playing tracks from an audio CD (a CD-ROM is considered an audio source when an audio CD is inserted).

Video Capture Subsystem

The video capture API enables applications to capture single or multiple frames of live video in real time and save them to a pixel map in graphics memory. Applications can then manipulate the captured images using the functionality of the graphics subsystem or other image-processing facilities.

Overlay Subsystem

The overlay subsystem APIs used in concert with the graphical-windowing system provide arbitration across multiple applications and control which applications are visible. In addition, the overlay subsystem provides a mechanism to overlay graphical information from the graphics subsystem over video.

MPEG Subsystem

The MPEG transport APIs provide traffic management of MPEG transport streams for digital video. MPEG transport streams are multiprogram data streams of interleaved digital video, audio and data. This API receives MPEG transport streams containing encoded content from the network and extracts the desired program from them. It then separates the audio, video and data components and routes them to the audio decoder, video decoder and CPU RAM, respectively.

TV Subsystem

The TV subsystem API provides a consistent interface to analog and digital broadcast services, so applications developed for one service easily can be extended to work with other services. The TV API also provides functionality that lets end users control interactive TV sets in familiar ways, such as changing the channels and adjusting volume.

Graphical Windowing System

Microwindows is used as the graphical windowing system, which easily integrates with the NTSC or PAL-compatible framebuffer provided by the kernel. A nice feature of the set-top box design is that the windowing system is not tied heavily to the hardware video functions. The windowing system primarily supports WebMedia and the applications layers, which use color keying and Video Middleware API calls in order to interface with video functions. Color keying works by drawing a rectangle in a special color using a standard graphical API, with the Geode's video overlay processor combining the video stream into the framebuffer contents defined by the color-keyed area. Thus, positioning or resizing the video stream is straightforward. WebMedia's use of FLTK allows the X Window System to be used as the windowing system, if desired.

WebMedia and Applications Layer

The top layer includes all applications software as well as Century's WebMedia, which provides the user interface for the set-top box. WebMedia allows the user interface to be created entirely in HTML, utilizing plugin modules to interface from HTML to the Video Middleware subsystem. The graphical interface is created by providing an HTML representation of the desired display using images combined with an included script to call a plugin module on associated events. Included in WebMedia is an integrated web browser, allowing easy internet access by the set-top box user. A screenshot showing a sample user interface is shown in Figure 4.

figure

Figure 4. Sample WebMedia HTML-Based User Interface

WebMedia is a modified version of the ViewML internet browser and uses the FLTK widget set, which allows it to be portable on Microwindows and the X Window System. Because the Video Middleware is separated from the graphical windowing system, it is relatively easy to switch windowing systems. Integrating another browser with the system is straightforward, using the extension mechanism described below.

The entire user interface for the set-top box is written in HTML, which includes both the full-screen viewing and menu-button operations. This allows the set-top box look and feel to be customized easily. Two mechanisms are used to integrate video into the display. The first mechanism involves an extension to the HTML Anchor feature, which allows a specified WebMedia plugin to execute using parameters contained in the anchor tag. For instance, the following HTML causes the DVD plugin to execute a rewind request:

When remote-control arrow keys are pressed, WebMedia outlines successive images associated with anchor tags, allowing the remote control to be used as a pointing device. The prebuilt WebMedia DVD plugin will execute when the remote control is used to select the rewind.gif image. The prebuilt plugins call the Video Middleware API to control the STB hardware functions. Other commands are used to position and scale the video. The second mechanism maps a video stream to the display screen, using the overlay API. A special RGB color is displayed normally on the screen using an HTML image, and color keying is used to merge the video data with the framebuffer contents. This is performed in real time directly by the Geode SC1200 CPU.

In normal operation, the Linux4.TV set-top box runs WebMedia as the controlling application, with HTML specifying a variety of plugins to control the video system integration and user interface. In this manner, the set-top box user interface and total system operation are easily customized for a variety of applications.

Linux4.TV

Resources



About the author: When not at the office detailing plans for building new-age PDA applications technologies, Greg Haerr sits at home in front of his terminal enhancing Microwindows. Greg is CEO of Century Software and the chief maintainer of the Microwindows Project. He can be reached at [email protected].



Copyright © 2001 Specialized Systems Consultants, Inc. All rights reserved. Embedded Linux Journal Online is a cooperative project of Embedded Linux Journal and LinuxDevices.com.

 
This article was originally published on LinuxDevices.com and has been donated to the open source community by QuinStreet Inc. Please visit LinuxToday.com for up-to-date news and articles about Linux and open source.



Comments are closed.