/* Blinker
   Copyright 2011-2019 Stefan Schuermans <stefan@blinkenarea.org>
   Copyleft GNU public license - http://www.gnu.org/copyleft/gpl.html
   a blinkenarea.org project */

#ifndef BLINKER_PLAYERMOVIE_H
#define BLINKER_PLAYERMOVIE_H

#include <string>

#include <BlinkenLib/BlinkenFrame.h>
#include <BlinkenLib/BlinkenMovie.h>

#include "File.h"
#include "Player.h"

namespace Blinker {

/// movie in player's playlist
class Player::Movie
{
public:
  /**
   * @brief constructor
   * @param[in] player owning player module
   * @param[in] name name of movie
   * @param[in] file movie file
   */
  Movie(Player &player, const std::string &name,
        const File &file);

  /// destructor
  ~Movie();

private:
  /// copy constructor disabled
  Movie(const Movie &that);

  /// assignment operator disabled
  const Movie & operator=(const Movie &that);

public:
  /// check for update of configuration
  void updateConfig();

protected:
  /// load movie from current file
  void load();

  /// free current movie
  void free();

  /// if this is the only movie in playlist go to begin of this movie
  void ifOnlyGoHere();

  /// if this is current movie go to begin of next movie
  void ifCurGoNext();

protected:
  Player         &m_player; ///< owning player module
  std::string    m_name;    ///< name of movie
  File           m_file;    ///< movie file

public:
  stBlinkenMovie *m_pMovie; ///< loaded movie object
}; // class Player::Movie

} // namespace Blinker

#endif // #ifndef BLINKER_PLAYERMOVIE_H

