summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2016-05-10 14:29:14 +0100
committerCarl Hetherington <cth@carlh.net>2016-05-18 11:50:29 +0100
commit504c63b3d62038bc486ca8a09e77fbb403907edd (patch)
treed9118c185110dd9eb103ed033700d4b3f486785d /test
parent9423e02c37daba7f9e406929a1cfc1bb10fb4b62 (diff)
Basics of splitting up Decoder tree like Content.
Diffstat (limited to 'test')
-rw-r--r--test/audio_decoder_test.cc15
-rw-r--r--test/dcp_subtitle_test.cc4
-rw-r--r--test/ffmpeg_decoder_seek_test.cc4
-rw-r--r--test/ffmpeg_decoder_sequential_test.cc12
-rw-r--r--test/seek_zero_test.cc5
-rw-r--r--test/video_decoder_fill_test.cc28
6 files changed, 40 insertions, 28 deletions
diff --git a/test/audio_decoder_test.cc b/test/audio_decoder_test.cc
index 21480a5c3..5eabc4074 100644
--- a/test/audio_decoder_test.cc
+++ b/test/audio_decoder_test.cc
@@ -58,14 +58,15 @@ public:
}
};
-class TestAudioDecoder : public AudioDecoder
+class TestAudioDecoder : public Decoder
{
public:
TestAudioDecoder (shared_ptr<TestAudioContent> content, shared_ptr<Log> log)
- : AudioDecoder (content->audio, false, log)
- , _test_audio_content (content)
+ : _test_audio_content (content)
, _position (0)
- {}
+ {
+ audio.reset (new AudioDecoder (this, content->audio, false, log));
+ }
bool pass (PassReason, bool)
{
@@ -81,7 +82,7 @@ public:
}
}
- audio (_test_audio_content->audio->stream(), buffers, ContentTime::from_frames (_position, 48000));
+ audio->audio (_test_audio_content->audio->stream(), buffers, ContentTime::from_frames (_position, 48000));
_position += N;
return N < 2000;
@@ -89,7 +90,7 @@ public:
void seek (ContentTime t, bool accurate)
{
- AudioDecoder::seek (t, accurate);
+ audio->seek (t, accurate);
_position = t.frames_round (_test_audio_content->audio->resampled_frame_rate ());
}
@@ -105,7 +106,7 @@ static ContentAudio
get (Frame from, Frame length)
{
decoder->seek (ContentTime::from_frames (from, content->audio->resampled_frame_rate ()), true);
- ContentAudio ca = decoder->get_audio (content->audio->stream(), from, length, true);
+ ContentAudio ca = decoder->audio->get_audio (content->audio->stream(), from, length, true);
BOOST_CHECK_EQUAL (ca.frame, from);
return ca;
}
diff --git a/test/dcp_subtitle_test.cc b/test/dcp_subtitle_test.cc
index 8a4677162..80e0a3dd1 100644
--- a/test/dcp_subtitle_test.cc
+++ b/test/dcp_subtitle_test.cc
@@ -29,6 +29,8 @@
#include "lib/dcp_decoder.h"
#include "lib/dcp_content_type.h"
#include "lib/subtitle_content.h"
+#include "lib/content_subtitle.h"
+#include "lib/subtitle_decoder.h"
#include "test.h"
#include <iostream>
@@ -84,7 +86,7 @@ BOOST_AUTO_TEST_CASE (dcp_subtitle_within_dcp_test)
BOOST_CHECK_EQUAL (ctp.back().from, ContentTime::from_seconds (25 + 12 * 0.04));
BOOST_CHECK_EQUAL (ctp.back().to, ContentTime::from_seconds (26 + 4 * 0.04));
- list<ContentTextSubtitle> subs = decoder->get_text_subtitles (
+ list<ContentTextSubtitle> subs = decoder->subtitle->get_text_subtitles (
ContentTimePeriod (
ContentTime::from_seconds (25),
ContentTime::from_seconds (26)
diff --git a/test/ffmpeg_decoder_seek_test.cc b/test/ffmpeg_decoder_seek_test.cc
index 2a9b4da71..83efc4201 100644
--- a/test/ffmpeg_decoder_seek_test.cc
+++ b/test/ffmpeg_decoder_seek_test.cc
@@ -29,6 +29,8 @@
#include "lib/ffmpeg_decoder.h"
#include "lib/null_log.h"
#include "lib/film.h"
+#include "lib/content_video.h"
+#include "lib/video_decoder.h"
#include "test.h"
#include <boost/test/unit_test.hpp>
#include <boost/filesystem.hpp>
@@ -44,7 +46,7 @@ static void
check (shared_ptr<FFmpegDecoder> decoder, int frame)
{
list<ContentVideo> v;
- v = decoder->get_video (frame, true);
+ v = decoder->video->get_video (frame, true);
BOOST_CHECK (v.size() == 1);
BOOST_CHECK_EQUAL (v.front().frame, frame);
}
diff --git a/test/ffmpeg_decoder_sequential_test.cc b/test/ffmpeg_decoder_sequential_test.cc
index ac3064aa0..e1e29ab17 100644
--- a/test/ffmpeg_decoder_sequential_test.cc
+++ b/test/ffmpeg_decoder_sequential_test.cc
@@ -25,6 +25,8 @@
#include "lib/ffmpeg_content.h"
#include "lib/ffmpeg_decoder.h"
#include "lib/null_log.h"
+#include "lib/content_video.h"
+#include "lib/video_decoder.h"
#include "lib/film.h"
#include "test.h"
#include <boost/filesystem.hpp>
@@ -53,20 +55,20 @@ ffmpeg_decoder_sequential_test_one (boost::filesystem::path file, float fps, int
shared_ptr<Log> log (new NullLog);
shared_ptr<FFmpegDecoder> decoder (new FFmpegDecoder (content, log, false));
- BOOST_REQUIRE (decoder->_video_content->video_frame_rate());
- BOOST_CHECK_CLOSE (decoder->_video_content->video_frame_rate().get(), fps, 0.01);
+ BOOST_REQUIRE (decoder->video->_video_content->video_frame_rate());
+ BOOST_CHECK_CLOSE (decoder->video->_video_content->video_frame_rate().get(), fps, 0.01);
#ifdef DCPOMATIC_DEBUG
- decoder->test_gaps = 0;
+ decoder->video->test_gaps = 0;
#endif
for (Frame i = 0; i < video_length; ++i) {
list<ContentVideo> v;
- v = decoder->get_video (i, true);
+ v = decoder->video->get_video (i, true);
BOOST_REQUIRE_EQUAL (v.size(), 1U);
BOOST_CHECK_EQUAL (v.front().frame, i);
}
#ifdef DCPOMATIC_DEBUG
- BOOST_CHECK_EQUAL (decoder->test_gaps, gaps);
+ BOOST_CHECK_EQUAL (decoder->video->test_gaps, gaps);
#endif
}
diff --git a/test/seek_zero_test.cc b/test/seek_zero_test.cc
index 332c39db9..0c65fa3b8 100644
--- a/test/seek_zero_test.cc
+++ b/test/seek_zero_test.cc
@@ -30,6 +30,9 @@
#include "lib/ffmpeg_decoder.h"
#include "lib/ffmpeg_audio_stream.h"
#include "lib/content_video.h"
+#include "lib/video_content_scale.h"
+#include "lib/video_content.h"
+#include "lib/video_decoder.h"
#include "test.h"
#include <iostream>
@@ -61,7 +64,7 @@ BOOST_AUTO_TEST_CASE (seek_zero_test)
Frame const first_frame = video_delay.round_up (content->active_video_frame_rate ()).frames_round (content->active_video_frame_rate ());
FFmpegDecoder decoder (content, film->log(), false);
- list<ContentVideo> a = decoder.get_video (first_frame, true);
+ list<ContentVideo> a = decoder.video->get_video (first_frame, true);
BOOST_CHECK (a.size() == 1);
BOOST_CHECK_EQUAL (a.front().frame, first_frame);
}
diff --git a/test/video_decoder_fill_test.cc b/test/video_decoder_fill_test.cc
index 190a469d0..539392718 100644
--- a/test/video_decoder_fill_test.cc
+++ b/test/video_decoder_fill_test.cc
@@ -20,6 +20,8 @@
#include <boost/test/unit_test.hpp>
#include "lib/image_decoder.h"
#include "lib/image_content.h"
+#include "lib/content_video.h"
+#include "lib/video_decoder.h"
#include "lib/film.h"
#include "test.h"
#include <iostream>
@@ -34,19 +36,19 @@ BOOST_AUTO_TEST_CASE (video_decoder_fill_test1)
shared_ptr<ImageContent> c (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
ImageDecoder decoder (c, film->log());
- decoder.fill_one_eye (0, 4, EYES_BOTH);
- BOOST_CHECK_EQUAL (decoder._decoded_video.size(), 4U);
- list<ContentVideo>::iterator i = decoder._decoded_video.begin();
+ decoder.video->fill_one_eye (0, 4, EYES_BOTH);
+ BOOST_CHECK_EQUAL (decoder.video->_decoded_video.size(), 4U);
+ list<ContentVideo>::iterator i = decoder.video->_decoded_video.begin();
for (int j = 0; j < 4; ++j) {
BOOST_CHECK_EQUAL (i->frame, j);
++i;
}
- decoder._decoded_video.clear ();
+ decoder.video->_decoded_video.clear ();
- decoder.fill_one_eye (0, 7, EYES_BOTH);
- BOOST_CHECK_EQUAL (decoder._decoded_video.size(), 7);
- i = decoder._decoded_video.begin();
+ decoder.video->fill_one_eye (0, 7, EYES_BOTH);
+ BOOST_CHECK_EQUAL (decoder.video->_decoded_video.size(), 7);
+ i = decoder.video->_decoded_video.begin();
for (int j = 0; j < 7; ++j) {
BOOST_CHECK_EQUAL (i->frame, j);
++i;
@@ -59,18 +61,18 @@ BOOST_AUTO_TEST_CASE (video_decoder_fill_test2)
shared_ptr<ImageContent> c (new ImageContent (film, "test/data/simple_testcard_640x480.png"));
ImageDecoder decoder (c, film->log());
- decoder.fill_both_eyes (0, 4, EYES_LEFT);
- BOOST_CHECK_EQUAL (decoder._decoded_video.size(), 8);
- list<ContentVideo>::iterator i = decoder._decoded_video.begin();
+ decoder.video->fill_both_eyes (0, 4, EYES_LEFT);
+ BOOST_CHECK_EQUAL (decoder.video->_decoded_video.size(), 8);
+ list<ContentVideo>::iterator i = decoder.video->_decoded_video.begin();
for (int j = 0; j < 8; ++j) {
BOOST_CHECK_EQUAL (i->frame, j / 2);
BOOST_CHECK_EQUAL (i->eyes, (j % 2) == 0 ? EYES_LEFT : EYES_RIGHT);
++i;
}
- decoder.fill_both_eyes (0, 7, EYES_RIGHT);
- BOOST_CHECK_EQUAL (decoder._decoded_video.size(), 15);
- i = decoder._decoded_video.begin();
+ decoder.video->fill_both_eyes (0, 7, EYES_RIGHT);
+ BOOST_CHECK_EQUAL (decoder.video->_decoded_video.size(), 15);
+ i = decoder.video->_decoded_video.begin();
for (int j = 0; j < 15; ++j) {
BOOST_CHECK_EQUAL (i->frame, j / 2);
BOOST_CHECK_EQUAL (i->eyes, (j % 2) == 0 ? EYES_LEFT : EYES_RIGHT);