Skip to content

Commit

Permalink
Removed unused equalsStream
Browse files Browse the repository at this point in the history
  • Loading branch information
litetex committed Jun 20, 2022
1 parent 665ee1e commit c0f1777
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,9 @@

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
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.schabi.newpipe.extractor.streamdata.stream;

import javax.annotation.Nullable;

public interface BaseAudioStream {
int UNKNOWN_AVG_BITRATE = -1;

Expand All @@ -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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import org.schabi.newpipe.extractor.streamdata.format.MediaFormat;

import javax.annotation.Nonnull;
import javax.annotation.Nullable;

public interface Stream<M extends MediaFormat> {

Expand All @@ -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);
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@
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.
Expand Down Expand Up @@ -42,16 +40,4 @@ default boolean autoGenerated() {
* @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());
}
}
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,12 @@
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.
*/
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());
}
}

0 comments on commit c0f1777

Please sign in to comment.