• 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

56.0
/src/mpeg4/boxes/fullBox.ts
1
import Mpeg4Box from "./mpeg4Box";
1✔
2
import Mpeg4BoxHeader from "../mpeg4BoxHeader";
1✔
3
import {ByteVector} from "../../byteVector";
1✔
4
import {File} from "../../file";
5
import {Guards, NumberUtils} from "../../utils";
1✔
6

7
/**
8
 * This class extends {@link Mpeg4Box} to provide an implementation of a ISO/IEC 14496-12 FullBox.
9
 */
10
export default abstract class FullBox extends Mpeg4Box {
1✔
11
    private _version: number;
12
    private _flags: number;
13

14
    // #region Constructors
15

16
    /**
17
     * Protected constructor to force construction via static functions.
18
     */
19
    protected constructor() {
20
        super();
700✔
21
    }
22

23
    /**
24
     * Initializes a new instance of {@link FullBox} with a provided header and handler
25
     * by reading the contents from a specified file.
26
     * @param header A {@link Mpeg4BoxHeader} object containing the header to use for the new instance.
27
     * @param file A {@link File} object to read the contents of the box from.
28
     * @param handlerType Type of the handler box object containing the handler that applies to the
29
     *     new instance, or undefined if no handler applies.
30
     */
31
    protected initializeFromHeaderFileAndHandler(header: Mpeg4BoxHeader, file: File, handlerType: ByteVector): void {
32
        Guards.truthy(header, "header");
×
33
        Guards.truthy(file, "file");
×
34

35
        this.initializeFromHeader(header, handlerType);
×
36
        const dataPositionBeforeIncrease = this.increaseDataPosition(4);
×
37

38
        file.seek(dataPositionBeforeIncrease);
×
39
        const headerData = file.readBlock(4);
×
40

41
        this._version = headerData.get(0);
×
42
        this._flags = headerData.subarray(1, 3).toUint();
×
43
    }
44

45
    /**
46
     * Initializes a new instance of {@link FullBox} with a provided header, version, and flags.
47
     * @param type A {@link ByteVector} object containing the four byte box type.
48
     * @param version A value containing the version of the new instance.
49
     * @param flags A value containing the flags for the new instance.
50
     */
51
    protected initializeFromTypeVersionAndFlags(type: ByteVector, version: number, flags: number): void {
52
        Guards.byte(version, "version");
700✔
53
        Guards.byte(flags, "flags");
700✔
54

55
        this.initializeFromHeader(Mpeg4BoxHeader.fromType(type));
700✔
56
        this.increaseDataPosition(4);
700✔
57

58
        this._version = version;
700✔
59
        this._flags = flags;
700✔
60
    }
61

62
    // #endregion
63

64
    /**
65
     * Gets the flags that apply to the current instance.
66
     */
67
    public get flags(): number { return this._flags; }
733✔
68
    /**
69
     * Sets the flags that apply to the current instance.
70
     * @protected
71
     */
72
    protected set flags(value: number) { this._flags = value; }
34✔
73

74
    /**
75
     * Gets the version number of the current instance.
76
     */
77
    public get version(): number { return this._version; }
×
78

79
    /**
80
     * @inheritDoc
81
     * @internal
82
     */
83
    public renderBoxHeaders(): ByteVector[] {
84
        // Generate |<ver>|<    |flags|    >|
85
        const flagsWithVersion = NumberUtils.uintOr(
×
86
            this.flags,
87
            NumberUtils.uintLShift(this.version, 24)
88
        );
89
        return [ByteVector.fromUint(flagsWithVersion)];
×
90
    }
91
}
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