Merge branch 'master' of ssh://carlh.dnsalias.org/home/carl/git/dvdomatic
[dcpomatic.git] / src / lib / options.h
index 65c7b9ebc802bed72a5cc6de493076fd4e2bdb51..55b066a2d90bb918d53b9a315b62d66fe8020a7b 100644 (file)
 #include <boost/optional.hpp>
 #include "util.h"
 
-/** @class Options
- *  @brief Options for a transcoding operation.
+/** @class EncodeOptions
+ *  @brief EncodeOptions for an encoding operation.
  *
  *  These are settings which may be different, in different circumstances, for
- *  the same film; ie they are options for a particular transcode operation.
+ *  the same film; ie they are options for a particular operation.
  */
-class Options
+class EncodeOptions
 {
 public:
 
-       Options (std::string f, std::string e, std::string m)
+       EncodeOptions (std::string f, std::string e, std::string m)
                : padding (0)
-               , apply_crop (true)
-               , decode_video_skip (0)
-               , decode_audio (true)
-               , decode_subtitles (false)
-               , decoder_alignment (true)
+               , video_skip (0)
                , _frame_out_path (f)
                , _frame_out_extension (e)
                , _multichannel_audio_out_path (m)
@@ -58,15 +54,11 @@ public:
         *  @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 (SourceFrame f, bool t, std::string e = "") const {
-               if (e.empty ()) {
-                       e = _frame_out_extension;
-               }
-               
+       std::string frame_out_path (SourceFrame f, bool t) const {
                std::stringstream s;
                s << _frame_out_path << "/";
                s.width (8);
-               s << std::setfill('0') << f << e;
+               s << std::setfill('0') << f << _frame_out_extension;
 
                if (t) {
                        s << ".tmp";
@@ -75,6 +67,10 @@ public:
                return s.str ();
        }
 
+       std::string hash_out_path (SourceFrame f, bool t) const {
+               return frame_out_path (f, t) + ".md5";
+       }
+
        /** @return Path to write multichannel audio data to */
        std::string multichannel_audio_out_path () const {
                return _multichannel_audio_out_path;
@@ -95,23 +91,17 @@ public:
        }
 
        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
 
-       /** Range of video frames to decode */
-       boost::optional<std::pair<SourceFrame, SourceFrame> > video_decode_range;
-       /** Range of audio frames to decode */
-       boost::optional<std::pair<int64_t, int64_t> > audio_decode_range;
+       /** Range of video frames to encode (in DCP frames) */
+       boost::optional<std::pair<int, int> > video_range;
+       /** Range of audio frames to decode (in the DCP's sampling rate) */
+       boost::optional<std::pair<int64_t, int64_t> > audio_range;
        
        /** Skip frames such that we don't decode any frame where (index % decode_video_skip) != 0; e.g.
         *  1 for every frame, 2 for every other frame, etc.
         */
-       SourceFrame decode_video_skip; 
-       bool decode_audio;          ///< true to decode audio, otherwise false
-       bool decode_subtitles;
-
-       bool decoder_alignment;
+       SourceFrame video_skip; 
 
 private:
        /** Path of the directory to write video frames to */
@@ -121,3 +111,18 @@ private:
        /** Path of the directory to write audio files to */
        std::string _multichannel_audio_out_path;
 };
+
+
+class DecodeOptions
+{
+public:
+       DecodeOptions ()
+               : decode_audio (true)
+               , decode_subtitles (false)
+               , video_sync (true)
+       {}
+       
+       bool decode_audio;
+       bool decode_subtitles;
+       bool video_sync;
+};