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
This commit is contained in:
parent
2012121363
commit
cc58300e30
11 changed files with 25 additions and 212 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue