-
Notifications
You must be signed in to change notification settings - Fork 547
[CoreMedia] Improve CMFormatDescription.SubType properties. Fixes #23217. #23262
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
base: main
Are you sure you want to change the base?
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I'd expect the macios projection of The reason for the initial bug report is that I'd also expect there to be some projection of the values of MediaSubType so that it's possible to write code that's a closer match to the Apple API. e.g. AVCaptureDeviceFormat desc = <something>;
if (desc.MediaSubType == MediaSubType.PixelFormat_32BGRA)
... I think it's more difficult to find things in the dotnet API the further they are from the upstream definition. So, this PR is kind of the opposite of what I was intending to achieve in opening #23217. As Rolf pointed out, all the constants from MediaSubType are actually available in other types (despite the difficultly in actually reasoning that that's the case). Just adding an extra convenience property would be more helpful IMHO: public CVPixelFormatType PixelFormatType {
get {
return MediaType == CMMediaType.Video ? (CVPixelFormatType) MediaSubType : 0;
}
} However, the trouble is with it being a video mediatype is that you don't know whether it is compressed or not, so either the existing Obsoleting CAC3 I think is a good change though, since I'd expect to find it from the usptream identifier |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
💻 [CI Build #ce6f6f0] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #ce6f6f0] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #ce6f6f0] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #ce6f6f0] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
Unfortunately there are no good solutions here, because I completely see the point that On the other hand, it's can also be argued that the
You can do this: AVCaptureDeviceFormat desc = <something>;
if (desc.MediaSubType == (uint) MediaSubType.PixelFormat_32BGRA)
...
Sadly, this isn't an API that maps nicely to C#. Note that you can write code that's pretty close to Objective-C code by using
There are also two pixel format enums: In any case, I'll updating this PR to:
|
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ [PR Build #fb3c205] Build passed (Detect API changes) ✅Pipeline on Agent |
✅ [CI Build #fb3c205] Build passed (Build packages) ✅Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🔥 Failed to compare API and create generator diff 🔥 Error: 'make' failed for the hash e433a6a. Pipeline on Agent |
🔥 [CI Build #fb3c205] Build failed (Build macOS tests) 🔥Build failed for the job 'Build macOS tests' (with job status 'Failed') Pipeline on Agent |
🔥 [CI Build #fb3c205] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 99 tests failed, 14 tests passed. Failures❌ dotnettests tests (iOS)
Html Report (VSDrops) Download ❌ dotnettests tests (MacCatalyst)
Html Report (VSDrops) Download ❌ dotnettests tests (macOS)
Html Report (VSDrops) Download ❌ dotnettests tests (tvOS)
Html Report (VSDrops) Download ❌ generator tests
Html Report (VSDrops) Download ❌ interdependent-binding-projects tests
Html Report (VSDrops) Download ❌ introspection tests
Html Report (VSDrops) Download ❌ linker tests
Html Report (VSDrops) Download ❌ monotouch tests (iOS)
Html Report (VSDrops) Download ❌ monotouch tests (MacCatalyst)
Html Report (VSDrops) Download ❌ monotouch tests (macOS)
Html Report (VSDrops) Download ❌ monotouch tests (tvOS)
Html Report (VSDrops) Download ❌ msbuild tests
Html Report (VSDrops) Download ❌ windows testsHtml Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
This comment has been minimized.
This comment has been minimized.
Well, that's the original bug I'm reporting. It's pretty much exactly what I want to do (since that's the equivalent of how you'd do it natively), but I can't because the projection of |
Any CMPixelFormat value is also a valid CMVideoCodecType value, so duplicate
the values in CMPixelFormat into CMVideoCodecType.
This helps discovery/intellisense.
Fixes #23217.