AnsweredAssumed Answered

mxc_v4l2_capture: How to set "standard id"?

Question asked by Eugene Kruglikov on Nov 28, 2019
Latest reply on Dec 4, 2019 by Eugene Kruglikov

Hello. I've modified ov5640.c and tried to use it with my camera (FPGA as a source of video stream).

I faced the trouble, when I tried to capture image from camera through gstreamer:

gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=/cap1.jpeg

I had got error:

ERROR: unrecognized std! 0 (PAL=ff, NTSC=b000)

There is a part of code from mxc_v4l2_capture.c:

static int mxc_v4l2_s_std(cam_data *cam, v4l2_std_id e)
{
    pr_debug("In mxc_v4l2_s_std %Lx\n", e);

 

    if (e == V4L2_STD_PAL) {
        pr_debug("   Setting standard to PAL %Lx\n", V4L2_STD_PAL);
        cam->standard.id = V4L2_STD_PAL;
        video_index = TV_PAL;
    } else if (e == V4L2_STD_NTSC) {
        pr_debug("   Setting standard to NTSC %Lx\n",
                V4L2_STD_NTSC);
        /* Get rid of the white dot line in NTSC signal input */
        cam->standard.id = V4L2_STD_NTSC;
        video_index = TV_NTSC;
    } else {
        cam->standard.id = V4L2_STD_ALL;
        video_index = TV_NOT_LOCKED;
        pr_err("ERROR: unrecognized std! %Lx (PAL=%Lx, NTSC=%Lx\n",
            e, V4L2_STD_PAL, V4L2_STD_NTSC);
    }

...

...

...

Messages log:

root@var-som-mx6:~# dmesg | grep ov5640


[   11.094087] [ov5640] > ov5640_probe
[   11.137421] [ov5640] > Camera ov5640 is found, v4l2_reg resp is 0
[   11.843813] [ov5640] > ioctl_dev_exit
[   11.846878] [ov5640] > ioctl_s_power
[   11.849846] [ov5640] > ioctl_g_fmt_cap
[   12.703436] [ov5640] > ioctl_g_ifparm
[   12.706504] [ov5640] > clock_curr=mclk=24000000
[   12.752054] [ov5640] > ioctl_g_fmt_cap
[   12.757388] [ov5640] > ioctl_s_power
[   12.770093] [ov5640] > ioctl_init
[   12.772810] [ov5640] > ioctl_dev_init
[   12.775866] [ov5640] > setting mclk to 24 MHz
[   12.783086] [ov5640] > ioctl_s_power
[   41.674770] [ov5640] > ioctl_g_ifparm
[   41.677840] [ov5640] > clock_curr=mclk=24000000
[   41.682819] [ov5640] > ioctl_g_fmt_cap
[   41.685979] [ov5640] > ioctl_s_power
[   41.688949] [ov5640] > ioctl_init
[   41.692781] [ov5640] > ioctl_dev_init
[   41.695843] [ov5640] > setting mclk to 24 MHz
[   41.701290] [ov5640] > ioctl_s_power

 

root@var-som-mx6:~# v4l2-ctl --list-devices


[ov5640] > ioctl_g_ifparm
[ov5640] > clock_curr=mclk=24000000
[ov5640] > ioctl_g_fmt_cap
[ov5640] > ioctl_s_power
[ov5640] > ioctl_init
[ov5640] > ioctl_dev_init
[ov5640] > setting mclk to 24 MHz
[ov5640] > ioctl_s_power
 ():[ov5640] > ioctl_g_ifparm

 

    /dev/video0
    /dev/video16
    /[ov5640] > clock_curr=mclk=24000000
dev/video17

 

[ov5640] > ioctl_g_fmt_cap
[ov5640] > ioctl_s_power
[ov5640] > ioctl_init
[ov5640] > ioctl_dev_init
[ov5640] > setting mclk to 24 MHz
[ov5640] > ioctl_s_power

 

root@var-som-mx6:~# gst-launch-1.0 imxv4l2videosrc num-buffers=1 ! jpegenc ! filesink location=/cap1.jpeg
esink location=/cap1.jpeg

 

(gst-plugin-scanner:739): GStreamer- [1;33mWARNING [0m **: Failed to load plugin '/usr/lib/arm-linux-gnueabihf/gstreamer-1.0/libgstimxaudio.so': lib_mp3_enc_arm12_elinux.so.2: cannot open shared object file: No such file or directory
[ov5640] > ioctl_g_ifparm
[ov5640] > clock_curr=mclk=24000000
[ov5640] > ioctl_g_fmt_cap
[ov5640] > ioctl_s_power
[ov5640] > ioctl_init
[ov5640] > ioctl_dev_init
[ov5640] > setting mclk to 24 MHz
[ov5640] > ioctl_s_power
Setting pipeline to PAUSED ...[ov5640] > ioctl_g_ifparm

 

[ov5640] > clock_curr=mclk=24000000
[ov5640] > ioctl_g_fmt_cap
[ov5640] > ioctl_s_power
[ov5640] > ioctl_init
[ov5640] > ioctl_dev_init
[ov5640] > setting mclk to 24 MHz
ERROR: unrecognized std! 0 (PAL=ff, NTSC=b000
[ov5640] > ioctl_enum_framesizes
[ov5640] > ioctl_g_parm
[ov5640] > ioctl_s_parm
[ov5640] > ioctl_g_ifparm
[ov5640] > clock_curr=mclk=24000000
[ov5640] > ioctl_g_fmt_cap
[ov5640] > ioctl_s_ctrl
[ov5640] > ioctl_s_ctrl
[ov5640] > ioctl_g_ctrl
Pipeline is live and does not need PREROLL ...
Setting pipeline to PLAYING ...
New clock: GstSystemClock
alloc_contig_range: [44800, 448c6) PFNs busy
alloc_contig_range: [44800, 448c6) PFNs busy
alloc_contig_range: [44800, 448c6) PFNs busy
alloc_contig_range: [44800, 448c6) PFNs busy
alloc_contig_range: [44800, 448c6) PFNs busy
ERROR: v4l2 capture: mxc_v4l_dqueue timeout enc_counter 0
ERROR: from element /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0: Internal data stream error.
Additional debug info:
gstbasesrc.c(2950): gst_base_src_loop (): /GstPipeline:pipeline0/GstImxV4l2VideoSrc:imxv4l2videosrc0:
streaming stopped, reason error (-5)
Execution ended after 0:00:10.754667335
Setting pipeline to PAUSED ...
Setting pipeline to READY ...
[ov5640] > ioctl_s_ctrl
[ov5640] > ioctl_s_ctrl
[ov5640] > ioctl_g_ctrl
[ov5640] > ioctl_s_power
Setting pipeline to NULL ...
Freeing pipeline ...

 

root@var-som-mx6:~# du -k /cap1.jpeg


0    /cap1.jpeg


ov5640.c uses structure sensor_data (defined in mxc_v4l2_capture.h) that haven't field "standard id".


So, how I should to define that parameter and pass it from ov5640 to mxc_v4l2 and avoid that exception?

 

Thanks!

Outcomes