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/film_state.h
21 * @brief The state of a Film. This is separate from Film so that
22 * state can easily be copied and kept around for reference
23 * by long-running jobs. This avoids the jobs getting confused
24 * by the user changing Film settings during their run.
27 #ifndef DVDOMATIC_FILM_STATE_H
28 #define DVDOMATIC_FILM_STATE_H
31 #include <libavcodec/avcodec.h>
32 #include <libswscale/swscale.h>
36 #include "trim_action.h"
43 * @brief The state of a Film.
45 * This is separate from Film so that state can easily be copied and
46 * kept around for reference by long-running jobs. This avoids the
47 * jobs getting confused by the user changing Film settings during
55 : dcp_content_type (0)
56 , frames_per_second (0)
58 , scaler (Scaler::from_id ("bicubic"))
60 , dcp_trim_action (CUT)
67 , audio_sample_rate (0)
68 , audio_sample_format (AV_SAMPLE_FMT_NONE)
71 std::string file (std::string f) const;
72 std::string dir (std::string d) const;
74 std::string content_path () const;
75 ContentType content_type () const;
77 bool content_is_dvd () const;
79 std::string thumb_file (int) const;
80 int thumb_frame (int) const;
82 int bytes_per_sample () const;
84 void write_metadata (std::ofstream &) const;
85 void read_metadata (std::string, std::string);
87 Size cropped_size (Size) const;
89 /** Complete path to directory containing the film metadata;
92 std::string directory;
93 /** Name for DVD-o-matic */
95 /** File or directory containing content; may be relative to our directory
96 * or an absolute path.
99 /** The type of content that this Film represents (feature, trailer etc.) */
100 DCPContentType const * dcp_content_type;
101 /** Frames per second of the source */
102 float frames_per_second;
103 /** The format to present this Film in (flat, scope, etc.) */
104 Format const * format;
106 /** Video filters that should be used when generating DCPs */
107 std::vector<Filter const *> filters;
108 /** Scaler algorithm to use */
109 Scaler const * scaler;
110 /** Number of frames to put in the DCP, or 0 for all */
113 TrimAction dcp_trim_action;
115 /** true to create an A/B comparison DCP, where the left half of the image
116 is the video without any filters or post-processing, and the right half
117 has the specified filters and post-processing.
120 /** Gain to apply to audio in dB */
122 /** Delay to apply to audio (positive moves audio later) in milliseconds */
124 /** Duration to make still-sourced films (in seconds) */
127 /* Data which is cached to speed things up */
129 /** Vector of frame indices for each of our `thumbnails' */
130 std::vector<int> thumbs;
131 /** Size, in pixels, of the source (ignoring cropping) */
133 /** Length of the source in frames */
135 /** Number of audio channels */
137 /** Sample rate of the source audio, in Hz */
138 int audio_sample_rate;
139 /** Format of the audio samples */
140 AVSampleFormat audio_sample_format;
141 /** MD5 digest of our content file */
142 std::string content_digest;
145 std::string thumb_file_for_frame (int) const;