From 49f85559268fc040fe7ba5611cc0520793cf728b Mon Sep 17 00:00:00 2001 From: Good Guy Date: Sat, 15 Oct 2016 12:08:32 -0600 Subject: [PATCH] remove v4l/lml/buz, add symbolic folders, more xlat update, yuyv fixes, v4l2 upgrades --- cinelerra-5.1/cinelerra/Makefile | 2 - cinelerra-5.1/cinelerra/amodule.C | 6 +- cinelerra-5.1/cinelerra/asset.C | 31 +- cinelerra-5.1/cinelerra/assetedit.C | 8 +- cinelerra-5.1/cinelerra/audioidevice.C | 2 +- cinelerra-5.1/cinelerra/awindowgui.C | 295 ++++--- cinelerra-5.1/cinelerra/awindowgui.h | 13 +- cinelerra-5.1/cinelerra/buz.h | 379 --------- cinelerra-5.1/cinelerra/channeledit.C | 28 +- cinelerra-5.1/cinelerra/channelpicker.C | 10 +- cinelerra-5.1/cinelerra/cwindow.C | 3 +- cinelerra-5.1/cinelerra/cwindowgui.C | 9 +- cinelerra-5.1/cinelerra/cwindowgui.h | 6 +- cinelerra-5.1/cinelerra/defaultformats.h | 26 +- cinelerra-5.1/cinelerra/devicev4l2base.C | 29 +- cinelerra-5.1/cinelerra/devicev4l2base.h | 2 + cinelerra-5.1/cinelerra/edl.C | 2 +- cinelerra-5.1/cinelerra/edl.inc | 24 +- cinelerra-5.1/cinelerra/edlsession.C | 27 +- cinelerra-5.1/cinelerra/edlsession.h | 2 +- cinelerra-5.1/cinelerra/filedv.C | 11 +- cinelerra-5.1/cinelerra/fileexr.C | 2 +- cinelerra-5.1/cinelerra/fileffmpeg.C | 70 +- cinelerra-5.1/cinelerra/filejpeg.C | 9 +- cinelerra-5.1/cinelerra/filelist.C | 2 +- cinelerra-5.1/cinelerra/filempeg.C | 19 +- cinelerra-5.1/cinelerra/fileogg.C | 2 +- cinelerra-5.1/cinelerra/filepng.C | 2 +- cinelerra-5.1/cinelerra/filetiff.C | 2 +- cinelerra-5.1/cinelerra/formattools.C | 4 - cinelerra-5.1/cinelerra/indexable.C | 2 +- cinelerra-5.1/cinelerra/indexable.h | 2 +- cinelerra-5.1/cinelerra/indexfile.C | 2 +- cinelerra-5.1/cinelerra/interlacemodes.C | 126 +-- cinelerra-5.1/cinelerra/interlacemodes.h | 69 +- cinelerra-5.1/cinelerra/libmjpeg.C | 23 - cinelerra-5.1/cinelerra/libmjpeg.h | 12 - cinelerra-5.1/cinelerra/localsession.C | 14 +- cinelerra-5.1/cinelerra/localsession.h | 2 +- cinelerra-5.1/cinelerra/mwindow.C | 20 +- cinelerra-5.1/cinelerra/packagerenderer.C | 6 +- cinelerra-5.1/cinelerra/playbackconfig.C | 29 +- cinelerra-5.1/cinelerra/playbackconfig.h | 9 +- cinelerra-5.1/cinelerra/playbackengine.C | 10 +- cinelerra-5.1/cinelerra/record.C | 4 - cinelerra-5.1/cinelerra/recordconfig.C | 22 +- cinelerra-5.1/cinelerra/recordconfig.h | 6 +- cinelerra-5.1/cinelerra/recordmonitor.C | 23 +- cinelerra-5.1/cinelerra/renderengine.C | 25 - cinelerra-5.1/cinelerra/renderengine.h | 20 - cinelerra-5.1/cinelerra/resourcepixmap.C | 2 +- cinelerra-5.1/cinelerra/resourcethread.C | 2 +- cinelerra-5.1/cinelerra/vdevicebuz.C | 805 -------------------- cinelerra-5.1/cinelerra/vdevicebuz.h | 129 ---- cinelerra-5.1/cinelerra/vdevicebuz.inc | 28 - cinelerra-5.1/cinelerra/vdevicelml.C | 439 ----------- cinelerra-5.1/cinelerra/vdevicelml.h | 106 --- cinelerra-5.1/cinelerra/vdevicelml.inc | 27 - cinelerra-5.1/cinelerra/vdeviceprefs.C | 124 +-- cinelerra-5.1/cinelerra/vdeviceprefs.h | 4 - cinelerra-5.1/cinelerra/vdevicev4l.C | 573 -------------- cinelerra-5.1/cinelerra/vdevicev4l.h | 94 --- cinelerra-5.1/cinelerra/vdevicev4l.inc | 27 - cinelerra-5.1/cinelerra/videoconfig.C | 15 +- cinelerra-5.1/cinelerra/videoconfig.h | 3 - cinelerra-5.1/cinelerra/videodevice.C | 53 +- cinelerra-5.1/cinelerra/videodevice.h | 3 - cinelerra-5.1/cinelerra/videodevice.inc | 12 +- cinelerra-5.1/cinelerra/vmodule.C | 14 +- cinelerra-5.1/cinelerra/vpatchgui.C | 8 +- cinelerra-5.1/cinelerra/vwindow.C | 37 - cinelerra-5.1/cinelerra/vwindow.h | 2 - cinelerra-5.1/guicast/bccmdl.py | 12 +- cinelerra-5.1/plugin_defs | 2 + cinelerra-5.1/plugins/livevideo/livevideo.C | 2 - 75 files changed, 501 insertions(+), 3475 deletions(-) delete mode 100644 cinelerra-5.1/cinelerra/buz.h delete mode 100644 cinelerra-5.1/cinelerra/vdevicebuz.C delete mode 100644 cinelerra-5.1/cinelerra/vdevicebuz.h delete mode 100644 cinelerra-5.1/cinelerra/vdevicebuz.inc delete mode 100644 cinelerra-5.1/cinelerra/vdevicelml.C delete mode 100644 cinelerra-5.1/cinelerra/vdevicelml.h delete mode 100644 cinelerra-5.1/cinelerra/vdevicelml.inc delete mode 100644 cinelerra-5.1/cinelerra/vdevicev4l.C delete mode 100644 cinelerra-5.1/cinelerra/vdevicev4l.h delete mode 100644 cinelerra-5.1/cinelerra/vdevicev4l.inc diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index 853ab8f1..19907a9b 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -294,14 +294,12 @@ OBJS = \ $(OBJDIR)/vautomation.o \ $(OBJDIR)/vdevice1394.o \ $(OBJDIR)/vdevicebase.o \ - $(OBJDIR)/vdevicebuz.o \ $(OBJDIR)/vdevicedvb.o \ $(OBJDIR)/vdevicempeg.o \ $(OBJDIR)/vdeviceprefs.o \ $(OBJDIR)/vdevicev4l2jpeg.o \ $(OBJDIR)/vdevicev4l2mpeg.o \ $(OBJDIR)/vdevicev4l2.o \ - $(OBJDIR)/vdevicev4l.o \ $(OBJDIR)/vdevicex11.o \ $(OBJDIR)/vedit.o \ $(OBJDIR)/vedits.o \ diff --git a/cinelerra-5.1/cinelerra/amodule.C b/cinelerra-5.1/cinelerra/amodule.C index 91116411..d3b1b18e 100644 --- a/cinelerra-5.1/cinelerra/amodule.C +++ b/cinelerra-5.1/cinelerra/amodule.C @@ -385,11 +385,7 @@ if(debug) printf("AModule::import_samples %d\n", __LINE__); nested_command->get_edl()->copy_all(nested_edl); nested_command->change_type = CHANGE_ALL; nested_command->realtime = renderengine->command->realtime; - nested_renderengine = new RenderEngine(0, - get_preferences(), - 0, - renderengine ? renderengine->channeldb : 0, - 1); + nested_renderengine = new RenderEngine(0, get_preferences(), 0, 1); nested_renderengine->set_acache(get_cache()); // Must use a private cache for the audio // if(!cache) diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index 6aa73d7b..9cf4a305 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -21,6 +21,7 @@ #include "asset.h" #include "assets.h" +#include "awindowgui.h" #include "bchash.h" #include "bcsignals.h" #include "clip.h" @@ -90,9 +91,9 @@ int Asset::init_values() jpeg_quality = 80; aspect_ratio = -1; - interlace_autofixoption = BC_ILACE_AUTOFIXOPTION_AUTO; - interlace_mode = BC_ILACE_MODE_UNDETECTED; - interlace_fixmethod = BC_ILACE_FIXMETHOD_NONE; + interlace_autofixoption = ILACE_AUTOFIXOPTION_AUTO; + interlace_mode = ILACE_MODE_UNDETECTED; + interlace_fixmethod = ILACE_FIXMETHOD_NONE; ampeg_bitrate = 256; ampeg_derivative = 3; @@ -192,8 +193,8 @@ void Asset::copy_from(Asset *asset, int do_index) void Asset::copy_location(Asset *asset) { - strcpy(this->path, asset->path); - strcpy(this->folder, asset->folder); + strcpy(path, asset->path); + awindow_folder = asset->awindow_folder; } void Asset::copy_format(Asset *asset, int do_index) @@ -464,7 +465,9 @@ int Asset::read(FileXML *file, else if(file->tag.title_is("FOLDER")) { - strcpy(folder, file->read_text()); + const char *string = file->tag.get_property("NUMBER"); + awindow_folder = string ? atoi(string) : + AWindowGUI::folder_number(file->read_text()); } else if(file->tag.title_is("VIDEO")) @@ -537,11 +540,11 @@ int Asset::read_video(FileXML *file) interlace_autofixoption = file->tag.get_property("INTERLACE_AUTOFIX",0); - ilacemode_to_xmltext(string, BC_ILACE_MODE_NOTINTERLACED); - interlace_mode = ilacemode_from_xmltext(file->tag.get_property("INTERLACE_MODE",string), BC_ILACE_MODE_NOTINTERLACED); + ilacemode_to_xmltext(string, ILACE_MODE_NOTINTERLACED); + interlace_mode = ilacemode_from_xmltext(file->tag.get_property("INTERLACE_MODE",string), ILACE_MODE_NOTINTERLACED); - ilacefixmethod_to_xmltext(string, BC_ILACE_FIXMETHOD_NONE); - interlace_fixmethod = ilacefixmethod_from_xmltext(file->tag.get_property("INTERLACE_FIXMETHOD",string), BC_ILACE_FIXMETHOD_NONE); + ilacefixmethod_to_xmltext(string, ILACE_FIXMETHOD_NONE); + interlace_fixmethod = ilacefixmethod_from_xmltext(file->tag.get_property("INTERLACE_FIXMETHOD",string), ILACE_FIXMETHOD_NONE); file->tag.get_property("REEL_NAME", reel_name); reel_number = file->tag.get_property("REEL_NUMBER", reel_number); @@ -593,8 +596,8 @@ int Asset::write(FileXML *file, file->append_newline(); file->tag.set_title("FOLDER"); + file->tag.set_property("NUMBER", awindow_folder); file->append_tag(); - file->append_text(folder); file->tag.set_title("/FOLDER"); file->append_tag(); file->append_newline(); @@ -831,9 +834,9 @@ void Asset::load_defaults(BC_Hash *defaults, jpeg_quality = GET_DEFAULT("JPEG_QUALITY", jpeg_quality); aspect_ratio = GET_DEFAULT("ASPECT_RATIO", aspect_ratio); - interlace_autofixoption = BC_ILACE_AUTOFIXOPTION_AUTO; - interlace_mode = BC_ILACE_MODE_UNDETECTED; - interlace_fixmethod = BC_ILACE_FIXMETHOD_UPONE; + interlace_autofixoption = ILACE_AUTOFIXOPTION_AUTO; + interlace_mode = ILACE_MODE_UNDETECTED; + interlace_fixmethod = ILACE_FIXMETHOD_UPONE; // MPEG format information vmpeg_iframe_distance = GET_DEFAULT("VMPEG_IFRAME_DISTANCE", vmpeg_iframe_distance); diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index c2102d2b..7854999d 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -577,7 +577,7 @@ void AssetEditWindow::create_objects() y += ilacefixoption_chkboxw->get_h() + 5; // -------------------- add_subwindow(title = new BC_Title(x1, y, _("Asset's interlacing:"))); - add_subwindow(textboxw = new AssetEditILacemode(this, "", BC_ILACE_ASSET_MODEDEFAULT, x2, y, 200)); + add_subwindow(textboxw = new AssetEditILacemode(this, "", ILACE_ASSET_MODEDEFAULT, x2, y, 200)); ilacefixoption_chkboxw->ilacemode_textbox = textboxw; add_subwindow(listboxw = new AssetEditInterlacemodePulldown(mwindow, textboxw, @@ -591,7 +591,7 @@ void AssetEditWindow::create_objects() // -------------------- add_subwindow(title = new BC_Title(x1, y, _("Interlace correction:"))); - add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", BC_ILACE_FIXDEFAULT, x2, y, 200)); + add_subwindow(textboxw = new AssetEditILacefixmethod(this, "", ILACE_FIXDEFAULT, x2, y, 200)); ilacefixoption_chkboxw->ilacefixmethod_textbox = textboxw; add_subwindow(listboxw = new InterlacefixmethodPulldown(mwindow, textboxw, @@ -731,7 +731,7 @@ void Interlaceautofix::showhideotherwidgets() int thevalue = get_value(); Asset *asset = fwindow->asset_edit->changed_params; - if (thevalue == BC_ILACE_AUTOFIXOPTION_AUTO) + if (thevalue == ILACE_AUTOFIXOPTION_AUTO) { this->ilacemode_textbox->enable(); this->ilacemode_listbox->enable(); @@ -741,7 +741,7 @@ void Interlaceautofix::showhideotherwidgets() ilacefixmethod_to_text(string,xx); this->ilacefixmethod_textbox->update(string); } - if (thevalue == BC_ILACE_AUTOFIXOPTION_MANUAL) + if (thevalue == ILACE_AUTOFIXOPTION_MANUAL) { this->ilacemode_textbox->disable(); this->ilacemode_listbox->disable(); diff --git a/cinelerra-5.1/cinelerra/audioidevice.C b/cinelerra-5.1/cinelerra/audioidevice.C index 7cd858be..6d4e1832 100644 --- a/cinelerra-5.1/cinelerra/audioidevice.C +++ b/cinelerra-5.1/cinelerra/audioidevice.C @@ -219,7 +219,7 @@ void AudioDevice::end_input() { is_recording = 0; polling_lock->unlock(); - buffer_lock->unlock(); + buffer_lock->reset(); } int AudioDevice::reset_input() diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index ba047200..1dcacb94 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -66,6 +66,18 @@ #include +const char *AWindowGUI::folder_names[] = +{ + N_("Audio Effects"), + N_("Video Effects"), + N_("Audio Transitions"), + N_("Video Transitions"), + N_("Labels"), + N_("Clips"), + N_("Media"), + N_("User") +}; + AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_t length) : VIcon(w, h, framerate) @@ -150,11 +162,21 @@ AssetPicon::AssetPicon(MWindow *mwindow, } AssetPicon::AssetPicon(MWindow *mwindow, - AWindowGUI *gui, - const char *folder) - : BC_ListBoxItem(folder, gui->folder_icon) + AWindowGUI *gui, int folder) + : BC_ListBoxItem(_(AWindowGUI::folder_names[folder]), gui->folder_icon) { reset(); + foldernum = folder; + this->mwindow = mwindow; + this->gui = gui; +} + +AssetPicon::AssetPicon(MWindow *mwindow, + AWindowGUI *gui, const char *folder_name, int folder_num) + : BC_ListBoxItem(folder_name, gui->folder_icon) +{ + reset(); + foldernum = folder_num; this->mwindow = mwindow; this->gui = gui; } @@ -536,19 +558,19 @@ SET_TRACE SET_TRACE // Mandatory folders - folders.append(picon = new AssetPicon(mwindow, this, AEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_AEFFECT_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, VEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_VEFFECT_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, ATRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_ATRANSITION_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, VTRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_VTRANSITION_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, LABEL_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_LABEL_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, CLIP_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_CLIP_FOLDER)); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, MEDIA_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, AW_MEDIA_FOLDER)); picon->persistent = 1; create_label_folder(); @@ -719,7 +741,7 @@ int AWindowGUI::close_event() void AWindowGUI::start_vicon_drawing() { if( !vicon_drawing ) return; - if( strcmp(mwindow->edl->session->current_folder, MEDIA_FOLDER) ) return; + if( mwindow->edl->session->awindow_folder != AW_MEDIA_FOLDER ) return; if( mwindow->edl->session->assetlist_format != ASSETS_ICONS ) return; vicon_thread->start_drawing(); } @@ -901,7 +923,7 @@ void AWindowGUI::update_folder_list() // Search assets for folders for(int i = 0; i < mwindow->edl->folders.total; i++) { - char *folder = mwindow->edl->folders.values[i]; + const char *folder = mwindow->edl->folders.values[i]; int exists = 0; //printf("AWindowGUI::update_folder_list 1.1\n"); @@ -918,7 +940,10 @@ void AWindowGUI::update_folder_list() if(!exists) { - AssetPicon *picon = new AssetPicon(mwindow, this, folder); + int aw_folder = folder_number(folder); + AssetPicon *picon = aw_folder >= 0 ? + new AssetPicon(mwindow, this, aw_folder) : + new AssetPicon(mwindow, this, folder, AW_USER_FOLDER); picon->create_objects(); folders.append(picon); } @@ -1118,48 +1143,32 @@ void AWindowGUI::update_asset_list() //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total); } - - - - void AWindowGUI::sort_assets() { //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder); - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) - sort_picons(&aeffects, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) - sort_picons(&veffects, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) - sort_picons(&atransitions, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - sort_picons(&vtransitions, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) - ;// Labels should ALWAYS be sorted by time. - else - sort_picons(&assets, - mwindow->edl->session->current_folder); + switch( mwindow->edl->session->awindow_folder ) { + case AW_AEFFECT_FOLDER: + sort_picons(&aeffects); + break; + case AW_VEFFECT_FOLDER: + sort_picons(&veffects); + break; + case AW_ATRANSITION_FOLDER: + sort_picons(&atransitions); + break; + case AW_VTRANSITION_FOLDER: + sort_picons(&vtransitions); + break; + case AW_LABEL_FOLDER: + // Labels should ALWAYS be sorted by time + break; + default: + sort_picons(&assets); + } update_assets(); } - - - - - - - - - - void AWindowGUI::collect_assets() { int i = 0; @@ -1176,8 +1185,7 @@ void AWindowGUI::collect_assets() } void AWindowGUI::copy_picons(ArrayList *dst, - ArrayList *src, - char *folder) + ArrayList *src, int folder) { // Remove current pointers dst[0].remove_all(); @@ -1189,10 +1197,9 @@ void AWindowGUI::copy_picons(ArrayList *dst, { AssetPicon *picon = (AssetPicon*)src->values[i]; //printf("AWindowGUI::copy_picons 2 %s\n", picon->asset->folder); - if(!folder || - (folder && picon->indexable && !strcasecmp(picon->indexable->folder, folder)) || - (folder && picon->edl && !strcasecmp(picon->edl->local_session->folder, folder))) - { + if( folder < 0 || + (picon->indexable && picon->indexable->awindow_folder == folder) || + (picon->edl && picon->edl->local_session->awindow_folder == folder) ) { BC_ListBoxItem *item2, *item1; dst[0].append(item1 = picon); if(picon->edl) @@ -1209,8 +1216,7 @@ void AWindowGUI::copy_picons(ArrayList *dst, } } -void AWindowGUI::sort_picons(ArrayList *src, - char *folder) +void AWindowGUI::sort_picons(ArrayList *src) { //printf("AWindowGUI::sort_picons 1\n") int done = 0; @@ -1241,46 +1247,36 @@ void AWindowGUI::filter_displayed_assets() allow_iconlisting = 1; asset_titles[0] = _("Title"); asset_titles[1] = _("Comments"); - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) - copy_picons(displayed_assets, - &aeffects, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) - copy_picons(displayed_assets, - &veffects, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) - copy_picons(displayed_assets, - &atransitions, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - copy_picons(displayed_assets, - &vtransitions, - 0); - else - if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) { - copy_picons(displayed_assets, - &labellist, - 0); + + switch( mwindow->edl->session->awindow_folder ) { + case AW_AEFFECT_FOLDER: + copy_picons(displayed_assets, &aeffects, AW_NO_FOLDER); + break; + case AW_VEFFECT_FOLDER: + copy_picons(displayed_assets, &veffects, AW_NO_FOLDER); + break; + case AW_ATRANSITION_FOLDER: + copy_picons(displayed_assets, &atransitions, AW_NO_FOLDER); + break; + case AW_VTRANSITION_FOLDER: + copy_picons(displayed_assets, &vtransitions, AW_NO_FOLDER); + break; + case AW_LABEL_FOLDER: + copy_picons(displayed_assets, &labellist, AW_NO_FOLDER); asset_titles[0] = _("Time Stamps"); asset_titles[1] = _("Title"); allow_iconlisting = 0; + break; + default: + copy_picons(displayed_assets, &assets, mwindow->edl->session->awindow_folder); + break; } - else - copy_picons(displayed_assets, - &assets, - mwindow->edl->session->current_folder); + // Ensure the current folder icon is highlighted for(int i = 0; i < folders.total; i++) - { - if(!strcasecmp(mwindow->edl->session->current_folder, folders.values[i]->get_text())) - folders.values[i]->set_selected(1); - else - folders.values[i]->set_selected(0); - } + folders.values[i]->set_selected(0); + + folders.values[mwindow->edl->session->awindow_folder]->set_selected(1); } @@ -1342,18 +1338,12 @@ void AWindowGUI::update_effects() create_persistent_folder(&vtransitions, 0, 1, 0, 1); } -int AWindowGUI::current_folder_number() +int AWindowGUI::folder_number(const char *name) { - int result = -1; - for(int i = 0; i < folders.total; i++) - { - if(!strcasecmp(folders.values[i]->get_text(), mwindow->edl->session->current_folder)) - { - result = i; - break; - } + for(int i = 0; i < AWINDOW_FOLDERS; i++) { + if( !strcasecmp(name, folder_names[i]) ) return i; } - return result; + return AW_NO_FOLDER; } int AWindowGUI::drag_motion() @@ -1487,7 +1477,7 @@ int AWindowFolders::selection_changed() gui->folderlist_menu->activate_menu(); } - strcpy(mwindow->edl->session->current_folder, picon->get_text()); + mwindow->edl->session->awindow_folder = picon->foldernum; //printf("AWindowFolders::selection_changed 1\n"); gui->asset_list->draw_background(); gui->async_update_assets(); @@ -1573,11 +1563,12 @@ int AWindowAssets::handle_event() //printf("AWindowAssets::handle_event 1 %d %d\n", get_buttonpress(), get_selection(0, 0)); AssetPicon *asset_picon = (AssetPicon *)get_selection(0, 0); if( !asset_picon ) return 0; - const char *folder = mwindow->edl->session->current_folder; - if( !strcasecmp(folder, AEFFECT_FOLDER) ) return 1; - if( !strcasecmp(folder, VEFFECT_FOLDER) ) return 1; - if( !strcasecmp(folder, ATRANSITION_FOLDER) ) return 1; - if( !strcasecmp(folder, VTRANSITION_FOLDER) ) return 1; + switch( mwindow->edl->session->awindow_folder ) { + case AW_AEFFECT_FOLDER: + case AW_VEFFECT_FOLDER: + case AW_ATRANSITION_FOLDER: + case AW_VTRANSITION_FOLDER: return 1; + } VWindow *vwindow = mwindow->vwindows.size() > DEFAULT_VWINDOW ? mwindow->vwindows.get(DEFAULT_VWINDOW) : 0; if( !vwindow || !vwindow->is_running() ) return 1; @@ -1595,32 +1586,26 @@ int AWindowAssets::handle_event() int AWindowAssets::selection_changed() { // Show popup window - if(get_button_down() && get_buttonpress() == 3 && get_selection(0, 0)) - { - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER) || - !strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - { + if( get_button_down() && get_buttonpress() == 3 && get_selection(0, 0) ) { + switch( mwindow->edl->session->awindow_folder ) { + case AW_AEFFECT_FOLDER: + case AW_VEFFECT_FOLDER: + case AW_ATRANSITION_FOLDER: + case AW_VTRANSITION_FOLDER: gui->assetlist_menu->update_titles(); gui->assetlist_menu->activate_menu(); - } - else - if (!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) - { + break; + case AW_LABEL_FOLDER: if(((AssetPicon*)get_selection(0, 0))->label) gui->label_menu->activate_menu(); - } - else - { + break; + default: if(((AssetPicon*)get_selection(0, 0))->indexable) gui->asset_menu->update(); else if(((AssetPicon*)get_selection(0, 0))->edl) gui->asset_menu->update(); - - gui->asset_menu->activate_menu(); } @@ -1644,12 +1629,11 @@ void AWindowAssets::draw_background() clear_box(0,0,get_w(),get_h(),get_bg_surface()); set_color(BC_WindowBase::get_resources()->audiovideo_color); set_font(LARGEFONT); - draw_text(get_w() - - get_text_width(LARGEFONT, mwindow->edl->session->current_folder) - 4, - 30, - mwindow->edl->session->current_folder, - -1, - get_bg_surface()); + int aw_folder = mwindow->edl->session->awindow_folder; + if( aw_folder < 0 ) return; + const char *aw_name = _(AWindowGUI::folder_names[aw_folder]); + draw_text(get_w() - get_text_width(LARGEFONT, aw_name) - 4, 30, + aw_name, -1, get_bg_surface()); } int AWindowAssets::drag_start_event() @@ -1657,43 +1641,33 @@ int AWindowAssets::drag_start_event() int collect_pluginservers = 0; int collect_assets = 0; - if(BC_ListBox::drag_start_event()) - { - if(!strcasecmp(mwindow->edl->session->current_folder, AEFFECT_FOLDER)) - { + if( BC_ListBox::drag_start_event() ) { + switch( mwindow->edl->session->awindow_folder ) { + case AW_AEFFECT_FOLDER: mwindow->session->current_operation = DRAG_AEFFECT; collect_pluginservers = 1; - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, VEFFECT_FOLDER)) - { + break; + case AW_VEFFECT_FOLDER: mwindow->session->current_operation = DRAG_VEFFECT; collect_pluginservers = 1; - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, ATRANSITION_FOLDER)) - { + break; + case AW_ATRANSITION_FOLDER: mwindow->session->current_operation = DRAG_ATRANSITION; collect_pluginservers = 1; - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, VTRANSITION_FOLDER)) - { + break; + case AW_VTRANSITION_FOLDER: mwindow->session->current_operation = DRAG_VTRANSITION; collect_pluginservers = 1; - } - else - if(!strcasecmp(mwindow->edl->session->current_folder, LABEL_FOLDER)) - { + break; + case AW_LABEL_FOLDER: // do nothing! - } - else - { + break; + default: mwindow->session->current_operation = DRAG_ASSET; collect_assets = 1; + break; } - if(collect_pluginservers) { int i = 0; @@ -2040,8 +2014,23 @@ void AddTools::create_objects() } } +#if 0 +// plugin_dirs list from toplevel makefile include plugin_defs +N_("ladspa") +N_("ffmpeg") +N_("audio_tools") +N_("audio_transitions") +N_("blending") +N_("colors") +N_("exotic") +N_("transforms") +N_("tv_effects") +N_("video_tools") +N_("video_transitions") +#endif + AddPluginItem::AddPluginItem(AddTools *menu, char const *text, int idx) - : BC_MenuItem(text) + : BC_MenuItem(_(text)) { this->menu = menu; this->idx = idx; diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index a1d2b5e5..8d9414e0 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -69,7 +69,8 @@ public: AssetPicon(MWindow *mwindow, AWindowGUI *gui, EDL *edl); AssetPicon(MWindow *mwindow, AWindowGUI *gui, PluginServer *plugin); AssetPicon(MWindow *mwindow, AWindowGUI *gui, Label *plugin); - AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder); + AssetPicon(MWindow *mwindow, AWindowGUI *gui, int folder); + AssetPicon(MWindow *mwindow, AWindowGUI *gui, const char *folder_name, int folder_num); virtual ~AssetPicon(); void create_objects(); @@ -79,6 +80,7 @@ public: AWindowGUI *gui; BC_Pixmap *icon; VFrame *icon_vframe; + int foldernum; // ID of thing pointed to int id; @@ -158,7 +160,7 @@ public: void update_effects(); void sort_assets(); void reposition_objects(); - int current_folder_number(); + static int folder_number(const char *name); // Call back for MWindow entry point int drag_motion(); int drag_stop(); @@ -171,10 +173,8 @@ public: int is_transition); void create_label_folder(); void copy_picons(ArrayList *dst, - ArrayList *src, - char *folder); - void sort_picons(ArrayList *src, - char *folder); + ArrayList *src, int folder); + void sort_picons(ArrayList *src); // Return the selected asset in asset_list Indexable* selected_asset(); PluginServer* selected_plugin(); @@ -246,6 +246,7 @@ public: int create_custom_xatoms(); // Function to overload to recieve customly defined atoms virtual int recieve_custom_xatoms(xatom_event *event); + static const char *folder_names[]; private: void update_folder_list(); diff --git a/cinelerra-5.1/cinelerra/buz.h b/cinelerra-5.1/cinelerra/buz.h deleted file mode 100644 index 465f23de..00000000 --- a/cinelerra-5.1/cinelerra/buz.h +++ /dev/null @@ -1,379 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -/* - buz - Iomega Buz driver - - Copyright (C) 1999 Rainer Johanni - - based on - - buz.0.0.3 Copyright (C) 1998 Dave Perks - - and - - bttv - Bt848 frame grabber driver - Copyright (C) 1996,97 Ralph Metzler (rjkm@thp.uni-koeln.de) - - 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., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -#ifndef _BUZ_H_ -#define _BUZ_H_ - -/* The Buz only supports a maximum width of 720, but some V4L - applications (e.g. xawtv are more happy with 768). - If XAWTV_HACK is defined, we try to fake a device with bigger width */ - -//#define XAWTV_HACK - -//#ifdef XAWTV_HACK -//#define BUZ_MAX_WIDTH 768 /* never display more than 768 pixels */ -#define BUZ_MAX_WIDTH (tvnorms[btv->params.norm].Wa) -//#else -//#define BUZ_MAX_WIDTH 720 /* never display more than 720 pixels */ -//#endif -//#define BUZ_MAX_HEIGHT 576 /* never display more than 576 rows */ -#define BUZ_MAX_HEIGHT (tvnorms[btv->params.norm].Ha) -#define BUZ_MIN_WIDTH 32 /* never display less than 32 pixels */ -#define BUZ_MIN_HEIGHT 24 /* never display less than 24 rows */ - -struct buz_requestbuffers -{ - unsigned long count; /* Number of buffers for MJPEG grabbing */ - unsigned long size; /* Size PER BUFFER in bytes */ -}; - -struct buz_sync -{ - unsigned long frame; /* number of buffer that has been free'd */ - unsigned long length; /* number of code bytes in buffer (capture only) */ - unsigned long seq; /* frame sequence number */ - struct timeval timestamp; /* timestamp */ -}; - -struct buz_status -{ - int input; /* Input channel, has to be set prior to BUZIOC_G_STATUS */ - int signal; /* Returned: 1 if valid video signal detected */ - int norm; /* Returned: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ - int color; /* Returned: 1 if color signal detected */ -}; - -struct buz_params -{ - - /* The following parameters can only be queried */ - - int major_version; /* Major version number of driver */ - int minor_version; /* Minor version number of driver */ - - /* Main control parameters */ - - int input; /* Input channel: 0 = Composite, 1 = S-VHS */ - int norm; /* Norm: VIDEO_MODE_PAL or VIDEO_MODE_NTSC */ - int decimation; /* decimation of captured video, - enlargement of video played back. - Valid values are 1, 2, 4 or 0. - 0 is a special value where the user - has full control over video scaling */ - - /* The following parameters only have to be set if decimation==0, - for other values of decimation they provide the data how the image is captured */ - - int HorDcm; /* Horizontal decimation: 1, 2 or 4 */ - int VerDcm; /* Vertical decimation: 1 or 2 */ - int TmpDcm; /* Temporal decimation: 1 or 2, - if TmpDcm==2 in capture every second frame is dropped, - in playback every frame is played twice */ - int field_per_buff; /* Number of fields per buffer: 1 or 2 */ - int img_x; /* start of image in x direction */ - int img_y; /* start of image in y direction */ - int img_width; /* image width BEFORE decimation, - must be a multiple of HorDcm*16 */ - int img_height; /* image height BEFORE decimation, - must be a multiple of VerDcm*8 */ - - /* --- End of parameters for decimation==0 only --- */ - - /* JPEG control parameters */ - - int quality; /* Measure for quality of compressed images. - Scales linearly with the size of the compressed images. - Must be beetween 0 and 100, 100 is a compression - ratio of 1:4 */ - - int odd_even; /* Which field should come first ??? */ - - int APPn; /* Number of APP segment to be written, must be 0..15 */ - int APP_len; /* Length of data in JPEG APPn segment */ - char APP_data[60]; /* Data in the JPEG APPn segment. */ - - int COM_len; /* Length of data in JPEG COM segment */ - char COM_data[60]; /* Data in JPEG COM segment */ - - unsigned long jpeg_markers; /* Which markers should go into the JPEG output. - Unless you exactly know what you do, leave them untouched. - Inluding less markers will make the resulting code - smaller, but there will be fewer aplications - which can read it. - The presence of the APP and COM marker is - influenced by APP0_len and COM_len ONLY! */ -#define JPEG_MARKER_DHT (1<<3) /* Define Huffman Tables */ -#define JPEG_MARKER_DQT (1<<4) /* Define Quantization Tables */ -#define JPEG_MARKER_DRI (1<<5) /* Define Restart Interval */ -#define JPEG_MARKER_COM (1<<6) /* Comment segment */ -#define JPEG_MARKER_APP (1<<7) /* App segment, driver will allways use APP0 */ - - int VFIFO_FB; /* Flag for enabling Video Fifo Feedback. - If this flag is turned on and JPEG decompressing - is going to the screen, the decompress process - is stopped every time the Video Fifo is full. - This enables a smooth decompress to the screen - but the video output signal will get scrambled */ - - /* Misc */ - - char reserved[312]; /* Makes 512 bytes for this structure */ -}; - -/* -Private IOCTL to set up for displaying MJPEG -*/ -#define BUZIOC_G_PARAMS _IOR ('v', BASE_VIDIOCPRIVATE+0, struct buz_params) -#define BUZIOC_S_PARAMS _IOWR('v', BASE_VIDIOCPRIVATE+1, struct buz_params) -#define BUZIOC_REQBUFS _IOWR('v', BASE_VIDIOCPRIVATE+2, struct buz_requestbuffers) -#define BUZIOC_QBUF_CAPT _IOW ('v', BASE_VIDIOCPRIVATE+3, int) -#define BUZIOC_QBUF_PLAY _IOW ('v', BASE_VIDIOCPRIVATE+4, int) -#define BUZIOC_SYNC _IOR ('v', BASE_VIDIOCPRIVATE+5, struct buz_sync) -#define BUZIOC_G_STATUS _IOWR('v', BASE_VIDIOCPRIVATE+6, struct buz_status) - - -#ifdef __KERNEL__ - -#define BUZ_NUM_STAT_COM 4 -#define BUZ_MASK_STAT_COM 3 - -#define BUZ_MAX_FRAME 256 /* Must be a power of 2 */ -#define BUZ_MASK_FRAME 255 /* Must be BUZ_MAX_FRAME-1 */ - -#if VIDEO_MAX_FRAME <= 32 -# define V4L_MAX_FRAME 32 -#elif VIDEO_MAX_FRAME <= 64 -# define V4L_MAX_FRAME 64 -#else -# error "Too many video frame buffers to handle" -#endif -#define V4L_MASK_FRAME (V4L_MAX_FRAME - 1) - - -#include "zr36057.h" - -enum buz_codec_mode -{ - BUZ_MODE_IDLE, /* nothing going on */ - BUZ_MODE_MOTION_COMPRESS, /* grabbing frames */ - BUZ_MODE_MOTION_DECOMPRESS, /* playing frames */ - BUZ_MODE_STILL_COMPRESS, /* still frame conversion */ - BUZ_MODE_STILL_DECOMPRESS /* still frame conversion */ -}; - -enum buz_buffer_state -{ - BUZ_STATE_USER, /* buffer is owned by application */ - BUZ_STATE_PEND, /* buffer is queued in pend[] ready to feed to I/O */ - BUZ_STATE_DMA, /* buffer is queued in dma[] for I/O */ - BUZ_STATE_DONE /* buffer is ready to return to application */ -}; - -struct buz_gbuffer -{ - u32 * frag_tab; /* addresses of frag table */ - u32 frag_tab_bus; /* same value cached to save time in ISR */ - enum buz_buffer_state state; /* non-zero if corresponding buffer is in use in grab queue */ - struct buz_sync bs; /* DONE: info to return to application */ -}; - -struct v4l_gbuffer -{ - char * fbuffer; /* virtual address of frame buffer */ - unsigned long fbuffer_phys; /* physical address of frame buffer */ - unsigned long fbuffer_bus; /* bus address of frame buffer */ - enum buz_buffer_state state; /* state: unused/pending/done */ -}; - -struct buz -{ - struct video_device video_dev; - struct i2c_bus i2c; - - int initialized; /* flag if buz has been correctly initalized */ - int user; /* number of current users (0 or 1) */ - - unsigned short id; /* number of this device */ - char name[32]; /* name of this device */ - struct pci_dev *pci_dev; /* PCI device */ - unsigned char revision; /* revision of zr36057 */ - unsigned int zr36057_adr; /* bus address of IO mem returned by PCI BIOS */ - unsigned char *zr36057_mem; /* pointer to mapped IO memory */ - - int map_mjpeg_buffers; /* Flag which bufferset will map by next mmap() */ - - spinlock_t lock; /* Spinlock */ - - /* Video for Linux parameters */ - - struct video_picture picture; /* Current picture params */ - struct video_buffer buffer; /* Current buffer params */ - struct video_window window; /* Current window params */ - int buffer_set, window_set; /* Flags if the above structures are set */ - int video_interlace; /* Image on screen is interlaced */ - - u32 *overlay_mask; - - struct wait_queue * v4l_capq; /* wait here for grab to finish */ - - int v4l_overlay_active; /* Overlay grab is activated */ - int v4l_memgrab_active; /* Memory grab is activated */ - - int v4l_grab_frame; /* Frame number being currently grabbed */ -#define NO_GRAB_ACTIVE (-1) - int v4l_grab_seq; /* Number of frames grabbed */ - int gwidth; /* Width of current memory capture */ - int gheight; /* Height of current memory capture */ - int gformat; /* Format of ... */ - int gbpl; /* byte per line of ... */ - - /* V4L grab queue of frames pending */ - - unsigned v4l_pend_head; - unsigned v4l_pend_tail; - int v4l_pend[V4L_MAX_FRAME]; - - struct v4l_gbuffer v4l_gbuf[VIDEO_MAX_FRAME]; /* V4L buffers' info */ - - /* Buz MJPEG parameters */ - - unsigned long jpg_nbufs; /* Number of buffers */ - unsigned long jpg_bufsize; /* Size of mjpeg buffers in bytes */ - int jpg_buffers_allocated; /* Flag if buffers are allocated */ - int need_contiguous; /* Flag if contiguous buffers are needed */ - - enum buz_codec_mode codec_mode; /* status of codec */ - struct buz_params params; /* structure with a lot of things to play with */ - - struct wait_queue * jpg_capq; /* wait here for grab to finish */ - - /* grab queue counts/indices, mask with BUZ_MASK_STAT_COM before using as index */ - /* (dma_head - dma_tail) is number active in DMA, must be <= BUZ_NUM_STAT_COM */ - /* (value & BUZ_MASK_STAT_COM) corresponds to index in stat_com table */ - unsigned long jpg_que_head; /* Index where to put next buffer which is queued */ - unsigned long jpg_dma_head; /* Index of next buffer which goes into stat_com */ - unsigned long jpg_dma_tail; /* Index of last buffer in stat_com */ - unsigned long jpg_que_tail; /* Index of last buffer in queue */ - unsigned long jpg_seq_num; /* count of frames since grab/play started */ - - /* zr36057's code buffer table */ - u32 * stat_com; /* stat_com[i] is indexed by dma_head/tail & BUZ_MASK_STAT_COM */ - - /* (value & BUZ_MASK_FRAME) corresponds to index in pend[] queue */ - int jpg_pend[BUZ_MAX_FRAME]; - - /* array indexed by frame number */ - struct buz_gbuffer jpg_gbuf[BUZ_MAX_FRAME]; /* MJPEG buffers' info */ - - /* Additional stuff for testing */ -#ifdef CONFIG_PROC_FS - - struct proc_dir_entry *buz_proc; - -#endif - int testing; - int jpeg_error; - int intr_counter_GIRQ1; - int intr_counter_GIRQ0; - int intr_counter_CodRepIRQ; - int intr_counter_JPEGRepIRQ; - int field_counter; - int IRQ1_in; - int IRQ1_out; - int JPEG_in; - int JPEG_out; - int JPEG_0; - int JPEG_1; - int JPEG_missed; - int JPEG_max_missed; - int JPEG_min_missed; - - u32 last_isr; - unsigned long frame_num; - - struct wait_queue *test_q; -}; - -#endif - -/*The following should be done in more portable way. It depends on define - of _ALPHA_BUZ in the Makefile.*/ - -#ifdef _ALPHA_BUZ -#define btwrite(dat,adr) writel((dat),(char *) (btv->zr36057_adr+(adr))) -#define btread(adr) readl(btv->zr36057_adr+(adr)) -#else -#define btwrite(dat,adr) writel((dat), (char *) (btv->zr36057_mem+(adr))) -#define btread(adr) readl(btv->zr36057_mem+(adr)) -#endif - -#define btand(dat,adr) btwrite((dat) & btread(adr), adr) -#define btor(dat,adr) btwrite((dat) | btread(adr), adr) -#define btaor(dat,mask,adr) btwrite((dat) | ((mask) & btread(adr)), adr) - -#define I2C_TSA5522 0xc2 -#define I2C_TDA9850 0xb6 -#define I2C_HAUPEE 0xa0 -#define I2C_STBEE 0xae -#define I2C_SAA7111 0x48 -#define I2C_SAA7110 0x9c -#define I2C_SAA7185 0x88 -//#define I2C_ADV7175 0xd4 -#define I2C_ADV7175 0x54 - -#define TDA9850_CON1 0x04 -#define TDA9850_CON2 0x05 -#define TDA9850_CON3 0x06 -#define TDA9850_CON4 0x07 -#define TDA9850_ALI1 0x08 -#define TDA9850_ALI2 0x09 -#define TDA9850_ALI3 0x0a - -#endif diff --git a/cinelerra-5.1/cinelerra/channeledit.C b/cinelerra-5.1/cinelerra/channeledit.C index 6c49c075..f85cd285 100644 --- a/cinelerra-5.1/cinelerra/channeledit.C +++ b/cinelerra-5.1/cinelerra/channeledit.C @@ -39,6 +39,8 @@ #include #include +#define MSG_NO_PIC_CONTROLS _("Device has no picture controls.") +//#define MSG_NO_INP_SELECTION _("Device has no input selection.") ChannelEditThread::ChannelEditThread(ChannelPicker *channel_picker, ChannelDB *channeldb) @@ -163,7 +165,7 @@ ChannelEditWindow::ChannelEditWindow(ChannelEditThread *thread, : BC_Window(_(PROGRAM_NAME ": Channels"), channel_picker->mwindow->session->channels_x, channel_picker->mwindow->session->channels_y, - 350, 400, 350, 400, 0, 0, 1) + 375, 400, 375, 400, 0, 0, 1) { this->thread = thread; this->channel_picker = channel_picker; @@ -1022,7 +1024,7 @@ void ChannelEditEditWindow::create_objects(Channel *channel) // !channel_usage->use_norm && // !channel_usage->use_input)) // { -// add_subwindow(new BC_Title(x, y, "Device has no input selection.")); +// add_subwindow(new BC_Title(x, y, MSG_NO_INP_SELECTION)); // y += 30; // } // else @@ -1406,12 +1408,21 @@ int ChannelEditPictureWindow::calculate_h(ChannelPicker *channel_picker) { PictureConfig *picture_usage = channel_picker->get_picture_usage(); int pad = BC_Pot::calculate_h(); - int result = 20 + - channel_picker->parent_window->get_text_height(MEDIUMFONT) + 5 + - BC_OKButton::calculate_h(); + int text_h = channel_picker->parent_window->get_text_height(MEDIUMFONT); + int result = 20 + text_h + 5 + BC_OKButton::calculate_h(); // Only used for Video4Linux 1 - if(picture_usage) + if( !picture_usage || ( + !picture_usage->use_brightness && + !picture_usage->use_contrast && + !picture_usage->use_color && + !picture_usage->use_hue && + !picture_usage->use_whiteness && + !channel_picker->get_controls() ) ) { + result += BC_Title::calculate_h(channel_picker->parent_window, + MSG_NO_PIC_CONTROLS); + } + else { if(picture_usage->use_brightness) result += pad; @@ -1446,8 +1457,7 @@ int ChannelEditPictureWindow::calculate_w(ChannelPicker *channel_picker) !channel_picker->get_controls())) { result = BC_Title::calculate_w(channel_picker->parent_window, - _("Device has no picture controls.")) + - 2 * widget_border; + MSG_NO_PIC_CONTROLS) + 20; } // Only used for Video4Linux 1 @@ -1513,7 +1523,7 @@ void ChannelEditPictureWindow::create_objects() !picture_usage->use_whiteness && !channel_picker->get_controls())) { - add_subwindow(new BC_Title(x, y, "Device has no picture controls.")); + add_subwindow(new BC_Title(x, y, MSG_NO_PIC_CONTROLS)); y += 50; } diff --git a/cinelerra-5.1/cinelerra/channelpicker.C b/cinelerra-5.1/cinelerra/channelpicker.C index 18291160..7880c306 100644 --- a/cinelerra-5.1/cinelerra/channelpicker.C +++ b/cinelerra-5.1/cinelerra/channelpicker.C @@ -39,7 +39,6 @@ #include "recordgui.h" #include "recordmonitor.h" #include "theme.h" -#include "vdevicebuz.h" #include "vdeviceprefs.h" #include "videodevice.h" @@ -281,11 +280,6 @@ PrefsChannelPicker::PrefsChannelPicker(MWindow *mwindow, { // printf("PrefsChannelPicker::PrefsChannelPicker 1\n"); this->prefs = prefs; - -#ifdef HAVE_VIDEO4LINUX - VDeviceBUZ::get_inputs(&input_sources); -#endif - } PrefsChannelPicker::~PrefsChannelPicker() @@ -333,14 +327,14 @@ void PrefsChannelPicker::set_channel(Channel *channel) Channel *PrefsChannelPicker::get_current_channel() { - int number = prefs->out_config->buz_out_channel; + int number = prefs->out_config->out_channel; return channeldb->get(number); } void PrefsChannelPicker::set_channel_number(int number) { CLAMP(number, 0, channeldb->size() - 1); - prefs->out_config->buz_out_channel = number; + prefs->out_config->out_channel = number; set_channel(get_current_channel()); } diff --git a/cinelerra-5.1/cinelerra/cwindow.C b/cinelerra-5.1/cinelerra/cwindow.C index 1b028302..022ee82e 100644 --- a/cinelerra-5.1/cinelerra/cwindow.C +++ b/cinelerra-5.1/cinelerra/cwindow.C @@ -34,6 +34,7 @@ #include "keys.h" #include "edl.h" #include "edlsession.h" +#include "language.h" #include "localsession.h" #include "mainmenu.h" #include "mainsession.h" @@ -267,7 +268,7 @@ void CWindow::update(int position, } if(!mwindow->edl->session->cwindow_scrollbars) - gui->zoom_panel->update(AUTO_ZOOM); + gui->zoom_panel->update(_(AUTO_ZOOM)); else gui->zoom_panel->update(mwindow->edl->session->cwindow_zoom); diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index 187fc502..aee61adf 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -199,8 +199,9 @@ void CWindowGUI::create_objects() mwindow->theme->czoom_y, mwindow->theme->czoom_w); zoom_panel->create_objects(); - zoom_panel->zoom_text->add_item(new BC_MenuItem(AUTO_ZOOM)); - if(!mwindow->edl->session->cwindow_scrollbars) zoom_panel->set_text(AUTO_ZOOM); + auto_zoom = _(AUTO_ZOOM); + zoom_panel->zoom_text->add_item(new BC_MenuItem(auto_zoom)); + if(!mwindow->edl->session->cwindow_scrollbars) zoom_panel->set_text(auto_zoom); // destination = new CWindowDestination(mwindow, // this, @@ -379,7 +380,7 @@ void CWindowGUI::zoom_canvas(int do_auto, double value, int update_menu) { if(do_auto) { - zoom_panel->update(AUTO_ZOOM); + zoom_panel->update(auto_zoom); } else { @@ -798,7 +799,7 @@ CWindowZoom::~CWindowZoom() int CWindowZoom::handle_event() { - if(!strcasecmp(AUTO_ZOOM, get_text())) + if(!strcasecmp(gui->auto_zoom, get_text())) { gui->zoom_canvas(1, get_value(), 0); } diff --git a/cinelerra-5.1/cinelerra/cwindowgui.h b/cinelerra-5.1/cinelerra/cwindowgui.h index 33913e5c..e090cdea 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.h +++ b/cinelerra-5.1/cinelerra/cwindowgui.h @@ -32,6 +32,7 @@ #include "floatauto.inc" #include "floatautos.inc" #include "guicast.h" +#include "language.h" #include "mainclock.inc" #include "maskauto.inc" #include "meterpanel.h" @@ -51,7 +52,7 @@ class CWindowCanvas; class CWindowEditing; -#define AUTO_ZOOM "Auto" +#define AUTO_ZOOM N_("Auto") class CWindowGUI : public BC_Window { @@ -87,7 +88,8 @@ public: void update_meters(); MWindow *mwindow; - CWindow *cwindow; + CWindow *cwindow; + const char *auto_zoom; CWindowEditing *edit_panel; // APanel *automation_panel; CPanel *composite_panel; diff --git a/cinelerra-5.1/cinelerra/defaultformats.h b/cinelerra-5.1/cinelerra/defaultformats.h index a68a7b32..61bd2165 100644 --- a/cinelerra-5.1/cinelerra/defaultformats.h +++ b/cinelerra-5.1/cinelerra/defaultformats.h @@ -40,31 +40,31 @@ struct formatpresets static struct formatpresets format_presets[] = { { N_("1080P/60"), 2, 2, 48000, 1, 1, 60000.0 / 1001, - 1920,1080, 16,9, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 1920,1080, 16,9, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("1080P/24"), 6, 6, 48000, 1, 1, 24, - 1920,1080, 16,9, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 1920,1080, 16,9, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("1080I"), 2, 2, 48000, 1, 1, 30000.0 / 1001, - 1920,1080, 16,9, BC_ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, + 1920,1080, 16,9, ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, { N_("720P/60"), 2, 2, 48000, 1, 1, 60000.0 / 1001, - 1280,720, 16,9, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 1280,720, 16,9, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("PAL 576I - DV(D)"), 2, 2, 48000, 1, 1, 25, - 720,576, 4,3, BC_ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, + 720,576, 4,3, ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, { N_("NTSC 480P - DV(D)"), 2, 2, 48000, 1, 1, 60000.0 / 1001, - 720,480, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 720,480, 4,3, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("NTSC 480I - DV(D)"), 2, 2, 48000, 1, 1, 30000.0 / 1001, - 720,480, 4,3, BC_ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, + 720,480, 4,3, ILACE_MODE_BOTTOM_FIRST, BC_YUVA8888 }, { N_("YouTube"), 1, 1, 48000, 1, 1, 30000.0 / 1001, - 424,318, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 424,318, 4,3, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("Half D-1 PAL"), 2, 2, 48000, 1, 1, 25, - 360,288, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 360,288, 4,3, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("NTSC Half D-1"), 2, 2, 48000, 1, 1, 30000.0 / 1001, - 360,240, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 360,240, 4,3, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("Internet"), 1, 1, 22050, 1, 1, 15, - 320,240, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, + 320,240, 4,3, ILACE_MODE_NOTINTERLACED, BC_YUVA8888 }, { N_("CD Audio"), 2, 2, 44100, 1, 0, 30000.0 / 1001, - 720,480, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_RGBA8888 }, + 720,480, 4,3, ILACE_MODE_NOTINTERLACED, BC_RGBA8888 }, { N_("DAT Audio"), 2, 2, 48000, 1, 0, 30000.0 / 1001, - 720,480, 4,3, BC_ILACE_MODE_NOTINTERLACED, BC_RGBA8888 }, + 720,480, 4,3, ILACE_MODE_NOTINTERLACED, BC_RGBA8888 }, { 0 } }; diff --git a/cinelerra-5.1/cinelerra/devicev4l2base.C b/cinelerra-5.1/cinelerra/devicev4l2base.C index b2f332b9..4cc01d4c 100644 --- a/cinelerra-5.1/cinelerra/devicev4l2base.C +++ b/cinelerra-5.1/cinelerra/devicev4l2base.C @@ -126,6 +126,8 @@ DeviceV4L2Base::DeviceV4L2Base() qbfrs_lock = new Mutex("DeviceV4L2Base::qbfrs_lock"); video_lock = new Condition(0, "DeviceV4L2Base::video_lock", 1); dev_fd = -1; + iwidth = 0; + iheight = 0; color_model = -1; device_buffers = 0; device_channel = 0; @@ -302,7 +304,7 @@ int DeviceV4L2Base::v4l2_open(int color_model) unsigned int best_format = 0; int best_merit = 0; int best_color_model = -1; - int best_area = 1; + int best_area = INT_MAX; int driver = video_device->in_config->driver; for( int i=0; i<20; ++i ) { @@ -319,15 +321,16 @@ int DeviceV4L2Base::v4l2_open(int color_model) int cmodel = -1; switch(fmt.pixelformat) { - case V4L2_PIX_FMT_UYVY: cmodel = BC_UVY422; merit = 4; break; case V4L2_PIX_FMT_YUYV: cmodel = BC_YUV422; merit = 4; break; + case V4L2_PIX_FMT_UYVY: cmodel = BC_UVY422; merit = 4; break; case V4L2_PIX_FMT_Y41P: cmodel = BC_YUV411P; merit = 1; break; case V4L2_PIX_FMT_YVU420: cmodel = BC_YUV420P; merit = 3; break; case V4L2_PIX_FMT_YUV422P: cmodel = BC_YUV422P; merit = 4; break; case V4L2_PIX_FMT_RGB24: cmodel = BC_RGB888; merit = 6; break; case V4L2_PIX_FMT_MJPEG: cmodel = BC_COMPRESSED; - merit = driver == VIDEO4LINUX2JPEG ? 7 : 0; + merit = driver == VIDEO4LINUX2JPEG || + driver == CAPTURE_JPEG_WEBCAM ? 7 : 0; break; case V4L2_PIX_FMT_MPEG: cmodel = BC_YUV420P; @@ -352,12 +355,9 @@ int DeviceV4L2Base::v4l2_open(int color_model) printf("%dx%d",w,h); int area = w * h; if( area > config_area ) continue; - int diff0 = area - best_area; - if( diff0 < 0 ) diff0 = -diff0; - int diff1 = area - config_area; - if( diff1 < 0 ) diff1 = -diff1; - if( diff1 < diff0 ) { - best_area = area; + int diff = abs(area-config_area); + if( diff < best_area ) { + best_area = diff; best_width = w; best_height = h; } @@ -426,6 +426,7 @@ int DeviceV4L2Base::v4l2_open(int color_model) perror("DeviceV4L2Base::v4l2_open VIDIOC_G_PARM"); } + printf("v4l2 s_fmt %dx%d %4.4s\n", best_width, best_height, (char*)&best_format); // Set up data format struct v4l2_format v4l2_params; memset(&v4l2_params, 0, sizeof(v4l2_params)); @@ -447,12 +448,12 @@ int DeviceV4L2Base::v4l2_open(int color_model) (char*)&v4l2_params.fmt.pix.pixelformat, (char*)&best_format); return 1; } - if( (int)v4l2_params.fmt.pix.width != best_width || - (int)v4l2_params.fmt.pix.height != best_height ) + iwidth = v4l2_params.fmt.pix.width; + iheight = v4l2_params.fmt.pix.height; + if( iwidth != best_width || iheight != best_height ) { printf("DeviceV4L2Base::v4l2_open set geom %dx%d != %dx%d best_geom\n", - v4l2_params.fmt.pix.width, v4l2_params.fmt.pix.height, - best_width, best_height); + iwidth, iheight, best_width, best_height); return 1; } @@ -794,8 +795,6 @@ int DeviceV4L2Base::start_dev() memset(device_buffers, 0, bfr_count*sizeof(device_buffers[0])); //printf("DeviceV4L2Base::start_dev color_model=%d\n", color_model); - int iwidth = video_device->in_config->w; - int iheight = video_device->in_config->h; int y_offset = 0, line_size = -1; int u_offset = 0, v_offset = 0; diff --git a/cinelerra-5.1/cinelerra/devicev4l2base.h b/cinelerra-5.1/cinelerra/devicev4l2base.h index 589169f7..e28965f9 100644 --- a/cinelerra-5.1/cinelerra/devicev4l2base.h +++ b/cinelerra-5.1/cinelerra/devicev4l2base.h @@ -98,6 +98,8 @@ class DeviceV4L2Base : public Thread // COMPRESSED or another color model the device should use. int color_model; int dev_fd; + int iwidth; + int iheight; int dev_open(); void dev_close(); diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 591db252..3082788c 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -1428,7 +1428,7 @@ if(debug) printf("EDL::get_use_vconsole %d\n", __LINE__); // Asset and output device must have same resulting de-interlacing method if( ilaceautofixmethod2(session->interlace_mode, asset->interlace_autofixoption, asset->interlace_mode, - asset->interlace_fixmethod) != BC_ILACE_FIXMETHOD_NONE ) + asset->interlace_fixmethod) != ILACE_FIXMETHOD_NONE ) return 1; // If we get here the frame is going to be directly copied. Whether it is diff --git a/cinelerra-5.1/cinelerra/edl.inc b/cinelerra-5.1/cinelerra/edl.inc index 07e06c24..309b47f2 100644 --- a/cinelerra-5.1/cinelerra/edl.inc +++ b/cinelerra-5.1/cinelerra/edl.inc @@ -53,19 +53,17 @@ class EDL; #define MOVE_NO_EDITS 2 #define MOVE_EDITS_DISABLED 3 - -// Mandatory folders -#define AEFFECT_FOLDER _("Audio Effects") -#define VEFFECT_FOLDER _("Video Effects") -#define ATRANSITION_FOLDER _("Audio Transitions") -#define VTRANSITION_FOLDER _("Video Transitions") - -#define LABEL_FOLDER _("Labels") - -// Default folders -#define CLIP_FOLDER _("Clips") -#define MEDIA_FOLDER _("Media") - +// AWindow folders +#define AW_NO_FOLDER -1 +#define AW_AEFFECT_FOLDER 0 +#define AW_VEFFECT_FOLDER 1 +#define AW_ATRANSITION_FOLDER 2 +#define AW_VTRANSITION_FOLDER 3 +#define AW_LABEL_FOLDER 4 +#define AW_CLIP_FOLDER 5 +#define AW_MEDIA_FOLDER 6 +#define AW_USER_FOLDER 7 +#define AWINDOW_FOLDERS 8 #define AWINDOW_MODES 2 diff --git a/cinelerra-5.1/cinelerra/edlsession.C b/cinelerra-5.1/cinelerra/edlsession.C index f0815d5a..0930dd05 100644 --- a/cinelerra-5.1/cinelerra/edlsession.C +++ b/cinelerra-5.1/cinelerra/edlsession.C @@ -22,6 +22,7 @@ #include "asset.h" #include "assets.h" #include "autoconf.h" +#include "awindowgui.h" #include "bccmodels.h" #include "bchash.h" #include "clip.h" @@ -46,6 +47,7 @@ EDLSession::EDLSession(EDL *edl) for(int i = 0; i < ASSET_COLUMNS; i++) asset_columns[i] = 100; auto_conf = new AutoConf; + awindow_folder = AW_MEDIA_FOLDER; aspect_w = 4; aspect_h = 3; audio_channels = 2; audio_tracks = 2; @@ -54,13 +56,12 @@ EDLSession::EDLSession(EDL *edl) brender_start = 0.0; clipboard_length = 0; // unused color_model = BC_RGBA8888; - interlace_mode = BC_ILACE_MODE_UNDETECTED; + interlace_mode = ILACE_MODE_UNDETECTED; crop_x1 = 0; crop_x2 = 320; crop_y1 = 0; crop_y2 = 240; eyedrop_radius = 0; ruler_x1 = ruler_y1 = 0.0; ruler_x2 = ruler_y2 = 0.0; - strcpy(current_folder, ""); cursor_on_frames = 1; typeless_keyframes = 0; cwindow_dest = 0; @@ -229,7 +230,7 @@ int EDLSession::load_defaults(BC_Hash *defaults) eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0); ilacemode_to_xmltext(string, interlace_mode); const char *ilace_mode = defaults->get("INTERLACE_MODE",string); - interlace_mode = ilacemode_from_xmltext(ilace_mode, BC_ILACE_MODE_NOTINTERLACED); + interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED); crop_x1 = defaults->get("CROP_X1", 0); crop_x2 = defaults->get("CROP_X2", 320); crop_y1 = defaults->get("CROP_Y1", 0); @@ -238,8 +239,7 @@ int EDLSession::load_defaults(BC_Hash *defaults) ruler_x2 = defaults->get("RULER_X2", 0.0); ruler_y1 = defaults->get("RULER_Y1", 0.0); ruler_y2 = defaults->get("RULER_Y2", 0.0); - sprintf(current_folder, MEDIA_FOLDER); - defaults->get("CURRENT_FOLDER", current_folder); + awindow_folder = defaults->get("AWINDOW_FOLDER", awindow_folder); cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 1); typeless_keyframes = defaults->get("TYPELESS_KEYFRAMES", 0); cwindow_dest = defaults->get("CWINDOW_DEST", 0); @@ -385,7 +385,7 @@ int EDLSession::save_defaults(BC_Hash *defaults) defaults->update("RULER_X2", ruler_x2); defaults->update("RULER_Y1", ruler_y1); defaults->update("RULER_Y2", ruler_y2); - defaults->update("CURRENT_FOLDER", current_folder); + defaults->update("AWINDOW_FOLDER", awindow_folder); defaults->update("CURSOR_ON_FRAMES", cursor_on_frames); defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes); defaults->update("CWINDOW_DEST", cwindow_dest); @@ -518,6 +518,7 @@ void EDLSession::boundaries() if(brender_start < 0) brender_start = 0.0; Workarounds::clamp(subtitle_number, 0, 31); + Workarounds::clamp(awindow_folder, 0, AWINDOW_FOLDERS - 1); // Correct framerates frame_rate = Units::fix_framerate(frame_rate); @@ -535,7 +536,7 @@ int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_ BC_CModels::to_text(string, color_model); color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string)); const char *ilace_mode = file->tag.get_property("INTERLACE_MODE"); - interlace_mode = ilacemode_from_xmltext(ilace_mode, BC_ILACE_MODE_NOTINTERLACED); + interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED); video_channels = file->tag.get_property("CHANNELS", video_channels); for(int i = 0; i < video_channels; i++) { @@ -603,7 +604,13 @@ int EDLSession::load_xml(FileXML *file, ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1); ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2); ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2); - file->tag.get_property("CURRENT_FOLDER", current_folder); + string[0] = 0; + file->tag.get_property("CURRENT_FOLDER", string); + if( string[0] ) { + awindow_folder = AWindowGUI::folder_number(string); + if( awindow_folder < 0 ) awindow_folder = AW_MEDIA_FOLDER; + } + file->tag.get_property("AWINDOW_FOLDER", awindow_folder); cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames); typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes); cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest); @@ -670,7 +677,7 @@ int EDLSession::save_xml(FileXML *file) file->tag.set_property("RULER_Y1", ruler_y1); file->tag.set_property("RULER_X2", ruler_x2); file->tag.set_property("RULER_Y2", ruler_y2); - file->tag.set_property("CURRENT_FOLDER", current_folder); + file->tag.set_property("AWINDOW_FOLDER", awindow_folder); file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames); file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes); file->tag.set_property("CWINDOW_DEST", cwindow_dest); @@ -801,7 +808,7 @@ int EDLSession::copy(EDLSession *session) ruler_y1 = session->ruler_y1; ruler_x2 = session->ruler_x2; ruler_y2 = session->ruler_y2; - strcpy(current_folder, session->current_folder); + awindow_folder = session->awindow_folder; cursor_on_frames = session->cursor_on_frames; typeless_keyframes = session->typeless_keyframes; cwindow_dest = session->cwindow_dest; diff --git a/cinelerra-5.1/cinelerra/edlsession.h b/cinelerra-5.1/cinelerra/edlsession.h index 9affcfef..a919b103 100644 --- a/cinelerra-5.1/cinelerra/edlsession.h +++ b/cinelerra-5.1/cinelerra/edlsession.h @@ -99,7 +99,7 @@ public: float ruler_x2, ruler_y2; // Ruler points relative to the output frame. // Current folder in resource window - char current_folder[BCTEXTLEN]; + int awindow_folder; // align cursor on frame boundaries int cursor_on_frames; // paste keyframes to any track type diff --git a/cinelerra-5.1/cinelerra/filedv.C b/cinelerra-5.1/cinelerra/filedv.C index 2ec80d8d..e862b2de 100644 --- a/cinelerra-5.1/cinelerra/filedv.C +++ b/cinelerra-5.1/cinelerra/filedv.C @@ -291,9 +291,9 @@ TRACE("FileDV::open_file 60") asset->height = decoder->height; if(dv_is_progressive(decoder) > 0) - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; else - asset->interlace_mode = BC_ILACE_MODE_BOTTOM_FIRST; + asset->interlace_mode = ILACE_MODE_BOTTOM_FIRST; isPAL = dv_is_PAL(decoder); @@ -935,14 +935,7 @@ int FileDV::get_best_colormodel(Asset *asset, int driver) case PLAYBACK_FIREWIRE: return BC_COMPRESSED; break; - case PLAYBACK_LML: - case PLAYBACK_BUZ: - return BC_YUV422P; - break; - case VIDEO4LINUX: case VIDEO4LINUX2: - case CAPTURE_BUZ: - case CAPTURE_LML: case VIDEO4LINUX2JPEG: return BC_YUV422; break; diff --git a/cinelerra-5.1/cinelerra/fileexr.C b/cinelerra-5.1/cinelerra/fileexr.C index 2589a006..a62b1b3c 100644 --- a/cinelerra-5.1/cinelerra/fileexr.C +++ b/cinelerra-5.1/cinelerra/fileexr.C @@ -305,7 +305,7 @@ int FileEXR::read_frame_header(char *path) asset->width = dw.max.x - dw.min.x + 1; asset->height = dw.max.y - dw.min.y + 1; - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; const Imf::ChannelList &channels = file.header().channels(); diff --git a/cinelerra-5.1/cinelerra/fileffmpeg.C b/cinelerra-5.1/cinelerra/fileffmpeg.C index ac62687f..b37a15d5 100644 --- a/cinelerra-5.1/cinelerra/fileffmpeg.C +++ b/cinelerra-5.1/cinelerra/fileffmpeg.C @@ -17,6 +17,7 @@ #include "fileffmpeg.h" #include "filesystem.h" #include "indexfile.h" +#include "language.h" #include "mainerror.h" #include "mainprogress.h" #include "mutex.h" @@ -313,10 +314,33 @@ int FileFFMPEG::colormodel_supported(int colormodel) int FileFFMPEG::get_best_colormodel(Asset *asset, int driver) { switch(driver) { - case PLAYBACK_X11: return BC_RGB888; - case PLAYBACK_X11_GL: return BC_YUV888; + case PLAYBACK_X11: + return BC_RGB888; + case PLAYBACK_X11_XV: + case PLAYBACK_ASYNCHRONOUS: + return BC_YUV888; + case PLAYBACK_X11_GL: + return BC_YUV888; + case PLAYBACK_DV1394: + case PLAYBACK_FIREWIRE: + return BC_YUV422P; + case VIDEO4LINUX2: + return BC_RGB888; + case VIDEO4LINUX2JPEG: + return BC_COMPRESSED; + case CAPTURE_DVB: + case VIDEO4LINUX2MPEG: + return BC_YUV422P; + case CAPTURE_JPEG_WEBCAM: + return BC_COMPRESSED; + case CAPTURE_YUYV_WEBCAM: + return BC_YUV422; + case CAPTURE_FIREWIRE: + case CAPTURE_IEC61883: + return BC_YUV422P; } - return BC_YUV420P; + + return BC_RGB888; } //====== @@ -717,7 +741,7 @@ FFOptions_OptPanel:: void FFOptions_OptPanel::create_objects() { - const char *cols[] = { "option", "value", }; + const char *cols[] = { _("option"), _("value"), }; const int col1_w = 150; int wids[] = { col1_w, get_w()-col1_w }; BC_ListBox::update(&items[0], &cols[0], &wids[0], sizeof(items)/sizeof(items[0])); @@ -869,7 +893,7 @@ int FFOptionsKind::handle_event() void FFOptionsKind::set(int k) { this->kind = k; - set_text(kinds[k]); + set_text(_(kinds[k])); } FFOptionsText:: @@ -1145,25 +1169,25 @@ int FFOptions_Opt::types(char *rp) { const char *cp = ""; if( opt ) switch (opt->type) { - case AV_OPT_TYPE_FLAGS: cp = ""; break; - case AV_OPT_TYPE_INT: cp = ""; break; - case AV_OPT_TYPE_INT64: cp = ""; break; - case AV_OPT_TYPE_DOUBLE: cp = ""; break; - case AV_OPT_TYPE_FLOAT: cp = ""; break; - case AV_OPT_TYPE_STRING: cp = ""; break; - case AV_OPT_TYPE_RATIONAL: cp = ""; break; - case AV_OPT_TYPE_BINARY: cp = ""; break; - case AV_OPT_TYPE_IMAGE_SIZE: cp = ""; break; - case AV_OPT_TYPE_VIDEO_RATE: cp = ""; break; - case AV_OPT_TYPE_PIXEL_FMT: cp = ""; break; - case AV_OPT_TYPE_SAMPLE_FMT: cp = ""; break; - case AV_OPT_TYPE_DURATION: cp = ""; break; - case AV_OPT_TYPE_COLOR: cp = ""; break; - case AV_OPT_TYPE_CHANNEL_LAYOUT: cp = ""; break; - case AV_OPT_TYPE_BOOL: cp = ""; break; - default: cp = ""; break; + case AV_OPT_TYPE_FLAGS: cp = N_(""); break; + case AV_OPT_TYPE_INT: cp = N_(""); break; + case AV_OPT_TYPE_INT64: cp = N_(""); break; + case AV_OPT_TYPE_DOUBLE: cp = N_(""); break; + case AV_OPT_TYPE_FLOAT: cp = N_(""); break; + case AV_OPT_TYPE_STRING: cp = N_(""); break; + case AV_OPT_TYPE_RATIONAL: cp = N_(""); break; + case AV_OPT_TYPE_BINARY: cp = N_(""); break; + case AV_OPT_TYPE_IMAGE_SIZE: cp = N_(""); break; + case AV_OPT_TYPE_VIDEO_RATE: cp = N_(""); break; + case AV_OPT_TYPE_PIXEL_FMT: cp = N_(""); break; + case AV_OPT_TYPE_SAMPLE_FMT: cp = N_(""); break; + case AV_OPT_TYPE_DURATION: cp = N_(""); break; + case AV_OPT_TYPE_COLOR: cp = N_(""); break; + case AV_OPT_TYPE_CHANNEL_LAYOUT: cp = N_(""); break; + case AV_OPT_TYPE_BOOL: cp = N_(""); break; + default: cp = N_(""); break; } - return sprintf(rp, "%s", cp); + return sprintf(rp, "%s", _(cp)); } int FFOptions_Opt::scalar(double d, char *rp) { diff --git a/cinelerra-5.1/cinelerra/filejpeg.C b/cinelerra-5.1/cinelerra/filejpeg.C index 2a162836..1eac64c7 100644 --- a/cinelerra-5.1/cinelerra/filejpeg.C +++ b/cinelerra-5.1/cinelerra/filejpeg.C @@ -127,16 +127,9 @@ int FileJPEG::get_best_colormodel(Asset *asset, int driver) case PLAYBACK_X11_GL: return BC_YUV888; break; - case PLAYBACK_LML: - case PLAYBACK_BUZ: - return BC_YUV422P; - break; - case VIDEO4LINUX: case VIDEO4LINUX2: return BC_YUV420P; break; - case CAPTURE_BUZ: - case CAPTURE_LML: case VIDEO4LINUX2JPEG: return BC_YUV422; break; @@ -229,7 +222,7 @@ int FileJPEG::read_frame_header(char *path) asset->width = jpeg_decompress.image_width; asset->height = jpeg_decompress.image_height; - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; jpeg_destroy((j_common_ptr)&jpeg_decompress); fclose(stream); diff --git a/cinelerra-5.1/cinelerra/filelist.C b/cinelerra-5.1/cinelerra/filelist.C index 2ed383fd..a7861e14 100644 --- a/cinelerra-5.1/cinelerra/filelist.C +++ b/cinelerra-5.1/cinelerra/filelist.C @@ -236,7 +236,7 @@ int FileList::read_list_header() }while(!feof(stream) && (string[0] == '#' || string[0] == ' ')); asset->height = atol(string); - asset->interlace_mode = BC_ILACE_MODE_UNDETECTED; // May be good to store the info in the list? + asset->interlace_mode = ILACE_MODE_UNDETECTED; // May be good to store the info in the list? asset->layers = 1; asset->audio_data = 0; asset->video_data = 1; diff --git a/cinelerra-5.1/cinelerra/filempeg.C b/cinelerra-5.1/cinelerra/filempeg.C index 44499f3b..59c4db28 100644 --- a/cinelerra-5.1/cinelerra/filempeg.C +++ b/cinelerra-5.1/cinelerra/filempeg.C @@ -454,7 +454,7 @@ int FileMPEG::open_file(int rd, int wr) //TODO: this is not as easy as just looking at headers. //most interlaced media is rendered as FRM, not TOP/BOT in coding ext hdrs. //currently, just using the assetedit menu to set the required result as needed. -// if( asset->interlace_mode == BC_ILACE_MODE_UNDETECTED ) +// if( asset->interlace_mode == ILACE_MODE_UNDETECTED ) // asset->interlace_mode = mpeg3_detect_interlace(fd, 0); if( !asset->layers ) { asset->layers = mpeg3_total_vstreams(fd); @@ -999,13 +999,9 @@ int FileMPEG::get_best_colormodel(Asset *asset, int driver) asset->vmpeg_cmodel : BC_RGB888; case PLAYBACK_X11_GL: return BC_YUV888; - case PLAYBACK_LML: - case PLAYBACK_BUZ: - return BC_YUV422P; case PLAYBACK_DV1394: case PLAYBACK_FIREWIRE: return BC_YUV422P; - case VIDEO4LINUX: case VIDEO4LINUX2: return zmpeg3_cmdl(asset->vmpeg_cmodel) > 0 ? asset->vmpeg_cmodel : BC_RGB888; @@ -1018,9 +1014,6 @@ int FileMPEG::get_best_colormodel(Asset *asset, int driver) return BC_COMPRESSED; case CAPTURE_YUYV_WEBCAM: return BC_YUV422; - case CAPTURE_BUZ: - case CAPTURE_LML: - return BC_YUV422; case CAPTURE_FIREWIRE: case CAPTURE_IEC61883: return BC_YUV422P; @@ -1273,8 +1266,8 @@ int FileMPEG::write_frames(VFrame ***frames, int len) switch( output_cmodel ) { case BC_YUV420P: if( file->preferences->dvd_yuv420p_interlace && - ( asset->interlace_mode == BC_ILACE_MODE_TOP_FIRST || - asset->interlace_mode == BC_ILACE_MODE_BOTTOM_FIRST ) ) + ( asset->interlace_mode == ILACE_MODE_TOP_FIRST || + asset->interlace_mode == ILACE_MODE_BOTTOM_FIRST ) ) output_cmodel = BC_YUV420PI; case BC_YUV422P: break; @@ -1500,7 +1493,7 @@ int FileMPEG::read_frame(VFrame *frame) int stream_cmdl = mpeg3_colormodel(fd,file->current_layer); int stream_color_model = bc_colormodel(stream_cmdl); int frame_color_model = frame->get_color_model(); - int frame_cmdl = asset->interlace_mode == BC_ILACE_MODE_NOTINTERLACED ? + int frame_cmdl = asset->interlace_mode == ILACE_MODE_NOTINTERLACED ? zmpeg3_cmdl(frame_color_model) : -1; mpeg3_show_subtitle(fd, file->current_layer, file->playback_subtitle); @@ -1562,8 +1555,8 @@ int FileMPEG::read_frame(VFrame *frame) if( y && u && v ) { if( stream_color_model == BC_YUV420P && file->preferences->dvd_yuv420p_interlace && ( - asset->interlace_mode == BC_ILACE_MODE_TOP_FIRST || - asset->interlace_mode == BC_ILACE_MODE_BOTTOM_FIRST ) ) + asset->interlace_mode == ILACE_MODE_TOP_FIRST || + asset->interlace_mode == ILACE_MODE_BOTTOM_FIRST ) ) stream_color_model = BC_YUV420PI; BC_CModels::transfer(frame->get_rows(), 0, frame->get_y(), frame->get_u(), frame->get_v(), diff --git a/cinelerra-5.1/cinelerra/fileogg.C b/cinelerra-5.1/cinelerra/fileogg.C index 4b8ce040..e88fd3ce 100644 --- a/cinelerra-5.1/cinelerra/fileogg.C +++ b/cinelerra-5.1/cinelerra/fileogg.C @@ -693,7 +693,7 @@ Not yet available in alpha4, we assume 420 for now asset->frame_rate = fps; // All theora material is noninterlaced by definition if(!asset->interlace_mode) - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; /* ogg_get_page_of_frame(tf->videosync, tf->to.serialno, &og, 0 +start_frame); ogg_get_page_of_frame(tf->videosync, tf->to.serialno, &og, 1 +start_frame); diff --git a/cinelerra-5.1/cinelerra/filepng.C b/cinelerra-5.1/cinelerra/filepng.C index 889ee240..8d5e2cc8 100644 --- a/cinelerra-5.1/cinelerra/filepng.C +++ b/cinelerra-5.1/cinelerra/filepng.C @@ -162,7 +162,7 @@ int FilePNG::read_frame_header(char *path) asset->width = png_get_image_width(png_ptr, info_ptr); asset->height = png_get_image_height(png_ptr, info_ptr); - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; color_type = png_get_color_type(png_ptr, info_ptr); color_depth = png_get_bit_depth(png_ptr,info_ptr); diff --git a/cinelerra-5.1/cinelerra/filetiff.C b/cinelerra-5.1/cinelerra/filetiff.C index c5f3f7a6..7a2f393b 100644 --- a/cinelerra-5.1/cinelerra/filetiff.C +++ b/cinelerra-5.1/cinelerra/filetiff.C @@ -198,7 +198,7 @@ int FileTIFF::read_frame_header(char *path) //printf("FileTIFF::read_frame_header %d %d %d\n", bitspersample, components, asset->tiff_cmodel); TIFFClose(stream); - asset->interlace_mode = BC_ILACE_MODE_NOTINTERLACED; + asset->interlace_mode = ILACE_MODE_NOTINTERLACED; return result; } diff --git a/cinelerra-5.1/cinelerra/formattools.C b/cinelerra-5.1/cinelerra/formattools.C index ef1a0b3b..d6f27599 100644 --- a/cinelerra-5.1/cinelerra/formattools.C +++ b/cinelerra-5.1/cinelerra/formattools.C @@ -319,8 +319,6 @@ void FormatTools::update_driver(int driver) case CAPTURE_IEC61883: case CAPTURE_FIREWIRE: - case CAPTURE_LML: - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: case CAPTURE_JPEG_WEBCAM: asset->format = FILE_FFMPEG; @@ -332,8 +330,6 @@ void FormatTools::update_driver(int driver) locked_compressor = (char*)CODEC_TAG_DVSD; break; - case CAPTURE_BUZ: - case CAPTURE_LML: case VIDEO4LINUX2JPEG: locked_compressor = (char*)CODEC_TAG_MJPEG; break; diff --git a/cinelerra-5.1/cinelerra/indexable.C b/cinelerra-5.1/cinelerra/indexable.C index fc328ffb..b0d47fdb 100644 --- a/cinelerra-5.1/cinelerra/indexable.C +++ b/cinelerra-5.1/cinelerra/indexable.C @@ -30,7 +30,7 @@ Indexable::Indexable(int is_asset) : Garbage(is_asset ? "Asset" : "EDL") { index_state = new IndexState; this->is_asset = is_asset; - strcpy(folder, MEDIA_FOLDER); + this->awindow_folder = AW_MEDIA_FOLDER; } diff --git a/cinelerra-5.1/cinelerra/indexable.h b/cinelerra-5.1/cinelerra/indexable.h index 766af10f..8546a2b3 100644 --- a/cinelerra-5.1/cinelerra/indexable.h +++ b/cinelerra-5.1/cinelerra/indexable.h @@ -63,7 +63,7 @@ public: // to the backup file, not the project file. char path[BCTEXTLEN]; // Folder in resource manager - char folder[BCTEXTLEN]; + int awindow_folder; int is_asset; // unique ID of this object for comparison diff --git a/cinelerra-5.1/cinelerra/indexfile.C b/cinelerra-5.1/cinelerra/indexfile.C index bdb928ce..dfb5d6b2 100644 --- a/cinelerra-5.1/cinelerra/indexfile.C +++ b/cinelerra-5.1/cinelerra/indexfile.C @@ -336,7 +336,7 @@ int IndexFile::open_source() command.realtime = 0; cache = new CICache(mwindow->preferences); render_engine = new RenderEngine(0, - mwindow->preferences, 0, 0, 0); + mwindow->preferences, 0, 0); render_engine->set_acache(cache); render_engine->arm_command(&command); FileSystem fs; diff --git a/cinelerra-5.1/cinelerra/interlacemodes.C b/cinelerra-5.1/cinelerra/interlacemodes.C index 58dc042a..f9b0b3b6 100644 --- a/cinelerra-5.1/cinelerra/interlacemodes.C +++ b/cinelerra-5.1/cinelerra/interlacemodes.C @@ -30,17 +30,19 @@ void ilaceautofixoption_to_text(char *string, int autofixoption) { + const char *cp = 0; switch(autofixoption) { - case BC_ILACE_AUTOFIXOPTION_AUTO: strcpy(string, BC_ILACE_AUTOFIXOPTION_AUTO_T); return; - case BC_ILACE_AUTOFIXOPTION_MANUAL: strcpy(string, BC_ILACE_AUTOFIXOPTION_MANUAL_T); return; + case ILACE_AUTOFIXOPTION_AUTO: cp = ILACE_AUTOFIXOPTION_AUTO_T; break; + case ILACE_AUTOFIXOPTION_MANUAL: cp = ILACE_AUTOFIXOPTION_MANUAL_T; break; + default: cp = ILACE_UNKNOWN_T; break; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, _(cp)); } int ilaceautofixoption_from_text(const char *text, int thedefault) { - if(!strcasecmp(text, BC_ILACE_AUTOFIXOPTION_AUTO_T)) return BC_ILACE_AUTOFIXOPTION_AUTO; - if(!strcasecmp(text, BC_ILACE_AUTOFIXOPTION_MANUAL_T)) return BC_ILACE_AUTOFIXOPTION_MANUAL; + if(!strcasecmp(text, _(ILACE_AUTOFIXOPTION_AUTO_T))) return ILACE_AUTOFIXOPTION_AUTO; + if(!strcasecmp(text, _(ILACE_AUTOFIXOPTION_MANUAL_T))) return ILACE_AUTOFIXOPTION_MANUAL; return thedefault; } @@ -48,42 +50,44 @@ int ilaceautofixoption_from_text(const char *text, int thedefault) void ilacemode_to_text(char *string, int ilacemode) { + const char *cp = 0; switch(ilacemode) { - case BC_ILACE_MODE_UNDETECTED: strcpy(string, BC_ILACE_MODE_UNDETECTED_T); return; - case BC_ILACE_MODE_TOP_FIRST: strcpy(string, BC_ILACE_MODE_TOP_FIRST_T); return; - case BC_ILACE_MODE_BOTTOM_FIRST: strcpy(string, BC_ILACE_MODE_BOTTOM_FIRST_T); return; - case BC_ILACE_MODE_NOTINTERLACED: strcpy(string, BC_ILACE_MODE_NOTINTERLACED_T); return; + case ILACE_MODE_UNDETECTED: cp = ILACE_MODE_UNDETECTED_T; break; + case ILACE_MODE_TOP_FIRST: cp = ILACE_MODE_TOP_FIRST_T; break; + case ILACE_MODE_BOTTOM_FIRST: cp = ILACE_MODE_BOTTOM_FIRST_T; break; + case ILACE_MODE_NOTINTERLACED: cp = ILACE_MODE_NOTINTERLACED_T; break; + default: cp = ILACE_UNKNOWN_T; break; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, _(cp)); } int ilacemode_from_text(const char *text, int thedefault) { - if(!strcasecmp(text, BC_ILACE_MODE_UNDETECTED_T)) return BC_ILACE_MODE_UNDETECTED; - if(!strcasecmp(text, BC_ILACE_MODE_TOP_FIRST_T)) return BC_ILACE_MODE_TOP_FIRST; - if(!strcasecmp(text, BC_ILACE_MODE_BOTTOM_FIRST_T)) return BC_ILACE_MODE_BOTTOM_FIRST; - if(!strcasecmp(text, BC_ILACE_MODE_NOTINTERLACED_T)) return BC_ILACE_MODE_NOTINTERLACED; + if(!strcasecmp(text, _(ILACE_MODE_UNDETECTED_T))) return ILACE_MODE_UNDETECTED; + if(!strcasecmp(text, _(ILACE_MODE_TOP_FIRST_T))) return ILACE_MODE_TOP_FIRST; + if(!strcasecmp(text, _(ILACE_MODE_BOTTOM_FIRST_T))) return ILACE_MODE_BOTTOM_FIRST; + if(!strcasecmp(text, _(ILACE_MODE_NOTINTERLACED_T))) return ILACE_MODE_NOTINTERLACED; return thedefault; } void ilacemode_to_xmltext(char *string, int ilacemode) { switch(ilacemode) { - case BC_ILACE_MODE_UNDETECTED: strcpy(string, BC_ILACE_MODE_UNDETECTED_XMLT); return; - case BC_ILACE_MODE_TOP_FIRST: strcpy(string, BC_ILACE_MODE_TOP_FIRST_XMLT); return; - case BC_ILACE_MODE_BOTTOM_FIRST: strcpy(string, BC_ILACE_MODE_BOTTOM_FIRST_XMLT); return; - case BC_ILACE_MODE_NOTINTERLACED: strcpy(string, BC_ILACE_MODE_NOTINTERLACED_XMLT); return; + case ILACE_MODE_UNDETECTED: strcpy(string, ILACE_MODE_UNDETECTED_XMLT); return; + case ILACE_MODE_TOP_FIRST: strcpy(string, ILACE_MODE_TOP_FIRST_XMLT); return; + case ILACE_MODE_BOTTOM_FIRST: strcpy(string, ILACE_MODE_BOTTOM_FIRST_XMLT); return; + case ILACE_MODE_NOTINTERLACED: strcpy(string, ILACE_MODE_NOTINTERLACED_XMLT); return; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, ILACE_UNKNOWN_T); } int ilacemode_from_xmltext(const char *text, int thedefault) { if( text ) { - if(!strcasecmp(text, BC_ILACE_MODE_UNDETECTED_XMLT)) return BC_ILACE_MODE_UNDETECTED; - if(!strcasecmp(text, BC_ILACE_MODE_TOP_FIRST_XMLT)) return BC_ILACE_MODE_TOP_FIRST; - if(!strcasecmp(text, BC_ILACE_MODE_BOTTOM_FIRST_XMLT)) return BC_ILACE_MODE_BOTTOM_FIRST; - if(!strcasecmp(text, BC_ILACE_MODE_NOTINTERLACED_XMLT)) return BC_ILACE_MODE_NOTINTERLACED; + if(!strcasecmp(text, ILACE_MODE_UNDETECTED_XMLT)) return ILACE_MODE_UNDETECTED; + if(!strcasecmp(text, ILACE_MODE_TOP_FIRST_XMLT)) return ILACE_MODE_TOP_FIRST; + if(!strcasecmp(text, ILACE_MODE_BOTTOM_FIRST_XMLT)) return ILACE_MODE_BOTTOM_FIRST; + if(!strcasecmp(text, ILACE_MODE_NOTINTERLACED_XMLT)) return ILACE_MODE_NOTINTERLACED; } return thedefault; } @@ -92,54 +96,56 @@ int ilacemode_from_xmltext(const char *text, int thedefault) void ilacefixmethod_to_text(char *string, int fixmethod) { + const char *cp = 0; switch(fixmethod) { - case BC_ILACE_FIXMETHOD_NONE: strcpy(string, BC_ILACE_FIXMETHOD_NONE_T); return; - case BC_ILACE_FIXMETHOD_UPONE: strcpy(string, BC_ILACE_FIXMETHOD_UPONE_T); return; - case BC_ILACE_FIXMETHOD_DOWNONE: strcpy(string, BC_ILACE_FIXMETHOD_DOWNONE_T); return; + case ILACE_FIXMETHOD_NONE: cp = ILACE_FIXMETHOD_NONE_T; break; + case ILACE_FIXMETHOD_UPONE: cp = ILACE_FIXMETHOD_UPONE_T; break; + case ILACE_FIXMETHOD_DOWNONE: cp = ILACE_FIXMETHOD_DOWNONE_T; break; + default: cp = ILACE_UNKNOWN_T; break; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, _(cp)); } int ilacefixmethod_from_text(const char *text, int thedefault) { - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_NONE_T)) return BC_ILACE_FIXMETHOD_NONE; - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_UPONE_T)) return BC_ILACE_FIXMETHOD_UPONE; - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_DOWNONE_T)) return BC_ILACE_FIXMETHOD_DOWNONE; + if(!strcasecmp(text, _(ILACE_FIXMETHOD_NONE_T))) return ILACE_FIXMETHOD_NONE; + if(!strcasecmp(text, _(ILACE_FIXMETHOD_UPONE_T))) return ILACE_FIXMETHOD_UPONE; + if(!strcasecmp(text, _(ILACE_FIXMETHOD_DOWNONE_T))) return ILACE_FIXMETHOD_DOWNONE; return thedefault; } void ilacefixmethod_to_xmltext(char *string, int fixmethod) { switch(fixmethod) { - case BC_ILACE_FIXMETHOD_NONE: strcpy(string, BC_ILACE_FIXMETHOD_NONE_XMLT); return; - case BC_ILACE_FIXMETHOD_UPONE: strcpy(string, BC_ILACE_FIXMETHOD_UPONE_XMLT); return; - case BC_ILACE_FIXMETHOD_DOWNONE: strcpy(string, BC_ILACE_FIXMETHOD_DOWNONE_XMLT); return; + case ILACE_FIXMETHOD_NONE: strcpy(string, ILACE_FIXMETHOD_NONE_XMLT); return; + case ILACE_FIXMETHOD_UPONE: strcpy(string, ILACE_FIXMETHOD_UPONE_XMLT); return; + case ILACE_FIXMETHOD_DOWNONE: strcpy(string, ILACE_FIXMETHOD_DOWNONE_XMLT); return; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, ILACE_UNKNOWN_T); } int ilacefixmethod_from_xmltext(const char *text, int thedefault) { - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_NONE_XMLT)) return BC_ILACE_FIXMETHOD_NONE; - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_UPONE_XMLT)) return BC_ILACE_FIXMETHOD_UPONE; - if(!strcasecmp(text, BC_ILACE_FIXMETHOD_DOWNONE_XMLT)) return BC_ILACE_FIXMETHOD_DOWNONE; + if(!strcasecmp(text, ILACE_FIXMETHOD_NONE_XMLT)) return ILACE_FIXMETHOD_NONE; + if(!strcasecmp(text, ILACE_FIXMETHOD_UPONE_XMLT)) return ILACE_FIXMETHOD_UPONE; + if(!strcasecmp(text, ILACE_FIXMETHOD_DOWNONE_XMLT)) return ILACE_FIXMETHOD_DOWNONE; return thedefault; } int ilaceautofixmethod(int projectmode, int assetmode) { if (projectmode == assetmode) - return BC_ILACE_FIXMETHOD_NONE; - if( (projectmode == BC_ILACE_MODE_BOTTOM_FIRST && assetmode == BC_ILACE_MODE_TOP_FIRST ) || - (projectmode == BC_ILACE_MODE_TOP_FIRST && assetmode == BC_ILACE_MODE_BOTTOM_FIRST) ) - return BC_ILACE_FIXDEFAULT; + return ILACE_FIXMETHOD_NONE; + if( (projectmode == ILACE_MODE_BOTTOM_FIRST && assetmode == ILACE_MODE_TOP_FIRST ) || + (projectmode == ILACE_MODE_TOP_FIRST && assetmode == ILACE_MODE_BOTTOM_FIRST) ) + return ILACE_FIXDEFAULT; // still to implement anything else... - return BC_ILACE_FIXMETHOD_NONE; + return ILACE_FIXMETHOD_NONE; } int ilaceautofixmethod2(int projectilacemode, int assetautofixoption, int assetilacemode, int assetfixmethod) { - if (assetautofixoption == BC_ILACE_AUTOFIXOPTION_AUTO) + if (assetautofixoption == ILACE_AUTOFIXOPTION_AUTO) return (ilaceautofixmethod(projectilacemode, assetilacemode)); return (assetfixmethod); } @@ -147,10 +153,10 @@ int ilaceautofixmethod2(int projectilacemode, int assetautofixoption, int asset int ilace_bc_to_yuv4mpeg(int ilacemode) { switch (ilacemode) { - case BC_ILACE_MODE_UNDETECTED: return(Y4M_UNKNOWN); - case BC_ILACE_MODE_TOP_FIRST: return(Y4M_ILACE_TOP_FIRST); - case BC_ILACE_MODE_BOTTOM_FIRST: return(Y4M_ILACE_BOTTOM_FIRST); - case BC_ILACE_MODE_NOTINTERLACED: return(Y4M_ILACE_NONE); + case ILACE_MODE_UNDETECTED: return(Y4M_UNKNOWN); + case ILACE_MODE_TOP_FIRST: return(Y4M_ILACE_TOP_FIRST); + case ILACE_MODE_BOTTOM_FIRST: return(Y4M_ILACE_BOTTOM_FIRST); + case ILACE_MODE_NOTINTERLACED: return(Y4M_ILACE_NONE); } return(Y4M_UNKNOWN); } @@ -158,25 +164,27 @@ int ilace_bc_to_yuv4mpeg(int ilacemode) int ilace_yuv4mpeg_to_bc(int ilacemode) { switch (ilacemode) { - case Y4M_UNKNOWN: return (BC_ILACE_MODE_UNDETECTED); - case Y4M_ILACE_NONE: return (BC_ILACE_MODE_NOTINTERLACED); - case Y4M_ILACE_TOP_FIRST: return (BC_ILACE_MODE_TOP_FIRST); - case Y4M_ILACE_BOTTOM_FIRST: return (BC_ILACE_MODE_BOTTOM_FIRST); -// case Y4M_ILACE_MIXED: return (BC_ILACE_MODE_UNDETECTED); // fixme!! + case Y4M_UNKNOWN: return (ILACE_MODE_UNDETECTED); + case Y4M_ILACE_NONE: return (ILACE_MODE_NOTINTERLACED); + case Y4M_ILACE_TOP_FIRST: return (ILACE_MODE_TOP_FIRST); + case Y4M_ILACE_BOTTOM_FIRST: return (ILACE_MODE_BOTTOM_FIRST); +// case Y4M_ILACE_MIXED: return (ILACE_MODE_UNDETECTED); // fixme!! } - return (BC_ILACE_MODE_UNDETECTED); + return (ILACE_MODE_UNDETECTED); } void ilace_yuv4mpeg_mode_to_text(char *string, int ilacemode) { + const char *cp = 0; switch(ilacemode) { - case Y4M_UNKNOWN: strcpy(string, BC_ILACE_Y4M_UKNOWN_T); return; - case Y4M_ILACE_NONE: strcpy(string, BC_ILACE_Y4M_NONE_T); return; - case Y4M_ILACE_TOP_FIRST: strcpy(string, BC_ILACE_Y4M_TOP_FIRST_T); return; - case Y4M_ILACE_BOTTOM_FIRST: strcpy(string, BC_ILACE_Y4M_BOTTOM_FIRST_T); return; -// case Y4M_ILACE_MIXED: strcpy(string, BC_ILACE_Y4M_MIXED_T); return; + case Y4M_UNKNOWN: cp = ILACE_Y4M_UKNOWN_T; break; + case Y4M_ILACE_NONE: cp = ILACE_Y4M_NONE_T; break; + case Y4M_ILACE_TOP_FIRST: cp = ILACE_Y4M_TOP_FIRST_T; break; + case Y4M_ILACE_BOTTOM_FIRST: cp = ILACE_Y4M_BOTTOM_FIRST_T; break; +// case Y4M_ILACE_MIXED: cp = ILACE_Y4M_MIXED_T; break; + default: cp = ILACE_UNKNOWN_T; break; } - strcpy(string, BC_ILACE_UNKNOWN_T); + strcpy(string, _(cp)); } diff --git a/cinelerra-5.1/cinelerra/interlacemodes.h b/cinelerra-5.1/cinelerra/interlacemodes.h index 2dc0651a..ffcf29e9 100644 --- a/cinelerra-5.1/cinelerra/interlacemodes.h +++ b/cinelerra-5.1/cinelerra/interlacemodes.h @@ -17,55 +17,56 @@ #ifndef INTERLACEMODES_H #define INTERLACEMODES_H +#include "language.h" -#define BC_ILACE_UNKNOWN_T "Error!" +#define ILACE_UNKNOWN_T N_("Error!") //Interlace Automatic fixing options -#define BC_ILACE_AUTOFIXOPTION_MANUAL 0 -#define BC_ILACE_AUTOFIXOPTION_MANUAL_T "Manual compensation using selection" -#define BC_ILACE_AUTOFIXOPTION_AUTO 1 -#define BC_ILACE_AUTOFIXOPTION_AUTO_T "Automatic compensation using modes" +#define ILACE_AUTOFIXOPTION_MANUAL 0 +#define ILACE_AUTOFIXOPTION_MANUAL_T N_("Manual compensation using selection") +#define ILACE_AUTOFIXOPTION_AUTO 1 +#define ILACE_AUTOFIXOPTION_AUTO_T N_("Automatic compensation using modes") //Note: Do not change what the numbers mean as this will make backward-compatability have erroraneous settings. //Interlace Modes -#define BC_ILACE_MODE_UNDETECTED 0 -#define BC_ILACE_MODE_UNDETECTED_XMLT "UNKNOWN" -#define BC_ILACE_MODE_UNDETECTED_T "Unknown" -#define BC_ILACE_MODE_TOP_FIRST 1 -#define BC_ILACE_MODE_TOP_FIRST_XMLT "TOP_FIELD_FIRST" -#define BC_ILACE_MODE_TOP_FIRST_T "Top Fields First" -#define BC_ILACE_MODE_BOTTOM_FIRST 2 -#define BC_ILACE_MODE_BOTTOM_FIRST_XMLT "BOTTOM_FIELD_FIRST" -#define BC_ILACE_MODE_BOTTOM_FIRST_T "Bottom Fields First" -#define BC_ILACE_MODE_NOTINTERLACED 3 -#define BC_ILACE_MODE_NOTINTERLACED_XMLT "NOTINTERLACED" -#define BC_ILACE_MODE_NOTINTERLACED_T "Not Interlaced" +#define ILACE_MODE_UNDETECTED 0 +#define ILACE_MODE_UNDETECTED_XMLT "UNKNOWN" +#define ILACE_MODE_UNDETECTED_T N_("Unknown") +#define ILACE_MODE_TOP_FIRST 1 +#define ILACE_MODE_TOP_FIRST_XMLT "TOP_FIELD_FIRST" +#define ILACE_MODE_TOP_FIRST_T N_("Top Fields First") +#define ILACE_MODE_BOTTOM_FIRST 2 +#define ILACE_MODE_BOTTOM_FIRST_XMLT "BOTTOM_FIELD_FIRST" +#define ILACE_MODE_BOTTOM_FIRST_T N_("Bottom Fields First") +#define ILACE_MODE_NOTINTERLACED 3 +#define ILACE_MODE_NOTINTERLACED_XMLT "NOTINTERLACED" +#define ILACE_MODE_NOTINTERLACED_T N_("Not Interlaced") -#define BC_ILACE_ASSET_MODEDEFAULT BC_ILACE_MODE_UNDETECTED -#define BC_ILACE_PROJECT_MODEDEFAULT BC_ILACE_MODE_NOTINTERLACED_T +#define ILACE_ASSET_MODEDEFAULT ILACE_MODE_UNDETECTED +#define ILACE_PROJECT_MODEDEFAULT ILACE_MODE_NOTINTERLACED_T //Note: Do not change what the numbers mean as this will make backward-compatability have erroraneous settings. //Interlace Compensation Methods -#define BC_ILACE_FIXMETHOD_NONE 0 -#define BC_ILACE_FIXMETHOD_NONE_XMLT "DO_NOTHING" -#define BC_ILACE_FIXMETHOD_NONE_T "Do Nothing" -#define BC_ILACE_FIXMETHOD_UPONE 1 -#define BC_ILACE_FIXMETHOD_UPONE_XMLT "SHIFT_UPONE" -#define BC_ILACE_FIXMETHOD_UPONE_T "Shift Up 1 pixel" -#define BC_ILACE_FIXMETHOD_DOWNONE 2 -#define BC_ILACE_FIXMETHOD_DOWNONE_XMLT "SHIFT_DOWNONE" -#define BC_ILACE_FIXMETHOD_DOWNONE_T "Shift Down 1 pixel" +#define ILACE_FIXMETHOD_NONE 0 +#define ILACE_FIXMETHOD_NONE_XMLT "DO_NOTHING" +#define ILACE_FIXMETHOD_NONE_T N_("Do Nothing") +#define ILACE_FIXMETHOD_UPONE 1 +#define ILACE_FIXMETHOD_UPONE_XMLT "SHIFT_UPONE" +#define ILACE_FIXMETHOD_UPONE_T N_("Shift Up 1 pixel") +#define ILACE_FIXMETHOD_DOWNONE 2 +#define ILACE_FIXMETHOD_DOWNONE_XMLT "SHIFT_DOWNONE" +#define ILACE_FIXMETHOD_DOWNONE_T N_("Shift Down 1 pixel") // the following is for project/asset having odd/even, or even/odd -#define BC_ILACE_FIXDEFAULT BC_ILACE_FIXMETHOD_UPONE +#define ILACE_FIXDEFAULT ILACE_FIXMETHOD_UPONE //Note: Do not change what the numbers mean as this will make backward-compatability have erroraneous settings. // Refer to (descriptions were cut-and-pasted!) -#define BC_ILACE_Y4M_UKNOWN_T "unknown" -#define BC_ILACE_Y4M_NONE_T "non-interlaced, progressive frame" -#define BC_ILACE_Y4M_TOP_FIRST_T "interlaced, top-field first" -#define BC_ILACE_Y4M_BOTTOM_FIRST_T "interlaced, bottom-field first" -#define BC_ILACE_Y4M_MIXED_T "mixed, \"refer to frame header\"" +#define ILACE_Y4M_UKNOWN_T N_("unknown") +#define ILACE_Y4M_NONE_T N_("non-interlaced, progressive frame") +#define ILACE_Y4M_TOP_FIRST_T N_("interlaced, top-field first") +#define ILACE_Y4M_BOTTOM_FIRST_T N_("interlaced, bottom-field first") +#define ILACE_Y4M_MIXED_T N_("mixed, \"refer to frame header\"") void ilaceautofixoption_to_text(char *string, int autofixoption); int ilaceautofixoption_from_text(const char *text, int thedefault); diff --git a/cinelerra-5.1/cinelerra/libmjpeg.C b/cinelerra-5.1/cinelerra/libmjpeg.C index 7cf2159c..b1614023 100644 --- a/cinelerra-5.1/cinelerra/libmjpeg.C +++ b/cinelerra-5.1/cinelerra/libmjpeg.C @@ -1527,29 +1527,6 @@ typedef struct int unpadded_field_size; } avi_hdr_t; -#define LML_MARKER_SIZE 0x2c -#define LML_MARKER_TAG 0xffe3 -void insert_lml33_markers(unsigned char **buffer, - long *field2_offset, - long *buffer_size, - long *buffer_allocated) -{ - long marker_offset = -1; - -/* Search for existing marker to replace */ -// marker_offset = find_marker(*buffer, *buffer_size, LML_MARKER_TAG); - -/* Insert new marker */ - if(marker_offset < 0) - { - marker_offset = 2; - insert_space(buffer, - buffer_size, - buffer_allocated, - 2, - LML_MARKER_SIZE); - } -} static int qt_table_offsets(unsigned char *buffer, long buffer_size, diff --git a/cinelerra-5.1/cinelerra/libmjpeg.h b/cinelerra-5.1/cinelerra/libmjpeg.h index a23b09be..dc48b6f2 100644 --- a/cinelerra-5.1/cinelerra/libmjpeg.h +++ b/cinelerra-5.1/cinelerra/libmjpeg.h @@ -49,16 +49,6 @@ struct mjpeg_error_mgr { typedef struct mjpeg_error_mgr* mjpeg_error_ptr; -#ifndef __alpha__ -typedef struct -{ -} mjpeg_lml_hdr; - -typedef struct -{ -} mjpeg_dc10_hdr; -#endif - // The compressor structure is shared between decompressors and compressors typedef struct @@ -208,8 +198,6 @@ void mjpeg_insert_avi_markers(unsigned char **buffer, long *field2_offset); // Get the second field offset from the markers -long mjpeg_get_buz_field2(unsigned char *buffer, long buffer_size); -long mjpeg_get_lml33_field2(unsigned char *buffer, long buffer_size); long mjpeg_get_quicktime_field2(unsigned char *buffer, long buffer_size); // Field dominance is retrieved for the jpeg decoder. AVI stores field // dominance in each field. diff --git a/cinelerra-5.1/cinelerra/localsession.C b/cinelerra-5.1/cinelerra/localsession.C index 3775dee1..5d8249fe 100644 --- a/cinelerra-5.1/cinelerra/localsession.C +++ b/cinelerra-5.1/cinelerra/localsession.C @@ -20,6 +20,7 @@ */ #include "automation.h" +#include "awindowgui.h" #include "clip.h" #include "bchash.h" #include "edl.h" @@ -58,7 +59,7 @@ LocalSession::LocalSession(EDL *edl) selectionstart = selectionend = 0; in_point = out_point = -1; - strcpy(folder, CLIP_FOLDER); + awindow_folder = AW_CLIP_FOLDER; sprintf(clip_title, _("Program")); strcpy(clip_notes, _("Hello world")); clipboard_length = 0; @@ -113,7 +114,7 @@ void LocalSession::copy_from(LocalSession *that) { strcpy(clip_title, that->clip_title); strcpy(clip_notes, that->clip_notes); - strcpy(folder, that->folder); + awindow_folder = that->awindow_folder; in_point = that->in_point; loop_playback = that->loop_playback; loop_start = that->loop_start; @@ -160,7 +161,7 @@ void LocalSession::save_xml(FileXML *file, double start) file->tag.set_property("SELECTION_END", selectionend - start); file->tag.set_property("CLIP_TITLE", clip_title); file->tag.set_property("CLIP_NOTES", clip_notes); - file->tag.set_property("FOLDER", folder); + file->tag.set_property("AWINDOW_FOLDER", awindow_folder); file->tag.set_property("X_PANE", x_pane); file->tag.set_property("Y_PANE", y_pane); @@ -228,7 +229,12 @@ void LocalSession::load_xml(FileXML *file, unsigned long load_flags) // Overwritten by MWindow::load_filenames file->tag.get_property("CLIP_TITLE", clip_title); file->tag.get_property("CLIP_NOTES", clip_notes); - file->tag.get_property("FOLDER", folder); + const char *folder = file->tag.get_property("FOLDER"); + if( folder ) { + awindow_folder = AWindowGUI::folder_number(folder); + if( awindow_folder < 0 ) awindow_folder = AW_MEDIA_FOLDER; + } + awindow_folder = file->tag.get_property("AWINDOW_FOLDER", awindow_folder); loop_playback = file->tag.get_property("LOOP_PLAYBACK", 0); loop_start = file->tag.get_property("LOOP_START", (double)0); loop_end = file->tag.get_property("LOOP_END", (double)0); diff --git a/cinelerra-5.1/cinelerra/localsession.h b/cinelerra-5.1/cinelerra/localsession.h index 21b586cb..547fcb8a 100644 --- a/cinelerra-5.1/cinelerra/localsession.h +++ b/cinelerra-5.1/cinelerra/localsession.h @@ -78,7 +78,7 @@ public: char clip_title[BCTEXTLEN]; char clip_notes[BCTEXTLEN]; // Folder in parent EDL of clip - char folder[BCTEXTLEN]; + int awindow_folder; int loop_playback; double loop_start, loop_end; diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 156c9532..520d64f4 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -1069,21 +1069,21 @@ void MWindow::init_menus() interlace_asset_fixmethods.append(new InterlacefixmethodItem(string, x)); // Interlacing Modes - ILACEASSETMODELISTADD(BC_ILACE_MODE_UNDETECTED); // Not included in the list for the project options. + ILACEASSETMODELISTADD(ILACE_MODE_UNDETECTED); // Not included in the list for the project options. - ILACEASSETMODELISTADD(BC_ILACE_MODE_TOP_FIRST); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_TOP_FIRST); + ILACEASSETMODELISTADD(ILACE_MODE_TOP_FIRST); + ILACEPROJECTMODELISTADD(ILACE_MODE_TOP_FIRST); - ILACEASSETMODELISTADD(BC_ILACE_MODE_BOTTOM_FIRST); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_BOTTOM_FIRST); + ILACEASSETMODELISTADD(ILACE_MODE_BOTTOM_FIRST); + ILACEPROJECTMODELISTADD(ILACE_MODE_BOTTOM_FIRST); - ILACEASSETMODELISTADD(BC_ILACE_MODE_NOTINTERLACED); - ILACEPROJECTMODELISTADD(BC_ILACE_MODE_NOTINTERLACED); + ILACEASSETMODELISTADD(ILACE_MODE_NOTINTERLACED); + ILACEPROJECTMODELISTADD(ILACE_MODE_NOTINTERLACED); // Interlacing Fixing Methods - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_NONE); - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_UPONE); - ILACEFIXMETHODLISTADD(BC_ILACE_FIXMETHOD_DOWNONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_NONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_UPONE); + ILACEFIXMETHODLISTADD(ILACE_FIXMETHOD_DOWNONE); } void MWindow::init_indexes() diff --git a/cinelerra-5.1/cinelerra/packagerenderer.C b/cinelerra-5.1/cinelerra/packagerenderer.C index b8cd1bd6..d4341493 100644 --- a/cinelerra-5.1/cinelerra/packagerenderer.C +++ b/cinelerra-5.1/cinelerra/packagerenderer.C @@ -196,11 +196,7 @@ void PackageRenderer::create_engine() aconfig->fragment_size = audio_read_length; - render_engine = new RenderEngine(0, - preferences, - 0, - 0, - 0); + render_engine = new RenderEngine(0, preferences, 0, 0); render_engine->set_acache(audio_cache); render_engine->set_vcache(video_cache); render_engine->arm_command(command); diff --git a/cinelerra-5.1/cinelerra/playbackconfig.C b/cinelerra-5.1/cinelerra/playbackconfig.C index 84cee18e..1c329474 100644 --- a/cinelerra-5.1/cinelerra/playbackconfig.C +++ b/cinelerra-5.1/cinelerra/playbackconfig.C @@ -235,14 +235,11 @@ int AudioOutConfig::save_defaults(BC_Hash *defaults, int active_config) +const char *VideoOutConfig::default_video_device = "/dev/video0"; VideoOutConfig::VideoOutConfig() { - sprintf(lml_out_device, "/dev/mvideo/stream"); - sprintf(buz_out_device, "/dev/video0"); driver = PLAYBACK_X11_XV; - buz_out_channel = 0; - buz_swap_fields = 0; x11_host[0] = 0; x11_use_fields = USE_NO_FIELDS; @@ -261,6 +258,7 @@ VideoOutConfig::VideoOutConfig() color = 32768; contrast = 32768; whiteness = 32768; + out_channel = -1; } VideoOutConfig::~VideoOutConfig() @@ -276,10 +274,6 @@ int VideoOutConfig::operator!=(VideoOutConfig &that) int VideoOutConfig::operator==(VideoOutConfig &that) { return (driver == that.driver) && - !strcmp(lml_out_device, that.lml_out_device) && - !strcmp(buz_out_device, that.buz_out_device) && - (buz_out_channel == that.buz_out_channel) && - (buz_swap_fields == that.buz_swap_fields) && !strcmp(x11_host, that.x11_host) && (x11_use_fields == that.x11_use_fields) && (brightness == that.brightness) && @@ -313,10 +307,6 @@ VideoOutConfig& VideoOutConfig::operator=(VideoOutConfig &that) void VideoOutConfig::copy_from(VideoOutConfig *src) { this->driver = src->driver; - strcpy(this->lml_out_device, src->lml_out_device); - strcpy(this->buz_out_device, src->buz_out_device); - this->buz_out_channel = src->buz_out_channel; - this->buz_swap_fields = src->buz_swap_fields; strcpy(this->x11_host, src->x11_host); this->x11_use_fields = src->x11_use_fields; @@ -331,13 +321,10 @@ void VideoOutConfig::copy_from(VideoOutConfig *src) dv1394_syt = src->dv1394_syt; } -char* VideoOutConfig::get_path() +const char *VideoOutConfig::get_path() { switch(driver) { - case PLAYBACK_BUZ: - return buz_out_device; - break; case PLAYBACK_X11: case PLAYBACK_X11_XV: return x11_host; @@ -349,7 +336,7 @@ char* VideoOutConfig::get_path() return firewire_path; break; }; - return buz_out_device; + return default_video_device; } int VideoOutConfig::load_defaults(BC_Hash *defaults, int active_config) @@ -358,10 +345,6 @@ int VideoOutConfig::load_defaults(BC_Hash *defaults, int active_config) sprintf(prefix, "%c_", 'A'+active_config); driver = defaults->getf(driver, "%sVIDEO_OUT_DRIVER", prefix); - defaults->getf(lml_out_device, "%sLML_OUT_DEVICE", prefix); - defaults->getf(buz_out_device, "%sBUZ_OUT_DEVICE", prefix); - buz_out_channel = defaults->getf(buz_out_channel, "%sBUZ_OUT_CHANNEL", prefix); - buz_swap_fields = defaults->getf(buz_swap_fields, "%sBUZ_SWAP_FIELDS", prefix); defaults->getf(x11_host, "%sX11_OUT_DEVICE", prefix); x11_use_fields = defaults->getf(x11_use_fields, "%sX11_USE_FIELDS", prefix); @@ -385,10 +368,6 @@ int VideoOutConfig::save_defaults(BC_Hash *defaults, int active_config) sprintf(prefix, "%c_", 'A'+active_config); defaults->updatef(driver, "%sVIDEO_OUT_DRIVER", prefix); - defaults->updatef(lml_out_device, "%sLML_OUT_DEVICE", prefix); - defaults->updatef(buz_out_device, "%sBUZ_OUT_DEVICE", prefix); - defaults->updatef(buz_out_channel, "%sBUZ_OUT_CHANNEL", prefix); - defaults->updatef(buz_swap_fields, "%sBUZ_SWAP_FIELDS", prefix); defaults->updatef(x11_host, "%sX11_OUT_DEVICE", prefix); defaults->updatef(x11_use_fields, "%sX11_USE_FIELDS", prefix); diff --git a/cinelerra-5.1/cinelerra/playbackconfig.h b/cinelerra-5.1/cinelerra/playbackconfig.h index 8e0e8bb5..bdd3cbb4 100644 --- a/cinelerra-5.1/cinelerra/playbackconfig.h +++ b/cinelerra-5.1/cinelerra/playbackconfig.h @@ -94,14 +94,11 @@ public: void copy_from(VideoOutConfig *src); int load_defaults(BC_Hash *defaults, int active_config); int save_defaults(BC_Hash *defaults, int active_config); - char* get_path(); + const char *get_path(); + static const char *default_video_device; int driver; - char lml_out_device[BCTEXTLEN]; - char buz_out_device[BCTEXTLEN]; -// Entry in the buz channel table - int buz_out_channel; - int buz_swap_fields; + int out_channel; // X11 options char x11_host[BCTEXTLEN]; diff --git a/cinelerra-5.1/cinelerra/playbackengine.C b/cinelerra-5.1/cinelerra/playbackengine.C index 7f31a6c1..faaff0e8 100644 --- a/cinelerra-5.1/cinelerra/playbackengine.C +++ b/cinelerra-5.1/cinelerra/playbackengine.C @@ -107,8 +107,6 @@ ChannelDB* PlaybackEngine::get_channeldb() { case VIDEO4LINUX2JPEG: return mwindow->channeldb_v4l2jpeg; - case PLAYBACK_BUZ: - return mwindow->channeldb_buz; } return 0; } @@ -117,13 +115,7 @@ int PlaybackEngine::create_render_engine() { // Fix playback configurations delete_render_engine(); - - - render_engine = new RenderEngine(this, - preferences, - output, - get_channeldb(), - 0); + render_engine = new RenderEngine(this, preferences, output, 0); //printf("PlaybackEngine::create_render_engine %d\n", __LINE__); return 0; } diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C index d2247d57..bf2c32df 100644 --- a/cinelerra-5.1/cinelerra/record.C +++ b/cinelerra-5.1/cinelerra/record.C @@ -202,10 +202,6 @@ int Record::load_defaults() // These are locked by a specific driver. const char *vcodec = 0; switch( session->vconfig_in->driver ) { - case CAPTURE_LML: - case CAPTURE_BUZ: - vcodec = CODEC_TAG_MJPEG; - break; case CAPTURE_DVB: case VIDEO4LINUX2MPEG: break; diff --git a/cinelerra-5.1/cinelerra/recordconfig.C b/cinelerra-5.1/cinelerra/recordconfig.C index 2e18dd59..55896be6 100644 --- a/cinelerra-5.1/cinelerra/recordconfig.C +++ b/cinelerra-5.1/cinelerra/recordconfig.C @@ -191,16 +191,15 @@ int AudioInConfig::save_defaults(BC_Hash *defaults) +const char *VideoInConfig::default_video_device = "/dev/video0"; + VideoInConfig::VideoInConfig() { - driver = VIDEO4LINUX; - sprintf(v4l_in_device, "%s", "/dev/video0"); + driver = VIDEO4LINUX2; sprintf(v4l2_in_device, "%s", "/dev/video0"); sprintf(v4l2jpeg_in_device, "%s", "/dev/video0"); v4l2jpeg_in_fields = 2; sprintf(v4l2mpeg_in_device, "%s", "/dev/video0"); - sprintf(lml_in_device, "%s", "/dev/mvideo/stream"); - sprintf(buz_in_device, "%s", "/dev/video0"); strcpy(dvb_in_adapter, "/dev/dvb/adapter0"); dvb_in_device = 0; sprintf(screencapture_display, "%s", ""); @@ -220,31 +219,26 @@ VideoInConfig::~VideoInConfig() { } -char* VideoInConfig::get_path() +const char *VideoInConfig::get_path() { switch(driver) { - case VIDEO4LINUX: return v4l_in_device; case CAPTURE_JPEG_WEBCAM: case CAPTURE_YUYV_WEBCAM: case VIDEO4LINUX2: return v4l2_in_device; case VIDEO4LINUX2JPEG: return v4l2jpeg_in_device; case VIDEO4LINUX2MPEG: return v4l2mpeg_in_device; - case CAPTURE_BUZ: return buz_in_device; case CAPTURE_DVB: return dvb_in_adapter; } - return v4l_in_device; + return default_video_device; } void VideoInConfig::copy_from(VideoInConfig *src) { driver = src->driver; - strcpy(v4l_in_device, src->v4l_in_device); strcpy(v4l2_in_device, src->v4l2_in_device); v4l2jpeg_in_fields = src->v4l2jpeg_in_fields; strcpy(v4l2jpeg_in_device, src->v4l2jpeg_in_device); strcpy(v4l2mpeg_in_device, src->v4l2mpeg_in_device); - strcpy(lml_in_device, src->lml_in_device); - strcpy(buz_in_device, src->buz_in_device); strcpy(dvb_in_adapter, src->dvb_in_adapter); dvb_in_device = src->dvb_in_device; strcpy(screencapture_display, src->screencapture_display); @@ -267,13 +261,10 @@ VideoInConfig& VideoInConfig::operator=(VideoInConfig &that) int VideoInConfig::load_defaults(BC_Hash *defaults) { driver = defaults->get("R_VIDEO_IN_DRIVER", driver); - defaults->get("R_V4L_IN_DEVICE", v4l_in_device); defaults->get("R_V4L2_IN_DEVICE", v4l2_in_device); defaults->get("R_V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device); v4l2jpeg_in_fields = defaults->get("R_V4L2JPEG_IN_FIELDS", v4l2jpeg_in_fields); defaults->get("R_V4L2MPEG_IN_DEVICE", v4l2mpeg_in_device); - defaults->get("R_LML_IN_DEVICE", lml_in_device); - defaults->get("R_BUZ_IN_DEVICE", buz_in_device); defaults->get("R_VIDEO_DVB_IN_ADAPTER", dvb_in_adapter); dvb_in_device = defaults->get("R_VIDEO_DVB_IN_DEVICE", dvb_in_device); defaults->get("R_SCREENCAPTURE_DISPLAY", screencapture_display); @@ -291,13 +282,10 @@ int VideoInConfig::load_defaults(BC_Hash *defaults) int VideoInConfig::save_defaults(BC_Hash *defaults) { defaults->update("R_VIDEO_IN_DRIVER", driver); - defaults->update("R_V4L_IN_DEVICE", v4l_in_device); defaults->update("R_V4L2_IN_DEVICE", v4l2_in_device); defaults->update("R_V4L2JPEG_IN_DEVICE", v4l2jpeg_in_device); defaults->update("R_V4L2JPEG_IN_FIELDS", v4l2jpeg_in_fields); defaults->update("R_V4L2MPEG_IN_DEVICE", v4l2mpeg_in_device); - defaults->update("R_LML_IN_DEVICE", lml_in_device); - defaults->update("R_BUZ_IN_DEVICE", buz_in_device); defaults->update("R_VIDEO_DVB_IN_ADAPTER", dvb_in_adapter); defaults->update("R_VIDEO_DVB_IN_DEVICE", dvb_in_device); defaults->update("R_SCREENCAPTURE_DISPLAY", screencapture_display); diff --git a/cinelerra-5.1/cinelerra/recordconfig.h b/cinelerra-5.1/cinelerra/recordconfig.h index f1862e09..846f60c6 100644 --- a/cinelerra-5.1/cinelerra/recordconfig.h +++ b/cinelerra-5.1/cinelerra/recordconfig.h @@ -81,16 +81,14 @@ public: void copy_from(VideoInConfig *src); int load_defaults(BC_Hash *defaults); int save_defaults(BC_Hash *defaults); - char* get_path(); + const char *get_path(); + static const char *default_video_device; int driver; - char v4l_in_device[BCTEXTLEN]; char v4l2_in_device[BCTEXTLEN]; char v4l2jpeg_in_device[BCTEXTLEN]; int v4l2jpeg_in_fields; char v4l2mpeg_in_device[BCTEXTLEN]; - char lml_in_device[BCTEXTLEN]; - char buz_in_device[BCTEXTLEN]; char screencapture_display[BCTEXTLEN]; int firewire_port, firewire_channel; char firewire_path[BCTEXTLEN]; diff --git a/cinelerra-5.1/cinelerra/recordmonitor.C b/cinelerra-5.1/cinelerra/recordmonitor.C index 5ea2f17a..c72317fb 100644 --- a/cinelerra-5.1/cinelerra/recordmonitor.C +++ b/cinelerra-5.1/cinelerra/recordmonitor.C @@ -306,17 +306,14 @@ void RecordMonitorGUI::create_objects() // y offset for video canvas if we have the transport controls lock_window("RecordMonitorGUI::create_objects"); int driver = mwindow->edl->session->vconfig_in->driver; - int do_channel = (driver == VIDEO4LINUX || - driver == CAPTURE_BUZ || - driver == CAPTURE_DVB || + int do_channel = (driver == CAPTURE_DVB || driver == VIDEO4LINUX2 || driver == VIDEO4LINUX2JPEG || driver == VIDEO4LINUX2MPEG || driver == CAPTURE_JPEG_WEBCAM || driver == CAPTURE_YUYV_WEBCAM); int do_scopes = do_channel || driver == SCREENCAPTURE; - int do_interlace = (driver == CAPTURE_BUZ || - driver == VIDEO4LINUX2JPEG); + int do_interlace = (driver == VIDEO4LINUX2JPEG); int background_done = 0; int do_audio = record->default_asset->audio_data; int do_video = record->default_asset->video_data; @@ -395,8 +392,7 @@ void RecordMonitorGUI::create_objects() channel_picker->create_objects(); x += channel_picker->get_w() + mwindow->theme->widget_border; } - if( driver == CAPTURE_BUZ || - driver == VIDEO4LINUX2JPEG ) { + if( driver == VIDEO4LINUX2JPEG ) { add_subwindow(reverse_interlace = new ReverseInterlace(record, mwindow->theme->rmonitor_interlace_x, mwindow->theme->rmonitor_interlace_y)); @@ -555,17 +551,14 @@ int RecordMonitorGUI::translation_event() int RecordMonitorGUI::resize_event(int w, int h) { int driver = mwindow->edl->session->vconfig_in->driver; - int do_channel = (driver == VIDEO4LINUX || - driver == CAPTURE_BUZ || - driver == CAPTURE_DVB || + int do_channel = (driver == CAPTURE_DVB || driver == VIDEO4LINUX2 || driver == VIDEO4LINUX2JPEG || driver == VIDEO4LINUX2MPEG || driver == CAPTURE_JPEG_WEBCAM || driver == CAPTURE_YUYV_WEBCAM); int do_scopes = do_channel || driver == SCREENCAPTURE; - int do_interlace = (driver == CAPTURE_BUZ || - driver == VIDEO4LINUX2JPEG); + int do_interlace = (driver == VIDEO4LINUX2JPEG); int do_avc = 0; #ifdef HAVE_FIREWIRE do_avc = avc1394_transport ? 1 : 0; @@ -919,7 +912,6 @@ void RecordMonitorThread::init_output_format() output_colormodel = record->vdevice->get_best_colormodel(record->default_asset); break; - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: jpeg_engine = new RecVideoMJPGThread(record, this, mwindow->edl->session->vconfig_in->v4l2jpeg_in_fields); @@ -946,7 +938,6 @@ void RecordMonitorThread::init_output_format() case CAPTURE_DVB: - case VIDEO4LINUX: case VIDEO4LINUX2: case VIDEO4LINUX2MPEG: output_colormodel = record->vdevice->get_best_colormodel(record->default_asset); @@ -974,7 +965,6 @@ int RecordMonitorThread::stop_playback() //printf("RecordMonitorThread::stop_playback 1\n"); switch(mwindow->edl->session->vconfig_in->driver) { - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: if( jpeg_engine ) { jpeg_engine->stop_rendering(); @@ -1045,7 +1035,7 @@ int RecordMonitorThread::render_dv() void RecordMonitorThread::render_uncompressed() { - output_frame->copy_from(input_frame); + output_frame->transfer_from(input_frame); } void RecordMonitorThread::show_output_frame() @@ -1069,7 +1059,6 @@ void RecordMonitorThread::lock_input() int RecordMonitorThread::render_frame() { switch(mwindow->edl->session->vconfig_in->driver) { - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: case CAPTURE_JPEG_WEBCAM: render_jpeg(); diff --git a/cinelerra-5.1/cinelerra/renderengine.C b/cinelerra-5.1/cinelerra/renderengine.C index abca0715..970a91b0 100644 --- a/cinelerra-5.1/cinelerra/renderengine.C +++ b/cinelerra-5.1/cinelerra/renderengine.C @@ -24,7 +24,6 @@ #include "asset.h" #include "audiodevice.h" #include "bcsignals.h" -#include "channeldb.h" #include "condition.h" #include "edl.h" #include "edlsession.h" @@ -46,13 +45,11 @@ RenderEngine::RenderEngine(PlaybackEngine *playback_engine, Preferences *preferences, Canvas *output, - ChannelDB *channeldb, int is_nested) : Thread(1, 0, 0) { this->playback_engine = playback_engine; this->output = output; - this->channeldb = channeldb; this->is_nested = is_nested; audio = 0; video = 0; @@ -248,26 +245,6 @@ int RenderEngine::brender_available(int position, int direction) return 0; } -Channel* RenderEngine::get_current_channel() -{ - if(channeldb) - { - switch(config->vconfig->driver) - { - case PLAYBACK_BUZ: - if(config->vconfig->buz_out_channel >= 0 && - config->vconfig->buz_out_channel < channeldb->size()) - { - return channeldb->get(config->vconfig->buz_out_channel); - } - break; - case VIDEO4LINUX2JPEG: - case VIDEO4LINUX2MPEG: - break; - } - } - return 0; -} CICache* RenderEngine::get_acache() { @@ -356,8 +333,6 @@ int RenderEngine::open_output() get_output_h(), output, command->single_frame()); - Channel *channel = get_current_channel(); - if(channel) video->set_channel(channel); video->set_quality(80); video->set_cpus(preferences->processors); } diff --git a/cinelerra-5.1/cinelerra/renderengine.h b/cinelerra-5.1/cinelerra/renderengine.h index 5f816947..f8968ff4 100644 --- a/cinelerra-5.1/cinelerra/renderengine.h +++ b/cinelerra-5.1/cinelerra/renderengine.h @@ -48,7 +48,6 @@ public: RenderEngine(PlaybackEngine *playback_engine, Preferences *preferences, Canvas *output, - ChannelDB *channeldb, int is_nested); ~RenderEngine(); @@ -61,8 +60,6 @@ public: int get_output_w(); int get_output_h(); int brender_available(int position, int direction); -// Get current channel for the BUZ output - Channel* get_current_channel(); double get_tracking_position(); CICache* get_acache(); CICache* get_vcache(); @@ -130,9 +127,6 @@ public: // If the termination came from interrupt or end of selection int interrupted; -// Channels for the BUZ output - ChannelDB *channeldb; - // Samples in audio buffer to process int64_t fragment_len; // Samples to send to audio device after speed adjustment @@ -141,20 +135,6 @@ public: CICache *audio_cache, *video_cache; - - - - - - - - - - - - - - // constructing with an audio device forces output buffer allocation // constructing without an audio device puts in one buffer at a time mode RenderEngine(MWindow *mwindow, diff --git a/cinelerra-5.1/cinelerra/resourcepixmap.C b/cinelerra-5.1/cinelerra/resourcepixmap.C index df287629..00cf7965 100644 --- a/cinelerra-5.1/cinelerra/resourcepixmap.C +++ b/cinelerra-5.1/cinelerra/resourcepixmap.C @@ -667,7 +667,7 @@ void ResourcePixmap::draw_audio_source(TrackCanvas *canvas, command.change_type = CHANGE_ALL; command.realtime = 0; mwindow->gui->render_engine = new RenderEngine(0, - mwindow->preferences, 0, 0, 0); + mwindow->preferences, 0, 0); mwindow->gui->render_engine_id = edit->nested_edl->id; mwindow->gui->render_engine->set_acache(mwindow->audio_cache); mwindow->gui->render_engine->arm_command(&command); diff --git a/cinelerra-5.1/cinelerra/resourcethread.C b/cinelerra-5.1/cinelerra/resourcethread.C index c3d69412..853ae024 100644 --- a/cinelerra-5.1/cinelerra/resourcethread.C +++ b/cinelerra-5.1/cinelerra/resourcethread.C @@ -364,7 +364,7 @@ void ResourceThread::open_render_engine(EDL *nested_edl, command.change_type = CHANGE_ALL; command.realtime = 0; render_engine = new RenderEngine(0, - mwindow->preferences, 0, 0, 0); + mwindow->preferences, 0, 0); render_engine_id = nested_edl->id; render_engine->set_vcache(mwindow->video_cache); render_engine->set_acache(mwindow->audio_cache); diff --git a/cinelerra-5.1/cinelerra/vdevicebuz.C b/cinelerra-5.1/cinelerra/vdevicebuz.C deleted file mode 100644 index c6b6e99f..00000000 --- a/cinelerra-5.1/cinelerra/vdevicebuz.C +++ /dev/null @@ -1,805 +0,0 @@ -; -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - - -#ifdef HAVE_VIDEO4LINUX - -// ALPHA C++ can't compile 64 bit headers -#undef _LARGEFILE_SOURCE -#undef _LARGEFILE64_SOURCE -#undef _FILE_OFFSET_BITS - -#include "assets.h" -#include "bcsignals.h" -#include "channel.h" -#include "chantables.h" -#include "condition.h" -#include "file.inc" -#include "mutex.h" -#include "picture.h" -#include "playbackconfig.h" -#include "preferences.h" -#include "recordconfig.h" -#include "strategies.inc" -#include "vdevicebuz.h" -#include "videodev.h" -#include "vframe.h" -#include "videoconfig.h" -#include "videodevice.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#define BASE_VIDIOCPRIVATE 192 - -#define READ_TIMEOUT 5000000 - - -VDeviceBUZInput::VDeviceBUZInput(VDeviceBUZ *device) - : Thread(1, 1, 0) -{ - this->device = device; - buffer = 0; - buffer_size = 0; - total_buffers = 0; - current_inbuffer = 0; - current_outbuffer = 0; - done = 0; - output_lock = new Condition(0, "VDeviceBUZInput::output_lock"); - buffer_lock = new Mutex("VDeviceBUZInput::buffer_lock"); -} - -VDeviceBUZInput::~VDeviceBUZInput() -{ - if(Thread::running()) - { - done = 1; - Thread::cancel(); - } - Thread::join(); - - if(buffer) - { - for(int i = 0; i < total_buffers; i++) - { - delete [] buffer[i]; - } - delete [] buffer; - delete [] buffer_size; - } - delete output_lock; - delete buffer_lock; -} - -void VDeviceBUZInput::start() -{ -// Create buffers - total_buffers = device->device->in_config->capture_length; - buffer = new char*[total_buffers]; - buffer_size = new int[total_buffers]; - bzero(buffer_size, sizeof(int) * total_buffers); - for(int i = 0; i < total_buffers; i++) - { - buffer[i] = new char[INPUT_BUFFER_SIZE]; - } - - Thread::start(); -} - -void VDeviceBUZInput::run() -{ - struct buz_sync bsync; - -// Wait for frame - while(1) - { - Thread::enable_cancel(); - if(ioctl(device->jvideo_fd, BUZIOC_SYNC, &bsync) < 0) - { - perror("VDeviceBUZInput::run BUZIOC_SYNC"); - if(done) return; - Thread::disable_cancel(); - } - else - { - Thread::disable_cancel(); - - - - int new_buffer = 0; - buffer_lock->lock("VDeviceBUZInput::run"); -// Save only if the current buffer is free. - if(!buffer_size[current_inbuffer]) - { - new_buffer = 1; -// Copy to input buffer - memcpy(buffer[current_inbuffer], - device->input_buffer + bsync.frame * device->breq.size, - bsync.length); - -// Advance input buffer number and decrease semaphore. - buffer_size[current_inbuffer] = bsync.length; - increment_counter(¤t_inbuffer); - } - - buffer_lock->unlock(); - - if(ioctl(device->jvideo_fd, BUZIOC_QBUF_CAPT, &bsync.frame)) - perror("VDeviceBUZInput::run BUZIOC_QBUF_CAPT"); - - if(new_buffer) output_lock->unlock(); - } - } -} - -void VDeviceBUZInput::get_buffer(char **ptr, int *size) -{ -// Increase semaphore to wait for buffer. - int result = output_lock->timed_lock(READ_TIMEOUT, "VDeviceBUZInput::get_buffer"); - - -// The driver has its own timeout routine but it doesn't work because -// because the tuner lock is unlocked and relocked with no delay. -// int result = 0; -// output_lock->lock("VDeviceBUZInput::get_buffer"); - - if(!result) - { -// Take over buffer table - buffer_lock->lock("VDeviceBUZInput::get_buffer"); - *ptr = buffer[current_outbuffer]; - *size = buffer_size[current_outbuffer]; - buffer_lock->unlock(); - } - else - { -//printf("VDeviceBUZInput::get_buffer 1\n"); - output_lock->unlock(); - } -} - -void VDeviceBUZInput::put_buffer() -{ - buffer_lock->lock("VDeviceBUZInput::put_buffer"); - buffer_size[current_outbuffer] = 0; - buffer_lock->unlock(); - increment_counter(¤t_outbuffer); -} - -void VDeviceBUZInput::increment_counter(int *counter) -{ - (*counter)++; - if(*counter >= total_buffers) *counter = 0; -} - -void VDeviceBUZInput::decrement_counter(int *counter) -{ - (*counter)--; - if(*counter < 0) *counter = total_buffers - 1; -} - - - - - - - - - - - - - - - -VDeviceBUZ::VDeviceBUZ(VideoDevice *device) - : VDeviceBase(device) -{ - reset_parameters(); - render_strategies.append(VRENDER_MJPG); - tuner_lock = new Mutex("VDeviceBUZ::tuner_lock"); -} - -VDeviceBUZ::~VDeviceBUZ() -{ - close_all(); - delete tuner_lock; -} - -void VDeviceBUZ::reset_parameters() -{ - jvideo_fd = 0; - input_buffer = 0; - output_buffer = 0; - frame_buffer = 0; - frame_size = 0; - frame_allocated = 0; - input_error = 0; - last_frame_no = 0; - temp_frame = 0; - user_frame = 0; - mjpeg = 0; - total_loops = 0; - output_number = 0; - input_thread = 0; - brightness = 32768; - hue = 32768; - color = 32768; - contrast = 32768; - whiteness = 32768; - return 0; -} - -void VDeviceBUZ::close_input_core() -{ - if(input_thread) - { - delete input_thread; - input_thread = 0; - } - - - if(device->r) - { - if(jvideo_fd) close(jvideo_fd); - jvideo_fd = 0; - } - - if(input_buffer) - { - if(input_buffer > 0) - munmap(input_buffer, breq.count * breq.size); - input_buffer = 0; - } - return 0; -} - -int VDeviceBUZ::close_output_core() -{ -//printf("VDeviceBUZ::close_output_core 1\n"); - if(device->w) - { -// if(ioctl(jvideo_fd, BUZIOC_QBUF_PLAY, &n) < 0) -// perror("VDeviceBUZ::close_output_core BUZIOC_QBUF_PLAY"); - if(jvideo_fd) close(jvideo_fd); - jvideo_fd = 0; - } - if(output_buffer) - { - if(output_buffer > 0) - munmap(output_buffer, breq.count * breq.size); - output_buffer = 0; - } - if(temp_frame) - { - delete temp_frame; - temp_frame = 0; - } - if(mjpeg) - { - mjpeg_delete(mjpeg); - mjpeg = 0; - } - if(user_frame) - { - delete user_frame; - user_frame = 0; - } -//printf("VDeviceBUZ::close_output_core 2\n"); - return 0; -} - - -int VDeviceBUZ::close_all() -{ -//printf("VDeviceBUZ::close_all 1\n"); - close_input_core(); -//printf("VDeviceBUZ::close_all 1\n"); - close_output_core(); -//printf("VDeviceBUZ::close_all 1\n"); - if(frame_buffer) delete frame_buffer; -//printf("VDeviceBUZ::close_all 1\n"); - reset_parameters(); -//printf("VDeviceBUZ::close_all 2\n"); - return 0; -} - -#define COMPOSITE_TEXT _("Composite") -#define SVIDEO_TEXT _("S-Video") -#define BUZ_COMPOSITE 0 -#define BUZ_SVIDEO 1 - -void VDeviceBUZ::get_inputs(ArrayList *input_sources) -{ - Channel *new_source = new Channel; - - strcpy(new_source->device_name, COMPOSITE_TEXT); - input_sources->append(new_source); - - new_source = new Channel; - strcpy(new_source->device_name, SVIDEO_TEXT); - input_sources->append(new_source); -} - -int VDeviceBUZ::open_input() -{ - device->channel->use_norm = 1; - device->channel->use_input = 1; - - device->picture->use_brightness = 1; - device->picture->use_contrast = 1; - device->picture->use_color = 1; - device->picture->use_hue = 1; - device->picture->use_whiteness = 1; - -// Can't open input until after the channel is set - return 0; -} - -int VDeviceBUZ::open_output() -{ -// Can't open output until after the channel is set - return 0; -} - -int VDeviceBUZ::set_channel(Channel *channel) -{ - if(!channel) return 0; - - tuner_lock->lock("VDeviceBUZ::set_channel"); - - if(device->r) - { - close_input_core(); - open_input_core(channel); - } - else - { - close_output_core(); - open_output_core(channel); - } - - tuner_lock->unlock(); - - - return 0; -} - -int VDeviceBUZ::create_channeldb(ArrayList *channeldb) -{ - return 0; -} - -int VDeviceBUZ::set_picture(PictureConfig *picture) -{ - this->brightness = (int)((float)picture->brightness / 100 * 32767 + 32768); - this->hue = (int)((float)picture->hue / 100 * 32767 + 32768); - this->color = (int)((float)picture->color / 100 * 32767 + 32768); - this->contrast = (int)((float)picture->contrast / 100 * 32767 + 32768); - this->whiteness = (int)((float)picture->whiteness / 100 * 32767 + 32768); - - - tuner_lock->lock("VDeviceBUZ::set_picture"); - if(device->r) - { - close_input_core(); - open_input_core(0); - } - else - { - close_output_core(); - open_output_core(0); - } - tuner_lock->unlock(); -// -// -// TRACE("VDeviceBUZ::set_picture 1"); -// tuner_lock->lock("VDeviceBUZ::set_picture"); -// TRACE("VDeviceBUZ::set_picture 2"); -// -// -// -// struct video_picture picture_params; -// // This call takes a long time in 2.4.22 -// if(ioctl(jvideo_fd, VIDIOCGPICT, &picture_params) < 0) -// perror("VDeviceBUZ::set_picture VIDIOCGPICT"); -// picture_params.brightness = brightness; -// picture_params.hue = hue; -// picture_params.colour = color; -// picture_params.contrast = contrast; -// picture_params.whiteness = whiteness; -// // This call takes a long time in 2.4.22 -// if(ioctl(jvideo_fd, VIDIOCSPICT, &picture_params) < 0) -// perror("VDeviceBUZ::set_picture VIDIOCSPICT"); -// if(ioctl(jvideo_fd, VIDIOCGPICT, &picture_params) < 0) -// perror("VDeviceBUZ::set_picture VIDIOCGPICT"); -// -// -// TRACE("VDeviceBUZ::set_picture 10"); -// -// -// tuner_lock->unlock(); - - return 0; -} - -int VDeviceBUZ::get_norm(int norm) -{ - switch(norm) - { - case NTSC: return VIDEO_MODE_NTSC; - case PAL: return VIDEO_MODE_PAL; - case SECAM: return VIDEO_MODE_SECAM; - } - printf("VDeviceBUZ::get_norm: unknown norm %d\n", norm); - return VIDEO_MODE_NTSC; -} - -int VDeviceBUZ::read_buffer(VFrame *frame) -{ - tuner_lock->lock("VDeviceBUZ::read_buffer"); - if(!jvideo_fd) open_input_core(0); - -// Get buffer from thread - char *buffer = 0; - int buffer_size = 0; - if(input_thread) - input_thread->get_buffer(&buffer, &buffer_size); - - if(buffer) - { - frame->allocate_compressed_data(buffer_size); - frame->set_compressed_size(buffer_size); - -// Transfer fields to frame - if(device->odd_field_first) - { - long field2_offset = mjpeg_get_field2((unsigned char*)buffer, buffer_size); - long field1_len = field2_offset; - long field2_len = buffer_size - field2_offset; - - memcpy(frame->get_data(), buffer + field2_offset, field2_len); - memcpy(frame->get_data() + field2_len, buffer, field1_len); - } - else - { - bcopy(buffer, frame->get_data(), buffer_size); - } - - input_thread->put_buffer(); - tuner_lock->unlock(); - } - else - { - tuner_lock->unlock(); - Timer timer; -// Allow other threads to lock the tuner_lock under NPTL. - timer.delay(100); - } - - - return 0; -} - -int VDeviceBUZ::open_input_core(Channel *channel) -{ - jvideo_fd = open(device->in_config->buz_in_device, O_RDONLY); - - if(jvideo_fd <= 0) - { - fprintf(stderr, "VDeviceBUZ::open_input %s: %s\n", - device->in_config->buz_in_device, - strerror(errno)); - jvideo_fd = 0; - return 1; - } - -// Create input sources - get_inputs(&device->input_sources); - -// Set current input source - if(channel) - { - for(int i = 0; i < 2; i++) - { - struct video_channel vch; - vch.channel = channel->input; - vch.norm = get_norm(channel->norm); - -//printf("VDeviceBUZ::open_input_core 2 %d %d\n", vch.channel, vch.norm); - if(ioctl(jvideo_fd, VIDIOCSCHAN, &vch) < 0) - perror("VDeviceBUZ::open_input_core VIDIOCSCHAN "); - } - } - - -// Throw away -// struct video_capability vc; -// if(ioctl(jvideo_fd, VIDIOCGCAP, &vc) < 0) -// perror("VDeviceBUZ::open_input VIDIOCGCAP"); - -// API dependant initialization - if(ioctl(jvideo_fd, BUZIOC_G_PARAMS, &bparm) < 0) - perror("VDeviceBUZ::open_input BUZIOC_G_PARAMS"); - - bparm.HorDcm = 1; - bparm.VerDcm = 1; - bparm.TmpDcm = 1; - bparm.field_per_buff = 2; - bparm.img_width = device->in_config->w; - bparm.img_height = device->in_config->h / bparm.field_per_buff; - bparm.img_x = 0; - bparm.img_y = 0; -// bparm.APPn = 0; -// bparm.APP_len = 14; - bparm.APP_len = 0; - bparm.odd_even = 0; - bparm.decimation = 0; - bparm.quality = device->quality; - bzero(bparm.APP_data, sizeof(bparm.APP_data)); - - if(ioctl(jvideo_fd, BUZIOC_S_PARAMS, &bparm) < 0) - perror("VDeviceBUZ::open_input BUZIOC_S_PARAMS"); - -// printf("open_input %d %d %d %d %d %d %d %d %d %d %d %d\n", -// bparm.HorDcm, -// bparm.VerDcm, -// bparm.TmpDcm, -// bparm.field_per_buff, -// bparm.img_width, -// bparm.img_height, -// bparm.img_x, -// bparm.img_y, -// bparm.APP_len, -// bparm.odd_even, -// bparm.decimation, -// bparm.quality); - - breq.count = device->in_config->capture_length; - breq.size = INPUT_BUFFER_SIZE; - if(ioctl(jvideo_fd, BUZIOC_REQBUFS, &breq) < 0) - perror("VDeviceBUZ::open_input BUZIOC_REQBUFS"); - -//printf("open_input %s %d %d %d %d\n", device->in_config->buz_in_device, breq.count, breq.size, bparm.img_width, bparm.img_height); - if((input_buffer = (char*)mmap(0, - breq.count * breq.size, - PROT_READ, - MAP_SHARED, - jvideo_fd, - 0)) == MAP_FAILED) - perror("VDeviceBUZ::open_input mmap"); - - -// Set picture quality - struct video_picture picture_params; -// This call takes a long time in 2.4.22 - if(ioctl(jvideo_fd, VIDIOCGPICT, &picture_params) < 0) - perror("VDeviceBUZ::set_picture VIDIOCGPICT"); - picture_params.brightness = brightness; - picture_params.hue = hue; - picture_params.colour = color; - picture_params.contrast = contrast; - picture_params.whiteness = whiteness; -// This call takes a long time in 2.4.22 - if(ioctl(jvideo_fd, VIDIOCSPICT, &picture_params) < 0) - perror("VDeviceBUZ::set_picture VIDIOCSPICT"); - if(ioctl(jvideo_fd, VIDIOCGPICT, &picture_params) < 0) - perror("VDeviceBUZ::set_picture VIDIOCGPICT"); - - -// Start capturing - int count = breq.count; - for(int i = 0; i < count; i++) - { - if(ioctl(jvideo_fd, BUZIOC_QBUF_CAPT, &i) < 0) - perror("VDeviceBUZ::open_input BUZIOC_QBUF_CAPT"); - } - - - input_thread = new VDeviceBUZInput(this); - input_thread->start(); -//printf("VDeviceBUZ::open_input_core 2\n"); - return 0; -} - -int VDeviceBUZ::open_output_core(Channel *channel) -{ -//printf("VDeviceBUZ::open_output 1\n"); - total_loops = 0; - output_number = 0; - jvideo_fd = open(device->out_config->buz_out_device, O_RDWR); - if(jvideo_fd <= 0) - { - perror("VDeviceBUZ::open_output"); - return 1; - } - - -// Set current input source - if(channel) - { - struct video_channel vch; - vch.channel = channel->input; - vch.norm = get_norm(channel->norm); - - if(ioctl(jvideo_fd, VIDIOCSCHAN, &vch) < 0) - perror("VDeviceBUZ::open_output_core VIDIOCSCHAN "); - } - - breq.count = 10; - breq.size = INPUT_BUFFER_SIZE; - if(ioctl(jvideo_fd, BUZIOC_REQBUFS, &breq) < 0) - perror("VDeviceBUZ::open_output BUZIOC_REQBUFS"); - if((output_buffer = (char*)mmap(0, - breq.count * breq.size, - PROT_READ | PROT_WRITE, - MAP_SHARED, - jvideo_fd, - 0)) == MAP_FAILED) - perror("VDeviceBUZ::open_output mmap"); - - if(ioctl(jvideo_fd, BUZIOC_G_PARAMS, &bparm) < 0) - perror("VDeviceBUZ::open_output BUZIOC_G_PARAMS"); - - bparm.decimation = 1; - bparm.HorDcm = 1; - bparm.field_per_buff = 2; - bparm.TmpDcm = 1; - bparm.VerDcm = 1; - bparm.img_width = device->out_w; - bparm.img_height = device->out_h / bparm.field_per_buff; - bparm.img_x = 0; - bparm.img_y = 0; - bparm.odd_even = 0; - - if(ioctl(jvideo_fd, BUZIOC_S_PARAMS, &bparm) < 0) - perror("VDeviceBUZ::open_output BUZIOC_S_PARAMS"); -//printf("VDeviceBUZ::open_output 2\n"); - return 0; -} - - - -int VDeviceBUZ::write_buffer(VFrame *frame, EDL *edl) -{ -//printf("VDeviceBUZ::write_buffer 1\n"); - tuner_lock->lock("VDeviceBUZ::write_buffer"); - - if(!jvideo_fd) open_output_core(0); - - VFrame *ptr = 0; - if(frame->get_color_model() != BC_COMPRESSED) - { - if(!temp_frame) temp_frame = new VFrame; - if(!mjpeg) - { - mjpeg = mjpeg_new(device->out_w, device->out_h, 2); - mjpeg_set_quality(mjpeg, device->quality); - mjpeg_set_float(mjpeg, 0); - } - ptr = temp_frame; - mjpeg_compress(mjpeg, - frame->get_rows(), - frame->get_y(), - frame->get_u(), - frame->get_v(), - frame->get_color_model(), - device->cpus); - temp_frame->allocate_compressed_data(mjpeg_output_size(mjpeg)); - temp_frame->set_compressed_size(mjpeg_output_size(mjpeg)); - bcopy(mjpeg_output_buffer(mjpeg), temp_frame->get_data(), mjpeg_output_size(mjpeg)); - } - else - ptr = frame; - -// Wait for frame to become available -// Caused close_output_core to lock up. -// if(total_loops >= 1) -// { -// if(ioctl(jvideo_fd, BUZIOC_SYNC, &output_number) < 0) -// perror("VDeviceBUZ::write_buffer BUZIOC_SYNC"); -// } - - if(device->out_config->buz_swap_fields) - { - long field2_offset = mjpeg_get_field2((unsigned char*)ptr->get_data(), - ptr->get_compressed_size()); - long field2_len = ptr->get_compressed_size() - field2_offset; - memcpy(output_buffer + output_number * breq.size, - ptr->get_data() + field2_offset, - field2_len); - memcpy(output_buffer + output_number * breq.size +field2_len, - ptr->get_data(), - field2_offset); - } - else - { - bcopy(ptr->get_data(), - output_buffer + output_number * breq.size, - ptr->get_compressed_size()); - } - - if(ioctl(jvideo_fd, BUZIOC_QBUF_PLAY, &output_number) < 0) - perror("VDeviceBUZ::write_buffer BUZIOC_QBUF_PLAY"); - - output_number++; - if(output_number >= (int)breq.count) - { - output_number = 0; - total_loops++; - } - tuner_lock->unlock(); -//printf("VDeviceBUZ::write_buffer 2\n"); - - return 0; -} - -void VDeviceBUZ::new_output_buffer(VFrame *output, - int colormodel) -{ -//printf("VDeviceBUZ::new_output_buffer 1 %d\n", colormodel); - if(user_frame) - { - if(colormodel != user_frame->get_color_model()) - { - delete user_frame; - user_frame = 0; - } - } - - if(!user_frame) - { - switch(colormodel) - { - case BC_COMPRESSED: - user_frame = new VFrame; - break; - default: - user_frame = new VFrame(0, - -1, - device->out_w, - device->out_h, - colormodel, - -1); - break; - } - } -// user_frame->set_shm_offset(0); - output = user_frame; -//printf("VDeviceBUZ::new_output_buffer 2\n"); -} - - -ArrayList* VDeviceBUZ::get_render_strategies() -{ - return &render_strategies; -} - - -#endif // HAVE_VIDEO4LINUX - - diff --git a/cinelerra-5.1/cinelerra/vdevicebuz.h b/cinelerra-5.1/cinelerra/vdevicebuz.h deleted file mode 100644 index 6fe9321b..00000000 --- a/cinelerra-5.1/cinelerra/vdevicebuz.h +++ /dev/null @@ -1,129 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICEBUZ_H -#define VDEVICEBUZ_H - -#include "buz.h" -#include "channel.inc" -#include "condition.inc" -#include "guicast.h" -#include "libmjpeg.h" -#include "mutex.inc" -#include "thread.h" -#include "vdevicebase.h" -#include "vdevicebuz.inc" -#include "vframe.inc" - - -#define INPUT_BUFFER_SIZE 0x40000 - -// Let's get real. The Buz driver doesn't work. If the buffers overflow -// for enough time it locks up and can't be recovered except by a -// SIGINT and restart. We need to cascade the buffer reading in another -// ring buffer thread, have it read continuously, and cancel it if it -// dies. How about if we do this in SCHED_RR and wait for it to die before -// implementing cancellation? - - -class VDeviceBUZInput : public Thread -{ -public: - VDeviceBUZInput(VDeviceBUZ *device); - ~VDeviceBUZInput(); - void start(); - void run(); - void get_buffer(char **ptr, int *size); - void put_buffer(); - void increment_counter(int *counter); - void decrement_counter(int *counter); - VDeviceBUZ *device; - - char **buffer; - int *buffer_size; - int total_buffers; - int current_inbuffer; - int current_outbuffer; - Condition *output_lock; - Mutex *buffer_lock; - int done; -}; - - -class VDeviceBUZ : public VDeviceBase -{ -public: - VDeviceBUZ(VideoDevice *device); - ~VDeviceBUZ(); - - friend class VDeviceBUZInput; - - int open_input(); - int open_output(); - int close_all(); - int read_buffer(VFrame *frame); - int write_buffer(VFrame *frames, EDL *edl); - void reset_parameters(); - ArrayList* get_render_strategies(); - int set_channel(Channel *channel); - int get_norm(int norm); - static void get_inputs(ArrayList *input_sources); - int set_picture(PictureConfig *picture); - int get_best_colormodel(int colormodel); - int create_channeldb(ArrayList *channeldb); - void new_output_buffer(VFrame *output, int colormodel); - - -private: - int open_input_core(Channel *channel); - void close_input_core(); - int open_output_core(Channel *channel); - int close_output_core(); - - int jvideo_fd; - char *input_buffer, *frame_buffer, *output_buffer; - long frame_size, frame_allocated; - int input_error; - long last_frame_no; - ArrayList render_strategies; -// Temporary frame for compressing output data - VFrame *temp_frame; -// Frame given to user to acquire data - VFrame *user_frame; - mjpeg_t *mjpeg; - Mutex *tuner_lock; - VDeviceBUZInput *input_thread; - - struct buz_params bparm; - struct buz_requestbuffers breq; -// Can't CSYNC the first loop - int total_loops; -// Number of output frame to load - int output_number; - - int brightness; - int hue; - int color; - int contrast; - int whiteness; -}; - -#endif diff --git a/cinelerra-5.1/cinelerra/vdevicebuz.inc b/cinelerra-5.1/cinelerra/vdevicebuz.inc deleted file mode 100644 index 72224e85..00000000 --- a/cinelerra-5.1/cinelerra/vdevicebuz.inc +++ /dev/null @@ -1,28 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICEBUZ_INC -#define VDEVICEBUZ_INC - -class VDeviceBUZ; -class VDeviceBUZInput; - -#endif diff --git a/cinelerra-5.1/cinelerra/vdevicelml.C b/cinelerra-5.1/cinelerra/vdevicelml.C deleted file mode 100644 index d200b7ba..00000000 --- a/cinelerra-5.1/cinelerra/vdevicelml.C +++ /dev/null @@ -1,439 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 "assets.h" -#include "file.inc" -#include "language.h" -#include "playbackconfig.h" -#include "preferences.h" -#include "recordconfig.h" -#include "strategies.inc" -#include "vdevicelml.h" -#include "vframe.h" -#include "videoconfig.h" -#include "videodevice.h" - - -#define SOI 0xffd8 -#define APP3 0xffe3 -#define APP1 0xffe1 -#define APP0 0xffe0 -#define EOI 0xffd9 - -VDeviceLML::VDeviceLML(VideoDevice *device) - : VDeviceBase(device) -{ - reset_parameters(); - render_strategies.append(VRENDER_MJPG); -} - -VDeviceLML::~VDeviceLML() -{ - close_all(); -} - -int VDeviceLML::reset_parameters() -{ - jvideo_fd = 0; - input_buffer = 0; - frame_buffer = 0; - frame_size = 0; - frame_allocated = 0; - input_error = 0; - input_position = INPUT_BUFFER_SIZE; - last_frame_no = 0; -} - -int VDeviceLML::open_input() -{ - jvideo_fd = fopen(device->in_config->lml_in_device, "rb"); - if(jvideo_fd) - { - return 0; - } - else - { - perror("VDeviceLML::open_input"); - jvideo_fd = 0; - return 1; - } - return 0; -} - -int VDeviceLML::open_output() -{ - jvideo_fd = fopen(device->out_config->lml_out_device, "wb"); - if(jvideo_fd) - { - return 0; - } - else - { - perror("VDeviceLML::open_output"); - jvideo_fd = 0; - return 1; - } - return 0; -} - -int VDeviceLML::close_all() -{ - if(device->r) - { - if(jvideo_fd) fclose(jvideo_fd); - } - if(device->w) - { - if(jvideo_fd) fclose(jvideo_fd); - } - if(input_buffer) - { - delete input_buffer; - } - if(frame_buffer) - { - delete frame_buffer; - } - reset_parameters(); - return 0; -} - -int VDeviceLML::read_buffer(VFrame *frame) -{ - long first_field = 0, frame1_size = 0, frame2_size = 0, i; - int result = 0, frame_no = 0, retries = 0; - - if(!jvideo_fd) return 1; - - input_error = 0; - -retry: - frame->set_compressed_size(0); - retries++; - if(retries > 5) return 1; - -// Keep reading until the first field of a frame arrives. - while(!input_error && !first_field) - { -// Get the first marker of a frame - while(!input_error && next_bytes(2) != SOI) - { - get_byte(); - } - -// Store SOI marker - frame_size = 0; - write_byte(get_byte()); - write_byte(get_byte()); - -// Copy the first frame - while(!input_error && next_bytes(2) != EOI) - { -// Replace the LML header with a Quicktime header - if(next_bytes(2) == APP3) - { - first_field = 1; - write_fake_marker(); - - get_byte(); // APP3 - get_byte(); - get_byte(); // LEN - get_byte(); - get_byte(); // COMMENT - get_byte(); - get_byte(); - get_byte(); - get_byte(); // Frame no - get_byte(); - get_byte(); // sec - get_byte(); - get_byte(); - get_byte(); - get_byte(); // usec - get_byte(); - get_byte(); - get_byte(); - get_byte(); // framesize (useless since we have to swap frames) - get_byte(); - get_byte(); - get_byte(); - frame_no = get_byte(); // frame seq no - frame_no |= (long)get_byte() << 8; - frame_no |= (long)get_byte() << 16; - frame_no |= (long)get_byte() << 24; - - if(frame_no <= last_frame_no) - { - input_error = reopen_input(); - first_field = 0; - goto retry; - } - else - { -// Finish LML header - last_frame_no = frame_no; - while(next_bytes(2) != 0xffdb) get_byte(); - } - } - else - { - write_byte(get_byte()); - } - } - -// Store EOI marker - write_byte(get_byte()); - write_byte(get_byte()); - } - - frame1_size = frame_size; - -// Read the second field - if(first_field) - { -// Find next field - while(!input_error && next_bytes(2) != SOI) - { - get_byte(); - } - -// Store SOI marker - write_byte(get_byte()); - write_byte(get_byte()); - -// Store Quicktime header - write_fake_marker(); - -// Copy the second frame - while(!input_error && next_bytes(2) != EOI) - { - write_byte(get_byte()); - } - -// Store EOI marker - write_byte(get_byte()); - write_byte(get_byte()); - } - - frame2_size = frame_size - frame1_size; - -// Insert the required information - if(!input_error) - { -// Store in the VFrame - frame->allocate_compressed_data(frame_size); - -// Quicktime expects the even field first - if(device->odd_field_first) - { - memcpy(frame->get_data(), frame_buffer + frame1_size, frame2_size); - memcpy(frame->get_data() + frame2_size, frame_buffer, frame1_size); - } - else - memcpy(frame->get_data(), frame_buffer, frame_size); - - frame->set_compressed_size(frame_size); - } - else - { - input_error = 0; - reopen_input(); - goto retry; - } - - return input_error; -} - -int VDeviceLML::reopen_input() -{ - int input_error = 0; - Timer timer; - fprintf(stderr, _("VDeviceLML::read_buffer: driver crash\n")); - fclose(jvideo_fd); - timer.delay(100); - input_error = open_input(); - if(!input_error) fprintf(stderr, _("VDeviceLML::read_buffer: reopened\n")); - last_frame_no = 0; - input_position = INPUT_BUFFER_SIZE; - return input_error; -} - - -int VDeviceLML::write_fake_marker() -{ -// Marker - write_byte(0xff); - write_byte(0xe1); -// Size - write_byte(0x00); - write_byte(0x2a); -// Blank space - for(int i = 0; i < 0x28; i++) - { - write_byte(0x00); - } - return 0; -} - -int VDeviceLML::refill_input() -{ -// Shift remaining data up. - memcpy(input_buffer, input_buffer + input_position, INPUT_BUFFER_SIZE - input_position); - -// Append new data - input_error = !fread(input_buffer + INPUT_BUFFER_SIZE - input_position, - INPUT_BUFFER_SIZE - (INPUT_BUFFER_SIZE - input_position), - 1, - jvideo_fd); - - input_position = 0; - return input_error; -} - - -int VDeviceLML::write_buffer(VFrame *frame, EDL *edl) -{ - int result = 0, i, frame1size, j, size_qword, real_size, skip; - unsigned long size = frame->get_compressed_size(); - unsigned char *data = frame->get_data(); - unsigned char *data1; - int even_field_first = 1; - -#if 0 - if(!jvideo_fd || frame->get_color_model() != VFRAME_COMPRESSED) return 1; -#endif - - if(frame_allocated < size * 2) - { - delete frame_buffer; - frame_buffer = 0; - } - - if(!frame_buffer) - { - frame_buffer = new unsigned char[size * 2]; - } - - for(data1 = data + 1, i = 0; i < size - 1; i++) - if(data[i] == ((EOI & 0xff00) >> 8) && data1[i] == (EOI & 0xff)) break; - - i += 2; - frame1size = i; - j = 0; - if(even_field_first) i = 0; - -// SOI - frame_buffer[j++] = data[i++]; - frame_buffer[j++] = data[i++]; - -// APP3 for LML driver - frame_buffer[j++] = (APP3 & 0xff00) >> 8; - frame_buffer[j++] = APP3 & 0xff; - frame_buffer[j++] = 0; // Marker size - frame_buffer[j++] = 0x2c; - frame_buffer[j++] = 'L'; // nm - frame_buffer[j++] = 'M'; - frame_buffer[j++] = 'L'; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; // frameNo - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; // sec - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; // usec - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; -// Frame size eventually goes here - size_qword = j; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; -// Frame Seq No - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; -// Color Encoding - frame_buffer[j++] = 1; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; -// Video Stream - frame_buffer[j++] = 1; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; -// Time Decimation - frame_buffer[j++] = 1; - frame_buffer[j++] = 0; -// Filler - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - frame_buffer[j++] = 0; - -// Copy rest of first field - data1 = data + 1; - - while(i < size) - { - frame_buffer[j++] = data[i++]; - } - -// Copy second field - if(!even_field_first) - { - for(i = 0; i < frame1size; ) - { - frame_buffer[j++] = data[i++]; - } - } - - real_size = j; -// frameSize in little endian - frame_buffer[size_qword++] = (real_size & 0xff); - frame_buffer[size_qword++] = ((real_size & 0xff00) >> 8); - frame_buffer[size_qword++] = ((real_size & 0xff0000) >> 16); - frame_buffer[size_qword++] = ((real_size & 0xff000000) >> 24); - -//fwrite(frame_buffer, real_size, 1, stdout); - result = !fwrite(frame_buffer, - real_size, - 1, - jvideo_fd); - if(result) perror("VDeviceLML::write_buffer"); - - return result; -} - -ArrayList* VDeviceLML::get_render_strategies() -{ - return &render_strategies; -} diff --git a/cinelerra-5.1/cinelerra/vdevicelml.h b/cinelerra-5.1/cinelerra/vdevicelml.h deleted file mode 100644 index 7f7daf1f..00000000 --- a/cinelerra-5.1/cinelerra/vdevicelml.h +++ /dev/null @@ -1,106 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICELML_H -#define VDEVICELML_H - -#include "guicast.h" -#include "vdevicebase.h" - -#include "jpeg.h" - -#define INPUT_BUFFER_SIZE 65536 - -class VDeviceLML : public VDeviceBase -{ -public: - VDeviceLML(VideoDevice *device); - ~VDeviceLML(); - - int open_input(); - int open_output(); - int close_all(); - int read_buffer(VFrame *frame); - int write_buffer(VFrame *frame, EDL *edl); - int reset_parameters(); - ArrayList* get_render_strategies(); - -private: - int reopen_input(); - - inline unsigned char get_byte() - { - if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE]; - if(input_position >= INPUT_BUFFER_SIZE) refill_input(); - return input_buffer[input_position++]; - }; - - inline unsigned long next_bytes(int total) - { - unsigned long result = 0; - int i; - - if(!input_buffer) input_buffer = new unsigned char[INPUT_BUFFER_SIZE]; - if(input_position + total > INPUT_BUFFER_SIZE) refill_input(); - - for(i = 0; i < total; i++) - { - result <<= 8; - result |= input_buffer[input_position + i]; - } - return result; - }; - - int refill_input(); - inline int write_byte(unsigned char byte) - { - if(!frame_buffer) - { - frame_buffer = new unsigned char[256000]; - frame_allocated = 256000; - } - - if(frame_size >= frame_allocated) - { - unsigned char *new_frame = new unsigned char[frame_allocated * 2]; - memcpy(new_frame, frame_buffer, frame_size); - delete frame_buffer; - frame_buffer = new_frame; - frame_allocated *= 2; - } - - frame_buffer[frame_size++] = byte; - return 0; - }; - - int write_fake_marker(); - - FILE *jvideo_fd; - unsigned char *input_buffer, *frame_buffer; - long input_position; - long frame_size, frame_allocated; - int input_error; -// quicktime_mjpeg_hdr jpeg_header; - long last_frame_no; - ArrayList render_strategies; -}; - -#endif diff --git a/cinelerra-5.1/cinelerra/vdevicelml.inc b/cinelerra-5.1/cinelerra/vdevicelml.inc deleted file mode 100644 index 31047e24..00000000 --- a/cinelerra-5.1/cinelerra/vdevicelml.inc +++ /dev/null @@ -1,27 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICELML_INC -#define VDEVICELML_INC - -class VDeviceLML; - -#endif diff --git a/cinelerra-5.1/cinelerra/vdeviceprefs.C b/cinelerra-5.1/cinelerra/vdeviceprefs.C index a64ca40d..e4b6dd28 100644 --- a/cinelerra-5.1/cinelerra/vdeviceprefs.C +++ b/cinelerra-5.1/cinelerra/vdeviceprefs.C @@ -50,7 +50,7 @@ VDevicePrefs::VDevicePrefs(int x, { this->pwindow = pwindow; this->dialog = dialog; - this->driver = -1; + this->driver = DEV_UNKNOWN; this->mode = mode; this->out_config = out_config; this->in_config = in_config; @@ -72,7 +72,6 @@ VDevicePrefs::~VDevicePrefs() } if( config >= 0 ) pwindow->mwindow->session->save_x11_host(config, out_config->x11_host); - pwindow->mwindow->channeldb_buz->save("channeldb_buz"); } @@ -96,7 +95,6 @@ void VDevicePrefs::reset_objects() fields_title = 0; device_fields = 0; - buz_swap_channels = 0; channel_picker = 0; } @@ -129,8 +127,7 @@ int VDevicePrefs::initialize(int creation) switch(this->driver) { - case VIDEO4LINUX: - create_v4l_objs(); + case DEV_UNKNOWN: break; case VIDEO4LINUX2: case CAPTURE_JPEG_WEBCAM: @@ -146,13 +143,6 @@ int VDevicePrefs::initialize(int creation) case SCREENCAPTURE: create_screencap_objs(); break; - case CAPTURE_LML: - create_lml_objs(); - break; - case CAPTURE_BUZ: - case PLAYBACK_BUZ: - create_buz_objs(); - break; case PLAYBACK_X11: case PLAYBACK_X11_XV: case PLAYBACK_X11_GL: @@ -186,7 +176,6 @@ int VDevicePrefs::delete_objects() { delete output_title; delete channel_picker; - delete buz_swap_channels; delete device_title; delete device_text; delete dvb_adapter_device; @@ -233,74 +222,6 @@ void VDevicePrefs::create_dvb_objs() dialog->add_subwindow(follow_video_config); } -int VDevicePrefs::create_lml_objs() -{ - char *output_char = 0; - int x1 = x + menu->get_w() + 5; - BC_Resources *resources = BC_WindowBase::get_resources(); - - switch(mode) - { - case MODEPLAY: - output_char = out_config->lml_out_device; - break; - case MODERECORD: - output_char = in_config->lml_in_device; - break; - } - dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default)); - x1 += device_title->get_w() + 10; - dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char)); - return 0; -} - -int VDevicePrefs::create_buz_objs() -{ -#ifdef HAVE_VIDEO4LINUX - - - char *output_char = 0; - int x1 = x + menu->get_w() + 5; - int x2 = x1 + 210; - int y1 = y; - BC_Resources *resources = BC_WindowBase::get_resources(); - - switch(mode) - { - case MODEPLAY: - output_char = out_config->buz_out_device; - break; - case MODERECORD: - output_char = in_config->buz_in_device; - break; - } - dialog->add_subwindow(device_title = new BC_Title(x1, y1, _("Device path:"), MEDIUMFONT, resources->text_default)); - - y1 += 20; - dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y1, output_char)); - - if(driver == PLAYBACK_BUZ) - { - dialog->add_subwindow(buz_swap_channels = - new VDeviceCheckBox(x2, y1, &out_config->buz_swap_fields, _("Swap fields"))); - } - y1 += 30; - if(driver == PLAYBACK_BUZ) - { - dialog->add_subwindow(output_title = new BC_Title(x1, y1, _("Output channel:"))); - y1 += 20; - channel_picker = new PrefsChannelPicker(pwindow->mwindow, - this, - pwindow->mwindow->channeldb_buz, - x1, - y1); - channel_picker->create_objects(); - } -#endif // HAVE_VIDEO4LINUX - - return 0; -} - int VDevicePrefs::create_firewire_objs() { int *output_int = 0; @@ -392,23 +313,6 @@ int VDevicePrefs::create_firewire_objs() return 0; } -int VDevicePrefs::create_v4l_objs() -{ -#ifdef HAVE_VIDEO4LINUX - - - char *output_char; - BC_Resources *resources = BC_WindowBase::get_resources(); - int x1 = x + menu->get_w() + 5; - output_char = pwindow->thread->edl->session->vconfig_in->v4l_in_device; - dialog->add_subwindow(device_title = new BC_Title(x1, y, _("Device path:"), MEDIUMFONT, resources->text_default)); - dialog->add_subwindow(device_text = new VDeviceTextBox(x1, y + 20, output_char)); - - -#endif // HAVE_VIDEO4LINUX - return 0; -} - int VDevicePrefs::create_v4l2_objs() { char *output_char; @@ -510,8 +414,8 @@ char* VDriverMenu::driver_to_string(int driver) { switch(driver) { - case VIDEO4LINUX: - sprintf(string, VIDEO4LINUX_TITLE); + case DEV_UNKNOWN: + sprintf(string, DEV_UNKNOWN_TITLE); break; case VIDEO4LINUX2: sprintf(string, VIDEO4LINUX2_TITLE); @@ -531,12 +435,6 @@ char* VDriverMenu::driver_to_string(int driver) case SCREENCAPTURE: sprintf(string, SCREENCAPTURE_TITLE); break; - case CAPTURE_BUZ: - sprintf(string, CAPTURE_BUZ_TITLE); - break; - case CAPTURE_LML: - sprintf(string, CAPTURE_LML_TITLE); - break; #ifdef HAVE_FIREWIRE case CAPTURE_FIREWIRE: sprintf(string, CAPTURE_FIREWIRE_TITLE); @@ -557,12 +455,6 @@ char* VDriverMenu::driver_to_string(int driver) case PLAYBACK_X11_GL: sprintf(string, PLAYBACK_X11_GL_TITLE); break; - case PLAYBACK_LML: - sprintf(string, PLAYBACK_LML_TITLE); - break; - case PLAYBACK_BUZ: - sprintf(string, PLAYBACK_BUZ_TITLE); - break; #ifdef HAVE_FIREWIRE case PLAYBACK_FIREWIRE: sprintf(string, PLAYBACK_FIREWIRE_TITLE); @@ -584,10 +476,6 @@ void VDriverMenu::create_objects() { if(do_input) { -#ifdef HAVE_VIDEO4LINUX - add_item(new VDriverItem(this, VIDEO4LINUX_TITLE, VIDEO4LINUX)); -#endif - #ifdef HAVE_VIDEO4LINUX2 add_item(new VDriverItem(this, VIDEO4LINUX2_TITLE, VIDEO4LINUX2)); add_item(new VDriverItem(this, CAPTURE_JPEG_WEBCAM_TITLE, CAPTURE_JPEG_WEBCAM)); @@ -597,9 +485,6 @@ void VDriverMenu::create_objects() #endif add_item(new VDriverItem(this, SCREENCAPTURE_TITLE, SCREENCAPTURE)); -#ifdef HAVE_VIDEO4LINUX - add_item(new VDriverItem(this, CAPTURE_BUZ_TITLE, CAPTURE_BUZ)); -#endif #ifdef HAVE_FIREWIRE add_item(new VDriverItem(this, CAPTURE_FIREWIRE_TITLE, CAPTURE_FIREWIRE)); add_item(new VDriverItem(this, CAPTURE_IEC61883_TITLE, CAPTURE_IEC61883)); @@ -617,7 +502,6 @@ void VDriverMenu::create_objects() if(get_opengl_server_version() >= 103) add_item(new VDriverItem(this, PLAYBACK_X11_GL_TITLE, PLAYBACK_X11_GL)); #endif - add_item(new VDriverItem(this, PLAYBACK_BUZ_TITLE, PLAYBACK_BUZ)); #ifdef HAVE_FIREWIRE add_item(new VDriverItem(this, PLAYBACK_FIREWIRE_TITLE, PLAYBACK_FIREWIRE)); add_item(new VDriverItem(this, PLAYBACK_DV1394_TITLE, PLAYBACK_DV1394)); diff --git a/cinelerra-5.1/cinelerra/vdeviceprefs.h b/cinelerra-5.1/cinelerra/vdeviceprefs.h index a2b1591e..06c1fa84 100644 --- a/cinelerra-5.1/cinelerra/vdeviceprefs.h +++ b/cinelerra-5.1/cinelerra/vdeviceprefs.h @@ -70,15 +70,12 @@ public: PrefsChannelPicker *channel_picker; private: - int create_lml_objs(); int create_firewire_objs(); int create_dv1394_objs(); - int create_v4l_objs(); int create_v4l2_objs(); int create_v4l2jpeg_objs(); int create_v4l2mpeg_objs(); int create_screencap_objs(); - int create_buz_objs(); int create_x11_objs(); void create_dvb_objs(); @@ -102,7 +99,6 @@ private: VDeviceTumbleBox *device_fields; VDeviceTumbleBox *dvb_adapter_device; - VDeviceCheckBox *buz_swap_channels; int driver, mode; int x; int y; diff --git a/cinelerra-5.1/cinelerra/vdevicev4l.C b/cinelerra-5.1/cinelerra/vdevicev4l.C deleted file mode 100644 index 3d289df6..00000000 --- a/cinelerra-5.1/cinelerra/vdevicev4l.C +++ /dev/null @@ -1,573 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - - -#ifdef HAVE_VIDEO4LINUX - -// V4L2 is incompatible with large file support -// ALPHA C++ can't compile 64 bit headers -#undef _FILE_OFFSET_BITS -#undef _LARGEFILE_SOURCE -#undef _LARGEFILE64_SOURCE - - -#include "assets.h" -#include "bcsignals.h" -#include "channel.h" -#include "chantables.h" -#include "clip.h" -#include "file.h" -#include "picture.h" -#include "preferences.h" -#include "recordconfig.h" -#include "vdevicev4l.h" -#include "vframe.h" -#include "videodevice.h" - -#include -#include -#include -#include -#include - -VDeviceV4L::VDeviceV4L(VideoDevice *device) - : VDeviceBase(device) -{ - initialize(); -} - -VDeviceV4L::~VDeviceV4L() -{ -} - -int VDeviceV4L::initialize() -{ - capture_buffer = 0; - capture_frame_number = 0; - read_frame_number = 0; - shared_memory = 0; - initialization_complete = 0; - return 0; -} - -int VDeviceV4L::open_input() -{ - device->channel->use_frequency = 1; - device->channel->use_fine = 1; - device->channel->use_norm = 1; - device->channel->use_input = 1; - - - device->picture->use_brightness = 1; - device->picture->use_contrast = 1; - device->picture->use_color = 1; - device->picture->use_hue = 1; - device->picture->use_whiteness = 1; - - if((input_fd = open(device->in_config->v4l_in_device, O_RDWR)) < 0) - { - perror("VDeviceV4L::open_input"); - return 1; - } - else - { - v4l1_get_inputs(); - close(input_fd); - } - return 0; -} - -int VDeviceV4L::close_all() -{ - close_v4l(); - return 0; -} - -int VDeviceV4L::close_v4l() -{ - unmap_v4l_shmem(); - if(input_fd != -1) close(input_fd); - return 0; -} - -int VDeviceV4L::unmap_v4l_shmem() -{ - if(capture_buffer) - { - if(shared_memory) - munmap(capture_buffer, capture_params.size); - else - delete capture_buffer; - capture_buffer = 0; - } - return 0; -} - -int VDeviceV4L::v4l_init() -{ - input_fd = open(device->in_config->v4l_in_device, O_RDWR); - - if(input_fd < 0) - perror("VDeviceV4L::v4l_init"); - else - { - set_cloexec_flag(input_fd, 1); - set_mute(0); - if(ioctl(input_fd, VIDIOCGWIN, &window_params) < 0) - perror("VDeviceV4L::v4l_init VIDIOCGWIN"); - window_params.x = 0; - window_params.y = 0; - window_params.width = device->in_config->w; - window_params.height = device->in_config->h; - window_params.chromakey = 0; - window_params.flags = 0; - window_params.clipcount = 0; - if(ioctl(input_fd, VIDIOCSWIN, &window_params) < 0) - perror("VDeviceV4L::v4l_init VIDIOCSWIN"); - if(ioctl(input_fd, VIDIOCGWIN, &window_params) < 0) - perror("VDeviceV4L::v4l_init VIDIOCGWIN"); - - device->in_config->w = window_params.width; - device->in_config->h = window_params.height; - - PictureConfig picture(0); - set_picture(&picture); - - if(ioctl(input_fd, VIDIOCGMBUF, &capture_params) < 0) - perror("VDeviceV4L::v4l_init VIDIOCGMBUF"); - - capture_buffer = (char*)mmap(0, - capture_params.size, - PROT_READ|PROT_WRITE, - MAP_SHARED, - input_fd, - 0); - - capture_frame_number = 0; - - if(capture_buffer == MAP_FAILED) - { -// Use read instead. - perror("VDeviceV4L::v4l_init mmap"); - shared_memory = 0; - capture_buffer = new char[capture_params.size]; - } - else - { -// Get all frames capturing - shared_memory = 1; - } - } - got_first_frame = 0; - return 0; -} - -void VDeviceV4L::v4l1_start_capture() -{ - for(int i = 0; i < MIN(capture_params.frames, device->in_config->capture_length); i++) - capture_frame(i); -} - - - - - - - - -int VDeviceV4L::v4l1_get_inputs() -{ - struct video_channel channel_struct; - int i = 0, done = 0; - - while(!done && i < 20) - { - channel_struct.channel = i; - if(ioctl(input_fd, VIDIOCGCHAN, &channel_struct) < 0) - { -// Finished - done = 1; - } - else - { - Channel *channel = new Channel; - strcpy(channel->device_name, channel_struct.name); - device->input_sources.append(channel); - } - i++; - } - return 0; -} - -void VDeviceV4L::set_mute(int muted) -{ -// Open audio, which obviously is controlled by the video driver. -// and apparently resets the input source. - v4l1_set_mute(muted); -} - -int VDeviceV4L::v4l1_set_mute(int muted) -{ - struct video_audio audio; - - if(ioctl(input_fd, VIDIOCGAUDIO, &audio)) - if(ioctl(input_fd, VIDIOCGAUDIO, &audio) < 0) - perror("VDeviceV4L::ioctl VIDIOCGAUDIO"); - - audio.volume = 65535; - audio.bass = 65535; - audio.treble = 65535; - if(muted) - audio.flags |= VIDEO_AUDIO_MUTE | VIDEO_AUDIO_VOLUME; - else - audio.flags &= ~VIDEO_AUDIO_MUTE; - - if(ioctl(input_fd, VIDIOCSAUDIO, &audio) < 0) - perror("VDeviceV4L::ioctl VIDIOCSAUDIO"); - return 0; -} - - -int VDeviceV4L::set_cloexec_flag(int desc, int value) -{ - int oldflags = fcntl(desc, F_GETFD, 0); - if(oldflags < 0) return oldflags; - if(value != 0) - oldflags |= FD_CLOEXEC; - else - oldflags &= ~FD_CLOEXEC; - return fcntl(desc, F_SETFD, oldflags); -} - - - - - -int VDeviceV4L::get_best_colormodel(Asset *asset) -{ - int result = BC_RGB888; - -// Get best colormodel for hardware acceleration - - result = File::get_best_colormodel(asset, device->in_config->driver); - - -// Need to get color model before opening device but don't call this -// unless you want to open the device either. - if(!initialization_complete) - { - device_colormodel = translate_colormodel(result); - this->colormodel = result; - v4l_init(); - initialization_complete = 1; - } -// printf("VDeviceV4L::get_best_colormodel %c%c%c%c\n", -// ((char*)&device_colormodel)[0], -// ((char*)&device_colormodel)[1], -// ((char*)&device_colormodel)[2], -// ((char*)&device_colormodel)[3]); - return result; -} - -unsigned long VDeviceV4L::translate_colormodel(int colormodel) -{ - unsigned long result = 0; - switch(colormodel) - { - case BC_YUV422: result = VIDEO_PALETTE_YUV422; break; - case BC_YUV420P: result = VIDEO_PALETTE_YUV420P; break; - case BC_YUV422P: result = VIDEO_PALETTE_YUV422P; break; - case BC_YUV411P: result = VIDEO_PALETTE_YUV411P; break; - case BC_RGB888: result = VIDEO_PALETTE_RGB24; break; - default: result = VIDEO_PALETTE_RGB24; break; - } -//printf("VDeviceV4L::translate_colormodel %d\n", result); - return result; -} - -int VDeviceV4L::set_channel(Channel *channel) -{ - return v4l1_set_channel(channel); -} - -int VDeviceV4L::v4l1_set_channel(Channel *channel) -{ - struct video_channel channel_struct; - struct video_tuner tuner_struct; - unsigned long new_freq; - -// Mute changed the input to TV -// set_mute(1); - -//printf("VDeviceV4L::v4l1_set_channel 1 %d\n", channel->input); -// Read norm/input defaults - channel_struct.channel = channel->input; - if(ioctl(input_fd, VIDIOCGCHAN, &channel_struct) < 0) - perror("VDeviceV4L::v4l1_set_channel VIDIOCGCHAN"); - -// Set norm/input - channel_struct.channel = channel->input; - channel_struct.norm = v4l1_get_norm(channel->norm); - if(ioctl(input_fd, VIDIOCSCHAN, &channel_struct) < 0) - perror("VDeviceV4L::v4l1_set_channel VIDIOCSCHAN"); - - if(channel_struct.flags & VIDEO_VC_TUNER) - { -// Read tuner defaults - tuner_struct.tuner = channel->input; - if(ioctl(input_fd, VIDIOCGTUNER, &tuner_struct) < 0) - perror("VDeviceV4L::v4l1_set_channel VIDIOCGTUNER"); - -// Set tuner - tuner_struct.mode = v4l1_get_norm(channel->norm); - if(ioctl(input_fd, VIDIOCSTUNER, &tuner_struct) < 0) - perror("VDeviceV4L::v4l1_set_channel VIDIOCSTUNER"); - - new_freq = chanlists[channel->freqtable].list[channel->entry].freq; - new_freq = (int)(new_freq * 0.016); - new_freq += channel->fine_tune; - - if(ioctl(input_fd, VIDIOCSFREQ, &new_freq) < 0) - perror("VDeviceV4L::v4l1_set_channel VIDIOCSFREQ"); - } -// set_mute(0); - return 0; -} - -int VDeviceV4L::v4l1_get_norm(int norm) -{ - switch(norm) - { - case NTSC: return VIDEO_MODE_NTSC; break; - case PAL: return VIDEO_MODE_PAL; break; - case SECAM: return VIDEO_MODE_SECAM; break; - } - return 0; -} - -int VDeviceV4L::set_picture(PictureConfig *picture) -{ - v4l1_set_picture(picture); - return 0; -} - - -int VDeviceV4L::v4l1_set_picture(PictureConfig *picture) -{ - int brightness = (int)((float)picture->brightness / 100 * 32767 + 32768); - int hue = (int)((float)picture->hue / 100 * 32767 + 32768); - int color = (int)((float)picture->color / 100 * 32767 + 32768); - int contrast = (int)((float)picture->contrast / 100 * 32767 + 32768); - int whiteness = (int)((float)picture->whiteness / 100 * 32767 + 32768); - - if(ioctl(input_fd, VIDIOCGPICT, &picture_params) < 0) - perror("VDeviceV4L::v4l1_set_picture VIDIOCGPICT"); - picture_params.brightness = brightness; - picture_params.hue = hue; - picture_params.colour = color; - picture_params.contrast = contrast; - picture_params.whiteness = whiteness; -// Bogus. Values are only set in the capture routine. - picture_params.depth = 3; - picture_params.palette = device_colormodel; - if(ioctl(input_fd, VIDIOCSPICT, &picture_params) < 0) - perror("VDeviceV4L::v4l1_set_picture VIDIOCSPICT"); - if(ioctl(input_fd, VIDIOCGPICT, &picture_params) < 0) - perror("VDeviceV4L::v4l1_set_picture VIDIOCGPICT"); - return 0; -} - - -int VDeviceV4L::capture_frame(int capture_frame_number) -{ - struct video_mmap params; - params.frame = capture_frame_number; - params.width = device->in_config->w; - params.height = device->in_config->h; -// Required to actually set the palette. - params.format = device_colormodel; -// Tells the driver the buffer is available for writing - if(ioctl(input_fd, VIDIOCMCAPTURE, ¶ms) < 0) - perror("VDeviceV4L::capture_frame VIDIOCMCAPTURE"); - return 0; -} - -int VDeviceV4L::wait_v4l_frame() -{ -//printf("VDeviceV4L::wait_v4l_frame 1 %d\n", capture_frame_number); - if(ioctl(input_fd, VIDIOCSYNC, &capture_frame_number)) - perror("VDeviceV4L::wait_v4l_frame VIDIOCSYNC"); -//printf("VDeviceV4L::wait_v4l_frame 2 %d\n", capture_frame_number); - return 0; -} - -int VDeviceV4L::read_v4l_frame(VFrame *frame) -{ - frame_to_vframe(frame, (unsigned char*)capture_buffer + capture_params.offsets[capture_frame_number]); - return 0; -} - -#ifndef MIN -#define MIN(x, y) ((x) < (y) ? (x) : (y)) -#endif - -int VDeviceV4L::frame_to_vframe(VFrame *frame, unsigned char *input) -{ - int inwidth, inheight; - int width, height; - - inwidth = window_params.width; - inheight = window_params.height; - - width = MIN(inwidth, frame->get_w()); - height = MIN(inheight, frame->get_h()); -//printf("VDeviceV4L::frame_to_vframe %d %d\n", colormodel, frame->get_color_model()); - - if(frame->get_color_model() == colormodel) - { - switch(frame->get_color_model()) - { - case BC_RGB888: - { - unsigned char *row_in; - unsigned char *row_out_start, *row_out_end; - int bytes_per_inrow = inwidth * 3; - int bytes_per_outrow = frame->get_bytes_per_line(); - unsigned char **rows_out = frame->get_rows(); - - for(int i = 0; i < frame->get_h(); i++) - { - row_in = input + bytes_per_inrow * i; - row_out_start = rows_out[i]; - row_out_end = row_out_start + - MIN(bytes_per_outrow, bytes_per_inrow); - - while(row_out_start < row_out_end) - { - *row_out_start++ = row_in[2]; - *row_out_start++ = row_in[1]; - *row_out_start++ = row_in[0]; - row_in += 3; - } - } - break; - } - - case BC_YUV420P: - case BC_YUV411P: - memcpy(frame->get_y(), input, width * height); - memcpy(frame->get_u(), input + width * height, width * height / 4); - memcpy(frame->get_v(), input + width * height + width * height / 4, width * height / 4); - break; - - case BC_YUV422P: - memcpy(frame->get_y(), input, width * height); - memcpy(frame->get_u(), input + width * height, width * height / 2); - memcpy(frame->get_v(), input + width * height + width * height / 2, width * height / 2); - break; - - case BC_YUV422: - memcpy(frame->get_data(), - input, - VFrame::calculate_data_size(width, - height, - -1, - frame->get_color_model())); - break; - } - } - else - { - VFrame *in_frame = new VFrame(input, - -1, - inwidth, - inheight, - colormodel, - -1); - BC_CModels::transfer(frame->get_rows(), - in_frame->get_rows(), - frame->get_y(), - frame->get_u(), - frame->get_v(), - in_frame->get_y(), - in_frame->get_u(), - in_frame->get_v(), - 0, - 0, - inwidth, - inheight, - 0, - 0, - frame->get_w(), - frame->get_h(), - colormodel, - frame->get_color_model(), - 0, - inwidth, - inheight); - } - return 0; -} - - - -int VDeviceV4L::next_frame(int previous_frame) -{ - int result = previous_frame + 1; - - if(result >= MIN(capture_params.frames, device->in_config->capture_length)) result = 0; - return result; -} - -int VDeviceV4L::read_buffer(VFrame *frame) -{ -SET_TRACE - if(shared_memory) - { -// Read the current frame - if(!got_first_frame) v4l1_start_capture(); - wait_v4l_frame(); - read_v4l_frame(frame); -// Free this frame up for capturing - capture_frame(capture_frame_number); -// Advance the frame to capture. - capture_frame_number = next_frame(capture_frame_number); - } - else - { - read(input_fd, capture_buffer, capture_params.size); - } - - got_first_frame = 1; -SET_TRACE - return 0; -} - - - - -#endif // HAVE_VIDEO4LINUX - - - - - - diff --git a/cinelerra-5.1/cinelerra/vdevicev4l.h b/cinelerra-5.1/cinelerra/vdevicev4l.h deleted file mode 100644 index 3b969cb3..00000000 --- a/cinelerra-5.1/cinelerra/vdevicev4l.h +++ /dev/null @@ -1,94 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICEV4L_H -#define VDEVICEV4L_H - -#ifdef HAVE_VIDEO4LINUX - - - -#include "vdevicebase.h" -#include -#include "videodevice.inc" - -class VDeviceV4L : public VDeviceBase -{ -public: - VDeviceV4L(VideoDevice *device); - ~VDeviceV4L(); - - int initialize(); - int open_input(); - int close_all(); - int read_buffer(VFrame *frame); - int get_best_colormodel(Asset *asset); - int set_channel(Channel *channel); - int set_picture(PictureConfig *picture); - -private: - int set_cloexec_flag(int desc, int value); - int set_mute(int muted); - int v4l1_get_inputs(); - int v4l1_set_mute(int muted); - unsigned long translate_colormodel(int colormodel); - int v4l1_set_channel(Channel *channel); - int v4l1_get_norm(int norm); - int v4l1_set_picture(PictureConfig *picture); - void v4l1_start_capture(); - int capture_frame(int capture_frame_number); - int wait_v4l_frame(); - int read_v4l_frame(VFrame *frame); - int frame_to_vframe(VFrame *frame, unsigned char *input); - int next_frame(int previous_frame); - int close_v4l(); - int unmap_v4l_shmem(); - int v4l_init(); - - int input_fd, output_fd; -// FourCC Colormodel for device - unsigned long device_colormodel; -// BC colormodel for device - int colormodel; - -// Video4Linux - struct video_capability cap1; - struct video_window window_params; - struct video_picture picture_params; - struct video_mbuf capture_params; // Capture for Video4Linux - -// Common - char *capture_buffer; // sequentual capture buffers for v4l1 or read buffer for v4l2 - int capture_frame_number; // number of frame to capture into - int read_frame_number; // number of the captured frame to read - int shared_memory; // Capturing directly to memory - int initialization_complete; - int got_first_frame; -}; - - -#endif // HAVE_VIDEO4LINUX - - -#endif - - - diff --git a/cinelerra-5.1/cinelerra/vdevicev4l.inc b/cinelerra-5.1/cinelerra/vdevicev4l.inc deleted file mode 100644 index 8cc173dc..00000000 --- a/cinelerra-5.1/cinelerra/vdevicev4l.inc +++ /dev/null @@ -1,27 +0,0 @@ - -/* - * CINELERRA - * Copyright (C) 2008 Adam Williams - * - * 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 - * - */ - -#ifndef VDEVICEV4L_INC -#define VDEVICEV4L_INC - -class VDeviceV4L; - -#endif diff --git a/cinelerra-5.1/cinelerra/videoconfig.C b/cinelerra-5.1/cinelerra/videoconfig.C index 7da8fca4..edb39aa8 100644 --- a/cinelerra-5.1/cinelerra/videoconfig.C +++ b/cinelerra-5.1/cinelerra/videoconfig.C @@ -38,8 +38,6 @@ VideoConfig& VideoConfig::operator=(VideoConfig &that) { // Input video_in_driver = that.video_in_driver; - strcpy(v4l_in_device, that.v4l_in_device); - strcpy(lml_in_device, that.lml_in_device); strcpy(screencapture_display, that.screencapture_display); vfirewire_in_port = that.vfirewire_in_port; vfirewire_in_channel = that.vfirewire_in_channel; @@ -47,18 +45,14 @@ VideoConfig& VideoConfig::operator=(VideoConfig &that) // Output video_out_driver = that.video_out_driver; - strcpy(lml_out_device, that.lml_out_device); CLAMP(capture_length, 1, 1000); return *this; } int VideoConfig::load_defaults(BC_Hash *defaults) { - video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX); - sprintf(v4l_in_device, "/dev/video"); - defaults->get("V4L_IN_DEVICE", v4l_in_device); - sprintf(lml_in_device, "/dev/mvideo/stream"); - defaults->get("LML_IN_DEVICE", lml_in_device); + video_in_driver = defaults->get("VIDEO_IN_DRIVER", VIDEO4LINUX2); + sprintf(v4l2_in_device, "/dev/video"); sprintf(screencapture_display, ""); defaults->get("SCREENCAPTURE_DISPLAY", screencapture_display); vfirewire_in_port = defaults->get("VFIREWIRE_IN_PORT", 0); @@ -66,21 +60,16 @@ int VideoConfig::load_defaults(BC_Hash *defaults) capture_length = defaults->get("VIDEO_CAPTURE_LENGTH", 30); video_out_driver = defaults->get("VIDEO_OUT_DRIVER", PLAYBACK_X11); - sprintf(lml_out_device, "/dev/mvideo/stream"); - defaults->get("LML_OUT_DEVICE", lml_out_device); return 0; } int VideoConfig::save_defaults(BC_Hash *defaults) { defaults->update("VIDEO_IN_DRIVER", video_in_driver); - defaults->update("V4L_IN_DEVICE", v4l_in_device); - defaults->update("LML_IN_DEVICE", lml_in_device); defaults->update("SCREENCAPTURE_DISPLAY", screencapture_display); defaults->update("VFIREWIRE_IN_PORT", vfirewire_in_port); defaults->update("VFIREWIRE_IN_CHANNEL", vfirewire_in_channel); defaults->update("VIDEO_CAPTURE_LENGTH", capture_length); defaults->update("VIDEO_OUT_DRIVER", video_out_driver); - defaults->update("LML_OUT_DEVICE", lml_out_device); } diff --git a/cinelerra-5.1/cinelerra/videoconfig.h b/cinelerra-5.1/cinelerra/videoconfig.h index ae452d7b..be4895a9 100644 --- a/cinelerra-5.1/cinelerra/videoconfig.h +++ b/cinelerra-5.1/cinelerra/videoconfig.h @@ -43,8 +43,6 @@ public: // Input int video_in_driver; - char v4l_in_device[1024]; - char lml_in_device[1024]; char screencapture_display[1024]; int vfirewire_in_port, vfirewire_in_channel; // number of frames to read from device during video recording. @@ -52,7 +50,6 @@ public: // Output int video_out_driver; - char lml_out_device[1024]; }; #endif diff --git a/cinelerra-5.1/cinelerra/videodevice.C b/cinelerra-5.1/cinelerra/videodevice.C index 8f9f6bbd..d38eaa67 100644 --- a/cinelerra-5.1/cinelerra/videodevice.C +++ b/cinelerra-5.1/cinelerra/videodevice.C @@ -46,9 +46,7 @@ #ifdef HAVE_FIREWIRE #include "vdevice1394.h" #endif -#include "vdevicebuz.h" #include "vdevicedvb.h" -#include "vdevicev4l.h" #include "vdevicev4l2.h" #include "vdevicev4l2jpeg.h" #include "vdevicev4l2mpeg.h" @@ -211,12 +209,6 @@ int VideoDevice::open_input(VideoInConfig *config, if( input_base ) return 1; // device already open switch(in_config->driver) { - case VIDEO4LINUX: - keepalive = new KeepaliveThread(this); - keepalive->start_keepalive(); - break; - - #ifdef HAVE_VIDEO4LINUX2 case VIDEO4LINUX2: @@ -232,12 +224,6 @@ int VideoDevice::open_input(VideoInConfig *config, this->input_x = input_x; this->input_y = input_y; break; - case CAPTURE_LML: - case CAPTURE_BUZ: -//printf("VideoDevice 1\n"); - keepalive = new KeepaliveThread(this); - keepalive->start_keepalive(); - break; #ifdef HAVE_FIREWIRE case CAPTURE_FIREWIRE: case CAPTURE_IEC61883: @@ -264,11 +250,6 @@ int VideoDevice::open_input(VideoInConfig *config, VDeviceBase* VideoDevice::new_device_base() { switch(in_config->driver) { -#ifdef HAVE_VIDEO4LINUX - case VIDEO4LINUX: - return input_base = new VDeviceV4L(this); -#endif - #ifdef HAVE_VIDEO4LINUX2 case VIDEO4LINUX2: case CAPTURE_JPEG_WEBCAM: @@ -283,13 +264,6 @@ VDeviceBase* VideoDevice::new_device_base() case SCREENCAPTURE: return input_base = new VDeviceX11(this, 0); -#ifdef HAVE_VIDEO4LINUX - case CAPTURE_BUZ: - return input_base = new VDeviceBUZ(this); - case CAPTURE_LML: - return input_base = new VDeviceLML(this); -#endif - #ifdef HAVE_FIREWIRE case CAPTURE_FIREWIRE: case CAPTURE_IEC61883: @@ -309,9 +283,6 @@ static const char* get_channeldb_path(VideoInConfig *vconfig_in) char *path = 0; switch(vconfig_in->driver) { - case VIDEO4LINUX: - path = (char*)"channels_v4l"; - break; case VIDEO4LINUX2: case CAPTURE_JPEG_WEBCAM: case CAPTURE_YUYV_WEBCAM: @@ -323,9 +294,6 @@ static const char* get_channeldb_path(VideoInConfig *vconfig_in) case VIDEO4LINUX2MPEG: path = (char*)"channels_v4l2mpeg"; break; - case CAPTURE_BUZ: - path = (char*)"channels_buz"; - break; case CAPTURE_DVB: path = (char*)"channels_dvb"; break; @@ -362,10 +330,8 @@ DeviceMPEGInput *VideoDevice::mpeg_device() int VideoDevice::is_compressed(int driver, int use_file, int use_fixed) { // FileMOV needs to have write_frames called so the start codes get scanned. - return ((driver == CAPTURE_BUZ && use_fixed) || - (driver == VIDEO4LINUX2JPEG && use_fixed) || + return ((driver == VIDEO4LINUX2JPEG && use_fixed) || (driver == CAPTURE_JPEG_WEBCAM && use_fixed) || - driver == CAPTURE_LML || driver == CAPTURE_FIREWIRE || driver == CAPTURE_IEC61883); } @@ -386,8 +352,6 @@ void VideoDevice::fix_asset(Asset *asset, int driver) vcodec = CODEC_TAG_DVSD; break; - case CAPTURE_BUZ: - case CAPTURE_LML: case VIDEO4LINUX2JPEG: vcodec = CODEC_TAG_MJPEG; break; @@ -417,16 +381,12 @@ const char* VideoDevice::drivertostr(int driver) case PLAYBACK_X11: return PLAYBACK_X11_TITLE; case PLAYBACK_X11_XV: return PLAYBACK_X11_XV_TITLE; case PLAYBACK_X11_GL: return PLAYBACK_X11_GL_TITLE; - case PLAYBACK_BUZ: return PLAYBACK_BUZ_TITLE; - case VIDEO4LINUX: return VIDEO4LINUX_TITLE; case VIDEO4LINUX2: return VIDEO4LINUX2_TITLE; case VIDEO4LINUX2JPEG: return VIDEO4LINUX2JPEG_TITLE; case VIDEO4LINUX2MPEG: return VIDEO4LINUX2MPEG_TITLE; case CAPTURE_JPEG_WEBCAM: return CAPTURE_JPEG_WEBCAM_TITLE; case CAPTURE_YUYV_WEBCAM: return CAPTURE_YUYV_WEBCAM_TITLE; case SCREENCAPTURE: return SCREENCAPTURE_TITLE; - case CAPTURE_BUZ: return CAPTURE_BUZ_TITLE; - case CAPTURE_LML: return CAPTURE_LML_TITLE; case CAPTURE_DVB: return CAPTURE_DVB_TITLE; #ifdef HAVE_FIREWIRE case CAPTURE_FIREWIRE: return CAPTURE_FIREWIRE_TITLE; @@ -586,8 +546,7 @@ int VideoDevice::update_translation() if(frame_resized) { input_x = new_input_x; input_y = new_input_y; - if( in_config->driver == VIDEO4LINUX || - in_config->driver == VIDEO4LINUX2 ) { + if( in_config->driver == VIDEO4LINUX2 ) { if(input_z != new_input_z) { input_z = new_input_z; //z_changed = 1; @@ -691,14 +650,6 @@ int VideoDevice::open_output(VideoOutConfig *config, float rate, //printf("VideoDevice::open_output 1 %d\n", out_config->driver); switch(out_config->driver) { -#ifdef HAVE_VIDEO4LINUX - case PLAYBACK_BUZ: - output_base = new VDeviceBUZ(this); - break; - case PLAYBACK_LML: - output_base = new VDeviceLML(this); - break; -#endif case PLAYBACK_X11: case PLAYBACK_X11_XV: case PLAYBACK_X11_GL: diff --git a/cinelerra-5.1/cinelerra/videodevice.h b/cinelerra-5.1/cinelerra/videodevice.h index 57264d3d..dcdb11fe 100644 --- a/cinelerra-5.1/cinelerra/videodevice.h +++ b/cinelerra-5.1/cinelerra/videodevice.h @@ -42,9 +42,6 @@ #include "thread.h" #include "picture.inc" #include "vdevicebase.inc" -#include "vdevicebuz.inc" -#include "vdevicelml.inc" -#include "vdevicev4l.inc" #include "vdevicex11.inc" #include "videoconfig.inc" #include "videowindow.inc" diff --git a/cinelerra-5.1/cinelerra/videodevice.inc b/cinelerra-5.1/cinelerra/videodevice.inc index 8c612a1c..75674215 100644 --- a/cinelerra-5.1/cinelerra/videodevice.inc +++ b/cinelerra-5.1/cinelerra/videodevice.inc @@ -25,26 +25,22 @@ class VideoDevice; // Flags for mainwindow->preferences->vconfig_in->driver -#define VIDEO4LINUX 0 +#define DEV_UNKNOWN 0 #define VIDEO4LINUX2 1 #define VIDEO4LINUX2JPEG 2 #define VIDEO4LINUX2MPEG 3 #define SCREENCAPTURE 4 -#define CAPTURE_LML 5 #define CAPTURE_FIREWIRE 6 -#define CAPTURE_BUZ 7 #define CAPTURE_IEC61883 8 #define CAPTURE_DVB 9 #define CAPTURE_JPEG_WEBCAM 20 #define CAPTURE_YUYV_WEBCAM 21 -#define VIDEO4LINUX_TITLE "Video4Linux" +#define DEV_UNKNOWN_TITLE "Device Unknown" #define VIDEO4LINUX2_TITLE "Video4Linux2" #define VIDEO4LINUX2JPEG_TITLE "Video4Linux2 JPEG" #define VIDEO4LINUX2MPEG_TITLE "Video4Linux2 MPEG" #define SCREENCAPTURE_TITLE "Screencapture" -#define CAPTURE_LML_TITLE "LML 33" -#define CAPTURE_BUZ_TITLE "Buz" #define CAPTURE_FIREWIRE_TITLE "DV 1394" #define CAPTURE_IEC61883_TITLE "IEC 61883" #define CAPTURE_DVB_TITLE "DVB" @@ -55,8 +51,6 @@ class VideoDevice; #define PLAYBACK_X11 10 #define PLAYBACK_X11_XV 14 #define PLAYBACK_X11_GL 17 -#define PLAYBACK_BUZ 11 -#define PLAYBACK_LML 12 #define PLAYBACK_FIREWIRE 13 #define PLAYBACK_DV1394 15 #define PLAYBACK_IEC61883 16 @@ -67,8 +61,6 @@ class VideoDevice; #define PLAYBACK_X11_TITLE "X11" #define PLAYBACK_X11_XV_TITLE "X11-XV" #define PLAYBACK_X11_GL_TITLE "X11-OpenGL" -#define PLAYBACK_BUZ_TITLE "Buz" -#define PLAYBACK_LML_TITLE "LML 33" #define PLAYBACK_FIREWIRE_TITLE "RAW 1394" #define PLAYBACK_DV1394_TITLE "DV 1394" #define PLAYBACK_IEC61883_TITLE "IEC 61883" diff --git a/cinelerra-5.1/cinelerra/vmodule.C b/cinelerra-5.1/cinelerra/vmodule.C index d9e1cbc9..93d6f4d9 100644 --- a/cinelerra-5.1/cinelerra/vmodule.C +++ b/cinelerra-5.1/cinelerra/vmodule.C @@ -233,11 +233,7 @@ int VModule::import_frame(VFrame *output, nested_command->get_edl()->copy_all(nested_edl); nested_command->change_type = CHANGE_ALL; nested_command->realtime = renderengine->command->realtime; - nested_renderengine = new RenderEngine(0, - get_preferences(), - 0, - renderengine ? renderengine->channeldb : 0, - 1); + nested_renderengine = new RenderEngine(0, get_preferences(), 0, 1); nested_renderengine->set_vcache(get_cache()); nested_renderengine->arm_command(nested_command); } @@ -453,7 +449,7 @@ int VModule::import_frame(VFrame *output, // current_edit->asset->interlace_fixmethod); // Determine the interlacing method to use. - int interlace_fixmethod = !current_edit->asset ? BC_ILACE_FIXMETHOD_NONE : + int interlace_fixmethod = !current_edit->asset ? ILACE_FIXMETHOD_NONE : ilaceautofixmethod2(get_edl()->session->interlace_mode, current_edit->asset->interlace_autofixoption, current_edit->asset->interlace_mode, @@ -465,13 +461,13 @@ int VModule::import_frame(VFrame *output, // Compensate for the said interlacing... switch (interlace_fixmethod) { - case BC_ILACE_FIXMETHOD_NONE: + case ILACE_FIXMETHOD_NONE: break; - case BC_ILACE_FIXMETHOD_UPONE: + case ILACE_FIXMETHOD_UPONE: out_y--; break; - case BC_ILACE_FIXMETHOD_DOWNONE: + case ILACE_FIXMETHOD_DOWNONE: out_y++; break; default: diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C index 1d4c46fb..dca01ad3 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.C +++ b/cinelerra-5.1/cinelerra/vpatchgui.C @@ -363,7 +363,7 @@ void VModePatch::create_objects() submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_AND), TRANSFER_AND)); submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_OR), TRANSFER_OR)); submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_XOR), TRANSFER_XOR)); - add_item(mode_item = new VModePatchItem(this, _("graphic art..."), -1)); + add_item(mode_item = new VModePatchItem(this, _("Graphic Art..."), -1)); mode_item->add_submenu(submenu = new VModePatchSubMenu(mode_item)); submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_OVERLAY), TRANSFER_OVERLAY)); submenu->add_submenuitem(new VModeSubMenuItem(submenu, mode_to_text(TRANSFER_SCREEN), TRANSFER_SCREEN)); @@ -415,9 +415,9 @@ const char* VModePatch::mode_to_text(int mode) case TRANSFER_SRC_IN: return _("SrcIn"); case TRANSFER_SRC_OUT: return _("SrcOut"); case TRANSFER_SRC_OVER: return _("SrcOver"); - case TRANSFER_AND: return _("And"); - case TRANSFER_OR: return _("Or"); - case TRANSFER_XOR: return _("Xor"); + case TRANSFER_AND: return _("AND"); + case TRANSFER_OR: return _("OR"); + case TRANSFER_XOR: return _("XOR"); case TRANSFER_OVERLAY: return _("Overlay"); case TRANSFER_SCREEN: return _("Screen"); case TRANSFER_BURN: return _("Burn"); diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index d65fd597..428a7b23 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -284,43 +284,6 @@ void VWindow::change_source(EDL *edl) gui->change_source(edl, _("Viewer")); } -void VWindow::change_source(char *folder, int item) -{ -//printf("VWindow::change_source %d\n", __LINE__); - int result = 0; - if(!running()) return; -// Search EDLs - if(!strcasecmp(folder, CLIP_FOLDER)) - { - if(item < mwindow->edl->clips.total) - { - change_source(mwindow->edl->clips.values[item]); - result = 1; - } - } - else -// Search media - if(!strcasecmp(folder, MEDIA_FOLDER)) - { - if(item < mwindow->edl->assets->total()) - { - change_source(mwindow->edl->assets->get_item_number(item)); - result = 1; - } - } - else -// Search extra clip folders - { - } - - if(!result) - { - delete_source(1, 1); - } -} - - - void VWindow::goto_start() { diff --git a/cinelerra-5.1/cinelerra/vwindow.h b/cinelerra-5.1/cinelerra/vwindow.h index e75d941f..3e216bcb 100644 --- a/cinelerra-5.1/cinelerra/vwindow.h +++ b/cinelerra-5.1/cinelerra/vwindow.h @@ -51,8 +51,6 @@ public: void change_source(EDL *edl); // Change source to 1 of master EDL's vwindow EDLs after a load. void change_source(int number); -// Change source to folder and item number - void change_source(char *folder, int item); // Returns private EDL of VWindow // If an asset is dropped in, a new VWindow EDL is created in the master EDL // and this points to it. diff --git a/cinelerra-5.1/guicast/bccmdl.py b/cinelerra-5.1/guicast/bccmdl.py index a8d8d0a7..069cbe70 100755 --- a/cinelerra-5.1/guicast/bccmdl.py +++ b/cinelerra-5.1/guicast/bccmdl.py @@ -181,12 +181,12 @@ base = { "yuyv8888": { "i8": { - "r": " int32_t iy = inp[(i&1)<<1], y = iy*0x010101u, u = inp[1], v = inp[3];", + "r": " int32_t iy = inp[(j&1)<<1], y = iy*0x010101u, u = inp[1], v = inp[3];", "w": " if( !(j&1) ) { *out++ = y; *out = u; out[2] = v; }\n" + " else { *out++ = u; *out++= y; *out++ = v; }", }, "i16": { - "r": " int32_t iy = inp[(i&1)<<1], y = iy*0x010101u, u = inp[1]<<8, v = inp[3]<<8;", + "r": " int32_t iy = inp[(j&1)<<1], y = iy*0x010101u, u = inp[1]<<8, v = inp[3]<<8;", "w": " if( !(j&1) ) { *out++ = y>>8; *out = u>>8; out[2] = v>>8; }\n" + " else { *out++ = u>>8; *out++= y>>8; *out++ = v>>8; }", }, @@ -194,12 +194,12 @@ base = { "uyvy8888": { "i8": { - "r": " int32_t u = inp[0], iy = inp[((i&1)<<1)+1], y = iy*0x010101u, v = inp[2];", + "r": " int32_t u = inp[0], iy = inp[((j&1)<<1)+1], y = iy*0x010101u, v = inp[2];", "w": " if( !(j&1) ) { *out++ = u; *out++ = y; *out++ = v; *out = y; }\n" + " else { *out++= y; }", }, "i16": { - "r": " int32_t u = inp[0]<<8, iy = inp[((i&1)<<1)+1], y = iy*0x010101u, v = inp[2]<<8;", + "r": " int32_t u = inp[0]<<8, iy = inp[((j&1)<<1)+1], y = iy*0x010101u, v = inp[2]<<8;", "w": " if( !(j&1) ) { *out++ = u>>8; *out++ = y>>8; *out++ = v>>8; *out = y>>8; }\n" + " else { *out++= y>>8; }", }, @@ -440,8 +440,8 @@ add_cmodel(14, "bc_yuva8888", "i8", "yuv888", "a8") add_cmodel(15, "bc_yuv161616", "i16", "yuv161616") add_cmodel(16, "bc_yuva16161616", "i16", "yuv161616", "a16") -add_cmodel(18, "bc_yuv422", "i8", "yuyv8888") -add_cmodel(19, "bc_uvy422", "i8", "uyvy8888") +add_cmodel(18, "bc_uvy422", "i8", "uyvy8888") +add_cmodel(19, "bc_yuv422", "i8", "yuyv8888") add_cmodel(22, "bc_a8") add_cmodel(23, "bc_a16") add_cmodel(31, "bc_a_float") diff --git a/cinelerra-5.1/plugin_defs b/cinelerra-5.1/plugin_defs index 848f5816..3dbe03f1 100644 --- a/cinelerra-5.1/plugin_defs +++ b/cinelerra-5.1/plugin_defs @@ -1,6 +1,8 @@ export TOPDIR ?= ../.. include $(TOPDIR)/global_config +# plugin_dirs is translated in awindowgui.C, update if changed. + plugin_dirs := themes themes := theme_bright theme_suv theme_blond theme_blue theme_blue_dot \ theme_hulk theme_pinklady theme_unflat theme_blond_cv diff --git a/cinelerra-5.1/plugins/livevideo/livevideo.C b/cinelerra-5.1/plugins/livevideo/livevideo.C index c675acf5..e941f7ac 100644 --- a/cinelerra-5.1/plugins/livevideo/livevideo.C +++ b/cinelerra-5.1/plugins/livevideo/livevideo.C @@ -402,7 +402,6 @@ int LiveVideo::process_buffer(VFrame *frame, { case CAPTURE_FIREWIRE: case CAPTURE_IEC61883: - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: case CAPTURE_JPEG_WEBCAM: input_cmodel = BC_COMPRESSED; @@ -514,7 +513,6 @@ int LiveVideo::process_buffer(VFrame *frame, frame->set_opengl_state(VFrame::RAM); break; - case CAPTURE_BUZ: case VIDEO4LINUX2JPEG: if(!mjpeg) mjpeg = mjpeg_new(frame->get_w(), -- 2.26.2