Skip to content

Commit 2f02f27

Browse files
committed
Add more documentation
1 parent 1aeac69 commit 2f02f27

3 files changed

Lines changed: 47 additions & 22 deletions

File tree

app/src/main/java/org/schabi/newpipe/streams/Mp4FromDashWriter.java

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ private void makeTrak(final int index, final long duration, final int defaultMed
783783
final int mediaTime;
784784

785785
if (tracks[index].trak.edstElst == null) {
786-
// is a audio track ¿is edst/elst optional for audio tracks?
786+
// is a audio track; is edst/elst optional for audio tracks?
787787
mediaTime = 0x00; // ffmpeg set this value as zero, instead of defaultMediaTime
788788
bMediaRate = 0x00010000;
789789
} else {
@@ -891,28 +891,35 @@ private int makeSbgp() throws IOException {
891891
return offset + 0x14;
892892
}
893893

894+
/**
895+
* Creates a Sample Group Description Box.
896+
*
897+
* <p>
898+
* What does it do?
899+
* <br>
900+
* The table inside of this box gives information about the
901+
* characteristics of sample groups. The descriptive information is any other
902+
* information needed to define or characterize the sample group.
903+
* </p>
904+
*
905+
* <p>
906+
* ¿is replicable this box?
907+
* <br>
908+
* NO due lacks of documentation about this box but...
909+
* most of m4a encoders and ffmpeg uses this box with dummy values (same values)
910+
* </p>
911+
*
912+
* @return byte array with the 'sgpd' box
913+
*/
894914
private byte[] makeSgpd() {
895-
/*
896-
* Sample Group Description Box
897-
*
898-
* ¿whats does?
899-
* the table inside of this box gives information about the
900-
* characteristics of sample groups. The descriptive information is any other
901-
* information needed to define or characterize the sample group.
902-
*
903-
* ¿is replicable this box?
904-
* NO due lacks of documentation about this box but...
905-
* most of m4a encoders and ffmpeg uses this box with dummy values (same values)
906-
*/
907-
908915
final ByteBuffer buffer = ByteBuffer.wrap(new byte[] {
909916
0x00, 0x00, 0x00, 0x1A, // box size
910917
0x73, 0x67, 0x70, 0x64, // "sgpd"
911918
0x01, 0x00, 0x00, 0x00, // box flags (unknown flag sets)
912-
0x72, 0x6F, 0x6C, 0x6C, // ¿¿group type??
913-
0x00, 0x00, 0x00, 0x02, // ¿¿??
914-
0x00, 0x00, 0x00, 0x01, // ¿¿??
915-
(byte) 0xFF, (byte) 0xFF // ¿¿??
919+
0x72, 0x6F, 0x6C, 0x6C, // group type??
920+
0x00, 0x00, 0x00, 0x02, // ??
921+
0x00, 0x00, 0x00, 0x01, // ??
922+
(byte) 0xFF, (byte) 0xFF // ??
916923
});
917924

918925
return buffer.array();
@@ -955,6 +962,7 @@ private void makeUdta() throws IOException {
955962
writeMetaItem("©ART", artist);
956963
}
957964
if (date != null && !date.isEmpty()) {
965+
// this means 'year' in mp4 metadata, who the hell thought that?
958966
writeMetaItem("©day", date);
959967
}
960968

@@ -1037,8 +1045,11 @@ private byte[] makeMetaHdlr() {
10371045
}
10381046

10391047
/**
1040-
* Helper to write cover image inside the 'udta' box.
1041-
*
1048+
* Helper to add cover image inside the 'udta' box.
1049+
* <p>
1050+
* This method writes the 'covr' metadata item which contains the cover image.
1051+
* The cover image is displayed as thumbnail in many media players and file managers.
1052+
* </p>
10421053
* <pre>
10431054
* [size][key] [data_box]
10441055
* data_box = [size]["data"][type(4bytes)][locale(4bytes)=0][payload]

app/src/main/java/us/shandian/giga/postprocessing/Postprocessing.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import android.util.Log;
55

66
import androidx.annotation.NonNull;
7+
import androidx.annotation.Nullable;
78

89
import org.schabi.newpipe.extractor.stream.StreamInfo;
910
import org.schabi.newpipe.streams.io.SharpStream;
@@ -33,7 +34,7 @@ public abstract class Postprocessing implements Serializable {
3334
public transient static final String ALGORITHM_OGG_FROM_WEBM_DEMUXER = "webm-ogg-d";
3435

3536
public static Postprocessing getAlgorithm(@NonNull String algorithmName, String[] args,
36-
StreamInfo streamInfo) {
37+
@NonNull StreamInfo streamInfo) {
3738
Postprocessing instance;
3839

3940
switch (algorithmName) {
@@ -80,7 +81,18 @@ public static Postprocessing getAlgorithm(@NonNull String algorithmName, String[
8081
private final String name;
8182

8283
private String[] args;
84+
85+
/**
86+
* StreamInfo object related to the current download
87+
*/
88+
@NonNull
8389
protected StreamInfo streamInfo;
90+
91+
/**
92+
* The thumbnail / cover art bitmap associated with the current download.
93+
* May be null.
94+
*/
95+
@Nullable
8496
protected Bitmap thumbnail;
8597

8698
private transient DownloadMission mission;

checkstyle/checkstyle.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,9 @@
7979
<module name="JavadocMethod"/>
8080
<module name="JavadocType"/>
8181
<!--<module name="JavadocVariable"/>-->
82-
<module name="JavadocStyle"/>
82+
<module name="JavadocStyle">
83+
<property name="additionalJavadocTags" value="implNote"/>
84+
</module>
8385
<!--<module name="MissingJavadocMethod"/>-->
8486

8587
<!-- Checks for Naming Conventions. -->

0 commit comments

Comments
 (0)