CN111597153A - HLS-based file management method and device, electronic equipment and storage medium - Google Patents
HLS-based file management method and device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN111597153A CN111597153A CN202010403172.9A CN202010403172A CN111597153A CN 111597153 A CN111597153 A CN 111597153A CN 202010403172 A CN202010403172 A CN 202010403172A CN 111597153 A CN111597153 A CN 111597153A
- Authority
- CN
- China
- Prior art keywords
- file
- reading
- file data
- index
- judging whether
- Prior art date
- Legal status (The legal status 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 status listed.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/17—Details of further file system functions
- G06F16/172—Caching, prefetching or hoarding of files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/40—Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
- G06F16/41—Indexing; Data structures therefor; Storage structures
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/65—Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L65/00—Network arrangements, protocols or services for supporting real-time applications in data packet communication
- H04L65/60—Network streaming of media packets
- H04L65/75—Media network packet handling
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Software Systems (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the application provides a file management method, a file management device, electronic equipment and a storage medium based on HLS, wherein when file data is read, whether the file data available for reading exists is judged according to an index, if the file data available for reading exists, the file data is read according to a reading position of a current mark, the reading position of the mark is updated after reading, the step of judging whether the file data available for reading exists according to the index is returned, and the file data is continuously read. By the mode, when the plurality of file segments are read, the file data included by the file segments can be read in sequence according to the reading positions of the marks, and the file data can be read without waiting for the completion of downloading of one file segment, so that the file data reading process is smoother, and the user experience is improved.
Description
Technical Field
The present application relates to the field of communications technologies, and in particular, to a method and an apparatus for file management based on HLS, an electronic device, and a storage medium.
Background
Hls (HTTP Live streaming) is an HTTP-based streaming media network transport protocol proposed by apple inc. The principle of HLS is to cut the entire multimedia file into a plurality of HTTP-based TS files, generate an extended M3U (M3U8) list file containing metadata, download only some of the TS files in the list file each time, and demux (demultiplex) the downloaded TS data to obtain audio or video decoding data.
Currently, in order to manage the TS file, the downloaded TS file is usually stored in a memory. In the demux process, after a TS file is downloaded, demux can be carried out on the TS file, so that the play starting time is long. In addition, in order to enable the multimedia file to be played continuously, a plurality of TS files generally need to be buffered, and if the TS file is large, a large amount of memory space is occupied, which causes waste of resource space. Meanwhile, in the demultiplexing process, the TS file must be repeatedly positioned, the reading state of the TS file is processed, and the logic complexity of demux is increased.
Disclosure of Invention
In view of the above, an object of the present application is to provide a method, an apparatus, an electronic device and a storage medium for file management based on HLS, so as to reduce the start-up time of a file.
In a first aspect, an embodiment provides a HLS-based file management method applied to an electronic device, where the method includes:
analyzing a file to be downloaded to obtain fragment information of a file fragment, and downloading the file fragment according to the fragment information;
creating an index for the downloaded file segments, wherein each file segment comprises a plurality of file data;
judging whether the file data available for reading exists according to the index, if so, reading the file data according to the reading position of the current mark, and updating the reading position of the mark;
and returning to the step of judging whether the file data available for reading exists according to the index.
In an optional embodiment, if there is file data available for reading, reading the file data according to the reading position of the current mark, and updating the reading position of the mark, including:
judging whether the size of the file data available for reading is smaller than that of the file data requested to be read or not;
if the current mark is smaller than the preset mark, reading the file data available for reading according to the reading position of the current mark, and updating the reading position of the mark;
and if not, reading the file data corresponding to the size of the file data requested to be read according to the reading position of the current mark, and updating the reading position of the mark.
In an optional embodiment, after downloading a file segment according to the segment information, the method further includes:
and judging whether the currently downloaded file segment is the last file segment, if so, setting the session state as the end.
In an optional embodiment, determining whether there is file data available for reading according to the index includes:
judging whether an index exists or not, and if so, acquiring a first index;
and judging whether the file data available for reading exists according to the acquired first index.
In an alternative embodiment, the method further comprises:
if the file data available for reading does not exist, judging whether the file segments corresponding to the first index are completely read;
if all the reading is finished, deleting the file segment and the index thereof, and returning to the step of judging whether the index exists or not.
In an alternative embodiment, the method further comprises:
if not, returning to the step of judging whether the index exists or not after a preset time period.
In an optional embodiment, determining whether there is file data available for reading according to the index further includes:
if no index exists, judging whether the session state is finished;
if the index is not in the end state, returning to the step of judging whether the index exists or not after a preset time period;
if the file data is in the end state, reading the file data is ended.
In a second aspect, an embodiment provides an HLS-based file management apparatus, which is applied to an electronic device, and includes:
the analysis downloading module is used for analyzing the file to be downloaded to obtain fragment information of the file fragment and downloading the file fragment according to the fragment information;
the index creating module is used for creating an index for the downloaded file segments, wherein each file segment comprises a plurality of file data;
the judging module is used for judging whether the file data which can be read exists according to the index, if so, reading the file data according to the reading position of the current mark and updating the reading position of the mark;
and the circulating module is used for returning to the step of judging whether the file data available for reading exists according to the index.
In a third aspect, an embodiment provides an electronic device, including a processor and a non-volatile memory storing computer instructions, where when the computer instructions are executed by the processor, the electronic device executes the HLS-based file management method according to any one of the foregoing embodiments.
In a fourth aspect, an embodiment provides a storage medium, in which a computer program is stored, and the computer program is executed to implement the HLS-based file management method according to any one of the foregoing embodiments.
The embodiment of the application provides a file management method, a file management device, electronic equipment and a storage medium based on HLS, wherein when file data is read, whether the file data available for reading exists is judged according to an index, if the file data available for reading exists, the file data is read according to a reading position of a current mark, the reading position of the mark is updated after reading, the step of judging whether the file data available for reading exists according to the index is returned, and the file data is continuously read. Through the mode, when the plurality of file segments are read, the file data included by the file segments can be sequentially read according to the marked reading positions, and the file data can be read without waiting for the completion of downloading of one file segment, so that the file data reading process is smoother, and the user experience is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained from the drawings without inventive effort.
Fig. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 2 is a flowchart of a HLS-based file management method according to an embodiment of the present application;
fig. 3 is a flowchart illustrating sub-steps of step S240 in fig. 2 according to an embodiment of the present disclosure;
fig. 4 is a flowchart illustrating one of the sub-steps of step S230 in fig. 2 according to an embodiment of the present disclosure;
FIG. 5 is a second flowchart of a HLS-based file management method provided in the present application;
fig. 6 is a second flowchart illustrating sub-steps of step S230 in fig. 2 according to an embodiment of the present disclosure;
fig. 7 is a functional block diagram of an HLS-based file management apparatus according to an embodiment of the present application.
Description of the main element symbols: 100-an electronic device; 110-HLS-based file management means; 120-a memory; 130-a processor; 1101-a parsing download module; 1102-an index creation module; 1103-judging module; 1104-circulation module.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, as generally described and illustrated in the figures herein, may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present application without making any creative effort, shall fall within the protection scope of the present application.
First, referring to fig. 1, fig. 1 is a schematic structural diagram of an electronic device 100 according to an embodiment of the present disclosure. The HLS-based file management method provided by the embodiment of the present application is applied to the electronic device 100, where the electronic device 100 includes a processor 130, a memory 120, and a HLS-based file management apparatus 110, and the memory 120, the processor 130, and various elements are directly or indirectly electrically connected to each other to implement data transmission or interaction. For example, the components may be electrically connected to each other via one or more communication buses or signal lines. The HLS-based file management apparatus 110 includes at least one software functional module which can be stored in the memory 120 in the form of software or firmware (firmware) or solidified in an Operating System (OS) of the electronic device 100. The processor 130 is used for executing executable modules stored in the memory 120, such as software functional modules and computer programs included in the HLS-based file management apparatus 110. The electronic device 100 may be, but is not limited to, a wearable device, a smartphone, a tablet, a personal digital assistant, and the like. The Memory 120 may be, but is not limited to, a Random Access Memory (RAM), a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), an Erasable Read-Only Memory (EPROM), an electrically Erasable Read-Only Memory (EEPROM), and the like.
The memory 120 is used for storing a program, and the processor 130 executes the program after receiving the execution instruction. The processor 130 may be an integrated circuit chip having signal processing capabilities. The Processor may be a general-purpose Processor, and includes a Central Processing Unit (CPU), a Network Processor (NP), and the like; but may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic, discrete hardware components. The methods, steps and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The HLS-based file management method provided in the embodiments of the present application is described in detail below. Referring to fig. 2, fig. 2 is a flowchart of a HLS-based file management method according to an embodiment of the present disclosure. The HLS-based file management method is applied to the electronic device 100 in fig. 1, and includes the following steps:
step S210, the file to be downloaded is analyzed to obtain the fragment information of the file fragment, and the file fragment is downloaded according to the fragment information.
Step S220, an index is created for the downloaded file segment. Wherein each file fragment includes a plurality of file data.
In step S230, it is determined whether there is file data available for reading according to the index.
In step S240, if there is file data available for reading, the file data is read according to the reading position of the current mark, and the reading position of the mark is updated.
And after the reading position of the mark is updated, returning to the step of judging whether the file data available for reading exists according to the index.
Further, in the present embodiment, the file to be downloaded may be an m3u8 file, and the file segments may be TS files, each of which includes a plurality of file data.
For example, when the electronic device 100 needs to play a video file, the m3u8 file of the video file is parsed to obtain the fragment information of a plurality of TS files, so that the corresponding TS file can be downloaded according to the fragment information, and the downloaded TS file is demux (demultiplexed) to obtain the decoded data of the video file. Generally, one video file includes a plurality of TS files.
In the demultiplexing process, the electronic device 100 reads the file data through the demultiplexing component, first determines whether the file data available for reading exists according to the index, and if the file data available for reading exists, reads the file data according to the reading position of the current mark, updates the reading position of the mark after reading, returns to the step of determining whether the file data available for reading exists according to the index, and continues to read the file data.
By the mode, the file data included by the file fragment can be read in sequence according to the reading position of the mark during demultiplexing, the file fragment can be downloaded while part of the file data in the downloaded file fragment is read, and the file data can be read without waiting for the completion of the downloading of one file fragment, so that the reading process of the file data is smoother, the reading logic of demultiplexing is optimized, the time for starting the file to wait is shortened, and the user experience is improved.
Further, referring to fig. 3, fig. 3 is a flowchart illustrating sub-steps of step S240 in fig. 2 according to an embodiment of the present disclosure. In the present embodiment, step S240 includes the following substeps:
in the substep S2401, it is determined whether the size of the file data available for reading is smaller than the size of the file data requested to be read.
And a substep S2402, if the reading position of the current mark is smaller than the reading position of the current mark, reading the file data available for reading and updating the reading position of the mark.
And step S2403, if not, reading the file data corresponding to the size of the file data requested to be read according to the reading position of the current mark, and updating the reading position of the mark.
In the sub-step described above, after each reading of the file data, the reading position needs to be marked so that the reading can be continued from the marking position next time. When the file data available for reading is determined to exist, it is also determined whether the size of the file data available for reading is smaller than the size of the file data requested to be read. If the current mark is smaller than the mark, reading file data available for reading according to the reading position of the current mark, and updating the reading position of the mark after the reading is finished; and if the reading position of the current mark is larger than or equal to the preset reading position, reading the file data corresponding to the size of the file data requested to be read according to the reading position of the current mark, and updating the reading position of the mark after the reading is finished.
For example, when the size of the file data requested to be read is 100 bytes, if the size of the file data available for reading is 50 bytes, all the file data of 50 bytes are read according to the read position of the current mark, and after the reading is completed, the position mark is performed to indicate the read position at this time. If the size of the file data available for reading is 150 bytes, 100 bytes of the file data are read from the 150 bytes, and position marking is performed after the reading is completed.
After the reading of the file data is completed, returning to the step of judging whether the file data available for reading exists according to the index, and reading the file data next time, when the file data is read next time, starting to read from the reading position of the mark, for example, when the 100 th byte is read last time, starting to read from the 101 th byte next time.
And circulating the step of reading the file data until all the file data are read.
Further, in this embodiment, after downloading the file segments according to the segment information, the HLS-based file management method further includes:
and judging whether the currently downloaded file segment is the last file segment, if so, setting the session state as the end.
In this embodiment, a multimedia file usually includes a plurality of file segments, and after downloading a file segment according to the segment information, it is further necessary to determine whether the currently downloaded file segment is the last file segment of the multimedia file, and if so, the session state is set to end, which indicates that all file segments are downloaded.
Further, referring to fig. 4, fig. 4 is a flowchart illustrating a sub-step of step S230 in fig. 2 according to an embodiment of the present disclosure. In this embodiment, step S230 includes:
in sub-step S2301, it is determined whether or not an index exists.
In sub-step S2302, if there is an index, the first index is obtained.
And a substep S2303, determining whether the file data available for reading exists according to the acquired first index.
In the sub-step, after downloading the file fragment, a corresponding index is created for the file fragment for managing the downloaded file fragment. When the file data available for reading exists, a corresponding index is created for the file data, so that whether the file data available for reading exists can be judged by judging whether the index exists.
Each file fragment corresponds to an index, and when multiple file fragments have been downloaded, multiple indexes are created. In order to sequentially read the file data, it is necessary to acquire the first index from the plurality of indexes, and determine whether there is file data available for reading according to the content of the first index.
Optionally, referring to fig. 5, fig. 5 is a second flowchart of the HLS-based file management method according to the embodiment of the present application. In this embodiment, the method further includes:
in step S250, if there is no file data available for reading, it is determined whether all the file segments corresponding to the first index are completely read.
In step S260, if all the reading is completed, the file segment and the index thereof are deleted, and the step of determining whether the index exists is returned, that is, the step returns to substep S2301 of step S230.
In the above step, when it is determined that there is no file data available for reading, it is determined whether all the file segments corresponding to the first index are completely read. For example, if the file segment corresponding to the first index is 500 bytes in total, it is determined whether all the file segments of 500 bytes are read.
If the 500-byte file segments are completely read, deleting the read file segments and the corresponding indexes, returning to the step S2301, and determining whether the indexes exist.
And when the read file segments and the corresponding indexes are deleted, the second index in the plurality of indexes is changed into the current first index in sequence. Therefore, the sub-step S2301 may continue to obtain the first index and perform subsequent reading of the file data.
In this embodiment, after a complete file segment of the multimedia file is read, the file segment and the index thereof are deleted, so that a part of memory space can be released, and the waste of memory resources is avoided.
Optionally, with reference to fig. 5, in this embodiment, the method further includes:
in step S270, if all the reading operations are not completed, the process returns to the step of determining whether an index exists after waiting for a preset time period, that is, returns to substep S2301 of step S230.
In the foregoing step, when there is no readable file data, and if the file segment corresponding to the first index is not read completely, it indicates that the file data included in the downloaded first index is read completely, but at this time, all the file data included in the first index is not read completely, that is, there is still some file data that is not downloaded. Therefore, it is necessary to wait for a period of time (a preset period of time, for example, 3 to 5 seconds) and then return to the step of determining whether the index exists, and re-read the file data.
Optionally, referring to fig. 6, fig. 6 is a second flowchart illustrating a sub-step of step S230 in fig. 2 according to an embodiment of the present disclosure. In this embodiment, step S230 further includes:
in sub-step S2304, if there is no index, it is determined whether the session state is ended.
In the substep S2305, if the index is not in the end state, the step of determining whether the index exists is returned after a preset time period. I.e., after a preset period of time, returns to substep S2301 of step S230.
In sub-step S2306, if the status is the end status, reading of the file data is ended.
In the sub-step, when there is no index, there may be two cases, one is that all the file segments are downloaded and read completely, and the corresponding index is deleted after reading, and the other is that some of the file segments are downloaded and read, and the index of the read file segment is deleted, and there may also be a case that some file segments are not downloaded, and thus no corresponding index is created yet.
Therefore, when there is no index, it is necessary to first determine whether the session state is the end state, and if the session state is the end state, it indicates that all the file segments are downloaded and the reading is completed, and at this time, the reading of the file data can be ended.
If the session state is not the end state, it indicates that a part of files are not downloaded, and it needs to wait for a period of time and then return to the step of judging whether the index exists, and repeat the subsequent steps, and continue to read the file data until all the file segments included in one multimedia file are completely read.
To sum up, the embodiment of the present application provides a file management method based on HLS, which determines whether there is readable file data according to an index when reading the file data, and if there is readable file data, reads the file data according to a reading position of a current mark, updates the reading position of the mark after reading, and returns to the step of determining whether there is readable file data according to the index to continue reading the file data. By the mode, when the plurality of file segments are read, the file data included by the file segments can be sequentially read according to the reading positions of the marks, and the file data is not required to be read after the file segments are downloaded, so that the file data reading process is smoother, and the user experience is improved.
After a file segment is read, the file segment and the corresponding index are deleted, so that a certain memory space can be released, and the memory resource waste is avoided.
Referring to fig. 7, fig. 7 is a functional block diagram of the HLS-based file management apparatus 110 according to an embodiment of the present application. The device is applied to the electronic equipment 100 and comprises:
the parsing and downloading module 1101 is configured to parse the file to be downloaded to obtain the fragment information of the file fragment, and download the file fragment according to the fragment information.
An index creating module 1102 configured to create an index for the downloaded file segments, wherein each file segment includes a plurality of file data.
The determining module 1103 is configured to determine whether there is file data available for reading according to the index, and if there is file data available for reading, read the file data according to the reading position of the current mark, and update the reading position of the mark.
And the loop module 1104 is configured to return to the step of determining whether the file data available for reading exists according to the index.
The HLS-based file management apparatus 110 provided in the embodiment of the present application may be specific hardware on the electronic device 100, or software or firmware installed on the electronic device 100, or the like. The device provided by the embodiment of the present application has the same implementation principle and technical effect as the foregoing method embodiments, and for the sake of brief description, reference may be made to the corresponding contents in the foregoing method embodiments where no part of the device embodiments is mentioned. It can be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the system, the apparatus and the unit described above may all refer to the corresponding processes in the above method embodiments, and are not described herein again.
An embodiment of the present application further provides an electronic device 100, which includes a processor 130 and a nonvolatile memory 120 storing computer instructions, where when the computer instructions are executed by the processor 130, the electronic device 100 executes the HLS-based file management method described in any of the foregoing embodiments, and specific implementation methods may refer to method embodiments and are not described herein again.
An embodiment of the present application further provides a storage medium, where a computer program is stored in the storage medium, and when the computer program is executed, the HLS-based file management method described in any of the foregoing embodiments is implemented.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may also be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments provided in the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application may be essentially implemented or contributed to by the prior art or parts thereof in the form of a software product stored in a storage medium, and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in a figure, it need not be further defined or explained in subsequent figures, and moreover, the terms "first," "second," "third," etc. are used merely to distinguish one description from another, and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above-mentioned embodiments are merely specific embodiments of the present application, which are used for illustrating the technical solutions of the present application and not for limiting the same, and the protection scope of the present application is not limited thereto, although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the present disclosure, which should be construed in light of the above teachings. Are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims (10)
1. An HLS-based file management method is applied to electronic equipment and comprises the following steps:
analyzing a file to be downloaded to obtain fragment information of a file fragment, and downloading the file fragment according to the fragment information;
creating an index for the downloaded file segments, wherein each file segment comprises a plurality of file data;
judging whether the file data available for reading exists according to the index;
if the file data available for reading exists, reading the file data according to the reading position of the current mark, and updating the reading position of the mark;
and returning to the step of judging whether the file data available for reading exists according to the index.
2. The method of claim 1, wherein if there is file data available for reading, reading the file data according to the reading position of the current mark, and updating the reading position of the mark, comprises:
judging whether the size of the file data available for reading is smaller than that of the file data requested to be read or not;
if the current mark is smaller than the preset mark, reading the file data available for reading according to the reading position of the current mark, and updating the reading position of the mark;
and if not, reading the file data corresponding to the size of the file data requested to be read according to the reading position of the current mark, and updating the reading position of the mark.
3. The method according to claim 1 or 2, wherein after downloading the file segment according to the fragmentation information, the method further comprises:
and judging whether the currently downloaded file segment is the last file segment, if so, setting the session state to be finished.
4. The method according to claim 1 or 2, wherein determining whether there is file data available for reading according to the index comprises:
judging whether an index exists or not, and if so, acquiring a first index;
and judging whether the file data available for reading exists according to the acquired first index.
5. The method of claim 4, further comprising:
if the file data available for reading does not exist, judging whether the file segments corresponding to the first index are completely read;
if all the reading is finished, deleting the file segment and the index thereof, and returning to the step of judging whether the index exists or not.
6. The method of claim 5, further comprising:
and if not, returning to the step of judging whether the index exists or not after a preset time period.
7. The method of claim 4, wherein determining whether there is file data available for reading according to the index further comprises:
if no index exists, judging whether the session state is finished;
if the index is not in the end state, returning to the step of judging whether the index exists or not after a preset time period;
if the file data is in the end state, reading the file data is ended.
8. An HLS-based file management device, applied to an electronic device, comprising:
the analysis downloading module is used for analyzing the file to be downloaded to obtain fragment information of the file fragment and downloading the file fragment according to the fragment information;
the index creating module is used for creating an index for the downloaded file segments, wherein each file segment comprises a plurality of file data;
the judging module is used for judging whether the file data which can be read exists according to the index, if so, reading the file data according to the reading position of the current mark and updating the reading position of the mark;
and the circulating module is used for returning to the step of judging whether the file data available for reading exists according to the index.
9. An electronic device comprising a processor and a non-volatile memory having stored thereon computer instructions which, when executed by the processor, perform the HLS-based file management method of any one of claims 1-7.
10. A storage medium, characterized in that the storage medium has stored therein a computer program which, when executed, implements the HLS-based file management method of any one of claims 1 to 7.
Priority Applications (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010403172.9A CN111597153A (en) | 2020-05-13 | 2020-05-13 | HLS-based file management method and device, electronic equipment and storage medium |
PCT/CN2020/135667 WO2021227481A1 (en) | 2020-05-13 | 2020-12-11 | Hls-based file management method and apparatus, and electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010403172.9A CN111597153A (en) | 2020-05-13 | 2020-05-13 | HLS-based file management method and device, electronic equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN111597153A true CN111597153A (en) | 2020-08-28 |
Family
ID=72187095
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010403172.9A Pending CN111597153A (en) | 2020-05-13 | 2020-05-13 | HLS-based file management method and device, electronic equipment and storage medium |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111597153A (en) |
WO (1) | WO2021227481A1 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021227481A1 (en) * | 2020-05-13 | 2021-11-18 | 湖南国科微电子股份有限公司 | Hls-based file management method and apparatus, and electronic device and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103297452A (en) * | 2012-02-24 | 2013-09-11 | 北京对角巷科技发展有限公司 | Method and system for publishing and broadcasting streaming media on Internet in live mode |
JP2016062319A (en) * | 2014-09-18 | 2016-04-25 | カシオ計算機株式会社 | Data reading device, program and data reading method |
WO2017035786A1 (en) * | 2015-09-01 | 2017-03-09 | 深圳好视网络科技有限公司 | Method, device, and system for playing and checking streaming media file |
CN109089174A (en) * | 2018-08-16 | 2018-12-25 | 咪咕视讯科技有限公司 | Multimedia data stream processing method and device and computer storage medium |
CN109710572A (en) * | 2018-12-29 | 2019-05-03 | 北京赛思信安技术股份有限公司 | A kind of file sharding method based on HBase |
CN110545472A (en) * | 2019-09-04 | 2019-12-06 | 北京字节跳动网络技术有限公司 | Video data processing method and device, electronic equipment and computer readable medium |
Family Cites Families (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140140417A1 (en) * | 2012-11-16 | 2014-05-22 | Gary K. Shaffer | System and method for providing alignment of multiple transcoders for adaptive bitrate streaming in a network environment |
CN111597153A (en) * | 2020-05-13 | 2020-08-28 | 湖南国科微电子股份有限公司 | HLS-based file management method and device, electronic equipment and storage medium |
-
2020
- 2020-05-13 CN CN202010403172.9A patent/CN111597153A/en active Pending
- 2020-12-11 WO PCT/CN2020/135667 patent/WO2021227481A1/en active Application Filing
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103297452A (en) * | 2012-02-24 | 2013-09-11 | 北京对角巷科技发展有限公司 | Method and system for publishing and broadcasting streaming media on Internet in live mode |
JP2016062319A (en) * | 2014-09-18 | 2016-04-25 | カシオ計算機株式会社 | Data reading device, program and data reading method |
WO2017035786A1 (en) * | 2015-09-01 | 2017-03-09 | 深圳好视网络科技有限公司 | Method, device, and system for playing and checking streaming media file |
CN109089174A (en) * | 2018-08-16 | 2018-12-25 | 咪咕视讯科技有限公司 | Multimedia data stream processing method and device and computer storage medium |
CN109710572A (en) * | 2018-12-29 | 2019-05-03 | 北京赛思信安技术股份有限公司 | A kind of file sharding method based on HBase |
CN110545472A (en) * | 2019-09-04 | 2019-12-06 | 北京字节跳动网络技术有限公司 | Video data processing method and device, electronic equipment and computer readable medium |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2021227481A1 (en) * | 2020-05-13 | 2021-11-18 | 湖南国科微电子股份有限公司 | Hls-based file management method and apparatus, and electronic device and storage medium |
Also Published As
Publication number | Publication date |
---|---|
WO2021227481A1 (en) | 2021-11-18 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108495192B (en) | Page editing processing method and device | |
US10713034B2 (en) | Updating web resources | |
CN106791933B (en) | The method and system of online quick editor's video based on web terminal | |
JP6488508B2 (en) | Web page access method, apparatus, device, and program | |
CN111061643B (en) | SDK cluster compatibility detection method and device, electronic equipment and storage medium | |
US10313712B2 (en) | Method, device, and server for producing video frame set | |
CN109729386B (en) | Video file playing starting method and system, electronic equipment and storage medium | |
CN104602138A (en) | Method and device for supporting HLS protocol by streaming media server | |
CN104104971A (en) | Video file processing method and system | |
US11374843B2 (en) | Method for measuring network speed, computing device, and computer-program product | |
CN110865834B (en) | Application program interface updating method and device, readable storage medium and terminal equipment | |
CN109151505B (en) | Video transcoding method, system, device and computer readable storage medium | |
CN108769830B (en) | Method for caching video and related equipment | |
US11463494B2 (en) | Balance of initial frame and limitation of traffic | |
CN109002282B (en) | Method and device for realizing animation effect in web page development | |
CN108833968B (en) | Method for caching video and related equipment | |
CN108924630B (en) | Method for displaying cache progress and playing device | |
CN107481739B (en) | Audio cutting method and device | |
CN111597153A (en) | HLS-based file management method and device, electronic equipment and storage medium | |
CN104580298B (en) | File upload process method and device | |
CN112822265A (en) | Data encoding method, device, equipment end and storage medium | |
CN111031117A (en) | Multimedia file downloading method and related device | |
CN116634246A (en) | Video generation method, device, equipment, medium and program product | |
CN114189745B (en) | Set top box software switching management method, system and computer device | |
CN113535206B (en) | Multi-version code upgrading method and system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |