me
me copied to clipboard
记录和分享技术的博客
[Cocoa Programming L62 - Storyboards - YouTube](https://www.youtube.com/watch?v=HY5uiTfjs8M) - Storyboard帮你组装了WindowController - Window - ViewController - View整条流水线 - 通过Segue可以直接链接到下一个页面,可以通过representedObject传递对象参数 - Storyboard大大简化了View之间的跳转 - 如果一个窗口需要多个View,就可以考虑使用TabViewController
MacOS和iOS的音视频框架主体都是围绕AVFoundation这个Framework,AVFoundation包括6个部分: - Assets - Playback - Capture - Editing - Audio - Speech source: [About Media Playback](https://developer.apple.com/library/archive/documentation/AudioVideo/Conceptual/MediaPlaybackGuide/Contents/Resources/en.lproj/Introduction/Introduction.html#//apple_ref/doc/uid/TP40016757-CH1-SW1) 跟随Learning AV Foundation来看第一个hello world,直接新建一个swift playground ```swift import AVFoundation let synthesizer = AVSpeechSynthesizer() let...
通过AV Foundation来实现摄像头的preview, 下面的代码直接用了当前View对应的layer,也可以加入一个Custom关联上去,一个道理。PreviewLayer只需要有session就行,所以这里就没有关联output,后面我们会来介绍。 ```swift func setup() { // Create a capture session session = AVCaptureSession() session.sessionPreset = .hd1280x720 // Get a refenerce to the default camera let videoDevice = AVCaptureDevice.default(for:...
参考obs, 通过c++/oc混合打开摄像头 main.cpp ```cxx extern "C" { #include "capture.h" } #include #include #include #include #include pthread_t capture_thread; void *worker(void *args); int main() { std::cout
## Overview - 本质上.c, .cpp, .m, .mm通过compile得到.o (object file), 然后link到一个elf - 函数调用的本质就是symbol和堆栈操作,所以遵循各自的调用规则,原则上C++主动匹配C的调用方式 ## C++调用C calc.h ```h #ifndef CALC_H #define CALC_H int add(int a, int b); #endif ``` calc.c ```c #include...
线程的实现本质上都是依赖于操作系统,所谓的跨平台是对具体的抽象,Windows上使用CreateThread,linux (POSIX) 上使用pthread, macOS上使用NSThread或是GCD, 因为macOS是POSIX所以也可以使用pthread,C++11也提供了std::thread这个就支持跨平台,但风评不太好。 参考obs,我们选择先看下pthread。 main.c ```c #include #include #include #include #include #include void *worker(void *arg); void teardown(int s); pthread_t thread1; bool shutdown; int main(int argc, char *argv[]) {...
## Quick 因为"讨厌"(最早MFC写烦了), 所以这么多年就躲着C++,自然也就放弃了Qt,看到OBS用一套Qt代码就搞定了跨平台,还是让我非常惊讶。速度重新看了一下Qt,只能说好强啊,C/C++ yyds ! Qt的几个概念: - Qt可以通过brew qt配合vscode,但还是建议用qtCreator上手 - Qt 6已经通过qtCreator直接build, deploy多平台 (Windows, MacOS, iOS, Android),牛b - Qt Widget是传统方式,可以理解为WinForm或者xib - Qt Quick是现代方式,采用QML,可以理解为WPF或者SwiftUI ```qml import QtQuick Window { width:...
## 规模 obs-studio ```sh ➜ npx cloc . 7907 text files. 5412 unique files. 2639 files ignored. github.com/AlDanial/cloc v 1.92 T=3.02 s (1791.8 files/s, 326760.6 lines/s) --------------------------------------------------------------------------------------- Language files blank...
使用一个dylib通常有2个方式,多数会采用编译时绑定,在做plugin的时候也会用到运行时链接。 在没有debug信息的时候,我们只能通过`nm`从dylib或so中获取symbols, 但无法获取完整的函数签名,所以如果在编译时就需要有header配合,在运行时就需要有对应的函数签名。 ```sh ➜ file libcalc.dylib libcalc.dylib: Mach-O 64-bit dynamically linked shared library arm64 ➜ size libcalc.dylib text data bss dec hex filename 104 0 0 104 68 libcalc.dylib...
[Direct Access to Video Encoding and Decoding - WWDC14 - Videos - Apple Developer](https://developer.apple.com/videos/play/wwdc2014/513/) Case Studies 1. Displaying an H.264 stream in a layer in your application 2. Decoding an...