Remove some unnecessary code.
authorCarl Hetherington <cth@carlh.net>
Tue, 9 Oct 2012 01:14:04 +0000 (02:14 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 9 Oct 2012 01:14:04 +0000 (02:14 +0100)
src/lib/ab_transcoder.cc
src/lib/decoder.cc
src/lib/decoder.h
src/lib/film.cc
src/lib/options.h

index 95492a9d8ddb5268af22be30487b4eef8aa60d5c..1c20ae4776fe23d0bf0c9f6d1f57cab5b3402246 100644 (file)
@@ -112,7 +112,7 @@ ABTranscoder::go ()
                bool const b = _db->pass ();
 
                if (_job) {
-                       _job->set_progress (float (_last_frame) / _da->decoding_frames ());
+                       _job->set_progress (float (_last_frame) / _fs_a->dcp_length());
                }
                
                if (a && b) {
index 8aa5f77c6e9f7b2916fba1eba3f9b20688b9580b..324d1a296b36c9a2dc43015b438bb54800b9a217 100644 (file)
@@ -112,7 +112,7 @@ Decoder::process_end ()
        */
 
        int64_t const audio_short_by_frames =
-               ((int64_t) decoding_frames() * _fs->target_sample_rate() / _fs->frames_per_second)
+               ((int64_t) _fs->dcp_length() * _fs->target_sample_rate() / _fs->frames_per_second)
                - _audio_frames_processed;
 
        if (audio_short_by_frames >= 0) {
@@ -147,24 +147,13 @@ Decoder::go ()
 
        while (pass () == false) {
                if (_job && !_ignore_length) {
-                       _job->set_progress (float (_video_frame) / decoding_frames ());
+                       _job->set_progress (float (_video_frame) / _fs->dcp_length());
                }
        }
 
        process_end ();
 }
 
-/** @return Number of frames that we will be decoding */
-int
-Decoder::decoding_frames () const
-{
-       if (_opt->num_frames > 0) {
-               return _opt->num_frames;
-       }
-       
-       return _fs->length;
-}
-
 /** Run one pass.  This may or may not generate any actual video / audio data;
  *  some decoders may require several passes to generate a single frame.
  *  @return true if we have finished processing all data; otherwise false.
@@ -177,7 +166,7 @@ Decoder::pass ()
                _have_setup_video_filters = true;
        }
        
-       if (_opt->num_frames != 0 && _video_frame >= _opt->num_frames) {
+       if (_video_frame >= _fs->dcp_length()) {
                return true;
        }
 
index 19ef25ede0836eea85926956131c6ce9db1e15fc..04ff512eb4fe520291754866fbf564b6c470efa9 100644 (file)
@@ -77,8 +77,6 @@ public:
                return _video_frame;
        }
        
-       int decoding_frames () const;
-
        /** Emitted when a video frame is ready.
         *  First parameter is the frame.
         *  Second parameter is its index within the content.
index 330ae9e5dcfd8e322dec323005922d591bb38045..e2b3d4bc31391cb4a226caa64442102abd6f7cf7 100644 (file)
@@ -517,18 +517,15 @@ Film::make_dcp (bool transcode, int freq)
        o->out_size = format()->dcp_size ();
        if (dcp_frames() == 0) {
                /* Decode the whole film, no blacking */
-               o->num_frames = 0;
                o->black_after = 0;
        } else {
                switch (dcp_trim_action()) {
                case CUT:
                        /* Decode only part of the film, no blacking */
-                       o->num_frames = dcp_frames ();
                        o->black_after = 0;
                        break;
                case BLACK_OUT:
                        /* Decode the whole film, but black some frames out */
-                       o->num_frames = 0;
                        o->black_after = dcp_frames ();
                }
        }
index b283e330de93af35db292aa0f0f8703e6820c6ce..1156ece1dfb3fb5a2dfe7e597303ed49a3ea9eac 100644 (file)
@@ -39,7 +39,6 @@ public:
        Options (std::string f, std::string e, std::string m)
                : padding (0)
                , apply_crop (true)
-               , num_frames (0)
                , decode_video (true)
                , decode_video_frequency (0)
                , decode_audio (true)
@@ -93,7 +92,6 @@ public:
        float ratio;                ///< ratio of the wanted output image (not considering padding)
        int padding;                ///< number of pixels of padding (in terms of the output size) each side of the image
        bool apply_crop;            ///< true to apply cropping
-       int num_frames;             ///< number of video frames to run for, or 0 for all
        int black_after;            ///< first frame for which to output a black frame, rather than the actual video content, or 0 for none
        bool decode_video;          ///< true to decode video, otherwise false
        int decode_video_frequency; ///< skip frames so that this many are decoded in all (or 0) (for generating thumbnails)