jean343 / Node-OpenMAX

Node wrapper for the OpenMAX library
https://www.npmjs.com/package/openmax
MIT License
16 stars 5 forks source link

Displaying JPEG images to screen #12

Open digi-chris opened 6 years ago

digi-chris commented 6 years ago

Hi,

I'm trying to get JPEG images to display to screen, but my code just seems to hang somewhere after the image decode is initiated and nothing appears on screen. Should the following work?

"use strict";
var fs = require('fs');
var omx = require('openmax');
var ImageDecode = new omx.ImageDecode();
var VideoRender = new omx.VideoRender();
omx.Component.initAll([ImageDecode, VideoRender])
        .then(function () {
          ImageDecode.setInputFormat(omx.IMAGE_CODINGTYPE.IMAGE_CodingJPEG);

          fs.createReadStream("frame_01.jpg")
                  .pipe(ImageDecode)
                  .tunnel(VideoRender)
                  .on('finish', function () {
                    console.log("Done");
                    process.exit();
                  });
        });

Thanks,

Chris.