summaryrefslogtreecommitdiff
path: root/src/lib/options.h
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-07-15 00:14:28 +0100
committerCarl Hetherington <cth@carlh.net>2012-07-15 00:14:28 +0100
commitbb767c7e338414beee132af3e96829c1448e214b (patch)
treebec2858dcc7225a9bcc2acd8170c25508f6df6cb /src/lib/options.h
parent66c9be6bdb1361e5681e094a0c8170d268aa9518 (diff)
Move things round a bit.
Diffstat (limited to 'src/lib/options.h')
-rw-r--r--src/lib/options.h109
1 files changed, 109 insertions, 0 deletions
diff --git a/src/lib/options.h b/src/lib/options.h
new file mode 100644
index 000000000..b283e330d
--- /dev/null
+++ b/src/lib/options.h
@@ -0,0 +1,109 @@
+/*
+ Copyright (C) 2012 Carl Hetherington <cth@carlh.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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+*/
+
+/** @file src/options.h
+ * @brief Options for a transcoding operation.
+ */
+
+#include <string>
+#include <iomanip>
+#include <sstream>
+#include "util.h"
+
+/** @class Options
+ * @brief Options for a transcoding operation.
+ *
+ * These are settings which may be different, in different circumstances, for
+ * the same film; ie they are options for a particular transcode operation.
+ */
+class Options
+{
+public:
+
+ Options (std::string f, std::string e, std::string m)
+ : padding (0)
+ , apply_crop (true)
+ , num_frames (0)
+ , decode_video (true)
+ , decode_video_frequency (0)
+ , decode_audio (true)
+ , _frame_out_path (f)
+ , _frame_out_extension (e)
+ , _multichannel_audio_out_path (m)
+ {}
+
+ /** @return The path to write video frames to */
+ std::string frame_out_path () const {
+ return _frame_out_path;
+ }
+
+ /** @param f Frame index.
+ * @param t true to return a temporary file path, otherwise a permanent one.
+ * @return The path to write this video frame to.
+ */
+ std::string frame_out_path (int f, bool t) const {
+ std::stringstream s;
+ s << _frame_out_path << "/";
+ s.width (8);
+ s << std::setfill('0') << f << _frame_out_extension;
+
+ if (t) {
+ s << ".tmp";
+ }
+
+ return s.str ();
+ }
+
+ /** @return Path to write multichannel audio data to */
+ std::string multichannel_audio_out_path () const {
+ return _multichannel_audio_out_path;
+ }
+
+ /** @param c Audio channel index.
+ * @param t true to return a temporary file path, otherwise a permanent one.
+ * @return The path to write this audio file to.
+ */
+ std::string multichannel_audio_out_path (int c, bool t) const {
+ std::stringstream s;
+ s << _multichannel_audio_out_path << "/" << (c + 1) << ".wav";
+ if (t) {
+ s << ".tmp";
+ }
+
+ return s.str ();
+ }
+
+ Size out_size; ///< size of output images
+ float ratio; ///< ratio of the wanted output image (not considering padding)
+ int padding; ///< number of pixels of padding (in terms of the output size) each side of the image
+ bool apply_crop; ///< true to apply cropping
+ int num_frames; ///< number of video frames to run for, or 0 for all
+ int black_after; ///< first frame for which to output a black frame, rather than the actual video content, or 0 for none
+ bool decode_video; ///< true to decode video, otherwise false
+ int decode_video_frequency; ///< skip frames so that this many are decoded in all (or 0) (for generating thumbnails)
+ bool decode_audio; ///< true to decode audio, otherwise false
+
+private:
+ /** Path of the directory to write video frames to */
+ std::string _frame_out_path;
+ /** Extension to use for video frame files (including the leading .) */
+ std::string _frame_out_extension;
+ /** Path of the directory to write audio files to */
+ std::string _multichannel_audio_out_path;
+};