Skip to content

Commit

Permalink
FMP4 EMSG/CEA608 output bug fix + tweaks
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
ojw28 committed Jan 25, 2017
1 parent 8970e80 commit 953c685
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -420,19 +420,19 @@ private void onMoovContainerAtomRead(ContainerAtom moov) throws ParserException
// We need to create the track bundles.
for (int i = 0; i < trackCount; 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);
}
maybeInitExtraTracks();
extractorOutput.endTracks();
} else {
Assertions.checkState(trackBundles.size() == trackCount);
}

// Initialization of tracks and default sample values.
for (int i = 0; i < trackCount; i++) {
Track track = tracks.valueAt(i);
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));
}
}
}

Expand All @@ -454,7 +454,7 @@ private void maybeInitExtraTracks() {
Format.OFFSET_SAMPLE_RELATIVE));
}
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,
null, Format.NO_VALUE, 0, null, null));
}
Expand Down

0 comments on commit 953c685

Please sign in to comment.