On Mon, 26 Sep 2022 15:14:46 GMT, Andy Goryachev <[email protected]> wrote:
>> There was two problems:
>> - uri.getPath() was returning null for jar URI, since it is not a standard
>> URI and thus we did not detect file type based on extension.
>> - Our signature detection for MP3 had a bug and did not detect MP3
>> correctly. See comments in code.
>>
>> Fixed by adding function to extract file name from jar URI and also
>> signature detection was fixed for MP3.
>
> modules/javafx.media/src/main/java/com/sun/media/jfxmediaimpl/MediaUtils.java
> line 154:
>
>> 152: } else if ((buf[0] & 0xff) == 0xff && (buf[1] & 0xe0) == 0xe0
>> && // sync
>> 153: (buf[1] & 0x18) != 0x08 && // not reserved version
>> 154: (buf[1] & 0x06) != 0x00) { // not reserved layer
>
> thank you for providing a descriptive comment!
>
> I wonder if, in the future, when the list of supported formats grows, we
> ought to invent some kind of Bit(input)Stream class that would make operating
> on bit fields easier?
I think we can use java.util.BitSet. We can define BitSet for headers and then
use intersects to see if bits are set, but it will be out of scope for this
issue.
-------------
PR: https://git.openjdk.org/jfx/pull/902