From 43821d27c5b51c4250a251f20c98878f54deb288 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Thu, 22 Dec 2016 18:39:05 -0700 Subject: [PATCH] filebox changes, mts fix, dvd/bd create changes, motionwindow layout --- cinelerra-5.1/cinelerra/bdcreate.C | 26 +-- cinelerra-5.1/cinelerra/bdcreate.h | 4 +- cinelerra-5.1/cinelerra/dvdcreate.C | 17 +- cinelerra-5.1/cinelerra/dvdcreate.h | 4 +- cinelerra-5.1/cinelerra/render.C | 4 +- cinelerra-5.1/guicast/bcfilebox.C | 46 +++-- cinelerra-5.1/guicast/bcfilebox.h | 2 +- cinelerra-5.1/guicast/filesystem.C | 169 +++++++++--------- cinelerra-5.1/guicast/filesystem.h | 14 +- cinelerra-5.1/libzmpeg3/libzmpeg3.C | 9 +- cinelerra-5.1/plugins/cdripper/cdripwindow.C | 4 +- .../plugins/motion-cv/motionwindow-cv.C | 7 +- cinelerra-5.1/plugins/motion/motionwindow.C | 11 +- 13 files changed, 164 insertions(+), 153 deletions(-) diff --git a/cinelerra-5.1/cinelerra/bdcreate.C b/cinelerra-5.1/cinelerra/bdcreate.C index 1bf6dac8..f8e424dc 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.C +++ b/cinelerra-5.1/cinelerra/bdcreate.C @@ -42,15 +42,14 @@ static struct bd_format { // framerates are frames, not fields, per second, *=not standard { "1920x1080 29.97i", 1920,1080, 29.97, 1, ILACE_MODE_TOP_FIRST }, { "1920x1080 29.97p*", 1920,1080, 29.97, 1, ILACE_MODE_NOTINTERLACED }, - { "1920x1080 24p", 1920,1080, 50., 1, ILACE_MODE_NOTINTERLACED }, - { "1920x1080 25i", 1920,1080, 25., 1, ILACE_MODE_TOP_FIRST }, { "1920x1080 24p", 1920,1080, 24., 1, ILACE_MODE_NOTINTERLACED }, + { "1920x1080 25i", 1920,1080, 25., 1, ILACE_MODE_TOP_FIRST }, { "1920x1080 23.976p", 1920,1080, 23.976, 1, ILACE_MODE_NOTINTERLACED }, - { "1440x1080 29.97i", 1440,1080, 59.94, 0, ILACE_MODE_TOP_FIRST }, - { "1440x1080 25i", 1440,1080, 50., 0, ILACE_MODE_TOP_FIRST }, + { "1440x1080 29.97i", 1440,1080, 29.97, 0, ILACE_MODE_TOP_FIRST }, + { "1440x1080 25i", 1440,1080, 25., 0, ILACE_MODE_TOP_FIRST }, { "1440x1080 24p", 1440,1080, 24., 0, ILACE_MODE_NOTINTERLACED }, { "1440x1080 23.976p", 1440,1080, 23.976, 0, ILACE_MODE_NOTINTERLACED }, - { "1280x720 29.97p", 1280,720, 59.94, 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 23.976p", 1280,720, 23.976, 1, ILACE_MODE_NOTINTERLACED }, { "1280x720 24p", 1280,720, 24., 1, ILACE_MODE_NOTINTERLACED }, @@ -121,8 +120,7 @@ CreateBD_Thread::~CreateBD_Thread() close_window(); } -int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, - const char *asset_dir, const char *asset_title) +int CreateBD_Thread::create_bd_jobs(ArrayList *jobs, const char *asset_dir) { EDL *edl = mwindow->edl; if( !edl || !edl->session ) { @@ -366,7 +364,7 @@ void CreateBD_Thread::handle_close_event(int result) sprintf(asset_dir, "%s/%s", tmp_path, asset_title); sprintf(jobs_path, "%s/bd.jobs", asset_dir); mwindow->batch_render->reset(jobs_path); - int ret = create_bd_jobs(&mwindow->batch_render->jobs, asset_dir, asset_title); + int ret = create_bd_jobs(&mwindow->batch_render->jobs, asset_dir); mwindow->undo->update_undo_after(_("create bd"), LOAD_ALL); mwindow->resync_guis(); if( ret ) return; @@ -490,7 +488,7 @@ CreateBD_DiskSpace::~CreateBD_DiskSpace() int64_t CreateBD_DiskSpace::tmp_path_space() { - const char *path = gui->tmp_path->get_text(); + const char *path = gui->thread->tmp_path; if( access(path,R_OK+W_OK) ) return 0; struct statfs sfs; if( statfs(path, &sfs) ) return 0; @@ -531,13 +529,15 @@ CreateBD_TmpPath::~CreateBD_TmpPath() int CreateBD_TmpPath::handle_event() { + get_text(); gui->disk_space->update(); return 1; } CreateBD_AssetTitle::CreateBD_AssetTitle(CreateBD_GUI *gui, int x, int y, int w) - : BC_TextBox(x, y, w, 1, 0, gui->thread->asset_title, 1, MEDIUMFONT) + : BC_TextBox(x, y, w, 1, -(int)sizeof(gui->thread->asset_title), + gui->thread->asset_title, 1, MEDIUMFONT) { this->gui = gui; } @@ -546,6 +546,11 @@ CreateBD_AssetTitle::~CreateBD_AssetTitle() { } +int CreateBD_AssetTitle::handle_event() +{ + get_text(); + return 1; +} CreateBD_Deinterlace::CreateBD_Deinterlace(CreateBD_GUI *gui, int x, int y) : BC_CheckBox(x, y, &gui->thread->use_deinterlace, _("Deinterlace")) @@ -953,7 +958,6 @@ void CreateBD_Format::create_objects() } submenu->add_submenuitem(new CreateBD_FormatItem(this, i, bd_formats[i].name)); } - set_value(gui->thread->use_standard); } int CreateBD_Format::handle_event() diff --git a/cinelerra-5.1/cinelerra/bdcreate.h b/cinelerra-5.1/cinelerra/bdcreate.h index 29a08db8..d04e5a09 100644 --- a/cinelerra-5.1/cinelerra/bdcreate.h +++ b/cinelerra-5.1/cinelerra/bdcreate.h @@ -40,8 +40,7 @@ public: void handle_close_event(int result); BC_Window* new_gui(); int option_presets(); - int create_bd_jobs(ArrayList *jobs, - const char *tmp_path, const char *asset_title); + int create_bd_jobs(ArrayList *jobs, const char *asset_dir); int insert_video_plugin(const char *title, KeyFrame *default_keyframe); int resize_tracks(); @@ -117,6 +116,7 @@ class CreateBD_AssetTitle : public BC_TextBox public: CreateBD_AssetTitle(CreateBD_GUI *gui, int x, int y, int w); ~CreateBD_AssetTitle(); + int handle_event(); CreateBD_GUI *gui; }; diff --git a/cinelerra-5.1/cinelerra/dvdcreate.C b/cinelerra-5.1/cinelerra/dvdcreate.C index f3c817a3..155f17fb 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.C +++ b/cinelerra-5.1/cinelerra/dvdcreate.C @@ -126,8 +126,7 @@ CreateDVD_Thread::~CreateDVD_Thread() close_window(); } -int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, - const char *asset_dir, const char *asset_title) +int CreateDVD_Thread::create_dvd_jobs(ArrayList *jobs, const char *asset_dir) { EDL *edl = mwindow->edl; if( !edl || !edl->session ) { @@ -439,7 +438,7 @@ void CreateDVD_Thread::handle_close_event(int result) sprintf(asset_dir, "%s/%s", tmp_path, asset_title); sprintf(jobs_path, "%s/dvd.jobs", asset_dir); mwindow->batch_render->reset(jobs_path); - int ret = create_dvd_jobs(&mwindow->batch_render->jobs, asset_dir, asset_title); + int ret = create_dvd_jobs(&mwindow->batch_render->jobs, asset_dir); mwindow->undo->update_undo_after(_("create dvd"), LOAD_ALL); mwindow->resync_guis(); if( ret ) return; @@ -577,7 +576,7 @@ CreateDVD_DiskSpace::~CreateDVD_DiskSpace() int64_t CreateDVD_DiskSpace::tmp_path_space() { - const char *path = gui->tmp_path->get_text(); + const char *path = gui->thread->tmp_path; if( access(path,R_OK+W_OK) ) return 0; struct statfs sfs; if( statfs(path, &sfs) ) return 0; @@ -619,13 +618,15 @@ CreateDVD_TmpPath::~CreateDVD_TmpPath() int CreateDVD_TmpPath::handle_event() { + get_text(); gui->disk_space->update(); return 1; } CreateDVD_AssetTitle::CreateDVD_AssetTitle(CreateDVD_GUI *gui, int x, int y, int w) - : BC_TextBox(x, y, w, 1, 0, gui->thread->asset_title, 1, MEDIUMFONT) + : BC_TextBox(x, y, w, 1, -(int)sizeof(gui->thread->asset_title), + gui->thread->asset_title, 1, MEDIUMFONT) { this->gui = gui; } @@ -634,6 +635,12 @@ CreateDVD_AssetTitle::~CreateDVD_AssetTitle() { } +int CreateDVD_AssetTitle::handle_event() +{ + get_text(); + return 1; +} + CreateDVD_Deinterlace::CreateDVD_Deinterlace(CreateDVD_GUI *gui, int x, int y) : BC_CheckBox(x, y, &gui->thread->use_deinterlace, _("Deinterlace")) diff --git a/cinelerra-5.1/cinelerra/dvdcreate.h b/cinelerra-5.1/cinelerra/dvdcreate.h index 6454a720..cfb9b00b 100644 --- a/cinelerra-5.1/cinelerra/dvdcreate.h +++ b/cinelerra-5.1/cinelerra/dvdcreate.h @@ -38,8 +38,7 @@ public: void handle_close_event(int result); BC_Window* new_gui(); int option_presets(); - int create_dvd_jobs(ArrayList *jobs, - const char *tmp_path, const char *asset_title); + int create_dvd_jobs(ArrayList *jobs, const char *asset_path); int insert_video_plugin(const char *title, KeyFrame *default_keyframe); int resize_tracks(); @@ -114,6 +113,7 @@ class CreateDVD_AssetTitle : public BC_TextBox public: CreateDVD_AssetTitle(CreateDVD_GUI *gui, int x, int y, int w); ~CreateDVD_AssetTitle(); + int handle_event(); CreateDVD_GUI *gui; }; diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index 03709b10..1f76a92a 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -330,7 +330,6 @@ BC_Window* Render::new_gui() batch_cancelled = 0; format_error = 0; result = 0; - completion->reset(); if(mode == Render::INTERACTIVE) { // Fix the asset for rendering @@ -529,6 +528,7 @@ void Render::start_render() in_progress = 0; elapsed_time = 0.0; result = 0; + completion->reset(); thread->start(); } @@ -1011,7 +1011,6 @@ if(debug) printf("Render::render %d\n", __LINE__); render->packages = 0; render->in_progress = 0; - render->completion->unlock(); if(debug) printf("Render::render %d\n", __LINE__); } @@ -1096,6 +1095,7 @@ void RenderThread::run() mwindow->batch_render->update_done(-1, 0, 0); } } + render->completion->unlock(); } diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 8e5a1e54..1dc1f308 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -128,7 +128,7 @@ int BC_FileBoxListBox::sort_order_event() { get_resources()->filebox_sortcolumn = filebox->sort_column = get_sort_column(); get_resources()->filebox_sortorder = filebox->sort_order = get_sort_order(); - filebox->refresh(); + filebox->refresh(-1); return 1; } @@ -582,20 +582,24 @@ void BC_FileBox::create_objects() // Create recent dir list create_history(); + update_history(); // Directories aren't filtered in FileSystem so skip this if(!want_directory) { filter_list.append(new BC_ListBoxItem("*")); - filter_list.append(new BC_ListBoxItem("[*.ifo][*.vob]")); + filter_list.append(new BC_ListBoxItem("[*.mkv]")); + filter_list.append(new BC_ListBoxItem("[*.mp4]")); filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]")); filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]")); - filter_list.append(new BC_ListBoxItem("heroine*")); filter_list.append(new BC_ListBoxItem("*.xml")); fs->set_filter(get_resources()->filebox_filter); } -// fs->update(directory); + fs->set_sort_order(sort_order); + fs->set_sort_field(column_type[sort_column]); + fs->update(directory); + create_icons(); create_tables(); @@ -807,8 +811,6 @@ int BC_FileBox::create_tables() fs->set_sort_order(sort_order); fs->set_sort_field(column_type[sort_column]); -// Directory is entered before this from a random source - fs->update(0); for(int i = 0; i < fs->total_files(); i++) { FileItem *file_item = fs->get_entry(i); @@ -913,20 +915,11 @@ BC_Pixmap* BC_FileBox::get_icon(char *path, int is_dir) const char* BC_FileBox::columntype_to_text(int type) { - switch(type) - { - case FILEBOX_NAME: - return FILEBOX_NAME_TEXT; - break; - case FILEBOX_SIZE: - return FILEBOX_SIZE_TEXT; - break; - case FILEBOX_DATE: - return FILEBOX_DATE_TEXT; - break; - case FILEBOX_EXTENSION: - return FILEBOX_EXTENSION_TEXT; - break; + switch(type) { + case FILEBOX_NAME: return FILEBOX_NAME_TEXT; + case FILEBOX_SIZE: return FILEBOX_SIZE_TEXT; + case FILEBOX_DATE: return FILEBOX_DATE_TEXT; + case FILEBOX_EXTENSION: return FILEBOX_EXTENSION_TEXT; } return ""; } @@ -940,13 +933,19 @@ int BC_FileBox::column_of_type(int type) -int BC_FileBox::refresh(int zscroll) +int BC_FileBox::refresh(int reset) { + fs->set_sort_order(sort_order); + fs->set_sort_field(column_type[sort_column]); + if( reset >= 0 ) + fs->update(0); + else + fs->update_sort(); create_tables(); listbox->set_master_column(column_of_type(FILEBOX_NAME), 0); listbox->update(list_column, column_titles, column_width, columns, - !zscroll ? listbox->get_xposition() : 0, - !zscroll ? listbox->get_yposition() : 0, + reset>0 ? 0 : listbox->get_xposition(), + reset>0 ? 0 : listbox->get_yposition(), -1, 1); return 0; } @@ -966,7 +965,6 @@ void BC_FileBox::move_column(int src, int dst) { if(src != dst) { - ArrayList *new_columns = new ArrayList[columns]; int *new_types = new int[columns]; diff --git a/cinelerra-5.1/guicast/bcfilebox.h b/cinelerra-5.1/guicast/bcfilebox.h index 509fa0d8..682fa9c3 100644 --- a/cinelerra-5.1/guicast/bcfilebox.h +++ b/cinelerra-5.1/guicast/bcfilebox.h @@ -249,7 +249,7 @@ public: void create_history(); void update_history(); - int refresh(int zscroll=0); + int refresh(int reset=0); // The OK and Use This button submits a path. // The cancel button has a current path highlighted but possibly different from the diff --git a/cinelerra-5.1/guicast/filesystem.C b/cinelerra-5.1/guicast/filesystem.C index 45e145a1..50c38a1c 100644 --- a/cinelerra-5.1/guicast/filesystem.C +++ b/cinelerra-5.1/guicast/filesystem.C @@ -43,14 +43,9 @@ FileItem::FileItem() reset(); } -FileItem::FileItem(char *path, - char *name, - int is_dir, - int64_t size, - int month, - int day, - int year, - int64_t calendar_time) +FileItem::FileItem(char *path, char *name, int is_dir, + int64_t size, int month, int day, int year, + int64_t calendar_time, int item_no) { this->path = new char[strlen(path)]; this->name = new char[strlen(name)]; @@ -62,6 +57,7 @@ FileItem::FileItem(char *path, this->day = day; this->year = year; this->calendar_time = calendar_time; + this->item_no = item_no; } FileItem::~FileItem() @@ -81,6 +77,7 @@ int FileItem::reset() day = 0; year = 0; calendar_time = 0; + item_no = -1; return 0; } @@ -141,11 +138,7 @@ int FileSystem::reset_parameters() int FileSystem::delete_directory() { - for(int i = 0; i < dir_list.total; i++) - { - delete dir_list.values[i]; - } - dir_list.remove_all(); + dir_list.remove_all_objects(); return 0; } @@ -190,14 +183,18 @@ int FileSystem::path_ascending(const void *ptr1, const void *ptr2) FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; //printf("path_ascending %p %p\n", ptr1, ptr2); - return strcasecmp(item1->name, item2->name); + int ret = strcasecmp(item1->name, item2->name); + if( ret != 0 ) return ret; + return item1->item_no - item2->item_no; } int FileSystem::path_descending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return strcasecmp(item2->name, item1->name); + int ret = strcasecmp(item2->name, item1->name); + if( ret != 0 ) return ret; + return item2->item_no - item1->item_no; } @@ -205,14 +202,18 @@ int FileSystem::size_ascending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item1->size >= item2->size; + return item1->size == item2->size ? + item1->item_no - item2->item_no : + item1->size > item2->size; } int FileSystem::size_descending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item1->size <= item2->size; + return item2->size == item1->size ? + item2->item_no - item1->item_no : + item2->size > item1->size; } @@ -220,21 +221,33 @@ int FileSystem::date_ascending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item1->calendar_time >= item2->calendar_time; + return item1->calendar_time == item2->calendar_time ? + item1->item_no - item2->item_no : + item1->calendar_time > item2->calendar_time; } int FileSystem::date_descending(const void *ptr1, const void *ptr2) { FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; - return item1->calendar_time <= item2->calendar_time; + return item2->calendar_time == item1->calendar_time ? + item2->item_no - item1->item_no : + item2->calendar_time > item1->calendar_time; } int FileSystem::ext_ascending(const void *ptr1, const void *ptr2) { - char dotreversedname1[BCTEXTLEN], dotreversedname2[BCTEXTLEN]; FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; + char *ext1 = strrchr(item1->name,'.'); + if( !ext1 ) ext1 = item1->name; + char *ext2 = strrchr(item2->name,'.'); + if( !ext2 ) ext2 = item2->name; + int ret = strcasecmp(ext1, ext2); + if( ret ) return ret; + if( item1->item_no >= 0 && item2->item_no >= 0 ) + return item1->item_no - item2->item_no; + char dotreversedname1[BCTEXTLEN], dotreversedname2[BCTEXTLEN]; dot_reverse_filename(dotreversedname1,item1->name); dot_reverse_filename(dotreversedname2,item2->name); return strcasecmp(dotreversedname1, dotreversedname2); @@ -242,9 +255,17 @@ int FileSystem::ext_ascending(const void *ptr1, const void *ptr2) int FileSystem::ext_descending(const void *ptr1, const void *ptr2) { - char dotreversedname1[BCTEXTLEN], dotreversedname2[BCTEXTLEN]; FileItem *item1 = *(FileItem**)ptr1; FileItem *item2 = *(FileItem**)ptr2; + char *ext1 = strrchr(item1->name,'.'); + if( !ext1 ) ext1 = item1->name; + char *ext2 = strrchr(item2->name,'.'); + if( !ext2 ) ext2 = item2->name; + int ret = strcasecmp(ext2, ext1); + if( ret ) return ret; + if( item2->item_no >= 0 && item1->item_no >= 0 ) + return item2->item_no - item1->item_no; + char dotreversedname1[BCTEXTLEN], dotreversedname2[BCTEXTLEN]; dot_reverse_filename(dotreversedname1,item1->name); dot_reverse_filename(dotreversedname2,item2->name); return strcasecmp(dotreversedname2, dotreversedname1); @@ -252,39 +273,17 @@ int FileSystem::ext_descending(const void *ptr1, const void *ptr2) int FileSystem::sort_table(ArrayList *dir_list) { -#define SORT_MACRO(compare) \ - qsort(dir_list->values, dir_list->size(), sizeof(FileItem*), compare); - if(!dir_list || !dir_list->size()) return 0; + static int (*cmpr[][2])(const void *ptr1, const void *ptr2) = { + { &path_ascending, &path_descending }, + { &size_ascending, &size_descending }, + { &date_ascending, &date_descending }, + { &ext_ascending, &ext_descending }, + }; -//printf("FileSystem::sort_table %p\n", dir_list->values); - switch(sort_field) - { - case SORT_PATH: - if(sort_order == SORT_ASCENDING) - SORT_MACRO(path_ascending) - else - SORT_MACRO(path_descending) - break; - case SORT_SIZE: - if(sort_order == SORT_ASCENDING) - SORT_MACRO(size_ascending) - else - SORT_MACRO(size_descending) - break; - case SORT_DATE: - if(sort_order == SORT_ASCENDING) - SORT_MACRO(date_ascending) - else - SORT_MACRO(date_descending) - break; - case SORT_EXTENSION: - if(sort_order == SORT_ASCENDING) - SORT_MACRO(ext_ascending) - else - SORT_MACRO(ext_descending) - break; - } + qsort(dir_list->values, + dir_list->size(), sizeof(FileItem*), + cmpr[sort_field][sort_order]); return 0; } @@ -438,27 +437,17 @@ int FileSystem::test_filter(FileItem *file) } -int FileSystem::update(const char *new_dir) +int FileSystem::scan_directory(const char *new_dir) { - DIR *dirstream; - struct dirent64 *new_filename; - struct stat ostat; - struct tm *mod_time; - int include_this; - FileItem *new_file; - char full_path[BCTEXTLEN], name_only[BCTEXTLEN]; - ArrayListdirectories; - ArrayListfiles; - int result = 0; - - delete_directory(); - if(new_dir != 0) strcpy(current_dir, new_dir); - dirstream = opendir(current_dir); - if(!dirstream) return 1; // failed to open directory + if( new_dir != 0 ) + strcpy(current_dir, new_dir); + DIR *dirstream = opendir(current_dir); + if( !dirstream ) return 1; // failed to open directory - while( (new_filename = readdir64(dirstream)) != 0 ) - { - include_this = 1; + struct dirent64 *new_filename; + while( (new_filename = readdir64(dirstream)) != 0 ) { + FileItem *new_file = 0; + int include_this = 1; // File is directory heirarchy if(!strcmp(new_filename->d_name, ".") || @@ -473,6 +462,7 @@ int FileSystem::update(const char *new_dir) if(include_this) { new_file = new FileItem; + char full_path[BCTEXTLEN], name_only[BCTEXTLEN]; sprintf(full_path, "%s", current_dir); if(!is_root_dir(current_dir)) strcat(full_path, "/"); strcat(full_path, new_filename->d_name); @@ -481,10 +471,11 @@ int FileSystem::update(const char *new_dir) new_file->set_name(name_only); // Get information about the file. + struct stat ostat; if(!stat(full_path, &ostat)) { new_file->size = ostat.st_size; - mod_time = localtime(&(ostat.st_mtime)); + struct tm *mod_time = localtime(&(ostat.st_mtime)); new_file->month = mod_time->tm_mon + 1; new_file->day = mod_time->tm_mday; new_file->year = mod_time->tm_year + 1900; @@ -511,28 +502,38 @@ int FileSystem::update(const char *new_dir) // add to list if(include_this) - { - if(new_file->is_dir) directories.append(new_file); - else files.append(new_file); - } + dir_list.append(new_file); else delete new_file; } } -//printf("FileSystem::update %d\n", __LINE__); + return 0; +} - closedir(dirstream); +int FileSystem::update(const char *new_dir) +{ + delete_directory(); + int result = scan_directory(new_dir); // combine the directories and files in the master list - combine(&directories, &files); -// remove pointers - directories.remove_all(); - files.remove_all(); -//printf("FileSystem::update %d\n", __LINE__); + return !result ? update_sort() : result; +} - return result; +int FileSystem::update_sort() +{ + ArrayList directories, files; + for( int i=0; i< dir_list.size(); ++i ) { + FileItem *item = dir_list[i]; + item->item_no = i; + (item->is_dir ? &directories : &files)->append(item); + } + dir_list.remove_all(); +// combine the directories and files in the master list + combine(&directories, &files); + return 0; // success } + int FileSystem::set_filter(const char *new_filter) { strcpy(filter, new_filter); diff --git a/cinelerra-5.1/guicast/filesystem.h b/cinelerra-5.1/guicast/filesystem.h index 40a0b7f6..14fe9ef5 100644 --- a/cinelerra-5.1/guicast/filesystem.h +++ b/cinelerra-5.1/guicast/filesystem.h @@ -30,14 +30,9 @@ class FileItem { public: FileItem(); - FileItem(char *path, - char *name, - int is_dir, - int64_t size, - int month, - int day, - int year, - int64_t calendar_time); + FileItem(char *path, char *name, int is_dir, + int64_t size, int month, int day, int year, + int64_t calendar_time, int item_no=-1); ~FileItem(); int set_path(char *path); @@ -55,6 +50,7 @@ public: int day; int year; int64_t calendar_time; + int item_no; }; class FileSystem @@ -67,7 +63,9 @@ public: // Load the new directory and change current_dir to it. // This does not complete the dir path. // If any of the files failed to stat, it returns nonzero. + int scan_directory(const char*); int update(const char *new_dir = 0); + int update_sort(); // Complete the path in the string and change to the directory in the string. // Does not change new_dir diff --git a/cinelerra-5.1/libzmpeg3/libzmpeg3.C b/cinelerra-5.1/libzmpeg3/libzmpeg3.C index 409e7b43..d27e5ceb 100644 --- a/cinelerra-5.1/libzmpeg3/libzmpeg3.C +++ b/cinelerra-5.1/libzmpeg3/libzmpeg3.C @@ -428,10 +428,11 @@ check_sig(char *path) else if( bits == TOC_PREFIX ) { result = 1; } - /* Blu-Ray or AVC-HD*/ - else if( is_bd_(bits, bits2, ext) ) { - result = 1; - } +/* don't use, does not work well at all */ +// /* Blu-Ray or AVC-HD*/ +// else if( is_bd_(bits, bits2, ext) ) { +// result = 1; +// } else if( (((bits >> 24) & 0xff) == zmpeg3_t::SYNC_BYTE ) || (bits == zmpeg3_t::PACK_START_CODE) || ((bits & 0xfff00000) == 0xfff00000) || diff --git a/cinelerra-5.1/plugins/cdripper/cdripwindow.C b/cinelerra-5.1/plugins/cdripper/cdripwindow.C index ec71baff..0116664f 100644 --- a/cinelerra-5.1/plugins/cdripper/cdripwindow.C +++ b/cinelerra-5.1/plugins/cdripper/cdripwindow.C @@ -40,11 +40,11 @@ void CDRipWindow::create_objects() { int y = 10, x = 10; add_tool(new BC_Title(x, y, _("Select the range to transfer:"))); y += 25; - add_tool(new BC_Title(x, y, _("Track"))); x += 70; + add_tool(new BC_Title(x, y, _("Track:"))); x += 70; add_tool(new BC_Title(x, y, _("Min."))); x += 70; add_tool(new BC_Title(x, y, _("Sec."))); x += 100; - add_tool(new BC_Title(x, y, _("Track"))); x += 70; + add_tool(new BC_Title(x, y, _("Track:"))); x += 70; add_tool(new BC_Title(x, y, _("Min."))); x += 70; add_tool(new BC_Title(x, y, _("Sec."))); x += 100; diff --git a/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C b/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C index 859a4301..ffe0b911 100644 --- a/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C +++ b/cinelerra-5.1/plugins/motion-cv/motionwindow-cv.C @@ -31,7 +31,7 @@ #include "pluginserver.h" MotionCVWindow::MotionCVWindow(MotionCVMain *plugin) - : PluginClientWindow(plugin, 815, 575, 815, 575, 0) + : PluginClientWindow(plugin, 815, 600, 815, 600, 0) { this->plugin = plugin; } @@ -100,12 +100,13 @@ void MotionCVWindow::create_objects() this, x + title->get_w() + 10, y)); mode3->create_objects(); + y += 40; int y1 = y; add_subwindow(title = new BC_Title(x2, y, _("Tracking file:"))); add_subwindow(tracking_file = new MotionCVTrackingFile(plugin, plugin->config. tracking_file, this, x2 + title->get_w() + 20, y)); + y1 += tracking_file->get_h() + 10; - y += 40; int y1 = y; add_subwindow(title = new BC_Title(x, y + 10, _("Block X:"))); add_subwindow(block_x = new MotionCVBlockX(plugin, this, x + title->get_w() + 10, y)); @@ -152,7 +153,7 @@ void MotionCVWindow::create_objects() add_subwindow(addtrackedframeoffset = new AddTrackedFrameOffset(plugin, this, x1=x2, y1+=track_frame_number->get_h())); int pef = client->server->mwindow->edl->session->video_every_frame; - add_subwindow(pef_title = new BC_Title(x1=x2, y1+=addtrackedframeoffset->get_h() + 5, + add_subwindow(pef_title = new BC_Title(x1=x2+50, y1+=addtrackedframeoffset->get_h() + 5, !pef ? _("For best results\n" " Set: Play every frame\n" " Preferences-> Playback-> Video Out") : diff --git a/cinelerra-5.1/plugins/motion/motionwindow.C b/cinelerra-5.1/plugins/motion/motionwindow.C index 86948858..8f3a244a 100644 --- a/cinelerra-5.1/plugins/motion/motionwindow.C +++ b/cinelerra-5.1/plugins/motion/motionwindow.C @@ -32,7 +32,7 @@ #include "pluginserver.h" MotionWindow::MotionWindow(MotionMain *plugin) - : PluginClientWindow(plugin, 800, 660, 800, 660, 0) + : PluginClientWindow(plugin, 800, 640, 800, 640, 0) { this->plugin = plugin; } @@ -107,11 +107,12 @@ void MotionWindow::create_objects() y)); track_direction->create_objects(); + y += 40; add_subwindow(title = new BC_Title(x2, y, _("Tracking file:"))); add_subwindow(tracking_file = new MotionTrackingFile(plugin, plugin->config.tracking_file, this, x2+title->get_w() + 20, y)); - y += 40; + int y1 = y; add_subwindow(title = new BC_Title(x, y + 10, _("Block X:"))); add_subwindow(block_x = new MotionBlockX(plugin, this, x + title->get_w() + 10, y)); @@ -119,12 +120,12 @@ void MotionWindow::create_objects() new MotionBlockXText(plugin, this, x + title->get_w() + 10 + block_x->get_w() + 10, y + 10)); + y += 40; add_subwindow(title = new BC_Title(x2, y, _("Rotation center:"))); add_subwindow(rotation_center = new RotationCenter(plugin, x2 + title->get_w() + 10, y)); - int y1 = y; - y += 50; + y += 40; add_subwindow(title = new BC_Title(x2, y + 10, _("Maximum angle offset:"))); add_subwindow(rotate_magnitude = new MotionRMagnitude(plugin, x2 + title->get_w() + 10, y)); @@ -174,7 +175,7 @@ void MotionWindow::create_objects() add_subwindow(addtrackedframeoffset = new AddTrackedFrameOffset(plugin, this, x1=x2, y1+=track_frame_number->get_h())); int pef = client->server->mwindow->edl->session->video_every_frame; - add_subwindow(pef_title = new BC_Title(x1=x2, y1+=addtrackedframeoffset->get_h() + 5, + add_subwindow(pef_title = new BC_Title(x1=x2+50, y1+=addtrackedframeoffset->get_h() + 5, !pef ? _("For best results\n" " Set: Play every frame\n" " Preferences-> Playback-> Video Out") : -- 2.26.2