Re-work FilmState / Film relationship a bit; Film now inherits from FilmState and...
[dcpomatic.git] / src / lib / film.h
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
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.
8
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.
13
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.
17
18 */
19
20 /** @file  src/film.h
21  *  @brief A representation of a piece of video (with sound), including naming,
22  *  the source content file, and how it should be presented in a DCP.
23  */
24
25 #ifndef DVDOMATIC_FILM_H
26 #define DVDOMATIC_FILM_H
27
28 #include <string>
29 #include <vector>
30 #include <inttypes.h>
31 #include <boost/thread/mutex.hpp>
32 #include <boost/thread.hpp>
33 extern "C" {
34 #include <libavcodec/avcodec.h>
35 }
36 #include "dcp_content_type.h"
37 #include "film_state.h"
38
39 class Format;
40 class Job;
41 class Filter;
42 class Log;
43 class ExamineContentJob;
44
45 /** @class Film
46  *  @brief A representation of a video with sound.
47  *
48  *  A representation of a piece of video (with sound), including naming,
49  *  the source content file, and how it should be presented in a DCP.
50  */
51 class Film : public FilmState
52 {
53 public:
54         Film (std::string d, bool must_exist = true);
55         ~Film ();
56
57         std::string j2k_dir () const;
58
59         std::vector<std::string> audio_files () const;
60
61         void update_thumbs_pre_gui ();
62         void update_thumbs_post_gui ();
63         std::pair<Position, std::string> thumb_subtitle (int) const;
64
65         void copy_from_dvd_post_gui ();
66         void examine_content ();
67         void examine_content_post_gui ();
68         void send_dcp_to_tms ();
69         void copy_from_dvd ();
70
71         void make_dcp (bool, int freq = 0);
72
73         /** @return Logger.
74          *  It is safe to call this from any thread.
75          */
76         Log* log () const {
77                 return _log;
78         }
79
80         int encoded_frames () const;
81         
82 private:
83         /** Log to write to */
84         Log* _log;
85
86         /** Any running ExamineContentJob, or 0 */
87         boost::shared_ptr<ExamineContentJob> _examine_content_job;
88 };
89
90 #endif