2008-09-12 03:42:32 +02:00
|
|
|
/*
|
|
|
|
|
STREAMTYPE.hpp - classification of media stream types
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
Copyright (C) Lumiera.org
|
|
|
|
|
2008, Hermann Vosseler <Ichthyostega@web.de>
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
|
modify it under the terms of the GNU General Public License as
|
2010-12-17 23:28:49 +01:00
|
|
|
published by the Free Software Foundation; either version 2 of
|
|
|
|
|
the License, or (at your option) any later version.
|
|
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
This program 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 General Public License for more details.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
2010-12-17 23:28:49 +01:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
*/
|
|
|
|
|
|
2008-09-13 03:59:36 +02:00
|
|
|
/** @file streamtype.hpp
|
|
|
|
|
** Framework for classification of media streams.
|
|
|
|
|
** Besides the actual implementation type of a media stream, the Proc-Layer
|
|
|
|
|
** needs a more general way for accessing, comparing and manipulating media streams
|
|
|
|
|
** based on type information.
|
|
|
|
|
**
|
|
|
|
|
** @see control::STypeManager
|
|
|
|
|
**
|
|
|
|
|
*/
|
|
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
|
2011-12-02 17:50:44 +01:00
|
|
|
#ifndef PROC_STREAMTYPE_H
|
|
|
|
|
#define PROC_STREAMTYPE_H
|
2008-09-12 03:42:32 +02:00
|
|
|
|
2009-09-24 23:02:40 +02:00
|
|
|
#include "lib/symbol.hpp"
|
2012-12-01 08:44:07 +01:00
|
|
|
//#include "common/query.hpp"
|
2015-07-02 19:24:44 +02:00
|
|
|
#include "lib/idi/entry-id.hpp"
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
#include <boost/noncopyable.hpp>
|
|
|
|
|
|
|
|
|
|
|
2011-12-02 16:10:03 +01:00
|
|
|
namespace proc {
|
2009-09-24 23:02:40 +02:00
|
|
|
|
|
|
|
|
using lib::Symbol;
|
2015-08-15 16:49:02 +02:00
|
|
|
|
|
|
|
|
// "yes mummy, we all know this code is not finished yet..."
|
2015-08-16 00:16:30 +02:00
|
|
|
#pragma GCC diagnostic push
|
2015-08-15 16:49:02 +02:00
|
|
|
#pragma GCC diagnostic ignored "-Wuninitialized"
|
2009-09-24 23:02:40 +02:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
/**
|
2015-08-15 16:49:02 +02:00
|
|
|
* @todo this is just a draft to show the general idea....
|
2008-09-12 03:42:32 +02:00
|
|
|
*/
|
|
|
|
|
struct StreamType : boost::noncopyable
|
|
|
|
|
{
|
|
|
|
|
enum MediaKind
|
|
|
|
|
{
|
|
|
|
|
VIDEO,
|
|
|
|
|
IMMAGE,
|
|
|
|
|
AUDIO,
|
|
|
|
|
MIDI
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
enum Usage
|
|
|
|
|
{
|
|
|
|
|
RAW,
|
|
|
|
|
SOURCE,
|
|
|
|
|
TARGET,
|
|
|
|
|
INTERMEDIARY
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Prototype;
|
|
|
|
|
|
|
|
|
|
class ImplFacade;
|
2008-09-15 05:40:13 +02:00
|
|
|
class ImplConstraint;
|
2008-09-12 03:42:32 +02:00
|
|
|
|
2015-07-02 19:13:50 +02:00
|
|
|
typedef lib::idi::EntryID<StreamType> ID;
|
2010-12-10 17:39:39 +01:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
Prototype const& prototype;
|
2008-10-06 07:26:43 +02:00
|
|
|
ImplFacade * implType; /////////////TODO: really by ptr???
|
2008-09-13 06:00:22 +02:00
|
|
|
Usage intentionTag;
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
};
|
2015-08-15 16:49:02 +02:00
|
|
|
#pragma GCC diagnostic pop
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
struct StreamType::Prototype
|
|
|
|
|
{
|
|
|
|
|
Symbol id;
|
2008-09-28 04:05:10 +02:00
|
|
|
MediaKind kind;
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
bool subsumes (Prototype const& other) const;
|
2008-09-28 04:05:10 +02:00
|
|
|
bool canRender (Prototype const& other) const;
|
2008-09-12 03:42:32 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2008-09-28 04:05:10 +02:00
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
|
|
|
|
|
/**
|
2008-09-15 05:40:13 +02:00
|
|
|
* A (more or less) concrete implementation type, wired up
|
|
|
|
|
* as a facade providing the basic set of operations.
|
2008-09-12 03:42:32 +02:00
|
|
|
*/
|
|
|
|
|
class StreamType::ImplFacade
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
Symbol libraryID;
|
|
|
|
|
|
2008-09-26 04:57:20 +02:00
|
|
|
class TypeTag ;
|
2008-09-22 06:42:10 +02:00
|
|
|
|
2011-06-21 04:24:01 +02:00
|
|
|
/**
|
|
|
|
|
* 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.
|
|
|
|
|
*/
|
2008-09-22 06:42:10 +02:00
|
|
|
struct DataBuffer { };
|
2008-09-28 04:05:10 +02:00
|
|
|
|
2008-09-22 06:42:10 +02:00
|
|
|
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual bool operator== (ImplFacade const& other) const =0;
|
|
|
|
|
virtual bool operator== (StreamType const& other) const =0;
|
2008-09-15 05:40:13 +02:00
|
|
|
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual bool canConvert (ImplFacade const& other) const =0;
|
|
|
|
|
virtual bool canConvert (StreamType const& other) const =0;
|
2008-09-15 05:40:13 +02:00
|
|
|
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual DataBuffer* createFrame () const =0;
|
2008-09-28 04:05:10 +02:00
|
|
|
virtual MediaKind getKind() const =0;
|
2008-09-15 05:40:13 +02:00
|
|
|
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual ~ImplFacade() {};
|
|
|
|
|
|
|
|
|
|
protected:
|
|
|
|
|
ImplFacade (Symbol libID) ;
|
2008-09-15 05:40:13 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
2009-08-31 12:16:47 +02:00
|
|
|
* Special case of an implementation type being only partially specified
|
2008-09-26 04:57:20 +02:00
|
|
|
* Besides requiring some aspect of the implementation type, there is the
|
|
|
|
|
* promise to fill in defaults to build a complete implementation type
|
|
|
|
|
* if necessary.
|
2008-09-15 05:40:13 +02:00
|
|
|
*/
|
|
|
|
|
class StreamType::ImplConstraint
|
|
|
|
|
: public StreamType::ImplFacade
|
|
|
|
|
{
|
|
|
|
|
public:
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual bool canConvert (ImplFacade const& other) const =0;
|
|
|
|
|
virtual bool canConvert (StreamType const& other) const =0;
|
2008-09-13 06:00:22 +02:00
|
|
|
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual bool subsumes (ImplFacade const& other) const =0;
|
2008-09-13 06:00:22 +02:00
|
|
|
|
2008-09-15 05:40:13 +02:00
|
|
|
/** modify the other impl type such as to comply with this constraint */
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual void makeCompliant (ImplFacade & other) const =0;
|
2008-09-15 05:40:13 +02:00
|
|
|
|
|
|
|
|
/** create a default impl type in accordance to this constraint
|
|
|
|
|
* and use it to create a new framebuffer */
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual DataBuffer* createFrame () const =0;
|
2008-09-28 04:05:10 +02:00
|
|
|
|
2010-12-10 17:39:39 +01:00
|
|
|
/** Similarly create a impl type which complies to this constraint
|
2008-09-15 05:40:13 +02:00
|
|
|
* as well as to the additional constraints (e.g. frame size).
|
2010-12-10 17:39:39 +01:00
|
|
|
* Create a new frame buffer of the resulting type */
|
2008-09-22 04:03:37 +02:00
|
|
|
virtual DataBuffer* createFrame (ImplConstraint const& furtherConstraints) const =0;
|
2008-09-13 06:00:22 +02:00
|
|
|
|
2008-09-22 06:42:10 +02:00
|
|
|
//TODO: do we need functions to represent and describe this constraint?
|
|
|
|
|
|
2008-09-12 03:42:32 +02:00
|
|
|
};
|
2008-09-26 04:57:20 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* opaque placeholder (type erasure)
|
|
|
|
|
* for implementation specific type info.
|
|
|
|
|
* Intended to be passed to a concrete
|
2009-09-24 23:02:40 +02:00
|
|
|
* MediaImplLib to build an ImplFacade.
|
2008-09-26 04:57:20 +02:00
|
|
|
*/
|
|
|
|
|
class StreamType::ImplFacade::TypeTag
|
|
|
|
|
{
|
|
|
|
|
void* rawTypeStruct_;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
Symbol libraryID;
|
|
|
|
|
|
|
|
|
|
template<class TY>
|
|
|
|
|
TypeTag (Symbol lID, TY& rawType)
|
|
|
|
|
: rawTypeStruct_(&rawType),
|
|
|
|
|
libraryID(lID)
|
|
|
|
|
{ }
|
|
|
|
|
};
|
2008-09-12 03:42:32 +02:00
|
|
|
|
2008-09-28 04:05:10 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2011-12-02 16:10:03 +01:00
|
|
|
} // namespace proc
|
2015-06-30 03:06:17 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace lumiera {
|
|
|
|
|
using proc::StreamType;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endif /*PROC_STREAMTYPE_H*/
|