Changeset 7124
- Timestamp:
- 01/30/10 07:13:54 (7 months ago)
- Files:
-
- 1 modified
-
trunk/liquidsoap/src/stream/frame.ml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/stream/frame.ml
r7075 r7124 393 393 * invalidation of all data after the given position. *) 394 394 let content_of_type frame pos content_type = 395 let rec aux acc = function 395 (* Start_pos indicates the start of the first layer, 396 * acc contains the previous layers in reverse order, 397 * and we're walking through the next layers. *) 398 let rec aux start_pos acc = function 396 399 | [] -> assert false 397 400 | (end_pos,content)::l -> 398 if end_pos<=pos then aux ((end_pos,content)::acc) l else 401 if end_pos<=pos then aux end_pos ((end_pos,content)::acc) l else 402 (* We are starting somewhere inside that layer. *) 399 403 if content_has_type content content_type then begin 400 404 if l=[] then assert (end_pos = !!size) else … … 402 406 content 403 407 end else begin 404 let acc = 405 if pos=0 then acc else (pos,content)::acc 406 in 407 let content = create_content content_type in 408 frame.contents <- List.rev ((!!size, content)::acc) ; 409 content 408 if pos=start_pos then 409 (* We are erasing the current layer. *) 410 match acc with 411 | (end_pos,content)::acc 412 when content_has_type content content_type -> 413 (* We must re-use the previous layer. *) 414 frame.contents <- List.rev ((!!size, content)::acc) ; 415 content 416 | _ -> 417 let content = create_content content_type in 418 frame.contents <- List.rev ((!!size, content)::acc) ; 419 content 420 else 421 let acc = (pos,content)::acc in 422 let content = create_content content_type in 423 frame.contents <- List.rev ((!!size, content)::acc) ; 424 content 410 425 end 411 426 in 412 aux [] frame.contents427 aux 0 [] frame.contents 413 428 414 429 let blit_content src src_pos dst dst_pos len =
