Credit Andrea improved comments in render format
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / bdcreate.C
index 61362cfc26be5fad4ccc28931ad76bb861b9f4f6..7305d4e960b6bec0d8aeccc070f791679109c422 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 "bdcreate.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
+
 // BD Creation
 
 // selected by timezone
@@ -51,10 +80,10 @@ static struct bd_format {
        { "1920x1080 25i",      1920,1080, 25.,    1, ILACE_MODE_TOP_FIRST },
        { "1920x1080 25p*",     1920,1080, 25.,    1, ILACE_MODE_FAKE_INTERLACE },
        { "1920x1080 23.976p",  1920,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED },
-       { "1440x1080 29.97i",   1440,1080, 29.97, -1, ILACE_MODE_TOP_FIRST },
-       { "1440x1080 25i",      1440,1080, 25.,   -1, ILACE_MODE_TOP_FIRST },
-       { "1440x1080 24p",      1440,1080, 24.,   -1, ILACE_MODE_NOTINTERLACED },
-       { "1440x1080 23.976p",  1440,1080, 23.976,-1, ILACE_MODE_NOTINTERLACED },
+       { "1440x1080 29.97i",   1440,1080, 29.97,  1, ILACE_MODE_TOP_FIRST },
+       { "1440x1080 25i",      1440,1080, 25.,    1, ILACE_MODE_TOP_FIRST },
+       { "1440x1080 24p",      1440,1080, 24.,    1, ILACE_MODE_NOTINTERLACED },
+       { "1440x1080 23.976p",  1440,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  59.94p",   1280,720,  59.94,  1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  50p",      1280,720,  50.,    1, ILACE_MODE_NOTINTERLACED },
        { "1280x720  29.97p*",  1280,720,  29.97,  1, ILACE_MODE_NOTINTERLACED },
@@ -63,8 +92,13 @@ static struct bd_format {
        { "1280x720  23.976p",  1280,720,  23.976, 1, ILACE_MODE_NOTINTERLACED },
        { "720x576   25i",       720,576,  25.,    0, ILACE_MODE_BOTTOM_FIRST },
        { "720x576   25p*",      720,576,  25.,    0, ILACE_MODE_NOTINTERLACED },
+       { "720x576(w)   25i",    720,576,  25.,    1, ILACE_MODE_BOTTOM_FIRST },
+       { "720x576(w)   25p*",   720,576,  25.,    1, ILACE_MODE_NOTINTERLACED },
        { "720x480   29.97i",    720,480,  29.97,  0, ILACE_MODE_BOTTOM_FIRST },
        { "720x480   29.97p*",   720,480,  29.97,  0, ILACE_MODE_NOTINTERLACED },
+       { "720x480(w)   29.97i",         720,480,  29.97,  1, ILACE_MODE_BOTTOM_FIRST },
+       { "720x480(w)   29.97p*",        720,480,  29.97,  1, ILACE_MODE_NOTINTERLACED },
+
 };
 
 static struct bd_profile {
@@ -347,12 +381,14 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs, const char
        }
 
 
-       fprintf(fp,"MUXOPT --blu-ray --hdmv-descriptors\n");
+       fprintf(fp,"MUXOPT --blu-ray --hdmv-descriptors --auto-chapters=5\n");
        fprintf(fp,"V_MPEG4/ISO/AVC, bd.m2ts, track=4113\n");
        if(!strcmp(use_profile, "bluray.m2ts"))
        fprintf(fp,"A_AC3, bd.m2ts, track=4352\n");
        if(!strcmp(use_profile, "bluray_lpcm.m2ts"))
        fprintf(fp,"A_LPCM, bd.m2ts, track=4352\n");
+       if(!strcmp(use_profile, "bluray_truehd.m2ts"))
+       fprintf(fp,"A_MLP, bd.m2ts, track=4352\n");
        fprintf(fp,"\n");
        fclose(fp);
 
@@ -396,6 +432,13 @@ int CreateBD_Thread::create_bd_jobs(ArrayList<BatchRenderJob*> *jobs, const char
        FFMPEG::set_option_path(option_path, "video/%s", asset->vcodec);
        FFMPEG::load_options(option_path, asset->ff_video_options,
                 sizeof(asset->ff_video_options));
+       if(session->aspect_w == 16) {
+       char aspect_line[100];
+       float par = (float)((float)asset->width / (float)asset->height);
+       sprintf(aspect_line, "aspect=%f\n", asset->aspect_ratio/par);
+       strcat(asset->ff_video_options, aspect_line);
+       //printf("Aspect line: %s par: %f width: %i height: %i\n ", aspect_line, par, asset->width, asset->height);
+       }
        asset->ff_video_bitrate = vid_bitrate;
        asset->ff_video_quality = -1;
        return 0;
@@ -962,6 +1005,7 @@ void CreateBD_GUI::update()
        need_wide_audio->set_value(thread->use_wide_audio);
        need_labeled->set_value(thread->use_labeled);
        need_farmed->set_value(thread->use_farmed);
+       need_tsmuxer->set_value(thread->use_tsmuxer);
 }
 
 int CreateBD_Thread::
@@ -1011,6 +1055,7 @@ option_presets()
        use_wide_audio = 0;
        use_labeled = 0;
        use_farmed = 0;
+       use_tsmuxer = 0;
 
        if( !mwindow->edl ) return 1;
 
@@ -1113,7 +1158,7 @@ int CreateBD_FormatItem::handle_event()
        popup->set_text(text);
        int n = strlen(text)-1;
        int not_standard = n >= 0 && text[n] == '*' ? 1 : 0;
-       popup->gui->non_standard->update(not_standard ? _("* non-standard format") : "", 0);
+       popup->gui->non_standard->update(not_standard ? _("                * non-standard format") : "", 0);
        return popup->handle_event();
 }
 
@@ -1219,6 +1264,7 @@ CreateBD_Profile::CreateBD_Profile(CreateBD_GUI *gui, int x, int y)
  : BC_PopupTextBox(gui, 0, 0, x, y, xS(170),yS(50))
 {
        this->gui = gui;
+       strcpy(gui->thread->use_profile, "bluray.m2ts");
 }
 
 CreateBD_Profile::~CreateBD_Profile()