Skip to content

Instantly share code, notes, and snippets.

@maki-rxrz
Last active October 9, 2016 12:49
Show Gist options
  • Save maki-rxrz/4eee00dc64f5e22a297337086a382f44 to your computer and use it in GitHub Desktop.
Save maki-rxrz/4eee00dc64f5e22a297337086a382f44 to your computer and use it in GitHub Desktop.
Some patches for m2v.aui(m2v.vfp)
diff -ur m2v_vfp-0.7.9/vfp/plugin.cpp m2v_vfp-0.7.9/vfp/plugin.cpp
--- m2v_vfp-0.7.9/vfp/plugin.cpp 2012-04-18 20:04:59.661078800 +0900
+++ m2v_vfp-0.7.9/vfp/plugin.cpp 2016-10-03 22:36:28.890947900 +0900
@@ -92,6 +92,17 @@
return true;
}
+
+ int GetPictureCodingType(int frame) const {
+ int type;
+
+ EnterCriticalSection(&(video->lock));
+ type = get_picture_coding_type(video, frame);
+ LeaveCriticalSection(&(video->lock));
+
+ return type;
+ }
+
};
//////////////////////////////////////////////////////////////////////////////
@@ -202,6 +213,31 @@
return samples;
}
+ BOOL IsKeyframe(int frame) {
+ int type = 1;
+
+ if(m2v != NULL)
+ type = m2v.GetPictureCodingType(frame);
+
+ switch(type){
+ case 1:
+ /* I picture */
+ return TRUE;
+ case 2:
+ /* P picture */
+ return FALSE;
+ case 3:
+ /* B picture */
+ return FALSE;
+ case 4:
+ /* B picture with closed gop */
+ return FALSE;
+ default:
+ /* unknown picture */
+ return FALSE;
+ }
+ }
+
static INPUT_HANDLE __cdecl func_open(LPSTR file) {
std::auto_ptr<ForAviutl> handle(new ForAviutl(file));
return (handle->m2v != NULL || handle->m2a != NULL) ? handle.release() : NULL;
@@ -224,6 +260,10 @@
return ((ForAviutl *)ih)->ReadAudio(start, length, buf);
}
+ static BOOL func_is_keyframe(INPUT_HANDLE ih,int frame) {
+ return ((ForAviutl *)ih)->IsKeyframe(frame);
+ }
+
public:
static INPUT_PLUGIN_TABLE *GetInputPluginTable() {
#define _FILE_TYPE_ "*.mpeg;*.mpg;*.m2p;*.mp2;*.vob;*.vro;*.m2v;*.m1v;*.mpv;*.ves;*.m2t;*.ssg;*.ts;*.bs;*.m2ts"
@@ -239,7 +279,7 @@
(BOOL (*)(INPUT_HANDLE, INPUT_INFO *))func_info_get,
(int (*)(INPUT_HANDLE, int, void *))func_read_video,
(int (*)(INPUT_HANDLE, int, int, void *))func_read_audio,
- NULL,
+ (BOOL (*)(INPUT_HANDLE, int))func_is_keyframe,
NULL,
};
#undef _FILE_TYPE_
diff -ur m2v_vfp-0.7.9/vfp/instance_manager.c m2v_vfp-0.7.9/vfp/instance_manager.c
--- m2v_vfp-0.7.9/vfp/instance_manager.c 2011-04-04 22:01:45.408525600 +0900
+++ m2v_vfp-0.7.9/vfp/instance_manager.c 2016-10-09 21:23:53.736563800 +0900
@@ -35,12 +35,12 @@
static INSTANCE_MANAGER manager; // ファイルローカル変数で管理
-static void initialize_instance_manager();
-static void teardown_instance_manager();
+static void initialize_instance_manager(void);
+static void teardown_instance_manager(void);
static INSTANCE *get_head(INSTANCE_LIST *list);
static void put_tail(INSTANCE_LIST *list, INSTANCE *elem);
-static INSTANCE *new_instance();
+static INSTANCE *new_instance(void);
static INSTANCE *find_instance(INSTANCE_LIST *list, void *instance);
static void remove_from_list(INSTANCE_LIST *list, INSTANCE *elem);
@@ -114,7 +114,7 @@
LeaveCriticalSection(&(manager.lock));
}
-static void initialize_instance_manager()
+static void initialize_instance_manager(void)
{
int i;
INSTANCE *p;
@@ -130,7 +130,7 @@
}
}
-static void teardown_instance_manager()
+static void teardown_instance_manager(void)
{
INSTANCE *p;
@@ -185,7 +185,7 @@
}
}
-static INSTANCE *new_instance()
+static INSTANCE *new_instance(void)
{
return (INSTANCE *)calloc(1, sizeof(INSTANCE));
}
diff -ur m2v_vfp-0.7.9/vfp/registry.c m2v_vfp-0.7.9/vfp/registry.c
--- m2v_vfp-0.7.9/vfp/registry.c 2003-07-06 21:20:21.630908800 +0900
+++ m2v_vfp-0.7.9/vfp/registry.c 2016-10-09 21:25:51.081681000 +0900
@@ -9,20 +9,20 @@
#define REGISTRY_C
#include "registry.h"
-int get_color_conversion_type();
-int get_idct_type();
-int get_simd_mode();
-int get_field_mode();
-int get_resize_mode();
-int get_file_check_limit();
-int get_color_matrix();
-int get_gl_mode();
-int get_file_mode();
-int get_yuy2_mode();
+int get_color_conversion_type(void);
+int get_idct_type(void);
+int get_simd_mode(void);
+int get_field_mode(void);
+int get_resize_mode(void);
+int get_file_check_limit(void);
+int get_color_matrix(void);
+int get_gl_mode(void);
+int get_file_mode(void);
+int get_yuy2_mode(void);
static const char REGISTRY_POSITION[] = "Software\\marumo\\mpeg2vid_vfp";
-int get_color_conversion_type()
+int get_color_conversion_type(void)
{
HKEY key;
DWORD type;
@@ -50,7 +50,7 @@
return 0;
}
-int get_idct_type()
+int get_idct_type(void)
{
HKEY key;
DWORD type;
@@ -74,7 +74,7 @@
return value;
}
-int get_simd_mode()
+int get_simd_mode(void)
{
HKEY key;
DWORD type;
@@ -98,7 +98,7 @@
return value;
}
-int get_field_mode()
+int get_field_mode(void)
{
HKEY key;
DWORD type;
@@ -122,7 +122,7 @@
return value;
}
-int get_resize_mode()
+int get_resize_mode(void)
{
HKEY key;
DWORD type;
@@ -146,7 +146,7 @@
return value;
}
-int get_filecheck_limit()
+int get_filecheck_limit(void)
{
HKEY key;
DWORD type;
@@ -170,7 +170,7 @@
return value;
}
-int get_color_matrix()
+int get_color_matrix(void)
{
HKEY key;
DWORD type;
@@ -194,7 +194,7 @@
return value;
}
-int get_gl_mode()
+int get_gl_mode(void)
{
HKEY key;
DWORD type;
@@ -218,7 +218,7 @@
return value;
}
-int get_file_mode()
+int get_file_mode(void)
{
HKEY key;
DWORD type;
@@ -246,7 +246,7 @@
return value;
}
-int get_yuy2_mode()
+int get_yuy2_mode(void)
{
HKEY key;
DWORD type;
diff -ur m2v_vfp-0.7.9/vfp/registry.h m2v_vfp-0.7.9/vfp/registry.h
--- m2v_vfp-0.7.9/vfp/registry.h 2003-07-02 22:56:01.891078400 +0900
+++ m2v_vfp-0.7.9/vfp/registry.h 2016-10-09 21:25:23.353995800 +0900
@@ -9,16 +9,16 @@
#endif
#ifndef REGISTRY_C
-extern int get_color_conversion_type();
-extern int get_idct_type();
-extern int get_simd_mode();
-extern int get_field_mode();
-extern int get_resize_mode();
-extern int get_filecheck_limit();
-extern int get_color_matrix();
-extern int get_gl_mode();
-extern int get_file_mode();
-extern int get_yuy2_mode();
+extern int get_color_conversion_type(void);
+extern int get_idct_type(void);
+extern int get_simd_mode(void);
+extern int get_field_mode(void);
+extern int get_resize_mode(void);
+extern int get_filecheck_limit(void);
+extern int get_color_matrix(void);
+extern int get_gl_mode(void);
+extern int get_file_mode(void);
+extern int get_yuy2_mode(void);
#endif /* REGISTRY_C */
#ifdef __cplusplus
diff -ur m2v_vfp-0.7.9/vfp/Makefile m2v_vfp-0.7.9/vfp/Makefile
--- m2v_vfp-0.7.9/vfp/Makefile 2016-10-03 22:45:48.036705300 +0900
+++ m2v_vfp-0.7.9/vfp/Makefile 2016-10-09 21:19:03.966712900 +0900
@@ -1,7 +1,7 @@
ASM = ml
AFLAG = /nologo /c /W3 /coff
# AFLAG = /nologo /c /coff /Zd /Zi
-CC = cl
+CC = clang-cl
CFLAG = /nologo /c /Gr /GF /Ob2 /Ot /Oi /MT /W4 /Zp1 /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS"
# CC = icl
# CFLAG = /c /MT /O1 /Oy /Oi /Ob1 /Qsfalign16 /Zp1 /Gr /W3 /GS /GF /Qvc10 /Qip /fp:double /arch:IA32
diff -ur m2v_vfp-0.7.9/vfp/Makefile m2v_vfp-0.7.9/vfp/Makefile
--- m2v_vfp-0.7.9/vfp/Makefile 2012-12-19 03:24:20.433905200 +0900
+++ m2v_vfp-0.7.9/vfp/Makefile 2016-10-03 22:45:48.036705300 +0900
@@ -1,13 +1,15 @@
ASM = ml
-AFLAG = /c /W3 /coff
-# AFLAG = /c /coff /Zd /Zi
-# CC = cl
-# CFLAG = /c /Gr /GF /Oa /Ob2 /Ot /Og /Oi /Op /MT /W4 /Zp1 /D "NDEBUG"
-CC = icl
-CFLAG = /c /MT /O1 /Oy /Oi /Ob1 /Qsfalign16 /Zp1 /Gr /W3 /GS /GF /Qvc10 /Qip /fp:double /arch:IA32
-LINK = xilink
+AFLAG = /nologo /c /W3 /coff
+# AFLAG = /nologo /c /coff /Zd /Zi
+CC = cl
+CFLAG = /nologo /c /Gr /GF /Ob2 /Ot /Oi /MT /W4 /Zp1 /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS"
+# CC = icl
+# CFLAG = /c /MT /O1 /Oy /Oi /Ob1 /Qsfalign16 /Zp1 /Gr /W3 /GS /GF /Qvc10 /Qip /fp:double /arch:IA32
+# LINK = xilink
+LINK = link
LFLAG = /DLL /nologo /EXPORT:vfGetPluginInfo /EXPORT:vfGetPluginFunc /EXPORT:vfGetPluginFuncEditExt /EXPORT:GetInputPluginTable kernel32.lib user32.lib advapi32.lib
RC = rc
+RCFLAG = /nologo
BINDIR = "..\release\"
RES = m2v.res
@@ -20,7 +22,7 @@
$(LINK) $(LFLAG) /OUT:m2v.vfp *.obj m2v.res
m2v.res: m2v.rc resource.h
- $(RC) m2v.rc
+ $(RC) $(RCFLAG) m2v.rc
clean:
DEL *.obj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment