mirror of
https://github.com/samsonjs/media.git
synced 2026-03-26 09:35:47 +00:00
Make it a bit easier to sideload a subtitle
------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=162221516
This commit is contained in:
parent
daa214f82a
commit
da79dec6c1
6 changed files with 18 additions and 13 deletions
|
|
@ -94,10 +94,10 @@ public final class FormatTest extends TestCase {
|
|||
500, 128, 5, 44100, INIT_DATA, null, 0, null));
|
||||
testConversionToFrameworkMediaFormatV16(Format.createAudioSampleFormat(null, "audio/xyz", null,
|
||||
500, Format.NO_VALUE, 5, 44100, null, null, 0, null));
|
||||
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", null,
|
||||
Format.NO_VALUE, 0, "eng", null));
|
||||
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", null,
|
||||
Format.NO_VALUE, 0, null, null));
|
||||
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", 0,
|
||||
"eng"));
|
||||
testConversionToFrameworkMediaFormatV16(Format.createTextSampleFormat(null, "text/xyz", 0,
|
||||
null));
|
||||
}
|
||||
|
||||
@SuppressLint("InlinedApi")
|
||||
|
|
|
|||
|
|
@ -286,9 +286,14 @@ public final class Format implements Parcelable {
|
|||
OFFSET_SAMPLE_RELATIVE, null, null, null);
|
||||
}
|
||||
|
||||
public static Format createTextSampleFormat(String id, String sampleMimeType, String codecs,
|
||||
int bitrate, @C.SelectionFlags int selectionFlags, String language, DrmInitData drmInitData) {
|
||||
return createTextSampleFormat(id, sampleMimeType, codecs, bitrate, selectionFlags, language,
|
||||
public static Format createTextSampleFormat(String id, String sampleMimeType,
|
||||
@C.SelectionFlags int selectionFlags, String language) {
|
||||
return createTextSampleFormat(id, sampleMimeType, selectionFlags, language, null);
|
||||
}
|
||||
|
||||
public static Format createTextSampleFormat(String id, String sampleMimeType,
|
||||
@C.SelectionFlags int selectionFlags, String language, DrmInitData drmInitData) {
|
||||
return createTextSampleFormat(id, sampleMimeType, null, NO_VALUE, selectionFlags, language,
|
||||
NO_VALUE, drmInitData, OFFSET_SAMPLE_RELATIVE, Collections.<byte[]>emptyList());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1762,8 +1762,8 @@ public final class MatroskaExtractor implements Extractor {
|
|||
drmInitData);
|
||||
} else if (MimeTypes.APPLICATION_SUBRIP.equals(mimeType)) {
|
||||
type = C.TRACK_TYPE_TEXT;
|
||||
format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, null,
|
||||
Format.NO_VALUE, selectionFlags, language, drmInitData);
|
||||
format = Format.createTextSampleFormat(Integer.toString(trackId), mimeType, selectionFlags,
|
||||
language, drmInitData);
|
||||
} else if (MimeTypes.TEXT_SSA.equals(mimeType)) {
|
||||
type = C.TRACK_TYPE_TEXT;
|
||||
initializationData = new ArrayList<>(2);
|
||||
|
|
|
|||
|
|
@ -464,8 +464,8 @@ public final class FragmentedMp4Extractor implements Extractor {
|
|||
if ((flags & FLAG_ENABLE_CEA608_TRACK) != 0 && cea608TrackOutputs == null) {
|
||||
TrackOutput cea608TrackOutput = extractorOutput.track(trackBundles.size() + 1,
|
||||
C.TRACK_TYPE_TEXT);
|
||||
cea608TrackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608,
|
||||
null, Format.NO_VALUE, 0, null, null));
|
||||
cea608TrackOutput.format(Format.createTextSampleFormat(null, MimeTypes.APPLICATION_CEA608, 0,
|
||||
null));
|
||||
cea608TrackOutputs = new TrackOutput[] {cea608TrackOutput};
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public final class DefaultTsPayloadReaderFactory implements TsPayloadReader.Fact
|
|||
this.flags = flags;
|
||||
if (!isSet(FLAG_OVERRIDE_CAPTION_DESCRIPTORS) && closedCaptionFormats.isEmpty()) {
|
||||
closedCaptionFormats = Collections.singletonList(Format.createTextSampleFormat(null,
|
||||
MimeTypes.APPLICATION_CEA608, null, Format.NO_VALUE, 0, null, null));
|
||||
MimeTypes.APPLICATION_CEA608, 0, null));
|
||||
}
|
||||
this.closedCaptionFormats = closedCaptionFormats;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -287,7 +287,7 @@ import java.util.List;
|
|||
}
|
||||
if (hasCea608Track) {
|
||||
Format format = Format.createTextSampleFormat(firstAdaptationSet.id + ":cea608",
|
||||
MimeTypes.APPLICATION_CEA608, null, Format.NO_VALUE, 0, null, null);
|
||||
MimeTypes.APPLICATION_CEA608, 0, null);
|
||||
trackGroups[trackGroupCount] = new TrackGroup(format);
|
||||
trackGroupInfos[trackGroupCount++] = new TrackGroupInfo(C.TRACK_TYPE_TEXT,
|
||||
adaptationSetIndices, primaryTrackGroupIndex, false, false, false);
|
||||
|
|
|
|||
Loading…
Reference in a new issue