FIX: fixed the bug of the start of image marker being written twice because it was added to the list of metadata markers. it is not added to that list anymore.

This commit is contained in:
JohnE 2016-10-17 19:54:14 -07:00
parent 093390ca1e
commit 6bf3a684a1
1 changed files with 10 additions and 9 deletions

View File

@ -53,11 +53,10 @@ class JpgBin:
def __isJPG(self):
(m1, m2) = struct.unpack('>HB', self.data_buf[0:3])
if (0xffd8 == m1 and 0xff == m2):
# set these variables to be used in the marker insertion loop
self.data_idx = 2
self.prev_mhex = 0xffd8
self.prev_mstr = "SOI "
self.prev_fpos = 0
self.prev_imgData = False
self.prev_imgData = None
return True
return False
@ -189,10 +188,11 @@ class JpgBin:
self.__addPrevMarkerData(marker_hex, "DHT ")
rec_len = self.__calcSeekBytes()
#
# end of file marker is never added to the marker array list (same as start of image marker)
#
def markerEOI(self, marker_hex):
self.__addPrevMarkerData(marker_hex, "EOI ")
self.__addPrevMarkerData(marker_hex, "JUST A DUMMY VALUE")
self.__addPrevMarkerData(marker_hex, "DUMMY VALUE ")
self.data_idx += 2
@ -202,6 +202,7 @@ class JpgBin:
cur_fpos = (fpos - (self.data_len - self.data_idx))
rec_len = cur_fpos - self.prev_fpos
if (self.prev_imgData is not None):
if (self.prev_imgData):
self.jpg_fp.addImgData(self.prev_mhex, self.prev_fpos, rec_len, self.prev_mstr)
else: