Skip to content

Commit

Permalink
refactor(core): make muxer name pascal case
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultBee committed Jan 10, 2025
1 parent 87b7bc3 commit f659a6a
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.github.thibaultbee.streampack.core.configuration.mediadescriptor.Media
import io.github.thibaultbee.streampack.core.configuration.mediadescriptor.UriMediaDescriptor
import io.github.thibaultbee.streampack.core.elements.endpoints.IEndpointInternal
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.CompositeEndpoint
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.mp4.MP4Muxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.mp4.Mp4Muxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.sinks.FileSink
import io.github.thibaultbee.streampack.core.streamers.single.AudioConfig
import io.github.thibaultbee.streampack.core.streamers.single.CameraSingleStreamer
Expand Down Expand Up @@ -159,7 +159,7 @@ class CameraStreamerFileTest(
arrayOf(
UriMediaDescriptor(FileUtils.createCacheFile("video.mp4").toUri()),
true,
CompositeEndpoint(MP4Muxer(), FileSink())
CompositeEndpoint(Mp4Muxer(), FileSink())
),
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import io.github.thibaultbee.streampack.core.elements.encoders.CodecConfig
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.CompositeEndpoint
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.CompositeEndpoints
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.flv.FlvMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TSMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TsMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.data.TSServiceInfo
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.sinks.ContentSink
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.sinks.FileSink
Expand Down Expand Up @@ -119,7 +119,7 @@ open class DynamicEndpoint(
val endpoint = getEndpoint(mediaDescriptor.type)

if (endpoint is CompositeEndpoint) {
if (endpoint.muxer is TSMuxer) {
if (endpoint.muxer is TsMuxer) {
// Clean up services
endpoint.muxer.removeServices()
val serviceInfo = mediaDescriptor.getCustomData(TSServiceInfo::class.java)
Expand Down Expand Up @@ -183,7 +183,7 @@ open class DynamicEndpoint(
private fun getTsFileEndpoint(): IEndpointInternal {
if (tsFileEndpoint == null) {
tsFileEndpoint = CompositeEndpoint(
TSMuxer(),
TsMuxer(),
FileSink()
)
}
Expand All @@ -193,7 +193,7 @@ open class DynamicEndpoint(
private fun getTsContentEndpoint(): IEndpointInternal {
if (tsContentEndpoint == null) {
tsContentEndpoint = CompositeEndpoint(
TSMuxer(), ContentSink(context)
TsMuxer(), ContentSink(context)
)
}
return tsContentEndpoint!!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package io.github.thibaultbee.streampack.core.elements.endpoints.composites
import io.github.thibaultbee.streampack.core.elements.endpoints.IEndpointInternal
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.IMuxerInternal
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.flv.FlvMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TSMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TsMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.data.TSServiceInfo
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.sinks.ISinkInternal

Expand All @@ -31,7 +31,7 @@ object CompositeEndpoints {
*/
internal fun createSrtEndpoint(serviceInfo: TSServiceInfo?): IEndpointInternal {
val sink = createSrtSink()
val muxer = TSMuxer()
val muxer = TsMuxer()
if (serviceInfo != null) {
muxer.addService(serviceInfo)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import io.github.thibaultbee.streampack.core.elements.utils.extensions.isAudio
import io.github.thibaultbee.streampack.core.elements.utils.extensions.isVideo
import java.nio.ByteBuffer

class MP4Muxer(
class Mp4Muxer(
override var listener: IMuxerInternal.IMuxerListener? = null,
private val timescale: Int = DEFAULT_TIMESCALE,
private val segmenterFactory: MP4SegmenterFactory = DefaultMP4SegmenterFactory()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import java.nio.ByteBuffer
import java.util.MissingFormatArgumentException
import kotlin.random.Random

class TSMuxer : IMuxerInternal {
class TsMuxer : IMuxerInternal {
override val info by lazy { TSMuxerInfo }
private val tsServices = mutableListOf<Service>()
private val tsPes = mutableListOf<Pes>()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Test

class TSMuxerTest {
class TsMuxerTest {
class MockMuxerListener :
io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.IMuxerInternal.IMuxerListener {
override fun onOutputFrame(packet: io.github.thibaultbee.streampack.core.elements.data.Packet) {}
Expand All @@ -52,7 +52,7 @@ class TSMuxerTest {
val service = createFakeServiceInfo()

val tsMux =
TSMuxer().apply {
TsMuxer().apply {
addService(service)
addStreams(
service,
Expand Down Expand Up @@ -86,7 +86,7 @@ class TSMuxerTest {
)
val aStreamConfig = AudioCodecConfig(mimeType = MediaFormat.MIMETYPE_AUDIO_AAC)
try {
TSMuxer().apply {
TsMuxer().apply {
addStreams(
listOf(vStreamConfig1, vStreamConfig2, aStreamConfig)
)
Expand All @@ -99,7 +99,7 @@ class TSMuxerTest {
@Test
fun `re-add existing service test`() {
val service = createFakeServiceInfo()
val tsMux = TSMuxer().apply {
val tsMux = TsMuxer().apply {
addService(service)
}
try {
Expand Down Expand Up @@ -127,7 +127,7 @@ class TSMuxerTest {
val service = createFakeServiceInfo()

val tsMux =
TSMuxer().apply {
TsMuxer().apply {
addService(service)
addStreams(
service,
Expand Down Expand Up @@ -168,7 +168,7 @@ class TSMuxerTest {
val service = createFakeServiceInfo()

val tsMux =
TSMuxer().apply {
TsMuxer().apply {
addService(service)
addStreams(
service,
Expand All @@ -186,7 +186,7 @@ class TSMuxerTest {

@Test
fun `encode without streams test`() {
val tsMux = TSMuxer()
val tsMux = TsMuxer()
try {
tsMux.write(FakeFrames.generate(mimeType = MediaFormat.MIMETYPE_VIDEO_AVC), -1)
fail()
Expand All @@ -196,7 +196,7 @@ class TSMuxerTest {

@Test
fun `encode with key frame with extra test `() {
val tsMux = TSMuxer()
val tsMux = TsMuxer()
try {
tsMux.write(
FakeFrames.generate(mimeType = MediaFormat.MIMETYPE_VIDEO_AVC), -1
Expand All @@ -215,7 +215,7 @@ class TSMuxerTest {
)
val service = createFakeServiceInfo()

val tsMux = TSMuxer().apply {
val tsMux = TsMuxer().apply {
addService(service)
}
val streamPid =
Expand All @@ -235,7 +235,7 @@ class TSMuxerTest {
val config = AudioCodecConfig(mimeType = MediaFormat.MIMETYPE_AUDIO_AAC)
val service = createFakeServiceInfo()

val tsMux = TSMuxer().apply {
val tsMux = TsMuxer().apply {
addService(service)
}
val streamPid =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package io.github.thibaultbee.streampack.ext.srt.internal.endpoints.composites
import io.github.thibaultbee.streampack.core.configuration.mediadescriptor.createDefaultTsServiceInfo
import io.github.thibaultbee.streampack.ext.srt.internal.endpoints.composites.sinks.SrtSink
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.CompositeEndpoint
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TSMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.TsMuxer
import io.github.thibaultbee.streampack.core.elements.endpoints.composites.muxers.ts.data.TSServiceInfo

/**
Expand All @@ -30,15 +30,15 @@ fun SrtEndpoint(serviceInfo: TSServiceInfo = createDefaultTsServiceInfo()) = Srt

/**
* A SRT endpoint.
* It encapsulates a [TSMuxer] and a [SrtSink].
* It encapsulates a [TsMuxer] and a [SrtSink].
*/
class SrtEndpoint internal constructor() :
CompositeEndpoint(TSMuxer(), SrtSink()) {
CompositeEndpoint(TsMuxer(), SrtSink()) {
fun addService(serviceInfo: TSServiceInfo = createDefaultTsServiceInfo()) {
(muxer as TSMuxer).addService(serviceInfo)
(muxer as TsMuxer).addService(serviceInfo)
}

fun removeService(serviceInfo: TSServiceInfo) {
(muxer as TSMuxer).removeService(serviceInfo)
(muxer as TsMuxer).removeService(serviceInfo)
}
}

0 comments on commit f659a6a

Please sign in to comment.