¤Û¤¤
°ì±þ¤¤¤Ã¤È¤¯¤±¤É¡¢C¤Î¼ÁÌä¤Ï¤³¤³¤Ç¤Ï¤ä¤Ã¤Á¤ã¤¤¤«¤ó¤¾¡©
#include <windows.h>
#include "hsp3plugin.h"
#include <vfw.h>
#include <string>
#define tstring string
#pragma comment (lib, "vfw32.lib")
int flag[2];
BOOL SaveAviFile(LPTSTR lpszFileName, PAVISTREAM paviVideo, PAVISTREAM paviAudio)
{
int i;
PAVISTREAM pavis[2];
AVICOMPRESSOPTIONS options[2];
LPAVICOMPRESSOPTIONS lpOptions[2];
for (i = 0; i < 2; i++) {
ZeroMemory(&options[i], sizeof(AVICOMPRESSOPTIONS));
lpOptions[i] = &options[i];
}
pavis[0] = paviVideo;
pavis[1] = paviAudio;
void* x;
if(flag[0])
{
if (!AVISaveOptions(NULL, 0, 2, pavis, lpOptions))
return FALSE;
x = lpOptions;
}else{
x = NULL;
}
if (AVISaveV(lpszFileName, NULL, NULL, 2, pavis, (LPAVICOMPRESSOPTIONS*)x) != AVIERR_OK) {
MessageBox(NULL, TEXT("AVI¥Õ¥¡¥¤¥ë¤ÎºîÀ®¤Ë¼ºÇÔ¤·¤Þ¤·¤¿"), NULL, MB_ICONWARNING);
AVISaveOptionsFree(2, lpOptions);
return FALSE;
}
AVISaveOptionsFree(2, lpOptions);
return TRUE;
}
static int cmdfunc( int cmd )
{
// ¼Â¹Ô½èÍý (Ì¿Îá¼Â¹Ô»þ¤Ë¸Æ¤Ð¤ì¤Þ¤¹)
//
code_next(); // ¼¡¤Î¥³¡¼¥É¤ò¼èÆÀ(ºÇ½é¤Ëɬ¤ºÉ¬ÍפǤ¹)
PAVISTREAM paviVideo;
PAVISTREAM paviAudio;
std::tstring inavi(code_gets());
std::tstring inwav(code_gets());
std::tstring newavi(code_gets());
flag[0] = code_getdi( FALSE );
flag[1] = code_getdi( FALSE );
AVIFileInit();
if (AVIStreamOpenFromFile(&paviVideo, inavi.c_str(), streamtypeVIDEO, 0, OF_READ, NULL) != 0) {
MessageBox(NULL, TEXT("¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥Ó¥Ç¥ª¥¹¥È¥ê¡¼¥à¤¬Â¸ºß¤·¤Þ¤»¤ó¡£"), TEXT("OK"), MB_OK);
AVIFileExit();
return 0;
}
if (AVIStreamOpenFromFile(&paviAudio, inwav.c_str(), streamtypeAUDIO, 0, OF_READ, NULL) != 0) {
MessageBox(NULL, TEXT("¥Õ¥¡¥¤¥ë¤Þ¤¿¤Ï¥ª¡¼¥Ç¥£¥ª¥¹¥È¥ê¡¼¥à¤¬Â¸ºß¤·¤Þ¤»¤ó¡£"), TEXT("OK"), MB_OK);
AVIStreamRelease(paviVideo);
AVIFileExit();
return 0;
}
if (SaveAviFile((TCHAR*)newavi.c_str(), paviVideo, paviAudio))
{
if(flag[1])
MessageBox(NULL, TEXT("AVI¥Õ¥¡¥¤¥ë¤òºîÀ®¤·¤Þ¤·¤¿¡£"), TEXT("OK"), MB_OK);
}
AVIStreamRelease(paviAudio);
AVIStreamRelease(paviVideo);
AVIFileExit();
return RUNMODE_RUN;
}
int WINAPI DllMain (HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved)
{
return TRUE;
}
EXPORT void WINAPI hsp3cmdinit( HSP3TYPEINFO *info )
{
hsp3sdk_init( info ); // SDK¤Î½é´ü²½(ºÇ½é¤Ë¹Ô¤Ê¤Ã¤Æ²¼¤µ¤¤)
info->cmdfunc = cmdfunc; // ¼Â¹Ô´Ø¿ô(cmdfunc)¤ÎÅÐÏ¿
}