1 /*  QWinFF - a qt4 gui frontend for ffmpeg
2  *  Copyright (C) 2011-2013 Timothy Lin <lzh9102@gmail.com>
3  *
4  *  This program is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 3 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef CONVERSIONPARAMETERS_H
19 #define CONVERSIONPARAMETERS_H
20 #include <QString>
21 #include <QStringList>
22 
23 class ConversionParameters
24 {
25 public:
26 
27     /* Generic Options */
28     QString source;       ///< name of source file
29     QString destination;  ///< name of destination file
30     int threads; ///< how many threads to use in conversion
31 
32     bool disable_audio;
33     bool copy_audio;
34     int audio_bitrate;
35     int audio_sample_rate;
36     bool audio_keep_sample_rate; ///< whether to keep original audio sample rate
37     int audio_channels;
38     int audio_volume; ///< output volume in binary percent (256 is normal, 512 is double)
39 
40     bool disable_video;
41     bool copy_video;
42     bool video_same_quality; ///< whether to keep all video quality (-sameq option in ffmpeg)
43     bool video_deinterlace;
44     int video_bitrate;
45     int video_width;
46     int video_height;
47     int video_crop_top, video_crop_bottom, video_crop_left, video_crop_right;
48 
49     unsigned int time_begin, time_end;
50 
51     /* FFmpeg Specific Options */
52     /*! Additional options passed to the ffmpeg transcoder.
53         These options will be overriden by other specific options. */
54     QString ffmpeg_options;
55 
56     /* MEncoder Specific Options */
57     //QString mencoder_oac; // output audio codec
58     //QString mencoder_ovc; // output video codec
59     //QString mencoder_of;  // output format
60 
61     /* Speed (FFmpeg + SoX) */
62     /*! Turn on/off speed scaling.
63         If speed scaling is on, speed_scaling_factor will be used
64         to change the speed of the video and audio stream.
65      */
66     bool speed_scaling;
67     /*! Speed scaling factor.
68         1.0 is normal speed; less than 1.0, slow down; greater than 1.0, speed up.
69         This parameter is only used when speed_scaling is true.
70      */
71     double speed_scaling_factor;
72 
73     /*! Copy all fields except source, destination files from src
74      *  @param src the source to copy from
75      */
76     void copyConfigurationFrom(const ConversionParameters& src);
77 
78     /*! Generate a ConversionParameters from ffmpeg command line options.
79         This function ignores input and output file options. */
80     static ConversionParameters fromFFmpegParameters(const QString& params_str);
81     static ConversionParameters fromFFmpegParameters(const char *params_str);
82 
ConversionParameters()83     ConversionParameters()
84         : threads(0),
85           disable_audio(false),
86           copy_audio(false),
87           audio_bitrate(0),
88           audio_sample_rate(0),
89           audio_keep_sample_rate(false),
90           audio_channels(0),
91           audio_volume(0),
92           disable_video(false),
93           copy_video(false),
94           video_same_quality(false),
95           video_deinterlace(false),
96           video_bitrate(0),
97           video_width(0), video_height(0),
98           video_crop_top(0), video_crop_bottom(0),
99           video_crop_left(0), video_crop_right(0),
100           time_begin(0), time_end(0),
101           speed_scaling(false), speed_scaling_factor(1.0)
102     { }
103 };
104 
105 #endif // CONVERSIONPARAMETERS_H
106