简体   繁体   English

Gstreamer-无法枚举视频格式,并且设备错误的ioctl不正确

[英]Gstreamer- failed to enumerate video formats and Inappropriate ioctl for device Error

I need to stream a video using gstreamer. 我需要使用gstreamer流式传输视频。 After giving media-ctl commands correctly When I give this command LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv driver=v4l2:device=/dev/video6 -vo png -fps 1 , it is successfully capturing frames but only problem with Gstreamer. 正确给出media-ctl命令后当我给出此命令LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so mplayer tv:// -tv driver=v4l2:device=/dev/video6 -vo png -fps 1 ,它是成功捕获帧,但Gstreamer唯一的问题。

Gstreamer pipeline: Gstreamer管道:

root@overo:~# LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so gst-launch-0.10 -v v4l2src device=/dev/video6 queue-size=8 ! video/x-raw-yuv,format=\(fourcc\)UYVY,width=720,height=480 ! ffmpegcolorspace ! tcpserversink host=192.168.1.104 port=5000
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to enumerate possible video formats device '/dev/video6' can work with
Additional debug info:
/home/siguser/yocto-28-11/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gst-plugins-good/0.10.31-r8/gst-plugins-good-0.10.31/sys/v4l2/gstv4l2object.c(1122): gst_v4l2_object_fill_format_list (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Failed to get number 0 in pixelformat enumeration for /dev/video6. (25 - Inappropriate ioctl for device)
Setting pipeline to NULL ...
Freeing pipeline ...

After changing resolution, I get same error: 更改分辨率后,出现相同的错误:

root@overo:~# LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so gst-launch-0.10 v4l2src --gst-debug=0 device=/dev/video6 ! video/x-raw-yuv,width=640,height=480,framerate=\(fraction\)2/1 ! ffmpegcolorspace ! smokeenc keyframe=8 qmax=40 ! udpsink host=192.168.1.104 port=5000
Setting pipeline to PAUSED ...
ERROR: Pipeline doesn't want to pause.
ERROR: from element /GstPipeline:pipeline0/GstV4l2Src:v4l2src0: Failed to enumerate possible video formats device '/dev/video6' can work with
Additional debug info:
/home/siguser/yocto-28-11/build/tmp/work/armv7a-vfp-neon-poky-linux-gnueabi/gst-plugins-good/0.10.31-r8/gst-plugins-good-0.10.31/sys/v4l2/gstv4l2object.c(1122): gst_v4l2_object_fill_format_list (): /GstPipeline:pipeline0/GstV4l2Src:v4l2src0:
Failed to get number 0 in pixelformat enumeration for /dev/video6. (25 - Inappropriate ioctl for device)
Setting pipeline to NULL ...
Freeing pipeline ...

root@overo:~# LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so v4l2-ctl -d 6 --list-formats root @ overo:〜#LD_PRELOAD = / usr / lib / libv4l / v4l2convert.so v4l2-ctl -d 6-列表格式

ioctl: VIDIOC_ENUM_FMT
Index       : 0
Type        : Video Capture
Pixel Format: 'RGB3' (emulated)
Name        : RGB3

Index       : 1
Type        : Video Capture
Pixel Format: 'BGR3' (emulated)
Name        : BGR3

Index       : 2
Type        : Video Capture
Pixel Format: 'YU12' (emulated)
Name        : YU12

Index       : 3
Type        : Video Capture
Pixel Format: 'YV12' (emulated)
Name        : YV12

I am trying to get the caspa camera working with yocto 1.4.2 (dylan) on 3.5.7 linux kernel. 我正在尝试让caspa相机在3.5.7 linux内核上与yocto 1.4.2(dylan)一起使用。

What if you also LD_PRELOAD the compat lib for gst? 如果您还LD_PRELOAD gst的compat库怎么办?

LD_PRELOAD=/usr/lib/libv4l/v4l2convert.so gst-launch-0.10 v4l2src ...

Also consider to use gstreamer-1.0. 还考虑使用gstreamer-1.0。

The problem lies in omap ispvideo driver code in 3.5.7 kernel version currently used by Gumstix. 问题出在Gumstix当前使用的3.5.7内核版本的omap ispvideo驱动程序代码中。 To output the video with our own codec then the driver should know what codec is used. 要使用我们自己的编解码器输出视频,则驱动程序应该知道使用了哪种编解码器。 Apply the changes to ispvideo.c located at 将更改应用到位于以下位置的ispvideo.c

/home/yocto/build/work/.../drivers/media/video/omap3isp/ispvideo.c

    From 2ea2a64d737236ed84f8aa481f4331eecbe6081f Mon Sep 17 00:00:00 2001
From: 
Date: Thu, 9 Jan 2014 15:32:50 +0100
Subject: [PATCH] Adding missing ioctl's

---
 drivers/media/video/omap3isp/ispvideo.c |   48 +++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

diff --git a/drivers/media/video/omap3isp/ispvideo.c b/drivers/media/video/omap3isp/ispvideo.c
index b37379d..0bf5c5b 100644
--- a/drivers/media/video/omap3isp/ispvideo.c
+++ b/drivers/media/video/omap3isp/ispvideo.c
@@ -662,6 +662,39 @@ isp_video_querycap(struct file *file, void *fh, struct v4l2_capability *cap)
 }

 static int
+// My patch changes
+isp_video_enum_format(struct file *file, void *fh, struct v4l2_fmtdesc*fmtdesc)
+{
+    struct isp_video_fh *vfh = to_isp_video_fh(fh);
+    struct isp_video *video = video_drvdata(file);
+
+    if (fmtdesc->index)
+    {
+//        printk(KERN_ERR "%s: invalid index (%d)\n",__func__,fmtdesc->index);
+        return -EINVAL;
+    }
+
+    if (fmtdesc->type != video->type)
+    {
+//        printk(KERN_ERR "%s: invalid type (%d). Current type:%d\n",__func__, fmtdesc->type, video->type);
+        return -EINVAL;
+    }
+
+    // trying to produce direct output in VYVY format. Hardcoded.
+    fmtdesc->flags = 0;
+    fmtdesc->description[0] = 'U';
+    fmtdesc->description[1] = 'Y';
+    fmtdesc->description[2] = 'V';
+    fmtdesc->description[3] = 'Y';
+    fmtdesc->description[4] = '0';
+    fmtdesc->pixelformat = V4L2_PIX_FMT_UYVY;
+
+    return 0;
+}
+
+static int
+
+
 isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
 {
    struct isp_video_fh *vfh = to_isp_video_fh(fh);
@@ -678,6 +711,7 @@ isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
 }

 static int
+
 isp_video_set_format(struct file *file, void *fh, struct v4l2_format *format)
 {
    struct isp_video_fh *vfh = to_isp_video_fh(fh);
@@ -1189,8 +1223,21 @@ isp_video_s_input(struct file *file, void *fh, unsigned int input)
    return input == 0 ? 0 : -EINVAL;
 }

+static int
+isp_video_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl*queryctrl)
+{
+//    printk(KERN_ERR "%s: query id (%d)\n",__func__, queryctrl->id);
+//    printk(KERN_ERR "%s: query type (%d)\n",__func__, queryctrl->type);
+
+    if (queryctrl->id < V4L2_CID_BASE)
+        return -EDOM;
+
+    return -EINVAL;
+}
+
 static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
    .vidioc_querycap        = isp_video_querycap,
+        .vidioc_enum_fmt_vid_cap    = isp_video_enum_format,
    .vidioc_g_fmt_vid_cap       = isp_video_get_format,
    .vidioc_s_fmt_vid_cap       = isp_video_set_format,
    .vidioc_try_fmt_vid_cap     = isp_video_try_format,
@@ -1211,6 +1258,7 @@ static const struct v4l2_ioctl_ops isp_video_ioctl_ops = {
    .vidioc_enum_input      = isp_video_enum_input,
    .vidioc_g_input         = isp_video_g_input,
    .vidioc_s_input         = isp_video_s_input,
+   .vidioc_queryctrl        = isp_video_queryctrl,
 };

 /* -----------------------------------------------------------------------------
-- 
1.7.9.5

After that commit changes of patch. 之后,提交补丁更改。 Follow this tutorial to know how to create the patch. 按照本教程了解如何创建补丁。

Yocto-Create the patch Yocto-创建补丁

The patch was taken from here 补丁是从这里拿来的

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM