A fast preview method for optical disc files, computing device and storage medium
By executing a quick preview method of CD files in a computing device, directly parsing the UDF file system in the user state, solving the time-consuming and complex problems of the CD file reading process, achieving rapid preview and performance improvement.
Patent Information
- Application Number
- CN202111579218.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-22
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2041-12-22
AI Technical Summary
In the prior art, the reading process of optical disk files is time-consuming and complex, especially in the operating system of Linux distributions. Users need to mount the optical disk medium through the kernel and parse metadata to view the file content, resulting in poor performance.
By executing a quick preview method of optical disc files in a computing device, responding to user requests, obtaining optical disc information, verifying file system, parsing metadata, generating file information and outputting file lists, a quick preview is achieved.
Bypassing the kernel-state file system and mounting mechanism, directly parsing the UDF file system in the user state, improving the startup performance of the file manager, and users can view the CD information without waiting for the optical drive to mount, improving user interaction experience.
Smart Images

Figure CN114281257B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer technology, and in particular to a fast preview method for optical disc files, a computing device and a storage medium. Background Art
[0002] Optical disc data storage requires a file system. Commonly used optical disc file systems include ISO 9660 (International Organization for Standardization 9660, an optical disc file system defined by the International Organization for Standardization (ISO)) and UDF (Universal Disk Format, a file specification established by the Optical Storage Technology Association). Since the ISO 9660 file system has many defects, such as not supporting the burning of single files larger than 4G and supporting fewer file attributes, the UDF file system for optical disc data storage was invented. Compared with the ISO9660 file system, it has the following main advantages:
[0003] Supports up to 2TB of storage media (more than enough for optical disks);
[0004] Supports flash media, Iomega REV discs and CD-MRW discs;
[0005] Files smaller than 2KB are stored in the File Entry block.
[0006] Supports up to 2TB of single file storage, and the file name can be up to 255 characters;
[0007] Supports rich file attributes and is suitable for various operating systems;
[0008] Support for bridge formats, where ISO 9660, Joliet and UDF formats all reside on the same disc. This is used in video applications such as DVD-Video, DVD+VR and DVD-VR;
[0009] Supports named streams and "real-time" files.
[0010] These advantages have gradually replaced the ISO9660 file system with the UDF file system, making optical disc data storage more applicable. However, since optical discs are a very slow storage medium, and on Linux distribution operating systems, users need to mount the optical disc medium through the kernel to read the file content on the optical disc, and then parse all the metadata of the optical disc before they can view the file content on the optical disc. This process is very time-consuming. Therefore, based on the most common optical disc UDF file system, it is very necessary to improve the performance of reading the optical disc file content that users are most concerned about.
[0011] In the current mainstream operating systems, there is no function to implement a quick preview of a UDF disc. The prior art requires a complicated process if the file contents of a UDF disc need to be viewed. Summary of the invention
[0012] In view of the above problems, the present invention is proposed to provide a method for quickly previewing optical disc files, a computing device and a storage medium that overcome the above problems or at least partially solve the above problems.
[0013] According to one aspect of the present invention, a method for quickly previewing a disc file is provided, which is executed in a computing device, and includes: in response to a user's request for quickly previewing a disc file, obtaining disc information, the disc information including the name of the optical drive device, the disc path and a file list; verifying the file system indicated by the name of the optical drive device; if the verification passes, parsing the file system to locate a data storage area; determining metadata and its description information from the data storage area; parsing the metadata and its description information to generate file information, and writing the file information into a file list; and outputting the file list.
[0014] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of verifying the file system indicated by the name of the optical drive device includes: obtaining the start position and the end position of the last node based on at least the device descriptor of the optical disc; jumping a first byte length from the start position and taking the jumped position as the first starting point; reading multiple data blocks in sequence from the first starting point to determine whether the content of the data block meets the preset condition; if the preset condition is met, jumping a second byte length from the start position and taking the jumped position as the second starting point; reading a data block from the second starting point; processing the read data block to determine whether the data block contains a preset character representing a query volume descriptor key pointer; if the preset character is contained, determining a third starting point based on the end position; reading a data block from the third starting point, and processing the read data block to determine whether the data block contains the preset character; if the data block contains the preset character, determining that the file system indicated by the name of the optical drive device has been verified.
[0015] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of reading multiple data blocks in sequence from a first starting point to determine whether the content of the data block meets the preset conditions includes: reading a data block from the first starting point, and checking whether the content of the read data block meets the first condition; if it meets the first condition, continue to read the next data block, and check whether the content of the read data block meets the second condition; if it meets the second condition, continue to read the next data block, and check whether the content of the read data block meets the third condition.
[0016] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of parsing the file system to locate the data storage area includes: determining the starting position and length of the metadata area based on the query volume descriptor key pointer represented by preset characters; determining the number of metadata blocks based on the length; traversing the metadata blocks based on the starting position to determine the metadata blocks containing key metadata; and processing the determined metadata blocks to determine the location of the data storage area.
[0017] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of processing the determined metadata block includes: converting the determined metadata block into a preset object.
[0018] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of determining the metadata and its description information from the data storage area includes: reading the first data block from the data storage area as the root metadata, and converting it into a structure object; parsing the structure object to obtain the description information of the root metadata; determining the non-root metadata in the data storage area except the root metadata as valid metadata; and determining the description information of the valid metadata based on the determined valid metadata.
[0019] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of parsing the metadata and its description information to generate file information includes: judging whether the determined metadata and its description information are root metadata and its description information; if not, obtaining the file name and file attributes from the description information and metadata respectively; reading the metadata and its description information in the next data block adjacent to it, and repeating the step of obtaining the file name and file attributes until the data storage area is traversed; generating file information based on the file name and file attributes, wherein the attributes of the file include: file type, user ID, user group ID, and file permissions.
[0020] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of determining whether the determined metadata and its description information are root metadata and its description information includes: determining whether the description information meets the fourth condition; if so, the metadata corresponding to the description information is the root metadata.
[0021] Optionally, in the fast preview method of CD files according to the present invention, a display application resides in the computing device, and the step of outputting the file list in the computing device includes: encapsulating the file list into a structure object and sending it to the display application; parsing the structure object by the display application, outputting preview information, and presenting the preview information to the user.
[0022] Optionally, in the fast preview method for optical disc files according to the present invention, the structure object is stored.
[0023] Optionally, in the fast preview method of the optical disc file according to the present invention, each data block includes 2048 bytes, the first byte length is 16*2048 bytes, and the second byte length is (16+256)*2048 bytes.
[0024] Optionally, in the fast preview method of the optical disc file according to the present invention, the step of processing the read data block to determine whether the data block contains preset characters includes: converting the binary data of the data block into a structure tag; obtaining an identification character in the structure tag, and determining whether the identification character is a preset character.
[0025] According to another aspect of the present invention, there is provided a computing device, comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be suitable for being executed by the at least one processor, and the program instructions include instructions for executing the above method.
[0026] According to another aspect of the present invention, a readable storage medium storing program instructions is provided. When the program instructions are read and executed by a computing device, the computing device executes the above method.
[0027] According to the solution of the present invention, by parsing the file system, the data storage area is directly located, and metadata and its description information are determined from the data storage area, the metadata and its description information are parsed, the file information is obtained, and the obtained file information is written into the file list. The file system and mounting mechanism in the kernel state are bypassed, and the key information of the files in the UDF file system CD is directly parsed in the user state, the startup performance of the file manager is improved, and the CD information can be directly viewed without waiting for the CD-ROM to mount, thereby enhancing the user interaction experience.
[0028] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings:
[0030] Figure 1 A schematic diagram of a process for viewing UDF optical disc files in the prior art is shown;
[0031] Figure 2 Another schematic diagram of a process for viewing UDF optical disc files in the prior art is shown;
[0032] Figure 3 shows a block diagram of a computing device 300 according to an embodiment of the present invention;
[0033] Figure 4 A flowchart of a method 400 for quickly previewing a disc file according to an embodiment of the present invention is shown;
[0034] Figure 5 A human-computer interaction diagram showing a method for quickly previewing optical disc files according to an embodiment of the present invention;
[0035] Figure 6 A schematic diagram of a data storage structure in an optical disc according to an embodiment of the present invention is shown;
[0036] Figure 7 A schematic diagram of a flow chart of a file system verification method provided according to an embodiment of the present invention is shown;
[0037] Figure 8 A schematic flow chart of a method for determining root metadata and description information of a file system provided in accordance with an embodiment of the present invention is shown;
[0038] Fig. 9 A schematic flow chart of a method for generating file information of a file system provided according to an embodiment of the present invention is shown. DETAILED DESCRIPTION
[0039] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0040] like Figure 1 As shown, Figure 1 A schematic diagram of a process for viewing UDF disc files in the prior art is shown. The most mainstream way to view the file content of a UDF disc in a Linux distribution is to mount the disc to the Linux file system through the kernel, and the UDF file system module in the Linux kernel parses the disc file content. When the user inserts the UDF disc, many processes in the kernel state and the user state need to be repeatedly crossed to achieve the purpose of the user previewing the files in the UDF.
[0041] This solution has the following problems:
[0042] 1. The CD must first be mounted by the kernel, which takes time and requires the user to provide permission;
[0043] 2. UDF disc parsing needs to be done through kernel parsing. Application layer software cannot control the parsing method, which will limit the addition of new features later.
[0044] 3. The kernel will parse all the data from the UDF disc, but a lot of the data is not of interest to the user, so too much time is wasted on the quick preview function.
[0045] 4. It involves a lot of inter-process communications and permission operations, which is very time-consuming.
[0046] In addition, in order to improve the deficiencies in the above-mentioned solution, the prior art provides a Figure 2 The scheme shown, Figure 2 Another schematic diagram of a process for viewing UDF optical disc files in the prior art is shown. Figure 2 In the solution shown, the UDF file system is parsed by using the user-mode file system FUSE, and a UDF file system parsing code can be customized to be implemented in the user-mode fuse driver. Since the UDF file system parsing code is self-written, the file system parsing process can be simplified, and only the key information that the user is concerned about can be parsed and fed back to the user.
[0047] However, in this solution, although FUSE almost does not require the participation of the kernel (accessing the VFS interface still requires entering the kernel state), bypasses some permission operations, and can independently control the parsing method of the UDF file system (you can customize how to parse the UDF metadata), the file read and write performance of FUSE is much lower than the UDF file system in the kernel (about 30%-40% lower). If the file read and write performance is low, the effect of quickly previewing the UDF disc file cannot be achieved.
[0048] In order to solve the above problems in the prior art, the solution of the present invention is proposed. An embodiment of the present invention provides a method for quickly previewing an optical disc file, which can be executed in a computing device.
[0049] For the convenience of description and understanding, the symbols and terms appearing in this aspect are explained and illustrated as follows:
[0050]
[0051] Figure 3 FIG. 3 shows a block diagram of a computing device 300 according to an embodiment of the present invention. Figure 3 As shown, in a basic configuration 302, computing device 300 typically includes a system memory 306 and one or more processors 304. A memory bus 308 may be used for communication between processor 304 and system memory 306.
[0052] Depending on the desired configuration, the processor 304 can be any type of processor, including but not limited to: a microprocessor (μP), a microcontroller (μC), a digital information processor (DSP), or any combination thereof. The processor 304 can include one or more levels of cache such as a first-level cache 310 and a second-level cache 312, a processor core 314, and registers 316. An example processor core 314 can include an arithmetic logic unit (ALU), a floating point unit (FPU), a digital signal processing core (DSP core), or any combination thereof. An example memory controller 318 can be used with the processor 304, or in some implementations, the memory controller 318 can be an internal part of the processor 304.
[0053] Depending on the desired configuration, the system memory 306 can be any type of memory, including but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.) or any combination thereof. The physical memory in the computing device usually refers to the volatile memory RAM, and the data in the disk needs to be loaded into the physical memory before it can be read by the processor 304. The system memory 306 may include an operating system 320, one or more applications 322, and program data 324. The application 322 is actually a plurality of program instructions, which are used to instruct the processor 304 to perform corresponding operations. In some embodiments, in some embodiments, the application 322 may be arranged to execute instructions on the operating system by one or more processors 304 using program data 324. The operating system 320 may be, for example, Linux, Windows, etc., which includes program instructions for processing basic system services and performing tasks that depend on hardware. The application 322 includes program instructions for implementing various user-desired functions, and the application 322 may be, for example, a browser, instant messaging software, a software development tool (such as an integrated development environment IDE, a compiler, etc.), etc., but is not limited thereto. When the application 322 is installed into the computing device 300 , a driver module may be added to the operating system 320 .
[0054] When the computing device 300 starts running, the processor 304 reads and executes the program instructions of the operating system 320 from the memory 306. The application 322 runs on the operating system 320 and uses the interface provided by the operating system 320 and the underlying hardware to implement various functions desired by the user. When the user starts the application 322, the application 322 is loaded into the memory 306, and the processor 304 reads and executes the program instructions of the application 322 from the memory 306.
[0055] The computing device 300 also includes a storage device 332 , which includes a removable storage 336 and a non-removable storage 338 , both of which are connected to the storage interface bus 334 .
[0056] The computing device 300 may also include an interface bus 340 that facilitates communication from various interface devices (e.g., output devices 342, peripheral interfaces 344, and communication devices 346) to the basic configuration 302 via the bus / interface controller 330. Example output devices 342 include a graphics processing unit 348 and an audio processing unit 350. They can be configured to facilitate communication with various external devices such as a display or speakers via one or more A / V ports 352. Example peripheral interfaces 344 may include a serial interface controller 354 and a parallel interface controller 356, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboards, mice, pens, voice input devices, touch input devices) or other peripherals (e.g., printers, scanners, etc.) via one or more I / O ports 358. Example communication devices 346 may include a network controller 360, which may be arranged to facilitate communication with one or more other computing devices 362 via a network communication link via one or more communication ports 364.
[0057] A network communication link can be an example of a communication medium. Communication media can generally be embodied as computer-readable instructions, data structures, program modules in a modulated data signal such as a carrier wave or other transmission mechanism, and can include any information delivery medium. A "modulated data signal" can be a signal in which one or more of its data sets or its changes can be carried out in a manner that encodes information in the signal. As non-limiting examples, communication media can include wired media such as a wired network or a dedicated line network, and various wireless media such as sound, radio frequency (RF), microwave, infrared (IR) or other wireless media. The term computer-readable medium used herein can include both storage media and communication media.
[0058] The computing device 300 also includes a storage interface bus 334 connected to the bus / interface controller 330. The storage interface bus 334 is connected to a storage device 332, which is suitable for data storage. Example storage devices 332 may include removable storage 336 (such as CD, DVD, USB flash drive, removable hard disk, etc.) and non-removable storage 338 (such as hard disk drive HDD, etc.).
[0059] In the computing device 300 according to the present invention, the application 322 includes a plurality of program instructions for executing the method 400 .
[0060] Figure 4 The flowchart of a method 400 for quickly previewing an optical disc file according to an embodiment of the present invention is shown. The method 400 is suitable for being executed in a computing device (such as the aforementioned computing device 300).
[0061] like Figure 4 As shown, the purpose of method 400 is to implement a fast preview method for optical disc files, which starts at step S402. In step S402, in response to a user's request for a fast preview of the optical disc file, the optical disc information is obtained, and the optical disc information includes the name of the optical drive device, the optical disc path and the file list.
[0062] In a specific example, if Figure 5 As shown, Figure 5 A human-computer interaction diagram of a method for quickly previewing optical disc files according to an embodiment of the present invention is shown. In the present invention, the core module for realizing the requirement of quickly previewing UDF optical disc files is to provide an efficient parsing method of the UDF file system. This core module is provided in the form of a dynamic link library and is named libquickudf.so. Above the core module libquickudf.so is an upper-level application similar to a file manager (dde-file-manager), which is responsible for the UI interaction logic with the user. Then the application loads and calls libquickudf.so. All processes work in user mode. After the libquickudf.so dynamic link library is loaded by the upper-level application, it can start working:
[0063] 1. The user presses the blank key (or other shortcut keys) on the CD-ROM drive icon in the dde-file-manager application to initiate a request for a quick preview of the UDF CD;
[0064] 2. The application dde-file-manager calls the quickudf_parse function inside libquickudf.so, which receives three parameters:
[0065] a) Input parameter dev, char* type, indicates the name of the optical drive device;
[0066] b) Input parameter path, char* type, indicating the UDF CD path to be parsed;
[0067] c) Output parameter file_list, a custom structure of type udf_files_t, returns a list of files in the specified path on the UDF disc to the application.
[0068] The return value type of the quickudf_parse function is int. It returns 0 when it works correctly and a non-zero value when it works abnormally.
[0069] In step S404, the file system indicated by the name of the optical drive device is verified. Specifically, the following steps are included:
[0070] S4041. Obtain the start position and end position of the last node based at least on the device descriptor of the optical disc.
[0071] In a specific example, if Figure 6 As shown, Figure 6 A schematic diagram of the data storage structure in an optical disc according to an embodiment of the present invention is shown. Each recording is stored in the optical disc in the form of a node (session, also called data block). The session stores the directory information, file information, and information containing "pointers" pointing to previously recorded files. By organizing them in a file system such as UDF or ISO9660, they can be mounted and identified in the operating system. Each session should have a complete file system data structure, including key descriptive characters of the file system, the directory of the file system, and key pointer entries for parsing the file system. All data in the file system can be parsed out one by one through the key pointer entries. All data is stored in the form of data blocks (such as Figure 6 The size of each block in the CD is 2048 bytes.
[0072] In a possible implementation, the last node can be obtained by calling the UDF check function isValidUDF(). Specifically, first, the device descriptor fd of the optical disk is passed into the function isValidUDF(). Then, the function isValidUDF() calls the system call function ioctl, passing in the parameters fd and the macro parameter CDROMMULTISESSION, to obtain the starting position of the last session, which is named start, and the ending position of the last session, which is named last.
[0073] S4042: Jump to the first byte length from the start position, and use the jump position as the first starting point. Specifically, the first byte length is 16*2048. That is, jump to 16 block lengths from the above starting position (i.e., the start position), where each block size is 2048 bytes. In addition, the first starting point to which the jump is made can be marked as start1.
[0074] S4043, starting from the first starting point, sequentially read a plurality of data blocks to determine whether the content of the data blocks meets a preset condition.
[0075] In a possible implementation, a data block is read from the first starting point, and the content of the read data block is checked to see whether it meets the first condition, wherein the first condition is to check whether the read content starts with "BEA01".
[0076] If the first condition is met, the next data block is read and the content of the read data block is checked to see if it meets the second condition, wherein the second condition is to check whether the read content is "NSR02" or "NSR03".
[0077] If the second condition is met, the next data block is read and the content of the read data block is checked to see if it meets the third condition, wherein the third condition is to check whether the read content is "TEA01".
[0078] For example, read a block from the start1 above, check whether the read content starts with "BEA01", if not, it means that the UDF file system is incorrect, and an error is returned. Continue to read another block, check whether the read content is "NSR02" or "NSR03", if not, an error is returned. Continue to read another block, check whether the read content is "TEA01", if not, an error is returned, and the process ends.
[0079] S4044: If the preset condition is met, jump the second byte length from the start position, and use the jumped position as the second starting point. The second byte length is (16+256)*2048. The second starting point to be jumped to can be start2.
[0080] S4045. Read a data block from the second starting point.
[0081] S4046: Process the read data block to determine whether the data block contains a preset character representing the query volume descriptor key pointer (AVDP). Specifically, convert the binary data of the data block into a structure tag; obtain the identification character in the structure tag, and determine whether the identification character is a preset character. In this embodiment, the preset character is the value of tagIdent in AVDP.
[0082] For example, the binary data of the data block is converted into a structure tag, the value of tagIdent in the structure is obtained, and it is checked whether the value is TAG_IDENT_AVDP (0x002). If not, an error is returned and the process ends. The definition of the structure tag is as follows:
[0083]
[0084] S4047: If the preset character is included, determine the third starting point based on the end position. The third starting point start3 is the block before the end position of the last session obtained above, that is, last-1.
[0085] S4048, starting from the third starting point, read a data block, and process the read data block to determine whether the data block contains the preset character. The determination of the preset character is the same as step S4047, and will not be repeated here.
[0086] S4049: If the data block contains the preset characters, it is determined that the file system indicated by the name of the optical drive device has passed the verification. If all of the above processes are normal, it indicates that the file system is a correct UDF file system.
[0087] In a specific example, combining Figure 7 , Figure 7 A schematic diagram of a file system verification method according to an embodiment of the present invention is shown. The file system verification method comprises the following steps:
[0088] 1. Call the UDF check function isValidUDF() and pass in the device descriptor fd of the optical disk;
[0089] 2. In isValidUDF(), the system call function ioctl is called, and the parameters fd and macro parameter CDROMMULTISESSION are passed in to get the starting position of the last session, which is named start. At the same time, the ending position of the last session can be obtained, which is named last.
[0090] 3. Jump 16 blocks from position start, each block size is 2048 bytes, then start = start + 16 * 2048;
[0091] 4. Read a block from start and check whether the read content starts with "BEA01". If not, return an error and end the process;
[0092] 5. Continue to read another block from the start, check whether the read content is "NSR02" or "NSR03", if not, return an error and end the process;
[0093] 6. Continue to read another block from start and check whether the read content is "TEA01". If not, return an error and end the process;
[0094] 7. Start checking whether AVDP exists. The value of start jumps to the position of start = start + 16 blocks + 256 blocks. Then read a block, convert the binary data of the block into a structure tag, get the value of tagIdent in the structure, check whether the value is TAG_IDENT_AVDP (0x002), if not, return an error and end the process. The definition of the structure tag is as follows:
[0095]
[0096]
[0097] 8. Update the value of start to start=last-1, and continue to check whether the second AVDP exists. The detection method is still the same as above. Check whether the value of tagIdent in the tag structure is TAG_IDENT_AVDP (0x002). If not, return an error and end the process;
[0098] 9. If all the above processes are normal, it means that the file system is a correct UDF file system and the program can proceed to the next step, otherwise the program ends.
[0099] In step S406, if the file system verification is passed, the file system is parsed to locate the data storage area (PSPACE). The data storage area is the area in the UDF file system that stores file contents.
[0100] In some possible implementations, first, based on the query volume descriptor key pointer represented by the preset character, the start position and length of the metadata area are determined. Specifically, the query volume descriptor key pointer (AVDP) obtained above can be converted into the following structure:
[0101]
[0102] The converted structure is named anchorVolDescPtr. The mainVolDescSeqExt value is read from the structure anchorVolDescPtr. This value records the starting position and length of the VDS (Volume Descriptor Sequence) area. The key metadata PD is located in the VDS. Metadata, also known as intermediate data or relay data, is data about data. It is mainly information describing data properties, and is used to support functions such as indicating storage locations, historical data, resource searches, and file records.
[0103] Then, based on the length, the number of metadata blocks is determined. The number of metadata blocks in the VDS area can be calculated by the formula length / 2048 (block size).
[0104] After that, based on the starting position, traverse the metadata blocks to determine the metadata blocks containing key metadata. Traverse all determined metadata blocks, read one block at a time, convert the block into the same tag structure object as above, get the value tagIdent in the structure object, and check whether the value is TAG_IDENT_PD (0x0005). If so, it means that the metadata block contains key metadata. If not, continue to read the next block.
[0105] Finally, the determined metadata block is processed to determine the location of the data storage area. Preferably, the determined metadata block is converted into a preset object (partitionDesc). The preset object partitionDesc is defined as follows:
[0106]
[0107] Get the partitionStartingLocation value from it, which records the location of the optical disc data storage area (PSPACE).
[0108] Continuing with the above example, combined with Figure 8 , Figure 8 A schematic flow chart of a method for locating a data storage area of a file system provided according to an embodiment of the present invention is shown. The method for locating a data storage area is specifically as follows:
[0109] 1. Read mainVolDescSeqExt from AVDP (its structure is called anchorVolDescPtr). This value records the starting position and length of the VDS area. The key metadata PD is located in the VDS.
[0110]
[0111] 2. Get the location and length of VDS from mainVolDescSeqExt;
[0112] 3. Calculate the number of metadata count in VDS by length / 2048 (block size)
[0113] 4. Traverse all blocks, read one block at a time, convert the block into the same tag structure object as above, get the value tagIdent in the structure object, check whether the value is TAG_IDENT_PD (0x0005), if not, continue to read the next block;
[0114] 5. Convert the block to a structure object partitionDesc and obtain the value partitionStartingLocation, which records the location of the optical disk data storage area (PSPACE). The structure partitionDesc is defined as follows:
[0115]
[0116]
[0117] In step S408, metadata and description information thereof are determined from the data storage area.
[0118] It should be noted that metadata includes root metadata (root FE) and common (valid) metadata (FE). The corresponding root FE has root metadata description information root FID, and the common metadata FE has metadata description information FID. However, the root FE and root FID do not record the file information burned by the user. The metadata FE and FID actually record the user's file information.
[0119] Based on this, in some embodiments, step S408 includes the following sub-steps:
[0120] S4081, read the first data block from the data storage area as root metadata and convert it into a structure object. The root FE is located in the first data block of the data storage area (PSPACE).
[0121] S4082, parse the structure object to obtain description information of the root metadata.
[0122] In a specific example, combining Figure 8 , Figure 8 The following is a flow chart of a method for determining root metadata and description information of a file system according to an embodiment of the present invention. Specifically:
[0123] 1. Using the partitionStartingLocation obtained from the partitionDesc structure above as the starting position, read a block (2048 bytes) and convert it into a Root FE structure object, which is defined as follows:
[0124]
[0125]
[0126] Parse the Root FE object, get the flags parameter in its value icbTag, and determine whether it is equal to ICBTAG_FLAG_AD_IN_ICB;
[0127] 2. When flags is ICBTAG_FLAG_AD_IN_ICB, it can be confirmed that the size of the Root FID object is the value lengthAllocDescs in the Root FE. Space is allocated for the Root FID object based on the size. The content of the Root FID object is the value extendedAttrAndAllocDescs in the Root FE.
[0128] 3. When the value of flags is not ICBTAG_FLAG_AD_IN_ICB, it can be confirmed that the size of the Root FID object is the value of informationLength in the Root FE, and space is allocated for the Root FID object based on this size;
[0129] 4. Convert the extendedAttrAndAllocDescs in the Root FE to an object of the structure short_ad. Parse the object to obtain the position pos and length len of the Root FID. The structure definition of short_ad is as follows:
[0130]
[0131] 5. Based on the parsed Root FID position pos as the starting position, read len bytes of data from the CD and write them into the Root FID object to complete the reading of the Root FID. The structure definition of the Root FID object is as follows:
[0132]
[0133] S4083, determine the non-root metadata in the data storage area except the root metadata as valid metadata. Preferably, determine all metadata after the root metadata appears as valid metadata.
[0134] S4084: Determine description information of the valid metadata according to the determined valid metadata. The specific determination process may refer to the determination process of the root FID described above, which will not be described in detail here.
[0135] In step S410, the metadata and its description information are parsed to generate file information, and the file information is written into a file list.
[0136] In some embodiments, step S410 includes the following steps:
[0137] S4101. Determine whether the determined metadata and its description information are root metadata and its description information. As mentioned above, the root metadata root FE and its description information root FID do not record the file information burned by the user. Therefore, it is necessary to determine whether the metadata is the root metadata root FE or the valid metadata FE. Specifically, it can be determined whether the description information meets the fourth condition. The fourth condition is to determine whether the parameter of the value fileCharacteristics of the description information is FID_FILE_CHAR_PARENT, which means that it is the description information of the root metadata, and the corresponding metadata is also the root metadata.
[0138] S4102. If not, obtain the file name and file attributes from the description information and metadata respectively. The value impUseAndFileIdent in the object of the description information FID of the valid metadata represents the name of the file. The attributes of the file can be obtained through the fileType in the value icbTag of the valid metadata FE. When the value is equal to ICBTAG_FILE_TYPE_DIRECTORY, it means that the file type is a directory, otherwise it is a regular file; the user ID of the file can be obtained through the value uid of the FE; the user group ID of the file can be obtained through the value gid of the FE; the permissions of the file can be obtained through the value permissions of the FE. Jump to the next FE and FID until the last FE and FID are parsed.
[0139] S4103, read the metadata and description information in the next data block adjacent to it, and repeat the steps of obtaining the file name and file attributes until the data storage area is traversed. The way to jump to the next FID is to add the value lengthOfImpUse and the value lengthFileIdent in the current FID object to the address where the current FID is located to obtain the next FID. The location of the next FE can be confirmed from the value icb of the FID, and the next FE object can be obtained by reading a block (2048 bytes).
[0140] S4104. Generate file information based on the file name and file attributes, wherein the file attributes include: file type, user ID, user group ID, and file permissions.
[0141] As mentioned above, the function quickudf_parse will obtain a file list. After obtaining the file information, the obtained file information will be written into the file list file_list. The file_list stores the data that the user is most concerned about. The file_list can be represented by the following structure object:
[0142]
[0143]
[0144] This structure connects all file information in series in the form of a doubly linked list.
[0145] In a specific example, combining Fig. 9 , Fig. 9 The following is a flow chart of a method for generating file information of a file system according to an embodiment of the present invention. Specifically:
[0146] 1. Root FE and Root FID do not record the file information burned by the user. The real recording of user file information starts from the next FE and FID after Root FE. Therefore, it is necessary to judge according to the value of FID fileCharacteristics. If the parameter value is FID_FILE_CHAR_PARENT, it means it is Root FID, which needs to be skipped to get the next FE and FID.
[0147] 2. Get the file name from FID. The value impUseAndFileIdent in the FID object represents the name of the file and records it in the file information list.
[0148] 3. Get the file attributes from FE. For example, the attributes that users care about most include file type (regular file or directory), which can be obtained through the fileType in the FE value icbTag. When the value is equal to ICBTAG_FILE_TYPE_DIRECTORY, it means that the file type is a directory, otherwise it is a regular file. The user ID of the file can be obtained through the FE value uid; the user group ID of the file can be obtained through the FE value gid; the file permissions can be obtained through the FE value permissions;
[0149] 4. Jump to the next FE and FID until the last FE and FID are resolved. The way to jump to the next FID is to add the value of lengthOfImpUse and the value of lengthFileIdent in the current FID object to the address where the current FID is located to obtain the next FID. The location of the next FE can be confirmed from the value icb of the FID. Read a block (2048 bytes) to obtain the next FE object.
[0150] In step S412, the file list is output. Preferably, first, the file list is encapsulated as a structure object and sent to the display application. The display application is the aforementioned file manager (dde-file-manager). The structure object is the aforementioned file_list structure object:
[0151]
[0152] Then, the display application parses the structure object, outputs the preview information, and presents the preview information to the user. 8. The upper-level application dde-file-manager parses the structure variable file_list and displays the variable data to the user using the UI interface.
[0153] In addition, the structure object can also be stored so that it can be directly displayed the next time it is previewed. Specifically, the structure object can be cached in the memory, and the cached content can be directly displayed the next time the same disc is previewed.
[0154] The method provided by the present invention is through.
[0155] The various techniques described herein may be implemented in combination with hardware or software, or a combination thereof. Thus, the method and apparatus of the present invention, or some aspects or parts of the method and apparatus of the present invention may be in the form of program codes (i.e., instructions) embedded in a tangible medium, such as a removable hard disk, a USB flash drive, a floppy disk, a CD-ROM, or any other machine-readable storage medium, wherein when the program is loaded into a machine such as a computer and executed by the machine, the machine becomes a device for practicing the present invention.
[0156] In the case where the program code is executed on a programmable computer, the computing device generally includes a processor, a storage medium readable by the processor (including volatile and non-volatile memory and / or storage elements), at least one input device, and at least one output device. The memory is configured to store the program code; the processor is configured to execute the method of the present invention according to the instructions in the program code stored in the memory.
[0157] By way of example and not limitation, readable media include readable storage media and communication media. Readable storage media stores information such as computer readable instructions, data structures, program modules or other data. Communication media generally embody computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transmission mechanism, and include any information transfer medium. Any combination of the above is also included within the scope of readable media.
[0158] In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system or other device. Various general purpose systems can also be used together with the examples of the present invention. According to the above description, it is obvious that the structure required for constructing such systems. In addition, the present invention is not directed to any specific programming language either. It should be understood that various programming languages can be utilized to implement the content of the present invention described herein, and the above description of specific languages is for the purpose of disclosing the preferred embodiment of the present invention.
[0159] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.
[0160] Similarly, it should be understood that in order to streamline the present disclosure and aid in understanding one or more of the various inventive aspects, in the above description of exemplary embodiments of the present invention, the various features of the present invention are sometimes grouped together into a single embodiment, figure, or description thereof. However, this disclosed method should not be interpreted as reflecting the following intention: that the claimed invention requires more features than the features explicitly recited in each claim. More specifically, as reflected in the claims below, inventive aspects lie in less than all the features of the individual embodiments disclosed above. Therefore, the claims that follow the specific embodiment are hereby expressly incorporated into the specific embodiment, with each claim itself serving as a separate embodiment of the present invention.
[0161] Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in the devices described in the embodiment, or alternatively may be located in one or more devices different from the devices in the examples. The modules in the foregoing examples may be combined into one module or may be divided into multiple submodules.
[0162] Those skilled in the art will appreciate that the modules in the devices in the embodiments may be adaptively changed and arranged in one or more devices different from the embodiments. The modules or units or components in the embodiments may be combined into one module or unit or component, and in addition they may be divided into a plurality of submodules or subunits or subcomponents. Except that at least some of such features and / or processes or units are mutually exclusive, all features disclosed in this specification (including the accompanying claims, abstracts and drawings) and all processes or units of any method or device disclosed in this manner may be combined in any combination. Unless otherwise expressly stated, each feature disclosed in this specification (including the accompanying claims, abstracts and drawings) may be replaced by an alternative feature providing the same, equivalent or similar purpose.
[0163] In addition, those skilled in the art will appreciate that, although some embodiments described herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present invention and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0164] In addition, some of the embodiments are described herein as methods or combinations of method elements that can be implemented by a processor of a computer system or by other devices that perform the functions. Therefore, a processor with necessary instructions for implementing the method or method elements forms a device for implementing the method or method elements. In addition, the elements described herein of the device embodiments are examples of devices for implementing the functions performed by the elements for the purpose of implementing the invention.
[0165] As used herein, unless otherwise specified, the use of ordinal numbers "first," "second," "third," etc. to describe common objects merely indicates that different instances of similar objects are involved, and is not intended to imply that the objects so described must have a given order in time, space, order, or in any other manner.
[0166] Although the present invention has been described according to a limited number of embodiments, it will be apparent to those skilled in the art, with the benefit of the above description, that other embodiments may be envisioned within the scope of the invention thus described. In addition, it should be noted that the language used in this specification is selected primarily for readability and teaching purposes, rather than for explaining or defining the subject matter of the present invention. Therefore, many modifications and variations will be apparent to those skilled in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is illustrative and not restrictive with respect to the scope of the present invention, and the scope of the present invention is defined by the appended claims.
Claims
1. A method for quickly previewing a CD file, which is executed based on a dynamic link library residing in a computing device, wherein the dynamic link library resides in a user state of an operating system, and a display application resides in the computing device, comprising: In response to a user's request for a quick preview of the optical disc file, obtaining optical disc information, the optical disc information including the name of the optical drive device, the optical disc path and the file list, including obtaining the optical disc information by calling the quickudf_parse function in the dynamic link library; Verifying the file system indicated by the name of the optical drive device; If the verification is successful, the file system is parsed to locate the data storage area; Determine metadata and description information thereof from the data storage area; Parsing the metadata and its description information to generate file information, and writing the file information into the file list; Outputting the file list includes encapsulating the file list into a structure object and sending it to the display application, parsing the structure object by the display application, outputting preview information, and presenting the preview information to the user.
2. The method of claim 1, wherein: The step of verifying the file system indicated by the name of the optical drive device comprises: Based at least on the device descriptor of the optical disc, obtaining the start position and the end position of the last node; Starting from the starting position, jump the first byte length, and use the position jumped to as the first starting point; Starting from a first starting point, a plurality of data blocks are read sequentially to determine whether the contents of the data blocks meet a preset condition; If the preset condition is met, jump from the starting position by a second byte length, and use the jumped position as the second starting point; Starting from the second starting point, read a data block; Processing the read data block to determine whether the data block contains a preset character representing a key pointer of a query volume descriptor; If the preset character is included, determining a third starting point based on the end position; Starting from the third starting point, a data block is read and the read data block is processed to determine whether the data block contains the preset character, including converting binary data of the data block into a structure tag, obtaining an identification character in the structure tag, and determining whether the identification character is a preset character; If the data block includes preset characters, it is determined that the file system indicated by the name of the optical drive device has passed verification.
3. The method of claim 2, wherein: The step of sequentially reading a plurality of data blocks from the first starting point to determine whether the content of the data blocks meets the preset condition comprises: Starting from the first starting point, a data block is read, and the content of the read data block is checked whether it meets the first condition; If the first condition is met, continue to read the next data block and check whether the content of the read data block meets the second condition; If the second condition is met, the next data block is read and the content of the read data block is checked to see whether it meets the third condition.
4. The method of claim 2, wherein: The step of parsing the file system to locate the data storage area includes: Determine the start position and length of the metadata area based on the query volume descriptor key pointer represented by the preset character; Based on the length, determining a number of metadata blocks; Based on the starting position, traverse the metadata blocks to determine a metadata block containing key metadata; The determined metadata block is processed to determine the location of the data storage area.
5. The method of claim 4, wherein: The step of processing the determined metadata block comprises: The determined metadata block is converted into a preset object.
6. The method of claim 1, wherein: The step of determining metadata and description information thereof from the data storage area comprises: Read the first data block from the data storage area as root metadata and convert it into a structure object; Parsing the structure object to obtain description information of the root metadata; Determine non-root metadata in the data storage area except the root metadata as valid metadata; According to the determined valid metadata, description information of the valid metadata is determined.
7. The method of claim 1, wherein: The step of parsing the metadata and its description information to generate file information includes: Determining whether the determined metadata and its description information are root metadata and its description information; If not, obtaining the file name and file attributes from the description information and metadata respectively; Read the metadata and description information of the next data block adjacent to it, and repeat the steps of obtaining the file name and file attributes until the data storage area is traversed; The file information is generated based on the file name and file attributes, wherein the file attributes include: file type, user identification, user group identification, and file permissions.
8. The method of claim 7, wherein: The step of determining whether the determined metadata and its description information are root metadata and its description information comprises: Determining whether the description information meets the fourth condition; If so, the metadata corresponding to the description information is the root metadata.
9. The method of claim 1, wherein: Also includes: The structure object is stored.
10. The method of claim 2, wherein: Each of the data blocks includes 2048 bytes, the first byte length is 16*2048 bytes, and the second byte length is (16+256)*2048 bytes.
11. A computing device comprising: at least one processor; and A memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, and the program instructions include instructions for executing the method according to any one of claims 1 to 10.
12. A readable storage medium storing program instructions, when the program instructions are read and executed by a computing device, the computing device executes the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Optical disc information acquisition method, computing equipment and readable storage medium
CN112346668A
Compact disc additional recording method and device and computing equipment
CN113823331A