mirror of
https://github.com/androidx/media.git
synced 2025-05-04 14:10:40 +08:00
Changed readable values to hex to follow Exo standard
This commit is contained in:
parent
1a616b4e00
commit
4f09fc36f9
@ -110,15 +110,15 @@ public class AviExtractor implements Extractor {
|
|||||||
static final int AVIIF_KEYFRAME = 16;
|
static final int AVIIF_KEYFRAME = 16;
|
||||||
|
|
||||||
|
|
||||||
static final int RIFF = 'R' | ('I' << 8) | ('F' << 16) | ('F' << 24);
|
static final int RIFF = 0x46464952; // RIFF
|
||||||
static final int AVI_ = 'A' | ('V' << 8) | ('I' << 16) | (' ' << 24);
|
static final int AVI_ = 0x20495641; // AVI<space>
|
||||||
//movie data box
|
//movie data box
|
||||||
static final int MOVI = 'm' | ('o' << 8) | ('v' << 16) | ('i' << 24);
|
static final int MOVI = 0x69766f6d; // movi
|
||||||
//Index
|
//Index
|
||||||
static final int IDX1 = 'i' | ('d' << 8) | ('x' << 16) | ('1' << 24);
|
static final int IDX1 = 0x31786469; // idx1
|
||||||
|
|
||||||
static final int JUNK = 'J' | ('U' << 8) | ('N' << 16) | ('K' << 24);
|
static final int JUNK = 0x4b4e554a; // JUNK
|
||||||
static final int REC_ = 'r' | ('e' << 8) | ('c' << 16) | (' ' << 24);
|
static final int REC_ = 0x20636572; // rec<space>
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
int state;
|
int state;
|
||||||
|
@ -25,7 +25,7 @@ public class AviHeaderBox extends ResidentBox {
|
|||||||
static final int LEN = 0x38;
|
static final int LEN = 0x38;
|
||||||
static final int AVIF_HASINDEX = 0x10;
|
static final int AVIF_HASINDEX = 0x10;
|
||||||
private static final int AVIF_MUSTUSEINDEX = 0x20;
|
private static final int AVIF_MUSTUSEINDEX = 0x20;
|
||||||
static final int AVIH = 'a' | ('v' << 8) | ('i' << 16) | ('h' << 24);
|
static final int AVIH = 0x68697661; // avih
|
||||||
|
|
||||||
AviHeaderBox(int type, int size, ByteBuffer byteBuffer) {
|
AviHeaderBox(int type, int size, ByteBuffer byteBuffer) {
|
||||||
super(type, size, byteBuffer);
|
super(type, size, byteBuffer);
|
||||||
|
@ -27,11 +27,9 @@ import java.util.List;
|
|||||||
* An AVI LIST box. Similar to a Java List<Box>
|
* An AVI LIST box. Similar to a Java List<Box>
|
||||||
*/
|
*/
|
||||||
public class ListBox extends Box {
|
public class ListBox extends Box {
|
||||||
public static final int LIST = 'L' | ('I' << 8) | ('S' << 16) | ('T' << 24);
|
public static final int LIST = 0x5453494c; // LIST
|
||||||
//Header List
|
public static final int TYPE_HDRL = 0x6c726468; // hdrl - Header List
|
||||||
public static final int TYPE_HDRL = 'h' | ('d' << 8) | ('r' << 16) | ('l' << 24);
|
public static final int TYPE_STRL = 0x6c727473; // strl - Stream List
|
||||||
//Stream List
|
|
||||||
public static final int TYPE_STRL = 's' | ('t' << 8) | ('r' << 16) | ('l' << 24);
|
|
||||||
|
|
||||||
private final int listType;
|
private final int listType;
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import java.nio.ByteBuffer;
|
|||||||
* Wrapper around the various StreamFormats
|
* Wrapper around the various StreamFormats
|
||||||
*/
|
*/
|
||||||
public class StreamFormatBox extends ResidentBox {
|
public class StreamFormatBox extends ResidentBox {
|
||||||
public static final int STRF = 's' | ('t' << 8) | ('r' << 16) | ('f' << 24);
|
public static final int STRF = 0x66727473; // strf
|
||||||
|
|
||||||
StreamFormatBox(int type, int size, ByteBuffer byteBuffer) {
|
StreamFormatBox(int type, int size, ByteBuffer byteBuffer) {
|
||||||
super(type, size, byteBuffer);
|
super(type, size, byteBuffer);
|
||||||
|
@ -22,13 +22,13 @@ import java.nio.ByteBuffer;
|
|||||||
* Wrapper around the AVISTREAMHEADER structure
|
* Wrapper around the AVISTREAMHEADER structure
|
||||||
*/
|
*/
|
||||||
public class StreamHeaderBox extends ResidentBox {
|
public class StreamHeaderBox extends ResidentBox {
|
||||||
public static final int STRH = 's' | ('t' << 8) | ('r' << 16) | ('h' << 24);
|
public static final int STRH = 0x68727473; // strh
|
||||||
|
|
||||||
//Audio Stream
|
//Audio Stream
|
||||||
static final int AUDS = 'a' | ('u' << 8) | ('d' << 16) | ('s' << 24);
|
static final int AUDS = 0x73647561; // auds
|
||||||
|
|
||||||
//Videos Stream
|
//Videos Stream
|
||||||
static final int VIDS = 'v' | ('i' << 8) | ('d' << 16) | ('s' << 24);
|
static final int VIDS = 0x73646976; // vids
|
||||||
|
|
||||||
StreamHeaderBox(int type, int size, ByteBuffer byteBuffer) {
|
StreamHeaderBox(int type, int size, ByteBuffer byteBuffer) {
|
||||||
super(type, size, byteBuffer);
|
super(type, size, byteBuffer);
|
||||||
|
@ -21,7 +21,7 @@ import java.nio.ByteBuffer;
|
|||||||
* Box containing a human readable stream name
|
* Box containing a human readable stream name
|
||||||
*/
|
*/
|
||||||
public class StreamNameBox extends ResidentBox {
|
public class StreamNameBox extends ResidentBox {
|
||||||
public static final int STRN = 's' | ('t' << 8) | ('r' << 16) | ('n' << 24);
|
public static final int STRN = 0x6e727473; // strn
|
||||||
|
|
||||||
StreamNameBox(int type, int size, ByteBuffer byteBuffer) {
|
StreamNameBox(int type, int size, ByteBuffer byteBuffer) {
|
||||||
super(type, size, byteBuffer);
|
super(type, size, byteBuffer);
|
||||||
|
@ -25,7 +25,7 @@ import java.util.HashMap;
|
|||||||
*/
|
*/
|
||||||
public class VideoFormat {
|
public class VideoFormat {
|
||||||
|
|
||||||
static final int XVID = 'X' | ('V' << 8) | ('I' << 16) | ('D' << 24);
|
static final int XVID = 0x44495658; // XVID
|
||||||
|
|
||||||
private static final HashMap<Integer, String> STREAM_MAP = new HashMap<>();
|
private static final HashMap<Integer, String> STREAM_MAP = new HashMap<>();
|
||||||
|
|
||||||
@ -34,21 +34,21 @@ public class VideoFormat {
|
|||||||
final String mimeType = MimeTypes.VIDEO_MP4V;
|
final String mimeType = MimeTypes.VIDEO_MP4V;
|
||||||
|
|
||||||
//I've never seen an Android devices that actually supports MP42
|
//I've never seen an Android devices that actually supports MP42
|
||||||
STREAM_MAP.put('M' | ('P' << 8) | ('4' << 16) | ('2' << 24), MimeTypes.VIDEO_MP42);
|
STREAM_MAP.put(0x3234504d, MimeTypes.VIDEO_MP42); // MP42
|
||||||
//Samsung seems to support the rare MP43.
|
//Samsung seems to support the rare MP43.
|
||||||
STREAM_MAP.put('M' | ('P' << 8) | ('4' << 16) | ('3' << 24), MimeTypes.VIDEO_MP43);
|
STREAM_MAP.put(0x3334504d, MimeTypes.VIDEO_MP43); // MP43
|
||||||
STREAM_MAP.put('H' | ('2' << 8) | ('6' << 16) | ('4' << 24), MimeTypes.VIDEO_H264);
|
STREAM_MAP.put(0x34363248, MimeTypes.VIDEO_H264); // H264
|
||||||
STREAM_MAP.put('a' | ('v' << 8) | ('c' << 16) | ('1' << 24), MimeTypes.VIDEO_H264);
|
STREAM_MAP.put(0x31637661, MimeTypes.VIDEO_H264); // avc1
|
||||||
STREAM_MAP.put('A' | ('V' << 8) | ('C' << 16) | ('1' << 24), MimeTypes.VIDEO_H264);
|
STREAM_MAP.put(0x31435641, MimeTypes.VIDEO_H264); // AVC1
|
||||||
STREAM_MAP.put('3' | ('V' << 8) | ('I' << 16) | ('D' << 24), mimeType);
|
STREAM_MAP.put(0x44495633, mimeType); // 3VID
|
||||||
STREAM_MAP.put('d' | ('i' << 8) | ('v' << 16) | ('x' << 24), mimeType);
|
STREAM_MAP.put(0x78766964, mimeType); // divx
|
||||||
STREAM_MAP.put('D' | ('I' << 8) | ('V' << 16) | ('X' << 24), mimeType);
|
STREAM_MAP.put(0x58564944, mimeType); // DIVX
|
||||||
STREAM_MAP.put('D' | ('X' << 8) | ('5' << 16) | ('0' << 24), mimeType);
|
STREAM_MAP.put(0x30355844, mimeType); // DX50
|
||||||
STREAM_MAP.put('F' | ('M' << 8) | ('P' << 16) | ('4' << 24), mimeType);
|
STREAM_MAP.put(0x34504d46, mimeType); // FMP4
|
||||||
STREAM_MAP.put('x' | ('v' << 8) | ('i' << 16) | ('d' << 24), mimeType);
|
STREAM_MAP.put(0x64697678, mimeType); // xvid
|
||||||
STREAM_MAP.put(XVID, mimeType);
|
STREAM_MAP.put(XVID, mimeType); // XVID
|
||||||
STREAM_MAP.put('M' | ('J' << 8) | ('P' << 16) | ('G' << 24), MimeTypes.VIDEO_MJPEG);
|
STREAM_MAP.put(0x47504a4d, MimeTypes.VIDEO_MJPEG); // MJPG
|
||||||
STREAM_MAP.put('m' | ('j' << 8) | ('p' << 16) | ('g' << 24), MimeTypes.VIDEO_MJPEG);
|
STREAM_MAP.put(0x67706a6d, MimeTypes.VIDEO_MJPEG); // mjpg
|
||||||
}
|
}
|
||||||
|
|
||||||
private final ByteBuffer byteBuffer;
|
private final ByteBuffer byteBuffer;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user