diff options
author | Ramiro Polla <ramiro@lisha.ufsc.br> | 2007-02-14 17:01:32 +0000 |
---|---|---|
committer | Guillaume Poirier <gpoirier@mplayerhq.hu> | 2007-02-14 17:01:32 +0000 |
commit | cc58300e30e7aea6acfecd72a04a3886b285cfd8 (patch) | |
tree | e1060df29a65226dcdf1378538c920a1a544e2f8 /libavformat/v4l2.c | |
parent | 20121213630a03001148f3ffdadac895dae8d7c5 (diff) | |
download | ffmpeg-cc58300e30e7aea6acfecd72a04a3886b285cfd8.tar.gz |
implement new grabbing interface, as described here:
ttp://thread.gmane.org/gmane.comp.video.ffmpeg.devel/42920
patch by Ramiro Polla % ramiro A lisha P ufsc P br %
Original thread:
Date: Jan 31, 2007 8:56 PM
Subject: [Ffmpeg-devel] [PATCH] New grabbing interface
Originally committed as revision 7983 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/v4l2.c')
-rw-r--r-- | libavformat/v4l2.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/libavformat/v4l2.c b/libavformat/v4l2.c index 5f669bd66c..ef661ae2ff 100644 --- a/libavformat/v4l2.c +++ b/libavformat/v4l2.c @@ -114,16 +114,16 @@ static struct fmt_map fmt_conversion_table[] = { }, }; -static int device_open(AVFormatContext *ctx, const char *devname, uint32_t *capabilities) +static int device_open(AVFormatContext *ctx, uint32_t *capabilities) { struct v4l2_capability cap; int fd; int res; - fd = open(devname, O_RDWR /*| O_NONBLOCK*/, 0); + fd = open(ctx->filename, O_RDWR /*| O_NONBLOCK*/, 0); if (fd < 0) { av_log(ctx, AV_LOG_ERROR, "Cannot open video device %s : %s\n", - devname, strerror(errno)); + ctx->filename, strerror(errno)); return -1; } @@ -429,7 +429,6 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) int width, height; int res, frame_rate, frame_rate_base; uint32_t desired_format, capabilities; - const char *video_device; if (ap->width <= 0 || ap->height <= 0 || ap->time_base.den <= 0) { av_log(s1, AV_LOG_ERROR, "Missing/Wrong parameters\n"); @@ -459,12 +458,8 @@ static int v4l2_read_header(AVFormatContext *s1, AVFormatParameters *ap) s->frame_rate = frame_rate; s->frame_rate_base = frame_rate_base; - video_device = ap->device; - if (!video_device) { - video_device = "/dev/video"; - } capabilities = 0; - s->fd = device_open(s1, video_device, &capabilities); + s->fd = device_open(s1, &capabilities); if (s->fd < 0) { av_free(st); |