[MAD Decoder] Patch a slight bug in libmad
There was a slight bug with handling Xing/LAME headers with main data pointers indicating data preceding the header frame. This should allow decoding their information properly. Signed-off-by: Christopher Snowhill <kode54@gmail.com>swiftingly
parent
163ae5c864
commit
453e29b2f5
|
@ -178,6 +178,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
free(tagBuffer);
|
free(tagBuffer);
|
||||||
|
} else if(stream.error == MAD_ERROR_BADDATAPTR) {
|
||||||
|
goto framedecoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
|
@ -190,6 +192,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
framedecoded:
|
||||||
framesDecoded++;
|
framesDecoded++;
|
||||||
|
|
||||||
if(framesDecoded == 1) {
|
if(framesDecoded == 1) {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
Built with the Homebrew defaults, sort of:
|
Built with the Homebrew defaults, sort of. Plus a patch to fix weird LAME/Xing
|
||||||
|
headers:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
patch -Np1 -i libmad_ancdata.patch
|
||||||
touch NEWS
|
touch NEWS
|
||||||
touch AUTHORS
|
touch AUTHORS
|
||||||
touch ChangeLog
|
touch ChangeLog
|
||||||
|
@ -9,4 +11,4 @@ autoreconf -fiv
|
||||||
make -j8 CFLAGS="-Os -arch x86_64 -arch arm64 -mmacosx-version-min=10.12" LDFLAGS="-arch x86_64 -arch arm64 -mmacosx-version-min=10.12"
|
make -j8 CFLAGS="-Os -arch x86_64 -arch arm64 -mmacosx-version-min=10.12" LDFLAGS="-arch x86_64 -arch arm64 -mmacosx-version-min=10.12"
|
||||||
```
|
```
|
||||||
|
|
||||||
Version 0.15.1b was used.
|
Version 0.15.1b was used, with the minor patch listed above.
|
||||||
|
|
Binary file not shown.
|
@ -0,0 +1,29 @@
|
||||||
|
diff -urN libmad-0.15.1b.orig/frame.c libmad-0.15.1b.patched/frame.c
|
||||||
|
--- libmad-0.15.1b.orig/frame.c 2022-06-19 17:20:02.000000000 -0700
|
||||||
|
+++ libmad-0.15.1b.patched/frame.c 2022-06-19 18:18:39.000000000 -0700
|
||||||
|
@@ -473,7 +473,9 @@
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
fail:
|
||||||
|
- stream->anc_bitlen = 0;
|
||||||
|
+ if(stream->error != MAD_ERROR_BADDATAPTR) {
|
||||||
|
+ stream->anc_bitlen = 0;
|
||||||
|
+ }
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff -urN libmad-0.15.1b.orig/layer3.c libmad-0.15.1b.patched/layer3.c
|
||||||
|
--- libmad-0.15.1b.orig/layer3.c 2022-06-19 17:20:02.000000000 -0700
|
||||||
|
+++ libmad-0.15.1b.patched/layer3.c 2022-06-19 18:18:47.000000000 -0700
|
||||||
|
@@ -2656,6 +2656,11 @@
|
||||||
|
stream->anc_ptr = ptr;
|
||||||
|
stream->anc_bitlen = md_len * CHAR_BIT - data_bitlen;
|
||||||
|
}
|
||||||
|
+ else {
|
||||||
|
+ /* Give it the rest of the frame */
|
||||||
|
+ stream->anc_ptr = stream->ptr;
|
||||||
|
+ stream->anc_bitlen = frame_free * CHAR_BIT;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
# if 0 && defined(DEBUG)
|
||||||
|
fprintf(stderr,
|
Loading…
Reference in New Issue