diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-05-01 15:12:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-05-01 15:12:38 +0100 |
| commit | c45fd99b0b4a193edcebccc927793d48431a5a13 (patch) | |
| tree | 7556421400a4289aba44f552218433022b27af53 /test/stream_test.cc | |
| parent | 85f70dbf690a9f77189067e655b02283f910a36f (diff) | |
Use ffmpeg calls for pixel parameters; add (and alter, hmm) tests to suit.
Diffstat (limited to 'test/stream_test.cc')
| -rw-r--r-- | test/stream_test.cc | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/test/stream_test.cc b/test/stream_test.cc new file mode 100644 index 000000000..b467dc9a2 --- /dev/null +++ b/test/stream_test.cc @@ -0,0 +1,52 @@ +/* + Copyright (C) 2013 Carl Hetherington <cth@carlh.net> + + 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. + + 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. + + 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. + +*/ + +BOOST_AUTO_TEST_CASE (stream_test) +{ + FFmpegAudioStream a ("ffmpeg 4 44100 1 hello there world", boost::optional<int> (1)); + BOOST_CHECK_EQUAL (a.id(), 4); + BOOST_CHECK_EQUAL (a.sample_rate(), 44100); + BOOST_CHECK_EQUAL (a.channel_layout(), 1); + BOOST_CHECK_EQUAL (a.name(), "hello there world"); + BOOST_CHECK_EQUAL (a.to_string(), "ffmpeg 4 44100 1 hello there world"); + + SndfileStream e ("external 44100 1", boost::optional<int> (1)); + BOOST_CHECK_EQUAL (e.sample_rate(), 44100); + BOOST_CHECK_EQUAL (e.channel_layout(), 1); + BOOST_CHECK_EQUAL (e.to_string(), "external 44100 1"); + + SubtitleStream s ("5 a b c", boost::optional<int> (1)); + BOOST_CHECK_EQUAL (s.id(), 5); + BOOST_CHECK_EQUAL (s.name(), "a b c"); + + shared_ptr<AudioStream> ff = audio_stream_factory ("ffmpeg 4 44100 1 hello there world", boost::optional<int> (1)); + shared_ptr<FFmpegAudioStream> cff = dynamic_pointer_cast<FFmpegAudioStream> (ff); + BOOST_CHECK (cff); + BOOST_CHECK_EQUAL (cff->id(), 4); + BOOST_CHECK_EQUAL (cff->sample_rate(), 44100); + BOOST_CHECK_EQUAL (cff->channel_layout(), 1); + BOOST_CHECK_EQUAL (cff->name(), "hello there world"); + BOOST_CHECK_EQUAL (cff->to_string(), "ffmpeg 4 44100 1 hello there world"); + + shared_ptr<AudioStream> fe = audio_stream_factory ("external 44100 1", boost::optional<int> (1)); + BOOST_CHECK_EQUAL (fe->sample_rate(), 44100); + BOOST_CHECK_EQUAL (fe->channel_layout(), 1); + BOOST_CHECK_EQUAL (fe->to_string(), "external 44100 1"); +} + |
