@@ -231,13 +231,13 @@ def _decode(self, obj, context, path=None):
231231
232232_frame_hdr = construct .Struct (
233233 'sat_num' / _satnum ,
234- 'reserved ' / construct .Int8ul ,
234+ 'reserved0 ' / construct .Int8ul ,
235235 'dlen' / construct .Int8ul ,
236236)
237237
238238_frame1 = construct .Struct (
239239 'sat_num' / _satnum ,
240- 'reserved ' / construct .Int8ul ,
240+ 'reserved0 ' / construct .Int8ul ,
241241 'dlen' / construct .Int8ul ,
242242 'mtype' / construct .Hex (construct .Int16ul ),
243243 'offset' / construct .Int16ul ,
@@ -250,9 +250,9 @@ def _decode(self, obj, context, path=None):
250250
251251_frame2 = construct .Struct (
252252 'sat_num' / _satnum ,
253- 'reserved ' / construct .Int8ul ,
253+ 'reserved0 ' / construct .Int8ul ,
254254 'dlen' / construct .Int8ul ,
255- 'reserved ' / construct .Bytes (2 ),
255+ 'reserved1 ' / construct .Bytes (2 ),
256256 'marker' / construct .Hex (construct .Int32ul ),
257257 'offset' / construct .Int32ul ,
258258 'fnum' / construct .Int16ul ,
@@ -287,7 +287,8 @@ def get_sat_name(sat_num):
287287class GeoscanImageReceiver (ImageReceiver ):
288288 CMD_IMG_START = 0x0901
289289 CMD_IMG_FRAME = 0x0905 , 0x0920 ,
290- CMD_IMG_HR_FRAME = 0x9820 , 0x411C
290+ CMD_IMG_HR_FRAME = 0x9820 , 0x411C ,
291+ CMD_IMG_FRAME_SPECIALS = 0x4150 ,
291292 MARKER_V2_IMG = 0x6F6B6F31
292293
293294 def __init__ (self , outdir ):
@@ -310,13 +311,20 @@ def generate_fid(self, sat_num=None):
310311 def force_new (self , * args , ** kwargs ):
311312 return super ().force_new (* args , ** kwargs )
312313
313- def push_data (self , data , is_v2 = 0 , ** kw ):
314+ def push_data (self , data , is_v2 = 0 , raw_data = b'' , ** kw ):
314315 if int (data .sat_num ) not in sat_names :
315316 self ._miss_cnt += 1
316317 return
317318
318319 if is_v2 :
319320 x = self ._push_data2 (data )
321+ if not x :
322+ try :
323+ data = _frame1 .parse (raw_data )
324+ except construct .ConstructError as e :
325+ return
326+ if data .reserved0 == 0x98 : # special values?
327+ x = self ._push_data1 (data )
320328 else :
321329 x = self ._push_data1 (data )
322330 return x
@@ -348,7 +356,7 @@ def _push_data1(self, data):
348356
349357 img .push_data (off , data .data [:data .dlen - 6 ])
350358
351- elif data .mtype in chain (self .CMD_IMG_FRAME , self .CMD_IMG_HR_FRAME ):
359+ elif data .mtype in chain (self .CMD_IMG_FRAME , self .CMD_IMG_HR_FRAME , self . CMD_IMG_FRAME_SPECIALS ):
352360 has_soi = data .data .startswith (b'\xff \xd8 ' )
353361 force = 0
354362 if sat_num != self ._last_sat_num :
@@ -559,7 +567,7 @@ def recognize(self, data):
559567
560568 name = get_sat_name (int (frame .sat_num ))
561569
562- x = self .ir .push_data (frame , is_v2 )
570+ x = self .ir .push_data (frame , is_v2 , raw_data = data )
563571 if x :
564572 if x != 2 :
565573 self .last_fn = self .ir .cur_img .fn
0 commit comments