Skip to content

Commit 6e8a207

Browse files
committed
refactor(sabr): create FormatId for Representation directly from stream
1 parent b6fcdf6 commit 6e8a207

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

app/src/main/java/com/github/libretube/player/manifest/Representation.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ import misc.Common.FormatId
1010
data class Representation(
1111
/** The format of the representation. */
1212
val format: Format,
13-
val itag: Int,
14-
val lastModified: Long,
15-
val xtags: String?,
13+
/** Metadata about the stream. */
1614
val stream: PipedStream,
1715
) {
18-
fun formatId(): FormatId =
19-
FormatId.newBuilder().setItag(itag).setLastModified(lastModified).setXtags(xtags ?: "")
20-
.build()
16+
fun formatId(): FormatId = FormatId.newBuilder()
17+
.setItag(stream.itag!!)
18+
.setLastModified(stream.lastModified!!)
19+
.setXtags(stream.xtags ?: "")
20+
.build()
2121
}

app/src/main/java/com/github/libretube/player/manifest/SabrManifest.kt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,7 @@ class SabrManifest(
101101
companion object {
102102
private fun buildRepresentation(stream: PipedStream, format: Format) = Representation(
103103
format,
104-
stream.itag!!,
105-
stream.lastModified!!,
106-
stream.xtags,
107-
stream
104+
stream,
108105
)
109106
}
110107
}

0 commit comments

Comments
 (0)