mirror of
				https://github.com/TeamNewPipe/NewPipe
				synced 2025-10-30 14:52:59 +00:00 
			
		
		
		
	Merge pull request #3395 from kapodamy/checkstyle-warnings
remove some warnings issued by checkstyle
This commit is contained in:
		| @@ -100,7 +100,6 @@ public class Mp4DashReader { | ||||
|                     moov = parseMoov(box); | ||||
|                     break; | ||||
|                 case ATOM_SIDX: | ||||
|                     break; | ||||
|                 case ATOM_MFRA: | ||||
|                     break; | ||||
|             } | ||||
| @@ -148,52 +147,6 @@ public class Mp4DashReader { | ||||
|         return tracks[index]; | ||||
|     } | ||||
|  | ||||
|     /** | ||||
|      * Count all fragments present. This operation requires a seekable stream | ||||
|      * | ||||
|      * @return list with a basic info | ||||
|      * @throws IOException if the source stream is not seekeable | ||||
|      */ | ||||
|     int getFragmentsCount() throws IOException { | ||||
|         if (selectedTrack < 0) { | ||||
|             throw new IllegalStateException("track no selected"); | ||||
|         } | ||||
|         if (!stream.canRewind()) { | ||||
|             throw new IOException("The provided stream doesn't allow seek"); | ||||
|         } | ||||
|  | ||||
|         Box tmp; | ||||
|         int count = 0; | ||||
|  | ||||
|         if (box.type == ATOM_MOOF) { | ||||
|             tmp = box; | ||||
|         } else { | ||||
|             ensure(box); | ||||
|             tmp = readBox(); | ||||
|         } | ||||
|  | ||||
|         do { | ||||
|             if (tmp.type == ATOM_MOOF) { | ||||
|                 ensure(readBox(ATOM_MFHD)); | ||||
|                 Box traf; | ||||
|                 while ((traf = untilBox(tmp, ATOM_TRAF)) != null) { | ||||
|                     Box tfhd = readBox(ATOM_TFHD); | ||||
|                     if (parseTfhd(tracks[selectedTrack].trak.tkhd.trackId) != null) { | ||||
|                         count++; | ||||
|                         break; | ||||
|                     } | ||||
|                     ensure(tfhd); | ||||
|                     ensure(traf); | ||||
|                 } | ||||
|             } | ||||
|             ensure(tmp); | ||||
|         } while (stream.available() && (tmp = readBox()) != null); | ||||
|  | ||||
|         rewind(); | ||||
|  | ||||
|         return count; | ||||
|     } | ||||
|  | ||||
|     public int[] getBrands() { | ||||
|         if (brands == null) { | ||||
|             throw new IllegalStateException("Not parsed"); | ||||
|   | ||||
| @@ -674,8 +674,9 @@ public class Mp4FromDashWriter { | ||||
|                 0x00, 0x01, 0x00, 0x00, 0x01, 0x00, // default volume and rate | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, // reserved values | ||||
|                 // default matrix | ||||
|                 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x40, 0x00, 0x00, 0x00 | ||||
|         }); | ||||
|         auxWrite(new byte[24]); // predefined | ||||
| @@ -717,12 +718,13 @@ public class Mp4FromDashWriter { | ||||
|  | ||||
|         // udta/meta/ilst/©too | ||||
|         auxWrite(new byte[]{ | ||||
|                 0x00, 0x00, 0x00, 0x5C, 0x75, 0x64, 0x74, 0x61, 0x00, 0x00, 0x00, 0x54, 0x6D, 0x65, 0x74, 0x61, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x68, 0x64, 0x6C, 0x72, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x6D, 0x64, 0x69, 0x72, 0x61, 0x70, 0x70, 0x6C, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x27, 0x69, 0x6C, 0x73, 0x74, 0x00, 0x00, 0x00, | ||||
|                 0x1F, (byte) 0xA9, 0x74, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x17, 0x64, 0x61, 0x74, 0x61, 0x00, 0x00, | ||||
|                 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x5C, 0x75, 0x64, 0x74, 0x61, 0x00, 0x00, 0x00, 0x54, 0x6D, 0x65, | ||||
|                 0x74, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x68, 0x64, 0x6C, 0x72, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6D, 0x64, 0x69, 0x72, 0x61, 0x70, | ||||
|                 0x70, 0x6C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x27, 0x69, 0x6C, 0x73, 0x74, 0x00, 0x00, 0x00, | ||||
|                 0x1F, (byte) 0xA9, 0x74, 0x6F, 0x6F, 0x00, 0x00, 0x00, 0x17, 0x64, 0x61, 0x74, 0x61, | ||||
|                 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x4E, 0x65, 0x77, 0x50, 0x69, 0x70, 0x65 // "NewPipe" binary string | ||||
|         }); | ||||
|  | ||||
| @@ -734,8 +736,10 @@ public class Mp4FromDashWriter { | ||||
|         int start = auxOffset(); | ||||
|  | ||||
|         auxWrite(new byte[]{ | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x74, 0x72, 0x61, 0x6B, // trak header | ||||
|                 0x00, 0x00, 0x00, 0x68, 0x74, 0x6B, 0x68, 0x64, 0x01, 0x00, 0x00, 0x03 // tkhd header | ||||
|                 // trak header | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x74, 0x72, 0x61, 0x6B, | ||||
|                 // tkhd header | ||||
|                 0x00, 0x00, 0x00, 0x68, 0x74, 0x6B, 0x68, 0x64, 0x01, 0x00, 0x00, 0x03 | ||||
|         }); | ||||
|  | ||||
|         ByteBuffer buffer = ByteBuffer.allocate(48); | ||||
| @@ -759,7 +763,8 @@ public class Mp4FromDashWriter { | ||||
|  | ||||
|         auxWrite(new byte[]{ | ||||
|                 0x00, 0x00, 0x00, 0x24, 0x65, 0x64, 0x74, 0x73, // edts header | ||||
|                 0x00, 0x00, 0x00, 0x1C, 0x65, 0x6C, 0x73, 0x74, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 // elst header | ||||
|                 0x00, 0x00, 0x00, 0x1C, 0x65, 0x6C, 0x73, 0x74, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 // elst header | ||||
|         }); | ||||
|  | ||||
|         int bMediaRate; | ||||
| @@ -845,14 +850,18 @@ public class Mp4FromDashWriter { | ||||
|     private byte[] makeHdlr(final Hdlr hdlr) { | ||||
|         ByteBuffer buffer = ByteBuffer.wrap(new byte[]{ | ||||
|                 0x00, 0x00, 0x00, 0x77, 0x68, 0x64, 0x6C, 0x72, // hdlr | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 // binary string "ISO Media file created in NewPipe (A libre lightweight streaming frontend for Android)." | ||||
|                 0x49, 0x53, 0x4F, 0x20, 0x4D, 0x65, 0x64, 0x69, 0x61, 0x20, 0x66, 0x69, 0x6C, 0x65, 0x20, 0x63, | ||||
|                 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6E, 0x20, 0x4E, 0x65, 0x77, 0x50, 0x69, 0x70, | ||||
|                 0x65, 0x20, 0x28, 0x41, 0x20, 0x6C, 0x69, 0x62, 0x72, 0x65, 0x20, 0x6C, 0x69, 0x67, 0x68, 0x74, | ||||
|                 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6D, 0x69, 0x6E, 0x67, | ||||
|                 0x20, 0x66, 0x72, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x64, 0x20, 0x66, 0x6F, 0x72, 0x20, 0x41, 0x6E, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | ||||
|                 // binary string | ||||
|                 // "ISO Media file created in NewPipe ( | ||||
|                 // A libre lightweight streaming frontend for Android)." | ||||
|                 0x49, 0x53, 0x4F, 0x20, 0x4D, 0x65, 0x64, 0x69, 0x61, 0x20, 0x66, 0x69, 0x6C, 0x65, | ||||
|                 0x20, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x20, 0x69, 0x6E, 0x20, 0x4E, 0x65, | ||||
|                 0x77, 0x50, 0x69, 0x70, 0x65, 0x20, 0x28, 0x41, 0x20, 0x6C, 0x69, 0x62, 0x72, 0x65, | ||||
|                 0x20, 0x6C, 0x69, 0x67, 0x68, 0x74, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x73, | ||||
|                 0x74, 0x72, 0x65, 0x61, 0x6D, 0x69, 0x6E, 0x67, | ||||
|                 0x20, 0x66, 0x72, 0x6F, 0x6E, 0x74, 0x65, 0x6E, 0x64, 0x20, 0x66, 0x6F, 0x72, 0x20, | ||||
|                 0x41, 0x6E, | ||||
|                 0x64, 0x72, 0x6F, 0x69, 0x64, 0x29, 0x2E | ||||
|         }); | ||||
|  | ||||
|   | ||||
| @@ -289,11 +289,13 @@ public class OggFromWebMWriter implements Closeable { | ||||
|                     /* | ||||
|                         // whole file duration (not implemented) | ||||
|                         0x44,// tag string size | ||||
|                         0x55, 0x52, 0x41, 0x54, 0x49, 0x4F, 0x4E, 0x3D, 0x30, 0x30, 0x3A, 0x30, 0x30, 0x3A, 0x30, | ||||
|                         0x30, 0x2E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30 | ||||
|                         0x55, 0x52, 0x41, 0x54, 0x49, 0x4F, 0x4E, 0x3D, 0x30, | ||||
|                         0x30, 0x3A, 0x30, 0x30, 0x3A, 0x30, 0x30, 0x2E, 0x30, | ||||
|                         0x30, 0x30, 0x30, 0x30, 0x30, 0x30 | ||||
|                      */ | ||||
|                     0x0F, // tag string size | ||||
|                     0x00, 0x00, 0x00, 0x45, 0x4E, 0x43, 0x4F, 0x44, 0x45, 0x52, 0x3D, // "ENCODER=" binary string | ||||
|                     0x00, 0x00, 0x00, 0x45, 0x4E, 0x43, 0x4F, | ||||
|                     0x44, 0x45, 0x52, 0x3D, // "ENCODER=" binary string | ||||
|                     0x4E, 0x65, 0x77, 0x50, 0x69, 0x70, 0x65, // "NewPipe" binary string | ||||
|                     0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 // ???????? | ||||
|             }; | ||||
|   | ||||
| @@ -102,10 +102,6 @@ public class WebMWriter implements Closeable { | ||||
|         return done; | ||||
|     } | ||||
|  | ||||
|     public boolean isParsed() { | ||||
|         return parsed; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public void close() { | ||||
|         done = true; | ||||
| @@ -360,7 +356,7 @@ public class WebMWriter implements Closeable { | ||||
|  | ||||
|         Block bloq = new Block(); | ||||
|         bloq.data = res.data; | ||||
|         bloq.dataSize = (int) res.dataSize; | ||||
|         bloq.dataSize = res.dataSize; | ||||
|         bloq.trackNumber = internalTrackId; | ||||
|         bloq.flags = res.flags; | ||||
|         bloq.absoluteTimecode = res.absoluteTimeCodeNs / DEFAULT_TIMECODE_SCALE; | ||||
| @@ -728,7 +724,7 @@ public class WebMWriter implements Closeable { | ||||
|         return 0; | ||||
|     } | ||||
|  | ||||
|     class KeyFrame { | ||||
|     static class KeyFrame { | ||||
|         KeyFrame(final long segment, final long cluster, final long block, final long timecode) { | ||||
|             clusterPosition = cluster - segment; | ||||
|             relativePosition = (int) (block - cluster - CLUSTER_HEADER_SIZE); | ||||
| @@ -740,7 +736,7 @@ public class WebMWriter implements Closeable { | ||||
|         final long duration; | ||||
|     } | ||||
|  | ||||
|     class Block { | ||||
|     static class Block { | ||||
|         InputStream data; | ||||
|         int trackNumber; | ||||
|         byte flags; | ||||
| @@ -759,7 +755,7 @@ public class WebMWriter implements Closeable { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     class ClusterInfo { | ||||
|     static class ClusterInfo { | ||||
|         long offset; | ||||
|         int size; | ||||
|     } | ||||
|   | ||||
| @@ -13,31 +13,21 @@ | ||||
|  | ||||
|   <!-- org.schabi.newpipe.streams --> | ||||
|   <suppress checks="FinalParameters" | ||||
|     files="WebMWriter.java" | ||||
|     lines="423,595"/> | ||||
|   <suppress checks="LineLength" | ||||
|     files="WebMWriter.java" | ||||
|     lines="160,162"/> | ||||
|  | ||||
|   <suppress checks="FinalParameters" | ||||
|     files="OggFromWebMWriter.java" | ||||
|     lines="378,420"/> | ||||
|   <suppress checks="LineLength" | ||||
|     files="OggFromWebMWriter.java" | ||||
|     lines="292,296"/> | ||||
|       files="DataReader.java" | ||||
|       lines="46,93"/> | ||||
|  | ||||
|   <suppress checks="FinalParameters" | ||||
|       files="Mp4FromDashWriter.java" | ||||
|       lines="643"/> | ||||
|   <suppress checks="LineLength" | ||||
|     files="Mp4FromDashWriter.java" | ||||
|     lines="677,678,720-724,738,762,848,850-855"/> | ||||
|  | ||||
|   <suppress checks="InnerAssignment" | ||||
|     files="Mp4DashReader.java" | ||||
|     lines="190"/> | ||||
|  | ||||
|   <suppress checks="FinalParameters" | ||||
|     files="DataReader.java" | ||||
|     lines="46,93"/> | ||||
|       files="OggFromWebMWriter.java" | ||||
|       lines="380,422"/> | ||||
|  | ||||
|   <suppress checks="FinalParameters" | ||||
|       files="WebMWriter.java" | ||||
|       lines="419,591"/> | ||||
|   <suppress checks="LineLength" | ||||
|       files="WebMWriter.java" | ||||
|       lines="156,158"/> | ||||
| </suppressions> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 wb9688
					wb9688