def jpg_info(filename): """ Reads a single jpeg image from the file *filename* and extracts the Axis user data header. The information it contains is returned as a dict with the keys "hwid", "serial_numer" and "firmware_version". """ if sys.version_info > (3, ): filename = bytes(filename, "utf8") m = ffi.new("struct mjpg *") r = lib.mjpg_open(m, filename, lib.IMTYPE_GRAY, lib.IMORDER_PLANAR) lib.mjpg_next_head(m) res = { 'hwid': ffi.string(m.hwid), 'serial_number': ffi.string(m.serial), 'firmware_version': ffi.string(m.firmware), 'timestamp': m.timestamp_sec + m.timestamp_usec / 1000000.0 } lib.mjpg_close(m) return res
def firmware_version(self): """ The firmware version running in the camera when it made this recording. """ self.myiter.next() return ffi.string(self.myiter.m.firmware)
def serial_number(self): """ The Axis serial number or mac address of the camera that made this recording. """ self.myiter.next() return ffi.string(self.myiter.m.serial)
def hwid(self): """ The Axis hardware id of the camera that made this recording. """ self.myiter.next() return ffi.string(self.myiter.m.hwid)