本文主要是介绍premiere插件调试及数据回传,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
premiere 简称 pr,是 adobe 公司开发的一款视频剪辑软件,插件后缀为 bundle,路径位于:
root@lucasdeMacBook-Pro ControlSurface # pwd
/Library/Application Support/Adobe/Common/Plug-ins/ControlSurface
root@lucasdeMacBook-Pro ControlSurface # ll
total 0
drwxr-xr-x 3 root wheel 96 9 22 09:43 Loupedeck2.bundle
drwxr-xr-x 3 root wheel 96 9 24 15:12 Test.bundle
调试的话,只需将本地代码打包后生成的 bundle 文件拷贝一份到该目录下,然后重启 premiere,在 首选项 -> 操纵面板 中重新引入即可。本地生成的 bundle 文件一般位于:
root@lucasdeMacBook-Pro Products # pwd
/Users/lucas/Library/Developer/Xcode/DerivedData/Test-cqjaklhpfoyspnbuesiydmmlyseg/Build/Products
root@lucasdeMacBook-Pro Products # ll
total 0
drwxr-xr-x 3 lucas staff 96 9 24 15:12 Test.bundle
drwxr-xr-x 3 lucas staff 96 9 24 15:12 Test.bundle.dSYM
Test.bundle 即打包后生成的插件,生成路径也可在 Xcode -> Preferences -> Locations 处自定义设置。如果对执行的每条命令有记录日志的话,就可以在操作插件的同时查看日志输出情况了:
lucas@lucasdeMacBook-Pro Desktop % tail -f test.log
command:lumetri|3|-1
command:lumetri|3|-1,newValue:0.200001
command:lumetri|3|-1
command:lumetri|3|-1,newValue:0.100001
command 是应用程序传过来的命令,newValue 是命令执行后的值,如曝光执行两次后最新值就是 0.1。如果想把最新值返回给应用程序呢?可以考虑通过 socket 通信,先创建个服务端:
int main(int argc, char* argv[])
{int sock = socket(AF_INET, SOCK_STREAM, 0);cout << "server socket: " << sock << endl;char recv_buf[200];struct sockaddr_in saddr, caddr;saddr.sin_family = AF_INET;saddr.sin_port = htons(11111);saddr.sin_addr.s_addr = htonl(INADDR_ANY);bind(sock, (struct sockaddr*)&saddr, sizeof(saddr));listen(sock, SOMAXCONN);socklen_t len = sizeof(caddr);while (true) {cout << "listening..." << endl;int clientsock = accept(sock, (struct sockaddr*)&caddr, &len);memset(recv_buf, 0, 200);int recv_len = recv(clientsock, recv_buf, 200, 0);cout << "resv_len: " << recv_len << endl;if (recv_len) {cout << "recv res: " << recv_buf << endl;}}return 0;
}
执行后可看到 11111 端口已处于监听状态:
root@lucasdeMacBook-Pro Products # lsof -i:11111
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
server 78400 lucas 3u IPv4 0x3ce3fdfe3b8f19 0t0 TCP *:vce (LISTEN)
然后在插件中模拟个客户端,即添加下面几行代码,将 send_buf 内容发到端口 11111 上:
int sock = socket(AF_INET, SOCK_STREAM, 0);
struct sockaddr_in saddr;
saddr.sin_family = AF_INET;
saddr.sin_port = htons(11111);
saddr.sin_addr.s_addr = htonl(INADDR_ANY);
socklen_t len = sizeof(saddr);
connect(sock, (const struct sockaddr *)&saddr, len);
send(sock, send_buf, 200, 0);
重新打包生成并拷贝到对应目录下,再执行,即可在服务端控制台看到和日志中一样的输出啦:
以上,欢迎交流~
这篇关于premiere插件调试及数据回传的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!