* added remote_insert_description (for adding linkback in html inserts of media)
[lhc/web/wiklou.git] / js2 / mwEmbed / binPlayers / omtk-fx / src / as / org / omtk / vorbis / Mode.as
1 /*
2
3 Copyright 2008 Tor-Einar Jarnbjo
4
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
8
9 http://www.apache.org/licenses/LICENSE-2.0
10
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
16
17 */
18
19 package org.omtk.vorbis {
20
21 import flash.errors.IllegalOperationError;
22 import flash.utils.Dictionary;
23 import org.omtk.util.BitByteArray;
24
25 public class Mode
26 {
27 private var _blockFlag:Boolean;
28 private var _windowType:uint;
29 private var _transformType:uint;
30 private var _mapping:uint;
31
32 public function Mode(source:BitByteArray, header:SetupHeader) {
33
34 _blockFlag=source.readBit();
35 _windowType=source.readUnsignedBitwiseInt(16);
36 _transformType=source.readUnsignedBitwiseInt(16);
37 _mapping=source.readUnsignedBitwiseInt(8);
38
39 if(_windowType!=0) {
40 throw new Error("Window type = "+windowType+", != 0");
41 }
42
43 if(_transformType!=0) {
44 throw new Error("Transform type = "+transformType+", != 0");
45 }
46
47 if(_mapping > header.mappings.length) {
48 throw new Error("Mode mapping number is higher than total number of mappings.");
49 }
50 }
51
52 public function get blockFlag():Boolean {
53 return _blockFlag;
54 }
55
56 public function get windowType():uint {
57 return _windowType;
58 }
59
60 public function get transformType():uint {
61 return _transformType;
62 }
63
64 public function get mapping():uint {
65 return _mapping;
66 }
67
68 }
69
70 }