Removed unused ``equalsStream``

This commit is contained in:
litetex 2022-06-20 21:20:05 +02:00
parent eb74ae3405
commit d2e82bdc84
6 changed files with 2 additions and 69 deletions

View File

@ -2,23 +2,9 @@ package org.schabi.newpipe.extractor.streamdata.stream;
import org.schabi.newpipe.extractor.streamdata.format.AudioMediaFormat;
import java.util.Objects;
import javax.annotation.Nullable;
/**
* Represents a audio (only) stream.
*/
public interface AudioStream extends Stream<AudioMediaFormat>, BaseAudioStream {
@Override
default boolean equalsStream(@Nullable final Stream other) {
if (!(other instanceof AudioStream)) {
return false;
}
final AudioStream otherAudioStream = (AudioStream) other;
return Objects.equals(mediaFormat(), otherAudioStream.mediaFormat())
&& averageBitrate() == otherAudioStream.averageBitrate();
}
// Nothing
}

View File

@ -1,7 +1,5 @@
package org.schabi.newpipe.extractor.streamdata.stream;
import javax.annotation.Nullable;
public interface BaseAudioStream {
int UNKNOWN_AVG_BITRATE = -1;
@ -13,13 +11,4 @@ public interface BaseAudioStream {
default int averageBitrate() {
return UNKNOWN_AVG_BITRATE;
}
default boolean equalsStream(@Nullable final Stream other) {
if (!(other instanceof BaseAudioStream)) {
return false;
}
final BaseAudioStream otherAudioStream = (BaseAudioStream) other;
return averageBitrate() == otherAudioStream.averageBitrate();
}
}

View File

@ -4,7 +4,6 @@ import org.schabi.newpipe.extractor.streamdata.delivery.DeliveryData;
import org.schabi.newpipe.extractor.streamdata.format.MediaFormat;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public interface Stream<M extends MediaFormat> {
@ -18,8 +17,4 @@ public interface Stream<M extends MediaFormat> {
@Nonnull
DeliveryData deliveryData();
// TODO: May also have to check deliverydata
boolean equalsStream(@Nullable Stream other);
}

View File

@ -3,10 +3,8 @@ package org.schabi.newpipe.extractor.streamdata.stream;
import org.schabi.newpipe.extractor.streamdata.format.SubtitleMediaFormat;
import java.util.Locale;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents a subtitle (only) stream.
@ -42,16 +40,4 @@ public interface SubtitleStream extends Stream<SubtitleMediaFormat> {
* @return the {@link Locale locale} of the subtitles
*/
Locale locale();
@Override
default boolean equalsStream(@Nullable final Stream other) {
if (!(other instanceof SubtitleStream)) {
return false;
}
final SubtitleStream otherSubtitleStream = (SubtitleStream) other;
return Objects.equals(mediaFormat(), otherSubtitleStream.mediaFormat())
&& autoGenerated() == otherSubtitleStream.autoGenerated()
&& Objects.equals(languageCode(), otherSubtitleStream.languageCode());
}
}

View File

@ -1,17 +1,8 @@
package org.schabi.newpipe.extractor.streamdata.stream;
import javax.annotation.Nullable;
/**
* Represents a combined video+audio stream.
*/
public interface VideoAudioStream extends VideoStream, BaseAudioStream {
@Override
default boolean equalsStream(@Nullable final Stream other) {
if (!(other instanceof VideoAudioStream)) {
return false;
}
return VideoStream.super.equalsStream(other) && BaseAudioStream.super.equalsStream(other);
}
// Nothing
}

View File

@ -3,10 +3,7 @@ package org.schabi.newpipe.extractor.streamdata.stream;
import org.schabi.newpipe.extractor.streamdata.format.VideoAudioMediaFormat;
import org.schabi.newpipe.extractor.streamdata.stream.quality.VideoQualityData;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
/**
* Represents a video (only) stream.
@ -14,15 +11,4 @@ import javax.annotation.Nullable;
public interface VideoStream extends Stream<VideoAudioMediaFormat> {
@Nonnull
VideoQualityData videoQualityData();
@Override
default boolean equalsStream(@Nullable final Stream other) {
if (!(other instanceof VideoStream)) {
return false;
}
final VideoStream otherVideoStream = (VideoStream) other;
return Objects.equals(mediaFormat(), otherVideoStream.mediaFormat())
&& videoQualityData().equalsVideoQualityData(otherVideoStream.videoQualityData());
}
}