Commit 953c6855 by olly Committed by Oliver Woodman

FMP4 EMSG/CEA608 output bug fix + tweaks

- Fix to use different track ids for EMSG + CEA608, so they can
  both be enabled at once.
- Tweaked extractor to output formats prior to endTracks() when
  parsing the initial moov box. This makes it easier to handle
  multiple tracks through the chunk package. It may or may not
  be made a requirement (it's already true for the MKV extractor).

Issue: #2362
Issue: #2176

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=145538757
parent 8970e80b
...@@ -420,19 +420,19 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -420,19 +420,19 @@ public final class FragmentedMp4Extractor implements Extractor {
// We need to create the track bundles. // We need to create the track bundles.
for (int i = 0; i < trackCount; i++) { for (int i = 0; i < trackCount; i++) {
Track track = tracks.valueAt(i); Track track = tracks.valueAt(i);
trackBundles.put(track.id, new TrackBundle(extractorOutput.track(i))); TrackBundle trackBundle = new TrackBundle(extractorOutput.track(i));
trackBundle.init(track, defaultSampleValuesArray.get(track.id));
trackBundles.put(track.id, trackBundle);
durationUs = Math.max(durationUs, track.durationUs); durationUs = Math.max(durationUs, track.durationUs);
} }
maybeInitExtraTracks(); maybeInitExtraTracks();
extractorOutput.endTracks(); extractorOutput.endTracks();
} else { } else {
Assertions.checkState(trackBundles.size() == trackCount); Assertions.checkState(trackBundles.size() == trackCount);
} for (int i = 0; i < trackCount; i++) {
Track track = tracks.valueAt(i);
// Initialization of tracks and default sample values. trackBundles.get(track.id).init(track, defaultSampleValuesArray.get(track.id));
for (int i = 0; i < trackCount; i++) { }
Track track = tracks.valueAt(i);
trackBundles.get(track.id).init(track, defaultSampleValuesArray.get(track.id));
} }
} }
...@@ -454,7 +454,7 @@ public final class FragmentedMp4Extractor implements Extractor { ...@@ -454,7 +454,7 @@ public final class FragmentedMp4Extractor implements Extractor {
Format.OFFSET_SAMPLE_RELATIVE)); Format.OFFSET_SAMPLE_RELATIVE));
} }
if ((flags & FLAG_ENABLE_CEA608_TRACK) != 0 && cea608TrackOutput == null) { if ((flags & FLAG_ENABLE_CEA608_TRACK) != 0 && cea608TrackOutput == null) {
cea608TrackOutput = extractorOutput.track(trackBundles.size()); cea608TrackOutput = extractorOutput.track(trackBundles.size() + 1);
cea608TrackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608, cea608TrackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608,
null, Format.NO_VALUE, 0, null, null)); null, Format.NO_VALUE, 0, null, null));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment