2 Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
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 2 of the License, or
7 (at your option) any later version.
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.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 /** @file src/options.h
21 * @brief Options for a transcoding operation.
27 #include <boost/optional.hpp>
31 * @brief Options for a transcoding operation.
33 * These are settings which may be different, in different circumstances, for
34 * the same film; ie they are options for a particular transcode operation.
40 Options (std::string f, std::string e, std::string m)
43 , decode_video_skip (0)
45 , decode_subtitles (false)
47 , _frame_out_extension (e)
48 , _multichannel_audio_out_path (m)
51 /** @return The path to write video frames to */
52 std::string frame_out_path () const {
53 return _frame_out_path;
56 /** @param f Source frame index.
57 * @param t true to return a temporary file path, otherwise a permanent one.
58 * @return The path to write this video frame to.
60 std::string frame_out_path (SourceFrame f, bool t, std::string e = "") const {
62 e = _frame_out_extension;
66 s << _frame_out_path << "/";
68 s << std::setfill('0') << f << e;
77 /** @return Path to write multichannel audio data to */
78 std::string multichannel_audio_out_path () const {
79 return _multichannel_audio_out_path;
82 /** @param c Audio channel index.
83 * @param t true to return a temporary file path, otherwise a permanent one.
84 * @return The path to write this audio file to.
86 std::string multichannel_audio_out_path (int c, bool t) const {
88 s << _multichannel_audio_out_path << "/" << (c + 1) << ".wav";
96 Size out_size; ///< size of output images
97 float ratio; ///< ratio of the wanted output image (not considering padding)
98 int padding; ///< number of pixels of padding (in terms of the output size) each side of the image
99 bool apply_crop; ///< true to apply cropping
101 /** Range of video frames to decode */
102 boost::optional<std::pair<SourceFrame, SourceFrame> > video_decode_range;
103 /** Range of audio frames to decode */
104 boost::optional<std::pair<int64_t, int64_t> > audio_decode_range;
106 /** Skip frames such that we don't decode any frame where (index % decode_video_skip) != 0; e.g.
107 * 1 for every frame, 2 for every other frame, etc.
109 SourceFrame decode_video_skip;
110 bool decode_audio; ///< true to decode audio, otherwise false
111 bool decode_subtitles;
114 /** Path of the directory to write video frames to */
115 std::string _frame_out_path;
116 /** Extension to use for video frame files (including the leading .) */
117 std::string _frame_out_extension;
118 /** Path of the directory to write audio files to */
119 std::string _multichannel_audio_out_path;