Remove PassReason stuff.
authorCarl Hetherington <cth@carlh.net>
Fri, 12 Jun 2015 12:47:35 +0000 (13:47 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Jun 2015 12:47:35 +0000 (13:47 +0100)
This feels wrong: it means that it is possible for FFmpegDecoder
to discard packets.  I can't see how this is ok in all cases:
maybe we were lucky that it worked at all.

17 files changed:
src/lib/audio_decoder_stream.cc
src/lib/dcp_decoder.cc
src/lib/dcp_decoder.h
src/lib/dcp_subtitle_decoder.cc
src/lib/dcp_subtitle_decoder.h
src/lib/decoder.h
src/lib/ffmpeg_decoder.cc
src/lib/ffmpeg_decoder.h
src/lib/image_decoder.cc
src/lib/image_decoder.h
src/lib/sndfile_decoder.cc
src/lib/sndfile_decoder.h
src/lib/subrip_decoder.cc
src/lib/subrip_decoder.h
src/lib/subtitle_decoder.cc
src/lib/video_decoder.cc
test/audio_decoder_test.cc

index b9a8f2657aff81693c6d739e4fe3c7f57fb8055f..f1d9839f81950777512c1ddf53db0f44fcaf8d43 100644 (file)
@@ -81,7 +81,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
                /* Keep stuffing data into _decoded until we have enough data, or the subclass does not want to give us any more */
                while (
                        (_decoded.frame > frame || (_decoded.frame + _decoded.audio->frames()) < end) &&
-                       !_decoder->pass (Decoder::PASS_REASON_AUDIO)
+                       !_decoder->pass ()
                        )
                {}
                
@@ -89,7 +89,7 @@ AudioDecoderStream::get (Frame frame, Frame length, bool accurate)
        } else {
                while (
                        _decoded.audio->frames() < length &&
-                       !_decoder->pass (Decoder::PASS_REASON_AUDIO)
+                       !_decoder->pass ()
                        )
                {}
                
index 8b2765d449689036b716f9e37cc6d16470b98c7e..ab906b3d17f8b4e4b54042c0874df1a61417b2e4 100644 (file)
@@ -55,7 +55,7 @@ DCPDecoder::DCPDecoder (shared_ptr<const DCPContent> c)
 }
 
 bool
-DCPDecoder::pass (PassReason)
+DCPDecoder::pass ()
 {
        if (_reel == _reels.end () || !_dcp_content->can_be_played ()) {
                return true;
index 3a05325c744ec195ed0b3320193840804b4e4dc1..5d9b76497411bc3f6a482c99f7be25964bbc8a54 100644 (file)
@@ -38,7 +38,7 @@ public:
        DCPDecoder (boost::shared_ptr<const DCPContent>);
 
 private:
-       bool pass (PassReason);
+       bool pass ();
        void seek (ContentTime t, bool accurate);
        
        std::list<ContentTimePeriod> image_subtitles_during (ContentTimePeriod, bool starting) const;
index 95d7bdca4a8cba8f9b35e28e2ae6f4ff54f9c894..9687f646c0e73ed686a0a76cdca6be64a8265977 100644 (file)
@@ -46,7 +46,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
 }
 
 bool
-DCPSubtitleDecoder::pass (PassReason)
+DCPSubtitleDecoder::pass ()
 {
        if (_next == _subtitles.end ()) {
                return true;
index 52e40041683f61119a7445dc0fcc11d1ff1b9387..a27d6b2dba44ab9fa66f8fbbebc5b68736b9ef0c 100644 (file)
@@ -28,7 +28,7 @@ public:
        DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>);
 
 protected:
-       bool pass (PassReason);
+       bool pass ();
        void seek (ContentTime time, bool accurate);
 
 private:
index acc77a814920630582c74678aee72c12ef858c13..c5a359e1a86afd52a7750c90d662447d5ce42b7b 100644 (file)
@@ -53,13 +53,7 @@ protected:
         */
        virtual void seek (ContentTime time, bool accurate) = 0;
 
-       enum PassReason {
-               PASS_REASON_VIDEO,
-               PASS_REASON_AUDIO,
-               PASS_REASON_SUBTITLE
-       };
-       
-       virtual bool pass (PassReason reason) = 0;
+       virtual bool pass () = 0;
 };
 
 #endif
index 416ac02484ab6bbdee295aab0c403c2956e89b4e..6f91922eb90e8faa786c3b8758a285277a3f3cc2 100644 (file)
@@ -137,7 +137,7 @@ FFmpegDecoder::flush ()
 }
 
 bool
-FFmpegDecoder::pass (PassReason reason)
+FFmpegDecoder::pass ()
 {
        int r = av_read_frame (_format_context, &_packet);
 
@@ -160,11 +160,11 @@ FFmpegDecoder::pass (PassReason reason)
        int const si = _packet.stream_index;
        shared_ptr<const FFmpegContent> fc = _ffmpeg_content;
 
-       if (si == _video_stream && !_ignore_video && reason != PASS_REASON_SUBTITLE) {
+       if (si == _video_stream && !_ignore_video) {
                decode_video_packet ();
        } else if (fc->subtitle_stream() && fc->subtitle_stream()->uses_index (_format_context, si)) {
                decode_subtitle_packet ();
-       } else if (reason != PASS_REASON_SUBTITLE) {
+       } else {
                decode_audio_packet ();
        }
 
index ec975f439e31e2ce4f9bf411d31c8392d415ac46..41af744471d1f91280c493e8aa2563b4ddaa8494 100644 (file)
@@ -54,7 +54,7 @@ public:
 private:
        friend struct ::ffmpeg_pts_offset_test;
 
-       bool pass (PassReason reason);
+       bool pass ();
        void seek (ContentTime time, bool);
        void flush ();
 
index 10eee2f6d40c049dbb7d0bcf2d03470f019e937d..3d3e1a55b2083ad6fa7a70276af8f0804485d9da 100644 (file)
@@ -43,7 +43,7 @@ ImageDecoder::ImageDecoder (shared_ptr<const ImageContent> c)
 }
 
 bool
-ImageDecoder::pass (PassReason)
+ImageDecoder::pass ()
 {
        if (_video_position >= _image_content->video_length()) {
                return true;
index 0453f7e7e8c6b447947bc0f61cf8e51ba68fe1a6..775496bfdb8a874b06f8099f3e1c632c4c0d3857 100644 (file)
@@ -35,7 +35,7 @@ public:
        }
 
 private:
-       bool pass (PassReason);
+       bool pass ();
        void seek (ContentTime, bool);
        
        boost::shared_ptr<const ImageContent> _image_content;
index 68b60c7ac1c8330b523a87d71863dc9b29be03eb..ff14543e19502a74e9f711ccd32416569d2f534d 100644 (file)
@@ -48,7 +48,7 @@ SndfileDecoder::~SndfileDecoder ()
 }
 
 bool
-SndfileDecoder::pass (PassReason)
+SndfileDecoder::pass ()
 {
        if (_remaining == 0) {
                return true;
index 4474adc9e3b37dba35bf62bd689ec318e973e643..40e31316571b257a761f2d498eec2ee9e225ba83 100644 (file)
@@ -31,7 +31,7 @@ public:
        ~SndfileDecoder ();
 
 private:
-       bool pass (PassReason);
+       bool pass ();
        void seek (ContentTime, bool);
        
        int64_t _done;
index 5c6d331dfe66bb3802010657de4ed0be2bd94b71..fecbbc5584cc96d6a943a9142fc49969d36b1909 100644 (file)
@@ -48,7 +48,7 @@ SubRipDecoder::seek (ContentTime time, bool accurate)
 }
 
 bool
-SubRipDecoder::pass (PassReason)
+SubRipDecoder::pass ()
 {
        if (_next >= _subtitles.size ()) {
                return true;
index 264ca88996b2b93dafd4b1521f4c4f3a98f8f609..876f763d3a5ffe1c39f1952226250eccb95db4c6 100644 (file)
@@ -32,7 +32,7 @@ public:
 
 protected:
        void seek (ContentTime time, bool accurate);
-       bool pass (PassReason);
+       bool pass ();
 
 private:
        std::list<ContentTimePeriod> image_subtitles_during (ContentTimePeriod, bool starting) const;
index 2efe9afb692bdebcf3b4a3d8e44c7e655a3f02c9..93493aa70ae67d5d207471b2ada30db4988a711e 100644 (file)
@@ -70,7 +70,7 @@ SubtitleDecoder::get (list<T> const & subs, list<ContentTimePeriod> const & sp,
         *  (a) give us what we want, or
         *  (b) hit the end of the decoder.
         */
-       while (!pass(PASS_REASON_SUBTITLE) && (subs.empty() || (subs.back().period().to < sp.back().to))) {}
+       while (!pass () && (subs.empty() || (subs.back().period().to < sp.back().to))) {}
 
        /* Now look for what we wanted in the data we have collected */
        /* XXX: inefficient */
index 6393fcbb26348c8f69d95c0a4b57969e273b25f5..9d165ab02f810b7d7e4730ff1617115f3a57eafb 100644 (file)
@@ -96,7 +96,7 @@ VideoDecoder::get_video (Frame frame, bool accurate)
                                break;
                        }
 
-                       if (pass (PASS_REASON_VIDEO)) {
+                       if (pass ()) {
                                /* The decoder has nothing more for us */
                                break;
                        }
@@ -113,7 +113,7 @@ VideoDecoder::get_video (Frame frame, bool accurate)
                dec = decoded_video (frame);
        } else {
                /* Any frame will do: use the first one that comes out of pass() */
-               while (_decoded_video.empty() && !pass (PASS_REASON_VIDEO)) {}
+               while (_decoded_video.empty() && !pass ()) {}
                if (!_decoded_video.empty ()) {
                        dec.push_back (_decoded_video.front ());
                }
index 880e3d6b643e2a689cd25762558999dab3da4d33..cd86b73e76942207c7580b28190fac23954673fc 100644 (file)
@@ -64,7 +64,7 @@ public:
                , _position (0)
        {}
 
-       bool pass (PassReason)
+       bool pass ()
        {
                Frame const N = min (
                        Frame (2000),