From 2f28632d8209ef735de1698a596bc94fa9613497 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 9 May 2016 16:24:40 -0600 Subject: [PATCH] ffmpeg param visibility, high422 x264 profile, bd/dvd enhancements --- cinelerra-5.1/cinelerra/bdcreate.C | 21 +- cinelerra-5.1/cinelerra/bdcreate.h | 2 + cinelerra-5.1/cinelerra/bdwrite.C | 26 +- cinelerra-5.1/cinelerra/cwindowgui.C | 103 +- cinelerra-5.1/cinelerra/dvdcreate.C | 15 +- cinelerra-5.1/cinelerra/dvdcreate.h | 2 + cinelerra-5.1/cinelerra/ffmpeg.C | 18 +- cinelerra-5.1/cinelerra/ffmpeg.h | 3 +- cinelerra-5.1/cinelerra/fileffmpeg.C | 889 +++++++++++++++++- cinelerra-5.1/cinelerra/fileffmpeg.h | 235 ++++- cinelerra-5.1/cinelerra/fileffmpeg.inc | 25 + cinelerra-5.1/cinelerra/mwindow.C | 3 + cinelerra-5.1/ffmpeg/video/bluray1.m2ts | 8 + cinelerra-5.1/thirdparty/src/ffmpeg.patch2 | 12 + cinelerra-5.1/thirdparty/src/libbluray.patch1 | 11 + 15 files changed, 1249 insertions(+), 124 deletions(-) create mode 100644 cinelerra-5.1/ffmpeg/video/bluray1.m2ts create mode 100644 cinelerra-5.1/thirdparty/src/ffmpeg.patch2 create mode 100644 cinelerra-5.1/thirdparty/src/libbluray.patch1 diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index 20ecf587..d487830c 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -30,7 +30,7 @@ #define BD_1920x1080_2500i 1 #define BD_1920x1080_2400p 2 #define BD_1920x1080_23976p 3 -#define BD_1280x720_5997p 4 +#define BD_1280x720_5994p 4 #define BD_1280x720_5000p 5 #define BD_1280x720_23976p 6 #define BD_1280x720_2400p 7 @@ -46,7 +46,7 @@ static struct bd_format { { "1920x1080 25i", 1920,1080, 25 }, { "1920x1080 24p", 1920,1080, 24 }, { "1920x1080 23.976p", 1920,1080, 23.976 }, - { "1280x720 59.97p", 1280,720, 59.97 }, + { "1280x720 59.94p", 1280,720, 59.94 }, { "1280x720 50p", 1280,720, 50 }, { "1280x720 23.976p", 1280,720, 23.976 }, { "1280x720 24p", 1280,720, 24 }, @@ -184,7 +184,8 @@ int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, fprintf(fp,"bdwrite $1/udfs $1/bd.m2ts\n"); fprintf(fp,"umount $1/udfs\n"); fprintf(fp,"echo To burn bluray, load writable media and run:\n"); - fprintf(fp,"echo growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n"); + fprintf(fp,"echo for WORM: growisofs -dvd-compat -Z /dev/bd=$1/bd.udfs\n"); + fprintf(fp,"echo for RW: dd if=$1/bd.udfs of=/dev/bd bs=2048000\n"); fprintf(fp,"\n"); fclose(fp); @@ -373,7 +374,7 @@ BC_Window* CreateBD_Thread::new_gui() has_standard = i; break; } } - use_standard = has_standard >= 0 ? has_standard : BD_1920x1080_2400p; + use_standard = has_standard >= 0 ? has_standard : BD_1920x1080_23976p; option_presets(); int scr_x = mwindow->gui->get_screen_x(0, -1); @@ -616,6 +617,7 @@ CreateBD_GUI::CreateBD_GUI(CreateBD_Thread *thread, int x, int y, int w, int h) cancel_x = cancel_y = cancel_w = cancel_h = 0; asset_title = 0; tmp_path = 0; + btmp_path = 0; disk_space = 0; need_deinterlace = 0; need_inverse_telecine = 0; @@ -645,11 +647,15 @@ void CreateBD_GUI::create_objects() asset_title = new CreateBD_AssetTitle(this, at_x, at_y, get_w()-at_x-10); add_subwindow(asset_title); y += title->get_h() + pady/2; - title = new BC_Title(x, y, _("tmp path:"), MEDIUMFONT, YELLOW); + title = new BC_Title(x, y, _("Work path:"), MEDIUMFONT, YELLOW); add_subwindow(title); tmp_x = x + title->get_w(); tmp_y = y; - tmp_path = new CreateBD_TmpPath(this, tmp_x, tmp_y, get_w()-tmp_x-10); + tmp_path = new CreateBD_TmpPath(this, tmp_x, tmp_y, get_w()-tmp_x-35); add_subwindow(tmp_path); + btmp_path = new BrowseButton(thread->mwindow, this, tmp_path, + tmp_x+tmp_path->get_w(), tmp_y, "/tmp", + _("Work path"), _("Select a Work directory:"), 1); + add_subwindow(btmp_path); y += title->get_h() + pady/2; disk_space = new CreateBD_DiskSpace(this, x, y); add_subwindow(disk_space); @@ -711,7 +717,8 @@ void CreateBD_GUI::create_objects() int CreateBD_GUI::resize_event(int w, int h) { asset_title->reposition_window(at_x, at_y, get_w()-at_x-10); - tmp_path->reposition_window(tmp_x, tmp_y, get_w()-tmp_x-10); + tmp_path->reposition_window(tmp_x, tmp_y, get_w()-tmp_x-35); + btmp_path->reposition_window(tmp_x+tmp_path->get_w(), tmp_y); ok_y = h - ok_h - 10; ok->reposition_window(ok_x, ok_y); cancel_x = w - cancel_w - 10, diff --git a/cinelerra-5.1/cinelerra/bdcreate.h b/cinelerra-5.1/cinelerra/bdcreate.h index 308208dc..f13bee74 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.h +++ b/cinelerra-5.1/cinelerra/bdcreate.h @@ -9,6 +9,7 @@ #include "bclistboxitem.inc" #include "bcmenuitem.h" #include "bctextbox.h" +#include "browsebutton.h" #include "mwindow.h" #include "bdcreate.inc" @@ -209,6 +210,7 @@ public: CreateBD_AssetTitle *asset_title; int tmp_x, tmp_y; CreateBD_TmpPath *tmp_path; + BrowseButton *btmp_path; CreateBD_DiskSpace *disk_space; CreateBD_Format *standard; ArrayList media_sizes; diff --git a/cinelerra-5.1/cinelerra/bdwrite.C b/cinelerra-5.1/cinelerra/bdwrite.C index 93b65690..a26d56aa 100644 --- a/cinelerra-5.1/cinelerra/bdwrite.C +++ b/cinelerra-5.1/cinelerra/bdwrite.C @@ -2882,8 +2882,8 @@ bd_path(const char *bp, const char *fmt, va_list ap) int Media:: bd_copy(const char *ifn, const char *fmt, ...) { - int n, ret = 1; - char bfr[0x40000]; + int bfrsz = 0x40000, ret = 1; + char bfr[bfrsz]; FILE *ifp = fopen(ifn,"r"); if( ifp ) { va_list ap; @@ -2894,9 +2894,27 @@ bd_copy(const char *ifn, const char *fmt, ...) if( ofp ) { setvbuf(ifp, 0, _IOFBF, 0x80000); setvbuf(ofp, 0, _IOFBF, 0x80000); - while( (n=fread(bfr,1,sizeof(bfr),ifp)) > 0 ) fwrite(bfr,1,n,ofp); - fclose(ofp); ret = 0; + int n = bfrsz; + while( !ret && n >= bfrsz ) { + n = fread(bfr,1,bfrsz,ifp); + if( n > 0 && (int)fwrite(bfr,1,n,ofp) != n ) { + fprintf(stderr, "cant write: %s\n",filename); + ret = 1; + } + } + if( ferror(ifp) ) { + fprintf(stderr, "read error: %s = %m\n",ifn); + ret = 1; + } + if( ferror(ofp) ) { + fprintf(stderr, "write error: %s = %m\n",filename); + ret = 1; + } + if( fclose(ofp) ) { + fprintf(stderr, "close error: %s = %m\n",filename); + ret = 1; + } } fclose(ifp); } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 73c11dc5..172ee6e3 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -1530,6 +1530,14 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, float x2 = point2->x + point2->control_x1; float y2 = point2->y + point2->control_y1; float x3 = point2->x, y3 = point2->y; + float canvas_x0 = (x0 - half_track_w) * projector_z + projector_x; + float canvas_y0 = (y0 - half_track_h) * projector_z + projector_y; + float canvas_x1 = (x1 - half_track_w) * projector_z + projector_x; + float canvas_y1 = (y1 - half_track_h) * projector_z + projector_y; + float canvas_x2 = (x2 - half_track_w) * projector_z + projector_x; + float canvas_y2 = (y2 - half_track_h) * projector_z + projector_y; + float canvas_x3 = (x3 - half_track_w) * projector_z + projector_x; + float canvas_y3 = (y3 - half_track_h) * projector_z + projector_y; float t = (float)j / segments; float tpow2 = t * t; @@ -1546,9 +1554,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, + 3 * t * invtpow2 * y1 + 3 * tpow2 * invt * y2 + tpow3 * y3); - - x = (x - half_track_w) * projector_z + projector_x; - y = (y - half_track_h) * projector_z + projector_y; + float canvas_x = (x - half_track_w) * projector_z + projector_x; + float canvas_y = (y - half_track_h) * projector_z + projector_y; // Test new point addition if(button_press) { float line_distance = line_dist(x,y, mask_cursor_x,mask_cursor_y); @@ -1565,13 +1572,9 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, } // Test existing point selection - float canvas_x = (x0 - half_track_w) * projector_z + projector_x; - float canvas_y = (y0 - half_track_h) * projector_z + projector_y; // Test first point if(gui->ctrl_down()) { - float control_x = (x1 - half_track_w) * projector_z + projector_x; - float control_y = (y1 - half_track_h) * projector_z + projector_y; - float distance = line_dist(control_x,control_y, mask_cursor_x,mask_cursor_y); + float distance = line_dist(x1,y1, mask_cursor_x,mask_cursor_y); if(distance < selected_control_point_distance) { selected_point = i; @@ -1581,7 +1584,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, } else { if(!gui->shift_down()) { - if(test_bbox(cursor_x, cursor_y, canvas_x, canvas_y)) { + if(test_bbox(cursor_x, cursor_y, canvas_x0, canvas_y0)) { selected_point = i; } } @@ -1590,13 +1593,8 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, } } // Test second point - canvas_x = (x3 - half_track_w) * projector_z + projector_x; - canvas_y = (y3 - half_track_h) * projector_z + projector_y; - if(gui->ctrl_down()) { - float control_x = (x2 - half_track_w) * projector_z + projector_x; - float control_y = (y2 - half_track_h) * projector_z + projector_y; - float distance = line_dist(control_x,control_y, mask_cursor_x,mask_cursor_y); + float distance = line_dist(x2,y2, mask_cursor_x,mask_cursor_y); //printf("CWindowCanvas::do_mask %d %f %f\n", i, distance, selected_control_point_distance); if(distance < selected_control_point_distance) { @@ -1607,7 +1605,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, } else if(i < points.size() - 1) { if(!gui->shift_down()) { - if(test_bbox(cursor_x, cursor_y, canvas_x, canvas_y)) { + if(test_bbox(cursor_x, cursor_y, canvas_x3, canvas_y3)) { selected_point = (i < points.size() - 1 ? i + 1 : 0); } } @@ -1617,14 +1615,13 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, } } - - output_to_canvas(mwindow->edl, 0, x, y); + output_to_canvas(mwindow->edl, 0, canvas_x, canvas_y); if(j > 0) { if(draw) { // Draw joining line - x_points.append((int)x); - y_points.append((int)y); + x_points.append((int)canvas_x); + y_points.append((int)canvas_y); } if(j == segments) { @@ -1632,24 +1629,24 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, if(i < points.size() - 1) { if(i == gui->affected_point - 1) get_canvas()->draw_disc( - (int)x - CONTROL_W / 2, - (int)y - CONTROL_W / 2, + (int)canvas_x - CONTROL_W / 2, + (int)canvas_y - CONTROL_W / 2, CONTROL_W, CONTROL_H); else get_canvas()->draw_circle( - (int)x - CONTROL_W / 2, - (int)y - CONTROL_W / 2, + (int)canvas_x - CONTROL_W / 2, + (int)canvas_y - CONTROL_W / 2, CONTROL_W, CONTROL_H); // char string[BCTEXTLEN]; // sprintf(string, "%d", (i < points.size() - 1 ? i + 1 : 0)); -// canvas->draw_text((int)x + CONTROL_W, (int)y + CONTROL_W, string); +// canvas->draw_text((int)canvas_x + CONTROL_W, (int)canvas_y + CONTROL_W, string); } // Draw second control point. Discard x2 and y2 after this. - x2 = (x2 - half_track_w) * projector_z + projector_x; - y2 = (y2 - half_track_h) * projector_z + projector_y; output_to_canvas(mwindow->edl, 0, x2, y2); - get_canvas()->draw_line((int)x, (int)y, (int)x2, (int)y2); + get_canvas()->draw_line( + (int)canvas_x, (int)canvas_y, + (int)canvas_x2, (int)canvas_y2); get_canvas()->draw_rectangle( (int)x2 - CONTROL_W / 2, (int)y2 - CONTROL_H / 2, @@ -1664,29 +1661,29 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, sprintf(mask_label, "%d", mwindow->edl->session->cwindow_mask); get_canvas()->draw_text( - (int)x - FIRST_CONTROL_W, - (int)y - FIRST_CONTROL_H, + (int)canvas_x - FIRST_CONTROL_W, + (int)canvas_y - FIRST_CONTROL_H, mask_label); get_canvas()->draw_disc( - (int)x - FIRST_CONTROL_W / 2, - (int)y - FIRST_CONTROL_H / 2, + (int)canvas_x - FIRST_CONTROL_W / 2, + (int)canvas_y - FIRST_CONTROL_H / 2, FIRST_CONTROL_W, FIRST_CONTROL_H); } -// Draw first control point. Discard x1 and y1 after this. +// Draw first control point. if(draw) { - x1 = (x1 - half_track_w) * projector_z + projector_x; - y1 = (y1 - half_track_h) * projector_z + projector_y; - output_to_canvas(mwindow->edl, 0, x1, y1); - get_canvas()->draw_line((int)x, (int)y, (int)x1, (int)y1); + output_to_canvas(mwindow->edl, 0, canvas_x1, canvas_y1); + get_canvas()->draw_line( + (int)canvas_x, (int)canvas_y, + (int)canvas_x1, (int)canvas_y1); get_canvas()->draw_rectangle( - (int)x1 - CONTROL_W / 2, - (int)y1 - CONTROL_H / 2, + (int)canvas_x1 - CONTROL_W / 2, + (int)canvas_y1 - CONTROL_H / 2, CONTROL_W, CONTROL_H); - x_points.append((int)x); - y_points.append((int)y); + x_points.append((int)canvas_x); + y_points.append((int)canvas_y); } } //printf("CWindowCanvas::do_mask 1\n"); @@ -2006,26 +2003,26 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender, float y1 = point->y + point->control_y1; float x2 = point->x + point->control_x2; float y2 = point->y + point->control_y2; - float canvas_x = (x0 - half_track_w) * projector_z + projector_x; - float canvas_y = (y0 - half_track_h) * projector_z + projector_y; + float canvas_x0 = (x0 - half_track_w) * projector_z + projector_x; + float canvas_y0 = (y0 - half_track_h) * projector_z + projector_y; - output_to_canvas(mwindow->edl, 0, canvas_x, canvas_y); - if(test_bbox(cursor_x, cursor_y, canvas_x, canvas_y)) { + output_to_canvas(mwindow->edl, 0, canvas_x0, canvas_y0); + if(test_bbox(cursor_x, cursor_y, canvas_x0, canvas_y0)) { over_point = 1; } if(!over_point && gui->ctrl_down()) { - canvas_x = (x1 - half_track_w) * projector_z + projector_x; - canvas_y = (y1 - half_track_h) * projector_z + projector_y; - output_to_canvas(mwindow->edl, 0, canvas_x, canvas_y); - if(test_bbox(cursor_x, cursor_y, canvas_x, canvas_y)) { + float canvas_x1 = (x1 - half_track_w) * projector_z + projector_x; + float canvas_y1 = (y1 - half_track_h) * projector_z + projector_y; + output_to_canvas(mwindow->edl, 0, canvas_x1, canvas_y1); + if(test_bbox(cursor_x, cursor_y, canvas_x1, canvas_y1)) { over_point = 1; } else { - canvas_x = (x2 - half_track_w) * projector_z + projector_x; - canvas_y = (y2 - half_track_h) * projector_z + projector_y; - output_to_canvas(mwindow->edl, 0, canvas_x, canvas_y); - if(test_bbox(cursor_x, cursor_y, canvas_x, canvas_y)) { + float canvas_x2 = (x2 - half_track_w) * projector_z + projector_x; + float canvas_y2 = (y2 - half_track_h) * projector_z + projector_y; + output_to_canvas(mwindow->edl, 0, canvas_x2, canvas_y2); + if(test_bbox(cursor_x, cursor_y, canvas_x2, canvas_y2)) { over_point = 1; } } diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index c7477269..66d93793 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -187,7 +187,8 @@ int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, fprintf(fp," \n"); fprintf(fp," \n"); fprintf(fp," \n"); - fprintf(fp,"