MP4: Use track header to get playback duration

When an MP4 file is trimmed, the samples may not be removed, but only
the playback duration for the track altered. So, to determine the
playback duration we must use track header's duration.

Add a new field in Track to store the mdhd header duration, which
contains the total duration of the samples contained in the track. This
can be use to determine the padding.

This reapplies aosp/2998978 with the change to store the mdhd duration.

Bug: 329121650
Test: atest MctsMediaExtractorTestCases
      atest MctsMediaV2TestCases:ExtractorTest
      atest MctsMediaV2TestCases:ExtractorUnitTest
      atest CtsMediaMuxerTestCases
      atest CtsMediaV2TestCases:MuxerTest
      atest CtsMediaV2TestCases:MuxerUnitTest

Change-Id: Idd4cbab8dec17fe8e1f815de9b1aa218baaa1fe7
2 files changed