Media Controller Support for Digital Video Broadcasting1

本文介绍了Digital Video Broadcasting (DVB)设备的基本组件及其在Linux内核中的API实现方式,包括前端、解复用器等关键部件的交互过程,并讨论了不同类型设备的数据流管道配置。

https://lwn.net/Articles/646638/rss?format=printable



May 8, 2015 - Mauro Carvalho Chehab

Media Controller Support for Digital Video Broadcasting

Supporting embedded Digital TV hardware is complex, considering that such hardware generally has multiple components that can be rewired in runtime to dynamically change the stream pipelines and provide flexibility for things like recording a video stream, then tuning into another channel to see a different program. This article describes how the DVB pipelines are setup and the needs that should be addressed by the Linux Kernel. This introduction will lead into the next article in this series, which will describe how the media subsystem is being improved to support such needs.

Digital TV devices

A Digital TV device consists of a set of hardware blocks. The basic components are:

Tuner – Tunes into a physical frequency (tuner), and outputs the channel on an Intermediate Frequency (IF).

Demodulator (a. k. a. demod) – Gets an IF, decodes the sub-carrier(s) content, and outputs the resulting MPEG-TS stream. It is specific for a given set of DTV standards.

Demultiplexer (a. k. a. demux) – Filters the MPEG-TS and extracts video, audio, and other data information, like subtitles, Electronic Program Guide, etc. The demux may also extract TCP/IP packets from the MPEG-TS and send them via a Linux network interface

Satellite devices also have a Satellite Equipment Control (SEC), which controls external components of the antenna subsystem like DiSEqC switches, LNBf, rotors, etc.

Please note:

    • Inexpensive/low-end devices don’t have a demux. The Linux Kernel emulates it in such cases.
    • Some devices may have a MPEG-TS multiplexer (for TCP/IP data send) and Conditional Access Module support (for Digital Rights Management).

Figure 1: Media device block diagram

 

Digital TV Front End

The DTV front end consists of several sub-devices including tuner, demod, low noise amplifiers (LNBf, LNA) that can be coupled at the antenna system and SEC.

Its functions include:

  • Tuning into a physical channel
  • Demodulating the channel data
  • Controlling the satellite and signal amplifiers

On Digital TV, tuning into a channel is a tightly-coupled operation:

  • The IF used by the demod and tuner should be the same.
  • The tuner filters should be optimized to the digital TV standard in use.
  • On some devices, in order to increase the quality of the signal the demod should control the tuner and amplifier gain, and set bandwidth filters dynamically.
  • On some satellite devices, the same hardware component will contain all 3 functions (tuner, demodulator and SEC).
  • On many devices, a FPGA or micro-controller handles both tuner and demod. In such cases, the tuner is not directly visible, but instead, a higher-level API is exposed. Additionally the FPGA/firmware receives the frequency and other parameters via the front end, and commands the tuner together with the demod to obtain optimized tuning.

The Linux DVB API was designed to expose the front end as a single entity. Yet, it might be necessary to expose the sub-devices in the future to allow direct control of the tuner, SEC, and low noise amplifiers.

MPEG-TS

Figure 2: MPEG-TS Container Example

The basic structure of most digital TV standards is the MPEG Transport Stream (MPEG-TS). The Transport Stream is a mechanism of encapsulating and multiplexing several different streams into a single stream. Each individual stream is called an Elementary Stream, and is identified via unique Packet ID (PID), as shown inFigure 2.

Linux Kernel Digital TV APIs

There are several device nodes for Digital TV to control hardware components:

/dev/dvb/adapter?/frontend? – The Front End API controls the tuner, demod and SEC

/dev/dvb/adapter?/ca? – The CA API controls the conditional access module

/dev/dvb/adapter?/demux? – The demux API controls the demux

In addition, there are other device nodes, such as:

/dev/dvb/adapter?/dvr? – Controls the MPEG-TS filtered output

/dev/dvb/adapter?/net? – Controls the MPEG-TS filter for a network adapter

Digital TV data flow pipelines

The Linux DVB API is used to control data flow. The tuner and demod are typically hardwired, and filters are dynamically created/removed to setup a filtered MPEG-TS to become available to the user space via the DVB demux API. Each filter contains a PID (PES filter) or a section filter (to filter tables). The PID set that matches the filtering parameters is sent to the user space via the DVR device node, and eventually passes through a Conditional Access Module (CAM) to be decrypted. Another option is to send each individual PID to a per/PID file descriptor in the user space via the demux device node.

From data flow point of view, a typical Digital TV PC customer’s device looks like what’s shown atFigure 3:

Figure 3: DTV data flow pipeline

Please note: On embedded hardware, the sink can actually be a GPU pipeline.

The control of the DVB device is done via several device nodes, as shown in Figure 4.

Figure 4: DTV control flow pipeline (the control flow is shown in dashed lines)

Several device nodes are used to control the hardware:

The front end devnode – controls tuner, demod (and SEC, for satellite)

The demux devnode – controls the demux

The CA devnode – controls the Conditional Access Module

Please notice that the DVR devnode doesn’t control anything – it is just used byread() ioctl to access the device data.

Other Examples of Digital TV Data Flows

The previous examples shown above are typical inexpensive PC hardware. On embedded devices, more complex data flows may happen, as shown in Figure 5 andFigure 6.

Figure 5: DTV control flow pipeline with no DMA output

 

Figure 6: A typical Set Top Box (STB) data flow pipeline

 

Figure 6 is actually simplified, as it doesn’t show the demod or demux and is based on a picturefound here.

It can be challenging to get diagrams like these from the Internet, as the real STB designs are typically protected by Non-disclosure Agreements (NDA). Since we want to give a more real example, let’s extrapolate from the diagram shown in Figure 6 to build an example showing demux, CAM and demod hardware with cross-bars between most of the elements.  The figure below allows us to randomly route to several alternatives.

Figure 7: A complete Set Top Box (STB) data flow pipeline (fictional)

Please note: Figure 7 doesn’t represent any real hardware; it is just an extrapolation from the diagram shown in Figure 6.

Now that the embedded Digital TV pipelines are understood, the next step is to improve the Linux Kernel in order to support such complex configurations. Before that, we still need to discuss an special case: network interfaces provided by Digital TV hardware.

On the next blog post in this series, I’ll describe the DVB network interfaces and how the Linux Kernel is addressing the DVB pipelines using the media controller.

Stay tuned!

Image Credits: Derivative of work by Subcommandante

About Mauro Carvalho Chehab

Mauro is the maintainer of the Linux kernel media and EDAC subsystems, and also a major contributor for the Reliability Availability and Serviceability (RAS) subsystems. He has broad experience in both telecommunications and software development, from previous work in IT, network and management areas at Brazil's largest telecommunication operator. He also spent time at Red Hat maintaining the RHEL kernel. He currently works for the Samsung Open Source Group.

LinuxDigital TV / Linux TV/ Multimidia/ Smart TV

STM32电机库无感代码注释无传感器版本龙贝格观测三电阻双AD采样前馈控制弱磁控制斜坡启动内容概要:本文档为一份关于STM32电机控制的无传感器版本代码注释资源,聚焦于龙贝格观测器在永磁同步电机(PMSM)无感控制中的应用。内容涵盖三电阻双通道AD采样技术、前馈控制、弱磁控制及斜坡启动等关键控制策略的实现方法,旨在通过详细的代码解析帮助开发者深入理解基于STM32平台的高性能电机控制算法设计与工程实现。文档适用于从事电机控制开发的技术人员,重点解析了无位置传感器控制下的转子初始定位、速度估算与系统稳定性优化等问题。; 适合人群:具备一定嵌入式开发基础,熟悉STM32平台及电机控制原理的工程师或研究人员,尤其适合从事无感FOC开发的中高级技术人员。; 使用场景及目标:①掌握龙贝格观测器在PMSM无感控制中的建模与实现;②理解三电阻采样与双AD同步采集的硬件匹配与软件处理机制;③实现前馈补偿提升动态响应、弱磁扩速控制策略以及平稳斜坡启动过程;④为实际项目中调试和优化无感FOC系统提供代码参考和技术支持; 阅读建议:建议结合STM32电机控制硬件平台进行代码对照阅读与实验验证,重点关注观测器设计、电流采样校准、PI参数整定及各控制模块之间的协同逻辑,建议配合示波器进行信号观测以加深对控制时序与性能表现的理解。
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值