X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Frecord.C;h=96ec0f8236284bd5a88f6fa504dd728d3e6ec89d;hb=875ae826327bf25abdaffe1db339aabd622addc8;hp=45e6b3d36e7fa5237e0f5d6960ad1f7e77368702;hpb=235c9cc4df8306babbbfda46189108fe262d44ef;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/record.C b/cinelerra-5.1/cinelerra/record.C index 45e6b3d3..96ec0f82 100644 --- a/cinelerra-5.1/cinelerra/record.C +++ b/cinelerra-5.1/cinelerra/record.C @@ -1,21 +1,21 @@ /* * CINELERRA * Copyright (C) 2009-2013 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 "asset.h" @@ -155,19 +155,23 @@ Record::Record(MWindow *mwindow, RecordMenuItem *menu_item) adevice_lock = new Mutex("Record::adevice_lock"); vdevice_lock = new Mutex("Record::vdevice_lock"); batch_lock = new Mutex("Record::batch_lock"); +#ifdef HAVE_COMMERCIAL skim_thread = new SkimDbThread(); cutads_status = new RecordCutAdsStatus(this); blink_status = new RecordBlinkStatus(this); +#endif } Record::~Record() { mwindow->gui->record = 0; - stop(); join(); + stop(); +#ifdef HAVE_COMMERCIAL delete blink_status; delete cutads_status; stop_skimming(); delete skim_thread; +#endif delete deletions; delete picture; delete channeldb; @@ -202,10 +206,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; @@ -234,6 +234,8 @@ int Record::load_defaults() video_zoom = defaults->get("RECORD_VIDEO_Z", (float)1); picture->load_defaults(); reverse_interlace = defaults->get("REVERSE_INTERLACE", 0); + do_cursor = defaults->get("RECORD_CURSOR", 0); + do_big_cursor = defaults->get("RECORD_BIG_CURSOR", 0); for( int i=0; iget(string, 0); @@ -270,6 +272,8 @@ int Record::save_defaults() defaults->update("RECORD_VIDEO_Z", video_zoom); picture->save_defaults(); defaults->update("REVERSE_INTERLACE", reverse_interlace); + defaults->update("RECORD_CURSOR", do_cursor); + defaults->update("RECORD_BIG_CURSOR", do_big_cursor); for( int i=0; iupdate(string, dc_offset[i]); @@ -366,14 +370,18 @@ void Record::run() // Need to stop everything this time - stop_commercial_capture(0); int video_stream = -1; +#ifdef HAVE_COMMERCIAL + stop_commercial_capture(0); +#endif +#ifdef HAVE_LIBZMPEG if( default_asset->format == FILE_MPEG ) { Channel *channel = get_current_channel(); if( channel ) video_stream = channel->video_stream; } - stop(); +#endif + stop(0); edl->Garbage::remove_user(); if( mwindow->gui->remote_control->deactivate() ) @@ -406,8 +414,9 @@ void Record::run() // For pasting, clear the active region if(load_mode == LOADMODE_PASTE) mwindow->clear(0); - - mwindow->paste_edls(&new_edls, load_mode, 0, -1, + int loadmode = load_mode == LOADMODE_RESOURCESONLY ? + LOADMODE_ASSETSONLY : load_mode; + mwindow->paste_edls(&new_edls, loadmode, 0, -1, SESSION->labels_follow_edits, SESSION->plugins_follow_edits, SESSION->autos_follow_edits, @@ -437,9 +446,13 @@ void Record::run() default_asset->Garbage::remove_user(); } -void Record::stop() +void Record::stop(int wait) { stop_operation(); + if( record_gui ) + record_gui->set_done(1); + if( wait ) + join(); window_lock->lock("Record::stop"); delete record_thread; record_thread = 0; delete record_monitor; record_monitor = 0; @@ -592,7 +605,6 @@ void Record::start() window_lock->unlock(); } else { - stop(); join(); init_lock->reset(); Thread::start(); } @@ -698,8 +710,7 @@ const char* Record::current_mode() double Record::current_display_position() { -//printf("Record::current_display_position " -// _LD " " _LD "\n", total_samples, total_frames) +//printf("Record::current_display_position "%jd %jd\n", total_samples, total_frames); double result = -1.; Asset *asset = default_asset; if( writing_file ) { @@ -742,8 +753,8 @@ Channel *Record::get_editing_channel() return batch ? batch->channel : 0; } -ArrayList* Record::get_video_inputs() -{ +ArrayList* Record::get_video_inputs() +{ return default_asset->video_data && vdevice ? vdevice->get_inputs() : 0; } @@ -969,11 +980,11 @@ void Record::open_audio_input() if( adevice ) { int sw_pos = SESSION->record_positioning == RECORD_POS_SOFTWARE; adevice->set_software_positioning(sw_pos); - adevice->open_input(SESSION->aconfig_in, SESSION->vconfig_in, + adevice->open_input(SESSION->aconfig_in, SESSION->vconfig_in, default_asset->sample_rate, get_fragment_samples(), default_asset->channels, SESSION->real_time_record); adevice->start_recording(); - adevice->open_monitor(SESSION->playback_config->aconfig,monitor_audio); + adevice->open_monitor(SESSION->playback_config->aconfig,monitor_audio); adevice->set_vdevice(vdevice); if( vdevice ) vdevice->set_adevice(adevice); } @@ -996,6 +1007,7 @@ void Record::open_video_input() master_channel->copy_usage(vdevice->channel); picture->copy_usage(vdevice->picture); vdevice->set_field_order(reverse_interlace); + vdevice->set_do_cursor(do_cursor, do_big_cursor); vdevice->set_adevice(adevice); if( adevice ) adevice->set_vdevice(vdevice); set_dev_channel(get_current_channel()); @@ -1072,7 +1084,7 @@ int Record::start_toc() Asset *asset = batch->asset; char source_filename[BCTEXTLEN], toc_path[BCTEXTLEN]; IndexFile::get_index_filename(source_filename, - mwindow->preferences->index_directory, + mwindow->preferences->index_directory, toc_path, asset->path,".toc"); if( default_asset->video_data ) return vdevice->start_toc(asset->path, toc_path); @@ -1096,8 +1108,8 @@ void Record::start_writing_file() if( !writing_file ) { written_frames = 0; written_samples = 0; - do_video = File::supports_video(default_asset->format); - do_audio = File::supports_audio(default_asset->format); + do_video = File::renders_video(default_asset); + do_audio = File::renders_audio(default_asset); if( single_frame ) do_audio = 0; if( !do_video && single_frame ) single_frame = 0; @@ -1208,11 +1220,15 @@ void Record::set_power_off(int value) record_gui->power_off->update(value); } -int Record::set_video_picture() +void Record::set_video_picture() { if( default_asset->video_data && vdevice ) vdevice->set_picture(picture); - return 0; +} + +void Record::set_do_cursor() +{ + vdevice->set_do_cursor(do_cursor, do_big_cursor); } void Record::set_translation(int x, int y) @@ -1454,7 +1470,7 @@ int Record::check_batch_complete() return result; } - +#ifdef HAVE_COMMERCIAL int Record::skimming(void *vp, int track) { return ((Record*)vp)->skimming(track); @@ -1497,6 +1513,14 @@ void Record::update_skimming(int v) stop_skimming(); } +#else +int Record::skimming(void *vp, int track) { return 1; } +int Record::skimming(int track) { return 1; } +void Record::start_skimming() {} +void Record::stop_skimming() {} +void Record::update_skimming(int v) {} +#endif + RecordRemoteHandler::RecordRemoteHandler(RemoteControl *remote_control) : RemoteHandler(remote_control->gui, GREEN) { @@ -1528,7 +1552,7 @@ display_cut_icon(int x, int y) #ifdef HAVE_DVB DeviceDVBInput *Record:: dvb_device() -{ +{ DeviceDVBInput *dvb_dev = !vdevice ? 0 : (DeviceDVBInput *)vdevice->mpeg_device(); if( !dvb_dev ) dvb_dev = !adevice ? 0 : @@ -1758,6 +1782,7 @@ int Record::remote_process_key(RemoteControl *remote_control, int key) break; //case UP: case DOWN: case LEFT: case RIGHT: //case KPPLAY: case KPBACK: case KPFORW: +#ifdef HAVE_COMMERCIAL case KPRECD: case 'c': // start capture, mark endpoint if( !deletions ) { start_commercial_capture(); @@ -1777,6 +1802,7 @@ int Record::remote_process_key(RemoteControl *remote_control, int key) case KPAUSE: case 'x': // ignore current commercial mark_commercial_capture(DEL_SKIP); break; +#endif case KPBACK: case 'a': // toggle mute audio if( !monitor_audio ) { set_mute_gain(1); set_play_gain(1); } set_audio_monitoring(monitor_audio ? 0 : 1); @@ -1784,9 +1810,11 @@ int Record::remote_process_key(RemoteControl *remote_control, int key) case 'm': // toggle metering audio set_audio_metering(metering_audio ? 0 : 1); break; +#ifdef HAVE_COMMERCIAL case KPPLAY: case 's': // ignore previous endpoint mark_commercial_capture(DEL_OOPS); break; +#endif case KPFWRD: case KPSLASH: display_channel_info(); break; @@ -1814,7 +1842,7 @@ int Record::remote_process_key(RemoteControl *remote_control, int key) return 1; } - +#ifdef HAVE_COMMERCIAL int Record::start_commercial_capture() { if( deletions != 0 ) return 1; @@ -1852,6 +1880,7 @@ int Record::mark_commercial_capture(int action) deletions->append(new Dele(time, action)); return 0; } +#endif void Record::remote_fill_color(int color) { @@ -1876,6 +1905,7 @@ void Record::set_play_gain(double gain) if( adevice ) adevice->set_play_gain(gain); } +#ifdef HAVE_COMMERCIAL int Record::stop_commercial_capture(int run_job) { if( deletions == 0 ) return 1; @@ -1912,11 +1942,12 @@ int Record::stop_commercial_capture(int run_job) int Record:: spawn(const char *fmt, ...) { - char exe_path[BCTEXTLEN], cmd[BCTEXTLEN]; - get_exe_path(exe_path); + const char *exec_path = File::get_cinlib_path(); + char cmd[BCTEXTLEN], *cp = cmd, *ep = cp+sizeof(cmd)-1; va_list ap; va_start(ap, fmt); - int n = snprintf(cmd, sizeof(cmd), "exec %s/", exe_path); - vsnprintf(cmd+n, sizeof(cmd)-n, fmt, ap); va_end(ap); + cp += snprintf(cp, ep-cp, "exec %s/", exec_path); + cp += vsnprintf(cp, ep-cp, fmt, ap); va_end(ap); + *cp = 0; pid_t pid = vfork(); if( pid < 0 ) return -1; if( pid > 0 ) return pid; @@ -2040,7 +2071,7 @@ run() usleep(500000); disable_cancel(); color ^= YELLOW ^ BLUE; - if( timer.get_difference() > 10*60*1000 ) { // 10 minites + if( timer.get_difference() > 10*60*1000 ) { // 10 minutes record->stop_commercial_capture(0); done = 1; } @@ -2048,3 +2079,4 @@ run() remote_color(record->status_color); } +#endif