Skip to content

Conversation

rolfbjarne
Copy link
Member

@rolfbjarne rolfbjarne commented Jul 4, 2025

Any CMPixelFormat value is also a valid CMVideoCodecType value, so duplicate
the values in CMPixelFormat into CMVideoCodecType.

This helps discovery/intellisense.

Also add a CMMediaSubType enum that mirrors the Swift type with the same name, which can be used to improve discovery/intellisense as well.

Additionally, fix a few other issues as well.

Fixes #23217.

…Fixes #23217.

Any CMPixelFormat value is also a valid CMVideoCodecType value, so duplicate
the values in CMPixelFormat into CMVideoCodecType.

This helps discovery/intellisense.

Fixes #23217.
@rolfbjarne rolfbjarne requested a review from dalexsoto as a code owner July 4, 2025 15:23
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@jeremy-visionaid
Copy link
Contributor

jeremy-visionaid commented Jul 6, 2025

I'd expect the macios projection of CMVideoCodecType to include only those values from CMVideoCodecType. So, adding pixel formats to it looks incorrect to me if they don't match the upstream definitions.

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 VideoCodecType property or PixelFormatType above might cast to an undefined enum value. (i.e. IMHO it would be better to just have the MediaSubType constants than any of the convenience properties).

Obsoleting CAC3 I think is a good change though, since I'd expect to find it from the usptream identifier iec60958AC3 rather than named from its FourCC value. 👍

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@jeremy-visionaid
Copy link
Contributor

LGTM now. Nice one, thanks!

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne requested review from dalexsoto and mandel-macaque and removed request for dalexsoto and mandel-macaque October 15, 2025 22:35
@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #9a5848b] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #9a5848b] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

NET (empty diffs)

✅ API diff vs stable

NET (empty diffs)

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #9a5848b] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #9a5848b] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #9a5848b] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #9a5848b] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #9a5848b] Tests on macOS arm64 - Mac Tahoe (26) passed 💻

All tests on macOS arm64 - Mac Tahoe (26) passed.

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #9a5848b] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@rolfbjarne rolfbjarne enabled auto-merge (squash) October 16, 2025 11:07
@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #9a5848b] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 117 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. [attempt 2] Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 11 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 9a5848b101ec3d203dfb044a5bf5b043d9abf4d1 [PR build]

@rolfbjarne rolfbjarne merged commit 22ededc into main Oct 16, 2025
45 checks passed
@rolfbjarne rolfbjarne deleted the dev/rolf/cmformat-mediasubtype branch October 16, 2025 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing constants for CMFormatDescription.MediaSubType

5 participants