2 acquire video thumbnail for each position
3 transform video_thumbnail to media frame_key
4 mark frames which exist in video_frames
7 acquire video thumbnail for mark position
8 transform video_thumbnail to media frame_key
9 find frame_key in video_frames giving video_frame_id
10 best = bad -- for every commercial using this frame
11 foreach clip_set in timelines matching (video_frame_id)
12 score = 0 -- for every frame in the commercial
13 foreach timeline_sequence matching (clip_set_id, seq_no++)
14 acquire video frame (now-offset)
15 transform video_thumbnail to media frame_key
16 access video_frame(video_frame_id);
17 compute error frame_key against video_frame(frame_key)
19 if score > best then break
21 if score < best score then best = score
23 if best is bad then exit
24 perform action for best match
25 reset position past match
30 acquire video thumbnail for current position
31 transform video_thumbnail to media frame_key
32 find frame_key in video_frames giving video_frame_id
33 if found, playback = commercial
34 save clip_set,seq_no and start_offset of timelines matching (video_frame_id)
35 perform highest priority action for matching clip_set
37 while commercial playback
38 acquire video thumbnail for next position
39 transform video_thumbnail to media frame_key
40 find frame_key in video_frames giving video_frame_id
43 foreach timelines matching video_frame_id
44 search saved clip_set for time_line clip_set_id
45 if not found : continue
46 if( time_line sequence_no != saved ++seq_no )
47 delete saved clip_set, empty save set : break
49 access timeline_sequence(clip_set(i),++seq_no(i)) giving next_time_line
50 if( next_time_line.offset-start_offset(i) == playtime ) playback = commerial, break