This application claims the priority benefit of China application serial no. 201210343149.0, filed on Sep. 14, 2012. The entirety of the above-mentioned patent application is hereby incorporated by reference herein and made a part of this specification.
1. Technical Field
The invention relates to a data read and write technique of a digital video converter. Particularly, the invention relates to a digital video converter and a method for reading and writing a video stream.
2. Related Art
A hard disk and a processor are two indispensable components in a computer system. The hard disk is used to store data, and the processor controls the hard disk through a file system run in an operating system, and reads data from or writes data into the hard disk. The commonly used file systems are, for example, a file allocation table (FAT) file system, a high performance file system (HPFS), a new technology file system (NTFS) and other types of file system. Presently, the NTFS has gradually replaces the FAT file system and the HPFS, and the NTFS is a main file system standard used in a Windows NT operating system and later released operating systems of the Microsoft Corporation.
As many data read and write techniques are provided by the Microsoft Corporation and protected by related intellectual property laws, and due to a difference in data structures, most of the non-Microsoft operating systems (for example, a Unix operating system or a Unix-like operating system) cannot effectively support the NTFS. For example, the Linux operating system can only read data from the hard disk through the NTFS, and cannot write data into the hard disk through the NTFS. In order to maintain a basic support (for example, capable of executing basic data read and write operations) of the Linux operating system for the NTFS, the Linux operating system has to additional run a filesystem in userspace (FUSE), for example, an NTFS file system driving program (for example, NTFS-3G).
In broad terms, the FUSE file system refers to a file system completely implemented in a user mode or a user space, through which a user can view information such as a file name and a file storage path, etc. stored in the file system, and can modify, copy, and access the file. Therefore, many non-Microsoft operating systems take the FUSE as a core and as a used file system module. However, the FUSE file system still has may restrictions and inconveniences in operation, for example, when a file stored in the hard disk is moved or read/written, the operating system frequently performs operation such as copying and changing file attributes, etc. between a kernel and the user space, which may cause a problem that the operating system has a poor data read and write speed on the hard disk. For example, each file in the FUSE file system is assigned with an index code (which is referred to as Mode in abbreviation), and such Mode is located in the user space. When such file is moved or read/written, the Mode corresponding to such file is also correspondingly modified, which increases a file moving time, and causes delay of the operating system.
In the process of writing the file 101 into the hard disk 13, the operating system executes the operations of file copy and Mode modifying, etc. for at least twice. Similarly, when data is read or moved from the hard disk, the current FUSE file system at least performs the copy operation between the kernel and the user space for more than twice, which decreases a read and write efficiency of data.
Particularly, regarding a digital video converter capable of recording or playing videos in real-time, especially a digital television (TV) set-top box (STB) capable of recording or playing signals of a high definition television (HDTV), any slight delay may cause severe error in image frames or sounds. Therefore, how to improve a file read and write speed of the digital video converter is an important problem to be resolved.
The invention is directed to a digital video converter and a method for reading and writing a video stream, by which read and write of the video stream in a storage device is implemented without involving a user space, so as to improve a speed that an operating system reads and writes data from/into the storage device.
The invention provides a digital video converter including a processing device and a storage device. The processing device runs an operating system, where the operating system is configured with a kernel and a user space. The storage device is coupled to the processing device and is used to store data. The processing device executes a writing process to write a video stream to the storage device according to a data storage request of a user. When the writing process is executed, the kernel obtains a specified identifier corresponding to a specified storage space in the storage device according to the data storage request of the user, and writes the video stream into the specified storage space according to the specified identifier. Moreover, the processing device executes a reading process to read the video stream from the storage device according a data reading request of the user, and when the reading process is executed, the kernel obtains the specified identifier corresponding to the specified storage space storing the video stream, searches the specified storage space according to the specified identifier, and reads the video stream from the specified storage space, where the writing process and the reading process do not involve the user space.
In an embodiment of the invention, the kernel inquires a logical block address (LBA) table to obtain a logical address corresponding to the specified storage space, where the LBA table indicates that the specified storage space corresponding to the logical address is capable of being written with data. Moreover, the kernel obtains the specified identifier corresponding to the specified storage space according to the logical address, searches the specified storage space according to the specified identifier, and writes the video stream into the specified storage space.
In an embodiment of the invention, the kernel inquires an LBA table to obtain a logical address corresponding to the specified storage space, where the LBA table indicates that the video stream has been written into the specified storage space corresponding to the logical address. Moreover, the kernel obtains the specified identifier corresponding to the specified storage space according to the logical address, searches the specified storage space according to the specified identifier, and reads the video stream from the specified storage space.
In an embodiment of the invention, the digital video converter further includes a video stream receiving device. The video stream receiving device is coupled to the processing device, and generates the video stream according to a television (TV) signal.
In an embodiment of the invention, the processing device displays a user operation interface in a display device, where the user operation interface displays a video file name corresponding to the video stream. Moreover, the processing device determines whether the video file name is selected, and when the video file name is selected, the processing device executes the reading process to play the video stream.
The invention also provides a method for reading and writing a video stream, which is adapted to a digital video converter, where the digital video converter includes an operating system and a storage device having a plurality of storage spaces, the operating system is configured with a kernel and a user space, and the method for reading and writing the video stream includes following steps. A writing process is executed to write a video stream to the storage device of the digital video converter according to a data storage request of a user, where the writing process includes following steps. The kernel obtains a specified identifier corresponding to a specified storage space in the storage device according to the data storage request of the user.
The kernel writes the video stream into the specified storage space according to the specified identifier. A reading process is executed to read the video stream from the storage device according a data reading request of the user, where the reading process includes following steps. The kernel obtains the specified identifier corresponding to the specified storage space storing the video stream. The kernel searches the specified storage space according to the specified identifier, and reads the video stream from the specified storage space, where the writing process and the reading process do not involve the user space.
In an embodiment of the invention, the writing process includes following steps. The kernel inquires a logical block address (LBA) table to obtain a logical address corresponding to the specified storage space, where the LBA table indicates that the specified storage space corresponding to the logical address is capable of being written with data. The kernel obtains the specified identifier corresponding to the specified storage space according to the logical address. The kernel searches the specified storage space according to the specified identifier, and writes the video stream into the specified storage space.
In an embodiment of the invention, the reading process includes following steps. The kernel inquires an LBA table to obtain a logical address corresponding to the specified storage space, where the LBA table indicates that the video stream has been written into the specified storage space corresponding to the logical address. The kernel obtains the specified identifier corresponding to the specified storage space according to the logical address. The kernel searches the specified storage space according to the specified identifier, and reads the video stream from the specified storage space.
In an embodiment of the invention, the video stream is obtained through a TV signal.
In an embodiment of the invention, the method for reading and writing the video stream further includes following steps. A user operation interface is displayed. A video file name corresponding to the video stream is displayed on the user operation interface. It is determined whether the video file name is selected, and when the video file name is selected, the reading process is executed to play the video stream.
According to the above descriptions, the invention provides the digital video converter and the method for reading and writing a video stream, by which read and write operations of the video stream in the storage device is implemented without involving the user space. In this way, a whole read and write speed of the video stream is effectively promoted to avoid occurrence of delay to influence a play quality.
In order to make the aforementioned and other features and advantages of the invention comprehensible, several exemplary embodiments accompanied with figures are described in detail below.
The accompanying drawings are included to provide a further understanding of the invention, and are incorporated in and constitute a part of this specification. The drawings illustrate embodiments of the invention and, together with the description, serve to explain the principles of the invention.
In order to avoid repeat copy operations performed between a kernel and a user space of an operating system when a digital video converter (for example, a digital television (TV) set-top box (STB) reads or writes a video stream transmitted in real-time, an embodiment of the invention provides a digital video converter and a method for reading and writing a video stream, by which in case that the user space in the operating system is not involved, the kernel is directly used to read and write data in a storage device (for example, a hard disk). In this way, the performance that the digital video converter performs the read or write operation on the video stream can be effectively enhanced. In order to fully convey the spirit of the invention to those skilled in the art, embodiments are provided below for detailed descriptions.
The video stream receiving device 21 generates a video stream according to a digital TV signal. For example, the video stream receiving device 21 can receive wireless TV signals through a wireless manner by using an antenna or a radio frequency (RF) receiving circuit, etc., and convert the received wireless TV signals into the video stream of a digital-form. For another example, the digital video converter 20 can receive video streams from the Internet or a cable TV provider through a network interface card or a video signal input interface, etc. Alternatively, the video stream receiving device 21 may have both of the aforementioned devices, such that the digital video converter 20 can receive and play wireless TV signals and cable TV signals, which is not limited by the invention.
The processing device 22 is coupled to the video stream receiving device 21, which is mainly used to run an operating system 220, where the operating system 220 is configured with a kernel 221 and a user space 222. In the present embodiment, the processing device 22 is, for example, a central processing unit (CPU), a microprocessor or an embedded processor, though the invention is not limited thereto. Moreover, the processing device 22 can also be configured with a temporary memory used in related operations of the operating system. The operating system 220 can be a Unix operating system or a Unix-like operating system. The Unix-like operating system is, for example, FreeBSD, OpenBSD, Solaris, Minix, Linux, QNX or other operating systems obtained by ameliorating the aforementioned known operating system and used for specific equipment, which is not limited by the invention.
The kernel 221 is a basic part of the operating system 220, which is mainly used to manage a system resource, and the user space 222 is controlled by the operating system. In other words, the operating system configures a virtual memory in the temporary memory of the storage device 23 or the processing device 22, and divides the virtual memory into the user space 222 and a kernel space for the kernel 221. Driving programs of the kernel 221 and the digital video converter 20 and expansion programs extended from the kernel 221 are run in the kernel space. Moreover, virtual memory spaces required by other application programs are configured in the user space 222. Particularly, index codes (inodes), etc. required when the user accesses data are also configured in the user space 222. However, when the digital video converter 20 of the present embodiment reads and writes data, the user space 222 is not involved, which is described in detail below.
The storage device 23 is coupled to the processing device 22, and is used to store data such as video streams, etc. In the present embodiment, the storage device 23 can be various non-volatile memories or combinations thereof, for example, a read-only memory (ROM) and/or a flash memory, where the ROM is, for example, a programmable read-only memory (PROM), an electrically alterable read-only memory (EAROM), an erasable programmable read-only memory (EPROM) and/or an electrically erasable programmable read-only memory (EEPROM). Moreover, the storage device 23 may also include a hard disk, an optical disc or an external storage device (for example, a memory card, a flash drive, etc.) or combinations thereof, and implementation of the storage device 23 is not limited by the invention.
In detail, the operating system 220 of the processing device 22 uses the kernel 221 to access data stored in the storage device 23, for example, in a recording mode of the digital video converter 20, the kernel 221 can directly write the video stream received by the video stream receiving device 21 into the storage device 23, or in a play mode of the digital video converter 20, the kernel 221 can directly replay the video stream previously recorded or stored in the storage device 23. Particularly, the spirit of the embodiment lies in that the data read and write operations performed to the storage device 23 by the kernel 221 do not involve the user space 222. Such feature results in an essential difference between the digital video converter 20 of the invention and the digital video converter of filesystem in userspace (FUSE) structured on the user space.
Since the digital video converter 20 is only used to execute a play operation and a recording operation of the video stream, the user only needs to know basic information such as the stored videos in the digital video converter 20 or the available storage space in the digital video converter 20. Therefore, in the present embodiment, the digital video converter 20 actually does not need to create a complex and complete data folder structure as that does of a computer system. Comparatively, the digital video converter 20 complied with the spirit of the present embodiment only needs an ameliorated file system structure capable of supporting basic operation functions of quick accessing the video streams or other files, etc. Namely, the digital video converter 20 directly reads and writes the video stream from/to the storage device 23 without modifying any setting in the user space 222, and the accessed data can be read and written from/to the storage device 23 without using the user space 222.
In the present embodiment, the display device 24 can be a general display screen, and is capable of receiving an input signal from a remote controller, a mouse or a physical button. Alternatively, the display device 24 can be a touch screen of any type, which is capable of detecting a touch operation on a surface thereof to generate a touch signal, where the touch screen may include a resistive touch panel, a capacitive touch panel, an optical touch panel, an acoustic wave touch panel, an electromagnetic touch panel, etc., which is not limited by the invention.
Referring to
For example, if the storage device 23 is a hard disk, a sector can be taken as a unit of the storage space to implement the aforementioned specified storage space. In this way, the aforementioned specified identifier is, for example, a sector header of each sector in the hard disk, and the sector header includes 3 digital types respectively representing a track, a cylinder and the sector. In other words, the aforementioned specified storage space and the specified identifier are correspondingly implemented according to a type of the storage device 23, which is not limited by the invention.
Referring to
For example, similar to the flow of the writing process of
In this way, in the present embodiment, the digital video converter 20 can also be coupled to the display device 24, so as to play the video stream through the display device 24. Moreover, the processing device 22 can also display a user operation interface on the display device 24, and displays a video file name corresponding to the video stream stored in the storage device 23 on the user operation interface. Moreover, the processing device 22 determines whether the video file name displayed on the user operation interface is selected. When the video file name is selected, the processing device 22 executes the reading process to play the video stream corresponding to the selected video file name.
Referring to
Moreover, in step S520, the operating system of the digital video converter executes a reading process to read the video stream from the storage device of the digital video converter according a data reading request of the user, where the reading process of the step S520 includes following steps. In step S522, the kernel of the operating system obtains the specified identifier corresponding to the specified storage space storing the video stream according to the data reading request of the user. Then, in step S524, the kernel of the operating system searches the specified storage space storing the video stream according to the obtained specified identifier, and reads the video stream from the specified storage space. Particularly, neither of the writing process of the step S510 and the reading process of the step S520 involves the user space of the user space.
Moreover, the step S510 and the step S520 can be respectively executed according to the read operation and write operation performed on the video stream by the digital video converter.
It should be noticed that since those skilled in the art can learn enough instructions, recommendations and descriptions from the aforementioned embodiment for the aforementioned method, detailed description thereof is not repeated.
In summary, the invention provides the digital video converter and the method for reading and writing a video stream, by which the kernel can be used to directly read data from the storage device and write data to the storage device in case that the user space of the operating system is not involved. In this way, the performance that the digital video converter performs the read or write operation on the video stream can be effectively enhanced.
It will be apparent to those skilled in the art that various modifications and variations can be made to the structure of the invention without departing from the scope or spirit of the invention. In view of the foregoing, it is intended that the invention cover modifications and variations of this invention provided they fall within the scope of the following claims and their equivalents.
Number | Date | Country | Kind |
---|---|---|---|
201210343149.0 | Sep 2012 | CN | national |