• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

benrr101 / node-taglib-sharp / 48393127

29 Oct 2023 04:39AM UTC coverage: 92.535% (-1.4%) from 93.934%
48393127

push

appveyor

benrr101
Merge branch 'release/v5.2.0'

3244 of 4129 branches covered (0.0%)

Branch coverage included in aggregate %.

2177 of 2177 new or added lines in 61 files covered. (100.0%)

26728 of 28261 relevant lines covered (94.58%)

423.2 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

17.39
/src/mpeg4/boxes/isoChunkOffsetBox.ts
1
import FullBox from "./fullBox";
1✔
2
import Mpeg4BoxHeader from "../mpeg4BoxHeader";
3
import {ByteVector} from "../../byteVector";
1✔
4
import {File} from "../../file";
5
import {Guards} from "../../utils";
1✔
6

7
/**
8
 * This class extends {@link FullBox} to provide an implementation of a ISO/IEC 14496-12 ChunkOffsetBox.
9
 */
10
export default class IsoChunkOffsetBox extends FullBox {
1✔
11
    private _offsetTable: number[];
12

13
    /**
14
     * Private constructor to force construction via static functions.
15
     */
16
    private constructor() {
17
        super();
×
18
    }
19

20
    /**
21
     * Constructs and initializes a new instance of {@link IsoChunkOffsetBox} with a provided header and
22
     * handler by reading the contents from a specified file.
23
     * @param header A {@link Mpeg4BoxHeader} object containing the header to use for the new instance.
24
     * @param file A {@link File} object to read the contents of the box from.
25
     * @param handlerType Type of the handler box object containing the handler that applies to the
26
     *     new instance, or undefined if no handler applies.
27
     */
28
    public static fromFile(header: Mpeg4BoxHeader, file: File, handlerType: ByteVector): IsoChunkOffsetBox {
29
        const instance = new IsoChunkOffsetBox();
×
30
        instance.initializeFromHeaderFileAndHandler(header, file, handlerType);
×
31

32
        const boxData = file.readBlock(instance.dataSize);
×
33
        instance._offsetTable = new Array(boxData.subarray(0, 4).toUint());
×
34

35
        for (let i = 0; i < instance._offsetTable.length; i++) {
×
36
            instance._offsetTable[i] = boxData.subarray(4 + i * 4, 4).toUint();
×
37
        }
38

39
        return instance;
×
40
    }
41

42
    /**
43
     * Gets and sets the data contained in the current instance.
44
     */
45
    public get data(): ByteVector {
46
        const output = ByteVector.fromUint(this._offsetTable.length);
×
47

48
        for (let i = 0; i < this._offsetTable.length; i++) {
×
49
            output.addByteVector(ByteVector.fromUint(this._offsetTable[i]));
×
50
        }
51

52
        return output;
×
53
    }
54

55
    /**
56
     * Updates the existing box position offsets.
57
     * @param sizeDifference A value containing the size change that occurred in the file.
58
     * @param after A value containing the position in the file after which offsets will be invalidated. If an
59
     *     offset is before this point, it won't be updated.
60
     * @internal
61
     */
62
    public updatePositions(sizeDifference: number, after: number): void {
63
        Guards.safeUint(sizeDifference, "sizeDifference");
×
64
        Guards.safeUint(after, "after");
×
65

66
        for (let i = 0; i < this._offsetTable.length; i++) {
×
67
            if (this._offsetTable[i] >= after) {
×
68
                this._offsetTable[i] = this._offsetTable[i] + Number(sizeDifference);
×
69
            }
70
        }
71
    }
72
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc