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|Timecodetime to start with.$frameRate:floatframe rate to calculate the timecode.$dropFrame:boolindicates 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|Timecodeindicating the value to be added.$operation:intused to get the sign oftime.return:TimecodeReference to theTimecodeobject.
subtract($time)
Substracts a timecode or a frame count to the current Timecode object.
$time:int|String|Timecodeindicating the value to be added.return:TimecodeReference to theTimecodeobject.
setHours($hours)
Directly set object hours.
$hours:intindicating the value to be setted.
setMinutes($minutes)
Directly set object minutes.
$minutes:intindicating the value to be setted.
setSeconds($seconds)
Directly set object seconds.
$seconds:intindicating the value to be setted.
setFrames($frames)
Directly set object frames.
$frames:intindicating the value to be setted.
setFrameCount($frameCount)
Directly set object frame count. This will recalculate all other attributes, so use it with care.
$frameCount:intindicating the value to be setted.
Static Methods
frameCountFromTimecode($time, $frameRate = null, $dropFrame = null)
Returns the frame count from a time.
$time:Stringtime as string to calculate.$frameRate:floatframe rate to calculate the timecode.$dropFrame:boolindicates if is drop frame.return:intreturns the frame count
fromSeconds($seconds, $frameRate = null, $dropFrame = null)
Instantiate a new object from seconds instead of timecode/framecount.
$seconds:intseconds to convert$frameRate:floatframe rate to calculate the timecode.$dropFrame:boolindicates if is drop frame.return:TimecodeReturns the newly created object
setDefaultFrameRate($frameRate)
Change default frame rate to instantiate objects with.
$frameRate:floatNew default frame rate.
setDefaultDropFrame($dropFrame)
Change default drop frame to instantiate objects with.
$dropFrame:floatNew default drop frame.
Contributing
All contribution is welcome, please feel free to open tickets and pull requests.
License
MIT.