dd checks/rejection for absurdly huge codebooks.
[xiph/unicode.git] / souffleur / oggStream.py
blob8250153f54015db9c2e843f95b770911f861ef93
1 __name__="oggStream - class of stream in OGG files"
2 __author__="Maxim Litvinov (aka DarakuTenshi) otaky<at>ukr.net"
4 import os
6 OGG_STREAM_VIDEO=1
7 OGG_STREAM_AUDIO=2
8 OGG_STREAM_TEXT=3
10 class oggStream:
11 """
12 Class for processing stream in OGG file.
13 """
14 #==============================================================================
15 def __init__(self, streamSerial, streamType, streamSource):
16 """
17 @brief Constructor of oggStream class
18 @param[IN] streamSerial - serial number of stream in OGG file
19 @param[IN] streamType - one char type id of stream (output from ogginfo tool)
20 """
21 self.serial=streamSerial
22 self.source=streamSource
23 self.intType=0
24 self.strType=""
25 if(streamType=="v"): self.strType="video"; self.intType=OGG_STREAM_VIDEO
26 if(streamType=="a"): self.strType="audio"; self.intType=OGG_STREAM_AUDIO
27 if(streamType=="t"): self.strType="text"; self.intType=OGG_STREAM_TEXT
28 self.attrNames=[]
29 self.attrValues=[]
30 return
31 #==============================================================================
32 def getSource(self):
33 """
34 Return stream source
35 """
36 return self.source;
37 #==============================================================================
38 def getType(self):
39 """
40 Return integer value of type of stream
41 """
42 return self.intType
43 #==============================================================================
44 def getStrType(self):
45 """
46 Return string value of type of stream
47 """
48 return self.strType
49 #==============================================================================
50 def getSerial(self):
51 """
52 Return serial number of stream
53 """
54 return self.serial
55 #==============================================================================
56 def getAttr(self, attrIndex):
57 """
58 @brief return attribute of stream.
60 This function return list of attribute name and attribute value,
61 by index.
62 @param[IN] attrIndex - index of requested attribute.
63 @return list where 0 element is attribute name, and 1st - value.
64 """
65 RET=[]
66 RET.append(self.attrNames[attrIndex])
67 RET.append(self.attrValues[attrIndex])
68 return RET
69 #==============================================================================
70 def addAttr(self, attrName, attrValue):
71 """
72 @brief add attribute to stream
74 @param[IN] attrName - name of attribute
75 @param[IN] attrValue - value of attribute
76 """
77 self.attrNames.append(attrName)
78 self.attrValues.append(attrValue)
79 return
80 #==============================================================================
81 def getAttrNumber(self):
82 """
83 Get number of attributes.
84 @return Attributes number.
85 """
86 return len(self.attrNames)
87 #==============================================================================