File indexing completed on 2024-05-12 16:23:35

0001 /***************************************************************************
0002  *   Copyright (C) 2005-2014 by Linuxstopmotion contributors;              *
0003  *   see the AUTHORS file for details.                                     *
0004  *                                                                         *
0005  *   This program is free software; you can redistribute it and/or modify  *
0006  *   it under the terms of the GNU General Public License as published by  *
0007  *   the Free Software Foundation; either version 2 of the License, or     *
0008  *   (at your option) any later version.                                   *
0009  *                                                                         *
0010  *   This program is distributed in the hope that it will be useful,       *
0011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0013  *   GNU General Public License for more details.                          *
0014  *                                                                         *
0015  *   You should have received a copy of the GNU General Public License     *
0016  *   along with this program; if not, write to the                         *
0017  *   Free Software Foundation, Inc.,                                       *
0018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
0019  ***************************************************************************/
0020 
0021 #include "src/technical/video/videoencoder.h"
0022 
0023 #include "src/technical/util.h"
0024 
0025 #include <stdlib.h>
0026 #include <string.h>
0027 
0028 
0029 VideoEncoder::VideoEncoder()
0030 {
0031     startCommand = NULL;
0032     stopCommand = NULL;
0033     outputFile = NULL;
0034 }
0035 
0036 
0037 VideoEncoder::~ VideoEncoder()
0038 {
0039     delete [] startCommand;
0040     startCommand = NULL;
0041     delete [] stopCommand;
0042     stopCommand = NULL;
0043     delete [] outputFile;
0044     outputFile = NULL;
0045 }
0046 
0047 
0048 const char* VideoEncoder::getStartCommand()
0049 {
0050     return startCommand;
0051 }
0052 
0053 
0054 const char* VideoEncoder::getStopCommand()
0055 {
0056     return stopCommand;
0057 }
0058 
0059 
0060 const char * VideoEncoder::getOutputFile()
0061 {
0062     return outputFile;
0063 }
0064 
0065 
0066 void VideoEncoder::setStartCommand(const char* command)
0067 {
0068     if (startCommand) {
0069         delete [] startCommand;
0070         startCommand = NULL;
0071     }
0072     startCommand = new char[strlen(command) + 1];
0073     strcpy(startCommand, command);
0074 }
0075 
0076 
0077 void VideoEncoder::setStopCommand(const char* command)
0078 {
0079     if (stopCommand) {
0080         delete [] stopCommand;
0081         stopCommand = NULL;
0082     }
0083     stopCommand = new char[strlen(command) + 1];
0084     strcpy(stopCommand, command);
0085 }
0086 
0087 
0088 void VideoEncoder::setOutputFile(const char* file)
0089 {
0090     if (outputFile) {
0091         delete [] outputFile;
0092         outputFile = NULL;
0093     }
0094     outputFile = new char[strlen(file) + 1];
0095     strcpy(outputFile, file);
0096 }
0097 
0098 
0099 bool VideoEncoder::isValid() {
0100     return Util::checkCommand(0, startCommand);
0101 }