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

Multiple binding signature issues with AVAssetWriter related types #21509

Open
jeremy-visionaid opened this issue Oct 23, 2024 · 4 comments
Open
Milestone

Comments

@jeremy-visionaid
Copy link
Contributor

jeremy-visionaid commented Oct 23, 2024

Apple platform

iOS, Mac Catalyst

Framework version

net8.0-, net9.0-

Affected platform version

.NET 8.0.403

Description

public AVAssetWriter(NSUrl outputUrl, string outputFileType, out NSError error);

Should be

public AVAssetWriter(NSUrl outputUrl, AVFileTypes outputFileType, out NSError error);

Or the enum's FieldAttribute value should be conventiently accessible as a string somewhere

Similarly,
AVAssetWriterInput exposes all the MediaTypes as a string instead of a AVMediaTypes enum and there appears to be no convenient alternative.

Steps to Reproduce

Can just look at the docs:

AVAssetWriter:

https://developer.apple.com/documentation/avfoundation/avassetwriter/1426663-assetwriterwithurl?language=objc

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avassetwriter.-ctor?view=xamarin-ios-sdk-12#avfoundation-avassetwriter-ctor(foundation-nsurl-system-string-foundation-nserror@)

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avfiletypes?view=xamarin-ios-sdk-12

AVAssetWriterInput:

https://developer.apple.com/documentation/avfoundation/avassetwriterinput/1385912-initwithmediatype?language=objc

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avassetwriterinput.-ctor?view=xamarin-ios-sdk-12#avfoundation-avassetwriterinput-ctor(system-string-avfoundation-audiosettings)

https://learn.microsoft.com/en-us/dotnet/api/avfoundation.avmediatypes?view=xamarin-ios-sdk-12

Did you find any workaround?

AVFileTypesExtensions.GetConstant()
AVFileTypesExtensions.GetValue()

Relevant log output

No response

@jeremy-visionaid
Copy link
Contributor Author

@rolfbjarne I think this type of issue has come up before (i.e. mismatched strings/enums), and it probably isn't limited to these particular types, just these are the ones that have come up most recently.

Unfortunately, I also can't link to the current documentation due to dotnet/dotnet-api-docs#10178

@snechaev
Copy link
Contributor

snechaev commented Oct 24, 2024

Or the enum's FieldAttribute value should be conventiently accessible as a string somewhere

Correct me if I'm wrong, but the AVFileTypesExtensions.GetConstant() extension method should do the trick, so the AVFileTypes.Aifc.GetConstant()=="public.aifc-audio"

And such an extensions (and the opposite ones like an AVFileTypesExtensions.GetValue(NSString) that can get the C# enum from the string value) exist for the many enums in the Xamarin that are bound to the native entities.

@rolfbjarne
Copy link
Member

Or the enum's FieldAttribute value should be conventiently accessible as a string somewhere

As @snechaev mentioned, the field value is accessible using the GetConstant extension method on the enum value:

var str = AVFileTypes.Aifc.GetConstant ();

We should still add the overloads that take the enum though, so keeping this open.

@rolfbjarne rolfbjarne added this to the Future milestone Oct 24, 2024
@jeremy-visionaid
Copy link
Contributor Author

@tolszak:

Or the enum's FieldAttribute value should be conventiently accessible as a string somewhere

Correct me if I'm wrong, but the AVFileTypesExtensions.GetConstant() extension method should do the trick, so the AVFileTypes.Aifc.GetConstant()=="public.aifc-audio"

And such an extensions (and the opposite ones like an AVFileTypesExtensions.GetValue(NSString) that can get the C# enum from the string value) exist for the many enums in the Xamarin that are bound to the native entities.

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

No branches or pull requests

3 participants