();
12 |
13 | static {
14 | mediaTypes.put("0", "Movie (is now 9)");
15 | mediaTypes.put("1", "Normal (Music)");
16 | mediaTypes.put("2", "Audiobook");
17 | mediaTypes.put("6", "Music Video");
18 | mediaTypes.put("9", "Movie");
19 | mediaTypes.put("10", "TV Show");
20 | mediaTypes.put("11", "Booklet");
21 | mediaTypes.put("14", "Ringtone");
22 | }
23 |
24 | public static final String TYPE = "stik";
25 |
26 |
27 | public AppleMediaTypeBox() {
28 | super(TYPE);
29 | appleDataBox = AppleDataBox.getUint8AppleDataBox();
30 | }
31 |
32 | public String getReadableValue() {
33 | if (mediaTypes.containsKey(getValue())) {
34 | return mediaTypes.get(getValue());
35 | } else {
36 | return "unknown media type " + getValue();
37 | }
38 |
39 | }
40 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleNameBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | import com.coremedia.iso.IsoTypeReader;
4 | import com.coremedia.iso.Utf8;
5 | import com.googlecode.mp4parser.AbstractFullBox;
6 |
7 | import java.nio.ByteBuffer;
8 |
9 | /**
10 | * 4cc = "{@value #TYPE}"
11 | * Apple Name box. Allowed as subbox of "----" box.
12 | *
13 | * @see AppleGenericBox
14 | */
15 | public final class AppleNameBox extends AbstractFullBox {
16 | public static final String TYPE = "name";
17 | private String name;
18 |
19 | public AppleNameBox() {
20 | super(TYPE);
21 | }
22 |
23 | protected long getContentSize() {
24 | return 4 + Utf8.convert(name).length;
25 | }
26 |
27 | public String getName() {
28 | return name;
29 | }
30 |
31 | public void setName(String name) {
32 | this.name = name;
33 | }
34 |
35 | @Override
36 | public void _parseDetails(ByteBuffer content) {
37 | parseVersionAndFlags(content);
38 | name = IsoTypeReader.readString(content, content.remaining());
39 | }
40 |
41 | @Override
42 | protected void getContent(ByteBuffer byteBuffer) {
43 | writeVersionAndFlags(byteBuffer);
44 | byteBuffer.put(Utf8.convert(name));
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleNetworkBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleNetworkBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "tvnn";
8 |
9 |
10 | public AppleNetworkBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/ApplePurchaseDateBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class ApplePurchaseDateBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "purd";
8 |
9 |
10 | public ApplePurchaseDateBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleRatingBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * iTunes Rating Box.
6 | */
7 | public final class AppleRatingBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "rtng";
9 |
10 |
11 | public AppleRatingBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getUint8AppleDataBox();
14 | }
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleRecordingYearBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public class AppleRecordingYearBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "\u00a9day";
8 |
9 |
10 | public AppleRecordingYearBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleReferenceMovieBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 castLabs GmbH, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.coremedia.iso.boxes.apple;
18 |
19 | import com.googlecode.mp4parser.AbstractContainerBox;
20 |
21 | public class AppleReferenceMovieBox extends AbstractContainerBox {
22 | public static final String TYPE = "rmra";
23 |
24 | public AppleReferenceMovieBox() {
25 | super(TYPE);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleReferenceMovieDescriptorBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 castLabs GmbH, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.coremedia.iso.boxes.apple;
18 |
19 | import com.googlecode.mp4parser.AbstractContainerBox;
20 |
21 | public class AppleReferenceMovieDescriptorBox extends AbstractContainerBox {
22 | public static final String TYPE = "rmda";
23 |
24 | public AppleReferenceMovieDescriptorBox() {
25 | super(TYPE);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleShowBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleShowBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "tvsh";
8 |
9 |
10 | public AppleShowBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleSortAlbumBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleSortAlbumBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "soal";
8 |
9 |
10 | public AppleSortAlbumBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleStandardGenreBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleStandardGenreBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "gnre";
8 |
9 |
10 | public AppleStandardGenreBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getUint16AppleDataBox();
13 | }
14 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleStoreAccountTypeBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * itunes MetaData comment box.
6 | */
7 | public class AppleStoreAccountTypeBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "akID";
9 |
10 |
11 | public AppleStoreAccountTypeBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getUint8AppleDataBox();
14 | }
15 |
16 | public String getReadableValue() {
17 | byte value = this.appleDataBox.getData()[0];
18 | switch (value) {
19 | case 0:
20 | return "iTunes Account";
21 | case 1:
22 | return "AOL Account";
23 | default:
24 | return "unknown Account";
25 | }
26 |
27 | }
28 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleSynopsisBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleSynopsisBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "ldes";
8 |
9 |
10 | public AppleSynopsisBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTempBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * Beats per minute.
6 | */
7 | public final class AppleTempBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "tmpo";
9 |
10 |
11 | public AppleTempBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getUint16AppleDataBox();
14 | }
15 |
16 |
17 | public int getTempo() {
18 | return appleDataBox.getData()[1];
19 | }
20 |
21 | public void setTempo(int tempo) {
22 | appleDataBox = new AppleDataBox();
23 | appleDataBox.setVersion(0);
24 | appleDataBox.setFlags(21);
25 | appleDataBox.setFourBytes(new byte[4]);
26 | appleDataBox.setData(new byte[]{0, (byte) (tempo & 0xFF)});
27 |
28 | }
29 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackAuthorBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleTrackAuthorBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "\u00a9wrt";
8 |
9 |
10 | public AppleTrackAuthorBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackNumberBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleTrackNumberBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "trkn";
8 |
9 |
10 | public AppleTrackNumberBox() {
11 | super(TYPE);
12 | }
13 |
14 |
15 | /**
16 | * @param track the actual track number
17 | * @param of number of tracks overall
18 | */
19 | public void setTrackNumber(byte track, byte of) {
20 | appleDataBox = new AppleDataBox();
21 | appleDataBox.setVersion(0);
22 | appleDataBox.setFlags(0);
23 | appleDataBox.setFourBytes(new byte[4]);
24 | appleDataBox.setData(new byte[]{0, 0, 0, track, 0, of, 0, 0});
25 | }
26 |
27 | public byte getTrackNumber() {
28 | return appleDataBox.getData()[3];
29 | }
30 |
31 | public byte getNumberOfTracks() {
32 | return appleDataBox.getData()[5];
33 | }
34 |
35 | public void setNumberOfTracks(byte numberOfTracks) {
36 | byte[] content = appleDataBox.getData();
37 | content[5] = numberOfTracks;
38 | appleDataBox.setData(content);
39 | }
40 |
41 | public void setTrackNumber(byte trackNumber) {
42 | byte[] content = appleDataBox.getData();
43 | content[3] = trackNumber;
44 | appleDataBox.setData(content);
45 | }
46 |
47 |
48 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTrackTitleBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | */
6 | public final class AppleTrackTitleBox extends AbstractAppleMetaDataBox {
7 | public static final String TYPE = "\u00a9nam";
8 |
9 |
10 | public AppleTrackTitleBox() {
11 | super(TYPE);
12 | appleDataBox = AppleDataBox.getStringAppleDataBox();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvEpisodeBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * Tv Episode.
6 | */
7 | public class AppleTvEpisodeBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "tves";
9 |
10 |
11 | public AppleTvEpisodeBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getUint32AppleDataBox();
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvEpisodeNumberBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * Tv Episode.
6 | */
7 | public class AppleTvEpisodeNumberBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "tven";
9 |
10 |
11 | public AppleTvEpisodeNumberBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getStringAppleDataBox();
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleTvSeasonBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | /**
4 | * 4cc = "{@value #TYPE}"
5 | * Tv Season.
6 | */
7 | public final class AppleTvSeasonBox extends AbstractAppleMetaDataBox {
8 | public static final String TYPE = "tvsn";
9 |
10 |
11 | public AppleTvSeasonBox() {
12 | super(TYPE);
13 | appleDataBox = AppleDataBox.getUint32AppleDataBox();
14 | }
15 |
16 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/apple/AppleWaveBox.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.AbstractContainerBox;
4 |
5 | /**
6 | * 4cc = "{@value #TYPE}"
7 | * siDecompressionParam Atom ('wave')
8 | * The siDecompressionParam atom provides the ability to store data specific to a given audio decompressor in the
9 | * SoundDescription record. As example, some audio decompression algorithms, such as Microsoft’s ADPCM, require a
10 | * set of out-of-band values to configure the decompressor. These are stored in an atom of this type.
11 | * This atom contains other atoms with audio decompressor settings and is a required extension to the sound sample
12 | * description for MPEG-4 audio. A 'wave' chunk for 'mp4a' typically contains (in order) at least a 'frma' atom, an
13 | * 'mp4a' atom, an 'esds' atom, and a “Terminator Atom (0x00000000)” atom.
14 | * The contents of other siDecompressionParam atoms are dependent on the audio decompressor.
15 | *
16 | * - Size - An unsigned 32-bit integer holding the size of the decompression parameters atom
17 | * - Type - An unsigned 32-bit field containing the four-character code 'wave'
18 | * - Extension atoms - Atoms containing the necessary out-of-band decompression parameters for the sound decompressor.
19 | * For MPEG-4 audio ('mp4a'), this includes elementary stream descriptor ('esds'), format ('frma'), and terminator atoms.
20 | *
21 | * Possible paths: /moov/trak/mdia/minf/stbl/stsd/mp4a/wave/esds or /moov/trak/mdia/minf/stbl/stsd/mp4a/wave/mp4a/esds
22 | *
23 | * @author Paul Gregoire (mondain@gmail.com)
24 | */
25 | public final class AppleWaveBox extends AbstractContainerBox {
26 | public static final String TYPE = "wave";
27 |
28 | public AppleWaveBox() {
29 | super(TYPE);
30 | }
31 |
32 | }
33 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/fragment/MovieExtendsBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 castLabs GmbH, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.coremedia.iso.boxes.fragment;
18 |
19 | import com.googlecode.mp4parser.AbstractContainerBox;
20 |
21 | /**
22 | * 4cc = "{@value #TYPE}"
23 | * aligned(8) class MovieExtendsBox extends Box('mvex'){
24 | * }
25 | */
26 | public class MovieExtendsBox extends AbstractContainerBox {
27 | public static final String TYPE = "mvex";
28 |
29 | public MovieExtendsBox() {
30 | super(TYPE);
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/fragment/MovieFragmentRandomAccessBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 castLabs GmbH, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.coremedia.iso.boxes.fragment;
18 |
19 | import com.googlecode.mp4parser.AbstractContainerBox;
20 |
21 | /**
22 | * 4cc = "{@value #TYPE}"
23 | * aligned(8) class MovieFragmentRandomAccessBox
24 | * extends Box('mfra')
25 | * {
26 | * }
27 | */
28 | public class MovieFragmentRandomAccessBox extends AbstractContainerBox {
29 | public static final String TYPE = "mfra";
30 |
31 | public MovieFragmentRandomAccessBox() {
32 | super(TYPE);
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/fragment/TrackFragmentBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2009 castLabs GmbH, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.coremedia.iso.boxes.fragment;
18 |
19 | import com.coremedia.iso.boxes.Box;
20 | import com.googlecode.mp4parser.AbstractContainerBox;
21 | import com.googlecode.mp4parser.annotations.DoNotParseDetail;
22 |
23 | /**
24 | * 4cc = "{@value #TYPE}"
25 | * aligned(8) class TrackFragmentBox extends Box('traf'){
26 | * }
27 | */
28 | public class TrackFragmentBox extends AbstractContainerBox {
29 | public static final String TYPE = "traf";
30 |
31 | public TrackFragmentBox() {
32 | super(TYPE);
33 | }
34 |
35 | @DoNotParseDetail
36 | public TrackFragmentHeaderBox getTrackFragmentHeaderBox() {
37 | for (Box box : getBoxes()) {
38 | if (box instanceof TrackFragmentHeaderBox) {
39 | return (TrackFragmentHeaderBox) box;
40 | }
41 | }
42 | return null;
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/odf-boxes.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/coremedia/iso/boxes/odf-boxes.zip
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/rtp-boxes.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/coremedia/iso/boxes/rtp-boxes.zip
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/sampleentry/MpegSampleEntry.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.sampleentry;
2 |
3 | import com.coremedia.iso.BoxParser;
4 | import com.coremedia.iso.boxes.Box;
5 | import com.coremedia.iso.boxes.ContainerBox;
6 |
7 | import java.nio.ByteBuffer;
8 | import java.util.Arrays;
9 |
10 | public class MpegSampleEntry extends SampleEntry implements ContainerBox {
11 |
12 | private BoxParser boxParser;
13 |
14 | public MpegSampleEntry(String type) {
15 | super(type);
16 | }
17 |
18 | @Override
19 | public void _parseDetails(ByteBuffer content) {
20 | _parseReservedAndDataReferenceIndex(content);
21 | _parseChildBoxes(content);
22 |
23 | }
24 |
25 | @Override
26 | protected long getContentSize() {
27 | long contentSize = 8;
28 | for (Box boxe : boxes) {
29 | contentSize += boxe.getSize();
30 | }
31 | return contentSize;
32 | }
33 |
34 | public String toString() {
35 | return "MpegSampleEntry" + Arrays.asList(getBoxes());
36 | }
37 |
38 | @Override
39 | protected void getContent(ByteBuffer byteBuffer) {
40 | _writeReservedAndDataReferenceIndex(byteBuffer);
41 | _writeChildBoxes(byteBuffer);
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/coremedia/iso/boxes/sampleentry/Ovc1VisualSampleEntryImpl.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.sampleentry;
2 |
3 | import com.coremedia.iso.IsoTypeWriter;
4 | import com.coremedia.iso.boxes.Box;
5 |
6 | import java.nio.ByteBuffer;
7 |
8 | /**
9 | * 4cc = "{@value #TYPE}"
10 | */
11 | public class Ovc1VisualSampleEntryImpl extends SampleEntry {
12 | private byte[] vc1Content;
13 | public static final String TYPE = "ovc1";
14 |
15 |
16 | @Override
17 | protected long getContentSize() {
18 | long size = 8;
19 |
20 | for (Box box : boxes) {
21 | size += box.getSize();
22 | }
23 | size += vc1Content.length;
24 | return size;
25 | }
26 |
27 | @Override
28 | public void _parseDetails(ByteBuffer content) {
29 | _parseReservedAndDataReferenceIndex(content);
30 | vc1Content = new byte[content.remaining()];
31 | content.get(vc1Content);
32 |
33 | }
34 |
35 | @Override
36 | protected void getContent(ByteBuffer byteBuffer) {
37 | byteBuffer.put(new byte[6]);
38 | IsoTypeWriter.writeUInt16(byteBuffer, getDataReferenceIndex());
39 | byteBuffer.put(vc1Content);
40 | }
41 |
42 |
43 | protected Ovc1VisualSampleEntryImpl() {
44 | super(TYPE);
45 | }
46 |
47 | }
48 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/Version.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStreamReader;
5 | import java.io.LineNumberReader;
6 | import java.util.logging.Logger;
7 |
8 | /**
9 | * The classic version object.
10 | */
11 | public class Version {
12 | private static final Logger LOG = Logger.getLogger(Version.class.getName());
13 | public static final String VERSION;
14 |
15 | static {
16 | LineNumberReader lnr = new LineNumberReader(new InputStreamReader(Version.class.getResourceAsStream("/version.txt")));
17 | String version;
18 | try {
19 | version = lnr.readLine();
20 | } catch (IOException e) {
21 | LOG.warning(e.getMessage());
22 | version = "unknown";
23 | }
24 | VERSION = version;
25 |
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/annotations/DoNotParseDetail.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.annotations;
18 |
19 | import java.lang.annotation.*;
20 |
21 | /**
22 | *
23 | */
24 |
25 | @Target({ElementType.METHOD, ElementType.TYPE})
26 | @Retention(RetentionPolicy.RUNTIME)
27 | @Inherited
28 | @Documented
29 | /**
30 | * Mark a method with this annotation to prevent triggering the call of
31 | * AbstractBox#parseDetails()
before actually executing the
32 | * method.
33 | * @see com.googlecode.mp4parser.RequiresParseDetailAspect
34 | */
35 | public @interface DoNotParseDetail {
36 | }
37 |
38 |
39 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/annotations/ParseDetail.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.annotations;
17 |
18 | import java.lang.annotation.Documented;
19 | import java.lang.annotation.ElementType;
20 | import java.lang.annotation.Inherited;
21 | import java.lang.annotation.Retention;
22 | import java.lang.annotation.RetentionPolicy;
23 | import java.lang.annotation.Target;
24 |
25 |
26 | @Target({ElementType.METHOD, ElementType.TYPE})
27 | @Retention(RetentionPolicy.RUNTIME)
28 | @Inherited
29 | @Documented
30 | public @interface ParseDetail {
31 | }
32 |
33 |
34 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/AbstractTrack.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.authoring;
18 |
19 | /**
20 | *
21 | */
22 | public abstract class AbstractTrack implements Track {
23 | private boolean enabled = true;
24 | private boolean inMovie = true;
25 | private boolean inPreview = true;
26 | private boolean inPoster = true;
27 |
28 | public boolean isEnabled() {
29 | return enabled;
30 | }
31 |
32 | public boolean isInMovie() {
33 | return inMovie;
34 | }
35 |
36 | public boolean isInPreview() {
37 | return inPreview;
38 | }
39 |
40 | public boolean isInPoster() {
41 | return inPoster;
42 | }
43 |
44 | public void setEnabled(boolean enabled) {
45 | this.enabled = enabled;
46 | }
47 |
48 | public void setInMovie(boolean inMovie) {
49 | this.inMovie = inMovie;
50 | }
51 |
52 | public void setInPreview(boolean inPreview) {
53 | this.inPreview = inPreview;
54 | }
55 |
56 | public void setInPoster(boolean inPoster) {
57 | this.inPoster = inPoster;
58 | }
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/DateHelper.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring;
17 |
18 | import java.util.Date;
19 |
20 | /**
21 | * Converts ISO Dates (seconds since 1/1/1904) to Date and vice versa.
22 | */
23 | public class DateHelper {
24 | /**
25 | * Converts a long value with seconds since 1/1/1904 to Date.
26 | *
27 | * @param secondsSince seconds since 1/1/1904
28 | * @return date the corresponding Date
29 | */
30 | static public Date convert(long secondsSince) {
31 | return new Date((secondsSince - 2082844800L) * 1000L);
32 | }
33 |
34 |
35 | /**
36 | * Converts a date as long to a mac date as long
37 | *
38 | * @param date date to convert
39 | * @return date in mac format
40 | */
41 | static public long convert(Date date) {
42 | return (date.getTime() / 1000L) + 2082844800L;
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/Track.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring;
17 |
18 | import com.coremedia.iso.boxes.*;
19 |
20 | import java.nio.ByteBuffer;
21 | import java.util.List;
22 |
23 | /**
24 | * Represents a Track. A track is a timed sequence of related samples.
25 | *
26 | * NOTE:
getDecodingTimeEntries();
35 |
36 | List getCompositionTimeEntries();
37 |
38 | long[] getSyncSamples();
39 |
40 | List getSampleDependencies();
41 |
42 | TrackMetaData getTrackMetaData();
43 |
44 | String getHandler();
45 |
46 | boolean isEnabled();
47 |
48 | boolean isInMovie();
49 |
50 | boolean isInPreview();
51 |
52 | boolean isInPoster();
53 |
54 | List getSamples();
55 |
56 | public Box getMediaHeaderBox();
57 |
58 | public SubSampleInformationBox getSubsampleInformationBox();
59 |
60 | }
61 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/AudioQuality.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.adaptivestreaming;
17 |
18 |
19 | public class AudioQuality {
20 | String fourCC;
21 | long bitrate;
22 | int audioTag;
23 | long samplingRate;
24 | int channels;
25 | int bitPerSample;
26 | int packetSize;
27 | String language;
28 | String codecPrivateData;
29 | }
30 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/ManifestWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.adaptivestreaming;
17 |
18 |
19 | import com.googlecode.mp4parser.authoring.Movie;
20 | import com.googlecode.mp4parser.authoring.Track;
21 |
22 | import java.io.IOException;
23 |
24 | public interface ManifestWriter {
25 | String getManifest(Movie inputs) throws IOException;
26 |
27 | long getBitrate(Track track);
28 |
29 | long[] calculateFragmentDurations(Track track, Movie movie);
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/PackageWriter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.adaptivestreaming;
17 |
18 | import com.googlecode.mp4parser.authoring.Movie;
19 |
20 | import java.io.IOException;
21 |
22 | /**
23 | * Writes the whole package.
24 | */
25 | public interface PackageWriter {
26 | public void write(Movie qualities) throws IOException;
27 | }
28 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/adaptivestreaming/VideoQuality.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.adaptivestreaming;
17 |
18 | class VideoQuality {
19 | long bitrate;
20 | String fourCC;
21 | int width;
22 | int height;
23 | String codecPrivateData;
24 | int nalLength;
25 | }
26 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/builder/FragmentIntersectionFinder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.builder;
17 |
18 | import com.googlecode.mp4parser.authoring.Movie;
19 | import com.googlecode.mp4parser.authoring.Track;
20 |
21 | /**
22 | *
23 | */
24 | public interface FragmentIntersectionFinder {
25 | /**
26 | * Gets the ordinal number of the samples which will be the first sample
27 | * in each fragment.
28 | *
29 | * @param track concerned track
30 | * @param movie the context of the track
31 | * @return an array containing the ordinal of each fragment's first sample
32 | */
33 | public long[] sampleNumbers(Track track, Movie movie);
34 | }
35 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/authoring/builder/Mp4Builder.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.authoring.builder;
17 |
18 | import com.coremedia.iso.IsoFile;
19 | import com.googlecode.mp4parser.authoring.Movie;
20 |
21 | /**
22 | * Transforms a Movie
object to an IsoFile. Implementations can
23 | * determine the specific format: Fragmented MP4, MP4, MP4 with Apple Metadata,
24 | * MP4 with 3GPP Metadata, MOV.
25 | */
26 | public interface Mp4Builder {
27 | /**
28 | * Builds the actual IsoFile from the Movie.
29 | *
30 | * @param movie data source
31 | * @return the freshly built IsoFile
32 | */
33 | public IsoFile build(Movie movie);
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/adobe/ActionMessageFormat0SampleEntryBox.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.adobe;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 | import com.coremedia.iso.boxes.sampleentry.SampleEntry;
5 |
6 | import java.nio.ByteBuffer;
7 |
8 | /**
9 | * 4cc = "{@value #TYPE}"
10 | * Sample Entry as used for Action Message Format tracks.
11 | */
12 | public class ActionMessageFormat0SampleEntryBox extends SampleEntry {
13 | public static final String TYPE = "amf0";
14 |
15 | public ActionMessageFormat0SampleEntryBox() {
16 | super(TYPE);
17 | }
18 |
19 | @Override
20 | protected long getContentSize() {
21 | long size = 8;
22 | for (Box box : boxes) {
23 | size += box.getSize();
24 | }
25 |
26 | return size;
27 | }
28 |
29 |
30 | @Override
31 | public void _parseDetails(ByteBuffer content) {
32 | _parseReservedAndDataReferenceIndex(content);
33 | _parseChildBoxes(content);
34 | }
35 |
36 | @Override
37 | protected void getContent(ByteBuffer byteBuffer) {
38 | _writeReservedAndDataReferenceIndex(byteBuffer);
39 | _writeChildBoxes(byteBuffer);
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/CleanApertureAtom.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.coremedia.iso.IsoTypeReader;
4 | import com.coremedia.iso.IsoTypeWriter;
5 | import com.googlecode.mp4parser.AbstractFullBox;
6 |
7 | import java.nio.ByteBuffer;
8 |
9 | /**
10 | * 4cc = "{@value #TYPE}"
11 | * A container atom that stores information for video correction in the form of three required atoms.
12 | * This atom is optionally included in the track atom. The type of the track aperture mode dimensions
13 | * atom is 'tapt'.
14 | */
15 | public class CleanApertureAtom extends AbstractFullBox {
16 | public static final String TYPE = "clef";
17 |
18 | double width;
19 | double height;
20 |
21 | public CleanApertureAtom() {
22 | super(TYPE);
23 | }
24 |
25 |
26 | @Override
27 | protected long getContentSize() {
28 | return 12;
29 | }
30 |
31 | @Override
32 | protected void getContent(ByteBuffer byteBuffer) {
33 | writeVersionAndFlags(byteBuffer);
34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width);
35 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height);
36 | }
37 |
38 | @Override
39 | protected void _parseDetails(ByteBuffer content) {
40 | parseVersionAndFlags(content);
41 | width = IsoTypeReader.readFixedPoint1616(content);
42 | height = IsoTypeReader.readFixedPoint1616(content);
43 | }
44 |
45 | public double getWidth() {
46 | return width;
47 | }
48 |
49 | public void setWidth(double width) {
50 | this.width = width;
51 | }
52 |
53 | public double getHeight() {
54 | return height;
55 | }
56 |
57 | public void setHeight(double height) {
58 | this.height = height;
59 | }
60 | }
61 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/GenericMediaHeaderAtom.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.boxes.apple;
17 |
18 | import com.googlecode.mp4parser.AbstractContainerBox;
19 |
20 | /**
21 | * 4cc = "{@value #TYPE}"
22 | */
23 | public class GenericMediaHeaderAtom extends AbstractContainerBox {
24 |
25 | public static final String TYPE = "gmhd";
26 |
27 | public GenericMediaHeaderAtom() {
28 | super(TYPE);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TimeCodeBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.boxes.apple;
17 |
18 | import com.coremedia.iso.boxes.Box;
19 | import com.coremedia.iso.boxes.sampleentry.SampleEntry;
20 |
21 | import java.nio.ByteBuffer;
22 |
23 | /**
24 | * 4cc = "{@value #TYPE}"
25 | */
26 | public class TimeCodeBox extends SampleEntry {
27 | public static final String TYPE = "tmcd";
28 |
29 | byte[] data;
30 |
31 |
32 | public TimeCodeBox() {
33 | super(TYPE);
34 | }
35 |
36 | @Override
37 | protected long getContentSize() {
38 | long size = 26;
39 | for (Box box : boxes) {
40 | size += box.getSize();
41 | }
42 | return size;
43 | }
44 |
45 | @Override
46 | public void _parseDetails(ByteBuffer content) {
47 | _parseReservedAndDataReferenceIndex(content);
48 | data = new byte[18];
49 | content.get(data);
50 | _parseChildBoxes(content);
51 | }
52 |
53 | @Override
54 | protected void getContent(ByteBuffer byteBuffer) {
55 | _writeReservedAndDataReferenceIndex(byteBuffer);
56 | byteBuffer.put(data);
57 | _writeChildBoxes(byteBuffer);
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackApertureModeDimensionAtom.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.AbstractContainerBox;
4 |
5 | /**
6 | * 4cc = "{@value #TYPE}"
7 | * Don't know what it is but it is obviously a container box.
8 | */
9 | public class TrackApertureModeDimensionAtom extends AbstractContainerBox {
10 | public static final String TYPE = "tapt";
11 |
12 | public TrackApertureModeDimensionAtom() {
13 | super(TYPE);
14 | }
15 |
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackEncodedPixelsDimensionsAtom.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.coremedia.iso.IsoTypeReader;
4 | import com.coremedia.iso.IsoTypeWriter;
5 | import com.googlecode.mp4parser.AbstractFullBox;
6 |
7 | import java.nio.ByteBuffer;
8 |
9 | /**
10 | * 4cc = "{@value #TYPE}"
11 | * This atom carries the pixel dimensions of the track’s encoded pixels.
12 | * The type of the track encoded pixels dimensions atom is 'enof'.
13 | */
14 | public class TrackEncodedPixelsDimensionsAtom extends AbstractFullBox {
15 | public static final String TYPE = "enof";
16 |
17 | double width;
18 | double height;
19 |
20 | public TrackEncodedPixelsDimensionsAtom() {
21 | super(TYPE);
22 | }
23 |
24 |
25 | @Override
26 | protected long getContentSize() {
27 | return 12;
28 | }
29 |
30 | @Override
31 | protected void getContent(ByteBuffer byteBuffer) {
32 | writeVersionAndFlags(byteBuffer);
33 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width);
34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height);
35 | }
36 |
37 | @Override
38 | protected void _parseDetails(ByteBuffer content) {
39 | parseVersionAndFlags(content);
40 | width = IsoTypeReader.readFixedPoint1616(content);
41 | height = IsoTypeReader.readFixedPoint1616(content);
42 | }
43 |
44 | public double getWidth() {
45 | return width;
46 | }
47 |
48 | public void setWidth(double width) {
49 | this.width = width;
50 | }
51 |
52 | public double getHeight() {
53 | return height;
54 | }
55 |
56 | public void setHeight(double height) {
57 | this.height = height;
58 | }
59 | }
60 |
61 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/apple/TrackProductionApertureDimensionsAtom.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.coremedia.iso.IsoTypeReader;
4 | import com.coremedia.iso.IsoTypeWriter;
5 | import com.googlecode.mp4parser.AbstractFullBox;
6 |
7 | import java.nio.ByteBuffer;
8 |
9 | /**
10 | * 4cc = "{@value #TYPE}"
11 | * This atom carries the pixel dimensions of the track’s production aperture. The type of
12 | * the track production aperture dimensions atom is 'prof'.
13 | */
14 | public class TrackProductionApertureDimensionsAtom extends AbstractFullBox {
15 | public static final String TYPE = "prof";
16 |
17 | double width;
18 | double height;
19 |
20 | public TrackProductionApertureDimensionsAtom() {
21 | super(TYPE);
22 | }
23 |
24 |
25 | @Override
26 | protected long getContentSize() {
27 | return 12;
28 | }
29 |
30 | @Override
31 | protected void getContent(ByteBuffer byteBuffer) {
32 | writeVersionAndFlags(byteBuffer);
33 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, width);
34 | IsoTypeWriter.writeFixedPoint1616(byteBuffer, height);
35 | }
36 |
37 | @Override
38 | protected void _parseDetails(ByteBuffer content) {
39 | parseVersionAndFlags(content);
40 | width = IsoTypeReader.readFixedPoint1616(content);
41 | height = IsoTypeReader.readFixedPoint1616(content);
42 | }
43 |
44 | public double getWidth() {
45 | return width;
46 | }
47 |
48 | public void setWidth(double width) {
49 | this.width = width;
50 | }
51 |
52 | public double getHeight() {
53 | return height;
54 | }
55 |
56 | public void setHeight(double height) {
57 | this.height = height;
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/basemediaformat/SampleEncryptionBox.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.basemediaformat;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBox;
4 |
5 | /**
6 | * 4cc = "{@value #TYPE}"
7 | * aligned(8) class AbstractSampleEncryptionBox extends FullBox(‘uuid’, extended_type= 0xA2394F52-5A9B-4f14-A244-6C427C648DF4, version=0, flags=0)
8 | * {
9 | *
10 | * unsigned int (32) sample_count;
11 | * {
12 | * unsigned int(16) InitializationVector;
13 | * }[ sample_count ]
14 | * }
15 | */
16 | public class SampleEncryptionBox extends AbstractSampleEncryptionBox {
17 | public static final String TYPE = "senc";
18 |
19 | /**
20 | * Creates a SampleEncryptionBox for non-h264 tracks.
21 | */
22 | public SampleEncryptionBox() {
23 | super(TYPE);
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/basemediaformat/TrackEncryptionBox.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.basemediaformat;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBox;
4 |
5 | /**
6 | * 4cc = "{@value #TYPE}"
7 | */
8 | public class TrackEncryptionBox extends AbstractTrackEncryptionBox {
9 | public static final String TYPE = "tenc";
10 |
11 | public TrackEncryptionBox() {
12 | super(TYPE);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4-boxes.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4-boxes.zip
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/ESDescriptorBox.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 castLabs, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.boxes.mp4;
18 |
19 | import com.googlecode.mp4parser.boxes.mp4.objectdescriptors.ESDescriptor;
20 |
21 | /**
22 | * 4cc = "{@value #TYPE}"
23 | * ES Descriptor Box.
24 | */
25 | public class ESDescriptorBox extends AbstractDescriptorBox {
26 | public static final String TYPE = "esds";
27 |
28 | public ESDescriptorBox() {
29 | super(TYPE);
30 | }
31 |
32 | public ESDescriptor getEsDescriptor() {
33 | return (ESDescriptor) super.getDescriptor();
34 | }
35 |
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/BitReaderBuffer.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
2 |
3 | import java.nio.ByteBuffer;
4 |
5 | public class BitReaderBuffer {
6 |
7 | private ByteBuffer buffer;
8 | int initialPos;
9 | int position;
10 |
11 | public BitReaderBuffer(ByteBuffer buffer) {
12 | this.buffer = buffer;
13 | initialPos = buffer.position();
14 | }
15 |
16 | public int readBits(int i) {
17 | byte b = buffer.get(initialPos + position / 8);
18 | int v = b < 0 ? b + 256 : b;
19 | int left = 8 - position % 8;
20 | int rc;
21 | if (i <= left) {
22 | rc = (v << (position % 8) & 0xFF) >> ((position % 8) + (left - i));
23 | position += i;
24 | } else {
25 | int now = left;
26 | int then = i - left;
27 | rc = readBits(now);
28 | rc = rc << then;
29 | rc += readBits(then);
30 | }
31 | buffer.position(initialPos + (int) Math.ceil((double) position / 8));
32 | return rc;
33 | }
34 |
35 | public int getPosition() {
36 | return position;
37 | }
38 |
39 | public int byteSync() {
40 | int left = 8 - position % 8;
41 | if (left == 8) {
42 | left = 0;
43 | }
44 | readBits(left);
45 | return left;
46 | }
47 |
48 | public int remainingBits() {
49 | return buffer.limit() * 8 - position;
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/BitWriterBuffer.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
2 |
3 | import java.nio.ByteBuffer;
4 |
5 | public class BitWriterBuffer {
6 |
7 | private ByteBuffer buffer;
8 | int initialPos;
9 | int position = 0;
10 |
11 | public BitWriterBuffer(ByteBuffer buffer) {
12 | this.buffer = buffer;
13 | this.initialPos = buffer.position();
14 | }
15 |
16 | public void writeBits(int i, int numBits) {
17 | assert i <= ((1 << numBits)-1): String.format("Trying to write a value bigger (%s) than the number bits (%s) allows. " +
18 | "Please mask the value before writing it and make your code is really working as intended.", i, (1< 127 ? current - 256 : current));
26 | position += numBits;
27 | } else {
28 | int bitsSecondWrite = numBits - left;
29 | writeBits(i >> bitsSecondWrite, left);
30 | writeBits(i & (1 << bitsSecondWrite) - 1, bitsSecondWrite);
31 | }
32 | buffer.position(initialPos + position / 8 + ((position % 8 > 0) ? 1 : 0));
33 | }
34 |
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/Descriptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 castLabs, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
18 |
19 | import java.lang.annotation.*;
20 |
21 | /**
22 | * 4cc = "{@value #TYPE}"
23 | * Created by IntelliJ IDEA.
24 | * User: mstattma
25 | * Date: 06.08.2010
26 | * Time: 06:54:58
27 | * To change this template use File | Settings | File Templates.
28 | */
29 | @Documented
30 | @Target(ElementType.TYPE)
31 | @Retention(RetentionPolicy.RUNTIME)
32 | public @interface Descriptor {
33 | int[] tags();
34 |
35 | int objectTypeIndication() default -1;
36 | }
37 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/ObjectDescriptorBase.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 castLabs, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
18 |
19 | /*
20 | abstract class ObjectDescriptorBase extends BaseDescriptor : bit(8)
21 | tag=[ObjectDescrTag..InitialObjectDescrTag] {
22 | // empty. To be filled by classes extending this class.
23 | }
24 | */
25 | @Descriptor(tags = 0x00)
26 | public abstract class ObjectDescriptorBase extends BaseDescriptor {
27 | }
28 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/objectdescriptors/UnknownDescriptor.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2011 castLabs, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.boxes.mp4.objectdescriptors;
18 |
19 | import java.io.IOException;
20 | import java.nio.ByteBuffer;
21 | import java.util.logging.Logger;
22 |
23 | public class UnknownDescriptor extends BaseDescriptor {
24 | private ByteBuffer data;
25 | private static Logger log = Logger.getLogger(UnknownDescriptor.class.getName());
26 |
27 | @Override
28 | public void parseDetail(ByteBuffer bb) throws IOException {
29 | data = (ByteBuffer) bb.slice().limit(this.getSizeOfInstance());
30 | }
31 |
32 | @Override
33 | public String toString() {
34 | final StringBuilder sb = new StringBuilder();
35 | sb.append("UnknownDescriptor");
36 | sb.append("{tag=").append(tag);
37 | sb.append(", sizeOfInstance=").append(sizeOfInstance);
38 | sb.append(", data=").append(data);
39 | sb.append('}');
40 | return sb.toString();
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/mp4/samplegrouping/GroupEntry.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 castLabs, Berlin
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package com.googlecode.mp4parser.boxes.mp4.samplegrouping;
18 |
19 | import java.nio.ByteBuffer;
20 |
21 | public abstract class GroupEntry {
22 | public abstract void parse(ByteBuffer byteBuffer);
23 | public abstract ByteBuffer get();
24 |
25 | public int size() {
26 | return get().limit();
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/piff/PiffSampleEncryptionBox.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.piff;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBox;
4 |
5 | /**
6 | *
7 | * aligned(8) class SampleEncryptionBox extends FullBox(‘uuid’, extended_type= 0xA2394F52-5A9B-4f14-A244-6C427C648DF4, version=0, flags=0)
8 | * {
9 | * if (flags & 0x000001)
10 | * {
11 | * unsigned int(24) AlgorithmID;
12 | * unsigned int(8) IV_size;
13 | * unsigned int(8)[16] KID;
14 | * }
15 | * unsigned int (32) sample_count;
16 | * {
17 | * unsigned int(IV_size) InitializationVector;
18 | * if (flags & 0x000002)
19 | * {
20 | * unsigned int(16) NumberOfEntries;
21 | * {
22 | * unsigned int(16) BytesOfClearData;
23 | * unsigned int(32) BytesOfEncryptedData;
24 | * } [ NumberOfEntries]
25 | * }
26 | * }[ sample_count ]
27 | * }
28 | *
29 | */
30 | public class PiffSampleEncryptionBox extends AbstractSampleEncryptionBox {
31 |
32 | /**
33 | * Creates a AbstractSampleEncryptionBox for non-h264 tracks.
34 | */
35 | public PiffSampleEncryptionBox() {
36 | super("uuid");
37 |
38 | }
39 |
40 | @Override
41 | public byte[] getUserType() {
42 | return new byte[]{(byte) 0xA2, 0x39, 0x4F, 0x52, 0x5A, (byte) 0x9B, 0x4f, 0x14, (byte) 0xA2, 0x44, 0x6C, 0x42, 0x7C, 0x64, (byte) 0x8D, (byte) 0xF4};
43 | }
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/boxes/piff/PiffTrackEncryptionBox.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.piff;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBox;
4 |
5 | /**
6 | * aligned(8) class TrackEncryptionBox extends FullBox(‘uuid’,
7 | * extended_type=0x8974dbce-7be7-4c51-84f9-7148f9882554, version=0,
8 | * flags=0)
9 | * {
10 | * unsigned int(24) default_AlgorithmID;
11 | * unsigned int(8) default_IV_size;
12 | * unsigned int(8)[16] default_KID;
13 | * }
14 | */
15 | public class PiffTrackEncryptionBox extends AbstractTrackEncryptionBox {
16 |
17 |
18 | public PiffTrackEncryptionBox() {
19 | super("uuid");
20 | }
21 |
22 | @Override
23 | public byte[] getUserType() {
24 | return new byte[]{(byte) 0x89, 0x74, (byte) 0xdb, (byte) 0xce, 0x7b, (byte) 0xe7, 0x4c, 0x51,
25 | (byte) 0x84, (byte) 0xf9, 0x71, 0x48, (byte) 0xf9, (byte) 0x88, 0x25, 0x54};
26 | }
27 |
28 | @Override
29 | public int getFlags() {
30 | return 0;
31 | }
32 |
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/h264/model/AspectRatio.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011 Stanislav Vitvitskiy
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
5 | software and associated documentation files (the "Software"), to deal in the Software
6 | without restriction, including without limitation the rights to use, copy, modify,
7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to the following
9 | conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or
12 | substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19 | OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 | package com.googlecode.mp4parser.h264.model;
22 |
23 | /**
24 | * Aspect ratio
25 | *
26 | * dynamic enum
27 | *
28 | * @author Stanislav Vitvitskiy
29 | */
30 | public class AspectRatio {
31 |
32 | public static final AspectRatio Extended_SAR = new AspectRatio(255);
33 |
34 | private int value;
35 |
36 | private AspectRatio(int value) {
37 | this.value = value;
38 | }
39 |
40 | public static AspectRatio fromValue(int value) {
41 | if (value == Extended_SAR.value) {
42 | return Extended_SAR;
43 | }
44 | return new AspectRatio(value);
45 | }
46 |
47 | public int getValue() {
48 | return value;
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/h264/model/BitstreamElement.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011 Stanislav Vitvitskiy
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
5 | software and associated documentation files (the "Software"), to deal in the Software
6 | without restriction, including without limitation the rights to use, copy, modify,
7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to the following
9 | conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or
12 | substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19 | OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 | package com.googlecode.mp4parser.h264.model;
22 |
23 | import java.io.IOException;
24 | import java.io.OutputStream;
25 |
26 | public abstract class BitstreamElement {
27 |
28 | public abstract void write(OutputStream out) throws IOException;
29 | }
30 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/h264/model/ScalingMatrix.java:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2011 Stanislav Vitvitskiy
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this
5 | software and associated documentation files (the "Software"), to deal in the Software
6 | without restriction, including without limitation the rights to use, copy, modify,
7 | merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to the following
9 | conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or
12 | substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
15 | INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
16 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
17 | FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
18 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
19 | OR OTHER DEALINGS IN THE SOFTWARE.
20 | */
21 | package com.googlecode.mp4parser.h264.model;
22 |
23 | import java.util.Arrays;
24 |
25 | public class ScalingMatrix {
26 |
27 | public ScalingList[] ScalingList4x4;
28 | public ScalingList[] ScalingList8x8;
29 |
30 | @Override
31 | public String toString() {
32 | return "ScalingMatrix{" +
33 | "ScalingList4x4=" + (ScalingList4x4 == null ? null : Arrays.asList(ScalingList4x4)) + "\n" +
34 | ", ScalingList8x8=" + (ScalingList8x8 == null ? null : Arrays.asList(ScalingList8x8)) + "\n" +
35 | '}';
36 | }
37 | }
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/AndroidLogger.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.util;
2 |
3 | import android.util.Log;
4 |
5 | /**
6 | * Logs on Android.
7 | */
8 | public class AndroidLogger extends Logger {
9 | String name;
10 | private static final String TAG = "isoparser";
11 |
12 | public AndroidLogger(String name) {
13 | this.name = name;
14 | }
15 |
16 | @Override
17 | public void logDebug(String message) {
18 | Log.d(TAG, name + ":" + message);
19 | }
20 |
21 | @Override
22 | public void logWarn(String message) {
23 | Log.w(TAG, name + ":" + message);
24 | }
25 |
26 | @Override
27 | public void logError(String message) {
28 | Log.e(TAG, name + ":" + message);
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/CastUtils.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.util;
17 |
18 |
19 | public class CastUtils {
20 | /**
21 | * Casts a long to an int. In many cases I use a long for a UInt32 but this cannot be used to allocate
22 | * ByteBuffers or arrays since they restricted to Integer.MAX_VALUE
this cast-method will throw
23 | * a RuntimeException if the cast would cause a loss of information.
24 | *
25 | * @param l the long value
26 | * @return the long value as int
27 | */
28 | public static int l2i(long l) {
29 | if (l > Integer.MAX_VALUE || l < Integer.MIN_VALUE) {
30 | throw new RuntimeException("A cast to int has gone wrong. Please contact the mp4parser discussion group (" + l + ")");
31 | }
32 | return (int) l;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/JuliLogger.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.util;
2 |
3 | import java.util.logging.Level;
4 |
5 | public class JuliLogger extends Logger {
6 | java.util.logging.Logger logger;
7 |
8 | public JuliLogger(String name) {
9 | logger = java.util.logging.Logger.getLogger(name);
10 | }
11 |
12 | @Override
13 | public void logDebug(String message) {
14 | logger.log(Level.FINE, message);
15 | }
16 |
17 | @Override
18 | public void logWarn(String message) {
19 | logger.log(Level.WARNING, message);
20 | }
21 |
22 | @Override
23 | public void logError(String message) {
24 | logger.log(Level.SEVERE, message);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/Logger.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.util;
2 |
3 | public abstract class Logger {
4 |
5 | public static Logger getLogger(Class clz) {
6 |
7 | if (System.getProperty("java.vm.name").equalsIgnoreCase("Dalvik")) {
8 | return new AndroidLogger(clz.getSimpleName());
9 | } else {
10 | return new JuliLogger(clz.getSimpleName());
11 | }
12 | }
13 |
14 | public abstract void logDebug(String message);
15 |
16 | public abstract void logWarn(String message);
17 |
18 | public abstract void logError(String message);
19 | }
20 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/Math.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.util;
2 |
3 | public class Math {
4 | public static long gcd(long a, long b) {
5 | while (b > 0) {
6 | long temp = b;
7 | b = a % b; // % is remainder
8 | a = temp;
9 | }
10 | return a;
11 | }
12 |
13 | public static int gcd(int a, int b) {
14 | while (b > 0) {
15 | int temp = b;
16 | b = a % b; // % is remainder
17 | a = temp;
18 | }
19 | return a;
20 | }
21 |
22 | public static long lcm(long a, long b) {
23 | return a * (b / gcd(a, b));
24 | }
25 |
26 | public static int lcm(int a, int b) {
27 | return a * (b / gcd(a, b));
28 | }
29 |
30 | }
31 |
--------------------------------------------------------------------------------
/isoparser/src/main/java/com/googlecode/mp4parser/util/UUIDConverter.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2012 Sebastian Annies, Hamburg
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the License);
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an AS IS BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.googlecode.mp4parser.util;
17 |
18 | import java.nio.ByteBuffer;
19 | import java.nio.ByteOrder;
20 | import java.util.UUID;
21 |
22 | /**
23 | * UUID from/to byte array.
24 | */
25 | public class UUIDConverter {
26 | public static byte[] convert(UUID uuid) {
27 |
28 | long msb = uuid.getMostSignificantBits();
29 | long lsb = uuid.getLeastSignificantBits();
30 | byte[] buffer = new byte[16];
31 |
32 | for (int i = 0; i < 8; i++) {
33 | buffer[i] = (byte) (msb >>> 8 * (7 - i));
34 | }
35 | for (int i = 8; i < 16; i++) {
36 | buffer[i] = (byte) (lsb >>> 8 * (7 - i));
37 | }
38 |
39 | return buffer;
40 |
41 | }
42 |
43 | public static UUID convert(byte[] uuidBytes) {
44 | ByteBuffer b = ByteBuffer.wrap(uuidBytes);
45 | b.order(ByteOrder.BIG_ENDIAN);
46 | return new UUID(b.getLong(), b.getLong());
47 | }
48 | }
49 |
--------------------------------------------------------------------------------
/isoparser/src/main/resources/NOTICE.txt:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to the section 4 d of ==
3 | == the Apache License, Version 2.0, ==
4 | == in this case for the Apache Maven distribution. ==
5 | =========================================================================
6 |
7 | This product includes software developed by
8 | CoreMedia AG (http://www.coremedia.com/).
9 |
10 | This product includes software developed by
11 | castLabs GmbH (http://www.castlabs.com/).
12 |
13 | This product includes software developed by
14 | Sebastian Annies (Sebastian.Annies@gmail.com)
15 |
16 | This product includes software (Hex Encoder extracted from commons-codec) developed by
17 | The Apache Software Foundation (http://www.apache.org/).
18 |
19 | This product includes software (package com.googlecode.mp4parser.h264) developed by
20 | Stanislav Vitvitskiy and originally licensed under MIT license (http://www.opensource.org/licenses/mit-license.php)
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/isoparser/src/main/resources/version.txt:
--------------------------------------------------------------------------------
1 | ${project.artifactId}-${project.version}
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/IsoFileTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso;
2 |
3 | import junit.framework.TestCase;
4 |
5 | /**
6 | *
7 | */
8 | public class IsoFileTest extends TestCase {
9 | public void testFourCC() {
10 | assertEquals("AA\0\0", IsoFile.bytesToFourCC(new byte[]{65, 65}));
11 | assertEquals("AAAA", IsoFile.bytesToFourCC(new byte[]{65, 65, 65, 65, 65, 65}));
12 | assertEquals("AAAA", new String(IsoFile.fourCCtoBytes("AAAAAAA")));
13 | assertEquals("AA\0\0", new String(IsoFile.fourCCtoBytes("AA")));
14 | assertEquals("\0\0\0\0", new String(IsoFile.fourCCtoBytes(null)));
15 | assertEquals("\0\0\0\0", new String(IsoFile.fourCCtoBytes("")));
16 | assertEquals("\0\0\0\0", IsoFile.bytesToFourCC(null));
17 | assertEquals("\0\0\0\0", IsoFile.bytesToFourCC(new byte[0]));
18 |
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/PropertyBoxParserImplTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class PropertyBoxParserImplTest {
7 |
8 |
9 | @Test
10 | public void test_isoparser_custom_properties() {
11 | PropertyBoxParserImpl bp = new PropertyBoxParserImpl();
12 | Assert.assertEquals("b", bp.mapping.get("a"));
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/EditListBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Arrays;
6 | import java.util.Map;
7 |
8 | /**
9 | * Created with IntelliJ IDEA.
10 | * User: sannies
11 | * Date: 11/18/12
12 | * Time: 10:42 PM
13 | * To change this template use File | Settings | File Templates.
14 | */
15 | public class EditListBoxTest extends BoxWriteReadBase {
16 | @Override
17 | public Class getBoxUnderTest() {
18 | return EditListBox.class;
19 | }
20 |
21 | @Override
22 | public void setupProperties(Map addPropsHere, EditListBox box) {
23 | addPropsHere.put("entries", Arrays.asList(new EditListBox.Entry(box, 12423, 0, 1), new EditListBox.Entry(box, 12423, 0, 0.5)));
24 |
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/MovieHeaderBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 |
8 | public class MovieHeaderBoxTest extends BoxWriteReadBase {
9 | @Override
10 | public Class getBoxUnderTest() {
11 | return MovieHeaderBox.class;
12 | }
13 |
14 | @Override
15 | public void setupProperties(Map addPropsHere, MovieHeaderBox box) {
16 | addPropsHere.put("creationTime", (long) 3453453345l);
17 | addPropsHere.put("currentTime", (int) 2342);
18 | addPropsHere.put("duration", (long) 243423);
19 | addPropsHere.put("matrix", (long[]) new long[]{1, 2, 3, 4, 5, 6, 7, 8, 9});
20 | addPropsHere.put("modificationTime", (long) 423);
21 | addPropsHere.put("nextTrackId", (long) 5543);
22 | addPropsHere.put("posterTime", (int) 5433);
23 | addPropsHere.put("previewDuration", (int) 5343);
24 | addPropsHere.put("previewTime", (int) 666);
25 | addPropsHere.put("rate", (double) 1);
26 | addPropsHere.put("selectionDuration", (int) 32);
27 | addPropsHere.put("selectionTime", (int) 4456);
28 | addPropsHere.put("timescale", (long) 7565);
29 | addPropsHere.put("volume", (float) 1.0);
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/SampleDependencyTypeBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes;
2 |
3 | import com.googlecode.mp4parser.util.ByteBufferByteChannel;
4 | import junit.framework.Assert;
5 | import org.junit.Test;
6 |
7 | import java.io.ByteArrayOutputStream;
8 | import java.nio.ByteBuffer;
9 | import java.nio.channels.Channels;
10 | import java.util.LinkedList;
11 | import java.util.List;
12 |
13 | /**
14 | *
15 | */
16 | public class SampleDependencyTypeBoxTest {
17 |
18 | @Test
19 | public void testParse() throws Exception {
20 | SampleDependencyTypeBox stsc = new SampleDependencyTypeBox();
21 | List l = new LinkedList();
22 | for (int i = 0; i < 0xcf; i++) {
23 | SampleDependencyTypeBox.Entry e = new SampleDependencyTypeBox.Entry(i);
24 | l.add(e);
25 | }
26 | stsc.setEntries(l);
27 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
28 | stsc.getBox(Channels.newChannel(baos));
29 | byte[] content = baos.toByteArray();
30 |
31 | SampleDependencyTypeBox stsc2 = new SampleDependencyTypeBox();
32 | stsc2.parse(new ByteBufferByteChannel(ByteBuffer.wrap(content, 8, content.length - 8)), null, content.length - 8, null);
33 | Assert.assertEquals(content.length, stsc2.getSize());
34 |
35 |
36 | }
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/SampleToChunkBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes;
2 |
3 | import com.googlecode.mp4parser.util.ByteBufferByteChannel;
4 | import junit.framework.Assert;
5 | import junit.framework.TestCase;
6 |
7 | import java.io.ByteArrayOutputStream;
8 | import java.nio.ByteBuffer;
9 | import java.nio.channels.Channels;
10 | import java.util.LinkedList;
11 | import java.util.List;
12 |
13 | /**
14 | * Created by IntelliJ IDEA.
15 | * User: sannies
16 | * Date: 24.02.11
17 | * Time: 12:41
18 | * To change this template use File | Settings | File Templates.
19 | */
20 | public class SampleToChunkBoxTest extends TestCase {
21 |
22 |
23 | public void testParse() throws Exception {
24 | SampleToChunkBox stsc = new SampleToChunkBox();
25 | List l = new LinkedList();
26 | for (int i = 0; i < 5; i++) {
27 | SampleToChunkBox.Entry e = new SampleToChunkBox.Entry(i, 1, i * i);
28 | l.add(e);
29 | }
30 | stsc.setEntries(l);
31 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
32 | stsc.getBox(Channels.newChannel(baos));
33 | byte[] content = baos.toByteArray();
34 |
35 | SampleToChunkBox stsc2 = new SampleToChunkBox();
36 | stsc2.parse(new ByteBufferByteChannel(ByteBuffer.wrap(content, 8, content.length - 8)), null, content.length - 8, null);
37 | Assert.assertEquals(content.length, stsc2.getSize());
38 |
39 |
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/XmlBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes;
2 |
3 | import com.coremedia.iso.IsoFile;
4 | import com.coremedia.iso.PropertyBoxParserImpl;
5 | import com.googlecode.mp4parser.util.ByteBufferByteChannel;
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 |
9 | import java.io.ByteArrayOutputStream;
10 | import java.io.IOException;
11 | import java.nio.ByteBuffer;
12 | import java.nio.channels.Channels;
13 | import java.util.Properties;
14 |
15 | /**
16 | *
17 | */
18 | public class XmlBoxTest {
19 |
20 | @Test
21 | public void simpleRoundTrip() throws IOException {
22 | XmlBox xmlBox = new XmlBox();
23 | xmlBox.setXml(""); // but the box doesnt care if well-formed
24 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
25 | xmlBox.getBox(Channels.newChannel(baos));
26 |
27 | Properties props = new Properties();
28 | props.put("xml ", XmlBox.class.getName());
29 | PropertyBoxParserImpl parser = new PropertyBoxParserImpl(props);
30 | IsoFile isoFile = new IsoFile(new ByteBufferByteChannel((ByteBuffer) ByteBuffer.wrap(baos.toByteArray()).rewind()), parser);
31 |
32 | Assert.assertTrue(!isoFile.getBoxes().isEmpty());
33 | XmlBox xmlBox2 = (XmlBox) isoFile.getBoxes().get(0);
34 | Assert.assertEquals(xmlBox.getXml(), xmlBox2.getXml());
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/apple/AbstractAppleMetaDataBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.apple;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | import java.io.ByteArrayOutputStream;
7 | import java.io.IOException;
8 | import java.nio.channels.Channels;
9 |
10 | public class AbstractAppleMetaDataBoxTest {
11 | @Test
12 | public void testSetValue_9() throws IOException {
13 | class MyConcreteAppleMetaDataBox extends AbstractAppleMetaDataBox {
14 |
15 | public MyConcreteAppleMetaDataBox() {
16 | super("test");
17 | this.appleDataBox = new AppleDataBox();
18 | this.appleDataBox.setFlags(21);
19 | this.appleDataBox.setData(new byte[4]);
20 | }
21 |
22 | }
23 |
24 | MyConcreteAppleMetaDataBox myConcreteAppleMetaDataBox = new MyConcreteAppleMetaDataBox();
25 | myConcreteAppleMetaDataBox.setValue("9");
26 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
27 | myConcreteAppleMetaDataBox.getBox(Channels.newChannel(baos));
28 | Assert.assertEquals("9", myConcreteAppleMetaDataBox.getValue());
29 |
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/coremedia/iso/boxes/sampleentry/TextSampleEntryTest.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.boxes.sampleentry;
2 |
3 | import org.junit.Assert;
4 | import org.junit.Test;
5 |
6 | public class TextSampleEntryTest {
7 |
8 | @Test
9 | public void testBitSetters() {
10 | TextSampleEntry tx3g = new TextSampleEntry("tx3g");
11 | tx3g.setContinuousKaraoke(true);
12 | Assert.assertTrue(tx3g.isContinuousKaraoke());
13 | tx3g.setContinuousKaraoke(false);
14 | Assert.assertFalse(tx3g.isContinuousKaraoke());
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/authoring/InTestMovieCreator.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.authoring;
2 |
3 | import com.googlecode.mp4parser.authoring.builder.SyncSampleIntersectFinderImpl;
4 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
5 |
6 | import java.io.IOException;
7 | import java.nio.channels.Channels;
8 |
9 |
10 | public class InTestMovieCreator {
11 | public static Movie createMovieOnlyVideo(String... names) throws IOException {
12 | Movie m = new Movie();
13 | for (String name : names) {
14 | Movie m1 = MovieCreator.build(Channels.newChannel(SyncSampleIntersectFinderImpl.class.getResourceAsStream(name)));
15 | for (Track track : m1.getTracks()) {
16 | if ("vide".equals(track.getHandler())) {
17 | m.addTrack(track);
18 | }
19 | }
20 |
21 | }
22 | return m;
23 | }
24 |
25 | }
26 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/authoring/builder/TwoSecondIntersectionFinderTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.authoring.builder;
2 |
3 | import com.googlecode.mp4parser.authoring.Movie;
4 | import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
5 | import org.junit.Assert;
6 | import org.junit.Test;
7 |
8 | import java.nio.channels.Channels;
9 |
10 | /**
11 | * Just check it works.
12 | */
13 | public class TwoSecondIntersectionFinderTest {
14 | long[] samples = new long[] {1, 87, 173, 259, 345, 431, 517, 603, 690, 776, 862, 948, 1034, 1120, 1206, 1292, 1379, 1465, 1551, 1637, 1723, 1809, 1895, 1982, 2068, 2154, 2240, 2326, 2412, 2498, 2584, 2671, 2757, 2843, 2929, 3015, 3101, 3187, 3274, 3360, 3446, 3532, 3618, 3704, 3790, 3876, 3963, 4049, 4135, 4221, 4307, 4393, 4479, 4566, 4652};
15 |
16 | @Test
17 | public void testSampleNumbers() throws Exception {
18 | Movie m = MovieCreator.build(Channels.newChannel(TwoSecondIntersectionFinderTest.class.getResourceAsStream("/Beethoven - Bagatelle op.119 no.11 i.m4a")));
19 | TwoSecondIntersectionFinder intersectionFinder = new TwoSecondIntersectionFinder();
20 | long[] s = intersectionFinder.sampleNumbers(m.getTracks().get(0), m);
21 | Assert.assertArrayEquals(samples, s);
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/authoring/subtext/SrtParserTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.authoring.subtext;
2 |
3 | import com.googlecode.mp4parser.authoring.tracks.TextTrackImpl;
4 | import com.googlecode.mp4parser.srt.SrtParser;
5 | import org.junit.Test;
6 |
7 | import java.io.IOException;
8 | import java.io.InputStream;
9 |
10 |
11 | public class SrtParserTest {
12 | @Test
13 | public void test() throws IOException {
14 | InputStream is = SrtParserTest.class.getResourceAsStream("/subs.srt");
15 | TextTrackImpl track = SrtParser.parse(is);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/authoring/tracks/AC3TrackImplTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.authoring.tracks;
2 |
3 | import com.coremedia.iso.IsoFile;
4 | import com.googlecode.mp4parser.authoring.Movie;
5 | import com.googlecode.mp4parser.authoring.Track;
6 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
7 | import org.junit.Test;
8 |
9 | import java.io.BufferedInputStream;
10 | import java.io.IOException;
11 |
12 | public class AC3TrackImplTest {
13 | @Test
14 | public void freeze() throws IOException {
15 | Track t = new AC3TrackImpl(new BufferedInputStream(AC3TrackImpl.class.getResourceAsStream("/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3")));
16 | Movie m = new Movie();
17 | m.addTrack(t);
18 |
19 | DefaultMp4Builder mp4Builder = new DefaultMp4Builder();
20 | IsoFile isoFile = mp4Builder.build(m);
21 |
22 | // FileChannel fc = new FileOutputStream("/home/sannies/scm/svn/mp4parser/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4").getChannel();
23 | // isoFile.getBox(fc);
24 | // fc.close();
25 | IsoFile isoFileReference = new IsoFile(this.getClass().getProtectionDomain().getCodeSource().getLocation().getFile() + "/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4");
26 | BoxComparator.check(isoFile, isoFileReference, "/moov[0]/mvhd[0]", "/moov[0]/trak[0]/tkhd[0]", "/moov[0]/trak[0]/mdia[0]/mdhd[0]");
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/AbstractTrackEncryptionBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes;
2 |
3 |
4 | import com.coremedia.iso.IsoFile;
5 | import com.googlecode.mp4parser.util.ByteBufferByteChannel;
6 | import org.junit.Assert;
7 | import org.junit.Test;
8 |
9 | import java.io.ByteArrayOutputStream;
10 | import java.io.IOException;
11 | import java.nio.ByteBuffer;
12 | import java.nio.channels.Channels;
13 |
14 | public abstract class AbstractTrackEncryptionBoxTest {
15 |
16 | protected AbstractTrackEncryptionBox tenc;
17 |
18 | @Test
19 | public void testRoundTrip() throws IOException {
20 | tenc.setDefault_KID(new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4, 5, 6});
21 | tenc.setDefaultAlgorithmId(0x0a0b0c);
22 | tenc.setDefaultIvSize(8);
23 |
24 |
25 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
26 | long sizeBeforeWrite = tenc.getSize();
27 | tenc.getBox(Channels.newChannel(baos));
28 | Assert.assertEquals(baos.size(), tenc.getSize());
29 | Assert.assertEquals(baos.size(), sizeBeforeWrite);
30 | IsoFile iso = new IsoFile(new ByteBufferByteChannel(ByteBuffer.wrap(baos.toByteArray())));
31 |
32 | Assert.assertTrue(iso.getBoxes().get(0) instanceof AbstractTrackEncryptionBox);
33 | AbstractTrackEncryptionBox tenc2 = (AbstractTrackEncryptionBox) iso.getBoxes().get(0);
34 | Assert.assertEquals(0, tenc2.getFlags());
35 | Assert.assertTrue(tenc.equals(tenc2));
36 | Assert.assertTrue(tenc2.equals(tenc));
37 |
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/BaseMediaInfoAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created with IntelliJ IDEA.
9 | * User: sannies
10 | * Date: 6/24/12
11 | * Time: 3:53 PM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class BaseMediaInfoAtomTest extends BoxWriteReadBase {
15 | @Override
16 | public Class getBoxUnderTest() {
17 | return BaseMediaInfoAtom.class;
18 | }
19 |
20 | @Override
21 | public void setupProperties(Map addPropsHere, BaseMediaInfoAtom box) {
22 | addPropsHere.put("balance", (short) 321);
23 | addPropsHere.put("graphicsMode", (short) 43);
24 | addPropsHere.put("opColorB", (int) 124);
25 | addPropsHere.put("opColorG", (int) 445);
26 | addPropsHere.put("opColorR", (int) 5321);
27 | addPropsHere.put("reserved", (short) 344);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/CleanApertureAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 |
8 | public class CleanApertureAtomTest extends BoxWriteReadBase {
9 | @Override
10 | public Class getBoxUnderTest() {
11 | return CleanApertureAtom.class;
12 | }
13 |
14 | @Override
15 | public void setupProperties(Map addPropsHere, CleanApertureAtom box) {
16 | addPropsHere.put("height", 123.0);
17 | addPropsHere.put("width", 321.0);
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/GenericMediaHeaderTextAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created with IntelliJ IDEA.
9 | * User: sannies
10 | * Date: 6/24/12
11 | * Time: 4:59 PM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class GenericMediaHeaderTextAtomTest extends BoxWriteReadBase {
15 | public GenericMediaHeaderTextAtomTest() {
16 | super("gmhd");
17 | }
18 |
19 | @Override
20 | public Class getBoxUnderTest() {
21 | return GenericMediaHeaderTextAtom.class;
22 | }
23 |
24 | @Override
25 | public void setupProperties(Map addPropsHere, GenericMediaHeaderTextAtom box) {
26 | addPropsHere.put("unknown_1", (int) 1);
27 | addPropsHere.put("unknown_2", (int) 2);
28 | addPropsHere.put("unknown_3", (int) 3);
29 | addPropsHere.put("unknown_4", (int) 4);
30 | addPropsHere.put("unknown_5", (int) 5);
31 | addPropsHere.put("unknown_6", (int) 6);
32 | addPropsHere.put("unknown_7", (int) 7);
33 | addPropsHere.put("unknown_8", (int) 8);
34 | addPropsHere.put("unknown_9", (int) 9);
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/PixelAspectRationAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | public class PixelAspectRationAtomTest extends BoxWriteReadBase {
8 | @Override
9 | public Class getBoxUnderTest() {
10 | return PixelAspectRationAtom.class;
11 | }
12 |
13 | @Override
14 | public void setupProperties(Map addPropsHere, PixelAspectRationAtom box) {
15 | addPropsHere.put("hSpacing", 25);
16 | addPropsHere.put("vSpacing", 26);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/QuicktimeTextSampleEntryTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Collections;
6 | import java.util.Map;
7 |
8 | public class QuicktimeTextSampleEntryTest extends BoxWriteReadBase {
9 | public QuicktimeTextSampleEntryTest() {
10 | super("stsd");
11 | }
12 |
13 | @Override
14 | public Class getBoxUnderTest() {
15 | return QuicktimeTextSampleEntry.class;
16 | }
17 |
18 | @Override
19 | public void setupProperties(Map addPropsHere, QuicktimeTextSampleEntry box) {
20 | addPropsHere.put("backgroundB", 5);
21 | addPropsHere.put("backgroundG", 10);
22 | addPropsHere.put("backgroundR", 15);
23 | addPropsHere.put("boxes", Collections.emptyList());
24 | addPropsHere.put("dataReferenceIndex", 1);
25 | addPropsHere.put("defaultTextBox", 54634562222l);
26 | addPropsHere.put("displayFlags", 324);
27 | addPropsHere.put("reserved1", 0);
28 | addPropsHere.put("textJustification", 1);
29 | addPropsHere.put("fontFace", (short) 0);
30 | addPropsHere.put("fontName", "");
31 | addPropsHere.put("fontNumber", (short) 0);
32 | addPropsHere.put("foregroundB", 115);
33 | addPropsHere.put("foregroundG", 120);
34 | addPropsHere.put("foregroundR", 125);
35 | addPropsHere.put("reserved2", (byte) 0);
36 | addPropsHere.put("reserved3", (short) 0);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TimeCodeBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.coremedia.iso.IsoFile;
4 | import com.googlecode.mp4parser.util.ByteBufferByteChannel;
5 | import org.apache.commons.codec.DecoderException;
6 | import org.apache.commons.codec.binary.Hex;
7 | import org.junit.Assert;
8 | import org.junit.Test;
9 |
10 | import java.io.IOException;
11 | import java.nio.ByteBuffer;
12 |
13 | import static com.googlecode.mp4parser.util.CastUtils.l2i;
14 |
15 | /**
16 | * Created with IntelliJ IDEA.
17 | * User: sannies
18 | * Date: 3/28/12
19 | * Time: 10:29 AM
20 | * To change this template use File | Settings | File Templates.
21 | */
22 | public class TimeCodeBoxTest {
23 | byte[] box;
24 |
25 | public TimeCodeBoxTest() throws DecoderException {
26 | box = Hex.decodeHex((
27 | "00000031746d63640000000000000001" +
28 | "000000000000000000000bb50000007d" +
29 | "188c0000000f6e616d65000300003030" +
30 | "31").toCharArray());
31 | }
32 |
33 | @Test
34 | public void testParse() throws IOException {
35 | IsoFile isoFile = new IsoFile(new ByteBufferByteChannel(ByteBuffer.wrap(box)));
36 | TimeCodeBox tmcd = (TimeCodeBox) isoFile.getBoxes().get(0);
37 | ByteBuffer byteBuffer = ByteBuffer.allocate(l2i(tmcd.getSize()));
38 | tmcd.getDataReferenceIndex();
39 | Assert.assertTrue(tmcd.isParsed());
40 | tmcd.getBox(new ByteBufferByteChannel(byteBuffer));
41 | Assert.assertArrayEquals(box, byteBuffer.array());
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackEncodedPixelsDimensionsAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created with IntelliJ IDEA.
9 | * User: sannies
10 | * Date: 11/18/12
11 | * Time: 11:31 AM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class TrackEncodedPixelsDimensionsAtomTest extends BoxWriteReadBase {
15 | @Override
16 | public Class getBoxUnderTest() {
17 | return TrackEncodedPixelsDimensionsAtom.class;
18 | }
19 |
20 | @Override
21 | public void setupProperties(Map addPropsHere, TrackEncodedPixelsDimensionsAtom box) {
22 | addPropsHere.put("height", 123.0);
23 | addPropsHere.put("width", 321.0);
24 | }
25 | }
26 |
27 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackLoadSettingsAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created with IntelliJ IDEA.
9 | * User: sannies2
10 | * Date: 2/1/13
11 | * Time: 11:16 AM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class TrackLoadSettingsAtomTest extends BoxWriteReadBase {
15 | @Override
16 | public Class getBoxUnderTest() {
17 | return TrackLoadSettingsAtom.class;
18 | }
19 |
20 | @Override
21 | public void setupProperties(Map addPropsHere, TrackLoadSettingsAtom box) {
22 | addPropsHere.put("defaultHints", 34);
23 | addPropsHere.put("preloadDuration", 35);
24 | addPropsHere.put("preloadFlags", 36);
25 | addPropsHere.put("preloadStartTime", 37);
26 |
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/apple/TrackProductionApertureDimensionsAtomTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.apple;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 | /**
8 | * Created with IntelliJ IDEA.
9 | * User: sannies
10 | * Date: 11/18/12
11 | * Time: 11:32 AM
12 | * To change this template use File | Settings | File Templates.
13 | */
14 | public class TrackProductionApertureDimensionsAtomTest extends BoxWriteReadBase {
15 | @Override
16 | public Class getBoxUnderTest() {
17 | return TrackProductionApertureDimensionsAtom.class;
18 | }
19 |
20 | @Override
21 | public void setupProperties(Map addPropsHere, TrackProductionApertureDimensionsAtom box) {
22 | addPropsHere.put("height", 123.0);
23 | addPropsHere.put("width", 321.0);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/basemediaformat/SampleEncryptionBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.basemediaformat;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBoxTest;
4 | import org.junit.Before;
5 |
6 |
7 | public class SampleEncryptionBoxTest extends AbstractSampleEncryptionBoxTest {
8 |
9 |
10 | @Before
11 | public void setUp() throws Exception {
12 | senc = new SampleEncryptionBox();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/basemediaformat/TrackEncryptionBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.basemediaformat;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBoxTest;
4 | import org.junit.Before;
5 |
6 |
7 | public class TrackEncryptionBoxTest extends AbstractTrackEncryptionBoxTest {
8 |
9 |
10 | @Before
11 | public void setUp() throws Exception {
12 | tenc = new TrackEncryptionBox();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/cenc/ProtectionSystemSpecificHeaderBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.cenc;
2 |
3 | import com.coremedia.iso.IsoFile;
4 | import org.junit.Assert;
5 | import org.junit.Test;
6 |
7 | import java.io.ByteArrayInputStream;
8 | import java.io.ByteArrayOutputStream;
9 | import java.io.IOException;
10 | import java.nio.channels.Channels;
11 |
12 | /**
13 | * Created with IntelliJ IDEA.
14 | * User: sannies
15 | * Date: 6/8/12
16 | * Time: 3:34 PM
17 | * To change this template use File | Settings | File Templates.
18 | */
19 | public class ProtectionSystemSpecificHeaderBoxTest {
20 | @Test
21 | public void testRoundtrip() throws IOException {
22 | ProtectionSystemSpecificHeaderBox pssh = new ProtectionSystemSpecificHeaderBox();
23 | pssh.setSystemId(ProtectionSystemSpecificHeaderBox.OMA2_SYSTEM_ID);
24 | byte[] content = new byte[]{1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
25 | pssh.setContent(content);
26 | ByteArrayOutputStream baos = new ByteArrayOutputStream();
27 | pssh.getBox(Channels.newChannel(baos));
28 | IsoFile isoFile = new IsoFile(Channels.newChannel(new ByteArrayInputStream(baos.toByteArray())));
29 | Assert.assertEquals(1, isoFile.getBoxes().size());
30 | Assert.assertTrue(isoFile.getBoxes().get(0) instanceof ProtectionSystemSpecificHeaderBox);
31 |
32 | Assert.assertArrayEquals(((ProtectionSystemSpecificHeaderBox) isoFile.getBoxes().get(0)).getContent(), content);
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/mp4/samplegrouping/SampleToGroupBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.mp4.samplegrouping;
2 |
3 |
4 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
5 |
6 | import java.util.Arrays;
7 | import java.util.Map;
8 |
9 | public class SampleToGroupBoxTest extends BoxWriteReadBase {
10 | @Override
11 | public Class getBoxUnderTest() {
12 | return SampleToGroupBox.class;
13 | }
14 |
15 | @Override
16 | public void setupProperties(Map addPropsHere, SampleToGroupBox box) {
17 | addPropsHere.put("entries", Arrays.asList(new SampleToGroupBox.Entry(1, 2), new SampleToGroupBox.Entry(2, 3), new SampleToGroupBox.Entry(10, 20)));
18 | addPropsHere.put("groupingType", "grp1");
19 | addPropsHere.put("groupingTypeParameter", "gtyp");
20 | addPropsHere.put("version", 1);
21 |
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/piff/PiffSampleEncryptionBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.piff;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractSampleEncryptionBoxTest;
4 | import org.junit.Before;
5 |
6 |
7 | public class PiffSampleEncryptionBoxTest extends AbstractSampleEncryptionBoxTest {
8 |
9 |
10 | @Before
11 | public void setUp() throws Exception {
12 | senc = new PiffSampleEncryptionBox();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/piff/PiffTrackEncryptionBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.piff;
2 |
3 | import com.googlecode.mp4parser.boxes.AbstractTrackEncryptionBoxTest;
4 | import org.junit.Before;
5 |
6 |
7 | public class PiffTrackEncryptionBoxTest extends AbstractTrackEncryptionBoxTest {
8 |
9 |
10 | @Before
11 | public void setUp() throws Exception {
12 | tenc = new PiffTrackEncryptionBox();
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/threegpp26244/SegmentIndexBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.threegpp26244;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Arrays;
6 | import java.util.Map;
7 |
8 |
9 | public class SegmentIndexBoxTest extends BoxWriteReadBase {
10 | @Override
11 | public Class getBoxUnderTest() {
12 | return SegmentIndexBox.class;
13 | }
14 |
15 | @Override
16 | public void setupProperties(Map values, SegmentIndexBox box) {
17 | values.put("referenceId", 726);
18 | values.put("timeScale", 725);
19 | values.put("earliestPresentationTime", 724);
20 | values.put("firstOffset", 34567);
21 | values.put("reserved", 0);
22 | values.put("entries", Arrays.asList(new SegmentIndexBox.Entry((byte) 1, 2, 3, (byte) 1, (byte) 5, 6)));
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/boxes/ultraviolet/AssetInformationBoxTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.boxes.ultraviolet;
2 |
3 | import com.googlecode.mp4parser.boxes.BoxWriteReadBase;
4 |
5 | import java.util.Map;
6 |
7 |
8 | public class AssetInformationBoxTest extends BoxWriteReadBase {
9 |
10 | @Override
11 | public Class getBoxUnderTest() {
12 | return AssetInformationBox.class;
13 | }
14 |
15 | @Override
16 | public void setupProperties(Map values, AssetInformationBox box) {
17 | values.put("apid", "urn:dece:apid:com:drmtoday:beta:12345abcdef");
18 | values.put("profileVersion", "hdv1");
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/isoparser/src/test/java/com/googlecode/mp4parser/util/PathTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.util;
2 |
3 |
4 | import com.coremedia.iso.IsoFile;
5 | import com.coremedia.iso.boxes.Box;
6 | import com.coremedia.iso.boxes.TrackBox;
7 | import junit.framework.Assert;
8 | import org.junit.Before;
9 | import org.junit.Test;
10 |
11 | import java.io.IOException;
12 | import java.nio.channels.Channels;
13 |
14 | public class PathTest {
15 | IsoFile isoFile;
16 |
17 | @Before
18 | public void setup() throws IOException {
19 | isoFile = new IsoFile(Channels.newChannel(PathTest.class.getResourceAsStream("/multiTrack.3gp")));
20 | }
21 |
22 | @Test
23 | public void testRoundTrip() throws IOException {
24 | Box b1 = isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox().getTimeToSampleBox();
25 | String p = Path.createPath(b1);
26 | Box b2 = Path.getPath(isoFile, p);
27 | Assert.assertSame(b1, b2);
28 | }
29 |
30 | @Test
31 | public void testGetParent() throws Exception {
32 | Box b1 = isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox().getTimeToSampleBox();
33 | Assert.assertEquals(isoFile.getMovieBox().getBoxes(TrackBox.class).get(1).getSampleTableBox(), Path.getPath(b1, ".."));
34 |
35 | }
36 |
37 | @Test
38 | public void testComponentMatcher() {
39 | Assert.assertTrue(Path.component.matcher("abcd").matches());
40 | Assert.assertTrue(Path.component.matcher("xml ").matches());
41 | Assert.assertTrue(Path.component.matcher("xml [1]").matches());
42 | Assert.assertTrue(Path.component.matcher("..").matches());
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_100.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_100.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_120.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_120.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_150.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_150.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_200.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_200.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_80.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/BBB_qpfile_10sec/BBB_fixedres_B_180x320_80.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/Beethoven - Bagatelle op.119 no.11 i.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Beethoven - Bagatelle op.119 no.11 i.m4a
--------------------------------------------------------------------------------
/isoparser/src/test/resources/MOV00006.3gp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/MOV00006.3gp
--------------------------------------------------------------------------------
/isoparser/src/test/resources/Tiny Sample - NEW - Metaxed.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - NEW - Metaxed.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/Tiny Sample - NEW - Untouched.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - NEW - Untouched.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/Tiny Sample - OLD.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/Tiny Sample - OLD.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.aac:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.aac
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/aac-sample.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.h264:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.h264
--------------------------------------------------------------------------------
/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/com/googlecode/mp4parser/authoring/tracks/h264-sample.mp4
--------------------------------------------------------------------------------
/isoparser/src/test/resources/count-english.ac3:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/count-english.ac3
--------------------------------------------------------------------------------
/isoparser/src/test/resources/count.h264:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/count.h264
--------------------------------------------------------------------------------
/isoparser/src/test/resources/file6141.odf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/file6141.odf
--------------------------------------------------------------------------------
/isoparser/src/test/resources/isoparser-custom.properties:
--------------------------------------------------------------------------------
1 | a=b
--------------------------------------------------------------------------------
/isoparser/src/test/resources/multiTrack.3gp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/multiTrack.3gp
--------------------------------------------------------------------------------
/isoparser/src/test/resources/test-pod.m4a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/test-pod.m4a
--------------------------------------------------------------------------------
/isoparser/src/test/resources/test.m4p:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/isoparser/src/test/resources/test.m4p
--------------------------------------------------------------------------------
/tools/isoviewer/src/etc/keystore.jks:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/isoviewer/src/etc/keystore.jks
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/Iso8859_1.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui;
2 |
3 | import java.io.UnsupportedEncodingException;
4 |
5 | /**
6 | *
7 | */
8 | public final class Iso8859_1 {
9 |
10 |
11 | public static String convert(byte[] b) {
12 | try {
13 | return new String(b, "ISO-8859-1");
14 | } catch (UnsupportedEncodingException e) {
15 | throw new Error(e);
16 | }
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/MultiLineCellRenderer.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui;
2 |
3 | import javax.swing.JList;
4 | import javax.swing.JPanel;
5 | import javax.swing.JTextArea;
6 | import javax.swing.ListCellRenderer;
7 | import java.awt.BorderLayout;
8 | import java.awt.Component;
9 |
10 | public class MultiLineCellRenderer implements ListCellRenderer {
11 |
12 | private JPanel p;
13 | private JTextArea ta;
14 |
15 | public MultiLineCellRenderer() {
16 | p = new JPanel();
17 | p.setLayout(new BorderLayout());
18 |
19 |
20 | // text
21 | ta = new JTextArea();
22 | ta.setLineWrap(false);
23 | ta.setWrapStyleWord(true);
24 | p.add(ta, BorderLayout.CENTER);
25 | }
26 |
27 |
28 | public Component getListCellRendererComponent(final JList list,
29 | final Object value, final int index, final boolean isSelected,
30 | final boolean hasFocus) {
31 |
32 | ta.setText((String) value);
33 | int width = list.getWidth();
34 | // this is just to lure the ta's internal sizing mechanism into action
35 | if (width > 0)
36 | ta.setSize(width, Short.MAX_VALUE);
37 | return p;
38 |
39 | }
40 | }
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/NonEditableJTextField.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui;
2 |
3 | import javax.swing.JTextField;
4 | import javax.swing.text.Document;
5 |
6 | /**
7 | * Simple convenience class for non-editable textfield
8 | */
9 | public class NonEditableJTextField extends JTextField {
10 | public NonEditableJTextField() {
11 | }
12 |
13 | public NonEditableJTextField(String text) {
14 | this(null, text, 0);
15 | }
16 |
17 | public NonEditableJTextField(int columns) {
18 | this(null, null, columns);
19 | }
20 |
21 | public NonEditableJTextField(String text, int columns) {
22 | this(null, text, columns);
23 | }
24 |
25 | public NonEditableJTextField(Document doc, String text, int columns) {
26 | super(doc, text, columns);
27 | this.setEditable(false);
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/SampleListModel.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui;
2 |
3 | import com.coremedia.iso.boxes.h264.AvcConfigurationBox;
4 | import com.coremedia.iso.boxes.mdat.SampleList;
5 | import com.coremedia.iso.boxes.sampleentry.SampleEntry;
6 |
7 | import javax.swing.AbstractListModel;
8 | import java.nio.ByteBuffer;
9 |
10 | /**
11 | *
12 | */
13 | public class SampleListModel extends AbstractListModel {
14 | SampleList list;
15 | long trackId;
16 | SampleEntry se;
17 | private AvcConfigurationBox.AVCDecoderConfigurationRecord avcD;
18 |
19 |
20 | public SampleListModel(SampleList list, long trackId, SampleEntry se, AvcConfigurationBox.AVCDecoderConfigurationRecord avcD) {
21 | this.list = list;
22 | this.trackId = trackId;
23 | this.se = se;
24 | this.avcD = avcD;
25 | }
26 |
27 | public long getTrackId() {
28 | return trackId;
29 | }
30 |
31 | public int getSize() {
32 | return list.size();
33 | }
34 |
35 | public Object getElementAt(int index) {
36 | ByteBuffer bb = list.get(index);
37 | long offset = list.getOffsetKeys()[index];
38 | return new Entry(bb, offset, trackId, se, avcD);
39 | }
40 |
41 | public static class Entry {
42 | public Entry(ByteBuffer sample, long offset, long trackId, SampleEntry se, AvcConfigurationBox.AVCDecoderConfigurationRecord avcD) {
43 | this.sample = sample;
44 | this.offset = offset;
45 | this.trackId = trackId;
46 | this.se = se;
47 | this.avcD = avcD;
48 | }
49 |
50 | ByteBuffer sample;
51 | long offset;
52 | long trackId;
53 | SampleEntry se;
54 | AvcConfigurationBox.AVCDecoderConfigurationRecord avcD;
55 | }
56 | }
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/TrackListRenderer.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui;
2 |
3 | import com.coremedia.iso.boxes.TrackBox;
4 | import com.coremedia.iso.boxes.fragment.TrackFragmentBox;
5 |
6 | import javax.swing.*;
7 | import java.awt.*;
8 |
9 | /**
10 | *
11 | */
12 | public class TrackListRenderer extends DefaultListCellRenderer {
13 | public Component getListCellRendererComponent(JList list,
14 | Object value,
15 | int index,
16 | boolean isSelected,
17 | boolean cellHasFocus) {
18 | final long trackId;
19 | if (value instanceof TrackBox) {
20 | TrackBox trackBox = ((TrackBox) value);
21 | trackId = trackBox.getTrackHeaderBox().getTrackId();
22 | } else {
23 | TrackFragmentBox traf = ((TrackFragmentBox) value);
24 | trackId = traf.getTrackFragmentHeaderBox().getTrackId();
25 | }
26 | value = "Track " + trackId;
27 | super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
28 | return this;
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/hex/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The classes in this package have been written by German Laullon and have been extracted from
2 | his SourceForge project JHeComponent (http://sourceforge.net/projects/jhecomponent/). The
3 | classes in this package (com.coremedia.iso.gui.hex) have been released by German Laullon under
4 | the GPL.
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/ByteTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:13:14
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class ByteTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | Box box;
21 |
22 | public ByteTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).byteValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/DoubleTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:12:24
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class DoubleTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | Box box;
21 |
22 | public DoubleTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).doubleValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/FloatTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:12:33
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class FloatTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | Box box;
21 |
22 | public FloatTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).floatValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/IntegerTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:12:52
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class IntegerTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | com.coremedia.iso.boxes.Box box;
21 |
22 | public IntegerTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).intValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/LongTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:12:43
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class LongTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | Box box;
21 |
22 | public LongTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).longValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/ShortTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 | import java.text.ParseException;
9 |
10 | /**
11 | * Created by IntelliJ IDEA.
12 | * User: sannies
13 | * Date: 11.11.2008
14 | * Time: 23:12:52
15 | * To change this template use File | Settings | File Templates.
16 | */
17 | public class ShortTransferValue implements TransferValue {
18 | JFormattedTextField source;
19 | Method writeMethod;
20 | Box box;
21 |
22 | public ShortTransferValue(JFormattedTextField source, Box box, Method writeMethod) {
23 | this.source = source;
24 | this.writeMethod = writeMethod;
25 | this.box = box;
26 | }
27 |
28 | public void go() {
29 | try {
30 | writeMethod.invoke(box, ((Number) source.getFormatter().stringToValue(source.getText())).shortValue());
31 | } catch (ParseException e) {
32 | throw new RuntimeException(e);
33 | } catch (InvocationTargetException e) {
34 | throw new RuntimeException(e);
35 | } catch (IllegalAccessException e) {
36 | throw new RuntimeException(e);
37 | }
38 |
39 | }
40 | }
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/StringTransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.InvocationTargetException;
7 | import java.lang.reflect.Method;
8 |
9 | /**
10 | * Created by IntelliJ IDEA.
11 | * User: sannies
12 | * Date: 11.11.2008
13 | * Time: 23:12:10
14 | * To change this template use File | Settings | File Templates.
15 | */
16 | public class StringTransferValue implements TransferValue {
17 | JTextField source;
18 | Method writeMethod;
19 | Box box;
20 |
21 | public StringTransferValue(JTextField source, Box box, Method writeMethod) {
22 | this.source = source;
23 | this.writeMethod = writeMethod;
24 | this.box = box;
25 | }
26 |
27 | public void go() {
28 | try {
29 | writeMethod.invoke(box, source.getText());
30 | } catch (InvocationTargetException e) {
31 | throw new RuntimeException(e);
32 | } catch (IllegalAccessException e) {
33 | throw new RuntimeException(e);
34 | }
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/TransferHelperFactory.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | import com.coremedia.iso.boxes.Box;
4 |
5 | import javax.swing.*;
6 | import java.lang.reflect.Method;
7 |
8 | /**
9 | * Created by IntelliJ IDEA.
10 | * User: sannies
11 | * Date: 11.11.2008
12 | * Time: 23:13:45
13 | * To change this template use File | Settings | File Templates.
14 | */
15 | public final class TransferHelperFactory {
16 | public static TransferValue getNumberTransferHelper(Class aClass,
17 | Box box, Method writeMethod, JFormattedTextField jftf) {
18 | if (Byte.class == aClass || byte.class == aClass) {
19 | return new ByteTransferValue(jftf, box, writeMethod);
20 | } else if (Double.class == aClass || double.class == aClass) {
21 | return new DoubleTransferValue(jftf, box, writeMethod);
22 | } else if (Float.class == aClass || float.class == aClass) {
23 | return new FloatTransferValue(jftf, box, writeMethod);
24 | } else if (Integer.class == aClass || int.class == aClass) {
25 | return new IntegerTransferValue(jftf, box, writeMethod);
26 | } else if (Short.class == aClass || short.class == aClass) {
27 | return new ShortTransferValue(jftf, box, writeMethod);
28 | } else if (Long.class == aClass || long.class == aClass) {
29 | return new LongTransferValue(jftf, box, writeMethod);
30 | } else {
31 | throw new RuntimeException("unknown number class " + aClass);
32 | }
33 |
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/java/com/coremedia/iso/gui/transferhelper/TransferValue.java:
--------------------------------------------------------------------------------
1 | package com.coremedia.iso.gui.transferhelper;
2 |
3 | /**
4 | * Created by IntelliJ IDEA.
5 | * User: sannies
6 | * Date: 11.11.2008
7 | * Time: 23:11:54
8 | * To change this template use File | Settings | File Templates.
9 | */
10 | public interface TransferValue {
11 | void go();
12 | }
13 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/jnlp/isoviewer.jnlp:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IsoViewer
6 | sebastian annies
7 | Analyzes MP4 files in an ugly UI
8 | Analyzes MP4 files
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/resources/NOTICE.txt:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to the section 4 d of ==
3 | == the Apache License, Version 2.0, ==
4 | == in this case for the Apache Maven distribution. ==
5 | =========================================================================
6 |
7 | This product includes software developed by
8 | CoreMedia AG (http://www.coremedia.com/).
9 |
10 | This product includes software developed by
11 | castLabs GmbH (http://www.castlabs.com/).
12 |
13 | This product includes software (Base64 Encoder extracted from commons-codec) developed by
14 | The Apache Software Foundation (http://www.apache.org/).
15 |
16 | This product includes software (JHexEditor) developed by
17 | Germán Laullón (http://www.apache.org/).
18 |
19 | The icon is licensed under Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
20 | http://www.softicons.com/free-icons/system-icons/senary-system-icons-by-arrioch/video-mp4-icon
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/IsoViewer.properties:
--------------------------------------------------------------------------------
1 | # resources/ConverterApp.properties
2 | Application.id = IsoViewer
3 | Application.title = ISO File Format Viewer
4 | Application.icon=icon.png
5 |
6 | open-iso-file.Action.text=Open...
7 |
8 | IsoViewerPanel.trackViewDetailPaneHeader = Track %s
9 | IsoViewerPanel.tabbedPaneHeaderTrack =Tracks & Samples
10 | IsoViewerPanel.tabbedPaneHeaderBox=Box Structure
--------------------------------------------------------------------------------
/tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/isoviewer/src/main/resources/com/googlecode/mp4parser/isoviewer/resources/icon.png
--------------------------------------------------------------------------------
/tools/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | mp4parser-project
5 | com.googlecode.mp4parser
6 | 1.0-RC-23-SNAPSHOT
7 |
8 | 4.0.0
9 | pom
10 | tools
11 | Tools
12 |
13 | smooth-streaming-fragmenter
14 | isoviewer
15 | smooth-streaming-downloader
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | org.apache.maven.plugins
24 | maven-deploy-plugin
25 |
26 | true
27 |
28 |
29 |
30 |
31 |
32 |
33 | org.apache.maven.plugins
34 | maven-deploy-plugin
35 |
36 | true
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/main/java/testdata/Anchor.java:
--------------------------------------------------------------------------------
1 | package testdata;
2 |
3 | /**
4 | * Just makes sure I find the testdata.
5 | */
6 | public final class Anchor {
7 | }
8 |
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/java/com/googlecode/mp4parser/tools/smoothstreamingdownloader/SmoothStreamingTrackTest.java:
--------------------------------------------------------------------------------
1 | package com.googlecode.mp4parser.tools.smoothstreamingdownloader;
2 |
3 | import com.coremedia.iso.IsoFile;
4 | import com.googlecode.mp4parser.authoring.Movie;
5 | import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
6 | import nu.xom.ParsingException;
7 | import org.junit.Test;
8 |
9 | import java.io.File;
10 | import java.io.IOException;
11 | import java.io.RandomAccessFile;
12 | import java.net.URL;
13 |
14 | /**
15 | * Created with IntelliJ IDEA.
16 | * User: sannies
17 | * Date: 8/11/12
18 | * Time: 5:29 AM
19 | * To change this template use File | Settings | File Templates.
20 | */
21 | public class SmoothStreamingTrackTest {
22 | public static void main(String[] args) throws IOException, ParsingException {
23 | URL anchor = SmoothStreamingTrackTest.class.getProtectionDomain().getCodeSource().getLocation();
24 | Movie m = new Movie();
25 | m.addTrack(new SmoothStreamingTrack(new File(anchor.getFile(), "testdata/Manifest").toURI(), "video", "70090"));
26 | DefaultMp4Builder builder = new DefaultMp4Builder();
27 | IsoFile isoFile = builder.build(m);
28 | RandomAccessFile raf = new RandomAccessFile("output.mp4", "rw");
29 | isoFile.getBox(raf.getChannel());
30 | raf.close();
31 | }
32 |
33 | @Test
34 | public void test() {
35 |
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/Manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/0:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/0
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/24000000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/24000000
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/48000000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/48000000
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/72000000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/72000000
--------------------------------------------------------------------------------
/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/96000000:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-downloader/src/test/resources/testdata/video/70090/96000000
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/main/resources/NOTICE.txt:
--------------------------------------------------------------------------------
1 | =========================================================================
2 | == NOTICE file corresponding to the section 4 d of ==
3 | == the Apache License, Version 2.0, ==
4 | == in this case for the Apache Maven distribution. ==
5 | =========================================================================
6 |
7 | This product includes software developed by
8 | CoreMedia AG (http://www.coremedia.com/).
9 |
10 | This product includes software developed by
11 | castLabs GmbH (http://www.castlabs.com/).
12 |
13 | This product includes software (Base64 Encoder extracted from commons-codec) developed by
14 | The Apache Software Foundation (http://www.apache.org/).
15 |
16 | This product includes software (JHexEditor) developed by
17 | Germán Laullón (http://www.apache.org/).
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/README.txt:
--------------------------------------------------------------------------------
1 | The smooth streaming example is a snippet from a film made by my dear colleague Shermin Voshmgir. Visit her at
2 | http://shermin.net/
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/audio-96000.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/audio-96000.mp4
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-128h-75kbps.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-128h-75kbps.mp4
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-192h-155kbps.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-192h-155kbps.mp4
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-240h-231kbps.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-240h-231kbps.mp4
--------------------------------------------------------------------------------
/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-320h-388kbps.mp4:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/copiousfreetime/mp4parser/fded8a4600f7325217f257e51a232cc8b3a17a9b/tools/smooth-streaming-fragmenter/src/test/resources/smoothstreaming/video-320h-388kbps.mp4
--------------------------------------------------------------------------------