-w and -h for with -z (zoom), load and play samplelist with -l commandline option, save current playing sample and pb mode, use veejay's memset,memcpy and malloc in avilib.c,fix crash on loading illegal video files, warn user with popup error if sample loading fails

git-svn-id: svn://code.dyne.org/veejay/trunk@745 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
Niels Elburg
2007-01-30 22:14:23 +00:00
parent e23e485f94
commit 9a1d992fb6
10 changed files with 364 additions and 226 deletions

View File

@@ -2376,6 +2376,40 @@ void ParseEffects(xmlDocPtr doc, xmlNodePtr cur, sample_info * skel, int start_a
}
}
void LoadCurrentPlaying( xmlDocPtr doc, xmlNodePtr cur , int *id, int *mode )
{
unsigned char *chTemp = NULL;
unsigned char *xmlTemp = NULL;
while (cur != NULL)
{
if (!xmlStrcmp(cur->name, (const xmlChar *) "PLAYING_ID")) {
xmlTemp = xmlNodeListGetString(doc,cur->xmlChildrenNode,1 );
chTemp = UTF8toLAT1(xmlTemp);
if(chTemp) {
int s_id = atoi(chTemp );
*id = s_id;
xmlFree(chTemp);
}
if( xmlTemp ) free(xmlTemp);
}
if( !xmlStrcmp(cur->name, (const xmlChar*) "PLAYING_MODE" ))
{
xmlTemp = xmlNodeListGetString( doc,cur->xmlChildrenNode,1 );
chTemp = UTF8toLAT1( xmlTemp );
if(chTemp ) {
int s_pm = atoi( chTemp );
*mode = s_pm;
xmlFree(chTemp);
}
if( xmlTemp ) free(xmlTemp);
}
cur = cur->next;
}
}
void LoadSequences( xmlDocPtr doc, xmlNodePtr cur, void *seq )
{
seq_t *s = (seq_t*) seq;
@@ -2733,7 +2767,7 @@ void LoadSubtitles( sample_info *skel, char *file, void *font )
vj_font_load_srt( font, tmp );
}
int sample_readFromFile(char *sampleFile, void *seq, void *font, void *el)
int sample_readFromFile(char *sampleFile, void *seq, void *font, void *el,int *id, int *mode)
{
xmlDocPtr doc;
xmlNodePtr cur;
@@ -2789,6 +2823,11 @@ int sample_readFromFile(char *sampleFile, void *seq, void *font, void *el)
}
}
if( !xmlStrcmp( cur->name, (const xmlChar*) "CURRENT" )) {
LoadCurrentPlaying( doc, cur->xmlChildrenNode, id, mode );
}
if( !xmlStrcmp( cur->name, (const xmlChar *) "SEQUENCE" )) {
LoadSequences( doc, cur->xmlChildrenNode,seq );
}
@@ -2916,6 +2955,18 @@ void SaveSequences( xmlNodePtr node, void *seq )
}
void SaveCurrentPlaying( xmlNodePtr node, int id, int mode )
{
char buffer[100];
sprintf(buffer, "%d", id );
xmlNewChild(node, NULL, (const xmlChar*) "PLAYING_ID",
(const xmlChar*) buffer );
sprintf(buffer, "%d", mode );
xmlNewChild(node,NULL, (const xmlChar*) "PLAYING_MODE",
(const xmlChar*) mode );
}
void CreateSample(xmlNodePtr node, sample_info * sample, void *font)
{
char buffer[100];
@@ -3043,7 +3094,7 @@ void WriteSubtitles( sample_info *next_sample, void *font, char *file )
vj_font_set_dict( font, d );
}
int sample_writeToFile(char *sampleFile, void *seq, void *font)
int sample_writeToFile(char *sampleFile, void *seq, void *font, int id, int mode)
{
int i;
char *encoding = "UTF-8";
@@ -3060,6 +3111,10 @@ int sample_writeToFile(char *sampleFile, void *seq, void *font)
(const xmlChar*) "SEQUENCE", NULL );
SaveSequences( childnode, seq );
childnode = xmlNewChild( rootnode, NULL, (const xmlChar*) "CURRENT" , NULL );
SaveCurrentPlaying( childnode , id, mode );
for (i = 1; i < sample_size(); i++) {
next_sample = sample_get(i);