[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/emms fca5f3e7d5 26/42: Use bindat-type in emms-info-fla
From: |
ELPA Syncer |
Subject: |
[elpa] externals/emms fca5f3e7d5 26/42: Use bindat-type in emms-info-flac |
Date: |
Wed, 1 Nov 2023 15:58:01 -0400 (EDT) |
branch: externals/emms
commit fca5f3e7d5358d26e66ef4437ca771ea8645ce0d
Author: Petteri Hintsanen <petterih@iki.fi>
Commit: Petteri Hintsanen <petterih@iki.fi>
Use bindat-type in emms-info-flac
---
emms-info-flac.el | 74 ++++++++++++++++++++++++++++++++++++++-----------------
1 file changed, 51 insertions(+), 23 deletions(-)
diff --git a/emms-info-flac.el b/emms-info-flac.el
index 1ece4f5ac1..d33636b296 100644
--- a/emms-info-flac.el
+++ b/emms-info-flac.el
@@ -30,9 +30,9 @@
;;; Code:
-(require 'bindat)
(require 'emms)
(require 'emms-info-vorbis)
+(require 'bindat)
(defconst emms-info-flac--max-peek-size (* 2048 1024)
"Maximum buffer size for metadata decoding.
@@ -47,34 +47,62 @@ but in practice processing must be constrained to prevent
memory
exhaustion in case of garbled or malicious inputs.")
(defconst emms-info-flac--meta-header-bindat-spec
- '((flags u8)
- (length u24)
- (eval (when (or (> last emms-info-flac--max-peek-size)
- (= last 0))
- (error "FLAC block length %s is invalid" last))))
+ (if emms--use-bindat-type
+ (bindat-type
+ (flags u8)
+ (length uint 24)
+ (_ unit (when (or (> length emms-info-flac--max-peek-size)
+ (= length 0))
+ (error "FLAC block length %s is invalid" length))))
+ '((flags u8)
+ (length u24)
+ (eval (when (or (> last emms-info-flac--max-peek-size)
+ (= last 0))
+ (error "FLAC block length %s is invalid" last)))))
"FLAC metadata block header specification.")
(defconst emms-info-flac--stream-info-block-bindat-spec
- '((min-block-size u16)
- (max-block-size u16)
- (min-frame-size u24)
- (max-frame-size u24)
- (sample-metadata vec 8)
- (md5 vec 16))
+ (if emms--use-bindat-type
+ (bindat-type
+ (min-block-size uint 16)
+ (max-block-size uint 16)
+ (min-frame-size uint 24)
+ (max-frame-size uint 24)
+ (sample-metadata vec 8)
+ (md5 vec 16))
+ '((min-block-size u16)
+ (max-block-size u16)
+ (min-frame-size u24)
+ (max-frame-size u24)
+ (sample-metadata vec 8)
+ (md5 vec 16)))
"FLAC stream info block specification.")
(defconst emms-info-flac--comment-block-bindat-spec
- '((vendor-length u32r)
- (eval (when (> last emms-info-vorbis--max-vendor-length)
- (error "FLAC vendor length %s is too long" last)))
- (vendor-string vec (vendor-length))
- (user-comments-list-length u32r)
- (eval (when (> last emms-info-vorbis--max-comments)
- (error "FLAC user comment list length %s is too long"
- last)))
- (user-comments repeat
- (user-comments-list-length)
- (struct emms-info-vorbis--comment-field-bindat-spec)))
+ (if emms--use-bindat-type
+ (bindat-type
+ (vendor-length uint 32 'le)
+ (_ unit (when (> vendor-length emms-info-vorbis--max-vendor-length)
+ (error "FLAC vendor length %s is too long"
+ vendor-length)))
+ (vendor-string str vendor-length)
+ (user-comments-list-length uint 32 'le)
+ (_ unit (when (> user-comments-list-length
emms-info-vorbis--max-comments)
+ (error "FLAC user comment list length %s is too long"
+ user-comments-list-length)))
+ (user-comments repeat user-comments-list-length
+ type emms-info-vorbis--comment-field-bindat-spec))
+ '((vendor-length u32r)
+ (eval (when (> last emms-info-vorbis--max-vendor-length)
+ (error "FLAC vendor length %s is too long" last)))
+ (vendor-string str (vendor-length))
+ (user-comments-list-length u32r)
+ (eval (when (> last emms-info-vorbis--max-comments)
+ (error "FLAC user comment list length %s is too long"
+ last)))
+ (user-comments repeat
+ (user-comments-list-length)
+ (struct emms-info-vorbis--comment-field-bindat-spec))))
"FLAC Vorbis comment block specification.")
(defun emms-info-flac-decode-metadata (filename)
- [elpa] externals/emms updated (cdea73e122 -> 32fd570ed7), ELPA Syncer, 2023/11/01
- [elpa] externals/emms b083c59e18 07/42: Decode playing time from MP3 files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms e501654df6 01/42: Split some functions for easier testing, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 7ce067566f 02/42: Add some tests for Ogg, Opus and FLAC code, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 45245b8b6b 08/42: Decode playing time from FLAC files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 643284a952 14/42: Streamline Ogg page reading and decoding, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 3f83a56d3f 04/42: Decode playing time from Ogg files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 3a7341f660 17/42: Avoid some copying in emms-info-vorbis-extract-comments, ELPA Syncer, 2023/11/01
- [elpa] externals/emms a6d2bbe484 18/42: Remove useless mapconcat, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 68a0dfa9b8 19/42: Add Unicode character to metadata in test files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms fca5f3e7d5 26/42: Use bindat-type in emms-info-flac,
ELPA Syncer <=
- [elpa] externals/emms a0c4d715f4 12/42: Use fixed sample rate when decoding Opus granule position, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 813c0058bd 28/42: Use bindat-type in emms-info-spc, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 32b394b2b1 34/42: Change tests to use unibyte strings, ELPA Syncer, 2023/11/01
- [elpa] externals/emms c9dce6b305 36/42: Fix tests, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 93c614dc24 32/42: Fix byte compilation errors, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 83490a7218 38/42: Change all tests to use emms-test- prefix, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 8a55be19ba 06/42: Ignore empty Vorbis comments, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 9d71a515f7 09/42: Split emms-info-native to several files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms 29260a991a 11/42: Replace emms-info-native test files, ELPA Syncer, 2023/11/01
- [elpa] externals/emms fe9b0fffe1 16/42: Use strings instead of vectors for Vorbis comments, ELPA Syncer, 2023/11/01