Skip to content

Commit

Permalink
BinaryEmbed: Support AVIF image format image viewing (gsantner#2252)
Browse files Browse the repository at this point in the history
  • Loading branch information
gsantner authored Mar 29, 2024
1 parent 8cce9b5 commit 21d2f3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
public class EmbedBinaryTextConverter extends TextConverterBase {
private static final List<String> EXT = new ArrayList<>();
private static final List<String> EXT_AUDIO = Arrays.asList(".mp3", ".ogg", ".flac", ".opus", ".oga", ".wma", ".m4a", ".aac", ".wav", ".amr", ".mid", ".midi", ".pcm");
private static final List<String> EXT_IMAGE = Arrays.asList(".jpg", ".jpeg", ".png", ".bmp", ".gif", ".webp", ".svg", ".heic", ".heif");
private static final List<String> EXT_IMAGE = Arrays.asList(".jpg", ".jpeg", ".png", ".bmp", ".gif", ".webp", ".svg", ".heic", ".heif", ".avif");
private static final List<String> EXT_VIDEO = Arrays.asList(".webm", ".mp4", ".mpeg4", ".mpeg", ".mpg", ".mkv", ".3gp", ".ts", ".m4v");

public static final String EXT_MATCHES_M3U_PLAYLIST = "(?i).m3u8?";
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/net/gsantner/opoc/util/GsContextUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2498,9 +2498,15 @@ public List<Pair<String, String>> extractFileMetadata(final Context context, Fil
if (!TextUtils.isEmpty(v)) {
if (mmrfield.first == MediaMetadataRetriever.METADATA_KEY_BITRATE) {
v = GsFileUtils.getHumanReadableByteCountSI(Long.parseLong(v)) + "ps";
if (v.startsWith("-1 ")) {
continue; // invalid / unknown
}
} else if (mmrfield.first == MediaMetadataRetriever.METADATA_KEY_DURATION) {
final int[] hms = GsFileUtils.getTimeDiffHMS(Long.parseLong(v), 0);
v = String.format("%sh %sm %ss", hms[0], hms[1], hms[2]);
if (v.equals("0h 0m 0s")) {
continue; // Duration key might be set but no actual duration information
}
}
append.callback(mmrfield.second, v);
}
Expand Down

0 comments on commit 21d2f3b

Please sign in to comment.