mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
Fix some HEVC and H.263 nits.
This commit is contained in:
parent
9dc1bfbbe7
commit
a44a78c72d
3 changed files with 11 additions and 11 deletions
|
|
@ -41,6 +41,8 @@ import java.util.List;
|
||||||
public static final int TYPE_avc3 = Util.getIntegerCodeForString("avc3");
|
public static final int TYPE_avc3 = Util.getIntegerCodeForString("avc3");
|
||||||
public static final int TYPE_hvc1 = Util.getIntegerCodeForString("hvc1");
|
public static final int TYPE_hvc1 = Util.getIntegerCodeForString("hvc1");
|
||||||
public static final int TYPE_hev1 = Util.getIntegerCodeForString("hev1");
|
public static final int TYPE_hev1 = Util.getIntegerCodeForString("hev1");
|
||||||
|
public static final int TYPE_s263 = Util.getIntegerCodeForString("s263");
|
||||||
|
public static final int TYPE_d263 = Util.getIntegerCodeForString("d263");
|
||||||
public static final int TYPE_mdat = Util.getIntegerCodeForString("mdat");
|
public static final int TYPE_mdat = Util.getIntegerCodeForString("mdat");
|
||||||
public static final int TYPE_mp4a = Util.getIntegerCodeForString("mp4a");
|
public static final int TYPE_mp4a = Util.getIntegerCodeForString("mp4a");
|
||||||
public static final int TYPE_ac_3 = Util.getIntegerCodeForString("ac-3");
|
public static final int TYPE_ac_3 = Util.getIntegerCodeForString("ac-3");
|
||||||
|
|
@ -92,8 +94,6 @@ import java.util.List;
|
||||||
public static final int TYPE_stco = Util.getIntegerCodeForString("stco");
|
public static final int TYPE_stco = Util.getIntegerCodeForString("stco");
|
||||||
public static final int TYPE_co64 = Util.getIntegerCodeForString("co64");
|
public static final int TYPE_co64 = Util.getIntegerCodeForString("co64");
|
||||||
public static final int TYPE_tx3g = Util.getIntegerCodeForString("tx3g");
|
public static final int TYPE_tx3g = Util.getIntegerCodeForString("tx3g");
|
||||||
public static final int TYPE_s263 = Util.getIntegerCodeForString("s263");
|
|
||||||
public static final int TYPE_d263 = Util.getIntegerCodeForString("d263");
|
|
||||||
|
|
||||||
public final int type;
|
public final int type;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1069,14 +1069,14 @@ public final class WebmExtractor implements Extractor {
|
||||||
break;
|
break;
|
||||||
case CODEC_ID_H264:
|
case CODEC_ID_H264:
|
||||||
mimeType = MimeTypes.VIDEO_H264;
|
mimeType = MimeTypes.VIDEO_H264;
|
||||||
Pair<List<byte[]>, Integer> h264Data = parseH264CodecPrivate(
|
Pair<List<byte[]>, Integer> h264Data = parseAvcCodecPrivate(
|
||||||
new ParsableByteArray(codecPrivate));
|
new ParsableByteArray(codecPrivate));
|
||||||
initializationData = h264Data.first;
|
initializationData = h264Data.first;
|
||||||
nalUnitLengthFieldLength = h264Data.second;
|
nalUnitLengthFieldLength = h264Data.second;
|
||||||
break;
|
break;
|
||||||
case CODEC_ID_H265:
|
case CODEC_ID_H265:
|
||||||
mimeType = MimeTypes.VIDEO_H265;
|
mimeType = MimeTypes.VIDEO_H265;
|
||||||
Pair<List<byte[]>, Integer> hevcData = parseHEVCCodecPrivate(
|
Pair<List<byte[]>, Integer> hevcData = parseHevcCodecPrivate(
|
||||||
new ParsableByteArray(codecPrivate));
|
new ParsableByteArray(codecPrivate));
|
||||||
initializationData = hevcData.first;
|
initializationData = hevcData.first;
|
||||||
nalUnitLengthFieldLength = hevcData.second;
|
nalUnitLengthFieldLength = hevcData.second;
|
||||||
|
|
@ -1121,12 +1121,12 @@ public final class WebmExtractor implements Extractor {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Builds initialization data for a {@link MediaFormat} from H.264 codec private data.
|
* Builds initialization data for a {@link MediaFormat} from H.264 (AVC) codec private data.
|
||||||
*
|
*
|
||||||
* @return The initialization data for the {@link MediaFormat}.
|
* @return The initialization data for the {@link MediaFormat}.
|
||||||
* @throws ParserException If the initialization data could not be built.
|
* @throws ParserException If the initialization data could not be built.
|
||||||
*/
|
*/
|
||||||
private static Pair<List<byte[]>, Integer> parseH264CodecPrivate(ParsableByteArray buffer)
|
private static Pair<List<byte[]>, Integer> parseAvcCodecPrivate(ParsableByteArray buffer)
|
||||||
throws ParserException {
|
throws ParserException {
|
||||||
try {
|
try {
|
||||||
// TODO: Deduplicate with AtomParsers.parseAvcCFromParent.
|
// TODO: Deduplicate with AtomParsers.parseAvcCFromParent.
|
||||||
|
|
@ -1144,7 +1144,7 @@ public final class WebmExtractor implements Extractor {
|
||||||
}
|
}
|
||||||
return Pair.create(initializationData, nalUnitLengthFieldLength);
|
return Pair.create(initializationData, nalUnitLengthFieldLength);
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
throw new ParserException("Error parsing vorbis codec private");
|
throw new ParserException("Error parsing AVC codec private");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1154,10 +1154,10 @@ public final class WebmExtractor implements Extractor {
|
||||||
* @return The initialization data for the {@link MediaFormat}.
|
* @return The initialization data for the {@link MediaFormat}.
|
||||||
* @throws ParserException If the initialization data could not be built.
|
* @throws ParserException If the initialization data could not be built.
|
||||||
*/
|
*/
|
||||||
private static Pair<List<byte[]>, Integer> parseHEVCCodecPrivate(ParsableByteArray parent)
|
private static Pair<List<byte[]>, Integer> parseHevcCodecPrivate(ParsableByteArray parent)
|
||||||
throws ParserException {
|
throws ParserException {
|
||||||
try {
|
try {
|
||||||
// TODO: Deduplicate with AtomParsers.parseAvcCFromParent.
|
// TODO: Deduplicate with AtomParsers.parseHvcCFromParent.
|
||||||
parent.setPosition(21);
|
parent.setPosition(21);
|
||||||
int lengthSizeMinusOne = parent.readUnsignedByte() & 0x03;
|
int lengthSizeMinusOne = parent.readUnsignedByte() & 0x03;
|
||||||
|
|
||||||
|
|
@ -1197,7 +1197,7 @@ public final class WebmExtractor implements Extractor {
|
||||||
List<byte[]> initializationData = csdLength == 0 ? null : Collections.singletonList(buffer);
|
List<byte[]> initializationData = csdLength == 0 ? null : Collections.singletonList(buffer);
|
||||||
return Pair.create(initializationData, lengthSizeMinusOne + 1);
|
return Pair.create(initializationData, lengthSizeMinusOne + 1);
|
||||||
} catch (ArrayIndexOutOfBoundsException e) {
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
throw new ParserException("Error parsing vorbis codec private");
|
throw new ParserException("Error parsing HEVC codec private");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,12 +32,12 @@ public class MimeTypes {
|
||||||
|
|
||||||
public static final String VIDEO_MP4 = BASE_TYPE_VIDEO + "/mp4";
|
public static final String VIDEO_MP4 = BASE_TYPE_VIDEO + "/mp4";
|
||||||
public static final String VIDEO_WEBM = BASE_TYPE_VIDEO + "/webm";
|
public static final String VIDEO_WEBM = BASE_TYPE_VIDEO + "/webm";
|
||||||
|
public static final String VIDEO_H263 = BASE_TYPE_VIDEO + "/3gpp";
|
||||||
public static final String VIDEO_H264 = BASE_TYPE_VIDEO + "/avc";
|
public static final String VIDEO_H264 = BASE_TYPE_VIDEO + "/avc";
|
||||||
public static final String VIDEO_H265 = BASE_TYPE_VIDEO + "/hevc";
|
public static final String VIDEO_H265 = BASE_TYPE_VIDEO + "/hevc";
|
||||||
public static final String VIDEO_VP8 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp8";
|
public static final String VIDEO_VP8 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp8";
|
||||||
public static final String VIDEO_VP9 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp9";
|
public static final String VIDEO_VP9 = BASE_TYPE_VIDEO + "/x-vnd.on2.vp9";
|
||||||
public static final String VIDEO_MP4V = BASE_TYPE_VIDEO + "/mp4v-es";
|
public static final String VIDEO_MP4V = BASE_TYPE_VIDEO + "/mp4v-es";
|
||||||
public static final String VIDEO_H263 = BASE_TYPE_VIDEO + "/3gpp";
|
|
||||||
|
|
||||||
public static final String AUDIO_MP4 = BASE_TYPE_AUDIO + "/mp4";
|
public static final String AUDIO_MP4 = BASE_TYPE_AUDIO + "/mp4";
|
||||||
public static final String AUDIO_AAC = BASE_TYPE_AUDIO + "/mp4a-latm";
|
public static final String AUDIO_AAC = BASE_TYPE_AUDIO + "/mp4a-latm";
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue