How to use macadam - 10 common examples

To help you get started, we’ve selected a few macadam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Streampunk / casparcl / scratch / promise_clunker.js View on Github external
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()
		b.copy(v210Src)
github Streampunk / casparcl / scratch / high_beam_cl.js View on Github external
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)
			}
		})
	}

	let pipel = H.pipeline(
github Streampunk / casparcl / scratch / ebu_oss_clunker.js View on Github external
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
github Streampunk / casparcl / scratch / promise_clunker.js View on Github external
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()
github Streampunk / casparcl / scratch / ebu_oss_clunker.js View on Github external
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
github Streampunk / casparcl / scratch / high_beam_cl.js View on Github external
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)
			}
		})
	}
github Streampunk / casparcl / scratch / high_beam_cl.js View on Github external
//await imageDst.hostAccess('readonly')
		// dumpFloatBuf(imageDst, 1920, 2, 4);
		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)
			}
		})
github Streampunk / casparcl / scratch / promise_clunker.js View on Github external
const numBytesV210 = v210_io.getPitchBytes(width) * height;
	const v210Src = await context.createBuffer(numBytesV210, 'readonly', 'coarse');

	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 = []
github Streampunk / casparcl / scratch / ebu_oss_clunker.js View on Github external
await context.createBuffer(chromaBytes, 'readonly', 'coarse')
  ];
	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
github Streampunk / casparcl / scratch / mixer_clunker.js View on Github external
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')
		// v210_io.dumpBuf(v210Dst, 1920, 4);

macadam

Async node.js interface to Blackmagic Design capture and playback devices.

Apache-2.0
Latest version published 3 years ago

Package Health Score

45 / 100
Full package analysis