first commit
This commit is contained in:
commit
e15f240735
61
.build/default.Manifest.xml
Normal file
61
.build/default.Manifest.xml
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<assembly
|
||||||
|
xmlns="urn:schemas-microsoft-com:asm.v1"
|
||||||
|
manifestVersion="1.0">
|
||||||
|
<assemblyIdentity
|
||||||
|
processorArchitecture="x86"
|
||||||
|
version="5.1.0.0"
|
||||||
|
type="win32"
|
||||||
|
name="视频添加二维码.exe"/>
|
||||||
|
<description>视频添加二维码</description>
|
||||||
|
<dependency>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity
|
||||||
|
type="win32"
|
||||||
|
name="Microsoft.Windows.Common-Controls"
|
||||||
|
version="6.0.0.0"
|
||||||
|
publicKeyToken="6595b64144ccf1df"
|
||||||
|
language="*"
|
||||||
|
processorArchitecture="x86"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</dependency>
|
||||||
|
<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
|
||||||
|
<application>
|
||||||
|
<!--Windows Vista -->
|
||||||
|
<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/>
|
||||||
|
<!--Windows 7 -->
|
||||||
|
<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/>
|
||||||
|
<!--Windows 8 -->
|
||||||
|
<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/>
|
||||||
|
<!-- Windows 8.1 -->
|
||||||
|
<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/>
|
||||||
|
<!-- Windows 10, Windows 11 -->
|
||||||
|
<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
|
||||||
|
</application>
|
||||||
|
</compatibility>
|
||||||
|
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
|
||||||
|
<security>
|
||||||
|
<requestedPrivileges>
|
||||||
|
<!--
|
||||||
|
可任选以下配置之一指定一个进程权限:
|
||||||
|
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
|
||||||
|
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
|
||||||
|
|
||||||
|
requireAdministrator 为管理员权限,
|
||||||
|
highestAvailable 为可以获取到的最高权限,
|
||||||
|
asInvoker 为默认值,即调用进程当前权限,一般不需要显式指定,指定后会禁用虚拟化。
|
||||||
|
|
||||||
|
虚拟化指Vista以后系统禁止写 Program File目录,启用虚拟化则重定向到%localappdata%\VirtualStore目录,
|
||||||
|
而注册表 HKEY_LOCAL_MACHINE\Software 则重定向到HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\Software
|
||||||
|
-->
|
||||||
|
</requestedPrivileges>
|
||||||
|
</security>
|
||||||
|
</trustInfo>
|
||||||
|
<asmv3:application xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" >
|
||||||
|
<asmv3:windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
|
||||||
|
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">True/PM</dpiAware>
|
||||||
|
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
|
||||||
|
</asmv3:windowsSettings>
|
||||||
|
</asmv3:application>
|
||||||
|
</assembly>
|
2
.build/default.init.aardio
Normal file
2
.build/default.init.aardio
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
//发布前触发
|
||||||
|
import ide;
|
6
.build/default.main.aardio
Normal file
6
.build/default.main.aardio
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
//此触发器在生成EXE以后执行
|
||||||
|
import ide;
|
||||||
|
import fsys;
|
||||||
|
|
||||||
|
//获取生成的EXE文件路径
|
||||||
|
var publishFile = ide.getPublishPath();
|
9
default.aproj
Normal file
9
default.aproj
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<project ver="10" name="视频添加二维码" libEmbed="true" icon="..." ui="win" output="视频添加二维码.exe" CompanyName="单位名称" FileDescription="视频添加二维码" LegalCopyright="Copyright (C) 作者 2024" ProductName="视频添加二维码" InternalName="视频添加二维码" FileVersion="0.0.0.5" ProductVersion="0.0.0.5" publishDir="/dist/" dstrip="false">
|
||||||
|
<file name="main.aardio" path="main.aardio" comment="main.aardio"/>
|
||||||
|
<folder name="资源文件" path="res" embed="true" local="false" ignored="false"/>
|
||||||
|
<folder name="窗体文件" path="dlg" comment="目录" embed="true" local="false" ignored="false">
|
||||||
|
<file name="qrcode.aardio" path="dlg\qrcode.aardio" comment="dlg\qr_code.aardio"/>
|
||||||
|
<file name="test.aardio" path="dlg\test.aardio" comment="dlg\test.aardio"/>
|
||||||
|
</folder>
|
||||||
|
</project>
|
BIN
dist/视频添加二维码.exe
vendored
Normal file
BIN
dist/视频添加二维码.exe
vendored
Normal file
Binary file not shown.
43
dlg/qrcode.aardio
Normal file
43
dlg/qrcode.aardio
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
import win.ui;
|
||||||
|
/*DSG{{*/
|
||||||
|
var winform = win.form(text="aardio form";right=304;bottom=297;bgcolor=16777215;exmode="none";max=false;min=false;mode="popup";sysmenu=false;title=false)
|
||||||
|
winform.add(
|
||||||
|
plus={cls="plus";left=0;top=0;right=167;bottom=159;clipBk=false;dl=1;dt=1;repeat="scale";z=1}
|
||||||
|
)
|
||||||
|
/*}}*/
|
||||||
|
|
||||||
|
import console;
|
||||||
|
import gdip;
|
||||||
|
|
||||||
|
subscribe("getQrcode",function(...){
|
||||||
|
var qrcodePath, width, height = ...;
|
||||||
|
winform.width = width;
|
||||||
|
winform.height = height;
|
||||||
|
winform.plus.width = width;
|
||||||
|
winform.plus.height = height;
|
||||||
|
winform.plus.background = qrcodePath;
|
||||||
|
} )
|
||||||
|
|
||||||
|
winform.wndproc = function(hwnd, message, wParam, lParam) {
|
||||||
|
select(message) {
|
||||||
|
case 0x201/*_WM_LBUTTONDOWN*/{
|
||||||
|
//点击左键移动窗体
|
||||||
|
winform.hitCaption()
|
||||||
|
}
|
||||||
|
case 0x205/*_WM_RBUTTONUP*/{
|
||||||
|
//右键菜单
|
||||||
|
var popmenu = win.ui.popmenu(winform);
|
||||||
|
popmenu.add('关闭',
|
||||||
|
function(id) {
|
||||||
|
win.close(winform.hwnd);
|
||||||
|
})
|
||||||
|
popmenu.popup()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//winform.setPos(0,0, winform.parent.hwnd);
|
||||||
|
winform.show();
|
||||||
|
//winform.transparent(128,0xFFFFFF)
|
||||||
|
//winform.transparent(true)
|
||||||
|
win.loopMessage();
|
14
dlg/test.aardio
Normal file
14
dlg/test.aardio
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import win.ui;
|
||||||
|
/*DSG{{*/
|
||||||
|
var winform = win.form(text="aardio form";right=735;bottom=618;bgcolor=16777215;max=false;min=false;mode="popup";sysmenu=false;title=false)
|
||||||
|
winform.add(
|
||||||
|
button={cls="button";text="Button";left=230;top=360;right=332;bottom=413;z=2};
|
||||||
|
plus={cls="plus";left=0;top=0;right=167;bottom=159;clipBk=false;dl=1;dt=1;repeat="scale";z=1}
|
||||||
|
)
|
||||||
|
/*}}*/
|
||||||
|
|
||||||
|
import console;
|
||||||
|
|
||||||
|
|
||||||
|
winform.show();
|
||||||
|
win.loopMessage();
|
17
lib/config.aardio
Normal file
17
lib/config.aardio
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
//config 配置文件
|
||||||
|
import fsys.config;
|
||||||
|
config = fsys.config("/config/");
|
||||||
|
//config = fsys.config( io.appData("/软件作者/应用程序名/") );
|
||||||
|
|
||||||
|
//不需要序列化的配置名字前请添加下划线
|
||||||
|
namespace config {
|
||||||
|
__appName = "应用程序名";
|
||||||
|
__website = "http://www.aardio.com/";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**intellisense(config)
|
||||||
|
__appName = 应用程序名
|
||||||
|
__website = 官方网站
|
||||||
|
saveAll() = 写入所有配置到文件
|
||||||
|
? = 获取值时指定不以下划线开始的配置表名称,\n返回一个可自动序列化到同名配置文件的表对象。\n如果此对象名以下划线开始,则可以正常读写值不会序列化为配置文件。\n否则不能对此对象直接赋值,只能对配置表对象的成员赋值。\n\n配置表可自动自文件加载,退出线程前自动序列化并存入文件。\n仅序列化以字符串、数值为键的元素,\n仅序列化值为字符串、数值、buffer 以及定义了 _serialize 元方法的成员。\n循环引用的值转换为 null,序列化时忽略成员函数\n!fsys_table.
|
||||||
|
end intellisense**/
|
155
main.aardio
Normal file
155
main.aardio
Normal file
|
@ -0,0 +1,155 @@
|
||||||
|
import win.ui;
|
||||||
|
/*DSG{{*/
|
||||||
|
mainForm = win.form(text="视频添加二维码";right=519;bottom=759;bgcolor=16777215)
|
||||||
|
mainForm.add(
|
||||||
|
custom={cls="custom";text="自定义控件";left=10;top=76;right=510;bottom=668;border=1;clip=1;db=1;dl=1;dr=1;dt=1;z=4};
|
||||||
|
edit={cls="edit";left=10;top=673;right=510;bottom=750;db=1;dl=1;dr=1;edge=1;multiline=1;readonly=1;z=5};
|
||||||
|
plus={cls="plus";text="导入视频";left=63;top=28;right=162;bottom=58;bgcolor=-5197169;border={color=-16777216;radius=3;width=1};dl=0.12;dr=0.69;dt=1;font=LOGFONT(h=-13);forecolor=16777215;z=1};
|
||||||
|
plus2={cls="plus";text="导入二维码";left=179;top=28;right=278;bottom=58;bgcolor=-5197169;border={color=-16777216;radius=3;width=1};dl=0.34;dr=0.47;dt=1;font=LOGFONT(h=-13);forecolor=16777215;notify=1;z=2};
|
||||||
|
plus3={cls="plus";text="保存格式";left=337;top=28;right=436;bottom=58;bgcolor=-5197169;border={color=-16777216;radius=3;width=1};dl=0.65;dr=0.16;dt=1;font=LOGFONT(h=-13);forecolor=5881621;notify=1;z=3}
|
||||||
|
)
|
||||||
|
/*}}*/
|
||||||
|
|
||||||
|
mainForm.plus.skin({
|
||||||
|
foreground={
|
||||||
|
active=0xFFFFBAB7;
|
||||||
|
default=0xFFFFFFFF
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
mainForm.plus2.skin({
|
||||||
|
foreground={
|
||||||
|
active=0xFFFFBAB7;
|
||||||
|
default=0xFFFFFFFF
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
mainForm.plus3.skin({
|
||||||
|
foreground={
|
||||||
|
active=0xFFFFBAB7;
|
||||||
|
default=0xFF15BF59
|
||||||
|
};
|
||||||
|
})
|
||||||
|
|
||||||
|
import console;
|
||||||
|
import gdip;
|
||||||
|
import fsys.dlg;
|
||||||
|
import process.ffmpeg;
|
||||||
|
|
||||||
|
var frmChild; // qrcode winform
|
||||||
|
var videoPath;
|
||||||
|
var qrcodePath;
|
||||||
|
var scaleRatio; // 定义一个全局变量来保存缩放比例
|
||||||
|
var offsetX; // 视频在 custom 内 x 偏移量
|
||||||
|
var offsetY; // 视频在 custom 内 y 偏移量
|
||||||
|
|
||||||
|
showVideo = function(vpath){
|
||||||
|
var customW = mainForm.custom.width;
|
||||||
|
var customH = mainForm.custom.height;
|
||||||
|
mainForm.edit.print(vpath);
|
||||||
|
var img = gdip.image(vpath + "0001.png");
|
||||||
|
var imgW = img.width;
|
||||||
|
var imgH = img.height;
|
||||||
|
|
||||||
|
var aspectRatio = imgW / imgH;
|
||||||
|
var customAspectRatio = customW / customH;
|
||||||
|
|
||||||
|
var newImgW, newImgH;
|
||||||
|
|
||||||
|
if (aspectRatio > customAspectRatio) {
|
||||||
|
newImgW = customW;
|
||||||
|
newImgH = customW / aspectRatio;
|
||||||
|
scaleRatio = customW / imgW; // 保存缩放比例
|
||||||
|
} else {
|
||||||
|
newImgH = customH;
|
||||||
|
newImgW = customH * aspectRatio;
|
||||||
|
scaleRatio = customH / imgH; // 保存缩放比例
|
||||||
|
}
|
||||||
|
|
||||||
|
offsetX = (customW - newImgW) / 2;
|
||||||
|
offsetY = (customH - newImgH) / 2;
|
||||||
|
|
||||||
|
mainForm.custom.add(
|
||||||
|
plus4 = {
|
||||||
|
cls = "plus";
|
||||||
|
left = offsetX;
|
||||||
|
top = offsetY;
|
||||||
|
right = offsetX + newImgW;
|
||||||
|
bottom = offsetY + newImgH;
|
||||||
|
background = vpath + "0001.png";
|
||||||
|
z = 6
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
mainForm.plus.oncommand = function(id,event){
|
||||||
|
var path = fsys.dlg.open("MP4 files (*.mp4)|*.mp4|其他格式 (*.*)|*||"); // 假设只支持mp4格式
|
||||||
|
if(path){
|
||||||
|
videoPath = path;
|
||||||
|
var tpath = io.splitpath(path);
|
||||||
|
var vpath = io._exedir+"temp\"+tpath.name+"\";
|
||||||
|
if(!io.exist(vpath)){
|
||||||
|
io.createDir(vpath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if(io.exist(vpath+"0001.png")){
|
||||||
|
showVideo(vpath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
//var ffmpeg = process.ffmpeg(,"-i "+path+" -vf fps=1 "+vpath+"\%04d.png");
|
||||||
|
var ffmpeg = process.ffmpeg(, `-i `++path++` -vf "select=eq(n\,0)" -vframes 1 `++vpath++`\0001.png`);
|
||||||
|
ffmpeg.logResponse(mainForm.edit);
|
||||||
|
|
||||||
|
ffmpeg.onResponseEnd = function(){
|
||||||
|
showVideo(vpath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mainForm.plus2.oncommand = function(id,event){
|
||||||
|
// 导入二维码
|
||||||
|
var path = fsys.dlg.open("*.png|*.png|其他格式 (*.*)|*||"); // 假设只支持png格式
|
||||||
|
if(path){
|
||||||
|
qrcodePath = path;
|
||||||
|
var img = gdip.image(path);
|
||||||
|
var imgW = img.width;
|
||||||
|
var imgH = img.height;
|
||||||
|
|
||||||
|
// 使用保存的缩放比例来计算新图片的宽度和高度
|
||||||
|
var newImgW = imgW * scaleRatio;
|
||||||
|
var newImgH = imgH * scaleRatio;
|
||||||
|
if(frmChild){
|
||||||
|
frmChild.close();
|
||||||
|
}
|
||||||
|
frmChild = mainForm.loadForm("\dlg\qrcode.aardio");
|
||||||
|
publish("getQrcode", path, newImgW, newImgH);
|
||||||
|
frmChild.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mainForm.plus3.oncommand = function(id,event){
|
||||||
|
var rc = mainForm.custom.plus4.getRect();
|
||||||
|
var vRect = win.toScreenRect(mainForm.custom.plus4.hwnd,rc);
|
||||||
|
var vLeft = vRect.left - offsetX;
|
||||||
|
var vTop = vRect.top - offsetY;
|
||||||
|
var iLeft = frmChild.left;
|
||||||
|
var iTop = frmChild.top;
|
||||||
|
var x = (iLeft - vLeft) / scaleRatio;
|
||||||
|
var y = (iTop - vTop) / scaleRatio;
|
||||||
|
|
||||||
|
var vpath = io.splitpath(videoPath);
|
||||||
|
var qrpath = io.splitpath(qrcodePath);
|
||||||
|
|
||||||
|
var str = `-i `++ vpath.file ++` -i `++ qrpath.file ++` -filter_complex "overlay=`++ x ++`:`++ y ++ `" ` ++ vpath.name ++`-output.mp4`;
|
||||||
|
|
||||||
|
var ffmpeg = process.ffmpeg(vpath.dir, str);
|
||||||
|
ffmpeg.logResponse(mainForm.edit);
|
||||||
|
ffmpeg.onResponseEnd = function(){
|
||||||
|
mainForm.edit.print("完成。");
|
||||||
|
mainForm.msgbox("处理完成,在原视频目录下查看 -output后缀")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
mainForm.show();
|
||||||
|
return win.loopMessage();
|
Loading…
Reference in New Issue
Block a user