|
Shinya Kitaoka |
810553 |
#pragma once
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#ifndef TIIO_AVI_H
|
|
Toshihiro Shimizu |
890ddd |
#define TIIO_AVI_H
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
#include <windows.h></windows.h>
|
|
Toshihiro Shimizu |
890ddd |
#include <vfw.h></vfw.h>
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
#include "tlevel_io.h"
|
|
Toshihiro Shimizu |
890ddd |
#include "tthreadmessage.h"
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
class TAviCodecCompressor;
|
|
Toshihiro Shimizu |
890ddd |
class VDVideoDecompressor;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// TLevelWriterAvi
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class TLevelWriterAvi : public TLevelWriter {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TLevelWriterAvi(const TFilePath &path, TPropertyGroup *winfo);
|
|
Shinya Kitaoka |
120a6e |
~TLevelWriterAvi();
|
|
Shinya Kitaoka |
473e70 |
TImageWriterP getFrameWriter(TFrameId fid) override;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
473e70 |
void saveSoundTrack(TSoundTrack *st) override;
|
|
Shinya Kitaoka |
120a6e |
void save(const TImageP &image, int frameIndex);
|
|
Shinya Kitaoka |
120a6e |
static TLevelWriter *create(const TFilePath &f, TPropertyGroup *winfo) {
|
|
Shinya Kitaoka |
120a6e |
return new TLevelWriterAvi(f, winfo);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
TThread::Mutex m_mutex;
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Shinya Kitaoka |
120a6e |
PAVIFILE m_aviFile;
|
|
Shinya Kitaoka |
120a6e |
PAVISTREAM m_videoStream;
|
|
Shinya Kitaoka |
120a6e |
PAVISTREAM m_audioStream;
|
|
Shinya Kitaoka |
120a6e |
TSoundTrack *m_st;
|
|
Shinya Kitaoka |
120a6e |
HIC m_hic;
|
|
Shinya Kitaoka |
120a6e |
BITMAPINFO *m_bitmapinfo;
|
|
Shinya Kitaoka |
120a6e |
BITMAPINFO *m_outputFmt;
|
|
Shinya Kitaoka |
120a6e |
AVISTREAMINFO m_audioStreamInfo;
|
|
Shinya Kitaoka |
120a6e |
void *m_buffer;
|
|
Shinya Kitaoka |
120a6e |
bool m_initDone;
|
|
Shinya Kitaoka |
120a6e |
int IOError;
|
|
Shinya Kitaoka |
120a6e |
int m_bpp;
|
|
Shinya Kitaoka |
120a6e |
long m_maxDataSize;
|
|
Shinya Kitaoka |
120a6e |
std::list<int> m_delayedFrames;</int>
|
|
Shinya Kitaoka |
120a6e |
int m_firstframe;
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
void doSaveSoundTrack();
|
|
Shinya Kitaoka |
120a6e |
void searchForCodec();
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Shinya Kitaoka |
120a6e |
int compressFrame(BITMAPINFOHEADER *outHeader, void **bufferOut,
|
|
Shinya Kitaoka |
120a6e |
int frameIndex, DWORD flagsIn, DWORD &flagsOut);
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Shinya Kitaoka |
120a6e |
void createBitmap(int lx, int ly);
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// TLevelWriterAvi
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
class TLevelReaderAvi : public TLevelReader {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
TLevelReaderAvi(const TFilePath &path);
|
|
Shinya Kitaoka |
120a6e |
~TLevelReaderAvi();
|
|
Shinya Kitaoka |
473e70 |
TImageReaderP getFrameReader(TFrameId fid) override;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
static TLevelReader *create(const TFilePath &f) {
|
|
Shinya Kitaoka |
120a6e |
return new TLevelReaderAvi(f);
|
|
Shinya Kitaoka |
120a6e |
}
|
|
Shinya Kitaoka |
473e70 |
TLevelP loadInfo() override;
|
|
Shinya Kitaoka |
120a6e |
TImageP load(int frameIndex);
|
|
Shinya Kitaoka |
120a6e |
TDimension getSize();
|
|
Shinya Kitaoka |
120a6e |
TThread::Mutex m_mutex;
|
|
Shinya Kitaoka |
120a6e |
void *m_decompressedBuffer;
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
9f5a1b |
#ifdef _WIN32
|
|
Toshihiro Shimizu |
890ddd |
private:
|
|
Shinya Kitaoka |
120a6e |
PAVISTREAM m_videoStream;
|
|
Shinya Kitaoka |
120a6e |
BITMAPINFO *m_srcBitmapInfo, *m_dstBitmapInfo;
|
|
Shinya Kitaoka |
120a6e |
HIC m_hic;
|
|
Shinya Kitaoka |
120a6e |
int IOError, m_prevFrame;
|
|
Shinya Kitaoka |
120a6e |
|
|
Shinya Kitaoka |
120a6e |
int readFrameFromStream(void *bufferOut, DWORD &bufferSize,
|
|
Shinya Kitaoka |
120a6e |
int frameIndex) const;
|
|
Shinya Kitaoka |
120a6e |
DWORD decompressFrame(void *srcBuffer, int srcSize, void *dstBuffer,
|
|
Shinya Kitaoka |
120a6e |
int currentFrame, int desiredFrame);
|
|
Shinya Kitaoka |
120a6e |
HIC findCandidateDecompressor();
|
|
Toshihiro Shimizu |
890ddd |
#endif
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
// Tiio::AviWriterProperties
|
|
Toshihiro Shimizu |
890ddd |
//
|
|
Toshihiro Shimizu |
890ddd |
//===========================================================
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
namespace Tiio {
|
|
Shinya Kitaoka |
120a6e |
class AviWriterProperties : public TPropertyGroup {
|
|
Toshihiro Shimizu |
890ddd |
public:
|
|
Shinya Kitaoka |
120a6e |
AviWriterProperties();
|
|
Shinya Kitaoka |
120a6e |
TEnumProperty m_codec;
|
|
Shinya Kitaoka |
120a6e |
static TEnumProperty m_defaultCodec;
|
|
Toshihiro Shimizu |
890ddd |
};
|
|
Toshihiro Shimizu |
890ddd |
}
|
|
Toshihiro Shimizu |
890ddd |
|
|
Shinya Kitaoka |
120a6e |
#endif // TIIO_AVI_H
|