Class Stream
java.lang.Object
org.schabi.newpipe.extractor.stream.Stream
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AudioStream,SubtitlesStream,VideoStream
Abstract class which represents streams in the extractor.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final Stringstatic final intAn integer to represent that the itag ID returned is not available (only for YouTube; this should never happen) or not applicable (for other services than YouTube). -
Constructor Summary
ConstructorsConstructorDescriptionStream(String id, String content, boolean isUrl, MediaFormat format, DeliveryMethod deliveryMethod, String manifestUrl) Instantiates a newStreamobject. -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancontainSimilarStream(Stream stream, List<? extends Stream> streamList) Checks if the list already contains a stream with the same statistics.booleanequalStats(Stream other) Reveals whether two streams have the same statistics (media formatanddelivery method).Gets the content or URL.Gets theDeliveryMethod.Gets theMediaFormat, which can be null.intGets the format ID, which can be unknown.getId()Gets the identifier of this stream, e.g.abstract ItagItemGets theItagItemof a stream.Gets the URL of the manifest this stream comes from (if applicable, otherwise null).getUrl()Deprecated.booleanisUrl()Returns whether the content is a URL or not.
-
Field Details
-
FORMAT_ID_UNKNOWN
public static final int FORMAT_ID_UNKNOWN- See Also:
-
ID_UNKNOWN
- See Also:
-
ITAG_NOT_AVAILABLE_OR_NOT_APPLICABLE
public static final int ITAG_NOT_AVAILABLE_OR_NOT_APPLICABLEAn integer to represent that the itag ID returned is not available (only for YouTube; this should never happen) or not applicable (for other services than YouTube).An itag should not have a negative value, so
-1is used for this constant.- See Also:
-
-
Constructor Details
-
Stream
public Stream(String id, String content, boolean isUrl, @Nullable MediaFormat format, DeliveryMethod deliveryMethod, @Nullable String manifestUrl) Instantiates a newStreamobject.- Parameters:
id- the identifier which uniquely identifies the file, e.g. for YouTube this would be the itagcontent- the content or URL, depending on whether isUrl is trueisUrl- whether content is the URL or the actual content of e.g. a DASH manifestformat- theMediaFormat, which can be nulldeliveryMethod- the delivery method of the streammanifestUrl- the URL of the manifest this stream comes from (if applicable, otherwise null)
-
-
Method Details
-
containSimilarStream
public static boolean containSimilarStream(@Nonnull Stream stream, List<? extends Stream> streamList) Checks if the list already contains a stream with the same statistics.- Parameters:
stream- the stream to be compared against the streams in the stream liststreamList- the list ofStreams which will be compared- Returns:
- whether the list already contains one stream with equals stats
-
equalStats
Reveals whether two streams have the same statistics (media formatanddelivery method).If the
media formatof the stream is unknown, the streams are compared by using only thedelivery methodand their ID.Note: This method always returns false if the stream passed is null.
- Parameters:
other- the stream object to be compared to this stream object- Returns:
- whether the stream have the same stats or not, based on the criteria above
-
getId
Gets the identifier of this stream, e.g. the itag for YouTube.It should normally be unique, but
ID_UNKNOWNmay be returned as the identifier if the one used by the stream extractor cannot be extracted, which could happen if the extractor uses a value from a streaming service.- Returns:
- the identifier (which may be
ID_UNKNOWN)
-
getUrl
Deprecated.UsegetContent()instead.Gets the URL of this stream if the content is a URL, ornullotherwise.- Returns:
- the URL if the content is a URL,
nullotherwise
-
getContent
Gets the content or URL.- Returns:
- the content or URL
-
isUrl
public boolean isUrl()Returns whether the content is a URL or not.- Returns:
trueif the content of this stream is a URL,falseif it's the actual content
-
getFormat
Gets theMediaFormat, which can be null.- Returns:
- the format
-
getFormatId
public int getFormatId()Gets the format ID, which can be unknown.- Returns:
- the format ID or
FORMAT_ID_UNKNOWN
-
getDeliveryMethod
Gets theDeliveryMethod.- Returns:
- the delivery method
-
getManifestUrl
Gets the URL of the manifest this stream comes from (if applicable, otherwise null).- Returns:
- the URL of the manifest this stream comes from or
null
-
getItagItem
Gets theItagItemof a stream.If the stream is not from YouTube, this value will always be null.
- Returns:
- the
ItagItemof the stream ornull
-
getContent()instead.