LUMIERA.clone/tests/basics/teststreamtypes.hpp

93 lines
2.7 KiB
C++
Raw Normal View History

/*
TESTSTREAMTYPES.hpp - create test (stub) stream type information
2010-12-17 23:28:49 +01:00
Copyright: clarify and simplify the file headers * Lumiera source code always was copyrighted by individual contributors * there is no entity "Lumiera.org" which holds any copyrights * Lumiera source code is provided under the GPL Version 2+ == Explanations == Lumiera as a whole is distributed under Copyleft, GNU General Public License Version 2 or above. For this to become legally effective, the ''File COPYING in the root directory is sufficient.'' The licensing header in each file is not strictly necessary, yet considered good practice; attaching a licence notice increases the likeliness that this information is retained in case someone extracts individual code files. However, it is not by the presence of some text, that legally binding licensing terms become effective; rather the fact matters that a given piece of code was provably copyrighted and published under a license. Even reformatting the code, renaming some variables or deleting parts of the code will not alter this legal situation, but rather creates a derivative work, which is likewise covered by the GPL! The most relevant information in the file header is the notice regarding the time of the first individual copyright claim. By virtue of this initial copyright, the first author is entitled to choose the terms of licensing. All further modifications are permitted and covered by the License. The specific wording or format of the copyright header is not legally relevant, as long as the intention to publish under the GPL remains clear. The extended wording was based on a recommendation by the FSF. It can be shortened, because the full terms of the license are provided alongside the distribution, in the file COPYING.
2024-11-17 23:42:55 +01:00
Copyright (C)
2008, Hermann Vosseler <Ichthyostega@web.de>
  **Lumiera** 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. See the file COPYING for further details.
2010-12-17 23:28:49 +01:00
*/
/** @file teststreamtypes.hpp
** Unit test helper to create fake streamtype information
*/
#ifndef LUMIERA_TEST_TESTSTREAMTYPES_H
#define LUMIERA_TEST_TESTSTREAMTYPES_H
//#include "lib/util.hpp"
#include "steam/streamtype.hpp"
#include "steam/control/stypemanager.hpp"
#include "lib/time/timevalue.hpp"
extern "C" {
#include <gavl/gavl.h>
}
namespace steam {
namespace test_format {
using lib::time::TimeValue;
namespace { // constants used to parametrise tests
const int TEST_IMG_WIDTH = 40;
const int TEST_IMG_HEIGHT = 30;
const int TEST_FRAME_DUR = TimeValue::SCALE / 25;
}
Symbol GAVL = "GAVL";
/** Helper: create an raw GAVL type descriptor
* usable for generating a Lumiera StreamType
*/
inline gavl_video_format_t
test_createRawType ()
{
gavl_video_format_t type;
type.pixelformat = GAVL_RGB_24;
type.interlace_mode = GAVL_INTERLACE_NONE;
type.framerate_mode = GAVL_FRAMERATE_CONSTANT;
type.chroma_placement = GAVL_CHROMA_PLACEMENT_DEFAULT;
type.image_width = TEST_IMG_WIDTH; // Width of the image in pixels
type.image_height = TEST_IMG_WIDTH; // Height of the image in pixels
type.frame_width = TEST_IMG_WIDTH; // Width of the frame buffer in pixels, might be larger than image_width
type.frame_height = TEST_IMG_WIDTH; // Height of the frame buffer in pixels, might be larger than image_height
type.pixel_width = 1; // Relative width of a pixel (pixel aspect ratio is pixel_width/pixel_height)
type.pixel_height = 1; // Relative height of a pixel (pixel aspect ratio is pixel_width/pixel_height)
type.frame_duration = TEST_FRAME_DUR; // Duration of a frame in timescale ticks.
type.timescale = TimeValue::SCALE; // Timescale in ticks per second (is defined to be 1000000 as of 9/2008)
return type;
}
/** Helper: create an implementation frame
* and build the corresponding streamtype
*/
inline StreamType::ImplFacade const&
test_createImplType ()
{
gavl_video_format_t rawType = test_createRawType();
return control::STypeManager::instance().getImpl (GAVL, rawType);
}
}} // namespace steam::test_format
#endif