mpv
mpv copied to clipboard
osxbundle: refactor Information Property List
Replaces deprecated CFBundleTypeExtensions with LSItemContentTypes. LSHandlerRank ranks apps that declare as editors or viewers of a specific file type. Default value was chosen since mpv is a viewer of file types as opposed to an editor. I tested this patch with some filetypes (avi,mkv,mov,wav) and the launch service seemed to behave appropriately.
Download the artifacts for this pull request:
i don't think CFBundleTypeExtensions and LSItemContentTypes are interchangeable. from the documentation former expects file extensions and the latter expects UTIs (all UTIs).
if we want to support file extensions that aren't defined by Apple we do need to define them and make them conform to one of the existing UTIs, eg with UTExportedTypeDeclarations and UTTypeConformsTo. probably similar to what we or VLC does.
okay let get this a little bit sorted. lets start by cleaning up the CFBundleDocumentTypes and UTImportedTypeDeclarations node.
lets keep it to 3 different CFBundleDocumentTypes like currently, video, audio and subtitle files. though lets order them a bit different. the flat nodes at top and the collections/arrays at the bottom. for audio i would start with the general public.audio, video with public.video and public.movie and subtitles public.plain-text.
<dict>
<key>CFBundleTypeIconFile</key>
<string>document.icns</string>
<key>CFBundleTypeName</key>
<string>Audio file</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
<key>LSItemContentTypes</key>
<array>
<string>UTI.URL.HERE</string>
...
</array>
</dict>
after that we start to sort out the UTImportedTypeDeclarations node. ever entry should conform (UTTypeConformsTo node) to either public.audio, public.movie or public.plain-text depending on the type. take over, fill or extend the UTTypeIdentifier (UTI), UTTypeTagSpecification (with extension and mime-type declaration). any UTTypeIdentifier added here should be added to one of the three CFBundleDocumentTypes contained nodes (audio, video, subtitle) in the LSItemContentTypes array node. also lets try to sort those nodes, first all audio nodes, then all video node and at the bottom all subtitle nodes. all io.mpv.* UTIs should be replaces with the official UTIs, if possible and existent.
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>GENERAL.UTI.HERE</string>
</array>
<key>UTTypeDescription</key>
<string>AC3 Audio</string>
<key>UTTypeIconFile</key>
<string>document.icns</string>
<key>UTTypeIdentifier</key>
<string>UTI.URL.HERE</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>EXTENSION</string>
...
</array>
<key>public.mime-type</key>
<array>
<string>MIME/TYPE</string>
...
</array>
</dict>
</dict>
lastly i would go through the list again and add all the other audio/video UTIs to the CFBundleDocumentTypes if they aren't already in some way in the UTImportedTypeDeclarations nodes.
References: UTIs: https://developer.apple.com/library/archive/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html Nodes: https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html#//apple_ref/doc/uid/20001431-101685
I reordered CFBundleDocumentTypes types to flat nodes at top and the collections/arrays at the bottom. There are still a few UTI's under LSItemContentTypes that I could not find. (I assume I will need to declare them as io.mpv.***.
I also couldn't find public.mime-type for
PCM
HDV
NUV
HEVC
YUV
Y4M
okay, i probably can't review your changes this week. it's a bit busy and i am not home at the weekend. just wanted to give you a heads up that i will try to look at everything as soon as possible.
okay, i probably can't review your changes this week. it's a bit busy and i am not home at the weekend. just wanted to give you a heads up that i will try to look at everything as soon as possible.
Thanks, no rush!
hope i've got everything.
hope this will be the last batch of comments.
only this one last thing. after this feel free to squash the commits and force push. then we can finally get this merged.
thank you for you hard work on this one, i really appreciate it.