LUMIERA.clone/src/steam/streamtype.hpp
Ichthyostega 806db414dd 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

193 lines
4.8 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*
STREAMTYPE.hpp - classification of media stream types
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.
*/
/** @file streamtype.hpp
** Framework for classification of media streams.
** Besides the actual implementation type of a media stream, the Steam-Layer
** needs a more general way for accessing, comparing and manipulating media streams
** based on type information.
**
** @see control::STypeManager
**
*/
#ifndef STEAM_STREAMTYPE_H
#define STEAM_STREAMTYPE_H
#include "lib/symbol.hpp"
//#include "common/query.hpp"
#include "lib/idi/entry-id.hpp"
namespace steam {
using lib::Symbol;
// "yes mummy, we all know this code is not finished yet..."
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wuninitialized"
/**
* @todo this is just a draft to show the general idea....
*/
struct StreamType
: util::NonCopyable
{
enum MediaKind
{
VIDEO,
IMMAGE,
AUDIO,
MIDI
};
enum Usage
{
RAW,
SOURCE,
TARGET,
TRANSIENT
};
struct Prototype;
class ImplFacade;
class ImplConstraint;
using ID = lib::idi::EntryID<StreamType>;
Prototype const& prototype;
ImplFacade * implType; /////////////TODO: really by ptr???
Usage intentionTag;
};
#pragma GCC diagnostic pop
/**
*
*/
struct StreamType::Prototype
{
Symbol id;
MediaKind kind;
bool subsumes (Prototype const& other) const;
bool canRender (Prototype const& other) const;
};
/**
* A (more or less) concrete implementation type, wired up
* as a facade providing the basic set of operations.
*/
class StreamType::ImplFacade
{
public:
Symbol libraryID;
class TypeTag ;
/**
* placeholder type for the contents of a data buffer.
* The actual buffer will always be provided by a
* library implementation; throughout the engine,
* it's just hidden behind a DataBuffer pointer.
*/
struct DataBuffer { };
virtual bool operator== (ImplFacade const& other) const =0;
virtual bool operator== (StreamType const& other) const =0;
virtual bool canConvert (ImplFacade const& other) const =0;
virtual bool canConvert (StreamType const& other) const =0;
virtual DataBuffer* createFrame () const =0;
virtual MediaKind getKind() const =0;
virtual ~ImplFacade() {};
protected:
ImplFacade (Symbol libID) ;
};
/**
* Special case of an implementation type being only partially specified
* Besides requiring some aspect of the implementation type, there is the
* promise to fill in defaults to build a complete implementation type
* if necessary.
*/
class StreamType::ImplConstraint
: public StreamType::ImplFacade
{
public:
virtual bool canConvert (ImplFacade const& other) const =0;
virtual bool canConvert (StreamType const& other) const =0;
virtual bool subsumes (ImplFacade const& other) const =0;
/** modify the other impl type such as to comply with this constraint */
virtual void makeCompliant (ImplFacade & other) const =0;
/** create a default impl type in accordance to this constraint
* and use it to create a new framebuffer */
virtual DataBuffer* createFrame () const =0;
/** Similarly create a impl type which complies to this constraint
* as well as to the additional constraints (e.g. frame size).
* Create a new frame buffer of the resulting type */
virtual DataBuffer* createFrame (ImplConstraint const& furtherConstraints) const =0;
//TODO: do we need functions to represent and describe this constraint?
};
/**
* opaque placeholder (type erasure)
* for implementation specific type info.
* Intended to be passed to a concrete
* MediaImplLib to build an ImplFacade.
*/
class StreamType::ImplFacade::TypeTag
{
void* rawTypeStruct_;
public:
Symbol libraryID;
template<class TY>
TypeTag (Symbol lID, TY& rawType)
: rawTypeStruct_(&rawType),
libraryID(lID)
{ }
};
} // namespace steam
namespace lumiera {
using steam::StreamType;
}
#endif /*STEAM_STREAMTYPE_H*/