mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Converted trackId into String
This commit is contained in:
parent
1b469f422f
commit
282a3fe818
15 changed files with 49 additions and 55 deletions
|
|
@ -505,8 +505,7 @@ public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
|
||||||
}
|
}
|
||||||
|
|
||||||
private static String buildTrackIdString(MediaFormat format) {
|
private static String buildTrackIdString(MediaFormat format) {
|
||||||
return format.trackId == MediaFormat.NO_VALUE ? ""
|
return format.trackId == null ? "" : " (" + format.trackId + ")";
|
||||||
: String.format(Locale.US, " (%d)", format.trackId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean onTrackItemClick(MenuItem item, int type) {
|
private boolean onTrackItemClick(MenuItem item, int type) {
|
||||||
|
|
|
||||||
|
|
@ -315,7 +315,7 @@ public final class FrameworkSampleSource implements SampleSource, SampleSourceRe
|
||||||
}
|
}
|
||||||
long durationUs = format.containsKey(android.media.MediaFormat.KEY_DURATION)
|
long durationUs = format.containsKey(android.media.MediaFormat.KEY_DURATION)
|
||||||
? format.getLong(android.media.MediaFormat.KEY_DURATION) : C.UNKNOWN_TIME_US;
|
? format.getLong(android.media.MediaFormat.KEY_DURATION) : C.UNKNOWN_TIME_US;
|
||||||
MediaFormat mediaFormat = new MediaFormat(null, MediaFormat.NO_VALUE, mimeType, MediaFormat.NO_VALUE,
|
MediaFormat mediaFormat = new MediaFormat(null, mimeType, MediaFormat.NO_VALUE,
|
||||||
maxInputSize, durationUs, width, height, rotationDegrees, MediaFormat.NO_VALUE,
|
maxInputSize, durationUs, width, height, rotationDegrees, MediaFormat.NO_VALUE,
|
||||||
channelCount, sampleRate, language, MediaFormat.OFFSET_SAMPLE_RELATIVE, initializationData,
|
channelCount, sampleRate, language, MediaFormat.OFFSET_SAMPLE_RELATIVE, initializationData,
|
||||||
false, MediaFormat.NO_VALUE, MediaFormat.NO_VALUE);
|
false, MediaFormat.NO_VALUE, MediaFormat.NO_VALUE);
|
||||||
|
|
|
||||||
|
|
@ -39,14 +39,10 @@ public final class MediaFormat {
|
||||||
*/
|
*/
|
||||||
public static final long OFFSET_SAMPLE_RELATIVE = Long.MAX_VALUE;
|
public static final long OFFSET_SAMPLE_RELATIVE = Long.MAX_VALUE;
|
||||||
/**
|
/**
|
||||||
* An identifier for the format.
|
* The identifier for the track represented by the format, or null if unknown or not
|
||||||
*/
|
|
||||||
public final String id;
|
|
||||||
/**
|
|
||||||
* The identifier for the track represented by the format, or {@link #NO_VALUE} if unknown or not
|
|
||||||
* applicable.
|
* applicable.
|
||||||
*/
|
*/
|
||||||
public final int trackId;
|
public final String trackId;
|
||||||
/**
|
/**
|
||||||
* The mime type of the format.
|
* The mime type of the format.
|
||||||
*/
|
*/
|
||||||
|
|
@ -142,53 +138,52 @@ public final class MediaFormat {
|
||||||
private int hashCode;
|
private int hashCode;
|
||||||
private android.media.MediaFormat frameworkMediaFormat;
|
private android.media.MediaFormat frameworkMediaFormat;
|
||||||
|
|
||||||
public static MediaFormat createVideoFormat(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate,
|
||||||
int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData) {
|
int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData) {
|
||||||
return createVideoFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return createVideoFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
initializationData, NO_VALUE, NO_VALUE);
|
initializationData, NO_VALUE, NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaFormat createVideoFormat(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createVideoFormat(String trackId, String mimeType, int bitrate,
|
||||||
int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData,
|
int maxInputSize, long durationUs, int width, int height, List<byte[]> initializationData,
|
||||||
int rotationDegrees, float pixelWidthHeightRatio) {
|
int rotationDegrees, float pixelWidthHeightRatio) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
rotationDegrees, pixelWidthHeightRatio, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE,
|
rotationDegrees, pixelWidthHeightRatio, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData, false, NO_VALUE, NO_VALUE);
|
initializationData, false, NO_VALUE, NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaFormat createAudioFormat(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createAudioFormat(String trackId, String mimeType, int bitrate,
|
||||||
int maxInputSize, long durationUs, int channelCount, int sampleRate,
|
int maxInputSize, long durationUs, int channelCount, int sampleRate,
|
||||||
List<byte[]> initializationData, String language) {
|
List<byte[]> initializationData, String language) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, NO_VALUE, NO_VALUE,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, NO_VALUE, NO_VALUE,
|
||||||
NO_VALUE, NO_VALUE, channelCount, sampleRate, language, OFFSET_SAMPLE_RELATIVE,
|
NO_VALUE, NO_VALUE, channelCount, sampleRate, language, OFFSET_SAMPLE_RELATIVE,
|
||||||
initializationData, false, NO_VALUE, NO_VALUE);
|
initializationData, false, NO_VALUE, NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaFormat createTextFormat(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate,
|
||||||
long durationUs, String language) {
|
long durationUs, String language) {
|
||||||
return createTextFormat(id, trackId, mimeType, bitrate, durationUs, language,
|
return createTextFormat(trackId, mimeType, bitrate, durationUs, language,
|
||||||
OFFSET_SAMPLE_RELATIVE);
|
OFFSET_SAMPLE_RELATIVE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaFormat createTextFormat(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createTextFormat(String trackId, String mimeType, int bitrate,
|
||||||
long durationUs, String language, long subsampleOffsetUs) {
|
long durationUs, String language, long subsampleOffsetUs) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
return new MediaFormat(trackId, mimeType, bitrate, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
||||||
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, language, subsampleOffsetUs, null, false, NO_VALUE,
|
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, language, subsampleOffsetUs, null, false, NO_VALUE,
|
||||||
NO_VALUE);
|
NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MediaFormat createFormatForMimeType(String id, int trackId, String mimeType, int bitrate,
|
public static MediaFormat createFormatForMimeType(String trackId, String mimeType, int bitrate,
|
||||||
long durationUs) {
|
long durationUs) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
return new MediaFormat(trackId, mimeType, bitrate, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
||||||
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE, null, false, NO_VALUE,
|
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE, null, false, NO_VALUE,
|
||||||
NO_VALUE);
|
NO_VALUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* package */ MediaFormat(String id, int trackId, String mimeType, int bitrate, int maxInputSize,
|
/* package */ MediaFormat(String trackId, String mimeType, int bitrate, int maxInputSize,
|
||||||
long durationUs, int width, int height, int rotationDegrees, float pixelWidthHeightRatio,
|
long durationUs, int width, int height, int rotationDegrees, float pixelWidthHeightRatio,
|
||||||
int channelCount, int sampleRate, String language, long subsampleOffsetUs,
|
int channelCount, int sampleRate, String language, long subsampleOffsetUs,
|
||||||
List<byte[]> initializationData, boolean adaptive, int maxWidth, int maxHeight) {
|
List<byte[]> initializationData, boolean adaptive, int maxWidth, int maxHeight) {
|
||||||
this.id = id;
|
|
||||||
this.trackId = trackId;
|
this.trackId = trackId;
|
||||||
this.mimeType = Assertions.checkNotEmpty(mimeType);
|
this.mimeType = Assertions.checkNotEmpty(mimeType);
|
||||||
this.bitrate = bitrate;
|
this.bitrate = bitrate;
|
||||||
|
|
@ -210,31 +205,31 @@ public final class MediaFormat {
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaFormat copyWithMaxInputSize(int maxInputSize) {
|
public MediaFormat copyWithMaxInputSize(int maxInputSize) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
||||||
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaFormat copyWithMaxVideoDimensions(int maxWidth, int maxHeight) {
|
public MediaFormat copyWithMaxVideoDimensions(int maxWidth, int maxHeight) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
||||||
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaFormat copyWithSubsampleOffsetUs(long subsampleOffsetUs) {
|
public MediaFormat copyWithSubsampleOffsetUs(long subsampleOffsetUs) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
||||||
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaFormat copyWithDurationUs(long durationUs) {
|
public MediaFormat copyWithDurationUs(long durationUs) {
|
||||||
return new MediaFormat(id, trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
return new MediaFormat(trackId, mimeType, bitrate, maxInputSize, durationUs, width, height,
|
||||||
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
rotationDegrees, pixelWidthHeightRatio, channelCount, sampleRate, language,
|
||||||
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
subsampleOffsetUs, initializationData, adaptive, maxWidth, maxHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MediaFormat copyAsAdaptive() {
|
public MediaFormat copyAsAdaptive() {
|
||||||
return new MediaFormat(id, trackId, mimeType, NO_VALUE, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
return new MediaFormat(null, mimeType, NO_VALUE, NO_VALUE, durationUs, NO_VALUE, NO_VALUE,
|
||||||
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE, null, true, maxWidth,
|
NO_VALUE, NO_VALUE, NO_VALUE, NO_VALUE, null, OFFSET_SAMPLE_RELATIVE, null, true, maxWidth,
|
||||||
maxHeight);
|
maxHeight);
|
||||||
}
|
}
|
||||||
|
|
@ -292,7 +287,7 @@ public final class MediaFormat {
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
if (hashCode == 0) {
|
if (hashCode == 0) {
|
||||||
int result = 17;
|
int result = 17;
|
||||||
result = 31 * result + trackId;
|
result = 31 * result + (trackId == null ? 0 : trackId.hashCode());
|
||||||
result = 31 * result + (mimeType == null ? 0 : mimeType.hashCode());
|
result = 31 * result + (mimeType == null ? 0 : mimeType.hashCode());
|
||||||
result = 31 * result + bitrate;
|
result = 31 * result + bitrate;
|
||||||
result = 31 * result + maxInputSize;
|
result = 31 * result + maxInputSize;
|
||||||
|
|
|
||||||
|
|
@ -608,14 +608,14 @@ public class DashChunkSource implements ChunkSource, Output {
|
||||||
String mediaMimeType, long durationUs) {
|
String mediaMimeType, long durationUs) {
|
||||||
switch (adaptationSetType) {
|
switch (adaptationSetType) {
|
||||||
case AdaptationSet.TYPE_VIDEO:
|
case AdaptationSet.TYPE_VIDEO:
|
||||||
return MediaFormat.createVideoFormat(format.id, MediaFormat.NO_VALUE, mediaMimeType, format.bitrate,
|
return MediaFormat.createVideoFormat(format.id, mediaMimeType, format.bitrate,
|
||||||
MediaFormat.NO_VALUE, durationUs, format.width, format.height, null);
|
MediaFormat.NO_VALUE, durationUs, format.width, format.height, null);
|
||||||
case AdaptationSet.TYPE_AUDIO:
|
case AdaptationSet.TYPE_AUDIO:
|
||||||
return MediaFormat.createAudioFormat(format.id, MediaFormat.NO_VALUE, mediaMimeType, format.bitrate,
|
return MediaFormat.createAudioFormat(format.id, mediaMimeType, format.bitrate,
|
||||||
MediaFormat.NO_VALUE, durationUs, format.audioChannels, format.audioSamplingRate, null,
|
MediaFormat.NO_VALUE, durationUs, format.audioChannels, format.audioSamplingRate, null,
|
||||||
format.language);
|
format.language);
|
||||||
case AdaptationSet.TYPE_TEXT:
|
case AdaptationSet.TYPE_TEXT:
|
||||||
return MediaFormat.createTextFormat(format.id, MediaFormat.NO_VALUE, mediaMimeType, format.bitrate,
|
return MediaFormat.createTextFormat(format.id, mediaMimeType, format.bitrate,
|
||||||
durationUs, format.language);
|
durationUs, format.language);
|
||||||
default:
|
default:
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -332,7 +332,7 @@ public final class Mp3Extractor implements Extractor {
|
||||||
if (seeker == null) {
|
if (seeker == null) {
|
||||||
setupSeeker(extractorInput, headerPosition);
|
setupSeeker(extractorInput, headerPosition);
|
||||||
extractorOutput.seekMap(seeker);
|
extractorOutput.seekMap(seeker);
|
||||||
trackOutput.format(MediaFormat.createAudioFormat(null, MediaFormat.NO_VALUE,
|
trackOutput.format(MediaFormat.createAudioFormat(null,
|
||||||
synchronizedHeader.mimeType, MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES,
|
synchronizedHeader.mimeType, MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES,
|
||||||
seeker.getDurationUs(), synchronizedHeader.channels, synchronizedHeader.sampleRate, null,
|
seeker.getDurationUs(), synchronizedHeader.channels, synchronizedHeader.sampleRate, null,
|
||||||
null));
|
null));
|
||||||
|
|
|
||||||
|
|
@ -387,13 +387,13 @@ import java.util.List;
|
||||||
parseAudioSampleEntry(stsd, childAtomType, childStartPosition, childAtomSize, trackId,
|
parseAudioSampleEntry(stsd, childAtomType, childStartPosition, childAtomSize, trackId,
|
||||||
durationUs, language, out, i);
|
durationUs, language, out, i);
|
||||||
} else if (childAtomType == Atom.TYPE_TTML) {
|
} else if (childAtomType == Atom.TYPE_TTML) {
|
||||||
out.mediaFormat = MediaFormat.createTextFormat(null, trackId, MimeTypes.APPLICATION_TTML,
|
out.mediaFormat = MediaFormat.createTextFormat(Integer.toString(trackId), MimeTypes.APPLICATION_TTML,
|
||||||
MediaFormat.NO_VALUE, durationUs, language);
|
MediaFormat.NO_VALUE, durationUs, language);
|
||||||
} else if (childAtomType == Atom.TYPE_tx3g) {
|
} else if (childAtomType == Atom.TYPE_tx3g) {
|
||||||
out.mediaFormat = MediaFormat.createTextFormat(null, trackId, MimeTypes.APPLICATION_TX3G,
|
out.mediaFormat = MediaFormat.createTextFormat(Integer.toString(trackId), MimeTypes.APPLICATION_TX3G,
|
||||||
MediaFormat.NO_VALUE, durationUs, language);
|
MediaFormat.NO_VALUE, durationUs, language);
|
||||||
} else if (childAtomType == Atom.TYPE_stpp) {
|
} else if (childAtomType == Atom.TYPE_stpp) {
|
||||||
out.mediaFormat = MediaFormat.createTextFormat(null, trackId, MimeTypes.APPLICATION_TTML,
|
out.mediaFormat = MediaFormat.createTextFormat(Integer.toString(trackId), MimeTypes.APPLICATION_TTML,
|
||||||
MediaFormat.NO_VALUE, durationUs, language, 0 /* subsample timing is absolute */);
|
MediaFormat.NO_VALUE, durationUs, language, 0 /* subsample timing is absolute */);
|
||||||
}
|
}
|
||||||
stsd.setPosition(childStartPosition + childAtomSize);
|
stsd.setPosition(childStartPosition + childAtomSize);
|
||||||
|
|
@ -464,7 +464,7 @@ import java.util.List;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.mediaFormat = MediaFormat.createVideoFormat(null, trackId, mimeType, MediaFormat.NO_VALUE,
|
out.mediaFormat = MediaFormat.createVideoFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE,
|
||||||
MediaFormat.NO_VALUE, durationUs, width, height, initializationData, rotationDegrees,
|
MediaFormat.NO_VALUE, durationUs, width, height, initializationData, rotationDegrees,
|
||||||
pixelWidthHeightRatio);
|
pixelWidthHeightRatio);
|
||||||
}
|
}
|
||||||
|
|
@ -653,7 +653,7 @@ import java.util.List;
|
||||||
} else if ((atomType == Atom.TYPE_dtsc || atomType == Atom.TYPE_dtse
|
} else if ((atomType == Atom.TYPE_dtsc || atomType == Atom.TYPE_dtse
|
||||||
|| atomType == Atom.TYPE_dtsh || atomType == Atom.TYPE_dtsl)
|
|| atomType == Atom.TYPE_dtsh || atomType == Atom.TYPE_dtsl)
|
||||||
&& childAtomType == Atom.TYPE_ddts) {
|
&& childAtomType == Atom.TYPE_ddts) {
|
||||||
out.mediaFormat = MediaFormat.createAudioFormat(null, trackId, mimeType, MediaFormat.NO_VALUE,
|
out.mediaFormat = MediaFormat.createAudioFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE,
|
||||||
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -665,7 +665,7 @@ import java.util.List;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
out.mediaFormat = MediaFormat.createAudioFormat(null, trackId, mimeType, MediaFormat.NO_VALUE,
|
out.mediaFormat = MediaFormat.createAudioFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE,
|
||||||
sampleSize, durationUs, channelCount, sampleRate,
|
sampleSize, durationUs, channelCount, sampleRate,
|
||||||
initializationData == null ? null : Collections.singletonList(initializationData),
|
initializationData == null ? null : Collections.singletonList(initializationData),
|
||||||
language);
|
language);
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ import java.util.Collections;
|
||||||
Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
|
Pair<Integer, Integer> audioParams = CodecSpecificDataUtil.parseAacAudioSpecificConfig(
|
||||||
audioSpecificConfig);
|
audioSpecificConfig);
|
||||||
|
|
||||||
MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, MediaFormat.NO_VALUE,
|
MediaFormat mediaFormat = MediaFormat.createAudioFormat(null,
|
||||||
MimeTypes.AUDIO_AAC, MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US,
|
MimeTypes.AUDIO_AAC, MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US,
|
||||||
audioParams.second, audioParams.first, Collections.singletonList(audioSpecificConfig),
|
audioParams.second, audioParams.first, Collections.singletonList(audioSpecificConfig),
|
||||||
null);
|
null);
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ import java.util.List;
|
||||||
SpsData parsedSpsData = CodecSpecificDataUtil.parseSpsNalUnit(bitArray);
|
SpsData parsedSpsData = CodecSpecificDataUtil.parseSpsNalUnit(bitArray);
|
||||||
|
|
||||||
// Construct and output the format.
|
// Construct and output the format.
|
||||||
output.format(MediaFormat.createVideoFormat(null, MediaFormat.NO_VALUE, MimeTypes.VIDEO_H264,
|
output.format(MediaFormat.createVideoFormat(null, MimeTypes.VIDEO_H264,
|
||||||
MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, parsedSpsData.width,
|
MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, parsedSpsData.width,
|
||||||
parsedSpsData.height, initializationData, MediaFormat.NO_VALUE,
|
parsedSpsData.height, initializationData, MediaFormat.NO_VALUE,
|
||||||
parsedSpsData.pixelWidthAspectRatio));
|
parsedSpsData.pixelWidthAspectRatio));
|
||||||
|
|
|
||||||
|
|
@ -294,7 +294,7 @@ import java.util.Collections;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
output.format(MediaFormat.createVideoFormat(null, MediaFormat.NO_VALUE, MimeTypes.VIDEO_H265,
|
output.format(MediaFormat.createVideoFormat(null, MimeTypes.VIDEO_H265,
|
||||||
MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, picWidthInLumaSamples,
|
MediaFormat.NO_VALUE, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, picWidthInLumaSamples,
|
||||||
picHeightInLumaSamples, Collections.singletonList(csd), MediaFormat.NO_VALUE,
|
picHeightInLumaSamples, Collections.singletonList(csd), MediaFormat.NO_VALUE,
|
||||||
pixelWidthHeightRatio));
|
pixelWidthHeightRatio));
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
|
||||||
|
|
||||||
public Id3Reader(TrackOutput output) {
|
public Id3Reader(TrackOutput output) {
|
||||||
super(output);
|
super(output);
|
||||||
output.format(MediaFormat.createFormatForMimeType(null, MediaFormat.NO_VALUE,
|
output.format(MediaFormat.createFormatForMimeType(null,
|
||||||
MimeTypes.APPLICATION_ID3, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US));
|
MimeTypes.APPLICATION_ID3, MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,7 +160,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
|
||||||
frameSize = header.frameSize;
|
frameSize = header.frameSize;
|
||||||
if (!hasOutputFormat) {
|
if (!hasOutputFormat) {
|
||||||
frameDurationUs = (C.MICROS_PER_SECOND * header.samplesPerFrame) / header.sampleRate;
|
frameDurationUs = (C.MICROS_PER_SECOND * header.samplesPerFrame) / header.sampleRate;
|
||||||
MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, MediaFormat.NO_VALUE, header.mimeType,
|
MediaFormat mediaFormat = MediaFormat.createAudioFormat(null, header.mimeType,
|
||||||
MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES, C.UNKNOWN_TIME_US,
|
MediaFormat.NO_VALUE, MpegAudioHeader.MAX_FRAME_SIZE_BYTES, C.UNKNOWN_TIME_US,
|
||||||
header.channels, header.sampleRate, null, null);
|
header.channels, header.sampleRate, null, null);
|
||||||
output.format(mediaFormat);
|
output.format(mediaFormat);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import com.google.android.exoplayer.util.ParsableByteArray;
|
||||||
|
|
||||||
public SeiReader(TrackOutput output) {
|
public SeiReader(TrackOutput output) {
|
||||||
super(output);
|
super(output);
|
||||||
output.format(MediaFormat.createTextFormat(null, MediaFormat.NO_VALUE, MimeTypes.APPLICATION_EIA608,
|
output.format(MediaFormat.createTextFormat(null, MimeTypes.APPLICATION_EIA608,
|
||||||
MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, null));
|
MediaFormat.NO_VALUE, C.UNKNOWN_TIME_US, null));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1229,15 +1229,15 @@ public final class WebmExtractor implements Extractor {
|
||||||
|
|
||||||
MediaFormat format;
|
MediaFormat format;
|
||||||
// TODO: Read the name of the track from the header of the webm container and
|
// TODO: Read the name of the track from the header of the webm container and
|
||||||
// supply this as id instead of 'null'
|
// supply this as id instead of trackId?
|
||||||
if (MimeTypes.isAudio(mimeType)) {
|
if (MimeTypes.isAudio(mimeType)) {
|
||||||
format = MediaFormat.createAudioFormat(null, trackId, mimeType, MediaFormat.NO_VALUE,
|
format = MediaFormat.createAudioFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE,
|
||||||
maxInputSize, durationUs, channelCount, sampleRate, initializationData, language);
|
maxInputSize, durationUs, channelCount, sampleRate, initializationData, language);
|
||||||
} else if (MimeTypes.isVideo(mimeType)) {
|
} else if (MimeTypes.isVideo(mimeType)) {
|
||||||
format = MediaFormat.createVideoFormat(null, trackId, mimeType, MediaFormat.NO_VALUE,
|
format = MediaFormat.createVideoFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE,
|
||||||
maxInputSize, durationUs, width, height, initializationData);
|
maxInputSize, durationUs, width, height, initializationData);
|
||||||
} else if (MimeTypes.APPLICATION_SUBRIP.equals(mimeType)) {
|
} else if (MimeTypes.APPLICATION_SUBRIP.equals(mimeType)) {
|
||||||
format = MediaFormat.createTextFormat(null, trackId, mimeType, MediaFormat.NO_VALUE, durationUs,
|
format = MediaFormat.createTextFormat(Integer.toString(trackId), mimeType, MediaFormat.NO_VALUE, durationUs,
|
||||||
language);
|
language);
|
||||||
} else {
|
} else {
|
||||||
throw new ParserException("Unexpected MIME type.");
|
throw new ParserException("Unexpected MIME type.");
|
||||||
|
|
|
||||||
|
|
@ -398,7 +398,7 @@ public class SmoothStreamingChunkSource implements ChunkSource,
|
||||||
int mp4TrackType;
|
int mp4TrackType;
|
||||||
switch (element.type) {
|
switch (element.type) {
|
||||||
case StreamElement.TYPE_VIDEO:
|
case StreamElement.TYPE_VIDEO:
|
||||||
mediaFormat = MediaFormat.createVideoFormat(format.id, MediaFormat.NO_VALUE, format.mimeType,
|
mediaFormat = MediaFormat.createVideoFormat(format.id, format.mimeType,
|
||||||
format.bitrate, MediaFormat.NO_VALUE, durationUs, format.width, format.height,
|
format.bitrate, MediaFormat.NO_VALUE, durationUs, format.width, format.height,
|
||||||
Arrays.asList(csdArray));
|
Arrays.asList(csdArray));
|
||||||
mp4TrackType = Track.TYPE_vide;
|
mp4TrackType = Track.TYPE_vide;
|
||||||
|
|
@ -411,13 +411,13 @@ public class SmoothStreamingChunkSource implements ChunkSource,
|
||||||
csd = Collections.singletonList(CodecSpecificDataUtil.buildAacAudioSpecificConfig(
|
csd = Collections.singletonList(CodecSpecificDataUtil.buildAacAudioSpecificConfig(
|
||||||
format.audioSamplingRate, format.audioChannels));
|
format.audioSamplingRate, format.audioChannels));
|
||||||
}
|
}
|
||||||
mediaFormat = MediaFormat.createAudioFormat(format.id, MediaFormat.NO_VALUE, format.mimeType,
|
mediaFormat = MediaFormat.createAudioFormat(format.id, format.mimeType,
|
||||||
format.bitrate, MediaFormat.NO_VALUE, durationUs, format.audioChannels,
|
format.bitrate, MediaFormat.NO_VALUE, durationUs, format.audioChannels,
|
||||||
format.audioSamplingRate, csd, format.language);
|
format.audioSamplingRate, csd, format.language);
|
||||||
mp4TrackType = Track.TYPE_soun;
|
mp4TrackType = Track.TYPE_soun;
|
||||||
break;
|
break;
|
||||||
case StreamElement.TYPE_TEXT:
|
case StreamElement.TYPE_TEXT:
|
||||||
mediaFormat = MediaFormat.createTextFormat(format.id, MediaFormat.NO_VALUE, format.mimeType,
|
mediaFormat = MediaFormat.createTextFormat(format.id, format.mimeType,
|
||||||
format.bitrate, durationUs, format.language);
|
format.bitrate, durationUs, format.language);
|
||||||
mp4TrackType = Track.TYPE_text;
|
mp4TrackType = Track.TYPE_text;
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ public final class Ac3Util {
|
||||||
if ((nextByte & 0x04) != 0) {
|
if ((nextByte & 0x04) != 0) {
|
||||||
channelCount++;
|
channelCount++;
|
||||||
}
|
}
|
||||||
return MediaFormat.createAudioFormat(null, trackId, MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
|
return MediaFormat.createAudioFormat(Integer.toString(trackId), MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
|
||||||
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -85,7 +85,7 @@ public final class Ac3Util {
|
||||||
if ((nextByte & 0x01) != 0) {
|
if ((nextByte & 0x01) != 0) {
|
||||||
channelCount++;
|
channelCount++;
|
||||||
}
|
}
|
||||||
return MediaFormat.createAudioFormat(null, trackId, MimeTypes.AUDIO_EC3, MediaFormat.NO_VALUE,
|
return MediaFormat.createAudioFormat(Integer.toString(trackId), MimeTypes.AUDIO_EC3, MediaFormat.NO_VALUE,
|
||||||
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
MediaFormat.NO_VALUE, durationUs, channelCount, sampleRate, null, language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -117,7 +117,7 @@ public final class Ac3Util {
|
||||||
data.skipBits(2); // dsurmod
|
data.skipBits(2); // dsurmod
|
||||||
}
|
}
|
||||||
boolean lfeon = data.readBit();
|
boolean lfeon = data.readBit();
|
||||||
return MediaFormat.createAudioFormat(null, trackId, MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
|
return MediaFormat.createAudioFormat(Integer.toString(trackId), MimeTypes.AUDIO_AC3, MediaFormat.NO_VALUE,
|
||||||
MediaFormat.NO_VALUE, durationUs, CHANNEL_COUNTS[acmod] + (lfeon ? 1 : 0),
|
MediaFormat.NO_VALUE, durationUs, CHANNEL_COUNTS[acmod] + (lfeon ? 1 : 0),
|
||||||
SAMPLE_RATES[fscod], null, language);
|
SAMPLE_RATES[fscod], null, language);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue