WO2017036218A1 - 多媒体文件读取方法及装置 - Google Patents

多媒体文件读取方法及装置 Download PDF

Info

Publication number
WO2017036218A1
WO2017036218A1 PCT/CN2016/084845 CN2016084845W WO2017036218A1 WO 2017036218 A1 WO2017036218 A1 WO 2017036218A1 CN 2016084845 W CN2016084845 W CN 2016084845W WO 2017036218 A1 WO2017036218 A1 WO 2017036218A1
Authority
WO
WIPO (PCT)
Prior art keywords
read
multimedia file
unread
data
location
Prior art date
Application number
PCT/CN2016/084845
Other languages
English (en)
French (fr)
Inventor
陈伟
Original Assignee
深圳Tcl数字技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳Tcl数字技术有限公司 filed Critical 深圳Tcl数字技术有限公司
Publication of WO2017036218A1 publication Critical patent/WO2017036218A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4331Caching operations, e.g. of an advertisement for later insertion during playback
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/433Content storage operation, e.g. storage operation in response to a pause request, caching operations
    • H04N21/4335Housekeeping operations, e.g. prioritizing content for deletion because of storage space restrictions

Definitions

  • the present invention relates to the field of multimedia technologies, and in particular, to a multimedia file reading method and apparatus.
  • the playback of multimedia files is generally read by data input.
  • the source of data input can be the multimedia of the player.
  • a file can also be a multimedia file of a network stream.
  • the current player will first cache the multimedia file to be played, and then read the multimedia file in the cache.
  • the cache is cleared after the multimedia file is read, and each time All emptying clears all cached data.
  • a user plays a file for a drag operation, it may need to read the played data, but each time it needs to rewrite the cache, thereby causing repeated writes.
  • the read multimedia file is a video file
  • the required buffer capacity value is also large, and the storage space occupied by the cache in the terminal is large, resulting in low operation efficiency of the terminal.
  • the main purpose of the present invention is to provide a multimedia file reading method and device, which aims to solve the technical problem that the storage space occupied by the cache is large during the process of reading multimedia files, resulting in low operation efficiency of the terminal.
  • the present invention provides a multimedia file reading method, and the multimedia file reading method includes the following steps:
  • Deleting data in the unread cache area and continuing to write data after the second location in the multimedia file in an available storage space in the ring buffer to update the unread cache area;
  • the required data is read from the read position of the unread cache area.
  • the present invention also provides a multimedia file reading method, and the multimedia file reading method includes the following steps:
  • the partial data is cleared to maintain the capacity corresponding to the read buffer area as the first capacity.
  • the present invention further provides a multimedia file reading apparatus, and the multimedia file reading apparatus includes:
  • a determining module configured to determine whether a reading position corresponding to the adjusting operation is in a ring buffer when detecting a playback position adjustment operation input by the multimedia file-based playing interface
  • a reading module configured to start reading the required data from the reading position in the unread buffer area when the reading position is in the unread buffer area of the ring buffer;
  • a processing module configured to update a location of the read cache area and the unread cache area in the ring buffer such that the required data that has been read is located in the read cache area, when the When the capacity corresponding to the read buffer area is greater than the first capacity, the partial data is cleared to keep the capacity corresponding to the read buffer area as the first capacity.
  • the multimedia file reading method and device of the present invention reads multimedia file data in a preset ring buffer, and reads from the unread when the reading position is in the unread buffer area of the ring buffer Reading the required data at the read position of the cache area, and updating the read buffer area and the position of the unread cache area in the ring buffer when the desired data is read, so that the read has been read
  • the required data is located in the read buffer area.
  • the capacity corresponding to the read buffer area is greater than the first capacity
  • the partial data is cleared to keep the capacity corresponding to the read buffer area as the first capacity instead of
  • the multimedia file data is read to clear the cache.
  • the program clears the multimedia file data cached first by buffering the multimedia file data. The storage space occupied by the cache is reduced, and the operating efficiency of the terminal is improved.
  • FIG. 1 is a schematic flow chart of a first embodiment of a method for reading a multimedia file according to the present invention
  • FIG. 2 is a schematic flow chart of a second embodiment of a multimedia file reading method according to the present invention.
  • FIG. 3 is a schematic flowchart of a third embodiment of a method for reading a multimedia file according to the present invention.
  • FIG. 4 is a schematic diagram of functional modules of a first embodiment of a multimedia file reading apparatus according to the present invention.
  • FIG. 5 is a schematic diagram of functional modules of a second embodiment of a multimedia file reading apparatus according to the present invention.
  • the invention provides a multimedia file reading method.
  • FIG. 1 is a schematic flowchart diagram of a first embodiment of a multimedia file reading method according to the present invention.
  • the embodiment provides a multimedia file reading method, and the multimedia file reading method includes:
  • Step S10 when detecting a play position adjustment operation input by the multimedia file-based play interface, determining whether the read position corresponding to the adjustment operation is in a ring buffer;
  • the method before the step S10, includes the following steps: when receiving the read instruction of the multimedia file, acquiring a third capacity value corresponding to the available storage space in the preset ring buffer, and writing the same The required data corresponding to the third capacity value.
  • the triggering manner of the reading instruction of the multimedia file includes: a. when the user clicks to start playing in the playing interface of the multimedia file, the reading instruction of the multimedia file is triggered. b. When the input voice play command is received on the play interface of the multimedia file, such as a voice broadcast, the read command of the multimedia file is triggered. It can be understood that, in this embodiment, a ring buffer is created in advance, and the storage space of the ring buffer is set according to specific needs.
  • the storage space of the ring buffer can be set to 1M.
  • the storage space of the ring buffer may be set to 30M, and when the multimedia file is a picture file, the storage space of the ring buffer may be set to 200K.
  • the ring buffer preferably includes a read cache area, an unread cache area, and an available area.
  • the available area can also be understood as a blank area, that is, the entire ring buffer is divided into three areas, and three areas are logical. The first and last tails can be seen as connected.
  • the read buffer area indicates that the data of these areas has been read. It is still saved for the player's possible backward reading request.
  • the unread buffer area is from the network stream or local.
  • the data read in the file has not been read yet, and the available area indicates the storage space that has not been written.
  • three pointers can be used in the ring buffer to divide the interval, which is the start pointer of the cache, the read pointer Done, the cache pointer End, the Begin and the Done. Read the cache area, Done and End constitute the unread cache area, End and Begin constitute the available area. Because it is a ring buffer, the End pointer moves back to the cache header when it moves to the end, that is, coincides with the Begin pointer. Updates to the location of each zone can be achieved by moving the corresponding pointer.
  • Step S20 when the read position is in the unread buffer area of the ring buffer, start reading the required data from the read position in the unread cache area;
  • Step S30 updating the location of the read cache area and the unread cache area in the ring buffer so that the required data that has been read is located in the read cache area when the read cache is read.
  • the capacity corresponding to the area is greater than the first capacity, the partial data is cleared to maintain the capacity corresponding to the read buffer area as the first capacity.
  • the first capacity value corresponding to the read buffer area when the ring buffer is created, and the first capacity value is used to ensure that During the process of reading the multimedia file, only the multimedia file data of the length of the capacity value may be retained, and the multimedia file data exceeding the first capacity value may be emptied, that is, the multimedia file is updated first during the reading process. Reading the buffer area and the location of the unread buffer area such that the required data that has been read is located in the read buffer area, and when the capacity corresponding to the read buffer area is greater than the first capacity, the clear part is The data maintains the capacity corresponding to the read buffer area as the first capacity.
  • the ring buffer is realized to maintain sufficient free space in real time to cache unwritten multimedia file data, even if the storage space of the ring buffer is smaller than the multimedia file to be read, and the actual read is caused by clearing the cache in real time.
  • the space of the multimedia file data is larger than the storage space of the ring buffer, and the utilization of the ring buffer is improved, and the multimedia file data is not read in the memory or the local file because the buffer space is insufficient, and the multimedia is also improved.
  • the step S30 can be understood from the pointer angle as: first determining the read position, using the read position as the read storage pointer Done, and then adjusting the start pointer according to the first capacity value.
  • the End pointer and the Begin constitutes an available area, which is correspondingly increased, that is, the available space of the ring buffer is increased. It can be understood that the Begin pointer moves from the original position to the new position. The data originally located between the two locations has been emptied, that is, part of the data of the originally read cache area has been cleared.
  • the multimedia file reading method further includes the step of: when the reading position is in the read buffer area, from the Reading the desired data begins at the read location in the read cache area. It can be understood that, when the playback position adjustment operation input by the multimedia file-based play interface is detected, and the read position is within the read buffer area, the reading can be started directly at the read position.
  • the required data in the read cache area enables the user to directly read the required data without repeatedly writing data to the cache when the user inputs the forward operation during the multimedia file reading process.
  • the multimedia file reading method in this embodiment reads multimedia file data in a preset ring buffer, and reads from the unread cache when the reading position is in the unread buffer area of the ring buffer. Reading the required data at the reading position of the area, and updating the position of the read buffer area and the unread buffer area in the ring buffer when the desired data is read, so that the said program has been read
  • the required data is located in the read buffer area.
  • the capacity corresponding to the read buffer area is greater than the first capacity
  • the partial data is cleared to keep the capacity corresponding to the read buffer area as the first capacity, instead of
  • the multimedia file data is read out to clear the cache.
  • the program clears the multimedia file data of the first cache by buffering the multimedia file data. The storage space occupied by the cache is reduced, and the operating efficiency of the terminal is improved.
  • the multimedia file reading method and The method described in the first embodiment is different in that, after the step S10, the multimedia file reading method further includes:
  • Step S40 When the read position is not in the ring buffer, obtain a first position of the read position in the multimedia file, and away from the read cache area in the unread cache area. One end of the second location in the multimedia file;
  • Step S50 determining whether a second capacity value between the first location and the second location in the multimedia file is less than a first preset capacity value
  • Step S60 if the second capacity value is less than or equal to the first preset capacity value, select data with the capacity of the first capacity from the unread buffer area to replace data in the read cache area.
  • Step S70 deleting data in the unread cache area, and continuing to write data after the second position in the multimedia file in the available storage space in the ring buffer to update the unread cache area;
  • Step S80 when the read position is located in the unread cache area, the required data is read from the read position of the unread cache area.
  • the reading position is not in the ring buffer, the data of the multimedia file to be read has not been successfully written, and when the adjustment operation based on the playing interface of the multimedia file is detected, Obtaining a first position of the read location corresponding to the adjustment operation in the multimedia file, and a second location in the unread cache area away from the read cache area at a second location in the multimedia file, and then The second capacity value between the first location and the second location in the multimedia file is compared with the first preset capacity value, and finally, according to the comparison result, the second capacity value and the first pre-determination may be determined.
  • the value of the capacity value is set.
  • the first preset capacity value is a value of the available area in the ring buffer
  • the second capacity value is less than or equal to the first preset.
  • a capacity value indicating that the read position is less than or equal to the available area from an end of the unread buffer area that is far from the read buffer area, and the first read buffer area may be selected first.
  • Replacing data in the read cache area with data of the first capacity, then deleting data in the unread cache area, and continuing to write the same in the available storage space in the ring buffer Data subsequent to the second location in the multimedia file to update the unread cache area, and when the read location is within the unread cache area, read from the read location of the unread cache area The required data.
  • the The multimedia file reading method further includes:
  • Step S90 if the second capacity value is greater than the first preset capacity value, determining that the reading location is in a storage location corresponding to the multimedia file;
  • Step S100 directly reading the required data at a storage location corresponding to the multimedia file.
  • the second capacity value is greater than the first preset capacity value
  • the distance from the read position to the end of the unread buffer area that is far from the read buffer area is greater than the available
  • the area is determined to be in the storage location corresponding to the multimedia file, and the required data is directly read in the storage location corresponding to the multimedia file, and the data is no longer written into the cache and then read from the cache.
  • the multimedia file data buffered in the ring buffer may be emptied, or only data with a size of the first capacity value may be stored in the read buffer area.
  • the multimedia file reading method further includes the step of: deleting the buffer in the ring buffer when the multimedia file data is read in the ring buffer Multimedia file data.
  • the ring buffer is cleared, so that the multimedia file data to be read is cached when the multimedia file is read next time.
  • the data in the multimedia file is continuously written in the available storage space in the ring buffer to update the unread cache. region. Equivalent to reading the data, and each time the unread data (the available data) in the ring buffer is found to be less than the second preset capacity value, the writing continues in the available storage space in the ring buffer.
  • the data in the multimedia file is used to update the unread cache area, that is, the data is immediately added while the data is being erased, so as to avoid the waiting time process when reading data, and also ensure the storage space utilization of the ring buffer area, avoiding large Some storage space is idle.
  • the present invention further provides a multimedia file reading apparatus.
  • FIG. 4 is a schematic diagram of functional modules of a first embodiment of a multimedia file reading apparatus according to the present invention.
  • the functional block diagram shown in FIG. 4 is merely an exemplary diagram of a preferred embodiment, and those skilled in the art surround the functional modules of the multimedia file reading device shown in FIG.
  • the function module can be easily supplemented by a new function module; the name of each function module is a custom name, which is only used to assist in understanding various program function blocks of the multimedia file reading device, and is not used to limit the technical solution of the present invention.
  • the functionality to be achieved by the functional modules that each define the name At the heart of the solution is the functionality to be achieved by the functional modules that each define the name.
  • the embodiment provides a multimedia file reading device, and the multimedia file reading device includes:
  • a determining module 10 configured to determine, when detecting a playback position adjustment operation input by the multimedia file-based playing interface, whether the reading position corresponding to the adjusting operation is in a ring buffer;
  • the multimedia file reading apparatus includes a processing module, and the processing module is configured to acquire a third capacity corresponding to the available storage space in the preset ring buffer when receiving the read instruction of the multimedia file. a value, and writes the required data corresponding to the third capacity value.
  • the triggering manner of the reading instruction of the multimedia file includes: a. when the user clicks to start playing in the playing interface of the multimedia file, the reading instruction of the multimedia file is triggered. b. When the input voice play command is received on the play interface of the multimedia file, such as a voice broadcast, the read command of the multimedia file is triggered. It can be understood that, in this embodiment, a ring buffer is created in advance, and the storage space of the ring buffer is set according to specific needs.
  • the storage space of the ring buffer can be set to 1M.
  • the storage space of the ring buffer may be set to 30M, and when the multimedia file is a picture file, the storage space of the ring buffer may be set to 200K.
  • the ring buffer preferably includes a read cache area, an unread cache area, and an available area.
  • the available area can also be understood as a blank area, that is, the entire ring buffer is divided into three areas, and three areas are logical. The first and last tails can be seen as connected.
  • the read buffer area indicates that the data of these areas has been read. It is still saved for the player's possible backward reading request.
  • the unread buffer area is from the network stream or local.
  • the data read in the file has not been read yet, and the available area indicates the storage space that has not been written.
  • three pointers can be used in the ring buffer to divide the interval, which is the start pointer of the cache, the read pointer Done, the cache pointer End, the Begin and the Done. Read the cache area, Done and End constitute the unread cache area, End and Begin constitute the available area. Because it is a ring buffer, the End pointer moves back to the cache header when it moves to the end, that is, coincides with the Begin pointer. Updates to the location of each zone can be achieved by moving the corresponding pointer.
  • the reading module 20 is configured to start reading the required data from the reading position in the unread buffer area when the reading position is in the unread buffer area of the ring buffer;
  • the determining module 10 when the playback position adjustment operation based on the playback interface of the multimedia file is detected, the determining module 10 first determines whether the read position corresponding to the adjustment operation is in the ring buffer, if In the ring buffer, the determining module 10 further determines whether a read position corresponding to the adjustment operation is in the unread cache area, and if the read position is in the unread cache area, Then, the reading module 20 can directly read the required data from the reading position of the unread buffer area.
  • a processing module 30 configured to update a location of the read cache area and the unread cache area in the ring buffer, so that the required data that has been read is located in the read cache area, when When the capacity corresponding to the read buffer area is greater than the first capacity, the partial data is cleared to maintain the capacity corresponding to the read buffer area as the first capacity.
  • the processing module 30 first updates the location of the read cache area and the unread cache area such that the required data that has been read is located in the read cache area, and the capacity corresponding to the read cache area is greater than the first In the case of capacity, the processing module 30 clears part of the data so that the capacity corresponding to the read buffer area remains at the first capacity.
  • the ring buffer is realized to maintain sufficient free space in real time to cache unwritten multimedia file data, even if the storage space of the ring buffer is smaller than the multimedia file to be read, and the actual read is caused by clearing the cache in real time.
  • the space of the multimedia file data is larger than the storage space of the ring buffer, and the utilization of the ring buffer is improved, and the multimedia file data is not read in the memory or the local file because the buffer space is insufficient, and the multimedia is also improved. The efficiency of reading files.
  • the processing module 30 updates the positions of the read cache area and the unread cache area such that the required data that has been read is located in the read cache area when the read
  • the capacity corresponding to the buffer area is greater than the first capacity
  • the partial data is cleared to keep the capacity corresponding to the read buffer area as the first capacity.
  • the determining module 10 first determines the read position. The read position is taken as the read storage pointer Done, and then the processing module 30 adjusts the start pointer Begin according to the first capacity value, such that the start pointer Begin and the read storage pointer Done The storage space is maintained as the first capacity value.
  • the End pointer and the Begin pointer constitute an available area, which is correspondingly increased, that is, the available space of the ring buffer is increased. It can be understood that the Begin pointer moves from the original position to the new position. The data originally located between the two locations has been emptied, that is, part of the data of the originally read cache area has been cleared.
  • the reading module 20 is further configured to start reading the required position from the reading position in the read buffer area when the reading position is in the read buffer area. data. It can be understood that, in the detection of the playback position adjustment operation input by the multimedia file-based playback interface, it can be understood that the playback position adjustment operation input on the multimedia file-based playback interface is detected, and the read position is in the When the read buffer area is read, the reading module 20 can start reading the required data in the read cache area directly at the read position, thereby realizing the user in the multimedia file reading process. When the forward operation is entered, the data required can be directly read without repeating the data write to the cache.
  • the multimedia file reading apparatus of this embodiment reads multimedia file data in a preset ring buffer, and reads from the unread cache when the reading position is in the unread buffer area of the ring buffer. Reading the required data at the reading position of the area, and updating the position of the read buffer area and the unread buffer area in the ring buffer when the desired data is read, so that the said program has been read
  • the required data is located in the read buffer area.
  • the capacity corresponding to the read buffer area is greater than the first capacity
  • the partial data is cleared to keep the capacity corresponding to the read buffer area as the first capacity, instead of
  • the multimedia file data is read out to clear the cache.
  • the program clears the multimedia file data of the first cache by buffering the multimedia file data. The storage space occupied by the cache is reduced, and the operating efficiency of the terminal is improved.
  • the multimedia file reading apparatus and the multimedia file reading apparatus are The device in the first embodiment is different in that the multimedia file reading device further includes:
  • the obtaining module 40 is configured to acquire a first location of the read location in the multimedia file when the read location is not in the ring buffer, and to move away from the read location in the unread cache area Reading a second end of the cache area at a second location in the multimedia file;
  • the determining module 10 is further configured to determine whether a second capacity value between the first location and the second location in the multimedia file is less than a first preset capacity value
  • the replacement module 50 is configured to: if the second capacity value is less than or equal to the first preset capacity value, select, from the unread buffer area, data that is the first capacity to replace the read cache area. Data in
  • the processing module 30 is further configured to delete data in the unread cache area, and continue to write data after the second location in the multimedia file in an available storage space in the ring buffer to update the location. Said unread cache area;
  • the reading module 20 is further configured to read the required data from the read position of the unread cache area when the read position is located in the unread cache area.
  • the reading position is not in the ring buffer, the data of the multimedia file to be read has not been successfully written, and when the adjustment operation based on the playing interface of the multimedia file is detected,
  • the obtaining module 40 first acquires a first position of the read position corresponding to the adjustment operation in the multimedia file, and a second end of the unread cache area away from the read cache area in the multimedia file. Positioning, then the determining module 10 compares the second capacity value between the first location and the second location in the multimedia file with a first preset capacity value, and finally determines the The relationship between the second capacity value and the first preset capacity value.
  • the first preset capacity value is a capacity value of an available area in the ring buffer, and when the second capacity is The value is less than or equal to the first preset capacity value, indicating that the read position is less than or equal to the available area from the end of the unread buffer area that is far from the read buffer area.
  • the replacement module 50 may first replace data in the read cache area with data of the first capacity from the unread cache area, and then the processing module 30 deletes the unread cache area.
  • the read module 20 reads the required data from the read position of the unread cache area.
  • a third embodiment of the multimedia file reading apparatus of the present invention is proposed based on the second embodiment.
  • this embodiment
  • the determining module 10 is further configured to: if the second capacity value is greater than the first preset capacity value, determine that the reading location is in a storage location corresponding to the multimedia file;
  • the reading module 20 is further configured to directly read the required data at a storage location corresponding to the multimedia file.
  • the determining module 10 determines that the reading location is in a storage location corresponding to the multimedia file, and the reading module 20 starts to read the required data directly in a storage location corresponding to the multimedia file, and no longer The data is written to the cache and then read from the cache. For large data volume readings directly from the network side or local multimedia files, you can avoid excessive cache space or frequent writes and reads due to insufficient cache space, resulting in inefficiency. At this time, the multimedia file data buffered in the ring buffer may be emptied, or only data with a size of the first capacity value may be stored in the read buffer area.
  • the multimedia file reading apparatus further includes a deleting module, and the deleting module is configured to delete the multimedia file data when the ring buffer is read.
  • the multimedia file data cached in the ring buffer.
  • the ring buffer is cleared, so that the multimedia file data to be read is cached when the multimedia file is read next time.
  • multimedia file reading apparatus further includes:
  • An update module configured to continue writing data in the multimedia file in an available storage space in the ring buffer to update the data when the data capacity of the unread buffer area is less than a second preset capacity value Unread cache area. Equivalent to reading the data, and each time the unread data (the available data) in the ring buffer is found to be less than the second preset capacity value, the writing continues in the available storage space in the ring buffer.
  • the data in the multimedia file is used to update the unread cache area, that is, the data is immediately added while the data is being erased, so as to avoid the waiting time process when reading data, and also ensure the storage space utilization of the ring buffer area, avoiding large Some storage space is idle.
  • the foregoing embodiment method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be through hardware, but in many cases, the former is better.
  • Implementation Based on such understanding, the technical solution of the present invention, which is essential or contributes to the prior art, may be embodied in the form of a software product stored in a storage medium (such as ROM/RAM, disk,
  • the optical disc includes a number of instructions for causing a terminal device (which may be a cell phone, a computer, a server, an air conditioner, or a network device, etc.) to perform the methods described in various embodiments of the present invention.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Human Computer Interaction (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种多媒体文件读取方法,在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;以及更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。本发明还公开了一种多媒体文件读取装置。本发明提高了多媒体文件读取过程中终端的运行效率。

Description

多媒体文件读取方法及装置
技术领域
本发明涉及多媒体技术领域,尤其涉及一种多媒体文件读取方法及装置。
背景技术
随着多媒体技术的发展,多媒体技术领域的各项业务也越来越成熟,在多媒体文件的播放过程中,多媒体文件的播放一般由数据输入读取,数据输入的来源可以是播放器本地的多媒体文件,也可以是网络流的多媒体文件。现在的播放器在播放多媒体文件时,都会先对待播放的多媒体文件建立缓存,然后在所述缓存中读取多媒体文件,一般情况下,都是在多媒体文件读取结束后才清空缓存,并且每次清空都将所有缓存数据全部清除。而当用户播放文件进行拖动操作时,其有可能会需要读取已播放的数据,但每一次都需要重新写入缓存,由此造成重复写入。并且,当读取的多媒体文件是视频文件时,所需的缓存的容量值也较大,而终端中缓存占用的存储空间较大,导致终端的运行效率低。
发明内容
本发明的主要目的在于提出一种多媒体文件读取方法及装置,旨在解决多媒体文件读取过程中,缓存占用的存储空间较大,导致终端的运行效率低的技术问题。
为实现上述目的,本发明提供的一种多媒体文件读取方法,所述多媒体文件读取方法包括以下步骤:
在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量;
在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据;
在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
此外,为实现上述目的,本发明还提出一种多媒体文件读取方法,所述多媒体文件读取方法包括以下步骤:
在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;以及
更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
此外,为实现上述目的,本发明还提出一种多媒体文件读取装置,所述多媒体文件读取装置包括:
确定模块,用于在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
读取模块,用于在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
处理模块,用于更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
本发明提出的多媒体文件读取方法及装置,在预设的环形缓冲区内读取多媒体文件数据,且当读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域的读取位置处开始读取所需数据,并在读取所需数据时更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使其所述已读缓存区域对应的容量保持为第一容量,而不是在多媒体文件读取过程中,把多媒体文件数据读取完才清空缓存,本方案在所述环形缓冲区中读取多媒体文件数据时,通过边缓存多媒体文件数据边清空先缓存的部分多媒体文件数据,减小了缓存占用的存储空间,提高了终端的运行效率。
附图说明
图1为本发明多媒体文件读取方法第一实施例的流程示意图;
图2为本发明多媒体文件读取方法第二实施例的流程示意图;
图3为本发明多媒体文件读取方法第三实施例的流程示意图;
图4为本发明多媒体文件读取装置第一实施例的功能模块示意图;
图5为本发明多媒体文件读取装置第二实施例的功能模块示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
具体实施方式
应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。
本发明提供一种多媒体文件读取方法。
参照图1,图1为本发明多媒体文件读取方法第一实施例的流程示意图。
本实施例提出一种多媒体文件读取方法,所述多媒体文件读取方法包括:
步骤S10,在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
在本实施例中,所述步骤S10之前,包括步骤:在接收到多媒体文件的读取指令时,获取预设的环形缓冲区中可用存储空间对应的第三容量值,并写入与所述第三容量值对应的所需数据。所述多媒体文件的读取指令的触发方式包括:a、用户在所述多媒体文件的播放界面点击开始播放时,触发所述多媒体文件的读取指令。b、在所述多媒体文件的播放界面接收到输入的语音播放指令如语音播报开始播放时,触发所述多媒体文件的读取指令。可以理解的是,本实施例中事先创建环形缓冲区,所述环形缓冲区的存储空间根据具体需要进行设置,如多媒体文件为音频文件时,所述环形缓冲区的存储空间可设置为1M,所述多媒体文件为视频文件时,所述环形缓冲区的存储空间可设置为30M,所述多媒体文件为图片文件时,所述环形缓冲区的存储空间可设置为200K。其中,所述环形缓冲区优选包括已读缓存区域、未读缓存区域以及可用区域,所述可用区域也可以理解为空白区域,也就是整个环形缓冲区分为三个区域,且三个区域在逻辑上其首尾可以看成是相连的,已读缓存区域表示这些区域的数据已经被读取过,现在依然保存是为了播放器可能的后向读取要求,未读缓存区域是从网络流或者本地文件里面读取的数据,目前尚未被读取过,可用区域表示未被写入的存储空间。为更好理解本方案,可在所述环形缓冲区中使用3个指针划分其区间,分别是缓存的开始指针Begin,已读取存储指针Done,已写入缓存指针End,Begin和Done构成已读缓存区域,Done和End构成未读缓存区域,End和Begin构成可用区域,由于是环形缓冲区,则End指针移动到末尾的时候又回到缓存的头部,即与所述Begin指针重合。各个区域位置的更新可以通过移动相应的指针实现。
步骤S20,在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
在本实施例中,在检测到基于多媒体文件所在播放界面输入的播放位置调整操作时,先确定所述调整操作对应的读取位置是否在所述环形缓冲区内,若在所述环形缓冲区内,进一步确定所述调整操作对应的读取位置是否在所述未读取缓存区域内,若所述读取位置在所述未读取缓存区域内,则可直接从所述未读缓存区域的读取位置处开始读取所需数据。
步骤S30,更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
在本实施例中,为了提高多媒体文件读取过程中终端的运行效率,优选在创建环形缓冲区时,先设置已读缓存区域对应的第一容量值,所述第一容量值用于保证在多媒体文件读取过程中,仅保留所述容量值长度的多媒体文件数据即可,超出所述第一容量值的多媒体文件数据可以进行清空,也就是在多媒体文件在读取过程中,先更新已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使其所述已读缓存区域对应的容量保持为第一容量。实现了所述环形缓冲区实时保持足够的可用空间,以缓存未写入的多媒体文件数据,即使所述环形缓冲区的存储空间小于待读取的多媒体文件,也由于实时清空缓存,使得实际读取的多媒体文件数据的空间大于所述环形缓冲区的存储空间,提高了环形缓冲区的利用率,而不会因为缓存空间不足而去内存或本地文件中读取多媒体文件数据,也提高了多媒体文件的读取效率。在本实施例中,所述步骤S30从指针角度可理解为:先确定所述读取位置,将所述读取位置作为已读取存储指针Done,然后根据所述第一容量值调节开始指针Begin,使得所述开始指针Begin和所述已读取存储指针Done之间的存储空间保持为所述第一容量值,此时,由于所述开始指针Begin移动了,则所述End指针和Begin指针构成可用区域也相应增加了,即加大了环形缓冲区的可用空间。可以理解的是,伴随着Begin指针从原位置移动至新位置。原先位于此两位置之间的数据已被清空,即原所述已读缓存区域的部分数据已被清除。
进一步地,为提高多媒体文件读取的灵活性,所述步骤S10之后,所述多媒体文件读取方法还包括步骤:在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据。可以理解的是,在检测到基于多媒体文件的播放界面输入的播放位置调整操作,且所述读取位置在所述已读缓存区域内时,则可直接在所述读取位置处开始读取所述已读缓存区域中的所述所需数据,实现了用户在多媒体文件读取过程中输入了前向操作时,无需重复向缓存重复写入数据也可直接读取述所需数据。
本实施例提出的多媒体文件读取方法,在预设的环形缓冲区内读取多媒体文件数据,且当读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域的读取位置处开始读取所需数据,并在读取所需数据时更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使其所述已读缓存区域对应的容量保持为第一容量,而不是在多媒体文件读取过程中,把多媒体文件数据读取完才清空缓存,本方案在所述环形缓冲区中读取多媒体文件数据时,通过边缓存多媒体文件数据边清空先缓存的部分多媒体文件数据,减小了缓存占用的存储空间,提高了终端的运行效率。
进一步地,为了提高多媒体文件读取的灵活性,基于第一实施例提出本发明多媒体文件读取方法的第二实施例,参照图2,在本实施例中,所述多媒体文件读取方法与第一实施例中所述方法的区别在于,所述步骤S10之后,所述多媒体文件读取方法还包括:
步骤S40,在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
步骤S50,确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
步骤S60,若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
步骤S70,删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
步骤S80,当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
在本实施例中,若所述读取位置不在所述环形缓冲区内,说明待读取的多媒体文件数据还没写入成功,在检测到基于多媒体文件所在播放界面输入的调整操作时,先获取所述调整操作对应的读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离已读缓存区域的一端在所述多媒体文件中的第二位置,然后将所述多媒体文件中第一位置和第二位置之间的第二容量值与第一预设容量值进行比对,最后根据比对结果,即可确定所述第二容量值与所述第一预设容量值的大小关系,本实施例中,优选所述第一预设容量值为所述环形缓冲区中可用区域的容量值,当所述第二容量值小于或等于所述第一预设容量值,说明所述读取位置距离所述未读缓存区域中远离已读缓存区域的一端的距离小于或等于所述可用区域,则可先从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据,然后删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域,当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
进一步地,为了提高多媒体文件读取的灵活性,基于第二实施例提出本发明多媒体文件读取方法的第三实施例,在本实施例中,参照图3,所述步骤S50之后,所述多媒体文件读取方法还包括:
步骤S90,若所述第二容量值大于所述第一预设容量值,确定所述读取位置在所述多媒体文件对应的存储位置;
步骤S100,在多媒体文件对应的存储位置开始直接读取所述所需数据。
在本实施例中,若所述第二容量值大于所述第一预设容量值,说明所述读取位置距离所述未读缓存区域中远离已读缓存区域的一端的距离大于所述可用区域,确定所述读取位置在所述多媒体文件对应的存储位置,直接在多媒体文件对应的存储位置开始读取所述所需数据,而不再将数据写入缓存再从缓存读取。对于较大数据量的读取直接从网络端或本地的多媒体文件读取,可以避免缓存空间过大,或是因缓存空间不足而导致的频繁写入及读取,造成效率低下。此时,还可将所述环形缓冲区中缓存的多媒体文件数据清空,或是仅保留大小为第一容量值的数据存储在所述已读缓存区域。
进一步地,为了提高多媒体文件读取的智能性,所述多媒体文件读取方法还包括步骤:在所述环形缓冲区中读取完所述多媒体文件数据时,删除所述环形缓冲区中缓存的多媒体文件数据。实现了读取完多媒体文件数据时,清空所述环形缓冲区,以供下一次读取多媒体文件时,缓存待读取的多媒体文件数据。
进一步地,当所述未读缓存区域的数据容量小于第二预设容量值时,在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中数据以更新所述未读缓存区域。相当于在读取数据时,每次发现环形缓冲区中的未读数据(即可用数据)已经小于第二预设容量值时,即时在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中数据以更新所述未读缓存区域,即在清除数据的同时也即时补充数据,以避免读取数据时等待时间过程,同时也确保环形缓存区域的存储空间利用率,避免大部分存储空间处于空闲状态。
本发明进一步提供一种多媒体文件读取装置。
参照图4,图4为本发明多媒体文件读取装置第一实施例的功能模块示意图。
需要强调的是,对本领域的技术人员来说,图4所示功能模块图仅仅是一个较佳实施例的示例图,本领域的技术人员围绕图4所示的多媒体文件读取装置的功能模块,可轻易进行新的功能模块的补充;各功能模块的名称是自定义名称,仅用于辅助理解该多媒体文件读取装置的各个程序功能块,不用于限定本发明的技术方案,本发明技术方案的核心是,各自定义名称的功能模块所要达成的功能。
本实施例提出一种多媒体文件读取装置,所述多媒体文件读取装置包括:
确定模块10,用于在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
在本实施例中,所述多媒体文件读取装置包括处理模块,所述处理模块用于在接收到多媒体文件的读取指令时,获取预设的环形缓冲区中可用存储空间对应的第三容量值,并写入与所述第三容量值对应的所需数据。所述多媒体文件的读取指令的触发方式包括:a、用户在所述多媒体文件的播放界面点击开始播放时,触发所述多媒体文件的读取指令。b、在所述多媒体文件的播放界面接收到输入的语音播放指令如语音播报开始播放时,触发所述多媒体文件的读取指令。可以理解的是,本实施例中事先创建环形缓冲区,所述环形缓冲区的存储空间根据具体需要进行设置,如多媒体文件为音频文件时,所述环形缓冲区的存储空间可设置为1M,所述多媒体文件为视频文件时,所述环形缓冲区的存储空间可设置为30M,所述多媒体文件为图片文件时,所述环形缓冲区的存储空间可设置为200K。其中,所述环形缓冲区优选包括已读缓存区域、未读缓存区域以及可用区域,所述可用区域也可以理解为空白区域,也就是整个环形缓冲区分为三个区域,且三个区域在逻辑上其首尾可以看成是相连的,已读缓存区域表示这些区域的数据已经被读取过,现在依然保存是为了播放器可能的后向读取要求,未读缓存区域是从网络流或者本地文件里面读取的数据,目前尚未被读取过,可用区域表示未被写入的存储空间。为更好理解本方案,可在所述环形缓冲区中使用3个指针划分其区间,分别是缓存的开始指针Begin,已读取存储指针Done,已写入缓存指针End,Begin和Done构成已读缓存区域,Done和End构成未读缓存区域,End和Begin构成可用区域,由于是环形缓冲区,则End指针移动到末尾的时候又回到缓存的头部,即与所述Begin指针重合。各个区域位置的更新可以通过移动相应的指针实现。
读取模块20,用于在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
在本实施例中,在检测到基于多媒体文件所在播放界面输入的播放位置调整操作时,所述确定模块10先确定所述调整操作对应的读取位置是否在所述环形缓冲区内,若在所述环形缓冲区内,所述确定模块10进一步确定所述调整操作对应的读取位置是否在所述未读取缓存区域内,若所述读取位置在所述未读取缓存区域内,则所述读取模块20可直接从所述未读缓存区域的读取位置处开始读取所需数据。
处理模块30,用于更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
在本实施例中,为了提高多媒体文件读取过程中终端的运行效率,优选在创建环形缓冲区时,先设置已读缓存区域对应的第一容量值,所述第一容量值用于保证在多媒体文件读取过程中,仅保留所述容量值长度的多媒体文件数据即可,超出所述第一容量值的多媒体文件数据可以进行清空,也就是在多媒体文件在读取过程中,所述处理模块30先更新已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,所述处理模块30清除部分数据使其所述已读缓存区域对应的容量保持为第一容量。实现了所述环形缓冲区实时保持足够的可用空间,以缓存未写入的多媒体文件数据,即使所述环形缓冲区的存储空间小于待读取的多媒体文件,也由于实时清空缓存,使得实际读取的多媒体文件数据的空间大于所述环形缓冲区的存储空间,提高了环形缓冲区的利用率,而不会因为缓存空间不足而去内存或本地文件中读取多媒体文件数据,也提高了多媒体文件的读取效率。在本实施例中,所述处理模块30更新已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使其所述已读缓存区域对应的容量保持为第一容量从指针角度可理解为:所述确定模块10先确定所述读取位置,将所述读取位置作为已读取存储指针Done,然后所述处理模块30根据所述第一容量值调节开始指针Begin,使得所述开始指针Begin和所述已读取存储指针Done之间的存储空间保持为所述第一容量值,此时,由于所述开始指针Begin移动了,则所述End指针和Begin指针构成可用区域也相应增加了,即加大了环形缓冲区的可用空间。可以理解的是,伴随着Begin指针从原位置移动至新位置。原先位于此两位置之间的数据已被清空,即原所述已读缓存区域的部分数据已被清除。
进一步地,所述读取模块20还用于在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据。可以理解的是,在检测到基于多媒体文件的播放界面输入的播放位置调整操作,可以理解的是,在检测到基于多媒体文件的播放界面输入的播放位置调整操作,且所述读取位置在所述已读缓存区域内时,则所述读取模块20可直接在所述读取位置处开始读取所述已读缓存区域中的所述所需数据,实现了用户在多媒体文件读取过程中输入了前向操作时,无需重复向缓存重复写入数据也可直接读取述所需数据。
本实施例提出的多媒体文件读取装置,在预设的环形缓冲区内读取多媒体文件数据,且当读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域的读取位置处开始读取所需数据,并在读取所需数据时更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使其所述已读缓存区域对应的容量保持为第一容量,而不是在多媒体文件读取过程中,把多媒体文件数据读取完才清空缓存,本方案在所述环形缓冲区中读取多媒体文件数据时,通过边缓存多媒体文件数据边清空先缓存的部分多媒体文件数据,减小了缓存占用的存储空间,提高了终端的运行效率。
进一步地,为了提高多媒体文件读取的灵活性,基于第一实施例提出本发明多媒体文件读取装置的第二实施例,参照图5,在本实施例中,所述多媒体文件读取装置与第一实施例中所述装置的区别在于,所述多媒体文件读取装置还包括:
获取模块40,用于在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
所述确定模块10,还用于确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
替换模块50,用于若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
所述处理模块30,还用于删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
所述读取模块20,还用于当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
在本实施例中,若所述读取位置不在所述环形缓冲区内,说明待读取的多媒体文件数据还没写入成功,在检测到基于多媒体文件所在播放界面输入的调整操作时,所述获取模块40先获取所述调整操作对应的读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离已读缓存区域的一端在所述多媒体文件中的第二位置,然后所述确定模块10将所述多媒体文件中第一位置和第二位置之间的第二容量值与第一预设容量值进行比对,最后根据比对结果,即可确定所述第二容量值与所述第一预设容量值的大小关系,本实施例中,优选所述第一预设容量值为所述环形缓冲区中可用区域的容量值,当所述第二容量值小于或等于所述第一预设容量值,说明所述读取位置距离所述未读缓存区域中远离已读缓存区域的一端的距离小于或等于所述可用区域,则所述替换模块50可先从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据,然后所述处理模块30删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域,当所述读取位置位于所述未读缓存区域内时,所述读取模块20从所述未读缓存区域的所述读取位置开始读取所述所需数据。
进一步地,为了提高多媒体文件读取的灵活性,基于第二实施例提出本发明多媒体文件读取装置的第三实施例,在本实施例中,
所述确定模块10,还用于若所述第二容量值大于所述第一预设容量值,确定所述读取位置在所述多媒体文件对应的存储位置;
所述读取模块20,还用于在多媒体文件对应的存储位置开始直接读取所述所需数据。
在本实施例中,若所述第二容量值大于所述第一预设容量值,说明所述读取位置距离所述未读缓存区域中远离已读缓存区域的一端的距离大于所述可用区域,所述确定模块10确定所述读取位置在所述多媒体文件对应的存储位置,所述读取模块20直接在多媒体文件对应的存储位置开始读取所述所需数据,而不再将数据写入缓存再从缓存读取。对于较大数据量的读取直接从网络端或本地的多媒体文件读取,可以避免缓存空间过大,或是因缓存空间不足而导致的频繁写入及读取,造成效率低下。此时,还可将所述环形缓冲区中缓存的多媒体文件数据清空,或是仅保留大小为第一容量值的数据存储在所述已读缓存区域。
进一步地,为了提高多媒体文件读取的智能性,所述多媒体文件读取装置还包括删除模块,所述删除模块用于在所述环形缓冲区中读取完所述多媒体文件数据时,删除所述环形缓冲区中缓存的多媒体文件数据。实现了读取完多媒体文件数据时,清空所述环形缓冲区,以供下一次读取多媒体文件时,缓存待读取的多媒体文件数据。
进一步地,所述多媒体文件读取装置还包括:
更新模块,用于当所述未读缓存区域的数据容量小于第二预设容量值时,在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中的数据以更新所述未读缓存区域。相当于在读取数据时,每次发现环形缓冲区中的未读数据(即可用数据)已经小于第二预设容量值时,即时在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中数据以更新所述未读缓存区域,即在清除数据的同时也即时补充数据,以避免读取数据时等待时间过程,同时也确保环形缓存区域的存储空间利用率,避免大部分存储空间处于空闲状态。
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其它变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者装置不仅包括那些要素,而且还包括没有明确列出的其它要素,或者是还包括为这种过程、方法、物品或者装置所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者装置中还存在另外的相同要素。
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本发明各个实施例所述的方法。
以上仅为本发明的优选实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其它相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (13)

  1. 一种多媒体文件读取方法,其特征在于,所述多媒体文件读取方法包括以下步骤:
    在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
    在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
    更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量;
    在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据;
    在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
    确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
    若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
    删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
    当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
  2. 如权利要求1所述的多媒体文件读取方法,其特征在于,所述确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值的步骤之后,所述多媒体文件读取方法还包括:
    若所述第二容量值大于所述第一预设容量值,确定所述读取位置在所述多媒体文件对应的存储位置;
    在多媒体文件对应的存储位置开始直接读取所述所需数据。
  3. 如权利要求1所述的多媒体文件读取方法,其特征在于,所述多媒体文件读取方法还包括:
    当所述未读缓存区域的数据容量小于第二预设容量值时,在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中的数据以更新所述未读缓存区域。
  4. 一种多媒体文件读取方法,其特征在于,所述多媒体文件读取方法包括以下步骤:
    在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
    在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;以及
    更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
  5. 如权利要求4所述的多媒体文件读取方法,其特征在于,所述在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内的步骤之后,所述多媒体文件读取方法还包括:
    在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据。
  6. 如权利要求4所述的多媒体文件读取方法,其特征在于,所述在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内的步骤之后,所述多媒体文件读取方法还包括:
    在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
    确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
    若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
    删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
    当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
  7. 如权利要求6所述的多媒体文件读取方法,其特征在于,所述确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值的步骤之后,所述多媒体文件读取方法还包括:
    若所述第二容量值大于所述第一预设容量值,确定所述读取位置在所述多媒体文件对应的存储位置;
    在多媒体文件对应的存储位置开始直接读取所述所需数据。
  8. 如权利要求4所述的多媒体文件读取方法,其特征在于,所述多媒体文件读取方法还包括:
    当所述未读缓存区域的数据容量小于第二预设容量值时,在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中的数据以更新所述未读缓存区域。
  9. 一种多媒体文件读取装置,其特征在于,所述多媒体文件读取装置包括:
    确定模块,用于在检测到基于多媒体文件的播放界面输入的播放位置调整操作时,确定所述调整操作对应的读取位置是否在环形缓冲区内;
    读取模块,用于在所述读取位置在所述环形缓冲区的未读缓存区域内时,从所述未读缓存区域中的所述读取位置处开始读取所需数据;
    处理模块,用于更新所述环形缓冲区中已读缓存区域和所述未读缓存区域的位置以使已被读取的所述所需数据位于所述已读缓存区域内,当所述已读缓存区域对应的容量大于第一容量时,清除部分数据使所述已读缓存区域对应的容量保持为所述第一容量。
  10. 如权利要求9所述的多媒体文件读取装置,其特征在于,所述读取模块还用于在所述读取位置在所述已读缓存区域内时,从所述已读缓存区域中的所述读取位置处开始读取所述所需数据。
  11. 如权利要求9所述的多媒体文件读取装置,其特征在于,所述多媒体文件读取装置还包括:
    获取模块,用于在所述读取位置不在所述环形缓冲区内时,获取所述读取位置在所述多媒体文件中的第一位置,以及所述未读缓存区域中远离所述已读缓存区域的一端在所述多媒体文件中的第二位置;
    所述确定模块,还用于确定所述多媒体文件中第一位置和第二位置之间的第二容量值是否小于第一预设容量值;
    替换模块,用于若所述第二容量值小于或等于所述第一预设容量值,从所述未读缓存区域中选取容量为所述第一容量的数据替换所述已读缓存区域中的数据;
    所述处理模块,还用于删除所述未读缓存区域中的数据,并在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中第二位置之后的数据以更新所述未读缓存区域;
    所述读取模块,还用于当所述读取位置位于所述未读缓存区域内时,从所述未读缓存区域的所述读取位置开始读取所述所需数据。
  12. 如权利要求11所述的多媒体文件读取装置,其特征在于,所述确定模块,还用于若所述第二容量值大于所述第一预设容量值,确定所述读取位置在所述多媒体文件对应的存储位置;
    所述读取模块,还用于在多媒体文件对应的存储位置开始直接读取所述所需数据。
  13. 如权利要求9所述的多媒体文件读取装置,其特征在于,所述多媒体文件读取装置还包括:
    更新模块,用于当所述未读缓存区域的数据容量小于第二预设容量值时,在所述环形缓冲区内的可用存储空间内继续写入所述多媒体文件中的数据以更新所述未读缓存区域。
PCT/CN2016/084845 2015-08-28 2016-06-03 多媒体文件读取方法及装置 WO2017036218A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510543847.9A CN105142004B (zh) 2015-08-28 2015-08-28 多媒体文件读取方法及装置
CN201510543847.9 2015-08-28

Publications (1)

Publication Number Publication Date
WO2017036218A1 true WO2017036218A1 (zh) 2017-03-09

Family

ID=54727189

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/084845 WO2017036218A1 (zh) 2015-08-28 2016-06-03 多媒体文件读取方法及装置

Country Status (2)

Country Link
CN (1) CN105142004B (zh)
WO (1) WO2017036218A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111866419A (zh) * 2019-04-24 2020-10-30 杭州海康微影传感科技有限公司 热成像图像显示方法、装置及热成像设备
CN112379844A (zh) * 2020-11-25 2021-02-19 深圳市华宝电子科技有限公司 一种数据保护方法、装置、电子终端及存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105142004B (zh) * 2015-08-28 2018-09-04 深圳Tcl数字技术有限公司 多媒体文件读取方法及装置
CN106528302A (zh) * 2016-10-18 2017-03-22 广州视睿电子科技有限公司 多系统一体机文件共享的方法及装置
CN108415667B (zh) * 2018-01-31 2021-06-25 惠州华阳通用电子有限公司 一种音频文件加载方法
CN109547335B (zh) * 2018-12-28 2021-06-25 天津字节跳动科技有限公司 会话消息处理方法和装置
CN114679624B (zh) * 2022-03-08 2024-09-13 上海连尚网络科技有限公司 一种确定视频信息的已读状态信息的方法与设备
CN115098454B (zh) * 2022-07-26 2024-08-27 北京天融信网络安全技术有限公司 一种数据处理方法及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6124868A (en) * 1998-03-24 2000-09-26 Ati Technologies, Inc. Method and apparatus for multiple co-processor utilization of a ring buffer
CN101447994A (zh) * 2008-12-30 2009-06-03 深圳市迅雷网络技术有限公司 多媒体文件的下载播放方法及设备
CN103391468A (zh) * 2012-05-08 2013-11-13 安凯(广州)微电子技术有限公司 一种基于移动终端的网络视频数据的缓冲控制方法及系统
CN103744621A (zh) * 2013-12-31 2014-04-23 深圳英飞拓科技股份有限公司 缓冲区循环读写的方法及装置
CN103974013A (zh) * 2013-01-24 2014-08-06 杭州海康威视数字技术股份有限公司 进行视频录像回放的方法及视频录像设备
CN105142004A (zh) * 2015-08-28 2015-12-09 深圳Tcl数字技术有限公司 多媒体文件读取方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6124868A (en) * 1998-03-24 2000-09-26 Ati Technologies, Inc. Method and apparatus for multiple co-processor utilization of a ring buffer
CN101447994A (zh) * 2008-12-30 2009-06-03 深圳市迅雷网络技术有限公司 多媒体文件的下载播放方法及设备
CN103391468A (zh) * 2012-05-08 2013-11-13 安凯(广州)微电子技术有限公司 一种基于移动终端的网络视频数据的缓冲控制方法及系统
CN103974013A (zh) * 2013-01-24 2014-08-06 杭州海康威视数字技术股份有限公司 进行视频录像回放的方法及视频录像设备
CN103744621A (zh) * 2013-12-31 2014-04-23 深圳英飞拓科技股份有限公司 缓冲区循环读写的方法及装置
CN105142004A (zh) * 2015-08-28 2015-12-09 深圳Tcl数字技术有限公司 多媒体文件读取方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111866419A (zh) * 2019-04-24 2020-10-30 杭州海康微影传感科技有限公司 热成像图像显示方法、装置及热成像设备
CN112379844A (zh) * 2020-11-25 2021-02-19 深圳市华宝电子科技有限公司 一种数据保护方法、装置、电子终端及存储介质

Also Published As

Publication number Publication date
CN105142004A (zh) 2015-12-09
CN105142004B (zh) 2018-09-04

Similar Documents

Publication Publication Date Title
WO2017036218A1 (zh) 多媒体文件读取方法及装置
WO2017084311A1 (zh) 单分片视频播放加速方法及装置
WO2013037258A1 (zh) 一种无线通讯设备对近期使用应用程序的提示方法及系统
WO2016192254A1 (zh) 网络视频在线播放的方法和装置
WO2017036209A1 (zh) 基于智能电视的音频数据播放方法、智能电视及系统
WO2013131444A1 (zh) 分享内容的方法、终端、服务器及系统、计算机存储介质
WO2015085765A1 (zh) 推送资讯信息的方法和智能终端
WO2017201913A1 (zh) 一种精准语音控制方法及装置
JPH07303237A (ja) ビデオ信号処理方法
WO2017152603A1 (zh) 显示方法及装置
WO2013091456A1 (zh) 桌面管理方法和装置
WO2017057960A1 (en) Electronic device and method for controlling the same
WO2013097723A1 (zh) 微博话题发表方法及终端
WO2016065705A1 (zh) 一种频道列表更新方法、装置及终端设备
WO2016091000A1 (zh) 动态码率切换方法、服务器及系统
WO2017092267A1 (zh) 频道处理方法及装置
WO2019114255A1 (zh) 语音采集方法、遥控器及计算机可读存储介质
WO2017016262A1 (zh) 一种智能手表的控制方法及智能手表
WO2019062109A1 (zh) 磁盘阵列的挂载方法、Android设备和存储介质
WO2017012419A1 (zh) 流媒体解密方法及装置
WO2019024472A1 (zh) 数据操作方法、装置及计算机可读存储介质
WO2015169209A1 (en) Animation data generating method, apparatus, and electronic device
WO2017059686A1 (zh) 桌面显示方法及装置
WO2022217944A1 (zh) 字幕与音源的绑定方法及装置
WO2012028080A1 (zh) 一种移动终端数据信息的备份方法及装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16840647

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 12.07.2018)

122 Ep: pct application non-entry in european phase

Ref document number: 16840647

Country of ref document: EP

Kind code of ref document: A1