[cvs-annodex] commit (/annodex):
phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php
ctford
nobody at lists.annodex.net
Thu Jan 5 14:59:08 EST 2006
Update of /annodex (new revision 1748)
Modified files:
phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php
Log Message:
Basic smpte supported, though the "drop" keyword isn't.
Modified: phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php
===================================================================
--- phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php 2006-01-05 02:44:03 UTC (rev 1747)
+++ phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php 2006-01-05 03:59:08 UTC (rev 1748)
@@ -2,10 +2,33 @@
class AnxSMPTE extends AnxInterval {
- const PREFIX = "smpte";
+ const PREFIX = "smpte-";
public function __construct( $string ) {
parent::__construct( $string );
+ /* Strip "smpte-" off front. */
+ $timespec = substr( $string, strlen( self::PREFIX ) );
+
+ /* Split it into start and end */
+ $fragments = explode( "-", $timespec );
+
+ /* Get frames per second. */
+ $fps = $start_hmsf[0];
+
+ /* Parse first half. */
+ $start_hmsf = explode( ":", $fragments[0] );
+ $start_seconds = 60*60*$start_hmsf[1] + 60*$start_hmsf[2]
+ + $start_hmsf[3] + $start_hmsf[4]/$fps;
+
+ /* Parse second half. */
+ $end_hmsf = explode( ":", $fragments[1] );
+ $end_seconds = 60*60*$end_hmsf[0] + 60*$end_hmsf[1]
+ + $end_hmsf[2] + $end_hmsf[3]/$fps;
+
+ /* Voila! */
+ $this->set_start( $start_seconds );
+ $this->set_end( $end_seconds );
+
}
}
--
ctford
More information about the cvs-annodex
mailing list