Skip to content

Commit f815f72

Browse files
committed
Improve documentation
Make indents consistent
1 parent 69ec266 commit f815f72

File tree

66 files changed

+3450
-3597
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+3450
-3597
lines changed

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ The following snippet illustrates the creation of an `RGBADescriptor` using the
5353
library/src/test/resources/imps/imp_1/VIDEO_f031aa43-88c8-4de9-856f-904a33a78505.mxf > \
5454
library/target/test-output/VIDEO_f031aa43-88c8-4de9-856f-904a33a78505.json
5555

56+
## Organization
57+
58+
The library consists of 3 modules:
59+
60+
- `class-generator` generates POJO classes in <library/target/generated-sources> when
61+
compiling the library, using the register files at <library/src/main/resources>
62+
- `library` holds the generated POJO classes and classes for reading and writing MXF files
63+
- `common` holds classes that do not depend on the generated classes
64+
65+
_NOTE_: `common` is largely based on [regxmllib](https://github.com/sandflow/regxmllib) and
66+
combining the two libraries is expected in the long run.
67+
5668
## MXF concepts
5769

5870
### Data model
@@ -91,7 +103,9 @@ Index entries point to the first byte of the K of each element.
91103

92104
In the case of clip-wrapping, the entire essence stream is wrapped into a single KLV triplet (also called an _element_).
93105

94-
Index entries point to the first byte of the V of each element.
106+
Index entries are relative to the first byte of the V of each element, _with the
107+
exception of IAB Track Files, where they are relative to the K of the IAB Clip
108+
Wrap element.
95109

96110
### Indexing
97111

common/src/main/java/com/sandflow/smpte/klv/Group.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,18 +34,18 @@
3434
*/
3535
public interface Group {
3636

37-
/**
38-
* Retrieves the items of the Group
39-
*
40-
* @return Ordered collection of all items within the Group
41-
*/
42-
Collection<Triplet> getItems();
37+
/**
38+
* Retrieves the items of the Group
39+
*
40+
* @return Ordered collection of all items within the Group
41+
*/
42+
Collection<Triplet> getItems();
4343

44-
/**
45-
* Returns the Key of the Group
46-
*
47-
* @return Key of the Group
48-
*/
49-
UL getKey();
44+
/**
45+
* Returns the Key of the Group
46+
*
47+
* @return Key of the Group
48+
*/
49+
UL getKey();
5050

5151
}

common/src/main/java/com/sandflow/smpte/klv/MemoryTriplet.java

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -35,40 +35,42 @@
3535
*/
3636
public class MemoryTriplet implements Triplet {
3737

38-
final private AUID key;
39-
final private byte[] value;
38+
final private AUID key;
39+
final private byte[] value;
4040

41-
/**
42-
* Creates a Triplet from a Key and an array of bytes as the Value
43-
* @param key Triplet Key
44-
* @param value Triplet Value
45-
*/
46-
public MemoryTriplet(AUID key, byte[] value) {
47-
48-
if (key == null || value == null) throw new InvalidParameterException("Triplet muse have key and value.");
49-
50-
this.key = key;
51-
this.value = value;
52-
}
41+
/**
42+
* Creates a Triplet from a Key and an array of bytes as the Value
43+
*
44+
* @param key Triplet Key
45+
* @param value Triplet Value
46+
*/
47+
public MemoryTriplet(AUID key, byte[] value) {
5348

54-
@Override
55-
public AUID getKey() {
56-
return key;
57-
}
49+
if (key == null || value == null)
50+
throw new InvalidParameterException("Triplet muse have key and value.");
5851

59-
@Override
60-
public long getLength() {
61-
return value.length;
62-
}
52+
this.key = key;
53+
this.value = value;
54+
}
6355

64-
@Override
65-
public byte[] getValue() {
66-
return value;
67-
}
56+
@Override
57+
public AUID getKey() {
58+
return key;
59+
}
60+
61+
@Override
62+
public long getLength() {
63+
return value.length;
64+
}
65+
66+
@Override
67+
public byte[] getValue() {
68+
return value;
69+
}
70+
71+
@Override
72+
public InputStream getValueAsStream() {
73+
return new ByteArrayInputStream(value);
74+
}
6875

69-
@Override
70-
public InputStream getValueAsStream() {
71-
return new ByteArrayInputStream(value);
72-
}
73-
7476
}

common/src/main/java/com/sandflow/smpte/klv/Triplet.java

Lines changed: 27 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -34,28 +34,32 @@
3434
*/
3535
public interface Triplet {
3636

37-
/**
38-
* Returns the Key of the KLV Triplet
39-
* @return Triplet Key
40-
*/
41-
AUID getKey();
42-
43-
/**
44-
* Returns the Length of the KLV Triplet
45-
* @return Triplet Length
46-
*/
47-
long getLength();
48-
49-
/**
50-
* Return the Value of the KLV Triplet as a byte array
51-
* @return Triplet Value
52-
*/
53-
byte[] getValue();
54-
55-
/**
56-
* Return the Value of the KLV Triplet as an Input Stream
57-
* @return Triplet Value
58-
*/
59-
InputStream getValueAsStream();
37+
/**
38+
* Returns the Key of the KLV Triplet
39+
*
40+
* @return Triplet Key
41+
*/
42+
AUID getKey();
43+
44+
/**
45+
* Returns the Length of the KLV Triplet
46+
*
47+
* @return Triplet Length
48+
*/
49+
long getLength();
50+
51+
/**
52+
* Return the Value of the KLV Triplet as a byte array
53+
*
54+
* @return Triplet Value
55+
*/
56+
byte[] getValue();
57+
58+
/**
59+
* Return the Value of the KLV Triplet as an Input Stream
60+
*
61+
* @return Triplet Value
62+
*/
63+
InputStream getValueAsStream();
6064

6165
}
Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
/*
2-
* Copyright (c) 2014, Pierre-Anthony Lemieux ([email protected])
3-
* All rights reserved.
4-
*
5-
* Redistribution and use in source and binary forms, with or without
6-
* modification, are permitted provided that the following conditions are met:
7-
*
8-
* * Redistributions of source code must retain the above copyright notice, this
9-
* list of conditions and the following disclaimer.
10-
* * Redistributions in binary form must reproduce the above copyright notice,
11-
* this list of conditions and the following disclaimer in the documentation
12-
* and/or other materials provided with the distribution.
13-
*
14-
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15-
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16-
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17-
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18-
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19-
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20-
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21-
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22-
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23-
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24-
* POSSIBILITY OF SUCH DAMAGE.
25-
*/
2+
* Copyright (c) 2014, Pierre-Anthony Lemieux ([email protected])
3+
* All rights reserved.
4+
*
5+
* Redistribution and use in source and binary forms, with or without
6+
* modification, are permitted provided that the following conditions are met:
7+
*
8+
* * Redistributions of source code must retain the above copyright notice, this
9+
* list of conditions and the following disclaimer.
10+
* * Redistributions in binary form must reproduce the above copyright notice,
11+
* this list of conditions and the following disclaimer in the documentation
12+
* and/or other materials provided with the distribution.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15+
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16+
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17+
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18+
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19+
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20+
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21+
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22+
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23+
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24+
* POSSIBILITY OF SUCH DAMAGE.
25+
*/
2626
package com.sandflow.smpte.klv.adapters;
2727

2828
import com.sandflow.smpte.util.UL;
@@ -32,22 +32,24 @@
3232
*/
3333
public class ULValueAdapter {
3434

35-
/**
36-
* Converts a KLV Triplet Value to a UL.
37-
* @param value KLV Triplet Value
38-
* @return UL
39-
*/
40-
public static UL fromValue(byte[] value) {
41-
return new UL(value);
42-
}
35+
/**
36+
* Converts a KLV Triplet Value to a UL.
37+
*
38+
* @param value KLV Triplet Value
39+
* @return UL
40+
*/
41+
public static UL fromValue(byte[] value) {
42+
return new UL(value);
43+
}
44+
45+
/**
46+
* Converts a UL to a KLV Triplet Value.
47+
*
48+
* @param obj UL
49+
* @return KLV Triplet Value
50+
*/
51+
public static byte[] toValue(UL obj) {
52+
return obj.getValue();
53+
}
4354

44-
/**
45-
* Converts a UL to a KLV Triplet Value.
46-
* @param obj UL
47-
* @return KLV Triplet Value
48-
*/
49-
public static byte[] toValue(UL obj) {
50-
return obj.getValue();
51-
}
52-
5355
}

common/src/main/java/com/sandflow/smpte/klv/adapters/UMIDValueAdapter.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,24 @@
3232
*/
3333
public class UMIDValueAdapter {
3434

35-
/**
36-
* Converts a KLV Triplet Value to a UMID.
37-
* @param value KLV Triplet Value
38-
* @return UMID
39-
*/
40-
public static UMID fromValue(byte[] value) {
41-
return new UMID(value);
42-
}
35+
/**
36+
* Converts a KLV Triplet Value to a UMID.
37+
*
38+
* @param value KLV Triplet Value
39+
* @return UMID
40+
*/
41+
public static UMID fromValue(byte[] value) {
42+
return new UMID(value);
43+
}
44+
45+
/**
46+
* Converts a UMID to a KLV Triplet Value.
47+
*
48+
* @param obj UMID
49+
* @return KLV Triplet Value
50+
*/
51+
public static byte[] toValue(UMID obj) {
52+
return obj.getValue();
53+
}
4354

44-
/**
45-
* Converts a UMID to a KLV Triplet Value.
46-
* @param obj UMID
47-
* @return KLV Triplet Value
48-
*/
49-
public static byte[] toValue(UMID obj) {
50-
return obj.getValue();
51-
}
52-
5355
}

common/src/main/java/com/sandflow/smpte/klv/adapters/UUIDValueAdapter.java

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,24 @@
3232
*/
3333
public class UUIDValueAdapter {
3434

35-
/**
36-
* Converts a KLV Triplet Value to a UUID.
37-
* @param value KLV Triplet Value
38-
* @return UUID
39-
*/
40-
public static UUID fromValue(byte[] value) {
41-
return new UUID(value);
42-
}
35+
/**
36+
* Converts a KLV Triplet Value to a UUID.
37+
*
38+
* @param value KLV Triplet Value
39+
* @return UUID
40+
*/
41+
public static UUID fromValue(byte[] value) {
42+
return new UUID(value);
43+
}
44+
45+
/**
46+
* Converts a UUID to a KLV Triplet Value.
47+
*
48+
* @param obj UUID
49+
* @return KLV Triplet Value
50+
*/
51+
public static byte[] toValue(UUID obj) {
52+
return obj.getValue();
53+
}
4354

44-
/**
45-
* Converts a UUID to a KLV Triplet Value.
46-
* @param obj UUID
47-
* @return KLV Triplet Value
48-
*/
49-
public static byte[] toValue(UUID obj) {
50-
return obj.getValue();
51-
}
52-
5355
}

0 commit comments

Comments
 (0)