turtletooth 04d8fd
#pragma once
turtletooth 04d8fd
turtletooth 04d8fd
#ifndef TTIO_WEBM_INCLUDED
turtletooth 04d8fd
#define TTIO_WEBM_INCLUDED
turtletooth 04d8fd
turtletooth 04d8fd
#include "tproperty.h"
turtletooth 04d8fd
#include "tlevel_io.h"
turtletooth 04d8fd
#include "tiio_ffmpeg.h"
shun-iwasawa e87e08
#include <qcoreapplication></qcoreapplication>
turtletooth 04d8fd
turtletooth 04d8fd
//===========================================================
turtletooth 04d8fd
//
turtletooth 04d8fd
//  TLevelWriterWebm
turtletooth 04d8fd
//
turtletooth 04d8fd
//===========================================================
turtletooth 04d8fd
turtletooth 04d8fd
class TLevelWriterWebm : public TLevelWriter {
turtletooth 04d8fd
public:
turtletooth 04d8fd
  TLevelWriterWebm(const TFilePath &path, TPropertyGroup *winfo);
turtletooth 04d8fd
  ~TLevelWriterWebm();
turtletooth 04d8fd
  void setFrameRate(double fps);
turtletooth 04d8fd
turtletooth 04d8fd
  TImageWriterP getFrameWriter(TFrameId fid) override;
turtletooth 04d8fd
  void save(const TImageP &image, int frameIndex);
turtletooth 04d8fd
turtletooth 04d8fd
  void saveSoundTrack(TSoundTrack *st);
turtletooth 04d8fd
turtletooth 04d8fd
  static TLevelWriter *create(const TFilePath &path, TPropertyGroup *winfo) {
turtletooth 04d8fd
    return new TLevelWriterWebm(path, winfo);
turtletooth 04d8fd
  }
turtletooth 04d8fd
turtletooth 04d8fd
private:
turtletooth 04d8fd
  Ffmpeg *ffmpegWriter;
turtletooth 04d8fd
  int m_lx, m_ly;
turtletooth 04d8fd
  int m_scale;
turtletooth 04d8fd
  int m_vidQuality;
turtletooth 04d8fd
  // void *m_buffer;
turtletooth 04d8fd
};
turtletooth 04d8fd
turtletooth 04d8fd
//===========================================================
turtletooth 04d8fd
//
turtletooth 04d8fd
//  TLevelReaderWebm
turtletooth 04d8fd
//
turtletooth 04d8fd
//===========================================================
turtletooth 04d8fd
turtletooth 04d8fd
class TLevelReaderWebm final : public TLevelReader {
turtletooth 04d8fd
public:
turtletooth 04d8fd
  TLevelReaderWebm(const TFilePath &path);
turtletooth 04d8fd
  ~TLevelReaderWebm();
turtletooth 04d8fd
  TImageReaderP getFrameReader(TFrameId fid) override;
turtletooth 04d8fd
turtletooth 04d8fd
  static TLevelReader *create(const TFilePath &f) {
turtletooth 04d8fd
    return new TLevelReaderWebm(f);
turtletooth 04d8fd
  }
turtletooth 04d8fd
turtletooth 04d8fd
  TLevelP loadInfo() override;
turtletooth 04d8fd
  TImageP load(int frameIndex);
turtletooth 04d8fd
  TDimension getSize();
turtletooth 04d8fd
  // TThread::Mutex m_mutex;
turtletooth 04d8fd
  // void *m_decompressedBuffer;
turtletooth 04d8fd
private:
turtletooth 04d8fd
  Ffmpeg *ffmpegReader;
turtletooth 04d8fd
  TDimension m_size;
turtletooth 04d8fd
  int m_frameCount, m_lx, m_ly;
turtletooth 04d8fd
};
turtletooth 04d8fd
turtletooth 04d8fd
//===========================================================================
turtletooth 04d8fd
turtletooth 04d8fd
namespace Tiio {
turtletooth 04d8fd
turtletooth 04d8fd
//===========================================================================
turtletooth 04d8fd
turtletooth 04d8fd
class WebmWriterProperties : public TPropertyGroup {
shun-iwasawa e87e08
  Q_DECLARE_TR_FUNCTIONS(WebmWriterProperties)
turtletooth 04d8fd
public:
turtletooth 04d8fd
  // TEnumProperty m_pixelSize;
turtletooth 04d8fd
  // TBoolProperty m_matte;
shun-iwasawa 27b0cf
  TIntProperty m_vidQuality;
shun-iwasawa 27b0cf
  TIntProperty m_scale;
turtletooth 04d8fd
  WebmWriterProperties();
shun-iwasawa e87e08
  void updateTranslation() override;
turtletooth 04d8fd
};
turtletooth 04d8fd
turtletooth 04d8fd
//===========================================================================
turtletooth 04d8fd
turtletooth 04d8fd
// Tiio::Reader *makeWebmReader();
turtletooth 04d8fd
// Tiio::Writer *makeWebmWriter();
turtletooth 04d8fd
turtletooth 04d8fd
}  // namespace
turtletooth 04d8fd
turtletooth 04d8fd
#endif