Property changes on: trunk/extensions/SmoothGallery/jd.gallery.css.patch |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 1 | + native |
Property changes on: trunk/extensions/SmoothGallery/jd.gallery.js.patch |
___________________________________________________________________ |
Added: svn:eol-style |
2 | 2 | + native |
Property changes on: trunk/extensions/Translate/groups/OpenLayers.php |
___________________________________________________________________ |
Added: svn:eol-style |
3 | 3 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_omtkEmbed.js |
___________________________________________________________________ |
Added: svn:eol-style |
4 | 4 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/flowplayer/flowplayer-3.0.0-rc2.min.js |
___________________________________________________________________ |
Added: svn:eol-style |
5 | 5 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/flowplayer/README.txt |
___________________________________________________________________ |
Added: svn:eol-style |
6 | 6 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/flowplayer/flowplayer-3.0.0-rc2.js |
___________________________________________________________________ |
Added: svn:eol-style |
7 | 7 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/flowplayer/LICENSE.txt |
___________________________________________________________________ |
Added: svn:eol-style |
8 | 8 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as |
— | — | @@ -1,29 +1,29 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.ogg {
|
21 | | -
|
22 | | - public class EndOfOggStreamError extends Error {
|
23 | | -
|
24 | | - public function EndOfOggStreamError(message:String = null) {
|
25 | | - super(message);
|
26 | | - }
|
27 | | -
|
28 | | - }
|
29 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.ogg { |
| 21 | + |
| 22 | + public class EndOfOggStreamError extends Error { |
| 23 | + |
| 24 | + public function EndOfOggStreamError(message:String = null) { |
| 25 | + super(message); |
| 26 | + } |
| 27 | + |
| 28 | + } |
| 29 | + |
30 | 30 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/EndOfOggStreamError.as |
___________________________________________________________________ |
Added: svn:eol-style |
31 | 31 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as |
— | — | @@ -1,72 +1,72 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.ogg {
|
21 | | -
|
22 | | - import org.omtk.util.BitByteArray;
|
23 | | - import flash.utils.Endian;
|
24 | | -
|
25 | | - public class LogicalOggStream {
|
26 | | -
|
27 | | - private var source:UncachedUrlStream;
|
28 | | -
|
29 | | - private var pageIndex:int;
|
30 | | - private var currentPage:OggPage;
|
31 | | - private var currentSegmentIndex:int;
|
32 | | -
|
33 | | - public function LogicalOggStream(source:UncachedUrlStream) {
|
34 | | - this.source = source;
|
35 | | - }
|
36 | | -
|
37 | | - public function getNextOggPacket(): OggPacket {
|
38 | | -
|
39 | | - var res:BitByteArray = new BitByteArray();
|
40 | | -
|
41 | | - var segmentLength:int = 0;
|
42 | | -
|
43 | | - if(currentPage == null) {
|
44 | | - currentPage = source.getNextOggPage();
|
45 | | - }
|
46 | | -
|
47 | | - do {
|
48 | | - if(currentSegmentIndex >= currentPage.segmentOffsets.length) {
|
49 | | - currentSegmentIndex=0;
|
50 | | -
|
51 | | - if(currentPage.eos) {
|
52 | | - throw new EndOfOggStreamError("End of OGG stream");
|
53 | | - }
|
54 | | -
|
55 | | - currentPage = source.getNextOggPage();
|
56 | | - }
|
57 | | -
|
58 | | - segmentLength = currentPage.segmentLengths[currentSegmentIndex];
|
59 | | - res.writeBytes(currentPage.data, currentPage.segmentOffsets[currentSegmentIndex], segmentLength);
|
60 | | - currentSegmentIndex++;
|
61 | | - }
|
62 | | - while(segmentLength==255);
|
63 | | -
|
64 | | - res.position = 0;
|
65 | | -
|
66 | | - var lastPacket: Boolean = currentPage.eos && currentSegmentIndex == currentPage.segmentOffsets.length;
|
67 | | - var lastGranulePosition: int = currentPage.absoluteGranulePosition;
|
68 | | -
|
69 | | - return new OggPacket(res, lastPacket, lastGranulePosition);
|
70 | | - }
|
71 | | -
|
72 | | - }
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.ogg { |
| 21 | + |
| 22 | + import org.omtk.util.BitByteArray; |
| 23 | + import flash.utils.Endian; |
| 24 | + |
| 25 | + public class LogicalOggStream { |
| 26 | + |
| 27 | + private var source:UncachedUrlStream; |
| 28 | + |
| 29 | + private var pageIndex:int; |
| 30 | + private var currentPage:OggPage; |
| 31 | + private var currentSegmentIndex:int; |
| 32 | + |
| 33 | + public function LogicalOggStream(source:UncachedUrlStream) { |
| 34 | + this.source = source; |
| 35 | + } |
| 36 | + |
| 37 | + public function getNextOggPacket(): OggPacket { |
| 38 | + |
| 39 | + var res:BitByteArray = new BitByteArray(); |
| 40 | + |
| 41 | + var segmentLength:int = 0; |
| 42 | + |
| 43 | + if(currentPage == null) { |
| 44 | + currentPage = source.getNextOggPage(); |
| 45 | + } |
| 46 | + |
| 47 | + do { |
| 48 | + if(currentSegmentIndex >= currentPage.segmentOffsets.length) { |
| 49 | + currentSegmentIndex=0; |
| 50 | + |
| 51 | + if(currentPage.eos) { |
| 52 | + throw new EndOfOggStreamError("End of OGG stream"); |
| 53 | + } |
| 54 | + |
| 55 | + currentPage = source.getNextOggPage(); |
| 56 | + } |
| 57 | + |
| 58 | + segmentLength = currentPage.segmentLengths[currentSegmentIndex]; |
| 59 | + res.writeBytes(currentPage.data, currentPage.segmentOffsets[currentSegmentIndex], segmentLength); |
| 60 | + currentSegmentIndex++; |
| 61 | + } |
| 62 | + while(segmentLength==255); |
| 63 | + |
| 64 | + res.position = 0; |
| 65 | + |
| 66 | + var lastPacket: Boolean = currentPage.eos && currentSegmentIndex == currentPage.segmentOffsets.length; |
| 67 | + var lastGranulePosition: int = currentPage.absoluteGranulePosition; |
| 68 | + |
| 69 | + return new OggPacket(res, lastPacket, lastGranulePosition); |
| 70 | + } |
| 71 | + |
| 72 | + } |
73 | 73 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/LogicalOggStream.as |
___________________________________________________________________ |
Added: svn:eol-style |
74 | 74 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as |
— | — | @@ -1,49 +1,49 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.ogg {
|
21 | | -
|
22 | | - import org.omtk.util.BitByteArray;
|
23 | | -
|
24 | | - public class OggPacket {
|
25 | | -
|
26 | | - private var _data: BitByteArray;
|
27 | | - private var _lastPacket: Boolean;
|
28 | | - private var _lastGranulePosition: int;
|
29 | | -
|
30 | | - public function OggPacket(data: BitByteArray, lastPacket: Boolean, lastGranulePosition: int) {
|
31 | | - _data = data;
|
32 | | - _lastPacket = lastPacket;
|
33 | | - _lastGranulePosition = lastGranulePosition;
|
34 | | - }
|
35 | | -
|
36 | | - public function get data(): BitByteArray {
|
37 | | - return _data;
|
38 | | - }
|
39 | | -
|
40 | | - public function get lastPacket(): Boolean {
|
41 | | - return _lastPacket;
|
42 | | - }
|
43 | | -
|
44 | | - public function get lastGranulePosition(): int {
|
45 | | - return _lastGranulePosition;
|
46 | | - }
|
47 | | -
|
48 | | - }
|
49 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.ogg { |
| 21 | + |
| 22 | + import org.omtk.util.BitByteArray; |
| 23 | + |
| 24 | + public class OggPacket { |
| 25 | + |
| 26 | + private var _data: BitByteArray; |
| 27 | + private var _lastPacket: Boolean; |
| 28 | + private var _lastGranulePosition: int; |
| 29 | + |
| 30 | + public function OggPacket(data: BitByteArray, lastPacket: Boolean, lastGranulePosition: int) { |
| 31 | + _data = data; |
| 32 | + _lastPacket = lastPacket; |
| 33 | + _lastGranulePosition = lastGranulePosition; |
| 34 | + } |
| 35 | + |
| 36 | + public function get data(): BitByteArray { |
| 37 | + return _data; |
| 38 | + } |
| 39 | + |
| 40 | + public function get lastPacket(): Boolean { |
| 41 | + return _lastPacket; |
| 42 | + } |
| 43 | + |
| 44 | + public function get lastGranulePosition(): int { |
| 45 | + return _lastGranulePosition; |
| 46 | + } |
| 47 | + |
| 48 | + } |
| 49 | + |
50 | 50 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPacket.as |
___________________________________________________________________ |
Added: svn:eol-style |
51 | 51 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as |
— | — | @@ -1,116 +1,116 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.ogg {
|
21 | | -
|
22 | | - import flash.net.*;
|
23 | | - import flash.utils.ByteArray;
|
24 | | -
|
25 | | - public class OggPage {
|
26 | | -
|
27 | | - private var _version:int;
|
28 | | - private var _continued:Boolean;
|
29 | | - private var _bos:Boolean;
|
30 | | - private var _eos:Boolean;
|
31 | | - private var _absoluteGranulePosition:int;
|
32 | | - private var _streamSerialNumber:int;
|
33 | | - private var _pageSequenceNumber:int;
|
34 | | - private var _pageCheckSum:int;
|
35 | | - private var _segmentOffsets:Array;
|
36 | | - private var _segmentLengths:Array;
|
37 | | - private var _totalLength:int;
|
38 | | - private var _data:ByteArray;
|
39 | | -
|
40 | | - public function OggPage(stream:URLStream) {
|
41 | | -
|
42 | | - var capture:int = stream.readInt();
|
43 | | - if(capture != 0x5367674f) {
|
44 | | - throw new Error("Ogg page does not start with 'OggS': "+capture);
|
45 | | - }
|
46 | | -
|
47 | | - _version = stream.readByte()&0xff;
|
48 | | - var tmp:int = stream.readByte();
|
49 | | -
|
50 | | - _continued = (tmp&1)!=0;;
|
51 | | - _bos = (tmp&2)!=0;
|
52 | | - _eos = (tmp&4)!=0;
|
53 | | -
|
54 | | - // absoluteGranulePosition is really 64 bits
|
55 | | - _absoluteGranulePosition = stream.readUnsignedInt();
|
56 | | - stream.readUnsignedInt(); // last 32 bits of _absoluteGranulePosition
|
57 | | -
|
58 | | - _streamSerialNumber = stream.readUnsignedInt();
|
59 | | - _pageSequenceNumber = stream.readUnsignedInt();
|
60 | | - _pageCheckSum = stream.readUnsignedInt();
|
61 | | -
|
62 | | - //trace("_pageSequenceNumber: " + _pageSequenceNumber);
|
63 | | -
|
64 | | - var pageSegments:int = stream.readUnsignedByte();
|
65 | | -
|
66 | | - //stream.waitFor(pageSegments);
|
67 | | -
|
68 | | - _segmentOffsets = [];
|
69 | | - _segmentLengths = [];
|
70 | | - _data = new ByteArray();
|
71 | | -
|
72 | | - var totalLength:int;
|
73 | | -
|
74 | | - var i:int;
|
75 | | - var l:int;
|
76 | | -
|
77 | | - for( i= 0 ; i < pageSegments ; i++ ) {
|
78 | | - l = stream.readUnsignedByte();
|
79 | | - _segmentLengths.push( l );
|
80 | | - _segmentOffsets.push( totalLength );
|
81 | | - totalLength += l;
|
82 | | - }
|
83 | | -
|
84 | | - stream.readBytes(_data, 0, totalLength);
|
85 | | - }
|
86 | | -
|
87 | | - public function get absoluteGranulePosition():int {
|
88 | | - return _absoluteGranulePosition;
|
89 | | - }
|
90 | | -
|
91 | | - public function get segmentOffsets():Array {
|
92 | | - return _segmentOffsets;
|
93 | | - }
|
94 | | -
|
95 | | - public function get segmentLengths():Array {
|
96 | | - return _segmentLengths;
|
97 | | - }
|
98 | | -
|
99 | | - public function get data():ByteArray {
|
100 | | - return _data;
|
101 | | - }
|
102 | | -
|
103 | | - public function get eos():Boolean {
|
104 | | - return _eos;
|
105 | | - }
|
106 | | -
|
107 | | - public function get bos():Boolean {
|
108 | | - return _bos;
|
109 | | - }
|
110 | | -
|
111 | | - public function get continued():Boolean {
|
112 | | - return _continued;
|
113 | | - }
|
114 | | -
|
115 | | - }
|
116 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.ogg { |
| 21 | + |
| 22 | + import flash.net.*; |
| 23 | + import flash.utils.ByteArray; |
| 24 | + |
| 25 | + public class OggPage { |
| 26 | + |
| 27 | + private var _version:int; |
| 28 | + private var _continued:Boolean; |
| 29 | + private var _bos:Boolean; |
| 30 | + private var _eos:Boolean; |
| 31 | + private var _absoluteGranulePosition:int; |
| 32 | + private var _streamSerialNumber:int; |
| 33 | + private var _pageSequenceNumber:int; |
| 34 | + private var _pageCheckSum:int; |
| 35 | + private var _segmentOffsets:Array; |
| 36 | + private var _segmentLengths:Array; |
| 37 | + private var _totalLength:int; |
| 38 | + private var _data:ByteArray; |
| 39 | + |
| 40 | + public function OggPage(stream:URLStream) { |
| 41 | + |
| 42 | + var capture:int = stream.readInt(); |
| 43 | + if(capture != 0x5367674f) { |
| 44 | + throw new Error("Ogg page does not start with 'OggS': "+capture); |
| 45 | + } |
| 46 | + |
| 47 | + _version = stream.readByte()&0xff; |
| 48 | + var tmp:int = stream.readByte(); |
| 49 | + |
| 50 | + _continued = (tmp&1)!=0;; |
| 51 | + _bos = (tmp&2)!=0; |
| 52 | + _eos = (tmp&4)!=0; |
| 53 | + |
| 54 | + // absoluteGranulePosition is really 64 bits |
| 55 | + _absoluteGranulePosition = stream.readUnsignedInt(); |
| 56 | + stream.readUnsignedInt(); // last 32 bits of _absoluteGranulePosition |
| 57 | + |
| 58 | + _streamSerialNumber = stream.readUnsignedInt(); |
| 59 | + _pageSequenceNumber = stream.readUnsignedInt(); |
| 60 | + _pageCheckSum = stream.readUnsignedInt(); |
| 61 | + |
| 62 | + //trace("_pageSequenceNumber: " + _pageSequenceNumber); |
| 63 | + |
| 64 | + var pageSegments:int = stream.readUnsignedByte(); |
| 65 | + |
| 66 | + //stream.waitFor(pageSegments); |
| 67 | + |
| 68 | + _segmentOffsets = []; |
| 69 | + _segmentLengths = []; |
| 70 | + _data = new ByteArray(); |
| 71 | + |
| 72 | + var totalLength:int; |
| 73 | + |
| 74 | + var i:int; |
| 75 | + var l:int; |
| 76 | + |
| 77 | + for( i= 0 ; i < pageSegments ; i++ ) { |
| 78 | + l = stream.readUnsignedByte(); |
| 79 | + _segmentLengths.push( l ); |
| 80 | + _segmentOffsets.push( totalLength ); |
| 81 | + totalLength += l; |
| 82 | + } |
| 83 | + |
| 84 | + stream.readBytes(_data, 0, totalLength); |
| 85 | + } |
| 86 | + |
| 87 | + public function get absoluteGranulePosition():int { |
| 88 | + return _absoluteGranulePosition; |
| 89 | + } |
| 90 | + |
| 91 | + public function get segmentOffsets():Array { |
| 92 | + return _segmentOffsets; |
| 93 | + } |
| 94 | + |
| 95 | + public function get segmentLengths():Array { |
| 96 | + return _segmentLengths; |
| 97 | + } |
| 98 | + |
| 99 | + public function get data():ByteArray { |
| 100 | + return _data; |
| 101 | + } |
| 102 | + |
| 103 | + public function get eos():Boolean { |
| 104 | + return _eos; |
| 105 | + } |
| 106 | + |
| 107 | + public function get bos():Boolean { |
| 108 | + return _bos; |
| 109 | + } |
| 110 | + |
| 111 | + public function get continued():Boolean { |
| 112 | + return _continued; |
| 113 | + } |
| 114 | + |
| 115 | + } |
| 116 | + |
117 | 117 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/OggPage.as |
___________________________________________________________________ |
Added: svn:eol-style |
118 | 118 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as |
— | — | @@ -1,52 +1,52 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.ogg {
|
21 | | -
|
22 | | - import flash.net.*;
|
23 | | - import flash.utils.Endian;
|
24 | | - import flash.events.HTTPStatusEvent;
|
25 | | - import flash.events.ProgressEvent;
|
26 | | -
|
27 | | - public class UncachedUrlStream {
|
28 | | -
|
29 | | - private var source:URLStream;
|
30 | | -
|
31 | | - public function UncachedUrlStream(source: URLStream) {
|
32 | | - this.source = source;
|
33 | | - }
|
34 | | -
|
35 | | - public function get bytesAvailable():int {
|
36 | | - return source.bytesAvailable;
|
37 | | - }
|
38 | | -
|
39 | | - public function addEventListener(type:String, listener:Function):void {
|
40 | | - source.addEventListener(type, listener);
|
41 | | - }
|
42 | | -
|
43 | | - public function getLogicalOggStream():LogicalOggStream {
|
44 | | - return new LogicalOggStream(this);
|
45 | | - }
|
46 | | -
|
47 | | - public function getNextOggPage():OggPage {
|
48 | | - return new OggPage(source);
|
49 | | - }
|
50 | | -
|
51 | | - }
|
52 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.ogg { |
| 21 | + |
| 22 | + import flash.net.*; |
| 23 | + import flash.utils.Endian; |
| 24 | + import flash.events.HTTPStatusEvent; |
| 25 | + import flash.events.ProgressEvent; |
| 26 | + |
| 27 | + public class UncachedUrlStream { |
| 28 | + |
| 29 | + private var source:URLStream; |
| 30 | + |
| 31 | + public function UncachedUrlStream(source: URLStream) { |
| 32 | + this.source = source; |
| 33 | + } |
| 34 | + |
| 35 | + public function get bytesAvailable():int { |
| 36 | + return source.bytesAvailable; |
| 37 | + } |
| 38 | + |
| 39 | + public function addEventListener(type:String, listener:Function):void { |
| 40 | + source.addEventListener(type, listener); |
| 41 | + } |
| 42 | + |
| 43 | + public function getLogicalOggStream():LogicalOggStream { |
| 44 | + return new LogicalOggStream(this); |
| 45 | + } |
| 46 | + |
| 47 | + public function getNextOggPage():OggPage { |
| 48 | + return new OggPage(source); |
| 49 | + } |
| 50 | + |
| 51 | + } |
| 52 | + |
53 | 53 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/ogg/UncachedUrlStream.as |
___________________________________________________________________ |
Added: svn:eol-style |
54 | 54 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as |
— | — | @@ -1,92 +1,92 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -package org.omtk.util {
|
20 | | -
|
21 | | - public class HuffmanNode {
|
22 | | -
|
23 | | - private var _parent:HuffmanNode;
|
24 | | -
|
25 | | - public var _o0:HuffmanNode;
|
26 | | - public var _o1:HuffmanNode;
|
27 | | -
|
28 | | - private var _depth:int;
|
29 | | -
|
30 | | - public var _value:int;
|
31 | | - public var hasValue: Boolean;
|
32 | | - private var _full:Boolean = false;
|
33 | | -
|
34 | | - public function HuffmanNode(parent:HuffmanNode = null, value:int = -1) {
|
35 | | - _parent = parent;
|
36 | | - if(_parent != null) {
|
37 | | - _depth = _parent.depth+1;
|
38 | | - }
|
39 | | - _value = value;
|
40 | | - _full = value >= 0;
|
41 | | - hasValue = value >= 0;
|
42 | | - }
|
43 | | -
|
44 | | - public function setNewValue(depth:int, value:uint):Boolean {
|
45 | | - if (full) {
|
46 | | - return false;
|
47 | | - }
|
48 | | - if (depth == 1) {
|
49 | | - if (_o0 == null) {
|
50 | | - _o0 = new HuffmanNode(this, value);
|
51 | | - return true;
|
52 | | - } else if (_o1 == null) {
|
53 | | - _o1 = new HuffmanNode(this, value);
|
54 | | - return true;
|
55 | | - } else {
|
56 | | - return false;
|
57 | | - }
|
58 | | - } else {
|
59 | | - return o0.setNewValue(depth - 1, value)
|
60 | | - ? true : o1.setNewValue(depth - 1, value);
|
61 | | - }
|
62 | | - }
|
63 | | -
|
64 | | - public function get value():uint {
|
65 | | - return _value;
|
66 | | - }
|
67 | | -
|
68 | | - public function get o0():HuffmanNode {
|
69 | | - if(_o0 == null) {
|
70 | | - _o0 = new HuffmanNode(this);
|
71 | | - }
|
72 | | - return _o0;
|
73 | | - }
|
74 | | -
|
75 | | - public function get o1():HuffmanNode {
|
76 | | - if(_o1 == null) {
|
77 | | - _o1 = new HuffmanNode(this);
|
78 | | - }
|
79 | | - return _o1;
|
80 | | - }
|
81 | | -
|
82 | | - public function get depth():int {
|
83 | | - return _depth;
|
84 | | - }
|
85 | | -
|
86 | | - public function get full():Boolean {
|
87 | | - return _full ? true
|
88 | | - : (_full = (_o0 != null && _o0.full && _o1 != null && _o1.full));
|
89 | | - }
|
90 | | -
|
91 | | - }
|
92 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | +package org.omtk.util { |
| 20 | + |
| 21 | + public class HuffmanNode { |
| 22 | + |
| 23 | + private var _parent:HuffmanNode; |
| 24 | + |
| 25 | + public var _o0:HuffmanNode; |
| 26 | + public var _o1:HuffmanNode; |
| 27 | + |
| 28 | + private var _depth:int; |
| 29 | + |
| 30 | + public var _value:int; |
| 31 | + public var hasValue: Boolean; |
| 32 | + private var _full:Boolean = false; |
| 33 | + |
| 34 | + public function HuffmanNode(parent:HuffmanNode = null, value:int = -1) { |
| 35 | + _parent = parent; |
| 36 | + if(_parent != null) { |
| 37 | + _depth = _parent.depth+1; |
| 38 | + } |
| 39 | + _value = value; |
| 40 | + _full = value >= 0; |
| 41 | + hasValue = value >= 0; |
| 42 | + } |
| 43 | + |
| 44 | + public function setNewValue(depth:int, value:uint):Boolean { |
| 45 | + if (full) { |
| 46 | + return false; |
| 47 | + } |
| 48 | + if (depth == 1) { |
| 49 | + if (_o0 == null) { |
| 50 | + _o0 = new HuffmanNode(this, value); |
| 51 | + return true; |
| 52 | + } else if (_o1 == null) { |
| 53 | + _o1 = new HuffmanNode(this, value); |
| 54 | + return true; |
| 55 | + } else { |
| 56 | + return false; |
| 57 | + } |
| 58 | + } else { |
| 59 | + return o0.setNewValue(depth - 1, value) |
| 60 | + ? true : o1.setNewValue(depth - 1, value); |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + public function get value():uint { |
| 65 | + return _value; |
| 66 | + } |
| 67 | + |
| 68 | + public function get o0():HuffmanNode { |
| 69 | + if(_o0 == null) { |
| 70 | + _o0 = new HuffmanNode(this); |
| 71 | + } |
| 72 | + return _o0; |
| 73 | + } |
| 74 | + |
| 75 | + public function get o1():HuffmanNode { |
| 76 | + if(_o1 == null) { |
| 77 | + _o1 = new HuffmanNode(this); |
| 78 | + } |
| 79 | + return _o1; |
| 80 | + } |
| 81 | + |
| 82 | + public function get depth():int { |
| 83 | + return _depth; |
| 84 | + } |
| 85 | + |
| 86 | + public function get full():Boolean { |
| 87 | + return _full ? true |
| 88 | + : (_full = (_o0 != null && _o0.full && _o1 != null && _o1.full)); |
| 89 | + } |
| 90 | + |
| 91 | + } |
| 92 | + |
93 | 93 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/util/HuffmanNode.as |
___________________________________________________________________ |
Added: svn:eol-style |
94 | 94 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as |
— | — | @@ -1,75 +1,75 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.util {
|
21 | | -
|
22 | | - import flash.utils.ByteArray;
|
23 | | - import flash.utils.Endian;
|
24 | | - import flash.errors.IllegalOperationError;
|
25 | | -
|
26 | | - public class BitByteArray extends ByteArray {
|
27 | | -
|
28 | | - private var currentByte:uint;
|
29 | | - private var bitIndex:int = 8;
|
30 | | -
|
31 | | - public function BitByteArray() {
|
32 | | - this.endian = Endian.LITTLE_ENDIAN;
|
33 | | - }
|
34 | | -
|
35 | | - public function readBit():Boolean {
|
36 | | - if (bitIndex > 7) {
|
37 | | - bitIndex = 0;
|
38 | | - currentByte = readUnsignedByte();
|
39 | | - }
|
40 | | - return (currentByte & (1 << (bitIndex++))) != 0;
|
41 | | - }
|
42 | | -
|
43 | | - public function readUnsignedBitwiseInt(bits:int):uint {
|
44 | | -
|
45 | | - var res:uint = 0;
|
46 | | -
|
47 | | - for (var i : int = 0; i < bits; i++) {
|
48 | | - if (bitIndex > 7) {
|
49 | | - bitIndex = 0;
|
50 | | - currentByte = readUnsignedByte();
|
51 | | - }
|
52 | | - if((currentByte & (1 << (bitIndex++))) != 0) {
|
53 | | - res |= (1 << i);
|
54 | | - }
|
55 | | - }
|
56 | | -
|
57 | | - return res;
|
58 | | - }
|
59 | | -
|
60 | | - public function readUnsignedHuffmanInt(root:HuffmanNode):uint {
|
61 | | -
|
62 | | - while (!root.hasValue) {
|
63 | | - if (bitIndex > 7) {
|
64 | | - bitIndex = 0;
|
65 | | - currentByte = readUnsignedByte();
|
66 | | - }
|
67 | | - root = (currentByte & (1 << (bitIndex++))) != 0 ? root._o1 : root._o0;
|
68 | | - }
|
69 | | -
|
70 | | - return root._value;
|
71 | | - }
|
72 | | -
|
73 | | - }
|
74 | | -
|
75 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.util { |
| 21 | + |
| 22 | + import flash.utils.ByteArray; |
| 23 | + import flash.utils.Endian; |
| 24 | + import flash.errors.IllegalOperationError; |
| 25 | + |
| 26 | + public class BitByteArray extends ByteArray { |
| 27 | + |
| 28 | + private var currentByte:uint; |
| 29 | + private var bitIndex:int = 8; |
| 30 | + |
| 31 | + public function BitByteArray() { |
| 32 | + this.endian = Endian.LITTLE_ENDIAN; |
| 33 | + } |
| 34 | + |
| 35 | + public function readBit():Boolean { |
| 36 | + if (bitIndex > 7) { |
| 37 | + bitIndex = 0; |
| 38 | + currentByte = readUnsignedByte(); |
| 39 | + } |
| 40 | + return (currentByte & (1 << (bitIndex++))) != 0; |
| 41 | + } |
| 42 | + |
| 43 | + public function readUnsignedBitwiseInt(bits:int):uint { |
| 44 | + |
| 45 | + var res:uint = 0; |
| 46 | + |
| 47 | + for (var i : int = 0; i < bits; i++) { |
| 48 | + if (bitIndex > 7) { |
| 49 | + bitIndex = 0; |
| 50 | + currentByte = readUnsignedByte(); |
| 51 | + } |
| 52 | + if((currentByte & (1 << (bitIndex++))) != 0) { |
| 53 | + res |= (1 << i); |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + return res; |
| 58 | + } |
| 59 | + |
| 60 | + public function readUnsignedHuffmanInt(root:HuffmanNode):uint { |
| 61 | + |
| 62 | + while (!root.hasValue) { |
| 63 | + if (bitIndex > 7) { |
| 64 | + bitIndex = 0; |
| 65 | + currentByte = readUnsignedByte(); |
| 66 | + } |
| 67 | + root = (currentByte & (1 << (bitIndex++))) != 0 ? root._o1 : root._o0; |
| 68 | + } |
| 69 | + |
| 70 | + return root._value; |
| 71 | + } |
| 72 | + |
| 73 | + } |
| 74 | + |
| 75 | + |
76 | 76 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/util/BitByteArray.as |
___________________________________________________________________ |
Added: svn:eol-style |
77 | 77 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as |
— | — | @@ -1,130 +1,130 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.events.SampleDataEvent;
|
23 | | - import flash.utils.ByteArray;
|
24 | | - import flash.utils.Endian;
|
25 | | - import org.omtk.util.*;
|
26 | | - import org.omtk.ogg.*;
|
27 | | -
|
28 | | - public class VorbisStream {
|
29 | | -
|
30 | | - private const IDENTIFICATION_HEADER:int = 1;
|
31 | | - private const COMMENT_HEADER:int = 3;
|
32 | | - private const SETUP_HEADER:int = 5;
|
33 | | -
|
34 | | - private var source:LogicalOggStream;
|
35 | | -
|
36 | | - private var _identificationHeader:IdentificationHeader;
|
37 | | - private var _commentHeader:CommentHeader;
|
38 | | - private var _setupHeader:SetupHeader;
|
39 | | -
|
40 | | - private var _lastAudioPacket:AudioPacket;
|
41 | | -
|
42 | | - private var _currentGranulePosition:int=0;
|
43 | | - private var packetCounter:int;
|
44 | | -
|
45 | | - private var _finished: Boolean = false;
|
46 | | -
|
47 | | - public var windows:Vector.<Vector.<Number>> = new Vector.<Vector.<Number>>(8);
|
48 | | -
|
49 | | - public function VorbisStream(source:LogicalOggStream) {
|
50 | | -
|
51 | | - this.source = source;
|
52 | | -
|
53 | | - for (var i:int = 0; i < 3; i++) {
|
54 | | -
|
55 | | - var data:BitByteArray = source.getNextOggPacket().data;
|
56 | | - var headerType:int = data.readUnsignedByte();
|
57 | | -
|
58 | | - switch(headerType) {
|
59 | | - case IDENTIFICATION_HEADER:
|
60 | | - _identificationHeader = new IdentificationHeader(data);
|
61 | | - break;
|
62 | | - case COMMENT_HEADER:
|
63 | | - _commentHeader = new CommentHeader(data);
|
64 | | - break;
|
65 | | - case SETUP_HEADER:
|
66 | | - _setupHeader = new SetupHeader(this, data);
|
67 | | - break;
|
68 | | - }
|
69 | | - }
|
70 | | -
|
71 | | - }
|
72 | | -
|
73 | | - public function get identificationHeader():IdentificationHeader {
|
74 | | - return _identificationHeader;
|
75 | | - }
|
76 | | -
|
77 | | - public function get commentHeader():CommentHeader {
|
78 | | - return _commentHeader;
|
79 | | - }
|
80 | | -
|
81 | | - public function get setupHeader():SetupHeader {
|
82 | | - return _setupHeader;
|
83 | | - }
|
84 | | -
|
85 | | - public function readPcm(data:ByteArray): int {
|
86 | | -
|
87 | | - var total:int;
|
88 | | - var i:int;
|
89 | | -
|
90 | | - if(_lastAudioPacket == null) {
|
91 | | - _lastAudioPacket = getNextAudioPacket();
|
92 | | - }
|
93 | | -
|
94 | | - total = 0;
|
95 | | -
|
96 | | - while(total < 2048 && !_finished) {
|
97 | | - try {
|
98 | | - var ap:AudioPacket = getNextAudioPacket();
|
99 | | - total += ap.readPcm(_lastAudioPacket, data);
|
100 | | - _lastAudioPacket = ap;
|
101 | | - }
|
102 | | - catch(e: EndOfOggStreamError) {
|
103 | | - // ok, stream finished
|
104 | | - _finished = true;
|
105 | | - }
|
106 | | - }
|
107 | | -
|
108 | | - return total;
|
109 | | - }
|
110 | | -
|
111 | | - private function getNextAudioPacket():AudioPacket {
|
112 | | - packetCounter++;
|
113 | | - var packet:OggPacket = source.getNextOggPacket();
|
114 | | - var res:AudioPacket = new AudioPacket(this, packet, _currentGranulePosition);
|
115 | | - if(_lastAudioPacket != null) {
|
116 | | - // don't count the first packet, since it doesn't contain any "real" samples
|
117 | | - _currentGranulePosition += res.numberOfSamples;
|
118 | | - }
|
119 | | - return res;
|
120 | | - }
|
121 | | -
|
122 | | - public function get finished() : Boolean {
|
123 | | - return _finished;
|
124 | | - }
|
125 | | -
|
126 | | - public function get currentGranulePosition(): int {
|
127 | | - return _currentGranulePosition;
|
128 | | - }
|
129 | | - }
|
130 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.events.SampleDataEvent; |
| 23 | + import flash.utils.ByteArray; |
| 24 | + import flash.utils.Endian; |
| 25 | + import org.omtk.util.*; |
| 26 | + import org.omtk.ogg.*; |
| 27 | + |
| 28 | + public class VorbisStream { |
| 29 | + |
| 30 | + private const IDENTIFICATION_HEADER:int = 1; |
| 31 | + private const COMMENT_HEADER:int = 3; |
| 32 | + private const SETUP_HEADER:int = 5; |
| 33 | + |
| 34 | + private var source:LogicalOggStream; |
| 35 | + |
| 36 | + private var _identificationHeader:IdentificationHeader; |
| 37 | + private var _commentHeader:CommentHeader; |
| 38 | + private var _setupHeader:SetupHeader; |
| 39 | + |
| 40 | + private var _lastAudioPacket:AudioPacket; |
| 41 | + |
| 42 | + private var _currentGranulePosition:int=0; |
| 43 | + private var packetCounter:int; |
| 44 | + |
| 45 | + private var _finished: Boolean = false; |
| 46 | + |
| 47 | + public var windows:Vector.<Vector.<Number>> = new Vector.<Vector.<Number>>(8); |
| 48 | + |
| 49 | + public function VorbisStream(source:LogicalOggStream) { |
| 50 | + |
| 51 | + this.source = source; |
| 52 | + |
| 53 | + for (var i:int = 0; i < 3; i++) { |
| 54 | + |
| 55 | + var data:BitByteArray = source.getNextOggPacket().data; |
| 56 | + var headerType:int = data.readUnsignedByte(); |
| 57 | + |
| 58 | + switch(headerType) { |
| 59 | + case IDENTIFICATION_HEADER: |
| 60 | + _identificationHeader = new IdentificationHeader(data); |
| 61 | + break; |
| 62 | + case COMMENT_HEADER: |
| 63 | + _commentHeader = new CommentHeader(data); |
| 64 | + break; |
| 65 | + case SETUP_HEADER: |
| 66 | + _setupHeader = new SetupHeader(this, data); |
| 67 | + break; |
| 68 | + } |
| 69 | + } |
| 70 | + |
| 71 | + } |
| 72 | + |
| 73 | + public function get identificationHeader():IdentificationHeader { |
| 74 | + return _identificationHeader; |
| 75 | + } |
| 76 | + |
| 77 | + public function get commentHeader():CommentHeader { |
| 78 | + return _commentHeader; |
| 79 | + } |
| 80 | + |
| 81 | + public function get setupHeader():SetupHeader { |
| 82 | + return _setupHeader; |
| 83 | + } |
| 84 | + |
| 85 | + public function readPcm(data:ByteArray): int { |
| 86 | + |
| 87 | + var total:int; |
| 88 | + var i:int; |
| 89 | + |
| 90 | + if(_lastAudioPacket == null) { |
| 91 | + _lastAudioPacket = getNextAudioPacket(); |
| 92 | + } |
| 93 | + |
| 94 | + total = 0; |
| 95 | + |
| 96 | + while(total < 2048 && !_finished) { |
| 97 | + try { |
| 98 | + var ap:AudioPacket = getNextAudioPacket(); |
| 99 | + total += ap.readPcm(_lastAudioPacket, data); |
| 100 | + _lastAudioPacket = ap; |
| 101 | + } |
| 102 | + catch(e: EndOfOggStreamError) { |
| 103 | + // ok, stream finished |
| 104 | + _finished = true; |
| 105 | + } |
| 106 | + } |
| 107 | + |
| 108 | + return total; |
| 109 | + } |
| 110 | + |
| 111 | + private function getNextAudioPacket():AudioPacket { |
| 112 | + packetCounter++; |
| 113 | + var packet:OggPacket = source.getNextOggPacket(); |
| 114 | + var res:AudioPacket = new AudioPacket(this, packet, _currentGranulePosition); |
| 115 | + if(_lastAudioPacket != null) { |
| 116 | + // don't count the first packet, since it doesn't contain any "real" samples |
| 117 | + _currentGranulePosition += res.numberOfSamples; |
| 118 | + } |
| 119 | + return res; |
| 120 | + } |
| 121 | + |
| 122 | + public function get finished() : Boolean { |
| 123 | + return _finished; |
| 124 | + } |
| 125 | + |
| 126 | + public function get currentGranulePosition(): int { |
| 127 | + return _currentGranulePosition; |
| 128 | + } |
| 129 | + } |
| 130 | + |
131 | 131 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisStream.as |
___________________________________________________________________ |
Added: svn:eol-style |
132 | 132 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as |
— | — | @@ -1,122 +1,122 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.BitByteArray;
|
24 | | -
|
25 | | - public class Floor {
|
26 | | -
|
27 | | - public static const DB_STATIC_TABLE:Vector.<Number> = Vector.<Number>([
|
28 | | - 1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07,
|
29 | | - 1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07,
|
30 | | - 1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.128753e-07,
|
31 | | - 2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07,
|
32 | | - 2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07,
|
33 | | - 3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07,
|
34 | | - 4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07,
|
35 | | - 6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07,
|
36 | | - 7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07,
|
37 | | - 1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06,
|
38 | | - 1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06,
|
39 | | - 1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06,
|
40 | | - 2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06,
|
41 | | - 2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06,
|
42 | | - 3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06,
|
43 | | - 4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06,
|
44 | | - 5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06,
|
45 | | - 7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06,
|
46 | | - 9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05,
|
47 | | - 1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05,
|
48 | | - 1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05,
|
49 | | - 2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05,
|
50 | | - 2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05,
|
51 | | - 3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05,
|
52 | | - 4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05,
|
53 | | - 5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05,
|
54 | | - 7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05,
|
55 | | - 9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824,
|
56 | | - 0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085,
|
57 | | - 0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536,
|
58 | | - 0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449,
|
59 | | - 0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787,
|
60 | | - 0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456,
|
61 | | - 0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927,
|
62 | | - 0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058,
|
63 | | - 0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457,
|
64 | | - 0.00092223983, 0.00098217216, 0.0010459992, 0.0011139742,
|
65 | | - 0.0011863665, 0.0012634633, 0.0013455702, 0.0014330129,
|
66 | | - 0.0015261382, 0.0016253153, 0.0017309374, 0.0018434235,
|
67 | | - 0.0019632195, 0.0020908006, 0.0022266726, 0.0023713743,
|
68 | | - 0.0025254795, 0.0026895994, 0.0028643847, 0.0030505286,
|
69 | | - 0.0032487691, 0.0034598925, 0.0036847358, 0.0039241906,
|
70 | | - 0.0041792066, 0.0044507950, 0.0047400328, 0.0050480668,
|
71 | | - 0.0053761186, 0.0057254891, 0.0060975636, 0.0064938176,
|
72 | | - 0.0069158225, 0.0073652516, 0.0078438871, 0.0083536271,
|
73 | | - 0.0088964928, 0.009474637, 0.010090352, 0.010746080,
|
74 | | - 0.011444421, 0.012188144, 0.012980198, 0.013823725,
|
75 | | - 0.014722068, 0.015678791, 0.016697687, 0.017782797,
|
76 | | - 0.018938423, 0.020169149, 0.021479854, 0.022875735,
|
77 | | - 0.024362330, 0.025945531, 0.027631618, 0.029427276,
|
78 | | - 0.031339626, 0.033376252, 0.035545228, 0.037855157,
|
79 | | - 0.040315199, 0.042935108, 0.045725273, 0.048696758,
|
80 | | - 0.051861348, 0.055231591, 0.058820850, 0.062643361,
|
81 | | - 0.066714279, 0.071049749, 0.075666962, 0.080584227,
|
82 | | - 0.085821044, 0.091398179, 0.097337747, 0.10366330,
|
83 | | - 0.11039993, 0.11757434, 0.12521498, 0.13335215,
|
84 | | - 0.14201813, 0.15124727, 0.16107617, 0.17154380,
|
85 | | - 0.18269168, 0.19456402, 0.20720788, 0.22067342,
|
86 | | - 0.23501402, 0.25028656, 0.26655159, 0.28387361,
|
87 | | - 0.30232132, 0.32196786, 0.34289114, 0.36517414,
|
88 | | - 0.38890521, 0.41417847, 0.44109412, 0.46975890,
|
89 | | - 0.50028648, 0.53279791, 0.56742212, 0.60429640,
|
90 | | - 0.64356699, 0.68538959, 0.72993007, 0.77736504,
|
91 | | - 0.82788260, 0.88168307, 0.9389798, 1.0]);
|
92 | | -
|
93 | | - public static function createInstance(source:BitByteArray, header:SetupHeader):Floor {
|
94 | | -
|
95 | | - var type:int = source.readUnsignedBitwiseInt(16);
|
96 | | -
|
97 | | - switch (type) {
|
98 | | - case 0:
|
99 | | - return new Floor0(source, header);
|
100 | | - case 1:
|
101 | | - return new Floor1(source, header);
|
102 | | - default:
|
103 | | - throw new Error("Floor type " + type + " is not supported.");
|
104 | | - }
|
105 | | - }
|
106 | | -
|
107 | | - public function get type():int {
|
108 | | - throw new IllegalOperationError("operation not implemented");
|
109 | | - }
|
110 | | -
|
111 | | - public function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 {
|
112 | | - throw new IllegalOperationError("operation not implemented");
|
113 | | - }
|
114 | | -
|
115 | | - public function computeFloor(vector:Vector.<Number>):void {
|
116 | | - throw new IllegalOperationError("operation not implemented");
|
117 | | - }
|
118 | | -
|
119 | | -
|
120 | | - }
|
121 | | -
|
122 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.BitByteArray; |
| 24 | + |
| 25 | + public class Floor { |
| 26 | + |
| 27 | + public static const DB_STATIC_TABLE:Vector.<Number> = Vector.<Number>([ |
| 28 | + 1.0649863e-07, 1.1341951e-07, 1.2079015e-07, 1.2863978e-07, |
| 29 | + 1.3699951e-07, 1.4590251e-07, 1.5538408e-07, 1.6548181e-07, |
| 30 | + 1.7623575e-07, 1.8768855e-07, 1.9988561e-07, 2.128753e-07, |
| 31 | + 2.2670913e-07, 2.4144197e-07, 2.5713223e-07, 2.7384213e-07, |
| 32 | + 2.9163793e-07, 3.1059021e-07, 3.3077411e-07, 3.5226968e-07, |
| 33 | + 3.7516214e-07, 3.9954229e-07, 4.2550680e-07, 4.5315863e-07, |
| 34 | + 4.8260743e-07, 5.1396998e-07, 5.4737065e-07, 5.8294187e-07, |
| 35 | + 6.2082472e-07, 6.6116941e-07, 7.0413592e-07, 7.4989464e-07, |
| 36 | + 7.9862701e-07, 8.5052630e-07, 9.0579828e-07, 9.6466216e-07, |
| 37 | + 1.0273513e-06, 1.0941144e-06, 1.1652161e-06, 1.2409384e-06, |
| 38 | + 1.3215816e-06, 1.4074654e-06, 1.4989305e-06, 1.5963394e-06, |
| 39 | + 1.7000785e-06, 1.8105592e-06, 1.9282195e-06, 2.0535261e-06, |
| 40 | + 2.1869758e-06, 2.3290978e-06, 2.4804557e-06, 2.6416497e-06, |
| 41 | + 2.8133190e-06, 2.9961443e-06, 3.1908506e-06, 3.3982101e-06, |
| 42 | + 3.6190449e-06, 3.8542308e-06, 4.1047004e-06, 4.3714470e-06, |
| 43 | + 4.6555282e-06, 4.9580707e-06, 5.2802740e-06, 5.6234160e-06, |
| 44 | + 5.9888572e-06, 6.3780469e-06, 6.7925283e-06, 7.2339451e-06, |
| 45 | + 7.7040476e-06, 8.2047000e-06, 8.7378876e-06, 9.3057248e-06, |
| 46 | + 9.9104632e-06, 1.0554501e-05, 1.1240392e-05, 1.1970856e-05, |
| 47 | + 1.2748789e-05, 1.3577278e-05, 1.4459606e-05, 1.5399272e-05, |
| 48 | + 1.6400004e-05, 1.7465768e-05, 1.8600792e-05, 1.9809576e-05, |
| 49 | + 2.1096914e-05, 2.2467911e-05, 2.3928002e-05, 2.5482978e-05, |
| 50 | + 2.7139006e-05, 2.8902651e-05, 3.0780908e-05, 3.2781225e-05, |
| 51 | + 3.4911534e-05, 3.7180282e-05, 3.9596466e-05, 4.2169667e-05, |
| 52 | + 4.4910090e-05, 4.7828601e-05, 5.0936773e-05, 5.4246931e-05, |
| 53 | + 5.7772202e-05, 6.1526565e-05, 6.5524908e-05, 6.9783085e-05, |
| 54 | + 7.4317983e-05, 7.9147585e-05, 8.4291040e-05, 8.9768747e-05, |
| 55 | + 9.5602426e-05, 0.00010181521, 0.00010843174, 0.00011547824, |
| 56 | + 0.00012298267, 0.00013097477, 0.00013948625, 0.00014855085, |
| 57 | + 0.00015820453, 0.00016848555, 0.00017943469, 0.00019109536, |
| 58 | + 0.00020351382, 0.00021673929, 0.00023082423, 0.00024582449, |
| 59 | + 0.00026179955, 0.00027881276, 0.00029693158, 0.00031622787, |
| 60 | + 0.00033677814, 0.00035866388, 0.00038197188, 0.00040679456, |
| 61 | + 0.00043323036, 0.00046138411, 0.00049136745, 0.00052329927, |
| 62 | + 0.00055730621, 0.00059352311, 0.00063209358, 0.00067317058, |
| 63 | + 0.00071691700, 0.00076350630, 0.00081312324, 0.00086596457, |
| 64 | + 0.00092223983, 0.00098217216, 0.0010459992, 0.0011139742, |
| 65 | + 0.0011863665, 0.0012634633, 0.0013455702, 0.0014330129, |
| 66 | + 0.0015261382, 0.0016253153, 0.0017309374, 0.0018434235, |
| 67 | + 0.0019632195, 0.0020908006, 0.0022266726, 0.0023713743, |
| 68 | + 0.0025254795, 0.0026895994, 0.0028643847, 0.0030505286, |
| 69 | + 0.0032487691, 0.0034598925, 0.0036847358, 0.0039241906, |
| 70 | + 0.0041792066, 0.0044507950, 0.0047400328, 0.0050480668, |
| 71 | + 0.0053761186, 0.0057254891, 0.0060975636, 0.0064938176, |
| 72 | + 0.0069158225, 0.0073652516, 0.0078438871, 0.0083536271, |
| 73 | + 0.0088964928, 0.009474637, 0.010090352, 0.010746080, |
| 74 | + 0.011444421, 0.012188144, 0.012980198, 0.013823725, |
| 75 | + 0.014722068, 0.015678791, 0.016697687, 0.017782797, |
| 76 | + 0.018938423, 0.020169149, 0.021479854, 0.022875735, |
| 77 | + 0.024362330, 0.025945531, 0.027631618, 0.029427276, |
| 78 | + 0.031339626, 0.033376252, 0.035545228, 0.037855157, |
| 79 | + 0.040315199, 0.042935108, 0.045725273, 0.048696758, |
| 80 | + 0.051861348, 0.055231591, 0.058820850, 0.062643361, |
| 81 | + 0.066714279, 0.071049749, 0.075666962, 0.080584227, |
| 82 | + 0.085821044, 0.091398179, 0.097337747, 0.10366330, |
| 83 | + 0.11039993, 0.11757434, 0.12521498, 0.13335215, |
| 84 | + 0.14201813, 0.15124727, 0.16107617, 0.17154380, |
| 85 | + 0.18269168, 0.19456402, 0.20720788, 0.22067342, |
| 86 | + 0.23501402, 0.25028656, 0.26655159, 0.28387361, |
| 87 | + 0.30232132, 0.32196786, 0.34289114, 0.36517414, |
| 88 | + 0.38890521, 0.41417847, 0.44109412, 0.46975890, |
| 89 | + 0.50028648, 0.53279791, 0.56742212, 0.60429640, |
| 90 | + 0.64356699, 0.68538959, 0.72993007, 0.77736504, |
| 91 | + 0.82788260, 0.88168307, 0.9389798, 1.0]); |
| 92 | + |
| 93 | + public static function createInstance(source:BitByteArray, header:SetupHeader):Floor { |
| 94 | + |
| 95 | + var type:int = source.readUnsignedBitwiseInt(16); |
| 96 | + |
| 97 | + switch (type) { |
| 98 | + case 0: |
| 99 | + return new Floor0(source, header); |
| 100 | + case 1: |
| 101 | + return new Floor1(source, header); |
| 102 | + default: |
| 103 | + throw new Error("Floor type " + type + " is not supported."); |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + public function get type():int { |
| 108 | + throw new IllegalOperationError("operation not implemented"); |
| 109 | + } |
| 110 | + |
| 111 | + public function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { |
| 112 | + throw new IllegalOperationError("operation not implemented"); |
| 113 | + } |
| 114 | + |
| 115 | + public function computeFloor(vector:Vector.<Number>):void { |
| 116 | + throw new IllegalOperationError("operation not implemented"); |
| 117 | + } |
| 118 | + |
| 119 | + |
| 120 | + } |
| 121 | + |
| 122 | + |
123 | 123 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor.as |
___________________________________________________________________ |
Added: svn:eol-style |
124 | 124 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as |
— | — | @@ -1,109 +1,109 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import flash.utils.Dictionary;
|
24 | | - import org.omtk.util.BitByteArray;
|
25 | | -
|
26 | | - public class Residue2 extends Residue {
|
27 | | -
|
28 | | - public function Residue2(source:BitByteArray, header:SetupHeader) {
|
29 | | - super(source, header);
|
30 | | - }
|
31 | | -
|
32 | | - public override function decodeResidue(
|
33 | | - vorbis:VorbisStream, source:BitByteArray,
|
34 | | - mode:Mode, ch:int,
|
35 | | - doNotDecodeFlags:Vector.<Boolean>, vectors0:Vector.<Number>, vectors1:Vector.<Number>):void {
|
36 | | -
|
37 | | - var i:int;
|
38 | | - var j:int;
|
39 | | - var k:int;
|
40 | | - var l:int;
|
41 | | - var s:int;
|
42 | | - var slim:int;
|
43 | | -
|
44 | | - var look:Look = getLook(vorbis, mode);
|
45 | | -
|
46 | | - var codeBook:CodeBook = vorbis.setupHeader.codeBooks[classBook];
|
47 | | -
|
48 | | - var classvalsPerCodeword:int = codeBook.dimensions;
|
49 | | - var nToRead:int = end - begin;
|
50 | | - var partitionsToRead:int = nToRead / partitionSize; // partvals
|
51 | | -
|
52 | | - var samplesPerPartition:int = partitionSize;
|
53 | | - var partitionsPerWord:int = look.phrasebook.dimensions;
|
54 | | -
|
55 | | - var partWords:int = (partitionsToRead + partitionsPerWord - 1) / partitionsPerWord;
|
56 | | -
|
57 | | - var offset:int;
|
58 | | -
|
59 | | - var left:Boolean = false;
|
60 | | - var right:Boolean = false;
|
61 | | -
|
62 | | - for (i = 0; i < doNotDecodeFlags.length; i++) {
|
63 | | - if (!doNotDecodeFlags[i]) {
|
64 | | - if(i==0) {
|
65 | | - left = true;
|
66 | | - }
|
67 | | - else if (i==1) {
|
68 | | - right = true;
|
69 | | - }
|
70 | | - }
|
71 | | - }
|
72 | | -
|
73 | | - var partword:Array = new Array(partWords);
|
74 | | -
|
75 | | - var pb:int = source.position;
|
76 | | -
|
77 | | - slim = look.stages;
|
78 | | - for (s = 0; s < slim; s++) {
|
79 | | -
|
80 | | - for (i = 0, l = 0; i < partitionsToRead; l++) {
|
81 | | -
|
82 | | - if (s == 0) {
|
83 | | - var temp:int = source.readUnsignedHuffmanInt(look.phrasebook.huffmanRoot);
|
84 | | - if (temp == -1) {
|
85 | | - throw new Error("Foo??");
|
86 | | - }
|
87 | | - partword[l] = look.decodemap[temp];
|
88 | | - if (partword[l] == null) {
|
89 | | - throw new Error("Foo??");
|
90 | | - }
|
91 | | - }
|
92 | | -
|
93 | | - for (k = 0; k < partitionsPerWord && i < partitionsToRead; k++, i++) {
|
94 | | - offset = begin + i * samplesPerPartition;
|
95 | | -
|
96 | | - if ((cascade[partword[l][k]] & (1 << s)) != 0) {
|
97 | | - var stagebook:CodeBook =
|
98 | | - vorbis.setupHeader.codeBooks[look.partbooks[partword[l][k]][s]];
|
99 | | - if (stagebook != null) {
|
100 | | - stagebook.readVvAdd(vectors0, vectors1, left, right, source, offset, samplesPerPartition);
|
101 | | - }
|
102 | | - }
|
103 | | - }
|
104 | | - }
|
105 | | - }
|
106 | | -
|
107 | | - }
|
108 | | -
|
109 | | - }
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import flash.utils.Dictionary; |
| 24 | + import org.omtk.util.BitByteArray; |
| 25 | + |
| 26 | + public class Residue2 extends Residue { |
| 27 | + |
| 28 | + public function Residue2(source:BitByteArray, header:SetupHeader) { |
| 29 | + super(source, header); |
| 30 | + } |
| 31 | + |
| 32 | + public override function decodeResidue( |
| 33 | + vorbis:VorbisStream, source:BitByteArray, |
| 34 | + mode:Mode, ch:int, |
| 35 | + doNotDecodeFlags:Vector.<Boolean>, vectors0:Vector.<Number>, vectors1:Vector.<Number>):void { |
| 36 | + |
| 37 | + var i:int; |
| 38 | + var j:int; |
| 39 | + var k:int; |
| 40 | + var l:int; |
| 41 | + var s:int; |
| 42 | + var slim:int; |
| 43 | + |
| 44 | + var look:Look = getLook(vorbis, mode); |
| 45 | + |
| 46 | + var codeBook:CodeBook = vorbis.setupHeader.codeBooks[classBook]; |
| 47 | + |
| 48 | + var classvalsPerCodeword:int = codeBook.dimensions; |
| 49 | + var nToRead:int = end - begin; |
| 50 | + var partitionsToRead:int = nToRead / partitionSize; // partvals |
| 51 | + |
| 52 | + var samplesPerPartition:int = partitionSize; |
| 53 | + var partitionsPerWord:int = look.phrasebook.dimensions; |
| 54 | + |
| 55 | + var partWords:int = (partitionsToRead + partitionsPerWord - 1) / partitionsPerWord; |
| 56 | + |
| 57 | + var offset:int; |
| 58 | + |
| 59 | + var left:Boolean = false; |
| 60 | + var right:Boolean = false; |
| 61 | + |
| 62 | + for (i = 0; i < doNotDecodeFlags.length; i++) { |
| 63 | + if (!doNotDecodeFlags[i]) { |
| 64 | + if(i==0) { |
| 65 | + left = true; |
| 66 | + } |
| 67 | + else if (i==1) { |
| 68 | + right = true; |
| 69 | + } |
| 70 | + } |
| 71 | + } |
| 72 | + |
| 73 | + var partword:Array = new Array(partWords); |
| 74 | + |
| 75 | + var pb:int = source.position; |
| 76 | + |
| 77 | + slim = look.stages; |
| 78 | + for (s = 0; s < slim; s++) { |
| 79 | + |
| 80 | + for (i = 0, l = 0; i < partitionsToRead; l++) { |
| 81 | + |
| 82 | + if (s == 0) { |
| 83 | + var temp:int = source.readUnsignedHuffmanInt(look.phrasebook.huffmanRoot); |
| 84 | + if (temp == -1) { |
| 85 | + throw new Error("Foo??"); |
| 86 | + } |
| 87 | + partword[l] = look.decodemap[temp]; |
| 88 | + if (partword[l] == null) { |
| 89 | + throw new Error("Foo??"); |
| 90 | + } |
| 91 | + } |
| 92 | + |
| 93 | + for (k = 0; k < partitionsPerWord && i < partitionsToRead; k++, i++) { |
| 94 | + offset = begin + i * samplesPerPartition; |
| 95 | + |
| 96 | + if ((cascade[partword[l][k]] & (1 << s)) != 0) { |
| 97 | + var stagebook:CodeBook = |
| 98 | + vorbis.setupHeader.codeBooks[look.partbooks[partword[l][k]][s]]; |
| 99 | + if (stagebook != null) { |
| 100 | + stagebook.readVvAdd(vectors0, vectors1, left, right, source, offset, samplesPerPartition); |
| 101 | + } |
| 102 | + } |
| 103 | + } |
| 104 | + } |
| 105 | + } |
| 106 | + |
| 107 | + } |
| 108 | + |
| 109 | + } |
110 | 110 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue2.as |
___________________________________________________________________ |
Added: svn:eol-style |
111 | 111 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as |
— | — | @@ -1,70 +1,70 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import flash.utils.Dictionary;
|
24 | | - import org.omtk.util.BitByteArray;
|
25 | | -
|
26 | | - public class Mode
|
27 | | - {
|
28 | | - private var _blockFlag:Boolean;
|
29 | | - private var _windowType:uint;
|
30 | | - private var _transformType:uint;
|
31 | | - private var _mapping:uint;
|
32 | | -
|
33 | | - public function Mode(source:BitByteArray, header:SetupHeader) {
|
34 | | -
|
35 | | - _blockFlag=source.readBit();
|
36 | | - _windowType=source.readUnsignedBitwiseInt(16);
|
37 | | - _transformType=source.readUnsignedBitwiseInt(16);
|
38 | | - _mapping=source.readUnsignedBitwiseInt(8);
|
39 | | -
|
40 | | - if(_windowType!=0) {
|
41 | | - throw new Error("Window type = "+windowType+", != 0");
|
42 | | - }
|
43 | | -
|
44 | | - if(_transformType!=0) {
|
45 | | - throw new Error("Transform type = "+transformType+", != 0");
|
46 | | - }
|
47 | | -
|
48 | | - if(_mapping > header.mappings.length) {
|
49 | | - throw new Error("Mode mapping number is higher than total number of mappings.");
|
50 | | - }
|
51 | | - }
|
52 | | -
|
53 | | - public function get blockFlag():Boolean {
|
54 | | - return _blockFlag;
|
55 | | - }
|
56 | | -
|
57 | | - public function get windowType():uint {
|
58 | | - return _windowType;
|
59 | | - }
|
60 | | -
|
61 | | - public function get transformType():uint {
|
62 | | - return _transformType;
|
63 | | - }
|
64 | | -
|
65 | | - public function get mapping():uint {
|
66 | | - return _mapping;
|
67 | | - }
|
68 | | -
|
69 | | - }
|
70 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import flash.utils.Dictionary; |
| 24 | + import org.omtk.util.BitByteArray; |
| 25 | + |
| 26 | + public class Mode |
| 27 | + { |
| 28 | + private var _blockFlag:Boolean; |
| 29 | + private var _windowType:uint; |
| 30 | + private var _transformType:uint; |
| 31 | + private var _mapping:uint; |
| 32 | + |
| 33 | + public function Mode(source:BitByteArray, header:SetupHeader) { |
| 34 | + |
| 35 | + _blockFlag=source.readBit(); |
| 36 | + _windowType=source.readUnsignedBitwiseInt(16); |
| 37 | + _transformType=source.readUnsignedBitwiseInt(16); |
| 38 | + _mapping=source.readUnsignedBitwiseInt(8); |
| 39 | + |
| 40 | + if(_windowType!=0) { |
| 41 | + throw new Error("Window type = "+windowType+", != 0"); |
| 42 | + } |
| 43 | + |
| 44 | + if(_transformType!=0) { |
| 45 | + throw new Error("Transform type = "+transformType+", != 0"); |
| 46 | + } |
| 47 | + |
| 48 | + if(_mapping > header.mappings.length) { |
| 49 | + throw new Error("Mode mapping number is higher than total number of mappings."); |
| 50 | + } |
| 51 | + } |
| 52 | + |
| 53 | + public function get blockFlag():Boolean { |
| 54 | + return _blockFlag; |
| 55 | + } |
| 56 | + |
| 57 | + public function get windowType():uint { |
| 58 | + return _windowType; |
| 59 | + } |
| 60 | + |
| 61 | + public function get transformType():uint { |
| 62 | + return _transformType; |
| 63 | + } |
| 64 | + |
| 65 | + public function get mapping():uint { |
| 66 | + return _mapping; |
| 67 | + } |
| 68 | + |
| 69 | + } |
| 70 | + |
71 | 71 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mode.as |
___________________________________________________________________ |
Added: svn:eol-style |
72 | 72 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as |
— | — | @@ -1,223 +1,223 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.*;
|
24 | | -
|
25 | | - public class CodeBook {
|
26 | | -
|
27 | | - private var entries:uint;
|
28 | | - private var entryLengths:Vector.<int>;
|
29 | | - private var valueVector:Vector.<Vector.<Number>>;
|
30 | | -
|
31 | | - private var codeBookLookupType:int = -1;
|
32 | | -
|
33 | | - public var huffmanRoot:HuffmanNode;
|
34 | | - public var dimensions:uint;
|
35 | | -
|
36 | | - public function CodeBook( source: BitByteArray ) {
|
37 | | -
|
38 | | - var i:int;
|
39 | | - var j:int;
|
40 | | -
|
41 | | - var syncPattern:uint = source.readUnsignedBitwiseInt(24);
|
42 | | - if(syncPattern !=0x564342) {
|
43 | | - throw new IllegalOperationError("Illegal codebook sync pattern: "+syncPattern);
|
44 | | - }
|
45 | | -
|
46 | | - dimensions = source.readUnsignedBitwiseInt(16);
|
47 | | - entries = source.readUnsignedBitwiseInt(24);
|
48 | | -
|
49 | | - entryLengths = new Vector.<int>(entries);
|
50 | | -
|
51 | | - var ordered:Boolean = source.readBit();
|
52 | | -
|
53 | | - if(ordered) {
|
54 | | - var cl:int = source.readUnsignedBitwiseInt(5)+1;
|
55 | | - for(i=0; i<entryLengths.length; ) {
|
56 | | - var num:int = source.readUnsignedBitwiseInt(Util.ilog(entryLengths.length-i));
|
57 | | - if(i+num>entryLengths.length) {
|
58 | | - throw new Error("The codebook entry length list is longer than the actual number of entry lengths.");
|
59 | | - }
|
60 | | - for(j=i; j<i+num; j++) {
|
61 | | - entryLengths[j] = cl;
|
62 | | - }
|
63 | | - //Arrays.fill(entryLengths, i, i+num, cl);
|
64 | | - cl++;
|
65 | | - i+=num;
|
66 | | - }
|
67 | | - }
|
68 | | - else {
|
69 | | - // !ordered
|
70 | | - var sparse:Boolean = source.readBit();
|
71 | | -
|
72 | | - if(sparse) {
|
73 | | - for(i=0; i<entryLengths.length; i++) {
|
74 | | - if(source.readBit()) {
|
75 | | - entryLengths[i]=source.readUnsignedBitwiseInt(5)+1;
|
76 | | - }
|
77 | | - else {
|
78 | | - entryLengths[i]=-1;
|
79 | | - }
|
80 | | - }
|
81 | | - }
|
82 | | - else {
|
83 | | - // !sparse
|
84 | | - //Alert.show("entryLengths.length: "+entryLengths.length, "CodeBook");
|
85 | | - for(i=0; i<entryLengths.length; i++) {
|
86 | | - entryLengths[i]=source.readUnsignedBitwiseInt(5)+1;
|
87 | | - }
|
88 | | - }
|
89 | | -
|
90 | | - }
|
91 | | -
|
92 | | - if (!createHuffmanTree(entryLengths)) {
|
93 | | - throw new Error("An exception was thrown when building the codebook Huffman tree.");
|
94 | | - }
|
95 | | -
|
96 | | - codeBookLookupType = source.readUnsignedBitwiseInt(4);
|
97 | | -
|
98 | | - switch(codeBookLookupType) {
|
99 | | - case 0:
|
100 | | - // codebook has no scalar vectors to be calculated
|
101 | | - break;
|
102 | | - case 1:
|
103 | | - case 2:
|
104 | | - var codeBookMinimumValue:Number = Util.float32unpack(source.readUnsignedBitwiseInt(32));
|
105 | | - var codeBookDeltaValue:Number = Util.float32unpack(source.readUnsignedBitwiseInt(32));
|
106 | | -
|
107 | | - var codeBookValueBits:uint = source.readUnsignedBitwiseInt(4)+1;
|
108 | | - var codeBookSequenceP:Boolean = source.readBit();
|
109 | | -
|
110 | | - var codeBookLookupValues:uint = 0;
|
111 | | -
|
112 | | - if(codeBookLookupType==1) {
|
113 | | - codeBookLookupValues=Util.lookup1Values(entries, dimensions);
|
114 | | - }
|
115 | | - else {
|
116 | | - codeBookLookupValues=entries*dimensions;
|
117 | | - }
|
118 | | -
|
119 | | - var codeBookMultiplicands:Vector.<int> = new Vector.<int>(codeBookLookupValues);
|
120 | | -
|
121 | | - for(i=0; i < codeBookMultiplicands.length; i++) {
|
122 | | - codeBookMultiplicands[i]=source.readUnsignedBitwiseInt(codeBookValueBits);
|
123 | | - }
|
124 | | -
|
125 | | - valueVector = new Vector.<Vector.<Number>>(entries);
|
126 | | -
|
127 | | - if(codeBookLookupType==1) {
|
128 | | - for(i=0; i<entries; i++) {
|
129 | | - valueVector[i] = new Vector.<Number>(dimensions);
|
130 | | - var last:Number = 0.0;
|
131 | | - var indexDivisor:uint = 1;
|
132 | | - for(j=0; j<dimensions; j++) {
|
133 | | - var multiplicandOffset:int = (i/indexDivisor)%codeBookLookupValues;
|
134 | | - valueVector[i][j]=
|
135 | | - codeBookMultiplicands[multiplicandOffset]*codeBookDeltaValue+codeBookMinimumValue+last;
|
136 | | - if(codeBookSequenceP) {
|
137 | | - last = valueVector[i][j];
|
138 | | - }
|
139 | | - indexDivisor*=codeBookLookupValues;
|
140 | | - }
|
141 | | - }
|
142 | | - }
|
143 | | - else {
|
144 | | - throw new Error("Unsupported codebook lookup type: "+codeBookLookupType);
|
145 | | - /** @todo implement */
|
146 | | - }
|
147 | | - break;
|
148 | | - default:
|
149 | | - throw new Error("Unsupported codebook lookup type: "+codeBookLookupType);
|
150 | | - }
|
151 | | - }
|
152 | | -
|
153 | | - private function createHuffmanTree(entryLengths:Vector.<int>):Boolean {
|
154 | | -
|
155 | | - var i:int;
|
156 | | -
|
157 | | - huffmanRoot = new HuffmanNode();
|
158 | | - for(i=0; i<entryLengths.length; i++) {
|
159 | | - var el:int = entryLengths[i];
|
160 | | - if(el>0) {
|
161 | | - if(!huffmanRoot.setNewValue(el, i)) {
|
162 | | - return false;
|
163 | | - }
|
164 | | - }
|
165 | | - }
|
166 | | - return true;
|
167 | | - }
|
168 | | -
|
169 | | -
|
170 | | - public function readVvAdd(a0:Vector.<Number>, a1:Vector.<Number>, left:Boolean, right:Boolean, source:BitByteArray, offset:int, length:int):void {
|
171 | | -
|
172 | | - var i:int;
|
173 | | - var j:int;
|
174 | | -
|
175 | | - if (!left && !right) {
|
176 | | - return;
|
177 | | - }
|
178 | | -
|
179 | | - // 1 or 2 channels
|
180 | | - var ch:int =
|
181 | | - left && right ? 2 : 1;
|
182 | | -
|
183 | | - var lim:int;
|
184 | | - var ix:int;
|
185 | | - var ve:Vector.<Number>;
|
186 | | -
|
187 | | - if(left && right) {
|
188 | | - lim = (offset + length) / 2;
|
189 | | - var chptr:int = 0;
|
190 | | - for (i = offset / 2; i < lim;) {
|
191 | | - ix = source.readUnsignedHuffmanInt(huffmanRoot);
|
192 | | - ve = valueVector[ix];
|
193 | | - for (j = 0; j < dimensions; j++) {
|
194 | | - if(chptr == 0) {
|
195 | | - a0[i] += ve[j];
|
196 | | - }
|
197 | | - else {
|
198 | | - a1[i] += ve[j];
|
199 | | - }
|
200 | | - chptr++;
|
201 | | - if(chptr == 2) {
|
202 | | - chptr = 0;
|
203 | | - i++;
|
204 | | - }
|
205 | | - }
|
206 | | - }
|
207 | | - }
|
208 | | - else {
|
209 | | - var a : Vector.<Number> = left ? a0 : a1;
|
210 | | - lim = offset + length;
|
211 | | - for (i = offset; i < lim;) {
|
212 | | - ve = valueVector[source.readUnsignedHuffmanInt(huffmanRoot)];
|
213 | | - for (j = 0; j < dimensions; j++) {
|
214 | | - a[i] += ve[j];
|
215 | | - i++;
|
216 | | - }
|
217 | | - }
|
218 | | - }
|
219 | | -
|
220 | | - }
|
221 | | -
|
222 | | - }
|
223 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.*; |
| 24 | + |
| 25 | + public class CodeBook { |
| 26 | + |
| 27 | + private var entries:uint; |
| 28 | + private var entryLengths:Vector.<int>; |
| 29 | + private var valueVector:Vector.<Vector.<Number>>; |
| 30 | + |
| 31 | + private var codeBookLookupType:int = -1; |
| 32 | + |
| 33 | + public var huffmanRoot:HuffmanNode; |
| 34 | + public var dimensions:uint; |
| 35 | + |
| 36 | + public function CodeBook( source: BitByteArray ) { |
| 37 | + |
| 38 | + var i:int; |
| 39 | + var j:int; |
| 40 | + |
| 41 | + var syncPattern:uint = source.readUnsignedBitwiseInt(24); |
| 42 | + if(syncPattern !=0x564342) { |
| 43 | + throw new IllegalOperationError("Illegal codebook sync pattern: "+syncPattern); |
| 44 | + } |
| 45 | + |
| 46 | + dimensions = source.readUnsignedBitwiseInt(16); |
| 47 | + entries = source.readUnsignedBitwiseInt(24); |
| 48 | + |
| 49 | + entryLengths = new Vector.<int>(entries); |
| 50 | + |
| 51 | + var ordered:Boolean = source.readBit(); |
| 52 | + |
| 53 | + if(ordered) { |
| 54 | + var cl:int = source.readUnsignedBitwiseInt(5)+1; |
| 55 | + for(i=0; i<entryLengths.length; ) { |
| 56 | + var num:int = source.readUnsignedBitwiseInt(Util.ilog(entryLengths.length-i)); |
| 57 | + if(i+num>entryLengths.length) { |
| 58 | + throw new Error("The codebook entry length list is longer than the actual number of entry lengths."); |
| 59 | + } |
| 60 | + for(j=i; j<i+num; j++) { |
| 61 | + entryLengths[j] = cl; |
| 62 | + } |
| 63 | + //Arrays.fill(entryLengths, i, i+num, cl); |
| 64 | + cl++; |
| 65 | + i+=num; |
| 66 | + } |
| 67 | + } |
| 68 | + else { |
| 69 | + // !ordered |
| 70 | + var sparse:Boolean = source.readBit(); |
| 71 | + |
| 72 | + if(sparse) { |
| 73 | + for(i=0; i<entryLengths.length; i++) { |
| 74 | + if(source.readBit()) { |
| 75 | + entryLengths[i]=source.readUnsignedBitwiseInt(5)+1; |
| 76 | + } |
| 77 | + else { |
| 78 | + entryLengths[i]=-1; |
| 79 | + } |
| 80 | + } |
| 81 | + } |
| 82 | + else { |
| 83 | + // !sparse |
| 84 | + //Alert.show("entryLengths.length: "+entryLengths.length, "CodeBook"); |
| 85 | + for(i=0; i<entryLengths.length; i++) { |
| 86 | + entryLengths[i]=source.readUnsignedBitwiseInt(5)+1; |
| 87 | + } |
| 88 | + } |
| 89 | + |
| 90 | + } |
| 91 | + |
| 92 | + if (!createHuffmanTree(entryLengths)) { |
| 93 | + throw new Error("An exception was thrown when building the codebook Huffman tree."); |
| 94 | + } |
| 95 | + |
| 96 | + codeBookLookupType = source.readUnsignedBitwiseInt(4); |
| 97 | + |
| 98 | + switch(codeBookLookupType) { |
| 99 | + case 0: |
| 100 | + // codebook has no scalar vectors to be calculated |
| 101 | + break; |
| 102 | + case 1: |
| 103 | + case 2: |
| 104 | + var codeBookMinimumValue:Number = Util.float32unpack(source.readUnsignedBitwiseInt(32)); |
| 105 | + var codeBookDeltaValue:Number = Util.float32unpack(source.readUnsignedBitwiseInt(32)); |
| 106 | + |
| 107 | + var codeBookValueBits:uint = source.readUnsignedBitwiseInt(4)+1; |
| 108 | + var codeBookSequenceP:Boolean = source.readBit(); |
| 109 | + |
| 110 | + var codeBookLookupValues:uint = 0; |
| 111 | + |
| 112 | + if(codeBookLookupType==1) { |
| 113 | + codeBookLookupValues=Util.lookup1Values(entries, dimensions); |
| 114 | + } |
| 115 | + else { |
| 116 | + codeBookLookupValues=entries*dimensions; |
| 117 | + } |
| 118 | + |
| 119 | + var codeBookMultiplicands:Vector.<int> = new Vector.<int>(codeBookLookupValues); |
| 120 | + |
| 121 | + for(i=0; i < codeBookMultiplicands.length; i++) { |
| 122 | + codeBookMultiplicands[i]=source.readUnsignedBitwiseInt(codeBookValueBits); |
| 123 | + } |
| 124 | + |
| 125 | + valueVector = new Vector.<Vector.<Number>>(entries); |
| 126 | + |
| 127 | + if(codeBookLookupType==1) { |
| 128 | + for(i=0; i<entries; i++) { |
| 129 | + valueVector[i] = new Vector.<Number>(dimensions); |
| 130 | + var last:Number = 0.0; |
| 131 | + var indexDivisor:uint = 1; |
| 132 | + for(j=0; j<dimensions; j++) { |
| 133 | + var multiplicandOffset:int = (i/indexDivisor)%codeBookLookupValues; |
| 134 | + valueVector[i][j]= |
| 135 | + codeBookMultiplicands[multiplicandOffset]*codeBookDeltaValue+codeBookMinimumValue+last; |
| 136 | + if(codeBookSequenceP) { |
| 137 | + last = valueVector[i][j]; |
| 138 | + } |
| 139 | + indexDivisor*=codeBookLookupValues; |
| 140 | + } |
| 141 | + } |
| 142 | + } |
| 143 | + else { |
| 144 | + throw new Error("Unsupported codebook lookup type: "+codeBookLookupType); |
| 145 | + /** @todo implement */ |
| 146 | + } |
| 147 | + break; |
| 148 | + default: |
| 149 | + throw new Error("Unsupported codebook lookup type: "+codeBookLookupType); |
| 150 | + } |
| 151 | + } |
| 152 | + |
| 153 | + private function createHuffmanTree(entryLengths:Vector.<int>):Boolean { |
| 154 | + |
| 155 | + var i:int; |
| 156 | + |
| 157 | + huffmanRoot = new HuffmanNode(); |
| 158 | + for(i=0; i<entryLengths.length; i++) { |
| 159 | + var el:int = entryLengths[i]; |
| 160 | + if(el>0) { |
| 161 | + if(!huffmanRoot.setNewValue(el, i)) { |
| 162 | + return false; |
| 163 | + } |
| 164 | + } |
| 165 | + } |
| 166 | + return true; |
| 167 | + } |
| 168 | + |
| 169 | + |
| 170 | + public function readVvAdd(a0:Vector.<Number>, a1:Vector.<Number>, left:Boolean, right:Boolean, source:BitByteArray, offset:int, length:int):void { |
| 171 | + |
| 172 | + var i:int; |
| 173 | + var j:int; |
| 174 | + |
| 175 | + if (!left && !right) { |
| 176 | + return; |
| 177 | + } |
| 178 | + |
| 179 | + // 1 or 2 channels |
| 180 | + var ch:int = |
| 181 | + left && right ? 2 : 1; |
| 182 | + |
| 183 | + var lim:int; |
| 184 | + var ix:int; |
| 185 | + var ve:Vector.<Number>; |
| 186 | + |
| 187 | + if(left && right) { |
| 188 | + lim = (offset + length) / 2; |
| 189 | + var chptr:int = 0; |
| 190 | + for (i = offset / 2; i < lim;) { |
| 191 | + ix = source.readUnsignedHuffmanInt(huffmanRoot); |
| 192 | + ve = valueVector[ix]; |
| 193 | + for (j = 0; j < dimensions; j++) { |
| 194 | + if(chptr == 0) { |
| 195 | + a0[i] += ve[j]; |
| 196 | + } |
| 197 | + else { |
| 198 | + a1[i] += ve[j]; |
| 199 | + } |
| 200 | + chptr++; |
| 201 | + if(chptr == 2) { |
| 202 | + chptr = 0; |
| 203 | + i++; |
| 204 | + } |
| 205 | + } |
| 206 | + } |
| 207 | + } |
| 208 | + else { |
| 209 | + var a : Vector.<Number> = left ? a0 : a1; |
| 210 | + lim = offset + length; |
| 211 | + for (i = offset; i < lim;) { |
| 212 | + ve = valueVector[source.readUnsignedHuffmanInt(huffmanRoot)]; |
| 213 | + for (j = 0; j < dimensions; j++) { |
| 214 | + a[i] += ve[j]; |
| 215 | + i++; |
| 216 | + } |
| 217 | + } |
| 218 | + } |
| 219 | + |
| 220 | + } |
| 221 | + |
| 222 | + } |
| 223 | + |
224 | 224 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CodeBook.as |
___________________________________________________________________ |
Added: svn:eol-style |
225 | 225 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as |
— | — | @@ -1,62 +1,62 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.events.*;
|
23 | | - import flash.system.*;
|
24 | | - import flash.display.*;
|
25 | | - import flash.net.*;
|
26 | | - import flash.utils.getTimer;
|
27 | | -
|
28 | | - /*
|
29 | | - * Wrapper for the haXe compiled class org.omtk.vorbis.MdctHX
|
30 | | - */
|
31 | | - public class Mdct {
|
32 | | -
|
33 | | - public static var initialized : Boolean = false;
|
34 | | - private static var hxClass : Class;
|
35 | | -
|
36 | | - public static function initialize() : void {
|
37 | | - var ldr:Loader = new Loader();
|
38 | | - var swfUrl:String = "hxmdct.swf";
|
39 | | - var req:URLRequest = new URLRequest(swfUrl);
|
40 | | - var ldrContext:LoaderContext =
|
41 | | - new LoaderContext(false, ApplicationDomain.currentDomain);
|
42 | | - ldr.load(req, ldrContext);
|
43 | | - ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded);
|
44 | | -
|
45 | | - function swfLoaded(e:Event):void {
|
46 | | - hxClass = ApplicationDomain.currentDomain.getDefinition("org.omtk.vorbis.MdctHX") as Class;
|
47 | | - initialized = true;
|
48 | | - }
|
49 | | - }
|
50 | | -
|
51 | | - private var delegate : Object;
|
52 | | -
|
53 | | - public function Mdct(n:int) {
|
54 | | - delegate = new hxClass(n);
|
55 | | - }
|
56 | | -
|
57 | | - public function imdct(frq:Vector.<Number>, window:Vector.<Number>, pcm:Vector.<Number>):void {
|
58 | | - delegate.imdct(frq, window, pcm);
|
59 | | - }
|
60 | | -
|
61 | | - }
|
62 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.events.*; |
| 23 | + import flash.system.*; |
| 24 | + import flash.display.*; |
| 25 | + import flash.net.*; |
| 26 | + import flash.utils.getTimer; |
| 27 | + |
| 28 | + /* |
| 29 | + * Wrapper for the haXe compiled class org.omtk.vorbis.MdctHX |
| 30 | + */ |
| 31 | + public class Mdct { |
| 32 | + |
| 33 | + public static var initialized : Boolean = false; |
| 34 | + private static var hxClass : Class; |
| 35 | + |
| 36 | + public static function initialize() : void { |
| 37 | + var ldr:Loader = new Loader(); |
| 38 | + var swfUrl:String = "hxmdct.swf"; |
| 39 | + var req:URLRequest = new URLRequest(swfUrl); |
| 40 | + var ldrContext:LoaderContext = |
| 41 | + new LoaderContext(false, ApplicationDomain.currentDomain); |
| 42 | + ldr.load(req, ldrContext); |
| 43 | + ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, swfLoaded); |
| 44 | + |
| 45 | + function swfLoaded(e:Event):void { |
| 46 | + hxClass = ApplicationDomain.currentDomain.getDefinition("org.omtk.vorbis.MdctHX") as Class; |
| 47 | + initialized = true; |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + private var delegate : Object; |
| 52 | + |
| 53 | + public function Mdct(n:int) { |
| 54 | + delegate = new hxClass(n); |
| 55 | + } |
| 56 | + |
| 57 | + public function imdct(frq:Vector.<Number>, window:Vector.<Number>, pcm:Vector.<Number>):void { |
| 58 | + delegate.imdct(frq, window, pcm); |
| 59 | + } |
| 60 | + |
| 61 | + } |
| 62 | + |
63 | 63 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mdct.as |
___________________________________________________________________ |
Added: svn:eol-style |
64 | 64 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as |
— | — | @@ -1,340 +1,340 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.utils.getTimer;
|
23 | | - import flash.utils.ByteArray;
|
24 | | - import org.omtk.ogg.*;
|
25 | | - import org.omtk.util.BitByteArray;
|
26 | | -
|
27 | | - public class AudioPacket {
|
28 | | -
|
29 | | - private var modeNumber:int;
|
30 | | - private var mode:Mode;
|
31 | | - private var mapping:Mapping;
|
32 | | - private var n:int;
|
33 | | -
|
34 | | - private var blockFlag:Boolean;
|
35 | | - private var previousWindowFlag:Boolean;
|
36 | | - private var nextWindowFlag:Boolean;
|
37 | | -
|
38 | | - private var windowCenter:int;
|
39 | | - private var leftWindowStart:int;
|
40 | | - private var leftWindowEnd:int;
|
41 | | - private var leftN:int;
|
42 | | - private var rightWindowStart:int;
|
43 | | - private var rightWindowEnd:int;
|
44 | | - private var rightN:int;
|
45 | | -
|
46 | | - private var window:Vector.<Number>;
|
47 | | - private var freq0:Vector.<Number>;
|
48 | | - private var freq1:Vector.<Number>;
|
49 | | - private var pcm0:Vector.<Number>;
|
50 | | - private var pcm1:Vector.<Number>;
|
51 | | -
|
52 | | - private var channelFloors:Vector.<Floor>;
|
53 | | - private var noResidues:Vector.<Boolean>;
|
54 | | -
|
55 | | - private var _lastPacket: Boolean;
|
56 | | - private var _lastGranulePosition: int;
|
57 | | -
|
58 | | - public function AudioPacket(vorbis:VorbisStream, packet: OggPacket, currentGranulePosition: int) {
|
59 | | -
|
60 | | - var source: BitByteArray = packet.data;
|
61 | | - _lastPacket = packet.lastPacket;
|
62 | | - _lastGranulePosition = packet.lastGranulePosition;
|
63 | | -
|
64 | | - var i:int;
|
65 | | - var j:int;
|
66 | | - var k:int;
|
67 | | -
|
68 | | - var sHeader:SetupHeader = vorbis.setupHeader;
|
69 | | - var iHeader:IdentificationHeader = vorbis.identificationHeader;
|
70 | | - var modes:Vector.<Mode> = sHeader.modes;
|
71 | | - var mappings:Vector.<Mapping> = sHeader.mappings;
|
72 | | - var residues:Vector.<Residue> = sHeader.residues;
|
73 | | - var channels:int = iHeader.channels;
|
74 | | -
|
75 | | - if (source.readUnsignedBitwiseInt(1) != 0) {
|
76 | | - throw new Error("Packet type mismatch when trying to create an audio packet.");
|
77 | | - }
|
78 | | -
|
79 | | - modeNumber = source.readUnsignedBitwiseInt(Util.ilog(modes.length - 1));
|
80 | | -
|
81 | | - mode = modes[modeNumber];
|
82 | | -
|
83 | | - if(mode == null) {
|
84 | | - throw new Error("Reference to invalid mode in audio packet.");
|
85 | | - }
|
86 | | -
|
87 | | - mapping = mappings[mode.mapping];
|
88 | | -
|
89 | | - var magnitudes:Vector.<int> = mapping.magnitudes;
|
90 | | - var angles:Vector.<int> = mapping.angles;
|
91 | | -
|
92 | | - blockFlag = mode.blockFlag;
|
93 | | -
|
94 | | - var blockSize0:int = iHeader.blockSize0;
|
95 | | - var blockSize1:int = iHeader.blockSize1;
|
96 | | -
|
97 | | - n = blockFlag ? blockSize1 : blockSize0;
|
98 | | -
|
99 | | - if (blockFlag) {
|
100 | | - previousWindowFlag = source.readBit();
|
101 | | - nextWindowFlag = source.readBit();
|
102 | | - }
|
103 | | -
|
104 | | - windowCenter = n / 2;
|
105 | | -
|
106 | | - if (blockFlag && !previousWindowFlag) {
|
107 | | - leftWindowStart = n / 4 - blockSize0 / 4;
|
108 | | - leftWindowEnd = n / 4 + blockSize0 / 4;
|
109 | | - leftN = blockSize0 / 2;
|
110 | | - } else {
|
111 | | - leftWindowStart = 0;
|
112 | | - leftWindowEnd = n / 2;
|
113 | | - leftN = windowCenter;
|
114 | | - }
|
115 | | -
|
116 | | - if (blockFlag && !nextWindowFlag) {
|
117 | | - rightWindowStart = n * 3 / 4 - blockSize0 / 4;
|
118 | | - rightWindowEnd = n * 3 / 4 + blockSize0 / 4;
|
119 | | - rightN = blockSize0 / 2;
|
120 | | - } else {
|
121 | | - rightWindowStart = windowCenter;
|
122 | | - rightWindowEnd = n;
|
123 | | - rightN = n / 2;
|
124 | | - }
|
125 | | -
|
126 | | - window = getComputedWindow(vorbis);
|
127 | | -
|
128 | | - channelFloors = new Vector.<Floor>(channels, true);
|
129 | | - noResidues = new Vector.<Boolean>(channels, true);
|
130 | | -
|
131 | | - freq0 = new Vector.<Number>(n, true);
|
132 | | - freq1 = new Vector.<Number>(n, true);
|
133 | | - pcm0 = new Vector.<Number>(n, true);
|
134 | | - pcm1 = new Vector.<Number>(n, true);
|
135 | | -
|
136 | | - var allFloorsEmpty: Boolean = true;
|
137 | | - var submapNumber: int;
|
138 | | - var floorNumber: int;
|
139 | | - var decodedFloor: Floor;
|
140 | | -
|
141 | | - for(i = 0; i < channels; i++) {
|
142 | | - submapNumber = mapping.mux[i];
|
143 | | - floorNumber = mapping.submapFloors[submapNumber];
|
144 | | - decodedFloor = sHeader.floors[floorNumber].decodeFloor(vorbis, source);
|
145 | | - channelFloors[i] = decodedFloor;
|
146 | | - noResidues[i] = decodedFloor == null;
|
147 | | - if (decodedFloor != null) {
|
148 | | - allFloorsEmpty = false;
|
149 | | - }
|
150 | | - }
|
151 | | -
|
152 | | - if(allFloorsEmpty) {
|
153 | | - return;
|
154 | | - }
|
155 | | -
|
156 | | - var mag: int;
|
157 | | - var ang: int;
|
158 | | -
|
159 | | - for(i = 0; i < magnitudes.length; i++) {
|
160 | | - mag = magnitudes[i];
|
161 | | - ang = angles[i];
|
162 | | - if (!noResidues[mag] || !noResidues[ang]) {
|
163 | | - noResidues[mag] = false;
|
164 | | - noResidues[ang] = false;
|
165 | | - }
|
166 | | - }
|
167 | | -
|
168 | | - var ch: int;
|
169 | | - var doNotDecodeFlags: Vector.<Boolean>;
|
170 | | - var residue:Residue;
|
171 | | -
|
172 | | - for(i = 0; i < mapping.submaps; i++) {
|
173 | | -
|
174 | | - doNotDecodeFlags = new Vector.<Boolean>();
|
175 | | -
|
176 | | - for(j = 0; j < channels; j++) {
|
177 | | - if(mapping.mux[j] == i) {
|
178 | | - doNotDecodeFlags.push(noResidues[j]);
|
179 | | - }
|
180 | | - }
|
181 | | -
|
182 | | - residue = residues[mapping.submapResidues[i]];
|
183 | | -
|
184 | | - residue.decodeResidue(vorbis, source, mode, ch, doNotDecodeFlags, freq0, freq1);
|
185 | | - }
|
186 | | -
|
187 | | - var a: Number;
|
188 | | - var m: Number;
|
189 | | -
|
190 | | - for(i = mapping.couplingSteps - 1; i >= 0; i--) {
|
191 | | -
|
192 | | - mag = magnitudes[i];
|
193 | | - ang = angles[i];
|
194 | | -
|
195 | | - for (j = 0; j < freq0.length; j++) {
|
196 | | -
|
197 | | - a = ang == 0 ? freq0[j] : freq1[j];
|
198 | | - m = mag == 0 ? freq0[j] : freq1[j];
|
199 | | -
|
200 | | - if(a > 0) {
|
201 | | - if(ang == 0) {
|
202 | | - freq0[j] = m > 0 ? m - a : m + a;
|
203 | | - }
|
204 | | - else {
|
205 | | - freq1[j] = m > 0 ? m - a : m + a;
|
206 | | - }
|
207 | | - }
|
208 | | - else {
|
209 | | - if(mag == 0) {
|
210 | | - freq0[j] = m > 0 ? m + a : m - a;
|
211 | | - }
|
212 | | - else {
|
213 | | - freq1[j] = m > 0 ? m + a : m - a;
|
214 | | - }
|
215 | | -
|
216 | | - if(ang == 0) {
|
217 | | - freq0[j] = m;
|
218 | | - }
|
219 | | - else {
|
220 | | - freq1[j] = m;
|
221 | | - }
|
222 | | - }
|
223 | | - }
|
224 | | - }
|
225 | | -
|
226 | | - if(channelFloors[0] != null) {
|
227 | | - Floor(channelFloors[0]).computeFloor(freq0);
|
228 | | - }
|
229 | | -
|
230 | | - if(channelFloors[1] != null) {
|
231 | | - Floor(channelFloors[1]).computeFloor(freq1);
|
232 | | - }
|
233 | | -
|
234 | | - // perform an inverse mdct to all channels
|
235 | | - var mdct: Mdct = blockFlag ? iHeader.mdct1 : iHeader.mdct0;
|
236 | | - mdct.imdct(freq0, window, pcm0);
|
237 | | - mdct.imdct(freq1, window, pcm1);
|
238 | | -
|
239 | | - if(_lastPacket) {
|
240 | | - if(leftWindowEnd - leftWindowStart > _lastGranulePosition - currentGranulePosition) {
|
241 | | - leftWindowEnd = leftWindowStart + _lastGranulePosition - currentGranulePosition
|
242 | | - }
|
243 | | - if(rightWindowStart - leftWindowStart > _lastGranulePosition - currentGranulePosition) {
|
244 | | - rightWindowStart = leftWindowStart + _lastGranulePosition - currentGranulePosition
|
245 | | - }
|
246 | | - }
|
247 | | -
|
248 | | - }
|
249 | | -
|
250 | | - private function getComputedWindow(vorbis:VorbisStream):Vector.<Number> {
|
251 | | -
|
252 | | - var i:int;
|
253 | | -
|
254 | | - var ix:int = (blockFlag ? 4 : 0) + (previousWindowFlag ? 2 : 0) + (nextWindowFlag ? 1 : 0);
|
255 | | - var w:Vector.<Number> = vorbis.windows[ix];
|
256 | | -
|
257 | | - var x:Number;
|
258 | | -
|
259 | | - if (w == null) {
|
260 | | - w = new Vector.<Number>(n);
|
261 | | -
|
262 | | - for(i = 0; i < leftWindowStart; i++) {
|
263 | | - w[i] = 0;
|
264 | | - }
|
265 | | -
|
266 | | - for (i = 0; i < leftN; i++) {
|
267 | | - x = (i + .5) / leftN * Math.PI / 2.;
|
268 | | - x = Math.sin(x);
|
269 | | - x *= x;
|
270 | | - x *= Math.PI / 2.;
|
271 | | - x = Math.sin(x);
|
272 | | - w[i + leftWindowStart] = x;
|
273 | | - }
|
274 | | -
|
275 | | - for (i = leftWindowEnd; i < rightWindowStart; i++) {
|
276 | | - w[i] = 1;
|
277 | | - }
|
278 | | -
|
279 | | - for (i = 0; i < rightN; i++) {
|
280 | | - x = (rightN - i - .5) / rightN * Math.PI / 2.;
|
281 | | - x = Math.sin(x);
|
282 | | - x *= x;
|
283 | | - x *= Math.PI / 2.;
|
284 | | - x = Math.sin(x);
|
285 | | - w[i + rightWindowStart] = x;
|
286 | | - }
|
287 | | -
|
288 | | - for(i = rightN + rightWindowStart; i < n; i++) {
|
289 | | - w[i] = 0;
|
290 | | - }
|
291 | | -
|
292 | | - for(i = 0; i < w.length; i++) {
|
293 | | - w[i] *= 0.5;
|
294 | | - }
|
295 | | -
|
296 | | - vorbis.windows[ix] = w;
|
297 | | - }
|
298 | | -
|
299 | | - return w;
|
300 | | - }
|
301 | | -
|
302 | | -
|
303 | | - public function readPcm(previousPacket:AudioPacket, target: ByteArray): int {
|
304 | | -
|
305 | | - var j:int;
|
306 | | - var j2:int;
|
307 | | - var ppcm0:Vector.<Number> = previousPacket.pcm0;
|
308 | | - var ppcm1:Vector.<Number> = previousPacket.pcm1;
|
309 | | -
|
310 | | - j2 = previousPacket.rightWindowStart;
|
311 | | -
|
312 | | - for(j = leftWindowStart; j < leftWindowEnd; j++) {
|
313 | | - target.writeFloat(pcm0[j] + ppcm0[j2]);
|
314 | | - target.writeFloat(pcm1[j] + ppcm1[j2++]);
|
315 | | - }
|
316 | | -
|
317 | | - for (j = leftWindowEnd; j < rightWindowStart; j++) {
|
318 | | - target.writeFloat(pcm0[j]);
|
319 | | - target.writeFloat(pcm1[j]);
|
320 | | - }
|
321 | | -
|
322 | | - return numberOfSamples;
|
323 | | -
|
324 | | - }
|
325 | | -
|
326 | | - public function get numberOfSamples():int {
|
327 | | - return rightWindowStart - leftWindowStart;
|
328 | | - }
|
329 | | -
|
330 | | - public function get lastPacket(): Boolean {
|
331 | | - return lastPacket;
|
332 | | - }
|
333 | | -
|
334 | | - public function get lastGranulePosition(): int {
|
335 | | - return lastGranulePosition;
|
336 | | - }
|
337 | | -
|
338 | | - }
|
339 | | -
|
340 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.utils.getTimer; |
| 23 | + import flash.utils.ByteArray; |
| 24 | + import org.omtk.ogg.*; |
| 25 | + import org.omtk.util.BitByteArray; |
| 26 | + |
| 27 | + public class AudioPacket { |
| 28 | + |
| 29 | + private var modeNumber:int; |
| 30 | + private var mode:Mode; |
| 31 | + private var mapping:Mapping; |
| 32 | + private var n:int; |
| 33 | + |
| 34 | + private var blockFlag:Boolean; |
| 35 | + private var previousWindowFlag:Boolean; |
| 36 | + private var nextWindowFlag:Boolean; |
| 37 | + |
| 38 | + private var windowCenter:int; |
| 39 | + private var leftWindowStart:int; |
| 40 | + private var leftWindowEnd:int; |
| 41 | + private var leftN:int; |
| 42 | + private var rightWindowStart:int; |
| 43 | + private var rightWindowEnd:int; |
| 44 | + private var rightN:int; |
| 45 | + |
| 46 | + private var window:Vector.<Number>; |
| 47 | + private var freq0:Vector.<Number>; |
| 48 | + private var freq1:Vector.<Number>; |
| 49 | + private var pcm0:Vector.<Number>; |
| 50 | + private var pcm1:Vector.<Number>; |
| 51 | + |
| 52 | + private var channelFloors:Vector.<Floor>; |
| 53 | + private var noResidues:Vector.<Boolean>; |
| 54 | + |
| 55 | + private var _lastPacket: Boolean; |
| 56 | + private var _lastGranulePosition: int; |
| 57 | + |
| 58 | + public function AudioPacket(vorbis:VorbisStream, packet: OggPacket, currentGranulePosition: int) { |
| 59 | + |
| 60 | + var source: BitByteArray = packet.data; |
| 61 | + _lastPacket = packet.lastPacket; |
| 62 | + _lastGranulePosition = packet.lastGranulePosition; |
| 63 | + |
| 64 | + var i:int; |
| 65 | + var j:int; |
| 66 | + var k:int; |
| 67 | + |
| 68 | + var sHeader:SetupHeader = vorbis.setupHeader; |
| 69 | + var iHeader:IdentificationHeader = vorbis.identificationHeader; |
| 70 | + var modes:Vector.<Mode> = sHeader.modes; |
| 71 | + var mappings:Vector.<Mapping> = sHeader.mappings; |
| 72 | + var residues:Vector.<Residue> = sHeader.residues; |
| 73 | + var channels:int = iHeader.channels; |
| 74 | + |
| 75 | + if (source.readUnsignedBitwiseInt(1) != 0) { |
| 76 | + throw new Error("Packet type mismatch when trying to create an audio packet."); |
| 77 | + } |
| 78 | + |
| 79 | + modeNumber = source.readUnsignedBitwiseInt(Util.ilog(modes.length - 1)); |
| 80 | + |
| 81 | + mode = modes[modeNumber]; |
| 82 | + |
| 83 | + if(mode == null) { |
| 84 | + throw new Error("Reference to invalid mode in audio packet."); |
| 85 | + } |
| 86 | + |
| 87 | + mapping = mappings[mode.mapping]; |
| 88 | + |
| 89 | + var magnitudes:Vector.<int> = mapping.magnitudes; |
| 90 | + var angles:Vector.<int> = mapping.angles; |
| 91 | + |
| 92 | + blockFlag = mode.blockFlag; |
| 93 | + |
| 94 | + var blockSize0:int = iHeader.blockSize0; |
| 95 | + var blockSize1:int = iHeader.blockSize1; |
| 96 | + |
| 97 | + n = blockFlag ? blockSize1 : blockSize0; |
| 98 | + |
| 99 | + if (blockFlag) { |
| 100 | + previousWindowFlag = source.readBit(); |
| 101 | + nextWindowFlag = source.readBit(); |
| 102 | + } |
| 103 | + |
| 104 | + windowCenter = n / 2; |
| 105 | + |
| 106 | + if (blockFlag && !previousWindowFlag) { |
| 107 | + leftWindowStart = n / 4 - blockSize0 / 4; |
| 108 | + leftWindowEnd = n / 4 + blockSize0 / 4; |
| 109 | + leftN = blockSize0 / 2; |
| 110 | + } else { |
| 111 | + leftWindowStart = 0; |
| 112 | + leftWindowEnd = n / 2; |
| 113 | + leftN = windowCenter; |
| 114 | + } |
| 115 | + |
| 116 | + if (blockFlag && !nextWindowFlag) { |
| 117 | + rightWindowStart = n * 3 / 4 - blockSize0 / 4; |
| 118 | + rightWindowEnd = n * 3 / 4 + blockSize0 / 4; |
| 119 | + rightN = blockSize0 / 2; |
| 120 | + } else { |
| 121 | + rightWindowStart = windowCenter; |
| 122 | + rightWindowEnd = n; |
| 123 | + rightN = n / 2; |
| 124 | + } |
| 125 | + |
| 126 | + window = getComputedWindow(vorbis); |
| 127 | + |
| 128 | + channelFloors = new Vector.<Floor>(channels, true); |
| 129 | + noResidues = new Vector.<Boolean>(channels, true); |
| 130 | + |
| 131 | + freq0 = new Vector.<Number>(n, true); |
| 132 | + freq1 = new Vector.<Number>(n, true); |
| 133 | + pcm0 = new Vector.<Number>(n, true); |
| 134 | + pcm1 = new Vector.<Number>(n, true); |
| 135 | + |
| 136 | + var allFloorsEmpty: Boolean = true; |
| 137 | + var submapNumber: int; |
| 138 | + var floorNumber: int; |
| 139 | + var decodedFloor: Floor; |
| 140 | + |
| 141 | + for(i = 0; i < channels; i++) { |
| 142 | + submapNumber = mapping.mux[i]; |
| 143 | + floorNumber = mapping.submapFloors[submapNumber]; |
| 144 | + decodedFloor = sHeader.floors[floorNumber].decodeFloor(vorbis, source); |
| 145 | + channelFloors[i] = decodedFloor; |
| 146 | + noResidues[i] = decodedFloor == null; |
| 147 | + if (decodedFloor != null) { |
| 148 | + allFloorsEmpty = false; |
| 149 | + } |
| 150 | + } |
| 151 | + |
| 152 | + if(allFloorsEmpty) { |
| 153 | + return; |
| 154 | + } |
| 155 | + |
| 156 | + var mag: int; |
| 157 | + var ang: int; |
| 158 | + |
| 159 | + for(i = 0; i < magnitudes.length; i++) { |
| 160 | + mag = magnitudes[i]; |
| 161 | + ang = angles[i]; |
| 162 | + if (!noResidues[mag] || !noResidues[ang]) { |
| 163 | + noResidues[mag] = false; |
| 164 | + noResidues[ang] = false; |
| 165 | + } |
| 166 | + } |
| 167 | + |
| 168 | + var ch: int; |
| 169 | + var doNotDecodeFlags: Vector.<Boolean>; |
| 170 | + var residue:Residue; |
| 171 | + |
| 172 | + for(i = 0; i < mapping.submaps; i++) { |
| 173 | + |
| 174 | + doNotDecodeFlags = new Vector.<Boolean>(); |
| 175 | + |
| 176 | + for(j = 0; j < channels; j++) { |
| 177 | + if(mapping.mux[j] == i) { |
| 178 | + doNotDecodeFlags.push(noResidues[j]); |
| 179 | + } |
| 180 | + } |
| 181 | + |
| 182 | + residue = residues[mapping.submapResidues[i]]; |
| 183 | + |
| 184 | + residue.decodeResidue(vorbis, source, mode, ch, doNotDecodeFlags, freq0, freq1); |
| 185 | + } |
| 186 | + |
| 187 | + var a: Number; |
| 188 | + var m: Number; |
| 189 | + |
| 190 | + for(i = mapping.couplingSteps - 1; i >= 0; i--) { |
| 191 | + |
| 192 | + mag = magnitudes[i]; |
| 193 | + ang = angles[i]; |
| 194 | + |
| 195 | + for (j = 0; j < freq0.length; j++) { |
| 196 | + |
| 197 | + a = ang == 0 ? freq0[j] : freq1[j]; |
| 198 | + m = mag == 0 ? freq0[j] : freq1[j]; |
| 199 | + |
| 200 | + if(a > 0) { |
| 201 | + if(ang == 0) { |
| 202 | + freq0[j] = m > 0 ? m - a : m + a; |
| 203 | + } |
| 204 | + else { |
| 205 | + freq1[j] = m > 0 ? m - a : m + a; |
| 206 | + } |
| 207 | + } |
| 208 | + else { |
| 209 | + if(mag == 0) { |
| 210 | + freq0[j] = m > 0 ? m + a : m - a; |
| 211 | + } |
| 212 | + else { |
| 213 | + freq1[j] = m > 0 ? m + a : m - a; |
| 214 | + } |
| 215 | + |
| 216 | + if(ang == 0) { |
| 217 | + freq0[j] = m; |
| 218 | + } |
| 219 | + else { |
| 220 | + freq1[j] = m; |
| 221 | + } |
| 222 | + } |
| 223 | + } |
| 224 | + } |
| 225 | + |
| 226 | + if(channelFloors[0] != null) { |
| 227 | + Floor(channelFloors[0]).computeFloor(freq0); |
| 228 | + } |
| 229 | + |
| 230 | + if(channelFloors[1] != null) { |
| 231 | + Floor(channelFloors[1]).computeFloor(freq1); |
| 232 | + } |
| 233 | + |
| 234 | + // perform an inverse mdct to all channels |
| 235 | + var mdct: Mdct = blockFlag ? iHeader.mdct1 : iHeader.mdct0; |
| 236 | + mdct.imdct(freq0, window, pcm0); |
| 237 | + mdct.imdct(freq1, window, pcm1); |
| 238 | + |
| 239 | + if(_lastPacket) { |
| 240 | + if(leftWindowEnd - leftWindowStart > _lastGranulePosition - currentGranulePosition) { |
| 241 | + leftWindowEnd = leftWindowStart + _lastGranulePosition - currentGranulePosition |
| 242 | + } |
| 243 | + if(rightWindowStart - leftWindowStart > _lastGranulePosition - currentGranulePosition) { |
| 244 | + rightWindowStart = leftWindowStart + _lastGranulePosition - currentGranulePosition |
| 245 | + } |
| 246 | + } |
| 247 | + |
| 248 | + } |
| 249 | + |
| 250 | + private function getComputedWindow(vorbis:VorbisStream):Vector.<Number> { |
| 251 | + |
| 252 | + var i:int; |
| 253 | + |
| 254 | + var ix:int = (blockFlag ? 4 : 0) + (previousWindowFlag ? 2 : 0) + (nextWindowFlag ? 1 : 0); |
| 255 | + var w:Vector.<Number> = vorbis.windows[ix]; |
| 256 | + |
| 257 | + var x:Number; |
| 258 | + |
| 259 | + if (w == null) { |
| 260 | + w = new Vector.<Number>(n); |
| 261 | + |
| 262 | + for(i = 0; i < leftWindowStart; i++) { |
| 263 | + w[i] = 0; |
| 264 | + } |
| 265 | + |
| 266 | + for (i = 0; i < leftN; i++) { |
| 267 | + x = (i + .5) / leftN * Math.PI / 2.; |
| 268 | + x = Math.sin(x); |
| 269 | + x *= x; |
| 270 | + x *= Math.PI / 2.; |
| 271 | + x = Math.sin(x); |
| 272 | + w[i + leftWindowStart] = x; |
| 273 | + } |
| 274 | + |
| 275 | + for (i = leftWindowEnd; i < rightWindowStart; i++) { |
| 276 | + w[i] = 1; |
| 277 | + } |
| 278 | + |
| 279 | + for (i = 0; i < rightN; i++) { |
| 280 | + x = (rightN - i - .5) / rightN * Math.PI / 2.; |
| 281 | + x = Math.sin(x); |
| 282 | + x *= x; |
| 283 | + x *= Math.PI / 2.; |
| 284 | + x = Math.sin(x); |
| 285 | + w[i + rightWindowStart] = x; |
| 286 | + } |
| 287 | + |
| 288 | + for(i = rightN + rightWindowStart; i < n; i++) { |
| 289 | + w[i] = 0; |
| 290 | + } |
| 291 | + |
| 292 | + for(i = 0; i < w.length; i++) { |
| 293 | + w[i] *= 0.5; |
| 294 | + } |
| 295 | + |
| 296 | + vorbis.windows[ix] = w; |
| 297 | + } |
| 298 | + |
| 299 | + return w; |
| 300 | + } |
| 301 | + |
| 302 | + |
| 303 | + public function readPcm(previousPacket:AudioPacket, target: ByteArray): int { |
| 304 | + |
| 305 | + var j:int; |
| 306 | + var j2:int; |
| 307 | + var ppcm0:Vector.<Number> = previousPacket.pcm0; |
| 308 | + var ppcm1:Vector.<Number> = previousPacket.pcm1; |
| 309 | + |
| 310 | + j2 = previousPacket.rightWindowStart; |
| 311 | + |
| 312 | + for(j = leftWindowStart; j < leftWindowEnd; j++) { |
| 313 | + target.writeFloat(pcm0[j] + ppcm0[j2]); |
| 314 | + target.writeFloat(pcm1[j] + ppcm1[j2++]); |
| 315 | + } |
| 316 | + |
| 317 | + for (j = leftWindowEnd; j < rightWindowStart; j++) { |
| 318 | + target.writeFloat(pcm0[j]); |
| 319 | + target.writeFloat(pcm1[j]); |
| 320 | + } |
| 321 | + |
| 322 | + return numberOfSamples; |
| 323 | + |
| 324 | + } |
| 325 | + |
| 326 | + public function get numberOfSamples():int { |
| 327 | + return rightWindowStart - leftWindowStart; |
| 328 | + } |
| 329 | + |
| 330 | + public function get lastPacket(): Boolean { |
| 331 | + return lastPacket; |
| 332 | + } |
| 333 | + |
| 334 | + public function get lastGranulePosition(): int { |
| 335 | + return lastGranulePosition; |
| 336 | + } |
| 337 | + |
| 338 | + } |
| 339 | + |
| 340 | + |
341 | 341 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/AudioPacket.as |
___________________________________________________________________ |
Added: svn:eol-style |
342 | 342 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as |
— | — | @@ -1,73 +1,73 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.BitByteArray;
|
24 | | -
|
25 | | - public class Mapping {
|
26 | | -
|
27 | | - public static function createInstance(stream:VorbisStream, source:BitByteArray, header:SetupHeader):Mapping {
|
28 | | -
|
29 | | - var type:int = source.readUnsignedBitwiseInt(16);
|
30 | | - switch (type) {
|
31 | | - case 0:
|
32 | | - return new Mapping0(stream, source, header);
|
33 | | - default:
|
34 | | - throw new Error("Mapping type " + type + " is not supported.");
|
35 | | - }
|
36 | | -
|
37 | | - }
|
38 | | -
|
39 | | - public function get type():int {
|
40 | | - throw new IllegalOperationError("not implemented");
|
41 | | - }
|
42 | | -
|
43 | | - public function get couplingSteps():int {
|
44 | | - throw new IllegalOperationError("not implemented");
|
45 | | - }
|
46 | | -
|
47 | | - public function get submaps():int {
|
48 | | - throw new IllegalOperationError("not implemented");
|
49 | | - }
|
50 | | -
|
51 | | - public function get angles():Vector.<int> {
|
52 | | - throw new IllegalOperationError("not implemented");
|
53 | | - }
|
54 | | -
|
55 | | - public function get magnitudes():Vector.<int> {
|
56 | | - throw new IllegalOperationError("not implemented");
|
57 | | - }
|
58 | | -
|
59 | | - public function get mux():Vector.<int> {
|
60 | | - throw new IllegalOperationError("not implemented");
|
61 | | - }
|
62 | | -
|
63 | | - public function get submapFloors():Vector.<int> {
|
64 | | - throw new IllegalOperationError("not implemented");
|
65 | | - }
|
66 | | -
|
67 | | - public function get submapResidues():Vector.<int> {
|
68 | | - throw new IllegalOperationError("not implemented");
|
69 | | - }
|
70 | | -
|
71 | | -
|
72 | | - }
|
73 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.BitByteArray; |
| 24 | + |
| 25 | + public class Mapping { |
| 26 | + |
| 27 | + public static function createInstance(stream:VorbisStream, source:BitByteArray, header:SetupHeader):Mapping { |
| 28 | + |
| 29 | + var type:int = source.readUnsignedBitwiseInt(16); |
| 30 | + switch (type) { |
| 31 | + case 0: |
| 32 | + return new Mapping0(stream, source, header); |
| 33 | + default: |
| 34 | + throw new Error("Mapping type " + type + " is not supported."); |
| 35 | + } |
| 36 | + |
| 37 | + } |
| 38 | + |
| 39 | + public function get type():int { |
| 40 | + throw new IllegalOperationError("not implemented"); |
| 41 | + } |
| 42 | + |
| 43 | + public function get couplingSteps():int { |
| 44 | + throw new IllegalOperationError("not implemented"); |
| 45 | + } |
| 46 | + |
| 47 | + public function get submaps():int { |
| 48 | + throw new IllegalOperationError("not implemented"); |
| 49 | + } |
| 50 | + |
| 51 | + public function get angles():Vector.<int> { |
| 52 | + throw new IllegalOperationError("not implemented"); |
| 53 | + } |
| 54 | + |
| 55 | + public function get magnitudes():Vector.<int> { |
| 56 | + throw new IllegalOperationError("not implemented"); |
| 57 | + } |
| 58 | + |
| 59 | + public function get mux():Vector.<int> { |
| 60 | + throw new IllegalOperationError("not implemented"); |
| 61 | + } |
| 62 | + |
| 63 | + public function get submapFloors():Vector.<int> { |
| 64 | + throw new IllegalOperationError("not implemented"); |
| 65 | + } |
| 66 | + |
| 67 | + public function get submapResidues():Vector.<int> { |
| 68 | + throw new IllegalOperationError("not implemented"); |
| 69 | + } |
| 70 | + |
| 71 | + |
| 72 | + } |
| 73 | + |
74 | 74 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping.as |
___________________________________________________________________ |
Added: svn:eol-style |
75 | 75 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as |
— | — | @@ -1,142 +1,142 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import flash.utils.Dictionary;
|
24 | | - import org.omtk.util.BitByteArray;
|
25 | | -
|
26 | | - public class Residue {
|
27 | | -
|
28 | | - private var _begin:int;
|
29 | | - private var _end:int;
|
30 | | - private var _partitionSize:int;
|
31 | | - private var _classifications:int;
|
32 | | - private var _classBook:int;
|
33 | | - private var _cascade:Vector.<int>;
|
34 | | - private var _books:Vector.<Vector.<int>>;
|
35 | | -
|
36 | | - private var _looks:Dictionary;
|
37 | | -
|
38 | | -
|
39 | | - public function Residue(source:BitByteArray, header:SetupHeader) {
|
40 | | -
|
41 | | - _begin = source.readUnsignedBitwiseInt(24);
|
42 | | - _end = source.readUnsignedBitwiseInt(24);
|
43 | | - _partitionSize = source.readUnsignedBitwiseInt(24) + 1;
|
44 | | - _classifications = source.readUnsignedBitwiseInt(6) + 1;
|
45 | | - _classBook = source.readUnsignedBitwiseInt(8);
|
46 | | -
|
47 | | - _cascade = new Vector.<int>(classifications);
|
48 | | -
|
49 | | - var acc:int = 0;
|
50 | | - var i:int;
|
51 | | - var j:int;
|
52 | | -
|
53 | | - for (i = 0; i < classifications; i++) {
|
54 | | - var highBits:int = 0;
|
55 | | - var lowBits:int = 0;
|
56 | | -
|
57 | | - lowBits = source.readUnsignedBitwiseInt(3);
|
58 | | - if (source.readBit()) {
|
59 | | - highBits = source.readUnsignedBitwiseInt(5);
|
60 | | - }
|
61 | | - _cascade[i] = (highBits << 3) | lowBits;
|
62 | | - acc += Util.icount(cascade[i]);
|
63 | | - }
|
64 | | -
|
65 | | - _books = new Vector.<Vector.<int>>(classifications);
|
66 | | -
|
67 | | - for (i = 0; i < classifications; i++) {
|
68 | | - books[i] = new Vector.<int>(8);
|
69 | | - for (j = 0; j < 8; j++) {
|
70 | | - if ((cascade[i] & (1 << j)) != 0) {
|
71 | | - books[i][j] = source.readUnsignedBitwiseInt(8);
|
72 | | - if (books[i][j] > header.codeBooks.length) {
|
73 | | - throw new Error(
|
74 | | - "Reference to invalid codebook entry in residue header.");
|
75 | | - }
|
76 | | - }
|
77 | | - }
|
78 | | - }
|
79 | | -
|
80 | | - _looks = new Dictionary();
|
81 | | - }
|
82 | | -
|
83 | | - public static function createInstance(source:BitByteArray, header:SetupHeader):Residue {
|
84 | | -
|
85 | | - var type:int = source.readUnsignedBitwiseInt(16);
|
86 | | - switch (type) {
|
87 | | - case 2:
|
88 | | - return new Residue2(source, header);
|
89 | | - default:
|
90 | | - throw new Error("Residue type " + type + " is not supported.");
|
91 | | - }
|
92 | | - }
|
93 | | -
|
94 | | - public function decodeResidue(
|
95 | | - vorbis:VorbisStream, source:BitByteArray,
|
96 | | - mode:Mode, ch:int,
|
97 | | - doNotDecodeFlags:Vector.<Boolean>, vectors0:Vector.<Number>, vectors1:Vector.<Number>):void {
|
98 | | -
|
99 | | - throw new IllegalOperationError("not implemented");
|
100 | | - }
|
101 | | -
|
102 | | -
|
103 | | - public function getLook(stream:VorbisStream, key:Mode):Look {
|
104 | | - var look:Look = _looks[key];
|
105 | | - if (look == null) {
|
106 | | - look = new Look(stream, this, key);
|
107 | | - _looks[key] = look;
|
108 | | - }
|
109 | | - return new Look(stream, this, key);//look;
|
110 | | - }
|
111 | | -
|
112 | | -
|
113 | | - public function get begin():int {
|
114 | | - return _begin;
|
115 | | - }
|
116 | | -
|
117 | | - public function get end():int {
|
118 | | - return _end;
|
119 | | - }
|
120 | | -
|
121 | | - public function get partitionSize():int {
|
122 | | - return _partitionSize;
|
123 | | - }
|
124 | | -
|
125 | | - public function get classifications():int {
|
126 | | - return _classifications;
|
127 | | - }
|
128 | | -
|
129 | | - public function get classBook():int {
|
130 | | - return _classBook;
|
131 | | - }
|
132 | | -
|
133 | | - public function get cascade():Vector.<int> {
|
134 | | - return _cascade;
|
135 | | - }
|
136 | | -
|
137 | | - public function get books():Vector.<Vector.<int>> {
|
138 | | - return _books;
|
139 | | - }
|
140 | | -
|
141 | | - }
|
142 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import flash.utils.Dictionary; |
| 24 | + import org.omtk.util.BitByteArray; |
| 25 | + |
| 26 | + public class Residue { |
| 27 | + |
| 28 | + private var _begin:int; |
| 29 | + private var _end:int; |
| 30 | + private var _partitionSize:int; |
| 31 | + private var _classifications:int; |
| 32 | + private var _classBook:int; |
| 33 | + private var _cascade:Vector.<int>; |
| 34 | + private var _books:Vector.<Vector.<int>>; |
| 35 | + |
| 36 | + private var _looks:Dictionary; |
| 37 | + |
| 38 | + |
| 39 | + public function Residue(source:BitByteArray, header:SetupHeader) { |
| 40 | + |
| 41 | + _begin = source.readUnsignedBitwiseInt(24); |
| 42 | + _end = source.readUnsignedBitwiseInt(24); |
| 43 | + _partitionSize = source.readUnsignedBitwiseInt(24) + 1; |
| 44 | + _classifications = source.readUnsignedBitwiseInt(6) + 1; |
| 45 | + _classBook = source.readUnsignedBitwiseInt(8); |
| 46 | + |
| 47 | + _cascade = new Vector.<int>(classifications); |
| 48 | + |
| 49 | + var acc:int = 0; |
| 50 | + var i:int; |
| 51 | + var j:int; |
| 52 | + |
| 53 | + for (i = 0; i < classifications; i++) { |
| 54 | + var highBits:int = 0; |
| 55 | + var lowBits:int = 0; |
| 56 | + |
| 57 | + lowBits = source.readUnsignedBitwiseInt(3); |
| 58 | + if (source.readBit()) { |
| 59 | + highBits = source.readUnsignedBitwiseInt(5); |
| 60 | + } |
| 61 | + _cascade[i] = (highBits << 3) | lowBits; |
| 62 | + acc += Util.icount(cascade[i]); |
| 63 | + } |
| 64 | + |
| 65 | + _books = new Vector.<Vector.<int>>(classifications); |
| 66 | + |
| 67 | + for (i = 0; i < classifications; i++) { |
| 68 | + books[i] = new Vector.<int>(8); |
| 69 | + for (j = 0; j < 8; j++) { |
| 70 | + if ((cascade[i] & (1 << j)) != 0) { |
| 71 | + books[i][j] = source.readUnsignedBitwiseInt(8); |
| 72 | + if (books[i][j] > header.codeBooks.length) { |
| 73 | + throw new Error( |
| 74 | + "Reference to invalid codebook entry in residue header."); |
| 75 | + } |
| 76 | + } |
| 77 | + } |
| 78 | + } |
| 79 | + |
| 80 | + _looks = new Dictionary(); |
| 81 | + } |
| 82 | + |
| 83 | + public static function createInstance(source:BitByteArray, header:SetupHeader):Residue { |
| 84 | + |
| 85 | + var type:int = source.readUnsignedBitwiseInt(16); |
| 86 | + switch (type) { |
| 87 | + case 2: |
| 88 | + return new Residue2(source, header); |
| 89 | + default: |
| 90 | + throw new Error("Residue type " + type + " is not supported."); |
| 91 | + } |
| 92 | + } |
| 93 | + |
| 94 | + public function decodeResidue( |
| 95 | + vorbis:VorbisStream, source:BitByteArray, |
| 96 | + mode:Mode, ch:int, |
| 97 | + doNotDecodeFlags:Vector.<Boolean>, vectors0:Vector.<Number>, vectors1:Vector.<Number>):void { |
| 98 | + |
| 99 | + throw new IllegalOperationError("not implemented"); |
| 100 | + } |
| 101 | + |
| 102 | + |
| 103 | + public function getLook(stream:VorbisStream, key:Mode):Look { |
| 104 | + var look:Look = _looks[key]; |
| 105 | + if (look == null) { |
| 106 | + look = new Look(stream, this, key); |
| 107 | + _looks[key] = look; |
| 108 | + } |
| 109 | + return new Look(stream, this, key);//look; |
| 110 | + } |
| 111 | + |
| 112 | + |
| 113 | + public function get begin():int { |
| 114 | + return _begin; |
| 115 | + } |
| 116 | + |
| 117 | + public function get end():int { |
| 118 | + return _end; |
| 119 | + } |
| 120 | + |
| 121 | + public function get partitionSize():int { |
| 122 | + return _partitionSize; |
| 123 | + } |
| 124 | + |
| 125 | + public function get classifications():int { |
| 126 | + return _classifications; |
| 127 | + } |
| 128 | + |
| 129 | + public function get classBook():int { |
| 130 | + return _classBook; |
| 131 | + } |
| 132 | + |
| 133 | + public function get cascade():Vector.<int> { |
| 134 | + return _cascade; |
| 135 | + } |
| 136 | + |
| 137 | + public function get books():Vector.<Vector.<int>> { |
| 138 | + return _books; |
| 139 | + } |
| 140 | + |
| 141 | + } |
| 142 | + |
143 | 143 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Residue.as |
___________________________________________________________________ |
Added: svn:eol-style |
144 | 144 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as |
— | — | @@ -1,56 +1,56 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.BitByteArray;
|
24 | | -
|
25 | | - public class Floor0 extends Floor {
|
26 | | -
|
27 | | - private var order:int;
|
28 | | - private var rate:int;
|
29 | | - private var barkMapSize:int;
|
30 | | - private var amplitudeBits:int;
|
31 | | - private var amplitudeOffset:int;
|
32 | | -
|
33 | | - private var bookList:Vector.<int>;
|
34 | | -
|
35 | | - public function Floor0(source:BitByteArray, header:SetupHeader) {
|
36 | | -
|
37 | | - order = source.readUnsignedBitwiseInt(8);
|
38 | | - rate = source.readUnsignedBitwiseInt(16);
|
39 | | - barkMapSize = source.readUnsignedBitwiseInt(16);
|
40 | | - amplitudeBits = source.readUnsignedBitwiseInt(6);
|
41 | | - amplitudeOffset = source.readUnsignedBitwiseInt(8);
|
42 | | -
|
43 | | - var bookCount:uint = source.readUnsignedBitwiseInt(4) + 1;
|
44 | | - bookList = new Vector.<int>(bookCount);
|
45 | | -
|
46 | | - var i:int;
|
47 | | -
|
48 | | - for (i = 0; i < bookList.length; i++) {
|
49 | | - bookList[i] = source.readUnsignedBitwiseInt(8);
|
50 | | - if (bookList[i] > header.codeBooks.length) {
|
51 | | - throw new Error("A floor0_book_list entry is higher than the code book count.");
|
52 | | - }
|
53 | | - }
|
54 | | - }
|
55 | | -
|
56 | | - }
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.BitByteArray; |
| 24 | + |
| 25 | + public class Floor0 extends Floor { |
| 26 | + |
| 27 | + private var order:int; |
| 28 | + private var rate:int; |
| 29 | + private var barkMapSize:int; |
| 30 | + private var amplitudeBits:int; |
| 31 | + private var amplitudeOffset:int; |
| 32 | + |
| 33 | + private var bookList:Vector.<int>; |
| 34 | + |
| 35 | + public function Floor0(source:BitByteArray, header:SetupHeader) { |
| 36 | + |
| 37 | + order = source.readUnsignedBitwiseInt(8); |
| 38 | + rate = source.readUnsignedBitwiseInt(16); |
| 39 | + barkMapSize = source.readUnsignedBitwiseInt(16); |
| 40 | + amplitudeBits = source.readUnsignedBitwiseInt(6); |
| 41 | + amplitudeOffset = source.readUnsignedBitwiseInt(8); |
| 42 | + |
| 43 | + var bookCount:uint = source.readUnsignedBitwiseInt(4) + 1; |
| 44 | + bookList = new Vector.<int>(bookCount); |
| 45 | + |
| 46 | + var i:int; |
| 47 | + |
| 48 | + for (i = 0; i < bookList.length; i++) { |
| 49 | + bookList[i] = source.readUnsignedBitwiseInt(8); |
| 50 | + if (bookList[i] > header.codeBooks.length) { |
| 51 | + throw new Error("A floor0_book_list entry is higher than the code book count."); |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + } |
57 | 57 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor0.as |
___________________________________________________________________ |
Added: svn:eol-style |
58 | 58 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as |
— | — | @@ -1,278 +1,278 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.*;
|
24 | | -
|
25 | | - public class Floor1 extends Floor {
|
26 | | -
|
27 | | - private var partitionClassList:Vector.<int>;
|
28 | | - private var maximumClass:int;
|
29 | | - private var multiplier:int;
|
30 | | - private var rangeBits:int;
|
31 | | - private var classDimensions:Vector.<int>;
|
32 | | - private var classSubclasses:Vector.<int>;
|
33 | | - private var classMasterbooks:Vector.<int>;
|
34 | | - private var subclassBooks:Vector.<Vector.<int>>;
|
35 | | - private var xList:Vector.<int>;
|
36 | | - private var yList:Vector.<int>;
|
37 | | - private var lowNeighbours:Vector.<int>;
|
38 | | - private var highNeighbours:Vector.<int>;
|
39 | | - private static var RANGES:Vector.<int> = Vector.<int>([256, 128, 86, 64]);
|
40 | | -
|
41 | | - private var xList2:Vector.<int>;
|
42 | | - private var step2Flags:Vector.<Boolean>;
|
43 | | -
|
44 | | - public function Floor1(source:BitByteArray = null, header:SetupHeader = null) {
|
45 | | -
|
46 | | - if(source==null && header==null) {
|
47 | | - return;
|
48 | | - }
|
49 | | -
|
50 | | - var i:int;
|
51 | | - var j:int;
|
52 | | -
|
53 | | - maximumClass = -1;
|
54 | | - var partitions:int = source.readUnsignedBitwiseInt(5);
|
55 | | - partitionClassList = new Vector.<int>(partitions);
|
56 | | -
|
57 | | - for (i = 0; i < partitionClassList.length; i++) {
|
58 | | - partitionClassList[i] = source.readUnsignedBitwiseInt(4);
|
59 | | - if (partitionClassList[i] > maximumClass) {
|
60 | | - maximumClass = partitionClassList[i];
|
61 | | - }
|
62 | | - }
|
63 | | -
|
64 | | - classDimensions = new Vector.<int>(maximumClass + 1);
|
65 | | - classSubclasses = new Vector.<int>(maximumClass + 1);
|
66 | | - classMasterbooks = new Vector.<int>(maximumClass + 1);
|
67 | | - subclassBooks = new Vector.<Vector.<int>>(maximumClass + 1);
|
68 | | -
|
69 | | - var xListLength:int = 2;
|
70 | | -
|
71 | | - for (i = 0; i <= maximumClass; i++) {
|
72 | | - classDimensions[i] = source.readUnsignedBitwiseInt(3) + 1;
|
73 | | - xListLength += classDimensions[i];
|
74 | | - classSubclasses[i] = source.readUnsignedBitwiseInt(2);
|
75 | | -
|
76 | | - if (classDimensions[i] > header.codeBooks.length || classSubclasses[i] > header.codeBooks.length) {
|
77 | | - throw new Error("There is a class dimension or class subclasses entry higher than the number of codebooks in the setup header.");
|
78 | | - }
|
79 | | - if (classSubclasses[i] != 0) {
|
80 | | - classMasterbooks[i] = source.readUnsignedBitwiseInt(8);
|
81 | | - }
|
82 | | - subclassBooks[i] = new Vector.<int>(1 << classSubclasses[i]);
|
83 | | - for (j = 0; j < subclassBooks[i].length; j++) {
|
84 | | - subclassBooks[i][j] = source.readUnsignedBitwiseInt(8) - 1;
|
85 | | - }
|
86 | | - }
|
87 | | -
|
88 | | - multiplier = source.readUnsignedBitwiseInt(2) + 1;
|
89 | | - rangeBits = source.readUnsignedBitwiseInt(4);
|
90 | | -
|
91 | | - var floorValues:int = 0;
|
92 | | -
|
93 | | - xList = Vector.<int>([0, 1<<rangeBits]);
|
94 | | -
|
95 | | - for (i = 0; i < partitions; i++) {
|
96 | | - for (j = 0; j < classDimensions[partitionClassList[i]]; j++) {
|
97 | | - xList.push(source.readUnsignedBitwiseInt(rangeBits));
|
98 | | - }
|
99 | | - }
|
100 | | -
|
101 | | - lowNeighbours = new Vector.<int>(xList.length);
|
102 | | - highNeighbours = new Vector.<int>(xList.length);
|
103 | | -
|
104 | | - for (i = 0; i < xList.length; i++) {
|
105 | | - lowNeighbours[i] = Util.lowNeighbour(xList, i);
|
106 | | - highNeighbours[i] = Util.highNeighbour(xList, i);
|
107 | | - }
|
108 | | -
|
109 | | - xList2 = new Vector.<int>(xList.length, true);
|
110 | | - step2Flags = new Vector.<Boolean>(xList.length, true);
|
111 | | - }
|
112 | | -
|
113 | | - public override function get type():int {
|
114 | | - return 1;
|
115 | | - }
|
116 | | -
|
117 | | - public override function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 {
|
118 | | -
|
119 | | - var i:int;
|
120 | | - var j:int;
|
121 | | - var offset:int;
|
122 | | -
|
123 | | - if (!source.readBit()) {
|
124 | | - return null;
|
125 | | - }
|
126 | | -
|
127 | | - var clone:Floor1 = clone();
|
128 | | -
|
129 | | - clone.yList = new Vector.<int>(xList.length);
|
130 | | -
|
131 | | - var range:int = RANGES[multiplier - 1];
|
132 | | -
|
133 | | - clone.yList[0] = source.readUnsignedBitwiseInt(Util.ilog(range - 1));
|
134 | | - clone.yList[1] = source.readUnsignedBitwiseInt(Util.ilog(range - 1));
|
135 | | -
|
136 | | - offset = 2;
|
137 | | -
|
138 | | - for (i = 0; i < partitionClassList.length; i++) {
|
139 | | - var cls:int = partitionClassList[i];
|
140 | | - var cdim:int = classDimensions[cls];
|
141 | | - var cbits:int = classSubclasses[cls];
|
142 | | - var csub:int = (1 << cbits) - 1;
|
143 | | - var cval:int = 0;
|
144 | | - if (cbits > 0) {
|
145 | | - cval = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[classMasterbooks[cls]].huffmanRoot);
|
146 | | - }
|
147 | | -
|
148 | | - for (j = 0; j < cdim; j++) {
|
149 | | - var book:int = subclassBooks[cls][cval & csub];
|
150 | | - cval >>>= cbits;
|
151 | | - if (book >= 0) {
|
152 | | - clone.yList[j + offset] = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[book].huffmanRoot);
|
153 | | - } else {
|
154 | | - clone.yList[j + offset] = 0;
|
155 | | - }
|
156 | | - }
|
157 | | - offset += cdim;
|
158 | | - }
|
159 | | -
|
160 | | - return clone;
|
161 | | - }
|
162 | | -
|
163 | | - public override function computeFloor(vector:Vector.<Number>):void {
|
164 | | -
|
165 | | - var i:int;
|
166 | | - var j:int;
|
167 | | -
|
168 | | - var n:int = vector.length;
|
169 | | - var values:int = xList.length;
|
170 | | - //var step2Flags:Vector.<Boolean> = new Vector.<Boolean>(values);
|
171 | | -
|
172 | | - var range:int = RANGES[multiplier - 1];
|
173 | | -
|
174 | | - for (i = 2; i < values; i++) {
|
175 | | -
|
176 | | - var lowNeighbourOffset:int = lowNeighbours[i];
|
177 | | - var highNeighbourOffset:int = highNeighbours[i];
|
178 | | -
|
179 | | - var predicted:int = Util.renderPoint(
|
180 | | - xList[lowNeighbourOffset], xList[highNeighbourOffset],
|
181 | | - yList[lowNeighbourOffset], yList[highNeighbourOffset], xList[i]);
|
182 | | -
|
183 | | - var val:int = yList[i];
|
184 | | - var highRoom:int = range - predicted;
|
185 | | - var lowRoom:int = predicted;
|
186 | | - var room:int = highRoom < lowRoom ? highRoom * 2 : lowRoom * 2;
|
187 | | -
|
188 | | - if (val != 0) {
|
189 | | - step2Flags[lowNeighbourOffset] = true;
|
190 | | - step2Flags[highNeighbourOffset] = true;
|
191 | | - step2Flags[i] = true;
|
192 | | - if (val >= room) {
|
193 | | - yList[i] = highRoom > lowRoom ? val - lowRoom + predicted
|
194 | | - : -val + highRoom + predicted - 1;
|
195 | | - } else {
|
196 | | - yList[i] = (val & 1) == 1 ? predicted - ((val + 1) >> 1)
|
197 | | - : predicted + (val >> 1);
|
198 | | - }
|
199 | | - } else {
|
200 | | - step2Flags[i] = false;
|
201 | | - yList[i] = predicted;
|
202 | | - }
|
203 | | - }
|
204 | | -
|
205 | | - for(i=0; i<xList.length; i++) {
|
206 | | - xList2[i] = xList[i];
|
207 | | - }
|
208 | | -
|
209 | | - sort(xList2, yList, step2Flags);
|
210 | | -
|
211 | | - var hx:int = 0;
|
212 | | - var hy:int = 0;
|
213 | | - var lx:int = 0;
|
214 | | - var ly:int = yList[0] * multiplier;
|
215 | | -
|
216 | | - for (i = 1; i < values; i++) {
|
217 | | - if (step2Flags[i]) {
|
218 | | - hy = yList[i] * multiplier;
|
219 | | - hx = xList2[i];
|
220 | | - Util.renderLine(lx, ly, hx, hy, vector);
|
221 | | - lx = hx;
|
222 | | - ly = hy;
|
223 | | - }
|
224 | | - }
|
225 | | -
|
226 | | - var r:Number = DB_STATIC_TABLE[hy];
|
227 | | -
|
228 | | - while(hx < n/2) {
|
229 | | - vector[hx++] = r;
|
230 | | - }
|
231 | | -
|
232 | | - }
|
233 | | -
|
234 | | - public function clone():Floor1 {
|
235 | | - var clone:Floor1 = new Floor1();
|
236 | | - clone.classDimensions = classDimensions;
|
237 | | - clone.classMasterbooks = classMasterbooks;
|
238 | | - clone.classSubclasses = classSubclasses;
|
239 | | - clone.maximumClass = maximumClass;
|
240 | | - clone.multiplier = multiplier;
|
241 | | - clone.partitionClassList = partitionClassList;
|
242 | | - clone.rangeBits = rangeBits;
|
243 | | - clone.subclassBooks = subclassBooks;
|
244 | | - clone.xList = xList;
|
245 | | - clone.yList = yList;
|
246 | | - clone.lowNeighbours = lowNeighbours;
|
247 | | - clone.highNeighbours = highNeighbours;
|
248 | | - clone.xList2 = xList2;
|
249 | | - clone.step2Flags = step2Flags;
|
250 | | - return clone;
|
251 | | - }
|
252 | | -
|
253 | | - private function sort(x:Vector.<int>, y:Vector.<int>, b:Vector.<Boolean>):void {
|
254 | | - var off:int = 0;
|
255 | | - var len:int = x.length;
|
256 | | - var lim:int = len + off;
|
257 | | - var itmp:int;
|
258 | | - var btmp:Boolean;
|
259 | | - var i:int;
|
260 | | - var j:int;
|
261 | | - // Insertion sort on smallest arrays
|
262 | | - for (i = off; i < lim; i++) {
|
263 | | - for (j = i; j > off && x[j - 1] > x[j]; j--) {
|
264 | | - itmp = x[j];
|
265 | | - x[j] = x[j - 1];
|
266 | | - x[j - 1] = itmp;
|
267 | | - itmp = y[j];
|
268 | | - y[j] = y[j - 1];
|
269 | | - y[j - 1] = itmp;
|
270 | | - btmp = b[j];
|
271 | | - b[j] = b[j - 1];
|
272 | | - b[j - 1] = btmp;
|
273 | | - }
|
274 | | - }
|
275 | | - }
|
276 | | -
|
277 | | - }
|
278 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.*; |
| 24 | + |
| 25 | + public class Floor1 extends Floor { |
| 26 | + |
| 27 | + private var partitionClassList:Vector.<int>; |
| 28 | + private var maximumClass:int; |
| 29 | + private var multiplier:int; |
| 30 | + private var rangeBits:int; |
| 31 | + private var classDimensions:Vector.<int>; |
| 32 | + private var classSubclasses:Vector.<int>; |
| 33 | + private var classMasterbooks:Vector.<int>; |
| 34 | + private var subclassBooks:Vector.<Vector.<int>>; |
| 35 | + private var xList:Vector.<int>; |
| 36 | + private var yList:Vector.<int>; |
| 37 | + private var lowNeighbours:Vector.<int>; |
| 38 | + private var highNeighbours:Vector.<int>; |
| 39 | + private static var RANGES:Vector.<int> = Vector.<int>([256, 128, 86, 64]); |
| 40 | + |
| 41 | + private var xList2:Vector.<int>; |
| 42 | + private var step2Flags:Vector.<Boolean>; |
| 43 | + |
| 44 | + public function Floor1(source:BitByteArray = null, header:SetupHeader = null) { |
| 45 | + |
| 46 | + if(source==null && header==null) { |
| 47 | + return; |
| 48 | + } |
| 49 | + |
| 50 | + var i:int; |
| 51 | + var j:int; |
| 52 | + |
| 53 | + maximumClass = -1; |
| 54 | + var partitions:int = source.readUnsignedBitwiseInt(5); |
| 55 | + partitionClassList = new Vector.<int>(partitions); |
| 56 | + |
| 57 | + for (i = 0; i < partitionClassList.length; i++) { |
| 58 | + partitionClassList[i] = source.readUnsignedBitwiseInt(4); |
| 59 | + if (partitionClassList[i] > maximumClass) { |
| 60 | + maximumClass = partitionClassList[i]; |
| 61 | + } |
| 62 | + } |
| 63 | + |
| 64 | + classDimensions = new Vector.<int>(maximumClass + 1); |
| 65 | + classSubclasses = new Vector.<int>(maximumClass + 1); |
| 66 | + classMasterbooks = new Vector.<int>(maximumClass + 1); |
| 67 | + subclassBooks = new Vector.<Vector.<int>>(maximumClass + 1); |
| 68 | + |
| 69 | + var xListLength:int = 2; |
| 70 | + |
| 71 | + for (i = 0; i <= maximumClass; i++) { |
| 72 | + classDimensions[i] = source.readUnsignedBitwiseInt(3) + 1; |
| 73 | + xListLength += classDimensions[i]; |
| 74 | + classSubclasses[i] = source.readUnsignedBitwiseInt(2); |
| 75 | + |
| 76 | + if (classDimensions[i] > header.codeBooks.length || classSubclasses[i] > header.codeBooks.length) { |
| 77 | + throw new Error("There is a class dimension or class subclasses entry higher than the number of codebooks in the setup header."); |
| 78 | + } |
| 79 | + if (classSubclasses[i] != 0) { |
| 80 | + classMasterbooks[i] = source.readUnsignedBitwiseInt(8); |
| 81 | + } |
| 82 | + subclassBooks[i] = new Vector.<int>(1 << classSubclasses[i]); |
| 83 | + for (j = 0; j < subclassBooks[i].length; j++) { |
| 84 | + subclassBooks[i][j] = source.readUnsignedBitwiseInt(8) - 1; |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + multiplier = source.readUnsignedBitwiseInt(2) + 1; |
| 89 | + rangeBits = source.readUnsignedBitwiseInt(4); |
| 90 | + |
| 91 | + var floorValues:int = 0; |
| 92 | + |
| 93 | + xList = Vector.<int>([0, 1<<rangeBits]); |
| 94 | + |
| 95 | + for (i = 0; i < partitions; i++) { |
| 96 | + for (j = 0; j < classDimensions[partitionClassList[i]]; j++) { |
| 97 | + xList.push(source.readUnsignedBitwiseInt(rangeBits)); |
| 98 | + } |
| 99 | + } |
| 100 | + |
| 101 | + lowNeighbours = new Vector.<int>(xList.length); |
| 102 | + highNeighbours = new Vector.<int>(xList.length); |
| 103 | + |
| 104 | + for (i = 0; i < xList.length; i++) { |
| 105 | + lowNeighbours[i] = Util.lowNeighbour(xList, i); |
| 106 | + highNeighbours[i] = Util.highNeighbour(xList, i); |
| 107 | + } |
| 108 | + |
| 109 | + xList2 = new Vector.<int>(xList.length, true); |
| 110 | + step2Flags = new Vector.<Boolean>(xList.length, true); |
| 111 | + } |
| 112 | + |
| 113 | + public override function get type():int { |
| 114 | + return 1; |
| 115 | + } |
| 116 | + |
| 117 | + public override function decodeFloor(vorbis:VorbisStream, source:BitByteArray):Floor1 { |
| 118 | + |
| 119 | + var i:int; |
| 120 | + var j:int; |
| 121 | + var offset:int; |
| 122 | + |
| 123 | + if (!source.readBit()) { |
| 124 | + return null; |
| 125 | + } |
| 126 | + |
| 127 | + var clone:Floor1 = clone(); |
| 128 | + |
| 129 | + clone.yList = new Vector.<int>(xList.length); |
| 130 | + |
| 131 | + var range:int = RANGES[multiplier - 1]; |
| 132 | + |
| 133 | + clone.yList[0] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); |
| 134 | + clone.yList[1] = source.readUnsignedBitwiseInt(Util.ilog(range - 1)); |
| 135 | + |
| 136 | + offset = 2; |
| 137 | + |
| 138 | + for (i = 0; i < partitionClassList.length; i++) { |
| 139 | + var cls:int = partitionClassList[i]; |
| 140 | + var cdim:int = classDimensions[cls]; |
| 141 | + var cbits:int = classSubclasses[cls]; |
| 142 | + var csub:int = (1 << cbits) - 1; |
| 143 | + var cval:int = 0; |
| 144 | + if (cbits > 0) { |
| 145 | + cval = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[classMasterbooks[cls]].huffmanRoot); |
| 146 | + } |
| 147 | + |
| 148 | + for (j = 0; j < cdim; j++) { |
| 149 | + var book:int = subclassBooks[cls][cval & csub]; |
| 150 | + cval >>>= cbits; |
| 151 | + if (book >= 0) { |
| 152 | + clone.yList[j + offset] = source.readUnsignedHuffmanInt(vorbis.setupHeader.codeBooks[book].huffmanRoot); |
| 153 | + } else { |
| 154 | + clone.yList[j + offset] = 0; |
| 155 | + } |
| 156 | + } |
| 157 | + offset += cdim; |
| 158 | + } |
| 159 | + |
| 160 | + return clone; |
| 161 | + } |
| 162 | + |
| 163 | + public override function computeFloor(vector:Vector.<Number>):void { |
| 164 | + |
| 165 | + var i:int; |
| 166 | + var j:int; |
| 167 | + |
| 168 | + var n:int = vector.length; |
| 169 | + var values:int = xList.length; |
| 170 | + //var step2Flags:Vector.<Boolean> = new Vector.<Boolean>(values); |
| 171 | + |
| 172 | + var range:int = RANGES[multiplier - 1]; |
| 173 | + |
| 174 | + for (i = 2; i < values; i++) { |
| 175 | + |
| 176 | + var lowNeighbourOffset:int = lowNeighbours[i]; |
| 177 | + var highNeighbourOffset:int = highNeighbours[i]; |
| 178 | + |
| 179 | + var predicted:int = Util.renderPoint( |
| 180 | + xList[lowNeighbourOffset], xList[highNeighbourOffset], |
| 181 | + yList[lowNeighbourOffset], yList[highNeighbourOffset], xList[i]); |
| 182 | + |
| 183 | + var val:int = yList[i]; |
| 184 | + var highRoom:int = range - predicted; |
| 185 | + var lowRoom:int = predicted; |
| 186 | + var room:int = highRoom < lowRoom ? highRoom * 2 : lowRoom * 2; |
| 187 | + |
| 188 | + if (val != 0) { |
| 189 | + step2Flags[lowNeighbourOffset] = true; |
| 190 | + step2Flags[highNeighbourOffset] = true; |
| 191 | + step2Flags[i] = true; |
| 192 | + if (val >= room) { |
| 193 | + yList[i] = highRoom > lowRoom ? val - lowRoom + predicted |
| 194 | + : -val + highRoom + predicted - 1; |
| 195 | + } else { |
| 196 | + yList[i] = (val & 1) == 1 ? predicted - ((val + 1) >> 1) |
| 197 | + : predicted + (val >> 1); |
| 198 | + } |
| 199 | + } else { |
| 200 | + step2Flags[i] = false; |
| 201 | + yList[i] = predicted; |
| 202 | + } |
| 203 | + } |
| 204 | + |
| 205 | + for(i=0; i<xList.length; i++) { |
| 206 | + xList2[i] = xList[i]; |
| 207 | + } |
| 208 | + |
| 209 | + sort(xList2, yList, step2Flags); |
| 210 | + |
| 211 | + var hx:int = 0; |
| 212 | + var hy:int = 0; |
| 213 | + var lx:int = 0; |
| 214 | + var ly:int = yList[0] * multiplier; |
| 215 | + |
| 216 | + for (i = 1; i < values; i++) { |
| 217 | + if (step2Flags[i]) { |
| 218 | + hy = yList[i] * multiplier; |
| 219 | + hx = xList2[i]; |
| 220 | + Util.renderLine(lx, ly, hx, hy, vector); |
| 221 | + lx = hx; |
| 222 | + ly = hy; |
| 223 | + } |
| 224 | + } |
| 225 | + |
| 226 | + var r:Number = DB_STATIC_TABLE[hy]; |
| 227 | + |
| 228 | + while(hx < n/2) { |
| 229 | + vector[hx++] = r; |
| 230 | + } |
| 231 | + |
| 232 | + } |
| 233 | + |
| 234 | + public function clone():Floor1 { |
| 235 | + var clone:Floor1 = new Floor1(); |
| 236 | + clone.classDimensions = classDimensions; |
| 237 | + clone.classMasterbooks = classMasterbooks; |
| 238 | + clone.classSubclasses = classSubclasses; |
| 239 | + clone.maximumClass = maximumClass; |
| 240 | + clone.multiplier = multiplier; |
| 241 | + clone.partitionClassList = partitionClassList; |
| 242 | + clone.rangeBits = rangeBits; |
| 243 | + clone.subclassBooks = subclassBooks; |
| 244 | + clone.xList = xList; |
| 245 | + clone.yList = yList; |
| 246 | + clone.lowNeighbours = lowNeighbours; |
| 247 | + clone.highNeighbours = highNeighbours; |
| 248 | + clone.xList2 = xList2; |
| 249 | + clone.step2Flags = step2Flags; |
| 250 | + return clone; |
| 251 | + } |
| 252 | + |
| 253 | + private function sort(x:Vector.<int>, y:Vector.<int>, b:Vector.<Boolean>):void { |
| 254 | + var off:int = 0; |
| 255 | + var len:int = x.length; |
| 256 | + var lim:int = len + off; |
| 257 | + var itmp:int; |
| 258 | + var btmp:Boolean; |
| 259 | + var i:int; |
| 260 | + var j:int; |
| 261 | + // Insertion sort on smallest arrays |
| 262 | + for (i = off; i < lim; i++) { |
| 263 | + for (j = i; j > off && x[j - 1] > x[j]; j--) { |
| 264 | + itmp = x[j]; |
| 265 | + x[j] = x[j - 1]; |
| 266 | + x[j - 1] = itmp; |
| 267 | + itmp = y[j]; |
| 268 | + y[j] = y[j - 1]; |
| 269 | + y[j - 1] = itmp; |
| 270 | + btmp = b[j]; |
| 271 | + b[j] = b[j - 1]; |
| 272 | + b[j - 1] = btmp; |
| 273 | + } |
| 274 | + } |
| 275 | + } |
| 276 | + |
| 277 | + } |
| 278 | + |
279 | 279 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Floor1.as |
___________________________________________________________________ |
Added: svn:eol-style |
280 | 280 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as |
— | — | @@ -1,87 +1,87 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.utils.ByteArray;
|
23 | | -
|
24 | | - public class IdentificationHeader {
|
25 | | -
|
26 | | - private var _version:uint;
|
27 | | - private var _channels:uint;
|
28 | | - private var _sampleRate:uint;
|
29 | | - private var _bitrateMaximum:int;
|
30 | | - private var _bitrateMinimum:int;
|
31 | | - private var _bitrateNominal:int;
|
32 | | - private var _blockSize0:uint;
|
33 | | - private var _blockSize1:uint;
|
34 | | -
|
35 | | - private var _mdct:Vector.<Mdct>;
|
36 | | -
|
37 | | - public function IdentificationHeader(source:ByteArray) {
|
38 | | -
|
39 | | - source.readByte();
|
40 | | - source.readByte();
|
41 | | - source.readByte();
|
42 | | - source.readByte();
|
43 | | - source.readByte();
|
44 | | - source.readByte();
|
45 | | -
|
46 | | - _version = source.readUnsignedInt();
|
47 | | - _channels = source.readUnsignedByte();
|
48 | | - _sampleRate = source.readUnsignedInt();
|
49 | | - _bitrateMaximum = source.readUnsignedInt();
|
50 | | - _bitrateNominal = source.readUnsignedInt();
|
51 | | - _bitrateMinimum = source.readUnsignedInt();
|
52 | | - var bs:int = source.readUnsignedByte();
|
53 | | - _blockSize0 = 1<<(bs&0xf);
|
54 | | - _blockSize1 = 1<<(bs>>4);
|
55 | | -
|
56 | | - _mdct = new Vector.<Mdct>(2, false);
|
57 | | - _mdct[0] = new Mdct(_blockSize0);
|
58 | | - _mdct[1] = new Mdct(_blockSize1);
|
59 | | - }
|
60 | | -
|
61 | | - public function get channels():uint {
|
62 | | - return _channels;
|
63 | | - }
|
64 | | -
|
65 | | - public function get sampleRate():uint {
|
66 | | - return _sampleRate;
|
67 | | - }
|
68 | | -
|
69 | | - public function get blockSize0():uint {
|
70 | | - return _blockSize0;
|
71 | | - }
|
72 | | -
|
73 | | - public function get blockSize1():uint {
|
74 | | - return _blockSize1;
|
75 | | - }
|
76 | | -
|
77 | | - public function get mdct0():Mdct {
|
78 | | - return _mdct[0];
|
79 | | - }
|
80 | | -
|
81 | | - public function get mdct1():Mdct {
|
82 | | - return _mdct[1];
|
83 | | - }
|
84 | | -
|
85 | | - }
|
86 | | -
|
87 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.utils.ByteArray; |
| 23 | + |
| 24 | + public class IdentificationHeader { |
| 25 | + |
| 26 | + private var _version:uint; |
| 27 | + private var _channels:uint; |
| 28 | + private var _sampleRate:uint; |
| 29 | + private var _bitrateMaximum:int; |
| 30 | + private var _bitrateMinimum:int; |
| 31 | + private var _bitrateNominal:int; |
| 32 | + private var _blockSize0:uint; |
| 33 | + private var _blockSize1:uint; |
| 34 | + |
| 35 | + private var _mdct:Vector.<Mdct>; |
| 36 | + |
| 37 | + public function IdentificationHeader(source:ByteArray) { |
| 38 | + |
| 39 | + source.readByte(); |
| 40 | + source.readByte(); |
| 41 | + source.readByte(); |
| 42 | + source.readByte(); |
| 43 | + source.readByte(); |
| 44 | + source.readByte(); |
| 45 | + |
| 46 | + _version = source.readUnsignedInt(); |
| 47 | + _channels = source.readUnsignedByte(); |
| 48 | + _sampleRate = source.readUnsignedInt(); |
| 49 | + _bitrateMaximum = source.readUnsignedInt(); |
| 50 | + _bitrateNominal = source.readUnsignedInt(); |
| 51 | + _bitrateMinimum = source.readUnsignedInt(); |
| 52 | + var bs:int = source.readUnsignedByte(); |
| 53 | + _blockSize0 = 1<<(bs&0xf); |
| 54 | + _blockSize1 = 1<<(bs>>4); |
| 55 | + |
| 56 | + _mdct = new Vector.<Mdct>(2, false); |
| 57 | + _mdct[0] = new Mdct(_blockSize0); |
| 58 | + _mdct[1] = new Mdct(_blockSize1); |
| 59 | + } |
| 60 | + |
| 61 | + public function get channels():uint { |
| 62 | + return _channels; |
| 63 | + } |
| 64 | + |
| 65 | + public function get sampleRate():uint { |
| 66 | + return _sampleRate; |
| 67 | + } |
| 68 | + |
| 69 | + public function get blockSize0():uint { |
| 70 | + return _blockSize0; |
| 71 | + } |
| 72 | + |
| 73 | + public function get blockSize1():uint { |
| 74 | + return _blockSize1; |
| 75 | + } |
| 76 | + |
| 77 | + public function get mdct0():Mdct { |
| 78 | + return _mdct[0]; |
| 79 | + } |
| 80 | + |
| 81 | + public function get mdct1():Mdct { |
| 82 | + return _mdct[1]; |
| 83 | + } |
| 84 | + |
| 85 | + } |
| 86 | + |
| 87 | + |
88 | 88 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/IdentificationHeader.as |
___________________________________________________________________ |
Added: svn:eol-style |
89 | 89 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as |
— | — | @@ -1,136 +1,136 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import org.omtk.util.BitByteArray;
|
23 | | -
|
24 | | - public class Look {
|
25 | | -
|
26 | | - private var _map:int;
|
27 | | - private var _parts:int;
|
28 | | - private var _stages:int;
|
29 | | - private var _fullbooks:Vector.<CodeBook>;
|
30 | | - private var _phrasebook:CodeBook;
|
31 | | - private var _partbooks:Vector.<Vector.<int>>;
|
32 | | - private var _partvals:int;
|
33 | | - private var _decodemap:Vector.<Vector.<int>>;
|
34 | | - private var _postbits:int;
|
35 | | - private var _phrasebits:int;
|
36 | | - private var _frames:int;
|
37 | | -
|
38 | | - public function Look(source:VorbisStream, residue:Residue, mode:Mode) {
|
39 | | -
|
40 | | - var i:int;
|
41 | | - var j:int;
|
42 | | - var k:int;
|
43 | | -
|
44 | | - var dim:int = 0;
|
45 | | - var acc:int = 0;
|
46 | | - var maxstage:int = 0;
|
47 | | -
|
48 | | - _map = mode.mapping;
|
49 | | -
|
50 | | - _parts = residue.classifications;
|
51 | | - _fullbooks = source.setupHeader.codeBooks;
|
52 | | - _phrasebook = _fullbooks[residue.classBook];
|
53 | | - dim = _phrasebook.dimensions;
|
54 | | -
|
55 | | - _partbooks = new Vector.<Vector.<int>>(_parts);
|
56 | | -
|
57 | | - for (j = 0; j < _parts; j++) {
|
58 | | - var s:int = Util.ilog(residue.cascade[j]);
|
59 | | - if (s != 0) {
|
60 | | - if (s > maxstage) {
|
61 | | - maxstage = s;
|
62 | | - }
|
63 | | - _partbooks[j] = new Vector.<int>(s);
|
64 | | - for (k = 0; k < s; k++) {
|
65 | | - if ((residue.cascade[j] & (1 << k)) != 0) {
|
66 | | - _partbooks[j][k] = residue.books[j][k];
|
67 | | - }
|
68 | | - }
|
69 | | - }
|
70 | | - }
|
71 | | -
|
72 | | - _partvals = Math.round(Math.pow(_parts, dim));
|
73 | | - _stages = maxstage;
|
74 | | -
|
75 | | - _decodemap = new Vector.<Vector.<int>>(_partvals, true);
|
76 | | -
|
77 | | - for (j = 0; j < _partvals; j++) {
|
78 | | - var val:int = j;
|
79 | | - var mult:int = _partvals / _parts;
|
80 | | - _decodemap[j] = new Vector.<int>(dim);
|
81 | | -
|
82 | | - for (k = 0; k < dim; k++) {
|
83 | | - var deco:int = val / mult;
|
84 | | - val -= deco * mult;
|
85 | | - mult /= _parts;
|
86 | | - _decodemap[j][k] = deco;
|
87 | | - }
|
88 | | - }
|
89 | | - }
|
90 | | -
|
91 | | - public function get map():int {
|
92 | | - return _map;
|
93 | | - }
|
94 | | -
|
95 | | - public function get parts():int {
|
96 | | - return _parts;
|
97 | | - }
|
98 | | -
|
99 | | - public function get stages():int {
|
100 | | - return _stages;
|
101 | | - }
|
102 | | -
|
103 | | - public function get fullbooks():Vector.<CodeBook> {
|
104 | | - return _fullbooks;
|
105 | | - }
|
106 | | -
|
107 | | - public function get phrasebook():CodeBook {
|
108 | | - return _phrasebook;
|
109 | | - }
|
110 | | -
|
111 | | - public function get partbooks():Vector.<Vector.<int>> {
|
112 | | - return _partbooks;
|
113 | | - }
|
114 | | -
|
115 | | - public function get partvals():int {
|
116 | | - return _partvals;
|
117 | | - }
|
118 | | -
|
119 | | - public function get decodemap():Vector.<Vector.<int>> {
|
120 | | - return _decodemap;
|
121 | | - }
|
122 | | -
|
123 | | - public function get postbits():int {
|
124 | | - return _postbits;
|
125 | | - }
|
126 | | -
|
127 | | - public function get phrasebits():int {
|
128 | | - return _phrasebits;
|
129 | | - }
|
130 | | -
|
131 | | - public function get frames():int {
|
132 | | - return _frames;
|
133 | | - }
|
134 | | -
|
135 | | - }
|
136 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import org.omtk.util.BitByteArray; |
| 23 | + |
| 24 | + public class Look { |
| 25 | + |
| 26 | + private var _map:int; |
| 27 | + private var _parts:int; |
| 28 | + private var _stages:int; |
| 29 | + private var _fullbooks:Vector.<CodeBook>; |
| 30 | + private var _phrasebook:CodeBook; |
| 31 | + private var _partbooks:Vector.<Vector.<int>>; |
| 32 | + private var _partvals:int; |
| 33 | + private var _decodemap:Vector.<Vector.<int>>; |
| 34 | + private var _postbits:int; |
| 35 | + private var _phrasebits:int; |
| 36 | + private var _frames:int; |
| 37 | + |
| 38 | + public function Look(source:VorbisStream, residue:Residue, mode:Mode) { |
| 39 | + |
| 40 | + var i:int; |
| 41 | + var j:int; |
| 42 | + var k:int; |
| 43 | + |
| 44 | + var dim:int = 0; |
| 45 | + var acc:int = 0; |
| 46 | + var maxstage:int = 0; |
| 47 | + |
| 48 | + _map = mode.mapping; |
| 49 | + |
| 50 | + _parts = residue.classifications; |
| 51 | + _fullbooks = source.setupHeader.codeBooks; |
| 52 | + _phrasebook = _fullbooks[residue.classBook]; |
| 53 | + dim = _phrasebook.dimensions; |
| 54 | + |
| 55 | + _partbooks = new Vector.<Vector.<int>>(_parts); |
| 56 | + |
| 57 | + for (j = 0; j < _parts; j++) { |
| 58 | + var s:int = Util.ilog(residue.cascade[j]); |
| 59 | + if (s != 0) { |
| 60 | + if (s > maxstage) { |
| 61 | + maxstage = s; |
| 62 | + } |
| 63 | + _partbooks[j] = new Vector.<int>(s); |
| 64 | + for (k = 0; k < s; k++) { |
| 65 | + if ((residue.cascade[j] & (1 << k)) != 0) { |
| 66 | + _partbooks[j][k] = residue.books[j][k]; |
| 67 | + } |
| 68 | + } |
| 69 | + } |
| 70 | + } |
| 71 | + |
| 72 | + _partvals = Math.round(Math.pow(_parts, dim)); |
| 73 | + _stages = maxstage; |
| 74 | + |
| 75 | + _decodemap = new Vector.<Vector.<int>>(_partvals, true); |
| 76 | + |
| 77 | + for (j = 0; j < _partvals; j++) { |
| 78 | + var val:int = j; |
| 79 | + var mult:int = _partvals / _parts; |
| 80 | + _decodemap[j] = new Vector.<int>(dim); |
| 81 | + |
| 82 | + for (k = 0; k < dim; k++) { |
| 83 | + var deco:int = val / mult; |
| 84 | + val -= deco * mult; |
| 85 | + mult /= _parts; |
| 86 | + _decodemap[j][k] = deco; |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + public function get map():int { |
| 92 | + return _map; |
| 93 | + } |
| 94 | + |
| 95 | + public function get parts():int { |
| 96 | + return _parts; |
| 97 | + } |
| 98 | + |
| 99 | + public function get stages():int { |
| 100 | + return _stages; |
| 101 | + } |
| 102 | + |
| 103 | + public function get fullbooks():Vector.<CodeBook> { |
| 104 | + return _fullbooks; |
| 105 | + } |
| 106 | + |
| 107 | + public function get phrasebook():CodeBook { |
| 108 | + return _phrasebook; |
| 109 | + } |
| 110 | + |
| 111 | + public function get partbooks():Vector.<Vector.<int>> { |
| 112 | + return _partbooks; |
| 113 | + } |
| 114 | + |
| 115 | + public function get partvals():int { |
| 116 | + return _partvals; |
| 117 | + } |
| 118 | + |
| 119 | + public function get decodemap():Vector.<Vector.<int>> { |
| 120 | + return _decodemap; |
| 121 | + } |
| 122 | + |
| 123 | + public function get postbits():int { |
| 124 | + return _postbits; |
| 125 | + } |
| 126 | + |
| 127 | + public function get phrasebits():int { |
| 128 | + return _phrasebits; |
| 129 | + } |
| 130 | + |
| 131 | + public function get frames():int { |
| 132 | + return _frames; |
| 133 | + } |
| 134 | + |
| 135 | + } |
| 136 | + |
137 | 137 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Look.as |
___________________________________________________________________ |
Added: svn:eol-style |
138 | 138 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as |
— | — | @@ -1,118 +1,118 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import org.omtk.util.BitByteArray;
|
23 | | -
|
24 | | - public class SetupHeader {
|
25 | | -
|
26 | | - private var _codeBooks:Vector.<CodeBook>;
|
27 | | - private var _floors:Vector.<Floor>;
|
28 | | - private var _residues:Vector.<Residue>;
|
29 | | - private var _mappings:Vector.<Mapping>;
|
30 | | - private var _modes:Vector.<Mode>;
|
31 | | -
|
32 | | - public function SetupHeader(stream:VorbisStream, source:BitByteArray) {
|
33 | | -
|
34 | | - var i:int;
|
35 | | -
|
36 | | - source.readByte();
|
37 | | - source.readByte();
|
38 | | - source.readByte();
|
39 | | - source.readByte();
|
40 | | - source.readByte();
|
41 | | - source.readByte();
|
42 | | -
|
43 | | - var codeBookCount:uint = source.readUnsignedBitwiseInt(8)+1;
|
44 | | - _codeBooks = new Vector.<CodeBook>(codeBookCount);
|
45 | | -
|
46 | | - for(i = 0; i < codeBookCount; i++) {
|
47 | | - _codeBooks[i] = new CodeBook(source);
|
48 | | - }
|
49 | | -
|
50 | | - // read the time domain transformations,
|
51 | | - // these should all be 0
|
52 | | -
|
53 | | - var timeCount:int = source.readUnsignedBitwiseInt(6) + 1;
|
54 | | - for (i = 0; i < timeCount; i++) {
|
55 | | - if (source.readUnsignedBitwiseInt(16) != 0) {
|
56 | | - throw new Error(
|
57 | | - "Time domain transformation != 0");
|
58 | | - }
|
59 | | - }
|
60 | | -
|
61 | | - // read floor entries
|
62 | | -
|
63 | | - var floorCount:int = source.readUnsignedBitwiseInt(6) + 1;
|
64 | | - _floors = new Vector.<Floor>(floorCount);
|
65 | | -
|
66 | | - for (i = 0; i < floorCount; i++) {
|
67 | | - _floors[i] = Floor.createInstance(source, this);
|
68 | | - }
|
69 | | -
|
70 | | - var residueCount:int = source.readUnsignedBitwiseInt(6) + 1;
|
71 | | - _residues = new Vector.<Residue>(residueCount);
|
72 | | -
|
73 | | - for (i = 0; i < residueCount; i++) {
|
74 | | - _residues[i] = Residue.createInstance(source, this);
|
75 | | - }
|
76 | | -
|
77 | | - var mappingCount:int = source.readUnsignedBitwiseInt(6) + 1;
|
78 | | - _mappings = new Vector.<Mapping>(mappingCount);
|
79 | | -
|
80 | | - for (i = 0; i < mappingCount; i++) {
|
81 | | - _mappings[i] = Mapping.createInstance(stream, source, this);
|
82 | | - }
|
83 | | -
|
84 | | - var modeCount:int = source.readUnsignedBitwiseInt(6) + 1;
|
85 | | - _modes = new Vector.<Mode>(modeCount);
|
86 | | -
|
87 | | - for (i = 0; i < modeCount; i++) {
|
88 | | - _modes[i] = new Mode(source, this);
|
89 | | - }
|
90 | | -
|
91 | | - if (!source.readBit()) {
|
92 | | - throw new Error("The setup header framing bit is incorrect.");
|
93 | | - }
|
94 | | - }
|
95 | | -
|
96 | | - public function get codeBooks():Vector.<CodeBook> {
|
97 | | - return _codeBooks;
|
98 | | - }
|
99 | | -
|
100 | | - public function get floors():Vector.<Floor> {
|
101 | | - return _floors;
|
102 | | - }
|
103 | | -
|
104 | | - public function get mappings():Vector.<Mapping> {
|
105 | | - return _mappings;
|
106 | | - }
|
107 | | -
|
108 | | - public function get residues():Vector.<Residue> {
|
109 | | - return _residues;
|
110 | | - }
|
111 | | -
|
112 | | - public function get modes():Vector.<Mode> {
|
113 | | - return _modes;
|
114 | | - }
|
115 | | -
|
116 | | - }
|
117 | | -
|
118 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import org.omtk.util.BitByteArray; |
| 23 | + |
| 24 | + public class SetupHeader { |
| 25 | + |
| 26 | + private var _codeBooks:Vector.<CodeBook>; |
| 27 | + private var _floors:Vector.<Floor>; |
| 28 | + private var _residues:Vector.<Residue>; |
| 29 | + private var _mappings:Vector.<Mapping>; |
| 30 | + private var _modes:Vector.<Mode>; |
| 31 | + |
| 32 | + public function SetupHeader(stream:VorbisStream, source:BitByteArray) { |
| 33 | + |
| 34 | + var i:int; |
| 35 | + |
| 36 | + source.readByte(); |
| 37 | + source.readByte(); |
| 38 | + source.readByte(); |
| 39 | + source.readByte(); |
| 40 | + source.readByte(); |
| 41 | + source.readByte(); |
| 42 | + |
| 43 | + var codeBookCount:uint = source.readUnsignedBitwiseInt(8)+1; |
| 44 | + _codeBooks = new Vector.<CodeBook>(codeBookCount); |
| 45 | + |
| 46 | + for(i = 0; i < codeBookCount; i++) { |
| 47 | + _codeBooks[i] = new CodeBook(source); |
| 48 | + } |
| 49 | + |
| 50 | + // read the time domain transformations, |
| 51 | + // these should all be 0 |
| 52 | + |
| 53 | + var timeCount:int = source.readUnsignedBitwiseInt(6) + 1; |
| 54 | + for (i = 0; i < timeCount; i++) { |
| 55 | + if (source.readUnsignedBitwiseInt(16) != 0) { |
| 56 | + throw new Error( |
| 57 | + "Time domain transformation != 0"); |
| 58 | + } |
| 59 | + } |
| 60 | + |
| 61 | + // read floor entries |
| 62 | + |
| 63 | + var floorCount:int = source.readUnsignedBitwiseInt(6) + 1; |
| 64 | + _floors = new Vector.<Floor>(floorCount); |
| 65 | + |
| 66 | + for (i = 0; i < floorCount; i++) { |
| 67 | + _floors[i] = Floor.createInstance(source, this); |
| 68 | + } |
| 69 | + |
| 70 | + var residueCount:int = source.readUnsignedBitwiseInt(6) + 1; |
| 71 | + _residues = new Vector.<Residue>(residueCount); |
| 72 | + |
| 73 | + for (i = 0; i < residueCount; i++) { |
| 74 | + _residues[i] = Residue.createInstance(source, this); |
| 75 | + } |
| 76 | + |
| 77 | + var mappingCount:int = source.readUnsignedBitwiseInt(6) + 1; |
| 78 | + _mappings = new Vector.<Mapping>(mappingCount); |
| 79 | + |
| 80 | + for (i = 0; i < mappingCount; i++) { |
| 81 | + _mappings[i] = Mapping.createInstance(stream, source, this); |
| 82 | + } |
| 83 | + |
| 84 | + var modeCount:int = source.readUnsignedBitwiseInt(6) + 1; |
| 85 | + _modes = new Vector.<Mode>(modeCount); |
| 86 | + |
| 87 | + for (i = 0; i < modeCount; i++) { |
| 88 | + _modes[i] = new Mode(source, this); |
| 89 | + } |
| 90 | + |
| 91 | + if (!source.readBit()) { |
| 92 | + throw new Error("The setup header framing bit is incorrect."); |
| 93 | + } |
| 94 | + } |
| 95 | + |
| 96 | + public function get codeBooks():Vector.<CodeBook> { |
| 97 | + return _codeBooks; |
| 98 | + } |
| 99 | + |
| 100 | + public function get floors():Vector.<Floor> { |
| 101 | + return _floors; |
| 102 | + } |
| 103 | + |
| 104 | + public function get mappings():Vector.<Mapping> { |
| 105 | + return _mappings; |
| 106 | + } |
| 107 | + |
| 108 | + public function get residues():Vector.<Residue> { |
| 109 | + return _residues; |
| 110 | + } |
| 111 | + |
| 112 | + public function get modes():Vector.<Mode> { |
| 113 | + return _modes; |
| 114 | + } |
| 115 | + |
| 116 | + } |
| 117 | + |
| 118 | + |
119 | 119 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/SetupHeader.as |
___________________________________________________________________ |
Added: svn:eol-style |
120 | 120 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as |
— | — | @@ -1,81 +1,81 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.utils.ByteArray;
|
23 | | - import flash.utils.Endian;
|
24 | | - import flash.utils.Dictionary;
|
25 | | - import org.omtk.ogg.*;
|
26 | | -
|
27 | | - public class CommentHeader {
|
28 | | -
|
29 | | - private var _vendor:String;
|
30 | | - private var _comments:Dictionary = new Dictionary();
|
31 | | -
|
32 | | - public function CommentHeader(source:ByteArray)
|
33 | | - {
|
34 | | - init( source );
|
35 | | - }
|
36 | | -
|
37 | | - private function init( source: ByteArray ): void
|
38 | | - {
|
39 | | - source.readByte();
|
40 | | - source.readByte();
|
41 | | - source.readByte();
|
42 | | - source.readByte();
|
43 | | - source.readByte();
|
44 | | - source.readByte();
|
45 | | -
|
46 | | - _vendor = readUtf8String(source);
|
47 | | -
|
48 | | - var ucLength:int = source.readUnsignedInt();
|
49 | | -
|
50 | | - for(var i:int = 0; i < ucLength; i++) {
|
51 | | - var comment:String = readUtf8String(source);
|
52 | | - var ix:int = comment.indexOf('=');
|
53 | | - var key:String = comment.substring(0, ix);
|
54 | | - var value:String = comment.substring(ix+1);
|
55 | | - _comments[key.toUpperCase()]=value;
|
56 | | - }
|
57 | | - }
|
58 | | -
|
59 | | - private function readUtf8String(source:ByteArray):String {
|
60 | | - var length:uint = source.readUnsignedInt();
|
61 | | - return source.readUTFBytes(length);
|
62 | | - }
|
63 | | -
|
64 | | - public function get vendor():String {
|
65 | | - return _vendor;
|
66 | | - }
|
67 | | -
|
68 | | - public function get comments():Dictionary {
|
69 | | - return _comments;
|
70 | | - }
|
71 | | -
|
72 | | - public function get artist():String {
|
73 | | - return _comments["ARTIST"];
|
74 | | - }
|
75 | | -
|
76 | | - public function get title():String {
|
77 | | - return _comments["TITLE"];
|
78 | | - }
|
79 | | -
|
80 | | - }
|
81 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.utils.ByteArray; |
| 23 | + import flash.utils.Endian; |
| 24 | + import flash.utils.Dictionary; |
| 25 | + import org.omtk.ogg.*; |
| 26 | + |
| 27 | + public class CommentHeader { |
| 28 | + |
| 29 | + private var _vendor:String; |
| 30 | + private var _comments:Dictionary = new Dictionary(); |
| 31 | + |
| 32 | + public function CommentHeader(source:ByteArray) |
| 33 | + { |
| 34 | + init( source ); |
| 35 | + } |
| 36 | + |
| 37 | + private function init( source: ByteArray ): void |
| 38 | + { |
| 39 | + source.readByte(); |
| 40 | + source.readByte(); |
| 41 | + source.readByte(); |
| 42 | + source.readByte(); |
| 43 | + source.readByte(); |
| 44 | + source.readByte(); |
| 45 | + |
| 46 | + _vendor = readUtf8String(source); |
| 47 | + |
| 48 | + var ucLength:int = source.readUnsignedInt(); |
| 49 | + |
| 50 | + for(var i:int = 0; i < ucLength; i++) { |
| 51 | + var comment:String = readUtf8String(source); |
| 52 | + var ix:int = comment.indexOf('='); |
| 53 | + var key:String = comment.substring(0, ix); |
| 54 | + var value:String = comment.substring(ix+1); |
| 55 | + _comments[key.toUpperCase()]=value; |
| 56 | + } |
| 57 | + } |
| 58 | + |
| 59 | + private function readUtf8String(source:ByteArray):String { |
| 60 | + var length:uint = source.readUnsignedInt(); |
| 61 | + return source.readUTFBytes(length); |
| 62 | + } |
| 63 | + |
| 64 | + public function get vendor():String { |
| 65 | + return _vendor; |
| 66 | + } |
| 67 | + |
| 68 | + public function get comments():Dictionary { |
| 69 | + return _comments; |
| 70 | + } |
| 71 | + |
| 72 | + public function get artist():String { |
| 73 | + return _comments["ARTIST"]; |
| 74 | + } |
| 75 | + |
| 76 | + public function get title():String { |
| 77 | + return _comments["TITLE"]; |
| 78 | + } |
| 79 | + |
| 80 | + } |
| 81 | + |
82 | 82 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/CommentHeader.as |
___________________________________________________________________ |
Added: svn:eol-style |
83 | 83 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as |
— | — | @@ -1,136 +1,136 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.errors.IllegalOperationError;
|
23 | | - import org.omtk.util.BitByteArray;
|
24 | | -
|
25 | | - public class Mapping0 extends Mapping {
|
26 | | -
|
27 | | - private var _magnitudes:Vector.<int>;
|
28 | | - private var _angles:Vector.<int>;
|
29 | | - private var _mux:Vector.<int>;
|
30 | | - private var _submapFloors:Vector.<int>;
|
31 | | - private var _submapResidues:Vector.<int>;
|
32 | | -
|
33 | | - public function Mapping0(stream:VorbisStream, source:BitByteArray, header:SetupHeader) {
|
34 | | -
|
35 | | - var i:int;
|
36 | | - var j:int;
|
37 | | -
|
38 | | - var submaps:int = 1;
|
39 | | -
|
40 | | - if (source.readBit()) {
|
41 | | - submaps = source.readUnsignedBitwiseInt(4) + 1;
|
42 | | - }
|
43 | | -
|
44 | | - var channels:int = stream.identificationHeader.channels;
|
45 | | - var ilogChannels:int = Util.ilog(channels - 1);
|
46 | | -
|
47 | | - if (source.readBit()) {
|
48 | | - var couplingSteps:int = source.readUnsignedBitwiseInt(8) + 1;
|
49 | | - _magnitudes = new Vector.<int>(couplingSteps);
|
50 | | - _angles = new Vector.<int>(couplingSteps);
|
51 | | -
|
52 | | - for (i = 0; i < couplingSteps; i++) {
|
53 | | - magnitudes[i] = source.readUnsignedBitwiseInt(ilogChannels);
|
54 | | - angles[i] = source.readUnsignedBitwiseInt(ilogChannels);
|
55 | | - if (magnitudes[i] == angles[i] || magnitudes[i] >= channels
|
56 | | - || angles[i] >= channels) {
|
57 | | - throw new Error("The channel magnitude and/or angle mismatch.");
|
58 | | - }
|
59 | | - }
|
60 | | - } else {
|
61 | | - _magnitudes = Vector.<int>([]);
|
62 | | - _angles = Vector.<int>([]);
|
63 | | - }
|
64 | | -
|
65 | | - if (source.readUnsignedBitwiseInt(2) != 0) {
|
66 | | - throw new Error("A reserved mapping field has an invalid value.");
|
67 | | - }
|
68 | | -
|
69 | | - _mux = new Vector.<int>(channels);
|
70 | | - if (submaps > 1) {
|
71 | | - for (i = 0; i < channels; i++) {
|
72 | | - _mux[i] = source.readUnsignedBitwiseInt(4);
|
73 | | - if (_mux[i] > submaps) {
|
74 | | - throw new Error("A mapping mux value is higher than the number of submaps");
|
75 | | - }
|
76 | | - }
|
77 | | - } else {
|
78 | | - for (i = 0; i < channels; i++) {
|
79 | | - _mux[i] = 0;
|
80 | | - }
|
81 | | - }
|
82 | | -
|
83 | | - _submapFloors = new Vector.<int>(submaps);
|
84 | | - _submapResidues = new Vector.<int>(submaps);
|
85 | | -
|
86 | | - var floorCount:int = header.floors.length;
|
87 | | - var residueCount:int = header.residues.length;
|
88 | | -
|
89 | | - for (i = 0; i < submaps; i++) {
|
90 | | - source.readUnsignedBitwiseInt(8); // discard time placeholder
|
91 | | - _submapFloors[i] = source.readUnsignedBitwiseInt(8);
|
92 | | - _submapResidues[i] = source.readUnsignedBitwiseInt(8);
|
93 | | -
|
94 | | - if (_submapFloors[i] > floorCount) {
|
95 | | - throw new Error("A mapping floor value is higher than the number of floors.");
|
96 | | - }
|
97 | | -
|
98 | | - if (_submapResidues[i] > residueCount) {
|
99 | | - throw new Error("A mapping residue value is higher than the number of residues.");
|
100 | | - }
|
101 | | - }
|
102 | | - }
|
103 | | -
|
104 | | - public override function get type():int {
|
105 | | - return 0;
|
106 | | - }
|
107 | | -
|
108 | | - public override function get couplingSteps():int {
|
109 | | - return _angles.length;
|
110 | | - }
|
111 | | -
|
112 | | - public override function get submaps():int {
|
113 | | - return _submapFloors.length;
|
114 | | - }
|
115 | | -
|
116 | | - public override function get angles():Vector.<int> {
|
117 | | - return _angles;
|
118 | | - }
|
119 | | -
|
120 | | - public override function get magnitudes():Vector.<int> {
|
121 | | - return _magnitudes;
|
122 | | - }
|
123 | | -
|
124 | | - public override function get mux():Vector.<int> {
|
125 | | - return _mux;
|
126 | | - }
|
127 | | -
|
128 | | - public override function get submapFloors():Vector.<int> {
|
129 | | - return _submapFloors;
|
130 | | - }
|
131 | | -
|
132 | | - public override function get submapResidues():Vector.<int> {
|
133 | | - return _submapResidues;
|
134 | | - }
|
135 | | - }
|
136 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.errors.IllegalOperationError; |
| 23 | + import org.omtk.util.BitByteArray; |
| 24 | + |
| 25 | + public class Mapping0 extends Mapping { |
| 26 | + |
| 27 | + private var _magnitudes:Vector.<int>; |
| 28 | + private var _angles:Vector.<int>; |
| 29 | + private var _mux:Vector.<int>; |
| 30 | + private var _submapFloors:Vector.<int>; |
| 31 | + private var _submapResidues:Vector.<int>; |
| 32 | + |
| 33 | + public function Mapping0(stream:VorbisStream, source:BitByteArray, header:SetupHeader) { |
| 34 | + |
| 35 | + var i:int; |
| 36 | + var j:int; |
| 37 | + |
| 38 | + var submaps:int = 1; |
| 39 | + |
| 40 | + if (source.readBit()) { |
| 41 | + submaps = source.readUnsignedBitwiseInt(4) + 1; |
| 42 | + } |
| 43 | + |
| 44 | + var channels:int = stream.identificationHeader.channels; |
| 45 | + var ilogChannels:int = Util.ilog(channels - 1); |
| 46 | + |
| 47 | + if (source.readBit()) { |
| 48 | + var couplingSteps:int = source.readUnsignedBitwiseInt(8) + 1; |
| 49 | + _magnitudes = new Vector.<int>(couplingSteps); |
| 50 | + _angles = new Vector.<int>(couplingSteps); |
| 51 | + |
| 52 | + for (i = 0; i < couplingSteps; i++) { |
| 53 | + magnitudes[i] = source.readUnsignedBitwiseInt(ilogChannels); |
| 54 | + angles[i] = source.readUnsignedBitwiseInt(ilogChannels); |
| 55 | + if (magnitudes[i] == angles[i] || magnitudes[i] >= channels |
| 56 | + || angles[i] >= channels) { |
| 57 | + throw new Error("The channel magnitude and/or angle mismatch."); |
| 58 | + } |
| 59 | + } |
| 60 | + } else { |
| 61 | + _magnitudes = Vector.<int>([]); |
| 62 | + _angles = Vector.<int>([]); |
| 63 | + } |
| 64 | + |
| 65 | + if (source.readUnsignedBitwiseInt(2) != 0) { |
| 66 | + throw new Error("A reserved mapping field has an invalid value."); |
| 67 | + } |
| 68 | + |
| 69 | + _mux = new Vector.<int>(channels); |
| 70 | + if (submaps > 1) { |
| 71 | + for (i = 0; i < channels; i++) { |
| 72 | + _mux[i] = source.readUnsignedBitwiseInt(4); |
| 73 | + if (_mux[i] > submaps) { |
| 74 | + throw new Error("A mapping mux value is higher than the number of submaps"); |
| 75 | + } |
| 76 | + } |
| 77 | + } else { |
| 78 | + for (i = 0; i < channels; i++) { |
| 79 | + _mux[i] = 0; |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + _submapFloors = new Vector.<int>(submaps); |
| 84 | + _submapResidues = new Vector.<int>(submaps); |
| 85 | + |
| 86 | + var floorCount:int = header.floors.length; |
| 87 | + var residueCount:int = header.residues.length; |
| 88 | + |
| 89 | + for (i = 0; i < submaps; i++) { |
| 90 | + source.readUnsignedBitwiseInt(8); // discard time placeholder |
| 91 | + _submapFloors[i] = source.readUnsignedBitwiseInt(8); |
| 92 | + _submapResidues[i] = source.readUnsignedBitwiseInt(8); |
| 93 | + |
| 94 | + if (_submapFloors[i] > floorCount) { |
| 95 | + throw new Error("A mapping floor value is higher than the number of floors."); |
| 96 | + } |
| 97 | + |
| 98 | + if (_submapResidues[i] > residueCount) { |
| 99 | + throw new Error("A mapping residue value is higher than the number of residues."); |
| 100 | + } |
| 101 | + } |
| 102 | + } |
| 103 | + |
| 104 | + public override function get type():int { |
| 105 | + return 0; |
| 106 | + } |
| 107 | + |
| 108 | + public override function get couplingSteps():int { |
| 109 | + return _angles.length; |
| 110 | + } |
| 111 | + |
| 112 | + public override function get submaps():int { |
| 113 | + return _submapFloors.length; |
| 114 | + } |
| 115 | + |
| 116 | + public override function get angles():Vector.<int> { |
| 117 | + return _angles; |
| 118 | + } |
| 119 | + |
| 120 | + public override function get magnitudes():Vector.<int> { |
| 121 | + return _magnitudes; |
| 122 | + } |
| 123 | + |
| 124 | + public override function get mux():Vector.<int> { |
| 125 | + return _mux; |
| 126 | + } |
| 127 | + |
| 128 | + public override function get submapFloors():Vector.<int> { |
| 129 | + return _submapFloors; |
| 130 | + } |
| 131 | + |
| 132 | + public override function get submapResidues():Vector.<int> { |
| 133 | + return _submapResidues; |
| 134 | + } |
| 135 | + } |
| 136 | + |
137 | 137 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Mapping0.as |
___________________________________________________________________ |
Added: svn:eol-style |
138 | 138 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as |
— | — | @@ -1,136 +1,136 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - import flash.net.URLRequest;
|
23 | | - import flash.net.URLStream;
|
24 | | - import flash.utils.ByteArray;
|
25 | | - import flash.utils.Endian;
|
26 | | - import flash.events.Event;
|
27 | | - import flash.events.ProgressEvent;
|
28 | | - import flash.events.SampleDataEvent;
|
29 | | -
|
30 | | - import flash.external.ExternalInterface;
|
31 | | -
|
32 | | - import flash.media.Sound;
|
33 | | -
|
34 | | - import org.omtk.ogg.UncachedUrlStream;
|
35 | | - import org.omtk.ogg.EndOfOggStreamError;
|
36 | | - import flash.utils.setTimeout;
|
37 | | -
|
38 | | - public class VorbisSound extends Sound {
|
39 | | -
|
40 | | - public static var METADATA_UPDATE: String = "metadata_update";
|
41 | | -
|
42 | | - private var urlStream: URLStream;
|
43 | | -
|
44 | | - private var oggStream:UncachedUrlStream;
|
45 | | - private var vorbisStream:VorbisStream;
|
46 | | -
|
47 | | - private var bytesAvailable:int;
|
48 | | -
|
49 | | - private var initialized:Boolean = false;
|
50 | | - private var playing:Boolean = false;
|
51 | | -
|
52 | | - private var fill1:Boolean = true;
|
53 | | - private var fill2:Boolean = true;
|
54 | | -
|
55 | | - private var stopped: Boolean = false;
|
56 | | - private var completeEventDispatched: Boolean = false;
|
57 | | -
|
58 | | - public function VorbisSound(url: URLRequest ) {
|
59 | | - urlStream = new URLStream();
|
60 | | - urlStream.endian = Endian.LITTLE_ENDIAN;
|
61 | | - urlStream.load(url);
|
62 | | -
|
63 | | - Mdct.initialize();
|
64 | | -
|
65 | | - oggStream = new UncachedUrlStream(urlStream);
|
66 | | - oggStream.addEventListener('progress', progress);
|
67 | | - bytesAvailable = oggStream.bytesAvailable;
|
68 | | - addEventListener("sampleData", sampleGenerator);
|
69 | | - }
|
70 | | -
|
71 | | - private function initialize():void {
|
72 | | - vorbisStream = new VorbisStream(oggStream.getLogicalOggStream());
|
73 | | - setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE));
|
74 | | - initialized = true;
|
75 | | - }
|
76 | | -
|
77 | | - private var samplesPlayed: int = 0;
|
78 | | -
|
79 | | - private function sampleGenerator(event:SampleDataEvent):void {
|
80 | | -
|
81 | | - if(stopped) {
|
82 | | - return;
|
83 | | - }
|
84 | | -
|
85 | | - if(Mdct.initialized && !initialized && bytesAvailable > 64*1024) {
|
86 | | - initialize();
|
87 | | - }
|
88 | | -
|
89 | | - if(initialized && bytesAvailable > 16*1024 && !vorbisStream.finished) {
|
90 | | - var cnt: int;
|
91 | | - cnt = vorbisStream.readPcm(event.data);
|
92 | | - samplesPlayed += cnt;
|
93 | | - if(cnt < 2048 && oggStream.bytesAvailable > 0) {
|
94 | | - vorbisStream = new VorbisStream(oggStream.getLogicalOggStream());
|
95 | | - setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE));
|
96 | | - samplesPlayed += vorbisStream.readPcm(event.data);
|
97 | | - }
|
98 | | - }
|
99 | | - else if(vorbisStream == null || !vorbisStream.finished) {
|
100 | | - for(var c:int=0; c<2048; c++) {
|
101 | | - event.data.writeFloat(0);
|
102 | | - event.data.writeFloat(0);
|
103 | | - }
|
104 | | - }
|
105 | | -
|
106 | | - if(initialized && vorbisStream.finished && oggStream.bytesAvailable == 0 && !completeEventDispatched) {
|
107 | | - dispatchEvent(new Event(Event.COMPLETE));
|
108 | | - completeEventDispatched = true;
|
109 | | - }
|
110 | | -
|
111 | | - //trace("samples played: " + samplesPlayed + "/" + oggStream.bytesAvailable);
|
112 | | -
|
113 | | - }
|
114 | | -
|
115 | | - public function stop(): void {
|
116 | | - stopped = true;
|
117 | | - }
|
118 | | -
|
119 | | - public function progress(event:ProgressEvent):void {
|
120 | | - bytesAvailable = oggStream.bytesAvailable;
|
121 | | - }
|
122 | | -
|
123 | | - public function get position(): int {
|
124 | | - return samplesPlayed * 1000 / 44100;
|
125 | | - }
|
126 | | -
|
127 | | - public function getMetaData(key: String):String {
|
128 | | - if(vorbisStream != null) {
|
129 | | - return vorbisStream.commentHeader.comments[key];
|
130 | | - }
|
131 | | - else {
|
132 | | - return null;
|
133 | | - }
|
134 | | - }
|
135 | | - }
|
136 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + import flash.net.URLRequest; |
| 23 | + import flash.net.URLStream; |
| 24 | + import flash.utils.ByteArray; |
| 25 | + import flash.utils.Endian; |
| 26 | + import flash.events.Event; |
| 27 | + import flash.events.ProgressEvent; |
| 28 | + import flash.events.SampleDataEvent; |
| 29 | + |
| 30 | + import flash.external.ExternalInterface; |
| 31 | + |
| 32 | + import flash.media.Sound; |
| 33 | + |
| 34 | + import org.omtk.ogg.UncachedUrlStream; |
| 35 | + import org.omtk.ogg.EndOfOggStreamError; |
| 36 | + import flash.utils.setTimeout; |
| 37 | + |
| 38 | + public class VorbisSound extends Sound { |
| 39 | + |
| 40 | + public static var METADATA_UPDATE: String = "metadata_update"; |
| 41 | + |
| 42 | + private var urlStream: URLStream; |
| 43 | + |
| 44 | + private var oggStream:UncachedUrlStream; |
| 45 | + private var vorbisStream:VorbisStream; |
| 46 | + |
| 47 | + private var bytesAvailable:int; |
| 48 | + |
| 49 | + private var initialized:Boolean = false; |
| 50 | + private var playing:Boolean = false; |
| 51 | + |
| 52 | + private var fill1:Boolean = true; |
| 53 | + private var fill2:Boolean = true; |
| 54 | + |
| 55 | + private var stopped: Boolean = false; |
| 56 | + private var completeEventDispatched: Boolean = false; |
| 57 | + |
| 58 | + public function VorbisSound(url: URLRequest ) { |
| 59 | + urlStream = new URLStream(); |
| 60 | + urlStream.endian = Endian.LITTLE_ENDIAN; |
| 61 | + urlStream.load(url); |
| 62 | + |
| 63 | + Mdct.initialize(); |
| 64 | + |
| 65 | + oggStream = new UncachedUrlStream(urlStream); |
| 66 | + oggStream.addEventListener('progress', progress); |
| 67 | + bytesAvailable = oggStream.bytesAvailable; |
| 68 | + addEventListener("sampleData", sampleGenerator); |
| 69 | + } |
| 70 | + |
| 71 | + private function initialize():void { |
| 72 | + vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); |
| 73 | + setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); |
| 74 | + initialized = true; |
| 75 | + } |
| 76 | + |
| 77 | + private var samplesPlayed: int = 0; |
| 78 | + |
| 79 | + private function sampleGenerator(event:SampleDataEvent):void { |
| 80 | + |
| 81 | + if(stopped) { |
| 82 | + return; |
| 83 | + } |
| 84 | + |
| 85 | + if(Mdct.initialized && !initialized && bytesAvailable > 64*1024) { |
| 86 | + initialize(); |
| 87 | + } |
| 88 | + |
| 89 | + if(initialized && bytesAvailable > 16*1024 && !vorbisStream.finished) { |
| 90 | + var cnt: int; |
| 91 | + cnt = vorbisStream.readPcm(event.data); |
| 92 | + samplesPlayed += cnt; |
| 93 | + if(cnt < 2048 && oggStream.bytesAvailable > 0) { |
| 94 | + vorbisStream = new VorbisStream(oggStream.getLogicalOggStream()); |
| 95 | + setTimeout(dispatchEvent, 100, new Event(METADATA_UPDATE)); |
| 96 | + samplesPlayed += vorbisStream.readPcm(event.data); |
| 97 | + } |
| 98 | + } |
| 99 | + else if(vorbisStream == null || !vorbisStream.finished) { |
| 100 | + for(var c:int=0; c<2048; c++) { |
| 101 | + event.data.writeFloat(0); |
| 102 | + event.data.writeFloat(0); |
| 103 | + } |
| 104 | + } |
| 105 | + |
| 106 | + if(initialized && vorbisStream.finished && oggStream.bytesAvailable == 0 && !completeEventDispatched) { |
| 107 | + dispatchEvent(new Event(Event.COMPLETE)); |
| 108 | + completeEventDispatched = true; |
| 109 | + } |
| 110 | + |
| 111 | + //trace("samples played: " + samplesPlayed + "/" + oggStream.bytesAvailable); |
| 112 | + |
| 113 | + } |
| 114 | + |
| 115 | + public function stop(): void { |
| 116 | + stopped = true; |
| 117 | + } |
| 118 | + |
| 119 | + public function progress(event:ProgressEvent):void { |
| 120 | + bytesAvailable = oggStream.bytesAvailable; |
| 121 | + } |
| 122 | + |
| 123 | + public function get position(): int { |
| 124 | + return samplesPlayed * 1000 / 44100; |
| 125 | + } |
| 126 | + |
| 127 | + public function getMetaData(key: String):String { |
| 128 | + if(vorbisStream != null) { |
| 129 | + return vorbisStream.commentHeader.comments[key]; |
| 130 | + } |
| 131 | + else { |
| 132 | + return null; |
| 133 | + } |
| 134 | + } |
| 135 | + } |
| 136 | + |
137 | 137 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/VorbisSound.as |
___________________________________________________________________ |
Added: svn:eol-style |
138 | 138 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as |
— | — | @@ -1,122 +1,122 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis {
|
21 | | -
|
22 | | - public class Util {
|
23 | | -
|
24 | | - public static function ilog(x:uint):uint {
|
25 | | - var res:int = 0;
|
26 | | - for(; x>0; x>>=1, res++);
|
27 | | - return res;
|
28 | | - }
|
29 | | -
|
30 | | - public static function float32unpack(x:uint):Number {
|
31 | | - var mantissa:Number = x&0x1fffff;
|
32 | | - var e:Number = (x&0x7fe00000)>>21;
|
33 | | - if((x&0x80000000)!=0) {
|
34 | | - mantissa=-mantissa;
|
35 | | - }
|
36 | | - return mantissa*Math.pow(2.0, e-788.0);
|
37 | | - }
|
38 | | -
|
39 | | - public static function lookup1Values(a:int, b:int):uint {
|
40 | | - var res:uint = Math.pow(Math.E, Math.log(a)/b);
|
41 | | - return intPow(res+1, b)<=a?res+1:res;
|
42 | | - }
|
43 | | -
|
44 | | - public static function intPow(base:uint, e:uint):uint {
|
45 | | - var res:uint = 1;
|
46 | | - for(; e>0; e--, res*=base);
|
47 | | - return res;
|
48 | | - }
|
49 | | -
|
50 | | - public static function isBitSet(value:uint, bit:uint):Boolean {
|
51 | | - return (value&(1<<bit))!=0;
|
52 | | - }
|
53 | | -
|
54 | | - public static function icount(value:uint):uint {
|
55 | | - var res:uint = 0;
|
56 | | - while (value > 0) {
|
57 | | - res += value & 1;
|
58 | | - value >>= 1;
|
59 | | - }
|
60 | | - return res;
|
61 | | - }
|
62 | | -
|
63 | | - public static function lowNeighbour(v:Vector.<int>, x:int):int {
|
64 | | -
|
65 | | - var max:int = -1;
|
66 | | - var n:int = 0;
|
67 | | - var i:int;
|
68 | | -
|
69 | | - for (i = 0; i < v.length && i < x; i++) {
|
70 | | - if (v[i] > max && v[i] < v[x]) {
|
71 | | - max = v[i];
|
72 | | - n = i;
|
73 | | - }
|
74 | | - }
|
75 | | - return n;
|
76 | | - }
|
77 | | -
|
78 | | - public static function highNeighbour(v:Vector.<int>, x:int):int {
|
79 | | -
|
80 | | - var min:int = int.MAX_VALUE;
|
81 | | - var n:int = 0;
|
82 | | - var i:int;
|
83 | | -
|
84 | | - for (i = 0; i < v.length && i < x; i++) {
|
85 | | - if (v[i] < min && v[i] > v[x]) {
|
86 | | - min = v[i];
|
87 | | - n = i;
|
88 | | - }
|
89 | | - }
|
90 | | - return n;
|
91 | | - }
|
92 | | -
|
93 | | - public static function renderPoint(x0:int, x1:int, y0:int, y1:int, x:int):int {
|
94 | | - return y0 + int(((y1-y0) * (x - x0)) / (x1 - x0));
|
95 | | - }
|
96 | | -
|
97 | | - public static function renderLine(x0:int, y0:int, x1:int, y1:int, v:Vector.<Number>):void {
|
98 | | -
|
99 | | - var dy:int = y1 - y0;
|
100 | | - var adx:int = x1 - x0;
|
101 | | - var b:int = dy / adx;
|
102 | | - var sy:int = dy < 0 ? b - 1 : b + 1;
|
103 | | - var x:int = x0;
|
104 | | - var y:int = y0;
|
105 | | - var err:int = 0;
|
106 | | - var ady:int = (dy < 0 ? -dy : dy) - (b > 0 ? b * adx : -b * adx);
|
107 | | -
|
108 | | - v[x] *= Floor.DB_STATIC_TABLE[y];
|
109 | | - for (x = x0 + 1; x < x1; x++) {
|
110 | | - err += ady;
|
111 | | - if (err >= adx) {
|
112 | | - err -= adx;
|
113 | | - v[x] *= Floor.DB_STATIC_TABLE[y += sy];
|
114 | | - } else {
|
115 | | - v[x] *= Floor.DB_STATIC_TABLE[y += b];
|
116 | | - }
|
117 | | - }
|
118 | | -
|
119 | | - }
|
120 | | -
|
121 | | - }
|
122 | | -
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis { |
| 21 | + |
| 22 | + public class Util { |
| 23 | + |
| 24 | + public static function ilog(x:uint):uint { |
| 25 | + var res:int = 0; |
| 26 | + for(; x>0; x>>=1, res++); |
| 27 | + return res; |
| 28 | + } |
| 29 | + |
| 30 | + public static function float32unpack(x:uint):Number { |
| 31 | + var mantissa:Number = x&0x1fffff; |
| 32 | + var e:Number = (x&0x7fe00000)>>21; |
| 33 | + if((x&0x80000000)!=0) { |
| 34 | + mantissa=-mantissa; |
| 35 | + } |
| 36 | + return mantissa*Math.pow(2.0, e-788.0); |
| 37 | + } |
| 38 | + |
| 39 | + public static function lookup1Values(a:int, b:int):uint { |
| 40 | + var res:uint = Math.pow(Math.E, Math.log(a)/b); |
| 41 | + return intPow(res+1, b)<=a?res+1:res; |
| 42 | + } |
| 43 | + |
| 44 | + public static function intPow(base:uint, e:uint):uint { |
| 45 | + var res:uint = 1; |
| 46 | + for(; e>0; e--, res*=base); |
| 47 | + return res; |
| 48 | + } |
| 49 | + |
| 50 | + public static function isBitSet(value:uint, bit:uint):Boolean { |
| 51 | + return (value&(1<<bit))!=0; |
| 52 | + } |
| 53 | + |
| 54 | + public static function icount(value:uint):uint { |
| 55 | + var res:uint = 0; |
| 56 | + while (value > 0) { |
| 57 | + res += value & 1; |
| 58 | + value >>= 1; |
| 59 | + } |
| 60 | + return res; |
| 61 | + } |
| 62 | + |
| 63 | + public static function lowNeighbour(v:Vector.<int>, x:int):int { |
| 64 | + |
| 65 | + var max:int = -1; |
| 66 | + var n:int = 0; |
| 67 | + var i:int; |
| 68 | + |
| 69 | + for (i = 0; i < v.length && i < x; i++) { |
| 70 | + if (v[i] > max && v[i] < v[x]) { |
| 71 | + max = v[i]; |
| 72 | + n = i; |
| 73 | + } |
| 74 | + } |
| 75 | + return n; |
| 76 | + } |
| 77 | + |
| 78 | + public static function highNeighbour(v:Vector.<int>, x:int):int { |
| 79 | + |
| 80 | + var min:int = int.MAX_VALUE; |
| 81 | + var n:int = 0; |
| 82 | + var i:int; |
| 83 | + |
| 84 | + for (i = 0; i < v.length && i < x; i++) { |
| 85 | + if (v[i] < min && v[i] > v[x]) { |
| 86 | + min = v[i]; |
| 87 | + n = i; |
| 88 | + } |
| 89 | + } |
| 90 | + return n; |
| 91 | + } |
| 92 | + |
| 93 | + public static function renderPoint(x0:int, x1:int, y0:int, y1:int, x:int):int { |
| 94 | + return y0 + int(((y1-y0) * (x - x0)) / (x1 - x0)); |
| 95 | + } |
| 96 | + |
| 97 | + public static function renderLine(x0:int, y0:int, x1:int, y1:int, v:Vector.<Number>):void { |
| 98 | + |
| 99 | + var dy:int = y1 - y0; |
| 100 | + var adx:int = x1 - x0; |
| 101 | + var b:int = dy / adx; |
| 102 | + var sy:int = dy < 0 ? b - 1 : b + 1; |
| 103 | + var x:int = x0; |
| 104 | + var y:int = y0; |
| 105 | + var err:int = 0; |
| 106 | + var ady:int = (dy < 0 ? -dy : dy) - (b > 0 ? b * adx : -b * adx); |
| 107 | + |
| 108 | + v[x] *= Floor.DB_STATIC_TABLE[y]; |
| 109 | + for (x = x0 + 1; x < x1; x++) { |
| 110 | + err += ady; |
| 111 | + if (err >= adx) { |
| 112 | + err -= adx; |
| 113 | + v[x] *= Floor.DB_STATIC_TABLE[y += sy]; |
| 114 | + } else { |
| 115 | + v[x] *= Floor.DB_STATIC_TABLE[y += b]; |
| 116 | + } |
| 117 | + } |
| 118 | + |
| 119 | + } |
| 120 | + |
| 121 | + } |
| 122 | + |
123 | 123 | } |
\ No newline at end of file |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/org/omtk/vorbis/Util.as |
___________________________________________________________________ |
Added: svn:eol-style |
124 | 124 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/Player.as |
— | — | @@ -1,106 +1,106 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package {
|
21 | | -
|
22 | | - import org.omtk.vorbis.VorbisSound;
|
23 | | -
|
24 | | - import flash.display.Shape;
|
25 | | - import flash.display.Sprite;
|
26 | | - import flash.display.StageAlign;
|
27 | | - import flash.display.StageQuality;
|
28 | | - import flash.display.StageScaleMode;
|
29 | | - import flash.net.*;
|
30 | | - import flash.events.Event;
|
31 | | - import flash.text.TextField;
|
32 | | - import flash.utils.ByteArray;
|
33 | | - import flash.utils.Endian;
|
34 | | - import flash.utils.getTimer;
|
35 | | - import flash.utils.setTimeout;
|
36 | | - import flash.utils.setInterval;
|
37 | | - import flash.external.ExternalInterface;
|
38 | | -
|
39 | | - [ SWF( backgroundColor = '#ffffff', width = '1', height = '1' ) ]
|
40 | | -
|
41 | | - public class Player extends Sprite {
|
42 | | -
|
43 | | - private var sound: VorbisSound;
|
44 | | - private var initialized: Boolean = false;
|
45 | | -
|
46 | | - public function Player() {
|
47 | | - if(stage != null) {
|
48 | | - stage.frameRate = 20;
|
49 | | - }
|
50 | | -
|
51 | | - setTimeout(registerJSCallbacks, 100);
|
52 | | - initialized = true;
|
53 | | - }
|
54 | | -
|
55 | | - private function registerJSCallbacks(): void {
|
56 | | - if (ExternalInterface.available) {
|
57 | | - ExternalInterface.addCallback("play", playJS);
|
58 | | - ExternalInterface.addCallback("getMetaData", getMetaDataJS);
|
59 | | - ExternalInterface.addCallback("getPosition", getPositionJS);
|
60 | | - }
|
61 | | - }
|
62 | | -
|
63 | | - public function playJS(url: String): void {
|
64 | | - if(sound != null) {
|
65 | | - sound.stop();
|
66 | | - }
|
67 | | - sound = new VorbisSound(new URLRequest(url));
|
68 | | - sound.addEventListener(Event.COMPLETE, complete);
|
69 | | - sound.addEventListener(VorbisSound.METADATA_UPDATE, metadataUpdate);
|
70 | | - sound.play();
|
71 | | - }
|
72 | | -
|
73 | | - public function getMetaDataJS(key: String): String {
|
74 | | - if(sound == null) {
|
75 | | - return null;
|
76 | | - }
|
77 | | - else {
|
78 | | - return sound.getMetaData(key);
|
79 | | - }
|
80 | | - }
|
81 | | -
|
82 | | - public function getPositionJS(): int {
|
83 | | - if(sound == null) {
|
84 | | - return -1;
|
85 | | - }
|
86 | | - else {
|
87 | | - return sound.position;
|
88 | | - }
|
89 | | - }
|
90 | | -
|
91 | | - private function complete(event: Event):void {
|
92 | | - trace("complete");
|
93 | | - if(ExternalInterface.available) {
|
94 | | - ExternalInterface.call("OMTK_P_complete");
|
95 | | - }
|
96 | | - }
|
97 | | -
|
98 | | - private function metadataUpdate(event: Event):void {
|
99 | | - trace("metadata update: " + sound.getMetaData("TITLE"));
|
100 | | - if(ExternalInterface.available) {
|
101 | | - ExternalInterface.call("OMTK_P_metadataUpdate");
|
102 | | - }
|
103 | | - }
|
104 | | -
|
105 | | - }
|
106 | | -
|
107 | | -}
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package { |
| 21 | + |
| 22 | + import org.omtk.vorbis.VorbisSound; |
| 23 | + |
| 24 | + import flash.display.Shape; |
| 25 | + import flash.display.Sprite; |
| 26 | + import flash.display.StageAlign; |
| 27 | + import flash.display.StageQuality; |
| 28 | + import flash.display.StageScaleMode; |
| 29 | + import flash.net.*; |
| 30 | + import flash.events.Event; |
| 31 | + import flash.text.TextField; |
| 32 | + import flash.utils.ByteArray; |
| 33 | + import flash.utils.Endian; |
| 34 | + import flash.utils.getTimer; |
| 35 | + import flash.utils.setTimeout; |
| 36 | + import flash.utils.setInterval; |
| 37 | + import flash.external.ExternalInterface; |
| 38 | + |
| 39 | + [ SWF( backgroundColor = '#ffffff', width = '1', height = '1' ) ] |
| 40 | + |
| 41 | + public class Player extends Sprite { |
| 42 | + |
| 43 | + private var sound: VorbisSound; |
| 44 | + private var initialized: Boolean = false; |
| 45 | + |
| 46 | + public function Player() { |
| 47 | + if(stage != null) { |
| 48 | + stage.frameRate = 20; |
| 49 | + } |
| 50 | + |
| 51 | + setTimeout(registerJSCallbacks, 100); |
| 52 | + initialized = true; |
| 53 | + } |
| 54 | + |
| 55 | + private function registerJSCallbacks(): void { |
| 56 | + if (ExternalInterface.available) { |
| 57 | + ExternalInterface.addCallback("play", playJS); |
| 58 | + ExternalInterface.addCallback("getMetaData", getMetaDataJS); |
| 59 | + ExternalInterface.addCallback("getPosition", getPositionJS); |
| 60 | + } |
| 61 | + } |
| 62 | + |
| 63 | + public function playJS(url: String): void { |
| 64 | + if(sound != null) { |
| 65 | + sound.stop(); |
| 66 | + } |
| 67 | + sound = new VorbisSound(new URLRequest(url)); |
| 68 | + sound.addEventListener(Event.COMPLETE, complete); |
| 69 | + sound.addEventListener(VorbisSound.METADATA_UPDATE, metadataUpdate); |
| 70 | + sound.play(); |
| 71 | + } |
| 72 | + |
| 73 | + public function getMetaDataJS(key: String): String { |
| 74 | + if(sound == null) { |
| 75 | + return null; |
| 76 | + } |
| 77 | + else { |
| 78 | + return sound.getMetaData(key); |
| 79 | + } |
| 80 | + } |
| 81 | + |
| 82 | + public function getPositionJS(): int { |
| 83 | + if(sound == null) { |
| 84 | + return -1; |
| 85 | + } |
| 86 | + else { |
| 87 | + return sound.position; |
| 88 | + } |
| 89 | + } |
| 90 | + |
| 91 | + private function complete(event: Event):void { |
| 92 | + trace("complete"); |
| 93 | + if(ExternalInterface.available) { |
| 94 | + ExternalInterface.call("OMTK_P_complete"); |
| 95 | + } |
| 96 | + } |
| 97 | + |
| 98 | + private function metadataUpdate(event: Event):void { |
| 99 | + trace("metadata update: " + sound.getMetaData("TITLE")); |
| 100 | + if(ExternalInterface.available) { |
| 101 | + ExternalInterface.call("OMTK_P_metadataUpdate"); |
| 102 | + } |
| 103 | + } |
| 104 | + |
| 105 | + } |
| 106 | + |
| 107 | +} |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/as/Player.as |
___________________________________________________________________ |
Added: svn:eol-style |
108 | 108 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/haXe/build.hxml |
___________________________________________________________________ |
Added: svn:eol-style |
109 | 109 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx |
— | — | @@ -1,337 +1,337 @@ |
2 | | -/*
|
3 | | -
|
4 | | -Copyright 2008 Tor-Einar Jarnbjo
|
5 | | -
|
6 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
7 | | - you may not use this file except in compliance with the License.
|
8 | | - You may obtain a copy of the License at
|
9 | | -
|
10 | | - http://www.apache.org/licenses/LICENSE-2.0
|
11 | | -
|
12 | | - Unless required by applicable law or agreed to in writing, software
|
13 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
14 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
15 | | - See the License for the specific language governing permissions and
|
16 | | - limitations under the License.
|
17 | | -
|
18 | | -*/
|
19 | | -
|
20 | | -package org.omtk.vorbis;
|
21 | | -
|
22 | | -import flash.Vector;
|
23 | | -
|
24 | | -class MdctHX {
|
25 | | -
|
26 | | - private static var cPI1_8:Float = 0.92387953251128675613;
|
27 | | - private static var cPI2_8:Float = 0.70710678118654752441;
|
28 | | - private static var cPI3_8:Float = 0.38268343236508977175;
|
29 | | -
|
30 | | - private var n:Int;
|
31 | | - private var log2n:Int;
|
32 | | - private var trig:Vector<Float>;
|
33 | | - private var bitrev:Vector<Int>;
|
34 | | -
|
35 | | - private var dtmp1:Float;
|
36 | | - private var dtmp2:Float;
|
37 | | - private var dtmp3:Float;
|
38 | | - private var dtmp4:Float;
|
39 | | -
|
40 | | - private var x:Vector<Float>;
|
41 | | - private var w:Vector<Float>;
|
42 | | -
|
43 | | - public function new(n:Int) {
|
44 | | - this.n = n;
|
45 | | -
|
46 | | - var i:Int;
|
47 | | - var j:Int;
|
48 | | -
|
49 | | - bitrev = new Vector<Int>();
|
50 | | - trig = new Vector<Float>(Std.int(n+n/4), true);
|
51 | | -
|
52 | | - for(i in 0...Std.int(n+n/4)) {
|
53 | | - trig[i] = 0;
|
54 | | - }
|
55 | | -
|
56 | | - x = new Vector<Float>(Std.int(n/2), true);
|
57 | | - w = new Vector<Float>(Std.int(n/2), true);
|
58 | | -
|
59 | | - for(i in 0...Std.int(n/2)) {
|
60 | | - x[i] = 0;
|
61 | | - w[i] = 0;
|
62 | | - }
|
63 | | -
|
64 | | - var n2:Int = n >>> 1;
|
65 | | - log2n = Math.round(Math.log(n) / Math.log(2));
|
66 | | -
|
67 | | - var AE:Int = 0;
|
68 | | - var AO:Int = 1;
|
69 | | - var BE:Int = Std.int(AE + n / 2);
|
70 | | - var BO:Int = BE + 1;
|
71 | | - var CE:Int = Std.int(BE + n / 2);
|
72 | | - var CO:Int = CE + 1;
|
73 | | -
|
74 | | - for (i in 0...Std.int(n/4)) {
|
75 | | - trig[AE + i * 2] = Math.cos((Math.PI / n) * (4 * i));
|
76 | | - trig[AO + i * 2] = -Math.sin((Math.PI / n) * (4 * i));
|
77 | | - trig[BE + i * 2] = Math.cos((Math.PI / (2 * n)) * (2 * i + 1));
|
78 | | - trig[BO + i * 2] = Math.sin((Math.PI / (2 * n)) * (2 * i + 1));
|
79 | | - }
|
80 | | -
|
81 | | - for (i in 0...Std.int(n/8)) {
|
82 | | - trig[CE + i * 2] = Math.cos((Math.PI / n) * (4 * i + 2));
|
83 | | - trig[CO + i * 2] = -Math.sin((Math.PI / n) * (4 * i + 2));
|
84 | | - }
|
85 | | -
|
86 | | - var mask:Int = (1 << (log2n - 1)) - 1;
|
87 | | - var msb:Int = 1 << (log2n - 2);
|
88 | | -
|
89 | | - for (i in 0...Std.int(n/8)) {
|
90 | | - var acc:Int = 0;
|
91 | | - j = 0;
|
92 | | - while(msb>>>j!=0) {
|
93 | | - if (((msb >>> j) & i) != 0) {
|
94 | | - acc |= 1 << j;
|
95 | | - }
|
96 | | - j++;
|
97 | | - }
|
98 | | - bitrev[i * 2] = ((~acc) & mask);
|
99 | | - bitrev[i * 2 + 1] = acc;
|
100 | | - }
|
101 | | -
|
102 | | - }
|
103 | | -
|
104 | | - public function imdct(frq:Vector<Float>, window:Vector<Float>, pcm:Vector<Float>):Void {
|
105 | | -
|
106 | | - var i:Int;
|
107 | | -
|
108 | | - var n2:Int;
|
109 | | - var n4:Int;
|
110 | | - var n8:Int;
|
111 | | -
|
112 | | - var inO:Int;
|
113 | | - var xO:Int;
|
114 | | - var A:Int;
|
115 | | -
|
116 | | - var temp1:Float;
|
117 | | - var temp2:Float;
|
118 | | -
|
119 | | - var B:Int;
|
120 | | - var o1:Int;
|
121 | | - var o2:Int;
|
122 | | - var o3:Int;
|
123 | | - var o4:Int;
|
124 | | -
|
125 | | - var xx:Int;
|
126 | | - var xxx:Vector<Float>;
|
127 | | -
|
128 | | - n2 = n >> 1;
|
129 | | - n4 = n >> 2;
|
130 | | - n8 = n >> 3;
|
131 | | -
|
132 | | - inO = -1;
|
133 | | - xO = 0;
|
134 | | - A = n2;
|
135 | | -
|
136 | | - temp1 = 0.0;
|
137 | | - temp2 = 0.0;
|
138 | | -
|
139 | | - for (i in 0...n8) {
|
140 | | - dtmp1 = frq[inO += 2];
|
141 | | - dtmp2 = frq[inO += 2];
|
142 | | - dtmp3 = trig[--A];
|
143 | | - dtmp4 = trig[--A];
|
144 | | - x[xO++] = -dtmp2 * dtmp3 - dtmp1 * dtmp4;
|
145 | | - x[xO++] = dtmp1 * dtmp3 - dtmp2 * dtmp4;
|
146 | | - }
|
147 | | -
|
148 | | - inO = n2;
|
149 | | -
|
150 | | - for(i in 0...n8) {
|
151 | | - dtmp1 = frq[inO -= 2];
|
152 | | - dtmp2 = frq[inO -= 2];
|
153 | | - dtmp3 = trig[--A];
|
154 | | - dtmp4 = trig[--A];
|
155 | | - x[xO++] = dtmp2 * dtmp3 + dtmp1 * dtmp4;
|
156 | | - x[xO++] = dtmp2 * dtmp4 - dtmp1 * dtmp3;
|
157 | | - }
|
158 | | -
|
159 | | - xxx = kernel(x, w, n, n2, n4, n8);
|
160 | | - xx = 0;
|
161 | | -
|
162 | | - B = n2;
|
163 | | - o1 = n4;
|
164 | | - o2 = o1 - 1;
|
165 | | - o3 = n4 + n2;
|
166 | | - o4 = o3 - 1;
|
167 | | -
|
168 | | - for (i in 0...n4) {
|
169 | | - dtmp1 = xxx[xx++];
|
170 | | - dtmp2 = xxx[xx++];
|
171 | | - dtmp3 = trig[B++];
|
172 | | - dtmp4 = trig[B++];
|
173 | | -
|
174 | | - temp1 = (dtmp1 * dtmp4 - dtmp2 * dtmp3);
|
175 | | - temp2 = -(dtmp1 * dtmp3 + dtmp2 * dtmp4);
|
176 | | -
|
177 | | - pcm[o1] = -temp1 * window[o1];
|
178 | | - pcm[o2] = temp1 * window[o2];
|
179 | | - pcm[o3] = temp2 * window[o3];
|
180 | | - pcm[o4] = temp2 * window[o4];
|
181 | | -
|
182 | | - o1++;
|
183 | | - o2--;
|
184 | | - o3++;
|
185 | | - o4--;
|
186 | | - }
|
187 | | -
|
188 | | - }
|
189 | | -
|
190 | | - private inline function kernel(x:Vector<Float>, w:Vector<Float>, n:Int, n2:Int, n4:Int, n8:Int):Vector<Float> {
|
191 | | -
|
192 | | - var i:Int;
|
193 | | - var r:Int;
|
194 | | - var s:Int;
|
195 | | - var rlim:Int;
|
196 | | - var slim:Int;
|
197 | | -
|
198 | | - var xA:Int = n4;
|
199 | | - var xB:Int = 0;
|
200 | | - var w1:Int = 0;
|
201 | | - var w2:Int = n4;
|
202 | | - var A:Int = n2;
|
203 | | -
|
204 | | - var x0:Float;
|
205 | | - var x1:Float;
|
206 | | - var wA:Float;
|
207 | | - var wB:Float;
|
208 | | - var wC:Float;
|
209 | | - var wD:Float;
|
210 | | - var k0:Int;
|
211 | | - var k1:Int;
|
212 | | - var t1:Int;
|
213 | | - var t2:Int;
|
214 | | -
|
215 | | - var wbase:Int;
|
216 | | - var temp:Vector<Float>;
|
217 | | -
|
218 | | - var wACE:Float;
|
219 | | - var wBCE:Float;
|
220 | | - var wACO:Float;
|
221 | | - var wBCO:Float;
|
222 | | -
|
223 | | - var AEv:Float;
|
224 | | - var AOv:Float;
|
225 | | -
|
226 | | - i=0;
|
227 | | - while(i < n4) {
|
228 | | - x0 = x[xA] - x[xB];
|
229 | | -
|
230 | | - w[w2 + i] = x[xA++] + x[xB++];
|
231 | | -
|
232 | | - x1 = x[xA] - x[xB];
|
233 | | - A -= 4;
|
234 | | -
|
235 | | - w[i++] = x0 * trig[A] + x1 * trig[A + 1];
|
236 | | - w[i] = x1 * trig[A] - x0 * trig[A + 1];
|
237 | | -
|
238 | | - w[w2 + i] = x[xA++] + x[xB++];
|
239 | | - i++;
|
240 | | - }
|
241 | | -
|
242 | | - for (i in 0...log2n-3) {
|
243 | | - k0 = n >>> (i + 2);
|
244 | | - k1 = 1 << (i + 3);
|
245 | | - wbase = n2 - 2;
|
246 | | -
|
247 | | - A = 0;
|
248 | | -
|
249 | | - rlim = k0 >>> 2;
|
250 | | - for (r in 0...rlim) {
|
251 | | -
|
252 | | - w1 = wbase;
|
253 | | - w2 = w1 - (k0 >> 1);
|
254 | | - AEv = trig[A];
|
255 | | - AOv = trig[A + 1];
|
256 | | - wbase -= 2;
|
257 | | -
|
258 | | - k0++;
|
259 | | -
|
260 | | - slim = 2 << i;
|
261 | | - for (s in 0...slim) {
|
262 | | - dtmp1 = w[w1];
|
263 | | - dtmp2 = w[w2];
|
264 | | - wB = dtmp1 - dtmp2;
|
265 | | - x[w1] = dtmp1 + dtmp2;
|
266 | | - dtmp1 = w[++w1];
|
267 | | - dtmp2 = w[++w2];
|
268 | | - wA = dtmp1 - dtmp2;
|
269 | | - x[w1] = dtmp1 + dtmp2;
|
270 | | - x[w2] = wA * AEv - wB * AOv;
|
271 | | - x[w2-1] = wB * AEv + wA * AOv;
|
272 | | - w1 -= k0;
|
273 | | - w2 -= k0;
|
274 | | - }
|
275 | | - k0--;
|
276 | | - A += k1;
|
277 | | - }
|
278 | | -
|
279 | | - temp = w;
|
280 | | - w = x;
|
281 | | - x = temp;
|
282 | | - }
|
283 | | -
|
284 | | -
|
285 | | - var C:Int = n;
|
286 | | - var bit:Int = 0;
|
287 | | - var xx1:Int = 0;
|
288 | | - var xx2:Int = n2 - 1;
|
289 | | -
|
290 | | - var wt1: Float;
|
291 | | - var wt2: Float;
|
292 | | - var wt12: Float;
|
293 | | - var wt21: Float;
|
294 | | - var trigV: Float;
|
295 | | -
|
296 | | - for (i in 0...n8) {
|
297 | | - t1 = bitrev[bit++];
|
298 | | - t2 = bitrev[bit++];
|
299 | | -
|
300 | | - wt1 = w[t1];
|
301 | | - wt2 = w[t2];
|
302 | | - wt12 = w[t1-1];
|
303 | | - wt21 = w[t2+1];
|
304 | | -
|
305 | | - wA = wt1 - wt21;
|
306 | | - wB = wt12 + wt2;
|
307 | | - wC = wt1 + wt21;
|
308 | | - wD = wt12 - wt2;
|
309 | | -
|
310 | | - trigV = trig[C];
|
311 | | -
|
312 | | - wACE = wA * trigV;
|
313 | | - wBCE = wB * trigV;
|
314 | | -
|
315 | | - trigV = trig[++C];
|
316 | | -
|
317 | | - wACO = wA * trigV;
|
318 | | - wBCO = wB * trigV;
|
319 | | -
|
320 | | - ++C;
|
321 | | -
|
322 | | - x[xx1++] = (wC + wACO + wBCE);
|
323 | | - x[xx2--] = (-wD + wBCO - wACE);
|
324 | | - x[xx1++] = (wD + wBCO - wACE);
|
325 | | - x[xx2--] = (wC - wACO - wBCE);
|
326 | | - }
|
327 | | -
|
328 | | - return x;
|
329 | | - }
|
330 | | -
|
331 | | - /*
|
332 | | - * Dummy function required for the haXe compiler to build this to
|
333 | | - * a .SWF file.
|
334 | | - */
|
335 | | - public static function main() : Void {
|
336 | | - }
|
337 | | -
|
338 | | -}
|
| 2 | +/* |
| 3 | + |
| 4 | +Copyright 2008 Tor-Einar Jarnbjo |
| 5 | + |
| 6 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | + you may not use this file except in compliance with the License. |
| 8 | + You may obtain a copy of the License at |
| 9 | + |
| 10 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | + |
| 12 | + Unless required by applicable law or agreed to in writing, software |
| 13 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | + See the License for the specific language governing permissions and |
| 16 | + limitations under the License. |
| 17 | + |
| 18 | +*/ |
| 19 | + |
| 20 | +package org.omtk.vorbis; |
| 21 | + |
| 22 | +import flash.Vector; |
| 23 | + |
| 24 | +class MdctHX { |
| 25 | + |
| 26 | + private static var cPI1_8:Float = 0.92387953251128675613; |
| 27 | + private static var cPI2_8:Float = 0.70710678118654752441; |
| 28 | + private static var cPI3_8:Float = 0.38268343236508977175; |
| 29 | + |
| 30 | + private var n:Int; |
| 31 | + private var log2n:Int; |
| 32 | + private var trig:Vector<Float>; |
| 33 | + private var bitrev:Vector<Int>; |
| 34 | + |
| 35 | + private var dtmp1:Float; |
| 36 | + private var dtmp2:Float; |
| 37 | + private var dtmp3:Float; |
| 38 | + private var dtmp4:Float; |
| 39 | + |
| 40 | + private var x:Vector<Float>; |
| 41 | + private var w:Vector<Float>; |
| 42 | + |
| 43 | + public function new(n:Int) { |
| 44 | + this.n = n; |
| 45 | + |
| 46 | + var i:Int; |
| 47 | + var j:Int; |
| 48 | + |
| 49 | + bitrev = new Vector<Int>(); |
| 50 | + trig = new Vector<Float>(Std.int(n+n/4), true); |
| 51 | + |
| 52 | + for(i in 0...Std.int(n+n/4)) { |
| 53 | + trig[i] = 0; |
| 54 | + } |
| 55 | + |
| 56 | + x = new Vector<Float>(Std.int(n/2), true); |
| 57 | + w = new Vector<Float>(Std.int(n/2), true); |
| 58 | + |
| 59 | + for(i in 0...Std.int(n/2)) { |
| 60 | + x[i] = 0; |
| 61 | + w[i] = 0; |
| 62 | + } |
| 63 | + |
| 64 | + var n2:Int = n >>> 1; |
| 65 | + log2n = Math.round(Math.log(n) / Math.log(2)); |
| 66 | + |
| 67 | + var AE:Int = 0; |
| 68 | + var AO:Int = 1; |
| 69 | + var BE:Int = Std.int(AE + n / 2); |
| 70 | + var BO:Int = BE + 1; |
| 71 | + var CE:Int = Std.int(BE + n / 2); |
| 72 | + var CO:Int = CE + 1; |
| 73 | + |
| 74 | + for (i in 0...Std.int(n/4)) { |
| 75 | + trig[AE + i * 2] = Math.cos((Math.PI / n) * (4 * i)); |
| 76 | + trig[AO + i * 2] = -Math.sin((Math.PI / n) * (4 * i)); |
| 77 | + trig[BE + i * 2] = Math.cos((Math.PI / (2 * n)) * (2 * i + 1)); |
| 78 | + trig[BO + i * 2] = Math.sin((Math.PI / (2 * n)) * (2 * i + 1)); |
| 79 | + } |
| 80 | + |
| 81 | + for (i in 0...Std.int(n/8)) { |
| 82 | + trig[CE + i * 2] = Math.cos((Math.PI / n) * (4 * i + 2)); |
| 83 | + trig[CO + i * 2] = -Math.sin((Math.PI / n) * (4 * i + 2)); |
| 84 | + } |
| 85 | + |
| 86 | + var mask:Int = (1 << (log2n - 1)) - 1; |
| 87 | + var msb:Int = 1 << (log2n - 2); |
| 88 | + |
| 89 | + for (i in 0...Std.int(n/8)) { |
| 90 | + var acc:Int = 0; |
| 91 | + j = 0; |
| 92 | + while(msb>>>j!=0) { |
| 93 | + if (((msb >>> j) & i) != 0) { |
| 94 | + acc |= 1 << j; |
| 95 | + } |
| 96 | + j++; |
| 97 | + } |
| 98 | + bitrev[i * 2] = ((~acc) & mask); |
| 99 | + bitrev[i * 2 + 1] = acc; |
| 100 | + } |
| 101 | + |
| 102 | + } |
| 103 | + |
| 104 | + public function imdct(frq:Vector<Float>, window:Vector<Float>, pcm:Vector<Float>):Void { |
| 105 | + |
| 106 | + var i:Int; |
| 107 | + |
| 108 | + var n2:Int; |
| 109 | + var n4:Int; |
| 110 | + var n8:Int; |
| 111 | + |
| 112 | + var inO:Int; |
| 113 | + var xO:Int; |
| 114 | + var A:Int; |
| 115 | + |
| 116 | + var temp1:Float; |
| 117 | + var temp2:Float; |
| 118 | + |
| 119 | + var B:Int; |
| 120 | + var o1:Int; |
| 121 | + var o2:Int; |
| 122 | + var o3:Int; |
| 123 | + var o4:Int; |
| 124 | + |
| 125 | + var xx:Int; |
| 126 | + var xxx:Vector<Float>; |
| 127 | + |
| 128 | + n2 = n >> 1; |
| 129 | + n4 = n >> 2; |
| 130 | + n8 = n >> 3; |
| 131 | + |
| 132 | + inO = -1; |
| 133 | + xO = 0; |
| 134 | + A = n2; |
| 135 | + |
| 136 | + temp1 = 0.0; |
| 137 | + temp2 = 0.0; |
| 138 | + |
| 139 | + for (i in 0...n8) { |
| 140 | + dtmp1 = frq[inO += 2]; |
| 141 | + dtmp2 = frq[inO += 2]; |
| 142 | + dtmp3 = trig[--A]; |
| 143 | + dtmp4 = trig[--A]; |
| 144 | + x[xO++] = -dtmp2 * dtmp3 - dtmp1 * dtmp4; |
| 145 | + x[xO++] = dtmp1 * dtmp3 - dtmp2 * dtmp4; |
| 146 | + } |
| 147 | + |
| 148 | + inO = n2; |
| 149 | + |
| 150 | + for(i in 0...n8) { |
| 151 | + dtmp1 = frq[inO -= 2]; |
| 152 | + dtmp2 = frq[inO -= 2]; |
| 153 | + dtmp3 = trig[--A]; |
| 154 | + dtmp4 = trig[--A]; |
| 155 | + x[xO++] = dtmp2 * dtmp3 + dtmp1 * dtmp4; |
| 156 | + x[xO++] = dtmp2 * dtmp4 - dtmp1 * dtmp3; |
| 157 | + } |
| 158 | + |
| 159 | + xxx = kernel(x, w, n, n2, n4, n8); |
| 160 | + xx = 0; |
| 161 | + |
| 162 | + B = n2; |
| 163 | + o1 = n4; |
| 164 | + o2 = o1 - 1; |
| 165 | + o3 = n4 + n2; |
| 166 | + o4 = o3 - 1; |
| 167 | + |
| 168 | + for (i in 0...n4) { |
| 169 | + dtmp1 = xxx[xx++]; |
| 170 | + dtmp2 = xxx[xx++]; |
| 171 | + dtmp3 = trig[B++]; |
| 172 | + dtmp4 = trig[B++]; |
| 173 | + |
| 174 | + temp1 = (dtmp1 * dtmp4 - dtmp2 * dtmp3); |
| 175 | + temp2 = -(dtmp1 * dtmp3 + dtmp2 * dtmp4); |
| 176 | + |
| 177 | + pcm[o1] = -temp1 * window[o1]; |
| 178 | + pcm[o2] = temp1 * window[o2]; |
| 179 | + pcm[o3] = temp2 * window[o3]; |
| 180 | + pcm[o4] = temp2 * window[o4]; |
| 181 | + |
| 182 | + o1++; |
| 183 | + o2--; |
| 184 | + o3++; |
| 185 | + o4--; |
| 186 | + } |
| 187 | + |
| 188 | + } |
| 189 | + |
| 190 | + private inline function kernel(x:Vector<Float>, w:Vector<Float>, n:Int, n2:Int, n4:Int, n8:Int):Vector<Float> { |
| 191 | + |
| 192 | + var i:Int; |
| 193 | + var r:Int; |
| 194 | + var s:Int; |
| 195 | + var rlim:Int; |
| 196 | + var slim:Int; |
| 197 | + |
| 198 | + var xA:Int = n4; |
| 199 | + var xB:Int = 0; |
| 200 | + var w1:Int = 0; |
| 201 | + var w2:Int = n4; |
| 202 | + var A:Int = n2; |
| 203 | + |
| 204 | + var x0:Float; |
| 205 | + var x1:Float; |
| 206 | + var wA:Float; |
| 207 | + var wB:Float; |
| 208 | + var wC:Float; |
| 209 | + var wD:Float; |
| 210 | + var k0:Int; |
| 211 | + var k1:Int; |
| 212 | + var t1:Int; |
| 213 | + var t2:Int; |
| 214 | + |
| 215 | + var wbase:Int; |
| 216 | + var temp:Vector<Float>; |
| 217 | + |
| 218 | + var wACE:Float; |
| 219 | + var wBCE:Float; |
| 220 | + var wACO:Float; |
| 221 | + var wBCO:Float; |
| 222 | + |
| 223 | + var AEv:Float; |
| 224 | + var AOv:Float; |
| 225 | + |
| 226 | + i=0; |
| 227 | + while(i < n4) { |
| 228 | + x0 = x[xA] - x[xB]; |
| 229 | + |
| 230 | + w[w2 + i] = x[xA++] + x[xB++]; |
| 231 | + |
| 232 | + x1 = x[xA] - x[xB]; |
| 233 | + A -= 4; |
| 234 | + |
| 235 | + w[i++] = x0 * trig[A] + x1 * trig[A + 1]; |
| 236 | + w[i] = x1 * trig[A] - x0 * trig[A + 1]; |
| 237 | + |
| 238 | + w[w2 + i] = x[xA++] + x[xB++]; |
| 239 | + i++; |
| 240 | + } |
| 241 | + |
| 242 | + for (i in 0...log2n-3) { |
| 243 | + k0 = n >>> (i + 2); |
| 244 | + k1 = 1 << (i + 3); |
| 245 | + wbase = n2 - 2; |
| 246 | + |
| 247 | + A = 0; |
| 248 | + |
| 249 | + rlim = k0 >>> 2; |
| 250 | + for (r in 0...rlim) { |
| 251 | + |
| 252 | + w1 = wbase; |
| 253 | + w2 = w1 - (k0 >> 1); |
| 254 | + AEv = trig[A]; |
| 255 | + AOv = trig[A + 1]; |
| 256 | + wbase -= 2; |
| 257 | + |
| 258 | + k0++; |
| 259 | + |
| 260 | + slim = 2 << i; |
| 261 | + for (s in 0...slim) { |
| 262 | + dtmp1 = w[w1]; |
| 263 | + dtmp2 = w[w2]; |
| 264 | + wB = dtmp1 - dtmp2; |
| 265 | + x[w1] = dtmp1 + dtmp2; |
| 266 | + dtmp1 = w[++w1]; |
| 267 | + dtmp2 = w[++w2]; |
| 268 | + wA = dtmp1 - dtmp2; |
| 269 | + x[w1] = dtmp1 + dtmp2; |
| 270 | + x[w2] = wA * AEv - wB * AOv; |
| 271 | + x[w2-1] = wB * AEv + wA * AOv; |
| 272 | + w1 -= k0; |
| 273 | + w2 -= k0; |
| 274 | + } |
| 275 | + k0--; |
| 276 | + A += k1; |
| 277 | + } |
| 278 | + |
| 279 | + temp = w; |
| 280 | + w = x; |
| 281 | + x = temp; |
| 282 | + } |
| 283 | + |
| 284 | + |
| 285 | + var C:Int = n; |
| 286 | + var bit:Int = 0; |
| 287 | + var xx1:Int = 0; |
| 288 | + var xx2:Int = n2 - 1; |
| 289 | + |
| 290 | + var wt1: Float; |
| 291 | + var wt2: Float; |
| 292 | + var wt12: Float; |
| 293 | + var wt21: Float; |
| 294 | + var trigV: Float; |
| 295 | + |
| 296 | + for (i in 0...n8) { |
| 297 | + t1 = bitrev[bit++]; |
| 298 | + t2 = bitrev[bit++]; |
| 299 | + |
| 300 | + wt1 = w[t1]; |
| 301 | + wt2 = w[t2]; |
| 302 | + wt12 = w[t1-1]; |
| 303 | + wt21 = w[t2+1]; |
| 304 | + |
| 305 | + wA = wt1 - wt21; |
| 306 | + wB = wt12 + wt2; |
| 307 | + wC = wt1 + wt21; |
| 308 | + wD = wt12 - wt2; |
| 309 | + |
| 310 | + trigV = trig[C]; |
| 311 | + |
| 312 | + wACE = wA * trigV; |
| 313 | + wBCE = wB * trigV; |
| 314 | + |
| 315 | + trigV = trig[++C]; |
| 316 | + |
| 317 | + wACO = wA * trigV; |
| 318 | + wBCO = wB * trigV; |
| 319 | + |
| 320 | + ++C; |
| 321 | + |
| 322 | + x[xx1++] = (wC + wACO + wBCE); |
| 323 | + x[xx2--] = (-wD + wBCO - wACE); |
| 324 | + x[xx1++] = (wD + wBCO - wACE); |
| 325 | + x[xx2--] = (wC - wACO - wBCE); |
| 326 | + } |
| 327 | + |
| 328 | + return x; |
| 329 | + } |
| 330 | + |
| 331 | + /* |
| 332 | + * Dummy function required for the haXe compiler to build this to |
| 333 | + * a .SWF file. |
| 334 | + */ |
| 335 | + public static function main() : Void { |
| 336 | + } |
| 337 | + |
| 338 | +} |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/src/haXe/org/omtk/vorbis/MdctHX.hx |
___________________________________________________________________ |
Added: svn:eol-style |
339 | 339 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/README.txt |
— | — | @@ -1,17 +1,17 @@ |
2 | | -
|
3 | | - *** PRELIMINARY SOFTWARE ***
|
4 | | -
|
5 | | -Please note that this is a prerelease of the OMTK Flash library. No
|
6 | | -quality of this software can be guaranteed.
|
7 | | -
|
8 | | -
|
9 | | - *** haXe notes ***
|
10 | | -
|
11 | | -You need at least haXe 2.01 (with support for the new Flash 10 types)
|
12 | | -to compile the haXe source.
|
13 | | -
|
14 | | - *** Flash notes ***
|
15 | | -
|
16 | | -I am not able to create a .SWC library from the haXe .SWF file. It's
|
17 | | -therefore dynamically linked at runtime and hxmdct.swf must be placed
|
18 | | -in the same directory as the "real" Flash movie.
|
| 2 | + |
| 3 | + *** PRELIMINARY SOFTWARE *** |
| 4 | + |
| 5 | +Please note that this is a prerelease of the OMTK Flash library. No |
| 6 | +quality of this software can be guaranteed. |
| 7 | + |
| 8 | + |
| 9 | + *** haXe notes *** |
| 10 | + |
| 11 | +You need at least haXe 2.01 (with support for the new Flash 10 types) |
| 12 | +to compile the haXe source. |
| 13 | + |
| 14 | + *** Flash notes *** |
| 15 | + |
| 16 | +I am not able to create a .SWC library from the haXe .SWF file. It's |
| 17 | +therefore dynamically linked at runtime and hxmdct.swf must be placed |
| 18 | +in the same directory as the "real" Flash movie. |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/README.txt |
___________________________________________________________________ |
Added: svn:eol-style |
19 | 19 | + native |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/LICENSE.txt |
— | — | @@ -1,201 +1,201 @@ |
2 | | - Apache License
|
3 | | - Version 2.0, January 2004
|
4 | | - http://www.apache.org/licenses/
|
5 | | -
|
6 | | - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
7 | | -
|
8 | | - 1. Definitions.
|
9 | | -
|
10 | | - "License" shall mean the terms and conditions for use, reproduction,
|
11 | | - and distribution as defined by Sections 1 through 9 of this document.
|
12 | | -
|
13 | | - "Licensor" shall mean the copyright owner or entity authorized by
|
14 | | - the copyright owner that is granting the License.
|
15 | | -
|
16 | | - "Legal Entity" shall mean the union of the acting entity and all
|
17 | | - other entities that control, are controlled by, or are under common
|
18 | | - control with that entity. For the purposes of this definition,
|
19 | | - "control" means (i) the power, direct or indirect, to cause the
|
20 | | - direction or management of such entity, whether by contract or
|
21 | | - otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
22 | | - outstanding shares, or (iii) beneficial ownership of such entity.
|
23 | | -
|
24 | | - "You" (or "Your") shall mean an individual or Legal Entity
|
25 | | - exercising permissions granted by this License.
|
26 | | -
|
27 | | - "Source" form shall mean the preferred form for making modifications,
|
28 | | - including but not limited to software source code, documentation
|
29 | | - source, and configuration files.
|
30 | | -
|
31 | | - "Object" form shall mean any form resulting from mechanical
|
32 | | - transformation or translation of a Source form, including but
|
33 | | - not limited to compiled object code, generated documentation,
|
34 | | - and conversions to other media types.
|
35 | | -
|
36 | | - "Work" shall mean the work of authorship, whether in Source or
|
37 | | - Object form, made available under the License, as indicated by a
|
38 | | - copyright notice that is included in or attached to the work
|
39 | | - (an example is provided in the Appendix below).
|
40 | | -
|
41 | | - "Derivative Works" shall mean any work, whether in Source or Object
|
42 | | - form, that is based on (or derived from) the Work and for which the
|
43 | | - editorial revisions, annotations, elaborations, or other modifications
|
44 | | - represent, as a whole, an original work of authorship. For the purposes
|
45 | | - of this License, Derivative Works shall not include works that remain
|
46 | | - separable from, or merely link (or bind by name) to the interfaces of,
|
47 | | - the Work and Derivative Works thereof.
|
48 | | -
|
49 | | - "Contribution" shall mean any work of authorship, including
|
50 | | - the original version of the Work and any modifications or additions
|
51 | | - to that Work or Derivative Works thereof, that is intentionally
|
52 | | - submitted to Licensor for inclusion in the Work by the copyright owner
|
53 | | - or by an individual or Legal Entity authorized to submit on behalf of
|
54 | | - the copyright owner. For the purposes of this definition, "submitted"
|
55 | | - means any form of electronic, verbal, or written communication sent
|
56 | | - to the Licensor or its representatives, including but not limited to
|
57 | | - communication on electronic mailing lists, source code control systems,
|
58 | | - and issue tracking systems that are managed by, or on behalf of, the
|
59 | | - Licensor for the purpose of discussing and improving the Work, but
|
60 | | - excluding communication that is conspicuously marked or otherwise
|
61 | | - designated in writing by the copyright owner as "Not a Contribution."
|
62 | | -
|
63 | | - "Contributor" shall mean Licensor and any individual or Legal Entity
|
64 | | - on behalf of whom a Contribution has been received by Licensor and
|
65 | | - subsequently incorporated within the Work.
|
66 | | -
|
67 | | - 2. Grant of Copyright License. Subject to the terms and conditions of
|
68 | | - this License, each Contributor hereby grants to You a perpetual,
|
69 | | - worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
70 | | - copyright license to reproduce, prepare Derivative Works of,
|
71 | | - publicly display, publicly perform, sublicense, and distribute the
|
72 | | - Work and such Derivative Works in Source or Object form.
|
73 | | -
|
74 | | - 3. Grant of Patent License. Subject to the terms and conditions of
|
75 | | - this License, each Contributor hereby grants to You a perpetual,
|
76 | | - worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
77 | | - (except as stated in this section) patent license to make, have made,
|
78 | | - use, offer to sell, sell, import, and otherwise transfer the Work,
|
79 | | - where such license applies only to those patent claims licensable
|
80 | | - by such Contributor that are necessarily infringed by their
|
81 | | - Contribution(s) alone or by combination of their Contribution(s)
|
82 | | - with the Work to which such Contribution(s) was submitted. If You
|
83 | | - institute patent litigation against any entity (including a
|
84 | | - cross-claim or counterclaim in a lawsuit) alleging that the Work
|
85 | | - or a Contribution incorporated within the Work constitutes direct
|
86 | | - or contributory patent infringement, then any patent licenses
|
87 | | - granted to You under this License for that Work shall terminate
|
88 | | - as of the date such litigation is filed.
|
89 | | -
|
90 | | - 4. Redistribution. You may reproduce and distribute copies of the
|
91 | | - Work or Derivative Works thereof in any medium, with or without
|
92 | | - modifications, and in Source or Object form, provided that You
|
93 | | - meet the following conditions:
|
94 | | -
|
95 | | - (a) You must give any other recipients of the Work or
|
96 | | - Derivative Works a copy of this License; and
|
97 | | -
|
98 | | - (b) You must cause any modified files to carry prominent notices
|
99 | | - stating that You changed the files; and
|
100 | | -
|
101 | | - (c) You must retain, in the Source form of any Derivative Works
|
102 | | - that You distribute, all copyright, patent, trademark, and
|
103 | | - attribution notices from the Source form of the Work,
|
104 | | - excluding those notices that do not pertain to any part of
|
105 | | - the Derivative Works; and
|
106 | | -
|
107 | | - (d) If the Work includes a "NOTICE" text file as part of its
|
108 | | - distribution, then any Derivative Works that You distribute must
|
109 | | - include a readable copy of the attribution notices contained
|
110 | | - within such NOTICE file, excluding those notices that do not
|
111 | | - pertain to any part of the Derivative Works, in at least one
|
112 | | - of the following places: within a NOTICE text file distributed
|
113 | | - as part of the Derivative Works; within the Source form or
|
114 | | - documentation, if provided along with the Derivative Works; or,
|
115 | | - within a display generated by the Derivative Works, if and
|
116 | | - wherever such third-party notices normally appear. The contents
|
117 | | - of the NOTICE file are for informational purposes only and
|
118 | | - do not modify the License. You may add Your own attribution
|
119 | | - notices within Derivative Works that You distribute, alongside
|
120 | | - or as an addendum to the NOTICE text from the Work, provided
|
121 | | - that such additional attribution notices cannot be construed
|
122 | | - as modifying the License.
|
123 | | -
|
124 | | - You may add Your own copyright statement to Your modifications and
|
125 | | - may provide additional or different license terms and conditions
|
126 | | - for use, reproduction, or distribution of Your modifications, or
|
127 | | - for any such Derivative Works as a whole, provided Your use,
|
128 | | - reproduction, and distribution of the Work otherwise complies with
|
129 | | - the conditions stated in this License.
|
130 | | -
|
131 | | - 5. Submission of Contributions. Unless You explicitly state otherwise,
|
132 | | - any Contribution intentionally submitted for inclusion in the Work
|
133 | | - by You to the Licensor shall be under the terms and conditions of
|
134 | | - this License, without any additional terms or conditions.
|
135 | | - Notwithstanding the above, nothing herein shall supersede or modify
|
136 | | - the terms of any separate license agreement you may have executed
|
137 | | - with Licensor regarding such Contributions.
|
138 | | -
|
139 | | - 6. Trademarks. This License does not grant permission to use the trade
|
140 | | - names, trademarks, service marks, or product names of the Licensor,
|
141 | | - except as required for reasonable and customary use in describing the
|
142 | | - origin of the Work and reproducing the content of the NOTICE file.
|
143 | | -
|
144 | | - 7. Disclaimer of Warranty. Unless required by applicable law or
|
145 | | - agreed to in writing, Licensor provides the Work (and each
|
146 | | - Contributor provides its Contributions) on an "AS IS" BASIS,
|
147 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
148 | | - implied, including, without limitation, any warranties or conditions
|
149 | | - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
150 | | - PARTICULAR PURPOSE. You are solely responsible for determining the
|
151 | | - appropriateness of using or redistributing the Work and assume any
|
152 | | - risks associated with Your exercise of permissions under this License.
|
153 | | -
|
154 | | - 8. Limitation of Liability. In no event and under no legal theory,
|
155 | | - whether in tort (including negligence), contract, or otherwise,
|
156 | | - unless required by applicable law (such as deliberate and grossly
|
157 | | - negligent acts) or agreed to in writing, shall any Contributor be
|
158 | | - liable to You for damages, including any direct, indirect, special,
|
159 | | - incidental, or consequential damages of any character arising as a
|
160 | | - result of this License or out of the use or inability to use the
|
161 | | - Work (including but not limited to damages for loss of goodwill,
|
162 | | - work stoppage, computer failure or malfunction, or any and all
|
163 | | - other commercial damages or losses), even if such Contributor
|
164 | | - has been advised of the possibility of such damages.
|
165 | | -
|
166 | | - 9. Accepting Warranty or Additional Liability. While redistributing
|
167 | | - the Work or Derivative Works thereof, You may choose to offer,
|
168 | | - and charge a fee for, acceptance of support, warranty, indemnity,
|
169 | | - or other liability obligations and/or rights consistent with this
|
170 | | - License. However, in accepting such obligations, You may act only
|
171 | | - on Your own behalf and on Your sole responsibility, not on behalf
|
172 | | - of any other Contributor, and only if You agree to indemnify,
|
173 | | - defend, and hold each Contributor harmless for any liability
|
174 | | - incurred by, or claims asserted against, such Contributor by reason
|
175 | | - of your accepting any such warranty or additional liability.
|
176 | | -
|
177 | | - END OF TERMS AND CONDITIONS
|
178 | | -
|
179 | | - APPENDIX: How to apply the Apache License to your work.
|
180 | | -
|
181 | | - To apply the Apache License to your work, attach the following
|
182 | | - boilerplate notice, with the fields enclosed by brackets "[]"
|
183 | | - replaced with your own identifying information. (Don't include
|
184 | | - the brackets!) The text should be enclosed in the appropriate
|
185 | | - comment syntax for the file format. We also recommend that a
|
186 | | - file or class name and description of purpose be included on the
|
187 | | - same "printed page" as the copyright notice for easier
|
188 | | - identification within third-party archives.
|
189 | | -
|
190 | | - Copyright 2008 Tor-Einar Jarnbjo
|
191 | | -
|
192 | | - Licensed under the Apache License, Version 2.0 (the "License");
|
193 | | - you may not use this file except in compliance with the License.
|
194 | | - You may obtain a copy of the License at
|
195 | | -
|
196 | | - http://www.apache.org/licenses/LICENSE-2.0
|
197 | | -
|
198 | | - Unless required by applicable law or agreed to in writing, software
|
199 | | - distributed under the License is distributed on an "AS IS" BASIS,
|
200 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
201 | | - See the License for the specific language governing permissions and
|
202 | | - limitations under the License.
|
| 2 | + Apache License |
| 3 | + Version 2.0, January 2004 |
| 4 | + http://www.apache.org/licenses/ |
| 5 | + |
| 6 | + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
| 7 | + |
| 8 | + 1. Definitions. |
| 9 | + |
| 10 | + "License" shall mean the terms and conditions for use, reproduction, |
| 11 | + and distribution as defined by Sections 1 through 9 of this document. |
| 12 | + |
| 13 | + "Licensor" shall mean the copyright owner or entity authorized by |
| 14 | + the copyright owner that is granting the License. |
| 15 | + |
| 16 | + "Legal Entity" shall mean the union of the acting entity and all |
| 17 | + other entities that control, are controlled by, or are under common |
| 18 | + control with that entity. For the purposes of this definition, |
| 19 | + "control" means (i) the power, direct or indirect, to cause the |
| 20 | + direction or management of such entity, whether by contract or |
| 21 | + otherwise, or (ii) ownership of fifty percent (50%) or more of the |
| 22 | + outstanding shares, or (iii) beneficial ownership of such entity. |
| 23 | + |
| 24 | + "You" (or "Your") shall mean an individual or Legal Entity |
| 25 | + exercising permissions granted by this License. |
| 26 | + |
| 27 | + "Source" form shall mean the preferred form for making modifications, |
| 28 | + including but not limited to software source code, documentation |
| 29 | + source, and configuration files. |
| 30 | + |
| 31 | + "Object" form shall mean any form resulting from mechanical |
| 32 | + transformation or translation of a Source form, including but |
| 33 | + not limited to compiled object code, generated documentation, |
| 34 | + and conversions to other media types. |
| 35 | + |
| 36 | + "Work" shall mean the work of authorship, whether in Source or |
| 37 | + Object form, made available under the License, as indicated by a |
| 38 | + copyright notice that is included in or attached to the work |
| 39 | + (an example is provided in the Appendix below). |
| 40 | + |
| 41 | + "Derivative Works" shall mean any work, whether in Source or Object |
| 42 | + form, that is based on (or derived from) the Work and for which the |
| 43 | + editorial revisions, annotations, elaborations, or other modifications |
| 44 | + represent, as a whole, an original work of authorship. For the purposes |
| 45 | + of this License, Derivative Works shall not include works that remain |
| 46 | + separable from, or merely link (or bind by name) to the interfaces of, |
| 47 | + the Work and Derivative Works thereof. |
| 48 | + |
| 49 | + "Contribution" shall mean any work of authorship, including |
| 50 | + the original version of the Work and any modifications or additions |
| 51 | + to that Work or Derivative Works thereof, that is intentionally |
| 52 | + submitted to Licensor for inclusion in the Work by the copyright owner |
| 53 | + or by an individual or Legal Entity authorized to submit on behalf of |
| 54 | + the copyright owner. For the purposes of this definition, "submitted" |
| 55 | + means any form of electronic, verbal, or written communication sent |
| 56 | + to the Licensor or its representatives, including but not limited to |
| 57 | + communication on electronic mailing lists, source code control systems, |
| 58 | + and issue tracking systems that are managed by, or on behalf of, the |
| 59 | + Licensor for the purpose of discussing and improving the Work, but |
| 60 | + excluding communication that is conspicuously marked or otherwise |
| 61 | + designated in writing by the copyright owner as "Not a Contribution." |
| 62 | + |
| 63 | + "Contributor" shall mean Licensor and any individual or Legal Entity |
| 64 | + on behalf of whom a Contribution has been received by Licensor and |
| 65 | + subsequently incorporated within the Work. |
| 66 | + |
| 67 | + 2. Grant of Copyright License. Subject to the terms and conditions of |
| 68 | + this License, each Contributor hereby grants to You a perpetual, |
| 69 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
| 70 | + copyright license to reproduce, prepare Derivative Works of, |
| 71 | + publicly display, publicly perform, sublicense, and distribute the |
| 72 | + Work and such Derivative Works in Source or Object form. |
| 73 | + |
| 74 | + 3. Grant of Patent License. Subject to the terms and conditions of |
| 75 | + this License, each Contributor hereby grants to You a perpetual, |
| 76 | + worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
| 77 | + (except as stated in this section) patent license to make, have made, |
| 78 | + use, offer to sell, sell, import, and otherwise transfer the Work, |
| 79 | + where such license applies only to those patent claims licensable |
| 80 | + by such Contributor that are necessarily infringed by their |
| 81 | + Contribution(s) alone or by combination of their Contribution(s) |
| 82 | + with the Work to which such Contribution(s) was submitted. If You |
| 83 | + institute patent litigation against any entity (including a |
| 84 | + cross-claim or counterclaim in a lawsuit) alleging that the Work |
| 85 | + or a Contribution incorporated within the Work constitutes direct |
| 86 | + or contributory patent infringement, then any patent licenses |
| 87 | + granted to You under this License for that Work shall terminate |
| 88 | + as of the date such litigation is filed. |
| 89 | + |
| 90 | + 4. Redistribution. You may reproduce and distribute copies of the |
| 91 | + Work or Derivative Works thereof in any medium, with or without |
| 92 | + modifications, and in Source or Object form, provided that You |
| 93 | + meet the following conditions: |
| 94 | + |
| 95 | + (a) You must give any other recipients of the Work or |
| 96 | + Derivative Works a copy of this License; and |
| 97 | + |
| 98 | + (b) You must cause any modified files to carry prominent notices |
| 99 | + stating that You changed the files; and |
| 100 | + |
| 101 | + (c) You must retain, in the Source form of any Derivative Works |
| 102 | + that You distribute, all copyright, patent, trademark, and |
| 103 | + attribution notices from the Source form of the Work, |
| 104 | + excluding those notices that do not pertain to any part of |
| 105 | + the Derivative Works; and |
| 106 | + |
| 107 | + (d) If the Work includes a "NOTICE" text file as part of its |
| 108 | + distribution, then any Derivative Works that You distribute must |
| 109 | + include a readable copy of the attribution notices contained |
| 110 | + within such NOTICE file, excluding those notices that do not |
| 111 | + pertain to any part of the Derivative Works, in at least one |
| 112 | + of the following places: within a NOTICE text file distributed |
| 113 | + as part of the Derivative Works; within the Source form or |
| 114 | + documentation, if provided along with the Derivative Works; or, |
| 115 | + within a display generated by the Derivative Works, if and |
| 116 | + wherever such third-party notices normally appear. The contents |
| 117 | + of the NOTICE file are for informational purposes only and |
| 118 | + do not modify the License. You may add Your own attribution |
| 119 | + notices within Derivative Works that You distribute, alongside |
| 120 | + or as an addendum to the NOTICE text from the Work, provided |
| 121 | + that such additional attribution notices cannot be construed |
| 122 | + as modifying the License. |
| 123 | + |
| 124 | + You may add Your own copyright statement to Your modifications and |
| 125 | + may provide additional or different license terms and conditions |
| 126 | + for use, reproduction, or distribution of Your modifications, or |
| 127 | + for any such Derivative Works as a whole, provided Your use, |
| 128 | + reproduction, and distribution of the Work otherwise complies with |
| 129 | + the conditions stated in this License. |
| 130 | + |
| 131 | + 5. Submission of Contributions. Unless You explicitly state otherwise, |
| 132 | + any Contribution intentionally submitted for inclusion in the Work |
| 133 | + by You to the Licensor shall be under the terms and conditions of |
| 134 | + this License, without any additional terms or conditions. |
| 135 | + Notwithstanding the above, nothing herein shall supersede or modify |
| 136 | + the terms of any separate license agreement you may have executed |
| 137 | + with Licensor regarding such Contributions. |
| 138 | + |
| 139 | + 6. Trademarks. This License does not grant permission to use the trade |
| 140 | + names, trademarks, service marks, or product names of the Licensor, |
| 141 | + except as required for reasonable and customary use in describing the |
| 142 | + origin of the Work and reproducing the content of the NOTICE file. |
| 143 | + |
| 144 | + 7. Disclaimer of Warranty. Unless required by applicable law or |
| 145 | + agreed to in writing, Licensor provides the Work (and each |
| 146 | + Contributor provides its Contributions) on an "AS IS" BASIS, |
| 147 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
| 148 | + implied, including, without limitation, any warranties or conditions |
| 149 | + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
| 150 | + PARTICULAR PURPOSE. You are solely responsible for determining the |
| 151 | + appropriateness of using or redistributing the Work and assume any |
| 152 | + risks associated with Your exercise of permissions under this License. |
| 153 | + |
| 154 | + 8. Limitation of Liability. In no event and under no legal theory, |
| 155 | + whether in tort (including negligence), contract, or otherwise, |
| 156 | + unless required by applicable law (such as deliberate and grossly |
| 157 | + negligent acts) or agreed to in writing, shall any Contributor be |
| 158 | + liable to You for damages, including any direct, indirect, special, |
| 159 | + incidental, or consequential damages of any character arising as a |
| 160 | + result of this License or out of the use or inability to use the |
| 161 | + Work (including but not limited to damages for loss of goodwill, |
| 162 | + work stoppage, computer failure or malfunction, or any and all |
| 163 | + other commercial damages or losses), even if such Contributor |
| 164 | + has been advised of the possibility of such damages. |
| 165 | + |
| 166 | + 9. Accepting Warranty or Additional Liability. While redistributing |
| 167 | + the Work or Derivative Works thereof, You may choose to offer, |
| 168 | + and charge a fee for, acceptance of support, warranty, indemnity, |
| 169 | + or other liability obligations and/or rights consistent with this |
| 170 | + License. However, in accepting such obligations, You may act only |
| 171 | + on Your own behalf and on Your sole responsibility, not on behalf |
| 172 | + of any other Contributor, and only if You agree to indemnify, |
| 173 | + defend, and hold each Contributor harmless for any liability |
| 174 | + incurred by, or claims asserted against, such Contributor by reason |
| 175 | + of your accepting any such warranty or additional liability. |
| 176 | + |
| 177 | + END OF TERMS AND CONDITIONS |
| 178 | + |
| 179 | + APPENDIX: How to apply the Apache License to your work. |
| 180 | + |
| 181 | + To apply the Apache License to your work, attach the following |
| 182 | + boilerplate notice, with the fields enclosed by brackets "[]" |
| 183 | + replaced with your own identifying information. (Don't include |
| 184 | + the brackets!) The text should be enclosed in the appropriate |
| 185 | + comment syntax for the file format. We also recommend that a |
| 186 | + file or class name and description of purpose be included on the |
| 187 | + same "printed page" as the copyright notice for easier |
| 188 | + identification within third-party archives. |
| 189 | + |
| 190 | + Copyright 2008 Tor-Einar Jarnbjo |
| 191 | + |
| 192 | + Licensed under the Apache License, Version 2.0 (the "License"); |
| 193 | + you may not use this file except in compliance with the License. |
| 194 | + You may obtain a copy of the License at |
| 195 | + |
| 196 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 197 | + |
| 198 | + Unless required by applicable law or agreed to in writing, software |
| 199 | + distributed under the License is distributed on an "AS IS" BASIS, |
| 200 | + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 201 | + See the License for the specific language governing permissions and |
| 202 | + limitations under the License. |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/binPlayers/omtk-fx/LICENSE.txt |
___________________________________________________________________ |
Added: svn:eol-style |
203 | 203 | + native |
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/fresh_smil_load.php |
___________________________________________________________________ |
Added: svn:eol-style |
204 | 204 | + native |
Property changes on: trunk/extensions/uniwiki/RELEASE-NOTES |
___________________________________________________________________ |
Added: svn:eol-style |
205 | 205 | + native |