Commit RELEASE-NOTES line for the wgCategories js variable I added some time ago.
[lhc/web/wiklou.git] / js2 / mwEmbed / libEmbedVideo / binPlayers / omtk-fx / src / as / org / omtk / vorbis / CommentHeader.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.utils.ByteArray;
22 import flash.utils.Endian;
23 import flash.utils.Dictionary;
24 import org.omtk.ogg.*;
25
26 public class CommentHeader {
27
28 private var _vendor:String;
29 private var _comments:Dictionary = new Dictionary();
30
31 public function CommentHeader(source:ByteArray)
32 {
33 init( source );
34 }
35
36 private function init( source: ByteArray ): void
37 {
38 source.readByte();
39 source.readByte();
40 source.readByte();
41 source.readByte();
42 source.readByte();
43 source.readByte();
44
45 _vendor = readUtf8String(source);
46
47 var ucLength:int = source.readUnsignedInt();
48
49 for(var i:int = 0; i < ucLength; i++) {
50 var comment:String = readUtf8String(source);
51 var ix:int = comment.indexOf('=');
52 var key:String = comment.substring(0, ix);
53 var value:String = comment.substring(ix+1);
54 _comments[key.toUpperCase()]=value;
55 }
56 }
57
58 private function readUtf8String(source:ByteArray):String {
59 var length:uint = source.readUnsignedInt();
60 return source.readUTFBytes(length);
61 }
62
63 public function get vendor():String {
64 return _vendor;
65 }
66
67 public function get comments():Dictionary {
68 return _comments;
69 }
70
71 public function get artist():String {
72 return _comments["ARTIST"];
73 }
74
75 public function get title():String {
76 return _comments["TITLE"];
77 }
78
79 }
80
81 }