justburner 64e039
#pragma once
justburner 64e039
justburner 64e039
#ifndef TTIO_FFMPEG_MOV_INCLUDED
justburner 64e039
#define TTIO_FFMPEG_MOV_INCLUDED
justburner 64e039
justburner 64e039
#include "tproperty.h"
justburner 64e039
#include "tlevel_io.h"
justburner 64e039
#include "tiio_ffmpeg.h"
justburner 64e039
justburner 64e039
#include <qcoreapplication></qcoreapplication>
justburner 64e039
justburner 64e039
//===========================================================
justburner 64e039
//
justburner 64e039
//  TLevelWriterFFMov
justburner 64e039
//
justburner 64e039
//===========================================================
justburner 64e039
justburner 64e039
class TLevelWriterFFMov : public TLevelWriter {
justburner 64e039
public:
justburner 64e039
  TLevelWriterFFMov(const TFilePath &path, TPropertyGroup *winfo);
justburner 64e039
  ~TLevelWriterFFMov();
justburner 64e039
  void setFrameRate(double fps) override;
justburner 64e039
justburner 64e039
  TImageWriterP getFrameWriter(TFrameId fid) override;
justburner 64e039
  void save(const TImageP &image, int frameIndex);
justburner 64e039
justburner 64e039
  void saveSoundTrack(TSoundTrack *st) override;
justburner 64e039
justburner 64e039
  static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) {
justburner 64e039
    return new TLevelWriterFFMov(path, winfo);
justburner 64e039
  }
justburner 64e039
justburner 64e039
private:
justburner 64e039
  Ffmpeg *ffmpegWriter;
justburner 64e039
  int m_lx, m_ly;
justburner 64e039
  int m_scale;
justburner 64e039
  int m_vidQuality;
justburner 64e039
};
justburner 64e039
justburner 64e039
//===========================================================
justburner 64e039
//
justburner 64e039
//  TLevelReaderFFMov
justburner 64e039
//
justburner 64e039
//===========================================================
justburner 64e039
justburner 64e039
class TLevelReaderFFMov final : public TLevelReader {
justburner 64e039
public:
justburner 64e039
  TLevelReaderFFMov(const TFilePath &path);
justburner 64e039
  ~TLevelReaderFFMov();
justburner 64e039
  TImageReaderP getFrameReader(TFrameId fid) override;
justburner 64e039
justburner 64e039
  static TLevelReader *create(const TFilePath &f) {
justburner 64e039
    return new TLevelReaderFFMov(f);
justburner 64e039
  }
justburner 64e039
justburner 64e039
  TLevelP loadInfo() override;
justburner 64e039
  TImageP load(int frameIndex);
justburner 64e039
  TDimension getSize();
justburner 64e039
private:
justburner 64e039
  Ffmpeg *ffmpegReader;
justburner 64e039
  bool ffmpegFramesCreated = false;
justburner 64e039
  TDimension m_size;
justburner 64e039
  int m_frameCount, m_lx, m_ly;
justburner 64e039
};
justburner 64e039
justburner 64e039
//===========================================================================
justburner 64e039
justburner 64e039
namespace Tiio {
justburner 64e039
justburner 64e039
//===========================================================================
justburner 64e039
justburner 64e039
class FFMovWriterProperties : public TPropertyGroup {
justburner 64e039
  Q_DECLARE_TR_FUNCTIONS(FFMovWriterProperties)
justburner 64e039
public:
justburner 64e039
  TIntProperty m_vidQuality;
justburner 64e039
  TIntProperty m_scale;
justburner 64e039
  FFMovWriterProperties();
justburner 64e039
  void updateTranslation() override;
justburner 64e039
};
justburner 64e039
justburner 64e039
//===========================================================================
justburner 64e039
justburner 64e039
}  // namespace Tiio
justburner 64e039
justburner 64e039
#endif