(self, c_pkt)
| 215 | return py_frame |
| 216 | |
| 217 | def c_packet_to_python_packet(self, c_pkt): |
| 218 | py_pkt = Packet() |
| 219 | py_pkt.set_timestamp(c_pkt.get_timestamp()) |
| 220 | |
| 221 | # for EOF packet, ignore data |
| 222 | if c_pkt.get_timestamp() == Timestamp.EOF: |
| 223 | return py_pkt |
| 224 | |
| 225 | c_data = c_pkt.py_get_data() |
| 226 | |
| 227 | # TODO: support other type as dict and so on |
| 228 | if isinstance(c_data, csdk.VideoFrame): |
| 229 | py_frame = self.c_vframe_to_python_vframe(c_data) |
| 230 | py_pkt.set_data(py_frame) |
| 231 | return py_pkt |
| 232 | elif isinstance(c_data, csdk.AudioFrame): |
| 233 | py_frame = self.c_aframe_to_python_aframe(c_data) |
| 234 | py_pkt.set_data(py_frame) |
| 235 | return py_pkt |
| 236 | elif isinstance(c_data, numpy.ndarray): |
| 237 | py_pkt.set_data(c_data) |
| 238 | return py_pkt |
| 239 | elif isinstance(c_data, dict): |
| 240 | py_pkt.set_data(c_data) |
| 241 | return py_pkt |
| 242 | else: |
| 243 | Log.log_node(LogLevel.ERROR, self.node_, "Unsupported data type:", |
| 244 | type(c_data)) |
| 245 | return None |
| 246 | |
| 247 | @staticmethod |
| 248 | def to_str_array(l): |
no test coverage detected