| | 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 | |
|---|