edl plugin names eng, fix segv for opengl brender, renderfarm rework strategy, perf...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / indexfile.C
index 5958efa5f85a08aaee6c6b50957d4521d1d95c41..eb9184f91a7e589e7582d979195997eefe5eda0e 100644 (file)
@@ -103,12 +103,12 @@ static int udf_volume_id(const char *path, char *fname)
                if( strncmp(ISO_STANDARD_ID,id.id,sizeof(id.id)) ) continue;
                // look for volume_id
                if( !isalnum(id.volume_id[0]) ) continue;
-               char *bp = &id.volume_id[0], *cp = fname;
+               char *bp = (char*)&id.volume_id[0], *cp = fname;
                for( int i=0; i<(int)sizeof(id.volume_id); ++i ) *cp++ = *bp++;
                while( --cp>=fname && *cp==' ' ) *cp = 0;
                if( !*fname ) continue;
                // fname = volume_id _ creation_date
-               ++cp;  *cp++ = '_';  bp = &id.creation_date[0];
+               ++cp;  *cp++ = '_';  bp = (char*)&id.creation_date[0];
                for( int i=0; i<(int)sizeof(id.creation_date)-1; ++i ) {
                        if( !isdigit(*bp) ) break;
                        *cp++ = *bp++;
@@ -141,7 +141,6 @@ IndexFile::IndexFile(MWindow *mwindow,
        this->mwindow = mwindow;
        this->indexable = indexable;
        redraw_timer = new Timer;
-
        if(indexable)
        {
                indexable->add_user();
@@ -336,7 +335,7 @@ int IndexFile::open_source()
                command.realtime = 0;
                cache = new CICache(mwindow->preferences);
                render_engine = new RenderEngine(0,
-                       mwindow->preferences, 0, 0, 0);
+                       mwindow->preferences, 0, 0);
                render_engine->set_acache(cache);
                render_engine->arm_command(&command);
                FileSystem fs;
@@ -433,6 +432,9 @@ SET_TRACE
 
 // open the source file
        if(open_source()) return 1;
+       source_channels = indexable->get_audio_channels();
+       source_samplerate = indexable->get_sample_rate();
+       source_length = indexable->get_audio_samples();
 
 SET_TRACE
 
@@ -445,7 +447,7 @@ SET_TRACE
 
 // Some file formats have their own sample index.
 // Test for index in stream table of contents
-       if(source && !source->get_index(index_filename))
+       if(source && !source->get_index(this, progress))
        {
                IndexState *index_state = get_state();
                index_state->index_status = INDEX_READY;
@@ -738,9 +740,7 @@ SET_TRACE
        int prev_y2 = center_pixel;
        int first_frame = 1;
        int zoom_y = mwindow->edl->local_session->zoom_y, zoom_y2 = zoom_y / 2;
-       int max_y = canvas->get_h();
-       int zmax_y = center_pixel + zoom_y2 - 1;
-       if( zmax_y < max_y ) max_y = zmax_y;
+       int max_y = center_pixel + zoom_y2 - 1;
 SET_TRACE
 
        for(int bufferposition = 0;
@@ -868,16 +868,19 @@ int IndexFile::read_info(Indexable *test_indexable)
 // Read the file format & index state.
                if(test_indexable->is_asset)
                {
-                       Asset *asset = (Asset*)test_indexable;
+                       Asset *test_asset = (Asset *)test_indexable;
+                       Asset *asset = new Asset;
                        asset->read(&xml);
-
+                       int ret = 0;
 //printf("IndexFile::read_info %d %f\n", __LINE__, asset->get_frame_rate());
 
-                       if(asset->format == FILE_UNKNOWN)
-                       {
+                       if( asset->format == FILE_UNKNOWN ||
+                           test_asset->format != asset->format ) {
 if(debug) printf("IndexFile::read_info %d\n", __LINE__);
-                               return 1;
+                               ret = 1;
                        }
+                       asset->remove_user();
+                       if( ret ) return ret;
                }
                else
                {