Flip video using Argus API

Facedetection works great as long as everything isn’t upside down. Is there an Argus interface that allows you to flip the video stream?

@Atrer
Please try to use video converter “V4L2_CID_VIDEO_CONVERT_FLIP_METHOD”

Here’s my attempt at using V4L2_CID_VIDEO_CONVERT_FLIP_METHOD. I added this code (taken from NvVideoConverter::setFlipMethod) to the top of argus_oneshot to try and take a rotated picture. However ioctl is returning EFAULT (Bad address).

#include <linux/videodev2.h>
#include "v4l2_nv_extensions.h"
#include <fcntl.h>
#include <sys/ioctl.h>

int main(int argc, char** argv)
{
    int fd = open("/dev/nvhost-vic", O_RDWR);

    if(fd == -1) printf("Could not open device /dev/nvhost-vic\n");
    else
    {
        struct v4l2_ext_control ctl;
        struct v4l2_ext_controls controls;
        memset(&ctl, 0, sizeof(ctl));
        memset(&controls, 0, sizeof(controls));

        ctl.id = (V4L2_CID_VIDEO_CONVERT_FLIP_METHOD);
        ctl.value = (uint32_t)V4L2_FLIP_METHOD_180;
        controls.controls = &ctl;
        controls.count = 1;

        if( ioctl(fd, VIDIOC_S_EXT_CTRLS, &controls) != 0) perror("Flip failed");
    }

    [...]
}

@Atrer
Please reference to the tegra_multimedia_api/samples/07_video_convert to use the NvVideoConverter class.

if (ctx.flip_method != -1)
    {
        ret = main_conv->setFlipMethod(ctx.flip_method);
        TEST_ERROR(ret < 0, "Could not set flip method", cleanup);
    }

Tried that, but couldn’t figure out how to set up Cmake to get rid of the linker errors. It seemed like a pretty thin wrapper around the ioctl.

I’ll try getting NvVideoConverter working again.