This is an automatic generated email to let you know that the following patch were queued at the http://git.linuxtv.org/v4l-utils.git tree:
Subject: v4l2-ctl: load initial frames from the file as well. Author: Hans Verkuil <[email protected]> Date: Fri Nov 23 14:28:20 2012 +0100 When streaming to output v4l2-ctl would load the initial frames with a colorbar, even though a file was specified. Fill those initial frames from the file as well. Signed-off-by: Hans Verkuil <[email protected]> utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 53 ++++++++++++++++++++------------- 1 files changed, 32 insertions(+), 21 deletions(-) --- http://git.linuxtv.org/v4l-utils.git?a=commitdiff;h=a9e79b4dca94ba4ee8b31bfe8c8a066e47ee3880 diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp index d5d5159..3aa677e 100644 --- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp +++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp @@ -484,6 +484,29 @@ static void fill_buffer(void *buffer, struct v4l2_pix_format *pix) } } +static bool fill_buffer_from_file(void *buffers[], unsigned buffer_lengths[], + unsigned buf_index, unsigned num_planes, FILE *fin) +{ + for (unsigned j = 0; j < num_planes; j++) { + unsigned p = buf_index * num_planes + j; + unsigned sz = fread(buffers[p], 1, + buffer_lengths[p], fin); + + if (j == 0 && sz == 0 && stream_loop) { + fseek(fin, 0, SEEK_SET); + sz = fread(buffers[p], 1, + buffer_lengths[p], fin); + } + if (sz == buffer_lengths[p]) + continue; + if (sz) + fprintf(stderr, "%u != %u\n", sz, buffer_lengths[p]); + // Bail out if we get weird buffer sizes. + return false; + } + return true; +} + void streaming_set(int fd) { if (options[OptStreamMmap] || options[OptStreamUser]) { @@ -768,6 +791,9 @@ void streaming_set(int fd) } } // TODO fill_buffer_mp(buffers[i], &fmt.fmt.pix_mp); + if (fin) + fill_buffer_from_file(buffers, buffer_lengths, + buf.index, num_planes, fin); } else { buffer_lengths[i] = buf.length; if (is_mmap) { @@ -782,7 +808,9 @@ void streaming_set(int fd) buffers[i] = calloc(1, buf.length); buf.m.userptr = (unsigned long)buffers[i]; } - fill_buffer(buffers[i], &fmt.fmt.pix); + if (!fin || !fill_buffer_from_file(buffers, buffer_lengths, + buf.index, num_planes, fin)) + fill_buffer(buffers[i], &fmt.fmt.pix); } if (doioctl(fd, VIDIOC_QBUF, &buf)) return; @@ -847,25 +875,9 @@ void streaming_set(int fd) fprintf(stderr, "%s: failed: %s\n", "VIDIOC_DQBUF", strerror(errno)); return; } - if (fin) { - for (unsigned j = 0; j < num_planes; j++) { - unsigned p = buf.index * num_planes + j; - unsigned sz = fread(buffers[p], 1, - buffer_lengths[p], fin); - - if (j == 0 && sz == 0 && stream_loop) { - fseek(fin, 0, SEEK_SET); - sz = fread(buffers[p], 1, - buffer_lengths[p], fin); - } - if (sz == buffer_lengths[p]) - continue; - if (sz) - fprintf(stderr, "%u != %u\n", sz, buffer_lengths[p]); - // Bail out if we get weird buffer sizes. - goto stream_out_eof; - } - } + if (fin && !fill_buffer_from_file(buffers, buffer_lengths, + buf.index, num_planes, fin)) + break; if (doioctl(fd, VIDIOC_QBUF, &buf)) return; @@ -893,7 +905,6 @@ void streaming_set(int fd) if (--stream_count == 0) break; } -stream_out_eof: doioctl(fd, VIDIOC_STREAMOFF, &type); fcntl(fd, F_SETFL, fd_flags); fprintf(stderr, "\n"); _______________________________________________ linuxtv-commits mailing list [email protected] http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits
