summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-06-12 13:47:35 +0100
committerCarl Hetherington <cth@carlh.net>2015-06-12 13:47:35 +0100
commitbdbfd6b08856a445446bfd845f1c43109d184250 (patch)
treeb894142ddd3e6dfc16c4b934e730f0ef9b518646 /src
parentad27e9acc3d99a29fdc358da62feb603983f8882 (diff)
Remove PassReason stuff.
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.
Diffstat (limited to 'src')
-rw-r--r--src/lib/audio_decoder_stream.cc4
-rw-r--r--src/lib/dcp_decoder.cc2
-rw-r--r--src/lib/dcp_decoder.h2
-rw-r--r--src/lib/dcp_subtitle_decoder.cc2
-rw-r--r--src/lib/dcp_subtitle_decoder.h2
-rw-r--r--src/lib/decoder.h8
-rw-r--r--src/lib/ffmpeg_decoder.cc6
-rw-r--r--src/lib/ffmpeg_decoder.h2
-rw-r--r--src/lib/image_decoder.cc2
-rw-r--r--src/lib/image_decoder.h2
-rw-r--r--src/lib/sndfile_decoder.cc2
-rw-r--r--src/lib/sndfile_decoder.h2
-rw-r--r--src/lib/subrip_decoder.cc2
-rw-r--r--src/lib/subrip_decoder.h2
-rw-r--r--src/lib/subtitle_decoder.cc2
-rw-r--r--src/lib/video_decoder.cc4
16 files changed, 20 insertions, 26 deletions
diff --git a/src/lib/audio_decoder_stream.cc b/src/lib/audio_decoder_stream.cc
index b9a8f2657..f1d9839f8 100644
--- a/src/lib/audio_decoder_stream.cc
+++ b/src/lib/audio_decoder_stream.cc
@@ -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 ()
)
{}
diff --git a/src/lib/dcp_decoder.cc b/src/lib/dcp_decoder.cc
index 8b2765d44..ab906b3d1 100644
--- a/src/lib/dcp_decoder.cc
+++ b/src/lib/dcp_decoder.cc
@@ -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;
diff --git a/src/lib/dcp_decoder.h b/src/lib/dcp_decoder.h
index 3a05325c7..5d9b76497 100644
--- a/src/lib/dcp_decoder.h
+++ b/src/lib/dcp_decoder.h
@@ -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;
diff --git a/src/lib/dcp_subtitle_decoder.cc b/src/lib/dcp_subtitle_decoder.cc
index 95d7bdca4..9687f646c 100644
--- a/src/lib/dcp_subtitle_decoder.cc
+++ b/src/lib/dcp_subtitle_decoder.cc
@@ -46,7 +46,7 @@ DCPSubtitleDecoder::seek (ContentTime time, bool accurate)
}
bool
-DCPSubtitleDecoder::pass (PassReason)
+DCPSubtitleDecoder::pass ()
{
if (_next == _subtitles.end ()) {
return true;
diff --git a/src/lib/dcp_subtitle_decoder.h b/src/lib/dcp_subtitle_decoder.h
index 52e400416..a27d6b2db 100644
--- a/src/lib/dcp_subtitle_decoder.h
+++ b/src/lib/dcp_subtitle_decoder.h
@@ -28,7 +28,7 @@ public:
DCPSubtitleDecoder (boost::shared_ptr<const DCPSubtitleContent>);
protected:
- bool pass (PassReason);
+ bool pass ();
void seek (ContentTime time, bool accurate);
private:
diff --git a/src/lib/decoder.h b/src/lib/decoder.h
index acc77a814..c5a359e1a 100644
--- a/src/lib/decoder.h
+++ b/src/lib/decoder.h
@@ -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
diff --git a/src/lib/ffmpeg_decoder.cc b/src/lib/ffmpeg_decoder.cc
index 416ac0248..6f91922eb 100644
--- a/src/lib/ffmpeg_decoder.cc
+++ b/src/lib/ffmpeg_decoder.cc
@@ -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 ();
}
diff --git a/src/lib/ffmpeg_decoder.h b/src/lib/ffmpeg_decoder.h
index ec975f439..41af74447 100644
--- a/src/lib/ffmpeg_decoder.h
+++ b/src/lib/ffmpeg_decoder.h
@@ -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 ();
diff --git a/src/lib/image_decoder.cc b/src/lib/image_decoder.cc
index 10eee2f6d..3d3e1a55b 100644
--- a/src/lib/image_decoder.cc
+++ b/src/lib/image_decoder.cc
@@ -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;
diff --git a/src/lib/image_decoder.h b/src/lib/image_decoder.h
index 0453f7e7e..775496bfd 100644
--- a/src/lib/image_decoder.h
+++ b/src/lib/image_decoder.h
@@ -35,7 +35,7 @@ public:
}
private:
- bool pass (PassReason);
+ bool pass ();
void seek (ContentTime, bool);
boost::shared_ptr<const ImageContent> _image_content;
diff --git a/src/lib/sndfile_decoder.cc b/src/lib/sndfile_decoder.cc
index 68b60c7ac..ff14543e1 100644
--- a/src/lib/sndfile_decoder.cc
+++ b/src/lib/sndfile_decoder.cc
@@ -48,7 +48,7 @@ SndfileDecoder::~SndfileDecoder ()
}
bool
-SndfileDecoder::pass (PassReason)
+SndfileDecoder::pass ()
{
if (_remaining == 0) {
return true;
diff --git a/src/lib/sndfile_decoder.h b/src/lib/sndfile_decoder.h
index 4474adc9e..40e313165 100644
--- a/src/lib/sndfile_decoder.h
+++ b/src/lib/sndfile_decoder.h
@@ -31,7 +31,7 @@ public:
~SndfileDecoder ();
private:
- bool pass (PassReason);
+ bool pass ();
void seek (ContentTime, bool);
int64_t _done;
diff --git a/src/lib/subrip_decoder.cc b/src/lib/subrip_decoder.cc
index 5c6d331df..fecbbc558 100644
--- a/src/lib/subrip_decoder.cc
+++ b/src/lib/subrip_decoder.cc
@@ -48,7 +48,7 @@ SubRipDecoder::seek (ContentTime time, bool accurate)
}
bool
-SubRipDecoder::pass (PassReason)
+SubRipDecoder::pass ()
{
if (_next >= _subtitles.size ()) {
return true;
diff --git a/src/lib/subrip_decoder.h b/src/lib/subrip_decoder.h
index 264ca8899..876f763d3 100644
--- a/src/lib/subrip_decoder.h
+++ b/src/lib/subrip_decoder.h
@@ -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;
diff --git a/src/lib/subtitle_decoder.cc b/src/lib/subtitle_decoder.cc
index 2efe9afb6..93493aa70 100644
--- a/src/lib/subtitle_decoder.cc
+++ b/src/lib/subtitle_decoder.cc
@@ -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 */
diff --git a/src/lib/video_decoder.cc b/src/lib/video_decoder.cc
index 6393fcbb2..9d165ab02 100644
--- a/src/lib/video_decoder.cc
+++ b/src/lib/video_decoder.cc
@@ -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 ());
}