From 66c5ced902ad8298f8ae6518cce05962204e831e Mon Sep 17 00:00:00 2001 From: Jonathan Thomas Date: Mon, 28 Sep 2015 22:05:50 -0500 Subject: [PATCH] Windows now passes most unit tests. Added header macro to assist on passing correct test media paths to unit tests. Also added a new info parameter has_single_image, which is used to optomize the frame mapper class for images with long durations. --- include/ReaderBase.h | 39 +++++++++++++------------ include/Tests.h | 35 ++++++++++++++++++++++ include/WriterBase.h | 39 +++++++++++++------------ src/FFmpegWriter.cpp | 2 +- src/FrameMapper.cpp | 19 ++++++++++++ src/ImageReader.cpp | 1 + src/QtImageReader.cpp | 1 + src/ReaderBase.cpp | 5 ++++ src/WriterBase.cpp | 6 ++++ src/examples/Example.cpp | 56 +++++++++++++++++++++++++++--------- tests/CMakeLists.txt | 3 +- tests/Clip_Tests.cpp | 8 ++++-- tests/FFmpegReader_Tests.cpp | 20 +++++++++---- tests/FrameMapper_Tests.cpp | 4 ++- tests/ImageWriter_Tests.cpp | 6 ++-- tests/Timeline_Tests.cpp | 24 ++++++++++++---- tests/tests.cpp | 3 ++ 17 files changed, 201 insertions(+), 70 deletions(-) create mode 100644 include/Tests.h diff --git a/include/ReaderBase.h b/include/ReaderBase.h index b949c3f3..67c259b5 100644 --- a/include/ReaderBase.h +++ b/include/ReaderBase.h @@ -56,27 +56,28 @@ namespace openshot */ struct ReaderInfo { - bool has_video; ///< Determines if this file has a video stream - bool has_audio; ///< Determines if this file has an audio stream - float duration; ///< Length of time (in seconds) - long long file_size; ///< Size of file (in bytes) - int height; ///< The height of the video (in pixels) - int width; ///< The width of the video (in pixesl) - int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...) - Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps) - int video_bit_rate; ///< The bit rate of the video stream (in bytes) - Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) - Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) - string vcodec; ///< The name of the video codec used to encode / decode the video stream - long int video_length; ///< The number of frames in the video stream + bool has_video; ///< Determines if this file has a video stream + bool has_audio; ///< Determines if this file has an audio stream + bool has_single_image; ///< Determines if this file only contains a single image + float duration; ///< Length of time (in seconds) + long long file_size; ///< Size of file (in bytes) + int height; ///< The height of the video (in pixels) + int width; ///< The width of the video (in pixesl) + int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...) + Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps) + int video_bit_rate; ///< The bit rate of the video stream (in bytes) + Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) + Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) + string vcodec; ///< The name of the video codec used to encode / decode the video stream + long int video_length; ///< The number of frames in the video stream int video_stream_index; ///< The index of the video stream Fraction video_timebase; ///< The video timebase determines how long each frame stays on the screen - bool interlaced_frame; // Are the contents of this frame interlaced - bool top_field_first; // Which interlaced field should be displayed first - string acodec; ///< The name of the audio codec used to encode / decode the video stream - int audio_bit_rate; ///< The bit rate of the audio stream (in bytes) - int sample_rate; ///< The number of audio samples per second (44100 is a common sample rate) - int channels; ///< The number of audio channels used in the audio stream + bool interlaced_frame; // Are the contents of this frame interlaced + bool top_field_first; // Which interlaced field should be displayed first + string acodec; ///< The name of the audio codec used to encode / decode the video stream + int audio_bit_rate; ///< The bit rate of the audio stream (in bytes) + int sample_rate; ///< The number of audio samples per second (44100 is a common sample rate) + int channels; ///< The number of audio channels used in the audio stream ChannelLayout channel_layout; ///< The channel layout (mono, stereo, 5 point surround, etc...) int audio_stream_index; ///< The index of the audio stream Fraction audio_timebase; ///< The audio timebase determines how long each audio packet should be played diff --git a/include/Tests.h b/include/Tests.h new file mode 100644 index 00000000..b7d9dbf5 --- /dev/null +++ b/include/Tests.h @@ -0,0 +1,35 @@ +/** + * @file + * @brief Header file for UnitTests + * @author Jonathan Thomas + * + * @section LICENSE + * + * Copyright (c) 2008-2014 OpenShot Studios, LLC + * . This file is part of + * OpenShot Library (libopenshot), an open-source project dedicated to + * delivering high quality video editing and animation solutions to the + * world. For more information visit . + * + * OpenShot Library (libopenshot) is free software: you can redistribute it + * and/or modify it under the terms of the GNU Lesser General Public License + * as published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * OpenShot Library (libopenshot) 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 Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with OpenShot Library. If not, see . + */ + +#ifndef OPENSHOT_UNITTESTS_H +#define OPENSHOT_UNITTESTS_H + + #ifndef TEST_MEDIA_PATH + #define TEST_MEDIA_PATH "../../src/examples/" + #endif + +#endif diff --git a/include/WriterBase.h b/include/WriterBase.h index 1a931989..8516158e 100644 --- a/include/WriterBase.h +++ b/include/WriterBase.h @@ -47,27 +47,28 @@ namespace openshot */ struct WriterInfo { - bool has_video; ///< Determines if this file has a video stream - bool has_audio; ///< Determines if this file has an audio stream - float duration; ///< Length of time (in seconds) - int file_size; ///< Size of file (in bytes) - int height; ///< The height of the video (in pixels) - int width; ///< The width of the video (in pixels) - int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...) - Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps) - int video_bit_rate; ///< The bit rate of the video stream (in bytes) - Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) - Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) - string vcodec; ///< The name of the video codec used to encode / decode the video stream - long int video_length; ///< The number of frames in the video stream + bool has_video; ///< Determines if this file has a video stream + bool has_audio; ///< Determines if this file has an audio stream + bool has_single_image; ///< Determines if this file only contains a single image + float duration; ///< Length of time (in seconds) + int file_size; ///< Size of file (in bytes) + int height; ///< The height of the video (in pixels) + int width; ///< The width of the video (in pixels) + int pixel_format; ///< The pixel format (i.e. YUV420P, RGB24, etc...) + Fraction fps; ///< Frames per second, as a fraction (i.e. 24/1 = 24 fps) + int video_bit_rate; ///< The bit rate of the video stream (in bytes) + Fraction pixel_ratio; ///< The pixel ratio of the video stream as a fraction (i.e. some pixels are not square) + Fraction display_ratio; ///< The ratio of width to height of the video stream (i.e. 640x480 has a ratio of 4/3) + string vcodec; ///< The name of the video codec used to encode / decode the video stream + long int video_length; ///< The number of frames in the video stream int video_stream_index; ///< The index of the video stream Fraction video_timebase; ///< The video timebase determines how long each frame stays on the screen - bool interlaced_frame; // Are the contents of this frame interlaced - bool top_field_first; // Which interlaced field should be displayed first - string acodec; ///< The name of the audio codec used to encode / decode the video stream - int audio_bit_rate; ///< The bit rate of the audio stream (in bytes) - int sample_rate; ///< The number of audio samples per second (44100 is a common sample rate) - int channels; ///< The number of audio channels used in the audio stream + bool interlaced_frame; ///< Are the contents of this frame interlaced + bool top_field_first; ///< Which interlaced field should be displayed first + string acodec; ///< The name of the audio codec used to encode / decode the video stream + int audio_bit_rate; ///< The bit rate of the audio stream (in bytes) + int sample_rate; ///< The number of audio samples per second (44100 is a common sample rate) + int channels; ///< The number of audio channels used in the audio stream ChannelLayout channel_layout; ///< The channel layout (mono, stereo, 5 point surround, etc...) int audio_stream_index; ///< The index of the audio stream Fraction audio_timebase; ///< The audio timebase determines how long each audio packet should be played diff --git a/src/FFmpegWriter.cpp b/src/FFmpegWriter.cpp index b2aee34b..07f78a41 100644 --- a/src/FFmpegWriter.cpp +++ b/src/FFmpegWriter.cpp @@ -1335,7 +1335,7 @@ void FFmpegWriter::write_audio_packets(bool final) } // deallocate AVFrame - free(frame_final->data[0]); // TODO: Determine why av_free crashes on Windows + //free(frame_final->data[0]); // TODO: Determine why av_free crashes on Windows AV_FREE_FRAME(&frame_final); // deallocate memory for packet diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index 5fa688a3..ff44bbfb 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -79,6 +79,11 @@ void FrameMapper::Init() { AppendDebugMethod("FrameMapper::Init (Calculate frame mappings)", "", -1, "", -1, "", -1, "", -1, "", -1, "", -1); + // Do not initialize anything if just a picture with no audio + if (info.has_video and !info.has_audio and info.has_single_image) + // Skip initialization + return; + // Clear the fields & frames lists fields.clear(); frames.clear(); @@ -285,6 +290,20 @@ void FrameMapper::Init() MappedFrame FrameMapper::GetMappedFrame(long int TargetFrameNumber) throw(OutOfBoundsFrame) { + // Ignore mapping on single image readers + if (info.has_video and !info.has_audio and info.has_single_image) { + // Return the same number + MappedFrame frame; + frame.Even.Frame = TargetFrameNumber; + frame.Odd.Frame = TargetFrameNumber; + frame.Samples.frame_start = 0; + frame.Samples.frame_end = 0; + frame.Samples.sample_start = 0; + frame.Samples.sample_end = 0; + frame.Samples.total = 0; + return frame; + } + // Check if frame number is valid if(TargetFrameNumber < 1 || frames.size() == 0) // frame too small, return error diff --git a/src/ImageReader.cpp b/src/ImageReader.cpp index 98876af5..39ceda24 100644 --- a/src/ImageReader.cpp +++ b/src/ImageReader.cpp @@ -60,6 +60,7 @@ void ImageReader::Open() throw(InvalidFile) // Update image properties info.has_audio = false; info.has_video = true; + info.has_single_image = true; info.file_size = image->fileSize(); info.vcodec = image->format(); info.width = image->size().width(); diff --git a/src/QtImageReader.cpp b/src/QtImageReader.cpp index 4fd13ddd..277cee3f 100644 --- a/src/QtImageReader.cpp +++ b/src/QtImageReader.cpp @@ -56,6 +56,7 @@ void QtImageReader::Open() throw(InvalidFile) // Update image properties info.has_audio = false; info.has_video = true; + info.has_single_image = true; info.file_size = image->byteCount(); info.vcodec = "QImage"; info.width = image->width(); diff --git a/src/ReaderBase.cpp b/src/ReaderBase.cpp index 46333dc5..9acdc882 100644 --- a/src/ReaderBase.cpp +++ b/src/ReaderBase.cpp @@ -35,6 +35,7 @@ ReaderBase::ReaderBase() // Initialize info struct info.has_video = false; info.has_audio = false; + info.has_single_image = false; info.duration = 0.0; info.file_size = 0; info.height = 0; @@ -140,6 +141,7 @@ void ReaderBase::DisplayInfo() { cout << "----------------------------" << endl; cout << "--> Has Video: " << info.has_video << endl; cout << "--> Has Audio: " << info.has_audio << endl; + cout << "--> Has Single Image: " << info.has_single_image << endl; cout << "--> Duration: " << info.duration << " Seconds" << endl; cout << "--> File Size: " << double(info.file_size) / 1024 / 1024 << " MB" << endl; cout << "----------------------------" << endl; @@ -178,6 +180,7 @@ Json::Value ReaderBase::JsonValue() { Json::Value root; root["has_video"] = info.has_video; root["has_audio"] = info.has_audio; + root["has_single_image"] = info.has_single_image; root["duration"] = info.duration; stringstream filesize_stream; filesize_stream << info.file_size; @@ -227,6 +230,8 @@ void ReaderBase::SetJsonValue(Json::Value root) { info.has_video = root["has_video"].asBool(); if (!root["has_audio"].isNull()) info.has_audio = root["has_audio"].asBool(); + if (!root["has_single_image"].isNull()) + info.has_single_image = root["has_single_image"].asBool(); if (!root["duration"].isNull()) info.duration = root["duration"].asDouble(); if (!root["file_size"].isNull()) diff --git a/src/WriterBase.cpp b/src/WriterBase.cpp index fb631a4d..2ed49832 100644 --- a/src/WriterBase.cpp +++ b/src/WriterBase.cpp @@ -35,6 +35,7 @@ WriterBase::WriterBase() // Initialized writer info info.has_video = false; info.has_audio = false; + info.has_single_image = false; info.duration = 0.0; info.file_size = 0; info.height = 0; @@ -133,6 +134,7 @@ void WriterBase::CopyReaderInfo(ReaderBase* reader) { info.has_video = reader->info.has_video; info.has_audio = reader->info.has_audio; + info.has_single_image = reader->info.has_single_image; info.duration = reader->info.duration; info.file_size = reader->info.file_size; info.height = reader->info.height; @@ -170,6 +172,7 @@ void WriterBase::DisplayInfo() { cout << "----------------------------" << endl; cout << "--> Has Video: " << info.has_video << endl; cout << "--> Has Audio: " << info.has_audio << endl; + cout << "--> Has Single Image: " << info.has_single_image << endl; cout << "--> Duration: " << info.duration << " Seconds" << endl; cout << "--> File Size: " << double(info.file_size) / 1024 / 1024 << " MB" << endl; cout << "----------------------------" << endl; @@ -215,6 +218,7 @@ Json::Value WriterBase::JsonValue() { Json::Value root; root["has_video"] = info.has_video; root["has_audio"] = info.has_audio; + root["has_single_image"] = info.has_single_image; root["duration"] = info.duration; stringstream filesize_stream; filesize_stream << info.file_size; @@ -287,6 +291,8 @@ void WriterBase::SetJsonValue(Json::Value root) { info.has_video = root["has_video"].asBool(); if (!root["has_audio"].isNull()) info.has_audio = root["has_audio"].asBool(); + if (!root["has_single_image"].isNull()) + info.has_single_image = root["has_single_image"].asBool(); if (!root["duration"].isNull()) info.duration = root["duration"].asDouble(); if (!root["file_size"].isNull()) diff --git a/src/examples/Example.cpp b/src/examples/Example.cpp index eb875b05..eeef13c4 100644 --- a/src/examples/Example.cpp +++ b/src/examples/Example.cpp @@ -38,41 +38,69 @@ int main(int argc, char* argv[]) { // Create a reader - string path = "C:\\Users\\Jonathan\\Apps\\libopenshot\\src\\examples\\sintel_trailer-720p.mp4"; + string path = "C:\\Users\\Jonathan\\Apps\\libopenshot-git\\src\\examples\\sintel_trailer-720p.mp4"; cout << path << endl; - Clip clip_video("C:\\Users\\Jonathan\\Apps\\libopenshot\\src\\examples\\sintel_trailer-720p.mp4"); + Clip clip_video(path); clip_video.Layer(0); clip_video.Position(0.0); -//// Clip clip_overlay("/home/jonathan/apps/libopenshot-git/src/examples/front3.png"); -//// clip_overlay.Layer(1); -//// //clip_overlay.Position(0.05); // Delay the overlay by 0.05 seconds -//// clip_overlay.End(0.5); // Make the duration of the overlay 1/2 second -// + Clip clip_overlay("C:\\Users\\Jonathan\\Apps\\libopenshot-git\\src\\examples\\front3.png"); + clip_overlay.Layer(1); + clip_overlay.Position(0.05); + // Create a timeline Timeline r9(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO); r9.debug = false; // // // Add clips r9.AddClip(&clip_video); -// //t.AddClip(&clip_overlay); + r9.AddClip(&clip_overlay); // Open Timeline r9.Open(); cout << " --> 1" << endl; - r9.GetFrame(1); + r9.GetFrame(1)->Save("pic1.png", 1.0); cout << " --> 500" << endl; r9.GetFrame(500); cout << "1034" << endl; r9.GetFrame(1034); -// cout << "1" << endl; -// t.GetFrame(1); -// cout << "1200" << endl; -// t.GetFrame(1200); + cout << "1" << endl; + r9.GetFrame(1); + cout << "1200" << endl; + r9.GetFrame(1200)->Save("pic2.png", 1.0); + + + /* WRITER ---------------- */ + FFmpegWriter w("output1.webm"); + + // Set options + w.SetAudioOptions(true, "libvorbis", 44100, 2, LAYOUT_STEREO, 188000); + w.SetVideoOptions(true, "libvpx", Fraction(24,1), 1280, 720, Fraction(1,1), false, false, 3000000); + + // Open writer + w.Open(); + + // Prepare Streams +// w.PrepareStreams(); // +// w.SetOption(VIDEO_STREAM, "qmin", "2" ); +// w.SetOption(VIDEO_STREAM, "qmax", "30" ); +// w.SetOption(VIDEO_STREAM, "crf", "10" ); +// w.SetOption(VIDEO_STREAM, "rc_min_rate", "2000000" ); +// w.SetOption(VIDEO_STREAM, "rc_max_rate", "4000000" ); +// w.SetOption(VIDEO_STREAM, "max_b_frames", "10" ); // -// return 0; +// // Write header +// w.WriteHeader(); + + // Write some frames + w.WriteFrame(&r9, 24, 50); + + // Close writer & reader + w.Close(); + + return 0; // // FFmpegReader r110("/home/jonathan/Videos/PlaysTV/Team Fortress 2/2015_07_06_22_43_16-ses.mp4"); // r110.Open(); diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 4bf59fe4..60d1dafb 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -29,7 +29,8 @@ # Set some compiler options for Windows # required for libopenshot-audio headers IF (WIN32) - add_definitions( -DIGNORE_JUCE_HYPOT=1 ) + STRING(REPLACE "/" "\\\\" TEST_MEDIA_PATH "${openshot_SOURCE_DIR}/src/examples/") + add_definitions( -DIGNORE_JUCE_HYPOT=1 -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH}" ) SET(CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -march=i686 -include cmath -std=c++0x") ENDIF(WIN32) diff --git a/tests/Clip_Tests.cpp b/tests/Clip_Tests.cpp index cb4b503d..3f919811 100644 --- a/tests/Clip_Tests.cpp +++ b/tests/Clip_Tests.cpp @@ -49,7 +49,9 @@ TEST(Clip_Default_Constructor) TEST(Clip_Constructor) { // Create a empty clip - Clip c1("../../src/examples/piano.wav"); + stringstream path; + path << TEST_MEDIA_PATH << "piano.wav"; + Clip c1(path.str()); c1.Open(); // Check basic settings @@ -202,7 +204,9 @@ TEST(Clip_Properties) TEST(Clip_Effects) { // Load clip with video - Clip c10("../../src/examples/sintel_trailer-720p.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; + Clip c10(path.str()); c10.Open(); Negate n; diff --git a/tests/FFmpegReader_Tests.cpp b/tests/FFmpegReader_Tests.cpp index a6f37579..1e22a89a 100644 --- a/tests/FFmpegReader_Tests.cpp +++ b/tests/FFmpegReader_Tests.cpp @@ -40,7 +40,9 @@ TEST(FFmpegReader_Invalid_Path) TEST(FFmpegReader_GetFrame_Before_Opening) { // Create a reader - FFmpegReader r("../../src/examples/piano.wav"); + stringstream path; + path << TEST_MEDIA_PATH << "piano.wav"; + FFmpegReader r(path.str()); // Check invalid path CHECK_THROW(r.GetFrame(1), ReaderClosed); @@ -49,7 +51,9 @@ TEST(FFmpegReader_GetFrame_Before_Opening) TEST(FFmpegReader_Check_Audio_File) { // Create a reader - FFmpegReader r("../../src/examples/piano.wav"); + stringstream path; + path << TEST_MEDIA_PATH << "piano.wav"; + FFmpegReader r(path.str()); r.Open(); // Get frame 1 @@ -77,7 +81,9 @@ TEST(FFmpegReader_Check_Audio_File) TEST(FFmpegReader_Check_Video_File) { // Create a reader - FFmpegReader r("../../src/examples/test.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "test.mp4"; + FFmpegReader r(path.str()); r.Open(); // Get frame 1 @@ -113,7 +119,9 @@ TEST(FFmpegReader_Check_Video_File) TEST(FFmpegReader_Seek) { // Create a reader - FFmpegReader r("../../src/examples/sintel_trailer-720p.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; + FFmpegReader r(path.str()); r.Open(); // Get frame @@ -168,7 +176,9 @@ TEST(FFmpegReader_Seek) TEST(FFmpegReader_Multiple_Open_and_Close) { // Create a reader - FFmpegReader r("../../src/examples/sintel_trailer-720p.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; + FFmpegReader r(path.str()); r.Open(); // Get frame that requires a seek diff --git a/tests/FrameMapper_Tests.cpp b/tests/FrameMapper_Tests.cpp index db9778ec..3e90e629 100644 --- a/tests/FrameMapper_Tests.cpp +++ b/tests/FrameMapper_Tests.cpp @@ -179,7 +179,9 @@ TEST(FrameMapper_30_fps_to_24_fps_Pulldown_None) TEST(FrameMapper_resample_audio_48000_to_41000) { // Create a reader: 24 fps, 2 channels, 48000 sample rate - FFmpegReader r("../../src/examples/sintel_trailer-720p.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; + FFmpegReader r(path.str()); // Map to 30 fps, 3 channels surround, 44100 sample rate FrameMapper map(&r, Fraction(30,1), PULLDOWN_NONE, 44100, 3, LAYOUT_SURROUND); diff --git a/tests/ImageWriter_Tests.cpp b/tests/ImageWriter_Tests.cpp index 5f82bd1c..6274a111 100644 --- a/tests/ImageWriter_Tests.cpp +++ b/tests/ImageWriter_Tests.cpp @@ -31,10 +31,12 @@ using namespace std; using namespace openshot; -TEST(ImageWriter_Test_Webm) +TEST(ImageWriter_Test_Gif) { // Reader - FFmpegReader r("../../src/examples/sintel_trailer-720p.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "sintel_trailer-720p.mp4"; + FFmpegReader r(path.str()); r.Open(); /* WRITER ---------------- */ diff --git a/tests/Timeline_Tests.cpp b/tests/Timeline_Tests.cpp index 4c8b661b..074459d3 100644 --- a/tests/Timeline_Tests.cpp +++ b/tests/Timeline_Tests.cpp @@ -87,11 +87,15 @@ TEST(Timeline_Framerate) TEST(Timeline_Check_Two_Track_Video) { // Create a reader - Clip clip_video("../../src/examples/test.mp4"); + stringstream path; + path << TEST_MEDIA_PATH << "test.mp4"; + Clip clip_video(path.str()); clip_video.Layer(0); clip_video.Position(0.0); - Clip clip_overlay("../../src/examples/front3.png"); + stringstream path_overlay; + path_overlay << TEST_MEDIA_PATH << "front3.png"; + Clip clip_overlay(path_overlay.str()); clip_overlay.Layer(1); clip_overlay.Position(0.05); // Delay the overlay by 0.05 seconds clip_overlay.End(0.5); // Make the duration of the overlay 1/2 second @@ -208,15 +212,21 @@ TEST(Timeline_Clip_Order) Timeline t(640, 480, Fraction(30, 1), 44100, 2, LAYOUT_STEREO); // Add some clips out of order - Clip clip_top("../../src/examples/front3.png"); + stringstream path_top; + path_top << TEST_MEDIA_PATH << "front3.png"; + Clip clip_top(path_top.str()); clip_top.Layer(2); t.AddClip(&clip_top); - Clip clip_middle("../../src/examples/front.png"); + stringstream path_middle; + path_middle << TEST_MEDIA_PATH << "front.png"; + Clip clip_middle(path_middle.str()); clip_middle.Layer(0); t.AddClip(&clip_middle); - Clip clip_bottom("../../src/examples/back.png"); + stringstream path_bottom; + path_bottom << TEST_MEDIA_PATH << "back.png"; + Clip clip_bottom(path_bottom.str()); clip_bottom.Layer(1); t.AddClip(&clip_bottom); @@ -250,7 +260,9 @@ TEST(Timeline_Clip_Order) } // Add another clip - Clip clip_middle1("../../src/examples/interlaced.png"); + stringstream path_middle1; + path_middle1 << TEST_MEDIA_PATH << "interlaced.png"; + Clip clip_middle1(path_middle1.str()); clip_middle1.Layer(1); clip_middle1.Position(0.5); t.AddClip(&clip_middle1); diff --git a/tests/tests.cpp b/tests/tests.cpp index 510f5641..dde58985 100644 --- a/tests/tests.cpp +++ b/tests/tests.cpp @@ -32,6 +32,9 @@ using namespace std; using namespace UnitTest; +#include "../include/Tests.h" + + int main() { cout << "----------------------------" << endl;