[go: up one dir, main page]

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 PDF

Info

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
read
file data
index
reading
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
Application number
CN202010403172.9A
Other languages
Chinese (zh)
Inventor
张洪宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Goke Microelectronics Co Ltd
Original Assignee
Hunan Goke Microelectronics Co Ltd
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 Hunan Goke Microelectronics Co Ltd filed Critical Hunan Goke Microelectronics Co Ltd
Priority to CN202010403172.9A priority Critical patent/CN111597153A/en
Publication of CN111597153A publication Critical patent/CN111597153A/en
Priority to PCT/CN2020/135667 priority patent/WO2021227481A1/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/40Information retrieval; Database structures therefor; File system structures therefor of multimedia data, e.g. slideshows comprising image and additional audio data
    • G06F16/41Indexing; Data structures therefor; Storage structures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/65Network streaming protocols, e.g. real-time transport protocol [RTP] or real-time control protocol [RTCP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L65/00Network arrangements, protocols or services for supporting real-time applications in data packet communication
    • H04L65/60Network streaming of media packets
    • H04L65/75Media network packet handling
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols 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

基于HLS的文件管理方法、装置、电子设备和存储介质HLS-based file management method, device, electronic device and storage medium

技术领域technical field

本申请涉及通讯技术领域,具体而言,涉及一种基于HLS的文件管理 方法、装置、电子设备和存储介质。The present application relates to the field of communication technologies, and in particular, to an HLS-based file management method, device, electronic device and storage medium.

背景技术Background technique

HLS(HTTP Live Streaming)是由苹果公司提出的基于HTTP的流媒体网 络传输协议。HLS的实现原理是把整个多媒体文件切成多个基于HTTP的 TS文件,生成一个包含元数据的扩展M3U(M3U8)列表文件,每次只下 载列表文件中的一些TS文件,对下载完成的TS数据进行demux(解复用) 即可获得音频或者视频解码数据。HLS (HTTP Live Streaming) is an HTTP-based streaming media network transmission protocol proposed by Apple. The implementation principle of HLS is to cut the entire multimedia file into multiple HTTP-based TS files, generate an extended M3U (M3U8) list file containing metadata, and download only some TS files in the list file each time. The data can be demuxed (demultiplexed) to obtain audio or video decoded data.

目前,为了对TS文件进行管理,通常是将下载的TS文件存储到内存 中。在demux过程中,必须等一个TS文件下载完成后,才能对其进行demux, 导致启播时间较长。并且,为了使多媒体文件能够连续播放,一般需缓冲 多个TS文件,如果TS文件比较大,则会占用大量内存空间,造成资源空 间的浪费。同时解复用过程必须反复定位TS文件,处理TS文件的读取状 态,增加了demux的逻辑复杂度。Currently, in order to manage the TS files, the downloaded TS files are usually stored in the memory. During the demux process, you must wait for a TS file to be downloaded before demuxing it, resulting in a longer start-up time. Moreover, in order to enable the multimedia files to be played continuously, it is generally necessary to buffer multiple TS files. If the TS files are relatively large, a large amount of memory space will be occupied, resulting in a waste of resource space. At the same time, the demultiplexing process must repeatedly locate the TS file and process the read state of the TS file, which increases the logic complexity of demux.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本申请的目的在于提供基于HLS的文件管理方法、装置、 电子设备和存储介质,以减少文件的启播时间。In view of this, the purpose of the present application is to provide an HLS-based file management method, apparatus, electronic device and storage medium, so as to reduce the start-up time of the file.

第一方面,实施例提供一种基于HLS的文件管理方法,应用于电子设 备,所述方法包括:A first aspect, the embodiment provides a kind of file management method based on HLS, is applied to electronic equipment, and described method comprises:

解析待下载文件获得文件片段的分片信息,根据所述分片信息下载所 述文件片段;Parsing the file to be downloaded to obtain fragmentation information of the file fragment, and downloading the file fragment according to the fragmentation information;

为下载的所述文件片段创建索引,其中,每个文件片段包括多个文件 数据;creating an index for the downloaded file segments, wherein each file segment includes a plurality of file data;

根据所述索引判断是否存在可供读取的文件数据,若存在可供读取的 文件数据,则根据当前标记的读取位置读取文件数据,并更新标记的读取 位置;Judging whether there is file data available for reading according to the index, if there is file data available for reading, then read the file data according to the reading position of the current mark, and update the reading position of the mark;

返回至根据所述索引判断是否存在可供读取的文件数据的步骤。Return to the step of judging whether there is file data available for reading according to the index.

在可选的实施方式中,所述若存在可供读取的文件数据,则根据当前 标记的读取位置读取文件数据,并更新标记的读取位置,包括:In an optional embodiment, if there is file data available for reading, read the file data according to the current marked reading position, and update the marked reading position, including:

判断所述可供读取的文件数据的大小是否小于请求读取的文件数据的 大小;Determine whether the size of the file data available for reading is less than the size of the file data requested to be read;

若小于,则根据当前标记的读取位置读取可供读取的文件数据,并更 新标记的读取位置;If it is less than, read the file data available for reading according to the reading position of the current mark, and update the reading position of the mark;

若不小于,则根据当前标记的读取位置读取所述请求读取的文件数据 的大小对应的文件数据,并更新标记的读取位置。If not less than, read the file data corresponding to the size of the file data requested to be read according to the read position of the current mark, and update the read position of the mark.

在可选的实施方式中,在根据所述分片信息下载文件片段之后,所述 方法还包括:In an optional implementation manner, after downloading the file fragment according to the fragmentation information, the method further includes:

判断当前下载的文件片段是否为最后一个文件片段,若是,则将会话 状态设置为结束。Determine whether the currently downloaded file segment is the last file segment, if so, set the session state to end.

在可选的实施方式中,根据所述索引判断是否存在可供读取的文件数 据,包括:In an optional implementation manner, it is judged whether there is file data available for reading according to the index, including:

判断是否存在索引,若存在索引,则获取第一个索引;Determine whether there is an index, if there is an index, get the first index;

根据获取到的所述第一个索引判断是否存在可供读取的文件数据。According to the obtained first index, it is judged whether there is file data that can be read.

在可选的实施方式中,所述方法还包括:In an optional embodiment, the method further includes:

若不存在可供读取的文件数据,则判断所述第一个索引对应的文件片 段是否全部读取完成;If there is no file data available for reading, then determine whether all the file segments corresponding to the first index have been read;

若全部读取完成,则删除该文件片段及其索引,并返回判断是否存在 索引的步骤。If all reading is completed, delete the file segment and its index, and return to the step of judging whether there is an index.

在可选的实施方式中,所述方法还包括:In an optional embodiment, the method further includes:

若未全部读取完成,则在预设的时间段后返回判断是否存在索引的步 骤。If not all readings are completed, return to the step of judging whether there is an index after a preset time period.

在可选的实施方式中,根据所述索引判断是否存在可供读取的文件数 据,还包括:In an optional implementation manner, judging whether there is file data available for reading according to the index, also includes:

若不存在索引,则判断会话状态是否为结束;If there is no index, judge whether the session state is over;

若不为结束状态,则在预设的时间段后返回判断是否存在索引的步骤;If it is not in the end state, return to the step of judging whether there is an index after a preset time period;

若为结束状态,则结束读取文件数据。If it is in the end state, the reading of the file data ends.

第二方面,实施例提供一种基于HLS的文件管理装置,应用于电子设 备,所述装置包括:In the second aspect, the embodiment provides a file management device based on HLS, applied to electronic equipment, and the device includes:

解析下载模块,用于解析待下载文件获得文件片段的分片信息,根据 所述分片信息下载所述文件片段;A parsing and downloading module, used for parsing the file to be downloaded to obtain the fragmentation information of the file fragment, and downloading the file fragment according to the fragmentation information;

索引创建模块,用于为下载的所述文件片段创建索引,其中,每个文 件片段包括多个文件数据;an index creation module for creating an index for the downloaded file segments, wherein each file segment includes a plurality of file data;

判断模块,用于根据所述索引判断是否存在可供读取的文件数据,若 存在可供读取的文件数据,则根据当前标记的读取位置读取文件数据,并 更新标记的读取位置;The judgment module is used to judge whether there is file data that can be read according to the index. If there is file data that can be read, read the file data according to the reading position of the current mark, and update the reading position of the mark ;

循环模块,用于返回至根据所述索引判断是否存在可供读取的文件数 据的步骤。The loop module is used to return to the step of judging whether there is file data available for reading according to the index.

第三方面,实施例提供一种电子设备,包括处理器及存储有计算机指 令的非易失性存储器,所述计算机指令被所述处理器执行时,所述电子设 备执行前述实施方式中任意一项所述的基于HLS的文件管理方法。In a third aspect, an embodiment provides an electronic device, including a processor and a non-volatile memory storing computer instructions. When the computer instructions are executed by the processor, the electronic device executes any one of the foregoing embodiments. The HLS-based file management method described in item.

第四方面,实施例提供一种存储介质,所述存储介质中存储有计算机 程序,所述计算机程序被执行时实现前述实施方式中任意一项所述的基于 HLS的文件管理方法。In a fourth aspect, an embodiment 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 one of the foregoing embodiments is implemented.

本申请实施例提供了一种基于HLS的文件管理方法、装置、电子设备 和存储介质,在读取文件数据时,根据索引判断是否存在可供读取的文件 数据,若存在可供读取的文件数据,则根据当前标记的读取位置读取文件 数据,并在读取后更新标记的读取位置,返回至根据所述索引判断是否存 在可供读取的文件数据的步骤,继续读取文件数据。通过上述方式,在读 取多个文件片段时能够按照标记的读取位置依次读取文件片段包括的文件 数据,无需等待一个文件片段下载完成再进行读取,使得文件数据读取的 过程更加流畅,提升了用户体验。The embodiments of the present application provide an HLS-based file management method, device, electronic device, and storage medium. When reading file data, it is determined whether there is file data that can be read according to an index, and if there is file data that can be read file data, then read the file data according to the reading position of the current mark, and update the reading position of the mark after reading, return to the step of judging whether there is file data available for reading according to the index, and continue reading file data. Through the above method, when reading multiple file fragments, the file data included in the file fragments can be read in sequence according to the marked reading positions, and there is no need to wait for a file fragment to be downloaded before reading it, so that the process of reading the file data is smoother. , which improves the user experience.

为使本申请的上述目的、特征和优点能更明显易懂,下文特举较佳实 施例,并配合所附附图,作详细说明如下。In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are exemplified below, and are described in detail as follows in conjunction with the accompanying drawings.

附图说明Description of drawings

为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需 要使用的附图作简单地介绍,应当理解,以下附图仅示出了本申请的某些 实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲, 在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following drawings will briefly introduce the drawings that need to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present application, and therefore do not It should be regarded as a limitation of the scope. For those of ordinary skill in the art, other related drawings can also be obtained according to these drawings without any creative effort.

图1为本申请实施例提供的电子设备的结构示意图;1 is a schematic structural diagram of an electronic device provided by an embodiment of the present application;

图2为本申请实施例提供的基于HLS的文件管理方法的流程图之一;2 is one of the flowcharts of the HLS-based file management method provided by the embodiment of the present application;

图3为本申请实施例提供的图2中的步骤S240的子步骤流程图;FIG. 3 is a flowchart of sub-steps of step S240 in FIG. 2 provided by an embodiment of the present application;

图4为本申请实施例提供的图2中步骤S230的子步骤流程图之 一;Fig. 4 is one of the sub-step flowcharts of step S230 in Fig. 2 provided by the embodiment of the present application;

图5为本申请实施例提供的基于HLS的文件管理方法的流程图之二;5 is the second flow chart of the HLS-based file management method provided by the embodiment of the present application;

图6为本申请实施例提供的图2中步骤S230的子步骤流程图之 二;Fig. 6 is the second of the sub-step flowchart of step S230 in Fig. 2 provided by the embodiment of the present application;

图7为本申请实施例提供的基于HLS的文件管理装置的功能模块图。FIG. 7 is a functional block diagram of an HLS-based file management apparatus provided by an embodiment of the present application.

主要元件符号说明:100-电子设备;110-基于HLS的文件管理装置; 120-存储器;130-处理器;1101-解析下载模块;1102-索引创建模块;1103- 判断模块;1104-循环模块。Description of main component symbols: 100-electronic equipment; 110-HLS-based file management device; 120-memory; 130-processor; 1101-parse download module; 1102-index creation module; 1103-judgment module;

具体实施方式Detailed ways

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本 申请实施例中附图,对本申请实施例中的技术方案进行清楚、完整地描述, 显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。 通常在此处附图中描述和示出的本申请实施例的组件可以以各种不同的配 置来布置和设计。因此,以下对在附图中提供的本申请的实施例的详细描 述并非旨在限制要求保护的本申请的范围,而是仅仅表示本申请的选定实 施例。基于本申请的实施例,本领域技术人员在没有做出创造性劳动的前 提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application more clear, 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. Obviously, the described embodiments are only It is a part of the embodiments of the present application, but not all of the embodiments. The components of the embodiments of the present application generally described and illustrated in the drawings herein may be arranged and designed in a variety of different configurations. Thus, the following detailed description of the embodiments of the application provided in the accompanying drawings is not intended to limit the scope of the application as claimed, but is merely representative of selected embodiments of the application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative work fall within the protection scope of the present application.

首先,请参照图1,图1为本申请实施例提供的电子设备100的结构示 意图。本申请实施例提供的基于HLS的文件管理方法应用于该电子设备100, 该电子设备100包括有处理器130、存储器120以及基于HLS的文件管理 装置110,所述存储器120与处理器130及各元件相互之间直接或间接地电 性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条 或多条通讯总线或信号线实现电性连接。所述基于HLS的文件管理装置110 包括至少一个可以软件或固件(firmware)的形式存储于所述存储器120中 或固化在所述电子设备100的操作系统(Operating System,OS)中的软件 功能模块。所述处理器130用于执行所述存储器120中存储的可执行模块, 例如基于HLS的文件管理装置110所包括的软件功能模块及计算机程序等。 所述电子设备100可以是,但不限于,可穿戴设备、智能手机、平板电脑、 个人数字助理等。其中,所述存储器120可以是,但不限于,随机存取存 储器(RandomAccess Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM), 可擦除只读存储器(Erasable ProgrammableRead-Only Memory,EPROM), 电可擦除只读存储器(Electric Erasable ProgrammableRead-Only Memory, EEPROM)等。First, please refer to FIG. 1 , which is a schematic structural diagram of an electronic device 100 provided by an embodiment of the present application. The HLS-based file management method provided by the embodiment of the present application is applied to the electronic device 100. The electronic device 100 includes a processor 130, a memory 120, and an HLS-based file management apparatus 110. The memory 120, the processor 130 and each Components are directly or indirectly electrically connected to each other to realize data transmission or interaction. For example, these components may be electrically connected to each other through one or more communication buses or signal lines. The HLS-based file management device 110 includes at least one software function module that can be stored in the memory 120 in the form of software or firmware (firmware) or solidified in an operating system (Operating System, OS) of the electronic device 100 . The processor 130 is configured to execute executable modules stored in the memory 120 , such as software function 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 smart phone, a tablet computer, a personal digital assistant, and the like. Wherein, the memory 120 may be, but not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only Memory, PROM), Erasable Programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM), Electrically Erasable Programmable Read-Only Memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

其中,存储器120用于存储程序,所述处理器130在接收到执行指令 后,执行所述程序。所述处理器130可能是一种集成电路芯片,具有信号 的处理能力。上述的处理器可以是通用处理器,包括中央处理器(Central Processing Unit,简称CPU)、网络处理器(Network Processor,简称NP) 等;还可以是数字信号处理器(DSP)、专用集成电路(ASIC)、现场可编 程门阵列(FPGA)或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、 分立硬件组件。可以实现或者执行本申请实施例中的公开的各方法、步骤 及逻辑框图。通用处理器可以是微处理器或者该处理器也可以是任何常规 的处理器等。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 with signal processing capability. The above-mentioned processor may be a general-purpose processor, including a central processing unit (Central Processing Unit, referred to as CPU), a network processor (Network Processor, referred to as NP), etc.; may also be a digital signal processor (DSP), an application-specific integrated circuit ( ASIC), Field Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of this application can be implemented or executed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.

下面,对本申请实施例提供的基于HLS的文件管理方法进行详细说明。 请参照图2,图2为本申请实施例提供的基于HLS的文件管理方法的流程 图之一。基于HLS的文件管理方法应用于图1中的电子设备100,该方法 包括以下步骤:Hereinafter, the HLS-based file management method provided by the embodiments of the present application will be described in detail. Please refer to FIG. 2, which is one of the flowcharts of the HLS-based file management method provided by the embodiment of the present application. The HLS-based file management method is applied to the electronic device 100 in Fig. 1, and the method includes the following steps:

步骤S210,解析待下载文件获得文件片段的分片信息,根据分片信息 下载文件片段。Step S210, parse the file to be downloaded to obtain fragmentation information of the file fragment, and download the file fragment according to the fragmentation information.

步骤S220,为下载的文件片段创建索引。其中,每个文件片段包括多 个文件数据。Step S220, creating an index for the downloaded file segment. Wherein, each file segment includes a plurality of file data.

步骤S230,根据索引判断是否存在可供读取的文件数据。Step S230, according to the index, determine whether there is file data available for reading.

步骤S240,若存在可供读取的文件数据,则根据当前标记的读取位置 读取文件数据,并更新标记的读取位置。Step S240, if there is file data available for reading, read the file data according to the read position of the current mark, and update the read position of the mark.

在更新标记的读取位置后,返回至根据索引判断是否存在可供读取的 文件数据的步骤。After updating the marked read position, the process returns to the step of judging whether there is file data available for reading based on the index.

进一步的,在本实施例中,待下载文件可以是m3u8文件,文件片段可 以是TS文件,每个TS文件包括多个文件数据。Further, in this embodiment, the file to be downloaded may be an m3u8 file, the file segment may be a TS file, and each TS file includes a plurality of file data.

例如,当电子设备100需要播放一个视频文件时,首先解析该视频文 件的m3u8文件以获得多个TS文件的分片信息,从而可以根据分片信息下 载对应的TS文件,对下载完成的TS文件进行demux(解复用)即可获得 该视频文件的解码数据。通常,一个视频文件包括有多个TS文件。For example, when the electronic device 100 needs to play a video file, it first parses the m3u8 file of the video file to obtain fragmentation information of multiple TS files, so that the corresponding TS files can be downloaded according to the fragmentation information, and the downloaded TS files can be downloaded. The decoded data of the video file can be obtained by performing demux (demultiplexing). Usually, a video file includes multiple TS files.

在解复用过程中,电子设备100通过解复用组件读取文件数据,首先 根据索引判断是否存在可供读取的文件数据,若存在可供读取的文件数据, 则根据当前标记的读取位置读取文件数据,并在读取后更新标记的读取位 置,返回至根据所述索引判断是否存在可供读取的文件数据的步骤,继续 读取文件数据。During the demultiplexing process, the electronic device 100 reads the file data through the demultiplexing component, and firstly judges whether there is file data that can be read according to the index. Take the position to read the file data, update the marked read position after reading, return to the step of judging whether there is file data available for reading according to the index, and continue to read the file data.

通过上述方式,在解复用时能够按照标记的读取位置依次读取文件片 段包括的文件数据,可以一边下载文件片段,一边读取已经下载的文件片 段中的部分文件数据,无需等待一个文件片段下载完成再进行读取,使得 文件数据读取的过程更加流畅,优化了解复用的读取逻辑,降低了启播需 要等待的时间,提升用户体验。Through the above method, during demultiplexing, the file data included in the file segments can be read in sequence according to the marked reading positions, and the file segments can be downloaded while reading part of the file data in the downloaded file segments without waiting for a file. After the fragment is downloaded and then read, the process of reading the file data is smoother, the read logic of demultiplexing is optimized, the waiting time for starting broadcast is reduced, and the user experience is improved.

进一步的,请参照图3,图3为本申请实施例提供的图2中的步骤S240 的子步骤流程图。在本实施例中,步骤S240包括以下子步骤:Further, please refer to FIG. 3 , which is a flowchart of sub-steps of step S240 in FIG. 2 provided by this embodiment of the present application. In this embodiment, step S240 includes the following sub-steps:

子步骤S2401,判断可供读取的文件数据的大小是否小于请求读取的文 件数据的大小。Sub-step S2401, determine whether the size of the file data available for reading is smaller than the size of the file data requested to be read.

子步骤S2402,若小于,则根据当前标记的读取位置读取可供读取的文 件数据,并更新标记的读取位置。In sub-step S2402, if it is smaller than the reading position of the current mark, read the file data that can be read according to the reading position of the mark, and update the reading position of the mark.

子步骤S2403,若不小于,则根据当前标记的读取位置读取请求读取的 文件数据的大小对应的文件数据,并更新标记的读取位置。Sub-step S2403, if not less than, read the file data corresponding to the size of the file data requested to be read according to the read position of the current mark, and update the read position of the mark.

在上述子步骤中,每次读取文件数据之后,都需要对读取位置进行标 记,以便下一次可以从标记位置处继续读取。当判断出存在可供读取的文 件数据后,还需要判断可供读取的文件数据的大小是否小于请求读取的文 件数据的大小。如果小于,则根据当前标记的读取位置读取可供读取的文 件数据,在读取完成后,更新标记的读取位置;如果大于等于,则根据当 前标记的读取位置读取请求读取的文件数据的大小对应的文件数据,在读取完成后,更新标记的读取位置。In the above sub-steps, after each reading of the file data, the reading position needs to be marked, so that the reading can be continued from the marked position next time. After it is determined that there is file data available for reading, it is also necessary to determine whether the size of the file data available for reading is smaller than the size of the file data requested to be read. If it is less than, read the file data available for reading according to the reading position of the current mark, and update the reading position of the mark after the reading is completed; if it is greater than or equal to, read the request according to the reading position of the current mark. After the file data corresponding to the size of the obtained file data is read, the read position of the mark is updated.

例如,当请求读取的文件数据的大小为100字节时,若可供读取的文 件数据的大小为50字节,则根据当前标记的读取位置读取全部50字节的 文件数据,并在读取完成后进行位置标记,表明此次的读取位置。若可供 读取的文件数据的大小为150字节,则从150字节中读取其中100个字节 的文件数据,并在读取完成后进行位置标记。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 50 bytes of file data are read according to the read position of the current mark. And mark the position after the reading is completed, indicating the current reading position. If the size of the file data that can be read is 150 bytes, read 100 bytes of file data from the 150 bytes, and mark the position after the reading is completed.

在此次文件数据读取完成后,返回至根据索引判断是否存在可供读取 的文件数据的步骤,进行下一次的文件数据的读取,在下一次读取文件数 据时,从标记的读取位置处开始读取,例如上一次读取到了第100字节处, 则下一次读取从第101字节处开始。After the current file data reading is completed, return to the step of judging whether there is file data available for reading according to the index, and perform the next file data reading. When reading the file data next time, read from the mark Start reading at the position, for example, the 100th byte was read last time, and the next read starts from the 101st byte.

循环上述读取文件数据的步骤,直至读取完全部的文件数据。The above steps of reading file data are repeated until all the file data is read.

进一步地,在本实施例中,在根据分片信息下载文件片段之后,基于 HLS的文件管理方法还包括:Further, in this embodiment, after downloading the file fragments according to the fragmentation information, the HLS-based file management method further includes:

判断当前下载的文件片段是否为最后一个文件片段,若是,则将会话 状态设置为结束。Determine whether the currently downloaded file segment is the last file segment, if so, set the session state to end.

在本实施例中,一个多媒体文件通常包括多个文件片段,在根据分片 信息下载文件片段之后,还需要判断当前下载的文件片段是否为该多媒体 文件的最后一个文件片段,若是,则将会话状态设置为结束,表明所有的 文件片段下载完成。In this embodiment, a multimedia file usually includes multiple file segments. After downloading the file segments according to the segment information, it is also necessary to determine whether the currently downloaded file segment is the last file segment of the multimedia file. The status is set to complete, indicating that the download of all file segments is complete.

进一步地,请参照图4,图4为本申请实施例提供的图2中步骤 S230的子步骤流程图之一。在本实施例中,步骤S230包括:Further, please refer to FIG. 4 , which is one of the sub-step flowcharts of step S230 in FIG. 2 provided by this embodiment of the present application. In this embodiment, step S230 includes:

子步骤S2301,判断是否存在索引。Sub-step S2301, it is judged whether there is an index.

子步骤S2302,若存在索引,则获取第一个索引。Sub-step S2302, if there is an index, obtain the first index.

子步骤S2303,根据获取到的第一个索引判断是否存在可供读取的文件 数据。Sub-step S2303, according to the obtained first index, determine whether there is file data available for reading.

在上述子步骤中,在下载了文件片段之后,会为该文件片段创建对应 的索引,用于管理下载的文件片段。当存在可供读取的文件数据时,便会 为该文件数据创建相应的索引,因此,可以通过判断是否存在索引,从而 判断是否存在可供读取的文件数据。In the above sub-steps, after the file segment is downloaded, a corresponding index is created for the file segment to manage the downloaded file segment. When there is file data that can be read, a corresponding index will be created for the file data. Therefore, it can be judged whether there is any file data that can be read by judging whether there is an index.

每个文件片段对应一个索引,当已经下载了多个文件片段时,则创建 了多个索引。为了能够依次读取文件数据,此时需要从多个索引中获取排 列在第一个的索引,并根据第一个索引的内容判断是否存在可供读取的文 件数据。Each file segment corresponds to an index, and when multiple file segments have been downloaded, multiple indexes are created. In order to be able to read file data in sequence, it is necessary to obtain the first index from multiple indexes, and judge whether there is any file data available for reading according to the content of the first index.

可选地,请参照图5,图5为本申请实施例提供的基于HLS的文件管 理方法的流程图之二。在本实施例中,该方法还包括:Optionally, please refer to FIG. 5. FIG. 5 is the second flowchart of the HLS-based file management method provided by the embodiment of the present application. In this embodiment, the method further includes:

步骤S250,若不存在可供读取的文件数据,则判断第一个索引对应的 文件片段是否全部读取完成。Step S250, if there is no file data available for reading, it is judged whether all the file segments corresponding to the first index have been read completely.

步骤S260,若全部读取完成,则删除该文件片段及其索引,并返回判 断是否存在索引的步骤,即返回步骤S230的子步骤S2301。Step S260, if all readings are completed, delete the file segment and its index, and return to the step of judging whether there is an index, that is, return to sub-step S2301 of step S230.

在上述步骤中,当判断出不存在可供读取的文件数据时,判断第一个 索引对应的文件片段是否全部读取完成。例如,若第一个索引对应的文件 片段总共500字节,则判断500字节的文件片段是否全部被读取。In the above steps, 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 have been read completely. For example, if the file segment corresponding to the first index has a total of 500 bytes, it is determined whether all the 500-byte file segments have been read.

若500字节的文件片段全部被读取完成,则删除该已经读取完的文件 片段及其对应的索引,并返回至子步骤S2301,判断是否存在索引的步骤。If all the 500-byte file segments have been read, delete the already read file segment and its corresponding index, and return to sub-step S2301 to determine whether there is an index.

当已经读取完的文件片段及其对应的索引被删除后,则多个索引中的 第二个索引顺位变为当前的第一个索引。因此,子步骤S2301可以继续获 取第一个索引,并进行后续的文件数据的读取。After the read file segment and its corresponding index are deleted, the second index in the multiple indexes becomes the current first index. Therefore, sub-step S2301 can continue to acquire the first index, and perform subsequent file data reading.

在本实施例中,当读取完多媒体文件的一个完成的文件片段后,将该 文件片段及其索引删除,可以释放出一部分内存空间,避免了内存资源的 浪费。In this embodiment, after reading a completed file segment of the multimedia file, the file segment and its index are deleted, which can release a part of the memory space and avoid the waste of memory resources.

可选地,请继续参照图5,在本实施例中,该方法还包括:Optionally, please continue to refer to FIG. 5, in this embodiment, the method further includes:

步骤S270,若未全部读取完成,则等待预设的时间段后返回判断是否 存在索引的步骤,即返回步骤S230的子步骤S2301。In step S270, if all readings are not completed, wait for a preset time period and return to the step of judging whether there is an index, that is, return to sub-step S2301 of step S230.

在上述步骤中,当不存在可读取的文件数据时,且若第一个索引对应 的文件片段未读取完成,则表示已经下载的第一个索引包括的文件数据均 读取完成,但此时第一个索引包括的所有文件数据并未读取完成,即还存 在部分文件数据未下载。因此,需要等待一段时间(预设时间段,例如3-5 秒)后返回判断是否存在索引的步骤,重新读取文件数据。In the above steps, when there is no readable file data, and if the file segment corresponding to the first index has not been read, it means that the file data included in the downloaded first index has been read, but At this time, all the file data included in the first index has not been read, that is, there are still some file data that have not been downloaded. Therefore, it is necessary to wait for a period of time (a preset period of time, such as 3-5 seconds), and then return to the step of judging whether there is an index, and re-read the file data.

可选地,请参照图6,图6为本申请实施例提供的图2中步骤S230 的子步骤流程图之二。在本实施例中,步骤S230还包括:Optionally, please refer to FIG. 6 , which is the second flowchart of the sub-steps of step S230 in FIG. 2 provided by this embodiment of the present application. In this embodiment, step S230 further includes:

子步骤S2304,若不存在索引,则判断会话状态是否为结束。Sub-step S2304, if there is no index, it is determined whether the session state is ended.

子步骤S2305,若不为结束状态,则在预设的时间段后返回判断是否存 在索引的步骤。即在预设的时间段后返回步骤S230的子步骤S2301。Sub-step S2305, if it is not in the end state, return to the step of judging whether there is an index after a preset time period. That is, it returns to sub-step S2301 of step S230 after the preset time period.

子步骤S2306,若为结束状态,则结束读取文件数据。In sub-step S2306, if it is in the end state, the reading of the file data is ended.

在上述子步骤中,当不存在索引时,可能会存在两种情况,一种是所 有的文件片段都下载完成且已经读取完成,并在读取后删除了对应的索引, 另一种情况是已经下载并读取了其中一部分文件片段,并将读取完的文件 片段的索引删除,此时还可能存在一部分文件片段还未下载,因此还没有 创建相应的索引。In the above sub-steps, when there is no index, there may be two cases, one is that all file segments have been downloaded and read, and the corresponding index is deleted after reading, the other is Some of the file segments have been downloaded and read, and the indexes of the read file segments have been deleted. At this time, there may be some file segments that have not been downloaded, so the corresponding indexes have not been created.

因此,在不存在索引时,需要先判断会话状态是否为结束状态,若会 话状态为结束状态,则表示所有的文件片段均下载且读取完成,此时可以 结束读取文件数据。Therefore, when there is no index, it is necessary to first judge whether the session state is in the end state. If the session state is in the end state, it means that all file segments have been downloaded and read is completed, and the file data can be read at this time.

若会话状态不为结束状态,则表示还存在一部分文件还未下载,需要 等待一段时间后返回至判断是否存在索引的步骤,并重复后续的步骤,继 续读取文件数据,直至将一个多媒体文件包括的所有文件片段全部读取完 成。If the session state is not in the end state, it means that there are still some files that have not been downloaded. It is necessary to wait for a period of time to return to the step of judging whether there is an index, and repeat the subsequent steps to continue reading file data until a multimedia file includes All file segments of the file have been read.

综上所述,本申请实施例提供了一种基于HLS的文件管理方法,在读 取文件数据时,根据索引判断是否存在可供读取的文件数据,若存在可供 读取的文件数据,则根据当前标记的读取位置读取文件数据,并在读取后 更新标记的读取位置,返回至根据所述索引判断是否存在可供读取的文件 数据的步骤,继续读取文件数据。通过上述方式,在读取多个文件片段时 能够按照标记的读取位置依次读取文件片段包括的文件数据,无需等待一个文件片段下载完成再进行读取,使得文件数据读取的过程更加流畅,提 升了用户体验。To sum up, the embodiment of the present application provides an HLS-based file management method. When reading file data, it is judged whether there is file data that can be read according to an index, and if there is file data that can be read, Then read the file data according to the current marked reading position, update the marked reading position after reading, return to the step of judging whether there is file data available for reading according to the index, and continue to read the file data. Through the above method, when reading multiple file fragments, the file data included in the file fragments can be read in sequence according to the marked reading positions, and there is no need to wait for a file fragment to be downloaded before reading it, so that the process of reading the file data is smoother. , which improves the user experience.

在读取完一个文件片段后,将该文件片段及其对应的索引删除,能够 释放出一定的内存空间,避免浪费内存资源。After reading a file segment, delete the file segment and its corresponding index, which can release a certain memory space and avoid wasting memory resources.

请参照图7,图7为本申请实施例提供的基于HLS的文件管理装置110 的功能模块图。该装置应用于电子设备100,包括:Please refer to FIG. 7 , which is a functional block diagram of an HLS-based file management apparatus 110 provided by an embodiment of the present application. The device is applied to the electronic device 100, including:

解析下载模块1101,用于解析待下载文件获得文件片段的分片信息, 根据分片信息下载文件片段。The parsing and downloading module 1101 is configured to parse the file to be downloaded to obtain fragmentation information of the file fragment, and download the file fragment according to the fragmentation information.

索引创建模块1102,用于为下载的文件片段创建索引,其中,每个文 件片段包括多个文件数据。The index creation module 1102 is configured to create an index for the downloaded file segments, wherein each file segment includes a plurality of file data.

判断模块1103,用于根据索引判断是否存在可供读取的文件数据,若 存在可供读取的文件数据,则根据当前标记的读取位置读取文件数据,并 更新标记的读取位置。The judgment module 1103 is used for judging whether there is file data that can be read according to the index, if there is file data that can be read, then read the file data according to the read position of the current mark, and update the read position of the mark.

循环模块1104,用于返回至根据索引判断是否存在可供读取的文件数 据的步骤。The loop module 1104 is used to return to the step of judging whether there is file data available for reading according to the index.

本申请实施例所提供的基于HLS的文件管理装置110可以为电子设备 100上的特定硬件或者安装于电子设备100上的软件或固件等。本申请实施 例所提供的装置,其实现原理及产生的技术效果和前述方法实施例相同, 为简要描述,装置实施例部分未提及之处,可参考前述方法实施例中相应 内容。所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,前 述描述的系统、装置和单元的具体工作过程,均可以参考上述方法实施例 中的对应过程,在此不再赘述。The HLS-based file management apparatus 110 provided in this 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 implementation principles and technical effects of the devices provided in the embodiments of the present application are the same as those in the foregoing method embodiments. For brief description, for the parts not mentioned in the device embodiments, reference may be made to the corresponding content in the foregoing method embodiments. Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can all refer to the corresponding processes in the above method embodiments, which will not be repeated here.

本申请实施例还提供了一种电子设备100,包括处理器130及存储有计 算机指令的非易失性存储器120,所述计算机指令被所述处理器130执行时, 所述电子设备100执行前述任一实施例描述的基于HLS的文件管理方法, 具体实现方法可参见方法实施例,在此不再赘述。Embodiments of the present application further provide an electronic device 100, including a processor 130 and a non-volatile memory 120 storing computer instructions. When the computer instructions are executed by the processor 130, the electronic device 100 executes the foregoing For the HLS-based file management method described in any embodiment, reference may be made to the method embodiment for a specific implementation method, and details are not described herein again.

本申请实施例还提供了一种存储介质,所述存储介质中存储有计算机 程序,所述计算机程序被执行时实现前述任一实施例描述的基于HLS的文 件管理方法,具体实现方法可参见方法实施例,在此不再赘述。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. For a specific implementation method, see Method The embodiments are not repeated here.

在本申请所提供的实施例中,应该理解到,所揭露装置和方法,可以 通过其它的方式实现。以上所描述的装置实施例仅仅是示意性的,例如, 所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划 分方式,又例如,多个单元或组件可以结合或者可以集成到另一个系统, 或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦 合或直接耦合或通信连接可以是通过一些通信接口,装置或单元的间接耦 合或通信连接,可以是电性,机械或其它的形式。In the embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and other division methods may be used in actual implementation. For example, multiple units or components may be combined or Can be integrated into another system, or some features can be omitted, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some communication interfaces, indirect coupling or communication connection of devices or units, which may be electrical, mechanical or other forms.

所述作为分离部件说明的单元可以是或者也可以不是物理上分开的, 作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地 方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的 部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.

另外,在本申请提供的实施例中的各功能单元可以集成在一个处理单 元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成 在一个单元中。In addition, each functional unit in the embodiments provided in this application may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.

所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使 用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申 请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的 部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储 介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机,服 务器,或者网络设备等)执行本申请各个实施例所述方法的全部或部分步 骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁碟或者光 盘等各种可以存储程序代码的介质。The functions, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including Several instructions are used to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes .

应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一 旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步 定义和解释,此外,术语“第一”、“第二”、“第三”等仅用于区分描述, 而不能理解为指示或暗示相对重要性。It should be noted that like numerals and letters refer to like items in the following figures, so that once an item is defined in one figure, it does not require further definition and explanation in subsequent figures, Furthermore, the terms "first", "second", "third", etc. are only used to differentiate the descriptions and should not be construed to indicate or imply relative importance.

最后应说明的是:以上所述实施例,仅为本申请的具体实施方式,用 以说明本申请的技术方案,而非对其限制,本申请的保护范围并不局限于 此,尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术 人员应当理解:任何熟悉本技术领域的技术人员在本申请揭露的技术范围 内,其依然可以对前述实施例所记载的技术方案进行修改或可轻易想到变 化,或者对其中部分技术特征进行等同替换;而这些修改、变化或者替换,并不使相应技术方案的本质脱离本申请实施例技术方案的精神和范围。都 应涵盖在本申请的保护范围之内。因此,本申请的保护范围应所述以权利 要求的保护范围为准。Finally, it should be noted that the above-mentioned embodiments are only specific implementations of the present application, and are used to illustrate the technical solutions of the present application, rather than limit them. The embodiments describe the application in detail, and those of ordinary skill in the art should understand that: any person skilled in the art can still modify the technical solutions described in the foregoing embodiments within the technical scope disclosed in the application. Changes can be easily conceived, or equivalent replacements are made to some of the technical features; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions in the embodiments of the present application. All should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be based on the protection scope of the claims.

Claims (10)

1.一种基于HLS的文件管理方法,其特征在于,应用于电子设备,所述方法包括:1. a file management method based on HLS, is characterized in that, is applied to electronic equipment, and described method comprises: 解析待下载文件获得文件片段的分片信息,根据所述分片信息下载所述文件片段;Parsing the file to be downloaded to obtain fragmentation information of the file fragment, and downloading the file fragment according to the fragmentation information; 为下载的所述文件片段创建索引,其中,每个文件片段包括多个文件数据;creating an index for the downloaded file segments, wherein each file segment includes a plurality of file data; 根据所述索引判断是否存在可供读取的文件数据;Judging whether there is file data available for reading according to the index; 若存在可供读取的文件数据,则根据当前标记的读取位置读取文件数据,并更新标记的读取位置;If there is file data available for reading, read the file data according to the current marked reading position, and update the marked reading position; 返回至根据所述索引判断是否存在可供读取的文件数据的步骤。Return to the step of judging whether there is file data available for reading according to the index. 2.根据权利要求1所述的方法,其特征在于,所述若存在可供读取的文件数据,则根据当前标记的读取位置读取文件数据,并更新标记的读取位置,包括:2. method according to claim 1, is characterized in that, described if there is the file data that can be read, read the file data according to the read position of current mark, and update the read position of mark, comprising: 判断所述可供读取的文件数据的大小是否小于请求读取的文件数据的大小;Determine whether the size of the file data available for reading is smaller than the size of the file data requested to be read; 若小于,则根据当前标记的读取位置读取可供读取的文件数据,并更新标记的读取位置;If it is less than, read the file data that can be read according to the read position of the current mark, and update the read position of the mark; 若不小于,则根据当前标记的读取位置读取所述请求读取的文件数据的大小对应的文件数据,并更新标记的读取位置。If not less than, read the file data corresponding to the size of the file data requested to be read according to the read position of the current mark, and update the read position of the mark. 3.根据权利要求1或2所述的方法,其特征在于,在根据所述分片信息下载所述文件片段之后,所述方法还包括:3. The method according to claim 1 or 2, wherein after downloading the file fragment according to the fragmentation information, the method further comprises: 判断当前下载的文件片段是否为最后一个文件片段,若是,则将会话状态设置为结束。Determine whether the currently downloaded file segment is the last file segment, if so, set the session state to end. 4.根据权利要求1或2所述的方法,其特征在于,根据所述索引判断是否存在可供读取的文件数据,包括:4. The method according to claim 1 or 2, wherein judging whether there is file data available for reading according to the index comprises: 判断是否存在索引,若存在索引,则获取第一个索引;Determine whether there is an index, if there is an index, get the first index; 根据获取到的所述第一个索引判断是否存在可供读取的文件数据。According to the obtained first index, it is judged whether there is file data that can be read. 5.根据权利要求4所述的方法,其特征在于,所述方法还包括:5. The method according to claim 4, wherein the method further comprises: 若不存在可供读取的文件数据,则判断所述第一个索引对应的文件片段是否全部读取完成;If there is no file data available for reading, then determine whether all the file segments corresponding to the first index have been read; 若全部读取完成,则删除该文件片段及其索引,并返回至判断是否存在索引的步骤。If all reading is completed, delete the file segment and its index, and return to the step of judging whether an index exists. 6.根据权利要求5所述的方法,其特征在于,所述方法还包括:6. The method according to claim 5, wherein the method further comprises: 若未全部读取完成,则在预设的时间段后返回判断是否存在索引的步骤。If not all readings are completed, the step of judging whether there is an index is returned to after a preset time period. 7.根据权利要求4所述的方法,其特征在于,根据所述索引判断是否存在可供读取的文件数据,还包括:7. The method according to claim 4, wherein judging whether there is file data available for reading according to the index, further comprising: 若不存在索引,则判断会话状态是否为结束;If there is no index, judge whether the session state is over; 若不为结束状态,则在预设的时间段后返回判断是否存在索引的步骤;If it is not in the end state, return to the step of judging whether there is an index after a preset time period; 若为结束状态,则结束读取文件数据。If it is in the end state, the reading of the file data ends. 8.一种基于HLS的文件管理装置,其特征在于,应用于电子设备,所述装置包括:8. A file management device based on HLS, characterized in that, applied to electronic equipment, the device comprising: 解析下载模块,用于解析待下载文件获得文件片段的分片信息,根据所述分片信息下载所述文件片段;A parsing and downloading module, configured to parse the file to be downloaded to obtain fragmentation information of the file fragment, and download the file fragment according to the fragmentation information; 索引创建模块,用于为下载的所述文件片段创建索引,其中,每个文件片段包括多个文件数据;an index creation module for creating an index for the downloaded file segments, wherein each file segment includes a plurality of file data; 判断模块,用于根据所述索引判断是否存在可供读取的文件数据,若存在可供读取的文件数据,则根据当前标记的读取位置读取文件数据,并更新标记的读取位置;The judgment module is used to judge whether there is file data that can be read according to the index, and if there is file data that can be read, read the file data according to the reading position of the current mark, and update the reading position of the mark ; 循环模块,用于返回至根据所述索引判断是否存在可供读取的文件数据的步骤。The loop module is configured to return to the step of judging whether there is file data available for reading according to the index. 9.一种电子设备,其特征在于,包括处理器及存储有计算机指令的非易失性存储器,所述计算机指令被所述处理器执行时,所述电子设备执行权利要求1-7中任意一项所述的基于HLS的文件管理方法。9. An electronic device, characterized by comprising a processor and a non-volatile memory storing computer instructions, when the computer instructions are executed by the processor, the electronic device executes any one of claims 1-7. A described HLS-based file management method. 10.一种存储介质,其特征在于,所述存储介质中存储有计算机程序,所述计算机程序被执行时实现权利要求1-7中任意一项所述的基于HLS的文件管理方法。10. A storage medium, wherein a computer program is stored in the storage medium, and when the computer program is executed, the HLS-based file management method according to any one of claims 1-7 is implemented.
CN202010403172.9A 2020-05-13 2020-05-13 HLS-based file management method and device, electronic equipment and storage medium Pending CN111597153A (en)

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 (2)

* Cited by examiner, † Cited by third party
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
WO2025081617A1 (en) * 2023-10-19 2025-04-24 天翼电子商务有限公司 Data reading method and apparatus, storage medium and electronic device

Citations (6)

* Cited by examiner, † Cited by third party
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)

* Cited by examiner, † Cited by third party
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
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 (2)

* Cited by examiner, † Cited by third party
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
WO2025081617A1 (en) * 2023-10-19 2025-04-24 天翼电子商务有限公司 Data reading method and apparatus, storage medium and electronic device

Also Published As

Publication number Publication date
WO2021227481A1 (en) 2021-11-18

Similar Documents

Publication Publication Date Title
US11490173B2 (en) Switch of audio and video
CN104850602B (en) A kind of rendering refreshing implementation method and device based on internet web page
CN108156152B (en) Method, apparatus, storage medium and the terminal device Streaming Media downloading and played
CN109729386B (en) A kind of video file start broadcasting method, system and electronic equipment and storage medium
CN108933764B (en) Method and device for realizing quick broadcast starting
CN109525578B (en) CDN (content delivery network) delivery network transmission method, device, system and storage medium
CN104602138A (en) A method and device for enabling streaming media server to support HLS protocol
CN104657401A (en) Web cache updating method
JP7524231B2 (en) Video data processing method, device, electronic device and computer-readable medium
WO2024245234A1 (en) Media file preloading method and apparatus, electronic device, and storage medium
CN111597153A (en) HLS-based file management method and device, electronic equipment and storage medium
CN105701153A (en) Method and device for reading webpage resources and electronic equipment
CN113055455A (en) File uploading method and equipment
CN110620827B (en) Fragment packaging method, host, system and equipment on Android cloud
EP3883251A1 (en) Video request method and system, and computer device and computer-readable storage medium
CN110493324A (en) Method for down loading, downloader and computer readable storage medium
CN118540319A (en) Method and device for downloading file through browser and electronic equipment
EP3125541A1 (en) Data acquisition and interaction method, set top box, server and multimedia system
CN110519656B (en) Self-adaptive streaming media playing method, system and server
CN111031117B (en) A multimedia file download method and related device
CN104217021B (en) Reading server, terminal device and its method for showing reading content
KR102720349B1 (en) Method for providing of playback statistical information about streamming data and apparatsu thereof
CN115412777A (en) Streaming media data transmission method, device and system
EP4075814A1 (en) Mp4 file virtual mss fragmentation method, mss adapter, media server, and storage medium
WO2014101462A1 (en) Method and apparatus for compressing web page text

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200828