Post

Replies

Boosts

Views

Activity

Draw something to CAMetalLayer cause it shows all red
I am writing something about video decoding. Now I have met some problems on darwin. First init the layer and bind it to a view CAMetalLayer *layer = [[CAMetalLayer alloc] init]; layer.device = MTLCreateSystemDefaultDevice(); layer.pixelFormat = MTLPixelFormatBGRA8Unorm; layer.drawableSize = self.view.frame.size; layer.contentsGravity = kCAGravityCenter; self.view.wantsLayer = YES; self.view.layer = layer; next when the video decoded frame coming, id <CAMetalDrawable> drawable = [metal_layer_ nextDrawable]; if (!drawable) { return; } id <MTLTexture> texture = [drawable texture]; IOSurfaceRef surface = [texture iosurface]; void *base_address = IOSurfaceGetBaseAddress(surface); int pitch[] = {(int) (IOSurfaceGetBytesPerRow(surface)), 0}; uint8_t *pixels[] = {static_cast<uint8_t *>(base_address), nullptr}; fn(pixels, pitch); // Which is ffmpeg swscale. [drawable present]; This does not work at all, the whole screen is red and would never change while new frame is coming. And I tried another way to present the video frame. It is still red. Is there any thing wrong or missed.
1
0
982
Mar ’23
Dylib with bitcode missing
Hi there, Currently we are developing a dynamic library written in C++, target to run on arm64 ios. Things become wired when we try to archive the final project. It says, bitcode bundle could not be generated because 'the_path_to.dylib' was built without full bitcode. Some brief arch of this project lists below, we use cmake and this toolchain to build this dylib. It has an argument named ENABLE_BITCODE. It would append -fembed-bitcode to C_FLAGS & CXX_FLAGS. BTW, we use clang & clang++ as C and C++ compiler. this dylib has several dependencies, such as libcurl, libffi. We download them from vcpkg then build with bitcode enabled. As mentioned above, running it directly on the phone works as we expected. But we can't archive it. using otool -l the_path_to.dylib | grep bitcode shows nothing. We still want to make it support bitcode feature. Is there anything we miss to do to enable this? About bitcode, is there anything to learn? Is there an accurate way to find out that the dylib support bitcode or not? Thanks in advance.
0
0
641
Dec ’21
Binary is improperly signed but the copy is ok
Hi there, We are developing an applicaton that can update itself. For example, we have two version 1 & 2. Both of them are signed, notarlized and stapled mac app bundle. When the version 1 find that there is a new version. It would download the difference. Then open another application named updater we developed. The updater use some posix function such as fopen, fwrite, chmod and link to copy/delete files to make the original one as the same as the version 2. The problem comes out here. When we open the updated one, the syslog says that binary is improperly signed. I don't know which step is incorrect. I make a copy of this app, it works perfectly. I guess there is something wrong with the application updater. We tried make the updater to be a single executable file or an signed, notarlized and stapled application bundle and still not work. After read some threads I still could not find out what is it. Hope someone could help me about this. Thanks in advance!
3
0
895
Sep ’21
Semaphore issues
I am developing a desktop application on macOS X. It is ok to use sem_open("name", O_CREAT, 0644, 0) under console application. But if it is a desktop application, it would result into a SEM_FAILED. And the error is EPERM(Operation not permitted). Is there any way to use semaphore in this situation? Cannot find any article to explain something about this. The os version is 10.15.7. Thx a lot.
13
0
2.5k
Feb ’21