Speed up SniffMidi() by parsing the initial bytes of the header

SniffMidi() was creating a MidiEngine() instance which in turn was
using a WatchDog timer to abort if the operation took longer than
10 seconds. In some cases, SniffMidi() was consuming more than 10 seconds.

This is now optimized by parsing a few initial bytes to identify
different types of midi files.

Bug: 359920208
Test: atest CtsMediaPlayerTestCases \
 CtsMediaExtractorTestCases \
 CtsMediaAudioTestCases:MidiSoloTest \
 CtsMediaAudioTestCases:SoundPoolMidiTest \
 CtsMediaV2TestCases:ExtractorTest \
 CtsMediaV2TestCases:ExtractorUnitTest

Change-Id: Ibf1e922d6de32ab6f2fbd8178843603a9bf72100
5 files changed