00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _PLAYLIST_H
00022 #define _PLAYLIST_H
00023
00024
00025 #include <vector>
00026 using std::vector;
00027 #include <string>
00028 using std::string;
00029 #include <map>
00030 using std::map;
00031 #include "smiltime.h"
00032
00033
00034
00035 #include <libxml/xmlmemory.h>
00036 #include <libxml/parser.h>
00037 #include <time.h>
00038
00039
00040
00041 class Frame;
00042 class FileHandler;
00043
00047 class PlayList
00048 {
00049 public:
00050 PlayList();
00051 PlayList( const PlayList& );
00052 PlayList& operator=( const PlayList& );
00053 ~PlayList();
00054
00055 xmlNodePtr GetBody( ) const;
00056 int GetNumFrames() const;
00057 char* GetFileNameOfFrame( int frameNum ) const;
00058 bool GetFrame( int frameNum, Frame &frame );
00059 bool GetMediaObject( int frameNum, FileHandler **media );
00060 int GetClipBegin( int frameNum ) const;
00061 int GetClipEnd( int frameNum ) const;
00062 bool SetClipBegin( int frameNum, const char* value );
00063 bool SetClipEnd( int frameNum, const char* value );
00064 int FindStartOfScene( int frameNum ) const;
00065 int FindEndOfScene( int frameNum ) const;
00066 void AutoSplit( int first, int last );
00067 bool SplitSceneBefore( int frameNum );
00068 bool JoinScenesAt( int frameNum );
00069 bool GetPlayList( int first, int last, PlayList &playlist ) const;
00070 bool InsertPlayList( PlayList &playlist, int before );
00071 bool Delete( int first, int last );
00072 bool LoadMediaObject( char *filename );
00073 bool LoadPlayList( char *filename );
00074 bool SavePlayList( char *filename, bool isLegacyFormat = false );
00075 bool SavePlayListEli( char *filename, bool isPAL );
00076 bool SavePlayListSrt( const char *filename );
00077 void CleanPlayList( xmlNodePtr node );
00078 void CleanPlayList( );
00079 bool IsFileUsed( string filename ) const;
00080 bool IsDirty( ) const;
00081 void SetDirty( bool value );
00082 string GetDocName( ) const;
00083 void GetLastCleanPlayList( PlayList &playlist );
00084 void SetDocName( string );
00085 string GetProjectDirectory( );
00086 string GetSeqAttribute( int frameNum, const char* ) const;
00087 bool SetSeqAttribute( int frameNum, const char*, const char* );
00088 bool SetDocId( const char* value );
00089 string GetDocId( ) const;
00090 bool SetDocTitle( const char* value );
00091 string GetDocTitle( ) const;
00092
00093 protected:
00094 bool dirty;
00095
00096 private:
00097 void RefreshCount();
00098 void AutoSplit( int first, time_t startTime, int last, time_t endTime, int fps );
00099 string doc_name;
00100 xmlDocPtr doc;
00101 int count;
00102 SMIL::MediaClippingTime time;
00103 };
00104
00108 class directory_utils
00109 {
00110 public:
00111 static string join_file_to_directory( const string directory, const string &file );
00112 static string get_directory_from_file( const string &file );
00113 static string get_absolute_path_to_file( const string &directory, const string &file );
00114 static string get_relative_path_to_file( const string &directory, const string &file );
00115 static string expand_directory( const string directory );
00116 };
00117
00121 class EditorBackup
00122 {
00123 private:
00124 int maxUndos;
00125 int position;
00126 vector <PlayList *> backups;
00127 public:
00128 EditorBackup();
00129 ~EditorBackup();
00130 void Store( PlayList *, bool isPersisted = true );
00131 void Undo( PlayList * );
00132 void Redo( PlayList * );
00133 void SetAllDirty( );
00134 void Clear( );
00135 bool Restore( PlayList * );
00136 };
00137
00141 extern EditorBackup *GetEditorBackup();
00142
00143
00147 class FileMap
00148 {
00149 public:
00150 virtual ~FileMap()
00151 { }
00153 virtual map<string, FileHandler*> &GetMap() = 0;
00155 virtual void Clear() = 0;
00157 virtual void GetUnusedFxFiles( PlayList &list, vector< string > &unused ) = 0;
00158 };
00159
00163 extern FileMap *GetFileMap( );
00164
00165
00166 #endif