Improve FFmpeg sync, in theory.
[dcpomatic.git] / src / lib / video_decoder.cc
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 #include "video_decoder.h"
21 #include "subtitle.h"
22 #include "film.h"
23 #include "image.h"
24 #include "ratio.h"
25
26 #include "i18n.h"
27
28 using std::cout;
29 using boost::shared_ptr;
30
31 VideoDecoder::VideoDecoder (shared_ptr<const Film> f)
32         : Decoder (f)
33         , _video_position (0)
34 {
35
36 }
37
38 void
39 VideoDecoder::video (shared_ptr<const Image> image, bool same, VideoContent::Frame frame)
40 {
41         Video (image, same, frame);
42         _video_position = frame + 1;
43 }
44
45 #if 0
46
47 /** Called by subclasses when a subtitle is ready.
48  *  s may be 0 to say that there is no current subtitle.
49  *  @param s New current subtitle, or 0.
50  */
51 void
52 VideoDecoder::subtitle (shared_ptr<TimedSubtitle> s)
53 {
54         _timed_subtitle = s;
55         
56         if (_timed_subtitle) {
57                 Position const p = _timed_subtitle->subtitle()->position ();
58                 _timed_subtitle->subtitle()->set_position (Position (p.x - _video_content->crop().left, p.y - _video_content->crop().top));
59         }
60 }
61 #endif
62