Skip to content
This repository has been archived by the owner on Oct 4, 2024. It is now read-only.

Commit

Permalink
Update print statements.
Browse files Browse the repository at this point in the history
  • Loading branch information
sturmen committed Jan 25, 2024
1 parent 19281c9 commit 8e94626
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions Sources/SpatialMediaKit/SpatialVideoSplitter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class SpatialVideoSplitter {

func incrementFrameCountAndLog() {
completedFrames += 1
print("encoded \(completedFrames) frames")
print("\rencoded \(completedFrames) frames", terminator: "")
}

func getCurrentFrameCount() -> Int {
Expand All @@ -32,12 +32,12 @@ public class SpatialVideoSplitter {

func createOutputUrl(outputFilename: String, outputDir: String?) throws -> URL {
let outputDir = outputDir ?? FileManager.default.currentDirectoryPath
print("writing output files to \(outputDir)")
let outputUrl = URL(fileURLWithPath: outputDir)
.appendingPathComponent(outputFilename)
if try !checkFileOverwrite(path: outputUrl.path()) {
throw MediaError.createOutputError
}
print("output file set to \(outputUrl)")
return outputUrl
}

Expand Down Expand Up @@ -117,7 +117,8 @@ public class SpatialVideoSplitter {
return true
}

print("Overwrite existing file? [y/N]: ")
print("File already exists: \(path)")
print("Overwrite existing file? [y/N]: ", terminator: "")

guard let userInput = readLine() else {
print("aborting!")
Expand Down Expand Up @@ -200,9 +201,9 @@ public class SpatialVideoSplitter {
while assetReader.status == .reading {
guard let nextSampleBuffer = assetReaderTrackOutput.copyNextSampleBuffer() else {
if assetReader.status == .completed {
print("finished reading all of \(filePath)")
print("\nfinished reading all of \(filePath)")
} else {
print("advancing due to null sample, reader status is \(assetReader.status)")
print("\nadvancing due to null sample, reader status is \(assetReader.status)")
}
leftAdaptor.assetWriterInput.markAsFinished()
rightAdaptor.assetWriterInput.markAsFinished()
Expand All @@ -216,7 +217,7 @@ public class SpatialVideoSplitter {
let encodingTimeoutResult = semaphore.wait(timeout: .now() + 60 * 60 * 24)
switch encodingTimeoutResult {
case .success:
print("encoding completed, flushing to disk... ")
print("finished encoding, flushing bytes to disk... ")
case .timedOut:
print("encoding file processing time exceeded hardcoded limit of 24 hours")
}
Expand Down

0 comments on commit 8e94626

Please sign in to comment.