|
turtletooth |
04d8fd |
#pragma once
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
#ifndef TTIO_MP4_INCLUDED
|
|
turtletooth |
04d8fd |
#define TTIO_MP4_INCLUDED
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
#include "tproperty.h"
|
|
turtletooth |
04d8fd |
#include "tlevel_io.h"
|
|
turtletooth |
04d8fd |
#include "tiio_ffmpeg.h"
|
|
turtletooth |
04d8fd |
|
|
shun-iwasawa |
e87e08 |
#include <qcoreapplication></qcoreapplication>
|
|
shun-iwasawa |
e87e08 |
|
|
turtletooth |
04d8fd |
//===========================================================
|
|
turtletooth |
04d8fd |
//
|
|
turtletooth |
04d8fd |
// TLevelWriterMp4
|
|
turtletooth |
04d8fd |
//
|
|
turtletooth |
04d8fd |
//===========================================================
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
class TLevelWriterMp4 : public TLevelWriter {
|
|
turtletooth |
04d8fd |
public:
|
|
turtletooth |
04d8fd |
TLevelWriterMp4(const TFilePath &path, TPropertyGroup *winfo);
|
|
turtletooth |
04d8fd |
~TLevelWriterMp4();
|
|
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 TLevelWriterMp4(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 |
// TLevelReaderMp4
|
|
turtletooth |
04d8fd |
//
|
|
turtletooth |
04d8fd |
//===========================================================
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
class TLevelReaderMp4 final : public TLevelReader {
|
|
turtletooth |
04d8fd |
public:
|
|
turtletooth |
04d8fd |
TLevelReaderMp4(const TFilePath &path);
|
|
turtletooth |
04d8fd |
~TLevelReaderMp4();
|
|
turtletooth |
04d8fd |
TImageReaderP getFrameReader(TFrameId fid) override;
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
static TLevelReader *create(const TFilePath &f) {
|
|
turtletooth |
04d8fd |
return new TLevelReaderMp4(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 Mp4WriterProperties : public TPropertyGroup {
|
|
shun-iwasawa |
e87e08 |
Q_DECLARE_TR_FUNCTIONS(Mp4WriterProperties)
|
|
turtletooth |
04d8fd |
public:
|
|
turtletooth |
04d8fd |
// TEnumProperty m_pixelSize;
|
|
turtletooth |
04d8fd |
// TBoolProperty m_matte;
|
|
turtletooth |
04d8fd |
TIntProperty m_vidQuality;
|
|
turtletooth |
04d8fd |
TIntProperty m_scale;
|
|
turtletooth |
04d8fd |
Mp4WriterProperties();
|
|
shun-iwasawa |
e87e08 |
void updateTranslation() override;
|
|
turtletooth |
04d8fd |
};
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
//===========================================================================
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
// Tiio::Reader *makeMp4Reader();
|
|
turtletooth |
04d8fd |
// Tiio::Writer *makeMp4Writer();
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
} // namespace
|
|
turtletooth |
04d8fd |
|
|
turtletooth |
04d8fd |
#endif
|