public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Pete Eberlein <pete@sensoray.com>
To: TJ <one.timothy.jones@gmail.com>
Cc: "linux-media@vger.kernel.org" <linux-media@vger.kernel.org>
Subject: Re: go7007 driver -- which program you use for capture
Date: Tue, 12 Jan 2010 15:46:27 -0800	[thread overview]
Message-ID: <1263339987.4697.36.camel@pete-desktop> (raw)
In-Reply-To: <4B47828B.9050000@gmail.com>

On Fri, 2010-01-08 at 14:07 -0500, TJ wrote:
> Pete and anybody else out there with go7007 devices, what do you use for capture?

I used a modified capture.c, based on
http://v4l2spec.bytesex.org/v4l2spec/capture.c 

In the init_device(void) function, use:

        fmt.type                = V4L2_BUF_TYPE_VIDEO_CAPTURE;
	switch (G_size) {
	case 0:
		fmt.fmt.pix.height = 640;
		fmt.fmt.pix.width = 480;
		break;
	case 1:
		fmt.fmt.pix.height = 320;
		fmt.fmt.pix.width = 240;
		break;
	}
	switch (type) {
	case TYPE_MJPEG:
		printf("MJPEG\n");
	  fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MJPEG;
	  break;
	case TYPE_MPEG1:
	case TYPE_MPEG2:
	case TYPE_MPEG4:
	  fmt.fmt.pix.pixelformat = V4L2_PIX_FMT_MPEG;
	  break;
	}

        fmt.fmt.pix.field       = V4L2_FIELD_ANY;

        if (-1 == xioctl (fd, VIDIOC_S_FMT, &fmt))
                errno_exit ("VIDIOC_S_FMT");

        /* Note VIDIOC_S_FMT may change width and height. */

	/* Buggy driver paranoia. */
	min = fmt.fmt.pix.width * 2;
	if (fmt.fmt.pix.bytesperline < min)
		fmt.fmt.pix.bytesperline = min;
	min = fmt.fmt.pix.bytesperline * fmt.fmt.pix.height;
	if (fmt.fmt.pix.sizeimage < min)
		fmt.fmt.pix.sizeimage = min;

	/* optional MPEG parameters */
	if( type != TYPE_MJPEG) {
		struct v4l2_control ctrl;
		
		ctrl.id = V4L2_CID_MPEG_VIDEO_ENCODING;
		switch (type) {
		case TYPE_MPEG1:
			ctrl.value = V4L2_MPEG_VIDEO_ENCODING_MPEG_1;
			break;
		case TYPE_MPEG2:
			ctrl.value = V4L2_MPEG_VIDEO_ENCODING_MPEG_2;
			break;
		case TYPE_MPEG4:
			ctrl.value = V4L2_MPEG_VIDEO_ENCODING_MPEG_4_SP;
			break;
		}

		if (0 != xioctl (fd, VIDIOC_S_CTRL, &ctrl)) {
			printf("could not set video encoding\n");
		}

		ctrl.id = V4L2_CID_MPEG_VIDEO_BITRATE;
		ctrl.value = G_br;
		if (0 != xioctl (fd, VIDIOC_S_CTRL, &ctrl)) {
			printf("could not change bitrate\n");
		}
	}

> Without GO7007 ioctls, I was only able to get vlc to capture in MJPEG format.

Does VLC try to change video parameters after starting the stream?  The
driver currently doesn't allow that.  I think I've seen xawtv try to do
that too.

Pete




  parent reply	other threads:[~2010-01-13  1:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-08 19:07 go7007 driver -- which program you use for capture TJ
2010-01-08 20:17 ` Jarod Wilson
2010-01-08 22:25   ` TJ
2010-01-13 21:02     ` Mauro Carvalho Chehab
2010-01-13 22:04       ` TJ
2010-01-13 22:12         ` Mauro Carvalho Chehab
2010-01-14 20:03           ` TJ
2010-01-14 20:08             ` Pete Eberlein
2010-01-14 20:18               ` TJ
2010-01-12 23:46 ` Pete Eberlein [this message]
2010-01-13 21:51   ` TJ

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263339987.4697.36.camel@pete-desktop \
    --to=pete@sensoray.com \
    --cc=linux-media@vger.kernel.org \
    --cc=one.timothy.jones@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox