the data structure and implement of core

data structure:
1.global variable:
(1)gbL
in Scilab, we use a global variable gbL to store timelines, objects, and transitions. it is a tlist.
gbL=tlist(['gbL';'VA';'VB';'VT';'V2';'V3';'V4'],list(),list(),list(),list(),list(),list());
according to initialization of gbL, we can know that there are 6 timelines. and there are neither objects nor transitions stored in gbL. if you want to add an object to a timeline(VA for example),you can only add the object to the list VA point to. this is the same to transition.
(2)source_list
we use a global variable source_list to store the materials which were imported.
(3)attribution of the project
_Width:the width of the outport video.
_Height:the height of the outport video.
_Fps:the fps of the outport video.
_BitRate:the bits of the outport video.
_Duration: the normal duration of a image object.
(4)other
gbL_id:id of the next new object.
mod_filename:filename of the mask the transition is using.
mod_martix:martix of the mask the transition is using.

2.important data structure
(1)object
in Scilab, we use the following data structure to describe an object:
tlist(['object';'id';'source';'start_time';'end_time';'filters';'motion';'clarity';'merge';'temp'],id,...
source,start_t,end_t,list(),list(),list(),tlist(['merge';'label';'key';'mask'],0,list(),0),0)
'id' identifies the object,'source' points to the material,'start_time' and 'end_time' are the start time and end time of the object,'filters' points to the list of the object's filters,'motion' stores the information of motion of the object,and 'clarity' stores the information of the object's transparency, 'merge' points to the mode of merge,'temp' can store a frame when we face a vedio.
(2)transition
we use the following data structure to describe an transition:
list(id,fun_name,start_t,end_t,start_r,end_r,direct,mod);
'id' identifies the transition,'fun_name' is the function of the transition, 'start_t' and 'end_t' are the start time and end time of the transition, 'start_r' and 'end_r' are the start rate and the end rate of the transition ,'direct'is the direction of the transition(VA->VB or VB->VA),'mod' expresses if the transition uses a template.
(3)source
we use the following data structure to store the information of the object's material:
tlist(['obj';'source';'till';'fps';'address';'total';'now_f'],0,0,0,path,1,0);
when the material is a video,'source' points to the id of the opened video file,'till' identifies that it is a video or a image,'fps' expresses the fps of the video file ,'total' stores the number of total frames of the video file,'now_f' show that how many frames we have read from the video file,'address' indicates the path of the multimedia file.
(4)filter
the data structure is used to store the information of a filter.
tlist(['filter';'function';'argument'],function_name,list());
'function' points to the function of the filter,'argument' points to a list which stores the arguments of the filter.
(5)motion_keyframe
the data structure is used to store the key frames of the motion.
tlist(['key';'time';'position';'size';'rate'],0,list(x,y),list(width,heigth),0);
'time' stored the key frame is which frame of the video file,'position' indicates position of the key frame,'size' show the size of the key frame,and 'rate' expresses the angle of the key frame.
(6)clarity_keyframe
the data structure is used to store the key frames of the transparency.
tlist(['key';'time';'rate'],0,0);
'time' stored the key frame is which frame of the video file,'rate' shows the transparency of the key frame.
(7)merge
the data structure is used to store the mode of merge,
tlist(['merge';'label';'key';'mask'],0,list(),0)
'label' identifies the mode of merge,0 is the normal mode(merge with the last frame directly),1 merge with a mask martix,and 2 merge through filtrating a key coloring matter,when the mode is 2 ,'key' stores a key coloring matter(r,g,b),when the mode is 1 ,'mask' stores a mask martix.

implement:
the global variable stores all information of the object.according to the information we preview or render one frame.when we deal with one frame, we first deal with VA and VB's filters、motion and transparency, after that we pass the results to the transition function,then we deal with V3's filters、motion and transparency, merge the result of V3 and the result of the transition with the mode of the merge,now we get the result of the merge.we do the same action with V4 and V5.now we get the final result of one frame.we can preview the last result or write the result to the given file.