mirror of
https://github.com/samsonjs/media.git
synced 2026-04-02 10:45:51 +00:00
Remove MediaFormat.bitrate.
This commit is contained in:
parent
54f97c952e
commit
d82343d06c
3 changed files with 8 additions and 22 deletions
|
|
@ -49,8 +49,6 @@ public class MediaFormat {
|
|||
public final int channelCount;
|
||||
public final int sampleRate;
|
||||
|
||||
public final int bitrate;
|
||||
|
||||
public final List<byte[]> initializationData;
|
||||
|
||||
private int maxWidth;
|
||||
|
|
@ -81,7 +79,7 @@ public class MediaFormat {
|
|||
public static MediaFormat createVideoFormat(String mimeType, int maxInputSize, long durationUs,
|
||||
int width, int height, float pixelWidthHeightRatio, List<byte[]> initializationData) {
|
||||
return new MediaFormat(mimeType, maxInputSize, durationUs, width, height, pixelWidthHeightRatio,
|
||||
NO_VALUE, NO_VALUE, NO_VALUE, initializationData);
|
||||
NO_VALUE, NO_VALUE, initializationData);
|
||||
}
|
||||
|
||||
public static MediaFormat createAudioFormat(String mimeType, int maxInputSize, int channelCount,
|
||||
|
|
@ -92,14 +90,8 @@ public class MediaFormat {
|
|||
|
||||
public static MediaFormat createAudioFormat(String mimeType, int maxInputSize, long durationUs,
|
||||
int channelCount, int sampleRate, List<byte[]> initializationData) {
|
||||
return createAudioFormat(
|
||||
mimeType, maxInputSize, durationUs, channelCount, sampleRate, NO_VALUE, initializationData);
|
||||
}
|
||||
|
||||
public static MediaFormat createAudioFormat(String mimeType, int maxInputSize, long durationUs,
|
||||
int channelCount, int sampleRate, int bitrate, List<byte[]> initializationData) {
|
||||
return new MediaFormat(mimeType, maxInputSize, durationUs, NO_VALUE, NO_VALUE, NO_VALUE,
|
||||
channelCount, sampleRate, bitrate, initializationData);
|
||||
channelCount, sampleRate, initializationData);
|
||||
}
|
||||
|
||||
public static MediaFormat createId3Format() {
|
||||
|
|
@ -116,7 +108,7 @@ public class MediaFormat {
|
|||
|
||||
public static MediaFormat createFormatForMimeType(String mimeType) {
|
||||
return new MediaFormat(mimeType, NO_VALUE, C.UNKNOWN_TIME_US, NO_VALUE, NO_VALUE, NO_VALUE,
|
||||
NO_VALUE, NO_VALUE, NO_VALUE, null);
|
||||
NO_VALUE, NO_VALUE, null);
|
||||
}
|
||||
|
||||
@TargetApi(16)
|
||||
|
|
@ -128,7 +120,6 @@ public class MediaFormat {
|
|||
height = getOptionalIntegerV16(format, android.media.MediaFormat.KEY_HEIGHT);
|
||||
channelCount = getOptionalIntegerV16(format, android.media.MediaFormat.KEY_CHANNEL_COUNT);
|
||||
sampleRate = getOptionalIntegerV16(format, android.media.MediaFormat.KEY_SAMPLE_RATE);
|
||||
bitrate = getOptionalIntegerV16(format, android.media.MediaFormat.KEY_BIT_RATE);
|
||||
pixelWidthHeightRatio = getOptionalFloatV16(format, KEY_PIXEL_WIDTH_HEIGHT_RATIO);
|
||||
initializationData = new ArrayList<byte[]>();
|
||||
for (int i = 0; format.containsKey("csd-" + i); i++) {
|
||||
|
|
@ -145,7 +136,7 @@ public class MediaFormat {
|
|||
}
|
||||
|
||||
private MediaFormat(String mimeType, int maxInputSize, long durationUs, int width, int height,
|
||||
float pixelWidthHeightRatio, int channelCount, int sampleRate, int bitrate,
|
||||
float pixelWidthHeightRatio, int channelCount, int sampleRate,
|
||||
List<byte[]> initializationData) {
|
||||
this.mimeType = mimeType;
|
||||
this.maxInputSize = maxInputSize;
|
||||
|
|
@ -155,7 +146,6 @@ public class MediaFormat {
|
|||
this.pixelWidthHeightRatio = pixelWidthHeightRatio;
|
||||
this.channelCount = channelCount;
|
||||
this.sampleRate = sampleRate;
|
||||
this.bitrate = bitrate;
|
||||
this.initializationData = initializationData == null ? Collections.<byte[]>emptyList()
|
||||
: initializationData;
|
||||
maxWidth = NO_VALUE;
|
||||
|
|
@ -192,7 +182,6 @@ public class MediaFormat {
|
|||
result = 31 * result + maxHeight;
|
||||
result = 31 * result + channelCount;
|
||||
result = 31 * result + sampleRate;
|
||||
result = 31 * result + bitrate;
|
||||
for (int i = 0; i < initializationData.size(); i++) {
|
||||
result = 31 * result + Arrays.hashCode(initializationData.get(i));
|
||||
}
|
||||
|
|
@ -228,7 +217,6 @@ public class MediaFormat {
|
|||
|| (!ignoreMaxDimensions && (maxWidth != other.maxWidth || maxHeight != other.maxHeight))
|
||||
|| channelCount != other.channelCount || sampleRate != other.sampleRate
|
||||
|| !Util.areEqual(mimeType, other.mimeType)
|
||||
|| bitrate != other.bitrate
|
||||
|| initializationData.size() != other.initializationData.size()) {
|
||||
return false;
|
||||
}
|
||||
|
|
@ -243,8 +231,8 @@ public class MediaFormat {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "MediaFormat(" + mimeType + ", " + maxInputSize + ", " + width + ", " + height + ", "
|
||||
+ pixelWidthHeightRatio + ", " + channelCount + ", " + sampleRate + ", " + bitrate + ", "
|
||||
+ durationUs + ", " + maxWidth + ", " + maxHeight + ")";
|
||||
+ pixelWidthHeightRatio + ", " + channelCount + ", " + sampleRate + ", " + durationUs + ", "
|
||||
+ maxWidth + ", " + maxHeight + ")";
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -260,7 +248,6 @@ public class MediaFormat {
|
|||
maybeSetIntegerV16(format, android.media.MediaFormat.KEY_HEIGHT, height);
|
||||
maybeSetIntegerV16(format, android.media.MediaFormat.KEY_CHANNEL_COUNT, channelCount);
|
||||
maybeSetIntegerV16(format, android.media.MediaFormat.KEY_SAMPLE_RATE, sampleRate);
|
||||
maybeSetIntegerV16(format, android.media.MediaFormat.KEY_BIT_RATE, bitrate);
|
||||
maybeSetFloatV16(format, KEY_PIXEL_WIDTH_HEIGHT_RATIO, pixelWidthHeightRatio);
|
||||
for (int i = 0; i < initializationData.size(); i++) {
|
||||
format.setByteBuffer("csd-" + i, ByteBuffer.wrap(initializationData.get(i)));
|
||||
|
|
|
|||
|
|
@ -258,7 +258,7 @@ public final class Mp3Extractor implements Extractor {
|
|||
trackOutput.format(MediaFormat.createAudioFormat(
|
||||
MIME_TYPE_BY_LAYER[synchronizedHeader.layerIndex], MAX_FRAME_SIZE_BYTES,
|
||||
seeker.getDurationUs(), synchronizedHeader.channels, synchronizedHeader.sampleRate,
|
||||
synchronizedHeader.bitrate * 1000, Collections.<byte[]>emptyList()));
|
||||
Collections.<byte[]>emptyList()));
|
||||
}
|
||||
|
||||
return headerPosition;
|
||||
|
|
|
|||
|
|
@ -498,7 +498,6 @@ import java.util.List;
|
|||
int sampleSize = parent.readUnsignedShort();
|
||||
parent.skipBytes(4);
|
||||
int sampleRate = parent.readUnsignedFixedPoint1616();
|
||||
int bitrate = MediaFormat.NO_VALUE;
|
||||
|
||||
byte[] initializationData = null;
|
||||
int childPosition = parent.getPosition();
|
||||
|
|
@ -536,7 +535,7 @@ import java.util.List;
|
|||
}
|
||||
|
||||
out.mediaFormat = MediaFormat.createAudioFormat(
|
||||
MimeTypes.AUDIO_AAC, sampleSize, durationUs, channelCount, sampleRate, bitrate,
|
||||
MimeTypes.AUDIO_AAC, sampleSize, durationUs, channelCount, sampleRate,
|
||||
initializationData == null ? null : Collections.singletonList(initializationData));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue