mirror of
https://github.com/koush/scrypted.git
synced 2026-02-13 02:12:58 +00:00
amcrest/onvif: fix 2 way audio codec matching to ignore case. add support for multichannel audio.
This commit is contained in:
4
plugins/amcrest/package-lock.json
generated
4
plugins/amcrest/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.97",
|
||||
"version": "0.0.98",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.97",
|
||||
"version": "0.0.98",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/amcrest",
|
||||
"version": "0.0.97",
|
||||
"version": "0.0.98",
|
||||
"description": "Amcrest Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
4
plugins/onvif/package-lock.json
generated
4
plugins/onvif/package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.84",
|
||||
"version": "0.0.85",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.84",
|
||||
"version": "0.0.85",
|
||||
"license": "Apache",
|
||||
"dependencies": {
|
||||
"@koush/axios-digest-auth": "^0.8.5",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@scrypted/onvif",
|
||||
"version": "0.0.84",
|
||||
"version": "0.0.85",
|
||||
"description": "ONVIF Camera Plugin for Scrypted",
|
||||
"author": "Scrypted",
|
||||
"license": "Apache",
|
||||
|
||||
@@ -46,16 +46,18 @@ interface CodecMatch {
|
||||
payloadType: string;
|
||||
sdpName: string;
|
||||
sampleRate: string;
|
||||
channels: string;
|
||||
}
|
||||
|
||||
const codecRegex = /a=rtpmap:(\d+) (.*?)\/(\d+)/g
|
||||
function* parseCodecs(audioSection: string): Generator<CodecMatch> {
|
||||
for (const match of audioSection.matchAll(codecRegex)) {
|
||||
const [_, payloadType, sdpName, sampleRate] = match;
|
||||
const [_, payloadType, sdpName, sampleRate, _skip, channels] = match;
|
||||
yield {
|
||||
payloadType,
|
||||
sdpName,
|
||||
sampleRate,
|
||||
channels,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -113,7 +115,7 @@ export class OnvifIntercom implements Intercom {
|
||||
let match: CodecMatch;
|
||||
let codec: SupportedCodec;
|
||||
for (const supported of availableCodecs) {
|
||||
codec = supportedCodecs.find(check => check.sdpName === supported.sdpName);
|
||||
codec = supportedCodecs.find(check => check.sdpName?.toLowerCase() === supported.sdpName.toLowerCase());
|
||||
if (codec) {
|
||||
match = supported;
|
||||
break;
|
||||
@@ -129,9 +131,7 @@ export class OnvifIntercom implements Intercom {
|
||||
'-vn',
|
||||
'-acodec', codec.ffmpegCodec,
|
||||
'-ar', match.sampleRate,
|
||||
// ought to fix this, i think there's a slash that follows the sample rate to indicate number of
|
||||
// channels, but no way of testing at the moment.
|
||||
'-ac', '1',
|
||||
'-ac', match.channels || '1',
|
||||
"-payload_type", match.payloadType,
|
||||
"-ssrc", parseInt(transportDict.ssrc, 16).toString(),
|
||||
'-f', 'rtp',
|
||||
|
||||
Reference in New Issue
Block a user