Method, device, equipment and storage medium for searching streaming media format data packets
By analyzing and narrowing the search range of streaming media format data packets, and performing type judgment and matching processing on the data packets, generating a temporary index table, solving the problem of low efficiency in streaming media format data packet search in the prior art, realizing the Quick positioning and retrieval effects.
Patent Information
- Application Number
- CN202210262105.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-16
- Publication Date
- 2025-02-18
- Estimated Expiration
- 2042-03-16
AI Technical Summary
The search method of existing streaming format packets is inefficient, especially in the absence of index tables, making it difficult to quickly locate streaming format packets.
By obtaining the search request for streaming media format data packets, parsing the original file, narrowing the search range, and performing type judgment and data content matching processing on the byte content of the data packet, a temporary index table is generated to store the successfully matched data packets.
It improves the search efficiency of streaming media format data packets and avoids full reading and judgment of all files. Especially in the absence of index tables, it can quickly locate and retrieve streaming media format data packets.
Smart Images

Figure CN114625892B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of audio and video technology, and in particular to a method, device, equipment and storage medium for searching data packets in a streaming media format. Background Art
[0002] FLV is the abbreviation of FLASH VIDEO. FLV streaming media format is a video format developed with the launch of Flash MX. Since the files formed by the streaming media format data package (FLASH VIDEO) are extremely small and load very quickly, it makes it possible to watch video files on the Internet. Its appearance effectively solves the problem that after the video files are imported into Flash, the exported SWF files are huge in size and cannot be used well on the Internet.
[0003] The existing method of searching for streaming media format data packets is to read and judge all files to find the streaming media format data packets. However, in general, the streaming media format data files do not have an index table, or the index table is missing, which makes it difficult to find the streaming media format data packets, resulting in low searching efficiency for the streaming media format data packets. A method for improving the searching efficiency for streaming media format data packets is urgently needed. Summary of the invention
[0004] The purpose of the embodiments of the present application is to provide a method, device, equipment and storage medium for searching streaming media format data packets, so as to improve the searching efficiency of streaming media format data packets.
[0005] In order to solve the above technical problems, an embodiment of the present application provides a method for searching a streaming media format data packet, comprising:
[0006] Obtaining a search request for a streaming media format data packet, and parsing an original file based on the search request to obtain a file to be searched, wherein the file to be searched includes a plurality of data packets;
[0007] For each data packet in the file to be searched, determining whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtaining a first determination result;
[0008] If the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet, the data packet is taken as the target data packet, and the data content of the target data packet is read, wherein the data content includes a data packet size, an identification field, and a timestamp, and the data packet size includes a first data packet size and a second data packet size;
[0009] Matching the identification field of the data content with the data packet size to obtain a matching result;
[0010] If the matching result is that the data content matches successfully, the target data packet is determined to be a streaming media format data packet, and the target data packet is stored in a temporary index table.
[0011] Furthermore, if the matching result is that the data content matches successfully, then the target data packet is determined to be a streaming media format data packet, and after the target data packet is stored in a temporary index table, the method further includes:
[0012] If the timestamp requested by the client is received, judging whether the streaming media format data packet is found in the temporary index table based on the timestamp requested by the client, and obtaining a second judgment result;
[0013] If the second judgment result is that the streaming media format data packet is not found in the temporary index table, then judging whether the timestamp requested by the client is between the timestamps of the two indexes;
[0014] If the timestamp requested by the client is between the timestamps of the two indexes, a binary search method is used to search the streaming media format data packet in the temporary index table until the streaming media format data packet is obtained.
[0015] Further, the step of obtaining a search request for a streaming media format data packet and parsing the original file based on the search request to obtain the file to be searched includes:
[0016] Obtaining a search request for a streaming media format data packet, wherein the search request includes a search range and a file size;
[0017] Based on the search range and the file size, the original file is parsed to obtain the file to be searched corresponding to the search range and the file size.
[0018] Further, the matching process of the identification field of the data content and the data packet size to obtain a matching result includes:
[0019] Acquire a marking field of a comparison streaming media format data packet as a comparison marking field, wherein the comparison marking field includes an encoding type, a sampling rate, and a bit depth of the audio and video;
[0020] Matching the comparison identification field with the identification field to obtain a first matching result;
[0021] If the first matching result is that the comparison identification field matches the identification field successfully, determining whether the first data packet size is equal to the second data packet size;
[0022] If the size of the first data packet is equal to the size of the second data packet, the matching result is a successful data content match; if the size of the first data packet is not equal to the size of the second data packet, the matching result is a failed data content match.
[0023] Further, for each data packet in the file to be searched, determining whether the byte content of the data packet conforms to the type of the streaming media format data packet to obtain a first determination result includes:
[0024] Obtain the type of the streaming media format data packet;
[0025] For each data packet in the to-be-searched file, read the byte content of the data packet in the to-be-searched file, and perform string matching between the byte content and the type of the streaming media format data packet to obtain a matching result;
[0026] If the matching result is a string match, then the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet;
[0027] If the matching result is that the character string does not match, then the first judgment result is that the byte content of the data packet in the to-be-searched file does not conform to the type of the streaming media format data packet.
[0028] Furthermore, if the matching result is that the data content matches successfully, determining that the target data packet is a streaming media format data packet, and storing the target data packet in a temporary index table includes:
[0029] If the matching result is that the data content matches successfully, then determining that the target data packet is a streaming media format data packet;
[0030] The target data packet is stored in the temporary index table in a timestamp manner, and the data size of the target data packet is stored in the temporary index table.
[0031] In order to solve the above technical problems, an embodiment of the present application provides a device for searching a streaming media format data packet, comprising:
[0032] A search request acquisition module, used to obtain a search request for a streaming media format data packet, and parse the original file based on the search request to obtain a file to be searched, wherein the file to be searched includes multiple data packets;
[0033] A first judgment result generating module is used to judge, for each data packet in the file to be searched, whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtain a first judgment result;
[0034] a data content reading module, configured to, if the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet, take the data packet as a target data packet and read the data content of the target data packet, wherein the data content includes a data packet size, an identification field and a timestamp, and the data packet size includes a first data packet size and a second data packet size;
[0035] A matching result generating module, used for matching the identification field of the data content with the data packet size to obtain a matching result;
[0036] The data packet search module is used to determine that the target data packet is a streaming media format data packet if the matching result is that the data content matches successfully, and store the target data packet in a temporary index table.
[0037] Further, after the data packet search module, the device also includes:
[0038] A second judgment result generating module is used to determine whether the streaming media format data packet is found in the temporary index table based on the timestamp requested by the client if a timestamp requested by the client is received, so as to obtain a second judgment result;
[0039] A timestamp determination module, configured to determine whether the timestamp requested by the client is between the timestamps of two indexes if the second determination result is that the streaming media format data packet is not found in the temporary index table;
[0040] The binary search module is used to use a binary search method to search the streaming media format data packet in the temporary index table if the timestamp requested by the client is between the timestamps of the two indexes, until the streaming media format data packet is obtained.
[0041] To solve the above technical problems, a technical solution adopted by the present invention is: to provide a computer device, including one or more processors; a memory for storing one or more programs, so that one or more processors can implement the method for searching streaming media format data packets described in any one of the above.
[0042] To solve the above technical problems, a technical solution adopted by the present invention is: a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the method for searching a streaming media format data packet described in any one of the above is implemented.
[0043] The embodiment of the present invention provides a method, device, equipment and storage medium for searching streaming media format data packets. The method includes: obtaining a search request for a streaming media format data packet, and parsing the original file based on the search request to obtain a file to be searched, wherein the file to be searched includes multiple data packets; for each data packet in the file to be searched, judging whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtaining a first judgment result; if the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet, the data packet is used as a target data packet, and the data content of the target data packet is read, wherein the data content includes a data packet size, an identification field and a timestamp, and the data packet size includes a first data packet size and a second data packet size; matching the identification field of the data content with the data packet size respectively to obtain a matching result; if the matching result is that the data content matches successfully, the target data packet is judged to be a streaming media format data packet, and the target data packet is stored in a temporary index table. The embodiment of the present invention parses the original file to obtain the file to be searched, narrows the search range of the streaming media format data packet, and judges the type of each data packet, effectively screens the streaming media format data packet, and then matches the data content of the data packet to further screen the streaming media format data packet to obtain the final streaming media format data packet, avoids reading and judging all files, and improves the search efficiency of the streaming media format data in the case of missing streaming media format data packet index. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the scheme in the present application, a brief introduction is given below to the drawings required for use in the description of the embodiments of the present application. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1 This is a flowchart of an implementation of a method for searching a streaming media format data packet provided in an embodiment of the present application;
[0046] Figure 2 It is another implementation flow chart of a sub-process in the method for searching a streaming media format data packet provided in an embodiment of the present application;
[0047] Figure 3 It is another implementation flow chart of a sub-process in the method for searching a streaming media format data packet provided in an embodiment of the present application;
[0048] Figure 4 It is another implementation flow chart of a sub-process in the method for searching a streaming media format data packet provided in an embodiment of the present application;
[0049] Figure 5 It is another implementation flow chart of a sub-process in the method for searching a streaming media format data packet provided in an embodiment of the present application;
[0050] Figure 6 It is another implementation flow chart of a sub-process in the method for searching a streaming media format data packet provided in an embodiment of the present application;
[0051] Figure 7 It is a schematic diagram of a device for searching streaming media format data packets provided in an embodiment of the present application;
[0052] Figure 8 It is a schematic diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by technicians in the technical field of the present application; the terms used in the specification of the application herein are only for the purpose of describing specific embodiments and are not intended to limit the present application; the terms "including" and "having" and any variations thereof in the specification and claims of the present application and the above-mentioned drawings are intended to cover non-exclusive inclusions. The terms "first", "second", etc. in the specification and claims of the present application or the above-mentioned drawings are used to distinguish different objects, not to describe a specific order.
[0054] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0055] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings.
[0056] The present invention is described in detail below with reference to the accompanying drawings and embodiments.
[0057] It should be noted that the method for searching for streaming media format data packets provided in the embodiments of the present application is generally executed by a server, and accordingly, the device for searching for streaming media format data packets is generally configured in the server.
[0058] See also Figure 1 , Figure 1 A specific implementation of a method for searching a streaming media format data packet is shown.
[0059] It should be noted that if there are substantially the same results, the method of the present invention is not limited to Figure 1 The process sequence shown is limited to the following steps:
[0060] S1: Obtain a search request for a streaming media format data packet, and parse the original file based on the search request to obtain a file to be searched, wherein the file to be searched includes multiple data packets.
[0061] See also Figure 2 , Figure 2 A specific implementation of step S1 is shown, which is described in detail as follows:
[0062] S11: Obtain a search request for a streaming media format data packet, wherein the search request includes a search range and a file size.
[0063] S12: Based on the search range and the file size, the original file is parsed to obtain a file to be searched corresponding to the search range and the file size.
[0064] Specifically, when it is necessary to search for a streaming media format data packet, the client first sends a search request for the streaming media format data packet to the server, and the server receives the search request for the streaming media format data packet and starts to search for the streaming media format data packet. Since each file has its generation time, a search range can be included in the search request sent, and the search range is defined by the generation time of the original file; and the file size can be set according to the client's choice. In a specific embodiment, the search range is that the generation time of the original file is within the last 24 hours and the file size is 5 megabytes. Based on the search range and the file size, the original file is parsed to obtain the file to be searched within the last 24 hours with a file size of 5 megabytes. Among them, the original file includes the file of the streaming media format data packet.
[0065] In this embodiment, by obtaining a search request for a streaming media format data packet and parsing the original file based on the search range and file size to obtain a file to be searched corresponding to the search range and file size, it is helpful to narrow the search range of the streaming media format data packet, thereby helping to improve the search efficiency of the streaming media format data packet.
[0066] S2: For each data packet in the file to be searched, determine whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtain a first determination result.
[0067] Specifically, since the streaming media format data packet has a fixed type, such as audio, video and metadata, the type of the streaming media format data packet is audio:0x08, video:0x09, meta:0x12, so it is determined whether the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet to obtain a first judgment result.
[0068] See also Figure 3 , Figure 3 A specific implementation of step S2 is shown, which is described in detail as follows:
[0069] S21: Obtain the type of the streaming media format data packet.
[0070] S22: For each data packet in the file to be searched, the byte content of the data packet in the file to be searched is read, and a string matching is performed between the byte content and the type of the data packet in the streaming media format to obtain a matching result.
[0071] S23: If the matching result is that the character string matches, then the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet.
[0072] S24: If the matching result is that the character string does not match, the first judgment result is that the byte content of the data packet in the file to be searched does not conform to the type of the streaming media format data packet.
[0073] Specifically, the type of the streaming media format data packet (audio: 0x08, video: 0x09, meta: 0x12) is first obtained, and then the byte content of the data packet in the file to be searched is read, and the byte content is string matched with the type of the streaming media format data packet to obtain a matching result. If the matching result is a string match, the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet; if the matching result is a string mismatch, the first judgment result is that the byte content of the data packet in the file to be searched does not conform to the type of the streaming media format data packet, thereby achieving preliminary screening of the data packets in the file to be searched, and excluding data packets that do not conform to the type of the streaming media format data packet, which is beneficial to improving the search efficiency of the streaming media format data packet.
[0074] Furthermore, the string matching process between the byte content and the type of the streaming media format data packet is as follows: the type of the streaming media format data packet is converted into a string form to obtain a comparison string; the comparison string is aligned with the byte content at either end; each character is compared starting from the aligned end, and if the characters are the same, the next character is compared until all characters are compared. If the characters of the comparison string and the byte content are exactly the same, the string matching result is successful; if any character is different, the string matching result fails.
[0075] S3: If the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the data packet in the streaming media format, the data packet is taken as the target data packet, and the data content of the target data packet is read.
[0076] Specifically, if the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet, the data packet is taken as the target data packet, and the data content of the target data packet is read, the data content includes the data packet size (packet size), identification field (flags) and timestamp (timestamp), etc.; if the first judgment result is that the byte content of the data packet in the file to be searched does not conform to the type of the streaming media format data packet, then it is judged that the byte content of the following data packet in the file to be searched conforms to the type of the streaming media format data packet.
[0077] S4: Match the identification field of the data content with the data packet size respectively to obtain a matching result.
[0078] See also Figure 4 , Figure 4 A specific implementation of step S4 is shown, which is described in detail as follows:
[0079] S41: Acquire a marking field of a comparison streaming media format data packet as a comparison marking field, wherein the comparison marking field includes an encoding type, a sampling rate, and a bit depth of audio and video.
[0080] S42: Match the comparison identification field with the identification field to obtain a first matching result.
[0081] S43: If the first matching result is that the comparison mark field and the mark field match successfully, determine whether the first data packet size is equal to the second data packet size.
[0082] S44: If the size of the first data packet is equal to the size of the second data packet, the matching result is that the data content matches successfully; if the size of the first data packet is not equal to the size of the second data packet, the matching result is that the data content matches failed.
[0083] Specifically, since the data content includes a packet size, a flag field, and a timestamp, etc., and the packet size includes a first packet size and a second packet size. This embodiment performs matching judgments on the packet size and the flag field, respectively. First, the flag field of the comparison streaming media format data packet is obtained as the comparison flag field, wherein the comparison flag field includes the encoding type, sampling rate, and bit depth of the audio and video, and then it is determined whether the comparison flag field and the encoding type, sampling rate, and bit depth of the audio and video of the flag field match. If they match, proceed to the next step. If they do not match, the data packet is not a streaming media format data packet, and step S2 is re-executed to determine the next data packet. Among them, the comparison flag field is the first flag field of the audio and video after the header field (flv header) of the comparison streaming media format data packet. If the first matching result is that the comparison mark field and the marking field match successfully, then determine whether the size of the first data packet is equal to the size of the second data packet. If the size of the first data packet is equal to the size of the second data packet, the matching result is that the data content matches successfully; if the size of the first data packet is not equal to the size of the second data packet, the matching result is that the data content matches failed, and step S2 is re-executed to determine the next data packet. The total number of samples sampled per second is called the sampling rate, and the unit is Hz. The bit depth is also called the sampling accuracy, and the unit is Bit. Common bit depth options are 16Bit and 24Bit; the total number of samples sampled per second is the sampling rate, and the bit depth is the number of bits of information in each sample.
[0084] In this embodiment, by obtaining the identification field of the comparison streaming media format data packet as the comparison identification field, matching the comparison identification field with the identification field, and comparing the first data packet size with the second data packet size, it is determined whether the data packet is a streaming media format data packet, thereby avoiding the judgment of all file information, which is beneficial to improving the search efficiency of streaming media format data packets.
[0085] S5: If the matching result is that the data content matches successfully, the target data packet is determined to be a streaming media format data packet, and the target data packet is stored in a temporary index table.
[0086] Specifically, the temporary index table includes the data size, timestamp, etc. of each streaming media format data packet.
[0087] In this embodiment, a search request for a streaming media format data packet is obtained, and the original file is parsed based on the search request to obtain a file to be searched, wherein the file to be searched includes multiple data packets; for each data packet in the file to be searched, it is determined whether the byte content of the data packet conforms to the type of the streaming media format data packet to obtain a first judgment result; if the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the streaming media format data packet, the data packet is used as a target data packet, and the data content of the target data packet is read, wherein the data content includes a data packet size, an identification field, and a timestamp, and the data packet size includes a first data packet size and a second data packet size; the identification field of the data content and the data packet size are matched respectively to obtain a matching result; if the matching result is that the data content matches successfully, the target data packet is determined to be a streaming media format data packet, and the target data packet is stored in a temporary index table. The embodiment of the present invention parses the original file to obtain the file to be searched, narrows the search range of the streaming media format data packet, and judges the type of each data packet, effectively screens the streaming media format data packet, and then matches the data content of the data packet to further screen the streaming media format data packet to obtain the final streaming media format data packet, avoids reading and judging all files, and improves the search efficiency of the streaming media format data in the case of missing streaming media format data packet index.
[0088] See also Figure 5 , Figure 5 A specific implementation of step S5 is shown, which is described in detail as follows:
[0089] S51: If the matching result is that the data content matches successfully, it is determined that the target data packet is a streaming media format data packet.
[0090] S52: Store the target data packet in a temporary index table in a timestamp format, and store the data size of the target data packet in the temporary index table.
[0091] Specifically, if the matching result is that the data content matches successfully, the target data packet is determined to be a streaming media format data packet. If the matching result is that the data content matches failed, the target data packet is determined not to be a streaming media format data packet, and step S2 is re-executed to judge the next data packet. The data packet determined to be the streaming media format data packet is stored in the temporary index table. Then, it is determined whether the next data packet in the search file is a streaming media format data packet, until the data packet search in the data packet to be searched is completed, and the data packet determined to be the streaming media format data packet is stored in the temporary index table in the form of a timestamp. In this embodiment, the data packet determined to be the streaming media format data packet is stored in the temporary index table, which facilitates the subsequent search for the streaming media format data packet with the corresponding timestamp. When the corresponding streaming media format data packet needs to be searched later, only the corresponding timestamp information needs to be searched to find the corresponding streaming media format data packet, thereby facilitating the search efficiency of the streaming media format data packet.
[0092] See also Figure 6 , Figure 6 A specific implementation after step S5 is shown, which is described in detail as follows:
[0093] S5A: If the timestamp requested by the client is received, it is determined whether a streaming media format data packet is found in the temporary index table based on the timestamp requested by the client, and a second determination result is obtained.
[0094] S5B: If the second determination result is that the streaming media format data packet is not found in the temporary index table, it is determined whether the timestamp requested by the client is between the timestamps of the two indexes.
[0095] S5C: If the timestamp requested by the client is between the timestamps of the two indexes, a binary search method is used to search for the streaming media format data packet in the temporary index table until the streaming media format data packet is obtained.
[0096] Specifically, since the above steps have stored the data packet determined to correspond to the streaming media format data packet in the temporary index table, if a timestamp requested by the client is subsequently received, it is determined based on the timestamp requested by the client whether the streaming media format data packet is found in the temporary index table to obtain a second judgment result; if the second judgment result is that the streaming media format data packet can be found in the temporary index table, the request task is completed; since the index of the streaming media format data packet is stored in the temporary index table and the corresponding timestamp has been indexed, if the second judgment result is that the streaming media format data packet is not found in the temporary index table, it is determined whether the timestamp requested by the client is between the timestamps of the two indexes; if the timestamp requested by the client is between the timestamps of the two indexes, a binary search method is used to search for the streaming media format data packet in the temporary index table until the streaming media format data packet is obtained.
[0097] Among them, the binary search method is to find the specific position of the number that is the same as the given keyword in a known ordered queue. The principle is to define three pointers low, high, and mid to point to the lower and upper bounds of the range of the element to be searched and the middle position of the interval, that is, mid = (low + high) / 2, and compare the keyword with the number pointed to by mid. If they are equal, the search is successful and mid is returned. If the keyword is less than the number pointed to by mid, high = mid-1, otherwise low = mid + 1, and then continue to loop until it is found or not found.
[0098] In this embodiment, by receiving the timestamp requested by the client, the streaming media format data packet corresponding to the timestamp is searched from the temporary index table. If the search fails, a binary search method is used to search from the temporary index table, thereby avoiding reading all the data packets, which is beneficial to improving the search efficiency of the streaming media format data packets.
[0099] Please refer to Figure 7 , as a response to the above Figure 1 The present application provides an embodiment of a device for searching a streaming media format data packet. Figure 1 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.
[0100] like Figure 7 As shown, the streaming media format data packet search device of this embodiment includes: a search request acquisition module 61, a first judgment result generation module 62, a data content reading module 63, a matching result generation module 64 and a data packet search module 65, wherein:
[0101] A search request acquisition module 61 is used to acquire a search request for a streaming media format data packet, and parse the original file based on the search request to acquire a file to be searched, wherein the file to be searched includes a plurality of data packets;
[0102] A search request acquisition module 61 is used to acquire a search request for a streaming media format data packet, and parse the original file based on the search request to acquire a file to be searched, wherein the file to be searched includes a plurality of data packets;
[0103] A first judgment result generating module 62 is used to judge, for each data packet in the file to be searched, whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtain a first judgment result;
[0104] The data content reading module 63 is used to take the data packet as the target data packet and read the data content of the target data packet if the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the data packet in the streaming media format, wherein the data content includes the data packet size, the identification field and the timestamp, and the data packet size includes the first data packet size and the second data packet size;
[0105] A matching result generating module 64 is used to match the identification field of the data content with the data packet size to obtain a matching result;
[0106] The data packet search module 65 is used to determine that the target data packet is a streaming media format data packet if the matching result is that the data content matches successfully, and store the target data packet in a temporary index table.
[0107] Further, after the data packet search module 65, the device also includes:
[0108] A second judgment result generating module is used to determine whether a streaming media format data packet is found in the temporary index table based on the timestamp requested by the client if a timestamp requested by the client is received, so as to obtain a second judgment result;
[0109] A timestamp determination module, configured to determine whether the timestamp requested by the client is between the timestamps of the two indexes if the second determination result is that the streaming media format data packet is not found in the temporary index table;
[0110] The binary search module is used to search for the streaming media format data packet in the temporary index table by using the binary search method if the timestamp requested by the client is between the timestamps of the two indexes, until the streaming media format data packet is obtained.
[0111] Furthermore, the search request acquisition module 61 includes:
[0112] A request acquisition unit, used to acquire a search request for a streaming media format data packet, wherein the search request includes a search range and a file size;
[0113] The original file parsing unit is used to parse the original file based on the search range and the file size to obtain the to-be-searched file corresponding to the search range and the file size.
[0114] Furthermore, the matching result generating module 64 includes:
[0115] A comparison mark field acquisition unit is used to acquire a mark field of a comparison streaming media format data packet as a comparison mark field, wherein the comparison mark field includes an encoding type, a sampling rate, and a bit depth of audio and video;
[0116] A first matching result generating unit, used for matching the comparison identification field with the identification field to obtain a first matching result;
[0117] a data packet comparison unit, configured to determine whether the size of the first data packet is equal to the size of the second data packet if the first matching result is that the comparison identification field and the identification field match successfully;
[0118] The match failure unit is used to determine that if the size of the first data packet is equal to the size of the second data packet, the match result is a successful data content match; if the size of the first data packet is not equal to the size of the second data packet, the match result is a failed data content match.
[0119] Furthermore, the first matching result generating unit includes:
[0120] A type acquisition subunit is used to acquire the type of a streaming media format data packet;
[0121] The byte content reading subunit is used to read the byte content of the data packet in the file to be searched for each data packet in the file to be searched, and perform string matching between the byte content and the type of the streaming media format data packet to obtain a matching result;
[0122] The first subunit for string matching is used for, if the matching result is that the string matches, then the first judgment result is that the byte content of the data packet in the file to be searched conforms to the type of the data packet in the streaming media format;
[0123] The string matching second subunit is used to, if the matching result is that the string does not match, then the first judgment result is that the byte content of the data packet in the file to be searched does not conform to the type of the streaming media format data packet.
[0124] Further, the data packet search module 65 includes:
[0125] A matching success module is used to determine that the target data packet is a streaming media format data packet if the matching result is that the data content matches successfully;
[0126] The data packet storage module is used to store the target data packet in a temporary index table in a timestamp manner, and store the data size of the target data packet in the temporary index table.
[0127] To solve the above technical problems, the present application also provides a computer device. Figure 8 , Figure 8 This is a basic structural block diagram of the computer device in this embodiment.
[0128] The computer device 7 includes a memory 71, a processor 72, and a network interface 73 that are interconnected through a system bus. It should be noted that the figure only shows a computer device 7 having three components: a memory 71, a processor 72, and a network interface 73, but it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASIC), programmable gate arrays (FPGA), digital signal processors (DSP), embedded devices, etc.
[0129] Computer devices can be computing devices such as desktop computers, notebooks, PDAs, and cloud servers. Computer devices can interact with users through keyboards, mice, remote controls, touch pads, or voice control devices.
[0130] The memory 71 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, disk, optical disk, etc. In some embodiments, the memory 71 can be an internal storage unit of the computer device 7, such as a hard disk or memory of the computer device 7. In other embodiments, the memory 71 can also be an external storage device of the computer device 7, such as a plug-in hard disk equipped on the computer device 7, a smart memory card (SmartMedia Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. Of course, the memory 71 can also include both the internal storage unit of the computer device 7 and its external storage device. In this embodiment, the memory 71 is generally used to store the operating system and various application software installed on the computer device 7, such as the program code of the method for searching the streaming media format data packet, etc. In addition, the memory 71 can also be used to temporarily store various types of data that have been output or are to be output.
[0131] The processor 72 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips in some embodiments. The processor 72 is generally used to control the overall operation of the computer device 7. In this embodiment, the processor 72 is used to run the program code stored in the memory 71 or process data, such as running the program code of the above-mentioned method for searching the streaming media format data packet to implement various embodiments of the method for searching the streaming media format data packet.
[0132] The network interface 73 may include a wireless network interface or a wired network interface, and the network interface 73 is generally used to establish a communication connection between the computer device 7 and other electronic devices.
[0133] The present application also provides another implementation, namely, providing a computer-readable storage medium, which stores a computer program. The computer program can be executed by at least one processor to enable the at least one processor to perform the steps of a method for searching a streaming media format data packet as described above.
[0134] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods of each embodiment of the present application.
[0135] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0136] Obviously, the embodiments described above are only some embodiments of the present application, rather than all embodiments. The preferred embodiments of the present application are given in the accompanying drawings, but they do not limit the patent scope of the present application. The present application can be implemented in many different forms. On the contrary, the purpose of providing these embodiments is to make the understanding of the disclosure of the present application more thorough and comprehensive. Although the present application is described in detail with reference to the aforementioned embodiments, for those skilled in the art, it is still possible to modify the technical solutions recorded in the aforementioned specific implementation methods, or to perform equivalent replacement of some of the technical features therein. Any equivalent structure made using the contents of the specification and drawings of this application, directly or indirectly used in other related technical fields, is similarly within the scope of patent protection of this application.
Claims
1. A method for searching a streaming media format data packet, characterized in that: include: Obtaining a search request for a streaming media format data packet, and parsing an original file based on the search request to obtain a file to be searched, wherein the file to be searched includes a plurality of data packets; For each data packet in the file to be searched, determining whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtaining a first determination result; If the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet, the data packet is taken as the target data packet, and the data content of the target data packet is read, wherein the data content includes a data packet size, an identification field, and a timestamp, and the data packet size includes a first data packet size and a second data packet size; Matching the identification field of the data content with the data packet size to obtain a matching result; If the matching result is that the data content matches successfully, the target data packet is determined to be a streaming media format data packet, and the target data packet is stored in a temporary index table; Wherein, if the matching result is that the data content matches successfully, then determining that the target data packet is a streaming media format data packet, and storing the target data packet in a temporary index table, the method further includes: If the timestamp requested by the client is received, judging whether the streaming media format data packet is found in the temporary index table based on the timestamp requested by the client, and obtaining a second judgment result; If the second judgment result is that the streaming media format data packet is not found in the temporary index table, then judging whether the timestamp requested by the client is between the timestamps of the two indexes; If the timestamp requested by the client is between the timestamps of the two indexes, a binary search method is used to search the streaming media format data packet in the temporary index table until the streaming media format data packet is obtained; The matching process of the identification field of the data content and the data packet size to obtain a matching result includes: Acquire a marking field of a comparison streaming media format data packet as a comparison marking field, wherein the comparison marking field includes an encoding type, a sampling rate, and a bit depth of the audio and video; Matching the comparison identification field with the identification field to obtain a first matching result; If the first matching result is that the comparison identification field matches the identification field successfully, determining whether the first data packet size is equal to the second data packet size; If the size of the first data packet is equal to the size of the second data packet, the matching result is that the data content matches successfully; if the size of the first data packet is not equal to the size of the second data packet, the matching result is that the data content matches failed; For each data packet in the file to be searched, determining whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtaining a first determination result, includes: Obtain the type of the streaming media format data packet; For each data packet in the to-be-searched file, read the byte content of the data packet in the to-be-searched file, and perform string matching between the byte content and the type of the streaming media format data packet to obtain a matching result; If the matching result is a string match, then the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet; If the matching result is that the character string does not match, then the first judgment result is that the byte content of the data packet in the to-be-searched file does not conform to the type of the streaming media format data packet.
2. The method for searching streaming media format data packets according to claim 1, characterized in that: The step of obtaining a search request for a streaming media format data packet and parsing the original file based on the search request to obtain the file to be searched includes: Obtaining a search request for a streaming media format data packet, wherein the search request includes a search range and a file size; Based on the search range and the file size, the original file is parsed to obtain the file to be searched corresponding to the search range and the file size.
3. The method for searching streaming media format data packets according to any one of claims 1 to 2, characterized in that: If the matching result is that the data content matches successfully, determining that the target data packet is a streaming media format data packet, and storing the target data packet in a temporary index table, includes: If the matching result is that the data content matches successfully, then determining that the target data packet is a streaming media format data packet; The target data packet is stored in the temporary index table in a timestamp manner, and the data size of the target data packet is stored in the temporary index table.
4. A device for searching streaming media format data packets, characterized in that: include: A search request acquisition module, used to obtain a search request for a streaming media format data packet, and parse the original file based on the search request to obtain a file to be searched, wherein the file to be searched includes multiple data packets; A first judgment result generating module is used to judge, for each data packet in the file to be searched, whether the byte content of the data packet conforms to the type of the streaming media format data packet, and obtain a first judgment result; a data content reading module, configured to, if the first judgment result is that the byte content of the data packet in the to-be-searched file conforms to the type of the streaming media format data packet, take the data packet as a target data packet and read the data content of the target data packet, wherein the data content includes a data packet size, an identification field and a timestamp, and the data packet size includes a first data packet size and a second data packet size; A matching result generating module, used for matching the identification field of the data content with the data packet size to obtain a matching result; A data packet search module, configured to determine that the target data packet is a streaming media format data packet if the matching result is that the data content matches successfully, and store the target data packet in a temporary index table; Wherein, after the data packet search module, the device further includes: A second judgment result generating module is used to determine whether the streaming media format data packet is found in the temporary index table based on the timestamp of the client request if the timestamp of the client request is received, so as to obtain a second judgment result; A timestamp determination module, configured to determine whether the timestamp requested by the client is between the timestamps of two indexes if the second determination result is that the streaming media format data packet is not found in the temporary index table; A timestamp determination module, configured to use a binary search method to search the streaming media format data packet in the temporary index table if the timestamp requested by the client is between the timestamps of the two indexes, until the streaming media format data packet is obtained; The matching result generation module comprises: The matching result generation module obtains the identification field of the comparison streaming media format data packet as the comparison identification field, wherein the comparison identification field includes the encoding type, sampling rate and bit depth of the audio and video; A first matching result generating unit, configured to match the comparison identification field with the identification field to obtain a first matching result; a data packet comparison unit, configured to determine whether the first data packet size is equal to the second data packet size if the first matching result is that the comparison identification field matches the identification field successfully; a data packet comparison unit, configured to: if the size of the first data packet is equal to the size of the second data packet, the matching result is a successful data content match; if the size of the first data packet is not equal to the size of the second data packet, the matching result is a failed data content match; The first matching result generating unit includes: A type acquisition subunit, used to acquire the type of the streaming media format data packet; The byte content reading subunit is used to read the byte content of the data packet in the file to be searched for each data packet in the file to be searched, and perform string matching between the byte content and the type of the streaming media format data packet to obtain a matching result; A first string matching subunit is used for, if the matching result is a string match, then the first judgment result is that the byte content of the data packet in the file to be found conforms to the type of the streaming media format data packet; The first string matching subunit is used for, if the matching result is a string mismatch, then the first judgment result is that the byte content of the data packet in the file to be searched does not conform to the type of the streaming media format data packet.
5. A computer device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the method for searching a streaming media format data packet as claimed in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method for searching a streaming media format data packet according to any one of claims 1 to 3 is implemented.
Citation Information
Patent Citations
Method for extracting, analyzing and searching network flow and content
CN103281213A
Fast and precise positioning method for original network data packets
CN107241231A