Skip to content
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

AVPlayerItemVideoOutput.CopyPixelBuffer missing/broken #21702

Closed
kiddkaffeine opened this issue Nov 27, 2024 · 1 comment · Fixed by #21710
Closed

AVPlayerItemVideoOutput.CopyPixelBuffer missing/broken #21702

kiddkaffeine opened this issue Nov 27, 2024 · 1 comment · Fixed by #21710
Assignees
Milestone

Comments

@kiddkaffeine
Copy link

kiddkaffeine commented Nov 27, 2024

Apple platform

iOS, macOS

Framework version

net9.0-*

Affected platform version

9.0.100

Description

In Objective C, AVPlayerItemVideoOutput has a method called "CopyPixelBuffer", and the documentation suggests a similar version exists in C#:
https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avplayeritemvideooutput.copypixelbuffer?view=xamarin-ios-sdk-12#avfoundation-avplayeritemvideooutput-copypixelbuffer(coremedia-cmtime-coremedia-cmtime@)

However, this method does not appear to exist.
1>TestFile.cs(55,25): Error CS1061 : 'AVPlayerItemVideoOutput' does not contain a definition for 'CopyPixelBuffer' and no accessible extension method 'CopyPixelBuffer' accepting a first argument of type 'AVPlayerItemVideoOutput' could be found (are you missing a using directive or an assembly reference?)

Using Rider to drill into the class, there does appear to be a method called "WeakCopyPixelBuffer" which returns an IntPtr but this method is protected and thus inaccessible.

Steps to Reproduce

  1. Create a net9.0-macos project
  2. Create an AVPlayerItemVideoOutput and attempt to invoke CopyPixelBuffer, eg
    videoOutput = new AVPlayerItemVideoOutput(); CMTime itemTime = videoOutput.GetItemTime((double)DateTime.Now.Ticks / TimeSpan.TicksPerMillisecond); // CACurrentMediaTime()? videoOutput.CopyPixelBuffer(itemTime, null);

Did you find any workaround?

None so far.

I did find this in the repo:
https://github.com/xamarin/xamarin-macios/blob/d8fba3b358a11b9679df2b8029d2e4a8df91a3b4/src/AVFoundation/AVPlayer.cs#L20
And tried to replicate it with reflection, but it appears to call a constructor for CVPixelBuffer which doesn't exist?

Relevant log output

No response

@rolfbjarne rolfbjarne added this to the Future milestone Nov 28, 2024
@rolfbjarne
Copy link
Member

Looks like we're excluding the API from macOS; the reason for this has been lost in time.

Let me see if I can fix it.

@rolfbjarne rolfbjarne self-assigned this Nov 28, 2024
rolfbjarne added a commit that referenced this issue Nov 28, 2024
…21702.

* The generator can handle the custom logic now, so remove the manually written bindings.
* Add the API for macOS.

Fixes #21702.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants