Method for automatically converting multiple audio programs
Through automated technology, the automatic conversion of multi-audio programs is realized, which solves the problem of user-compromising audio operations, improves user experience and program conversion efficiency, and does not increase operating bandwidth costs.
Patent Information
- Application Number
- CN202411927610.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-25
AI Technical Summary
In the program release environment of set-top boxes, users need to switch multiple audios through key operation, resulting in cumbersome operation and poor user experience. At the same time, traditional methods increase operation bandwidth costs.
Through automation technology, PAT table, PMT table and SDT table are parsed and modified, and the multi-audio mixed programs are converted into single-audio mixed programs, and the program name is automatically modified according to the audio language, so that users can switch programs through up and down keys.
Without increasing the cost of operation bandwidth, the presentation of the program will be automatically increased, the experience of end users will be improved, the complexity of manual operations will be reduced, and the efficiency and accuracy of program conversion will be improved.
Smart Images

Figure CN119893201A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the technical field of digital video broadcasting, and in particular to a method for automatically switching multiple audio programs. Background Art
[0002] In the current set-top box program publishing environment, programs published by program publishers often contain multiple audios. During the transmission process, these audios are usually processed by the multiplexer according to the DVB standard and contain multiple audio PIDs (Packet Identifiers) in a PMT (Program Map Table). Terminal set-top box users need to switch different audio languages or select specific audio programs through key operations. However, this traditional switching method is cumbersome to operate and the user experience is poor.
[0003] In order to meet the user's demand of watching the same program with different audio by simply switching programs with the up and down keys, the traditional multiplexer needs to add a video and different audio. However, this method will cause duplicate video data to be used in the entire multiplexer, which will increase the final output bandwidth exponentially and increase operating costs. Summary of the invention
[0004] In view of the deficiencies of the prior art, the present invention provides a method for automatically converting multiple audio programs, which can automatically increase the presentation form of the program without increasing the operating bandwidth cost, so as to facilitate a better experience for terminal users.
[0005] The present invention achieves the above-mentioned purpose through the following technical solutions:
[0006] A method for automatically converting multiple audio programs comprises the following steps:
[0007] Streaming and data downloading: input the program source data link address, establish a network connection, and use the communication protocol to download data;
[0008] Parse PAT table data: obtain PAT table data from buffer Ts_buffer_A and save it to storage area A, and parse the PAT table;
[0009] Parse SDT table data: obtain data from storage area B, obtain SDT table data from buffer Ts_buffer_A and save it to storage area A, and parse the SDT table;
[0010] Parse PMT table data: obtain data from storage area B, obtain all PMT table data from buffer Ts_buffer_A and save it to storage area A, and parse the PMT table;
[0011] Modify the PAT table, PMT table, and SDT table respectively, and save the modified PAT table, PMT table, and SDT table data to storage area A;
[0012] Data output and transmission: When storage area A completes the entry of all data, it is sent to the output buffer Ts_out_buffer_G, storage area A is cleared, and the data in buffer Ts_out_buffer_G is sent to the network through the communication protocol according to the TS stream transmission rate;
[0013] Repeat the steps of pulling streams and downloading data to the steps of outputting and sending data, and the multi-audio mixed program can be converted into a single-audio mixed program.
[0014] According to a method for automatically converting multiple audio programs provided by the present invention, in the streaming and data downloading steps, the communication protocol supports http and udp protocols, and the validity of the data after the streaming is successfully completed is judged. If it is a TS stream, it is sent to the input buffer Ts_buffer_A, otherwise it is discarded; the transmission rate value of the current TS stream is obtained once within a specified time and saved as ts_rate_speed; other PID data directly enters the output buffer Ts_out_buffer_G; wherein, the parsing or modification of the data is based on the data format defined by ISO_IEC_13818-1 and ETSI EN 300468.
[0015] According to a method for automatically converting multiple audio programs provided by the present invention, in the step of parsing PAT table data, the PAT section is parsed according to the ISO_IEC_13818-1 definition to obtain the total number of N groups of programs total_program_number; each group of program_number obtained is combined with program_map_PID and stored in storage area B; new_id_flag is identified to distinguish between the original and newly added IDs.
[0016] According to a method for automatically converting multiple audio programs provided by the present invention, in the step of parsing SDT table data, by traversing storage area B to see how many groups of program_number match the service_id of the SDT section, service_name is obtained and stored in storage area E.
[0017] According to a method for automatically converting multiple audio programs provided by the present invention, in the step of parsing PMT table data, the PMT section in storage area A is traversed and parsed through program_map_PID to obtain video elementary_PID, audio elementary_PID group and audio iso639_code value, and the obtained data is saved in storage area C; if there are multiple audio elementary_PID data, non-repeating program_map_PID and program_number are randomly generated within the pid allowed range, and storage area B is updated.
[0018] According to a method for automatically converting multiple audio programs provided by the present invention, when the PAT table is modified, the PAT section is read from storage area A, the program_number in storage area B is traversed, the program_number and program_map_PID of the newly added group are found through the new_id_flag, and the program_number and program_map_PID are inserted into the PAT section until the program_number in storage area B is traversed and saved to storage area A after the modification is completed.
[0019] According to a method for automatically converting multi-audio programs provided by the present invention, when the PMT table is modified, the storage area C is traversed according to the total_program_number, and the corresponding PMT section is added according to the number of audios; the original PMT section where the multi-audio exists is matched and obtained; a new PMT section is created, and a new program_map_PID, program_number, video_elementary_PID descriptor and audio_elementary_PID descriptor are inserted; and the modified PMT section is updated and saved to the storage area A.
[0020] According to a method for automatically converting multiple audio programs provided by the present invention, if it is found that the total_audio_number is greater than 1, it is necessary to add total_audio_number-1 PMT sections; according to the matching principle of program_map_PID in storage area C and program_map_PID in pmt section of storage area A, the original PMT section where multiple audio_elementary_PIDs exist is obtained; the program_map_PID and program_number groups with new_id_flag of 1 and is_used of 0 in storage area B are obtained; the video_elementary_PID in storage area c is obtained, a new section is created according to the PMT standard format, and new program_map_PID and program_number values, as well as video_elementary_PID descriptor and audio_elementary_PID descriptor contents are inserted.
[0021] According to a method for automatically converting multiple audio programs provided by the present invention, when the SDT table is modified, the SDT section in the storage area A is obtained; the storage area B is traversed, the new audio_elementary_PID is found through the new_id_flag, and the audio_iso639_code string and the original program_number are matched and obtained; the service_name is obtained in the storage area E, and merged to generate a new service_name2; the new program_number and the corresponding service_name2 related descriptor are inserted into the SDT section; and after completion, it is saved to the storage area A.
[0022] According to a method for automatically converting multiple audio programs provided by the present invention, the audio_iso639_code string and the original program_number are obtained by matching the audio_elementary_PID in storage area B with the audio_elementary_PID in storage area C; the service_name is obtained in storage area E through the original program_number and the program_number matching algorithm in storage area E, and the audio_iso639_code string and service_name are merged to generate a new service_name2.
[0023] It can be seen that compared with the prior art, the present invention has the following beneficial effects:
[0024] 1. The present invention automatically increases the presentation form of programs without increasing the operating bandwidth cost, so as to provide a better experience for the terminal users.
[0025] 2. The present invention reduces the complexity of manual operation and improves the efficiency and accuracy of program conversion through automation technology.
[0026] Therefore, the core of the present invention lies in a method for automatically generating new programs, specifically, by modifying the PAT table, PMT table and SDT table, converting multi-audio mixed programs into single audio mixed programs, and automatically modifying the program name according to the audio language to facilitate terminal users to watch.
[0027] The present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] Figure 1 It is a flowchart of an embodiment of a method for automatically converting multiple audio programs according to the present invention.
[0029] Figure 2 It is a principle diagram of an embodiment of a method for automatically converting multiple audio programs according to the present invention.
[0030] Figure 3 The present invention is a flow chart of a method for automatically converting multiple audio programs according to an embodiment of the present invention.
[0031] Figure 4 It is a flow diagram of the steps of streaming and data downloading in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0032] Figure 5 It is a flow diagram of the steps of parsing PAT table data in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0033] Figure 6 It is a schematic diagram of the process of parsing PMT table data in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0034] Figure 7 It is a flow diagram of the steps of parsing SDT section data in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0035] Figure 8 It is a flow diagram of the transmission bit rate calculation in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0036] Fig. 9 It is a flow chart of the steps of modifying the PAT table in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0037] Fig.10 It is a flow chart of the steps of modifying the PMT table in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0038] Fig.11 It is a flow diagram of the steps of modifying the SDT table in an embodiment of a method for automatically converting multiple audio programs of the present invention.
[0039] Fig.12 It is a schematic diagram of a process for sending data according to bit rate in an embodiment of a method for automatically converting multiple audio programs of the present invention. DETAILED DESCRIPTION
[0040] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0041] 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.
[0042] PAT table: Program Association Table, is one of the first tables that the decoder searches. It provides basic information about all programs (or services) in the current transport stream, and is mainly used to guide the decoder on how to parse the program information in the transport stream. Through the PAT table, the decoder can know which PID (Packet Identifier) contains the PMT table of a specific program. PID is a mechanism for identifying different data packets in the transport stream. The PAT table usually contains a mapping of one or more program numbers (Program Number) to the corresponding PMT table PID.
[0043] PMT table: Program Map Table, which contains the program's audio, video and other information descriptions to guide the decoder to parse audio and video information. The PMT table provides a detailed description of the audio and video streams and other data streams (such as subtitles, data broadcasting, etc.) for a specific program. Through the PMT table, the decoder can understand how to parse and present the various components of the program, such as which PID contains video data, which PID contains audio data, and the encoding format of these data streams. The PMT table usually contains information such as the program number, the PID and type of the video stream, the PID and type of the audio stream, and the PID and type of other data streams.
[0044] SDT table: Service Description Table, which describes the data of the service in the program, such as the program name, etc. It mainly guides the decoder to obtain the service description of the program. The SDT table provides a detailed description of the broadcast service (or program), such as the service name, service provider name, service type, etc. The decoder can provide a more user-friendly interface through the SDT table, such as displaying program lists, program names and providers, so that users can more easily select and watch the programs they are interested in. The SDT table usually contains service ID, service name, service provider name, service type (such as TV, radio, data service, etc.) and other optional descriptive information.
[0045] Audio pid (audio packet identifier) and video pid (video packet identifier) are abbreviations of audio_elementary_PID and video_elementary_PID. In MPEG-2TS (Transport Stream) and other multimedia transmission protocols, these PIDs are used to identify and distinguish different data streams, such as audio streams and video streams.
[0046] In the digital TV broadcasting system, the PAT table, PMT table and SDT table together form the basis for the decoder to parse and process the broadcast signal. The PAT table provides the entry point for the PMT table, which describes the specific audio, video and data stream information of the program, while the SDT table provides descriptive information about the service. These tables work together to enable the decoder to correctly parse and present the broadcast content, providing users with a high-quality viewing experience.
[0047] See also Figure 1 This embodiment provides a method for automatically converting multiple audio programs, the method comprising the following steps:
[0048] S1-streaming and data downloading steps: input the program source data link address, establish a network connection, and use the communication protocol to download data;
[0049] S2-PAT table data parsing step: obtain PAT table data from buffer Ts_buffer_A and save it to storage area A, and parse the PAT table;
[0050] S3- SDT table data parsing step: obtain data from storage area B, obtain SDT table data from buffer Ts_buffer_A and save it to storage area A, and parse the SDT table;
[0051] S4-PMT table data parsing step: obtain data from storage area B, obtain all PMT table data from buffer Ts_buffer_A and save them to storage area A, and parse the PMT table;
[0052] S5-modification step: modify the PAT table, PMT table, and SDT table respectively, and save the modified PAT table, PMT table, and SDT table data to storage area A;
[0053] S6-data output and sending step: when storage area A completes the entry of all data, it sends it to the output buffer Ts_out_buffer_G, clears storage area A, and sends the data in buffer Ts_out_buffer_G to the network through the communication protocol according to the TS stream transmission rate;
[0054] S7-Repeat the stream pulling and data downloading steps to the data output and sending steps to convert the multi-audio mixed program into a single audio mixed program.
[0055] After completing the above steps once, the system will not stop, but will immediately start a new round of processing. This repetitive execution mechanism is implemented through a loop or similar structure, which ensures that the system can continuously process the input data stream and convert it into a single audio mixed program output, and output it to the network for users to receive and play. If an error or invalid data stream is encountered during the process of pulling the stream or downloading the data, the system needs to handle the error and record the error log.
[0056] In the streaming and data downloading steps, the communication protocol supports http and udp protocols. The validity of the data after successful streaming is judged. If it is a TS stream, it is sent to the input buffer Ts_buffer_A, otherwise it is discarded; the transmission rate value of the current TS stream is obtained once within the specified time and saved as ts_rate_speed; other PID data directly enters the output buffer Ts_out_buffer_G; among them, the parsing or modification of the data is based on the data format defined by ISO_IEC_13818-1 and ETSI EN 300468.
[0057] Specifically, the steps of pulling streams and downloading data are as follows: Figure 4 As shown, input the program source data link address (supports http and udp protocols), establish a network connection, use http and udp protocols to download data, and after the stream is successfully pulled, determine whether the data is valid. If it is a TS stream, send the data to the input buffer Ts_buffer_A, otherwise the data is discarded. Get the transmission rate value of the current TS stream once a second and save it to ts_rate_speed. Other PID data directly enter the output buffer Ts_out_buffer_G. The transmission bit rate is calculated as follows: Figure 8 As shown, the data formats involved in the following parsing or modification of the TS stream are parsed according to the data formats defined in ISO_IEC_13818-1 and ETSI EN 300468.
[0058] In the step of parsing the PAT table data, the PAT section is parsed according to the ISO13818-1 definition to obtain the total number of N groups of programs total_program_number; each group of program_number obtained is combined with program_map_PID and stored in storage area B; new_id_flag is marked to distinguish the original and newly added IDs.
[0059] Specifically, the steps for parsing PAT section data are as follows: Figure 5 As shown: PATsection is obtained from buffer Ts_buffer_A and saved in storage area A. PAT section is parsed according to the PAT table data format defined in ISO_IEC_13818-1. The total number of N groups of programs can be obtained by parsing the PAT section, and its value is stored as total_program_number, that is, N groups of program_number and program_map_PID combinations are obtained. A group of program_number and program_map_PID represents a set of programs. The program_number and program_map_PID of all groups obtained are stored in storage area B respectively, and new_id_flag is marked as original or newly added.
[0060] In the step of parsing the SDT table data, by traversing the storage area B to see how many groups of program_number match the service_id of the SDTsection, the service_name is obtained and saved in the storage area E.
[0061] Specifically, the steps for parsing SDT section data are as follows: Figure 7As shown: get the data in storage area B, get the SDT section from the buffer Ts_buffer_A and save it to storage area A, parse the SDT section, traverse the number of program_number groups in storage area B, match them with the service_id of the sdt section to get the service_name and save it in storage area E.
[0062] In the step of parsing the PMT table data, the PMT section in storage area A is traversed and parsed through program_map_PID to obtain the video elementary_PID, audio elementary_PID group and audio iso639_code value, and the obtained data is saved in storage area C; if there are multiple audio elementary_PID data, non-repeating program_map_PID and program_number are randomly generated within the allowed range of pid, and storage area B is updated.
[0063] Specifically, the steps for parsing PMT table data are as follows: Figure 6 As shown: get the data in storage area B, get all PMT sections from buffer Ts_buffer_A and save them in storage area A, traverse PMT sections in storage area A through program_map_PID. Parse each PMT section, get the video elementary_PID and audio elementary_PID group, the audio iso639_code value, and save the data in storage area C. If there are N+1 audio elementary_PID data (the audio data exceeds 1), randomly generate N groups of program_map_PID and program_number within the range allowed by pid 0-8191 to ensure that the newly generated program_map_PID and program_number data are not repeated with the ID in storage area B. At the same time, the corresponding audio elementary_PID is saved in storage area B. The structure of storage area B can distinguish the new ID from the old ID through new_id_flag.
[0064] When modifying the PAT table, read the PAT section from storage area A, traverse the program_number in storage area B, find the program_number and program_map_PID of the newly added group through new_id_flag, insert program_number and program_map_PID on the PATsection, until the program_number in storage area B is traversed, and save it to storage area A after the modification is completed.
[0065] Specifically, the steps to modify the PAT table are as follows: Fig. 9 As shown: read the PAT section from storage area A, traverse the program_number in storage area B, find the newly added group of program_number and program_map_PID through new_id_flag, insert program_number and program_map_PID on the PAT section, until the traversal of program_number in storage area B is completed, and save it to storage area A after the modification is completed.
[0066] When modifying the PMT table, traverse storage area C according to total_program_number, and add the corresponding PMT section according to the number of audios; match and obtain the original PMT section where multiple audios exist; create a new PMTsection, insert new program_map_PID, program_number, video_elementary_PID descriptors and audio_elementary_PID descriptors; update and save the modified PMT section to storage area A.
[0067] If it is found that the total_audio_number is greater than 1, it is necessary to add total_audio_number-1 PMTsection; according to the matching principle of program_map_PID in storage area C and program_map_PID in pmt section of storage area A, obtain the original PMT section with multiple audio_elementary_PIDs; obtain the program_map_PID and program_number group with new_id_flag of 1 and is_used of 0 in storage area B; obtain the video_elementary_PID in storage area c, create a new section according to the PMT standard format, insert new program_map_PID, program_number values, and video_elementary_PID descriptor and audio_elementary_PID descriptor contents.
[0068] Specifically, the steps to modify the PMT table are as follows: Fig.10 As shown: traverse storage area C according to total_program_number. If it is found that the total_audio_number is greater than 1, it is necessary to add total_audio_number-1 PMTsection. According to the matching principle of program_map_PID in storage area C and program_map_PID in pmt section of storage area A, obtain the original pmt section with multiple audio_elementary_PIDs. Obtain the program_map_PID and program_number group with new_id_flag as 1 and is_used as 0 in storage area B, obtain the video_elementary_PID in storage area c, create a new section according to the PMT standard format, insert new values in program_map_PID and program_number, copy the video_elementary_PID descriptor and audio_elementary_PID descriptor content from the original PMT section, and insert them into the new section. Other commonly used values are copied from the PMT section. Generate a new pmt_section2 and store pmt_section2 in storage area A. Delete the description data of audio_elementary_PID from the original PMT section, regenerate PMT setion and save it in storage area A. The next multi-audio is added with the same process of PMT section_m.
[0069] When modifying the SDT table, obtain the SDT section in storage area A; traverse storage area B, find the new audio_elementary_PID through new_id_flag, and match the audio_iso639_code string and the original program_number; obtain the service_name in storage area E, merge and generate a new service_name2; insert the new program_number and the corresponding service_name2 related descriptor in the SDTsection; save to storage area A after completion.
[0070] Among them, by matching the audio_elementary_PID in storage area B with the audio_elementary_PID in storage area C, the audio_iso639_code string and the original program_number are obtained; the service_name is obtained in storage area E through the original program_number and the program_number matching algorithm in storage area E, and the audio_iso639_code string and service_name are merged to generate a new service_name2.
[0071] Specifically, the steps to modify the SDT table are as follows: Fig.11 As shown: Get the sdt section in storage area A, traverse storage area B, find the new audio_elementary_PID through the new_id_flag tag, match the audio_elementary_PID in storage area B with the audio_elementary_PID in storage area C, get the audio_iso639_code string and the original program_number, and get the service_name in storage area E through the matching algorithm between the original program_number and the program_number in storage area E. Merge the audio_iso639_code string and service_name to generate a new service_name2. Insert the new program_number value and the corresponding service_name2 string related descriptor into the position of the service_id descriptor in the sdt section. Copy other attribute values according to the values in the original sdt section. The values that need to be recalculated are calculated according to the SDT table data format. After the modification is completed, save it to storage area A.
[0072] When storage area A completes the entry of all data, it is sent to the output buffer Ts_out_buffer_G, storage area A is cleared, and buffer G is sent to the network through the UDP protocol according to the TS stream transmission rate, such as Fig.12 shown.
[0073] Among them, the purpose of modifying the PAT table is to add the newly generated ID description data; the purpose of modifying the original PMT table is to delete the audio-related description data occupied by the new PMT table; the purpose of creating a new PMT table is to add a PMT (channel) for the stripped audio data; the purpose of modifying the SDT table is because a new program name needs to be generated after the audio program is stripped, and the program description information needs to be added.
[0074] The data structure of storage area A includes:
[0075] #define MAX_CHANNEL 256
[0076] Unsigned char Ts_buffer_A[20*1024*1024] / / system dynamically allocated
[0077] Unsigned char pat_section
[4096]
[0078] Unsigned char pmt_section[MAX_CHANNEL]
[4096]
[0079] Unsigned char sdt_section
[4096]
[0080] Unsigned int ts_rate_speed=0;
[0081] Unsigned int total_new_group_number=0;
[0082] Unsigned int total_program_number=0;
[0083] Unsigned char Ts_out_buffer_G[50*1024*1024] / / system dynamically allocated;
[0084] The data structure of storage area B includes:
[0085] Typedef Struct group_id
[0086] {
[0087] Int program_number,
[0088] Int program_map_PID,
[0089] Int audio_elementary_PID,
[0090] Int is_used, / / If it is newly added, whether it is used
[0091] Int new_id_flag, / / original or newly added group
[0092] }all_group_id
[256] / / How many groups are saved in order. Add here to establish data relationship through audio_elementary_PID and program_number
[0093] The data structure of storage area C includes:
[0094] Typedef Struct channel_pmt_info
[0095] {
[0096] Int program_map_PID,
[0097] Int program_number,
[0098] Int video_elementary_PID
[0099] Int audio_elementary_PID
[32] ,
[0100] Int is_used
[32] , / / Whether audio is added to pmt
[0101] Char audio_iso639_code
[32] , / / such as "eng", "ara", "china"
[0102] Int total_audio_number
[0103] }channel_old_id
[256] / / Store original data
[0104] The data structure of storage area E includes:
[0105] Typedef Struct channel_info
[0106] {
[0107] Int program_number, / / Program number 1
[0108] Int program_map_PID, / / pid 0x12
[0109] Char service_name
[64] ; / / For example, "cctv1"
[0110] }channel_old_info
[256] / / Original data
[0111] In summary, the core of the present invention lies in a method for automatically generating new programs, specifically, by modifying the PAT table, PMT table and SDT table, converting a multi-audio mixed program into a single audio mixed program, and automatically modifying the program name according to the audio language to facilitate terminal users to watch.
[0112] Therefore, the present invention automatically increases the presentation form of the program without increasing the operating bandwidth cost, which is convenient for the terminal users to have a better experience. Through the automation technology, the complexity of manual operation is reduced, and the efficiency and accuracy of program conversion are improved.
[0113] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0114] The above-mentioned embodiments are only preferred embodiments of the present invention and cannot be used to limit the scope of protection of the present invention. Any non-substantial changes and substitutions made by technicians in this field on the basis of the present invention shall fall within the scope of protection required by the present invention.
Claims
1. A method for automatically converting multiple audio programs, characterized in that: The following steps are involved: Streaming and data downloading: input the program source data link address, establish a network connection, and use the communication protocol to download data; Parse PAT table data: obtain PAT table data from buffer Ts_buffer_A and save it to storage area A, and parse the PAT table; Parse SDT table data: obtain data from storage area B, obtain SDT table data from buffer Ts_buffer_A and save it to storage area A, and parse the SDT table; Parse PMT table data: obtain data from storage area B, obtain all PMT table data from buffer Ts_buffer_A and save it to storage area A, and parse the PMT table; Modify the PAT table, PMT table, and SDT table respectively, and save the modified PAT table, PMT table, and SDT table data to storage area A; Data output and transmission: When storage area A completes the entry of all data, it is sent to the output buffer Ts_out_buffer_G, storage area A is cleared, and the data in buffer Ts_out_buffer_G is sent to the network through the communication protocol according to the TS stream transmission rate; Repeat the steps of pulling streams and downloading data to the steps of outputting and sending data, and the multi-audio mixed program can be converted into a single-audio mixed program.
2. The method according to claim 1, characterized in that: In the streaming and data downloading steps, the communication protocol supports http and udp protocols. The validity of the data after successful streaming is judged. If it is a TS stream, it is sent to the input buffer Ts_buffer_A, otherwise it is discarded; the transmission rate value of the current TS stream is obtained once within the specified time and saved as ts_rate_speed; other PID data directly enters the output buffer Ts_out_buffer_G; among them, the parsing or modification of the data is based on the data format defined by ISO_IEC_13818-1 and ETSI EN 300468.
3. The method according to claim 1, characterized in that: In the step of parsing the PAT table data, the PAT section is parsed according to the ISO_IEC_13818-1 definition to obtain the total number of N groups of programs total_program_number; each group of program_number obtained is combined with program_map_PID and stored in storage area B; new_id_flag is marked to distinguish the original and newly added IDs.
4. The method according to claim 1, characterized in that: In the step of parsing the SDT table data, by traversing the storage area B to see how many groups of program_number match the service_id of the SDTsection, the service_name is obtained and saved in the storage area E.
5. The method according to claim 1, characterized in that: In the step of parsing the PMT table data, the PMT section in storage area A is traversed and parsed through program_map_PID to obtain the video elementary_PID, audio elementary_PID group and audio iso639_code value, and the obtained data is saved in storage area C; if there are multiple audio elementary_PID data, non-repeating program_map_PID and program_number are randomly generated within the allowed range of pid, and storage area B is updated.
6. The method according to claim 1, characterized in that: When modifying the PAT table, read the PAT section from storage area A, traverse the program_number in storage area B, find the program_number and program_map_PID of the newly added group through new_id_flag, insert program_number and program_map_PID on the PAT section, until the program_number in storage area B is traversed, and save to storage area A after the modification is completed.
7. The method according to any one of claims 1 to 6, characterized in that: When modifying the PMT table, traverse storage area C according to total_program_number, and add the corresponding PMT section according to the number of audios; match and obtain the original PMT section where multiple audios exist; create a new PMT section, insert new program_map_PID, program_number, video_elementary_PID descriptors and audio_elementary_PID descriptors; update and save the modified PMT section to storage area A.
8. The method according to claim 7, characterized in that: If it is found that the total_audio_number is greater than 1, it is necessary to add total_audio_number-1 PMTsection; according to the matching principle of program_map_PID in storage area C and program_map_PID in pmt section of storage area A, obtain the original PMT section with multiple audio_elementary_PIDs; obtain the program_map_PID and program_number group with new_id_flag of 1 and is_used of 0 in storage area B; obtain the video_elementary_PID in storage area c, create a new section according to the PMT standard format, insert new program_map_PID, program_number values, and video_elementary_PID descriptor and audio_elementary_PID descriptor contents.
9. The method according to any one of claims 1 to 6, characterized in that: When modifying the SDT table, obtain the SDT section in storage area A; traverse storage area B, find the new audio_elementary_PID through new_id_flag, and match the audio_iso639_code string and the original program_number; obtain the service_name in storage area E, merge and generate a new service_name2; insert the new program_number and the corresponding service_name2 related descriptor in the SDTsection; save to storage area A after completion.
10. The method according to claim 9, characterized in that: By matching the audio_elementary_PID in storage area B with the audio_elementary_PID in storage area C, the audio_iso639_code string and the original program_number are obtained; the service_name is obtained in storage area E through the original program_number matching algorithm with the program_number in storage area E, and the audio_iso639_code string and service_name are merged to generate a new service_name2.