bool VideoEncoderX264or5::configure(int bitrate_, int fps_, int gop_, int lookahead_, int threads_, bool annexB_, std::string preset_)
{
    if (bitrate_ <= 0 || gop_ <= 0 || lookahead_ < 0 || threads_ <= 0 || preset_.empty()) {
        utils::errorMsg("Error configuring VideoEncoderX264or5: invalid configuration values");
        return false;
    }

    bitrate = bitrate_;
    gop = gop_;
    lookahead = lookahead_;
    threads = threads_;
    annexB = annexB_;
    preset = preset_;

    if (fps_ <= 0) {
        fps = VIDEO_DEFAULT_FRAMERATE;
        setFrameTime(std::chrono::nanoseconds(0));
    } else {
        fps = fps_;
        setFrameTime(std::chrono::nanoseconds(std::nano::den/fps));
    }

    needsConfig = true;
    return true;
}
Exemplo n.º 2
0
void NiAnimation::stopRecording()
{
    is_recording = false;
    setFPS(DEFAULT_FPS);
    setNumberOfFrames(current_frame);
    setFrameTime(frameTime());
}
Exemplo n.º 3
0
	void Sprite::init(SDL_Surface* image, int frames, int frameTime, int w, int h)
	{
		setImage( image );
		setFrames( frames - 1 );
		setFrameTime( frameTime );
		setSize( w, h );
	}
Exemplo n.º 4
0
//*************************************************************************************************
//! Constructor used when accessing a common video object (versus instantiating a new video for
//! each frame.
//*************************************************************************************************
ossimVideoImageSource::ossimVideoImageSource(ossimVideoSource* /* video */, 
                                             const double& frame_time_seconds)
:  m_frameTime (-1.0)
{
   initialize();
   setFrameTime(frame_time_seconds);
}
Exemplo n.º 5
0
void GrimEngine::luaUpdate() {
	// Update timing information
	unsigned newStart = g_system->getMillis();
	if (newStart < _frameStart) {
		_frameStart = newStart;
		return;
	}
	_frameTime = newStart - _frameStart;
	_frameStart = newStart;

	_frameTimeCollection += _frameTime;
	if (_frameTimeCollection > 10000) {
		_frameTimeCollection = 0;
		lua_collectgarbage(0);
	}

	lua_beginblock();
	setFrameTime(_frameTime);
	lua_endblock();

	lua_beginblock();
	setMovieTime(_movieTime);
	lua_endblock();

	// Run asynchronous tasks
	lua_runtasks();
}
Exemplo n.º 6
0
//*************************************************************************************************
// Indirectly sets the frame time given a frame index from the start frame.
//! Returns false if frame time is outside of allowable range.
//*************************************************************************************************
bool ossimVideoImageSource::setCurrentEntry(ossim_uint32 frame_number)
{
   if (!m_video)
      return false;

   ossim_float64 frame_rate = m_video->videoFrameRate();
   ossim_float64 frameTime =  frame_number / frame_rate;
   return setFrameTime(frameTime);
}
Exemplo n.º 7
0
void LevelMainCharacter::load()
{
	setBoundingBox(sf::FloatRect(0.f, 0.f, 30.f, 100.f));
	setSpriteOffset(sf::Vector2f(-25.f, -20.f));

	Animation walkingAnimation;
	walkingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_mainChar));
	walkingAnimation.addFrame(sf::IntRect(0, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(80, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(160, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(240, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(320, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(400, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(480, 0, 80, 120));
	walkingAnimation.addFrame(sf::IntRect(560, 0, 80, 120));

	addAnimation(GameObjectState::Walking, walkingAnimation);

	Animation idleAnimation;
	idleAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_mainChar));
	idleAnimation.addFrame(sf::IntRect(640, 0, 80, 120));

	addAnimation(GameObjectState::Idle, idleAnimation);

	Animation jumpingAnimation;
	jumpingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_mainChar));
	jumpingAnimation.addFrame(sf::IntRect(720, 0, 80, 120));

	addAnimation(GameObjectState::Jumping, jumpingAnimation);

	Animation fightingAnimation;
	fightingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_mainChar));
	fightingAnimation.addFrame(sf::IntRect(800, 0, 80, 120));
	fightingAnimation.addFrame(sf::IntRect(880, 0, 80, 120));
	fightingAnimation.addFrame(sf::IntRect(960, 0, 80, 120));
	fightingAnimation.addFrame(sf::IntRect(1040, 0, 80, 120));
	fightingAnimation.addFrame(sf::IntRect(1040, 0, 80, 120));

	addAnimation(GameObjectState::Fighting, fightingAnimation);

	Animation deadAnimation;
	deadAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_mainChar));
	deadAnimation.addFrame(sf::IntRect(1120, 0, 80, 120));

	addAnimation(GameObjectState::Dead, deadAnimation);

	setFrameTime(sf::seconds(0.07f));

	// initial values
	m_state = GameObjectState::Idle;
	m_isFacingRight = true;
	setCurrentAnimation(getAnimation(m_state), !m_isFacingRight);
	playCurrentAnimation(true);

	setDebugBoundingBox(sf::Color::White);
}
Exemplo n.º 8
0
Animation::Animation(BVH* newBVH,const QString& bvhFile) :
  frame(0),totalFrames(0),mirrored(false)
{
  qDebug("Animation::Animation(%px)",this);

  bvh=newBVH;
  if(!bvh)
  {
    qDebug("Animation::Animation(): BVH initialisation failed.");
    return;
  }

  QString fileName;

  // pick up path from src.pro qmake file's DEFINES section, i.e. usr/share/qavimator
  //dataPath=QAVIMATOR_DATAPATH;
#ifdef __APPLE__
  dataPath=QApplication::applicationDirPath() + "/../Resources";
#else
  dataPath=QAVIMATOR_DATAPATH;
#endif

  // load BVH that defines motion
  if (!bvhFile.isEmpty())
    fileName=bvhFile;
  else
    fileName=dataPath+"/"+DEFAULT_POSE;

  loadBVH(fileName);
  calcPartMirrors();
  useRotationLimits(true);
  setNumberOfFrames(bvh->lastLoadedNumberOfFrames);
  setAvatarScale(bvh->lastLoadedAvatarScale);
  setFigureType(bvh->lastLoadedFigureType);
  setLoopInPoint(bvh->lastLoadedLoopIn);
  setLoopOutPoint(bvh->lastLoadedLoopOut);
  setFrameTime(bvh->lastLoadedFrameTime);
  positionNode=bvh->lastLoadedPositionNode;
  addKeyFrameAllJoints();

  ikTree.set(frames);
  setIK(IK_LHAND, false);
  setIK(IK_RHAND, false);
  setIK(IK_LFOOT, false);
  setIK(IK_RFOOT, false);

  setLoop(false);
  setDirty(false);

  currentPlayTime=0.0;
  setPlaystate(PLAYSTATE_STOPPED);

  connect(&timer,SIGNAL(timeout()),this,SLOT(playbackTimeout()));
}
Exemplo n.º 9
0
VideoMixer::VideoMixer(FilterRole fRole_, bool sharedFrames, int framerate, int inputChannels, 
                       int outputWidth, int outputHeight, size_t fTime) :
ManyToOneFilter(fRole_, sharedFrames, inputChannels, fTime, true)
{
    this->outputWidth = outputWidth;
    this->outputHeight = outputHeight;
    fType = VIDEO_MIXER;
    maxChannels = inputChannels;
    setFrameTime(std::chrono::nanoseconds(std::nano::den/framerate));

    layoutImg = cv::Mat(outputHeight, outputWidth, CV_8UC3);
    initializeEventMap();
}
Exemplo n.º 10
0
void FireRatEnemy::load()
{
	setBoundingBox(sf::FloatRect(0.f, 0.f, 40.f, 30.f));
	setSpriteOffset(sf::Vector2f(-5.f, -20.f));

	Animation walkingAnimation;
	walkingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_enemy_firerat));
	walkingAnimation.addFrame(sf::IntRect(0, 0, 50, 50));
	walkingAnimation.addFrame(sf::IntRect(50, 0, 50, 50));
	walkingAnimation.addFrame(sf::IntRect(100, 0, 50, 50));
	walkingAnimation.addFrame(sf::IntRect(50, 0, 50, 50));

	addAnimation(GameObjectState::Walking, walkingAnimation);

	Animation idleAnimation;
	idleAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_enemy_firerat));
	idleAnimation.addFrame(sf::IntRect(50, 0, 50, 50));
	idleAnimation.addFrame(sf::IntRect(300, 0, 50, 50));

	addAnimation(GameObjectState::Idle, idleAnimation);

	Animation jumpingAnimation;
	jumpingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_enemy_firerat));
	jumpingAnimation.addFrame(sf::IntRect(150, 0, 50, 50));

	addAnimation(GameObjectState::Jumping, jumpingAnimation);

	Animation fightingAnimation;
	fightingAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_enemy_firerat));
	fightingAnimation.addFrame(sf::IntRect(200, 0, 50, 50));
	fightingAnimation.addFrame(sf::IntRect(250, 0, 50, 50));

	addAnimation(GameObjectState::Fighting, fightingAnimation);

	Animation deadAnimation;
	deadAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_enemy_firerat));
	deadAnimation.addFrame(sf::IntRect(350, 0, 50, 50));

	addAnimation(GameObjectState::Dead, deadAnimation);

	setFrameTime(sf::seconds(0.08f));

	// initial values
	m_state = GameObjectState::Idle;
	m_isFacingRight = true;
	setCurrentAnimation(getAnimation(m_state), !m_isFacingRight);
	playCurrentAnimation(true);
}
Exemplo n.º 11
0
void LuaBase::update(int frameTime, int movieTime) {
	_frameTimeCollection += frameTime;
	if (_frameTimeCollection > 10000) {
		_frameTimeCollection = 0;
		lua_collectgarbage(0);
	}

	lua_beginblock();
	setFrameTime(frameTime);
	lua_endblock();

	lua_beginblock();
	setMovieTime(movieTime);
	lua_endblock();

	// Run asynchronous tasks
	lua_runtasks();
}
Exemplo n.º 12
0
void FearSpell::load(const SpellBean& bean, LevelMovableGameObject* mob, const sf::Vector2f& target)
{
	setSpriteOffset(sf::Vector2f(-10.f, -10.f));

	Animation spellAnimation;
	spellAnimation.setSpriteSheet(g_resourceManager->getTexture(ResourceID::Texture_spell_fear));
	spellAnimation.addFrame(sf::IntRect(0, 0, 30, 30));
	spellAnimation.addFrame(sf::IntRect(30, 0, 30, 30));

	addAnimation(GameObjectState::Idle, spellAnimation);

	setFrameTime(sf::seconds(0.1f));

	// initial values
	setCurrentAnimation(getAnimation(GameObjectState::Idle), false);
	playCurrentAnimation(true);

	Spell::load(bean, mob, target);
}
Exemplo n.º 13
0
Frog::Frog(float x, float y, sf::Texture &s) : DynamicGameEntity(x, y, s){
	setFrameTime(sf::seconds(0.07));

	facingRight = -1;
	gravity = 20;
	moveSpeed = 50;
	jumpSpeed = -3;

	setSign(false);

	type = entityTypes::NPC;

	//boundingBox
	boundingBox.top = 20;
	boundingBox.height = 11;
	boundingBox.left = 7;
	boundingBox.width = 16;

	facingRight = true;
}
Exemplo n.º 14
0
void ModelMd2::setFrame(float time)
{
	setFrameTime(time);
}
Exemplo n.º 15
0
void AnimatedMesh::restart()
{
	setFrame(0);
	setFrameTime(0);
}