remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / cinelerra / record.C
index 9a24b98129f0ee654160581366394f2473b7a85f..1c9f6ecd1376e80e6b14c54effa3f427ea982ce9 100644 (file)
@@ -1,21 +1,21 @@
 /*
  * CINELERRA
  * Copyright (C) 2009-2013 Adam Williams <broadcast at earthling dot net>
- * 
+ *
  * 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"
@@ -48,6 +48,7 @@
 #include "localsession.h"
 #include "libdv.h"
 #include "libmjpeg.h"
+#include "libzmpeg3.h"
 #include "mainmenu.h"
 #include "mainundo.h"
 #include "mwindow.h"
@@ -201,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;
@@ -741,8 +738,8 @@ Channel *Record::get_editing_channel()
        return batch ? batch->channel : 0;
 }
 
-ArrayList<Channel*>* Record::get_video_inputs() 
-{ 
+ArrayList<Channel*>* Record::get_video_inputs()
+{
        return default_asset->video_data && vdevice ? vdevice->get_inputs() : 0;
 }
 
@@ -864,7 +861,7 @@ void Record::resync()
        }
        else if( diff > 0. ) {
                int64_t delay = (int64_t)(1000.0 * diff);
-               dbmsg("  delay " _LDv(8), delay);
+               dbmsg("  delay %8jd", delay);
                if( delay > 500 ) {
                        video_time = audio_time = -1.;
                        delay = 500;
@@ -968,11 +965,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);
        }
@@ -1071,7 +1068,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);
@@ -1524,15 +1521,17 @@ display_cut_icon(int x, int y)
        display_vframe(cut_icon, x, y, 200, 1.0, scale);
 }
 
+#ifdef HAVE_DVB
 DeviceDVBInput *Record::
 dvb_device()
-{ 
+{
        DeviceDVBInput *dvb_dev = !vdevice ? 0 :
                (DeviceDVBInput *)vdevice->mpeg_device();
        if( !dvb_dev ) dvb_dev = !adevice ? 0 :
                (DeviceDVBInput *)adevice->mpeg_device();
        return dvb_dev;
 }
+#endif
 
 #if 0
 
@@ -1596,6 +1595,7 @@ undisplay_vframe()
 int Record::
 display_channel_info()
 {
+#ifdef HAVE_DVB
        if( !channel ) return 1;
        if( !vdevice || vdevice->in_config->driver != CAPTURE_DVB ) return 1;
        DeviceDVBInput *dvb_input = dvb_device();
@@ -1648,11 +1648,15 @@ display_channel_info()
                display_video_text(20, 20, text,
                                BIGFONT, WHITE, BLACK, 0, 3., 1.);
        return result;
+#else
+       return 1;
+#endif
 }
 
 int Record::
 display_channel_schedule()
 {
+#ifdef HAVE_DVB
        if( !channel ) return 1;
        if( !vdevice || vdevice->in_config->driver != CAPTURE_DVB ) return 1;
        DeviceDVBInput *dvb_input = dvb_device();
@@ -1702,6 +1706,9 @@ display_channel_schedule()
        display_video_text(20, 20, text,
                                BIGFONT, WHITE, BLACK, 0, 3., 1.);
        return 0;
+#else
+       return 1;
+#endif
 }
 
 void Record::clear_keybfr()
@@ -1901,11 +1908,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;