Index: trunk/extensions/MetavidWiki/skins/mv_embed/flvServer/MvFlv.php |
— | — | @@ -3,88 +3,91 @@ |
4 | 4 | include_once 'FLV/FLV.php'; |
5 | 5 | |
6 | 6 | define('MAX_FLV_TS', 16777.216);//it appears tag times restart after 16777.216 seconds; |
7 | | -define('KEY_FRAME_DISTANCE', 2); //max keyframe distance |
| 7 | +define('KEY_FRAME_DISTANCE', 2); //max keyframe distance |
8 | 8 | |
9 | | -//define('META_KFDATA_EXT', '.KfMeta'); //file extension for cached keframe metadata |
| 9 | +//define('META_KFDATA_EXT', '.KfMeta'); //file extension for cached keframe metadata |
10 | 10 | define('META_DATA_EXT', '.meta'); //basic cached meta |
11 | 11 | |
12 | 12 | class MyFLV extends FLV { |
13 | | - |
| 13 | + |
14 | 14 | /** |
15 | | - * On audio-only files the frame index will use this as minimum gap |
| 15 | + * On audio-only files the frame index will use this as minimum gap |
16 | 16 | */ |
17 | 17 | private $audioFrameGap = 3; |
18 | | - |
| 18 | + |
19 | 19 | private $origMetaOfs = 0; |
20 | 20 | private $origMetaSize = 0; |
21 | 21 | private $origMetaData; |
22 | 22 | private $compMetaData; |
23 | | - |
| 23 | + |
24 | 24 | //added segment vars: |
25 | 25 | private $fullMeta=null; |
26 | 26 | private $mDuration=null; |
27 | 27 | var $wrapTimeCount=0; |
28 | | - |
| 28 | + |
29 | 29 | function getKeyFrameByteTimes( $start_time_sec, $end_time_sec=null ){ |
30 | | - //print "play $start_time_sec to $end_time_sec"; |
| 30 | + //print "play $start_time_sec to $end_time_sec"; |
31 | 31 | //@@todo cache byte offsets in memcache if available |
32 | 32 | if( $end_time_sec) |
33 | 33 | $this->mDuration = $end_time_sec - $start_time_sec; |
34 | | - //print "SET metaDuration to: " . $this->metaDuration . "\n"; |
| 34 | + //print "SET metaDuration to: " . $this->metaDuration . "\n"; |
35 | 35 | //print_r($fullMeta); |
36 | | - $meta =& $this->getKeyFrameMetaData(); |
| 36 | + $meta = $this->getKeyFrameMetaData(); |
37 | 37 | //die; |
38 | | - $start_byte=$end_byte=null; |
39 | | - if($start_time_sec==0 && $end_time_sec==null)$this->play(); |
| 38 | + $start_byte=$end_byte=null; |
| 39 | + |
| 40 | + if($start_time_sec==0 && $end_time_sec==null) |
| 41 | + $this->play(); |
| 42 | + |
40 | 43 | $start_time_ms = $start_time_sec*1000; |
41 | | - $end_time_ms = ($end_time_sec==null)?null:$end_time_sec*1000; |
42 | | - |
43 | | - for($i=0; $i < count($meta['times']); $i++){ |
| 44 | + $end_time_ms = ($end_time_sec==null)?null:$end_time_sec*1000; |
| 45 | + |
| 46 | + for($i=0; $i < count($meta['times']); $i++){ |
44 | 47 | //set to the keyframe right before a keyframe of the requested start time |
45 | 48 | if($meta['times'][$i] >= $start_time_ms && $start_byte==null){ |
46 | 49 | $start_byte=(isset($meta['times'][$i-1]))?$meta['filepositions'][$i-1]:$meta['filepositions'][$i]; |
47 | | - if($end_time_ms==null)break; |
| 50 | + if($end_time_ms==null)break; |
48 | 51 | } |
49 | | - //set to the keyframe right after the keyframe of the end time: |
| 52 | + //set to the keyframe right after the keyframe of the end time: |
50 | 53 | if($end_time_ms!=null){ |
51 | 54 | if($meta['times'][$i] >= $end_time_ms){ |
52 | 55 | $end_byte= $meta['filepositions'][$i]; |
53 | 56 | break; |
54 | | - } |
55 | | - } |
56 | | - } |
| 57 | + } |
| 58 | + } |
| 59 | + } |
57 | 60 | return array($start_byte, $end_byte); |
58 | 61 | } |
59 | | - function playTimeReq( $start_time_sec, $end_time_sec=null ){ |
60 | | - //print "play $start_time_sec to $end_time_sec"; |
| 62 | + function playTimeReq( $start_time_sec, $end_time_sec=null ){ |
| 63 | + //print "play $start_time_sec to $end_time_sec"; |
61 | 64 | //@@todo cache byte offsets in memcache if available |
62 | 65 | if( $end_time_sec) |
63 | 66 | $this->mDuration = $end_time_sec - $start_time_sec; |
64 | | - //print "SET metaDuration to: " . $this->metaDuration . "\n"; |
| 67 | + //print "SET metaDuration to: " . $this->metaDuration . "\n"; |
65 | 68 | //print_r($fullMeta); |
66 | | - $meta =& $this->getKeyFrameMetaData(); |
| 69 | + $meta =& $this->getKeyFrameMetaData(); |
67 | 70 | //die; |
68 | | - $start_byte=$end_byte=null; |
| 71 | + $start_byte=$end_byte=null; |
69 | 72 | if($start_time_sec==0 && $end_time_sec==null)$this->play(); |
70 | 73 | $start_time_ms = $start_time_sec*1000; |
71 | | - $end_time_ms = ($end_time_sec==null)?null:$end_time_sec*1000; |
72 | | - |
73 | | - for($i=0; $i < count($meta['times']); $i++){ |
| 74 | + $end_time_ms = ($end_time_sec==null)?null:$end_time_sec*1000; |
| 75 | + |
| 76 | + for($i=0; $i < count($meta['times']); $i++){ |
74 | 77 | //set to the keyframe right before a keyframe of the requested start time |
75 | 78 | if($meta['times'][$i]>=$start_time_ms && $start_byte==null){ |
76 | 79 | $start_byte=(isset($meta['times'][$i-1]))?$meta['filepositions'][$i-1]:$meta['filepositions'][$i]; |
77 | | - if($end_time_ms==null)break; |
| 80 | + if($end_time_ms==null)break; |
78 | 81 | } |
79 | | - //set to the keyframe right after the keyframe of the end time: |
| 82 | + //set to the keyframe right after the keyframe of the end time: |
80 | 83 | if($end_time_ms!=null){ |
81 | 84 | if($meta['times'][$i]>=$end_time_ms){ |
82 | 85 | $end_byte= $meta['filepositions'][$i]; |
83 | 86 | break; |
84 | | - } |
85 | | - } |
86 | | - } |
87 | | - $this->play($start_byte, $end_byte); |
88 | | - } |
| 87 | + } |
| 88 | + } |
| 89 | + } |
| 90 | + $this->play($start_byte, $end_byte); |
| 91 | + } |
89 | 92 | function computeMetaData() |
90 | 93 | { |
91 | 94 | ini_set("max_execution_time","0");//computeMetaData can take some time |
— | — | @@ -95,69 +98,69 @@ |
96 | 99 | $this->compMetaData['keyframes']['filepositions'] = array(); |
97 | 100 | $this->compMetaData['keyframes']['times'] = array(); |
98 | 101 | $this->compMetaData['lasttimestamp'] = -1; |
99 | | - |
| 102 | + |
100 | 103 | $this->origMetaOfs = 0; |
101 | 104 | $this->origMetaSize = 0; |
102 | 105 | $this->origMetaData = null; |
103 | | - |
| 106 | + |
104 | 107 | $skipTagTypes = array(); |
105 | 108 | while ($tag = $this->getTag( $skipTagTypes )) |
106 | 109 | { |
107 | 110 | // pre-calculate the timestamp as seconds |
108 | | - $ts = $tag->timestamp/1000; |
109 | | - if ($tag->timestamp > 0 && $tag->type==FLV_Tag::TYPE_VIDEO ){ |
| 111 | + $ts = $tag->timestamp/1000; |
| 112 | + if ($tag->timestamp > 0 && $tag->type==FLV_Tag::TYPE_VIDEO ){ |
110 | 113 | $ts = (MAX_FLV_TS*$this->wrapTimeCount) + $ts; |
111 | 114 | if($ts < $this->compMetaData['lasttimestamp']){ |
112 | 115 | $this->wrapTimeCount++; |
113 | 116 | $ts = MAX_FLV_TS + $ts; |
114 | | - } |
| 117 | + } |
115 | 118 | //print "set end time to $ts \n"; |
116 | | - $this->compMetaData['lasttimestamp'] = $ts; |
117 | | - } |
118 | | - |
| 119 | + $this->compMetaData['lasttimestamp'] = $ts; |
| 120 | + } |
| 121 | + |
119 | 122 | switch ($tag->type) |
120 | 123 | { |
121 | | - case FLV_Tag::TYPE_VIDEO : |
| 124 | + case FLV_Tag::TYPE_VIDEO : |
122 | 125 | //Optimization, extract the frametype without analyzing the tag body |
123 | 126 | if ((ord($tag->body[0]) >> 4) == FLV_Tag_Video::FRAME_KEYFRAME) |
124 | 127 | { |
125 | 128 | $this->compMetaData['keyframes']['filepositions'][] = $this->getTagOffset(); |
126 | 129 | $this->compMetaData['keyframes']['times'][] = $ts; |
127 | 130 | } |
128 | | - |
| 131 | + |
129 | 132 | if ( !in_array(FLV_TAG::TYPE_VIDEO, $skipTagTypes) ) |
130 | 133 | { |
131 | 134 | $this->compMetaData['width'] = $tag->width; |
132 | 135 | $this->compMetaData['height'] = $tag->height; |
133 | 136 | $this->compMetaData['videocodecid'] = $tag->codec; |
134 | | - //Processing one video tag is enough |
| 137 | + //Processing one video tag is enough |
135 | 138 | array_push( $skipTagTypes, FLV_Tag::TYPE_VIDEO ); |
136 | | - } |
| 139 | + } |
137 | 140 | break; |
138 | | - |
| 141 | + |
139 | 142 | case FLV_Tag::TYPE_AUDIO : |
140 | | - |
141 | | - //Save audio frame positions when there is no video |
| 143 | + |
| 144 | + //Save audio frame positions when there is no video |
142 | 145 | /*if (!$flv->hasVideo && $ts - $oldTs > $this->audioFrameGap) |
143 | 146 | { |
144 | 147 | $this->compMetaData['keyframes']['filepositions'][] = $this->getTagOffset(); |
145 | 148 | $this->compMetaData['keyframes']['times'][] = $ts; |
146 | 149 | $oldTs = $ts; |
147 | 150 | } |
148 | | - |
149 | | - if ( !in_array( FLV_Tag::TYPE_AUDIO, $skipTagTypes) ) |
| 151 | + |
| 152 | + if ( !in_array( FLV_Tag::TYPE_AUDIO, $skipTagTypes) ) |
150 | 153 | { |
151 | 154 | $this->compMetaData['audiocodecid'] = $tag->codec; |
152 | 155 | $this->compMetaData['audiofreqid'] = $tag->frequency; |
153 | 156 | $this->compMetaData['audiodepthid'] = $tag->depth; |
154 | 157 | $this->compMetaData['audiomodeid'] = $tag->mode; |
155 | | - |
| 158 | + |
156 | 159 | //Processing one audio tag is enough |
157 | 160 | array_push( $skipTagTypes, FLV_Tag::TYPE_AUDIO ); |
158 | 161 | } */ |
159 | | - |
| 162 | + |
160 | 163 | break; |
161 | | - |
| 164 | + |
162 | 165 | case FLV_Tag::TYPE_DATA : |
163 | 166 | if ($tag->name == 'onMetaData') |
164 | 167 | { |
— | — | @@ -167,19 +170,19 @@ |
168 | 171 | } |
169 | 172 | break; |
170 | 173 | } |
171 | | - |
| 174 | + |
172 | 175 | //Does this actually help with memory allocation? |
173 | 176 | unset($tag); |
174 | 177 | } |
175 | | - |
| 178 | + |
176 | 179 | if (! empty($this->compMetaData['keyframes']['times'])) |
177 | 180 | $this->compMetaData['lastkeyframetimestamp'] = $this->compMetaData['keyframes']['times'][ count($this->compMetaData['keyframes']['times'])-1 ]; |
178 | | - |
| 181 | + |
179 | 182 | $this->compMetaData['duration'] = $this->compMetaData['lasttimestamp']; |
180 | | - |
| 183 | + |
181 | 184 | return $this->compMetaData; |
182 | 185 | } |
183 | | - |
| 186 | + |
184 | 187 | function setMetaData( $metadata, $origMetaOfs = 0, $origMetaSize = 0 ) |
185 | 188 | { |
186 | 189 | $this->compMetaData = $metadata; |
— | — | @@ -191,50 +194,50 @@ |
192 | 195 | { |
193 | 196 | if($this->fullMeta)return $this->fullMeta; |
194 | 197 | if(is_file($this->fname . META_DATA_EXT)){ |
195 | | - $this->fullMeta = unserialize(file_get_contents ($this->fname . META_DATA_EXT)); |
| 198 | + $this->fullMeta = unserialize(file_get_contents ($this->fname . META_DATA_EXT)); |
196 | 199 | }else{ |
197 | 200 | $this->computeMetaData(); |
198 | 201 | if (! is_array($this->origMetaData)){ |
199 | 202 | $this->fullMeta = $this->compMetaData; |
200 | 203 | }else{ |
201 | 204 | $this->fullMeta = array_merge( $this->origMetaData, $this->compMetaData ); |
202 | | - } |
203 | | - //free non-merged arrays: |
| 205 | + } |
| 206 | + //free non-merged arrays: |
204 | 207 | unset($this->origMetaData); |
205 | | - unset($this->compMetaData); |
| 208 | + unset($this->compMetaData); |
206 | 209 | //convert floats to int |
207 | 210 | foreach($this->fullMeta['keyframes']['times'] as $inx=>& $ts){ |
208 | 211 | $ts = (int)($ts*1000); |
209 | | - } |
| 212 | + } |
210 | 213 | if(!file_put_contents($this->fname . META_DATA_EXT, serialize($this->fullMeta))){ |
211 | 214 | throw( new FLV_FileException('Unable to write out cached keyframe output to '.$this->fname) ); |
212 | | - } |
213 | | - } |
| 215 | + } |
| 216 | + } |
214 | 217 | return $this->fullMeta; |
215 | 218 | } |
216 | 219 | function getKeyFrameMetaData(){ |
217 | | - $meta = & $this->getMetaData(); |
| 220 | + $meta = $this->getMetaData(); |
218 | 221 | return $meta['keyframes']; |
219 | 222 | } |
220 | 223 | function getSegmentMetaData(){ |
221 | 224 | //pull base cached metadata |
222 | 225 | //update duration & return new array |
223 | | - $meta = & $this->getMetaData(); |
224 | | - $meta['keyframes'] = array(); |
225 | | - //@@todo update all the other metadata to match segment outupt |
| 226 | + $meta = $this->getMetaData(); |
| 227 | + $meta['keyframes'] = array(); |
| 228 | + //@@todo update all the other metadata to match segment outupt |
226 | 229 | return $meta; |
227 | | - } |
| 230 | + } |
228 | 231 | function play( $from = 0, $play_to=null ) |
229 | 232 | { |
230 | 233 | fseek($this->fp, 0); |
231 | | - |
| 234 | + |
232 | 235 | // get original file header just in case it has any special flag |
233 | 236 | echo fread($this->fp, $this->bodyOfs + 4); |
234 | | - |
| 237 | + |
235 | 238 | // output the metadata if available |
236 | | - $meta = $this->getSegmentMetaData(); |
| 239 | + $meta = $this->getSegmentMetaData(); |
237 | 240 | //$meta = $this->getMetaData(); |
238 | | - |
| 241 | + |
239 | 242 | if (! empty($meta)) |
240 | 243 | { |
241 | 244 | //serialize the metadata as an AMF stream |
— | — | @@ -252,25 +255,25 @@ |
253 | 256 | $out.= pack('N', 0); |
254 | 257 | //StreamID |
255 | 258 | $out.= pack('Cn', 0, 0); |
256 | | - |
| 259 | + |
257 | 260 | echo $out; |
258 | 261 | echo $serMeta; |
259 | | - |
| 262 | + |
260 | 263 | // PrevTagSize for the metadata |
261 | 264 | echo pack('N', strlen($serMeta) + strlen($out) ); |
262 | 265 | } |
263 | | - |
| 266 | + |
264 | 267 | $chunkSize = 4096; |
265 | 268 | $skippedOrigMeta = empty($this->origMetaSize); |
266 | | - //seek to offset point: |
| 269 | + //seek to offset point: |
267 | 270 | fseek($this->fp, $from); |
268 | 271 | while (! feof($this->fp)) |
269 | 272 | { |
270 | 273 | // if the original metadata is present and not yet skipped... |
271 | 274 | if (! $skippedOrigMeta) |
272 | | - { |
| 275 | + { |
273 | 276 | $pos = ftell($this->fp); |
274 | | - |
| 277 | + |
275 | 278 | // check if we are going to output it in this loop step |
276 | 279 | if ( $pos <= $this->origMetaOfs && |
277 | 280 | $pos + $chunkSize > $this->origMetaOfs ) |
— | — | @@ -278,10 +281,10 @@ |
279 | 282 | // output the bytes just before the original metadata tag |
280 | 283 | if ($this->origMetaOfs - $pos > 0) |
281 | 284 | echo fread($this->fp, $this->origMetaOfs - $pos); |
282 | | - |
| 285 | + |
283 | 286 | // position the file pointer just after the metadata tag |
284 | 287 | fseek($this->fp, $this->origMetaOfs + $this->origMetaSize); |
285 | | - |
| 288 | + |
286 | 289 | $skippedOrigMeta = true; |
287 | 290 | continue; |
288 | 291 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/flvServer/FLV/Util/AMFSerialize.php |
— | — | @@ -46,7 +46,7 @@ |
47 | 47 | */ |
48 | 48 | function serialize( $var, $skipMark = false ) |
49 | 49 | { |
50 | | - $number=''; |
| 50 | + $number = ''; |
51 | 51 | // process objects as hashed arrays |
52 | 52 | if ( is_object( $var ) ) |
53 | 53 | $var = (array)$var; |
— | — | @@ -94,7 +94,6 @@ |
95 | 95 | return ( $skipMark ? '':"\x01" ) . ( $var ? "\x01" : "\x00" ); |
96 | 96 | |
97 | 97 | } else if ( is_numeric( $var ) ) { |
98 | | - |
99 | 98 | $number .= pack( 'd', $var ); |
100 | 99 | |
101 | 100 | // reverse bytes if we are in little-endian hardware |
— | — | @@ -121,7 +120,8 @@ |
122 | 121 | if ( $this->isLittleEndian ) |
123 | 122 | $tz = strrev( $tz ); |
124 | 123 | } |
125 | | - |
| 124 | + if(!isset($tz)) |
| 125 | + $tz=''; |
126 | 126 | return ( $skipMark ? '':"\x0B" ) . $this->serialize( (float)$ms, true ) . pack( 'n', $tz ); |
127 | 127 | } |
128 | 128 | |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/flvServer/mvFlvServer.php |
— | — | @@ -1,15 +1,15 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | | - * mv_flvServer.php |
| 4 | + * mv_flvServer.php |
5 | 5 | * |
6 | 6 | * @date Jul 25, 2008 |
7 | | - * |
| 7 | + * |
8 | 8 | * this should enable serving segments of flv files |
9 | | - * |
| 9 | + * |
10 | 10 | * called with: mv_flvServer.php?file=myClip.flv&t=0:01:00/0:02:00 |
11 | | - * |
| 11 | + * |
12 | 12 | * flash does not like get arguments in media files? so best to use mod-rewrite |
13 | | - * something like: |
| 13 | + * something like: |
14 | 14 | * /flvserver/my_file/start_time/end_time |
15 | 15 | */ |
16 | 16 | define('BASE_LOCAL_CLIP_PATH', '/metavid/video_archive'); |
— | — | @@ -24,12 +24,11 @@ |
25 | 25 | if(!function_exists('filter_input')){ |
26 | 26 | die('you version of php lacks <b>filter_input()</b> function</br>'); |
27 | 27 | } |
28 | | - |
29 | 28 | do_request(); |
30 | 29 | function do_request(){ |
31 | 30 | $file_req = filter_input(INPUT_GET, 'file', FILTER_SANITIZE_STRING); |
32 | 31 | $time_req = filter_input(INPUT_GET, 't', FILTER_SANITIZE_STRING); |
33 | | - |
| 32 | + |
34 | 33 | //try to grab the file from /filename format |
35 | 34 | if($file_req==''){ |
36 | 35 | if(isset($_SERVER['PHP_SELF'])){ |
— | — | @@ -43,12 +42,15 @@ |
44 | 43 | $file_req = str_replace(array('../','./'), '', $file_req); |
45 | 44 | if($file_req=='')die('error: missing file name'); |
46 | 45 | $file_loc =BASE_LOCAL_CLIP_PATH.'/'.$file_req; |
47 | | - if(!is_file($file_loc))die('error: requested file not found'); |
48 | | - |
49 | | - //if 't' is empty no seeking necessary: |
50 | | - if($time_req==''){ |
| 46 | + if(!is_file($file_loc)) |
| 47 | + die('error: requested file not found:'. $file_loc); |
| 48 | + |
| 49 | + //if 't' is empty no seeking necessary: |
| 50 | + if( $time_req == '' ){ |
| 51 | + header('Content-type: '.FLASH_VIDEO_CONTENT_TYPE); |
| 52 | + header('Content-Length: ' . filesize($file_loc) ); |
51 | 53 | output_full_file($file_loc); |
52 | | - }else{ |
| 54 | + }else{ |
53 | 55 | //@@todo support more time request formats |
54 | 56 | if(strpos( $time_req,'/')!==false){ |
55 | 57 | list($start_time_ntp, $end_time_ntp)=explode('/',$time_req); |
— | — | @@ -57,12 +59,13 @@ |
58 | 60 | }else{ |
59 | 61 | $start_sec = npt2seconds($time_req); |
60 | 62 | $end_sec = null; |
61 | | - if($start_sec==0)output_full_file($file_loc); |
| 63 | + if( $start_sec==0 ) |
| 64 | + output_full_file($file_loc); |
62 | 65 | } |
63 | 66 | if($start_sec > $end_sec)die('error: requested invalid time range'); |
64 | 67 | //print "DO: $start_sec $end_sec \n"; |
65 | 68 | require_once('MvFlv.php'); |
66 | | - //open up the metavid Flv object: |
| 69 | + //open up the metavid Flv object: |
67 | 70 | $flv = new MyFLV(); |
68 | 71 | try { |
69 | 72 | $flv->open( $file_loc ); |
— | — | @@ -71,15 +74,15 @@ |
72 | 75 | } |
73 | 76 | header('Content-type: '.FLASH_VIDEO_CONTENT_TYPE); |
74 | 77 | $one_year = 60*60*24*365; |
75 | | - header("Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM"); |
| 78 | + header("Expires: " . gmdate( "D, d M Y H:i:s", time() + $one_year ) . " GM"); |
76 | 79 | //small meta file to parse no big deal: |
77 | 80 | list($start_byte, $end_byte) = $flv->getKeyFrameByteTimes($start_sec, $end_sec); |
78 | | - //send out content length: |
| 81 | + //send out content length: |
79 | 82 | header('Content-Length: ' . ($end_byte - $start_byte) ); |
80 | | - $flv->play($start_byte, $end_byte); |
| 83 | + $flv->play($start_byte, $end_byte); |
81 | 84 | //$end = microtime(true); |
82 | | - //file_put_contents('/tmp/time.log', "<hr/>EXTRACT METADATA PROCESS TOOK " . number_format(($end-$start), 2) . " seconds<br/>"); |
83 | | - $flv->close(); |
| 85 | + //file_put_contents('/tmp/time.log', "<hr/>EXTRACT METADATA PROCESS TOOK " . number_format(($end-$start), 2) . " seconds<br/>"); |
| 86 | + $flv->close(); |
84 | 87 | } |
85 | 88 | } |
86 | 89 | |
— | — | @@ -88,13 +91,13 @@ |
89 | 92 | header('Content-Type: '.FLASH_VIDEO_CONTENT_TYPE); |
90 | 93 | while (ob_get_level() > 0) { |
91 | 94 | ob_end_flush(); |
92 | | - } //turn off output buffering |
| 95 | + } //turn off output buffering |
93 | 96 | @readfile($file_loc); |
94 | 97 | die(); |
95 | 98 | } |
96 | 99 | |
97 | 100 | function npt2seconds($str_time){ |
98 | | - $time_ary = explode(':', $str_time); |
| 101 | + $time_ary = explode(':', $str_time); |
99 | 102 | $hours=$min=$sec=0; |
100 | 103 | if(count($time_ary)==3){ |
101 | 104 | $hours=$time_ary[0]; |
— | — | @@ -105,7 +108,7 @@ |
106 | 109 | $sec=$time_ary[1]; |
107 | 110 | }else if(count($time_ary)==1){ |
108 | 111 | $sec=$time_ary[0]; |
109 | | - } |
| 112 | + } |
110 | 113 | return ($hours*3600) + ($min*60) + $sec; |
111 | 114 | } |
112 | 115 | ?> |