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

benrr101 / node-taglib-sharp / 48387633

28 Oct 2023 05:34AM UTC coverage: 92.442% (+0.5%) from 91.899%
48387633

push

appveyor

web-flow
Merge 6a78b5713 into f0c9477b7

3250 of 4147 branches covered (0.0%)

Branch coverage included in aggregate %.

1763 of 1763 new or added lines in 39 files covered. (100.0%)

26753 of 28309 relevant lines covered (94.5%)

422.49 hits per line

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

17.39
/src/mpeg4/boxes/isoChunkLargeOffsetBox.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 @see FullBox to provide an implementation of a ISO/IEC 14496-12 ChunkLargeOffsetBox.
9
 *  @TODO: Is this pretty much the same as the non-large offset box?
10
 */
11
export default class IsoChunkLargeOffsetBox extends FullBox {
1✔
12
    private _offsetTable: number[];
13

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

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

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

37
        for (let i = 0; i < instance._offsetTable.length; i++) {
×
38
            instance._offsetTable[i] = Number(boxData.subarray(4 + i * 8, 8).toUlong());
×
39
        }
40

41
        return instance;
×
42
    }
43

44
    /**
45
     * Gets and sets the data contained in the current instance.
46
     */
47
    public get data(): ByteVector {
48
        const output = ByteVector.fromUint(this._offsetTable.length);
×
49
        for (let i = 0; i < this._offsetTable.length; i++) {
×
50
            output.addByteVector(ByteVector.fromUlong(this._offsetTable[i]));
×
51
        }
52

53
        return output;
×
54
    }
55

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

67
        for (let i = 0; i < this._offsetTable.length; i++) {
×
68
            if (this._offsetTable[i] >= after) {
×
69
                this._offsetTable[i] = this._offsetTable[i] + sizeDifference;
×
70
            }
71
        }
72
    }
73
}
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