CN103294771A - Method and device for compressing sound data in swf (shock wave flash) files in batched manner - Google Patents
Method and device for compressing sound data in swf (shock wave flash) files in batched manner Download PDFInfo
- Publication number
- CN103294771A CN103294771A CN2013101683720A CN201310168372A CN103294771A CN 103294771 A CN103294771 A CN 103294771A CN 2013101683720 A CN2013101683720 A CN 2013101683720A CN 201310168372 A CN201310168372 A CN 201310168372A CN 103294771 A CN103294771 A CN 103294771A
- Authority
- CN
- China
- Prior art keywords
- swf file
- processing threads
- sound data
- swf
- source
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Abstract
The invention provides a method and a device for compressing sound data in swf (shock wave flash) files in a batched manner. The method includes enabling processing threads to judge whether source swf files contain uncompressed sound data or not; directly storing the source swf files in storage equipment if the source swf files do not contain the uncompressed sound data, and then turning the processing threads into idle threads; enabling the processing threads to execute compression operation on the uncompressed sound data to obtain swf files which only contain compressed sound data if the source swf files contain the uncompressed sound data, then storing the obtained swf files into the storage equipment, and turning the processing threads into idle threads. The processing threads are responsible for the corresponding source swf files. By the method and the device, the sound data in the swf files can be compressed in the batched manner, accordingly, the size of each swf file is effectively reduced, occupied hard disk space is reduced, and the file propagation speed is increased. Besides, the method and the device have the advantage of high compression efficiency.
Description
Technical field
The invention belongs to field of computer technology, be specifically related to voice data compresses in batches in a kind of swf file method and device.
Background technology
Swf (shock wave flash) is the professional format of animation software Flash, is a kind of animation file form of supporting vector and dot pattern, is widely used in fields such as webpage design, cartoon making.
This shows that the swf file has the characteristics widely of propagating, therefore, how further to reduce the volume of swf file, reduce hard disk and take up room, improve its velocity of propagation, still have important practical significance.
Summary of the invention
Defective at prior art exists the invention provides voice data compresses in batches in a kind of swf file method and device, compresses voice data in the swf file in batches, thereby reduces the volume of swf file, reduces hard disk and takes up room, and has improved its velocity of propagation.
The technical solution used in the present invention is as follows:
The present invention also provides the method that voice data compresses in batches in a kind of swf file, may further comprise the steps:
S1, the batch processing server receives X source swf file of client upload; Wherein, X 〉=1, X is integer;
S2, described batch processing server is created Y processing threads according to the described source swf quantity of documents of current internal storage state and needs processing, then a described Y processing threads is distributed to described X source swf file; Wherein, Y 〉=1, Y is integer;
S3, the described processing threads of described batch processing server controls is all carried out following operation to the described source swf file of self being responsible for: described processing threads judges in the described source swf file of self being responsible for whether comprise not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
S4, described batch processing server regularly judges in the described Y processing threads whether have idle thread, if exist, then further judges whether to exist pending source swf file; If exist, then described idle thread heavily distributed to described pending source swf file; If there is no, then nullify described idle thread.
Preferably, S3 specifically may further comprise the steps:
S31, described processing threads judge whether the described source swf file of self being responsible for is compressed file, if then carry out S32; Otherwise, directly carry out S33;
S32, the described processing threads described source swf file that decompresses obtains the source swf file behind the decompress(ion), carries out S33 then;
S33, described processing threads resolve described source swf file, obtain the swf header information of described source swf file, and N the swf initial labels that is positioned at described swf header information back; Wherein, N 〉=1, N is integer;
S34, described processing threads navigate to described N the voice tag in the swf initial labels; Then, described processing threads judges whether comprise not compression sound data in the described voice tag, if comprise, then obtain described not compression sound data, described not compression sound data is carried out squeeze operation, obtain compression sound data, replace described not compression sound data with described compression sound data then, obtain new voice tag; Carry out S35 then; Otherwise, directly carry out S36;
S35, described processing threads recombinate described swf header information, described new voice tag, the swf initial labels of the N-1 except described voice tag are not comprised the not swf file of compression sound data, process ends;
S36, described processing threads recombinate described swf header information and described N swf initial labels re-generate described source swf file, process ends.
Preferably, among the S34, described not compression sound data is carried out squeeze operation is specially:
Compress the frequency of described not compression sound data.
Preferably, among the S34, replace described not compression sound data with described compression sound data, also comprise afterwards:
Calculate the length value of described compression sound data place voice tag, the original length value with the length value that calculates is replaced described voice tag obtains new voice tag.
The present invention also provides the device that voice data compresses in batches in a kind of swf file, comprising:
Receiver module is for X the source swf file that receives client upload; Wherein, X 〉=1, X is integer;
Creation module is used for the described source swf quantity of documents according to current internal storage state and needs processing, creates Y processing threads;
Distribution module is used for Y the processing threads that described creation module is created distributed to described X the source swf file that described receiver module receives; Wherein, Y 〉=1, Y is integer;
Control module, the described processing threads that is used for the described creation module establishment of control is carried out following operation to the described source swf file of self being responsible for: described processing threads judges whether the described source swf file of self being responsible for comprises not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
Judge module is used for regularly judging whether a described Y processing threads exists idle thread; Also be used for when judging that obtaining a described Y processing threads exists idle thread, further judging whether to exist pending source swf file;
Heavy distribution module is used for when described judge module judgement obtains existing pending source swf file described idle thread heavily being distributed to described pending source swf file;
Nullify module, be used for when there is not pending source swf file in described judge module judgement, nullifying described idle thread.
Beneficial effect of the present invention is as follows:
Voice data compresses in batches in the swf file provided by the invention method and device compress voice data in the swf file in batches, thereby effectively reduce the volume of swf file, reduce hard disk and take up room, and have improved its velocity of propagation.And, also have the high advantage of compression efficiency.
Description of drawings
Fig. 1 is the schematic flow sheet of the method that voice data compresses in batches in the swf file provided by the invention;
Fig. 2 is the structural representation of the device that voice data compresses in batches in the swf file provided by the invention.
Embodiment
The present invention is described in detail below in conjunction with accompanying drawing:
As shown in Figure 1, the invention provides the method that voice data compresses in batches in a kind of swf file, may further comprise the steps:
S1, the batch processing server receives X source swf file of client upload; Wherein, X 〉=1, X is integer;
S2, described batch processing server is created Y processing threads according to the described source swf quantity of documents of current internal storage state and needs processing, then a described Y processing threads is distributed to described X source swf file; Wherein, Y 〉=1, Y is integer;
In this step, the quantity Y of processing threads less than, more than or equal to source swf quantity of documents X, specifically distinguish following situation: (1) is if Y=X, for example, Y=X=5 then distributes to 5 processing threads 5 source swf files, is responsible for a source swf file by a processing threads.(2) if Y less than X, for example, Y=5, X=8 then at first handles 5 source swf files by 5 processing threads, after certain processing threads disposes, handles in untreated 3 source swf files still again, and active swf file processing is finished.(3) if Y greater than X, for example, Y=5, X=3 then can make two or a source of 3 thread associated treatment swf file.That is to say, among the present invention, for a source swf file, can be handled simultaneously by one or more threads, thereby improve treatment effeciency.
S3, the described processing threads of described batch processing server controls is all carried out following operation to the described source swf file of self being responsible for: described processing threads judges in the described source swf file of self being responsible for whether comprise not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
Among the present invention, during to source swf file processing, to the operation of source file compression sound data, and store operation in the memory device into, carry out by identical processing threads, thereby can simplify the complexity of system configuration, instruction simplifies the operation.
This step specifically may further comprise the steps:
S31, described processing threads judge whether the described source swf file of self being responsible for is compressed file, if then carry out S32; Otherwise, directly carry out S33;
S32, the described processing threads described source swf file that decompresses obtains the source swf file behind the decompress(ion), carries out S33 then;
S33, described processing threads resolve described source swf file, obtain the swf header information of described source swf file, and N the swf initial labels that is positioned at described swf header information back; Wherein, N 〉=1, N is integer;
S34, described processing threads navigate to described N the voice tag in the swf initial labels; Then, described processing threads judges whether comprise not compression sound data in the described voice tag, if comprise, then obtain described not compression sound data, described not compression sound data is carried out squeeze operation, for example: compress the not frequency of compression sound data, obtain compression sound data, replace described not compression sound data with described compression sound data then, obtain new voice tag; Carry out S35 then; Otherwise, directly carry out S36;
In this step, can also comprise: calculate the length value of described compression sound data place voice tag, the original length value with the length value that calculates is replaced described voice tag obtains new voice tag.
S35, described processing threads recombinate described swf header information, described new voice tag, the swf initial labels of the N-1 except described voice tag are not comprised the not swf file of compression sound data, process ends;
S36, described processing threads recombinate described swf header information and described N swf initial labels re-generate described source swf file, process ends.
S4, described batch processing server regularly judges in the described Y processing threads whether have idle thread, if exist, then further judges whether to exist pending source swf file; If exist, then described idle thread heavily distributed to described pending source swf file; If there is no, then nullify described idle thread.
As shown in Figure 2, the present invention also provides the device that voice data compresses in batches in a kind of swf file, comprising:
Receiver module is for X the source swf file that receives client upload; Wherein, X 〉=1, X is integer;
Creation module is used for the described source swf quantity of documents according to current internal storage state and needs processing, creates Y processing threads;
Distribution module is used for Y the processing threads that described creation module is created distributed to described X the source swf file that described receiver module receives; Wherein, Y 〉=1, Y is integer;
Control module, the described processing threads that is used for the described creation module establishment of control is carried out following operation to the described source swf file of self being responsible for: described processing threads judges whether the described source swf file of self being responsible for comprises not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
Judge module is used for regularly judging whether a described Y processing threads exists idle thread; Also be used for when judging that obtaining a described Y processing threads exists idle thread, further judging whether to exist pending source swf file;
Heavy distribution module is used for when described judge module judgement obtains existing pending source swf file described idle thread heavily being distributed to described pending source swf file;
Nullify module, be used for when there is not pending source swf file in described judge module judgement, nullifying described idle thread.
Voice data compresses in batches in the swf file provided by the invention method and device compress voice data in the swf file in batches, thereby effectively reduce the volume of swf file, reduce hard disk and take up room, and have improved its velocity of propagation.And, also have the high advantage of compression efficiency.
The above only is preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be looked protection scope of the present invention.
Claims (5)
1. the method that voice data compresses in batches in the swf file is characterized in that, may further comprise the steps:
S1, the batch processing server receives X source swf file of client upload; Wherein, X 〉=1, X is integer;
S2, described batch processing server is created Y processing threads according to the described source swf quantity of documents of current internal storage state and needs processing, then a described Y processing threads is distributed to described X source swf file; Wherein, Y 〉=1, Y is integer;
S3, the described processing threads of described batch processing server controls is all carried out following operation to the described source swf file of self being responsible for: described processing threads judges in the described source swf file of self being responsible for whether comprise not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
S4, described batch processing server regularly judges in the described Y processing threads whether have idle thread, if exist, then further judges whether to exist pending source swf file; If exist, then described idle thread heavily distributed to described pending source swf file; If there is no, then nullify described idle thread.
2. the method that voice data compresses in batches in the swf file according to claim 1 is characterized in that S3 specifically may further comprise the steps:
S31, described processing threads judge whether the described source swf file of self being responsible for is compressed file, if then carry out S32; Otherwise, directly carry out S33;
S32, the described processing threads described source swf file that decompresses obtains the source swf file behind the decompress(ion), carries out S33 then;
S33, described processing threads resolve described source swf file, obtain the swf header information of described source swf file, and N the swf initial labels that is positioned at described swf header information back; Wherein, N 〉=1, N is integer;
S34, described processing threads navigate to described N the voice tag in the swf initial labels; Then, described processing threads judges whether comprise not compression sound data in the described voice tag, if comprise, then obtain described not compression sound data, described not compression sound data is carried out squeeze operation, obtain compression sound data, replace described not compression sound data with described compression sound data then, obtain new voice tag; Carry out S35 then; Otherwise, directly carry out S36;
S35, described processing threads recombinate described swf header information, described new voice tag, the swf initial labels of the N-1 except described voice tag are not comprised the not swf file of compression sound data, process ends;
S36, described processing threads recombinate described swf header information and described N swf initial labels re-generate described source swf file, process ends.
3. the method that voice data compresses in batches in the swf file according to claim 2 is characterized in that, among the S34, described not compression sound data is carried out squeeze operation be specially:
Compress the frequency of described not compression sound data.
4. the method that voice data compresses in batches in the swf file according to claim 2 is characterized in that, among the S34, replaces described not compression sound data with described compression sound data, also comprises afterwards:
Calculate the length value of described compression sound data place voice tag, the original length value with the length value that calculates is replaced described voice tag obtains new voice tag.
5. the device that voice data compresses in batches in the swf file is characterized in that, comprising:
Receiver module is for X the source swf file that receives client upload; Wherein, X 〉=1, X is integer;
Creation module is used for the described source swf quantity of documents according to current internal storage state and needs processing, creates Y processing threads;
Distribution module is used for Y the processing threads that described creation module is created distributed to described X the source swf file that described receiver module receives; Wherein, Y 〉=1, Y is integer;
Control module, the described processing threads that is used for the described creation module establishment of control is carried out following operation to the described source swf file of self being responsible for: described processing threads judges whether the described source swf file of self being responsible for comprises not compression sound data; If do not comprise, then directly described source swf file is stored in the memory device, then, described processing threads changes idle thread into; If comprise, described processing threads is carried out squeeze operation to described not compression sound data, is only comprised the swf file of compression sound data, and the described swf file that will obtain then stores in the memory device, and then, described processing threads changes idle thread into;
Judge module is used for regularly judging whether a described Y processing threads exists idle thread; Also be used for when judging that obtaining a described Y processing threads exists idle thread, further judging whether to exist pending source swf file;
Heavy distribution module is used for when described judge module judgement obtains existing pending source swf file described idle thread heavily being distributed to described pending source swf file;
Nullify module, be used for when there is not pending source swf file in described judge module judgement, nullifying described idle thread.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101683720A CN103294771A (en) | 2013-05-09 | 2013-05-09 | Method and device for compressing sound data in swf (shock wave flash) files in batched manner |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN2013101683720A CN103294771A (en) | 2013-05-09 | 2013-05-09 | Method and device for compressing sound data in swf (shock wave flash) files in batched manner |
Publications (1)
Publication Number | Publication Date |
---|---|
CN103294771A true CN103294771A (en) | 2013-09-11 |
Family
ID=49095633
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN2013101683720A Pending CN103294771A (en) | 2013-05-09 | 2013-05-09 | Method and device for compressing sound data in swf (shock wave flash) files in batched manner |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103294771A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106294202A (en) * | 2015-06-12 | 2017-01-04 | 联想(北京)有限公司 | A kind of date storage method and device |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6925340B1 (en) * | 1999-08-24 | 2005-08-02 | Sony Corporation | Sound reproduction method and sound reproduction apparatus |
CN1835572A (en) * | 2006-01-24 | 2006-09-20 | 康佳集团股份有限公司 | Method of realizing flash cartoon playing on DVD recorder player |
CN101916276A (en) * | 2010-08-13 | 2010-12-15 | 北京新岸线网络技术有限公司 | Method, device and server for improving release of rich media file in network |
CN102799672A (en) * | 2012-07-17 | 2012-11-28 | 厦门游家网络有限公司 | Method for extracting jpg pictures and mp3 files in batch from swf files |
-
2013
- 2013-05-09 CN CN2013101683720A patent/CN103294771A/en active Pending
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6925340B1 (en) * | 1999-08-24 | 2005-08-02 | Sony Corporation | Sound reproduction method and sound reproduction apparatus |
CN1835572A (en) * | 2006-01-24 | 2006-09-20 | 康佳集团股份有限公司 | Method of realizing flash cartoon playing on DVD recorder player |
CN101916276A (en) * | 2010-08-13 | 2010-12-15 | 北京新岸线网络技术有限公司 | Method, device and server for improving release of rich media file in network |
CN102799672A (en) * | 2012-07-17 | 2012-11-28 | 厦门游家网络有限公司 | Method for extracting jpg pictures and mp3 files in batch from swf files |
Non-Patent Citations (5)
Title |
---|
刘新强,曾兵义: ""用线程池解决服务器并发请求的方案设计"", 《现代电子技术》 * |
刘新强,曾兵义: "用线程池解决服务器并发请求的方案设计", 《现代电子技术》 * |
姚玉明 胡晓峰 吴铃达: "多媒体系统中的声音数据压缩技术", 《电子技术应用》 * |
赵东升等: "《Flash MX培训教程》", 30 November 2002 * |
邵长侠: "Flash组成元素的内容特征提取与标注研究", 《中国优秀硕士学位论文全文数据库》 * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106294202A (en) * | 2015-06-12 | 2017-01-04 | 联想(北京)有限公司 | A kind of date storage method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10116325B2 (en) | Data compression/decompression device | |
CN107027036A (en) | A kind of FPGA isomeries accelerate decompression method, the apparatus and system of platform | |
CN102841901A (en) | Web page display method and device | |
US10727864B2 (en) | Server and method for compressing data by device | |
CN105373369A (en) | Asynchronous caching method, server and system | |
CN102023973A (en) | Method, device and system for synchronizing database with application cache server | |
CN103023796B (en) | network data compression method and system | |
CN103391442A (en) | Rapid video image transmission compression algorithm based on regional division and difference comparison | |
US20110307471A1 (en) | Accelerating Database Management System Operations | |
CN109949156A (en) | A kind of data processing method and server of block chain contract | |
CN105550246A (en) | System and method for loading network picture under Android platform | |
CN108965333A (en) | A kind of data compression, decompression method, system and electronic equipment | |
CN108769694B (en) | Method and device for Alpha channel coding based on FPGA | |
CN109088636B (en) | Data processing method and system, electronic equipment and storage medium | |
CN104408178A (en) | Device and method for WEB control loading | |
CN103049561B (en) | A kind of data compression method, storage engines and storage system | |
CN103677930A (en) | GIS data loading method and device based on mosaic wall system | |
CN113138969A (en) | Data transmission method and device, electronic equipment and computer readable storage medium | |
CN103412898A (en) | Method and device for optimizing webpage | |
CN113220651A (en) | Operation data compression method and device, terminal equipment and storage medium | |
CN103294771A (en) | Method and device for compressing sound data in swf (shock wave flash) files in batched manner | |
CN103268619A (en) | Method and device for batch compression for picture data in swf document | |
CN106547595A (en) | A kind of UI resources loading method and system | |
CN110311754B (en) | Data receiving method and device, storage medium and electronic equipment | |
CN101577143A (en) | Method, device and system for storing files |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20130911 |
|
RJ01 | Rejection of invention patent application after publication |