基于软件实现机顶盒功能的方法 技术领域 Method for realizing set-top box function based on software TECHNICAL FIELD
本发明涉及通用图像数据处理, 特别是涉及基于软件方式实现互联网机顶盒功 能的技术。 背景技术 The present invention relates to general image data processing, and in particular, to a technology for realizing the function of an Internet set-top box based on software. Background technique
根据接收信号的不同, 机顶盒主要分为两类, 第一类是接收处理电视信号的机 顶盒, 常用于数字电视领域; 第二类是接收处理互联网数据的机顶盒, 简称为互联 网机顶盒, 用于通过电视机观看互联网的影视节目、 玩游戏、 浏览信息等。 本发明 主要涉及第二类的互联网机顶盒。传统的互联网机顶盒基于独立的硬件和专用软件 实现, 价格髙, 一般在 1000元人民币以上, 业务功能强的机顶盒价格接近 2000元 人民币。在传统机顶盒上扩展新的业务功能时, 例如支持层出不穷的新影音编码格 式、支持在线游戏, 或者通过机顶盒提供视频电话功能时, 需要扩展机顶盒硬件模 块, 同时配合开发软件功能, 复杂程度高, 开发周期长。 发明内容 According to different received signals, set-top boxes are mainly divided into two types. The first type is a set-top box that receives and processes television signals and is often used in the digital television field. The second type is a set-top box that receives and processes Internet data, referred to as the Internet set-top box for short. To watch movies and TV shows on the Internet, play games, browse information, etc. The present invention mainly relates to a second type of Internet set-top box. The traditional Internet set-top box is based on independent hardware and dedicated software. The price is usually over RMB 1,000. A set-top box with strong business functions costs close to RMB 2,000. When expanding new business functions on a traditional set-top box, such as supporting endless new video and audio encoding formats, supporting online games, or providing video phone functions through a set-top box, it is necessary to expand the set-top box hardware module and cooperate with the development of software functions. The cycle is long. Summary of the invention
本发明要解决的技术问题在于避免上述现有技术的不足之处而提出一种基于软 件实现传统互联网机顶盒功能的方法, 利用用户已有的电脑资源, 以很低的成本实现 5:联网机顶盒的功能, 并可以方便地扩展新的业务功能, 用户使用非常方便。 The technical problem to be solved by the present invention is to avoid the above-mentioned shortcomings of the prior art, and propose a software-based method for implementing the function of a traditional Internet set-top box, using a user's existing computer resources, to realize at a low cost 5: Functions, and can easily expand new business functions, users are very convenient to use.
本发明解决所述技术问题可以通过采用以下技术方案来实现: The present invention can solve the technical problems by adopting the following technical solutions:
提出一种基于软件实现机顶盒功能的方法, 包括有服务器、 用户端电脑以及电 视机, 包括以下步骤, A method for implementing a set-top box function based on software is provided, which includes a server, a client computer, and a television. The method includes the following steps.
① 所述用户端电脑通过互联网访问服务器, 通过用户端电脑内安装的应用软 件从所述服务器获取节目内容; ① The client computer accesses the server through the Internet, and obtains program content from the server through application software installed in the client computer;
②用户根据电视机上界面菜单, 利用电脑遥控器将按键命令发送至控制器; ② According to the interface menu on the TV, the user sends the key commands to the controller using the computer remote control;
③所述控制器把接收到的遥控器按键命令发送到所述用户端电脑中;③ The controller sends the received remote control key command to the client computer;
④所述用户端电脑的应用软件响应所述遥控器按键命令, 执行如下操作: 通 过互联网从所述服务器获取服务内容; 或者调用所述用户端电脑中的服务 内容模块, 在所述用户端电脑支持电视视频信号输出或者电视机支持电脑
视频信号输入的情况下, 将图像界面输出到与该用户端电脑有直接通信连 接的所述电视机上, 提供给用户观看; 在所述用户端电脑不支持电视视频 信号输出并且电视机不支持电脑视频信号输入的情况下, 将视频图像通过 视频转换器输出在所述电视机上, 提供给用户观看。 ④ The application software of the client computer responds to the key commands of the remote control, and performs the following operations: obtaining service content from the server through the Internet; or calling a service content module in the client computer, on the client computer Support TV video signal output or TV support computer In the case of a video signal input, an image interface is output to the TV set that has a direct communication connection with the client computer, and is provided for the user to watch; the client computer does not support TV video signal output and the TV does not support a computer In the case of a video signal input, a video image is output on the television through a video converter and provided to a user for viewing.
将用户标识码保存在所述控制器中, 在服务端提供鉴别权限和计费。 The user identification code is stored in the controller, and authentication authority and charging are provided on the server.
所述用户端电脑采用多任务和多画面显示软件机制。 The client computer uses a multi-task and multi-screen display software mechanism.
同现有技术相比较, 本发明的技术效果在于: 利用已有电脑提供的通信、 存储 和处理能力资源, 基于电脑软件实现机顶盒功能, 用户使用简便; 无需机顶盒硬件平 台, 成本大大降低; 可以方便扩展业务功能。 本发明不但可以应用于互联网中, 也可 应用于类似网络中。 附图说明 Compared with the prior art, the technical effects of the present invention are: using the existing computer's communication, storage, and processing power resources to implement set-top box functions based on computer software, which is easy for users to use; no need for a set-top box hardware platform, and the cost is greatly reduced; it can be convenient Expand business functions. The present invention can be applied not only to the Internet, but also to similar networks. BRIEF DESCRIPTION OF THE DRAWINGS
图 1 是用户端电脑支持电视视频信号输出或者电视机支持电脑视频信号输入 的情况下, 本发明方法所使用硬件的连接示意图; FIG. 1 is a schematic diagram of the connection of hardware used in the method of the present invention in the case that a client computer supports television video signal output or a television supports computer video signal input;
图 2是在所述用户端电脑不支持电视视频信号输出并且电视机不支持电脑视 频信号输入的情况下, 本发明所使用硬件的连接示意图; 2 is a schematic diagram of a connection of hardware used in the present invention in a case where the client computer does not support TV video signal output and the TV does not support computer video signal input;
图 3是用户端电脑应用软件和服务端软件的模块方框示意图, 图 3— 1是服务 端软件的模块方框示意图, 图 3— 2是用户端电脑应用软件的模块方框示意图; Figure 3 is a block diagram of the client computer application software and server software, Figure 3-1 is a module block diagram of the server software, and Figure 3-2 is a module block diagram of the client computer application software;
图 4是用户端电脑应用软件流程和调用服务器软件流程图; Figure 4 is a flow chart of the client computer application software flow and the call server software flow;
图 5是用户端电脑应用软件界面示意图; FIG. 5 is a schematic diagram of an application software interface of a client computer;
图 6是控制器电路原理图; Figure 6 is a schematic diagram of the controller circuit;
图 7是控制器软件流程图, 图 7—1是控制器软件主程序流程示意图; 图 7— 2 是所述控制器向用户端电脑串口发送单字节的函数流程示意图; 图 7— 3是遥控器按 键中断响应的流程示意图。 具体实施方式 Figure 7 is a flowchart of the controller software, Figure 7-1 is a schematic diagram of the main flow of the controller software; Figure 7-2 is a schematic flowchart of the function of the controller sending a single byte to the serial port of the client computer; Figure 7-3 is Schematic diagram of the remote control button interrupt response. detailed description
以下结合附图所示之最佳实施例作进一步详述。 In the following, the preferred embodiment shown in the drawings is used for further details.
如图 1所示, 用户端电脑 2支持电视视频信号输出, 通过视音频线缆 6与电视 机 5连接(其中视频线缆可以是 S端子视频线, 也可以是 AV端子视频线); 控制器 3通过线缆 7连接到用户端电脑 2的串口,或者可以连接到 USB口,或者连接到 PS/2
口; 遥控器 4通过无线方式发送按键命令到控制器 3, 可以是红外方式, 也可以是 超短波方式。 ' As shown in FIG. 1, the client computer 2 supports television video signal output, and is connected to the television 5 through the video and audio cable 6 (where the video cable can be an S-terminal video cable or an AV-terminal video cable); the controller 3 Connect to the serial port of client computer 2 through cable 7, or you can connect to the USB port, or connect to PS / 2 The remote control 4 sends key commands to the controller 3 in a wireless manner, which may be an infrared mode or an ultra-short wave mode. '
为了防止干扰, 该遥控器 4与电视遥控器的编码不同。 遥控器 4在市场上已 经有成熟产品, 这里不再详述其实现方案。 To prevent interference, the remote control 4 has a different code from the TV remote control. The remote control 4 already has mature products in the market, and its implementation scheme will not be described in detail here.
图 2是本发明在用户端电脑不支持电视视频信号输出并且电视机不支持电脑 视频信号输入情况下的方案示意图。用户端电脑 2不支持电视视频信号输出, 其输 出的电脑视频信号通过线缆 9输出到视频转换器 8上,视频转换器 8把电脑视频信 号转换为标准的 PAL、 NTSC或 SECAM电视信号, 通过视音频线缆 6输出到电视机 5 上; 控制器 3通过线缆 10为视频转换器 8提供电源, 并控制电视图像的尺寸、 位 置调整;控制器 3通过线缆 7连接到用户端电脑 2的串口,或者可以连接到 USB口, 或者连接到 PS/2口。 所述控制器 3和视频转换器 8在物理上可为一体, 也可作为 板卡插入到所述哟用户端电脑中使用。 FIG. 2 is a schematic diagram of the solution of the present invention in a case where a user-side computer does not support TV video signal output and a television does not support computer video signal input. The client computer 2 does not support TV video signal output. The computer video signal output by the client computer 2 is output to the video converter 8 through the cable 9. The video converter 8 converts the computer video signal into a standard PAL, NTSC or SECAM TV signal. The video and audio cable 6 is output to the television 5; the controller 3 provides power to the video converter 8 through the cable 10, and controls the size and position adjustment of the television image; the controller 3 is connected to the user-side computer 2 through the cable 7 The serial port can be connected to either the USB port or the PS / 2 port. The controller 3 and the video converter 8 may be physically integrated, or they may be inserted into the client computer for use as a board.
视频转换器 8在市场上已经有成熟的产品, 这里不再详述其实现方案。 The video converter 8 already has mature products in the market, and its implementation scheme will not be described in detail here.
为了布线方便,可以用无线射频方式更换视音频线缆 6传送视音频信号。市场 上已经有成熟的无线传送视音频信号的产品, 这里不再详述其实现方案。 For the convenience of wiring, the audio and video cable 6 can be replaced by radio frequency to transmit the audio and video signals. There are already mature products for wirelessly transmitting video and audio signals on the market, and their implementation solutions are not described in detail here.
在实现收费节目运营中,用户访问收费节目需要使用一个唯一的用户标识码作 为鉴别用户权限和计费的依据。现有的用户标识码输入方式是用户通过遥控器按键 输入, 对于收费节目需要用户经常输入, 操作很不方便。本发明把用户标识码数据 保存在控制器 3中, 用户端电脑 2从控制器 3上直接读取用户标识码, 发送到服务 器 1, 用来作为鉴别用户权限和计费的依据。 In the implementation of paid program operations, users accessing paid programs need to use a unique user identification code as a basis for identifying user rights and charging. The existing user identification code input method is that the user inputs the keys through the remote control, which requires frequent input by users for paid programs, which is very inconvenient to operate. In the present invention, the user identification code data is stored in the controller 3, and the client computer 2 reads the user identification code directly from the controller 3 and sends it to the server 1, which is used as a basis for identifying user rights and charging.
在用户端电脑中, 采用多任务和多画面显示软件机制, 实现电脑显示器和电视 机不同画面输出, 使得用户使用软件机顶盒观看电视机的同时, 还可以利用电脑进 行其它工作。 目前市场上一些电脑操作系统已经支持多任务、多显示器输出不同画 面技术, 下面不再详述其实现方案。 In the client computer, the multi-task and multi-screen display software mechanism is adopted to realize different screen output of the computer monitor and the television, so that the user can use the computer to perform other tasks while watching the television using the software set-top box. At present, some computer operating systems on the market already support multi-tasking and multi-monitor output of different screen technologies. The implementation scheme is not described in detail below.
如图 3— 1所示, 服务端软件 11包括界面服务模块 111、 服务端业务功能模块 As shown in Figure 3-1, the server software 11 includes an interface service module 111 and a server business function module.
112和用户数据库模块 113; 界面服务模块 111以网页的方式提供用户端界面; 服 务端业务功能模块 112包括但不限于影音服务模块、视频电话服务模块、游戏服务 模块、视频邮件服务模块等,视频电话服务模块提供对用户端视频电话模块的管理, 包括用户端电脑 IP地址与视频电话号码的解析; 游戏服务模块提供对用户端游戏 模块的管理; 用户数据库模块 113提供对用户标识的权限、 计费等信息的管理, 接
收用户端电脑 2发送的用户标识, 根据用户标识查找相应权限, 允许或者禁止用户 使用各种服务, 在用户使用收费内容时进行计费。 112 and user database module 113; interface service module 111 provides user interface in the form of web page; server-side business function module 112 includes but is not limited to audio and video service module, video phone service module, game service module, video mail service module, etc., video The phone service module provides management of the user's video phone module, including the analysis of the client computer's IP address and video phone number; the game service module provides management of the user's game module; the user database module 113 provides permissions, accounting for user identification Management of information such as fees The user identification sent by the client computer 2 is used to find the corresponding authority according to the user identification, allowing or forbidding the user to use various services, and charging when the user uses the charged content.
如图 3— 2所示,所述用户端电脑 2的应用软件 12包括主控模块 122、控制命令 模块 124、 用户端业务功能模块 123、 界面模块 121 以及接口模块 125。 该接口模块 125包括但不限于 USB接口模块、 PS/2接口模块或 RS232接口模块, USB接口模块负 责处理通过 USB口连接的控制器 3的上报数据, PS/2接口模块负责处理通过 PS/2口 连接的控制器 3的上报数据, RS232接口模块负责处理通过 RS232串口连接的控制器 3的上报数据;对应控制器 3的接口方式,运行对应的 USB接口模块、 PS/2接口模块、 RS232接口模块; 所述用户端业务功能模块 123包括但不限于影音播放模块、 视频电 话模块、 游戏模块以及视频邮件模块等等。 如图 4所示, 该应用软件 12的工作流程 以下: As shown in FIG. 3-2, the application software 12 of the client computer 2 includes a main control module 122, a control command module 124, a client service function module 123, an interface module 121, and an interface module 125. The interface module 125 includes, but is not limited to, a USB interface module, a PS / 2 interface module, or an RS232 interface module. The USB interface module is responsible for processing the data reported by the controller 3 connected through the USB port, and the PS / 2 interface module is responsible for processing through the PS / 2. The RS232 interface module is responsible for processing the data reported by the controller 3 connected through the RS232 serial port. Corresponding to the interface mode of the controller 3, it runs the corresponding USB interface module, PS / 2 interface module, and RS232 interface. Module; the client-side business function module 123 includes, but is not limited to, an audio and video playback module, a video phone module, a game module, a video mail module, and the like. As shown in FIG. 4, the workflow of the application software 12 is as follows:
用户端电脑应用软件 12的主控模块 122从服务器软件 11获取界面, 显示在 电视机上; 根据电视机界面提示, 用户按下遥控器按键, 通过控制器 3发送到接口 模块 125, 并上报给控制命令模块 124; 控制命令模块 124解析遥控命令, 上报给 主控模块 122; 主控模块 122根据遥控命令执行相应动作, 调用影音播放模块、 视 频电话模块、游戏模块或者视频邮件模块,并把界面显示到电视机上,供用户观看。 The main control module 122 of the client computer application software 12 obtains the interface from the server software 11 and displays it on the TV. According to the TV interface prompt, the user presses the remote control button, sends it to the interface module 125 through the controller 3, and reports it to the control. Command module 124; Control command module 124 parses the remote control command and reports it to the main control module 122; The main control module 122 performs the corresponding action according to the remote command, calls the audio and video playback module, video phone module, game module or video mail module, and displays the interface Go to the TV for users to watch.
在扩展业务功能时, 只需要遵循主控模块 122的接口调用方式, 在用户端电脑 应用软件中增加用户端业务功能模块, 同时在服务端增加相应服务模块即可, 非常 灵活方便。 When expanding business functions, it is only necessary to follow the interface invoking method of the main control module 122, add user-side business function modules to the client computer application software, and add corresponding service modules to the server, which is very flexible and convenient.
图 5是用户端电脑应用软件界面示意图。 界面以 HTML和 JavaScript设计, 以 全屏方式显示在电视机上, 字体效果适合电视机显示。影片试播窗口循环播放指定 的节目片断。 在遥控器上按 " 1 ", 即播放热门影片 A; 在遥控器上按 "2", 即播放 热门影片 B; 在遥控器上按 "7", 进入影视节目分类界面, 查找指定的影视节目, 选择观看, 则在电视机上以全屏方式播放; 在遥控器上按 "8", 进入在线游戏; 在 遥控器上按" 9", 进入歌曲分类界面, 査找并播放指定的歌曲; 在遥控器上按 "0", 播放当前新闻。 Figure 5 is a schematic diagram of the software interface of a client computer. The interface is designed in HTML and JavaScript, and is displayed on the TV in full screen mode, with font effects suitable for TV display. The movie preview window plays the specified program segment in a loop. Press "1" on the remote control to play the popular movie A; Press "2" on the remote control to play the popular movie B; Press "7" on the remote control to enter the movie program classification interface and find the specified movie program , Select watch, then play on the TV in full screen mode; press "8" on the remote control to enter the online game; press "9" on the remote control to enter the song classification interface to find and play the specified song; on the remote control Press "0" to play the current news.
图 6是控制器电路原理图。控制器 3以 RS232与用户端电脑 2连接, 通过窃电 电路从用户端电脑串口获取 5V电源。电路以 8位单片机 EM78P156为中心控制模块, 以软件方式实现串口通信, 一个 I/O管脚向用户端电脑串口发送数据, 一个 I/O管 脚接收来自用户端电脑的串行数据。单片机中断口监测来自遥控器的信号。 当用户
按下遥控器按键时, 控制器 3的红外接收模块解码后, 触发单片机中断, 单片机读 入按键命令码流, 发送给用户端电脑 2。 · Figure 6 is a schematic diagram of the controller circuit. The controller 3 is connected to the client computer 2 by RS232, and obtains a 5V power from the serial port of the client computer through a power stealing circuit. The circuit uses an 8-bit single-chip microcomputer EM78P156 as the central control module and implements serial communication in software. One I / O pin sends data to the serial port of the client computer, and one I / O pin receives serial data from the client computer. The MCU interrupt port monitors signals from the remote control. When the user When the remote control button is pressed, after the infrared receiving module of the controller 3 decodes, the single-chip microcomputer interrupt is triggered, and the single-chip microcomputer reads the key command code stream and sends it to the client computer 2. ·
当采用无线射频遥控器时, 只需把红外接收模块更换为无线射频接收模块。 控制器软件流程如图 7所示, 遥控器 4和控制器 3采用 RC5编解码方式, 每次 遥控器按键对应码流包括四部分: 1. 5位起始码, 1位控制位, 5位地址码, 6位命 令码; 每位的宽度为 1. 778ms, 在图 7中称为 1个遥控码周期。 控制器 3通过串口 与用户端电脑 2连接, 以 RS232异步串行方式进行通信, 传输速率为 1200bps, 1 位起始位, 8位数据位, 无奇偶校验位, 1位停止位; 每位的宽度为 0. 833ms, 在图 7中称为 1个串口周期; 当调整传输速率时, 只需调整串口周期时间常量即可。 When using a radio frequency remote control, it is only necessary to replace the infrared receiving module with a radio frequency receiving module. The software flow of the controller is shown in Figure 7. The remote controller 4 and controller 3 use the RC5 encoding and decoding method. The code stream corresponding to each remote control button includes four parts: 1. 5 digit start code, 1 control bit, 5 digits. Address code, 6-digit command code; the width of each bit is 1. 778ms, which is called a remote control code period in FIG. 7. The controller 3 is connected to the client computer 2 through the serial port, and communicates in RS232 asynchronous serial mode. The transmission rate is 1200bps, 1 start bit, 8 data bits, no parity bit, 1 stop bit; each bit The width is 0. 833ms, which is called a serial port cycle in Figure 7. When adjusting the transmission rate, you only need to adjust the serial port cycle time constant.
控制器软件主程序流程如图 7— 1所示, 控制器软件在初始化后, 首先向用户 端电脑 2发送用户标识, 作为计费依据; 之后进入空指令循环, 等待遥控器按键触 发中断。 The main flow of the controller software is shown in Figure 7-1. After the controller software is initialized, it first sends the user ID to the client computer 2 as the basis for billing. Then it enters an empty command loop and waits for the remote control button to trigger interruption.
控制器向用户端电脑串口发送单字节的函数流程如图 7— 2 所示, 控制器以 RS232异步串行通信协议向用户端电脑 3发送数据, 定义为串口发送函数, 供其它 模块调用。 在函数被调用时, 首先发送起始位, 在单片机发送管脚输出低电平, 并 延迟 1个串口周期; 之后依次发送 8位数据位; 发送 1个停止位和 1个空闲位, 即 高电平保持 2个串口周期。 The function flow of the controller sending a single byte to the serial port of the client computer is shown in Figure 7-2. The controller sends data to the client computer 3 using the RS232 asynchronous serial communication protocol, which is defined as a serial port sending function for other modules to call. When the function is called, the start bit is sent first, and the microcontroller sends a pin to output a low level, which is delayed by 1 serial port period; after that, 8 data bits are sent in sequence; 1 stop bit and 1 idle bit are sent, that is, high The level is maintained for 2 serial port cycles.
遥控器按键中断响应的流程如图 7— 3所示, 控制器软件响应遥控器按键中断 处理中,主要是接收并解码来自遥控器的 RC5码流,获取 5位地址位和 6位命令位, 调用串口发送函数向用户端电脑发送。 中断响应模块详细流程如下: 首先跳过 2. 5 个遥控码周期的起始位和控制位, 再延时 0. 25个遥控码周期(即共延时 2. 75个遥 控码周期), 到达第一个地址位的 1/4时间点进行釆样, 读取第一个地址位, 之后 每次延时 1个遥控码周期, 依次读取 5个地址码和 6个命令码, 地址码和命令码分 别保存在两个字节中, 高位以 0填充; 最后调用串口发送函数按 RS232串口异步通 信协议向用户端电脑发送两个字节。
The remote control button interruption response process is shown in Figure 7-3. In the controller software response to the remote control button interruption processing, it mainly receives and decodes the RC5 code stream from the remote control, and obtains 5 address bits and 6 command bits. Call the serial port send function to send to the client computer. The detailed procedure of the interrupt response module is as follows: first skip the start bit and control bit of 2. 5 remote control code cycles, and then delay 0. 25 remote control code cycles (that is, delay 2.75 remote control code cycles in total), arrive The first address bit is sampled at 1/4 of the time point, the first address bit is read, and then one remote control code period is delayed each time, and then the 5 address codes and 6 command codes are read in sequence. The command code is stored in two bytes, and the high bits are filled with 0. Finally, the serial port sending function is called to send two bytes to the client computer according to the RS232 serial port asynchronous communication protocol.