Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions android/src/main/java/com/brentvatne/common/api/BufferConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetDouble
import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetFloat
import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetInt
import com.facebook.react.bridge.ReadableMap
import java.util.Objects

/**
* Class representing bufferConfig for host.
Expand Down Expand Up @@ -42,6 +43,21 @@ class BufferConfig {
)
}

override fun hashCode(): Int =
Objects.hash(
cacheSize,
minBufferMs,
maxBufferMs,
bufferForPlaybackMs,
bufferForPlaybackAfterRebufferMs,
backBufferDurationMs,
maxHeapAllocationPercent,
minBackBufferMemoryReservePercent,
minBufferMemoryReservePercent,
initialBitrate,
live
)

class Live {
var maxPlaybackSpeed: Float = BufferConfigPropUnsetDouble.toFloat()
var minPlaybackSpeed: Float = BufferConfigPropUnsetDouble.toFloat()
Expand All @@ -60,6 +76,8 @@ class BufferConfig {
)
}

override fun hashCode(): Int = Objects.hash(maxPlaybackSpeed, minPlaybackSpeed, maxOffsetMs, minOffsetMs, targetOffsetMs)

companion object {
private const val PROP_BUFFER_CONFIG_LIVE_MAX_PLAYBACK_SPEED = "maxPlaybackSpeed"
private const val PROP_BUFFER_CONFIG_LIVE_MIN_PLAYBACK_SPEED = "minPlaybackSpeed"
Expand Down
3 changes: 3 additions & 0 deletions android/src/main/java/com/brentvatne/common/api/DRMProps.kt
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetArray
import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetBool
import com.brentvatne.common.toolbox.ReactBridgeUtils.safeGetString
import com.facebook.react.bridge.ReadableMap
import java.util.Objects
import java.util.UUID

/**
Expand Down Expand Up @@ -45,6 +46,8 @@ class DRMProps {
drmLicenseHeader.contentDeepEquals(other.drmLicenseHeader) // drmLicenseHeader is never null
}

override fun hashCode(): Int = Objects.hash(drmType, drmLicenseServer, multiDrm, drmLicenseHeader.contentHashCode())

companion object {
private const val PROP_DRM_TYPE = "type"
private const val PROP_DRM_LICENSE_SERVER = "licenseServer"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package com.brentvatne.common.api
import android.net.Uri
import com.brentvatne.common.toolbox.ReactBridgeUtils
import com.facebook.react.bridge.ReadableMap
import java.util.Objects

/**
* Class representing a sideLoaded text track from application
Expand All @@ -13,6 +14,12 @@ class SideLoadedTextTrack {
var title: String? = null
var uri: Uri = Uri.EMPTY
var type: String? = null

override fun equals(other: Any?): Boolean =
other is SideLoadedTextTrack && language == other.language && title == other.title && uri == other.uri && type == other.type

override fun hashCode(): Int = Objects.hash(language, title, uri, type)

companion object {
val SIDELOAD_TEXT_TRACK_LANGUAGE = "language"
val SIDELOAD_TEXT_TRACK_TITLE = "title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ class SideLoadedTextTrackList {
return tracks == other.tracks
}

override fun hashCode(): Int = tracks.hashCode()

companion object {
fun parse(src: ReadableArray?): SideLoadedTextTrackList? {
if (src == null) {
Expand Down
36 changes: 34 additions & 2 deletions android/src/main/java/com/brentvatne/common/api/Source.kt
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,26 @@ class Source {
*/
var sideLoadedTextTracks: SideLoadedTextTrackList? = null

override fun hashCode(): Int = Objects.hash(uriString, uri, startPositionMs, cropStartMs, cropEndMs, extension, metadata, headers, adsProps)
override fun hashCode(): Int =
Objects.hash(
uri,
cropStartMs,
cropEndMs,
startPositionMs,
extension,
drmProps,
contentStartTime,
cmcdProps,
sideLoadedTextTracks,
adsProps,
minLoadRetryCount,
isLocalAssetFile,
isAsset,
bufferConfig,
textTracksAllowChunklessPreparation,
headers,
metadata
)

/** return true if this and src are equals */
override fun equals(other: Any?): Boolean {
Expand All @@ -108,7 +127,10 @@ class Source {
minLoadRetryCount == other.minLoadRetryCount &&
isLocalAssetFile == other.isLocalAssetFile &&
isAsset == other.isAsset &&
bufferConfig == other.bufferConfig
bufferConfig == other.bufferConfig &&
textTracksAllowChunklessPreparation == other.textTracksAllowChunklessPreparation &&
headers == other.headers &&
metadata == other.metadata
)
}

Expand All @@ -132,6 +154,16 @@ class Source {
/** image uri to display */
var imageUri: Uri? = null

override fun equals(other: Any?): Boolean =
other is Metadata &&
title == other.title &&
subtitle == other.subtitle &&
description == other.description &&
artist == other.artist &&
imageUri == other.imageUri

override fun hashCode(): Int = Objects.hash(title, subtitle, description, artist, imageUri)

companion object {
private const val PROP_SRC_METADATA_TITLE = "title"
private const val PROP_SRC_METADATA_SUBTITLE = "subtitle"
Expand Down
Loading