Tidy up test film naming.
[dcpomatic.git] / src / lib / film_state.h
index 40908693f26c40dd7edfbd049adb4462549de67d..14a8f7eb5e19b763786d60bf9a9fede0223dfcbe 100644 (file)
@@ -70,13 +70,54 @@ public:
                , _subtitle_offset (0)
                , _subtitle_scale (1)
                , _length (0)
-               , _audio_channels (0)
                , _audio_sample_rate (0)
                , _has_subtitles (false)
                , _frames_per_second (0)
                , _dirty (false)
        {}
 
+       FilmState (FilmState const & o)
+               : _directory         (o._directory)
+               , _name              (o._name)
+               , _use_dci_name      (o._use_dci_name)
+               , _content           (o._content)
+               , _dcp_content_type  (o._dcp_content_type)
+               , _format            (o._format)
+               , _crop              (o._crop)
+               , _filters           (o._filters)
+               , _scaler            (o._scaler)
+               , _dcp_frames        (o._dcp_frames)
+               , _dcp_trim_action   (o._dcp_trim_action)
+               , _dcp_ab            (o._dcp_ab)
+               , _audio_stream      (o._audio_stream)
+               , _audio_gain        (o._audio_gain)
+               , _audio_delay       (o._audio_delay)
+               , _still_duration    (o._still_duration)
+               , _subtitle_stream   (o._subtitle_stream)
+               , _with_subtitles    (o._with_subtitles)
+               , _subtitle_offset   (o._subtitle_offset)
+               , _subtitle_scale    (o._subtitle_scale)
+               , _audio_language    (o._audio_language)
+               , _subtitle_language (o._subtitle_language)
+               , _territory         (o._territory)
+               , _rating            (o._rating)
+               , _studio            (o._studio)
+               , _facility          (o._facility)
+               , _package_type      (o._package_type)
+               , _thumbs            (o._thumbs)
+               , _size              (o._size)
+               , _length            (o._length)
+               , _audio_sample_rate (o._audio_sample_rate)
+               , _content_digest    (o._content_digest)
+               , _has_subtitles     (o._has_subtitles)
+               , _audio_streams     (o._audio_streams)
+               , _subtitle_streams  (o._subtitle_streams)
+               , _frames_per_second (o._frames_per_second)
+               , _dirty             (o._dirty)
+       {}
+
+       virtual ~FilmState () {}
+
        std::string file (std::string f) const;
        std::string dir (std::string d) const;
 
@@ -89,7 +130,7 @@ public:
        std::string thumb_base (int) const;
        int thumb_frame (int) const;
 
-       int target_sample_rate () const;
+       int target_audio_sample_rate () const;
        
        void write_metadata () const;
        void read_metadata ();
@@ -106,6 +147,8 @@ public:
                return _dirty;
        }
 
+       int audio_channels () const;
+
        enum Property {
                NONE,
                NAME,
@@ -131,7 +174,6 @@ public:
                THUMBS,
                SIZE,
                LENGTH,
-               AUDIO_CHANNELS,
                AUDIO_SAMPLE_RATE,
                HAS_SUBTITLES,
                AUDIO_STREAMS,
@@ -190,10 +232,15 @@ public:
                return _dcp_ab;
        }
 
-       int audio_stream () const {
+       int audio_stream_index () const {
                return _audio_stream;
        }
 
+       AudioStream audio_stream () const {
+               assert (_audio_stream < int (_audio_streams.size()));
+               return _audio_streams[_audio_stream];
+       }
+       
        float audio_gain () const {
                return _audio_gain;
        }
@@ -206,10 +253,15 @@ public:
                return _still_duration;
        }
 
-       int subtitle_stream () const {
+       int subtitle_stream_index () const {
                return _subtitle_stream;
        }
 
+       SubtitleStream subtitle_stream () const {
+               assert (_subtitle_stream < int (_subtitle_streams.size()));
+               return _subtitle_streams[_subtitle_stream];
+       }
+
        bool with_subtitles () const {
                return _with_subtitles;
        }
@@ -262,10 +314,6 @@ public:
                return _length;
        }
 
-       int audio_channels () const {
-               return _audio_channels;
-       }
-       
        int audio_sample_rate () const {
                return _audio_sample_rate;
        }
@@ -278,11 +326,11 @@ public:
                return _has_subtitles;
        }
 
-       std::vector<Stream> audio_streams () const {
+       std::vector<AudioStream> audio_streams () const {
                return _audio_streams;
        }
 
-       std::vector<Stream> subtitle_streams () const {
+       std::vector<SubtitleStream> subtitle_streams () const {
                return _subtitle_streams;
        }
        
@@ -290,13 +338,13 @@ public:
                return _frames_per_second;
        }
 
-       
+
        /* SET */
 
        void set_directory (std::string);
        void set_name (std::string);
        void set_use_dci_name (bool);
-       void set_content (std::string);
+       virtual void set_content (std::string);
        void set_dcp_content_type (DCPContentType const *);
        void set_format (Format const *);
        void set_crop (Crop);
@@ -331,8 +379,8 @@ public:
        void set_audio_sample_rate (int);
        void set_content_digest (std::string);
        void set_has_subtitles (bool);
-       void set_audio_streams (std::vector<Stream>);
-       void set_subtitle_streams (std::vector<Stream>);
+       void set_audio_streams (std::vector<AudioStream>);
+       void set_subtitle_streams (std::vector<SubtitleStream>);
        void set_frames_per_second (float);
 
        /** Emitted when some property has changed */
@@ -375,7 +423,7 @@ private:
            has the specified filters and post-processing.
        */
        bool _dcp_ab;
-       /** The decoder's stream ID to use for audio, or -1 if there is none */
+       /** An index into our _audio_streams vector for the stream to use for audio, or -1 if there is none */
        int _audio_stream;
        /** Gain to apply to audio in dB */
        float _audio_gain;
@@ -383,7 +431,7 @@ private:
        int _audio_delay;
        /** Duration to make still-sourced films (in seconds) */
        int _still_duration;
-       /** The decoder's stream ID to use for subtitles, or -1 if there are none */
+       /** An index into our _subtitle_streams vector for the stream to use for subtitles, or -1 if there is none */
        int _subtitle_stream;
        /** True if subtitles should be shown for this film */
        bool _with_subtitles;
@@ -411,8 +459,6 @@ private:
        Size _size;
        /** Length of the source in frames */
        int _length;
-       /** Number of audio channels */
-       int _audio_channels;
        /** Sample rate of the source audio, in Hz */
        int _audio_sample_rate;
        /** MD5 digest of our content file */
@@ -420,9 +466,9 @@ private:
        /** true if the source has subtitles */
        bool _has_subtitles;
        /** the audio streams that the source has */
-       std::vector<Stream> _audio_streams;
+       std::vector<AudioStream> _audio_streams;
        /** the subtitle streams that the source has */
-       std::vector<Stream> _subtitle_streams;
+       std::vector<SubtitleStream> _subtitle_streams;
        /** Frames per second of the source */
        float _frames_per_second;