Bug 99483

Summary: Add a mimetype for Khronos texture files
Product: shared-mime-info Reporter: Fredrik Höglund <fredrik>
Component: freedesktop.org.xmlAssignee: Shared Mime Info group <shared_mime_info>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: patch
patch v2

Description Fredrik Höglund 2017-01-21 16:53:38 UTC
The attached patch
Comment 1 Fredrik Höglund 2017-01-21 17:00:46 UTC
Created attachment 129082 [details] [review]
patch

(Hit enter too soon, sorry about that)

The attached patch adds a mimetype for Khronos texture files (image/ktx).
It includes a test file from the SDK.

https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#mimeregistration
Comment 2 Bastien Nocera 2017-01-21 17:19:37 UTC
Please add a link to:
https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#5
in the commit message, as that's where the mime-type itself comes from.

However, this page only mentions one magic. Where are the others coming from?
Comment 3 Fredrik Höglund 2017-01-21 18:11:41 UTC
(In reply to Bastien Nocera from comment #2)
> Please add a link to:
> https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#5
> in the commit message, as that's where the mime-type itself comes from.

Will do.

> However, this page only mentions one magic. Where are the others coming from?

It's one 12 byte magic, split into three 32-bit values. I tried entering it as a string, but the escaped non-ascii characters are converted to UTF8 so that doesn't work. The ^Z character is also not a valid xmlChar.
Comment 4 Bastien Nocera 2017-01-21 18:26:15 UTC
(In reply to Fredrik Höglund from comment #3)
> (In reply to Bastien Nocera from comment #2)
> > Please add a link to:
> > https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#5
> > in the commit message, as that's where the mime-type itself comes from.
> 
> Will do.
> 
> > However, this page only mentions one magic. Where are the others coming from?
> 
> It's one 12 byte magic, split into three 32-bit values. I tried entering it
> as a string, but the escaped non-ascii characters are converted to UTF8 so
> that doesn't work. The ^Z character is also not a valid xmlChar.

I missed the offsets. But that's the wrong check. You're checking for this at offset 0, *or* that at offset 4, etc.

I've fixed it up.

commit 1e44ab018eb75c82fa8b870a861d30cc603f1423
Author: Fredrik Höglund <fredrik@kde.org>
Date:   Sat Jan 21 16:33:12 2017 +0100

    Add a mimetype for Khronos texture files
    
    As defined at:
    https://www.khronos.org/opengles/sdk/tools/KTX/file_format_spec/#5
    
    https://bugs.freedesktop.org/show_bug.cgi?id=99483
Comment 5 Fredrik Höglund 2017-01-21 18:26:26 UTC
Created attachment 129086 [details] [review]
patch v2
Comment 6 Fredrik Höglund 2017-01-21 19:30:43 UTC
Thanks. I missed that part of the spec.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.