Changeset 1748

Show
Ignore:
Timestamp:
2006-01-04 19:59:08 (3 years ago)
Author:
ctford
Message:

Basic smpte supported, though the "drop" keyword isn't.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • phpannodex/trunk/phpsrc/AnxInterval/AnxSMPTE.php

    r1735 r1748  
    33class AnxSMPTE extends AnxInterval { 
    44 
    5         const PREFIX = "smpte"; 
     5        const PREFIX = "smpte-"; 
    66 
    77        public function __construct( $string ) { 
    88                parent::__construct( $string ); 
    99 
     10                /* Strip "smpte-" off front. */ 
     11                $timespec = substr( $string, strlen( self::PREFIX ) ); 
     12 
     13                /* Split it into start and end */ 
     14                $fragments = explode( "-", $timespec ); 
     15 
     16                /* Get frames per second. */ 
     17                $fps = $start_hmsf[0]; 
     18 
     19                /* Parse first half. */ 
     20                $start_hmsf = explode( ":", $fragments[0] ); 
     21                $start_seconds = 60*60*$start_hmsf[1] + 60*$start_hmsf[2]  
     22                        + $start_hmsf[3] + $start_hmsf[4]/$fps; 
     23                         
     24                /* Parse second half. */ 
     25                $end_hmsf = explode( ":", $fragments[1] ); 
     26                $end_seconds = 60*60*$end_hmsf[0] + 60*$end_hmsf[1]  
     27                        + $end_hmsf[2] + $end_hmsf[3]/$fps; 
     28 
     29                /* Voila! */ 
     30                $this->set_start( $start_seconds ); 
     31                $this->set_end( $end_seconds ); 
     32 
    1033        } 
    1134}