repair default keyframe load, tweak init default histogram threshold
[goodguy/history.git] / cinelerra-5.1 / cinelerra / filempeg.C
index 0526875ba4c73debd051670c56affaa60ec53fd9..6c889b92c6cb7a169d3fcde23571454939682c87 100644 (file)
@@ -105,10 +105,8 @@ FileMPEG::~FileMPEG()
 }
 
 void FileMPEG::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 && asset->format == FILE_AMPEG)
        {
@@ -776,6 +774,7 @@ int FileMPEG::skim_video(int track, void *vp, skim_fn fn)
 
 
 
+#ifdef HAVE_COMMERCIAL
 int FileMPEG::toc_nail(void *vp, int track)
 {
        File *file = (File *)vp;
@@ -786,11 +785,11 @@ int FileMPEG::toc_nail(void *vp, int track)
        if( mpeg->get_video_info(track, pid, framerate, width, height) ) return 1;
        if( pid < 0 || framerate <= 0 ) return 1;
        double position = framenum / framerate;
-//printf("t%d/%03x f"_LD", %dx%d %dx%d\n",track,pid,framenum,mw,mh,width,height);
+//printf("t%d/%03x f%jd, %dx%d %dx%d\n",track,pid,framenum,mw,mh,width,height);
        MWindow::commercials->get_frame(file, pid, position, tdat, mw, mh, width, height);
        return 0;
 }
-
+#endif
 
 int FileMPEG::create_toc(char *toc_path)
 {
@@ -818,11 +817,13 @@ int FileMPEG::create_toc(char *toc_path)
 // File needs a table of contents.
        struct timeval new_time, prev_time, start_time, current_time;
        gettimeofday(&prev_time, 0);  gettimeofday(&start_time, 0);
+#ifdef HAVE_COMMERCIAL
        if( file->preferences->scan_commercials ) {
                set_skimming(-1, 1, toc_nail, file);
                if( MWindow::commercials->resetDb() != 0 )
                        eprintf(_("cant access commercials database"));
        }
+#endif
 // This gets around the fact that MWindowGUI may be locked.
        char progress_title[BCTEXTLEN];
        sprintf(progress_title, _("Creating %s\n"), toc_file);
@@ -866,10 +867,12 @@ int FileMPEG::create_toc(char *toc_path)
                }
        }
 
+#ifdef HAVE_COMMERCIAL
        if( file->preferences->scan_commercials ) {
                if( !result ) MWindow::commercials->write_ads(asset->path);
                MWindow::commercials->closeDb();
        }
+#endif
 
        mpeg3_stop_toc(fd);
        fd = 0;
@@ -998,7 +1001,9 @@ int FileMPEG::get_best_colormodel(Asset *asset, int driver)
        switch(driver)
        {
                case PLAYBACK_X11:
-                       return BC_RGB888;
+//                     return BC_RGB888;
+// the direct X11 color model requires scaling in the codec
+                       return BC_BGR8888;
                case PLAYBACK_X11_XV:
                case PLAYBACK_ASYNCHRONOUS:
                        return zmpeg3_cmdl(asset->vmpeg_cmodel) > 0 ?
@@ -1323,12 +1328,8 @@ int FileMPEG::write_frames(VFrame ***frames, int len)
 
                                                if(!temp_frame)
                                                {
-                                                       temp_frame = new VFrame(0,
-                                                               -1,
-                                                               temp_w,
-                                                               temp_h,
-                                                               output_cmodel,
-                                                               -1);
+                                                       temp_frame = new VFrame(temp_w, temp_h,
+                                                                       output_cmodel, 0);
                                                }
 
                                                BC_CModels::transfer(temp_frame->get_rows(),
@@ -1374,12 +1375,8 @@ int FileMPEG::write_frames(VFrame ***frames, int len)
 //printf("FileMPEG::write_frames %d\n", __LINE__);sleep(1);
                                                if(!temp_frame)
                                                {
-                                                       temp_frame = new VFrame(0,
-                                                               -1,
-                                                               asset->width,
-                                                               asset->height,
-                                                               output_cmodel,
-                                                               -1);
+                                                       temp_frame = new VFrame(asset->width, asset->height,
+                                                                               output_cmodel, 0);
                                                }
 
 // printf("FileMPEG::write_frames %d temp_frame=%p %p %p %p frame=%p %p %p %p color_model=%p %p\n",
@@ -1729,13 +1726,7 @@ MPEGConfigAudio::MPEGConfigAudio(BC_WindowBase *parent_window, Asset *asset)
  : BC_Window(_(PROGRAM_NAME ": Audio Compression"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
-       310,
-       120,
-       -1,
-       -1,
-       0,
-       0,
-       1)
+       310, 120, -1, -1, 0, 0, 1)
 {
        this->parent_window = parent_window;
        this->asset = asset;
@@ -1782,11 +1773,6 @@ int MPEGConfigAudio::close_event()
 }
 
 
-
-
-
-
-
 MPEGLayer::MPEGLayer(int x, int y, MPEGConfigAudio *gui)
  : BC_PopupMenu(x, y, 100, layer_to_string(gui->asset->ampeg_derivative))
 {
@@ -1841,9 +1827,7 @@ char* MPEGLayer::layer_to_string(int layer)
 
 
 MPEGABitrate::MPEGABitrate(int x, int y, MPEGConfigAudio *gui)
- : BC_PopupMenu(x,
-       y,
-       100,
+ : BC_PopupMenu(x, y, 100,
        bitrate_to_string(gui->string, gui->asset->ampeg_bitrate))
 {
        this->gui = gui;
@@ -1921,13 +1905,7 @@ MPEGConfigVideo::MPEGConfigVideo(BC_WindowBase *parent_window,
  : BC_Window(_(PROGRAM_NAME ": Video Compression"),
        parent_window->get_abs_cursor_x(1),
        parent_window->get_abs_cursor_y(1),
-       500,
-       400,
-       -1,
-       -1,
-       0,
-       0,
-       1)
+       500, 400, -1, -1, 0, 0, 1)
 {
        this->parent_window = parent_window;
        this->asset = asset;