1. Field of the Invention
The present invention is related to media processing and in particular, to systems and methods for caching media.
2. Description of the Related Art
Multimedia, such as video and audio data, is often stored on a mass storage medium, such as a Digital Versatile Disk (DVD), Compact Disc (CD), a hard disk drive, a FLASH memory drive, and the like. Often, to reduce the space to store such multimedia, the multimedia is compressed and encoded using a coding technology, such as MPEG 1, MPEG 2, MPEG 4, and the like.
Media streaming often involves the process of sequentially transmitting multimedia data streams, such as audio and video data streams, between a host machine and a stream storage device. The host machine can be a PC or a consumer electronic device, such as a DVD recorder. The stream storage device can be a local mass storage device, including storage media, or a server machine connected over a network to the host machine.
Conventionally, multimedia data is read in a sequential fashion from a media source, such as a mass storage device or over a network. The individual data streams are then presented together to a user via a decoding and rendering process. Often not all of the data is immediately available at the decoder, and a media seek operation may be need to access data, which can include a latency. The latency can result from a head seek on a disk drive or a position change request to the network media source, by way of example. Due to the nature of media storage devices, data access time may vary depending on a number of parameters that are often not easily predicted or controlled.
Many conventional data storage devices, including optical and magnetic disks, utilize “tracks” to store data. Each disk or disk platter may have thousands of tracks. The tracks may be concentric, as on conventional magnetic disks and some optical disks. Each track is further divided into sectors.
A read track buffer is often used to read slightly ahead and buffer data that is read from media, so as to prevent the de-multiplexing and decoding stages from encountering data starvation due to access latency of the media storage device. Thus, the read track buffer can smooth fluctuations in the bit stream that might result from irregular media accesses. The track buffer is usually implemented using volatile random access memory (RAM) that provides relatively fast access storage as compared to the media source or storage device. Data sectors are read from the media source and are temporarily stored in the read track buffer in a sequential manner.
In order to keep the read track buffer relatively small, such as 2 Mbit in size, the sectors stored in the track buffer are typically deleted, invalidated, ignored or overwritten immediately after they have been de-multiplexed, decoded, and rendered. However, because the size of the read track buffer is relatively small, often only a small amount of data can be buffered at a given time. As a result, most sectors from the source media are generally read into the read track buffer as track buffer space is freed by decoding. This process results in frequent and substantially constant media access operations when playing the source media, often many times per second.
Conventional multimedia read processes often have several disadvantages. For example, on many platforms where system power consumption is a major concern, such as a portable computing device operating on battery power (laptops, portable DVD players, and the like), the frequent access operations may keep the media access device spinning all of the time during a play operation, consuming a significant amount of power and reducing battery life.
In addition, because many platforms include relatively small read track buffers, they may only allow the reading of one media location, such as one small contiguous group of memory addresses, at a given time.
Further, because many platforms include relatively small read track buffers, the read track buffer data is often discarded on a media scanning operation such as fast forward or fast rewind/reverse. Thus, these platforms may require a re-read operation should a user want to revisit previously played data (such as for a 10 second jump-back operation).
Similarly, many conventional multimedia write processes suffer from several disadvantages. Typically, a multimedia signal, such as a television signal, is sampled and encoded into individual data streams by applying a coding technology, such as MPEG 1, MPEG 2, or MPEG 4. The individual data streams are typically multiplexed to form a single data stream, which is then written to a mass storage device media, such as a DVD, a CD, a magnetic disk, or the like.
A write track buffer is often used as temporary storage for the data stream that is to be written to the mass storage device media. Typically, the data stream is read from the write track buffer and written to the mass storage device media in units of one sector or a predefined number of sectors. For example, many DVD write formats use a 16 sector elementary physical writing unit. The size of the write track buffer is often relatively small, such as 8 Mbit in size, and as a result, the sectors will be written to mass storage device as long as there are sufficient number of sectors to write stored in the write track buffer. Therefore, frequent and substantially constant media access operations occur when playing the media, often many times per second.
Often these conventional multimedia write processes suffer from several deficiencies. As similarly described above with respect to many conventional read processes, on platforms where system power consumption is a major concern, such as a portable computing device operating on battery power, the constant intermittent access keeps the media access device spinning all of the time, consuming a significant amount of power and reducing battery life.
Further, the writing speed to a mass storage device is often faster than media stream sampling and encoding. Due to the speed mismatch, for some CD or DVD mass storage writing devices, which are better operated using a constant writing speed, such as 4 times or 16 times of maximal stream data rate, the writing process needs to be either operated at a less than optimal speed, or turned off intermittently to match the slower sampling/encoding process. This process results in worse writing performance and can increase the wear on the mass storage device.
In addition, for some CD or DVD mass storage writing devices, a significant writing latency occurs at the very beginning of the writing process because the mass storage writing device has to spin up the media or disc to a certain speed. Further, when a new writing destination is far from the previous writing destination, the device needs time to seek to the new location. As a result of the relatively small size of the write track buffer, a significant latency in writing can temporarily prevent or halt the sampling/encoding process, and can result in the degradation of encoded stream quality or in the loss of portions of the stream.
Additionally, some multimedia write applications output the encoded multimedia data stream to an intermediate file first, and then the encoded multimedia data stream is written from the intermediate file to the mass storage writing device, such as a DVD or CD device. However, the use of an intermediate file often disadvantageously utilizes a relatively large space in local storage, such as on a hard disk drive, to serve as temporary space. Further, the user of the intermediate file also results in a longer write process as compared to the use of a single pass write process that does not use an intermediate file.
Still further, the destination location on the mass storage media may be randomly selected depending on the writing application. As a result, some CD or DVD writing mass storage devices have to frequently seek to specific locations while performing the writing process, which can result in intermittent writing delays and can also result in faster wearing of the CD or DVD mass storage device.