Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / dvdcreate.C
index f4587fc682d8d499cdd42bdc7df0db741f4656ea..390d2cbcb44743a4dc5f5dba44d1f0cda170eb78 100644 (file)
@@ -1,3 +1,23 @@
+/*
+ * CINELERRA
+ * Copyright (C) 2016-2020 William Morrow
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+ * USA
+ */
+
 #include "asset.h"
 #include "bchash.h"
 #include "clip.h"
@@ -8,6 +28,7 @@
 #include "edlsession.h"
 #include "file.h"
 #include "filexml.h"
+#include "interlacemodes.h"
 #include "keyframe.h"
 #include "labels.h"
 #include "mainerror.h"
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
+#if !defined(__FreeBSD__)
 #include <sys/stat.h>
+#if !defined(__NetBSD__)
 #include <sys/statfs.h>
+#endif
+#else
+#include <sys/param.h>
+#include <sys/mount.h>
+#endif
 
+#if defined(__NetBSD__)
+#include <sys/statvfs.h>
+#ifndef statfs
+#define statfs statvfs
+#endif
+#endif
 
 #define DVD_PAL_4x3    0
 #define DVD_PAL_16x9   1
@@ -177,7 +211,7 @@ char *DVD_BatchRenderJob::create_script(EDL *edl, ArrayList<Indexable *> *idxbls
        int file_seq = farmed || labeled ? 1 : 0;
        if( !muxed ) {
                if( file_seq ) {
-                       fprintf(fp, "cat > $dir/dvd.m2v $dir/dvd.m2v0*\n");
+                       fprintf(fp, "cat > $dir/dvd.m2v $dir/dvd.m2v[0-9]*\n");
                        fprintf(fp, "mplex -M -f 8 -o $dir/dvd.mpg $dir/dvd.m2v $dir/dvd.ac3\n");
                        file_seq = 0;
                }
@@ -316,6 +350,10 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
        double old_samplerate = session->sample_rate;
        double old_framerate = session->frame_rate;
 
+       if(use_deinterlace) {
+       session->interlace_mode = ILACE_MODE_NOTINTERLACED;
+       }
+
        session->video_channels = DVD_STREAMS;
        session->video_tracks = DVD_STREAMS;
        session->frame_rate = dvd_framerate;
@@ -433,12 +471,17 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList<BatchRenderJob*> *jobs, const ch
                asset->vmpeg_bitrate = vid_bitrate;
                asset->vmpeg_quantization = 15;
                asset->vmpeg_iframe_distance = 15;
-               asset->vmpeg_progressive = 0;
+               if(session->interlace_mode == ILACE_MODE_NOTINTERLACED || use_deinterlace)
+               { asset->vmpeg_progressive = 1; } else {
+               asset->vmpeg_progressive = 0; }
                asset->vmpeg_denoise = 0;
                asset->vmpeg_seq_codes = 0;
                asset->vmpeg_derivative = 2;
                asset->vmpeg_preset = 8;
                asset->vmpeg_field_order = 0;
+               if(session->interlace_mode == ILACE_MODE_BOTTOM_FIRST && !use_deinterlace)
+               { asset->vmpeg_field_order = 1; } else {
+               asset->vmpeg_field_order = 0; }
                asset->vmpeg_pframe_distance = 0;
                use_farmed = job->farmed;
                job = new BatchRenderJob(mwindow->preferences, 0, 0);
@@ -486,7 +529,7 @@ void CreateDVD_Thread::handle_close_event(int result)
                Tracks *tracks = mwindow->edl->tracks;
                for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                        if( vtrk->data_type != TRACK_VIDEO ) continue;
-                       if( !vtrk->record ) continue;
+                       if( !vtrk->is_armed() ) continue;
                        vtrk->expand_view = 1;
                        PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk);
                        vtrk->plugin_set.append(plugin_set);
@@ -645,7 +688,7 @@ int CreateDVD_OK::button_press_event()
 
 int CreateDVD_OK::keypress_event()
 {
-       return 0;
+       return context_help_check_and_show();
 }
 
 
@@ -873,6 +916,8 @@ CreateDVD_GUI::CreateDVD_GUI(CreateDVD_Thread *thread, int x, int y, int w, int
        need_farmed = 0;
        ok = 0;
        cancel = 0;
+// *** CONTEXT_HELP ***
+       context_help_set_keyword("DVD and Bluray Creation");
 }
 
 CreateDVD_GUI::~CreateDVD_GUI()
@@ -1015,7 +1060,7 @@ insert_video_plugin(const char *title, KeyFrame *default_keyframe)
        Tracks *tracks = mwindow->edl->tracks;
        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                if( vtrk->data_type != TRACK_VIDEO ) continue;
-               if( !vtrk->record ) continue;
+               if( !vtrk->is_armed() ) continue;
                vtrk->expand_view = 1;
                PluginSet *plugin_set = new PluginSet(mwindow->edl, vtrk);
                vtrk->plugin_set.append(plugin_set);
@@ -1039,7 +1084,7 @@ resize_tracks()
        if( trk_h < dvd_height ) trk_h = dvd_height;
        for( Track *vtrk=tracks->first; vtrk; vtrk=vtrk->next ) {
                if( vtrk->data_type != TRACK_VIDEO ) continue;
-               if( !vtrk->record ) continue;
+               if( !vtrk->is_armed() ) continue;
                vtrk->track_w = trk_w;
                vtrk->track_h = trk_h;
        }
@@ -1072,7 +1117,7 @@ option_presets()
        max_w = 0;  max_h = 0;
        int has_deinterlace = 0, has_scale = 0;
        for( Track *trk=tracks->first; trk; trk=trk->next ) {
-               if( !trk->record ) continue;
+               if( !trk->is_armed() ) continue;
                Edits *edits = trk->edits;
                switch( trk->data_type ) {
                case TRACK_VIDEO:
@@ -1111,7 +1156,7 @@ option_presets()
                if( max_h != dvd_height ) use_resize_tracks = 1;
        }
        for( Track *trk=tracks->first; trk && !use_resize_tracks; trk=trk->next ) {
-               if( !trk->record ) continue;
+               if( !trk->is_armed() ) continue;
                switch( trk->data_type ) {
                case TRACK_VIDEO:
                        if( trk->track_w != max_w ) use_resize_tracks = 1;