-
Notifications
You must be signed in to change notification settings - Fork 519
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple issues when trying to get CGImage from video file #18452
Comments
Correct, I'll fix this.
Not quite correct, but it's confusing. We've bound We haven't bound In any case, I'm binding the latter anyways now.
Yes, that was to fix #16314 to make the API easier to use. We'll remove one of those overloads the next time we can do breaking changes.
I think I see the problem here. I'll have a look.
Use |
…gs. Partial fix for dotnet#18452. * The 'copyCGImageAtTime:actualTime:error:' selector is deprecated, so replicate that. * Bind the 'generateCGImageAsynchronouslyForTime:completionHandler:' selector. Fixes parts 1 and 2 of dotnet#18452.
…an INativeObject wrapper instance. Fixes part of dotnet#18452. Also don't create the instance directly from third-party bindings, the required constructor might not be public - use Runtime.GetINativeObject instead. Fixes part 4 of dotnet#18452.
Closing, since all the relevant fixes have been merged. |
My goal is to get a thumbnail image from a video file and I was using
AVAssetImageGenerator.CopyCGImageAtTime
for this.Now I experienced crashes coming from that method and while investigating, I noticed that the method deprecated.
Problem 1: This method is not marked deprecated in the bindings, see: /~https://github.com/xamarin/xamarin-macios/blob/2761123a6bf6dd8eed5dd91ac85f969711f38114/tests/xtro-sharpie/iOS-AVFoundation.todo#L9
So according to Apple one should use the image(at:) method (which is Swift only so there are no .Net bindings for it) or the generateCGImagesAsynchronouslyForTimes:completionHandler: method.
Problem 2: This method is not bound at all, see: /~https://github.com/xamarin/xamarin-macios/blob/2761123a6bf6dd8eed5dd91ac85f969711f38114/tests/xtro-sharpie/iOS-AVFoundation.todo#L72
Ok, then I try the generateCGImagesAsynchronouslyForTimes:completionHandler: method instead, which is bound.
Problem 3: This method seems to be bound twice, which is rather confusing:

Ok, but I try it, like this:
Problem 4: When I run this method with a bunch of files (in rather quick succession), it crashes quite often:
Visual Studio logs this crash report in the Output window:
It looks like this crash happens when the thumbnail retrieval failed and IntPtr imageRef==0 (and the error parameter contains the retrieval error).
I seem to be able to workaround the crash by using the other binding method that returns the
IntPtr
instead of theCGImage
in the callback, but I am not sure if to specify "true" or "false" for theowns
parameter when constructing the CGImage object:Environment
Version information
The text was updated successfully, but these errors were encountered: