Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

playlist.cc File Reference

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <list>
#include <map>
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>
#include <pthread.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <dirent.h>
#include "playlist.h"
#include "error.h"
#include "filehandler.h"
#include "frame.h"
#include "stringutils.h"

Include dependency graph for playlist.cc:

Go to the source code of this file.

Typedefs

typedef bool(* callback )(xmlNodePtr node, void *p, bool *freed)
typedef list< EliInfoEliInfos
typedef EliInfos::iterator EliInfosIterator

Functions

FileMapGetFileMap ()
 The singleton method for obtain the instance of the file map.
static bool findFile (xmlNodePtr node, void *p, bool *freed)
 Finds the file corresponding to an absolute frame number.
static bool fillMap (xmlNodePtr node, void *p, bool *freed)
 Searches tree for file names not yet in our filemap.
static bool findSceneStart (xmlNodePtr node, void *p, bool *freed)
 Finds the start of a scene.
static bool findSceneEnd (xmlNodePtr node, void *p, bool *freed)
static bool countFrames (xmlNodePtr node, void *p, bool *freed)
 Count number of frames in one node.
static bool convertEli (xmlNodePtr node, void *p, bool *freed)
 Convert the xml format to ELI format.
static bool convertSrt (xmlNodePtr node, void *data, bool *freed)
static bool convertFramesToSmilTime (xmlNodePtr node, void *data, bool *freed)
static bool convertSmilTimeToFrames (xmlNodePtr node, void *data, bool *freed)
static bool clone (xmlNodePtr node, void *data, bool *freed)
static bool parse (xmlNodePtr node, callback func, void *p)
 Walk the xml tree.
static bool relativeMap (xmlNodePtr node, void *p, bool *freed)
static bool checkIfFileUsed (xmlNodePtr node, void *p, bool *freed)
 Checks if the file exists in the current playlist.
EditorBackupGetEditorBackup ()
 The singleton method for obtaining the instance of the EditorBackup.

Variables

const xmlChar * SMIL20_NAMESPACE_HREF = reinterpret_cast< const xmlChar* >( "http://www.w3.org/2001/SMIL20/Language" )
const string KINO_AUTOSAVE_DIR = string( getenv("HOME") ) + string( "/.kino-history" )


Typedef Documentation

typedef bool( * callback)(xmlNodePtr node, void *p, bool *freed)
 

Definition at line 254 of file playlist.cc.

typedef list<EliInfo> EliInfos
 

Definition at line 625 of file playlist.cc.

typedef EliInfos::iterator EliInfosIterator
 

Definition at line 626 of file playlist.cc.


Function Documentation

static bool checkIfFileUsed xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Checks if the file exists in the current playlist.

Parameters:
node a node
p pointer to a string
Returns:
true if file has been found and xml tree walk is done

Definition at line 2180 of file playlist.cc.

Referenced by PlayList::IsFileUsed().

02181 {
02182     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
02183     {
02184         // Check whether the required properties exist
02185         xmlChar * src = xmlGetProp( node, ( const xmlChar* ) "src" );
02186         string index( ( char * ) src );
02187         xmlFree( src );
02188         return *( string * ) p == index;
02189     }
02190     return false;
02191 }

static bool clone xmlNodePtr  node,
void *  data,
bool *  freed
[static]
 

Definition at line 831 of file playlist.cc.

Referenced by PlayList::operator=(), PlayList::PlayList(), and PlayList::SavePlayList().

00832 {
00833     xmlNodePtr* parent = (xmlNodePtr*) data;
00834 
00835     xmlNodePtr child = xmlNewNode( NULL, node->name );
00836     xmlAddChild( *parent, child );
00837     for ( xmlAttr* attr = node->properties; attr; attr = attr->next )
00838         xmlNewProp( child, attr->name, xmlGetProp( attr->parent, attr->name) );
00839     if ( node->children ) // next iteration in depth-first traversal will be a child
00840         *parent = child;
00841     else if ( node == node->parent->last ) // last sibling
00842         *parent = (*parent)->parent;
00843     
00844     return false;
00845 }

static bool convertEli xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Convert the xml format to ELI format.

Parameters:
node a node
p pointer to an EliInfo struct
If this is a <video> node, then add the info to p. p is a ptr to an EliInfos struct.

The node must have this format: <video src="file.avi" clipBegin="200" clipEnd="800" >

Note:
This code requires a <video> node format that is not defined in smil.

Definition at line 640 of file playlist.cc.

References EliInfo::clipBegin, EliInfo::clipEnd, and EliInfo::file.

Referenced by PlayList::SavePlayListEli().

00641 {
00642     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00643     {
00644 
00645         xmlChar * src = xmlGetProp( node, ( const xmlChar* ) "src" );
00646         xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00647         xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00648 
00649         if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00650         {
00651             /*
00652             cout << "convertEli : " << src << ", " << clipBegin << ", " << clipEnd
00653             << endl; 
00654             */
00655             EliInfos * Eli = ( EliInfos * ) p;
00656             EliInfo tmp;
00657             tmp.file = ( const char* ) src;
00658             tmp.clipBegin = ( const char* ) clipBegin;
00659             tmp.clipEnd = ( const char* ) clipEnd;
00660             Eli->push_back( tmp );
00661         }
00662 
00663         if ( clipEnd )
00664             xmlFree( clipEnd );
00665         if ( clipBegin )
00666             xmlFree( clipBegin );
00667         if ( src )
00668             xmlFree( src );
00669     }
00670     return false;
00671 }

static bool convertFramesToSmilTime xmlNodePtr  node,
void *  data,
bool *  freed
[static]
 

Definition at line 765 of file playlist.cc.

References GetFileMap(), FileHandler::GetFrame(), GetFramePool(), Frame::GetFrameRate(), SMIL::MediaClippingTime::parseFramesToString(), SMIL::MediaClippingTime::setFramerate(), and SMIL::Time::TIME_FORMAT_CLOCK.

Referenced by PlayList::SavePlayList().

00766 {
00767     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00768     {
00769         Frame *frame = GetFramePool( )->GetFrame( );
00770         xmlChar *src = xmlGetProp( node, ( const xmlChar* ) "src" );
00771         string index( ( char* ) src );
00772         xmlFree( src );
00773         FileHandler *mediaFile = GetFileMap()->GetMap() [ index ];
00774         mediaFile->GetFrame( *frame, 0 );
00775         SMIL::MediaClippingTime time;
00776         time.setFramerate( frame->GetFrameRate() );
00777         GetFramePool( )->DoneWithFrame( frame );
00778 
00779         xmlChar *prop = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00780         if ( prop )
00781         {
00782             std::string newValue = time.parseFramesToString( atoi( ( const char* ) prop ), SMIL::Time::TIME_FORMAT_CLOCK );
00783             xmlFree( prop );
00784             xmlSetProp( node, ( const xmlChar* ) "clipBegin", ( const xmlChar* ) newValue.c_str() );
00785         }
00786         prop = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00787         if ( prop )
00788         {
00789             std::string newValue = time.parseFramesToString( atoi( ( const char* ) prop ), SMIL::Time::TIME_FORMAT_CLOCK );
00790             xmlFree( prop );
00791             xmlSetProp( node, ( const xmlChar* ) "clipEnd", ( const xmlChar* ) newValue.c_str() );
00792         }
00793     }
00794     return false;
00795 }

static bool convertSmilTimeToFrames xmlNodePtr  node,
void *  data,
bool *  freed
[static]
 

Definition at line 797 of file playlist.cc.

References GetFileMap(), FileHandler::GetFrame(), GetFramePool(), Frame::GetFrameRate(), SMIL::MediaClippingTime::parseValue(), SMIL::MediaClippingTime::setFramerate(), SMIL::Time::TIME_FORMAT_FRAMES, and SMIL::MediaClippingTime::toString().

Referenced by PlayList::LoadPlayList().

00798 {
00799     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00800     {
00801         Frame *frame = GetFramePool( )->GetFrame( );
00802         xmlChar *src = xmlGetProp( node, ( const xmlChar* ) "src" );
00803         string index( ( char* ) src );
00804         xmlFree( src );
00805         FileHandler *mediaFile = GetFileMap()->GetMap() [ index ];
00806         mediaFile->GetFrame( *frame, 0 );
00807         SMIL::MediaClippingTime time;
00808         time.setFramerate( frame->GetFrameRate() );
00809         GetFramePool( )->DoneWithFrame( frame );
00810 
00811         xmlChar *prop = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00812         if ( prop )
00813         {
00814             time.parseValue( ( const char* ) prop );
00815             xmlFree( prop );
00816             std::string newValue = time.toString( SMIL::Time::TIME_FORMAT_FRAMES );
00817             xmlSetProp( node, ( const xmlChar* ) "clipBegin", ( const xmlChar* ) newValue.c_str() );
00818         }
00819         prop = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00820         if ( prop )
00821         {
00822             time.parseValue( ( const char* ) prop );
00823             xmlFree( prop );
00824             std::string newValue = time.toString( SMIL::Time::TIME_FORMAT_FRAMES );
00825             xmlSetProp( node, ( const xmlChar* ) "clipEnd", ( const xmlChar* ) newValue.c_str() );
00826         }
00827     }
00828     return false;
00829 }

static bool convertSrt xmlNodePtr  node,
void *  data,
bool *  freed
[static]
 

Definition at line 738 of file playlist.cc.

References SrtContext::abstract, SrtContext::begin, SrtContext::duration, SrtContext::printEntry(), SrtContext::src, and SrtContext::title.

Referenced by PlayList::SavePlayListSrt().

00739 {
00740     SrtContext* srt = static_cast< SrtContext* >( data );
00741     
00742     if ( xmlStrcmp( node->name, ( const xmlChar* ) "seq" ) == 0 )
00743     {
00744         srt->printEntry();
00745         srt->title = xmlGetProp( node, ( const xmlChar * ) "title" );
00746         srt->abstract = xmlGetProp( node, ( const xmlChar * ) "abstract" );
00747     }
00748     else if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00749     {
00750         xmlChar* clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00751         xmlChar* clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00752 
00753         srt->src = xmlGetProp( node, ( const xmlChar* ) "src" );
00754         if ( !srt->begin && ( srt->title || srt->abstract ) )
00755             srt->begin = srt->duration;
00756         srt->duration += atoi( ( const char* ) clipEnd ) - atoi( ( const char* ) clipBegin ) + 1;
00757 
00758         xmlFree( clipBegin );
00759         xmlFree( clipEnd );
00760     }
00761 
00762     return false;
00763 }

static bool countFrames xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Count number of frames in one node.

Parameters:
node a node
p pointer to some private data
If this is a <video> node then calculate the number of frames in this clip. p is a ptr to an integer holding the total number of frames so far.

The node must have this format: <video src="file.avi" clipBegin="200" clipEnd="800" >

Note:
This code requires a <video> node format that is not defined in smil.

Definition at line 594 of file playlist.cc.

Referenced by readThread(), and PlayList::RefreshCount().

00595 {
00596     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00597     {
00598 
00599         xmlChar * src = xmlGetProp( node, ( const xmlChar* ) "src" );
00600         xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00601         xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00602 
00603         if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00604             * ( ( int* ) p ) += atoi( ( const char* ) clipEnd ) - atoi( ( const char* ) clipBegin ) + 1;
00605 
00606         if ( clipEnd )
00607             xmlFree( clipEnd );
00608         if ( clipBegin )
00609             xmlFree( clipBegin );
00610         if ( src )
00611             xmlFree( src );
00612     }
00613     return false;
00614 }

static bool fillMap xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Searches tree for file names not yet in our filemap.

Parameters:
node a node
p pointer to a string containing the project directory
Returns:
true if file has been found and xml tree walk is done

Definition at line 365 of file playlist.cc.

References directory_utils::get_absolute_path_to_file(), GetFileMap(), and FileHandler::Open().

Referenced by PlayList::GetPlayList(), PlayList::InsertPlayList(), and PlayList::LoadPlayList().

00366 {
00367     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00368     {
00369 
00370         // Check whether the required properties exist
00371 
00372         xmlChar * src = xmlGetProp( node, ( const xmlChar* ) "src" );
00373         xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00374         xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00375 
00376         if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00377         {
00378 
00379             // Determine the absolute path to the file indicated by src
00380             string & directory = *( string * ) p;
00381             string index = directory_utils::get_absolute_path_to_file( directory, ( char * ) src );
00382 
00383             // Internally, we always use absolute paths so convert now, just to be on the safe side
00384             xmlSetProp( node, ( const xmlChar* ) "src", ( xmlChar * ) index.c_str() );
00385 
00386             // Check if the file actually exists in the file map
00387             if ( GetFileMap() ->GetMap().find( index ) == GetFileMap() ->GetMap().end() )
00388             {
00389 
00390                 FileHandler * mediaFile;
00391                 /* determine file type */
00392                 if ( strncasecmp( strrchr( ( char* ) src, '.' ), ".avi", 4 ) == 0 )
00393                     mediaFile = new AVIHandler();
00394                 else if ( strncasecmp( strrchr( ( char* ) src, '.' ), ".dv", 3 ) == 0 ||
00395                           strncasecmp( strrchr( ( char* ) src, '.' ), ".dif", 4 ) == 0 )
00396                     mediaFile = new RawHandler();
00397 #ifdef HAVE_LIBQUICKTIME
00398 
00399                 else if ( strncasecmp( strrchr( ( char* ) src, '.' ), ".mov", 4 ) == 0 )
00400                     mediaFile = new QtHandler();
00401 #endif
00402 
00403                 else
00404                 {
00405                     xmlFree( src );
00406                     xmlFree( clipEnd );
00407                     xmlFree( clipBegin );
00408                     return false;
00409                 }
00410                 /* construct appropriate filehandler */
00411                 if ( mediaFile->Open( index.c_str() ) )
00412                 {
00413                     GetFileMap() ->GetMap() [ index ] = mediaFile;
00414                 }
00415                 else
00416                 {
00417                     cerr << "Unable to open " << ( char * ) src
00418                     << " - removing from list" << endl;
00419                     xmlUnlinkNode( node );
00420                     xmlFreeNode( node );
00421                     *freed = true;
00422                 }
00423             }
00424         }
00425 
00426         xmlFree( src );
00427         xmlFree( clipEnd );
00428         xmlFree( clipBegin );
00429     }
00430     return false;
00431 }

static bool findFile xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Finds the file corresponding to an absolute frame number.

The absolute frame number is passed in MovieInfo.absFrame. If found, the MovieInfo struct is filled:

absFrame: some absolute frame number absBegin: absolute frame number of movie start absEnd: absolute frame number of movie end clipFrame: corresponding relative frame number clipBegin: corresponding relative frame number clipEnd: corresponding relative frame number clipNumber: clipLength: frame count in this clip fileName: its file name sequence: node ptr to its <seq> node video: node ptr to its <video> node

Parameters:
node a node
p pointer to MovieInfo struct
Returns:
true if file has been found and xml tree walk is done

Definition at line 293 of file playlist.cc.

References MovieInfo::absBegin, MovieInfo::absEnd, MovieInfo::absFrame, MovieInfo::clipBegin, MovieInfo::clipEnd, MovieInfo::clipFrame, MovieInfo::clipLength, MovieInfo::clipNumber, MovieInfo::fileName, MovieInfo::sequence, and MovieInfo::video.

Referenced by PlayList::AutoSplit(), PlayList::GetFileNameOfFrame(), PlayList::GetFrame(), PlayList::GetMediaObject(), PlayList::GetPlayList(), and PlayList::InsertPlayList().

00294 {
00295     MovieInfo * data = ( MovieInfo* ) p;
00296 
00297     if ( xmlStrcmp( node->name, ( const xmlChar* ) "seq" ) == 0 )
00298     {
00299         data->sequence = node;
00300         data->clipNumber++;
00301     }
00302 
00303     // if this is a <video> node, calculate its absolute begin and end positions
00304 
00305     else if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00306     {
00307 
00308         data->video = node;
00309 
00310         // Check whether the required properties exist
00311 
00312         xmlChar *src = xmlGetProp( node, ( const xmlChar* ) "src" );
00313         xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00314         xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00315 
00316         if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00317         {
00318 
00319             data->clipBegin = atoi( ( const char* ) clipBegin );
00320             data->clipEnd = atoi( ( const char* ) clipEnd );
00321 
00322             data->absBegin += data->clipLength; // add length of previous clip
00323             data->clipLength = data->clipEnd - data->clipBegin + 1;
00324             data->absEnd = data->absBegin + data->clipLength - 1;
00325 
00326             // cerr << "Number: " << data->clipNumber << " starts " << data->absBegin << " ends " << data->absEnd << endl;
00327 
00328             // if absFrame is within this scene, we have found the corresponding file.
00329             // Otherwise, add frame count of this scene to absBegin
00330 
00331             if ( data->absFrame <= data->absEnd )
00332             {
00333                 strcpy( data->fileName, ( char * ) src );
00334                 data->clipFrame = data->absFrame - data->absBegin + data->clipBegin;
00335 
00336                 // Free memory used
00337                 xmlFree( src );
00338                 xmlFree( clipEnd );
00339                 xmlFree( clipBegin );
00340 
00341                 // cerr << "Obtaining frame " << data->clipFrame << " from " << data->clipNumber << endl;
00342 
00343                 return true; // true means done traversing xml tree
00344             }
00345         }
00346 
00347         if ( src )
00348             xmlFree( src );
00349         if ( clipEnd )
00350             xmlFree( clipEnd );
00351         if ( clipBegin )
00352             xmlFree( clipBegin );
00353 
00354     }
00355     return false;
00356 }

static bool findSceneEnd xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Definition at line 516 of file playlist.cc.

References MovieInfo::absBegin, MovieInfo::absEnd, MovieInfo::absFrame, MovieInfo::clipBegin, MovieInfo::clipEnd, MovieInfo::clipFrame, MovieInfo::fileName, MovieInfo::sequence, and MovieInfo::video.

Referenced by PlayList::FindEndOfScene(), PlayList::GetClipEnd(), PlayList::JoinScenesAt(), PlayList::SetClipEnd(), and PlayList::SplitSceneBefore().

00517 {
00518     bool found = false;
00519     xmlChar *src = NULL;
00520     MovieInfo *data = ( MovieInfo* ) p;
00521 
00522     // if this is a <seq> node process all of its <video> child nodes
00523 
00524     if ( xmlStrcmp( node->name, ( const xmlChar* ) "seq" ) == 0 )
00525     {
00526 
00527         data->sequence = node;
00528 
00529         node = node->children;
00530         while ( node != NULL )
00531         {
00532             if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00533             {
00534 
00535                 data->video = node;
00536 
00537                 if ( src )
00538                     xmlFree( src );
00539 
00540                 src = xmlGetProp( node, ( const xmlChar* ) "src" );
00541                 xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00542                 xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00543 
00544                 if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00545                 {
00546 
00547                     data->clipBegin = atoi( ( const char* ) clipBegin );
00548                     data->clipEnd = atoi( ( const char* ) clipEnd );
00549                     data->clipFrame = data->clipEnd;
00550 
00551                     if ( data->absFrame <= data->absBegin + data->clipEnd - data->clipBegin )
00552                         found = true;
00553                     data->absBegin += ( data->clipEnd - data->clipBegin + 1 );
00554                 }
00555 
00556                 if ( clipEnd )
00557                     xmlFree( clipEnd );
00558                 if ( clipBegin )
00559                     xmlFree( clipBegin );
00560             }
00561             node = node->next;
00562         }
00563 
00564         if ( found )
00565         {
00566             strcpy( data->fileName, ( char * ) src );
00567             xmlFree( src );
00568             data->absEnd = data->absBegin - 1;
00569             return true;
00570         }
00571 
00572         if ( src )
00573             xmlFree( src );
00574     }
00575     data->clipFrame = 0;
00576     strcpy( data->fileName, "" );
00577     return false;
00578 }

static bool findSceneStart xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Finds the start of a scene.

Parameters:
node a node
p pointer to some private data
Returns:
true if file has been found and xml tree walk is done
If the scene has been found in the playlist, the file name and first frame number are returned in the private data.

Definition at line 443 of file playlist.cc.

References MovieInfo::absBegin, MovieInfo::absFrame, MovieInfo::clipBegin, MovieInfo::clipEnd, MovieInfo::clipFrame, MovieInfo::fileName, MovieInfo::sequence, and MovieInfo::video.

Referenced by PlayList::FindStartOfScene(), PlayList::GetClipBegin(), PlayList::GetSeqAttribute(), PlayList::JoinScenesAt(), PlayList::SetClipBegin(), PlayList::SetSeqAttribute(), and PlayList::SplitSceneBefore().

00444 {
00445     int fileCount = 0;
00446     MovieInfo *data = ( MovieInfo* ) p;
00447     int begin = data->absBegin;
00448 
00449     // if this is a <seq> node process all of its <video> child nodes
00450 
00451     if ( xmlStrcmp( node->name, ( const xmlChar* ) "seq" ) == 0 )
00452     {
00453 
00454         data->sequence = node;
00455 
00456         node = node->children;
00457         while ( node != NULL )
00458         {
00459             if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
00460             {
00461 
00462                 data->video = node;
00463 
00464                 xmlChar *src = xmlGetProp( node, ( const xmlChar* ) "src" );
00465                 xmlChar *clipBegin = xmlGetProp( node, ( const xmlChar* ) "clipBegin" );
00466                 xmlChar *clipEnd = xmlGetProp( node, ( const xmlChar* ) "clipEnd" );
00467 
00468                 if ( ( src != NULL ) && ( clipBegin != NULL ) && ( clipEnd != NULL ) )
00469                 {
00470 
00471                     data->clipBegin = atoi( ( const char* ) clipBegin );
00472                     data->clipEnd = atoi( ( const char* ) clipEnd );
00473 
00474                     // if this is the first file remember its name and start
00475 
00476                     if ( fileCount == 0 )
00477                     {
00478                         data->clipFrame = data->clipBegin;
00479                         strcpy( data->fileName, ( char * ) src );
00480                     }
00481 
00482                     // if absFrame is within current scene we are done.
00483                     // fine name and relative frame number have been already found (see above)
00484                     // otherwise update absBegin to hold abs frame num of next file
00485 
00486                     if ( data->absFrame <= begin + data->clipEnd - data->clipBegin )
00487                     {
00488                         xmlFree( clipBegin );
00489                         xmlFree( clipEnd );
00490                         xmlFree( src );
00491                         return true;
00492                     }
00493                     else
00494                     {
00495                         begin += ( data->clipEnd - data->clipBegin + 1 );
00496                     }
00497                     fileCount++;
00498                 }
00499                 if ( src )
00500                     xmlFree( src );
00501                 if ( clipEnd )
00502                     xmlFree( clipEnd );
00503                 if ( clipBegin )
00504                     xmlFree( clipBegin );
00505             }
00506             node = node->next;
00507         }
00508     }
00509     data->absBegin = begin;
00510     data->clipFrame = 0;
00511     strcpy( data->fileName, "" );
00512     return false;
00513 }

EditorBackup* GetEditorBackup  ) 
 

The singleton method for obtaining the instance of the EditorBackup.

Definition at line 2561 of file playlist.cc.

References backup.

Referenced by bulkLoad(), PageEditor::DeleteFrames(), PageTrim::insertScene(), KinoCommon::loadFile(), KinoCommon::loadPlayList(), KinoCommon::newFile(), PageEditor::PasteFrames(), PageTrim::processCommand(), PageEditor::processCommand(), PlayList::SavePlayList(), PageTrim::saveScene(), PageEditor::snapshot(), and PageCapture::stopCapture().

02562 {
02563     static EditorBackup * backup = new EditorBackup( );
02564     return backup;
02565 }

FileMap* GetFileMap  ) 
 

The singleton method for obtain the instance of the file map.

Definition at line 104 of file playlist.cc.

Referenced by PlayList::AutoSplit(), convertFramesToSmilTime(), convertSmilTimeToFrames(), fillMap(), PlayList::GetFrame(), PlayList::GetMediaObject(), PageTrim::insertScene(), PlayList::LoadMediaObject(), KinoCommon::newFile(), SrtContext::printEntry(), PageTrim::saveScene(), PageTrim::start(), and KinoCommon::~KinoCommon().

00105 {
00106     static FileMap * thismap = new KinoFileMap( );
00107     return thismap;
00108 }

static bool parse xmlNodePtr  node,
callback  func,
void *  p
[static]
 

Walk the xml tree.

Parameters:
node the root node
func the function to execute on each node
p storage to some private data for func
This function is usually called with the root node of an XML tree. It calls the user supplied callback function on each node and then visits recursively all child nodes.

If the callback function returns true the xml tree walk is aborted.

Definition at line 861 of file playlist.cc.

Referenced by PlayList::AutoSplit(), PlayList::FindEndOfScene(), PlayList::FindStartOfScene(), PlayList::GetClipBegin(), PlayList::GetClipEnd(), PlayList::GetFileNameOfFrame(), PlayList::GetFrame(), PlayList::GetMediaObject(), PlayList::GetPlayList(), PlayList::GetSeqAttribute(), PlayList::InsertPlayList(), PlayList::IsFileUsed(), PlayList::JoinScenesAt(), PlayList::LoadPlayList(), PlayList::operator=(), PlayList::PlayList(), PlayList::RefreshCount(), PlayList::SavePlayList(), PlayList::SavePlayListEli(), PlayList::SavePlayListSrt(), PlayList::SetClipBegin(), PlayList::SetClipEnd(), PlayList::SetSeqAttribute(), and PlayList::SplitSceneBefore().

00862 {
00863     bool done = false;
00864 
00865     while ( node != NULL && done == false )
00866     {
00867         bool freed = false;
00868         xmlNodePtr next = node->next;
00869         done = ( *func ) ( node, p, &freed );
00870         if ( !done && !freed && node->children )
00871             done = parse( node->children, func, p );
00872         node = next;
00873     }
00874     return done;
00875 }

static bool relativeMap xmlNodePtr  node,
void *  p,
bool *  freed
[static]
 

Definition at line 1941 of file playlist.cc.

References directory_utils::get_relative_path_to_file().

Referenced by PlayList::SavePlayList().

01942 {
01943     if ( xmlStrcmp( node->name, ( const xmlChar* ) "video" ) == 0 )
01944     {
01945         // Check whether the required properties exist
01946         xmlChar * src = xmlGetProp( node, ( const xmlChar* ) "src" );
01947 
01948         if ( src != NULL )
01949         {
01950             // Determine the absolute path to the file indicated by src
01951             string & directory = *( string * ) p;
01952             string index = directory_utils::get_relative_path_to_file( directory, ( char * ) src );
01953 
01954             // Save to relative file now
01955             xmlSetProp( node, ( const xmlChar* ) "src", ( xmlChar * ) index.c_str() );
01956         }
01957 
01958         xmlFree( src );
01959     }
01960     return false;
01961 }


Variable Documentation

const string KINO_AUTOSAVE_DIR = string( getenv("HOME") ) + string( "/.kino-history" )
 

Definition at line 59 of file playlist.cc.

Referenced by EditorBackup::Restore(), and EditorBackup::Store().

const xmlChar* SMIL20_NAMESPACE_HREF = reinterpret_cast< const xmlChar* >( "http://www.w3.org/2001/SMIL20/Language" )
 

Definition at line 58 of file playlist.cc.

Referenced by PlayList::LoadPlayList(), PlayList::operator=(), PlayList::PlayList(), and PlayList::SavePlayList().


Generated on Sun Mar 11 22:12:32 2007 for Kino by  doxygen 1.4.2