Skip to content

Commit a28c4bb

Browse files
committed
Debug byte order and fourcc gen
1 parent 39ae662 commit a28c4bb

File tree

2 files changed

+19
-7
lines changed

2 files changed

+19
-7
lines changed

io/src/main/java/org/red5/codec/VideoCodec.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public IVideoStreamCodec newInstance() {
106106

107107
@Override
108108
public String getMimeType() {
109-
return "vp08";
109+
return "vp08"; // vp8 / ffmpeg LE = 08pv / 0x76703038
110110
}
111111

112112
}, // VP8 / vp08 / vp8
@@ -119,7 +119,7 @@ public IVideoStreamCodec newInstance() {
119119

120120
@Override
121121
public String getMimeType() {
122-
return "vp09";
122+
return "vp09"; // vp9 / ffmpeg LE = 09pv / 0x76703039
123123
}
124124

125125
}, // VP9 / vp09
@@ -159,7 +159,7 @@ public IVideoStreamCodec newInstance() {
159159

160160
@Override
161161
public String getMimeType() {
162-
return "av01";
162+
return "av01"; // av1 / ffmpeg LE = 10va / 0x61763031
163163
}
164164

165165
}; // AV1 / av01

io/src/test/java/org/red5/codec/FourCCTest.java

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,33 @@
11
package org.red5.codec;
22

3+
import org.apache.mina.core.buffer.IoBuffer;
34
import org.junit.Test;
45
import org.red5.io.utils.IOUtils;
6+
import java.nio.ByteOrder;
57

68
public class FourCCTest {
79

810
@Test
911
public void test() {
1012
VideoCodec[] values = VideoCodec.values();
1113
for (VideoCodec codec : values) {
12-
System.out.println(codec.name() + " fourcc: " + codec.getFourcc());
13-
System.out.println("mimeType: " + codec.getMimeType() + " fourcc from mime: " + IOUtils.makeFourcc(codec.getMimeType()));
14+
int fourcc = codec.getFourcc();
15+
System.out.println(codec.name() + " fourcc: " + fourcc + " mimeType: " + codec.getMimeType() + " fourcc from mime: " + IOUtils.makeFourcc(codec.getMimeType()));
16+
IoBuffer buffer = IoBuffer.allocate(4);
17+
buffer.order(ByteOrder.BIG_ENDIAN); // native order is BIG_ENDIAN in linux
18+
buffer.putInt(fourcc);
19+
buffer.flip();
20+
System.out.println("fourcc bytes: " + buffer.getHexDump());
1421
}
1522
AudioCodec[] audioValues = AudioCodec.values();
1623
for (AudioCodec codec : audioValues) {
17-
System.out.println(codec.name() + " fourcc: " + codec.getFourcc());
18-
System.out.println("mimeType: " + codec.getMimeType() + " fourcc from mime: " + IOUtils.makeFourcc(codec.getMimeType()));
24+
int fourcc = codec.getFourcc();
25+
System.out.println(codec.name() + " fourcc: " + fourcc + " mimeType: " + codec.getMimeType() + " fourcc from mime: " + IOUtils.makeFourcc(codec.getMimeType()));
26+
IoBuffer buffer = IoBuffer.allocate(4);
27+
buffer.order(ByteOrder.BIG_ENDIAN); // native order is BIG_ENDIAN in linux
28+
buffer.putInt(fourcc);
29+
buffer.flip();
30+
System.out.println("fourcc bytes: " + buffer.getHexDump());
1931
}
2032
}
2133

0 commit comments

Comments
 (0)