nested clips, big rework and cleanup, sams new icons, leaks and tweaks
[goodguy/history.git] / cinelerra-5.1 / cinelerra / fileogg.C
index 4f24a88e989702cf7fe398b8f155657d838052c1..b413066d200db285eca71ff11b3d6205e967e779 100644 (file)
@@ -100,10 +100,8 @@ FileOGG::~FileOGG()
 }
 
 void FileOGG::get_parameters(BC_WindowBase *parent_window,
-       Asset *asset,
-       BC_WindowBase* &format_window,
-       int audio_options,
-       int video_options)
+       Asset *asset, BC_WindowBase* &format_window,
+       int audio_options, int video_options, EDL *edl)
 {
        if(audio_options)
        {
@@ -1501,15 +1499,9 @@ int FileOGG::read_frame(VFrame *frame)
                yuv.v += yuv.uv_stride * (yuv.uv_height - 1);
                yuv.y_stride = - yuv.y_stride;
                yuv.uv_stride = - yuv.uv_stride;*/
-               VFrame *temp_frame = new VFrame(yuv.y,
-                                               -1,
-                                               0,
-                                               yuv.u - yuv.y,
-                                               yuv.v - yuv.y,
-                                               - yuv.y_stride,
-                                               yuv.y_height,
-                                               BC_YUV420P,
-                                               - yuv.y_stride);
+               VFrame *temp_frame = new VFrame(yuv.y, -1, 0,
+                                       yuv.u - yuv.y, yuv.v - yuv.y, - yuv.y_stride,
+                                       yuv.y_height, BC_YUV420P, - yuv.y_stride);
                // copy into temp frame...
 
                BC_CModels::transfer(frame->get_rows(),
@@ -1959,12 +1951,7 @@ int FileOGG::write_frames_theora(VFrame ***frames, int len, int e_o_s)
 
                if (!temp_frame)
                {
-                       temp_frame = new VFrame (0,
-                                               -1,
-                                               tf->ti.width,
-                                               tf->ti.height,
-                                               BC_YUV420P,
-                                               -1);
+                       temp_frame = new VFrame ( tf->ti.width, tf->ti.height, BC_YUV420P, 0);
                }
                VFrame *frame = frames[0][j];
                int in_color_model = frame->get_color_model();
@@ -2334,7 +2321,7 @@ PackagingEngineOGG::~PackagingEngineOGG()
                delete [] packages;
        }
        if (default_asset)
-               delete default_asset;
+               default_asset->remove_user();
 }
 
 
@@ -2379,7 +2366,9 @@ int PackagingEngineOGG::create_packages_single_farm(
        if (default_asset->audio_data)
        {
                packages[local_current_package] = new RenderPackage;
-               sprintf(packages[current_package]->path, "%s.audio", default_asset->path);
+               snprintf(packages[current_package]->path,
+                       sizeof(packages[current_package]->path),
+                       "%s.audio", default_asset->path);
                local_current_package++;
        }
 
@@ -2499,6 +2488,7 @@ int PackagingEngineOGG::packages_are_done()
        if (default_asset->audio_data)
        {
                audio_asset = new Asset(packages[local_current_package]->path);
+               audio_asset->format = FILE_OGG;
                local_current_package++;
 
                audio_file_gen = new File();
@@ -2511,6 +2501,7 @@ int PackagingEngineOGG::packages_are_done()
        if (default_asset->video_data)
        {
                video_asset = new Asset(packages[local_current_package]->path);
+               video_asset->format = FILE_OGG;
                local_current_package++;
 
                video_file_gen = new File();
@@ -2550,8 +2541,9 @@ int PackagingEngineOGG::packages_are_done()
                                                ogg_stream_clear(&video_in_stream);
                                                video_file_gen->close_file();
                                                delete video_file_gen;
-                                               delete video_asset;
+                                               if( video_asset ) video_asset->remove_user();
                                                video_asset = new Asset(packages[local_current_package]->path);
+                                               video_asset->format = FILE_OGG;
                                                local_current_package++;
 
                                                video_file_gen = new File();
@@ -2632,22 +2624,24 @@ int PackagingEngineOGG::packages_are_done()
                ogg_stream_clear(&audio_in_stream);
                audio_file_gen->close_file();
                delete audio_file_gen;
-               delete audio_asset;
+               if( audio_asset )
+                       audio_asset->remove_user();
        }
        if (default_asset->video_data)
        {
                ogg_stream_clear(&video_in_stream);
                video_file_gen->close_file();
                delete video_file_gen;
-               delete video_asset;
+               if( video_asset )
+                       video_asset->remove_user();
        }
 
        output_file_gen->close_file();
        delete output_file_gen;
 
-// Now delete the temp files
-       for(int i = 0; i < total_packages; i++)
-               unlink(packages[i]->path);
+// don't delete the temp files, for now
+//     for(int i = 0; i < total_packages; i++)
+//             unlink(packages[i]->path);
 
        return 0;
 }