mirror of
https://github.com/wader/fq.git
synced 2024-11-22 07:16:49 +03:00
decode: Fix MapRawToScalar regression
This commit is contained in:
parent
986d5ecc50
commit
c083a9e475
2
format/matroska/testdata/avc.fqtest
vendored
2
format/matroska/testdata/avc.fqtest
vendored
@ -462,7 +462,7 @@ $ fq -d matroska verbose /avc.mkv
|
||||
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
|
||||
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
|
||||
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
|
||||
0x010|d9 23 ee ef |.#.. |
|
||||
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
|
||||
0x020|31 36 31 20 72 33 30 32 30 20 64 31 39 38 39 33|161 r3020 d19893|
|
||||
|
2
format/mp4/testdata/avc.fqtest
vendored
2
format/mp4/testdata/avc.fqtest
vendored
@ -404,7 +404,7 @@ $ fq -d mp4 verbose /avc.mp4
|
||||
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
|
||||
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
|
||||
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
|
||||
0x010|d9 23 ee ef |.#.. |
|
||||
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
|
||||
0x020|31 36 31 20 72 33 30 32 30 20 64 31 39 38 39 33|161 r3020 d19893|
|
||||
|
2
format/mp4/testdata/fragmented.fqtest
vendored
2
format/mp4/testdata/fragmented.fqtest
vendored
@ -1109,7 +1109,7 @@ $ fq -d mp4 verbose /fragmented.mp4
|
||||
| | | sei: {} (avc_sei) 0x0-0x25b.7 (604)
|
||||
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
|
||||
0x000| ff ff 59 | ..Y | payload_size: 599 0x1-0x3.7 (3)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
|
||||
0x010|d9 23 ee ef |.#.. |
|
||||
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x25a.7 (583)
|
||||
0x020|31 36 31 20 72 33 30 33 39 20 35 34 34 63 36 31|161 r3039 544c61|
|
||||
|
2
format/mpeg/testdata/avc_annexb.fqtest
vendored
2
format/mpeg/testdata/avc_annexb.fqtest
vendored
@ -91,7 +91,7 @@ $ fq -d avc_annexb verbose /avc_annexb
|
||||
| | | sei: {} (avc_sei) 0x0-0x2ab.7 (684)
|
||||
0x000|05 |. | payload_type: "user_data_unregistered" (5) 0x0-0x0.7 (1)
|
||||
0x000| ff ff a9 | ... | payload_size: 679 0x1-0x3.7 (3)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: raw bits 0x4-0x13.7 (16)
|
||||
0x000| dc 45 e9 bd e6 d9 48 b7 96 2c d8 20| .E....H..,. | uuid: "x264" (raw bits) 0x4-0x13.7 (16)
|
||||
0x010|d9 23 ee ef |.#.. |
|
||||
0x010| 78 32 36 34 20 2d 20 63 6f 72 65 20| x264 - core | data: raw bits 0x14-0x2aa.7 (663)
|
||||
0x020|31 36 31 20 72 33 30 33 39 20 35 34 34 63 36 31|161 r3039 544c61|
|
||||
|
@ -128,10 +128,7 @@ func (d *D) MapURangeToScalar(rm map[[2]uint64]Scalar) func(s Scalar) (Scalar, e
|
||||
|
||||
func (d *D) MapSRangeToScalar(rm map[[2]int64]Scalar) func(s Scalar) (Scalar, error) {
|
||||
return func(s Scalar) (Scalar, error) {
|
||||
n, ok := s.Actual.(int64)
|
||||
if !ok {
|
||||
return s, nil
|
||||
}
|
||||
n := s.ActualS()
|
||||
for r, rs := range rm {
|
||||
if n >= r[0] && n <= r[1] {
|
||||
ns := rs
|
||||
@ -151,8 +148,7 @@ type BytesToScalar []struct {
|
||||
|
||||
func (d *D) MapRawToScalar(btss BytesToScalar) func(s Scalar) (Scalar, error) {
|
||||
return func(s Scalar) (Scalar, error) {
|
||||
// TODO: check type assert?
|
||||
ab, err := s.Actual.(*bitio.Buffer).Bytes()
|
||||
ab, err := s.ActualBitBuf().Bytes()
|
||||
if err != nil {
|
||||
return s, err
|
||||
}
|
||||
@ -160,6 +156,7 @@ func (d *D) MapRawToScalar(btss BytesToScalar) func(s Scalar) (Scalar, error) {
|
||||
if bytes.Equal(ab, bs.Bytes) {
|
||||
ns := bs.Scalar
|
||||
ns.Actual = s.Actual
|
||||
s = ns
|
||||
break
|
||||
}
|
||||
}
|
||||
@ -388,6 +385,7 @@ func (d *D) tryText(nBytes int, e encoding.Encoding) (string, error) {
|
||||
// read length prefixed text (ex pascal short string)
|
||||
// lBits length prefix
|
||||
// fixedBytes if != -1 read nBytes but trim to length
|
||||
//nolint:unparam
|
||||
func (d *D) tryTextLenPrefixed(lenBits int, fixedBytes int, e encoding.Encoding) (string, error) {
|
||||
p := d.Pos()
|
||||
l, err := d.bits(lenBits)
|
||||
|
Loading…
Reference in New Issue
Block a user