Skip to content
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

can not decode APICFrame picutreData (mimetype=image/png, encoding=UTF-16, description=Cover) #9087

Closed
Empressia opened this issue Jun 20, 2021 · 4 comments
Assignees
Labels

Comments

@Empressia
Copy link

Empressia commented Jun 20, 2021

Problem

I extracted the APICFrame from an MP3 file and tried to decode it with BitmapFactory#decodeByteArray.
but it returns null.

MP3 file information

MP3 files are updated by mutagen (version 1.45.1 python library),
For AICFrames, the encoding is UTF-16, MIMEType is image/png, and description is "Cover".

APICFrame#toString()

APIC: mimeType=image/png, description=Cove�

It is dingy.

Environment

  • ExoPlayer version number -> 2.14.0
  • Android version -> 11
  • Android device -> Xperia 10 II

extras

  • When I updated description from "Cover" to ""(0 length string) by mutagen, i can get a bitmap expected (non null).
  • When I updated encoding from UTF-16 to ISO-8859-1, i can get a bitmap expected (non null).
  • When I updated image with JPEG, i can get a bitmap expected (non null).
  • When I updated MP3 file with WMP, i get null by decoding.
@Empressia
Copy link
Author

I made a mistake, so I'll fix it.

@Empressia
Copy link
Author

fix UTF-8 to UTF-16 (I didn't know how to fix the title...).

@Empressia Empressia reopened this Jun 20, 2021
@Empressia Empressia changed the title can not decode APICFrame picutreData (mimetype=image/png, encoding=UTF-8, description=Cover) can not decode APICFrame picutreData (mimetype=image/png, encoding=UTF-16, description=Cover) Jun 20, 2021
@Empressia
Copy link
Author

I added test case to my fork repository.
https://github.com/Empressia/ExoPlayer/tree/dev-v2-issue-9087
Empressia@b0f0415

  • Test Result.

    expected: Hello World
    but was : Hello World Ă̄Ԇ܈ऀ

@ojw28 ojw28 assigned ojw28 and unassigned Samrobbo Sep 7, 2021
@ojw28 ojw28 removed the needs triage label Sep 7, 2021
@ojw28
Copy link
Contributor

ojw28 commented Sep 7, 2021

Thanks for reporting this. There's a small bug detecting string termination if (a) UTF-16 is used, and (b) the string starts at an non-even offset in the ID3 data. We'll push a fix.

ojw28 added a commit that referenced this issue Sep 7, 2021
The current detection logic checks that the two byte terminator starts
at an even position in the ID3 data, where-as it should check that it
starts at an even position relative to the start of the string.

#minor-release
#exofixit
Issue: #9087
PiperOrigin-RevId: 395274934
@ojw28 ojw28 closed this as completed Sep 7, 2021
christosts pushed a commit that referenced this issue Sep 21, 2021
The current detection logic checks that the two byte terminator starts
at an even position in the ID3 data, where-as it should check that it
starts at an even position relative to the start of the string.

Issue: #9087
PiperOrigin-RevId: 395274934
@google google locked and limited conversation to collaborators Nov 7, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants