Skip to content

Commit 2321822

Browse files
StypoxAudricV
authored andcommitted
Rename Stream's baseUrl to manifestUrl
1 parent cfc13f4 commit 2321822

5 files changed

Lines changed: 54 additions & 86 deletions

File tree

extractor/src/main/java/org/schabi/newpipe/extractor/services/peertube/extractors/PeertubeStreamExtractor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,7 +570,7 @@ private void addNewAudioStream(@Nonnull final JsonObject streamJsonObject,
570570
.setDeliveryMethod(DeliveryMethod.HLS)
571571
.setMediaFormat(format)
572572
.setAverageBitrate(UNKNOWN_BITRATE)
573-
.setBaseUrl(playlistUrl)
573+
.setManifestUrl(playlistUrl)
574574
.build();
575575
if (!Stream.containSimilarStream(audioStream, audioStreams)) {
576576
audioStreams.add(audioStream);
@@ -623,7 +623,7 @@ private void addNewVideoStream(@Nonnull final JsonObject streamJsonObject,
623623
.setDeliveryMethod(DeliveryMethod.HLS)
624624
.setResolution(resolution)
625625
.setMediaFormat(format)
626-
.setBaseUrl(playlistUrl)
626+
.setManifestUrl(playlistUrl)
627627
.build();
628628
if (!Stream.containSimilarStream(videoStream, videoStreams)) {
629629
videoStreams.add(videoStream);

extractor/src/main/java/org/schabi/newpipe/extractor/stream/AudioStream.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ public static final class Builder {
5656
@Nullable
5757
private MediaFormat mediaFormat;
5858
@Nullable
59-
private String baseUrl;
59+
private String manifestUrl;
6060
private int averageBitrate = UNKNOWN_BITRATE;
6161
@Nullable
6262
private ItagItem itagItem;
@@ -148,22 +148,13 @@ public Builder setDeliveryMethod(@Nonnull final DeliveryMethod deliveryMethod) {
148148
}
149149

150150
/**
151-
* Set the base URL of the {@link AudioStream}.
151+
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
152152
*
153-
* <p>
154-
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
155-
* from which the URLs have been parsed.
156-
* </p>
157-
*
158-
* <p>
159-
* The default value is {@code null}.
160-
* </p>
161-
*
162-
* @param baseUrl the base URL of the {@link AudioStream}, which can be null
153+
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
163154
* @return this {@link Builder} instance
164155
*/
165-
public Builder setBaseUrl(@Nullable final String baseUrl) {
166-
this.baseUrl = baseUrl;
156+
public Builder setManifestUrl(@Nullable final String manifestUrl) {
157+
this.manifestUrl = manifestUrl;
167158
return this;
168159
}
169160

@@ -236,7 +227,7 @@ public AudioStream build() {
236227
}
237228

238229
return new AudioStream(id, content, isUrl, mediaFormat, deliveryMethod, averageBitrate,
239-
baseUrl, itagItem);
230+
manifestUrl, itagItem);
240231
}
241232
}
242233

@@ -255,8 +246,8 @@ public AudioStream build() {
255246
* @param averageBitrate the average bitrate of the stream (which can be unknown, see
256247
* {@link #UNKNOWN_BITRATE})
257248
* @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null
258-
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
259-
* information)
249+
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
250+
* otherwise null)
260251
*/
261252
@SuppressWarnings("checkstyle:ParameterNumber")
262253
private AudioStream(@Nonnull final String id,
@@ -265,9 +256,9 @@ private AudioStream(@Nonnull final String id,
265256
@Nullable final MediaFormat format,
266257
@Nonnull final DeliveryMethod deliveryMethod,
267258
final int averageBitrate,
268-
@Nullable final String baseUrl,
259+
@Nullable final String manifestUrl,
269260
@Nullable final ItagItem itagItem) {
270-
super(id, content, isUrl, format, deliveryMethod, baseUrl);
261+
super(id, content, isUrl, format, deliveryMethod, manifestUrl);
271262
if (itagItem != null) {
272263
this.itagItem = itagItem;
273264
this.itag = itagItem.id;

extractor/src/main/java/org/schabi/newpipe/extractor/stream/Stream.java

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public abstract class Stream implements Serializable {
3333
private final String content;
3434
private final boolean isUrl;
3535
private final DeliveryMethod deliveryMethod;
36-
@Nullable private final String baseUrl;
36+
@Nullable private final String manifestUrl;
3737

3838
/**
3939
* Instantiates a new {@code Stream} object.
@@ -45,21 +45,21 @@ public abstract class Stream implements Serializable {
4545
* manifest
4646
* @param format the {@link MediaFormat}, which can be null
4747
* @param deliveryMethod the delivery method of the stream
48-
* @param baseUrl the base URL of the content if the stream is a DASH or an HLS
49-
* manifest, which can be null
48+
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
49+
* otherwise null)
5050
*/
5151
public Stream(final String id,
5252
final String content,
5353
final boolean isUrl,
5454
@Nullable final MediaFormat format,
5555
final DeliveryMethod deliveryMethod,
56-
@Nullable final String baseUrl) {
56+
@Nullable final String manifestUrl) {
5757
this.id = id;
5858
this.content = content;
5959
this.isUrl = isUrl;
6060
this.mediaFormat = format;
6161
this.deliveryMethod = deliveryMethod;
62-
this.baseUrl = baseUrl;
62+
this.manifestUrl = manifestUrl;
6363
}
6464

6565
/**
@@ -184,7 +184,7 @@ public int getFormatId() {
184184
}
185185

186186
/**
187-
* Gets the delivery method.
187+
* Gets the {@link DeliveryMethod}.
188188
*
189189
* @return the delivery method
190190
*/
@@ -194,18 +194,13 @@ public DeliveryMethod getDeliveryMethod() {
194194
}
195195

196196
/**
197-
* Gets the base URL of a stream.
197+
* Gets the URL of the manifest this stream comes from (if applicable, otherwise null).
198198
*
199-
* <p>
200-
* If the stream is not a DASH stream or an HLS stream, this value will always be null.
201-
* It may also be null for these streams too.
202-
* </p>
203-
*
204-
* @return the base URL of the stream or {@code null}
199+
* @return the URL of the manifest this stream comes from or {@code null}
205200
*/
206201
@Nullable
207-
public String getBaseUrl() {
208-
return baseUrl;
202+
public String getManifestUrl() {
203+
return manifestUrl;
209204
}
210205

211206
/**
@@ -235,11 +230,11 @@ public boolean equals(final Object obj) {
235230
&& deliveryMethod == stream.deliveryMethod
236231
&& content.equals(stream.content)
237232
&& isUrl == stream.isUrl
238-
&& Objects.equals(baseUrl, stream.baseUrl);
233+
&& Objects.equals(manifestUrl, stream.manifestUrl);
239234
}
240235

241236
@Override
242237
public int hashCode() {
243-
return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, baseUrl);
238+
return Objects.hash(id, mediaFormat, deliveryMethod, content, isUrl, manifestUrl);
244239
}
245240
}

extractor/src/main/java/org/schabi/newpipe/extractor/stream/SubtitlesStream.java

Lines changed: 20 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static final class Builder {
2929
@Nullable
3030
private MediaFormat mediaFormat;
3131
@Nullable
32-
private String baseUrl;
32+
private String manifestUrl;
3333
private String languageCode;
3434
// Use of the Boolean class instead of the primitive type needed for setter call check
3535
private Boolean autoGenerated;
@@ -116,22 +116,13 @@ public Builder setDeliveryMethod(@Nonnull final DeliveryMethod deliveryMethod) {
116116
}
117117

118118
/**
119-
* Set the base URL of the {@link SubtitlesStream}.
119+
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
120120
*
121-
* <p>
122-
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
123-
* from which the URLs have been parsed.
124-
* </p>
125-
*
126-
* <p>
127-
* The default value is {@code null}.
128-
* </p>
129-
*
130-
* @param baseUrl the base URL of the {@link SubtitlesStream}, which can be null
121+
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
131122
* @return this {@link Builder} instance
132123
*/
133-
public Builder setBaseUrl(@Nullable final String baseUrl) {
134-
this.baseUrl = baseUrl;
124+
public Builder setManifestUrl(@Nullable final String manifestUrl) {
125+
this.manifestUrl = manifestUrl;
135126
return this;
136127
}
137128

@@ -212,25 +203,25 @@ public SubtitlesStream build() {
212203
}
213204

214205
return new SubtitlesStream(id, content, isUrl, mediaFormat, deliveryMethod,
215-
languageCode, autoGenerated, baseUrl);
206+
languageCode, autoGenerated, manifestUrl);
216207
}
217208
}
218209

219210
/**
220211
* Create a new subtitles stream.
221212
*
222-
* @param id the identifier which uniquely identifies the stream, e.g. for YouTube
223-
* this would be the itag
224-
* @param content the content or the URL of the stream, depending on whether isUrl is
225-
* true
226-
* @param isUrl whether content is the URL or the actual content of e.g. a DASH
227-
* manifest
228-
* @param mediaFormat the {@link MediaFormat} used by the stream
229-
* @param deliveryMethod the {@link DeliveryMethod} of the stream
230-
* @param languageCode the language code of the stream
231-
* @param autoGenerated whether the subtitles are auto-generated by the streaming service
232-
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
233-
* information)
213+
* @param id the identifier which uniquely identifies the stream, e.g. for YouTube
214+
* this would be the itag
215+
* @param content the content or the URL of the stream, depending on whether isUrl is
216+
* true
217+
* @param isUrl whether content is the URL or the actual content of e.g. a DASH
218+
* manifest
219+
* @param mediaFormat the {@link MediaFormat} used by the stream
220+
* @param deliveryMethod the {@link DeliveryMethod} of the stream
221+
* @param languageCode the language code of the stream
222+
* @param autoGenerated whether the subtitles are auto-generated by the streaming service
223+
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
224+
* otherwise null)
234225
*/
235226
@SuppressWarnings("checkstyle:ParameterNumber")
236227
private SubtitlesStream(@Nonnull final String id,
@@ -240,8 +231,8 @@ private SubtitlesStream(@Nonnull final String id,
240231
@Nonnull final DeliveryMethod deliveryMethod,
241232
@Nonnull final String languageCode,
242233
final boolean autoGenerated,
243-
@Nullable final String baseUrl) {
244-
super(id, content, isUrl, mediaFormat, deliveryMethod, baseUrl);
234+
@Nullable final String manifestUrl) {
235+
super(id, content, isUrl, mediaFormat, deliveryMethod, manifestUrl);
245236

246237
/*
247238
* Locale.forLanguageTag only for Android API >= 21

extractor/src/main/java/org/schabi/newpipe/extractor/stream/VideoStream.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ public static final class Builder {
6464
@Nullable
6565
private MediaFormat mediaFormat;
6666
@Nullable
67-
private String baseUrl;
67+
private String manifestUrl;
6868
// Use of the Boolean class instead of the primitive type needed for setter call check
6969
private Boolean isVideoOnly;
7070
private String resolution;
@@ -157,22 +157,13 @@ public Builder setDeliveryMethod(@Nonnull final DeliveryMethod deliveryMethod) {
157157
}
158158

159159
/**
160-
* Set the base URL of the {@link VideoStream}.
160+
* Sets the URL of the manifest this stream comes from (if applicable, otherwise null).
161161
*
162-
* <p>
163-
* For non-URL contents, the base URL is, for instance, a link to the DASH or HLS manifest
164-
* from which the URLs have been parsed.
165-
* </p>
166-
*
167-
* <p>
168-
* The default value is {@code null}.
169-
* </p>
170-
*
171-
* @param baseUrl the base URL of the {@link VideoStream}, which can be null
162+
* @param manifestUrl the URL of the manifest this stream comes from or {@code null}
172163
* @return this {@link Builder} instance
173164
*/
174-
public Builder setBaseUrl(@Nullable final String baseUrl) {
175-
this.baseUrl = baseUrl;
165+
public Builder setManifestUrl(@Nullable final String manifestUrl) {
166+
this.manifestUrl = manifestUrl;
176167
return this;
177168
}
178169

@@ -282,7 +273,7 @@ public VideoStream build() {
282273
}
283274

284275
return new VideoStream(id, content, isUrl, mediaFormat, deliveryMethod, resolution,
285-
isVideoOnly, baseUrl, itagItem);
276+
isVideoOnly, manifestUrl, itagItem);
286277
}
287278
}
288279

@@ -300,8 +291,8 @@ public VideoStream build() {
300291
* @param resolution the resolution of the stream
301292
* @param isVideoOnly whether the stream is video-only
302293
* @param itagItem the {@link ItagItem} corresponding to the stream, which cannot be null
303-
* @param baseUrl the base URL of the stream (see {@link Stream#getBaseUrl()} for more
304-
* information)
294+
* @param manifestUrl the URL of the manifest this stream comes from (if applicable,
295+
* otherwise null)
305296
*/
306297
@SuppressWarnings("checkstyle:ParameterNumber")
307298
private VideoStream(@Nonnull final String id,
@@ -311,9 +302,9 @@ private VideoStream(@Nonnull final String id,
311302
@Nonnull final DeliveryMethod deliveryMethod,
312303
@Nonnull final String resolution,
313304
final boolean isVideoOnly,
314-
@Nullable final String baseUrl,
305+
@Nullable final String manifestUrl,
315306
@Nullable final ItagItem itagItem) {
316-
super(id, content, isUrl, format, deliveryMethod, baseUrl);
307+
super(id, content, isUrl, format, deliveryMethod, manifestUrl);
317308
if (itagItem != null) {
318309
this.itagItem = itagItem;
319310
this.itag = itagItem.id;

0 commit comments

Comments
 (0)