2007-09-22 16:44:50 +02:00
|
|
|
|
/*
|
2011-05-20 02:17:20 +02:00
|
|
|
|
MEDIA-ACCESS-FACADE.hpp - functions for querying media file and channels.
|
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
|
|
|
|
|
2007-09-22 16:44:50 +02:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2016-11-03 18:22:31 +01:00
|
|
|
|
/** @file media-access-facade.hpp
|
2016-11-03 19:37:34 +01:00
|
|
|
|
** Abstraction interface to query for a media file.
|
|
|
|
|
|
** The corresponding service allows to discover some properties like
|
|
|
|
|
|
** the kind and number of channels for a given file (name) ID, without
|
|
|
|
|
|
** touching any of the technical details related to file handling.
|
|
|
|
|
|
**
|
|
|
|
|
|
** @todo this was added as a draft and mock implementation in 2008
|
|
|
|
|
|
** and is only used sporadic for unit tests.
|
2016-11-03 18:20:10 +01:00
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
|
2018-11-15 23:52:02 +01:00
|
|
|
|
#ifndef VAULT_INTERFACE_MEDIA_ACCESS_FACADE_H
|
|
|
|
|
|
#define VAULT_INTERFACE_MEDIA_ACCESS_FACADE_H
|
2007-09-22 16:44:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
2008-12-27 00:53:35 +01:00
|
|
|
|
#include "lib/error.hpp"
|
2013-10-20 03:19:36 +02:00
|
|
|
|
#include "lib/depend.hpp"
|
2011-05-18 01:37:33 +02:00
|
|
|
|
#include "lib/time/timevalue.hpp"
|
2007-09-23 13:31:33 +02:00
|
|
|
|
|
2011-05-18 01:37:33 +02:00
|
|
|
|
#include <string>
|
2007-09-23 13:31:33 +02:00
|
|
|
|
|
2007-09-22 16:44:50 +02:00
|
|
|
|
|
2011-05-18 01:37:33 +02:00
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
namespace vault {
|
2011-05-18 01:37:33 +02:00
|
|
|
|
|
|
|
|
|
|
using lib::time::Duration;
|
|
|
|
|
|
using std::string;
|
2007-09-24 16:20:41 +02:00
|
|
|
|
|
2011-05-18 01:37:33 +02:00
|
|
|
|
struct MediaDesc;
|
2007-09-24 16:20:41 +02:00
|
|
|
|
struct ChanDesc;
|
2009-09-30 00:27:14 +02:00
|
|
|
|
|
|
|
|
|
|
|
2013-10-24 23:06:36 +02:00
|
|
|
|
/**************************************************************//**
|
2018-11-15 21:13:52 +01:00
|
|
|
|
* Interface to the vault layer:
|
2007-09-22 16:44:50 +02:00
|
|
|
|
* provides functions for querying (opening) a media file,
|
|
|
|
|
|
* detecting the channels or streams found within this file etc.
|
2018-11-15 21:13:52 +01:00
|
|
|
|
* Implementation delegating to the actual vault layer functions.
|
2007-09-24 16:20:41 +02:00
|
|
|
|
*
|
|
|
|
|
|
* convention: data passed by pointer is owned by the originator;
|
2011-05-18 01:37:33 +02:00
|
|
|
|
* it should be copied if needed beyond the control flow
|
2007-09-24 16:20:41 +02:00
|
|
|
|
* of the invoked function.
|
2007-09-22 16:44:50 +02:00
|
|
|
|
*/
|
2011-05-18 01:37:33 +02:00
|
|
|
|
class MediaAccessFacade
|
2007-09-22 16:44:50 +02:00
|
|
|
|
{
|
2011-05-18 01:37:33 +02:00
|
|
|
|
public:
|
2007-09-24 16:20:41 +02:00
|
|
|
|
typedef void* ChanHandle;
|
|
|
|
|
|
|
2013-10-20 03:19:36 +02:00
|
|
|
|
static lib::Depend<MediaAccessFacade> instance;
|
2007-09-23 13:31:33 +02:00
|
|
|
|
|
2009-09-30 00:27:14 +02:00
|
|
|
|
/** request for testing the denoted files accessibility
|
2007-09-24 16:20:41 +02:00
|
|
|
|
* @param name path and filename of the media file.
|
2011-05-18 01:37:33 +02:00
|
|
|
|
* @throw error::Invalid when passing empty filename,
|
|
|
|
|
|
* or in case the media file is inaccessible
|
|
|
|
|
|
* or otherwise inappropriate.
|
2007-09-24 16:20:41 +02:00
|
|
|
|
* @return opaque handle usable for querying channel
|
|
|
|
|
|
* information from this file, NULL if the
|
2009-09-30 00:27:14 +02:00
|
|
|
|
* file is not accessible.
|
2007-09-24 16:20:41 +02:00
|
|
|
|
*/
|
2011-05-18 01:37:33 +02:00
|
|
|
|
virtual MediaDesc& queryFile (string const& name) const;
|
2007-09-23 13:31:33 +02:00
|
|
|
|
|
2007-09-24 16:20:41 +02:00
|
|
|
|
/** request for information about the n-th channel
|
2009-09-30 00:27:14 +02:00
|
|
|
|
* of the file referred by FileHandle.
|
2007-09-24 16:20:41 +02:00
|
|
|
|
* @return ChanDesc which may contain \c NULL values if
|
|
|
|
|
|
* the file doesn't contain this much channels.
|
2007-09-25 23:39:46 +02:00
|
|
|
|
* @todo throw or return NULL-ChanDesc if Filehandle is invalid?
|
2007-09-24 16:20:41 +02:00
|
|
|
|
*/
|
2011-05-18 01:37:33 +02:00
|
|
|
|
virtual ChanDesc queryChannel (MediaDesc&, uint chanNo) const;
|
2007-09-24 16:20:41 +02:00
|
|
|
|
|
|
|
|
|
|
virtual ~MediaAccessFacade () {}
|
2007-09-22 16:44:50 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
2011-05-18 01:37:33 +02:00
|
|
|
|
|
|
|
|
|
|
/**
|
2011-12-23 03:55:01 +01:00
|
|
|
|
* Descriptor holding the global information record
|
|
|
|
|
|
* required for further handling this kind of media within Lumiera.
|
2011-05-18 01:37:33 +02:00
|
|
|
|
*/
|
|
|
|
|
|
struct MediaDesc
|
|
|
|
|
|
{
|
|
|
|
|
|
/** effectively usable duration.
|
|
|
|
|
|
* A clip created from this media will have this
|
|
|
|
|
|
* maximum duration. We expect to get media stream data
|
|
|
|
|
|
* from all channels within this limit.
|
|
|
|
|
|
*/
|
|
|
|
|
|
Duration length;
|
|
|
|
|
|
|
|
|
|
|
|
MediaDesc() : length(Duration::NIL) { }
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-09-24 16:20:41 +02:00
|
|
|
|
/**
|
|
|
|
|
|
* Description of one channel found in a
|
|
|
|
|
|
* media file; result of querying the channel.
|
|
|
|
|
|
*/
|
|
|
|
|
|
struct ChanDesc
|
|
|
|
|
|
{
|
|
|
|
|
|
/** identifier which can be used to create a name
|
|
|
|
|
|
* for the media asset corresponding to this channel.
|
|
|
|
|
|
* May be NULL or empty and need not be unique.
|
|
|
|
|
|
*/
|
|
|
|
|
|
const char* chanID;
|
|
|
|
|
|
|
2009-09-30 00:27:14 +02:00
|
|
|
|
/** identifier characterising the access method (or codec)
|
2007-09-24 16:20:41 +02:00
|
|
|
|
* needed to get at the media data. This should be rather
|
|
|
|
|
|
* a high level description of the media stream type,
|
|
|
|
|
|
* e.g. "H264" -- anyhow, it will be used to find a
|
|
|
|
|
|
* codec asset for this channel.
|
|
|
|
|
|
*/
|
|
|
|
|
|
const char* codecID;
|
|
|
|
|
|
|
|
|
|
|
|
/** opaque handle, which will be used later to open this
|
|
|
|
|
|
* channel and retrieve some frames from it
|
|
|
|
|
|
*/
|
|
|
|
|
|
MediaAccessFacade::ChanHandle handle;
|
|
|
|
|
|
|
|
|
|
|
|
ChanDesc (const char* chanName=0, const char* codec=0,
|
|
|
|
|
|
MediaAccessFacade::ChanHandle h=0)
|
|
|
|
|
|
: chanID(chanName),
|
|
|
|
|
|
codecID(codec),
|
|
|
|
|
|
handle(h)
|
|
|
|
|
|
{ }
|
|
|
|
|
|
};
|
2007-09-22 16:44:50 +02:00
|
|
|
|
|
2018-11-15 23:55:13 +01:00
|
|
|
|
} // namespace vault
|
2011-05-18 01:37:33 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace backend_interface {
|
|
|
|
|
|
|
2018-11-15 23:59:23 +01:00
|
|
|
|
using vault::MediaAccessFacade;
|
|
|
|
|
|
using vault::MediaDesc;
|
|
|
|
|
|
using vault::ChanDesc;
|
2007-09-22 16:44:50 +02:00
|
|
|
|
|
|
|
|
|
|
} // namespace backend_interface
|
|
|
|
|
|
#endif
|