From: xie <yili.xie@gmail.com>
To: linux-media@vger.kernel.org
Cc: "Dongsoo, Nathaniel Kim(V4L2)" <dongsoo.kim@gmail.com>
Subject: About the VIDIOC_DQBUF
Date: Mon, 08 Jun 2009 10:05:59 +0800 [thread overview]
Message-ID: <1244426759.6740.31.camel@xie> (raw)
Dear all ~~
I have met a issue when I used the mmap method for previewing . I just
used the standard code as spec to get the image data :
status_t CameraHardwareProwave::V4l2Camera::v4l2CaptureMainloop()
{
LOG_FUNCTION_NAME
int rt ;
unsigned int i ;
fd_set fds ;
struct timeval tv ;
struct v4l2_buffer buf ;
for(;;){
FD_ZERO(&fds) ;
FD_SET(v4l2Fd, &fds) ;
//now the time is long ,just for debug
tv.tv_sec = 2 ;
tv.tv_usec = 0 ;
rt = select(v4l2Fd + 1, &fds, NULL, NULL, &tv) ;
LOGD("The value of select return : %d\n", rt) ;
/********** for debug
if(V4L2_NOERROR != v4l2ReadFrame()){
LOGE("READ ERROR") ;
}
***********/
if(-1 == rt){
LOGE("there is something wrong in select function(select)") ;
//no defined error manage
return V4L2_IOCTL_ERROR ;
}
if(0 == rt){
LOGE("wait for data timeout in select") ;
return V4L2_TIMEOUT ;
}
memset(&buf, 0, sizeof(buf)) ;
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE ;
buf.memory = V4L2_MEMORY_MMAP ;
if(-1 == ioctl(v4l2Fd, VIDIOC_DQBUF, &buf)){
LOGE("there is something wrong in dequeue buffer(VIDIOC_DQBUF)") ;
return V4L2_IOCTL_ERROR ;
}
assert(i < n_buf) ;
LOGE("buf.index 0buf.length = %d %d \n", buf.index , buf.length) ;
memcpy((mCameraProwave->getPreviewHeap())->base(),
v4l2Buffer[buf.index].start, buf.length) ;
if(-1 == ioctl(v4l2Fd, VIDIOC_QBUF, &buf)){
LOGE("there is something wrong in enqueue buffer(VIDIOC_QBUF)") ;
return V4L2_IOCTL_ERROR ;
}
//break ; //i don't know whether the break is needed ;
}
return V4L2_NOERROR ;
}
when executed the VIDIOC_DQBUF IOCTL,the return value was right, but the
value of buf.length would always be zero. Then I used the read()
function to read raw data in the file handle for debug, and I can get
the raw data. Anybody have met this issue before ? Who can give me some
advices or tell me what is wrong , thanks a lot ~
next reply other threads:[~2009-06-08 2:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-08 2:05 xie [this message]
2009-06-08 6:56 ` About the VIDIOC_DQBUF Dongsoo, Nathaniel Kim
2009-06-08 8:02 ` xie
2009-06-08 11:40 ` Dongsoo, Nathaniel Kim
2009-06-09 2:22 ` xie
2009-06-09 7:41 ` Dongsoo, Nathaniel Kim
2009-06-10 5:10 ` xie
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=1244426759.6740.31.camel@xie \
--to=yili.xie@gmail.com \
--cc=dongsoo.kim@gmail.com \
--cc=linux-media@vger.kernel.org \
/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