Ark Server API (ASA) - Wiki
Loading...
Searching...
No Matches
QualifiedFrameTime.h
Go to the documentation of this file.
1// Copyright Epic Games, Inc. All Rights Reserved.
2
3#pragma once
4
5#include "Misc/FrameRate.h"
6#include "Misc/FrameTime.h"
7#include "Misc/Timecode.h"
8
9/**
10 * A frame time qualified by a frame rate context
11 */
13{
14
15 /**
16 * Default construction for UObject purposes
17 */
19 : Time(0), Rate(24, 1)
20 {}
21
22 /**
23 * User construction from a frame time and its frame rate
24 */
25 FQualifiedFrameTime(const FFrameTime& InTime, const FFrameRate& InRate)
26 : Time(InTime), Rate(InRate)
27 {}
28
29 /**
30 * User construction from a timecode and its frame rate
31 */
32 FQualifiedFrameTime(const FTimecode& InTimecode, const FFrameRate& InRate)
33 : Time(InTimecode.ToFrameNumber(InRate))
34 , Rate(InRate)
35 {
36 }
37
38public:
39
40 /**
41 * Convert this frame time to a value in seconds
42 */
43 double AsSeconds() const
44 {
45 return Time / Rate;
46 }
47
48 /**
49 * Convert this frame time to a different frame rate
50 */
51 FFrameTime ConvertTo(FFrameRate DesiredRate) const
52 {
53 return FFrameRate::TransformTime(Time, Rate, DesiredRate);
54 }
55
56 /**
57 * Create an FTimecode from this qualified frame time.
58 *
59 * Any subframe value in the frame time will be ignored.
60 * Whether or not the returned timecode is a drop-frame timecode will be determined by the qualified frame time's frame rate
61 * and the CVar specifying whether to generate drop-frame timecodes by default for supported frame rates.
62 */
64 {
66 }
67
68 /**
69 * Create an FTimecode from this qualified frame time. Optionally supports creating a drop-frame timecode,
70 * which drops certain timecode display numbers to help account for NTSC frame rates which are fractional.
71 *
72 * @param bDropFrame If true, the returned timecode will drop the first two frames on every minute (except when Minute % 10 == 0).
73 * This is only valid for NTSC framerates (29.97, 59.94) and will assert if you try to create a drop-frame timecode
74 * from a non-valid framerate. All framerates can be represented by non-drop timecode.
75 */
76 FTimecode ToTimecode(bool bDropFrame) const
77 {
79 }
80
81public:
82
83 /** The frame time */
85
86 /** The rate that this frame time is in */
88};
static FFrameTime TransformTime(FFrameTime SourceTime, FFrameRate SourceRate, FFrameRate DestinationRate)
Definition FrameRate.h:293
friend double operator/(FFrameTime FrameTime, FFrameRate Rate)
Definition FrameRate.h:196
FFrameRate(uint32 InNumerator, uint32 InDenominator)
Definition FrameRate.h:30
FFrameTime(FFrameNumber InFrameNumber)
Definition FrameTime.h:236
FFrameNumber FloorToFrame() const
Definition FrameTime.h:258
FTimecode ToTimecode(bool bDropFrame) const
FQualifiedFrameTime(const FFrameTime &InTime, const FFrameRate &InRate)
FFrameTime ConvertTo(FFrameRate DesiredRate) const
FTimecode ToTimecode() const
FQualifiedFrameTime(const FTimecode &InTimecode, const FFrameRate &InRate)
static FTimecode FromFrameNumber(const FFrameNumber &InFrameNumber, const FFrameRate &InFrameRate)
Definition Timecode.h:225
FFrameNumber ToFrameNumber(const FFrameRate &InFrameRate) const
Definition Timecode.h:87
static FTimecode FromFrameNumber(const FFrameNumber &InFrameNumber, const FFrameRate &InFrameRate, bool InbDropFrame)
Definition Timecode.h:140