From c5b7b929b35c38234cb0fde435806056746343e8 Mon Sep 17 00:00:00 2001 From: Alexandre Emsenhuber Date: Sun, 19 Jul 2009 12:27:48 +0000 Subject: [PATCH] svn:eol-style native --- js2/mwEmbed/binPlayers/omtk-fx/LICENSE.txt | 402 +- js2/mwEmbed/binPlayers/omtk-fx/README.txt | 34 +- .../binPlayers/omtk-fx/src/as/Player.as | 212 +- .../as/org/omtk/ogg/EndOfOggStreamError.as | 56 +- .../src/as/org/omtk/ogg/LogicalOggStream.as | 142 +- .../omtk-fx/src/as/org/omtk/ogg/OggPacket.as | 96 +- .../omtk-fx/src/as/org/omtk/ogg/OggPage.as | 230 +- .../src/as/org/omtk/ogg/UncachedUrlStream.as | 102 +- .../src/as/org/omtk/util/BitByteArray.as | 148 +- .../src/as/org/omtk/util/HuffmanNode.as | 182 +- .../src/as/org/omtk/vorbis/AudioPacket.as | 678 +- .../src/as/org/omtk/vorbis/CodeBook.as | 444 +- .../src/as/org/omtk/vorbis/CommentHeader.as | 160 +- .../omtk-fx/src/as/org/omtk/vorbis/Floor.as | 242 +- .../omtk-fx/src/as/org/omtk/vorbis/Floor0.as | 110 +- .../omtk-fx/src/as/org/omtk/vorbis/Floor1.as | 554 +- .../org/omtk/vorbis/IdentificationHeader.as | 172 +- .../omtk-fx/src/as/org/omtk/vorbis/Look.as | 270 +- .../omtk-fx/src/as/org/omtk/vorbis/Mapping.as | 144 +- .../src/as/org/omtk/vorbis/Mapping0.as | 270 +- .../omtk-fx/src/as/org/omtk/vorbis/Mdct.as | 122 +- .../omtk-fx/src/as/org/omtk/vorbis/Mode.as | 138 +- .../omtk-fx/src/as/org/omtk/vorbis/Residue.as | 282 +- .../src/as/org/omtk/vorbis/Residue2.as | 216 +- .../src/as/org/omtk/vorbis/SetupHeader.as | 234 +- .../omtk-fx/src/as/org/omtk/vorbis/Util.as | 242 +- .../src/as/org/omtk/vorbis/VorbisSound.as | 270 +- .../src/as/org/omtk/vorbis/VorbisStream.as | 258 +- .../src/haXe/org/omtk/vorbis/MdctHX.hx | 674 +- .../princess_iron_fan-zh-hant.srt | 2784 ++++---- .../princess_iron_fan.srt | 2792 ++++---- js2/mwEmbed/jquery/plugins/jquery.pngFix.js | 226 +- .../libClipEdit/colorpicker/css/layout.css | 436 +- .../libClipEdit/colorpicker/index.html | 368 +- .../libClipEdit/colorpicker/js/colorpicker.js | 966 +-- js2/mwEmbed/libClipEdit/colorpicker/js/eye.js | 68 +- .../libClipEdit/colorpicker/js/layout.js | 132 +- .../libClipEdit/colorpicker/js/utils.js | 502 +- .../libClipEdit/pixastic-editor/editor.js | 1934 ++--- .../pixastic-editor/pixastic.all.js | 6338 ++++++++--------- .../libClipEdit/pixastic-editor/pixastic.css | 846 +-- js2/mwEmbed/libClipEdit/pixastic-editor/ui.js | 474 +- .../libClipEdit/pixastic-editor/uidata.js | 1930 ++--- .../pixastic-lib/pixastic-editor/editor.js | 1934 ++--- .../pixastic-editor/pixastic.all.js | 6338 ++++++++--------- .../pixastic-lib/pixastic-editor/pixastic.css | 846 +-- .../pixastic-lib/pixastic-editor/ui.js | 474 +- .../pixastic-lib/pixastic-editor/uidata.js | 1930 ++--- 48 files changed, 19201 insertions(+), 19201 deletions(-) diff --git a/js2/mwEmbed/binPlayers/omtk-fx/LICENSE.txt b/js2/mwEmbed/binPlayers/omtk-fx/LICENSE.txt index 6b1065b6cc..878ca2a00e 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/LICENSE.txt +++ b/js2/mwEmbed/binPlayers/omtk-fx/LICENSE.txt @@ -1,201 +1,201 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/js2/mwEmbed/binPlayers/omtk-fx/README.txt b/js2/mwEmbed/binPlayers/omtk-fx/README.txt index 2c421f2440..f8416e0a34 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/README.txt +++ b/js2/mwEmbed/binPlayers/omtk-fx/README.txt @@ -1,17 +1,17 @@ - - *** PRELIMINARY SOFTWARE *** - -Please note that this is a prerelease of the OMTK Flash library. No -quality of this software can be guaranteed. - - - *** haXe notes *** - -You need at least haXe 2.01 (with support for the new Flash 10 types) -to compile the haXe source. - - *** Flash notes *** - -I am not able to create a .SWC library from the haXe .SWF file. It's -therefore dynamically linked at runtime and hxmdct.swf must be placed -in the same directory as the "real" Flash movie. + + *** PRELIMINARY SOFTWARE *** + +Please note that this is a prerelease of the OMTK Flash library. No +quality of this software can be guaranteed. + + + *** haXe notes *** + +You need at least haXe 2.01 (with support for the new Flash 10 types) +to compile the haXe source. + + *** Flash notes *** + +I am not able to create a .SWC library from the haXe .SWF file. It's +therefore dynamically linked at runtime and hxmdct.swf must be placed +in the same directory as the "real" Flash movie. diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/Player.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/Player.as index 365051788b..6abe5d2ced 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/Player.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/Player.as @@ -1,106 +1,106 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package { - - import org.omtk.vorbis.VorbisSound; - - import flash.display.Shape; - import flash.display.Sprite; - import flash.display.StageAlign; - import flash.display.StageQuality; - import flash.display.StageScaleMode; - import flash.net.*; - import flash.events.Event; - import flash.text.TextField; - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.utils.getTimer; - import flash.utils.setTimeout; - import flash.utils.setInterval; - import flash.external.ExternalInterface; - - [ SWF( backgroundColor = '#ffffff', width = '1', height = '1' ) ] - - public class Player extends Sprite { - - private var sound: VorbisSound; - private var initialized: Boolean = false; - - public function Player() { - if(stage != null) { - stage.frameRate = 20; - } - - setTimeout(registerJSCallbacks, 100); - initialized = true; - } - - private function registerJSCallbacks(): void { - if (ExternalInterface.available) { - ExternalInterface.addCallback("play", playJS); - ExternalInterface.addCallback("getMetaData", getMetaDataJS); - ExternalInterface.addCallback("getPosition", getPositionJS); - } - } - - public function playJS(url: String): void { - if(sound != null) { - sound.stop(); - } - sound = new VorbisSound(new URLRequest(url)); - sound.addEventListener(Event.COMPLETE, complete); - sound.addEventListener(VorbisSound.METADATA_UPDATE, metadataUpdate); - sound.play(); - } - - public function getMetaDataJS(key: String): String { - if(sound == null) { - return null; - } - else { - return sound.getMetaData(key); - } - } - - public function getPositionJS(): int { - if(sound == null) { - return -1; - } - else { - return sound.position; - } - } - - private function complete(event: Event):void { - trace("complete"); - if(ExternalInterface.available) { - ExternalInterface.call("OMTK_P_complete"); - } - } - - private function metadataUpdate(event: Event):void { - trace("metadata update: " + sound.getMetaData("TITLE")); - if(ExternalInterface.available) { - ExternalInterface.call("OMTK_P_metadataUpdate"); - } - } - - } - -} +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package { + + import org.omtk.vorbis.VorbisSound; + + import flash.display.Shape; + import flash.display.Sprite; + import flash.display.StageAlign; + import flash.display.StageQuality; + import flash.display.StageScaleMode; + import flash.net.*; + import flash.events.Event; + import flash.text.TextField; + import flash.utils.ByteArray; + import flash.utils.Endian; + import flash.utils.getTimer; + import flash.utils.setTimeout; + import flash.utils.setInterval; + import flash.external.ExternalInterface; + + [ SWF( backgroundColor = '#ffffff', width = '1', height = '1' ) ] + + public class Player extends Sprite { + + private var sound: VorbisSound; + private var initialized: Boolean = false; + + public function Player() { + if(stage != null) { + stage.frameRate = 20; + } + + setTimeout(registerJSCallbacks, 100); + initialized = true; + } + + private function registerJSCallbacks(): void { + if (ExternalInterface.available) { + ExternalInterface.addCallback("play", playJS); + ExternalInterface.addCallback("getMetaData", getMetaDataJS); + ExternalInterface.addCallback("getPosition", getPositionJS); + } + } + + public function playJS(url: String): void { + if(sound != null) { + sound.stop(); + } + sound = new VorbisSound(new URLRequest(url)); + sound.addEventListener(Event.COMPLETE, complete); + sound.addEventListener(VorbisSound.METADATA_UPDATE, metadataUpdate); + sound.play(); + } + + public function getMetaDataJS(key: String): String { + if(sound == null) { + return null; + } + else { + return sound.getMetaData(key); + } + } + + public function getPositionJS(): int { + if(sound == null) { + return -1; + } + else { + return sound.position; + } + } + + private function complete(event: Event):void { + trace("complete"); + if(ExternalInterface.available) { + ExternalInterface.call("OMTK_P_complete"); + } + } + + private function metadataUpdate(event: Event):void { + trace("metadata update: " + sound.getMetaData("TITLE")); + if(ExternalInterface.available) { + ExternalInterface.call("OMTK_P_metadataUpdate"); + } + } + + } + +} diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as index 3c02799a7c..9b8a82aece 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as @@ -1,29 +1,29 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.ogg { - - public class EndOfOggStreamError extends Error { - - public function EndOfOggStreamError(message:String = null) { - super(message); - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.ogg { + + public class EndOfOggStreamError extends Error { + + public function EndOfOggStreamError(message:String = null) { + super(message); + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as index a5685595af..d9d5d35ac8 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as @@ -1,72 +1,72 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.ogg { - - import org.omtk.util.BitByteArray; - import flash.utils.Endian; - - public class LogicalOggStream { - - private var source:UncachedUrlStream; - - private var pageIndex:int; - private var currentPage:OggPage; - private var currentSegmentIndex:int; - - public function LogicalOggStream(source:UncachedUrlStream) { - this.source = source; - } - - public function getNextOggPacket(): OggPacket { - - var res:BitByteArray = new BitByteArray(); - - var segmentLength:int = 0; - - if(currentPage == null) { - currentPage = source.getNextOggPage(); - } - - do { - if(currentSegmentIndex >= currentPage.segmentOffsets.length) { - currentSegmentIndex=0; - - if(currentPage.eos) { - throw new EndOfOggStreamError("End of OGG stream"); - } - - currentPage = source.getNextOggPage(); - } - - segmentLength = currentPage.segmentLengths[currentSegmentIndex]; - res.writeBytes(currentPage.data, currentPage.segmentOffsets[currentSegmentIndex], segmentLength); - currentSegmentIndex++; - } - while(segmentLength==255); - - res.position = 0; - - var lastPacket: Boolean = currentPage.eos && currentSegmentIndex == currentPage.segmentOffsets.length; - var lastGranulePosition: int = currentPage.absoluteGranulePosition; - - return new OggPacket(res, lastPacket, lastGranulePosition); - } - - } +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.ogg { + + import org.omtk.util.BitByteArray; + import flash.utils.Endian; + + public class LogicalOggStream { + + private var source:UncachedUrlStream; + + private var pageIndex:int; + private var currentPage:OggPage; + private var currentSegmentIndex:int; + + public function LogicalOggStream(source:UncachedUrlStream) { + this.source = source; + } + + public function getNextOggPacket(): OggPacket { + + var res:BitByteArray = new BitByteArray(); + + var segmentLength:int = 0; + + if(currentPage == null) { + currentPage = source.getNextOggPage(); + } + + do { + if(currentSegmentIndex >= currentPage.segmentOffsets.length) { + currentSegmentIndex=0; + + if(currentPage.eos) { + throw new EndOfOggStreamError("End of OGG stream"); + } + + currentPage = source.getNextOggPage(); + } + + segmentLength = currentPage.segmentLengths[currentSegmentIndex]; + res.writeBytes(currentPage.data, currentPage.segmentOffsets[currentSegmentIndex], segmentLength); + currentSegmentIndex++; + } + while(segmentLength==255); + + res.position = 0; + + var lastPacket: Boolean = currentPage.eos && currentSegmentIndex == currentPage.segmentOffsets.length; + var lastGranulePosition: int = currentPage.absoluteGranulePosition; + + return new OggPacket(res, lastPacket, lastGranulePosition); + } + + } } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as index 95b53f5244..b7876ca56c 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as @@ -1,49 +1,49 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.ogg { - - import org.omtk.util.BitByteArray; - - public class OggPacket { - - private var _data: BitByteArray; - private var _lastPacket: Boolean; - private var _lastGranulePosition: int; - - public function OggPacket(data: BitByteArray, lastPacket: Boolean, lastGranulePosition: int) { - _data = data; - _lastPacket = lastPacket; - _lastGranulePosition = lastGranulePosition; - } - - public function get data(): BitByteArray { - return _data; - } - - public function get lastPacket(): Boolean { - return _lastPacket; - } - - public function get lastGranulePosition(): int { - return _lastGranulePosition; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.ogg { + + import org.omtk.util.BitByteArray; + + public class OggPacket { + + private var _data: BitByteArray; + private var _lastPacket: Boolean; + private var _lastGranulePosition: int; + + public function OggPacket(data: BitByteArray, lastPacket: Boolean, lastGranulePosition: int) { + _data = data; + _lastPacket = lastPacket; + _lastGranulePosition = lastGranulePosition; + } + + public function get data(): BitByteArray { + return _data; + } + + public function get lastPacket(): Boolean { + return _lastPacket; + } + + public function get lastGranulePosition(): int { + return _lastGranulePosition; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as index 54f63874d2..8e90b08213 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as @@ -1,116 +1,116 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.ogg { - - import flash.net.*; - import flash.utils.ByteArray; - - public class OggPage { - - private var _version:int; - private var _continued:Boolean; - private var _bos:Boolean; - private var _eos:Boolean; - private var _absoluteGranulePosition:int; - private var _streamSerialNumber:int; - private var _pageSequenceNumber:int; - private var _pageCheckSum:int; - private var _segmentOffsets:Array; - private var _segmentLengths:Array; - private var _totalLength:int; - private var _data:ByteArray; - - public function OggPage(stream:URLStream) { - - var capture:int = stream.readInt(); - if(capture != 0x5367674f) { - throw new Error("Ogg page does not start with 'OggS': "+capture); - } - - _version = stream.readByte()&0xff; - var tmp:int = stream.readByte(); - - _continued = (tmp&1)!=0;; - _bos = (tmp&2)!=0; - _eos = (tmp&4)!=0; - - // absoluteGranulePosition is really 64 bits - _absoluteGranulePosition = stream.readUnsignedInt(); - stream.readUnsignedInt(); // last 32 bits of _absoluteGranulePosition - - _streamSerialNumber = stream.readUnsignedInt(); - _pageSequenceNumber = stream.readUnsignedInt(); - _pageCheckSum = stream.readUnsignedInt(); - - //trace("_pageSequenceNumber: " + _pageSequenceNumber); - - var pageSegments:int = stream.readUnsignedByte(); - - //stream.waitFor(pageSegments); - - _segmentOffsets = []; - _segmentLengths = []; - _data = new ByteArray(); - - var totalLength:int; - - var i:int; - var l:int; - - for( i= 0 ; i < pageSegments ; i++ ) { - l = stream.readUnsignedByte(); - _segmentLengths.push( l ); - _segmentOffsets.push( totalLength ); - totalLength += l; - } - - stream.readBytes(_data, 0, totalLength); - } - - public function get absoluteGranulePosition():int { - return _absoluteGranulePosition; - } - - public function get segmentOffsets():Array { - return _segmentOffsets; - } - - public function get segmentLengths():Array { - return _segmentLengths; - } - - public function get data():ByteArray { - return _data; - } - - public function get eos():Boolean { - return _eos; - } - - public function get bos():Boolean { - return _bos; - } - - public function get continued():Boolean { - return _continued; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.ogg { + + import flash.net.*; + import flash.utils.ByteArray; + + public class OggPage { + + private var _version:int; + private var _continued:Boolean; + private var _bos:Boolean; + private var _eos:Boolean; + private var _absoluteGranulePosition:int; + private var _streamSerialNumber:int; + private var _pageSequenceNumber:int; + private var _pageCheckSum:int; + private var _segmentOffsets:Array; + private var _segmentLengths:Array; + private var _totalLength:int; + private var _data:ByteArray; + + public function OggPage(stream:URLStream) { + + var capture:int = stream.readInt(); + if(capture != 0x5367674f) { + throw new Error("Ogg page does not start with 'OggS': "+capture); + } + + _version = stream.readByte()&0xff; + var tmp:int = stream.readByte(); + + _continued = (tmp&1)!=0;; + _bos = (tmp&2)!=0; + _eos = (tmp&4)!=0; + + // absoluteGranulePosition is really 64 bits + _absoluteGranulePosition = stream.readUnsignedInt(); + stream.readUnsignedInt(); // last 32 bits of _absoluteGranulePosition + + _streamSerialNumber = stream.readUnsignedInt(); + _pageSequenceNumber = stream.readUnsignedInt(); + _pageCheckSum = stream.readUnsignedInt(); + + //trace("_pageSequenceNumber: " + _pageSequenceNumber); + + var pageSegments:int = stream.readUnsignedByte(); + + //stream.waitFor(pageSegments); + + _segmentOffsets = []; + _segmentLengths = []; + _data = new ByteArray(); + + var totalLength:int; + + var i:int; + var l:int; + + for( i= 0 ; i < pageSegments ; i++ ) { + l = stream.readUnsignedByte(); + _segmentLengths.push( l ); + _segmentOffsets.push( totalLength ); + totalLength += l; + } + + stream.readBytes(_data, 0, totalLength); + } + + public function get absoluteGranulePosition():int { + return _absoluteGranulePosition; + } + + public function get segmentOffsets():Array { + return _segmentOffsets; + } + + public function get segmentLengths():Array { + return _segmentLengths; + } + + public function get data():ByteArray { + return _data; + } + + public function get eos():Boolean { + return _eos; + } + + public function get bos():Boolean { + return _bos; + } + + public function get continued():Boolean { + return _continued; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as index 30fc448a83..6e4a34af8d 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as @@ -1,52 +1,52 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.ogg { - - import flash.net.*; - import flash.utils.Endian; - import flash.events.HTTPStatusEvent; - import flash.events.ProgressEvent; - - public class UncachedUrlStream { - - private var source:URLStream; - - public function UncachedUrlStream(source: URLStream) { - this.source = source; - } - - public function get bytesAvailable():int { - return source.bytesAvailable; - } - - public function addEventListener(type:String, listener:Function):void { - source.addEventListener(type, listener); - } - - public function getLogicalOggStream():LogicalOggStream { - return new LogicalOggStream(this); - } - - public function getNextOggPage():OggPage { - return new OggPage(source); - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.ogg { + + import flash.net.*; + import flash.utils.Endian; + import flash.events.HTTPStatusEvent; + import flash.events.ProgressEvent; + + public class UncachedUrlStream { + + private var source:URLStream; + + public function UncachedUrlStream(source: URLStream) { + this.source = source; + } + + public function get bytesAvailable():int { + return source.bytesAvailable; + } + + public function addEventListener(type:String, listener:Function):void { + source.addEventListener(type, listener); + } + + public function getLogicalOggStream():LogicalOggStream { + return new LogicalOggStream(this); + } + + public function getNextOggPage():OggPage { + return new OggPage(source); + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as index d954897b9a..3c54f6f053 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as @@ -1,75 +1,75 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.util { - - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.errors.IllegalOperationError; - - public class BitByteArray extends ByteArray { - - private var currentByte:uint; - private var bitIndex:int = 8; - - public function BitByteArray() { - this.endian = Endian.LITTLE_ENDIAN; - } - - public function readBit():Boolean { - if (bitIndex > 7) { - bitIndex = 0; - currentByte = readUnsignedByte(); - } - return (currentByte & (1 << (bitIndex++))) != 0; - } - - public function readUnsignedBitwiseInt(bits:int):uint { - - var res:uint = 0; - - for (var i : int = 0; i < bits; i++) { - if (bitIndex > 7) { - bitIndex = 0; - currentByte = readUnsignedByte(); - } - if((currentByte & (1 << (bitIndex++))) != 0) { - res |= (1 << i); - } - } - - return res; - } - - public function readUnsignedHuffmanInt(root:HuffmanNode):uint { - - while (!root.hasValue) { - if (bitIndex > 7) { - bitIndex = 0; - currentByte = readUnsignedByte(); - } - root = (currentByte & (1 << (bitIndex++))) != 0 ? root._o1 : root._o0; - } - - return root._value; - } - - } - - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.util { + + import flash.utils.ByteArray; + import flash.utils.Endian; + import flash.errors.IllegalOperationError; + + public class BitByteArray extends ByteArray { + + private var currentByte:uint; + private var bitIndex:int = 8; + + public function BitByteArray() { + this.endian = Endian.LITTLE_ENDIAN; + } + + public function readBit():Boolean { + if (bitIndex > 7) { + bitIndex = 0; + currentByte = readUnsignedByte(); + } + return (currentByte & (1 << (bitIndex++))) != 0; + } + + public function readUnsignedBitwiseInt(bits:int):uint { + + var res:uint = 0; + + for (var i : int = 0; i < bits; i++) { + if (bitIndex > 7) { + bitIndex = 0; + currentByte = readUnsignedByte(); + } + if((currentByte & (1 << (bitIndex++))) != 0) { + res |= (1 << i); + } + } + + return res; + } + + public function readUnsignedHuffmanInt(root:HuffmanNode):uint { + + while (!root.hasValue) { + if (bitIndex > 7) { + bitIndex = 0; + currentByte = readUnsignedByte(); + } + root = (currentByte & (1 << (bitIndex++))) != 0 ? root._o1 : root._o0; + } + + return root._value; + } + + } + + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as index 14a014d474..c8ce3ae7ea 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as @@ -1,92 +1,92 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ -package org.omtk.util { - - public class HuffmanNode { - - private var _parent:HuffmanNode; - - public var _o0:HuffmanNode; - public var _o1:HuffmanNode; - - private var _depth:int; - - public var _value:int; - public var hasValue: Boolean; - private var _full:Boolean = false; - - public function HuffmanNode(parent:HuffmanNode = null, value:int = -1) { - _parent = parent; - if(_parent != null) { - _depth = _parent.depth+1; - } - _value = value; - _full = value >= 0; - hasValue = value >= 0; - } - - public function setNewValue(depth:int, value:uint):Boolean { - if (full) { - return false; - } - if (depth == 1) { - if (_o0 == null) { - _o0 = new HuffmanNode(this, value); - return true; - } else if (_o1 == null) { - _o1 = new HuffmanNode(this, value); - return true; - } else { - return false; - } - } else { - return o0.setNewValue(depth - 1, value) - ? true : o1.setNewValue(depth - 1, value); - } - } - - public function get value():uint { - return _value; - } - - public function get o0():HuffmanNode { - if(_o0 == null) { - _o0 = new HuffmanNode(this); - } - return _o0; - } - - public function get o1():HuffmanNode { - if(_o1 == null) { - _o1 = new HuffmanNode(this); - } - return _o1; - } - - public function get depth():int { - return _depth; - } - - public function get full():Boolean { - return _full ? true - : (_full = (_o0 != null && _o0.full && _o1 != null && _o1.full)); - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ +package org.omtk.util { + + public class HuffmanNode { + + private var _parent:HuffmanNode; + + public var _o0:HuffmanNode; + public var _o1:HuffmanNode; + + private var _depth:int; + + public var _value:int; + public var hasValue: Boolean; + private var _full:Boolean = false; + + public function HuffmanNode(parent:HuffmanNode = null, value:int = -1) { + _parent = parent; + if(_parent != null) { + _depth = _parent.depth+1; + } + _value = value; + _full = value >= 0; + hasValue = value >= 0; + } + + public function setNewValue(depth:int, value:uint):Boolean { + if (full) { + return false; + } + if (depth == 1) { + if (_o0 == null) { + _o0 = new HuffmanNode(this, value); + return true; + } else if (_o1 == null) { + _o1 = new HuffmanNode(this, value); + return true; + } else { + return false; + } + } else { + return o0.setNewValue(depth - 1, value) + ? true : o1.setNewValue(depth - 1, value); + } + } + + public function get value():uint { + return _value; + } + + public function get o0():HuffmanNode { + if(_o0 == null) { + _o0 = new HuffmanNode(this); + } + return _o0; + } + + public function get o1():HuffmanNode { + if(_o1 == null) { + _o1 = new HuffmanNode(this); + } + return _o1; + } + + public function get depth():int { + return _depth; + } + + public function get full():Boolean { + return _full ? true + : (_full = (_o0 != null && _o0.full && _o1 != null && _o1.full)); + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as index 949b6bd6b3..8cec99619e 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as @@ -1,340 +1,340 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.utils.getTimer; - import flash.utils.ByteArray; - import org.omtk.ogg.*; - import org.omtk.util.BitByteArray; - - public class AudioPacket { - - private var modeNumber:int; - private var mode:Mode; - private var mapping:Mapping; - private var n:int; - - private var blockFlag:Boolean; - private var previousWindowFlag:Boolean; - private var nextWindowFlag:Boolean; - - private var windowCenter:int; - private var leftWindowStart:int; - private var leftWindowEnd:int; - private var leftN:int; - private var rightWindowStart:int; - private var rightWindowEnd:int; - private var rightN:int; - - private var window:Vector.; - private var freq0:Vector.; - private var freq1:Vector.; - private var pcm0:Vector.; - private var pcm1:Vector.; - - private var channelFloors:Vector.; - private var noResidues:Vector.; - - private var _lastPacket: Boolean; - private var _lastGranulePosition: int; - - public function AudioPacket(vorbis:VorbisStream, packet: OggPacket, currentGranulePosition: int) { - - var source: BitByteArray = packet.data; - _lastPacket = packet.lastPacket; - _lastGranulePosition = packet.lastGranulePosition; - - var i:int; - var j:int; - var k:int; - - var sHeader:SetupHeader = vorbis.setupHeader; - var iHeader:IdentificationHeader = vorbis.identificationHeader; - var modes:Vector. = sHeader.modes; - var mappings:Vector. = sHeader.mappings; - var residues:Vector. = sHeader.residues; - var channels:int = iHeader.channels; - - if (source.readUnsignedBitwiseInt(1) != 0) { - throw new Error("Packet type mismatch when trying to create an audio packet."); - } - - modeNumber = source.readUnsignedBitwiseInt(Util.ilog(modes.length - 1)); - - mode = modes[modeNumber]; - - if(mode == null) { - throw new Error("Reference to invalid mode in audio packet."); - } - - mapping = mappings[mode.mapping]; - - var magnitudes:Vector. = mapping.magnitudes; - var angles:Vector. = mapping.angles; - - blockFlag = mode.blockFlag; - - var blockSize0:int = iHeader.blockSize0; - var blockSize1:int = iHeader.blockSize1; - - n = blockFlag ? blockSize1 : blockSize0; - - if (blockFlag) { - previousWindowFlag = source.readBit(); - nextWindowFlag = source.readBit(); - } - - windowCenter = n / 2; - - if (blockFlag && !previousWindowFlag) { - leftWindowStart = n / 4 - blockSize0 / 4; - leftWindowEnd = n / 4 + blockSize0 / 4; - leftN = blockSize0 / 2; - } else { - leftWindowStart = 0; - leftWindowEnd = n / 2; - leftN = windowCenter; - } - - if (blockFlag && !nextWindowFlag) { - rightWindowStart = n * 3 / 4 - blockSize0 / 4; - rightWindowEnd = n * 3 / 4 + blockSize0 / 4; - rightN = blockSize0 / 2; - } else { - rightWindowStart = windowCenter; - rightWindowEnd = n; - rightN = n / 2; - } - - window = getComputedWindow(vorbis); - - channelFloors = new Vector.(channels, true); - noResidues = new Vector.(channels, true); - - freq0 = new Vector.(n, true); - freq1 = new Vector.(n, true); - pcm0 = new Vector.(n, true); - pcm1 = new Vector.(n, true); - - var allFloorsEmpty: Boolean = true; - var submapNumber: int; - var floorNumber: int; - var decodedFloor: Floor; - - for(i = 0; i < channels; i++) { - submapNumber = mapping.mux[i]; - floorNumber = mapping.submapFloors[submapNumber]; - decodedFloor = sHeader.floors[floorNumber].decodeFloor(vorbis, source); - channelFloors[i] = decodedFloor; - noResidues[i] = decodedFloor == null; - if (decodedFloor != null) { - allFloorsEmpty = false; - } - } - - if(allFloorsEmpty) { - return; - } - - var mag: int; - var ang: int; - - for(i = 0; i < magnitudes.length; i++) { - mag = magnitudes[i]; - ang = angles[i]; - if (!noResidues[mag] || !noResidues[ang]) { - noResidues[mag] = false; - noResidues[ang] = false; - } - } - - var ch: int; - var doNotDecodeFlags: Vector.; - var residue:Residue; - - for(i = 0; i < mapping.submaps; i++) { - - doNotDecodeFlags = new Vector.(); - - for(j = 0; j < channels; j++) { - if(mapping.mux[j] == i) { - doNotDecodeFlags.push(noResidues[j]); - } - } - - residue = residues[mapping.submapResidues[i]]; - - residue.decodeResidue(vorbis, source, mode, ch, doNotDecodeFlags, freq0, freq1); - } - - var a: Number; - var m: Number; - - for(i = mapping.couplingSteps - 1; i >= 0; i--) { - - mag = magnitudes[i]; - ang = angles[i]; - - for (j = 0; j < freq0.length; j++) { - - a = ang == 0 ? freq0[j] : freq1[j]; - m = mag == 0 ? freq0[j] : freq1[j]; - - if(a > 0) { - if(ang == 0) { - freq0[j] = m > 0 ? m - a : m + a; - } - else { - freq1[j] = m > 0 ? m - a : m + a; - } - } - else { - if(mag == 0) { - freq0[j] = m > 0 ? m + a : m - a; - } - else { - freq1[j] = m > 0 ? m + a : m - a; - } - - if(ang == 0) { - freq0[j] = m; - } - else { - freq1[j] = m; - } - } - } - } - - if(channelFloors[0] != null) { - Floor(channelFloors[0]).computeFloor(freq0); - } - - if(channelFloors[1] != null) { - Floor(channelFloors[1]).computeFloor(freq1); - } - - // perform an inverse mdct to all channels - var mdct: Mdct = blockFlag ? iHeader.mdct1 : iHeader.mdct0; - mdct.imdct(freq0, window, pcm0); - mdct.imdct(freq1, window, pcm1); - - if(_lastPacket) { - if(leftWindowEnd - leftWindowStart > _lastGranulePosition - currentGranulePosition) { - leftWindowEnd = leftWindowStart + _lastGranulePosition - currentGranulePosition - } - if(rightWindowStart - leftWindowStart > _lastGranulePosition - currentGranulePosition) { - rightWindowStart = leftWindowStart + _lastGranulePosition - currentGranulePosition - } - } - - } - - private function getComputedWindow(vorbis:VorbisStream):Vector. { - - var i:int; - - var ix:int = (blockFlag ? 4 : 0) + (previousWindowFlag ? 2 : 0) + (nextWindowFlag ? 1 : 0); - var w:Vector. = vorbis.windows[ix]; - - var x:Number; - - if (w == null) { - w = new Vector.(n); - - for(i = 0; i < leftWindowStart; i++) { - w[i] = 0; - } - - for (i = 0; i < leftN; i++) { - x = (i + .5) / leftN * Math.PI / 2.; - x = Math.sin(x); - x *= x; - x *= Math.PI / 2.; - x = Math.sin(x); - w[i + leftWindowStart] = x; - } - - for (i = leftWindowEnd; i < rightWindowStart; i++) { - w[i] = 1; - } - - for (i = 0; i < rightN; i++) { - x = (rightN - i - .5) / rightN * Math.PI / 2.; - x = Math.sin(x); - x *= x; - x *= Math.PI / 2.; - x = Math.sin(x); - w[i + rightWindowStart] = x; - } - - for(i = rightN + rightWindowStart; i < n; i++) { - w[i] = 0; - } - - for(i = 0; i < w.length; i++) { - w[i] *= 0.5; - } - - vorbis.windows[ix] = w; - } - - return w; - } - - - public function readPcm(previousPacket:AudioPacket, target: ByteArray): int { - - var j:int; - var j2:int; - var ppcm0:Vector. = previousPacket.pcm0; - var ppcm1:Vector. = previousPacket.pcm1; - - j2 = previousPacket.rightWindowStart; - - for(j = leftWindowStart; j < leftWindowEnd; j++) { - target.writeFloat(pcm0[j] + ppcm0[j2]); - target.writeFloat(pcm1[j] + ppcm1[j2++]); - } - - for (j = leftWindowEnd; j < rightWindowStart; j++) { - target.writeFloat(pcm0[j]); - target.writeFloat(pcm1[j]); - } - - return numberOfSamples; - - } - - public function get numberOfSamples():int { - return rightWindowStart - leftWindowStart; - } - - public function get lastPacket(): Boolean { - return lastPacket; - } - - public function get lastGranulePosition(): int { - return lastGranulePosition; - } - - } - - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.utils.getTimer; + import flash.utils.ByteArray; + import org.omtk.ogg.*; + import org.omtk.util.BitByteArray; + + public class AudioPacket { + + private var modeNumber:int; + private var mode:Mode; + private var mapping:Mapping; + private var n:int; + + private var blockFlag:Boolean; + private var previousWindowFlag:Boolean; + private var nextWindowFlag:Boolean; + + private var windowCenter:int; + private var leftWindowStart:int; + private var leftWindowEnd:int; + private var leftN:int; + private var rightWindowStart:int; + private var rightWindowEnd:int; + private var rightN:int; + + private var window:Vector.; + private var freq0:Vector.; + private var freq1:Vector.; + private var pcm0:Vector.; + private var pcm1:Vector.; + + private var channelFloors:Vector.; + private var noResidues:Vector.; + + private var _lastPacket: Boolean; + private var _lastGranulePosition: int; + + public function AudioPacket(vorbis:VorbisStream, packet: OggPacket, currentGranulePosition: int) { + + var source: BitByteArray = packet.data; + _lastPacket = packet.lastPacket; + _lastGranulePosition = packet.lastGranulePosition; + + var i:int; + var j:int; + var k:int; + + var sHeader:SetupHeader = vorbis.setupHeader; + var iHeader:IdentificationHeader = vorbis.identificationHeader; + var modes:Vector. = sHeader.modes; + var mappings:Vector. = sHeader.mappings; + var residues:Vector. = sHeader.residues; + var channels:int = iHeader.channels; + + if (source.readUnsignedBitwiseInt(1) != 0) { + throw new Error("Packet type mismatch when trying to create an audio packet."); + } + + modeNumber = source.readUnsignedBitwiseInt(Util.ilog(modes.length - 1)); + + mode = modes[modeNumber]; + + if(mode == null) { + throw new Error("Reference to invalid mode in audio packet."); + } + + mapping = mappings[mode.mapping]; + + var magnitudes:Vector. = mapping.magnitudes; + var angles:Vector. = mapping.angles; + + blockFlag = mode.blockFlag; + + var blockSize0:int = iHeader.blockSize0; + var blockSize1:int = iHeader.blockSize1; + + n = blockFlag ? blockSize1 : blockSize0; + + if (blockFlag) { + previousWindowFlag = source.readBit(); + nextWindowFlag = source.readBit(); + } + + windowCenter = n / 2; + + if (blockFlag && !previousWindowFlag) { + leftWindowStart = n / 4 - blockSize0 / 4; + leftWindowEnd = n / 4 + blockSize0 / 4; + leftN = blockSize0 / 2; + } else { + leftWindowStart = 0; + leftWindowEnd = n / 2; + leftN = windowCenter; + } + + if (blockFlag && !nextWindowFlag) { + rightWindowStart = n * 3 / 4 - blockSize0 / 4; + rightWindowEnd = n * 3 / 4 + blockSize0 / 4; + rightN = blockSize0 / 2; + } else { + rightWindowStart = windowCenter; + rightWindowEnd = n; + rightN = n / 2; + } + + window = getComputedWindow(vorbis); + + channelFloors = new Vector.(channels, true); + noResidues = new Vector.(channels, true); + + freq0 = new Vector.(n, true); + freq1 = new Vector.(n, true); + pcm0 = new Vector.(n, true); + pcm1 = new Vector.(n, true); + + var allFloorsEmpty: Boolean = true; + var submapNumber: int; + var floorNumber: int; + var decodedFloor: Floor; + + for(i = 0; i < channels; i++) { + submapNumber = mapping.mux[i]; + floorNumber = mapping.submapFloors[submapNumber]; + decodedFloor = sHeader.floors[floorNumber].decodeFloor(vorbis, source); + channelFloors[i] = decodedFloor; + noResidues[i] = decodedFloor == null; + if (decodedFloor != null) { + allFloorsEmpty = false; + } + } + + if(allFloorsEmpty) { + return; + } + + var mag: int; + var ang: int; + + for(i = 0; i < magnitudes.length; i++) { + mag = magnitudes[i]; + ang = angles[i]; + if (!noResidues[mag] || !noResidues[ang]) { + noResidues[mag] = false; + noResidues[ang] = false; + } + } + + var ch: int; + var doNotDecodeFlags: Vector.; + var residue:Residue; + + for(i = 0; i < mapping.submaps; i++) { + + doNotDecodeFlags = new Vector.(); + + for(j = 0; j < channels; j++) { + if(mapping.mux[j] == i) { + doNotDecodeFlags.push(noResidues[j]); + } + } + + residue = residues[mapping.submapResidues[i]]; + + residue.decodeResidue(vorbis, source, mode, ch, doNotDecodeFlags, freq0, freq1); + } + + var a: Number; + var m: Number; + + for(i = mapping.couplingSteps - 1; i >= 0; i--) { + + mag = magnitudes[i]; + ang = angles[i]; + + for (j = 0; j < freq0.length; j++) { + + a = ang == 0 ? freq0[j] : freq1[j]; + m = mag == 0 ? freq0[j] : freq1[j]; + + if(a > 0) { + if(ang == 0) { + freq0[j] = m > 0 ? m - a : m + a; + } + else { + freq1[j] = m > 0 ? m - a : m + a; + } + } + else { + if(mag == 0) { + freq0[j] = m > 0 ? m + a : m - a; + } + else { + freq1[j] = m > 0 ? m + a : m - a; + } + + if(ang == 0) { + freq0[j] = m; + } + else { + freq1[j] = m; + } + } + } + } + + if(channelFloors[0] != null) { + Floor(channelFloors[0]).computeFloor(freq0); + } + + if(channelFloors[1] != null) { + Floor(channelFloors[1]).computeFloor(freq1); + } + + // perform an inverse mdct to all channels + var mdct: Mdct = blockFlag ? iHeader.mdct1 : iHeader.mdct0; + mdct.imdct(freq0, window, pcm0); + mdct.imdct(freq1, window, pcm1); + + if(_lastPacket) { + if(leftWindowEnd - leftWindowStart > _lastGranulePosition - currentGranulePosition) { + leftWindowEnd = leftWindowStart + _lastGranulePosition - currentGranulePosition + } + if(rightWindowStart - leftWindowStart > _lastGranulePosition - currentGranulePosition) { + rightWindowStart = leftWindowStart + _lastGranulePosition - currentGranulePosition + } + } + + } + + private function getComputedWindow(vorbis:VorbisStream):Vector. { + + var i:int; + + var ix:int = (blockFlag ? 4 : 0) + (previousWindowFlag ? 2 : 0) + (nextWindowFlag ? 1 : 0); + var w:Vector. = vorbis.windows[ix]; + + var x:Number; + + if (w == null) { + w = new Vector.(n); + + for(i = 0; i < leftWindowStart; i++) { + w[i] = 0; + } + + for (i = 0; i < leftN; i++) { + x = (i + .5) / leftN * Math.PI / 2.; + x = Math.sin(x); + x *= x; + x *= Math.PI / 2.; + x = Math.sin(x); + w[i + leftWindowStart] = x; + } + + for (i = leftWindowEnd; i < rightWindowStart; i++) { + w[i] = 1; + } + + for (i = 0; i < rightN; i++) { + x = (rightN - i - .5) / rightN * Math.PI / 2.; + x = Math.sin(x); + x *= x; + x *= Math.PI / 2.; + x = Math.sin(x); + w[i + rightWindowStart] = x; + } + + for(i = rightN + rightWindowStart; i < n; i++) { + w[i] = 0; + } + + for(i = 0; i < w.length; i++) { + w[i] *= 0.5; + } + + vorbis.windows[ix] = w; + } + + return w; + } + + + public function readPcm(previousPacket:AudioPacket, target: ByteArray): int { + + var j:int; + var j2:int; + var ppcm0:Vector. = previousPacket.pcm0; + var ppcm1:Vector. = previousPacket.pcm1; + + j2 = previousPacket.rightWindowStart; + + for(j = leftWindowStart; j < leftWindowEnd; j++) { + target.writeFloat(pcm0[j] + ppcm0[j2]); + target.writeFloat(pcm1[j] + ppcm1[j2++]); + } + + for (j = leftWindowEnd; j < rightWindowStart; j++) { + target.writeFloat(pcm0[j]); + target.writeFloat(pcm1[j]); + } + + return numberOfSamples; + + } + + public function get numberOfSamples():int { + return rightWindowStart - leftWindowStart; + } + + public function get lastPacket(): Boolean { + return lastPacket; + } + + public function get lastGranulePosition(): int { + return lastGranulePosition; + } + + } + + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as index 27137aa3c1..ed84041e08 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as @@ -1,223 +1,223 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.*; - - public class CodeBook { - - private var entries:uint; - private var entryLengths:Vector.; - private var valueVector:Vector.>; - - private var codeBookLookupType:int = -1; - - public var huffmanRoot:HuffmanNode; - public var dimensions:uint; - - public function CodeBook( source: BitByteArray ) { - - var i:int; - var j:int; - - var syncPattern:uint = source.readUnsignedBitwiseInt(24); - if(syncPattern !=0x564342) { - throw new IllegalOperationError("Illegal codebook sync pattern: "+syncPattern); - } - - dimensions = source.readUnsignedBitwiseInt(16); - entries = source.readUnsignedBitwiseInt(24); - - entryLengths = new Vector.(entries); - - var ordered:Boolean = source.readBit(); - - if(ordered) { - var cl:int = source.readUnsignedBitwiseInt(5)+1; - for(i=0; ientryLengths.length) { - throw new Error("The codebook entry length list is longer than the actual number of entry lengths."); - } - for(j=i; j = new Vector.(codeBookLookupValues); - - for(i=0; i < codeBookMultiplicands.length; i++) { - codeBookMultiplicands[i]=source.readUnsignedBitwiseInt(codeBookValueBits); - } - - valueVector = new Vector.>(entries); - - if(codeBookLookupType==1) { - for(i=0; i(dimensions); - var last:Number = 0.0; - var indexDivisor:uint = 1; - for(j=0; j):Boolean { - - var i:int; - - huffmanRoot = new HuffmanNode(); - for(i=0; i0) { - if(!huffmanRoot.setNewValue(el, i)) { - return false; - } - } - } - return true; - } - - - public function readVvAdd(a0:Vector., a1:Vector., left:Boolean, right:Boolean, source:BitByteArray, offset:int, length:int):void { - - var i:int; - var j:int; - - if (!left && !right) { - return; - } - - // 1 or 2 channels - var ch:int = - left && right ? 2 : 1; - - var lim:int; - var ix:int; - var ve:Vector.; - - if(left && right) { - lim = (offset + length) / 2; - var chptr:int = 0; - for (i = offset / 2; i < lim;) { - ix = source.readUnsignedHuffmanInt(huffmanRoot); - ve = valueVector[ix]; - for (j = 0; j < dimensions; j++) { - if(chptr == 0) { - a0[i] += ve[j]; - } - else { - a1[i] += ve[j]; - } - chptr++; - if(chptr == 2) { - chptr = 0; - i++; - } - } - } - } - else { - var a : Vector. = left ? a0 : a1; - lim = offset + length; - for (i = offset; i < lim;) { - ve = valueVector[source.readUnsignedHuffmanInt(huffmanRoot)]; - for (j = 0; j < dimensions; j++) { - a[i] += ve[j]; - i++; - } - } - } - - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.*; + + public class CodeBook { + + private var entries:uint; + private var entryLengths:Vector.; + private var valueVector:Vector.>; + + private var codeBookLookupType:int = -1; + + public var huffmanRoot:HuffmanNode; + public var dimensions:uint; + + public function CodeBook( source: BitByteArray ) { + + var i:int; + var j:int; + + var syncPattern:uint = source.readUnsignedBitwiseInt(24); + if(syncPattern !=0x564342) { + throw new IllegalOperationError("Illegal codebook sync pattern: "+syncPattern); + } + + dimensions = source.readUnsignedBitwiseInt(16); + entries = source.readUnsignedBitwiseInt(24); + + entryLengths = new Vector.(entries); + + var ordered:Boolean = source.readBit(); + + if(ordered) { + var cl:int = source.readUnsignedBitwiseInt(5)+1; + for(i=0; ientryLengths.length) { + throw new Error("The codebook entry length list is longer than the actual number of entry lengths."); + } + for(j=i; j = new Vector.(codeBookLookupValues); + + for(i=0; i < codeBookMultiplicands.length; i++) { + codeBookMultiplicands[i]=source.readUnsignedBitwiseInt(codeBookValueBits); + } + + valueVector = new Vector.>(entries); + + if(codeBookLookupType==1) { + for(i=0; i(dimensions); + var last:Number = 0.0; + var indexDivisor:uint = 1; + for(j=0; j):Boolean { + + var i:int; + + huffmanRoot = new HuffmanNode(); + for(i=0; i0) { + if(!huffmanRoot.setNewValue(el, i)) { + return false; + } + } + } + return true; + } + + + public function readVvAdd(a0:Vector., a1:Vector., left:Boolean, right:Boolean, source:BitByteArray, offset:int, length:int):void { + + var i:int; + var j:int; + + if (!left && !right) { + return; + } + + // 1 or 2 channels + var ch:int = + left && right ? 2 : 1; + + var lim:int; + var ix:int; + var ve:Vector.; + + if(left && right) { + lim = (offset + length) / 2; + var chptr:int = 0; + for (i = offset / 2; i < lim;) { + ix = source.readUnsignedHuffmanInt(huffmanRoot); + ve = valueVector[ix]; + for (j = 0; j < dimensions; j++) { + if(chptr == 0) { + a0[i] += ve[j]; + } + else { + a1[i] += ve[j]; + } + chptr++; + if(chptr == 2) { + chptr = 0; + i++; + } + } + } + } + else { + var a : Vector. = left ? a0 : a1; + lim = offset + length; + for (i = offset; i < lim;) { + ve = valueVector[source.readUnsignedHuffmanInt(huffmanRoot)]; + for (j = 0; j < dimensions; j++) { + a[i] += ve[j]; + i++; + } + } + } + + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as index 81885a63df..6cf3bfded5 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as @@ -1,81 +1,81 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.utils.Dictionary; - import org.omtk.ogg.*; - - public class CommentHeader { - - private var _vendor:String; - private var _comments:Dictionary = new Dictionary(); - - public function CommentHeader(source:ByteArray) - { - init( source ); - } - - private function init( source: ByteArray ): void - { - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - - _vendor = readUtf8String(source); - - var ucLength:int = source.readUnsignedInt(); - - for(var i:int = 0; i < ucLength; i++) { - var comment:String = readUtf8String(source); - var ix:int = comment.indexOf('='); - var key:String = comment.substring(0, ix); - var value:String = comment.substring(ix+1); - _comments[key.toUpperCase()]=value; - } - } - - private function readUtf8String(source:ByteArray):String { - var length:uint = source.readUnsignedInt(); - return source.readUTFBytes(length); - } - - public function get vendor():String { - return _vendor; - } - - public function get comments():Dictionary { - return _comments; - } - - public function get artist():String { - return _comments["ARTIST"]; - } - - public function get title():String { - return _comments["TITLE"]; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.utils.ByteArray; + import flash.utils.Endian; + import flash.utils.Dictionary; + import org.omtk.ogg.*; + + public class CommentHeader { + + private var _vendor:String; + private var _comments:Dictionary = new Dictionary(); + + public function CommentHeader(source:ByteArray) + { + init( source ); + } + + private function init( source: ByteArray ): void + { + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + + _vendor = readUtf8String(source); + + var ucLength:int = source.readUnsignedInt(); + + for(var i:int = 0; i < ucLength; i++) { + var comment:String = readUtf8String(source); + var ix:int = comment.indexOf('='); + var key:String = comment.substring(0, ix); + var value:String = comment.substring(ix+1); + _comments[key.toUpperCase()]=value; + } + } + + private function readUtf8String(source:ByteArray):String { + var length:uint = source.readUnsignedInt(); + return source.readUTFBytes(length); + } + + public function get vendor():String { + return _vendor; + } + + public function get comments():Dictionary { + return _comments; + } + + public function get artist():String { + return _comments["ARTIST"]; + } + + public function get title():String { + return _comments["TITLE"]; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as index 24295d5fb2..f8eac3ba22 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as @@ -1,122 +1,122 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.BitByteArray; - - public class Floor { - - public static const DB_STATIC_TABLE:Vector. = Vector.([ - 1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, - 1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, - 1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.128753e-07, - 2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, - 2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, - 3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, - 4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, - 6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, - 7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, - 1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, - 1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, - 1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, - 2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, - 2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, - 3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, - 4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, - 5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, - 7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, - 9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, - 1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, - 1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, - 2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, - 2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, - 3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, - 4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, - 5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, - 7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, - 9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, - 0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, - 0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, - 0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, - 0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, - 0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, - 0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, - 0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, - 0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, - 0.00092223983, 0.00098217216, 0.0010459992, 0.0011139742, - 0.0011863665, 0.0012634633, 0.0013455702, 0.0014330129, - 0.0015261382, 0.0016253153, 0.0017309374, 0.0018434235, - 0.0019632195, 0.0020908006, 0.0022266726, 0.0023713743, - 0.0025254795, 0.0026895994, 0.0028643847, 0.0030505286, - 0.0032487691, 0.0034598925, 0.0036847358, 0.0039241906, - 0.0041792066, 0.0044507950, 0.0047400328, 0.0050480668, - 0.0053761186, 0.0057254891, 0.0060975636, 0.0064938176, - 0.0069158225, 0.0073652516, 0.0078438871, 0.0083536271, - 0.0088964928, 0.009474637, 0.010090352, 0.010746080, - 0.011444421, 0.012188144, 0.012980198, 0.013823725, - 0.014722068, 0.015678791, 0.016697687, 0.017782797, - 0.018938423, 0.020169149, 0.021479854, 0.022875735, - 0.024362330, 0.025945531, 0.027631618, 0.029427276, - 0.031339626, 0.033376252, 0.035545228, 0.037855157, - 0.040315199, 0.042935108, 0.045725273, 0.048696758, - 0.051861348, 0.055231591, 0.058820850, 0.062643361, - 0.066714279, 0.071049749, 0.075666962, 0.080584227, - 0.085821044, 0.091398179, 0.097337747, 0.10366330, - 0.11039993, 0.11757434, 0.12521498, 0.13335215, - 0.14201813, 0.15124727, 0.16107617, 0.17154380, - 0.18269168, 0.19456402, 0.20720788, 0.22067342, - 0.23501402, 0.25028656, 0.26655159, 0.28387361, - 0.30232132, 0.32196786, 0.34289114, 0.36517414, - 0.38890521, 0.41417847, 0.44109412, 0.46975890, - 0.50028648, 0.53279791, 0.56742212, 0.60429640, - 0.64356699, 0.68538959, 0.72993007, 0.77736504, - 0.82788260, 0.88168307, 0.9389798, 1.0]); - - public static function createInstance(source:BitByteArray, header:SetupHeader):Floor { - - var type:int = source.readUnsignedBitwiseInt(16); - - switch (type) { - case 0: - return new Floor0(source, header); - case 1: - return new Floor1(source, header); - default: - throw new Error("Floor type " + type + " is not supported."); - } - } - - public function get type():int { - throw new IllegalOperationError("operation not implemented"); - } - - public function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { - throw new IllegalOperationError("operation not implemented"); - } - - public function computeFloor(vector:Vector.):void { - throw new IllegalOperationError("operation not implemented"); - } - - - } - - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.BitByteArray; + + public class Floor { + + public static const DB_STATIC_TABLE:Vector. = Vector.([ + 1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, + 1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, + 1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.128753e-07, + 2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, + 2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, + 3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, + 4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, + 6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, + 7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, + 1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, + 1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, + 1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, + 2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, + 2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, + 3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, + 4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, + 5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, + 7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, + 9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, + 1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, + 1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, + 2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, + 2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, + 3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, + 4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, + 5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, + 7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, + 9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, + 0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, + 0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, + 0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, + 0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, + 0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, + 0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, + 0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, + 0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, + 0.00092223983, 0.00098217216, 0.0010459992, 0.0011139742, + 0.0011863665, 0.0012634633, 0.0013455702, 0.0014330129, + 0.0015261382, 0.0016253153, 0.0017309374, 0.0018434235, + 0.0019632195, 0.0020908006, 0.0022266726, 0.0023713743, + 0.0025254795, 0.0026895994, 0.0028643847, 0.0030505286, + 0.0032487691, 0.0034598925, 0.0036847358, 0.0039241906, + 0.0041792066, 0.0044507950, 0.0047400328, 0.0050480668, + 0.0053761186, 0.0057254891, 0.0060975636, 0.0064938176, + 0.0069158225, 0.0073652516, 0.0078438871, 0.0083536271, + 0.0088964928, 0.009474637, 0.010090352, 0.010746080, + 0.011444421, 0.012188144, 0.012980198, 0.013823725, + 0.014722068, 0.015678791, 0.016697687, 0.017782797, + 0.018938423, 0.020169149, 0.021479854, 0.022875735, + 0.024362330, 0.025945531, 0.027631618, 0.029427276, + 0.031339626, 0.033376252, 0.035545228, 0.037855157, + 0.040315199, 0.042935108, 0.045725273, 0.048696758, + 0.051861348, 0.055231591, 0.058820850, 0.062643361, + 0.066714279, 0.071049749, 0.075666962, 0.080584227, + 0.085821044, 0.091398179, 0.097337747, 0.10366330, + 0.11039993, 0.11757434, 0.12521498, 0.13335215, + 0.14201813, 0.15124727, 0.16107617, 0.17154380, + 0.18269168, 0.19456402, 0.20720788, 0.22067342, + 0.23501402, 0.25028656, 0.26655159, 0.28387361, + 0.30232132, 0.32196786, 0.34289114, 0.36517414, + 0.38890521, 0.41417847, 0.44109412, 0.46975890, + 0.50028648, 0.53279791, 0.56742212, 0.60429640, + 0.64356699, 0.68538959, 0.72993007, 0.77736504, + 0.82788260, 0.88168307, 0.9389798, 1.0]); + + public static function createInstance(source:BitByteArray, header:SetupHeader):Floor { + + var type:int = source.readUnsignedBitwiseInt(16); + + switch (type) { + case 0: + return new Floor0(source, header); + case 1: + return new Floor1(source, header); + default: + throw new Error("Floor type " + type + " is not supported."); + } + } + + public function get type():int { + throw new IllegalOperationError("operation not implemented"); + } + + public function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { + throw new IllegalOperationError("operation not implemented"); + } + + public function computeFloor(vector:Vector.):void { + throw new IllegalOperationError("operation not implemented"); + } + + + } + + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as index 064a0a1ae8..3f38dc842f 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as @@ -1,56 +1,56 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.BitByteArray; - - public class Floor0 extends Floor { - - private var order:int; - private var rate:int; - private var barkMapSize:int; - private var amplitudeBits:int; - private var amplitudeOffset:int; - - private var bookList:Vector.; - - public function Floor0(source:BitByteArray, header:SetupHeader) { - - order = source.readUnsignedBitwiseInt(8); - rate = source.readUnsignedBitwiseInt(16); - barkMapSize = source.readUnsignedBitwiseInt(16); - amplitudeBits = source.readUnsignedBitwiseInt(6); - amplitudeOffset = source.readUnsignedBitwiseInt(8); - - var bookCount:uint = source.readUnsignedBitwiseInt(4) + 1; - bookList = new Vector.(bookCount); - - var i:int; - - for (i = 0; i < bookList.length; i++) { - bookList[i] = source.readUnsignedBitwiseInt(8); - if (bookList[i] > header.codeBooks.length) { - throw new Error("A floor0_book_list entry is higher than the code book count."); - } - } - } - - } +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.BitByteArray; + + public class Floor0 extends Floor { + + private var order:int; + private var rate:int; + private var barkMapSize:int; + private var amplitudeBits:int; + private var amplitudeOffset:int; + + private var bookList:Vector.; + + public function Floor0(source:BitByteArray, header:SetupHeader) { + + order = source.readUnsignedBitwiseInt(8); + rate = source.readUnsignedBitwiseInt(16); + barkMapSize = source.readUnsignedBitwiseInt(16); + amplitudeBits = source.readUnsignedBitwiseInt(6); + amplitudeOffset = source.readUnsignedBitwiseInt(8); + + var bookCount:uint = source.readUnsignedBitwiseInt(4) + 1; + bookList = new Vector.(bookCount); + + var i:int; + + for (i = 0; i < bookList.length; i++) { + bookList[i] = source.readUnsignedBitwiseInt(8); + if (bookList[i] > header.codeBooks.length) { + throw new Error("A floor0_book_list entry is higher than the code book count."); + } + } + } + + } } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as index 068d8177c0..70621d0a3b 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as @@ -1,278 +1,278 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.*; - - public class Floor1 extends Floor { - - private var partitionClassList:Vector.; - private var maximumClass:int; - private var multiplier:int; - private var rangeBits:int; - private var classDimensions:Vector.; - private var classSubclasses:Vector.; - private var classMasterbooks:Vector.; - private var subclassBooks:Vector.>; - private var xList:Vector.; - private var yList:Vector.; - private var lowNeighbours:Vector.; - private var highNeighbours:Vector.; - private static var RANGES:Vector. = Vector.([256, 128, 86, 64]); - - private var xList2:Vector.; - private var step2Flags:Vector.; - - public function Floor1(source:BitByteArray = null, header:SetupHeader = null) { - - if(source==null && header==null) { - return; - } - - var i:int; - var j:int; - - maximumClass = -1; - var partitions:int = source.readUnsignedBitwiseInt(5); - partitionClassList = new Vector.(partitions); - - for (i = 0; i < partitionClassList.length; i++) { - partitionClassList[i] = source.readUnsignedBitwiseInt(4); - if (partitionClassList[i] > maximumClass) { - maximumClass = partitionClassList[i]; - } - } - - classDimensions = new Vector.(maximumClass + 1); - classSubclasses = new Vector.(maximumClass + 1); - classMasterbooks = new Vector.(maximumClass + 1); - subclassBooks = new Vector.>(maximumClass + 1); - - var xListLength:int = 2; - - for (i = 0; i <= maximumClass; i++) { - classDimensions[i] = source.readUnsignedBitwiseInt(3) + 1; - xListLength += classDimensions[i]; - classSubclasses[i] = source.readUnsignedBitwiseInt(2); - - if (classDimensions[i] > header.codeBooks.length || classSubclasses[i] > header.codeBooks.length) { - throw new Error("There is a class dimension or class subclasses entry higher than the number of codebooks in the setup header."); - } - if (classSubclasses[i] != 0) { - classMasterbooks[i] = source.readUnsignedBitwiseInt(8); - } - subclassBooks[i] = new Vector.(1 << classSubclasses[i]); - for (j = 0; j < subclassBooks[i].length; j++) { - subclassBooks[i][j] = source.readUnsignedBitwiseInt(8) - 1; - } - } - - multiplier = source.readUnsignedBitwiseInt(2) + 1; - rangeBits = source.readUnsignedBitwiseInt(4); - - var floorValues:int = 0; - - xList = Vector.([0, 1<(xList.length); - highNeighbours = new Vector.(xList.length); - - for (i = 0; i < xList.length; i++) { - lowNeighbours[i] = Util.lowNeighbour(xList, i); - highNeighbours[i] = Util.highNeighbour(xList, i); - } - - xList2 = new Vector.(xList.length, true); - step2Flags = new Vector.(xList.length, true); - } - - public override function get type():int { - return 1; - } - - public override function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { - - var i:int; - var j:int; - var offset:int; - - if (!source.readBit()) { - return null; - } - - var clone:Floor1 = clone(); - - clone.yList = new Vector.(xList.length); - - var range:int = RANGES[multiplier - 1]; - - clone.yList[0] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); - clone.yList[1] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); - - offset = 2; - - for (i = 0; i < partitionClassList.length; i++) { - var cls:int = partitionClassList[i]; - var cdim:int = classDimensions[cls]; - var cbits:int = classSubclasses[cls]; - var csub:int = (1 << cbits) - 1; - var cval:int = 0; - if (cbits > 0) { - cval = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[classMasterbooks[cls]].huffmanRoot); - } - - for (j = 0; j < cdim; j++) { - var book:int = subclassBooks[cls][cval & csub]; - cval >>>= cbits; - if (book >= 0) { - clone.yList[j + offset] = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[book].huffmanRoot); - } else { - clone.yList[j + offset] = 0; - } - } - offset += cdim; - } - - return clone; - } - - public override function computeFloor(vector:Vector.):void { - - var i:int; - var j:int; - - var n:int = vector.length; - var values:int = xList.length; - //var step2Flags:Vector. = new Vector.(values); - - var range:int = RANGES[multiplier - 1]; - - for (i = 2; i < values; i++) { - - var lowNeighbourOffset:int = lowNeighbours[i]; - var highNeighbourOffset:int = highNeighbours[i]; - - var predicted:int = Util.renderPoint( - xList[lowNeighbourOffset], xList[highNeighbourOffset], - yList[lowNeighbourOffset], yList[highNeighbourOffset], xList[i]); - - var val:int = yList[i]; - var highRoom:int = range - predicted; - var lowRoom:int = predicted; - var room:int = highRoom < lowRoom ? highRoom * 2 : lowRoom * 2; - - if (val != 0) { - step2Flags[lowNeighbourOffset] = true; - step2Flags[highNeighbourOffset] = true; - step2Flags[i] = true; - if (val >= room) { - yList[i] = highRoom > lowRoom ? val - lowRoom + predicted - : -val + highRoom + predicted - 1; - } else { - yList[i] = (val & 1) == 1 ? predicted - ((val + 1) >> 1) - : predicted + (val >> 1); - } - } else { - step2Flags[i] = false; - yList[i] = predicted; - } - } - - for(i=0; i, y:Vector., b:Vector.):void { - var off:int = 0; - var len:int = x.length; - var lim:int = len + off; - var itmp:int; - var btmp:Boolean; - var i:int; - var j:int; - // Insertion sort on smallest arrays - for (i = off; i < lim; i++) { - for (j = i; j > off && x[j - 1] > x[j]; j--) { - itmp = x[j]; - x[j] = x[j - 1]; - x[j - 1] = itmp; - itmp = y[j]; - y[j] = y[j - 1]; - y[j - 1] = itmp; - btmp = b[j]; - b[j] = b[j - 1]; - b[j - 1] = btmp; - } - } - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.*; + + public class Floor1 extends Floor { + + private var partitionClassList:Vector.; + private var maximumClass:int; + private var multiplier:int; + private var rangeBits:int; + private var classDimensions:Vector.; + private var classSubclasses:Vector.; + private var classMasterbooks:Vector.; + private var subclassBooks:Vector.>; + private var xList:Vector.; + private var yList:Vector.; + private var lowNeighbours:Vector.; + private var highNeighbours:Vector.; + private static var RANGES:Vector. = Vector.([256, 128, 86, 64]); + + private var xList2:Vector.; + private var step2Flags:Vector.; + + public function Floor1(source:BitByteArray = null, header:SetupHeader = null) { + + if(source==null && header==null) { + return; + } + + var i:int; + var j:int; + + maximumClass = -1; + var partitions:int = source.readUnsignedBitwiseInt(5); + partitionClassList = new Vector.(partitions); + + for (i = 0; i < partitionClassList.length; i++) { + partitionClassList[i] = source.readUnsignedBitwiseInt(4); + if (partitionClassList[i] > maximumClass) { + maximumClass = partitionClassList[i]; + } + } + + classDimensions = new Vector.(maximumClass + 1); + classSubclasses = new Vector.(maximumClass + 1); + classMasterbooks = new Vector.(maximumClass + 1); + subclassBooks = new Vector.>(maximumClass + 1); + + var xListLength:int = 2; + + for (i = 0; i <= maximumClass; i++) { + classDimensions[i] = source.readUnsignedBitwiseInt(3) + 1; + xListLength += classDimensions[i]; + classSubclasses[i] = source.readUnsignedBitwiseInt(2); + + if (classDimensions[i] > header.codeBooks.length || classSubclasses[i] > header.codeBooks.length) { + throw new Error("There is a class dimension or class subclasses entry higher than the number of codebooks in the setup header."); + } + if (classSubclasses[i] != 0) { + classMasterbooks[i] = source.readUnsignedBitwiseInt(8); + } + subclassBooks[i] = new Vector.(1 << classSubclasses[i]); + for (j = 0; j < subclassBooks[i].length; j++) { + subclassBooks[i][j] = source.readUnsignedBitwiseInt(8) - 1; + } + } + + multiplier = source.readUnsignedBitwiseInt(2) + 1; + rangeBits = source.readUnsignedBitwiseInt(4); + + var floorValues:int = 0; + + xList = Vector.([0, 1<(xList.length); + highNeighbours = new Vector.(xList.length); + + for (i = 0; i < xList.length; i++) { + lowNeighbours[i] = Util.lowNeighbour(xList, i); + highNeighbours[i] = Util.highNeighbour(xList, i); + } + + xList2 = new Vector.(xList.length, true); + step2Flags = new Vector.(xList.length, true); + } + + public override function get type():int { + return 1; + } + + public override function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { + + var i:int; + var j:int; + var offset:int; + + if (!source.readBit()) { + return null; + } + + var clone:Floor1 = clone(); + + clone.yList = new Vector.(xList.length); + + var range:int = RANGES[multiplier - 1]; + + clone.yList[0] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); + clone.yList[1] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); + + offset = 2; + + for (i = 0; i < partitionClassList.length; i++) { + var cls:int = partitionClassList[i]; + var cdim:int = classDimensions[cls]; + var cbits:int = classSubclasses[cls]; + var csub:int = (1 << cbits) - 1; + var cval:int = 0; + if (cbits > 0) { + cval = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[classMasterbooks[cls]].huffmanRoot); + } + + for (j = 0; j < cdim; j++) { + var book:int = subclassBooks[cls][cval & csub]; + cval >>>= cbits; + if (book >= 0) { + clone.yList[j + offset] = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[book].huffmanRoot); + } else { + clone.yList[j + offset] = 0; + } + } + offset += cdim; + } + + return clone; + } + + public override function computeFloor(vector:Vector.):void { + + var i:int; + var j:int; + + var n:int = vector.length; + var values:int = xList.length; + //var step2Flags:Vector. = new Vector.(values); + + var range:int = RANGES[multiplier - 1]; + + for (i = 2; i < values; i++) { + + var lowNeighbourOffset:int = lowNeighbours[i]; + var highNeighbourOffset:int = highNeighbours[i]; + + var predicted:int = Util.renderPoint( + xList[lowNeighbourOffset], xList[highNeighbourOffset], + yList[lowNeighbourOffset], yList[highNeighbourOffset], xList[i]); + + var val:int = yList[i]; + var highRoom:int = range - predicted; + var lowRoom:int = predicted; + var room:int = highRoom < lowRoom ? highRoom * 2 : lowRoom * 2; + + if (val != 0) { + step2Flags[lowNeighbourOffset] = true; + step2Flags[highNeighbourOffset] = true; + step2Flags[i] = true; + if (val >= room) { + yList[i] = highRoom > lowRoom ? val - lowRoom + predicted + : -val + highRoom + predicted - 1; + } else { + yList[i] = (val & 1) == 1 ? predicted - ((val + 1) >> 1) + : predicted + (val >> 1); + } + } else { + step2Flags[i] = false; + yList[i] = predicted; + } + } + + for(i=0; i, y:Vector., b:Vector.):void { + var off:int = 0; + var len:int = x.length; + var lim:int = len + off; + var itmp:int; + var btmp:Boolean; + var i:int; + var j:int; + // Insertion sort on smallest arrays + for (i = off; i < lim; i++) { + for (j = i; j > off && x[j - 1] > x[j]; j--) { + itmp = x[j]; + x[j] = x[j - 1]; + x[j - 1] = itmp; + itmp = y[j]; + y[j] = y[j - 1]; + y[j - 1] = itmp; + btmp = b[j]; + b[j] = b[j - 1]; + b[j - 1] = btmp; + } + } + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as index e78ff2ea2b..c334a11a48 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as @@ -1,87 +1,87 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.utils.ByteArray; - - public class IdentificationHeader { - - private var _version:uint; - private var _channels:uint; - private var _sampleRate:uint; - private var _bitrateMaximum:int; - private var _bitrateMinimum:int; - private var _bitrateNominal:int; - private var _blockSize0:uint; - private var _blockSize1:uint; - - private var _mdct:Vector.; - - public function IdentificationHeader(source:ByteArray) { - - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - - _version = source.readUnsignedInt(); - _channels = source.readUnsignedByte(); - _sampleRate = source.readUnsignedInt(); - _bitrateMaximum = source.readUnsignedInt(); - _bitrateNominal = source.readUnsignedInt(); - _bitrateMinimum = source.readUnsignedInt(); - var bs:int = source.readUnsignedByte(); - _blockSize0 = 1<<(bs&0xf); - _blockSize1 = 1<<(bs>>4); - - _mdct = new Vector.(2, false); - _mdct[0] = new Mdct(_blockSize0); - _mdct[1] = new Mdct(_blockSize1); - } - - public function get channels():uint { - return _channels; - } - - public function get sampleRate():uint { - return _sampleRate; - } - - public function get blockSize0():uint { - return _blockSize0; - } - - public function get blockSize1():uint { - return _blockSize1; - } - - public function get mdct0():Mdct { - return _mdct[0]; - } - - public function get mdct1():Mdct { - return _mdct[1]; - } - - } - - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.utils.ByteArray; + + public class IdentificationHeader { + + private var _version:uint; + private var _channels:uint; + private var _sampleRate:uint; + private var _bitrateMaximum:int; + private var _bitrateMinimum:int; + private var _bitrateNominal:int; + private var _blockSize0:uint; + private var _blockSize1:uint; + + private var _mdct:Vector.; + + public function IdentificationHeader(source:ByteArray) { + + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + + _version = source.readUnsignedInt(); + _channels = source.readUnsignedByte(); + _sampleRate = source.readUnsignedInt(); + _bitrateMaximum = source.readUnsignedInt(); + _bitrateNominal = source.readUnsignedInt(); + _bitrateMinimum = source.readUnsignedInt(); + var bs:int = source.readUnsignedByte(); + _blockSize0 = 1<<(bs&0xf); + _blockSize1 = 1<<(bs>>4); + + _mdct = new Vector.(2, false); + _mdct[0] = new Mdct(_blockSize0); + _mdct[1] = new Mdct(_blockSize1); + } + + public function get channels():uint { + return _channels; + } + + public function get sampleRate():uint { + return _sampleRate; + } + + public function get blockSize0():uint { + return _blockSize0; + } + + public function get blockSize1():uint { + return _blockSize1; + } + + public function get mdct0():Mdct { + return _mdct[0]; + } + + public function get mdct1():Mdct { + return _mdct[1]; + } + + } + + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as index 0f50452902..a174a7b456 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as @@ -1,136 +1,136 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import org.omtk.util.BitByteArray; - - public class Look { - - private var _map:int; - private var _parts:int; - private var _stages:int; - private var _fullbooks:Vector.; - private var _phrasebook:CodeBook; - private var _partbooks:Vector.>; - private var _partvals:int; - private var _decodemap:Vector.>; - private var _postbits:int; - private var _phrasebits:int; - private var _frames:int; - - public function Look(source:VorbisStream, residue:Residue, mode:Mode) { - - var i:int; - var j:int; - var k:int; - - var dim:int = 0; - var acc:int = 0; - var maxstage:int = 0; - - _map = mode.mapping; - - _parts = residue.classifications; - _fullbooks = source.setupHeader.codeBooks; - _phrasebook = _fullbooks[residue.classBook]; - dim = _phrasebook.dimensions; - - _partbooks = new Vector.>(_parts); - - for (j = 0; j < _parts; j++) { - var s:int = Util.ilog(residue.cascade[j]); - if (s != 0) { - if (s > maxstage) { - maxstage = s; - } - _partbooks[j] = new Vector.(s); - for (k = 0; k < s; k++) { - if ((residue.cascade[j] & (1 << k)) != 0) { - _partbooks[j][k] = residue.books[j][k]; - } - } - } - } - - _partvals = Math.round(Math.pow(_parts, dim)); - _stages = maxstage; - - _decodemap = new Vector.>(_partvals, true); - - for (j = 0; j < _partvals; j++) { - var val:int = j; - var mult:int = _partvals / _parts; - _decodemap[j] = new Vector.(dim); - - for (k = 0; k < dim; k++) { - var deco:int = val / mult; - val -= deco * mult; - mult /= _parts; - _decodemap[j][k] = deco; - } - } - } - - public function get map():int { - return _map; - } - - public function get parts():int { - return _parts; - } - - public function get stages():int { - return _stages; - } - - public function get fullbooks():Vector. { - return _fullbooks; - } - - public function get phrasebook():CodeBook { - return _phrasebook; - } - - public function get partbooks():Vector.> { - return _partbooks; - } - - public function get partvals():int { - return _partvals; - } - - public function get decodemap():Vector.> { - return _decodemap; - } - - public function get postbits():int { - return _postbits; - } - - public function get phrasebits():int { - return _phrasebits; - } - - public function get frames():int { - return _frames; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import org.omtk.util.BitByteArray; + + public class Look { + + private var _map:int; + private var _parts:int; + private var _stages:int; + private var _fullbooks:Vector.; + private var _phrasebook:CodeBook; + private var _partbooks:Vector.>; + private var _partvals:int; + private var _decodemap:Vector.>; + private var _postbits:int; + private var _phrasebits:int; + private var _frames:int; + + public function Look(source:VorbisStream, residue:Residue, mode:Mode) { + + var i:int; + var j:int; + var k:int; + + var dim:int = 0; + var acc:int = 0; + var maxstage:int = 0; + + _map = mode.mapping; + + _parts = residue.classifications; + _fullbooks = source.setupHeader.codeBooks; + _phrasebook = _fullbooks[residue.classBook]; + dim = _phrasebook.dimensions; + + _partbooks = new Vector.>(_parts); + + for (j = 0; j < _parts; j++) { + var s:int = Util.ilog(residue.cascade[j]); + if (s != 0) { + if (s > maxstage) { + maxstage = s; + } + _partbooks[j] = new Vector.(s); + for (k = 0; k < s; k++) { + if ((residue.cascade[j] & (1 << k)) != 0) { + _partbooks[j][k] = residue.books[j][k]; + } + } + } + } + + _partvals = Math.round(Math.pow(_parts, dim)); + _stages = maxstage; + + _decodemap = new Vector.>(_partvals, true); + + for (j = 0; j < _partvals; j++) { + var val:int = j; + var mult:int = _partvals / _parts; + _decodemap[j] = new Vector.(dim); + + for (k = 0; k < dim; k++) { + var deco:int = val / mult; + val -= deco * mult; + mult /= _parts; + _decodemap[j][k] = deco; + } + } + } + + public function get map():int { + return _map; + } + + public function get parts():int { + return _parts; + } + + public function get stages():int { + return _stages; + } + + public function get fullbooks():Vector. { + return _fullbooks; + } + + public function get phrasebook():CodeBook { + return _phrasebook; + } + + public function get partbooks():Vector.> { + return _partbooks; + } + + public function get partvals():int { + return _partvals; + } + + public function get decodemap():Vector.> { + return _decodemap; + } + + public function get postbits():int { + return _postbits; + } + + public function get phrasebits():int { + return _phrasebits; + } + + public function get frames():int { + return _frames; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as index 8b2c5ae8ad..982bec72ba 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as @@ -1,73 +1,73 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.BitByteArray; - - public class Mapping { - - public static function createInstance(stream:VorbisStream, source:BitByteArray, header:SetupHeader):Mapping { - - var type:int = source.readUnsignedBitwiseInt(16); - switch (type) { - case 0: - return new Mapping0(stream, source, header); - default: - throw new Error("Mapping type " + type + " is not supported."); - } - - } - - public function get type():int { - throw new IllegalOperationError("not implemented"); - } - - public function get couplingSteps():int { - throw new IllegalOperationError("not implemented"); - } - - public function get submaps():int { - throw new IllegalOperationError("not implemented"); - } - - public function get angles():Vector. { - throw new IllegalOperationError("not implemented"); - } - - public function get magnitudes():Vector. { - throw new IllegalOperationError("not implemented"); - } - - public function get mux():Vector. { - throw new IllegalOperationError("not implemented"); - } - - public function get submapFloors():Vector. { - throw new IllegalOperationError("not implemented"); - } - - public function get submapResidues():Vector. { - throw new IllegalOperationError("not implemented"); - } - - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.BitByteArray; + + public class Mapping { + + public static function createInstance(stream:VorbisStream, source:BitByteArray, header:SetupHeader):Mapping { + + var type:int = source.readUnsignedBitwiseInt(16); + switch (type) { + case 0: + return new Mapping0(stream, source, header); + default: + throw new Error("Mapping type " + type + " is not supported."); + } + + } + + public function get type():int { + throw new IllegalOperationError("not implemented"); + } + + public function get couplingSteps():int { + throw new IllegalOperationError("not implemented"); + } + + public function get submaps():int { + throw new IllegalOperationError("not implemented"); + } + + public function get angles():Vector. { + throw new IllegalOperationError("not implemented"); + } + + public function get magnitudes():Vector. { + throw new IllegalOperationError("not implemented"); + } + + public function get mux():Vector. { + throw new IllegalOperationError("not implemented"); + } + + public function get submapFloors():Vector. { + throw new IllegalOperationError("not implemented"); + } + + public function get submapResidues():Vector. { + throw new IllegalOperationError("not implemented"); + } + + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as index 13dd013075..547b53363e 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as @@ -1,136 +1,136 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import org.omtk.util.BitByteArray; - - public class Mapping0 extends Mapping { - - private var _magnitudes:Vector.; - private var _angles:Vector.; - private var _mux:Vector.; - private var _submapFloors:Vector.; - private var _submapResidues:Vector.; - - public function Mapping0(stream:VorbisStream, source:BitByteArray, header:SetupHeader) { - - var i:int; - var j:int; - - var submaps:int = 1; - - if (source.readBit()) { - submaps = source.readUnsignedBitwiseInt(4) + 1; - } - - var channels:int = stream.identificationHeader.channels; - var ilogChannels:int = Util.ilog(channels - 1); - - if (source.readBit()) { - var couplingSteps:int = source.readUnsignedBitwiseInt(8) + 1; - _magnitudes = new Vector.(couplingSteps); - _angles = new Vector.(couplingSteps); - - for (i = 0; i < couplingSteps; i++) { - magnitudes[i] = source.readUnsignedBitwiseInt(ilogChannels); - angles[i] = source.readUnsignedBitwiseInt(ilogChannels); - if (magnitudes[i] == angles[i] || magnitudes[i] >= channels - || angles[i] >= channels) { - throw new Error("The channel magnitude and/or angle mismatch."); - } - } - } else { - _magnitudes = Vector.([]); - _angles = Vector.([]); - } - - if (source.readUnsignedBitwiseInt(2) != 0) { - throw new Error("A reserved mapping field has an invalid value."); - } - - _mux = new Vector.(channels); - if (submaps > 1) { - for (i = 0; i < channels; i++) { - _mux[i] = source.readUnsignedBitwiseInt(4); - if (_mux[i] > submaps) { - throw new Error("A mapping mux value is higher than the number of submaps"); - } - } - } else { - for (i = 0; i < channels; i++) { - _mux[i] = 0; - } - } - - _submapFloors = new Vector.(submaps); - _submapResidues = new Vector.(submaps); - - var floorCount:int = header.floors.length; - var residueCount:int = header.residues.length; - - for (i = 0; i < submaps; i++) { - source.readUnsignedBitwiseInt(8); // discard time placeholder - _submapFloors[i] = source.readUnsignedBitwiseInt(8); - _submapResidues[i] = source.readUnsignedBitwiseInt(8); - - if (_submapFloors[i] > floorCount) { - throw new Error("A mapping floor value is higher than the number of floors."); - } - - if (_submapResidues[i] > residueCount) { - throw new Error("A mapping residue value is higher than the number of residues."); - } - } - } - - public override function get type():int { - return 0; - } - - public override function get couplingSteps():int { - return _angles.length; - } - - public override function get submaps():int { - return _submapFloors.length; - } - - public override function get angles():Vector. { - return _angles; - } - - public override function get magnitudes():Vector. { - return _magnitudes; - } - - public override function get mux():Vector. { - return _mux; - } - - public override function get submapFloors():Vector. { - return _submapFloors; - } - - public override function get submapResidues():Vector. { - return _submapResidues; - } - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import org.omtk.util.BitByteArray; + + public class Mapping0 extends Mapping { + + private var _magnitudes:Vector.; + private var _angles:Vector.; + private var _mux:Vector.; + private var _submapFloors:Vector.; + private var _submapResidues:Vector.; + + public function Mapping0(stream:VorbisStream, source:BitByteArray, header:SetupHeader) { + + var i:int; + var j:int; + + var submaps:int = 1; + + if (source.readBit()) { + submaps = source.readUnsignedBitwiseInt(4) + 1; + } + + var channels:int = stream.identificationHeader.channels; + var ilogChannels:int = Util.ilog(channels - 1); + + if (source.readBit()) { + var couplingSteps:int = source.readUnsignedBitwiseInt(8) + 1; + _magnitudes = new Vector.(couplingSteps); + _angles = new Vector.(couplingSteps); + + for (i = 0; i < couplingSteps; i++) { + magnitudes[i] = source.readUnsignedBitwiseInt(ilogChannels); + angles[i] = source.readUnsignedBitwiseInt(ilogChannels); + if (magnitudes[i] == angles[i] || magnitudes[i] >= channels + || angles[i] >= channels) { + throw new Error("The channel magnitude and/or angle mismatch."); + } + } + } else { + _magnitudes = Vector.([]); + _angles = Vector.([]); + } + + if (source.readUnsignedBitwiseInt(2) != 0) { + throw new Error("A reserved mapping field has an invalid value."); + } + + _mux = new Vector.(channels); + if (submaps > 1) { + for (i = 0; i < channels; i++) { + _mux[i] = source.readUnsignedBitwiseInt(4); + if (_mux[i] > submaps) { + throw new Error("A mapping mux value is higher than the number of submaps"); + } + } + } else { + for (i = 0; i < channels; i++) { + _mux[i] = 0; + } + } + + _submapFloors = new Vector.(submaps); + _submapResidues = new Vector.(submaps); + + var floorCount:int = header.floors.length; + var residueCount:int = header.residues.length; + + for (i = 0; i < submaps; i++) { + source.readUnsignedBitwiseInt(8); // discard time placeholder + _submapFloors[i] = source.readUnsignedBitwiseInt(8); + _submapResidues[i] = source.readUnsignedBitwiseInt(8); + + if (_submapFloors[i] > floorCount) { + throw new Error("A mapping floor value is higher than the number of floors."); + } + + if (_submapResidues[i] > residueCount) { + throw new Error("A mapping residue value is higher than the number of residues."); + } + } + } + + public override function get type():int { + return 0; + } + + public override function get couplingSteps():int { + return _angles.length; + } + + public override function get submaps():int { + return _submapFloors.length; + } + + public override function get angles():Vector. { + return _angles; + } + + public override function get magnitudes():Vector. { + return _magnitudes; + } + + public override function get mux():Vector. { + return _mux; + } + + public override function get submapFloors():Vector. { + return _submapFloors; + } + + public override function get submapResidues():Vector. { + return _submapResidues; + } + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as index 329c2763f5..886deea63f 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as @@ -1,62 +1,62 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.events.*; - import flash.system.*; - import flash.display.*; - import flash.net.*; - import flash.utils.getTimer; - - /* - * Wrapper for the haXe compiled class org.omtk.vorbis.MdctHX - */ - public class Mdct { - - public static var initialized : Boolean = false; - private static var hxClass : Class; - - public static function initialize() : void { - var ldr:Loader = new Loader(); - var swfUrl:String = "hxmdct.swf"; - var req:URLRequest = new URLRequest(swfUrl); - var ldrContext:LoaderContext = - new LoaderContext(false, ApplicationDomain.currentDomain); - ldr.load(req, ldrContext); - ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded); - - function swfLoaded(e:Event):void { - hxClass = ApplicationDomain.currentDomain.getDefinition("org.omtk.vorbis.MdctHX") as Class; - initialized = true; - } - } - - private var delegate : Object; - - public function Mdct(n:int) { - delegate = new hxClass(n); - } - - public function imdct(frq:Vector., window:Vector., pcm:Vector.):void { - delegate.imdct(frq, window, pcm); - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.events.*; + import flash.system.*; + import flash.display.*; + import flash.net.*; + import flash.utils.getTimer; + + /* + * Wrapper for the haXe compiled class org.omtk.vorbis.MdctHX + */ + public class Mdct { + + public static var initialized : Boolean = false; + private static var hxClass : Class; + + public static function initialize() : void { + var ldr:Loader = new Loader(); + var swfUrl:String = "hxmdct.swf"; + var req:URLRequest = new URLRequest(swfUrl); + var ldrContext:LoaderContext = + new LoaderContext(false, ApplicationDomain.currentDomain); + ldr.load(req, ldrContext); + ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded); + + function swfLoaded(e:Event):void { + hxClass = ApplicationDomain.currentDomain.getDefinition("org.omtk.vorbis.MdctHX") as Class; + initialized = true; + } + } + + private var delegate : Object; + + public function Mdct(n:int) { + delegate = new hxClass(n); + } + + public function imdct(frq:Vector., window:Vector., pcm:Vector.):void { + delegate.imdct(frq, window, pcm); + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as index 6da6abff41..cf27af2b3f 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as @@ -1,70 +1,70 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import flash.utils.Dictionary; - import org.omtk.util.BitByteArray; - - public class Mode - { - private var _blockFlag:Boolean; - private var _windowType:uint; - private var _transformType:uint; - private var _mapping:uint; - - public function Mode(source:BitByteArray, header:SetupHeader) { - - _blockFlag=source.readBit(); - _windowType=source.readUnsignedBitwiseInt(16); - _transformType=source.readUnsignedBitwiseInt(16); - _mapping=source.readUnsignedBitwiseInt(8); - - if(_windowType!=0) { - throw new Error("Window type = "+windowType+", != 0"); - } - - if(_transformType!=0) { - throw new Error("Transform type = "+transformType+", != 0"); - } - - if(_mapping > header.mappings.length) { - throw new Error("Mode mapping number is higher than total number of mappings."); - } - } - - public function get blockFlag():Boolean { - return _blockFlag; - } - - public function get windowType():uint { - return _windowType; - } - - public function get transformType():uint { - return _transformType; - } - - public function get mapping():uint { - return _mapping; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import flash.utils.Dictionary; + import org.omtk.util.BitByteArray; + + public class Mode + { + private var _blockFlag:Boolean; + private var _windowType:uint; + private var _transformType:uint; + private var _mapping:uint; + + public function Mode(source:BitByteArray, header:SetupHeader) { + + _blockFlag=source.readBit(); + _windowType=source.readUnsignedBitwiseInt(16); + _transformType=source.readUnsignedBitwiseInt(16); + _mapping=source.readUnsignedBitwiseInt(8); + + if(_windowType!=0) { + throw new Error("Window type = "+windowType+", != 0"); + } + + if(_transformType!=0) { + throw new Error("Transform type = "+transformType+", != 0"); + } + + if(_mapping > header.mappings.length) { + throw new Error("Mode mapping number is higher than total number of mappings."); + } + } + + public function get blockFlag():Boolean { + return _blockFlag; + } + + public function get windowType():uint { + return _windowType; + } + + public function get transformType():uint { + return _transformType; + } + + public function get mapping():uint { + return _mapping; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as index 9c87ad935e..de9924f7b9 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as @@ -1,142 +1,142 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import flash.utils.Dictionary; - import org.omtk.util.BitByteArray; - - public class Residue { - - private var _begin:int; - private var _end:int; - private var _partitionSize:int; - private var _classifications:int; - private var _classBook:int; - private var _cascade:Vector.; - private var _books:Vector.>; - - private var _looks:Dictionary; - - - public function Residue(source:BitByteArray, header:SetupHeader) { - - _begin = source.readUnsignedBitwiseInt(24); - _end = source.readUnsignedBitwiseInt(24); - _partitionSize = source.readUnsignedBitwiseInt(24) + 1; - _classifications = source.readUnsignedBitwiseInt(6) + 1; - _classBook = source.readUnsignedBitwiseInt(8); - - _cascade = new Vector.(classifications); - - var acc:int = 0; - var i:int; - var j:int; - - for (i = 0; i < classifications; i++) { - var highBits:int = 0; - var lowBits:int = 0; - - lowBits = source.readUnsignedBitwiseInt(3); - if (source.readBit()) { - highBits = source.readUnsignedBitwiseInt(5); - } - _cascade[i] = (highBits << 3) | lowBits; - acc += Util.icount(cascade[i]); - } - - _books = new Vector.>(classifications); - - for (i = 0; i < classifications; i++) { - books[i] = new Vector.(8); - for (j = 0; j < 8; j++) { - if ((cascade[i] & (1 << j)) != 0) { - books[i][j] = source.readUnsignedBitwiseInt(8); - if (books[i][j] > header.codeBooks.length) { - throw new Error( - "Reference to invalid codebook entry in residue header."); - } - } - } - } - - _looks = new Dictionary(); - } - - public static function createInstance(source:BitByteArray, header:SetupHeader):Residue { - - var type:int = source.readUnsignedBitwiseInt(16); - switch (type) { - case 2: - return new Residue2(source, header); - default: - throw new Error("Residue type " + type + " is not supported."); - } - } - - public function decodeResidue( - vorbis:VorbisStream, source:BitByteArray, - mode:Mode, ch:int, - doNotDecodeFlags:Vector., vectors0:Vector., vectors1:Vector.):void { - - throw new IllegalOperationError("not implemented"); - } - - - public function getLook(stream:VorbisStream, key:Mode):Look { - var look:Look = _looks[key]; - if (look == null) { - look = new Look(stream, this, key); - _looks[key] = look; - } - return new Look(stream, this, key);//look; - } - - - public function get begin():int { - return _begin; - } - - public function get end():int { - return _end; - } - - public function get partitionSize():int { - return _partitionSize; - } - - public function get classifications():int { - return _classifications; - } - - public function get classBook():int { - return _classBook; - } - - public function get cascade():Vector. { - return _cascade; - } - - public function get books():Vector.> { - return _books; - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import flash.utils.Dictionary; + import org.omtk.util.BitByteArray; + + public class Residue { + + private var _begin:int; + private var _end:int; + private var _partitionSize:int; + private var _classifications:int; + private var _classBook:int; + private var _cascade:Vector.; + private var _books:Vector.>; + + private var _looks:Dictionary; + + + public function Residue(source:BitByteArray, header:SetupHeader) { + + _begin = source.readUnsignedBitwiseInt(24); + _end = source.readUnsignedBitwiseInt(24); + _partitionSize = source.readUnsignedBitwiseInt(24) + 1; + _classifications = source.readUnsignedBitwiseInt(6) + 1; + _classBook = source.readUnsignedBitwiseInt(8); + + _cascade = new Vector.(classifications); + + var acc:int = 0; + var i:int; + var j:int; + + for (i = 0; i < classifications; i++) { + var highBits:int = 0; + var lowBits:int = 0; + + lowBits = source.readUnsignedBitwiseInt(3); + if (source.readBit()) { + highBits = source.readUnsignedBitwiseInt(5); + } + _cascade[i] = (highBits << 3) | lowBits; + acc += Util.icount(cascade[i]); + } + + _books = new Vector.>(classifications); + + for (i = 0; i < classifications; i++) { + books[i] = new Vector.(8); + for (j = 0; j < 8; j++) { + if ((cascade[i] & (1 << j)) != 0) { + books[i][j] = source.readUnsignedBitwiseInt(8); + if (books[i][j] > header.codeBooks.length) { + throw new Error( + "Reference to invalid codebook entry in residue header."); + } + } + } + } + + _looks = new Dictionary(); + } + + public static function createInstance(source:BitByteArray, header:SetupHeader):Residue { + + var type:int = source.readUnsignedBitwiseInt(16); + switch (type) { + case 2: + return new Residue2(source, header); + default: + throw new Error("Residue type " + type + " is not supported."); + } + } + + public function decodeResidue( + vorbis:VorbisStream, source:BitByteArray, + mode:Mode, ch:int, + doNotDecodeFlags:Vector., vectors0:Vector., vectors1:Vector.):void { + + throw new IllegalOperationError("not implemented"); + } + + + public function getLook(stream:VorbisStream, key:Mode):Look { + var look:Look = _looks[key]; + if (look == null) { + look = new Look(stream, this, key); + _looks[key] = look; + } + return new Look(stream, this, key);//look; + } + + + public function get begin():int { + return _begin; + } + + public function get end():int { + return _end; + } + + public function get partitionSize():int { + return _partitionSize; + } + + public function get classifications():int { + return _classifications; + } + + public function get classBook():int { + return _classBook; + } + + public function get cascade():Vector. { + return _cascade; + } + + public function get books():Vector.> { + return _books; + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as index 7bec7c50ab..1fdc453fbc 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as @@ -1,109 +1,109 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.errors.IllegalOperationError; - import flash.utils.Dictionary; - import org.omtk.util.BitByteArray; - - public class Residue2 extends Residue { - - public function Residue2(source:BitByteArray, header:SetupHeader) { - super(source, header); - } - - public override function decodeResidue( - vorbis:VorbisStream, source:BitByteArray, - mode:Mode, ch:int, - doNotDecodeFlags:Vector., vectors0:Vector., vectors1:Vector.):void { - - var i:int; - var j:int; - var k:int; - var l:int; - var s:int; - var slim:int; - - var look:Look = getLook(vorbis, mode); - - var codeBook:CodeBook = vorbis.setupHeader.codeBooks[classBook]; - - var classvalsPerCodeword:int = codeBook.dimensions; - var nToRead:int = end - begin; - var partitionsToRead:int = nToRead / partitionSize; // partvals - - var samplesPerPartition:int = partitionSize; - var partitionsPerWord:int = look.phrasebook.dimensions; - - var partWords:int = (partitionsToRead + partitionsPerWord - 1) / partitionsPerWord; - - var offset:int; - - var left:Boolean = false; - var right:Boolean = false; - - for (i = 0; i < doNotDecodeFlags.length; i++) { - if (!doNotDecodeFlags[i]) { - if(i==0) { - left = true; - } - else if (i==1) { - right = true; - } - } - } - - var partword:Array = new Array(partWords); - - var pb:int = source.position; - - slim = look.stages; - for (s = 0; s < slim; s++) { - - for (i = 0, l = 0; i < partitionsToRead; l++) { - - if (s == 0) { - var temp:int = source.readUnsignedHuffmanInt(look.phrasebook.huffmanRoot); - if (temp == -1) { - throw new Error("Foo??"); - } - partword[l] = look.decodemap[temp]; - if (partword[l] == null) { - throw new Error("Foo??"); - } - } - - for (k = 0; k < partitionsPerWord && i < partitionsToRead; k++, i++) { - offset = begin + i * samplesPerPartition; - - if ((cascade[partword[l][k]] & (1 << s)) != 0) { - var stagebook:CodeBook = - vorbis.setupHeader.codeBooks[look.partbooks[partword[l][k]][s]]; - if (stagebook != null) { - stagebook.readVvAdd(vectors0, vectors1, left, right, source, offset, samplesPerPartition); - } - } - } - } - } - - } - - } +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.errors.IllegalOperationError; + import flash.utils.Dictionary; + import org.omtk.util.BitByteArray; + + public class Residue2 extends Residue { + + public function Residue2(source:BitByteArray, header:SetupHeader) { + super(source, header); + } + + public override function decodeResidue( + vorbis:VorbisStream, source:BitByteArray, + mode:Mode, ch:int, + doNotDecodeFlags:Vector., vectors0:Vector., vectors1:Vector.):void { + + var i:int; + var j:int; + var k:int; + var l:int; + var s:int; + var slim:int; + + var look:Look = getLook(vorbis, mode); + + var codeBook:CodeBook = vorbis.setupHeader.codeBooks[classBook]; + + var classvalsPerCodeword:int = codeBook.dimensions; + var nToRead:int = end - begin; + var partitionsToRead:int = nToRead / partitionSize; // partvals + + var samplesPerPartition:int = partitionSize; + var partitionsPerWord:int = look.phrasebook.dimensions; + + var partWords:int = (partitionsToRead + partitionsPerWord - 1) / partitionsPerWord; + + var offset:int; + + var left:Boolean = false; + var right:Boolean = false; + + for (i = 0; i < doNotDecodeFlags.length; i++) { + if (!doNotDecodeFlags[i]) { + if(i==0) { + left = true; + } + else if (i==1) { + right = true; + } + } + } + + var partword:Array = new Array(partWords); + + var pb:int = source.position; + + slim = look.stages; + for (s = 0; s < slim; s++) { + + for (i = 0, l = 0; i < partitionsToRead; l++) { + + if (s == 0) { + var temp:int = source.readUnsignedHuffmanInt(look.phrasebook.huffmanRoot); + if (temp == -1) { + throw new Error("Foo??"); + } + partword[l] = look.decodemap[temp]; + if (partword[l] == null) { + throw new Error("Foo??"); + } + } + + for (k = 0; k < partitionsPerWord && i < partitionsToRead; k++, i++) { + offset = begin + i * samplesPerPartition; + + if ((cascade[partword[l][k]] & (1 << s)) != 0) { + var stagebook:CodeBook = + vorbis.setupHeader.codeBooks[look.partbooks[partword[l][k]][s]]; + if (stagebook != null) { + stagebook.readVvAdd(vectors0, vectors1, left, right, source, offset, samplesPerPartition); + } + } + } + } + } + + } + + } } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as index 885c182ce7..1d1350f9ef 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as @@ -1,118 +1,118 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import org.omtk.util.BitByteArray; - - public class SetupHeader { - - private var _codeBooks:Vector.; - private var _floors:Vector.; - private var _residues:Vector.; - private var _mappings:Vector.; - private var _modes:Vector.; - - public function SetupHeader(stream:VorbisStream, source:BitByteArray) { - - var i:int; - - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - source.readByte(); - - var codeBookCount:uint = source.readUnsignedBitwiseInt(8)+1; - _codeBooks = new Vector.(codeBookCount); - - for(i = 0; i < codeBookCount; i++) { - _codeBooks[i] = new CodeBook(source); - } - - // read the time domain transformations, - // these should all be 0 - - var timeCount:int = source.readUnsignedBitwiseInt(6) + 1; - for (i = 0; i < timeCount; i++) { - if (source.readUnsignedBitwiseInt(16) != 0) { - throw new Error( - "Time domain transformation != 0"); - } - } - - // read floor entries - - var floorCount:int = source.readUnsignedBitwiseInt(6) + 1; - _floors = new Vector.(floorCount); - - for (i = 0; i < floorCount; i++) { - _floors[i] = Floor.createInstance(source, this); - } - - var residueCount:int = source.readUnsignedBitwiseInt(6) + 1; - _residues = new Vector.(residueCount); - - for (i = 0; i < residueCount; i++) { - _residues[i] = Residue.createInstance(source, this); - } - - var mappingCount:int = source.readUnsignedBitwiseInt(6) + 1; - _mappings = new Vector.(mappingCount); - - for (i = 0; i < mappingCount; i++) { - _mappings[i] = Mapping.createInstance(stream, source, this); - } - - var modeCount:int = source.readUnsignedBitwiseInt(6) + 1; - _modes = new Vector.(modeCount); - - for (i = 0; i < modeCount; i++) { - _modes[i] = new Mode(source, this); - } - - if (!source.readBit()) { - throw new Error("The setup header framing bit is incorrect."); - } - } - - public function get codeBooks():Vector. { - return _codeBooks; - } - - public function get floors():Vector. { - return _floors; - } - - public function get mappings():Vector. { - return _mappings; - } - - public function get residues():Vector. { - return _residues; - } - - public function get modes():Vector. { - return _modes; - } - - } - - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import org.omtk.util.BitByteArray; + + public class SetupHeader { + + private var _codeBooks:Vector.; + private var _floors:Vector.; + private var _residues:Vector.; + private var _mappings:Vector.; + private var _modes:Vector.; + + public function SetupHeader(stream:VorbisStream, source:BitByteArray) { + + var i:int; + + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + source.readByte(); + + var codeBookCount:uint = source.readUnsignedBitwiseInt(8)+1; + _codeBooks = new Vector.(codeBookCount); + + for(i = 0; i < codeBookCount; i++) { + _codeBooks[i] = new CodeBook(source); + } + + // read the time domain transformations, + // these should all be 0 + + var timeCount:int = source.readUnsignedBitwiseInt(6) + 1; + for (i = 0; i < timeCount; i++) { + if (source.readUnsignedBitwiseInt(16) != 0) { + throw new Error( + "Time domain transformation != 0"); + } + } + + // read floor entries + + var floorCount:int = source.readUnsignedBitwiseInt(6) + 1; + _floors = new Vector.(floorCount); + + for (i = 0; i < floorCount; i++) { + _floors[i] = Floor.createInstance(source, this); + } + + var residueCount:int = source.readUnsignedBitwiseInt(6) + 1; + _residues = new Vector.(residueCount); + + for (i = 0; i < residueCount; i++) { + _residues[i] = Residue.createInstance(source, this); + } + + var mappingCount:int = source.readUnsignedBitwiseInt(6) + 1; + _mappings = new Vector.(mappingCount); + + for (i = 0; i < mappingCount; i++) { + _mappings[i] = Mapping.createInstance(stream, source, this); + } + + var modeCount:int = source.readUnsignedBitwiseInt(6) + 1; + _modes = new Vector.(modeCount); + + for (i = 0; i < modeCount; i++) { + _modes[i] = new Mode(source, this); + } + + if (!source.readBit()) { + throw new Error("The setup header framing bit is incorrect."); + } + } + + public function get codeBooks():Vector. { + return _codeBooks; + } + + public function get floors():Vector. { + return _floors; + } + + public function get mappings():Vector. { + return _mappings; + } + + public function get residues():Vector. { + return _residues; + } + + public function get modes():Vector. { + return _modes; + } + + } + + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as index 698f78b8cc..f6e7ed18db 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as @@ -1,122 +1,122 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - public class Util { - - public static function ilog(x:uint):uint { - var res:int = 0; - for(; x>0; x>>=1, res++); - return res; - } - - public static function float32unpack(x:uint):Number { - var mantissa:Number = x&0x1fffff; - var e:Number = (x&0x7fe00000)>>21; - if((x&0x80000000)!=0) { - mantissa=-mantissa; - } - return mantissa*Math.pow(2.0, e-788.0); - } - - public static function lookup1Values(a:int, b:int):uint { - var res:uint = Math.pow(Math.E, Math.log(a)/b); - return intPow(res+1, b)<=a?res+1:res; - } - - public static function intPow(base:uint, e:uint):uint { - var res:uint = 1; - for(; e>0; e--, res*=base); - return res; - } - - public static function isBitSet(value:uint, bit:uint):Boolean { - return (value&(1< 0) { - res += value & 1; - value >>= 1; - } - return res; - } - - public static function lowNeighbour(v:Vector., x:int):int { - - var max:int = -1; - var n:int = 0; - var i:int; - - for (i = 0; i < v.length && i < x; i++) { - if (v[i] > max && v[i] < v[x]) { - max = v[i]; - n = i; - } - } - return n; - } - - public static function highNeighbour(v:Vector., x:int):int { - - var min:int = int.MAX_VALUE; - var n:int = 0; - var i:int; - - for (i = 0; i < v.length && i < x; i++) { - if (v[i] < min && v[i] > v[x]) { - min = v[i]; - n = i; - } - } - return n; - } - - public static function renderPoint(x0:int, x1:int, y0:int, y1:int, x:int):int { - return y0 + int(((y1-y0) * (x - x0)) / (x1 - x0)); - } - - public static function renderLine(x0:int, y0:int, x1:int, y1:int, v:Vector.):void { - - var dy:int = y1 - y0; - var adx:int = x1 - x0; - var b:int = dy / adx; - var sy:int = dy < 0 ? b - 1 : b + 1; - var x:int = x0; - var y:int = y0; - var err:int = 0; - var ady:int = (dy < 0 ? -dy : dy) - (b > 0 ? b * adx : -b * adx); - - v[x] *= Floor.DB_STATIC_TABLE[y]; - for (x = x0 + 1; x < x1; x++) { - err += ady; - if (err >= adx) { - err -= adx; - v[x] *= Floor.DB_STATIC_TABLE[y += sy]; - } else { - v[x] *= Floor.DB_STATIC_TABLE[y += b]; - } - } - - } - - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + public class Util { + + public static function ilog(x:uint):uint { + var res:int = 0; + for(; x>0; x>>=1, res++); + return res; + } + + public static function float32unpack(x:uint):Number { + var mantissa:Number = x&0x1fffff; + var e:Number = (x&0x7fe00000)>>21; + if((x&0x80000000)!=0) { + mantissa=-mantissa; + } + return mantissa*Math.pow(2.0, e-788.0); + } + + public static function lookup1Values(a:int, b:int):uint { + var res:uint = Math.pow(Math.E, Math.log(a)/b); + return intPow(res+1, b)<=a?res+1:res; + } + + public static function intPow(base:uint, e:uint):uint { + var res:uint = 1; + for(; e>0; e--, res*=base); + return res; + } + + public static function isBitSet(value:uint, bit:uint):Boolean { + return (value&(1< 0) { + res += value & 1; + value >>= 1; + } + return res; + } + + public static function lowNeighbour(v:Vector., x:int):int { + + var max:int = -1; + var n:int = 0; + var i:int; + + for (i = 0; i < v.length && i < x; i++) { + if (v[i] > max && v[i] < v[x]) { + max = v[i]; + n = i; + } + } + return n; + } + + public static function highNeighbour(v:Vector., x:int):int { + + var min:int = int.MAX_VALUE; + var n:int = 0; + var i:int; + + for (i = 0; i < v.length && i < x; i++) { + if (v[i] < min && v[i] > v[x]) { + min = v[i]; + n = i; + } + } + return n; + } + + public static function renderPoint(x0:int, x1:int, y0:int, y1:int, x:int):int { + return y0 + int(((y1-y0) * (x - x0)) / (x1 - x0)); + } + + public static function renderLine(x0:int, y0:int, x1:int, y1:int, v:Vector.):void { + + var dy:int = y1 - y0; + var adx:int = x1 - x0; + var b:int = dy / adx; + var sy:int = dy < 0 ? b - 1 : b + 1; + var x:int = x0; + var y:int = y0; + var err:int = 0; + var ady:int = (dy < 0 ? -dy : dy) - (b > 0 ? b * adx : -b * adx); + + v[x] *= Floor.DB_STATIC_TABLE[y]; + for (x = x0 + 1; x < x1; x++) { + err += ady; + if (err >= adx) { + err -= adx; + v[x] *= Floor.DB_STATIC_TABLE[y += sy]; + } else { + v[x] *= Floor.DB_STATIC_TABLE[y += b]; + } + } + + } + + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as index 8a802f98c0..c82bb72e7f 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as @@ -1,136 +1,136 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.net.URLRequest; - import flash.net.URLStream; - import flash.utils.ByteArray; - import flash.utils.Endian; - import flash.events.Event; - import flash.events.ProgressEvent; - import flash.events.SampleDataEvent; - - import flash.external.ExternalInterface; - - import flash.media.Sound; - - import org.omtk.ogg.UncachedUrlStream; - import org.omtk.ogg.EndOfOggStreamError; - import flash.utils.setTimeout; - - public class VorbisSound extends Sound { - - public static var METADATA_UPDATE: String = "metadata_update"; - - private var urlStream: URLStream; - - private var oggStream:UncachedUrlStream; - private var vorbisStream:VorbisStream; - - private var bytesAvailable:int; - - private var initialized:Boolean = false; - private var playing:Boolean = false; - - private var fill1:Boolean = true; - private var fill2:Boolean = true; - - private var stopped: Boolean = false; - private var completeEventDispatched: Boolean = false; - - public function VorbisSound(url: URLRequest ) { - urlStream = new URLStream(); - urlStream.endian = Endian.LITTLE_ENDIAN; - urlStream.load(url); - - Mdct.initialize(); - - oggStream = new UncachedUrlStream(urlStream); - oggStream.addEventListener('progress', progress); - bytesAvailable = oggStream.bytesAvailable; - addEventListener("sampleData", sampleGenerator); - } - - private function initialize():void { - vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); - setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); - initialized = true; - } - - private var samplesPlayed: int = 0; - - private function sampleGenerator(event:SampleDataEvent):void { - - if(stopped) { - return; - } - - if(Mdct.initialized && !initialized && bytesAvailable > 64*1024) { - initialize(); - } - - if(initialized && bytesAvailable > 16*1024 && !vorbisStream.finished) { - var cnt: int; - cnt = vorbisStream.readPcm(event.data); - samplesPlayed += cnt; - if(cnt < 2048 && oggStream.bytesAvailable > 0) { - vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); - setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); - samplesPlayed += vorbisStream.readPcm(event.data); - } - } - else if(vorbisStream == null || !vorbisStream.finished) { - for(var c:int=0; c<2048; c++) { - event.data.writeFloat(0); - event.data.writeFloat(0); - } - } - - if(initialized && vorbisStream.finished && oggStream.bytesAvailable == 0 && !completeEventDispatched) { - dispatchEvent(new Event(Event.COMPLETE)); - completeEventDispatched = true; - } - - //trace("samples played: " + samplesPlayed + "/" + oggStream.bytesAvailable); - - } - - public function stop(): void { - stopped = true; - } - - public function progress(event:ProgressEvent):void { - bytesAvailable = oggStream.bytesAvailable; - } - - public function get position(): int { - return samplesPlayed * 1000 / 44100; - } - - public function getMetaData(key: String):String { - if(vorbisStream != null) { - return vorbisStream.commentHeader.comments[key]; - } - else { - return null; - } - } - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.net.URLRequest; + import flash.net.URLStream; + import flash.utils.ByteArray; + import flash.utils.Endian; + import flash.events.Event; + import flash.events.ProgressEvent; + import flash.events.SampleDataEvent; + + import flash.external.ExternalInterface; + + import flash.media.Sound; + + import org.omtk.ogg.UncachedUrlStream; + import org.omtk.ogg.EndOfOggStreamError; + import flash.utils.setTimeout; + + public class VorbisSound extends Sound { + + public static var METADATA_UPDATE: String = "metadata_update"; + + private var urlStream: URLStream; + + private var oggStream:UncachedUrlStream; + private var vorbisStream:VorbisStream; + + private var bytesAvailable:int; + + private var initialized:Boolean = false; + private var playing:Boolean = false; + + private var fill1:Boolean = true; + private var fill2:Boolean = true; + + private var stopped: Boolean = false; + private var completeEventDispatched: Boolean = false; + + public function VorbisSound(url: URLRequest ) { + urlStream = new URLStream(); + urlStream.endian = Endian.LITTLE_ENDIAN; + urlStream.load(url); + + Mdct.initialize(); + + oggStream = new UncachedUrlStream(urlStream); + oggStream.addEventListener('progress', progress); + bytesAvailable = oggStream.bytesAvailable; + addEventListener("sampleData", sampleGenerator); + } + + private function initialize():void { + vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); + setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); + initialized = true; + } + + private var samplesPlayed: int = 0; + + private function sampleGenerator(event:SampleDataEvent):void { + + if(stopped) { + return; + } + + if(Mdct.initialized && !initialized && bytesAvailable > 64*1024) { + initialize(); + } + + if(initialized && bytesAvailable > 16*1024 && !vorbisStream.finished) { + var cnt: int; + cnt = vorbisStream.readPcm(event.data); + samplesPlayed += cnt; + if(cnt < 2048 && oggStream.bytesAvailable > 0) { + vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); + setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); + samplesPlayed += vorbisStream.readPcm(event.data); + } + } + else if(vorbisStream == null || !vorbisStream.finished) { + for(var c:int=0; c<2048; c++) { + event.data.writeFloat(0); + event.data.writeFloat(0); + } + } + + if(initialized && vorbisStream.finished && oggStream.bytesAvailable == 0 && !completeEventDispatched) { + dispatchEvent(new Event(Event.COMPLETE)); + completeEventDispatched = true; + } + + //trace("samples played: " + samplesPlayed + "/" + oggStream.bytesAvailable); + + } + + public function stop(): void { + stopped = true; + } + + public function progress(event:ProgressEvent):void { + bytesAvailable = oggStream.bytesAvailable; + } + + public function get position(): int { + return samplesPlayed * 1000 / 44100; + } + + public function getMetaData(key: String):String { + if(vorbisStream != null) { + return vorbisStream.commentHeader.comments[key]; + } + else { + return null; + } + } + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as index ea7a208948..0c37fa1b18 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as @@ -1,130 +1,130 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis { - - import flash.events.SampleDataEvent; - import flash.utils.ByteArray; - import flash.utils.Endian; - import org.omtk.util.*; - import org.omtk.ogg.*; - - public class VorbisStream { - - private const IDENTIFICATION_HEADER:int = 1; - private const COMMENT_HEADER:int = 3; - private const SETUP_HEADER:int = 5; - - private var source:LogicalOggStream; - - private var _identificationHeader:IdentificationHeader; - private var _commentHeader:CommentHeader; - private var _setupHeader:SetupHeader; - - private var _lastAudioPacket:AudioPacket; - - private var _currentGranulePosition:int=0; - private var packetCounter:int; - - private var _finished: Boolean = false; - - public var windows:Vector.> = new Vector.>(8); - - public function VorbisStream(source:LogicalOggStream) { - - this.source = source; - - for (var i:int = 0; i < 3; i++) { - - var data:BitByteArray = source.getNextOggPacket().data; - var headerType:int = data.readUnsignedByte(); - - switch(headerType) { - case IDENTIFICATION_HEADER: - _identificationHeader = new IdentificationHeader(data); - break; - case COMMENT_HEADER: - _commentHeader = new CommentHeader(data); - break; - case SETUP_HEADER: - _setupHeader = new SetupHeader(this, data); - break; - } - } - - } - - public function get identificationHeader():IdentificationHeader { - return _identificationHeader; - } - - public function get commentHeader():CommentHeader { - return _commentHeader; - } - - public function get setupHeader():SetupHeader { - return _setupHeader; - } - - public function readPcm(data:ByteArray): int { - - var total:int; - var i:int; - - if(_lastAudioPacket == null) { - _lastAudioPacket = getNextAudioPacket(); - } - - total = 0; - - while(total < 2048 && !_finished) { - try { - var ap:AudioPacket = getNextAudioPacket(); - total += ap.readPcm(_lastAudioPacket, data); - _lastAudioPacket = ap; - } - catch(e: EndOfOggStreamError) { - // ok, stream finished - _finished = true; - } - } - - return total; - } - - private function getNextAudioPacket():AudioPacket { - packetCounter++; - var packet:OggPacket = source.getNextOggPacket(); - var res:AudioPacket = new AudioPacket(this, packet, _currentGranulePosition); - if(_lastAudioPacket != null) { - // don't count the first packet, since it doesn't contain any "real" samples - _currentGranulePosition += res.numberOfSamples; - } - return res; - } - - public function get finished() : Boolean { - return _finished; - } - - public function get currentGranulePosition(): int { - return _currentGranulePosition; - } - } - +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis { + + import flash.events.SampleDataEvent; + import flash.utils.ByteArray; + import flash.utils.Endian; + import org.omtk.util.*; + import org.omtk.ogg.*; + + public class VorbisStream { + + private const IDENTIFICATION_HEADER:int = 1; + private const COMMENT_HEADER:int = 3; + private const SETUP_HEADER:int = 5; + + private var source:LogicalOggStream; + + private var _identificationHeader:IdentificationHeader; + private var _commentHeader:CommentHeader; + private var _setupHeader:SetupHeader; + + private var _lastAudioPacket:AudioPacket; + + private var _currentGranulePosition:int=0; + private var packetCounter:int; + + private var _finished: Boolean = false; + + public var windows:Vector.> = new Vector.>(8); + + public function VorbisStream(source:LogicalOggStream) { + + this.source = source; + + for (var i:int = 0; i < 3; i++) { + + var data:BitByteArray = source.getNextOggPacket().data; + var headerType:int = data.readUnsignedByte(); + + switch(headerType) { + case IDENTIFICATION_HEADER: + _identificationHeader = new IdentificationHeader(data); + break; + case COMMENT_HEADER: + _commentHeader = new CommentHeader(data); + break; + case SETUP_HEADER: + _setupHeader = new SetupHeader(this, data); + break; + } + } + + } + + public function get identificationHeader():IdentificationHeader { + return _identificationHeader; + } + + public function get commentHeader():CommentHeader { + return _commentHeader; + } + + public function get setupHeader():SetupHeader { + return _setupHeader; + } + + public function readPcm(data:ByteArray): int { + + var total:int; + var i:int; + + if(_lastAudioPacket == null) { + _lastAudioPacket = getNextAudioPacket(); + } + + total = 0; + + while(total < 2048 && !_finished) { + try { + var ap:AudioPacket = getNextAudioPacket(); + total += ap.readPcm(_lastAudioPacket, data); + _lastAudioPacket = ap; + } + catch(e: EndOfOggStreamError) { + // ok, stream finished + _finished = true; + } + } + + return total; + } + + private function getNextAudioPacket():AudioPacket { + packetCounter++; + var packet:OggPacket = source.getNextOggPacket(); + var res:AudioPacket = new AudioPacket(this, packet, _currentGranulePosition); + if(_lastAudioPacket != null) { + // don't count the first packet, since it doesn't contain any "real" samples + _currentGranulePosition += res.numberOfSamples; + } + return res; + } + + public function get finished() : Boolean { + return _finished; + } + + public function get currentGranulePosition(): int { + return _currentGranulePosition; + } + } + } \ No newline at end of file diff --git a/js2/mwEmbed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx b/js2/mwEmbed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx index a932a6f14b..4461c32dae 100644 --- a/js2/mwEmbed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx +++ b/js2/mwEmbed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx @@ -1,337 +1,337 @@ -/* - -Copyright 2008 Tor-Einar Jarnbjo - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - -*/ - -package org.omtk.vorbis; - -import flash.Vector; - -class MdctHX { - - private static var cPI1_8:Float = 0.92387953251128675613; - private static var cPI2_8:Float = 0.70710678118654752441; - private static var cPI3_8:Float = 0.38268343236508977175; - - private var n:Int; - private var log2n:Int; - private var trig:Vector; - private var bitrev:Vector; - - private var dtmp1:Float; - private var dtmp2:Float; - private var dtmp3:Float; - private var dtmp4:Float; - - private var x:Vector; - private var w:Vector; - - public function new(n:Int) { - this.n = n; - - var i:Int; - var j:Int; - - bitrev = new Vector(); - trig = new Vector(Std.int(n+n/4), true); - - for(i in 0...Std.int(n+n/4)) { - trig[i] = 0; - } - - x = new Vector(Std.int(n/2), true); - w = new Vector(Std.int(n/2), true); - - for(i in 0...Std.int(n/2)) { - x[i] = 0; - w[i] = 0; - } - - var n2:Int = n >>> 1; - log2n = Math.round(Math.log(n) / Math.log(2)); - - var AE:Int = 0; - var AO:Int = 1; - var BE:Int = Std.int(AE + n / 2); - var BO:Int = BE + 1; - var CE:Int = Std.int(BE + n / 2); - var CO:Int = CE + 1; - - for (i in 0...Std.int(n/4)) { - trig[AE + i * 2] = Math.cos((Math.PI / n) * (4 * i)); - trig[AO + i * 2] = -Math.sin((Math.PI / n) * (4 * i)); - trig[BE + i * 2] = Math.cos((Math.PI / (2 * n)) * (2 * i + 1)); - trig[BO + i * 2] = Math.sin((Math.PI / (2 * n)) * (2 * i + 1)); - } - - for (i in 0...Std.int(n/8)) { - trig[CE + i * 2] = Math.cos((Math.PI / n) * (4 * i + 2)); - trig[CO + i * 2] = -Math.sin((Math.PI / n) * (4 * i + 2)); - } - - var mask:Int = (1 << (log2n - 1)) - 1; - var msb:Int = 1 << (log2n - 2); - - for (i in 0...Std.int(n/8)) { - var acc:Int = 0; - j = 0; - while(msb>>>j!=0) { - if (((msb >>> j) & i) != 0) { - acc |= 1 << j; - } - j++; - } - bitrev[i * 2] = ((~acc) & mask); - bitrev[i * 2 + 1] = acc; - } - - } - - public function imdct(frq:Vector, window:Vector, pcm:Vector):Void { - - var i:Int; - - var n2:Int; - var n4:Int; - var n8:Int; - - var inO:Int; - var xO:Int; - var A:Int; - - var temp1:Float; - var temp2:Float; - - var B:Int; - var o1:Int; - var o2:Int; - var o3:Int; - var o4:Int; - - var xx:Int; - var xxx:Vector; - - n2 = n >> 1; - n4 = n >> 2; - n8 = n >> 3; - - inO = -1; - xO = 0; - A = n2; - - temp1 = 0.0; - temp2 = 0.0; - - for (i in 0...n8) { - dtmp1 = frq[inO += 2]; - dtmp2 = frq[inO += 2]; - dtmp3 = trig[--A]; - dtmp4 = trig[--A]; - x[xO++] = -dtmp2 * dtmp3 - dtmp1 * dtmp4; - x[xO++] = dtmp1 * dtmp3 - dtmp2 * dtmp4; - } - - inO = n2; - - for(i in 0...n8) { - dtmp1 = frq[inO -= 2]; - dtmp2 = frq[inO -= 2]; - dtmp3 = trig[--A]; - dtmp4 = trig[--A]; - x[xO++] = dtmp2 * dtmp3 + dtmp1 * dtmp4; - x[xO++] = dtmp2 * dtmp4 - dtmp1 * dtmp3; - } - - xxx = kernel(x, w, n, n2, n4, n8); - xx = 0; - - B = n2; - o1 = n4; - o2 = o1 - 1; - o3 = n4 + n2; - o4 = o3 - 1; - - for (i in 0...n4) { - dtmp1 = xxx[xx++]; - dtmp2 = xxx[xx++]; - dtmp3 = trig[B++]; - dtmp4 = trig[B++]; - - temp1 = (dtmp1 * dtmp4 - dtmp2 * dtmp3); - temp2 = -(dtmp1 * dtmp3 + dtmp2 * dtmp4); - - pcm[o1] = -temp1 * window[o1]; - pcm[o2] = temp1 * window[o2]; - pcm[o3] = temp2 * window[o3]; - pcm[o4] = temp2 * window[o4]; - - o1++; - o2--; - o3++; - o4--; - } - - } - - private inline function kernel(x:Vector, w:Vector, n:Int, n2:Int, n4:Int, n8:Int):Vector { - - var i:Int; - var r:Int; - var s:Int; - var rlim:Int; - var slim:Int; - - var xA:Int = n4; - var xB:Int = 0; - var w1:Int = 0; - var w2:Int = n4; - var A:Int = n2; - - var x0:Float; - var x1:Float; - var wA:Float; - var wB:Float; - var wC:Float; - var wD:Float; - var k0:Int; - var k1:Int; - var t1:Int; - var t2:Int; - - var wbase:Int; - var temp:Vector; - - var wACE:Float; - var wBCE:Float; - var wACO:Float; - var wBCO:Float; - - var AEv:Float; - var AOv:Float; - - i=0; - while(i < n4) { - x0 = x[xA] - x[xB]; - - w[w2 + i] = x[xA++] + x[xB++]; - - x1 = x[xA] - x[xB]; - A -= 4; - - w[i++] = x0 * trig[A] + x1 * trig[A + 1]; - w[i] = x1 * trig[A] - x0 * trig[A + 1]; - - w[w2 + i] = x[xA++] + x[xB++]; - i++; - } - - for (i in 0...log2n-3) { - k0 = n >>> (i + 2); - k1 = 1 << (i + 3); - wbase = n2 - 2; - - A = 0; - - rlim = k0 >>> 2; - for (r in 0...rlim) { - - w1 = wbase; - w2 = w1 - (k0 >> 1); - AEv = trig[A]; - AOv = trig[A + 1]; - wbase -= 2; - - k0++; - - slim = 2 << i; - for (s in 0...slim) { - dtmp1 = w[w1]; - dtmp2 = w[w2]; - wB = dtmp1 - dtmp2; - x[w1] = dtmp1 + dtmp2; - dtmp1 = w[++w1]; - dtmp2 = w[++w2]; - wA = dtmp1 - dtmp2; - x[w1] = dtmp1 + dtmp2; - x[w2] = wA * AEv - wB * AOv; - x[w2-1] = wB * AEv + wA * AOv; - w1 -= k0; - w2 -= k0; - } - k0--; - A += k1; - } - - temp = w; - w = x; - x = temp; - } - - - var C:Int = n; - var bit:Int = 0; - var xx1:Int = 0; - var xx2:Int = n2 - 1; - - var wt1: Float; - var wt2: Float; - var wt12: Float; - var wt21: Float; - var trigV: Float; - - for (i in 0...n8) { - t1 = bitrev[bit++]; - t2 = bitrev[bit++]; - - wt1 = w[t1]; - wt2 = w[t2]; - wt12 = w[t1-1]; - wt21 = w[t2+1]; - - wA = wt1 - wt21; - wB = wt12 + wt2; - wC = wt1 + wt21; - wD = wt12 - wt2; - - trigV = trig[C]; - - wACE = wA * trigV; - wBCE = wB * trigV; - - trigV = trig[++C]; - - wACO = wA * trigV; - wBCO = wB * trigV; - - ++C; - - x[xx1++] = (wC + wACO + wBCE); - x[xx2--] = (-wD + wBCO - wACE); - x[xx1++] = (wD + wBCO - wACE); - x[xx2--] = (wC - wACO - wBCE); - } - - return x; - } - - /* - * Dummy function required for the haXe compiler to build this to - * a .SWF file. - */ - public static function main() : Void { - } - -} +/* + +Copyright 2008 Tor-Einar Jarnbjo + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +*/ + +package org.omtk.vorbis; + +import flash.Vector; + +class MdctHX { + + private static var cPI1_8:Float = 0.92387953251128675613; + private static var cPI2_8:Float = 0.70710678118654752441; + private static var cPI3_8:Float = 0.38268343236508977175; + + private var n:Int; + private var log2n:Int; + private var trig:Vector; + private var bitrev:Vector; + + private var dtmp1:Float; + private var dtmp2:Float; + private var dtmp3:Float; + private var dtmp4:Float; + + private var x:Vector; + private var w:Vector; + + public function new(n:Int) { + this.n = n; + + var i:Int; + var j:Int; + + bitrev = new Vector(); + trig = new Vector(Std.int(n+n/4), true); + + for(i in 0...Std.int(n+n/4)) { + trig[i] = 0; + } + + x = new Vector(Std.int(n/2), true); + w = new Vector(Std.int(n/2), true); + + for(i in 0...Std.int(n/2)) { + x[i] = 0; + w[i] = 0; + } + + var n2:Int = n >>> 1; + log2n = Math.round(Math.log(n) / Math.log(2)); + + var AE:Int = 0; + var AO:Int = 1; + var BE:Int = Std.int(AE + n / 2); + var BO:Int = BE + 1; + var CE:Int = Std.int(BE + n / 2); + var CO:Int = CE + 1; + + for (i in 0...Std.int(n/4)) { + trig[AE + i * 2] = Math.cos((Math.PI / n) * (4 * i)); + trig[AO + i * 2] = -Math.sin((Math.PI / n) * (4 * i)); + trig[BE + i * 2] = Math.cos((Math.PI / (2 * n)) * (2 * i + 1)); + trig[BO + i * 2] = Math.sin((Math.PI / (2 * n)) * (2 * i + 1)); + } + + for (i in 0...Std.int(n/8)) { + trig[CE + i * 2] = Math.cos((Math.PI / n) * (4 * i + 2)); + trig[CO + i * 2] = -Math.sin((Math.PI / n) * (4 * i + 2)); + } + + var mask:Int = (1 << (log2n - 1)) - 1; + var msb:Int = 1 << (log2n - 2); + + for (i in 0...Std.int(n/8)) { + var acc:Int = 0; + j = 0; + while(msb>>>j!=0) { + if (((msb >>> j) & i) != 0) { + acc |= 1 << j; + } + j++; + } + bitrev[i * 2] = ((~acc) & mask); + bitrev[i * 2 + 1] = acc; + } + + } + + public function imdct(frq:Vector, window:Vector, pcm:Vector):Void { + + var i:Int; + + var n2:Int; + var n4:Int; + var n8:Int; + + var inO:Int; + var xO:Int; + var A:Int; + + var temp1:Float; + var temp2:Float; + + var B:Int; + var o1:Int; + var o2:Int; + var o3:Int; + var o4:Int; + + var xx:Int; + var xxx:Vector; + + n2 = n >> 1; + n4 = n >> 2; + n8 = n >> 3; + + inO = -1; + xO = 0; + A = n2; + + temp1 = 0.0; + temp2 = 0.0; + + for (i in 0...n8) { + dtmp1 = frq[inO += 2]; + dtmp2 = frq[inO += 2]; + dtmp3 = trig[--A]; + dtmp4 = trig[--A]; + x[xO++] = -dtmp2 * dtmp3 - dtmp1 * dtmp4; + x[xO++] = dtmp1 * dtmp3 - dtmp2 * dtmp4; + } + + inO = n2; + + for(i in 0...n8) { + dtmp1 = frq[inO -= 2]; + dtmp2 = frq[inO -= 2]; + dtmp3 = trig[--A]; + dtmp4 = trig[--A]; + x[xO++] = dtmp2 * dtmp3 + dtmp1 * dtmp4; + x[xO++] = dtmp2 * dtmp4 - dtmp1 * dtmp3; + } + + xxx = kernel(x, w, n, n2, n4, n8); + xx = 0; + + B = n2; + o1 = n4; + o2 = o1 - 1; + o3 = n4 + n2; + o4 = o3 - 1; + + for (i in 0...n4) { + dtmp1 = xxx[xx++]; + dtmp2 = xxx[xx++]; + dtmp3 = trig[B++]; + dtmp4 = trig[B++]; + + temp1 = (dtmp1 * dtmp4 - dtmp2 * dtmp3); + temp2 = -(dtmp1 * dtmp3 + dtmp2 * dtmp4); + + pcm[o1] = -temp1 * window[o1]; + pcm[o2] = temp1 * window[o2]; + pcm[o3] = temp2 * window[o3]; + pcm[o4] = temp2 * window[o4]; + + o1++; + o2--; + o3++; + o4--; + } + + } + + private inline function kernel(x:Vector, w:Vector, n:Int, n2:Int, n4:Int, n8:Int):Vector { + + var i:Int; + var r:Int; + var s:Int; + var rlim:Int; + var slim:Int; + + var xA:Int = n4; + var xB:Int = 0; + var w1:Int = 0; + var w2:Int = n4; + var A:Int = n2; + + var x0:Float; + var x1:Float; + var wA:Float; + var wB:Float; + var wC:Float; + var wD:Float; + var k0:Int; + var k1:Int; + var t1:Int; + var t2:Int; + + var wbase:Int; + var temp:Vector; + + var wACE:Float; + var wBCE:Float; + var wACO:Float; + var wBCO:Float; + + var AEv:Float; + var AOv:Float; + + i=0; + while(i < n4) { + x0 = x[xA] - x[xB]; + + w[w2 + i] = x[xA++] + x[xB++]; + + x1 = x[xA] - x[xB]; + A -= 4; + + w[i++] = x0 * trig[A] + x1 * trig[A + 1]; + w[i] = x1 * trig[A] - x0 * trig[A + 1]; + + w[w2 + i] = x[xA++] + x[xB++]; + i++; + } + + for (i in 0...log2n-3) { + k0 = n >>> (i + 2); + k1 = 1 << (i + 3); + wbase = n2 - 2; + + A = 0; + + rlim = k0 >>> 2; + for (r in 0...rlim) { + + w1 = wbase; + w2 = w1 - (k0 >> 1); + AEv = trig[A]; + AOv = trig[A + 1]; + wbase -= 2; + + k0++; + + slim = 2 << i; + for (s in 0...slim) { + dtmp1 = w[w1]; + dtmp2 = w[w2]; + wB = dtmp1 - dtmp2; + x[w1] = dtmp1 + dtmp2; + dtmp1 = w[++w1]; + dtmp2 = w[++w2]; + wA = dtmp1 - dtmp2; + x[w1] = dtmp1 + dtmp2; + x[w2] = wA * AEv - wB * AOv; + x[w2-1] = wB * AEv + wA * AOv; + w1 -= k0; + w2 -= k0; + } + k0--; + A += k1; + } + + temp = w; + w = x; + x = temp; + } + + + var C:Int = n; + var bit:Int = 0; + var xx1:Int = 0; + var xx2:Int = n2 - 1; + + var wt1: Float; + var wt2: Float; + var wt12: Float; + var wt21: Float; + var trigV: Float; + + for (i in 0...n8) { + t1 = bitrev[bit++]; + t2 = bitrev[bit++]; + + wt1 = w[t1]; + wt2 = w[t2]; + wt12 = w[t1-1]; + wt21 = w[t2+1]; + + wA = wt1 - wt21; + wB = wt12 + wt2; + wC = wt1 + wt21; + wD = wt12 - wt2; + + trigV = trig[C]; + + wACE = wA * trigV; + wBCE = wB * trigV; + + trigV = trig[++C]; + + wACO = wA * trigV; + wBCO = wB * trigV; + + ++C; + + x[xx1++] = (wC + wACO + wBCE); + x[xx2--] = (-wD + wBCO - wACE); + x[xx1++] = (wD + wBCO - wACE); + x[xx2--] = (wC - wACO - wBCE); + } + + return x; + } + + /* + * Dummy function required for the haXe compiler to build this to + * a .SWF file. + */ + public static function main() : Void { + } + +} diff --git a/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan-zh-hant.srt b/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan-zh-hant.srt index 3afc899bdb..734c4bfc9b 100644 --- a/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan-zh-hant.srt +++ b/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan-zh-hant.srt @@ -1,1392 +1,1392 @@ -1 -00:00:01,080 --> 00:00:09,078 -片名:鐵扇公主 - -2 -00:02:03,119 --> 00:02:09,280 -西遊記,本為一部絕妙之童話 - -3 -00:02:09,280 --> 00:02:15,280 -特以世多誤解,致被目為神怪小說 - -4 -00:02:15,280 --> 00:02:19,240 -本片取材於是 - -5 -00:02:19,240 --> 00:02:24,240 -實為培育兒童心理而作 - -6 -00:02:24,240 --> 00:02:29,280 -故內容刪蕪存精,不涉神怪 - -7 -00:02:29,280 --> 00:02:32,560 -僅以唐僧等四人路阻火焰山 - -8 -00:02:32,560 --> 00:02:41,040 -以示人生途徑中之磨難 - -9 -00:02:41,040 --> 00:02:46,440 -欲求經此磨難,則必須堅持信念 -大眾一心 - -10 -00:02:46,440 --> 00:02:52,436 -始能獲得此撲滅凶焰之芭蕉扇 - -11 -00:03:34,480 --> 00:03:37,790 -現在已經秋天了,怎麼還這麼熱 - -12 -00:03:37,840 --> 00:03:42,356 -呆子,不要說廢話,趕路要緊 - -13 -00:04:06,920 --> 00:04:09,354 -悟空,這是到了什麼地方 - -14 -00:04:09,400 --> 00:04:13,678 -反正是我們上西天必定要經過的地方 - -15 -00:04:13,720 --> 00:04:18,111 -我們沒有走錯路線吧 - -16 -00:04:18,159 --> 00:04:22,311 -為什麼這個地方這麼樣的熱呢 - -17 -00:04:30,039 --> 00:04:31,711 -師傅,你看 - -18 -00:04:31,759 --> 00:04:33,795 -前面那兒,不是有一座房子了嗎 - -19 -00:04:33,839 --> 00:04:38,117 -我們大家進去歇息一會兒好吧 - -20 -00:04:59,399 --> 00:05:02,914 -這個地方名叫火焰山 - -21 -00:05:02,959 --> 00:05:06,031 -周圍有幾百里的火焰 - -22 -00:05:06,079 --> 00:05:08,752 -一根草都不生 - -23 -00:05:08,799 --> 00:05:11,632 -一年四季都是熱的 - -24 -00:05:11,680 --> 00:05:19,633 -就是銅頭鐵臂要經過那個山 -也得融化成水 - -25 -00:05:19,679 --> 00:05:23,592 -哪有這種事,師傅,你請放心 - -26 -00:05:23,639 --> 00:05:27,154 -我們三個人都有法子可以過去 - -27 -00:05:27,199 --> 00:05:30,714 -師傅,我去看看好吧 - -28 -00:08:06,319 --> 00:08:09,595 -悟空,你去看了怎麼樣 - -29 -00:08:09,639 --> 00:08:11,834 -厲害,厲害,真厲言 - -30 -00:08:11,880 --> 00:08:15,919 -要不是我跑得快,尾巴都燒光了 - -31 -00:08:42,720 --> 00:08:47,600 -老施主,這裡的火這樣大 - -32 -00:08:47,600 --> 00:08:49,670 -這五穀從哪兒來的 - -33 -00:08:49,719 --> 00:08:53,997 -你看這兒有一千多里的路 -有一位鐵扇公主 - -34 -00:08:54,040 --> 00:08:56,508 -她有一把芭蕉扇 - -35 -00:08:56,560 --> 00:08:59,074 -一扇呢,火就熄了 - -36 -00:08:59,120 --> 00:09:01,634 -兩扇呢,風就來了 - -37 -00:09:01,680 --> 00:09:03,989 -三扇呢,就下雨了 - -38 -00:09:04,040 --> 00:09:07,510 -我們就從這個時候播種收割 - -39 -00:09:07,560 --> 00:09:11,348 -不過,要請那位公主來 - -40 -00:09:11,400 --> 00:09:14,870 -可不是一件容易的事 - -41 -00:09:14,919 --> 00:09:16,830 -她住在什麼地方 - -42 -00:09:16,880 --> 00:09:20,190 -她住在翠雲山芭蕉洞 - -43 -00:09:20,240 --> 00:09:23,676 -是她一個人住在那兒嗎 - -44 -00:09:23,720 --> 00:09:25,756 -她有沒有丈夫啊 - -45 -00:09:25,800 --> 00:09:29,588 -她的丈夫是牛魔王 - -46 -00:09:29,640 --> 00:09:32,200 -原來是老牛 - -47 -00:09:32,240 --> 00:09:36,791 -呆子,你竟然認識他嗎? -跟我一塊兒借扇子去 - -48 -00:09:36,840 --> 00:09:41,755 -我…我知道老牛不住在那兒的 - -49 -00:09:41,800 --> 00:09:46,351 -在他男人不在家的時候 -我們去找他的女人 - -50 -00:09:46,400 --> 00:09:51,520 -這…這有點不大方便吧 - -51 -00:09:51,560 --> 00:09:58,318 -你們…兩個人…去吧 - -52 -00:09:58,360 --> 00:10:05,198 -我…我在…這兒…伺候師父 - -53 -00:10:05,240 --> 00:10:11,270 -悟淨,你也跟你兩個師兄一同去吧 - -54 -00:10:47,200 --> 00:10:51,557 -呆子,每次都是我去打頭陣的 - -55 -00:10:51,600 --> 00:10:54,353 -這次該你去了 - -56 -00:10:58,520 --> 00:11:04,914 -三弟,每次都是我去打頭陣 -這次該你去了 - -57 -00:11:04,960 --> 00:11:06,837 -大師兄 - -58 -00:11:06,880 --> 00:11:10,998 -我叫你去給師父出一點力 -你都不肯嗎 - -59 -00:11:11,040 --> 00:11:14,316 -快去… - -60 -00:11:39,640 --> 00:11:43,040 -你是哪兒跑來的野和尚 - -61 -00:11:43,040 --> 00:11:49,878 -大唐…聖僧…要你家…大公主… - -62 -00:11:49,920 --> 00:11:52,480 -胡說 - -63 -00:12:47,559 --> 00:12:52,075 -大…大師兄,還是你去吧 - -64 -00:12:52,120 --> 00:12:56,955 -呆子,你去 - -65 -00:12:57,000 --> 00:13:00,709 -大師兄,還是你去吧 - -66 -00:13:04,039 --> 00:13:07,475 -偷懶的東西 - -67 -00:13:54,280 --> 00:13:57,909 -好雷公菩薩,你饒了我放了我吧 - -68 -00:13:57,960 --> 00:13:59,951 -你跟你們公主說 - -69 -00:14:00,000 --> 00:14:03,280 -我孫悟空要來借芭蕉扇 - -70 -00:14:03,280 --> 00:14:08,400 -好,好,你放了我,我就去 - -71 -00:14:29,560 --> 00:14:37,069 -奶奶,外面有一個孫悟空 -要來借芭蕉扇 - -72 -00:14:41,520 --> 00:14:44,159 -快拿我的劍來 - -73 -00:15:01,640 --> 00:15:04,154 -孫悟空,害我兒子的仇人 - -74 -00:15:04,200 --> 00:15:08,557 -你今天也敢自己來送死嗎 - -75 -00:15:08,600 --> 00:15:12,040 -我是從來沒見過你,怎麼會害你的兒子 - -76 -00:15:12,040 --> 00:15:15,794 -我的孩子紅孩兒不是你害死的嗎 - -77 -00:15:15,840 --> 00:15:20,391 -令郎已成正果,怎麼說老孫害他呢 - -78 -00:15:20,440 --> 00:15:23,750 -少說廢話,伸過頭來讓我砍幾劍 - -79 -00:15:23,800 --> 00:15:26,155 -受得住我就把芭蕉扇借給你 - -80 -00:15:26,200 --> 00:15:28,555 -真的嗎 - -81 -00:15:56,800 --> 00:16:00,634 -慢著,快把扇子借給我 - -82 -00:17:53,639 --> 00:18:00,112 -大聖不保唐僧到西天去 -來到這兒做什麼 - -83 -00:18:11,159 --> 00:18:17,155 -我被鐵扇公主一扇扇到這兒來的 - -84 -00:18:17,199 --> 00:18:23,877 -大聖你來得巧極了 -我有一樣東西送給你 - -85 -00:18:28,519 --> 00:18:33,468 -這裡是一粒定風珠,大聖你有了這珠子 - -86 -00:18:33,519 --> 00:18:36,158 -可以使你的心堅定了 - -87 -00:18:36,199 --> 00:18:39,191 -保那鐵扇公主扇不動你了 - -88 -00:18:39,239 --> 00:18:42,868 -大聖你來看 - -89 -00:19:00,439 --> 00:19:02,555 -謝謝 - -90 -00:19:06,079 --> 00:19:12,314 -大…大師兄…不知給… - -91 -00:19:12,359 --> 00:19:18,707 -吹到什麼…地方去了 - -92 -00:19:18,759 --> 00:19:26,109 -管他呢,讓猴子也吃點舌頭,我們走 - -93 -00:19:35,199 --> 00:19:37,269 -大…大…師兄 - -94 -00:19:37,319 --> 00:19:43,479 -你…被…被…那… - -95 -00:19:43,479 --> 00:19:50,237 -大師兄,你被那個婆娘扇到 -什麼地方去了 - -96 -00:19:50,279 --> 00:19:57,196 -呆子,現在總該你去了 - -97 -00:19:57,239 --> 00:20:00,948 -我不去,我要是被她一扇 - -98 -00:20:00,999 --> 00:20:03,467 -簡直就認不得回來了 - -99 -00:20:03,519 --> 00:20:09,719 -還是…你再去一趟吧 - -100 -00:20:09,719 --> 00:20:12,233 -不去,不去 - -101 -00:20:17,799 --> 00:20:22,793 -下次輪到你,可不准再偷懶了 - -102 -00:20:56,159 --> 00:21:00,152 -這次你儘管扇,扇得我動一動 - -103 -00:21:00,199 --> 00:21:05,227 -我不算男子漢大丈夫 - -104 -00:21:33,679 --> 00:21:38,594 -大師兄,怎麼這回 -她的扇子沒有用啊 - -105 -00:21:46,839 --> 00:21:50,115 -我們來打進去 - -106 -00:23:59,639 --> 00:24:04,190 -快把芭蕉拿出來,給我孫悟空用一用 - -107 -00:24:14,879 --> 00:24:16,915 -孫悟空,你在什麼地方 - -108 -00:24:16,959 --> 00:24:19,996 -我在你肚子裡呢 - -109 -00:24:45,759 --> 00:24:48,557 -孫悟空,你饒了我的命吧 - -110 -00:24:48,599 --> 00:24:51,193 -你把扇子拿出來就是了 - -111 -00:24:51,239 --> 00:24:56,552 -我答應你就是了,請你快點出來吧 - -112 -00:25:00,239 --> 00:25:02,833 -快把扇子拿來 - -113 -00:25:07,439 --> 00:25:09,236 -扇子已經來了 - -114 -00:25:09,280 --> 00:25:12,078 -孫悟空你怎麼還不出來呢 - -115 -00:25:12,119 --> 00:25:16,635 -你把嘴張開來,我就出來了 - -116 -00:25:25,359 --> 00:25:29,432 -孫祖宗,你怎麼還不出來呢 - -117 -00:25:50,359 --> 00:25:55,592 -我在這兒呢,借給我用用就還你的 - -118 -00:26:32,559 --> 00:26:36,598 -師父等了好久了,我們快去吧 - -119 -00:27:01,879 --> 00:27:04,916 -經,經是什麼 - -120 -00:27:04,959 --> 00:27:10,039 -經是天地之間不能辨易的道理 - -121 -00:27:10,039 --> 00:27:14,191 -這個道理也就是做人的道理 - -122 -00:27:14,239 --> 00:27:18,710 -任何一個人有了這個道理 - -123 -00:27:18,759 --> 00:27:25,358 -才可以免去諸般痛苦 -好好的安居樂業 - -124 -00:27:25,399 --> 00:27:29,950 -實實在在的過日子 - -125 -00:27:34,680 --> 00:27:36,352 -反過來說 - -126 -00:27:36,399 --> 00:27:40,108 -要是做人不曉得這個道理 - -127 -00:27:40,159 --> 00:27:46,394 -就跟沉陷在苦海裡頭一樣 -一生一世 - -128 -00:27:46,439 --> 00:27:52,628 -甚至於子孫孫,都得不到幸福 - -129 -00:27:52,679 --> 00:27:55,671 -我為什麼要去取經 - -130 -00:27:55,719 --> 00:28:01,316 -就是因為現在的人都陷在苦海裡了 - -131 -00:28:01,359 --> 00:28:04,192 -要想成就這此些人 - -132 -00:28:04,239 --> 00:28:12,510 -所以在大唐皇帝面前討下這 -重大繁難的差事 - -133 -00:28:15,679 --> 00:28:17,829 -芭蕉扇借到了沒有 - -134 -00:28:17,879 --> 00:28:19,517 -借來了 - -135 -00:28:19,559 --> 00:28:22,790 -是不是這個 - -136 -00:28:22,839 --> 00:28:27,993 -諸位施主,現在扇子既然借到了 - -137 -00:28:28,039 --> 00:28:32,157 -貧僧師徒就要告辭了 - -138 -00:28:32,199 --> 00:28:34,040 -慢一點 - -139 -00:28:34,040 --> 00:28:39,797 -諸位,我想留聖僧在這兒多住幾天 - -140 -00:28:39,839 --> 00:28:41,352 -好不好啊 - -141 -00:28:41,399 --> 00:28:43,469 -好的,好的 - -142 -00:28:43,519 --> 00:28:45,908 -謝謝諸位的好意 - -143 -00:28:45,959 --> 00:28:51,795 -我早走一步就是早一步完成 -我們的任務 - -144 -00:28:51,839 --> 00:28:56,196 -那麼就請令高徒先到火焰山 - -145 -00:28:56,239 --> 00:29:02,155 -扇滅了火之後,再陪聖僧同行 - -146 -00:29:02,199 --> 00:29:05,475 -好,你就去吧 - -147 -00:30:24,479 --> 00:30:30,039 -鐵扇公主真可惡,拿假的芭蕉扇 -來騙我 - -148 -00:30:30,039 --> 00:30:32,792 -我非殺了她不可 - -149 -00:30:32,839 --> 00:30:36,309 -不,殺了她也是枉然 - -150 -00:30:36,359 --> 00:30:39,590 -我素來不願意你多殺人 - -151 -00:30:39,639 --> 00:30:42,995 -我們再想辦法 - -152 -00:30:52,159 --> 00:30:56,232 -師兄,怎麼你也會上她的當 - -153 -00:30:56,279 --> 00:30:58,554 -費了這麼許多的力氣 - -154 -00:30:58,599 --> 00:31:02,114 -卻弄了一把假的扇子來 - -155 -00:31:02,159 --> 00:31:06,516 -笑話,笑話 - -156 -00:31:08,919 --> 00:31:10,432 -那麼你去 - -157 -00:31:10,479 --> 00:31:14,392 -好好,我去我去,我就去 - -158 -00:31:14,439 --> 00:31:17,033 -我去找牛魔王 - -159 -00:31:17,119 --> 00:31:19,952 -這倒是一個好辦法 - -160 -00:31:21,399 --> 00:31:24,550 -師兄,你看好不好 - -161 -00:31:24,599 --> 00:31:27,397 -好,看你的了 - -162 -00:33:07,199 --> 00:33:11,159 -你看我今天化妝得好嗎 - -163 -00:33:11,159 --> 00:33:13,798 -好極了,我的小寶貝 - -164 -00:33:13,839 --> 00:33:17,070 -你陪我到洞外頭去走走,好不好 - -165 -00:33:17,119 --> 00:33:21,556 -我的寶貝,還是你一個人去吧 - -166 -00:33:21,599 --> 00:33:24,830 -本來嘛,我們這種草婆子 - -167 -00:33:24,879 --> 00:33:28,030 -跟你出去了會使你丟臉的 - -168 -00:33:28,079 --> 00:33:32,039 -小寶貝,這是什麼話呢 - -169 -00:33:32,039 --> 00:33:37,511 -你先去,我隨後就來好不好 - -170 -00:35:28,039 --> 00:35:35,673 -女菩薩,你真是天仙下凡 - -171 -00:35:35,719 --> 00:35:37,914 -你…你是什麼人 - -172 -00:35:37,959 --> 00:35:41,474 -我是從芭蕉洞來找牛魔王的 - -173 -00:35:41,520 --> 00:35:43,988 -快放手 - -174 -00:35:49,559 --> 00:35:52,949 -女菩薩,你慢點走 - -175 -00:36:44,239 --> 00:36:49,233 -小寶貝,誰來欺負你 - -176 -00:36:49,279 --> 00:36:50,837 -是你 - -177 -00:36:50,879 --> 00:36:54,349 -我哪裡捨得欺負你呢 - -178 -00:36:56,919 --> 00:36:59,274 -你還是回芭蕉洞去吧 - -179 -00:36:59,320 --> 00:37:01,709 -省得那個不要臉的東西 - -180 -00:37:01,759 --> 00:37:07,675 -時常派人來請你,欺負我 - -181 -00:37:07,719 --> 00:37:11,075 -你說有人來找我 - -182 -00:37:11,119 --> 00:37:15,078 -外邊有一個豬臉的和尚來請你 - -183 -00:37:15,120 --> 00:37:18,510 -差一點把我嚇死了 - -184 -00:37:18,559 --> 00:37:22,757 -真有這回事嗎?待我出去看一看 - -185 -00:37:50,679 --> 00:37:53,796 -牛大哥 - -186 -00:37:53,839 --> 00:37:58,151 -這裡頭有個頂漂亮的小娘們 - -187 -00:37:58,200 --> 00:38:03,991 -呸,那是我的女人,你為什麼要欺負她 - -188 -00:38:04,039 --> 00:38:08,559 -大哥,我不知那就是二嫂,請原瓊 - -189 -00:38:08,559 --> 00:38:11,949 -不知道不見罪,好啊,你走啊 - -190 -00:38:11,999 --> 00:38:16,117 -不不不,我還有事情請大哥幫忙 - -191 -00:38:18,479 --> 00:38:24,719 -小弟保唐僧取經,路過火焰山 - -192 -00:38:24,719 --> 00:38:27,313 -請大哥跟嫂子說一聲 - -193 -00:38:27,359 --> 00:38:30,829 -把這個芭蕉扇借來用一用 - -194 -00:38:30,880 --> 00:38:33,519 -不成,那唐僧和孫悟空 - -195 -00:38:33,519 --> 00:38:35,191 -是我孩子的仇人 - -196 -00:38:35,239 --> 00:38:38,754 -我正要抓他們報仇 - -197 -00:38:38,799 --> 00:38:44,988 -令郎已成正果,請大哥不必再計較吧 - -198 -00:38:45,039 --> 00:38:48,952 -好,看在我們從前的交情 -我不跟你計較 - -199 -00:38:49,000 --> 00:38:51,719 -那麼去吧 - -200 -00:39:38,399 --> 00:39:44,190 -寶貝,那個豬臉和尚 -是我從前一個朋友 - -201 -00:39:44,239 --> 00:39:46,514 -並不是芭蕉洞派來的 - -202 -00:39:46,559 --> 00:39:47,753 -我不相信 - -203 -00:39:47,799 --> 00:39:50,950 -我不騙你 - -204 -00:39:50,999 --> 00:39:54,036 -現在那個和尚到哪兒去了呢 - -205 -00:39:54,119 --> 00:39:57,794 -已經被我打走了 - -206 -00:43:58,639 --> 00:44:01,358 -大王回來了 - -207 -00:44:01,399 --> 00:44:02,388 -奶奶呢 - -208 -00:44:02,439 --> 00:44:04,794 -在裡邊 - -209 -00:44:42,999 --> 00:44:48,232 -今天是什麼風會把大王吹到這兒來的 - -210 -00:44:48,279 --> 00:44:52,272 -聽到孫悟空保唐僧快到這兒 - -211 -00:44:52,320 --> 00:44:56,916 -恐怕他要來借芭蕉扇過火焰山 - -212 -00:44:56,959 --> 00:45:00,872 -那猴子是害我們兒子的仇人 - -213 -00:45:00,919 --> 00:45:08,507 -早晚來了抓著他,讓我們夫妻出出恨 - -214 -00:45:08,559 --> 00:45:12,711 -夫人,你為什麼哭 - -215 -00:45:12,759 --> 00:45:15,717 -那猴子已經來過了 - -216 -00:45:15,759 --> 00:45:18,876 -是我不肯把扇子借給他 - -217 -00:45:18,919 --> 00:45:22,275 -不知道怎麼會跑到我的肚子裡來 - -218 -00:45:22,319 --> 00:45:25,516 -弄得我肚子痛得要命 - -219 -00:45:25,559 --> 00:45:31,399 -後來我沒有法子,只好把扇子借給他 - -220 -00:45:31,399 --> 00:45:38,271 -可惜可惜,你怎麼把扇子借給他 - -221 -00:45:38,320 --> 00:45:40,470 -拿去的是假的 - -222 -00:45:40,519 --> 00:45:43,033 -假的 - -223 -00:46:14,199 --> 00:46:19,876 -開筵慶祝大王歸 - -224 -00:46:19,919 --> 00:46:25,630 -好酒殷勤勸幾杯 - -225 -00:46:25,679 --> 00:46:34,189 -雞又香,鴨又美,豬又肥 - -226 -00:46:34,240 --> 00:46:45,674 -我盡量的歌,我盡量的舞 - -227 -00:46:45,719 --> 00:46:54,514 -你也要盡量的醉 - -228 -00:47:03,599 --> 00:47:16,399 -大王啊,你把舊人丟 - -229 -00:47:16,439 --> 00:47:22,628 -你愛新人媚 - -230 -00:47:22,679 --> 00:47:36,673 -為你淌了多少相思淚 - -231 -00:47:46,719 --> 00:47:55,718 -等一會燈兒吹帳兒垂 - -232 -00:47:55,759 --> 00:48:00,879 -你獨自兒睡 - -233 -00:48:00,879 --> 00:48:05,519 -也嘗嘗這個淒涼味 - -234 -00:48:05,519 --> 00:48:13,437 -恕我不奉陪 - -235 -00:48:18,559 --> 00:48:24,634 -就是同床 - -236 -00:48:24,679 --> 00:48:34,350 -我們各人蓋著各人的被 - -237 -00:48:38,399 --> 00:48:42,392 -大王,我醉了 - -238 -00:48:55,079 --> 00:48:58,151 -夫人,那真扇子你放在什麼地方 - -239 -00:48:58,199 --> 00:49:05,469 -那猴子花樣很多,而且那豬八戒 -本事更大 - -240 -00:49:05,519 --> 00:49:09,797 -當心給他們騙了去 - -241 -00:49:18,360 --> 00:49:21,989 -寶貝不是在這兒嗎 - -242 -00:49:31,439 --> 00:49:39,319 -大王,你出神想什麼呢? -還是收了吧 - -243 -00:49:39,319 --> 00:49:43,551 -小寶貝 - -244 -00:49:43,599 --> 00:49:49,037 -寶貝,你多喝一杯,你喝啊 - -245 -00:49:53,919 --> 00:49:59,519 -今兒晚上,金龍大王 -還要請我去喝酒呢 - -246 -00:49:59,519 --> 00:50:01,430 -那你就該去了 - -247 -00:50:01,479 --> 00:50:02,878 -是的 - -248 -00:50:02,919 --> 00:50:06,628 -你去替爺爺把金睛獸牽出去預備好 - -249 -00:50:06,679 --> 00:50:08,271 -是 - -250 -00:50:08,320 --> 00:50:12,598 -可是,你今兒個晚上去要少喝一點兒 - -251 -00:50:12,639 --> 00:50:15,756 -免得回來睡著叫不醒你 - -252 -00:50:15,800 --> 00:50:19,110 -不好了,爺爺那個金隋獸不見了 - -253 -00:50:19,159 --> 00:50:20,911 -你們全都是死人嗎 - -254 -00:50:20,959 --> 00:50:24,039 -家裡頭的東西怎麼會不見了呢 - -255 -00:50:24,039 --> 00:50:27,918 -寶貝,不要管他們吧 - -256 -00:50:27,960 --> 00:50:31,714 -恐怕是那豬八戒偷了去了 - -257 -00:50:31,759 --> 00:50:35,274 -說不定我要到芭蕉洞去一趟 - -258 -00:50:35,320 --> 00:50:39,313 -原來是你們做好了的圈套 - -259 -00:50:42,280 --> 00:50:48,150 -你還是要到那個不要臉的女人那兒去 - -260 -00:50:48,199 --> 00:50:50,713 -好寶貝,你不要哭了 - -261 -00:50:50,759 --> 00:50:54,069 -我去去就來的 - -262 -00:51:02,679 --> 00:51:07,309 -來來,喝喝 - -263 -00:51:10,359 --> 00:51:12,475 -我現在放心了 - -264 -00:51:12,519 --> 00:51:16,717 -不怕他們偷我們的寶貝 - -265 -00:51:16,759 --> 00:51:21,310 -他們就是偷了去 -不知道把那絲線一拉 - -266 -00:51:21,360 --> 00:51:26,275 -單是一顆珠子也沒有用處啊 - -267 -00:51:26,319 --> 00:51:31,791 -是不是那麼一拉就變成扇子 - -268 -00:51:35,120 --> 00:51:38,078 -大王,你今天喝醉了 - -269 -00:51:38,119 --> 00:51:44,035 -自己的寶貝都忘了,還來問我 - -270 -00:51:49,999 --> 00:51:53,708 -娘子,你看看我是誰 - -271 -00:52:00,320 --> 00:52:03,756 -你是什麼人 - -272 -00:52:03,799 --> 00:52:09,908 -我是唐僧的二徒弟,豬八戒 - -273 -00:52:09,959 --> 00:52:14,794 -對不住,謝謝你,打擾了 - -274 -00:52:19,080 --> 00:52:21,719 -再見 - -275 -00:53:06,839 --> 00:53:10,718 -牛大嫂太風騷 - -276 -00:53:10,760 --> 00:53:14,719 -眾小妖都俊俏 - -277 -00:53:14,759 --> 00:53:24,828 -老豬真有點受不了 - -278 -00:53:24,879 --> 00:53:28,872 -心機巧,手段妙 - -279 -00:53:28,919 --> 00:53:32,832 -居然騙得了無價寶 - -280 -00:53:32,880 --> 00:53:36,793 -這一番勞苦功高 - -281 -00:53:36,839 --> 00:53:38,318 -沙僧該拜倒 - -282 -00:53:38,359 --> 00:53:40,748 -猴兒該領教 - -283 -00:53:40,799 --> 00:53:45,236 -師父也要嚇一跳 - -284 -00:53:45,280 --> 00:53:49,193 -我老豬也有今朝 - -285 -00:53:49,239 --> 00:53:54,359 -我老豬也有今朝 - -286 -00:54:36,720 --> 00:54:40,474 -呆子,事情辦得怎麼樣了 - -287 -00:54:40,519 --> 00:54:42,828 -不僅扇子到手 - -288 -00:54:42,880 --> 00:54:48,796 -鐵扇公主並且還做了我 -半天的老婆 - -289 -00:54:48,839 --> 00:54:51,717 -這倒便宜了你了 - -290 -00:54:58,159 --> 00:55:01,595 -扇子拿來給我看看 - -291 -00:55:16,039 --> 00:55:20,237 -你怎麼會把它縮小了的呀 - -292 -00:55:40,559 --> 00:55:45,349 -老豬,你可認識我嗎 - -293 -00:55:45,399 --> 00:55:49,187 -你不要跟我開玩笑了 - -294 -00:55:49,239 --> 00:55:52,151 -誰跟你開玩笑 - -295 -00:56:42,879 --> 00:56:45,393 -呆子,你去了怎麼樣 - -296 -00:56:45,439 --> 00:56:47,111 -白跑了一趟 - -297 -00:56:47,159 --> 00:56:49,992 -悟能,扇子借來沒有 - -298 -00:56:50,039 --> 00:56:53,349 -我去找牛魔王,他不肯借 - -299 -00:56:53,400 --> 00:56:59,191 -後來,我又變成老牛的樣子 - -300 -00:56:59,239 --> 00:57:03,551 -在鐵扇公主那兒把扇子已經騙過來了 - -301 -00:57:03,599 --> 00:57:10,599 -誰知道他又變成你的樣子又給他騙回去了 - -302 -00:57:10,599 --> 00:57:12,749 -老牛的本領大 - -303 -00:57:12,800 --> 00:57:16,156 -我還被他揍了一頓呢 - -304 -00:57:16,199 --> 00:57:21,398 -呆子,你能辦這樣大的事那 -還算是呆子嗎 - -305 -00:57:21,439 --> 00:57:25,671 -事情不都環在你頭上 - -306 -00:57:30,759 --> 00:57:34,388 -你們不要吵了,趕緊再想辦法 - -307 -00:57:34,439 --> 00:57:40,275 -哪一方…沒…沒有火啊 - -308 -00:57:40,320 --> 00:57:47,078 -東南西北,只有西方有火 - -309 -00:57:47,120 --> 00:57:50,749 -那我們不是要走回去了嗎 - -310 -00:57:50,799 --> 00:57:52,949 -這路不通,不回去怎麼樣呢 - -311 -00:57:52,999 --> 00:57:55,229 -八戒,你不要這樣說 - -312 -00:57:55,279 --> 00:57:59,158 -要成功一件事情總是有阻礙的 - -313 -00:57:59,199 --> 00:58:04,557 -我們要做這樣神聖的事情 -就要堅定我們的信念 - -314 -00:58:04,599 --> 00:58:09,229 -不能因為有一點兒困難 -就中適改變我們的宗旨 - -315 -00:58:09,280 --> 00:58:14,593 -你們這次失敗的原因是由於 -既不同心又不合力 - -316 -00:58:14,639 --> 00:58:17,153 -假使你們三個人一條心 - -317 -00:58:17,199 --> 00:58:20,509 -合起力量,共同跟牛魔王決鬥 - -318 -00:58:20,559 --> 00:58:22,868 -事情一定可以成功的 - -319 -00:58:22,919 --> 00:58:26,039 -我們謹遵師父的命令 - -320 -00:58:26,039 --> 00:58:30,157 -去跟牛魔王爭一個誰勝誰敗 - -321 -00:58:30,199 --> 00:58:34,272 -誰…誰…誰勝誰敗 - -322 -00:58:34,320 --> 00:58:37,710 -那就好極了 - -323 -00:58:37,759 --> 00:58:40,990 -各位受他的害處也不小了 - -324 -00:58:41,040 --> 00:58:43,879 -希望各位也出此些力量 - -325 -00:58:43,879 --> 00:58:49,590 -跟小徒們共同征服牛魔王,消滅火焰山 - -326 -00:58:49,639 --> 00:58:53,837 -免除永遠的禍害 - -327 -00:58:53,879 --> 00:58:57,508 -我們聽從師父的命令,為大家謀幸福 - -328 -00:58:57,559 --> 00:58:58,878 -大家一起出力去 - -329 -00:58:58,919 --> 00:59:01,035 -好 - -330 -01:08:23,239 --> 01:08:25,628 -奶奶,不好了 - -331 -01:08:25,679 --> 01:08:30,799 -爺爺給人家抓住了,你快點去看看吧 - -332 -01:08:54,479 --> 01:08:56,709 -還不過來打,過來打 - -333 -01:08:56,760 --> 01:08:59,718 -慢一點,慢一點 - -334 -01:08:59,760 --> 01:09:05,790 -孽畜,只要你把扇子交出來,饒你不死 - -335 -01:09:05,840 --> 01:09:12,757 -老牛,扇子在什麼地方?快拿出來啊 - -336 -01:09:12,799 --> 01:09:19,352 -在我老…老婆那兒 - -337 -01:09:25,240 --> 01:09:27,993 -夫人,夫人,夫人 - -338 -01:09:28,039 --> 01:09:32,271 -你快點來救救我 - -339 -01:09:32,320 --> 01:09:35,118 -把扇子拿出來吧 - -340 -01:09:35,159 --> 01:09:39,630 -大王,好,好的 - -341 -01:09:43,400 --> 01:09:47,234 -悟空,你再去一趟吧 - +1 +00:00:01,080 --> 00:00:09,078 +片名:鐵扇公主 + +2 +00:02:03,119 --> 00:02:09,280 +西遊記,本為一部絕妙之童話 + +3 +00:02:09,280 --> 00:02:15,280 +特以世多誤解,致被目為神怪小說 + +4 +00:02:15,280 --> 00:02:19,240 +本片取材於是 + +5 +00:02:19,240 --> 00:02:24,240 +實為培育兒童心理而作 + +6 +00:02:24,240 --> 00:02:29,280 +故內容刪蕪存精,不涉神怪 + +7 +00:02:29,280 --> 00:02:32,560 +僅以唐僧等四人路阻火焰山 + +8 +00:02:32,560 --> 00:02:41,040 +以示人生途徑中之磨難 + +9 +00:02:41,040 --> 00:02:46,440 +欲求經此磨難,則必須堅持信念 +大眾一心 + +10 +00:02:46,440 --> 00:02:52,436 +始能獲得此撲滅凶焰之芭蕉扇 + +11 +00:03:34,480 --> 00:03:37,790 +現在已經秋天了,怎麼還這麼熱 + +12 +00:03:37,840 --> 00:03:42,356 +呆子,不要說廢話,趕路要緊 + +13 +00:04:06,920 --> 00:04:09,354 +悟空,這是到了什麼地方 + +14 +00:04:09,400 --> 00:04:13,678 +反正是我們上西天必定要經過的地方 + +15 +00:04:13,720 --> 00:04:18,111 +我們沒有走錯路線吧 + +16 +00:04:18,159 --> 00:04:22,311 +為什麼這個地方這麼樣的熱呢 + +17 +00:04:30,039 --> 00:04:31,711 +師傅,你看 + +18 +00:04:31,759 --> 00:04:33,795 +前面那兒,不是有一座房子了嗎 + +19 +00:04:33,839 --> 00:04:38,117 +我們大家進去歇息一會兒好吧 + +20 +00:04:59,399 --> 00:05:02,914 +這個地方名叫火焰山 + +21 +00:05:02,959 --> 00:05:06,031 +周圍有幾百里的火焰 + +22 +00:05:06,079 --> 00:05:08,752 +一根草都不生 + +23 +00:05:08,799 --> 00:05:11,632 +一年四季都是熱的 + +24 +00:05:11,680 --> 00:05:19,633 +就是銅頭鐵臂要經過那個山 +也得融化成水 + +25 +00:05:19,679 --> 00:05:23,592 +哪有這種事,師傅,你請放心 + +26 +00:05:23,639 --> 00:05:27,154 +我們三個人都有法子可以過去 + +27 +00:05:27,199 --> 00:05:30,714 +師傅,我去看看好吧 + +28 +00:08:06,319 --> 00:08:09,595 +悟空,你去看了怎麼樣 + +29 +00:08:09,639 --> 00:08:11,834 +厲害,厲害,真厲言 + +30 +00:08:11,880 --> 00:08:15,919 +要不是我跑得快,尾巴都燒光了 + +31 +00:08:42,720 --> 00:08:47,600 +老施主,這裡的火這樣大 + +32 +00:08:47,600 --> 00:08:49,670 +這五穀從哪兒來的 + +33 +00:08:49,719 --> 00:08:53,997 +你看這兒有一千多里的路 +有一位鐵扇公主 + +34 +00:08:54,040 --> 00:08:56,508 +她有一把芭蕉扇 + +35 +00:08:56,560 --> 00:08:59,074 +一扇呢,火就熄了 + +36 +00:08:59,120 --> 00:09:01,634 +兩扇呢,風就來了 + +37 +00:09:01,680 --> 00:09:03,989 +三扇呢,就下雨了 + +38 +00:09:04,040 --> 00:09:07,510 +我們就從這個時候播種收割 + +39 +00:09:07,560 --> 00:09:11,348 +不過,要請那位公主來 + +40 +00:09:11,400 --> 00:09:14,870 +可不是一件容易的事 + +41 +00:09:14,919 --> 00:09:16,830 +她住在什麼地方 + +42 +00:09:16,880 --> 00:09:20,190 +她住在翠雲山芭蕉洞 + +43 +00:09:20,240 --> 00:09:23,676 +是她一個人住在那兒嗎 + +44 +00:09:23,720 --> 00:09:25,756 +她有沒有丈夫啊 + +45 +00:09:25,800 --> 00:09:29,588 +她的丈夫是牛魔王 + +46 +00:09:29,640 --> 00:09:32,200 +原來是老牛 + +47 +00:09:32,240 --> 00:09:36,791 +呆子,你竟然認識他嗎? +跟我一塊兒借扇子去 + +48 +00:09:36,840 --> 00:09:41,755 +我…我知道老牛不住在那兒的 + +49 +00:09:41,800 --> 00:09:46,351 +在他男人不在家的時候 +我們去找他的女人 + +50 +00:09:46,400 --> 00:09:51,520 +這…這有點不大方便吧 + +51 +00:09:51,560 --> 00:09:58,318 +你們…兩個人…去吧 + +52 +00:09:58,360 --> 00:10:05,198 +我…我在…這兒…伺候師父 + +53 +00:10:05,240 --> 00:10:11,270 +悟淨,你也跟你兩個師兄一同去吧 + +54 +00:10:47,200 --> 00:10:51,557 +呆子,每次都是我去打頭陣的 + +55 +00:10:51,600 --> 00:10:54,353 +這次該你去了 + +56 +00:10:58,520 --> 00:11:04,914 +三弟,每次都是我去打頭陣 +這次該你去了 + +57 +00:11:04,960 --> 00:11:06,837 +大師兄 + +58 +00:11:06,880 --> 00:11:10,998 +我叫你去給師父出一點力 +你都不肯嗎 + +59 +00:11:11,040 --> 00:11:14,316 +快去… + +60 +00:11:39,640 --> 00:11:43,040 +你是哪兒跑來的野和尚 + +61 +00:11:43,040 --> 00:11:49,878 +大唐…聖僧…要你家…大公主… + +62 +00:11:49,920 --> 00:11:52,480 +胡說 + +63 +00:12:47,559 --> 00:12:52,075 +大…大師兄,還是你去吧 + +64 +00:12:52,120 --> 00:12:56,955 +呆子,你去 + +65 +00:12:57,000 --> 00:13:00,709 +大師兄,還是你去吧 + +66 +00:13:04,039 --> 00:13:07,475 +偷懶的東西 + +67 +00:13:54,280 --> 00:13:57,909 +好雷公菩薩,你饒了我放了我吧 + +68 +00:13:57,960 --> 00:13:59,951 +你跟你們公主說 + +69 +00:14:00,000 --> 00:14:03,280 +我孫悟空要來借芭蕉扇 + +70 +00:14:03,280 --> 00:14:08,400 +好,好,你放了我,我就去 + +71 +00:14:29,560 --> 00:14:37,069 +奶奶,外面有一個孫悟空 +要來借芭蕉扇 + +72 +00:14:41,520 --> 00:14:44,159 +快拿我的劍來 + +73 +00:15:01,640 --> 00:15:04,154 +孫悟空,害我兒子的仇人 + +74 +00:15:04,200 --> 00:15:08,557 +你今天也敢自己來送死嗎 + +75 +00:15:08,600 --> 00:15:12,040 +我是從來沒見過你,怎麼會害你的兒子 + +76 +00:15:12,040 --> 00:15:15,794 +我的孩子紅孩兒不是你害死的嗎 + +77 +00:15:15,840 --> 00:15:20,391 +令郎已成正果,怎麼說老孫害他呢 + +78 +00:15:20,440 --> 00:15:23,750 +少說廢話,伸過頭來讓我砍幾劍 + +79 +00:15:23,800 --> 00:15:26,155 +受得住我就把芭蕉扇借給你 + +80 +00:15:26,200 --> 00:15:28,555 +真的嗎 + +81 +00:15:56,800 --> 00:16:00,634 +慢著,快把扇子借給我 + +82 +00:17:53,639 --> 00:18:00,112 +大聖不保唐僧到西天去 +來到這兒做什麼 + +83 +00:18:11,159 --> 00:18:17,155 +我被鐵扇公主一扇扇到這兒來的 + +84 +00:18:17,199 --> 00:18:23,877 +大聖你來得巧極了 +我有一樣東西送給你 + +85 +00:18:28,519 --> 00:18:33,468 +這裡是一粒定風珠,大聖你有了這珠子 + +86 +00:18:33,519 --> 00:18:36,158 +可以使你的心堅定了 + +87 +00:18:36,199 --> 00:18:39,191 +保那鐵扇公主扇不動你了 + +88 +00:18:39,239 --> 00:18:42,868 +大聖你來看 + +89 +00:19:00,439 --> 00:19:02,555 +謝謝 + +90 +00:19:06,079 --> 00:19:12,314 +大…大師兄…不知給… + +91 +00:19:12,359 --> 00:19:18,707 +吹到什麼…地方去了 + +92 +00:19:18,759 --> 00:19:26,109 +管他呢,讓猴子也吃點舌頭,我們走 + +93 +00:19:35,199 --> 00:19:37,269 +大…大…師兄 + +94 +00:19:37,319 --> 00:19:43,479 +你…被…被…那… + +95 +00:19:43,479 --> 00:19:50,237 +大師兄,你被那個婆娘扇到 +什麼地方去了 + +96 +00:19:50,279 --> 00:19:57,196 +呆子,現在總該你去了 + +97 +00:19:57,239 --> 00:20:00,948 +我不去,我要是被她一扇 + +98 +00:20:00,999 --> 00:20:03,467 +簡直就認不得回來了 + +99 +00:20:03,519 --> 00:20:09,719 +還是…你再去一趟吧 + +100 +00:20:09,719 --> 00:20:12,233 +不去,不去 + +101 +00:20:17,799 --> 00:20:22,793 +下次輪到你,可不准再偷懶了 + +102 +00:20:56,159 --> 00:21:00,152 +這次你儘管扇,扇得我動一動 + +103 +00:21:00,199 --> 00:21:05,227 +我不算男子漢大丈夫 + +104 +00:21:33,679 --> 00:21:38,594 +大師兄,怎麼這回 +她的扇子沒有用啊 + +105 +00:21:46,839 --> 00:21:50,115 +我們來打進去 + +106 +00:23:59,639 --> 00:24:04,190 +快把芭蕉拿出來,給我孫悟空用一用 + +107 +00:24:14,879 --> 00:24:16,915 +孫悟空,你在什麼地方 + +108 +00:24:16,959 --> 00:24:19,996 +我在你肚子裡呢 + +109 +00:24:45,759 --> 00:24:48,557 +孫悟空,你饒了我的命吧 + +110 +00:24:48,599 --> 00:24:51,193 +你把扇子拿出來就是了 + +111 +00:24:51,239 --> 00:24:56,552 +我答應你就是了,請你快點出來吧 + +112 +00:25:00,239 --> 00:25:02,833 +快把扇子拿來 + +113 +00:25:07,439 --> 00:25:09,236 +扇子已經來了 + +114 +00:25:09,280 --> 00:25:12,078 +孫悟空你怎麼還不出來呢 + +115 +00:25:12,119 --> 00:25:16,635 +你把嘴張開來,我就出來了 + +116 +00:25:25,359 --> 00:25:29,432 +孫祖宗,你怎麼還不出來呢 + +117 +00:25:50,359 --> 00:25:55,592 +我在這兒呢,借給我用用就還你的 + +118 +00:26:32,559 --> 00:26:36,598 +師父等了好久了,我們快去吧 + +119 +00:27:01,879 --> 00:27:04,916 +經,經是什麼 + +120 +00:27:04,959 --> 00:27:10,039 +經是天地之間不能辨易的道理 + +121 +00:27:10,039 --> 00:27:14,191 +這個道理也就是做人的道理 + +122 +00:27:14,239 --> 00:27:18,710 +任何一個人有了這個道理 + +123 +00:27:18,759 --> 00:27:25,358 +才可以免去諸般痛苦 +好好的安居樂業 + +124 +00:27:25,399 --> 00:27:29,950 +實實在在的過日子 + +125 +00:27:34,680 --> 00:27:36,352 +反過來說 + +126 +00:27:36,399 --> 00:27:40,108 +要是做人不曉得這個道理 + +127 +00:27:40,159 --> 00:27:46,394 +就跟沉陷在苦海裡頭一樣 +一生一世 + +128 +00:27:46,439 --> 00:27:52,628 +甚至於子孫孫,都得不到幸福 + +129 +00:27:52,679 --> 00:27:55,671 +我為什麼要去取經 + +130 +00:27:55,719 --> 00:28:01,316 +就是因為現在的人都陷在苦海裡了 + +131 +00:28:01,359 --> 00:28:04,192 +要想成就這此些人 + +132 +00:28:04,239 --> 00:28:12,510 +所以在大唐皇帝面前討下這 +重大繁難的差事 + +133 +00:28:15,679 --> 00:28:17,829 +芭蕉扇借到了沒有 + +134 +00:28:17,879 --> 00:28:19,517 +借來了 + +135 +00:28:19,559 --> 00:28:22,790 +是不是這個 + +136 +00:28:22,839 --> 00:28:27,993 +諸位施主,現在扇子既然借到了 + +137 +00:28:28,039 --> 00:28:32,157 +貧僧師徒就要告辭了 + +138 +00:28:32,199 --> 00:28:34,040 +慢一點 + +139 +00:28:34,040 --> 00:28:39,797 +諸位,我想留聖僧在這兒多住幾天 + +140 +00:28:39,839 --> 00:28:41,352 +好不好啊 + +141 +00:28:41,399 --> 00:28:43,469 +好的,好的 + +142 +00:28:43,519 --> 00:28:45,908 +謝謝諸位的好意 + +143 +00:28:45,959 --> 00:28:51,795 +我早走一步就是早一步完成 +我們的任務 + +144 +00:28:51,839 --> 00:28:56,196 +那麼就請令高徒先到火焰山 + +145 +00:28:56,239 --> 00:29:02,155 +扇滅了火之後,再陪聖僧同行 + +146 +00:29:02,199 --> 00:29:05,475 +好,你就去吧 + +147 +00:30:24,479 --> 00:30:30,039 +鐵扇公主真可惡,拿假的芭蕉扇 +來騙我 + +148 +00:30:30,039 --> 00:30:32,792 +我非殺了她不可 + +149 +00:30:32,839 --> 00:30:36,309 +不,殺了她也是枉然 + +150 +00:30:36,359 --> 00:30:39,590 +我素來不願意你多殺人 + +151 +00:30:39,639 --> 00:30:42,995 +我們再想辦法 + +152 +00:30:52,159 --> 00:30:56,232 +師兄,怎麼你也會上她的當 + +153 +00:30:56,279 --> 00:30:58,554 +費了這麼許多的力氣 + +154 +00:30:58,599 --> 00:31:02,114 +卻弄了一把假的扇子來 + +155 +00:31:02,159 --> 00:31:06,516 +笑話,笑話 + +156 +00:31:08,919 --> 00:31:10,432 +那麼你去 + +157 +00:31:10,479 --> 00:31:14,392 +好好,我去我去,我就去 + +158 +00:31:14,439 --> 00:31:17,033 +我去找牛魔王 + +159 +00:31:17,119 --> 00:31:19,952 +這倒是一個好辦法 + +160 +00:31:21,399 --> 00:31:24,550 +師兄,你看好不好 + +161 +00:31:24,599 --> 00:31:27,397 +好,看你的了 + +162 +00:33:07,199 --> 00:33:11,159 +你看我今天化妝得好嗎 + +163 +00:33:11,159 --> 00:33:13,798 +好極了,我的小寶貝 + +164 +00:33:13,839 --> 00:33:17,070 +你陪我到洞外頭去走走,好不好 + +165 +00:33:17,119 --> 00:33:21,556 +我的寶貝,還是你一個人去吧 + +166 +00:33:21,599 --> 00:33:24,830 +本來嘛,我們這種草婆子 + +167 +00:33:24,879 --> 00:33:28,030 +跟你出去了會使你丟臉的 + +168 +00:33:28,079 --> 00:33:32,039 +小寶貝,這是什麼話呢 + +169 +00:33:32,039 --> 00:33:37,511 +你先去,我隨後就來好不好 + +170 +00:35:28,039 --> 00:35:35,673 +女菩薩,你真是天仙下凡 + +171 +00:35:35,719 --> 00:35:37,914 +你…你是什麼人 + +172 +00:35:37,959 --> 00:35:41,474 +我是從芭蕉洞來找牛魔王的 + +173 +00:35:41,520 --> 00:35:43,988 +快放手 + +174 +00:35:49,559 --> 00:35:52,949 +女菩薩,你慢點走 + +175 +00:36:44,239 --> 00:36:49,233 +小寶貝,誰來欺負你 + +176 +00:36:49,279 --> 00:36:50,837 +是你 + +177 +00:36:50,879 --> 00:36:54,349 +我哪裡捨得欺負你呢 + +178 +00:36:56,919 --> 00:36:59,274 +你還是回芭蕉洞去吧 + +179 +00:36:59,320 --> 00:37:01,709 +省得那個不要臉的東西 + +180 +00:37:01,759 --> 00:37:07,675 +時常派人來請你,欺負我 + +181 +00:37:07,719 --> 00:37:11,075 +你說有人來找我 + +182 +00:37:11,119 --> 00:37:15,078 +外邊有一個豬臉的和尚來請你 + +183 +00:37:15,120 --> 00:37:18,510 +差一點把我嚇死了 + +184 +00:37:18,559 --> 00:37:22,757 +真有這回事嗎?待我出去看一看 + +185 +00:37:50,679 --> 00:37:53,796 +牛大哥 + +186 +00:37:53,839 --> 00:37:58,151 +這裡頭有個頂漂亮的小娘們 + +187 +00:37:58,200 --> 00:38:03,991 +呸,那是我的女人,你為什麼要欺負她 + +188 +00:38:04,039 --> 00:38:08,559 +大哥,我不知那就是二嫂,請原瓊 + +189 +00:38:08,559 --> 00:38:11,949 +不知道不見罪,好啊,你走啊 + +190 +00:38:11,999 --> 00:38:16,117 +不不不,我還有事情請大哥幫忙 + +191 +00:38:18,479 --> 00:38:24,719 +小弟保唐僧取經,路過火焰山 + +192 +00:38:24,719 --> 00:38:27,313 +請大哥跟嫂子說一聲 + +193 +00:38:27,359 --> 00:38:30,829 +把這個芭蕉扇借來用一用 + +194 +00:38:30,880 --> 00:38:33,519 +不成,那唐僧和孫悟空 + +195 +00:38:33,519 --> 00:38:35,191 +是我孩子的仇人 + +196 +00:38:35,239 --> 00:38:38,754 +我正要抓他們報仇 + +197 +00:38:38,799 --> 00:38:44,988 +令郎已成正果,請大哥不必再計較吧 + +198 +00:38:45,039 --> 00:38:48,952 +好,看在我們從前的交情 +我不跟你計較 + +199 +00:38:49,000 --> 00:38:51,719 +那麼去吧 + +200 +00:39:38,399 --> 00:39:44,190 +寶貝,那個豬臉和尚 +是我從前一個朋友 + +201 +00:39:44,239 --> 00:39:46,514 +並不是芭蕉洞派來的 + +202 +00:39:46,559 --> 00:39:47,753 +我不相信 + +203 +00:39:47,799 --> 00:39:50,950 +我不騙你 + +204 +00:39:50,999 --> 00:39:54,036 +現在那個和尚到哪兒去了呢 + +205 +00:39:54,119 --> 00:39:57,794 +已經被我打走了 + +206 +00:43:58,639 --> 00:44:01,358 +大王回來了 + +207 +00:44:01,399 --> 00:44:02,388 +奶奶呢 + +208 +00:44:02,439 --> 00:44:04,794 +在裡邊 + +209 +00:44:42,999 --> 00:44:48,232 +今天是什麼風會把大王吹到這兒來的 + +210 +00:44:48,279 --> 00:44:52,272 +聽到孫悟空保唐僧快到這兒 + +211 +00:44:52,320 --> 00:44:56,916 +恐怕他要來借芭蕉扇過火焰山 + +212 +00:44:56,959 --> 00:45:00,872 +那猴子是害我們兒子的仇人 + +213 +00:45:00,919 --> 00:45:08,507 +早晚來了抓著他,讓我們夫妻出出恨 + +214 +00:45:08,559 --> 00:45:12,711 +夫人,你為什麼哭 + +215 +00:45:12,759 --> 00:45:15,717 +那猴子已經來過了 + +216 +00:45:15,759 --> 00:45:18,876 +是我不肯把扇子借給他 + +217 +00:45:18,919 --> 00:45:22,275 +不知道怎麼會跑到我的肚子裡來 + +218 +00:45:22,319 --> 00:45:25,516 +弄得我肚子痛得要命 + +219 +00:45:25,559 --> 00:45:31,399 +後來我沒有法子,只好把扇子借給他 + +220 +00:45:31,399 --> 00:45:38,271 +可惜可惜,你怎麼把扇子借給他 + +221 +00:45:38,320 --> 00:45:40,470 +拿去的是假的 + +222 +00:45:40,519 --> 00:45:43,033 +假的 + +223 +00:46:14,199 --> 00:46:19,876 +開筵慶祝大王歸 + +224 +00:46:19,919 --> 00:46:25,630 +好酒殷勤勸幾杯 + +225 +00:46:25,679 --> 00:46:34,189 +雞又香,鴨又美,豬又肥 + +226 +00:46:34,240 --> 00:46:45,674 +我盡量的歌,我盡量的舞 + +227 +00:46:45,719 --> 00:46:54,514 +你也要盡量的醉 + +228 +00:47:03,599 --> 00:47:16,399 +大王啊,你把舊人丟 + +229 +00:47:16,439 --> 00:47:22,628 +你愛新人媚 + +230 +00:47:22,679 --> 00:47:36,673 +為你淌了多少相思淚 + +231 +00:47:46,719 --> 00:47:55,718 +等一會燈兒吹帳兒垂 + +232 +00:47:55,759 --> 00:48:00,879 +你獨自兒睡 + +233 +00:48:00,879 --> 00:48:05,519 +也嘗嘗這個淒涼味 + +234 +00:48:05,519 --> 00:48:13,437 +恕我不奉陪 + +235 +00:48:18,559 --> 00:48:24,634 +就是同床 + +236 +00:48:24,679 --> 00:48:34,350 +我們各人蓋著各人的被 + +237 +00:48:38,399 --> 00:48:42,392 +大王,我醉了 + +238 +00:48:55,079 --> 00:48:58,151 +夫人,那真扇子你放在什麼地方 + +239 +00:48:58,199 --> 00:49:05,469 +那猴子花樣很多,而且那豬八戒 +本事更大 + +240 +00:49:05,519 --> 00:49:09,797 +當心給他們騙了去 + +241 +00:49:18,360 --> 00:49:21,989 +寶貝不是在這兒嗎 + +242 +00:49:31,439 --> 00:49:39,319 +大王,你出神想什麼呢? +還是收了吧 + +243 +00:49:39,319 --> 00:49:43,551 +小寶貝 + +244 +00:49:43,599 --> 00:49:49,037 +寶貝,你多喝一杯,你喝啊 + +245 +00:49:53,919 --> 00:49:59,519 +今兒晚上,金龍大王 +還要請我去喝酒呢 + +246 +00:49:59,519 --> 00:50:01,430 +那你就該去了 + +247 +00:50:01,479 --> 00:50:02,878 +是的 + +248 +00:50:02,919 --> 00:50:06,628 +你去替爺爺把金睛獸牽出去預備好 + +249 +00:50:06,679 --> 00:50:08,271 +是 + +250 +00:50:08,320 --> 00:50:12,598 +可是,你今兒個晚上去要少喝一點兒 + +251 +00:50:12,639 --> 00:50:15,756 +免得回來睡著叫不醒你 + +252 +00:50:15,800 --> 00:50:19,110 +不好了,爺爺那個金隋獸不見了 + +253 +00:50:19,159 --> 00:50:20,911 +你們全都是死人嗎 + +254 +00:50:20,959 --> 00:50:24,039 +家裡頭的東西怎麼會不見了呢 + +255 +00:50:24,039 --> 00:50:27,918 +寶貝,不要管他們吧 + +256 +00:50:27,960 --> 00:50:31,714 +恐怕是那豬八戒偷了去了 + +257 +00:50:31,759 --> 00:50:35,274 +說不定我要到芭蕉洞去一趟 + +258 +00:50:35,320 --> 00:50:39,313 +原來是你們做好了的圈套 + +259 +00:50:42,280 --> 00:50:48,150 +你還是要到那個不要臉的女人那兒去 + +260 +00:50:48,199 --> 00:50:50,713 +好寶貝,你不要哭了 + +261 +00:50:50,759 --> 00:50:54,069 +我去去就來的 + +262 +00:51:02,679 --> 00:51:07,309 +來來,喝喝 + +263 +00:51:10,359 --> 00:51:12,475 +我現在放心了 + +264 +00:51:12,519 --> 00:51:16,717 +不怕他們偷我們的寶貝 + +265 +00:51:16,759 --> 00:51:21,310 +他們就是偷了去 +不知道把那絲線一拉 + +266 +00:51:21,360 --> 00:51:26,275 +單是一顆珠子也沒有用處啊 + +267 +00:51:26,319 --> 00:51:31,791 +是不是那麼一拉就變成扇子 + +268 +00:51:35,120 --> 00:51:38,078 +大王,你今天喝醉了 + +269 +00:51:38,119 --> 00:51:44,035 +自己的寶貝都忘了,還來問我 + +270 +00:51:49,999 --> 00:51:53,708 +娘子,你看看我是誰 + +271 +00:52:00,320 --> 00:52:03,756 +你是什麼人 + +272 +00:52:03,799 --> 00:52:09,908 +我是唐僧的二徒弟,豬八戒 + +273 +00:52:09,959 --> 00:52:14,794 +對不住,謝謝你,打擾了 + +274 +00:52:19,080 --> 00:52:21,719 +再見 + +275 +00:53:06,839 --> 00:53:10,718 +牛大嫂太風騷 + +276 +00:53:10,760 --> 00:53:14,719 +眾小妖都俊俏 + +277 +00:53:14,759 --> 00:53:24,828 +老豬真有點受不了 + +278 +00:53:24,879 --> 00:53:28,872 +心機巧,手段妙 + +279 +00:53:28,919 --> 00:53:32,832 +居然騙得了無價寶 + +280 +00:53:32,880 --> 00:53:36,793 +這一番勞苦功高 + +281 +00:53:36,839 --> 00:53:38,318 +沙僧該拜倒 + +282 +00:53:38,359 --> 00:53:40,748 +猴兒該領教 + +283 +00:53:40,799 --> 00:53:45,236 +師父也要嚇一跳 + +284 +00:53:45,280 --> 00:53:49,193 +我老豬也有今朝 + +285 +00:53:49,239 --> 00:53:54,359 +我老豬也有今朝 + +286 +00:54:36,720 --> 00:54:40,474 +呆子,事情辦得怎麼樣了 + +287 +00:54:40,519 --> 00:54:42,828 +不僅扇子到手 + +288 +00:54:42,880 --> 00:54:48,796 +鐵扇公主並且還做了我 +半天的老婆 + +289 +00:54:48,839 --> 00:54:51,717 +這倒便宜了你了 + +290 +00:54:58,159 --> 00:55:01,595 +扇子拿來給我看看 + +291 +00:55:16,039 --> 00:55:20,237 +你怎麼會把它縮小了的呀 + +292 +00:55:40,559 --> 00:55:45,349 +老豬,你可認識我嗎 + +293 +00:55:45,399 --> 00:55:49,187 +你不要跟我開玩笑了 + +294 +00:55:49,239 --> 00:55:52,151 +誰跟你開玩笑 + +295 +00:56:42,879 --> 00:56:45,393 +呆子,你去了怎麼樣 + +296 +00:56:45,439 --> 00:56:47,111 +白跑了一趟 + +297 +00:56:47,159 --> 00:56:49,992 +悟能,扇子借來沒有 + +298 +00:56:50,039 --> 00:56:53,349 +我去找牛魔王,他不肯借 + +299 +00:56:53,400 --> 00:56:59,191 +後來,我又變成老牛的樣子 + +300 +00:56:59,239 --> 00:57:03,551 +在鐵扇公主那兒把扇子已經騙過來了 + +301 +00:57:03,599 --> 00:57:10,599 +誰知道他又變成你的樣子又給他騙回去了 + +302 +00:57:10,599 --> 00:57:12,749 +老牛的本領大 + +303 +00:57:12,800 --> 00:57:16,156 +我還被他揍了一頓呢 + +304 +00:57:16,199 --> 00:57:21,398 +呆子,你能辦這樣大的事那 +還算是呆子嗎 + +305 +00:57:21,439 --> 00:57:25,671 +事情不都環在你頭上 + +306 +00:57:30,759 --> 00:57:34,388 +你們不要吵了,趕緊再想辦法 + +307 +00:57:34,439 --> 00:57:40,275 +哪一方…沒…沒有火啊 + +308 +00:57:40,320 --> 00:57:47,078 +東南西北,只有西方有火 + +309 +00:57:47,120 --> 00:57:50,749 +那我們不是要走回去了嗎 + +310 +00:57:50,799 --> 00:57:52,949 +這路不通,不回去怎麼樣呢 + +311 +00:57:52,999 --> 00:57:55,229 +八戒,你不要這樣說 + +312 +00:57:55,279 --> 00:57:59,158 +要成功一件事情總是有阻礙的 + +313 +00:57:59,199 --> 00:58:04,557 +我們要做這樣神聖的事情 +就要堅定我們的信念 + +314 +00:58:04,599 --> 00:58:09,229 +不能因為有一點兒困難 +就中適改變我們的宗旨 + +315 +00:58:09,280 --> 00:58:14,593 +你們這次失敗的原因是由於 +既不同心又不合力 + +316 +00:58:14,639 --> 00:58:17,153 +假使你們三個人一條心 + +317 +00:58:17,199 --> 00:58:20,509 +合起力量,共同跟牛魔王決鬥 + +318 +00:58:20,559 --> 00:58:22,868 +事情一定可以成功的 + +319 +00:58:22,919 --> 00:58:26,039 +我們謹遵師父的命令 + +320 +00:58:26,039 --> 00:58:30,157 +去跟牛魔王爭一個誰勝誰敗 + +321 +00:58:30,199 --> 00:58:34,272 +誰…誰…誰勝誰敗 + +322 +00:58:34,320 --> 00:58:37,710 +那就好極了 + +323 +00:58:37,759 --> 00:58:40,990 +各位受他的害處也不小了 + +324 +00:58:41,040 --> 00:58:43,879 +希望各位也出此些力量 + +325 +00:58:43,879 --> 00:58:49,590 +跟小徒們共同征服牛魔王,消滅火焰山 + +326 +00:58:49,639 --> 00:58:53,837 +免除永遠的禍害 + +327 +00:58:53,879 --> 00:58:57,508 +我們聽從師父的命令,為大家謀幸福 + +328 +00:58:57,559 --> 00:58:58,878 +大家一起出力去 + +329 +00:58:58,919 --> 00:59:01,035 +好 + +330 +01:08:23,239 --> 01:08:25,628 +奶奶,不好了 + +331 +01:08:25,679 --> 01:08:30,799 +爺爺給人家抓住了,你快點去看看吧 + +332 +01:08:54,479 --> 01:08:56,709 +還不過來打,過來打 + +333 +01:08:56,760 --> 01:08:59,718 +慢一點,慢一點 + +334 +01:08:59,760 --> 01:09:05,790 +孽畜,只要你把扇子交出來,饒你不死 + +335 +01:09:05,840 --> 01:09:12,757 +老牛,扇子在什麼地方?快拿出來啊 + +336 +01:09:12,799 --> 01:09:19,352 +在我老…老婆那兒 + +337 +01:09:25,240 --> 01:09:27,993 +夫人,夫人,夫人 + +338 +01:09:28,039 --> 01:09:32,271 +你快點來救救我 + +339 +01:09:32,320 --> 01:09:35,118 +把扇子拿出來吧 + +340 +01:09:35,159 --> 01:09:39,630 +大王,好,好的 + +341 +01:09:43,400 --> 01:09:47,234 +悟空,你再去一趟吧 + diff --git a/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan.srt b/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan.srt index 04168a690a..0852d36b32 100644 --- a/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan.srt +++ b/js2/mwEmbed/example_usage/media/princess_archive_org/princess_iron_fan.srt @@ -1,1396 +1,1396 @@ -1 -00:00:01,080 --> 00:00:09,070 -Princess Iron Fan - -2 -00:02:03,109 --> 00:02:09,280 -Journey to the West is a wonderful children's story, - -3 -00:02:09,280 --> 00:02:15,280 -but the world often misunderstands it as a fantasy novel. - -4 -00:02:15,280 --> 00:02:19,240 -This film was made for the purpose of - -5 -00:02:19,240 --> 00:02:24,240 -training the hearts and minds of children. - -6 -00:02:24,240 --> 00:02:29,280 -The story is pure, untainted by fantasy. - -7 -00:02:29,280 --> 00:02:32,560 -Fiery Mountain blocking the path of Tang Seng's company - -8 -00:02:32,560 --> 00:02:41,039 -is a metaphor for the difficulties in life. - -9 -00:02:41,039 --> 00:02:46,439 -In order to overcome them, one must keep faith. -Everybody must work together - -10 -00:02:46,439 --> 00:02:52,430 -in order to obtain the palm leaf fan and put out the flames. - -11 -00:02:52,839 --> 00:02:58,178 -Tripikata True Sutra - -12 -00:03:34,479 --> 00:03:37,789 -It's already autumn, how can it still be so warm? - -13 -00:03:37,840 --> 00:03:42,349 -Fool, don't talk rubbish. We should hurry and get on our way. - -14 -00:04:06,919 --> 00:04:09,349 -Wukong, where is this place? - -15 -00:04:09,400 --> 00:04:13,669 -We must pass through here to continue westwards, that much is certain. - -16 -00:04:13,719 --> 00:04:18,110 -Might we have taken the wrong path? - -17 -00:04:18,149 --> 00:04:21,700 -Why is it so hot here? - -18 -00:04:30,029 --> 00:04:31,649 -Master, look! - -19 -00:04:31,650 --> 00:04:33,779 -Isn't that a house up ahead? - -20 -00:04:33,829 --> 00:04:38,100 -Let's go in and rest for a while, OK? - -21 -00:04:59,389 --> 00:05:02,899 -This place is called Fiery Mountain. - -22 -00:05:02,949 --> 00:05:06,019 -The fire stretches for hundreds of miles. - -23 -00:05:06,069 --> 00:05:08,740 -Not single straw of grass can grow here. - -24 -00:05:08,790 --> 00:05:11,620 -The four seasons of the year are all warm. - -25 -00:05:11,680 --> 00:05:19,629 -You couldn't pass through the mountain even with a head of copper and arms of iron. - -26 -00:05:19,670 --> 00:05:23,579 -What kind of place is this? Master, don't worry! - -27 -00:05:23,629 --> 00:05:27,139 -The three of us are all strong enough to pass! - -28 -00:05:27,189 --> 00:05:30,699 -Master, I'll go and have a look! - -29 -00:08:06,310 --> 00:08:09,579 -Wukong, what was it like? - -30 -00:08:09,629 --> 00:08:11,819 -Bad, bad, very bad. - -31 -00:08:11,879 --> 00:08:15,910 -If I were any slower the fur on my tail would have been burned off. - -32 -00:08:42,720 --> 00:08:47,600 -Noble host, the fires here are so big. - -33 -00:08:47,600 --> 00:08:49,669 -How can you grow any crops? - -34 -00:08:49,710 --> 00:08:53,980 -A thousand miles from here lives Princess Iron Fan. - -35 -00:08:54,039 --> 00:08:56,500 -She has a palm leaf fan. - -36 -00:08:56,559 --> 00:08:59,070 -Wave the fan once and the fire goes out. - -37 -00:08:59,120 --> 00:09:01,629 -Twice and the wind starts blowing. - -38 -00:09:01,679 --> 00:09:03,980 -Three times and the rain starts coming down. - -39 -00:09:04,039 --> 00:09:07,509 -In the following period we plant and harvest. - -40 -00:09:07,559 --> 00:09:11,340 -However, asking that princess to come - -41 -00:09:11,399 --> 00:09:14,870 -is certainly no simple matter. - -42 -00:09:14,909 --> 00:09:16,820 -Where does she live? - -43 -00:09:16,879 --> 00:09:20,190 -She lives in Palm Leaf Cave at Emerald Cloud Mountain. - -44 -00:09:20,240 --> 00:09:23,669 -Does she live there alone? - -45 -00:09:23,720 --> 00:09:25,750 -Doesn't she have a husband? - -46 -00:09:25,799 --> 00:09:29,580 -Her husband is Bull Demon King. - -47 -00:09:29,639 --> 00:09:32,200 -What, her husband is Old Bull? - -48 -00:09:32,240 --> 00:09:36,789 -Fool, you know him? Come with me to borrow the fan! - -49 -00:09:36,840 --> 00:09:41,750 -Actually... Old Bull doesn't live there. - -50 -00:09:41,799 --> 00:09:46,350 -Looking for his woman when he isn't home - -51 -00:09:46,399 --> 00:09:51,519 -isn't very... appropriate. - -52 -00:09:51,559 --> 00:09:58,309 -You... you... the two of you go. - -53 -00:09:58,360 --> 00:10:04,290 -I... I'll stay here and serve Master. - -54 -00:10:04,440 --> 00:10:11,269 -Sha Wujing, go with your two fellow apprentices. - -55 -00:10:38,571 --> 00:10:44,978 -Palm Leaf Cave - -56 -00:10:47,200 --> 00:10:51,549 -Fool, I always go first. - -57 -00:10:51,600 --> 00:10:54,350 -This time it's your turn! - -58 -00:10:58,519 --> 00:11:04,909 -Junior! I always go first, this time it's your turn! - -59 -00:11:04,960 --> 00:11:06,830 -Senior... - -60 -00:11:06,879 --> 00:11:10,990 -I'm asking you to make a small effort for Master. Can't you do that? - -61 -00:11:11,039 --> 00:11:14,309 -Hurry up! - -62 -00:11:39,639 --> 00:11:43,039 -Simple monk, where did you come from? - -63 -00:11:43,039 --> 00:11:49,870 -The Great Sage... Tang Seng... wants your princess... - -64 -00:11:49,919 --> 00:11:52,480 -Nonsense! - -65 -00:12:47,549 --> 00:12:52,059 -Senior... why don't you go instead? - -66 -00:12:52,120 --> 00:12:56,950 -Fool, you go! - -67 -00:12:57,000 --> 00:13:00,700 -Senior, why don't you go? - -68 -00:13:04,029 --> 00:13:07,460 -Lazy fool! - -69 -00:13:54,279 --> 00:13:57,899 -Great God of Thunder! Don't kill me, let me go! - -70 -00:13:57,960 --> 00:13:59,950 -Go tell your princess - -71 -00:14:00,000 --> 00:14:03,279 -that Sun Wukong has come to borrow the fan. - -72 -00:14:03,279 --> 00:14:08,399 -Yes, yes! Let me loose, I'll go at once. - -73 -00:14:29,559 --> 00:14:37,059 -Grandma, there's a Sun Wukong outside asking to borrow the fan. - -74 -00:14:41,519 --> 00:14:44,149 -Quickly fetch my sword. - -75 -00:15:01,639 --> 00:15:04,149 -Sun Wukong, you hurt my son! - -76 -00:15:04,200 --> 00:15:08,549 -You dare come here to meet your death? - -77 -00:15:08,600 --> 00:15:12,039 -I've never met you before, how could I have harmed your son? - -78 -00:15:12,039 --> 00:15:15,789 -My son Red Child's life was ruined, wasn't that your doing? - -79 -00:15:15,840 --> 00:15:20,389 -Your son is with the Goddess of Mercy now, how can you say that I hurt him? - -80 -00:15:20,440 --> 00:15:23,750 -Enough rubbish! Come here and let me chop you with my sword. - -81 -00:15:23,799 --> 00:15:26,149 -If you can take it I'll lend you the fan. - -82 -00:15:26,200 --> 00:15:28,549 -Really? - -83 -00:15:56,799 --> 00:16:00,629 -Stop! Quickly give me the fan! - -84 -00:17:53,630 --> 00:18:00,099 -Great Sage, weren't you going west? Why have you come back here? - -85 -00:18:11,150 --> 00:18:17,140 -Princess Iron Fan blew me here with a single wave of her fan. - -86 -00:18:17,190 --> 00:18:23,859 -That's truly amazing, Great Sage. I have something for you. - -87 -00:18:28,509 --> 00:18:33,450 -This is a wind pearl. When you use it, - -88 -00:18:33,509 --> 00:18:36,140 -your heart will become steady as a rock. - -89 -00:18:36,190 --> 00:18:39,180 -Princess Iron Fan won't be able to move you. - -90 -00:18:39,230 --> 00:18:42,849 -Great Sage, come and have a look. - -91 -00:19:00,430 --> 00:19:02,539 -Thank you. - -92 -00:19:06,069 --> 00:19:12,299 -Senior... where... - -93 -00:19:12,349 --> 00:19:18,690 -where has he... been blown to? - -94 -00:19:18,750 --> 00:19:26,099 -Who cares about him? Let the monkey handle himself. Let's go. - -95 -00:19:35,190 --> 00:19:37,259 -Senior... senior... - -96 -00:19:37,309 --> 00:19:43,470 -You... you... - -97 -00:19:43,470 --> 00:19:50,220 -Where were you blown to by that old lady? - -98 -00:19:50,269 --> 00:19:57,180 -Fool, now it's definitely your turn to go. - -99 -00:19:57,230 --> 00:20:00,930 -I'm not going, a single wave of her fan - -100 -00:20:00,990 --> 00:20:03,450 -could blow me to some faraway land. - -101 -00:20:03,509 --> 00:20:09,710 -Maybe it's better if you go again. - -102 -00:20:09,710 --> 00:20:12,220 -I won't go. - -103 -00:20:17,789 --> 00:20:22,779 -Next time I won't let you off! - -104 -00:20:56,150 --> 00:21:00,140 -This time I won't move no matter how much you wave, - -105 -00:21:00,190 --> 00:21:05,210 -as sure as I call myself am a man! - -106 -00:21:33,670 --> 00:21:38,579 -Senior, how come this time her fan couldn't move you? - -107 -00:21:46,829 --> 00:21:50,099 -Let's break our way in. - -108 -00:23:59,630 --> 00:24:04,180 -Quickly bring out the fan for Sun Wukong! - -109 -00:24:14,869 --> 00:24:16,900 -Sun Wukong, where are you? - -110 -00:24:16,950 --> 00:24:19,980 -I'm in your stomach! - -111 -00:24:45,750 --> 00:24:48,539 -Sun Wukong, spare me! - -112 -00:24:48,589 --> 00:24:51,180 -Only if you give me the fan! - -113 -00:24:51,230 --> 00:24:56,539 -I promise, I'll give it to you. Please come out! - -114 -00:25:00,230 --> 00:25:02,819 -Hurry up and bring the fan. - -115 -00:25:07,430 --> 00:25:09,220 -We've brought out the fan. - -116 -00:25:09,279 --> 00:25:12,069 -Why haven't you come out? - -117 -00:25:12,109 --> 00:25:16,619 -Open your mouth and I'll come out. - -118 -00:25:25,349 --> 00:25:29,420 -Sun Wukong, why haven't you come out? - -119 -00:25:50,349 --> 00:25:55,579 -Here I am. Lend me the fan for a while, I'll return it. - -120 -00:26:32,549 --> 00:26:36,579 -Master has been waiting long enough, let's get going! - -121 -00:27:01,869 --> 00:27:04,900 -Scripture, what is scripture? - -122 -00:27:04,950 --> 00:27:10,029 -Scriptures are the principles that link heaven and earth. - -123 -00:27:10,029 --> 00:27:14,180 -They are the principles of man. - -124 -00:27:14,230 --> 00:27:18,700 -Only he who holds these principles - -125 -00:27:18,750 --> 00:27:25,339 -can rid himself of pain and live a good life, - -126 -00:27:25,390 --> 00:27:29,940 -live a true and honest life. - -127 -00:27:34,680 --> 00:27:36,349 -Conversely, - -128 -00:27:36,390 --> 00:27:40,089 -he who does not know these principles, - -129 -00:27:40,150 --> 00:27:46,380 -will live a life full of misery. - -130 -00:27:46,430 --> 00:27:52,609 -Even his son or grandson will not achieve happiness. - -131 -00:27:52,670 --> 00:27:55,660 -Why am I going to get the scripture? - -132 -00:27:55,710 --> 00:28:01,299 -Because men nowadays are trapped in misery. - -133 -00:28:01,349 --> 00:28:04,180 -In order to achieve this goal, we are going to - -134 -00:28:04,230 --> 00:28:12,500 -appear before the Tang emperor and discuss this very complicated matter. - -135 -00:28:15,670 --> 00:28:17,819 -Did you get the palm leaf fan? - -136 -00:28:17,869 --> 00:28:19,400 -We have it. - -137 -00:28:19,401 --> 00:28:20,779 -Is this it? - -138 -00:28:22,829 --> 00:28:27,980 -Noble hosts, now that we have the fan, - -139 -00:28:28,029 --> 00:28:32,140 -we will take our leave. - -140 -00:28:32,190 --> 00:28:34,039 -Hold on. - -141 -00:28:34,039 --> 00:28:39,789 -Everyone, I would like to ask Sage Seng to stay here for a few more days. - -142 -00:28:39,829 --> 00:28:41,339 -Do you agree? - -143 -00:28:41,390 --> 00:28:43,460 -Agreed! - -144 -00:28:43,509 --> 00:28:45,890 -Thank you for your kindness. - -145 -00:28:45,950 --> 00:28:51,779 -But the sooner I leave the sooner we can complete our task. - -146 -00:28:51,829 --> 00:28:56,180 -Very well, will the honorable apprentice first go to Fiery Mountain. - -147 -00:28:56,230 --> 00:29:02,140 -After extinguishing the flames, continue to follow Sage Seng. - -148 -00:29:02,190 --> 00:29:05,460 -All right, go ahead! - -149 -00:30:24,470 --> 00:30:30,029 -Princess Iron Fan is really despicable, she gave us a fake fan! - -150 -00:30:30,029 --> 00:30:32,779 -I'll kill her for sure! - -151 -00:30:32,829 --> 00:30:36,299 -No, killing her is the wrong thing to do. - -152 -00:30:36,349 --> 00:30:39,579 -I won't let you kill anyone. - -153 -00:30:39,630 --> 00:30:42,980 -Let's think of something else. - -154 -00:30:52,150 --> 00:30:56,220 -Senior, how could you be fooled by her? - -155 -00:30:56,269 --> 00:30:58,539 -After making such an effort - -156 -00:30:58,589 --> 00:31:02,099 -all we got was a fake fan. - -157 -00:31:02,150 --> 00:31:06,500 -Ridiculous, ridiculous. - -158 -00:31:08,910 --> 00:31:10,420 -Then you go! - -159 -00:31:10,470 --> 00:31:14,380 -OK, I'll go, I'll go, I'm going! - -160 -00:31:14,430 --> 00:31:16,908 -I'll go find Bull Demon King. - -161 -00:31:16,909 --> 00:31:19,940 -This is a good solution. - -162 -00:31:21,390 --> 00:31:24,439 -Partner, what do you think? - -163 -00:31:24,440 --> 00:31:27,380 -We'll see how you do. - -164 -00:33:07,190 --> 00:33:11,150 -What do you think, am I pretty today? - -165 -00:33:11,150 --> 00:33:13,779 -Beautiful, my baby. - -166 -00:33:13,829 --> 00:33:17,059 -Accompany me for a walk outside the cave, all right? - -167 -00:33:17,109 --> 00:33:21,539 -My baby, why don't you go by yourself. - -168 -00:33:21,589 --> 00:33:24,819 -Why of course, I'm just a plain country girl. - -169 -00:33:24,869 --> 00:33:28,019 -Taking me outside might cause you to lose face. - -170 -00:33:28,069 --> 00:33:32,029 -Baby, what are you saying? - -171 -00:33:32,029 --> 00:33:37,500 -You go ahead, I'll come out in a while, all right? - -172 -00:33:39,852 --> 00:33:44,557 -Emerald Cloud Cave - -173 -00:35:28,030 --> 00:35:35,659 -Goddess, you're truly an angel come down from heaven. - -174 -00:35:35,710 --> 00:35:37,900 -Who... who are you? - -175 -00:35:37,949 --> 00:35:41,460 -I've come from Palm Leaf Cave to look for Bull Demon King. - -176 -00:35:41,519 --> 00:35:43,980 -Let go of me! - -177 -00:35:49,550 --> 00:35:52,940 -Goddess, slow down! - -178 -00:36:38,768 --> 00:36:40,133 -Emerald Cloud Cave - -179 -00:36:44,230 --> 00:36:49,219 -Baby, who has bullied you? - -180 -00:36:49,269 --> 00:36:50,820 -You! - -181 -00:36:50,869 --> 00:36:54,340 -How could I bully you? - -182 -00:36:56,909 --> 00:36:59,260 -Why don't you go back to Palm Leaf Cave? - -183 -00:36:59,320 --> 00:37:01,699 -It would spare you some embarrassment. - -184 -00:37:01,750 --> 00:37:07,659 -They often send people to look for you, and bully me. - -185 -00:37:07,710 --> 00:37:11,059 -Has there been someone here to look for me? - -186 -00:37:11,110 --> 00:37:15,059 -There's a pig monk outside looking for you. - -187 -00:37:15,119 --> 00:37:18,510 -He almost scared me to death. - -188 -00:37:18,550 --> 00:37:22,739 -How can this be? Wait while I go out to have a look. - -189 -00:37:50,670 --> 00:37:53,780 -Bull, old friend! - -190 -00:37:53,829 --> 00:37:58,139 -There's a very beautiful young lady in here. - -191 -00:37:58,199 --> 00:38:03,889 -Hey, that's my woman! Why have you come to bother her? - -192 -00:38:03,930 --> 00:38:08,550 -Oh, I didn't know, please forgive me! - -193 -00:38:08,550 --> 00:38:11,940 -You didn't know, so I can't blame you. Off you go! - -194 -00:38:11,989 --> 00:38:16,099 -No, no. I still have something I need you to help me with. - -195 -00:38:18,469 --> 00:38:24,710 -We were on our way to retrieve the scriptures when we arrived at Fiery Mountain. - -196 -00:38:24,710 --> 00:38:27,300 -Please ask your wife - -197 -00:38:27,349 --> 00:38:30,820 -to lend us the palm leaf fan for a while. - -198 -00:38:30,880 --> 00:38:33,510 -Absolutely not! Tang Seng and Sun Wukong - -199 -00:38:33,510 --> 00:38:35,179 -are my son's enemies. - -200 -00:38:35,230 --> 00:38:38,739 -I'd love to take my revenge on them. - -201 -00:38:38,789 --> 00:38:44,969 -Your son is with the Goddess of Mercy now, please don't fight. - -202 -00:38:45,030 --> 00:38:48,940 -All right, since we are old friends, I won't fight you. - -203 -00:38:49,000 --> 00:38:51,710 -Now go away! - -204 -00:39:38,389 --> 00:39:44,179 -Baby, that pig monk is a friend of mine. - -205 -00:39:44,230 --> 00:39:46,500 -He wasn't sent from Palm Leaf Cave at all. - -206 -00:39:46,550 --> 00:39:47,739 -I don't believe you. - -207 -00:39:47,789 --> 00:39:50,940 -I'm not lying to you! - -208 -00:39:50,989 --> 00:39:54,019 -Where is that monk now? - -209 -00:39:54,110 --> 00:39:57,780 -I've already scared him away. - -210 -00:43:34,814 --> 00:43:40,987 -Palm Leaf Cave - -211 -00:43:58,630 --> 00:44:01,340 -The king has returned! - -212 -00:44:01,389 --> 00:44:02,369 -Where's grandma? - -213 -00:44:02,429 --> 00:44:04,780 -She's inside. - -214 -00:44:42,989 --> 00:44:48,219 -By what honor has the king come to visit today? - -215 -00:44:48,269 --> 00:44:52,260 -I heard that Sun Wukong and Tang Seng are coming here. - -216 -00:44:52,320 --> 00:44:56,909 -I'm afraid they want to use the palm leaf fan to pass Fiery Mountain. - -217 -00:44:56,949 --> 00:45:00,860 -That monkey is the one who harmed our son. - -218 -00:45:00,909 --> 00:45:08,489 -I'll get him sooner or later, we will have our revenge. - -219 -00:45:08,550 --> 00:45:12,699 -Darling, why are you crying? - -220 -00:45:12,750 --> 00:45:15,699 -That monkey has already been here. - -221 -00:45:15,750 --> 00:45:18,860 -I refused to give him the fan. - -222 -00:45:18,909 --> 00:45:22,260 -I don't know how, but he got inside my stomach. - -223 -00:45:22,309 --> 00:45:25,500 -It hurt so bad I thought I would die. - -224 -00:45:25,550 --> 00:45:30,589 -At last I had no choice but to give him the fan. - -225 -00:45:30,789 --> 00:45:35,260 -That's terrible, how could you give him the fan? - -226 -00:45:38,320 --> 00:45:40,469 -I gave him a false one. - -227 -00:45:40,720 --> 00:45:43,019 -A false one? - -228 -00:46:14,190 --> 00:46:19,860 -A banquet to celebrate the king's return - -229 -00:46:19,909 --> 00:46:25,619 -Please drink the fine wine. - -230 -00:46:25,670 --> 00:46:34,179 -The chicken is fragrant, the duck is beautiful, and the pig is fat. - -231 -00:46:34,239 --> 00:46:45,670 -I try my best to sing, I try my best to dance. - -232 -00:46:45,710 --> 00:46:54,500 -You must also try your best to drink. - -233 -00:47:03,590 --> 00:47:16,389 -My king! You dumped the old one. - -234 -00:47:16,429 --> 00:47:22,610 -You love another woman. - -235 -00:47:22,670 --> 00:47:34,659 -Countless tears were spilled for you. - -236 -00:47:46,710 --> 00:47:55,699 -When the light is out and the curtain is dropped, - -237 -00:47:55,750 --> 00:48:00,869 -you will sleep alone. - -238 -00:48:00,869 --> 00:48:05,510 -You too will taste loneliness. - -239 -00:48:05,510 --> 00:48:13,420 -Pardon me for not making you company. - -240 -00:48:18,550 --> 00:48:24,619 -Even if we are on the same bed, - -241 -00:48:24,670 --> 00:48:34,340 -we will sleep under separate sheets. - -242 -00:48:38,389 --> 00:48:42,380 -King, I'm drunk. - -243 -00:48:55,070 --> 00:48:58,139 -Darling, where did you put the real fan? - -244 -00:48:58,190 --> 00:49:05,460 -That monkey is very deceitful, and the pig has even greater skill. - -245 -00:49:05,510 --> 00:49:09,780 -If you're not careful they might trick you. - -246 -00:49:18,360 --> 00:49:21,980 -Our treasure is right here. - -247 -00:49:31,429 --> 00:49:39,309 -King, what are you thinking about? Why don't you take it? - -248 -00:49:39,309 --> 00:49:40,847 -My treasure. - -249 -00:49:41,514 --> 00:49:44,150 -Emerald Cloud Cave - -250 -00:49:44,250 --> 00:49:49,019 -Baby, have another cup. Drink. - -251 -00:49:53,909 --> 00:49:59,510 -Gold Dragon King has asked me to drink with him tonight - -252 -00:49:59,510 --> 00:50:01,420 -Then you should go. - -253 -00:50:01,469 --> 00:50:02,860 -That's right. - -254 -00:50:02,909 --> 00:50:06,610 -You should prepare the golden eyed beast for grandpa. - -255 -00:50:06,670 --> 00:50:08,260 -I will. - -256 -00:50:08,320 --> 00:50:12,590 -You should drink a little less tonight. - -257 -00:50:12,630 --> 00:50:15,739 -Otherwise I won't be able to wake you up. - -258 -00:50:15,800 --> 00:50:19,110 -It's terrible, grandpa's golden eyed beast has disappeared! - -259 -00:50:19,150 --> 00:50:20,900 -Are you all deaf and blind? - -260 -00:50:20,949 --> 00:50:24,030 -How could it just disappear? - -261 -00:50:24,030 --> 00:50:27,900 -Baby, don't mind them. - -262 -00:50:27,960 --> 00:50:31,710 -I'm afraid Zhu Bajie might have stolen it. - -263 -00:50:31,750 --> 00:50:35,260 -Maybe I should go over to Palm Leaf Cave. - -264 -00:50:35,320 --> 00:50:39,309 -What? You've had this planned all along. - -265 -00:50:42,280 --> 00:50:48,150 -You still want to go over to that shameless woman? - -266 -00:50:48,190 --> 00:50:50,699 -Please baby, don't cry. - -267 -00:50:50,750 --> 00:50:54,059 -I'll be back soon. - -268 -00:50:57,624 --> 00:51:01,194 -Palm Leaf Cave - -269 -00:51:02,670 --> 00:51:07,300 -Come over here, drink a little! - -270 -00:51:10,349 --> 00:51:12,460 -Now I can relax. - -271 -00:51:12,510 --> 00:51:16,699 -We don't have to worry about our treasure being stolen. - -272 -00:51:16,750 --> 00:51:21,300 -Even if they stole it, they wouldn't know to pull the silk thread. - -273 -00:51:21,360 --> 00:51:26,269 -Having just a pearl won't be of any use. - -274 -00:51:26,309 --> 00:51:31,780 -Pulling the thread will turn it into a fan, right? - -275 -00:51:35,119 --> 00:51:38,070 -King, you're drunk. - -276 -00:51:38,110 --> 00:51:44,019 -You forgot about your own treasure, and are asking me. - -277 -00:51:49,989 --> 00:51:53,690 -Lady, look at who I am. - -278 -00:52:00,320 --> 00:52:03,750 -Who are you? - -279 -00:52:03,789 --> 00:52:09,889 -I am Tang Seng's second apprentice, Zhu Bajie. - -280 -00:52:09,949 --> 00:52:14,780 -Sorry about bothering you, and thanks! - -281 -00:52:19,079 --> 00:52:21,710 -Bye! - -282 -00:53:06,829 --> 00:53:10,699 -Bull's wife is too flirtatious. - -283 -00:53:10,760 --> 00:53:14,710 -All her underlings are handsome. - -284 -00:53:14,750 --> 00:53:24,809 -Old Pig almost couldn't take it. - -285 -00:53:24,869 --> 00:53:28,860 -Using clever tricks and tactics, - -286 -00:53:28,909 --> 00:53:32,820 -I stole their treasure away. - -287 -00:53:32,880 --> 00:53:36,789 -This is a great accomplishment. - -288 -00:53:36,829 --> 00:53:38,300 -Sandy should be on his knees. - -289 -00:53:38,349 --> 00:53:40,730 -Monkey should learn from me. - -290 -00:53:40,789 --> 00:53:45,219 -Even Master will be astonished. - -291 -00:53:45,280 --> 00:53:49,190 -Old Pig is truly masterful. - -292 -00:53:49,230 --> 00:53:54,349 -Old Pig is truly masterful. - -293 -00:54:36,719 --> 00:54:40,469 -Fool, how are things going? - -294 -00:54:40,510 --> 00:54:42,809 -Not only did I get the fan, - -295 -00:54:42,880 --> 00:54:48,789 -Princess Iron Fan was my wife for half a day, too. - -296 -00:54:48,829 --> 00:54:51,699 -You got a good deal. - -297 -00:54:58,150 --> 00:55:01,579 -Hey, let me see the fan. - -298 -00:55:16,030 --> 00:55:20,219 -Why did you shrink it? - -299 -00:55:40,550 --> 00:55:45,340 -Old Pig, you do recognize me, right? - -300 -00:55:45,389 --> 00:55:49,170 -Stop joking around with me. - -301 -00:55:49,230 --> 00:55:52,139 -Who's joking around with you? - -302 -00:56:42,869 --> 00:56:45,380 -Fool, how did it go? - -303 -00:56:45,429 --> 00:56:47,099 -It was all for nothing. - -304 -00:56:47,150 --> 00:56:49,980 -Wuneng, did you borrow the fan? - -305 -00:56:50,030 --> 00:56:53,340 -I found Bull Demon King, but he refused. - -306 -00:56:53,400 --> 00:56:59,190 -Then, I turned into his look-alike. - -307 -00:56:59,230 --> 00:57:03,539 -I tricked Princess Iron Fan into giving me the fan. - -308 -00:57:03,590 --> 00:57:10,590 -But then Old Bull turned into your look-alike and tricked me into giving it back. - -309 -00:57:10,590 --> 00:57:12,739 -Old Bull's skills are great. - -310 -00:57:12,800 --> 00:57:16,150 -I got beaten up by him, too. - -311 -00:57:16,190 --> 00:57:21,380 -How could you get the fan and still be such a fool? - -312 -00:57:21,429 --> 00:57:25,659 -Not everything revolves around you! - -313 -00:57:30,750 --> 00:57:34,369 -Don't fight, we should quickly think of a solution. - -314 -00:57:34,429 --> 00:57:40,260 -In which... which direction is there no fire? - -315 -00:57:40,320 --> 00:57:47,070 -Of east, south, west, north, there's fire only to the west. - -316 -00:57:47,119 --> 00:57:50,739 -So we have no option but to go back. - -317 -00:57:50,789 --> 00:57:52,940 -This path is blocked, what other options do we have? - -318 -00:57:52,989 --> 00:57:55,219 -Bajie, don't talk like that. - -319 -00:57:55,269 --> 00:57:59,139 -There will always be obstacles in our path. - -320 -00:57:59,190 --> 00:58:04,539 -To complete our sacred task we must be strong in our faith. - -321 -00:58:04,590 --> 00:58:09,219 -We can't change our goal half way just because we encounter some obstacles. - -322 -00:58:09,280 --> 00:58:14,590 -The reason that we've been defeated is that we haven't worked together. - -323 -00:58:14,630 --> 00:58:17,139 -If the three of you work as one, - -324 -00:58:17,190 --> 00:58:20,500 -put your strength together to fight Bull Demon King, - -325 -00:58:20,550 --> 00:58:22,849 -then you will certainly be victorious. - -326 -00:58:22,909 --> 00:58:26,030 -We have heard the order of Master - -327 -00:58:26,030 --> 00:58:30,139 -and will fight Bull Demon King to the end. - -328 -00:58:30,190 --> 00:58:34,260 -to... to the end. - -329 -00:58:34,320 --> 00:58:37,710 -That's excellent! - -330 -00:58:37,750 --> 00:58:40,980 -We have all been through hardships. - -331 -00:58:41,039 --> 00:58:43,869 -I hope everyone will make an effort - -332 -00:58:43,869 --> 00:58:49,579 -together with my disciples to defeat Bull Demon King and put out the flames of Fiery Mountain. - -333 -00:58:49,630 --> 00:58:52,820 -Otherwise this misery will never end. - -334 -00:58:53,869 --> 00:58:57,489 -We have heard the order of Master, to seek happiness for all. - -335 -00:58:57,550 --> 00:58:58,860 -Everyone work together! - -336 -00:58:58,909 --> 00:59:00,519 -All right! - -337 -01:08:23,229 --> 01:08:25,609 -Grandma, it's terrible! - -338 -01:08:25,670 --> 01:08:30,789 -Grandpa has been trapped, come quickly and look! - -339 -01:08:54,470 --> 01:08:56,699 -The fight's not over yet, not over. - -340 -01:08:56,760 --> 01:08:58,710 -Careful, careful. - -341 -01:08:59,760 --> 01:09:05,789 -Beast, all you have to is give us the fan and we'll spare your life. - -342 -01:09:05,840 --> 01:09:12,750 -Old Bull, where is the fan? Hand it over! - -343 -01:09:12,789 --> 01:09:19,340 -My... my wife... has it. - -344 -01:09:25,239 --> 01:09:27,989 -Darling, darling! - -345 -01:09:28,029 --> 01:09:32,260 -Save me, hurry! - -346 -01:09:32,319 --> 01:09:35,109 -Give them the fan. - -347 -01:09:35,149 --> 01:09:39,619 -King! All right, all right! - -348 -01:09:43,399 --> 01:09:47,229 -Wukong, you go one more time! - -349 -01:12:30,850 --> 01:12:46,599 -The End +1 +00:00:01,080 --> 00:00:09,070 +Princess Iron Fan + +2 +00:02:03,109 --> 00:02:09,280 +Journey to the West is a wonderful children's story, + +3 +00:02:09,280 --> 00:02:15,280 +but the world often misunderstands it as a fantasy novel. + +4 +00:02:15,280 --> 00:02:19,240 +This film was made for the purpose of + +5 +00:02:19,240 --> 00:02:24,240 +training the hearts and minds of children. + +6 +00:02:24,240 --> 00:02:29,280 +The story is pure, untainted by fantasy. + +7 +00:02:29,280 --> 00:02:32,560 +Fiery Mountain blocking the path of Tang Seng's company + +8 +00:02:32,560 --> 00:02:41,039 +is a metaphor for the difficulties in life. + +9 +00:02:41,039 --> 00:02:46,439 +In order to overcome them, one must keep faith. +Everybody must work together + +10 +00:02:46,439 --> 00:02:52,430 +in order to obtain the palm leaf fan and put out the flames. + +11 +00:02:52,839 --> 00:02:58,178 +Tripikata True Sutra + +12 +00:03:34,479 --> 00:03:37,789 +It's already autumn, how can it still be so warm? + +13 +00:03:37,840 --> 00:03:42,349 +Fool, don't talk rubbish. We should hurry and get on our way. + +14 +00:04:06,919 --> 00:04:09,349 +Wukong, where is this place? + +15 +00:04:09,400 --> 00:04:13,669 +We must pass through here to continue westwards, that much is certain. + +16 +00:04:13,719 --> 00:04:18,110 +Might we have taken the wrong path? + +17 +00:04:18,149 --> 00:04:21,700 +Why is it so hot here? + +18 +00:04:30,029 --> 00:04:31,649 +Master, look! + +19 +00:04:31,650 --> 00:04:33,779 +Isn't that a house up ahead? + +20 +00:04:33,829 --> 00:04:38,100 +Let's go in and rest for a while, OK? + +21 +00:04:59,389 --> 00:05:02,899 +This place is called Fiery Mountain. + +22 +00:05:02,949 --> 00:05:06,019 +The fire stretches for hundreds of miles. + +23 +00:05:06,069 --> 00:05:08,740 +Not single straw of grass can grow here. + +24 +00:05:08,790 --> 00:05:11,620 +The four seasons of the year are all warm. + +25 +00:05:11,680 --> 00:05:19,629 +You couldn't pass through the mountain even with a head of copper and arms of iron. + +26 +00:05:19,670 --> 00:05:23,579 +What kind of place is this? Master, don't worry! + +27 +00:05:23,629 --> 00:05:27,139 +The three of us are all strong enough to pass! + +28 +00:05:27,189 --> 00:05:30,699 +Master, I'll go and have a look! + +29 +00:08:06,310 --> 00:08:09,579 +Wukong, what was it like? + +30 +00:08:09,629 --> 00:08:11,819 +Bad, bad, very bad. + +31 +00:08:11,879 --> 00:08:15,910 +If I were any slower the fur on my tail would have been burned off. + +32 +00:08:42,720 --> 00:08:47,600 +Noble host, the fires here are so big. + +33 +00:08:47,600 --> 00:08:49,669 +How can you grow any crops? + +34 +00:08:49,710 --> 00:08:53,980 +A thousand miles from here lives Princess Iron Fan. + +35 +00:08:54,039 --> 00:08:56,500 +She has a palm leaf fan. + +36 +00:08:56,559 --> 00:08:59,070 +Wave the fan once and the fire goes out. + +37 +00:08:59,120 --> 00:09:01,629 +Twice and the wind starts blowing. + +38 +00:09:01,679 --> 00:09:03,980 +Three times and the rain starts coming down. + +39 +00:09:04,039 --> 00:09:07,509 +In the following period we plant and harvest. + +40 +00:09:07,559 --> 00:09:11,340 +However, asking that princess to come + +41 +00:09:11,399 --> 00:09:14,870 +is certainly no simple matter. + +42 +00:09:14,909 --> 00:09:16,820 +Where does she live? + +43 +00:09:16,879 --> 00:09:20,190 +She lives in Palm Leaf Cave at Emerald Cloud Mountain. + +44 +00:09:20,240 --> 00:09:23,669 +Does she live there alone? + +45 +00:09:23,720 --> 00:09:25,750 +Doesn't she have a husband? + +46 +00:09:25,799 --> 00:09:29,580 +Her husband is Bull Demon King. + +47 +00:09:29,639 --> 00:09:32,200 +What, her husband is Old Bull? + +48 +00:09:32,240 --> 00:09:36,789 +Fool, you know him? Come with me to borrow the fan! + +49 +00:09:36,840 --> 00:09:41,750 +Actually... Old Bull doesn't live there. + +50 +00:09:41,799 --> 00:09:46,350 +Looking for his woman when he isn't home + +51 +00:09:46,399 --> 00:09:51,519 +isn't very... appropriate. + +52 +00:09:51,559 --> 00:09:58,309 +You... you... the two of you go. + +53 +00:09:58,360 --> 00:10:04,290 +I... I'll stay here and serve Master. + +54 +00:10:04,440 --> 00:10:11,269 +Sha Wujing, go with your two fellow apprentices. + +55 +00:10:38,571 --> 00:10:44,978 +Palm Leaf Cave + +56 +00:10:47,200 --> 00:10:51,549 +Fool, I always go first. + +57 +00:10:51,600 --> 00:10:54,350 +This time it's your turn! + +58 +00:10:58,519 --> 00:11:04,909 +Junior! I always go first, this time it's your turn! + +59 +00:11:04,960 --> 00:11:06,830 +Senior... + +60 +00:11:06,879 --> 00:11:10,990 +I'm asking you to make a small effort for Master. Can't you do that? + +61 +00:11:11,039 --> 00:11:14,309 +Hurry up! + +62 +00:11:39,639 --> 00:11:43,039 +Simple monk, where did you come from? + +63 +00:11:43,039 --> 00:11:49,870 +The Great Sage... Tang Seng... wants your princess... + +64 +00:11:49,919 --> 00:11:52,480 +Nonsense! + +65 +00:12:47,549 --> 00:12:52,059 +Senior... why don't you go instead? + +66 +00:12:52,120 --> 00:12:56,950 +Fool, you go! + +67 +00:12:57,000 --> 00:13:00,700 +Senior, why don't you go? + +68 +00:13:04,029 --> 00:13:07,460 +Lazy fool! + +69 +00:13:54,279 --> 00:13:57,899 +Great God of Thunder! Don't kill me, let me go! + +70 +00:13:57,960 --> 00:13:59,950 +Go tell your princess + +71 +00:14:00,000 --> 00:14:03,279 +that Sun Wukong has come to borrow the fan. + +72 +00:14:03,279 --> 00:14:08,399 +Yes, yes! Let me loose, I'll go at once. + +73 +00:14:29,559 --> 00:14:37,059 +Grandma, there's a Sun Wukong outside asking to borrow the fan. + +74 +00:14:41,519 --> 00:14:44,149 +Quickly fetch my sword. + +75 +00:15:01,639 --> 00:15:04,149 +Sun Wukong, you hurt my son! + +76 +00:15:04,200 --> 00:15:08,549 +You dare come here to meet your death? + +77 +00:15:08,600 --> 00:15:12,039 +I've never met you before, how could I have harmed your son? + +78 +00:15:12,039 --> 00:15:15,789 +My son Red Child's life was ruined, wasn't that your doing? + +79 +00:15:15,840 --> 00:15:20,389 +Your son is with the Goddess of Mercy now, how can you say that I hurt him? + +80 +00:15:20,440 --> 00:15:23,750 +Enough rubbish! Come here and let me chop you with my sword. + +81 +00:15:23,799 --> 00:15:26,149 +If you can take it I'll lend you the fan. + +82 +00:15:26,200 --> 00:15:28,549 +Really? + +83 +00:15:56,799 --> 00:16:00,629 +Stop! Quickly give me the fan! + +84 +00:17:53,630 --> 00:18:00,099 +Great Sage, weren't you going west? Why have you come back here? + +85 +00:18:11,150 --> 00:18:17,140 +Princess Iron Fan blew me here with a single wave of her fan. + +86 +00:18:17,190 --> 00:18:23,859 +That's truly amazing, Great Sage. I have something for you. + +87 +00:18:28,509 --> 00:18:33,450 +This is a wind pearl. When you use it, + +88 +00:18:33,509 --> 00:18:36,140 +your heart will become steady as a rock. + +89 +00:18:36,190 --> 00:18:39,180 +Princess Iron Fan won't be able to move you. + +90 +00:18:39,230 --> 00:18:42,849 +Great Sage, come and have a look. + +91 +00:19:00,430 --> 00:19:02,539 +Thank you. + +92 +00:19:06,069 --> 00:19:12,299 +Senior... where... + +93 +00:19:12,349 --> 00:19:18,690 +where has he... been blown to? + +94 +00:19:18,750 --> 00:19:26,099 +Who cares about him? Let the monkey handle himself. Let's go. + +95 +00:19:35,190 --> 00:19:37,259 +Senior... senior... + +96 +00:19:37,309 --> 00:19:43,470 +You... you... + +97 +00:19:43,470 --> 00:19:50,220 +Where were you blown to by that old lady? + +98 +00:19:50,269 --> 00:19:57,180 +Fool, now it's definitely your turn to go. + +99 +00:19:57,230 --> 00:20:00,930 +I'm not going, a single wave of her fan + +100 +00:20:00,990 --> 00:20:03,450 +could blow me to some faraway land. + +101 +00:20:03,509 --> 00:20:09,710 +Maybe it's better if you go again. + +102 +00:20:09,710 --> 00:20:12,220 +I won't go. + +103 +00:20:17,789 --> 00:20:22,779 +Next time I won't let you off! + +104 +00:20:56,150 --> 00:21:00,140 +This time I won't move no matter how much you wave, + +105 +00:21:00,190 --> 00:21:05,210 +as sure as I call myself am a man! + +106 +00:21:33,670 --> 00:21:38,579 +Senior, how come this time her fan couldn't move you? + +107 +00:21:46,829 --> 00:21:50,099 +Let's break our way in. + +108 +00:23:59,630 --> 00:24:04,180 +Quickly bring out the fan for Sun Wukong! + +109 +00:24:14,869 --> 00:24:16,900 +Sun Wukong, where are you? + +110 +00:24:16,950 --> 00:24:19,980 +I'm in your stomach! + +111 +00:24:45,750 --> 00:24:48,539 +Sun Wukong, spare me! + +112 +00:24:48,589 --> 00:24:51,180 +Only if you give me the fan! + +113 +00:24:51,230 --> 00:24:56,539 +I promise, I'll give it to you. Please come out! + +114 +00:25:00,230 --> 00:25:02,819 +Hurry up and bring the fan. + +115 +00:25:07,430 --> 00:25:09,220 +We've brought out the fan. + +116 +00:25:09,279 --> 00:25:12,069 +Why haven't you come out? + +117 +00:25:12,109 --> 00:25:16,619 +Open your mouth and I'll come out. + +118 +00:25:25,349 --> 00:25:29,420 +Sun Wukong, why haven't you come out? + +119 +00:25:50,349 --> 00:25:55,579 +Here I am. Lend me the fan for a while, I'll return it. + +120 +00:26:32,549 --> 00:26:36,579 +Master has been waiting long enough, let's get going! + +121 +00:27:01,869 --> 00:27:04,900 +Scripture, what is scripture? + +122 +00:27:04,950 --> 00:27:10,029 +Scriptures are the principles that link heaven and earth. + +123 +00:27:10,029 --> 00:27:14,180 +They are the principles of man. + +124 +00:27:14,230 --> 00:27:18,700 +Only he who holds these principles + +125 +00:27:18,750 --> 00:27:25,339 +can rid himself of pain and live a good life, + +126 +00:27:25,390 --> 00:27:29,940 +live a true and honest life. + +127 +00:27:34,680 --> 00:27:36,349 +Conversely, + +128 +00:27:36,390 --> 00:27:40,089 +he who does not know these principles, + +129 +00:27:40,150 --> 00:27:46,380 +will live a life full of misery. + +130 +00:27:46,430 --> 00:27:52,609 +Even his son or grandson will not achieve happiness. + +131 +00:27:52,670 --> 00:27:55,660 +Why am I going to get the scripture? + +132 +00:27:55,710 --> 00:28:01,299 +Because men nowadays are trapped in misery. + +133 +00:28:01,349 --> 00:28:04,180 +In order to achieve this goal, we are going to + +134 +00:28:04,230 --> 00:28:12,500 +appear before the Tang emperor and discuss this very complicated matter. + +135 +00:28:15,670 --> 00:28:17,819 +Did you get the palm leaf fan? + +136 +00:28:17,869 --> 00:28:19,400 +We have it. + +137 +00:28:19,401 --> 00:28:20,779 +Is this it? + +138 +00:28:22,829 --> 00:28:27,980 +Noble hosts, now that we have the fan, + +139 +00:28:28,029 --> 00:28:32,140 +we will take our leave. + +140 +00:28:32,190 --> 00:28:34,039 +Hold on. + +141 +00:28:34,039 --> 00:28:39,789 +Everyone, I would like to ask Sage Seng to stay here for a few more days. + +142 +00:28:39,829 --> 00:28:41,339 +Do you agree? + +143 +00:28:41,390 --> 00:28:43,460 +Agreed! + +144 +00:28:43,509 --> 00:28:45,890 +Thank you for your kindness. + +145 +00:28:45,950 --> 00:28:51,779 +But the sooner I leave the sooner we can complete our task. + +146 +00:28:51,829 --> 00:28:56,180 +Very well, will the honorable apprentice first go to Fiery Mountain. + +147 +00:28:56,230 --> 00:29:02,140 +After extinguishing the flames, continue to follow Sage Seng. + +148 +00:29:02,190 --> 00:29:05,460 +All right, go ahead! + +149 +00:30:24,470 --> 00:30:30,029 +Princess Iron Fan is really despicable, she gave us a fake fan! + +150 +00:30:30,029 --> 00:30:32,779 +I'll kill her for sure! + +151 +00:30:32,829 --> 00:30:36,299 +No, killing her is the wrong thing to do. + +152 +00:30:36,349 --> 00:30:39,579 +I won't let you kill anyone. + +153 +00:30:39,630 --> 00:30:42,980 +Let's think of something else. + +154 +00:30:52,150 --> 00:30:56,220 +Senior, how could you be fooled by her? + +155 +00:30:56,269 --> 00:30:58,539 +After making such an effort + +156 +00:30:58,589 --> 00:31:02,099 +all we got was a fake fan. + +157 +00:31:02,150 --> 00:31:06,500 +Ridiculous, ridiculous. + +158 +00:31:08,910 --> 00:31:10,420 +Then you go! + +159 +00:31:10,470 --> 00:31:14,380 +OK, I'll go, I'll go, I'm going! + +160 +00:31:14,430 --> 00:31:16,908 +I'll go find Bull Demon King. + +161 +00:31:16,909 --> 00:31:19,940 +This is a good solution. + +162 +00:31:21,390 --> 00:31:24,439 +Partner, what do you think? + +163 +00:31:24,440 --> 00:31:27,380 +We'll see how you do. + +164 +00:33:07,190 --> 00:33:11,150 +What do you think, am I pretty today? + +165 +00:33:11,150 --> 00:33:13,779 +Beautiful, my baby. + +166 +00:33:13,829 --> 00:33:17,059 +Accompany me for a walk outside the cave, all right? + +167 +00:33:17,109 --> 00:33:21,539 +My baby, why don't you go by yourself. + +168 +00:33:21,589 --> 00:33:24,819 +Why of course, I'm just a plain country girl. + +169 +00:33:24,869 --> 00:33:28,019 +Taking me outside might cause you to lose face. + +170 +00:33:28,069 --> 00:33:32,029 +Baby, what are you saying? + +171 +00:33:32,029 --> 00:33:37,500 +You go ahead, I'll come out in a while, all right? + +172 +00:33:39,852 --> 00:33:44,557 +Emerald Cloud Cave + +173 +00:35:28,030 --> 00:35:35,659 +Goddess, you're truly an angel come down from heaven. + +174 +00:35:35,710 --> 00:35:37,900 +Who... who are you? + +175 +00:35:37,949 --> 00:35:41,460 +I've come from Palm Leaf Cave to look for Bull Demon King. + +176 +00:35:41,519 --> 00:35:43,980 +Let go of me! + +177 +00:35:49,550 --> 00:35:52,940 +Goddess, slow down! + +178 +00:36:38,768 --> 00:36:40,133 +Emerald Cloud Cave + +179 +00:36:44,230 --> 00:36:49,219 +Baby, who has bullied you? + +180 +00:36:49,269 --> 00:36:50,820 +You! + +181 +00:36:50,869 --> 00:36:54,340 +How could I bully you? + +182 +00:36:56,909 --> 00:36:59,260 +Why don't you go back to Palm Leaf Cave? + +183 +00:36:59,320 --> 00:37:01,699 +It would spare you some embarrassment. + +184 +00:37:01,750 --> 00:37:07,659 +They often send people to look for you, and bully me. + +185 +00:37:07,710 --> 00:37:11,059 +Has there been someone here to look for me? + +186 +00:37:11,110 --> 00:37:15,059 +There's a pig monk outside looking for you. + +187 +00:37:15,119 --> 00:37:18,510 +He almost scared me to death. + +188 +00:37:18,550 --> 00:37:22,739 +How can this be? Wait while I go out to have a look. + +189 +00:37:50,670 --> 00:37:53,780 +Bull, old friend! + +190 +00:37:53,829 --> 00:37:58,139 +There's a very beautiful young lady in here. + +191 +00:37:58,199 --> 00:38:03,889 +Hey, that's my woman! Why have you come to bother her? + +192 +00:38:03,930 --> 00:38:08,550 +Oh, I didn't know, please forgive me! + +193 +00:38:08,550 --> 00:38:11,940 +You didn't know, so I can't blame you. Off you go! + +194 +00:38:11,989 --> 00:38:16,099 +No, no. I still have something I need you to help me with. + +195 +00:38:18,469 --> 00:38:24,710 +We were on our way to retrieve the scriptures when we arrived at Fiery Mountain. + +196 +00:38:24,710 --> 00:38:27,300 +Please ask your wife + +197 +00:38:27,349 --> 00:38:30,820 +to lend us the palm leaf fan for a while. + +198 +00:38:30,880 --> 00:38:33,510 +Absolutely not! Tang Seng and Sun Wukong + +199 +00:38:33,510 --> 00:38:35,179 +are my son's enemies. + +200 +00:38:35,230 --> 00:38:38,739 +I'd love to take my revenge on them. + +201 +00:38:38,789 --> 00:38:44,969 +Your son is with the Goddess of Mercy now, please don't fight. + +202 +00:38:45,030 --> 00:38:48,940 +All right, since we are old friends, I won't fight you. + +203 +00:38:49,000 --> 00:38:51,710 +Now go away! + +204 +00:39:38,389 --> 00:39:44,179 +Baby, that pig monk is a friend of mine. + +205 +00:39:44,230 --> 00:39:46,500 +He wasn't sent from Palm Leaf Cave at all. + +206 +00:39:46,550 --> 00:39:47,739 +I don't believe you. + +207 +00:39:47,789 --> 00:39:50,940 +I'm not lying to you! + +208 +00:39:50,989 --> 00:39:54,019 +Where is that monk now? + +209 +00:39:54,110 --> 00:39:57,780 +I've already scared him away. + +210 +00:43:34,814 --> 00:43:40,987 +Palm Leaf Cave + +211 +00:43:58,630 --> 00:44:01,340 +The king has returned! + +212 +00:44:01,389 --> 00:44:02,369 +Where's grandma? + +213 +00:44:02,429 --> 00:44:04,780 +She's inside. + +214 +00:44:42,989 --> 00:44:48,219 +By what honor has the king come to visit today? + +215 +00:44:48,269 --> 00:44:52,260 +I heard that Sun Wukong and Tang Seng are coming here. + +216 +00:44:52,320 --> 00:44:56,909 +I'm afraid they want to use the palm leaf fan to pass Fiery Mountain. + +217 +00:44:56,949 --> 00:45:00,860 +That monkey is the one who harmed our son. + +218 +00:45:00,909 --> 00:45:08,489 +I'll get him sooner or later, we will have our revenge. + +219 +00:45:08,550 --> 00:45:12,699 +Darling, why are you crying? + +220 +00:45:12,750 --> 00:45:15,699 +That monkey has already been here. + +221 +00:45:15,750 --> 00:45:18,860 +I refused to give him the fan. + +222 +00:45:18,909 --> 00:45:22,260 +I don't know how, but he got inside my stomach. + +223 +00:45:22,309 --> 00:45:25,500 +It hurt so bad I thought I would die. + +224 +00:45:25,550 --> 00:45:30,589 +At last I had no choice but to give him the fan. + +225 +00:45:30,789 --> 00:45:35,260 +That's terrible, how could you give him the fan? + +226 +00:45:38,320 --> 00:45:40,469 +I gave him a false one. + +227 +00:45:40,720 --> 00:45:43,019 +A false one? + +228 +00:46:14,190 --> 00:46:19,860 +A banquet to celebrate the king's return + +229 +00:46:19,909 --> 00:46:25,619 +Please drink the fine wine. + +230 +00:46:25,670 --> 00:46:34,179 +The chicken is fragrant, the duck is beautiful, and the pig is fat. + +231 +00:46:34,239 --> 00:46:45,670 +I try my best to sing, I try my best to dance. + +232 +00:46:45,710 --> 00:46:54,500 +You must also try your best to drink. + +233 +00:47:03,590 --> 00:47:16,389 +My king! You dumped the old one. + +234 +00:47:16,429 --> 00:47:22,610 +You love another woman. + +235 +00:47:22,670 --> 00:47:34,659 +Countless tears were spilled for you. + +236 +00:47:46,710 --> 00:47:55,699 +When the light is out and the curtain is dropped, + +237 +00:47:55,750 --> 00:48:00,869 +you will sleep alone. + +238 +00:48:00,869 --> 00:48:05,510 +You too will taste loneliness. + +239 +00:48:05,510 --> 00:48:13,420 +Pardon me for not making you company. + +240 +00:48:18,550 --> 00:48:24,619 +Even if we are on the same bed, + +241 +00:48:24,670 --> 00:48:34,340 +we will sleep under separate sheets. + +242 +00:48:38,389 --> 00:48:42,380 +King, I'm drunk. + +243 +00:48:55,070 --> 00:48:58,139 +Darling, where did you put the real fan? + +244 +00:48:58,190 --> 00:49:05,460 +That monkey is very deceitful, and the pig has even greater skill. + +245 +00:49:05,510 --> 00:49:09,780 +If you're not careful they might trick you. + +246 +00:49:18,360 --> 00:49:21,980 +Our treasure is right here. + +247 +00:49:31,429 --> 00:49:39,309 +King, what are you thinking about? Why don't you take it? + +248 +00:49:39,309 --> 00:49:40,847 +My treasure. + +249 +00:49:41,514 --> 00:49:44,150 +Emerald Cloud Cave + +250 +00:49:44,250 --> 00:49:49,019 +Baby, have another cup. Drink. + +251 +00:49:53,909 --> 00:49:59,510 +Gold Dragon King has asked me to drink with him tonight + +252 +00:49:59,510 --> 00:50:01,420 +Then you should go. + +253 +00:50:01,469 --> 00:50:02,860 +That's right. + +254 +00:50:02,909 --> 00:50:06,610 +You should prepare the golden eyed beast for grandpa. + +255 +00:50:06,670 --> 00:50:08,260 +I will. + +256 +00:50:08,320 --> 00:50:12,590 +You should drink a little less tonight. + +257 +00:50:12,630 --> 00:50:15,739 +Otherwise I won't be able to wake you up. + +258 +00:50:15,800 --> 00:50:19,110 +It's terrible, grandpa's golden eyed beast has disappeared! + +259 +00:50:19,150 --> 00:50:20,900 +Are you all deaf and blind? + +260 +00:50:20,949 --> 00:50:24,030 +How could it just disappear? + +261 +00:50:24,030 --> 00:50:27,900 +Baby, don't mind them. + +262 +00:50:27,960 --> 00:50:31,710 +I'm afraid Zhu Bajie might have stolen it. + +263 +00:50:31,750 --> 00:50:35,260 +Maybe I should go over to Palm Leaf Cave. + +264 +00:50:35,320 --> 00:50:39,309 +What? You've had this planned all along. + +265 +00:50:42,280 --> 00:50:48,150 +You still want to go over to that shameless woman? + +266 +00:50:48,190 --> 00:50:50,699 +Please baby, don't cry. + +267 +00:50:50,750 --> 00:50:54,059 +I'll be back soon. + +268 +00:50:57,624 --> 00:51:01,194 +Palm Leaf Cave + +269 +00:51:02,670 --> 00:51:07,300 +Come over here, drink a little! + +270 +00:51:10,349 --> 00:51:12,460 +Now I can relax. + +271 +00:51:12,510 --> 00:51:16,699 +We don't have to worry about our treasure being stolen. + +272 +00:51:16,750 --> 00:51:21,300 +Even if they stole it, they wouldn't know to pull the silk thread. + +273 +00:51:21,360 --> 00:51:26,269 +Having just a pearl won't be of any use. + +274 +00:51:26,309 --> 00:51:31,780 +Pulling the thread will turn it into a fan, right? + +275 +00:51:35,119 --> 00:51:38,070 +King, you're drunk. + +276 +00:51:38,110 --> 00:51:44,019 +You forgot about your own treasure, and are asking me. + +277 +00:51:49,989 --> 00:51:53,690 +Lady, look at who I am. + +278 +00:52:00,320 --> 00:52:03,750 +Who are you? + +279 +00:52:03,789 --> 00:52:09,889 +I am Tang Seng's second apprentice, Zhu Bajie. + +280 +00:52:09,949 --> 00:52:14,780 +Sorry about bothering you, and thanks! + +281 +00:52:19,079 --> 00:52:21,710 +Bye! + +282 +00:53:06,829 --> 00:53:10,699 +Bull's wife is too flirtatious. + +283 +00:53:10,760 --> 00:53:14,710 +All her underlings are handsome. + +284 +00:53:14,750 --> 00:53:24,809 +Old Pig almost couldn't take it. + +285 +00:53:24,869 --> 00:53:28,860 +Using clever tricks and tactics, + +286 +00:53:28,909 --> 00:53:32,820 +I stole their treasure away. + +287 +00:53:32,880 --> 00:53:36,789 +This is a great accomplishment. + +288 +00:53:36,829 --> 00:53:38,300 +Sandy should be on his knees. + +289 +00:53:38,349 --> 00:53:40,730 +Monkey should learn from me. + +290 +00:53:40,789 --> 00:53:45,219 +Even Master will be astonished. + +291 +00:53:45,280 --> 00:53:49,190 +Old Pig is truly masterful. + +292 +00:53:49,230 --> 00:53:54,349 +Old Pig is truly masterful. + +293 +00:54:36,719 --> 00:54:40,469 +Fool, how are things going? + +294 +00:54:40,510 --> 00:54:42,809 +Not only did I get the fan, + +295 +00:54:42,880 --> 00:54:48,789 +Princess Iron Fan was my wife for half a day, too. + +296 +00:54:48,829 --> 00:54:51,699 +You got a good deal. + +297 +00:54:58,150 --> 00:55:01,579 +Hey, let me see the fan. + +298 +00:55:16,030 --> 00:55:20,219 +Why did you shrink it? + +299 +00:55:40,550 --> 00:55:45,340 +Old Pig, you do recognize me, right? + +300 +00:55:45,389 --> 00:55:49,170 +Stop joking around with me. + +301 +00:55:49,230 --> 00:55:52,139 +Who's joking around with you? + +302 +00:56:42,869 --> 00:56:45,380 +Fool, how did it go? + +303 +00:56:45,429 --> 00:56:47,099 +It was all for nothing. + +304 +00:56:47,150 --> 00:56:49,980 +Wuneng, did you borrow the fan? + +305 +00:56:50,030 --> 00:56:53,340 +I found Bull Demon King, but he refused. + +306 +00:56:53,400 --> 00:56:59,190 +Then, I turned into his look-alike. + +307 +00:56:59,230 --> 00:57:03,539 +I tricked Princess Iron Fan into giving me the fan. + +308 +00:57:03,590 --> 00:57:10,590 +But then Old Bull turned into your look-alike and tricked me into giving it back. + +309 +00:57:10,590 --> 00:57:12,739 +Old Bull's skills are great. + +310 +00:57:12,800 --> 00:57:16,150 +I got beaten up by him, too. + +311 +00:57:16,190 --> 00:57:21,380 +How could you get the fan and still be such a fool? + +312 +00:57:21,429 --> 00:57:25,659 +Not everything revolves around you! + +313 +00:57:30,750 --> 00:57:34,369 +Don't fight, we should quickly think of a solution. + +314 +00:57:34,429 --> 00:57:40,260 +In which... which direction is there no fire? + +315 +00:57:40,320 --> 00:57:47,070 +Of east, south, west, north, there's fire only to the west. + +316 +00:57:47,119 --> 00:57:50,739 +So we have no option but to go back. + +317 +00:57:50,789 --> 00:57:52,940 +This path is blocked, what other options do we have? + +318 +00:57:52,989 --> 00:57:55,219 +Bajie, don't talk like that. + +319 +00:57:55,269 --> 00:57:59,139 +There will always be obstacles in our path. + +320 +00:57:59,190 --> 00:58:04,539 +To complete our sacred task we must be strong in our faith. + +321 +00:58:04,590 --> 00:58:09,219 +We can't change our goal half way just because we encounter some obstacles. + +322 +00:58:09,280 --> 00:58:14,590 +The reason that we've been defeated is that we haven't worked together. + +323 +00:58:14,630 --> 00:58:17,139 +If the three of you work as one, + +324 +00:58:17,190 --> 00:58:20,500 +put your strength together to fight Bull Demon King, + +325 +00:58:20,550 --> 00:58:22,849 +then you will certainly be victorious. + +326 +00:58:22,909 --> 00:58:26,030 +We have heard the order of Master + +327 +00:58:26,030 --> 00:58:30,139 +and will fight Bull Demon King to the end. + +328 +00:58:30,190 --> 00:58:34,260 +to... to the end. + +329 +00:58:34,320 --> 00:58:37,710 +That's excellent! + +330 +00:58:37,750 --> 00:58:40,980 +We have all been through hardships. + +331 +00:58:41,039 --> 00:58:43,869 +I hope everyone will make an effort + +332 +00:58:43,869 --> 00:58:49,579 +together with my disciples to defeat Bull Demon King and put out the flames of Fiery Mountain. + +333 +00:58:49,630 --> 00:58:52,820 +Otherwise this misery will never end. + +334 +00:58:53,869 --> 00:58:57,489 +We have heard the order of Master, to seek happiness for all. + +335 +00:58:57,550 --> 00:58:58,860 +Everyone work together! + +336 +00:58:58,909 --> 00:59:00,519 +All right! + +337 +01:08:23,229 --> 01:08:25,609 +Grandma, it's terrible! + +338 +01:08:25,670 --> 01:08:30,789 +Grandpa has been trapped, come quickly and look! + +339 +01:08:54,470 --> 01:08:56,699 +The fight's not over yet, not over. + +340 +01:08:56,760 --> 01:08:58,710 +Careful, careful. + +341 +01:08:59,760 --> 01:09:05,789 +Beast, all you have to is give us the fan and we'll spare your life. + +342 +01:09:05,840 --> 01:09:12,750 +Old Bull, where is the fan? Hand it over! + +343 +01:09:12,789 --> 01:09:19,340 +My... my wife... has it. + +344 +01:09:25,239 --> 01:09:27,989 +Darling, darling! + +345 +01:09:28,029 --> 01:09:32,260 +Save me, hurry! + +346 +01:09:32,319 --> 01:09:35,109 +Give them the fan. + +347 +01:09:35,149 --> 01:09:39,619 +King! All right, all right! + +348 +01:09:43,399 --> 01:09:47,229 +Wukong, you go one more time! + +349 +01:12:30,850 --> 01:12:46,599 +The End diff --git a/js2/mwEmbed/jquery/plugins/jquery.pngFix.js b/js2/mwEmbed/jquery/plugins/jquery.pngFix.js index 6adfcc9421..e80b56890f 100644 --- a/js2/mwEmbed/jquery/plugins/jquery.pngFix.js +++ b/js2/mwEmbed/jquery/plugins/jquery.pngFix.js @@ -1,113 +1,113 @@ -/** - * -------------------------------------------------------------------- - * jQuery-Plugin "pngFix" - * Version: 1.2, 09.03.2009 - * by Andreas Eberhard, andreas.eberhard@gmail.com - * http://jquery.andreaseberhard.de/ - * - * Copyright (c) 2007 Andreas Eberhard - * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php) - * - * Changelog: - * 09.03.2009 Version 1.2 - * - Update for jQuery 1.3.x, removed @ from selectors - * 11.09.2007 Version 1.1 - * - removed noConflict - * - added png-support for input type=image - * - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com - * 31.05.2007 initial Version 1.0 - * -------------------------------------------------------------------- - * @example $(function(){$(document).pngFix();}); - * @desc Fixes all PNG's in the document on document.ready - * - * jQuery(function(){jQuery(document).pngFix();}); - * @desc Fixes all PNG's in the document on document.ready when using noConflict - * - * @example $(function(){$('div.examples').pngFix();}); - * @desc Fixes all PNG's within div with class examples - * - * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );}); - * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png - * -------------------------------------------------------------------- - */ - -(function($) { - -jQuery.fn.pngFix = function(settings) { - - // Settings - settings = jQuery.extend({ - blankgif: 'blank.gif' - }, settings); - - var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1); - var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1); - - if (jQuery.browser.msie && (ie55 || ie6)) { - - //fix images with png-source - jQuery(this).find("img[src$=.png]").each(function() { - - jQuery(this).attr('width',jQuery(this).width()); - jQuery(this).attr('height',jQuery(this).height()); - - var prevStyle = ''; - var strNewHTML = ''; - var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : ''; - var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : ''; - var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : ''; - var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : ''; - var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : ''; - var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : ''; - if (this.style.border) { - prevStyle += 'border:'+this.style.border+';'; - this.style.border = ''; - } - if (this.style.padding) { - prevStyle += 'padding:'+this.style.padding+';'; - this.style.padding = ''; - } - if (this.style.margin) { - prevStyle += 'margin:'+this.style.margin+';'; - this.style.margin = ''; - } - var imgStyle = (this.style.cssText); - - strNewHTML += ''; - if (prevStyle != ''){ - strNewHTML = '' + strNewHTML + ''; - } - - jQuery(this).hide(); - jQuery(this).after(strNewHTML); - - }); - - // fix css background pngs - jQuery(this).find("*").each(function(){ - var bgIMG = jQuery(this).css('background-image'); - if(bgIMG.indexOf(".png")!=-1){ - var iebg = bgIMG.split('url("')[1].split('")')[0]; - jQuery(this).css('background-image', 'none'); - jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')"; - } - }); - - //fix input with png-source - jQuery(this).find("input[src$=.png]").each(function() { - var bgIMG = jQuery(this).attr('src'); - jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');'; - jQuery(this).attr('src', settings.blankgif) - }); - - } - - return jQuery; - -}; - -})(jQuery); +/** + * -------------------------------------------------------------------- + * jQuery-Plugin "pngFix" + * Version: 1.2, 09.03.2009 + * by Andreas Eberhard, andreas.eberhard@gmail.com + * http://jquery.andreaseberhard.de/ + * + * Copyright (c) 2007 Andreas Eberhard + * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php) + * + * Changelog: + * 09.03.2009 Version 1.2 + * - Update for jQuery 1.3.x, removed @ from selectors + * 11.09.2007 Version 1.1 + * - removed noConflict + * - added png-support for input type=image + * - 01.08.2007 CSS background-image support extension added by Scott Jehl, scott@filamentgroup.com, http://www.filamentgroup.com + * 31.05.2007 initial Version 1.0 + * -------------------------------------------------------------------- + * @example $(function(){$(document).pngFix();}); + * @desc Fixes all PNG's in the document on document.ready + * + * jQuery(function(){jQuery(document).pngFix();}); + * @desc Fixes all PNG's in the document on document.ready when using noConflict + * + * @example $(function(){$('div.examples').pngFix();}); + * @desc Fixes all PNG's within div with class examples + * + * @example $(function(){$('div.examples').pngFix( { blankgif:'ext.gif' } );}); + * @desc Fixes all PNG's within div with class examples, provides blank gif for input with png + * -------------------------------------------------------------------- + */ + +(function($) { + +jQuery.fn.pngFix = function(settings) { + + // Settings + settings = jQuery.extend({ + blankgif: 'blank.gif' + }, settings); + + var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1); + var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1); + + if (jQuery.browser.msie && (ie55 || ie6)) { + + //fix images with png-source + jQuery(this).find("img[src$=.png]").each(function() { + + jQuery(this).attr('width',jQuery(this).width()); + jQuery(this).attr('height',jQuery(this).height()); + + var prevStyle = ''; + var strNewHTML = ''; + var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : ''; + var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : ''; + var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : ''; + var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : ''; + var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : ''; + var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : ''; + if (this.style.border) { + prevStyle += 'border:'+this.style.border+';'; + this.style.border = ''; + } + if (this.style.padding) { + prevStyle += 'padding:'+this.style.padding+';'; + this.style.padding = ''; + } + if (this.style.margin) { + prevStyle += 'margin:'+this.style.margin+';'; + this.style.margin = ''; + } + var imgStyle = (this.style.cssText); + + strNewHTML += ''; + if (prevStyle != ''){ + strNewHTML = '' + strNewHTML + ''; + } + + jQuery(this).hide(); + jQuery(this).after(strNewHTML); + + }); + + // fix css background pngs + jQuery(this).find("*").each(function(){ + var bgIMG = jQuery(this).css('background-image'); + if(bgIMG.indexOf(".png")!=-1){ + var iebg = bgIMG.split('url("')[1].split('")')[0]; + jQuery(this).css('background-image', 'none'); + jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')"; + } + }); + + //fix input with png-source + jQuery(this).find("input[src$=.png]").each(function() { + var bgIMG = jQuery(this).attr('src'); + jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');'; + jQuery(this).attr('src', settings.blankgif) + }); + + } + + return jQuery; + +}; + +})(jQuery); diff --git a/js2/mwEmbed/libClipEdit/colorpicker/css/layout.css b/js2/mwEmbed/libClipEdit/colorpicker/css/layout.css index 8b3f00ff3f..cc5da1d312 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/css/layout.css +++ b/js2/mwEmbed/libClipEdit/colorpicker/css/layout.css @@ -1,218 +1,218 @@ -body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { - margin:0; - padding:0; -} -table { - border-collapse:collapse; - border-spacing:0; -} -fieldset,img { - border:0; -} -address,caption,cite,code,dfn,em,strong,th,var { - font-style:normal; - font-weight:normal; -} -ol,ul { - list-style:none; -} -caption,th { - text-align:left; -} -h1,h2,h3,h4,h5,h6 { - font-size:100%; - font-weight:normal; -} -q:before,q:after { - content:''; -} -abbr,acronym { border:0; -} -html, body { - background-color: #fff; - font-family: Arial, Helvetica, sans-serif; - font-size: 12px; - line-height: 18px; - color: #52697E; -} -body { - text-align: center; - overflow: auto; -} -.wrapper { - width: 700px; - margin: 0 auto; - text-align: left; -} -h1 { - font-size: 21px; - height: 47px; - line-height: 47px; - text-transform: uppercase; -} -.navigationTabs { - height: 23px; - line-height: 23px; - border-bottom: 1px solid #ccc; -} -.navigationTabs li { - float: left; - height: 23px; - line-height: 23px; - padding-right: 3px; -} -.navigationTabs li a{ - float: left; - dispaly: block; - height: 23px; - line-height: 23px; - padding: 0 10px; - overflow: hidden; - color: #52697E; - background-color: #eee; - position: relative; - text-decoration: none; -} -.navigationTabs li a:hover { - background-color: #f0f0f0; -} -.navigationTabs li a.active { - background-color: #fff; - border: 1px solid #ccc; - border-bottom: 0px solid; -} -.tabsContent { - border: 1px solid #ccc; - border-top: 0px solid; - width: 698px; - overflow: hidden; -} -.tab { - padding: 16px; - display: none; -} -.tab h2 { - font-weight: bold; - font-size: 16px; -} -.tab h3 { - font-weight: bold; - font-size: 14px; - margin-top: 20px; -} -.tab p { - margin-top: 16px; - clear: both; -} -.tab ul { - margin-top: 16px; - list-style: disc; -} -.tab li { - margin: 10px 0 0 35px; -} -.tab a { - color: #8FB0CF; -} -.tab strong { - font-weight: bold; -} -.tab pre { - font-size: 11px; - margin-top: 20px; - width: 668px; - overflow: auto; - clear: both; -} -.tab table { - width: 100%; -} -.tab table td { - padding: 6px 10px 6px 0; - vertical-align: top; -} -.tab dt { - margin-top: 16px; -} - -#colorSelector { - position: relative; - width: 36px; - height: 36px; - background: url(../images/select.png); -} -#colorSelector div { - position: absolute; - top: 3px; - left: 3px; - width: 30px; - height: 30px; - background: url(../images/select.png) center; -} -#colorSelector2 { - position: absolute; - top: 0; - left: 0; - width: 36px; - height: 36px; - background: url(../images/select2.png); -} -#colorSelector2 div { - position: absolute; - top: 4px; - left: 4px; - width: 28px; - height: 28px; - background: url(../images/select2.png) center; -} -#colorpickerHolder2 { - top: 32px; - left: 0; - width: 356px; - height: 0; - overflow: hidden; - position: absolute; -} -#colorpickerHolder2 .colorpicker { - background-image: url(../images/custom_background.png); - position: absolute; - bottom: 0; - left: 0; -} -#colorpickerHolder2 .colorpicker_hue div { - background-image: url(../images/custom_indic.gif); -} -#colorpickerHolder2 .colorpicker_hex { - background-image: url(../images/custom_hex.png); -} -#colorpickerHolder2 .colorpicker_rgb_r { - background-image: url(../images/custom_rgb_r.png); -} -#colorpickerHolder2 .colorpicker_rgb_g { - background-image: url(../images/custom_rgb_g.png); -} -#colorpickerHolder2 .colorpicker_rgb_b { - background-image: url(../images/custom_rgb_b.png); -} -#colorpickerHolder2 .colorpicker_hsb_s { - background-image: url(../images/custom_hsb_s.png); - display: none; -} -#colorpickerHolder2 .colorpicker_hsb_h { - background-image: url(../images/custom_hsb_h.png); - display: none; -} -#colorpickerHolder2 .colorpicker_hsb_b { - background-image: url(../images/custom_hsb_b.png); - display: none; -} -#colorpickerHolder2 .colorpicker_submit { - background-image: url(../images/custom_submit.png); -} -#colorpickerHolder2 .colorpicker input { - color: #778398; -} -#customWidget { - position: relative; - height: 36px; -} +body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td { + margin:0; + padding:0; +} +table { + border-collapse:collapse; + border-spacing:0; +} +fieldset,img { + border:0; +} +address,caption,cite,code,dfn,em,strong,th,var { + font-style:normal; + font-weight:normal; +} +ol,ul { + list-style:none; +} +caption,th { + text-align:left; +} +h1,h2,h3,h4,h5,h6 { + font-size:100%; + font-weight:normal; +} +q:before,q:after { + content:''; +} +abbr,acronym { border:0; +} +html, body { + background-color: #fff; + font-family: Arial, Helvetica, sans-serif; + font-size: 12px; + line-height: 18px; + color: #52697E; +} +body { + text-align: center; + overflow: auto; +} +.wrapper { + width: 700px; + margin: 0 auto; + text-align: left; +} +h1 { + font-size: 21px; + height: 47px; + line-height: 47px; + text-transform: uppercase; +} +.navigationTabs { + height: 23px; + line-height: 23px; + border-bottom: 1px solid #ccc; +} +.navigationTabs li { + float: left; + height: 23px; + line-height: 23px; + padding-right: 3px; +} +.navigationTabs li a{ + float: left; + dispaly: block; + height: 23px; + line-height: 23px; + padding: 0 10px; + overflow: hidden; + color: #52697E; + background-color: #eee; + position: relative; + text-decoration: none; +} +.navigationTabs li a:hover { + background-color: #f0f0f0; +} +.navigationTabs li a.active { + background-color: #fff; + border: 1px solid #ccc; + border-bottom: 0px solid; +} +.tabsContent { + border: 1px solid #ccc; + border-top: 0px solid; + width: 698px; + overflow: hidden; +} +.tab { + padding: 16px; + display: none; +} +.tab h2 { + font-weight: bold; + font-size: 16px; +} +.tab h3 { + font-weight: bold; + font-size: 14px; + margin-top: 20px; +} +.tab p { + margin-top: 16px; + clear: both; +} +.tab ul { + margin-top: 16px; + list-style: disc; +} +.tab li { + margin: 10px 0 0 35px; +} +.tab a { + color: #8FB0CF; +} +.tab strong { + font-weight: bold; +} +.tab pre { + font-size: 11px; + margin-top: 20px; + width: 668px; + overflow: auto; + clear: both; +} +.tab table { + width: 100%; +} +.tab table td { + padding: 6px 10px 6px 0; + vertical-align: top; +} +.tab dt { + margin-top: 16px; +} + +#colorSelector { + position: relative; + width: 36px; + height: 36px; + background: url(../images/select.png); +} +#colorSelector div { + position: absolute; + top: 3px; + left: 3px; + width: 30px; + height: 30px; + background: url(../images/select.png) center; +} +#colorSelector2 { + position: absolute; + top: 0; + left: 0; + width: 36px; + height: 36px; + background: url(../images/select2.png); +} +#colorSelector2 div { + position: absolute; + top: 4px; + left: 4px; + width: 28px; + height: 28px; + background: url(../images/select2.png) center; +} +#colorpickerHolder2 { + top: 32px; + left: 0; + width: 356px; + height: 0; + overflow: hidden; + position: absolute; +} +#colorpickerHolder2 .colorpicker { + background-image: url(../images/custom_background.png); + position: absolute; + bottom: 0; + left: 0; +} +#colorpickerHolder2 .colorpicker_hue div { + background-image: url(../images/custom_indic.gif); +} +#colorpickerHolder2 .colorpicker_hex { + background-image: url(../images/custom_hex.png); +} +#colorpickerHolder2 .colorpicker_rgb_r { + background-image: url(../images/custom_rgb_r.png); +} +#colorpickerHolder2 .colorpicker_rgb_g { + background-image: url(../images/custom_rgb_g.png); +} +#colorpickerHolder2 .colorpicker_rgb_b { + background-image: url(../images/custom_rgb_b.png); +} +#colorpickerHolder2 .colorpicker_hsb_s { + background-image: url(../images/custom_hsb_s.png); + display: none; +} +#colorpickerHolder2 .colorpicker_hsb_h { + background-image: url(../images/custom_hsb_h.png); + display: none; +} +#colorpickerHolder2 .colorpicker_hsb_b { + background-image: url(../images/custom_hsb_b.png); + display: none; +} +#colorpickerHolder2 .colorpicker_submit { + background-image: url(../images/custom_submit.png); +} +#colorpickerHolder2 .colorpicker input { + color: #778398; +} +#customWidget { + position: relative; + height: 36px; +} diff --git a/js2/mwEmbed/libClipEdit/colorpicker/index.html b/js2/mwEmbed/libClipEdit/colorpicker/index.html index e1ad5782da..f8da8aff3d 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/index.html +++ b/js2/mwEmbed/libClipEdit/colorpicker/index.html @@ -1,184 +1,184 @@ - - - - - - ColorPicker - jQuery plugin - - - - - - - -
-

Color Picker - jQuery plugin

- -
-
-

About

-

A simple component to select color in the same way you select color in Adobe Photoshop

-

Last update

-

23.05.2009 - Check Download tab

-

Features

-
    -
  • Flat mode - as element in page
  • -
  • Powerful controls for color selection
  • -
  • Easy to customize the look by changing some images
  • -
  • Fits into the viewport
  • -
-

License

-

Dual licensed under the MIT and GPL licenses.

-

Examples

-

Flat mode.

-

-

-
-$('#colorpickerHolder').ColorPicker({flat: true});
-                
-

Custom skin and using flat mode to display the color picker in a custom widget.

-
-
-
-
-
- -

Attached to an text field and using callback functions to update the color with field's value and set the value back in the field by submiting the color.

-

-

-

-
$('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({
-	onSubmit: function(hsb, hex, rgb, el) {
-		$(el).val(hex);
-		$(el).ColorPickerHide();
-	},
-	onBeforeShow: function () {
-		$(this).ColorPickerSetColor(this.value);
-	}
-})
-.bind('keyup', function(){
-	$(this).ColorPickerSetColor(this.value);
-});
-
-

Attached to DOMElement and using callbacks to live preview the color and adding animation.

-

-

-

-
-$('#colorSelector').ColorPicker({
-	color: '#0000ff',
-	onShow: function (colpkr) {
-		$(colpkr).fadeIn(500);
-		return false;
-	},
-	onHide: function (colpkr) {
-		$(colpkr).fadeOut(500);
-		return false;
-	},
-	onChange: function (hsb, hex, rgb) {
-		$('#colorSelector div').css('backgroundColor', '#' + hex);
-	}
-});
-
-
-
-

Download

-

colorpicker.zip (73 kb): jQuery, Javscript files, CSS files, images, examples and instructions.

-

Changelog

-
-
23.05.2009
-
Added: close on color selection example
-
Added: restore original color option
-
Changed: color update on key up event
-
Fixed: colorpicker hide and show methods
-
Fixed: reference to options. Multiple fields with colorpickers is possible now.
-
Fixed: RGB to HSB convertion
-
22.08.2008
-
Fixed bug: where some events were not canceled right on Safari
-
Fixed bug: where teh view port was not detected right on Safari
-
16-07-2008
-
Fixed bug where the letter 'F' could not be typed in the Hex field
-
Fixed bug where the changes on Hex field where not parsed
-
Added new option 'livePreview'
-
08-07-2008
-
Fixed typo in the code, both JavaScript and CSS
-
Changed the cursor for some elements
-
Added new demo explaining how to implement custom skin
-
07.07.2008
-
The first release.
-
-
-
-

Implement

-

Attach the Javascript and CSS files to your document. Edit CSS file and fix the paths to images and change colors to fit your site theme.

-
-<link rel="stylesheet" media="screen" type="text/css" href="css/colorpicker.css" />
-<script type="text/javascript" src="js/colorpicker.js"></script>
-                
-

Invocation code

-

All you have to do is to select the elements in a jQuery way and call the plugin.

-
- $('input').ColorPicker(options);
-                
-

Options

-

A hash of parameters. All parameters are optional.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
eventNamestringThe desired event to trigger the colorpicker. Default: 'click'
colorstring or hashThe default color. String for hex color or hash for RGB and HSB ({r:255, r:0, b:0}) . Default: 'ff0000'
flatbooleanWhatever if the color picker is appended to the element or triggered by an event. Default false
livePreviewbooleanWhatever if the color values are filled in the fields while changing values on selector or a field. If false it may improve speed. Default true
onShowfunctionCallback function triggered when the color picker is shown
onBeforeShowfunctionCallback function triggered before the color picker is shown
onHidefunctionCallback function triggered when the color picker is hidden
onChangefunctionCallback function triggered when the color is changed
onSubmitfunctionCallback function triggered when the color it is chosen
-

Set color

-

If you want to set a new color.

-
$('input').ColorPickerSetColor(color);
-

The 'color' argument is the same format as the option color, string for hex color or hash for RGB and HSB ({r:255, r:0, b:0}).

-
-
-
- - + + + + + + ColorPicker - jQuery plugin + + + + + + + +
+

Color Picker - jQuery plugin

+ +
+
+

About

+

A simple component to select color in the same way you select color in Adobe Photoshop

+

Last update

+

23.05.2009 - Check Download tab

+

Features

+
    +
  • Flat mode - as element in page
  • +
  • Powerful controls for color selection
  • +
  • Easy to customize the look by changing some images
  • +
  • Fits into the viewport
  • +
+

License

+

Dual licensed under the MIT and GPL licenses.

+

Examples

+

Flat mode.

+

+

+
+$('#colorpickerHolder').ColorPicker({flat: true});
+                
+

Custom skin and using flat mode to display the color picker in a custom widget.

+
+
+
+
+
+ +

Attached to an text field and using callback functions to update the color with field's value and set the value back in the field by submiting the color.

+

+

+

+
$('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({
+	onSubmit: function(hsb, hex, rgb, el) {
+		$(el).val(hex);
+		$(el).ColorPickerHide();
+	},
+	onBeforeShow: function () {
+		$(this).ColorPickerSetColor(this.value);
+	}
+})
+.bind('keyup', function(){
+	$(this).ColorPickerSetColor(this.value);
+});
+
+

Attached to DOMElement and using callbacks to live preview the color and adding animation.

+

+

+

+
+$('#colorSelector').ColorPicker({
+	color: '#0000ff',
+	onShow: function (colpkr) {
+		$(colpkr).fadeIn(500);
+		return false;
+	},
+	onHide: function (colpkr) {
+		$(colpkr).fadeOut(500);
+		return false;
+	},
+	onChange: function (hsb, hex, rgb) {
+		$('#colorSelector div').css('backgroundColor', '#' + hex);
+	}
+});
+
+
+
+

Download

+

colorpicker.zip (73 kb): jQuery, Javscript files, CSS files, images, examples and instructions.

+

Changelog

+
+
23.05.2009
+
Added: close on color selection example
+
Added: restore original color option
+
Changed: color update on key up event
+
Fixed: colorpicker hide and show methods
+
Fixed: reference to options. Multiple fields with colorpickers is possible now.
+
Fixed: RGB to HSB convertion
+
22.08.2008
+
Fixed bug: where some events were not canceled right on Safari
+
Fixed bug: where teh view port was not detected right on Safari
+
16-07-2008
+
Fixed bug where the letter 'F' could not be typed in the Hex field
+
Fixed bug where the changes on Hex field where not parsed
+
Added new option 'livePreview'
+
08-07-2008
+
Fixed typo in the code, both JavaScript and CSS
+
Changed the cursor for some elements
+
Added new demo explaining how to implement custom skin
+
07.07.2008
+
The first release.
+
+
+
+

Implement

+

Attach the Javascript and CSS files to your document. Edit CSS file and fix the paths to images and change colors to fit your site theme.

+
+<link rel="stylesheet" media="screen" type="text/css" href="css/colorpicker.css" />
+<script type="text/javascript" src="js/colorpicker.js"></script>
+                
+

Invocation code

+

All you have to do is to select the elements in a jQuery way and call the plugin.

+
+ $('input').ColorPicker(options);
+                
+

Options

+

A hash of parameters. All parameters are optional.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
eventNamestringThe desired event to trigger the colorpicker. Default: 'click'
colorstring or hashThe default color. String for hex color or hash for RGB and HSB ({r:255, r:0, b:0}) . Default: 'ff0000'
flatbooleanWhatever if the color picker is appended to the element or triggered by an event. Default false
livePreviewbooleanWhatever if the color values are filled in the fields while changing values on selector or a field. If false it may improve speed. Default true
onShowfunctionCallback function triggered when the color picker is shown
onBeforeShowfunctionCallback function triggered before the color picker is shown
onHidefunctionCallback function triggered when the color picker is hidden
onChangefunctionCallback function triggered when the color is changed
onSubmitfunctionCallback function triggered when the color it is chosen
+

Set color

+

If you want to set a new color.

+
$('input').ColorPickerSetColor(color);
+

The 'color' argument is the same format as the option color, string for hex color or hash for RGB and HSB ({r:255, r:0, b:0}).

+
+
+
+ + diff --git a/js2/mwEmbed/libClipEdit/colorpicker/js/colorpicker.js b/js2/mwEmbed/libClipEdit/colorpicker/js/colorpicker.js index 10a2b2244b..45f56ced7a 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/js/colorpicker.js +++ b/js2/mwEmbed/libClipEdit/colorpicker/js/colorpicker.js @@ -1,484 +1,484 @@ -/** - * - * Color picker - * Author: Stefan Petre www.eyecon.ro - * - * Dual licensed under the MIT and GPL licenses - * - */ -(function ($) { - var ColorPicker = function () { - var - ids = {}, - inAction, - charMin = 65, - visible, - tpl = '
', - defaults = { - eventName: 'click', - onShow: function () {}, - onBeforeShow: function(){}, - onHide: function () {}, - onChange: function () {}, - onSubmit: function () {}, - color: 'ff0000', - livePreview: true, - flat: false - }, - fillRGBFields = function (hsb, cal) { - var rgb = HSBToRGB(hsb); - $(cal).data('colorpicker').fields - .eq(1).val(rgb.r).end() - .eq(2).val(rgb.g).end() - .eq(3).val(rgb.b).end(); - }, - fillHSBFields = function (hsb, cal) { - $(cal).data('colorpicker').fields - .eq(4).val(hsb.h).end() - .eq(5).val(hsb.s).end() - .eq(6).val(hsb.b).end(); - }, - fillHexFields = function (hsb, cal) { - $(cal).data('colorpicker').fields - .eq(0).val(HSBToHex(hsb)).end(); - }, - setSelector = function (hsb, cal) { - $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100})); - $(cal).data('colorpicker').selectorIndic.css({ - left: parseInt(150 * hsb.s/100, 10), - top: parseInt(150 * (100-hsb.b)/100, 10) - }); - }, - setHue = function (hsb, cal) { - $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10)); - }, - setCurrentColor = function (hsb, cal) { - $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb)); - }, - setNewColor = function (hsb, cal) { - $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb)); - }, - keyDown = function (ev) { - var pressedKey = ev.charCode || ev.keyCode || -1; - if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) { - return false; - } - var cal = $(this).parent().parent(); - if (cal.data('colorpicker').livePreview === true) { - change.apply(this); - } - }, - change = function (ev) { - var cal = $(this).parent().parent(), col; - if (this.parentNode.className.indexOf('_hex') > 0) { - cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value)); - } else if (this.parentNode.className.indexOf('_hsb') > 0) { - cal.data('colorpicker').color = col = fixHSB({ - h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10), - s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10), - b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10) - }); - } else { - cal.data('colorpicker').color = col = RGBToHSB(fixRGB({ - r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10), - g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10), - b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10) - })); - } - if (ev) { - fillRGBFields(col, cal.get(0)); - fillHexFields(col, cal.get(0)); - fillHSBFields(col, cal.get(0)); - } - setSelector(col, cal.get(0)); - setHue(col, cal.get(0)); - setNewColor(col, cal.get(0)); - cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]); - }, - blur = function (ev) { - var cal = $(this).parent().parent(); - cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus'); - }, - focus = function () { - charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65; - $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus'); - $(this).parent().addClass('colorpicker_focus'); - }, - downIncrement = function (ev) { - var field = $(this).parent().find('input').focus(); - var current = { - el: $(this).parent().addClass('colorpicker_slider'), - max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255), - y: ev.pageY, - field: field, - val: parseInt(field.val(), 10), - preview: $(this).parent().parent().data('colorpicker').livePreview - }; - $(document).bind('mouseup', current, upIncrement); - $(document).bind('mousemove', current, moveIncrement); - }, - moveIncrement = function (ev) { - ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10)))); - if (ev.data.preview) { - change.apply(ev.data.field.get(0), [true]); - } - return false; - }, - upIncrement = function (ev) { - change.apply(ev.data.field.get(0), [true]); - ev.data.el.removeClass('colorpicker_slider').find('input').focus(); - $(document).unbind('mouseup', upIncrement); - $(document).unbind('mousemove', moveIncrement); - return false; - }, - downHue = function (ev) { - var current = { - cal: $(this).parent(), - y: $(this).offset().top - }; - current.preview = current.cal.data('colorpicker').livePreview; - $(document).bind('mouseup', current, upHue); - $(document).bind('mousemove', current, moveHue); - }, - moveHue = function (ev) { - change.apply( - ev.data.cal.data('colorpicker') - .fields - .eq(4) - .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10)) - .get(0), - [ev.data.preview] - ); - return false; - }, - upHue = function (ev) { - fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); - fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); - $(document).unbind('mouseup', upHue); - $(document).unbind('mousemove', moveHue); - return false; - }, - downSelector = function (ev) { - var current = { - cal: $(this).parent(), - pos: $(this).offset() - }; - current.preview = current.cal.data('colorpicker').livePreview; - $(document).bind('mouseup', current, upSelector); - $(document).bind('mousemove', current, moveSelector); - }, - moveSelector = function (ev) { - change.apply( - ev.data.cal.data('colorpicker') - .fields - .eq(6) - .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10)) - .end() - .eq(5) - .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10)) - .get(0), - [ev.data.preview] - ); - return false; - }, - upSelector = function (ev) { - fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); - fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); - $(document).unbind('mouseup', upSelector); - $(document).unbind('mousemove', moveSelector); - return false; - }, - enterSubmit = function (ev) { - $(this).addClass('colorpicker_focus'); - }, - leaveSubmit = function (ev) { - $(this).removeClass('colorpicker_focus'); - }, - clickSubmit = function (ev) { - var cal = $(this).parent(); - var col = cal.data('colorpicker').color; - cal.data('colorpicker').origColor = col; - setCurrentColor(col, cal.get(0)); - cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el); - }, - show = function (ev) { - var cal = $('#' + $(this).data('colorpickerId')); - cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]); - var pos = $(this).offset(); - var viewPort = getViewport(); - var top = pos.top + this.offsetHeight; - var left = pos.left; - if (top + 176 > viewPort.t + viewPort.h) { - top -= this.offsetHeight + 176; - } - if (left + 356 > viewPort.l + viewPort.w) { - left -= 356; - } - cal.css({left: left + 'px', top: top + 'px'}); - if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) { - cal.show(); - } - $(document).bind('mousedown', {cal: cal}, hide); - return false; - }, - hide = function (ev) { - if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) { - if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) { - ev.data.cal.hide(); - } - $(document).unbind('mousedown', hide); - } - }, - isChildOf = function(parentEl, el, container) { - if (parentEl == el) { - return true; - } - if (parentEl.contains) { - return parentEl.contains(el); - } - if ( parentEl.compareDocumentPosition ) { - return !!(parentEl.compareDocumentPosition(el) & 16); - } - var prEl = el.parentNode; - while(prEl && prEl != container) { - if (prEl == parentEl) - return true; - prEl = prEl.parentNode; - } - return false; - }, - getViewport = function () { - var m = document.compatMode == 'CSS1Compat'; - return { - l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft), - t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop), - w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth), - h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight) - }; - }, - fixHSB = function (hsb) { - return { - h: Math.min(360, Math.max(0, hsb.h)), - s: Math.min(100, Math.max(0, hsb.s)), - b: Math.min(100, Math.max(0, hsb.b)) - }; - }, - fixRGB = function (rgb) { - return { - r: Math.min(255, Math.max(0, rgb.r)), - g: Math.min(255, Math.max(0, rgb.g)), - b: Math.min(255, Math.max(0, rgb.b)) - }; - }, - fixHex = function (hex) { - var len = 6 - hex.length; - if (len > 0) { - var o = []; - for (var i=0; i -1) ? hex.substring(1) : hex), 16); - return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)}; - }, - HexToHSB = function (hex) { - return RGBToHSB(HexToRGB(hex)); - }, - RGBToHSB = function (rgb) { - var hsb = { - h: 0, - s: 0, - b: 0 - }; - var min = Math.min(rgb.r, rgb.g, rgb.b); - var max = Math.max(rgb.r, rgb.g, rgb.b); - var delta = max - min; - hsb.b = max; - if (max != 0) { - - } - hsb.s = max != 0 ? 255 * delta / max : 0; - if (hsb.s != 0) { - if (rgb.r == max) { - hsb.h = (rgb.g - rgb.b) / delta; - } else if (rgb.g == max) { - hsb.h = 2 + (rgb.b - rgb.r) / delta; - } else { - hsb.h = 4 + (rgb.r - rgb.g) / delta; - } - } else { - hsb.h = -1; - } - hsb.h *= 60; - if (hsb.h < 0) { - hsb.h += 360; - } - hsb.s *= 100/255; - hsb.b *= 100/255; - return hsb; - }, - HSBToRGB = function (hsb) { - var rgb = {}; - var h = Math.round(hsb.h); - var s = Math.round(hsb.s*255/100); - var v = Math.round(hsb.b*255/100); - if(s == 0) { - rgb.r = rgb.g = rgb.b = v; - } else { - var t1 = v; - var t2 = (255-s)*v/255; - var t3 = (t1-t2)*(h%60)/60; - if(h==360) h = 0; - if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} - else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} - else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} - else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} - else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} - else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} - else {rgb.r=0; rgb.g=0; rgb.b=0} - } - return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}; - }, - RGBToHex = function (rgb) { - var hex = [ - rgb.r.toString(16), - rgb.g.toString(16), - rgb.b.toString(16) - ]; - $.each(hex, function (nr, val) { - if (val.length == 1) { - hex[nr] = '0' + val; - } - }); - return hex.join(''); - }, - HSBToHex = function (hsb) { - return RGBToHex(HSBToRGB(hsb)); - }, - restoreOriginal = function () { - var cal = $(this).parent(); - var col = cal.data('colorpicker').origColor; - cal.data('colorpicker').color = col; - fillRGBFields(col, cal.get(0)); - fillHexFields(col, cal.get(0)); - fillHSBFields(col, cal.get(0)); - setSelector(col, cal.get(0)); - setHue(col, cal.get(0)); - setNewColor(col, cal.get(0)); - }; - return { - init: function (opt) { - opt = $.extend({}, defaults, opt||{}); - if (typeof opt.color == 'string') { - opt.color = HexToHSB(opt.color); - } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) { - opt.color = RGBToHSB(opt.color); - } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) { - opt.color = fixHSB(opt.color); - } else { - return this; - } - return this.each(function () { - if (!$(this).data('colorpickerId')) { - var options = $.extend({}, opt); - options.origColor = opt.color; - var id = 'collorpicker_' + parseInt(Math.random() * 1000); - $(this).data('colorpickerId', id); - var cal = $(tpl).attr('id', id); - if (options.flat) { - cal.appendTo(this).show(); - } else { - cal.appendTo(document.body); - } - options.fields = cal - .find('input') - .bind('keyup', keyDown) - .bind('change', change) - .bind('blur', blur) - .bind('focus', focus); - cal - .find('span').bind('mousedown', downIncrement).end() - .find('>div.colorpicker_current_color').bind('click', restoreOriginal); - options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector); - options.selectorIndic = options.selector.find('div div'); - options.el = this; - options.hue = cal.find('div.colorpicker_hue div'); - cal.find('div.colorpicker_hue').bind('mousedown', downHue); - options.newColor = cal.find('div.colorpicker_new_color'); - options.currentColor = cal.find('div.colorpicker_current_color'); - cal.data('colorpicker', options); - cal.find('div.colorpicker_submit') - .bind('mouseenter', enterSubmit) - .bind('mouseleave', leaveSubmit) - .bind('click', clickSubmit); - fillRGBFields(options.color, cal.get(0)); - fillHSBFields(options.color, cal.get(0)); - fillHexFields(options.color, cal.get(0)); - setHue(options.color, cal.get(0)); - setSelector(options.color, cal.get(0)); - setCurrentColor(options.color, cal.get(0)); - setNewColor(options.color, cal.get(0)); - if (options.flat) { - cal.css({ - position: 'relative', - display: 'block' - }); - } else { - $(this).bind(options.eventName, show); - } - } - }); - }, - showPicker: function() { - return this.each( function () { - if ($(this).data('colorpickerId')) { - show.apply(this); - } - }); - }, - hidePicker: function() { - return this.each( function () { - if ($(this).data('colorpickerId')) { - $('#' + $(this).data('colorpickerId')).hide(); - } - }); - }, - setColor: function(col) { - if (typeof col == 'string') { - col = HexToHSB(col); - } else if (col.r != undefined && col.g != undefined && col.b != undefined) { - col = RGBToHSB(col); - } else if (col.h != undefined && col.s != undefined && col.b != undefined) { - col = fixHSB(col); - } else { - return this; - } - return this.each(function(){ - if ($(this).data('colorpickerId')) { - var cal = $('#' + $(this).data('colorpickerId')); - cal.data('colorpicker').color = col; - cal.data('colorpicker').origColor = col; - fillRGBFields(col, cal.get(0)); - fillHSBFields(col, cal.get(0)); - fillHexFields(col, cal.get(0)); - setHue(col, cal.get(0)); - setSelector(col, cal.get(0)); - setCurrentColor(col, cal.get(0)); - setNewColor(col, cal.get(0)); - } - }); - } - }; - }(); - $.fn.extend({ - ColorPicker: ColorPicker.init, - ColorPickerHide: ColorPicker.hidePicker, - ColorPickerShow: ColorPicker.showPicker, - ColorPickerSetColor: ColorPicker.setColor - }); +/** + * + * Color picker + * Author: Stefan Petre www.eyecon.ro + * + * Dual licensed under the MIT and GPL licenses + * + */ +(function ($) { + var ColorPicker = function () { + var + ids = {}, + inAction, + charMin = 65, + visible, + tpl = '
', + defaults = { + eventName: 'click', + onShow: function () {}, + onBeforeShow: function(){}, + onHide: function () {}, + onChange: function () {}, + onSubmit: function () {}, + color: 'ff0000', + livePreview: true, + flat: false + }, + fillRGBFields = function (hsb, cal) { + var rgb = HSBToRGB(hsb); + $(cal).data('colorpicker').fields + .eq(1).val(rgb.r).end() + .eq(2).val(rgb.g).end() + .eq(3).val(rgb.b).end(); + }, + fillHSBFields = function (hsb, cal) { + $(cal).data('colorpicker').fields + .eq(4).val(hsb.h).end() + .eq(5).val(hsb.s).end() + .eq(6).val(hsb.b).end(); + }, + fillHexFields = function (hsb, cal) { + $(cal).data('colorpicker').fields + .eq(0).val(HSBToHex(hsb)).end(); + }, + setSelector = function (hsb, cal) { + $(cal).data('colorpicker').selector.css('backgroundColor', '#' + HSBToHex({h: hsb.h, s: 100, b: 100})); + $(cal).data('colorpicker').selectorIndic.css({ + left: parseInt(150 * hsb.s/100, 10), + top: parseInt(150 * (100-hsb.b)/100, 10) + }); + }, + setHue = function (hsb, cal) { + $(cal).data('colorpicker').hue.css('top', parseInt(150 - 150 * hsb.h/360, 10)); + }, + setCurrentColor = function (hsb, cal) { + $(cal).data('colorpicker').currentColor.css('backgroundColor', '#' + HSBToHex(hsb)); + }, + setNewColor = function (hsb, cal) { + $(cal).data('colorpicker').newColor.css('backgroundColor', '#' + HSBToHex(hsb)); + }, + keyDown = function (ev) { + var pressedKey = ev.charCode || ev.keyCode || -1; + if ((pressedKey > charMin && pressedKey <= 90) || pressedKey == 32) { + return false; + } + var cal = $(this).parent().parent(); + if (cal.data('colorpicker').livePreview === true) { + change.apply(this); + } + }, + change = function (ev) { + var cal = $(this).parent().parent(), col; + if (this.parentNode.className.indexOf('_hex') > 0) { + cal.data('colorpicker').color = col = HexToHSB(fixHex(this.value)); + } else if (this.parentNode.className.indexOf('_hsb') > 0) { + cal.data('colorpicker').color = col = fixHSB({ + h: parseInt(cal.data('colorpicker').fields.eq(4).val(), 10), + s: parseInt(cal.data('colorpicker').fields.eq(5).val(), 10), + b: parseInt(cal.data('colorpicker').fields.eq(6).val(), 10) + }); + } else { + cal.data('colorpicker').color = col = RGBToHSB(fixRGB({ + r: parseInt(cal.data('colorpicker').fields.eq(1).val(), 10), + g: parseInt(cal.data('colorpicker').fields.eq(2).val(), 10), + b: parseInt(cal.data('colorpicker').fields.eq(3).val(), 10) + })); + } + if (ev) { + fillRGBFields(col, cal.get(0)); + fillHexFields(col, cal.get(0)); + fillHSBFields(col, cal.get(0)); + } + setSelector(col, cal.get(0)); + setHue(col, cal.get(0)); + setNewColor(col, cal.get(0)); + cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col)]); + }, + blur = function (ev) { + var cal = $(this).parent().parent(); + cal.data('colorpicker').fields.parent().removeClass('colorpicker_focus'); + }, + focus = function () { + charMin = this.parentNode.className.indexOf('_hex') > 0 ? 70 : 65; + $(this).parent().parent().data('colorpicker').fields.parent().removeClass('colorpicker_focus'); + $(this).parent().addClass('colorpicker_focus'); + }, + downIncrement = function (ev) { + var field = $(this).parent().find('input').focus(); + var current = { + el: $(this).parent().addClass('colorpicker_slider'), + max: this.parentNode.className.indexOf('_hsb_h') > 0 ? 360 : (this.parentNode.className.indexOf('_hsb') > 0 ? 100 : 255), + y: ev.pageY, + field: field, + val: parseInt(field.val(), 10), + preview: $(this).parent().parent().data('colorpicker').livePreview + }; + $(document).bind('mouseup', current, upIncrement); + $(document).bind('mousemove', current, moveIncrement); + }, + moveIncrement = function (ev) { + ev.data.field.val(Math.max(0, Math.min(ev.data.max, parseInt(ev.data.val + ev.pageY - ev.data.y, 10)))); + if (ev.data.preview) { + change.apply(ev.data.field.get(0), [true]); + } + return false; + }, + upIncrement = function (ev) { + change.apply(ev.data.field.get(0), [true]); + ev.data.el.removeClass('colorpicker_slider').find('input').focus(); + $(document).unbind('mouseup', upIncrement); + $(document).unbind('mousemove', moveIncrement); + return false; + }, + downHue = function (ev) { + var current = { + cal: $(this).parent(), + y: $(this).offset().top + }; + current.preview = current.cal.data('colorpicker').livePreview; + $(document).bind('mouseup', current, upHue); + $(document).bind('mousemove', current, moveHue); + }, + moveHue = function (ev) { + change.apply( + ev.data.cal.data('colorpicker') + .fields + .eq(4) + .val(parseInt(360*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.y))))/150, 10)) + .get(0), + [ev.data.preview] + ); + return false; + }, + upHue = function (ev) { + fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + $(document).unbind('mouseup', upHue); + $(document).unbind('mousemove', moveHue); + return false; + }, + downSelector = function (ev) { + var current = { + cal: $(this).parent(), + pos: $(this).offset() + }; + current.preview = current.cal.data('colorpicker').livePreview; + $(document).bind('mouseup', current, upSelector); + $(document).bind('mousemove', current, moveSelector); + }, + moveSelector = function (ev) { + change.apply( + ev.data.cal.data('colorpicker') + .fields + .eq(6) + .val(parseInt(100*(150 - Math.max(0,Math.min(150,(ev.pageY - ev.data.pos.top))))/150, 10)) + .end() + .eq(5) + .val(parseInt(100*(Math.max(0,Math.min(150,(ev.pageX - ev.data.pos.left))))/150, 10)) + .get(0), + [ev.data.preview] + ); + return false; + }, + upSelector = function (ev) { + fillRGBFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + fillHexFields(ev.data.cal.data('colorpicker').color, ev.data.cal.get(0)); + $(document).unbind('mouseup', upSelector); + $(document).unbind('mousemove', moveSelector); + return false; + }, + enterSubmit = function (ev) { + $(this).addClass('colorpicker_focus'); + }, + leaveSubmit = function (ev) { + $(this).removeClass('colorpicker_focus'); + }, + clickSubmit = function (ev) { + var cal = $(this).parent(); + var col = cal.data('colorpicker').color; + cal.data('colorpicker').origColor = col; + setCurrentColor(col, cal.get(0)); + cal.data('colorpicker').onSubmit(col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el); + }, + show = function (ev) { + var cal = $('#' + $(this).data('colorpickerId')); + cal.data('colorpicker').onBeforeShow.apply(this, [cal.get(0)]); + var pos = $(this).offset(); + var viewPort = getViewport(); + var top = pos.top + this.offsetHeight; + var left = pos.left; + if (top + 176 > viewPort.t + viewPort.h) { + top -= this.offsetHeight + 176; + } + if (left + 356 > viewPort.l + viewPort.w) { + left -= 356; + } + cal.css({left: left + 'px', top: top + 'px'}); + if (cal.data('colorpicker').onShow.apply(this, [cal.get(0)]) != false) { + cal.show(); + } + $(document).bind('mousedown', {cal: cal}, hide); + return false; + }, + hide = function (ev) { + if (!isChildOf(ev.data.cal.get(0), ev.target, ev.data.cal.get(0))) { + if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false) { + ev.data.cal.hide(); + } + $(document).unbind('mousedown', hide); + } + }, + isChildOf = function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (parentEl.contains) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + getViewport = function () { + var m = document.compatMode == 'CSS1Compat'; + return { + l : window.pageXOffset || (m ? document.documentElement.scrollLeft : document.body.scrollLeft), + t : window.pageYOffset || (m ? document.documentElement.scrollTop : document.body.scrollTop), + w : window.innerWidth || (m ? document.documentElement.clientWidth : document.body.clientWidth), + h : window.innerHeight || (m ? document.documentElement.clientHeight : document.body.clientHeight) + }; + }, + fixHSB = function (hsb) { + return { + h: Math.min(360, Math.max(0, hsb.h)), + s: Math.min(100, Math.max(0, hsb.s)), + b: Math.min(100, Math.max(0, hsb.b)) + }; + }, + fixRGB = function (rgb) { + return { + r: Math.min(255, Math.max(0, rgb.r)), + g: Math.min(255, Math.max(0, rgb.g)), + b: Math.min(255, Math.max(0, rgb.b)) + }; + }, + fixHex = function (hex) { + var len = 6 - hex.length; + if (len > 0) { + var o = []; + for (var i=0; i -1) ? hex.substring(1) : hex), 16); + return {r: hex >> 16, g: (hex & 0x00FF00) >> 8, b: (hex & 0x0000FF)}; + }, + HexToHSB = function (hex) { + return RGBToHSB(HexToRGB(hex)); + }, + RGBToHSB = function (rgb) { + var hsb = { + h: 0, + s: 0, + b: 0 + }; + var min = Math.min(rgb.r, rgb.g, rgb.b); + var max = Math.max(rgb.r, rgb.g, rgb.b); + var delta = max - min; + hsb.b = max; + if (max != 0) { + + } + hsb.s = max != 0 ? 255 * delta / max : 0; + if (hsb.s != 0) { + if (rgb.r == max) { + hsb.h = (rgb.g - rgb.b) / delta; + } else if (rgb.g == max) { + hsb.h = 2 + (rgb.b - rgb.r) / delta; + } else { + hsb.h = 4 + (rgb.r - rgb.g) / delta; + } + } else { + hsb.h = -1; + } + hsb.h *= 60; + if (hsb.h < 0) { + hsb.h += 360; + } + hsb.s *= 100/255; + hsb.b *= 100/255; + return hsb; + }, + HSBToRGB = function (hsb) { + var rgb = {}; + var h = Math.round(hsb.h); + var s = Math.round(hsb.s*255/100); + var v = Math.round(hsb.b*255/100); + if(s == 0) { + rgb.r = rgb.g = rgb.b = v; + } else { + var t1 = v; + var t2 = (255-s)*v/255; + var t3 = (t1-t2)*(h%60)/60; + if(h==360) h = 0; + if(h<60) {rgb.r=t1; rgb.b=t2; rgb.g=t2+t3} + else if(h<120) {rgb.g=t1; rgb.b=t2; rgb.r=t1-t3} + else if(h<180) {rgb.g=t1; rgb.r=t2; rgb.b=t2+t3} + else if(h<240) {rgb.b=t1; rgb.r=t2; rgb.g=t1-t3} + else if(h<300) {rgb.b=t1; rgb.g=t2; rgb.r=t2+t3} + else if(h<360) {rgb.r=t1; rgb.g=t2; rgb.b=t1-t3} + else {rgb.r=0; rgb.g=0; rgb.b=0} + } + return {r:Math.round(rgb.r), g:Math.round(rgb.g), b:Math.round(rgb.b)}; + }, + RGBToHex = function (rgb) { + var hex = [ + rgb.r.toString(16), + rgb.g.toString(16), + rgb.b.toString(16) + ]; + $.each(hex, function (nr, val) { + if (val.length == 1) { + hex[nr] = '0' + val; + } + }); + return hex.join(''); + }, + HSBToHex = function (hsb) { + return RGBToHex(HSBToRGB(hsb)); + }, + restoreOriginal = function () { + var cal = $(this).parent(); + var col = cal.data('colorpicker').origColor; + cal.data('colorpicker').color = col; + fillRGBFields(col, cal.get(0)); + fillHexFields(col, cal.get(0)); + fillHSBFields(col, cal.get(0)); + setSelector(col, cal.get(0)); + setHue(col, cal.get(0)); + setNewColor(col, cal.get(0)); + }; + return { + init: function (opt) { + opt = $.extend({}, defaults, opt||{}); + if (typeof opt.color == 'string') { + opt.color = HexToHSB(opt.color); + } else if (opt.color.r != undefined && opt.color.g != undefined && opt.color.b != undefined) { + opt.color = RGBToHSB(opt.color); + } else if (opt.color.h != undefined && opt.color.s != undefined && opt.color.b != undefined) { + opt.color = fixHSB(opt.color); + } else { + return this; + } + return this.each(function () { + if (!$(this).data('colorpickerId')) { + var options = $.extend({}, opt); + options.origColor = opt.color; + var id = 'collorpicker_' + parseInt(Math.random() * 1000); + $(this).data('colorpickerId', id); + var cal = $(tpl).attr('id', id); + if (options.flat) { + cal.appendTo(this).show(); + } else { + cal.appendTo(document.body); + } + options.fields = cal + .find('input') + .bind('keyup', keyDown) + .bind('change', change) + .bind('blur', blur) + .bind('focus', focus); + cal + .find('span').bind('mousedown', downIncrement).end() + .find('>div.colorpicker_current_color').bind('click', restoreOriginal); + options.selector = cal.find('div.colorpicker_color').bind('mousedown', downSelector); + options.selectorIndic = options.selector.find('div div'); + options.el = this; + options.hue = cal.find('div.colorpicker_hue div'); + cal.find('div.colorpicker_hue').bind('mousedown', downHue); + options.newColor = cal.find('div.colorpicker_new_color'); + options.currentColor = cal.find('div.colorpicker_current_color'); + cal.data('colorpicker', options); + cal.find('div.colorpicker_submit') + .bind('mouseenter', enterSubmit) + .bind('mouseleave', leaveSubmit) + .bind('click', clickSubmit); + fillRGBFields(options.color, cal.get(0)); + fillHSBFields(options.color, cal.get(0)); + fillHexFields(options.color, cal.get(0)); + setHue(options.color, cal.get(0)); + setSelector(options.color, cal.get(0)); + setCurrentColor(options.color, cal.get(0)); + setNewColor(options.color, cal.get(0)); + if (options.flat) { + cal.css({ + position: 'relative', + display: 'block' + }); + } else { + $(this).bind(options.eventName, show); + } + } + }); + }, + showPicker: function() { + return this.each( function () { + if ($(this).data('colorpickerId')) { + show.apply(this); + } + }); + }, + hidePicker: function() { + return this.each( function () { + if ($(this).data('colorpickerId')) { + $('#' + $(this).data('colorpickerId')).hide(); + } + }); + }, + setColor: function(col) { + if (typeof col == 'string') { + col = HexToHSB(col); + } else if (col.r != undefined && col.g != undefined && col.b != undefined) { + col = RGBToHSB(col); + } else if (col.h != undefined && col.s != undefined && col.b != undefined) { + col = fixHSB(col); + } else { + return this; + } + return this.each(function(){ + if ($(this).data('colorpickerId')) { + var cal = $('#' + $(this).data('colorpickerId')); + cal.data('colorpicker').color = col; + cal.data('colorpicker').origColor = col; + fillRGBFields(col, cal.get(0)); + fillHSBFields(col, cal.get(0)); + fillHexFields(col, cal.get(0)); + setHue(col, cal.get(0)); + setSelector(col, cal.get(0)); + setCurrentColor(col, cal.get(0)); + setNewColor(col, cal.get(0)); + } + }); + } + }; + }(); + $.fn.extend({ + ColorPicker: ColorPicker.init, + ColorPickerHide: ColorPicker.hidePicker, + ColorPickerShow: ColorPicker.showPicker, + ColorPickerSetColor: ColorPicker.setColor + }); })(jQuery) \ No newline at end of file diff --git a/js2/mwEmbed/libClipEdit/colorpicker/js/eye.js b/js2/mwEmbed/libClipEdit/colorpicker/js/eye.js index ea70e643f2..8a281dc3bf 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/js/eye.js +++ b/js2/mwEmbed/libClipEdit/colorpicker/js/eye.js @@ -1,34 +1,34 @@ -/** - * - * Zoomimage - * Author: Stefan Petre www.eyecon.ro - * - */ -(function($){ - var EYE = window.EYE = function() { - var _registered = { - init: [] - }; - return { - init: function() { - $.each(_registered.init, function(nr, fn){ - fn.call(); - }); - }, - extend: function(prop) { - for (var i in prop) { - if (prop[i] != undefined) { - this[i] = prop[i]; - } - } - }, - register: function(fn, type) { - if (!_registered[type]) { - _registered[type] = []; - } - _registered[type].push(fn); - } - }; - }(); - $(EYE.init); -})(jQuery); +/** + * + * Zoomimage + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($){ + var EYE = window.EYE = function() { + var _registered = { + init: [] + }; + return { + init: function() { + $.each(_registered.init, function(nr, fn){ + fn.call(); + }); + }, + extend: function(prop) { + for (var i in prop) { + if (prop[i] != undefined) { + this[i] = prop[i]; + } + } + }, + register: function(fn, type) { + if (!_registered[type]) { + _registered[type] = []; + } + _registered[type].push(fn); + } + }; + }(); + $(EYE.init); +})(jQuery); diff --git a/js2/mwEmbed/libClipEdit/colorpicker/js/layout.js b/js2/mwEmbed/libClipEdit/colorpicker/js/layout.js index e0dfb8f332..56975f3bae 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/js/layout.js +++ b/js2/mwEmbed/libClipEdit/colorpicker/js/layout.js @@ -1,67 +1,67 @@ -(function($){ - var initLayout = function() { - var hash = window.location.hash.replace('#', ''); - var currentTab = $('ul.navigationTabs a') - .bind('click', showTab) - .filter('a[rel=' + hash + ']'); - if (currentTab.size() == 0) { - currentTab = $('ul.navigationTabs a:first'); - } - showTab.apply(currentTab.get(0)); - $('#colorpickerHolder').ColorPicker({flat: true}); - $('#colorpickerHolder2').ColorPicker({ - flat: true, - color: '#00ff00', - onSubmit: function(hsb, hex, rgb) { - $('#colorSelector2 div').css('backgroundColor', '#' + hex); - } - }); - $('#colorpickerHolder2>div').css('position', 'absolute'); - var widt = false; - $('#colorSelector2').bind('click', function() { - $('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500); - widt = !widt; - }); - $('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({ - onSubmit: function(hsb, hex, rgb, el) { - $(el).val(hex); - $(el).ColorPickerHide(); - }, - onBeforeShow: function () { - $(this).ColorPickerSetColor(this.value); - } - }) - .bind('keyup', function(){ - $(this).ColorPickerSetColor(this.value); - }); - $('#colorSelector').ColorPicker({ - color: '#0000ff', - onShow: function (colpkr) { - $(colpkr).fadeIn(500); - return false; - }, - onHide: function (colpkr) { - $(colpkr).fadeOut(500); - return false; - }, - onChange: function (hsb, hex, rgb) { - $('#colorSelector div').css('backgroundColor', '#' + hex); - } - }); - }; - - var showTab = function(e) { - var tabIndex = $('ul.navigationTabs a') - .removeClass('active') - .index(this); - $(this) - .addClass('active') - .blur(); - $('div.tab') - .hide() - .eq(tabIndex) - .show(); - }; - - EYE.register(initLayout, 'init'); +(function($){ + var initLayout = function() { + var hash = window.location.hash.replace('#', ''); + var currentTab = $('ul.navigationTabs a') + .bind('click', showTab) + .filter('a[rel=' + hash + ']'); + if (currentTab.size() == 0) { + currentTab = $('ul.navigationTabs a:first'); + } + showTab.apply(currentTab.get(0)); + $('#colorpickerHolder').ColorPicker({flat: true}); + $('#colorpickerHolder2').ColorPicker({ + flat: true, + color: '#00ff00', + onSubmit: function(hsb, hex, rgb) { + $('#colorSelector2 div').css('backgroundColor', '#' + hex); + } + }); + $('#colorpickerHolder2>div').css('position', 'absolute'); + var widt = false; + $('#colorSelector2').bind('click', function() { + $('#colorpickerHolder2').stop().animate({height: widt ? 0 : 173}, 500); + widt = !widt; + }); + $('#colorpickerField1, #colorpickerField2, #colorpickerField3').ColorPicker({ + onSubmit: function(hsb, hex, rgb, el) { + $(el).val(hex); + $(el).ColorPickerHide(); + }, + onBeforeShow: function () { + $(this).ColorPickerSetColor(this.value); + } + }) + .bind('keyup', function(){ + $(this).ColorPickerSetColor(this.value); + }); + $('#colorSelector').ColorPicker({ + color: '#0000ff', + onShow: function (colpkr) { + $(colpkr).fadeIn(500); + return false; + }, + onHide: function (colpkr) { + $(colpkr).fadeOut(500); + return false; + }, + onChange: function (hsb, hex, rgb) { + $('#colorSelector div').css('backgroundColor', '#' + hex); + } + }); + }; + + var showTab = function(e) { + var tabIndex = $('ul.navigationTabs a') + .removeClass('active') + .index(this); + $(this) + .addClass('active') + .blur(); + $('div.tab') + .hide() + .eq(tabIndex) + .show(); + }; + + EYE.register(initLayout, 'init'); })(jQuery) \ No newline at end of file diff --git a/js2/mwEmbed/libClipEdit/colorpicker/js/utils.js b/js2/mwEmbed/libClipEdit/colorpicker/js/utils.js index cc7ce14ec3..d9be853260 100644 --- a/js2/mwEmbed/libClipEdit/colorpicker/js/utils.js +++ b/js2/mwEmbed/libClipEdit/colorpicker/js/utils.js @@ -1,252 +1,252 @@ -/** - * - * Utilities - * Author: Stefan Petre www.eyecon.ro - * - */ -(function($) { -EYE.extend({ - getPosition : function(e, forceIt) - { - var x = 0; - var y = 0; - var es = e.style; - var restoreStyles = false; - if (forceIt && jQuery.curCSS(e,'display') == 'none') { - var oldVisibility = es.visibility; - var oldPosition = es.position; - restoreStyles = true; - es.visibility = 'hidden'; - es.display = 'block'; - es.position = 'absolute'; - } - var el = e; - if (el.getBoundingClientRect) { // IE - var box = el.getBoundingClientRect(); - x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; - y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2; - } else { - x = el.offsetLeft; - y = el.offsetTop; - el = el.offsetParent; - if (e != el) { - while (el) { - x += el.offsetLeft; - y += el.offsetTop; - el = el.offsetParent; - } - } - if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) { - x -= document.body.offsetLeft; - y -= document.body.offsetTop; - } - el = e.parentNode; - while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') - { - if (jQuery.curCSS(el, 'display') != 'inline') { - x -= el.scrollLeft; - y -= el.scrollTop; - } - el = el.parentNode; - } - } - if (restoreStyles == true) { - es.display = 'none'; - es.position = oldPosition; - es.visibility = oldVisibility; - } - return {x:x, y:y}; - }, - getSize : function(e) - { - var w = parseInt(jQuery.curCSS(e,'width'), 10); - var h = parseInt(jQuery.curCSS(e,'height'), 10); - var wb = 0; - var hb = 0; - if (jQuery.curCSS(e, 'display') != 'none') { - wb = e.offsetWidth; - hb = e.offsetHeight; - } else { - var es = e.style; - var oldVisibility = es.visibility; - var oldPosition = es.position; - es.visibility = 'hidden'; - es.display = 'block'; - es.position = 'absolute'; - wb = e.offsetWidth; - hb = e.offsetHeight; - es.display = 'none'; - es.position = oldPosition; - es.visibility = oldVisibility; - } - return {w:w, h:h, wb:wb, hb:hb}; - }, - getClient : function(e) - { - var h, w; - if (e) { - w = e.clientWidth; - h = e.clientHeight; - } else { - var de = document.documentElement; - w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; - h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; - } - return {w:w,h:h}; - }, - getScroll : function (e) - { - var t=0, l=0, w=0, h=0, iw=0, ih=0; - if (e && e.nodeName.toLowerCase() != 'body') { - t = e.scrollTop; - l = e.scrollLeft; - w = e.scrollWidth; - h = e.scrollHeight; - } else { - if (document.documentElement) { - t = document.documentElement.scrollTop; - l = document.documentElement.scrollLeft; - w = document.documentElement.scrollWidth; - h = document.documentElement.scrollHeight; - } else if (document.body) { - t = document.body.scrollTop; - l = document.body.scrollLeft; - w = document.body.scrollWidth; - h = document.body.scrollHeight; - } - if (typeof pageYOffset != 'undefined') { - t = pageYOffset; - l = pageXOffset; - } - iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; - ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; - } - return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; - }, - getMargins : function(e, toInteger) - { - var t = jQuery.curCSS(e,'marginTop') || ''; - var r = jQuery.curCSS(e,'marginRight') || ''; - var b = jQuery.curCSS(e,'marginBottom') || ''; - var l = jQuery.curCSS(e,'marginLeft') || ''; - if (toInteger) - return { - t: parseInt(t, 10)||0, - r: parseInt(r, 10)||0, - b: parseInt(b, 10)||0, - l: parseInt(l, 10) - }; - else - return {t: t, r: r, b: b, l: l}; - }, - getPadding : function(e, toInteger) - { - var t = jQuery.curCSS(e,'paddingTop') || ''; - var r = jQuery.curCSS(e,'paddingRight') || ''; - var b = jQuery.curCSS(e,'paddingBottom') || ''; - var l = jQuery.curCSS(e,'paddingLeft') || ''; - if (toInteger) - return { - t: parseInt(t, 10)||0, - r: parseInt(r, 10)||0, - b: parseInt(b, 10)||0, - l: parseInt(l, 10) - }; - else - return {t: t, r: r, b: b, l: l}; - }, - getBorder : function(e, toInteger) - { - var t = jQuery.curCSS(e,'borderTopWidth') || ''; - var r = jQuery.curCSS(e,'borderRightWidth') || ''; - var b = jQuery.curCSS(e,'borderBottomWidth') || ''; - var l = jQuery.curCSS(e,'borderLeftWidth') || ''; - if (toInteger) - return { - t: parseInt(t, 10)||0, - r: parseInt(r, 10)||0, - b: parseInt(b, 10)||0, - l: parseInt(l, 10)||0 - }; - else - return {t: t, r: r, b: b, l: l}; - }, - traverseDOM : function(nodeEl, func) - { - func(nodeEl); - nodeEl = nodeEl.firstChild; - while(nodeEl){ - EYE.traverseDOM(nodeEl, func); - nodeEl = nodeEl.nextSibling; - } - }, - getInnerWidth : function(el, scroll) { - var offsetW = el.offsetWidth; - return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth; - }, - getInnerHeight : function(el, scroll) { - var offsetH = el.offsetHeight; - return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight; - }, - getExtraWidth : function(el) { - if($.boxModel) - return (parseInt($.curCSS(el, 'paddingLeft'))||0) - + (parseInt($.curCSS(el, 'paddingRight'))||0) - + (parseInt($.curCSS(el, 'borderLeftWidth'))||0) - + (parseInt($.curCSS(el, 'borderRightWidth'))||0); - return 0; - }, - getExtraHeight : function(el) { - if($.boxModel) - return (parseInt($.curCSS(el, 'paddingTop'))||0) - + (parseInt($.curCSS(el, 'paddingBottom'))||0) - + (parseInt($.curCSS(el, 'borderTopWidth'))||0) - + (parseInt($.curCSS(el, 'borderBottomWidth'))||0); - return 0; - }, - isChildOf: function(parentEl, el, container) { - if (parentEl == el) { - return true; - } - if (!el || !el.nodeType || el.nodeType != 1) { - return false; - } - if (parentEl.contains && !$.browser.safari) { - return parentEl.contains(el); - } - if ( parentEl.compareDocumentPosition ) { - return !!(parentEl.compareDocumentPosition(el) & 16); - } - var prEl = el.parentNode; - while(prEl && prEl != container) { - if (prEl == parentEl) - return true; - prEl = prEl.parentNode; - } - return false; - }, - centerEl : function(el, axis) - { - var clientScroll = EYE.getScroll(); - var size = EYE.getSize(el); - if (!axis || axis == 'vertically') - $(el).css( - { - top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px' - } - ); - if (!axis || axis == 'horizontally') - $(el).css( - { - left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px' - } - ); - } -}); -if (!$.easing.easeout) { - $.easing.easeout = function(p, n, firstNum, delta, duration) { - return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum; - }; -} - +/** + * + * Utilities + * Author: Stefan Petre www.eyecon.ro + * + */ +(function($) { +EYE.extend({ + getPosition : function(e, forceIt) + { + var x = 0; + var y = 0; + var es = e.style; + var restoreStyles = false; + if (forceIt && jQuery.curCSS(e,'display') == 'none') { + var oldVisibility = es.visibility; + var oldPosition = es.position; + restoreStyles = true; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + } + var el = e; + if (el.getBoundingClientRect) { // IE + var box = el.getBoundingClientRect(); + x = box.left + Math.max(document.documentElement.scrollLeft, document.body.scrollLeft) - 2; + y = box.top + Math.max(document.documentElement.scrollTop, document.body.scrollTop) - 2; + } else { + x = el.offsetLeft; + y = el.offsetTop; + el = el.offsetParent; + if (e != el) { + while (el) { + x += el.offsetLeft; + y += el.offsetTop; + el = el.offsetParent; + } + } + if (jQuery.browser.safari && jQuery.curCSS(e, 'position') == 'absolute' ) { + x -= document.body.offsetLeft; + y -= document.body.offsetTop; + } + el = e.parentNode; + while (el && el.tagName.toUpperCase() != 'BODY' && el.tagName.toUpperCase() != 'HTML') + { + if (jQuery.curCSS(el, 'display') != 'inline') { + x -= el.scrollLeft; + y -= el.scrollTop; + } + el = el.parentNode; + } + } + if (restoreStyles == true) { + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {x:x, y:y}; + }, + getSize : function(e) + { + var w = parseInt(jQuery.curCSS(e,'width'), 10); + var h = parseInt(jQuery.curCSS(e,'height'), 10); + var wb = 0; + var hb = 0; + if (jQuery.curCSS(e, 'display') != 'none') { + wb = e.offsetWidth; + hb = e.offsetHeight; + } else { + var es = e.style; + var oldVisibility = es.visibility; + var oldPosition = es.position; + es.visibility = 'hidden'; + es.display = 'block'; + es.position = 'absolute'; + wb = e.offsetWidth; + hb = e.offsetHeight; + es.display = 'none'; + es.position = oldPosition; + es.visibility = oldVisibility; + } + return {w:w, h:h, wb:wb, hb:hb}; + }, + getClient : function(e) + { + var h, w; + if (e) { + w = e.clientWidth; + h = e.clientHeight; + } else { + var de = document.documentElement; + w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth; + h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight; + } + return {w:w,h:h}; + }, + getScroll : function (e) + { + var t=0, l=0, w=0, h=0, iw=0, ih=0; + if (e && e.nodeName.toLowerCase() != 'body') { + t = e.scrollTop; + l = e.scrollLeft; + w = e.scrollWidth; + h = e.scrollHeight; + } else { + if (document.documentElement) { + t = document.documentElement.scrollTop; + l = document.documentElement.scrollLeft; + w = document.documentElement.scrollWidth; + h = document.documentElement.scrollHeight; + } else if (document.body) { + t = document.body.scrollTop; + l = document.body.scrollLeft; + w = document.body.scrollWidth; + h = document.body.scrollHeight; + } + if (typeof pageYOffset != 'undefined') { + t = pageYOffset; + l = pageXOffset; + } + iw = self.innerWidth||document.documentElement.clientWidth||document.body.clientWidth||0; + ih = self.innerHeight||document.documentElement.clientHeight||document.body.clientHeight||0; + } + return { t: t, l: l, w: w, h: h, iw: iw, ih: ih }; + }, + getMargins : function(e, toInteger) + { + var t = jQuery.curCSS(e,'marginTop') || ''; + var r = jQuery.curCSS(e,'marginRight') || ''; + var b = jQuery.curCSS(e,'marginBottom') || ''; + var l = jQuery.curCSS(e,'marginLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getPadding : function(e, toInteger) + { + var t = jQuery.curCSS(e,'paddingTop') || ''; + var r = jQuery.curCSS(e,'paddingRight') || ''; + var b = jQuery.curCSS(e,'paddingBottom') || ''; + var l = jQuery.curCSS(e,'paddingLeft') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10) + }; + else + return {t: t, r: r, b: b, l: l}; + }, + getBorder : function(e, toInteger) + { + var t = jQuery.curCSS(e,'borderTopWidth') || ''; + var r = jQuery.curCSS(e,'borderRightWidth') || ''; + var b = jQuery.curCSS(e,'borderBottomWidth') || ''; + var l = jQuery.curCSS(e,'borderLeftWidth') || ''; + if (toInteger) + return { + t: parseInt(t, 10)||0, + r: parseInt(r, 10)||0, + b: parseInt(b, 10)||0, + l: parseInt(l, 10)||0 + }; + else + return {t: t, r: r, b: b, l: l}; + }, + traverseDOM : function(nodeEl, func) + { + func(nodeEl); + nodeEl = nodeEl.firstChild; + while(nodeEl){ + EYE.traverseDOM(nodeEl, func); + nodeEl = nodeEl.nextSibling; + } + }, + getInnerWidth : function(el, scroll) { + var offsetW = el.offsetWidth; + return scroll ? Math.max(el.scrollWidth,offsetW) - offsetW + el.clientWidth:el.clientWidth; + }, + getInnerHeight : function(el, scroll) { + var offsetH = el.offsetHeight; + return scroll ? Math.max(el.scrollHeight,offsetH) - offsetH + el.clientHeight:el.clientHeight; + }, + getExtraWidth : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingLeft'))||0) + + (parseInt($.curCSS(el, 'paddingRight'))||0) + + (parseInt($.curCSS(el, 'borderLeftWidth'))||0) + + (parseInt($.curCSS(el, 'borderRightWidth'))||0); + return 0; + }, + getExtraHeight : function(el) { + if($.boxModel) + return (parseInt($.curCSS(el, 'paddingTop'))||0) + + (parseInt($.curCSS(el, 'paddingBottom'))||0) + + (parseInt($.curCSS(el, 'borderTopWidth'))||0) + + (parseInt($.curCSS(el, 'borderBottomWidth'))||0); + return 0; + }, + isChildOf: function(parentEl, el, container) { + if (parentEl == el) { + return true; + } + if (!el || !el.nodeType || el.nodeType != 1) { + return false; + } + if (parentEl.contains && !$.browser.safari) { + return parentEl.contains(el); + } + if ( parentEl.compareDocumentPosition ) { + return !!(parentEl.compareDocumentPosition(el) & 16); + } + var prEl = el.parentNode; + while(prEl && prEl != container) { + if (prEl == parentEl) + return true; + prEl = prEl.parentNode; + } + return false; + }, + centerEl : function(el, axis) + { + var clientScroll = EYE.getScroll(); + var size = EYE.getSize(el); + if (!axis || axis == 'vertically') + $(el).css( + { + top: clientScroll.t + ((Math.min(clientScroll.h,clientScroll.ih) - size.hb)/2) + 'px' + } + ); + if (!axis || axis == 'horizontally') + $(el).css( + { + left: clientScroll.l + ((Math.min(clientScroll.w,clientScroll.iw) - size.wb)/2) + 'px' + } + ); + } +}); +if (!$.easing.easeout) { + $.easing.easeout = function(p, n, firstNum, delta, duration) { + return -delta * ((n=n/duration-1)*n*n*n - 1) + firstNum; + }; +} + })(jQuery); \ No newline at end of file diff --git a/js2/mwEmbed/libClipEdit/pixastic-editor/editor.js b/js2/mwEmbed/libClipEdit/pixastic-editor/editor.js index 6edba1aadb..6789531dd0 100644 --- a/js2/mwEmbed/libClipEdit/pixastic-editor/editor.js +++ b/js2/mwEmbed/libClipEdit/pixastic-editor/editor.js @@ -1,968 +1,968 @@ - -var PixasticEditor = (function () { - - var $frame; // iframe container element - var $editor; // editor container element - - // various UI structures - var accordionElements = {}; - var tabElements = {}; - var activeTabId; - var $activeTabContent; - - var isRunning = false; - - var $loadingScreen; - - var $imageCanvas; // the canvas holding the current state of the image - var $displayCanvas; // the canvas element displayed on the screen, also the working canvas (where preview operations are performed) - var imageCtx; - - var imageWidth = 0; // dimensions of the current image state - var imageHeight = 0; - - var undoImages = []; // canvas elements holding previous image states - var undoLevels = 10; - - var doc; - - var $; - - // test for valid file formats for toDataURL() - // we do that by calling it with each of the mime types in testFormats - // and then doing string checking on the resulting data: URI to see if it succeeded - var saveFormats = []; - var testFormats = [["image/jpeg", "JPEG"], ["image/png", "PNG"]]; - var testCanvas = document.createElement("canvas"); - if (testCanvas.toDataURL) { - testCanvas.width = testCanvas.height = 1; - for (var i=0;i", doc) - .addClass("error-dialog") - .attr("title", "Oops!") - .html(errTxt) - .dialog(); - // the dialog is added outside the Pixastic container, so get it back in. - var dialogParent = $j(dialog.get(0).parentNode); - dialogParent.appendTo($editor); - - return errTxt; - } - - function enableTab(id, refresh) { - if (id == activeTabId && !refresh) - return; - - activeTabId = id; - - var activeIndex = 0; - - if ($activeTabContent) { - if ($activeTabContent.get(0)) { - var $parent = $j($activeTabContent.get(0).parentNode); - activeIndex = $parent.data("accordionindex"); - if ($parent.data("ondeactivate")) { - $parent.data("ondeactivate")(); - } - if ($parent.data("previewCheckbox")) - $parent.data("previewCheckbox").attr("checked", false); - $parent.data("uidesc").previewEnabled = false; - if ($parent.data("uidesc").forcePreview) - $parent.data("uidesc").previewEnabled = true; - } - } - - - for (var a in accordionElements) { - if (accordionElements.hasOwnProperty(a)) { - accordionElements[a].accordion("option", "animated", false); - accordionElements[a].accordion("activate", -1); - accordionElements[a].hide(); - tabElements[a].removeClass("active"); - - } - } - - accordionElements[id].accordion("option", "animated", false); - accordionElements[id].accordion("activate", refresh ? activeIndex : 0); - tabElements[id].addClass("active"); - accordionElements[id].show(); - accordionElements[id].accordion("option", "animated", "slide"); - resetDisplayCanvas(); - } - - // revert to a previous image state - function undo(idx) { - var undoImage = undoImages[idx]; - - if (!undoImage) - throw new Error(errorDialog("Invalid undo state")); - if (!($imageCanvas && $imageCanvas.get && $imageCanvas.get(0))) - throw new Error(errorDialog("$imageCanvas doesn't exist")); - - var canvas = $imageCanvas.get(0); - addUndo(canvas); - canvas.width = imageWidth = undoImage.width; - canvas.height = imageHeight = undoImage.height; - canvas.getContext("2d").drawImage(undoImage,0,0); - - enableTab(activeTabId, true); - resetDisplayCanvas(); - } - - function addUndo(canvasElement) { - if (!canvasElement) - throw new Error(errorDialog("No undo image state provided")); - - if (undoImages.length == undoLevels) { - undoImages.shift(); - } - var undoCanvas = document.createElement("canvas"); - undoCanvas.width = canvasElement.width; - undoCanvas.height = canvasElement.height; - undoCanvas.getContext("2d").drawImage(canvasElement,0,0); - $j(undoCanvas).addClass("undo-canvas"); - undoImages.push(undoCanvas); - updateUndoList(); - } - - function updateUndoList() { - var $listCtr = $j("#undo-bar", doc) - .html(""); - - var ctrHeight = $listCtr.height(); - - var $testCanvas = $j("", doc) - .addClass("undo-canvas-small") - .addClass("far-far-away") - .appendTo("body"); - - var canvasHeight = $testCanvas.height(); - var canvasWidth = $testCanvas.width(); - var canvasCSSHeight = canvasHeight + parseInt($testCanvas.css("margin-top"),10) + parseInt($testCanvas.css("margin-bottom"),10); - - $testCanvas.remove(); - - var undoRatio = canvasWidth / canvasHeight; - - for (var i=undoImages.length-1;i>=0;i--) { - (function(){ - var canvas = document.createElement("canvas"); - $j(canvas) - .addClass("undo-canvas-small") - .attr("width", canvasWidth) - .attr("height", canvasHeight); - - var image = undoImages[i]; - $j(image).show(); - - var undoWidth, undoHeight; - var imageRatio = image.width / image.height; - - if (imageRatio > undoRatio) { // image too wide - undoWidth = canvasWidth; - undoHeight = canvasWidth / imageRatio; - } else { - undoWidth = canvasHeight * imageRatio; - undoHeight = canvasHeight; - } - - var restWidth = canvasWidth - undoWidth; - var restHeight = canvasHeight - undoHeight; - - canvas.getContext("2d").drawImage( - image, - 0,0,image.width,image.height, - restWidth*0.5, restHeight*0.5, - undoWidth, undoHeight - ); - - - $link = $j("", doc) - .addClass("undo-link") - .appendTo($listCtr) - .mouseover(function(){ $j(this).addClass("hover") }) - .mouseout(function(){ $j(this).removeClass("hover") }); - $j(canvas).appendTo($link); - - var displayShowing; - var undoIndex = i; - $link.click(function() { - $j(image).hide(); - $j(image).remove(); - undo(undoIndex); - if (displayShowing) - $displayCanvas.show(); - $j(".jcrop-holder", doc).show(); - }); - - $link.mouseover(function() { - displayShowing = $displayCanvas.css("display") != "none"; - var $imagectr = $j("#image-container", doc); - - $j(".jcrop-holder", doc).hide(); - $displayCanvas.hide(); - $j(image).appendTo($imagectr); - - var h1 = $j("#image-area", doc).height(); - var h2 = image.height; - var m = Math.max(0, (h1 - h2) / 2); - $imagectr.css("marginTop", m); - - $imagectr.height(image.height); - }); - - $link.mouseout(function() { - $j(image).remove(); - if (displayShowing) - $displayCanvas.show(); - $j(".jcrop-holder", doc).show(); - updateDisplayCanvas(); - }); - - - $j(canvas).attr("title", "Click to revert to this previous image"); - - })(); - } - } - - - function applyAction(id, options, afteraction) { - if (!Pixastic.Actions[id]) - throw new Error("applyAction(): unknown action [" + id + "]"); - - $j("#action-bar-overlay", doc).show(); - - setTimeout(function() { - options.leaveDOM = true; - var canvasElement = $imageCanvas.get(0); - addUndo(canvasElement) - - var res = Pixastic.process( - canvasElement, id, options, - function(resCanvas) { - canvasElement.width = imageWidth = resCanvas.width; - canvasElement.height = imageHeight = resCanvas.height; - - var ctx = canvasElement.getContext("2d"); - ctx.clearRect(0,0,imageWidth,imageHeight); - ctx.drawImage(resCanvas,0,0); - $imageCanvas = $j(canvasElement); - resetDisplayCanvas(); - - $j("#action-bar-overlay", doc).hide(); - - if (afteraction) - afteraction(); - } - ); - if (!res) - throw new Error("applyAction(): Pixastic.process() failed for action [" + id + "]"); - },1); - } - - - function previewAction(id, options, afteraction) { - if (!Pixastic.Actions[id]) - throw new Error("applyAction(): unknown action [" + id + "]"); - - $j("#action-bar-overlay", doc).show(); - - resetDisplayCanvas(); - - options.leaveDOM = true; - var canvasElement = $displayCanvas.get(0); - - var res = Pixastic.process( - canvasElement, id, options, - function(resCanvas) { - - canvasElement.width = resCanvas.width; - canvasElement.height = resCanvas.height; - - var ctx = canvasElement.getContext("2d"); - ctx.clearRect(0,0,canvasElement.width,canvasElement.height); - ctx.drawImage(resCanvas,0,0); - updateDisplayCanvas(); - updateOverlay(); - - $j("#action-bar-overlay", doc).hide(); - - if (afteraction) - afteraction(); - } - ); - } - - var onwindowresize = function() { - updateDisplayCanvas(); - updateOverlay(); - } - - var baseUrl = "" - - function buildEditor() { - var styles = [ - "jquery-ui-1.7.1.custom.css", - "jquery.Jcrop.css", - "pixastic.css" - ]; - - for (var i=0;i", doc) - .attr("id", "pixastic-editor") - .appendTo($j(doc.body)); - - $editor.append( - $j("
", doc), - $j("
", doc).append( - $j("
", doc).append( - $j("
", doc).append( - $j("
", doc).append( - $j("
", doc) - ), - $j("
", doc) - ), - $j("
", doc).append( - $j("
", doc).append( - $j("
", doc), - $j("
", doc).append( - $j("
", doc) - ) - ) - ) - ) - ), - $j("
", doc), - $j("", doc) - ); - - $j("#image-container", doc).append( - $displayCanvas = $j("", doc) - .addClass("display-canvas") - ); - - // loop through all defined UI action controls - var tabs = PixasticEditor.UI.data.tabs; - - for (var i=0;i" + tab.title + "", doc) - .attr("id", "main-tab-button-" + tab.id) - .addClass("main-tab") - .click(function() { - enableTab(tab.id); - }) - .mouseover(function(){ $j(this).addClass("hover") }) - .mouseout(function(){ $j(this).removeClass("hover") }); - - $j("#main-bar", doc).append($tabElement); - - tabElements[tab.id] = $tabElement; - - var $menu = $j("
", doc); - accordionElements[tab.id] = $menu; - - for (var j=0;j

" + action.title + "

", doc) - - $menu.append($actionElement); - - var $content = $j("
", doc) - .attr("id", "pixastic-action-tab-content-" + action.id) - .appendTo($actionElement); - - var controlOptions = []; - - action.previewEnabled = false; - if (action.forcePreview) - action.previewEnabled = true; - - function togglePreview(enable, doAction) { - if (enable && !action.previewEnabled && doAction) - doAction(true); - if (!enable && action.previewEnabled) - resetDisplayCanvas(); - - action.previewEnabled = enable; - } - - var reset = function() { - for (var i in controlOptions) { - if (controlOptions.hasOwnProperty(i)) { - controlOptions[i].reset(); - } - } - if (action.previewEnabled) - doAction(true); - } - var doAction = function(isPreview) { - var options = {}; - for (var i in controlOptions) { - if (controlOptions.hasOwnProperty(i)) { - options[i] = controlOptions[i].valueField.val(); - } - } - - var afteraction = function() { - if (action.onafteraction) - action.onafteraction(action, isPreview); - if (!isPreview) - resetDisplayCanvas(); - - if (!isPreview && !action.forcePreview) { - $j("#pixastic-input-preview-" + action.id, doc).attr("checked", false); - togglePreview(false); - reset(); - } - } - - if (isPreview) { - previewAction(action.id, options, afteraction); - } else { - applyAction(action.id, options, afteraction); - } - - } - - var hadInputs = false; - - if (action.controls) { - var onChange = function() {}; - if (action.isAction && action.preview) { - onChange = function() { - if (action.previewEnabled) - doAction(true) - }; - } - - for (var k=0;k
", doc) - .addClass("ui-action-output") - .html(control.content) - .appendTo($content); - break; - } - } - } - - if (action.isAction) { - - var $applyButton = PixasticEditor.UI.makeButton("Apply") - .addClass("pixastic-option-button-apply") - .click(function() {doAction();}); - - $content.append($applyButton); - - if (hadInputs) { - var $resetButton = PixasticEditor.UI.makeButton("Reset") - .addClass("pixastic-option-button-reset") - .click(reset); - - $content.append($resetButton) - } - - if (action.preview && !action.forcePreview) { - var $checkctr = $j("
", doc) - .addClass("ui-checkbox-container") - .addClass("ui-preview-checkbox-container"); - - var $label = $j("", doc) - .addClass("ui-checkbox-label") - .attr("for", "pixastic-input-preview-" + action.id) - .html("Preview:") - .appendTo($checkctr); - - var $checkbox = $j("", doc) - .addClass("ui-checkbox") - .attr("id", "pixastic-input-preview-" + action.id) - .appendTo($checkctr) - .change(function() { - togglePreview(this.checked, doAction) - }); - - $content.append($checkctr); - - $content.data("previewCheckbox", $checkbox); - } - - } - - - if (typeof action.content == "function") { - action.content($content); - } - - // stupid hack to make it possible to get $content in change event (below) - $j("", doc).appendTo($content); - - $content.data("controlOptions", controlOptions); - $content.data("onactivate", action.onactivate); - $content.data("ondeactivate", action.ondeactivate); - $content.data("onoverlayupdate", action.onoverlayupdate); - $content.data("accordionindex", j); - $content.data("uidesc", action); - - })(); - } - - $j("#action-bar", doc).append($menu); - - $menu.hide().accordion({ - header: "h3", - autoHeight : false, - collapsible : true, - active: -1 - }) - .bind("accordionchange", - function(event, ui) { - resetDisplayCanvas(); - - // oldContent / newContent are arrays of whatever elements are present in the content area - // We need the parent element (the one holding the content) but if there is no content, how do we get it? - // fixed above by always appending a but that's ugly and needs to be done in some other way - if (ui.oldContent.get(0)) { - var $parent = $j(ui.oldContent.get(0).parentNode); - if ($parent.data("ondeactivate")) { - $parent.data("ondeactivate")(); - } - } - $activeTabContent = ui.newContent; - - if (ui.newContent.get(0)) { - var $parent = $j(ui.newContent.get(0).parentNode); - if ($parent.data("previewCheckbox")) - $parent.data("previewCheckbox").attr("checked", false); - $parent.data("uidesc").previewEnabled = false; - if ($parent.data("uidesc").forcePreview) - $parent.data("uidesc").previewEnabled = true; - - var controlOptions = $parent.data("controlOptions"); - for (var i in controlOptions) { - if (controlOptions.hasOwnProperty(i)) { - controlOptions[i].reset(); - } - } - if ($parent.data("onactivate")) { - $parent.data("onactivate")(); - } - } - updateDisplayCanvas(); - - } - ); - - - })(); - } - - $j(window).bind("resize", onwindowresize); - } - - function showLoadingScreen() { - if ($loadingScreen) { - $loadingScreen.show(); - return; - } - $loadingScreen = $j("
") - var $ctr = $j("
"); - $j("
") - .addClass("spinner") - .appendTo($ctr); - $loadingScreen.append($ctr); - $loadingScreen.appendTo("body"); - } - - function hideLoadingScreen() { - setTimeout(function() { - $loadingScreen.hide(); - }, 1); - } - - var oldScrollLeft; - var oldScrollTop; - var oldOverflow; - - // fire it up - function init(callback) { - isRunning = true; - - showLoadingScreen(); - - oldScrollLeft = document.body.scrollLeft; - oldScrollTop = document.body.scrollTop; - oldOverflow = document.body.style.overflow; - - document.body.scrollLeft = 0; - document.body.scrollTop = 0; - document.body.style.overflow = "hidden"; - - $frame = $j("