00001 #include "filexml.h"
00002 #include "keyframe.h"
00003
00004 #include <stdio.h>
00005 #include <string.h>
00006
00007
00008
00009 KeyFrame::KeyFrame()
00010 : Auto()
00011 {
00012 data[0] = 0;
00013 }
00014
00015 KeyFrame::KeyFrame(EDL *edl, KeyFrames *autos)
00016 : Auto(edl, (Autos*)autos)
00017 {
00018 data[0] = 0;
00019 }
00020 KeyFrame::~KeyFrame()
00021 {
00022 }
00023
00024 void KeyFrame::load(FileXML *file)
00025 {
00026
00027
00028
00029
00030
00031 file->read_text_until("/KEYFRAME", data, MESSAGESIZE);
00032
00033 }
00034
00035 void KeyFrame::copy(int64_t start, int64_t end, FileXML *file, int default_auto)
00036 {
00037
00038 file->tag.set_title("KEYFRAME");
00039 if(default_auto)
00040 file->tag.set_property("POSITION", 0);
00041 else
00042 file->tag.set_property("POSITION", position - start);
00043
00044 if(is_default && !default_auto)
00045 file->tag.set_property("DEFAULT", 1);
00046 file->append_tag();
00047
00048
00049
00050
00051 file->append_text(data);
00052
00053
00054 file->tag.set_title("/KEYFRAME");
00055 file->append_tag();
00056 file->append_newline();
00057 }
00058
00059
00060 void KeyFrame::copy_from(Auto *that)
00061 {
00062 copy_from((KeyFrame*)that);
00063 }
00064
00065 void KeyFrame::copy_from(KeyFrame *that)
00066 {
00067 Auto::copy_from(that);
00068 KeyFrame *keyframe = (KeyFrame*)that;
00069 strcpy(data, keyframe->data);
00070 position = keyframe->position;
00071 }
00072
00073
00074 int KeyFrame::identical(KeyFrame *src)
00075 {
00076 return !strcasecmp(src->data, data);
00077 }
00078
00079
00080 int KeyFrame::operator==(Auto &that)
00081 {
00082 return identical((KeyFrame*)&that);
00083 }
00084
00085 int KeyFrame::operator==(KeyFrame &that)
00086 {
00087 return identical(&that);
00088 }
00089
00090
00091 void KeyFrame::dump()
00092 {
00093 printf(" position: %lld\n", position);
00094 printf(" data: %s\n", data);
00095 }