X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Frecord.C;h=50cfb74136e5107ec9f8604838e85b4890bb05ce;hb=e94d765d190f22937e955f0e6ff9b70d167786f8;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..50cfb741 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" @@ -163,7 +163,7 @@ Record::Record(MWindow *mwindow, RecordMenuItem *menu_item) Record::~Record() { mwindow->gui->record = 0; - stop(); join(); + stop(); delete blink_status; delete cutads_status; stop_skimming(); @@ -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; @@ -373,7 +369,7 @@ void Record::run() if( channel ) video_stream = channel->video_stream; } - stop(); + stop(0); edl->Garbage::remove_user(); if( mwindow->gui->remote_control->deactivate() ) @@ -437,9 +433,12 @@ void Record::run() default_asset->Garbage::remove_user(); } -void Record::stop() +void Record::stop(int wait) { stop_operation(); + if( wait && running() ) + record_gui->set_done(1); + join(); window_lock->lock("Record::stop"); delete record_thread; record_thread = 0; delete record_monitor; record_monitor = 0; @@ -592,7 +591,6 @@ void Record::start() window_lock->unlock(); } else { - stop(); join(); init_lock->reset(); Thread::start(); } @@ -742,8 +740,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 +967,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); } @@ -1072,7 +1070,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); @@ -1528,7 +1526,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 : @@ -1912,11 +1910,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;