Skip to content
This repository was archived by the owner on May 22, 2025. It is now read-only.

[activationBytes] Add support for -activation_bytes option #1252

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions lib/options/inputs.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,55 @@ module.exports = function(proto) {

return this;
};

/**
* Specify activation bytes for the last specified input
*
* @method FfmpegCommand#activationBytes
* @category Input
* @param {String} bytes activation bytes
* @return FfmpegCommand
*/
proto.activationBytes = function(bytes) {
if (!this._currentInput) {
throw new Error('No input specified');
}

this._currentInput.options('-activation_bytes', bytes);
return this;
};

/**
* Specify audible key for the last specified input
*
* @method FfmpegCommand#audibleKey
* @category Input
* @param {String} key audible key
* @return FfmpegCommand
*/
proto.audibleKey = function(key) {
if (!this._currentInput) {
throw new Error('No input specified');
}

this._currentInput.options('-audible_key', key);
return this;
};

/**
* Specify audible IV for the last specified input
*
* @method FfmpegCommand#audibleIv
* @category Input
* @param {String} iv audible IV
* @return FfmpegCommand
*/
proto.audibleIv = function(iv) {
if (!this._currentInput) {
throw new Error('No input specified');
}

this._currentInput.options('-audible_iv', iv);
return this;
};
};
17 changes: 17 additions & 0 deletions test/args.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1119,4 +1119,21 @@ describe('Command', function() {
});
});
});
describe('activationBytes', function() {
it('should apply activation bytes to input', function(done) {
new Ffmpeg({ source: this.testfile, logger: testhelper.logger })
.activationBytes('12345678')
._test_getArgs(function(args, err) {
testhelper.logArgError(err);
assert.ok(!err);

// Check if the '-activation_bytes' option is correctly applied
const activationBytesIndex = args.indexOf('-activation_bytes');
assert.ok(activationBytesIndex !== -1, 'Activation bytes option not found');
assert.strictEqual(args[activationBytesIndex + 1], '12345678', 'Activation bytes value does not match');

done();
});
});
});
});