diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java index 60666db92..d42e23ede 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java @@ -570,7 +570,7 @@ public class PeertubeStreamExtractor extends StreamExtractor { .setDeliveryMethod(DeliveryMethod.HLS) .setMediaFormat(format) .setAverageBitrate(UNKNOWN_BITRATE) - .setBaseUrl(playlistUrl) + .setManifestUrl(playlistUrl) .build(); if (!Stream.containSimilarStream(audioStream, audioStreams)) { audioStreams.add(audioStream); @@ -623,7 +623,7 @@ public class PeertubeStreamExtractor extends StreamExtractor { .setDeliveryMethod(DeliveryMethod.HLS) .setResolution(resolution) .setMediaFormat(format) - .setBaseUrl(playlistUrl) + .setManifestUrl(playlistUrl) .build(); if (!Stream.containSimilarStream(videoStream, videoStreams)) { videoStreams.add(videoStream); diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioStream.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioStream.java index 65062a649..44d6e15ff 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioStream.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioStream.java @@ -56,7 +56,7 @@ public final class AudioStream extends Stream { @Nullable private MediaFormat mediaFormat; @Nullable - private String baseUrl; + private String manifestUrl; private int averageBitrate = UNKNOWN_BITRATE; @Nullable private ItagItem itagItem; @@ -148,22 +148,13 @@ public final class AudioStream extends Stream { } /** - * Set the base URL of the {@link AudioStream}. + * Sets the URL of the manifest this stream comes from (if applicable, otherwise null). * - *

- * For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest - * from which the URLs have been parsed. - *

- * - *

- * The default value is {@code null}. - *

- * - * @param baseUrl the base URL of the {@link AudioStream}, which can be null + * @param manifestUrl the URL of the manifest this stream comes from or {@code null} * @return this {@link Builder} instance */ - public Builder setBaseUrl(@Nullable final String baseUrl) { - this.baseUrl = baseUrl; + public Builder setManifestUrl(@Nullable final String manifestUrl) { + this.manifestUrl = manifestUrl; return this; } @@ -236,7 +227,7 @@ public final class AudioStream extends Stream { } return new AudioStream(id, content, isUrl, mediaFormat, deliveryMethod, averageBitrate, - baseUrl, itagItem); + manifestUrl, itagItem); } } @@ -255,8 +246,8 @@ public final class AudioStream extends Stream { * @param averageBitrate the average bitrate of the stream (which can be unknown, see * {@link #UNKNOWN_BITRATE}) * @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null - * @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more - * information) + * @param manifestUrl the URL of the manifest this stream comes from (if applicable, + * otherwise null) */ @SuppressWarnings("checkstyle:ParameterNumber") private AudioStream(@Nonnull final String id, @@ -265,9 +256,9 @@ public final class AudioStream extends Stream { @Nullable final MediaFormat format, @Nonnull final DeliveryMethod deliveryMethod, final int averageBitrate, - @Nullable final String baseUrl, + @Nullable final String manifestUrl, @Nullable final ItagItem itagItem) { - super(id, content, isUrl, format, deliveryMethod, baseUrl); + super(id, content, isUrl, format, deliveryMethod, manifestUrl); if (itagItem != null) { this.itagItem = itagItem; this.itag = itagItem.id; diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/Stream.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/Stream.java index 02ca3cf16..44ce2772e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/Stream.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/Stream.java @@ -33,7 +33,7 @@ public abstract class Stream implements Serializable { private final String content; private final boolean isUrl; private final DeliveryMethod deliveryMethod; - @Nullable private final String baseUrl; + @Nullable private final String manifestUrl; /** * Instantiates a new {@code Stream} object. @@ -45,21 +45,21 @@ public abstract class Stream implements Serializable { * manifest * @param format the {@link MediaFormat}, which can be null * @param deliveryMethod the delivery method of the stream - * @param baseUrl the base URL of the content if the stream is a DASH or an HLS - * manifest, which can be null + * @param manifestUrl the URL of the manifest this stream comes from (if applicable, + * otherwise null) */ public Stream(final String id, final String content, final boolean isUrl, @Nullable final MediaFormat format, final DeliveryMethod deliveryMethod, - @Nullable final String baseUrl) { + @Nullable final String manifestUrl) { this.id = id; this.content = content; this.isUrl = isUrl; this.mediaFormat = format; this.deliveryMethod = deliveryMethod; - this.baseUrl = baseUrl; + this.manifestUrl = manifestUrl; } /** @@ -184,7 +184,7 @@ public abstract class Stream implements Serializable { } /** - * Gets the delivery method. + * Gets the {@link DeliveryMethod}. * * @return the delivery method */ @@ -194,18 +194,13 @@ public abstract class Stream implements Serializable { } /** - * Gets the base URL of a stream. + * Gets the URL of the manifest this stream comes from (if applicable, otherwise null). * - *

- * If the stream is not a DASH stream or an HLS stream, this value will always be null. - * It may also be null for these streams too. - *

- * - * @return the base URL of the stream or {@code null} + * @return the URL of the manifest this stream comes from or {@code null} */ @Nullable - public String getBaseUrl() { - return baseUrl; + public String getManifestUrl() { + return manifestUrl; } /** @@ -235,11 +230,11 @@ public abstract class Stream implements Serializable { && deliveryMethod == stream.deliveryMethod && content.equals(stream.content) && isUrl == stream.isUrl - && Objects.equals(baseUrl, stream.baseUrl); + && Objects.equals(manifestUrl, stream.manifestUrl); } @Override public int hashCode() { - return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, baseUrl); + return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, manifestUrl); } } diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesStream.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesStream.java index ddd372343..b40d0e928 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesStream.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesStream.java @@ -29,7 +29,7 @@ public final class SubtitlesStream extends Stream { @Nullable private MediaFormat mediaFormat; @Nullable - private String baseUrl; + private String manifestUrl; private String languageCode; // Use of the Boolean class instead of the primitive type needed for setter call check private Boolean autoGenerated; @@ -116,22 +116,13 @@ public final class SubtitlesStream extends Stream { } /** - * Set the base URL of the {@link SubtitlesStream}. + * Sets the URL of the manifest this stream comes from (if applicable, otherwise null). * - *

- * For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest - * from which the URLs have been parsed. - *

- * - *

- * The default value is {@code null}. - *

- * - * @param baseUrl the base URL of the {@link SubtitlesStream}, which can be null + * @param manifestUrl the URL of the manifest this stream comes from or {@code null} * @return this {@link Builder} instance */ - public Builder setBaseUrl(@Nullable final String baseUrl) { - this.baseUrl = baseUrl; + public Builder setManifestUrl(@Nullable final String manifestUrl) { + this.manifestUrl = manifestUrl; return this; } @@ -212,25 +203,25 @@ public final class SubtitlesStream extends Stream { } return new SubtitlesStream(id, content, isUrl, mediaFormat, deliveryMethod, - languageCode, autoGenerated, baseUrl); + languageCode, autoGenerated, manifestUrl); } } /** * Create a new subtitles stream. * - * @param id the identifier which uniquely identifies the stream, e.g. for YouTube - * this would be the itag - * @param content the content or the URL of the stream, depending on whether isUrl is - * true - * @param isUrl whether content is the URL or the actual content of e.g. a DASH - * manifest - * @param mediaFormat the {@link MediaFormat} used by the stream - * @param deliveryMethod the {@link DeliveryMethod} of the stream - * @param languageCode the language code of the stream - * @param autoGenerated whether the subtitles are auto-generated by the streaming service - * @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more - * information) + * @param id the identifier which uniquely identifies the stream, e.g. for YouTube + * this would be the itag + * @param content the content or the URL of the stream, depending on whether isUrl is + * true + * @param isUrl whether content is the URL or the actual content of e.g. a DASH + * manifest + * @param mediaFormat the {@link MediaFormat} used by the stream + * @param deliveryMethod the {@link DeliveryMethod} of the stream + * @param languageCode the language code of the stream + * @param autoGenerated whether the subtitles are auto-generated by the streaming service + * @param manifestUrl the URL of the manifest this stream comes from (if applicable, + * otherwise null) */ @SuppressWarnings("checkstyle:ParameterNumber") private SubtitlesStream(@Nonnull final String id, @@ -240,8 +231,8 @@ public final class SubtitlesStream extends Stream { @Nonnull final DeliveryMethod deliveryMethod, @Nonnull final String languageCode, final boolean autoGenerated, - @Nullable final String baseUrl) { - super(id, content, isUrl, mediaFormat, deliveryMethod, baseUrl); + @Nullable final String manifestUrl) { + super(id, content, isUrl, mediaFormat, deliveryMethod, manifestUrl); /* * Locale.forLanguageTag only for Android API >= 21 diff --git a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java index e8b2595b9..0709af90e 100644 --- a/extractor/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java +++ b/extractor/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java @@ -64,7 +64,7 @@ public final class VideoStream extends Stream { @Nullable private MediaFormat mediaFormat; @Nullable - private String baseUrl; + private String manifestUrl; // Use of the Boolean class instead of the primitive type needed for setter call check private Boolean isVideoOnly; private String resolution; @@ -157,22 +157,13 @@ public final class VideoStream extends Stream { } /** - * Set the base URL of the {@link VideoStream}. + * Sets the URL of the manifest this stream comes from (if applicable, otherwise null). * - *

- * For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest - * from which the URLs have been parsed. - *

- * - *

- * The default value is {@code null}. - *

- * - * @param baseUrl the base URL of the {@link VideoStream}, which can be null + * @param manifestUrl the URL of the manifest this stream comes from or {@code null} * @return this {@link Builder} instance */ - public Builder setBaseUrl(@Nullable final String baseUrl) { - this.baseUrl = baseUrl; + public Builder setManifestUrl(@Nullable final String manifestUrl) { + this.manifestUrl = manifestUrl; return this; } @@ -282,7 +273,7 @@ public final class VideoStream extends Stream { } return new VideoStream(id, content, isUrl, mediaFormat, deliveryMethod, resolution, - isVideoOnly, baseUrl, itagItem); + isVideoOnly, manifestUrl, itagItem); } } @@ -300,8 +291,8 @@ public final class VideoStream extends Stream { * @param resolution the resolution of the stream * @param isVideoOnly whether the stream is video-only * @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null - * @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more - * information) + * @param manifestUrl the URL of the manifest this stream comes from (if applicable, + * otherwise null) */ @SuppressWarnings("checkstyle:ParameterNumber") private VideoStream(@Nonnull final String id, @@ -311,9 +302,9 @@ public final class VideoStream extends Stream { @Nonnull final DeliveryMethod deliveryMethod, @Nonnull final String resolution, final boolean isVideoOnly, - @Nullable final String baseUrl, + @Nullable final String manifestUrl, @Nullable final ItagItem itagItem) { - super(id, content, isUrl, format, deliveryMethod, baseUrl); + super(id, content, isUrl, format, deliveryMethod, manifestUrl); if (itagItem != null) { this.itagItem = itagItem; this.itag = itagItem.id;