Lumiera  0.pre.03
»edit your freedom«
teststreamtypes.hpp
Go to the documentation of this file.
1 /*
2  TESTSTREAMTYPES.hpp - create test (stub) stream type information
3 
4  Copyright (C) Lumiera.org
5  2008, Hermann Vosseler <Ichthyostega@web.de>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 
21 */
22 
28 #ifndef LUMIERA_TEST_TESTSTREAMTYPES_H
29 #define LUMIERA_TEST_TESTSTREAMTYPES_H
30 
31 
32 //#include "lib/util.hpp"
33 
34 #include "steam/streamtype.hpp"
36 #include "lib/time/timevalue.hpp"
37 
38 extern "C" {
39 #include <gavl/gavl.h>
40 }
41 
42 
43 namespace steam {
44 namespace test_format {
45 
47 
48  namespace { // constants used to parametrise tests
49 
50  const int TEST_IMG_WIDTH = 40;
51  const int TEST_IMG_HEIGHT = 30;
52 
53  const int TEST_FRAME_DUR = TimeValue::SCALE / 25;
54  }
55 
56  Symbol GAVL = "GAVL";
57 
58 
59 
63  inline gavl_video_format_t
65  {
66  gavl_video_format_t type;
67 
68  type.pixelformat = GAVL_RGB_24;
69  type.interlace_mode = GAVL_INTERLACE_NONE;
70  type.framerate_mode = GAVL_FRAMERATE_CONSTANT;
71  type.chroma_placement = GAVL_CHROMA_PLACEMENT_DEFAULT;
72 
73  type.image_width = TEST_IMG_WIDTH; // Width of the image in pixels
74  type.image_height = TEST_IMG_WIDTH; // Height of the image in pixels
75  type.frame_width = TEST_IMG_WIDTH; // Width of the frame buffer in pixels, might be larger than image_width
76  type.frame_height = TEST_IMG_WIDTH; // Height of the frame buffer in pixels, might be larger than image_height
77 
78  type.pixel_width = 1; // Relative width of a pixel (pixel aspect ratio is pixel_width/pixel_height)
79  type.pixel_height = 1; // Relative height of a pixel (pixel aspect ratio is pixel_width/pixel_height)
80 
81  type.frame_duration = TEST_FRAME_DUR; // Duration of a frame in timescale ticks.
82  type.timescale = TimeValue::SCALE; // Timescale in ticks per second (is defined to be 1000000 as of 9/2008)
83 
84  return type;
85  }
86 
87 
91  inline StreamType::ImplFacade const&
93  {
94  gavl_video_format_t rawType = test_createRawType();
95  return control::STypeManager::instance().getImpl (GAVL, rawType);
96  }
97 
98 
99 
100 }} // namespace steam::test_format
101 #endif
Framework for classification of media streams.
static const gavl_time_t SCALE
Number of micro ticks (µs) per second as basic time scale.
Definition: timevalue.hpp:176
Steam-Layer implementation namespace root.
Interface to the stream type system.
A (more or less) concrete implementation type, wired up as a facade providing the basic set of operat...
Definition: streamtype.hpp:108
static lib::Depend< STypeManager > instance
access the system-wide stream type manager instance.
gavl_video_format_t test_createRawType()
Helper: create an raw GAVL type descriptor usable for generating a Lumiera StreamType.
Token or Atom with distinct identity.
Definition: symbol.hpp:126
a family of time value like entities and their relationships.
basic constant internal time value.
Definition: timevalue.hpp:142
StreamType::ImplFacade const & test_createImplType()
Helper: create an implementation frame and build the corresponding streamtype.