Another try at sorting out the thorny question of timing.
[dcpomatic.git] / src / lib / imagemagick_decoder.h
index aca91ef5562d7392b1456942c6611df8b8c2aba1..286f473378396f9bbd44f39f28f08c7eeefaf0dd 100644 (file)
@@ -1,67 +1,44 @@
-#include "decoder.h"
+/*
+    Copyright (C) 2012-2013 Carl Hetherington <cth@carlh.net>
 
-namespace Magick {
-       class Image;
-}
-
-class ImageMagickDecoder : public Decoder
-{
-public:
-       ImageMagickDecoder (boost::shared_ptr<const FilmState>, boost::shared_ptr<const Options>, Job *, Log *, bool, bool);
-
-       int length_in_frames () const {
-               return 1;
-       }
-
-       float frames_per_second () const {
-               return static_frames_per_second ();
-       }
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
 
-       Size native_size () const;
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
 
-       int audio_channels () const {
-               return 0;
-       }
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-       int audio_sample_rate () const {
-               return 0;
-       }
+*/
 
-       AVSampleFormat audio_sample_format () const {
-               return AV_SAMPLE_FMT_NONE;
-       }
+#include "video_decoder.h"
+#include "imagemagick.h"
 
-       int64_t audio_channel_layout () const {
-               return 0;
-       }
-
-       static float static_frames_per_second () {
-               return 24;
-       }
-
-protected:
-       bool do_pass ();
-       PixelFormat pixel_format () const;
+namespace Magick {
+       class Image;
+}
 
-       int time_base_numerator () const {
-               return 0;
-       }
+class ImageMagickContent;
 
-       int time_base_denominator () const {
-               return 0;
-       }
+class ImageMagickDecoder : public VideoDecoder, public ImageMagick
+{
+public:
+       ImageMagickDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const ImageMagickContent>);
 
-       int sample_aspect_ratio_numerator () const {
-               /* XXX */
-               return 1;
-       }
+       /* Decoder */
 
-       int sample_aspect_ratio_denominator () const {
-               /* XXX */
-               return 1;
-       }
+       void pass ();
+       void seek (VideoContent::Frame);
+       void seek_back ();
+       bool done () const;
 
 private:
-       Magick::Image* _magick_image;
-       bool _done;
+       boost::shared_ptr<Image> _image;
+       mutable boost::optional<libdcp::Size> _video_size;
 };