This repository has been archived by the owner on Nov 14, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better timecode/realtime seconds translation
- Loading branch information
Showing
4 changed files
with
107 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// | ||
// SessionEntityTests.swift | ||
// PKitTests | ||
// | ||
// Created by Jamie Hardt on 4/7/19. | ||
// | ||
|
||
import XCTest | ||
import CoreMedia | ||
|
||
class SessionEntityTests: XCTestCase { | ||
|
||
override func setUp() { | ||
// Put setup code here. This method is called before the invocation of each test method in the class. | ||
} | ||
|
||
override func tearDown() { | ||
// Put teardown code here. This method is called after the invocation of each test method in the class. | ||
} | ||
|
||
func testDecodeTimecode() { | ||
|
||
let e = SessionEntity(rawTitle: "Test Session", sampleRate: 48000.0, bitDepth: "24 bit", startTime: "01:00:00:00", | ||
timecodeFormat: "30 Frame", trackCount: 1, clipCount: 1, filesCount: 1) | ||
|
||
let result1 = try! e.decodeTime(from: "01:00:00:00") | ||
XCTAssertEqual(result1, CMTime(value: 3600, timescale: 1) ) | ||
|
||
let result2 = try! e.decodeTime(from: "02:00:00:00") | ||
XCTAssertEqual(result2, CMTime(value: 7200, timescale: 1) ) | ||
|
||
|
||
|
||
} | ||
|
||
func testDecodeTimecode2398() { | ||
let e = SessionEntity(rawTitle: "Test Session", sampleRate: 48000.0, bitDepth: "24 bit", startTime: "01:00:00:00", | ||
timecodeFormat: "23.976 Frame", trackCount: 1, clipCount: 1, filesCount: 1) | ||
|
||
let result1 = try! e.decodeTime(from: "01:00:00:00") | ||
XCTAssertEqual(result1, CMTime(value: 3600 * 1001, timescale: 1000) ) | ||
|
||
let result2 = try! e.decodeTime(from: "02:00:00:00") | ||
XCTAssertEqual(result2, CMTime(value: 7200 * 1001, timescale: 1000) ) | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters