2008-09-17 03:46:38 +02:00
|
|
|
|
/*
|
|
|
|
|
|
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
|
|
|
|
|
2008-09-17 03:46:38 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
2017-02-22 01:54:20 +01:00
|
|
|
|
/** @file teststreamtypes.hpp
|
|
|
|
|
|
** Unit test helper to create fake streamtype information
|
2016-11-03 18:20:10 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
|
|
|
|
|
#ifndef LUMIERA_TEST_TESTSTREAMTYPES_H
|
|
|
|
|
|
#define LUMIERA_TEST_TESTSTREAMTYPES_H
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-12-18 04:47:41 +01:00
|
|
|
|
//#include "lib/util.hpp"
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2018-11-15 23:42:43 +01:00
|
|
|
|
#include "steam/streamtype.hpp"
|
|
|
|
|
|
#include "steam/control/stypemanager.hpp"
|
2018-11-17 18:00:39 +01:00
|
|
|
|
#include "lib/time/timevalue.hpp"
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2008-09-25 21:48:43 +02:00
|
|
|
|
extern "C" {
|
|
|
|
|
|
#include <gavl/gavl.h>
|
|
|
|
|
|
}
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace steam {
|
2011-12-02 17:50:44 +01:00
|
|
|
|
namespace test_format {
|
2008-09-25 21:48:43 +02:00
|
|
|
|
|
2018-11-17 18:00:39 +01:00
|
|
|
|
using lib::time::TimeValue;
|
|
|
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
|
namespace { // constants used to parametrise tests
|
|
|
|
|
|
|
|
|
|
|
|
const int TEST_IMG_WIDTH = 40;
|
|
|
|
|
|
const int TEST_IMG_HEIGHT = 30;
|
2008-09-25 21:48:43 +02:00
|
|
|
|
|
2018-11-17 18:00:39 +01:00
|
|
|
|
const int TEST_FRAME_DUR = TimeValue::SCALE / 25;
|
2011-12-02 17:50:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
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;
|
2008-09-25 21:48:43 +02:00
|
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
|
type.pixelformat = GAVL_RGB_24;
|
|
|
|
|
|
type.interlace_mode = GAVL_INTERLACE_NONE;
|
|
|
|
|
|
type.framerate_mode = GAVL_FRAMERATE_CONSTANT;
|
|
|
|
|
|
type.chroma_placement = GAVL_CHROMA_PLACEMENT_DEFAULT;
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
|
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
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2018-11-17 18:00:39 +01:00
|
|
|
|
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)
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2018-11-17 18:00:39 +01:00
|
|
|
|
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)
|
2008-09-17 03:46:38 +02:00
|
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
|
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);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
}} // namespace steam::test_format
|
2008-09-17 03:46:38 +02:00
|
|
|
|
#endif
|