Class: FilesHunter::Decoders::MPG_Video

Inherits:
BeginPatternDecoder show all
Defined in:
lib/fileshunter/Decoders/MPG_Video.rb

Constant Summary collapse

BEGIN_PATTERN_MPG =
"\x00\x00\x01\xBA\x21\x00\x01\x00\x01\x80".force_encoding(Encoding::ASCII_8BIT)
END_PATTERN_MPG =
"\x00\x00\x01\xB7\x00\x00\x01\xB9".force_encoding(Encoding::ASCII_8BIT)

Instance Method Summary collapse

Methods inherited from BeginPatternDecoder

#find_segments

Methods inherited from FilesHunter::Decoder

#segments_found, #setup

Instance Method Details

#decode(offset) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/fileshunter/Decoders/MPG_Video.rb', line 14

def decode(offset)
  ending_offset = nil

  found_relevant_data(:mpg)
  end_pattern_offset = @data.index(END_PATTERN_MPG, offset + 10)
  log_debug "=== @#{offset} - Found ending offset: #{end_pattern_offset.inspect}"
  truncated_data if ((end_pattern_offset == nil) or (end_pattern_offset + 8 > @end_offset))
  ending_offset = end_pattern_offset + 8

  return ending_offset
end

#get_begin_patternObject



10
11
12
# File 'lib/fileshunter/Decoders/MPG_Video.rb', line 10

def get_begin_pattern
  return BEGIN_PATTERN_MPG, { :offset_inc => 10 }
end