00001 """autogenerated by genpy from theora_image_transport/Packet.msg. Do not edit."""
00002 import sys
00003 python3 = True if sys.hexversion > 0x03000000 else False
00004 import genpy
00005 import struct
00006
00007 import std_msgs.msg
00008
00009 class Packet(genpy.Message):
00010 _md5sum = "33ac4e14a7cff32e7e0d65f18bb410f3"
00011 _type = "theora_image_transport/Packet"
00012 _has_header = True
00013 _full_text = """# ROS message adaptation of the ogg_packet struct from libogg,
00014 # see http://www.xiph.org/ogg/doc/libogg/ogg_packet.html.
00015
00016 Header header # Original sensor_msgs/Image header
00017 uint8[] data # Raw Theora packet data (combines packet and bytes fields from ogg_packet)
00018 int32 b_o_s # Flag indicating whether this packet begins a logical bitstream
00019 int32 e_o_s # Flag indicating whether this packet ends a bitstream
00020 int64 granulepos # A number indicating the position of this packet in the decoded data
00021 int64 packetno # Sequential number of this packet in the ogg bitstream
00022
00023 ================================================================================
00024 MSG: std_msgs/Header
00025 # Standard metadata for higher-level stamped data types.
00026 # This is generally used to communicate timestamped data
00027 # in a particular coordinate frame.
00028 #
00029 # sequence ID: consecutively increasing ID
00030 uint32 seq
00031 #Two-integer timestamp that is expressed as:
00032 # * stamp.secs: seconds (stamp_secs) since epoch
00033 # * stamp.nsecs: nanoseconds since stamp_secs
00034 # time-handling sugar is provided by the client library
00035 time stamp
00036 #Frame this data is associated with
00037 # 0: no frame
00038 # 1: global frame
00039 string frame_id
00040
00041 """
00042 __slots__ = ['header','data','b_o_s','e_o_s','granulepos','packetno']
00043 _slot_types = ['std_msgs/Header','uint8[]','int32','int32','int64','int64']
00044
00045 def __init__(self, *args, **kwds):
00046 """
00047 Constructor. Any message fields that are implicitly/explicitly
00048 set to None will be assigned a default value. The recommend
00049 use is keyword arguments as this is more robust to future message
00050 changes. You cannot mix in-order arguments and keyword arguments.
00051
00052 The available fields are:
00053 header,data,b_o_s,e_o_s,granulepos,packetno
00054
00055 :param args: complete set of field values, in .msg order
00056 :param kwds: use keyword arguments corresponding to message field names
00057 to set specific fields.
00058 """
00059 if args or kwds:
00060 super(Packet, self).__init__(*args, **kwds)
00061
00062 if self.header is None:
00063 self.header = std_msgs.msg.Header()
00064 if self.data is None:
00065 self.data = ''
00066 if self.b_o_s is None:
00067 self.b_o_s = 0
00068 if self.e_o_s is None:
00069 self.e_o_s = 0
00070 if self.granulepos is None:
00071 self.granulepos = 0
00072 if self.packetno is None:
00073 self.packetno = 0
00074 else:
00075 self.header = std_msgs.msg.Header()
00076 self.data = ''
00077 self.b_o_s = 0
00078 self.e_o_s = 0
00079 self.granulepos = 0
00080 self.packetno = 0
00081
00082 def _get_types(self):
00083 """
00084 internal API method
00085 """
00086 return self._slot_types
00087
00088 def serialize(self, buff):
00089 """
00090 serialize message into buffer
00091 :param buff: buffer, ``StringIO``
00092 """
00093 try:
00094 _x = self
00095 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00096 _x = self.header.frame_id
00097 length = len(_x)
00098 if python3 or type(_x) == unicode:
00099 _x = _x.encode('utf-8')
00100 length = len(_x)
00101 buff.write(struct.pack('<I%ss'%length, length, _x))
00102 _x = self.data
00103 length = len(_x)
00104
00105 if type(_x) in [list, tuple]:
00106 buff.write(struct.pack('<I%sB'%length, length, *_x))
00107 else:
00108 buff.write(struct.pack('<I%ss'%length, length, _x))
00109 _x = self
00110 buff.write(_struct_2i2q.pack(_x.b_o_s, _x.e_o_s, _x.granulepos, _x.packetno))
00111 except struct.error as se: self._check_types(se)
00112 except TypeError as te: self._check_types(te)
00113
00114 def deserialize(self, str):
00115 """
00116 unpack serialized message in str into this message instance
00117 :param str: byte array of serialized message, ``str``
00118 """
00119 try:
00120 if self.header is None:
00121 self.header = std_msgs.msg.Header()
00122 end = 0
00123 _x = self
00124 start = end
00125 end += 12
00126 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00127 start = end
00128 end += 4
00129 (length,) = _struct_I.unpack(str[start:end])
00130 start = end
00131 end += length
00132 if python3:
00133 self.header.frame_id = str[start:end].decode('utf-8')
00134 else:
00135 self.header.frame_id = str[start:end]
00136 start = end
00137 end += 4
00138 (length,) = _struct_I.unpack(str[start:end])
00139 start = end
00140 end += length
00141 if python3:
00142 self.data = str[start:end].decode('utf-8')
00143 else:
00144 self.data = str[start:end]
00145 _x = self
00146 start = end
00147 end += 24
00148 (_x.b_o_s, _x.e_o_s, _x.granulepos, _x.packetno,) = _struct_2i2q.unpack(str[start:end])
00149 return self
00150 except struct.error as e:
00151 raise genpy.DeserializationError(e)
00152
00153
00154 def serialize_numpy(self, buff, numpy):
00155 """
00156 serialize message with numpy array types into buffer
00157 :param buff: buffer, ``StringIO``
00158 :param numpy: numpy python module
00159 """
00160 try:
00161 _x = self
00162 buff.write(_struct_3I.pack(_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs))
00163 _x = self.header.frame_id
00164 length = len(_x)
00165 if python3 or type(_x) == unicode:
00166 _x = _x.encode('utf-8')
00167 length = len(_x)
00168 buff.write(struct.pack('<I%ss'%length, length, _x))
00169 _x = self.data
00170 length = len(_x)
00171
00172 if type(_x) in [list, tuple]:
00173 buff.write(struct.pack('<I%sB'%length, length, *_x))
00174 else:
00175 buff.write(struct.pack('<I%ss'%length, length, _x))
00176 _x = self
00177 buff.write(_struct_2i2q.pack(_x.b_o_s, _x.e_o_s, _x.granulepos, _x.packetno))
00178 except struct.error as se: self._check_types(se)
00179 except TypeError as te: self._check_types(te)
00180
00181 def deserialize_numpy(self, str, numpy):
00182 """
00183 unpack serialized message in str into this message instance using numpy for array types
00184 :param str: byte array of serialized message, ``str``
00185 :param numpy: numpy python module
00186 """
00187 try:
00188 if self.header is None:
00189 self.header = std_msgs.msg.Header()
00190 end = 0
00191 _x = self
00192 start = end
00193 end += 12
00194 (_x.header.seq, _x.header.stamp.secs, _x.header.stamp.nsecs,) = _struct_3I.unpack(str[start:end])
00195 start = end
00196 end += 4
00197 (length,) = _struct_I.unpack(str[start:end])
00198 start = end
00199 end += length
00200 if python3:
00201 self.header.frame_id = str[start:end].decode('utf-8')
00202 else:
00203 self.header.frame_id = str[start:end]
00204 start = end
00205 end += 4
00206 (length,) = _struct_I.unpack(str[start:end])
00207 start = end
00208 end += length
00209 if python3:
00210 self.data = str[start:end].decode('utf-8')
00211 else:
00212 self.data = str[start:end]
00213 _x = self
00214 start = end
00215 end += 24
00216 (_x.b_o_s, _x.e_o_s, _x.granulepos, _x.packetno,) = _struct_2i2q.unpack(str[start:end])
00217 return self
00218 except struct.error as e:
00219 raise genpy.DeserializationError(e)
00220
00221 _struct_I = genpy.struct_I
00222 _struct_2i2q = struct.Struct("<2i2q")
00223 _struct_3I = struct.Struct("<3I")