Download the PHP package fireworkweb/smpte without Composer
On this page you can find all versions of the php package fireworkweb/smpte. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fireworkweb/smpte
More information about fireworkweb/smpte
Files in fireworkweb/smpte
Package smpte
Short Description Easily deal with Timecode SMPTE format in PHP
License MIT
Informations about the package smpte
smpte.php
Easily deal with SMPTE Timecode format in PHP. If you need a Javascript lib, check out fireworkweb/smpte.js.
Installation
You can install the package via composer:
Usage
Include the Timecode or Validations classes:
You can instantiate it directly using new:
Or you can use the static helper:
Properties
Property | Type | Description |
---|---|---|
getFrameCount() |
int |
Total number of frames |
getHours() |
int |
Hours number |
getMinutes() |
int |
Minutes number |
getSeconds() |
int |
Seconds number |
getFrames() |
int |
Frames number |
durationInSeconds() |
int |
Timecode duration in seconds |
Object Methods
__construct($time = 0, $frameRate = null, $dropFrame = null)
$time
:int|String|Timecode
time to start with.$frameRate
:float
frame rate to calculate the timecode.$dropFrame
:bool
indicates if is drop frame. ONLY WITH 29.97 FPS
$time
as int is the frame count to be setted with. To deal with seconds, use fromSeconds
.
Note: if $frameRate
or $dropFrame
are null, it will use the default.
toString()
/ __toString()
Returns a timecode string representation.
add($time, $operation = 1)
Adds a timecode or a frame count to the current Timecode object.
$time
:int|String|Timecode
indicating the value to be added.$operation
:int
used to get the sign oftime
.return
:Timecode
Reference to theTimecode
object.
subtract($time)
Substracts a timecode or a frame count to the current Timecode object.
$time
:int|String|Timecode
indicating the value to be added.return
:Timecode
Reference to theTimecode
object.
setHours($hours)
Directly set object hours.
$hours
:int
indicating the value to be setted.
setMinutes($minutes)
Directly set object minutes.
$minutes
:int
indicating the value to be setted.
setSeconds($seconds)
Directly set object seconds.
$seconds
:int
indicating the value to be setted.
setFrames($frames)
Directly set object frames.
$frames
:int
indicating the value to be setted.
setFrameCount($frameCount)
Directly set object frame count. This will recalculate all other attributes, so use it with care.
$frameCount
:int
indicating the value to be setted.
Static Methods
frameCountFromTimecode($time, $frameRate = null, $dropFrame = null)
Returns the frame count from a time.
$time
:String
time as string to calculate.$frameRate
:float
frame rate to calculate the timecode.$dropFrame
:bool
indicates if is drop frame.return
:int
returns the frame count
fromSeconds($seconds, $frameRate = null, $dropFrame = null)
Instantiate a new object from seconds instead of timecode/framecount.
$seconds
:int
seconds to convert$frameRate
:float
frame rate to calculate the timecode.$dropFrame
:bool
indicates if is drop frame.return
:Timecode
Returns the newly created object
setDefaultFrameRate($frameRate)
Change default frame rate to instantiate objects with.
$frameRate
:float
New default frame rate.
setDefaultDropFrame($dropFrame)
Change default drop frame to instantiate objects with.
$dropFrame
:float
New default drop frame.
Contributing
All contribution is welcome, please feel free to open tickets and pull requests.
License
MIT.