Updating build

This commit is contained in:
watsonb8 2020-11-01 20:31:10 -05:00
parent a3d64fb00b
commit d59a58f63d
4 changed files with 5 additions and 114 deletions

6
.gitignore vendored
View File

@ -8,7 +8,6 @@ lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
@ -113,4 +112,7 @@ dist
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
.pnp.*
tsconfig.tsbuildinfo
lib

View File

@ -1,110 +0,0 @@
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var child_process_1 = require("child_process");
var events_1 = require("events");
var fs_1 = __importDefault(require("fs"));
var Rtsp = /** @class */ (function (_super) {
__extends(Rtsp, _super);
function Rtsp(connectionString) {
var _this = _super.call(this) || this;
_this.onError = function (err) {
console.error('Failed to start stream: ' + err.message);
};
_this.onStdErrorData = function (data) {
if (!_this._started) {
_this._started = true;
}
data.toString().split(/\n/).forEach(function (line) {
console.debug(line);
});
};
_this.onExit = function (code, signal) {
var message = 'FFmpeg exited with code: ' + code + ' and signal: ' + signal;
if (code == null || code === 255) {
if (_this._childProcess && _this._childProcess.killed) {
console.debug(message + ' (Expected)');
}
else {
console.error(message + ' (Unexpected)');
}
}
else {
console.error(message + ' (Error)');
}
};
_this.onData = function (data) {
if (data.length > 1) {
_this._buffer = _this._buffer ? Buffer.concat([_this._buffer, data]) : _this._buffer = Buffer.from(data);
//End of image
if (data[data.length - 2].toString(16) == "ff" && data[data.length - 1].toString(16) == "d9") {
_this.emit('data', _this._buffer);
_this._buffer = Buffer.from('');
console.log();
}
}
};
_this._started = false;
_this._connecteionString = connectionString;
_this._childProcess = undefined;
_this._buffer = Buffer.from('');
return _this;
}
Object.defineProperty(Rtsp.prototype, "isStarted", {
get: function () {
return this._started;
},
enumerable: true,
configurable: true
});
Rtsp.prototype.start = function () {
var _a;
var args = "-i " + this._connecteionString + " -r 30 -f image2 -update 1 -";
this._childProcess = child_process_1.spawn("ffmpeg", args.split(/\s+/));
if (!this._childProcess) {
return;
}
(_a = this._childProcess.stdout) === null || _a === void 0 ? void 0 : _a.on('data', this.onData);
this._childProcess.on('exit', this.onExit);
this._childProcess.on('error', this.onError);
if (this._childProcess.stderr) {
this._childProcess.stderr.on('data', this.onStdErrorData);
}
};
Rtsp.prototype.close = function () {
this._childProcess && this._childProcess.kill('SIGKILL');
this.emit('closed');
};
Rtsp.prototype.getStdin = function () {
return this._childProcess ? this._childProcess.stdin : null;
};
return Rtsp;
}(events_1.EventEmitter));
exports.Rtsp = Rtsp;
var rtsp = new Rtsp("rtsp://brandon:asdf1234@192.168.1.229/live");
rtsp.on('data', function (data) {
rtsp.close();
fs_1.default.writeFile("/Users/brandonwatson/Documents/Git/Gitea/asdf.jpeg", data, 'base64', function (err) {
if (err) {
console.log(err);
process.exit(1);
}
});
});
rtsp.start();
//# sourceMappingURL=index.js.map

View File

@ -1 +0,0 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,+CAAmD;AACnD,iCAAsC;AAEtC,0CAAoB;AAEpB;IAA0B,wBAAY;IAMlC,cAAY,gBAAwB;QAApC,YACI,iBAAO,SAKV;QAgCO,aAAO,GAAG,UAAC,GAAU;YACzB,OAAO,CAAC,KAAK,CAAC,0BAA0B,GAAG,GAAG,CAAC,OAAO,CAAC,CAAC;QA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AC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;SAC3D;IACP,CAAC;IAEM,oBAAK,GAAZ;QACI,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QACzD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxB,CAAC;IAEM,uBAAQ,GAAf;QACI,OAAO,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC9D,CAAC;IA0CP,WAAC;AAAD,CAAC,AApFD,CAA0B,qBAAY,GAoFrC;AApFY,oBAAI;AAsFjB,IAAM,IAAI,GAAG,IAAI,IAAI,CAAC,4CAA4C,CAAC,CAAC;AACpE,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,IAAY;IACzB,IAAI,CAAC,KAAK,EAAE,CAAC;IACb,YAAE,CAAC,SAAS,CAAC,oDAAoD,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAC,GAAG;QACnF,IAAG,GAAG,EAAC;YACH,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACjB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACnB;IACL,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAA;AACF,IAAI,CAAC,KAAK,EAAE,CAAC"}

View File

@ -14,7 +14,7 @@
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "./lib", /* Redirect output structure to the directory. */
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "composite": true, /* Enable project compilation */
"composite": true, /* Enable project compilation */
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */