Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const numBytesRGBA = width * height * 4 * 4;
const rgbaDst = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const imageDst = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const v210Dst = await context.createBuffer(numBytesV210, 'writeonly', 'coarse');
let dm = await beamy.demuxer('file:../media/dpp/AS11_DPP_HD_EXAMPLE_1.mxf')
console.log(dm)
let dec = await beamy.decoder({ demuxer: dm, stream_index: 0 })
let enc = beamy.encoder({ name: 'v210', codec_id: 127, width: 1920, height: 1080, pix_fmt: 'yuv422p10le', bits_per_raw_sample: 20, time_base: [ 1, 25 ] })
console.log(enc)
let playback = await macadam.playback({
deviceIndex: 0, // Index relative to the 'macadam.getDeviceInfo()' array
displayMode: macadam.bmdModeHD1080i50,
pixelFormat: macadam.bmdFormat10BitYUV
})
let result = []
let counter = 0
async function read() {
let p = await dm.read()
if (p.stream_index === 0) return p
return read()
}
async function processFrame(b) {
let res = []
await v210Src.hostAccess('writeonly')
let lstamp = process.hrtime()
const srcs2 = [
await context.createBuffer(lumaBytes, 'readonly', 'coarse'),
await context.createBuffer(chromaBytes, 'readonly', 'coarse'),
await context.createBuffer(chromaBytes, 'readonly', 'coarse')
];
const numBytesRGBA = width * height * 4 * 4;
const rgbaDst1 = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const rgbaDst2 = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const imageDst = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const v210Dst = await context.createBuffer(numBytesV210, 'writeonly', 'coarse');
let playback = await macadam.playback({
deviceIndex: 0, // Index relative to the 'macadam.getDeviceInfo()' array
displayMode: macadam.bmdModeHD1080i50,
pixelFormat: macadam.bmdFormat10BitYUV
})
function dumpFloatBuf(buf, width, height, numPixels, numLines) {
const r = (b, o) => b.readFloatLE(o).toFixed(4);
for (let y=0; y
res[2] = await v210Writer.toV210(imageDst, v210Dst)
await v210Dst.hostAccess('readonly')
// v210_io.dumpBuf(v210Dst, 1920, 4);
// console.log(process.hrtime(lstamp))
return res;
}
let dm = await beamy.demuxer('file:../media/dpp/AS11_DPP_HD_EXAMPLE_1.mxf')
console.log(dm)
let dec = await beamy.decoder({ demuxer: dm, stream_index: 0 })
let enc = beamy.encoder({ name: 'v210', codec_id: 127, width: 1920, height: 1080, pix_fmt: 'yuv422p10le', bits_per_raw_sample: 20, time_base: [ 1, 25 ] })
console.log(enc)
let playback = await macadam.playback({
deviceIndex: 0, // Index relative to the 'macadam.getDeviceInfo()' array
displayMode: macadam.bmdModeHD1080i50,
pixelFormat: macadam.bmdFormat10BitYUV
})
let counter = 0
const gen = (push, next) => {
dm.read().then(p => {
if (p.stream_index === 0) {
push(null, p)
next()
} else {
gen(push, next)
}
})
}
});
const numBytesV210 = v210_io.getPitchBytes(width) * height;
const v210Src1 = await context.createBuffer(numBytesV210, 'readonly', 'coarse');
const v210Src2 = await context.createBuffer(numBytesV210, 'readonly', 'coarse');
const numBytesRGBA = width * height * 4 * 4;
const rgbaDst1 = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const rgbaDst2 = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const imageDst = await context.createBuffer(numBytesRGBA, 'readwrite', 'coarse');
const v210Dst = await context.createBuffer(numBytesV210, 'writeonly', 'coarse');
let playback = await macadam.playback({
deviceIndex: 0, // Index relative to the 'macadam.getDeviceInfo()' array
displayMode: macadam.bmdModeHD1080i50,
pixelFormat: macadam.bmdFormat10BitYUV
})
async function processFrame(b1, b2, fl) {
let res = []
await v210Src1.hostAccess('writeonly', b1)
await v210Src2.hostAccess('writeonly', b2)
res[0] = await v210Loader1.fromYUV({ source: v210Src1, dest: rgbaDst1 })
res[1] = await v210Loader2.fromYUV({ source: v210Src2, dest: rgbaDst2 })
//await rgbaDst.hostAccess('readonly')
// dumpFloatBuf(rgbaDst, 1920, 2, 4);
res[2] = await testImageProgram.run({input1: rgbaDst1, input2: rgbaDst2, fl: fl, output: imageDst})
//await imageDst.hostAccess('readonly')
// dumpFloatBuf(imageDst, 1920, 2, 4);
res[3] = await v210Saver.toYUV({ source: imageDst, dest: v210Dst })
await v210Dst.hostAccess('readonly')
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
var macIn = require('../valve/macadamInlet.js');
var macadam = require('macadam')
var fs = require('fs');
var count = 0;
var ws = fs.createWriteStream('/Volumes/Ormiscraid/media/streampunk/recordings/fire100f.v210.yuv');
var stopper = null;
var w = macIn(0, macadam.bmdModeHD1080i50, macadam.bmdFormat10BitYUV, function (s) { stopper = s; })
.take(100)
.doto( function (x) {
ws.write(x, function (err) {
if (err) throw err;
console.log('Written', count++);
});
})
.errors(function (e) { console.log(e); })
.done(function () { stopper(); ws.close() });