jean343 / Node-OpenMAX

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

Can't seem to get the OMX_IndexParamPortDefinition of VideoDecode #5

Closed skerit closed 7 years ago

skerit commented 7 years ago

In the readme you wrote Use the OMX OMX_GetParameter and OMX_SetParameter to change eCompressionFormat to:

var format = VideoDecode.component.getParameter(VideoDecode.component.in_port, omx.Index.OMX_INDEXTYPE.OMX_IndexParamVideoPortFormat);
format.eCompressionFormat = omx.Video.OMX_VIDEO_CODINGTYPE.OMX_VIDEO_CodingAVC;
VideoDecode.component.setParameter(VideoDecode.component.in_port, omx.Index.OMX_INDEXTYPE.OMX_IndexParamVideoPortFormat, format);

I tried to do this in the SimpleVideoDecoderRenderBuffer.js file, after the initAll call:

omx.Component.initAll([VideoDecode, VideoRender])
  .then(function () {

    VideoDecode.setVideoPortFormat(omx.VIDEO_CODINGTYPE.VIDEO_CodingAVC);

    // out_port is undefined?
    console.log('out_port:', VideoDecode.component.out_port);

    var format = VideoDecode.component.getParameter(VideoDecode.component.out_port, omx.Index.OMX_INDEXTYPE.OMX_IndexParamPortDefinition);
    console.log('FORMAT:')
    console.log(format);
    return

    fs.createReadStream("../../spec/data/video-LQ.h264")
            .pipe(VideoDecode)
            .pipe(TransformFilter)
            .pipe(VideoRender)
            .on('finish', function () {
              console.log("Done");
              process.exit();
            });
  });

But as you can see in the comment, out_format is undefined. What am I doing wrong here?

In case you're wondering: I'm trying to change the scale & position of the video being rendered.

While that probably has to happen in the VideoRender (using OMX_IndexConfigCommonScale perhaps?) I'm just wondering why I'm having trouble with this parameter.

jean343 commented 7 years ago

I fixed the readme, it should read:

var format = VideoDecode.getParameter(VideoDecode.in_port, omx.Index.OMX_INDEXTYPE.OMX_IndexParamVideoPortFormat);
format.eCompressionFormat = omx.Video.OMX_VIDEO_CODINGTYPE.OMX_VIDEO_CodingAVC;
VideoDecode.setParameter(VideoDecode.in_port, omx.Index.OMX_INDEXTYPE.OMX_IndexParamVideoPortFormat, format);

As per changing the scale and position, try the following sample: https://github.com/jean343/Node-OpenMAX/blob/master/perf/PerfRender.ts

It was used to display a matrix of 4x3 videos.

Let me know if there is another issue.

JP