2007-08-08 04:50:02 +02:00
|
|
|
/*
|
|
|
|
|
Clip - a Media Clip
|
|
|
|
|
|
|
|
|
|
Copyright (C) CinelerraCV
|
|
|
|
|
2007, Christian Thaeter <ct@pipapo.org>
|
|
|
|
|
|
|
|
|
|
This program 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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
* *****************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "proc/mobject/session/clip.hpp"
|
2007-11-14 10:10:52 +01:00
|
|
|
#include "proc/assetmanager.hpp"
|
2007-11-13 03:37:58 +01:00
|
|
|
#include "proc/asset/media.hpp"
|
|
|
|
|
#include "proc/asset/clip.hpp"
|
2007-08-08 04:50:02 +02:00
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
namespace mobject
|
2007-08-08 04:50:02 +02:00
|
|
|
{
|
2007-08-09 18:51:47 +02:00
|
|
|
namespace session
|
2007-08-08 04:50:02 +02:00
|
|
|
{
|
2007-08-09 18:51:47 +02:00
|
|
|
|
2007-10-19 22:34:07 +02:00
|
|
|
/** new clip-MO linked with the given asset::Clip.
|
|
|
|
|
* Initially, this clip will cover the whole source media length.
|
|
|
|
|
*/
|
2007-11-14 10:10:52 +01:00
|
|
|
Clip::Clip (const asset::Clip& clipDef, const Media& mediaDef)
|
2007-10-19 22:34:07 +02:00
|
|
|
: start_(0),
|
2007-11-13 03:37:58 +01:00
|
|
|
mediaDef_(mediaDef),
|
2007-11-14 10:10:52 +01:00
|
|
|
clipDef_(clipDef)
|
2007-10-19 22:34:07 +02:00
|
|
|
{
|
2007-11-12 02:05:39 +01:00
|
|
|
setupLength();
|
2007-10-19 22:34:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2007-11-10 23:09:15 +01:00
|
|
|
/** implementing the common MObject self test.
|
|
|
|
|
* Length definition is consitent, underlying
|
|
|
|
|
* media def is accessible etc. */
|
|
|
|
|
bool
|
|
|
|
|
Clip::isValid () const
|
|
|
|
|
{
|
2007-11-20 05:20:01 +01:00
|
|
|
TODO ("check consistency of clip length def, implies accessing the underlying media def");
|
|
|
|
|
return length > 0;
|
2007-11-10 23:09:15 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2007-10-19 22:34:07 +02:00
|
|
|
void
|
|
|
|
|
Clip::setupLength()
|
|
|
|
|
{
|
2007-11-19 04:58:18 +01:00
|
|
|
TODO ("really calculate the length of a clip and set length field");
|
|
|
|
|
this->length = mediaDef_.getLength();
|
2007-10-19 22:34:07 +02:00
|
|
|
}
|
2007-11-13 03:37:58 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
PMedia
|
|
|
|
|
Clip::getMedia () const
|
|
|
|
|
{
|
2007-11-14 10:10:52 +01:00
|
|
|
return asset::AssetManager::getPtr (mediaDef_);
|
2007-11-13 03:37:58 +01:00
|
|
|
}
|
|
|
|
|
|
2007-10-19 22:34:07 +02:00
|
|
|
|
|
|
|
|
|
2007-08-09 18:51:47 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace mobject::session
|
|
|
|
|
|
|
|
|
|
} // namespace mobject
|