mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 09:49:18 -04:00
o Update booktree capture code to latest version:
1) Warning message if the tuner device cannot be opened for write 2) A two stage sync slip recovery mechanism, stage 1 runs async to catch up, stage 2 injects a blank frame 3) Update to a consistent indent style (will minimize future diffs) o Bump PORTREVISION Submitted by: "Steve O'Hara-Smith" <steve@sohara.org>
This commit is contained in:
parent
bab9877d31
commit
b868b85dad
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=69495
8 changed files with 636 additions and 564 deletions
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= ffmpeg
|
PORTNAME= ffmpeg
|
||||||
PORTVERSION= 0.4.5
|
PORTVERSION= 0.4.5
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= graphics
|
CATEGORIES= graphics
|
||||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||||
MASTER_SITE_SUBDIR= lioux
|
MASTER_SITE_SUBDIR= lioux
|
||||||
|
|
|
@ -60,8 +60,13 @@ const char *video_device = "/dev/bktr0";
|
||||||
|
|
||||||
static UINT8 *video_buf;
|
static UINT8 *video_buf;
|
||||||
|
|
||||||
|
static int signal_expected = 0;
|
||||||
|
static int unexpected_signals = 0;
|
||||||
|
|
||||||
static void catchsignal(int signal)
|
static void catchsignal(int signal)
|
||||||
{
|
{
|
||||||
|
if (!signal_expected) unexpected_signals++;
|
||||||
|
signal_expected = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +90,9 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
height = s->height;
|
height = s->height;
|
||||||
|
|
||||||
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
||||||
|
if (s->tuner_fd < 0) {
|
||||||
|
perror("Warning: Tuner not opened continuing");
|
||||||
|
}
|
||||||
|
|
||||||
video_fd = open(video_device, O_RDWR);
|
video_fd = open(video_device, O_RDWR);
|
||||||
if (video_fd < 0) {
|
if (video_fd < 0) {
|
||||||
|
@ -95,11 +103,12 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
geo.rows = height;
|
geo.rows = height;
|
||||||
geo.columns = width;
|
geo.columns = width;
|
||||||
geo.frames = 1;
|
geo.frames = 1;
|
||||||
geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
|
geo.oformat = METEOR_GEO_YUV_PACKED;
|
||||||
|
|
||||||
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
|
|
||||||
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
||||||
perror ("METEORSETGEO");
|
perror ("METEORSETGEO");
|
||||||
|
@ -122,7 +131,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
perror ("METEORSINPUT");
|
perror ("METEORSINPUT");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
|
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED,
|
||||||
video_fd, (off_t) 0);
|
video_fd, (off_t) 0);
|
||||||
if (video_buf == MAP_FAILED) {
|
if (video_buf == MAP_FAILED) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
|
@ -131,6 +140,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
c = METEOR_CAP_CONTINOUS;
|
c = METEOR_CAP_CONTINOUS;
|
||||||
ioctl(s->fd, METEORCAPTUR, &c);
|
ioctl(s->fd, METEORCAPTUR, &c);
|
||||||
c = SIGUSR1;
|
c = SIGUSR1;
|
||||||
|
signal_expected = 1;
|
||||||
ioctl (s->fd, METEORSSIGNAL, &c);
|
ioctl (s->fd, METEORSSIGNAL, &c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -173,15 +183,23 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
if (av_new_packet(pkt, size + halfsize) < 0)
|
if (av_new_packet(pkt, size + halfsize) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
if (unexpected_signals > 0) {
|
||||||
|
unexpected_signals--;
|
||||||
|
} else {
|
||||||
|
signal_expected = 1;
|
||||||
sigemptyset (&msig);
|
sigemptyset (&msig);
|
||||||
sigsuspend (&msig);
|
sigsuspend (&msig);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unexpected_signals & 1) {
|
||||||
|
bzero (pkt->data, size + halfsize);
|
||||||
|
} else {
|
||||||
lum = pkt->data;
|
lum = pkt->data;
|
||||||
cb = lum + size;
|
cb = lum + size;
|
||||||
cr = cb + size/4;
|
cr = cb + size/4;
|
||||||
|
|
||||||
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
||||||
|
}
|
||||||
return size + halfsize;
|
return size + halfsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +226,7 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
s->width = width;
|
s->width = width;
|
||||||
s->height = height;
|
s->height = height;
|
||||||
s->frame_rate = frame_rate;
|
s->frame_rate = frame_rate;
|
||||||
s->frame_size = width*height*2; /*RGB*/
|
s->frame_size = width*height*2;
|
||||||
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
||||||
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
||||||
st->codec.width = width;
|
st->codec.width = width;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= ffmpeg
|
PORTNAME= ffmpeg
|
||||||
PORTVERSION= 0.4.5
|
PORTVERSION= 0.4.5
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= graphics
|
CATEGORIES= graphics
|
||||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||||
MASTER_SITE_SUBDIR= lioux
|
MASTER_SITE_SUBDIR= lioux
|
||||||
|
|
|
@ -60,8 +60,13 @@ const char *video_device = "/dev/bktr0";
|
||||||
|
|
||||||
static UINT8 *video_buf;
|
static UINT8 *video_buf;
|
||||||
|
|
||||||
|
static int signal_expected = 0;
|
||||||
|
static int unexpected_signals = 0;
|
||||||
|
|
||||||
static void catchsignal(int signal)
|
static void catchsignal(int signal)
|
||||||
{
|
{
|
||||||
|
if (!signal_expected) unexpected_signals++;
|
||||||
|
signal_expected = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +90,9 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
height = s->height;
|
height = s->height;
|
||||||
|
|
||||||
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
||||||
|
if (s->tuner_fd < 0) {
|
||||||
|
perror("Warning: Tuner not opened continuing");
|
||||||
|
}
|
||||||
|
|
||||||
video_fd = open(video_device, O_RDWR);
|
video_fd = open(video_device, O_RDWR);
|
||||||
if (video_fd < 0) {
|
if (video_fd < 0) {
|
||||||
|
@ -95,11 +103,12 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
geo.rows = height;
|
geo.rows = height;
|
||||||
geo.columns = width;
|
geo.columns = width;
|
||||||
geo.frames = 1;
|
geo.frames = 1;
|
||||||
geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
|
geo.oformat = METEOR_GEO_YUV_PACKED;
|
||||||
|
|
||||||
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
|
|
||||||
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
||||||
perror ("METEORSETGEO");
|
perror ("METEORSETGEO");
|
||||||
|
@ -122,7 +131,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
perror ("METEORSINPUT");
|
perror ("METEORSINPUT");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
|
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED,
|
||||||
video_fd, (off_t) 0);
|
video_fd, (off_t) 0);
|
||||||
if (video_buf == MAP_FAILED) {
|
if (video_buf == MAP_FAILED) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
|
@ -131,6 +140,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
c = METEOR_CAP_CONTINOUS;
|
c = METEOR_CAP_CONTINOUS;
|
||||||
ioctl(s->fd, METEORCAPTUR, &c);
|
ioctl(s->fd, METEORCAPTUR, &c);
|
||||||
c = SIGUSR1;
|
c = SIGUSR1;
|
||||||
|
signal_expected = 1;
|
||||||
ioctl (s->fd, METEORSSIGNAL, &c);
|
ioctl (s->fd, METEORSSIGNAL, &c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -173,15 +183,23 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
if (av_new_packet(pkt, size + halfsize) < 0)
|
if (av_new_packet(pkt, size + halfsize) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
if (unexpected_signals > 0) {
|
||||||
|
unexpected_signals--;
|
||||||
|
} else {
|
||||||
|
signal_expected = 1;
|
||||||
sigemptyset (&msig);
|
sigemptyset (&msig);
|
||||||
sigsuspend (&msig);
|
sigsuspend (&msig);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unexpected_signals & 1) {
|
||||||
|
bzero (pkt->data, size + halfsize);
|
||||||
|
} else {
|
||||||
lum = pkt->data;
|
lum = pkt->data;
|
||||||
cb = lum + size;
|
cb = lum + size;
|
||||||
cr = cb + size/4;
|
cr = cb + size/4;
|
||||||
|
|
||||||
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
||||||
|
}
|
||||||
return size + halfsize;
|
return size + halfsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +226,7 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
s->width = width;
|
s->width = width;
|
||||||
s->height = height;
|
s->height = height;
|
||||||
s->frame_rate = frame_rate;
|
s->frame_rate = frame_rate;
|
||||||
s->frame_size = width*height*2; /*RGB*/
|
s->frame_size = width*height*2;
|
||||||
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
||||||
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
||||||
st->codec.width = width;
|
st->codec.width = width;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= ffmpeg
|
PORTNAME= ffmpeg
|
||||||
PORTVERSION= 0.4.5
|
PORTVERSION= 0.4.5
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= graphics
|
CATEGORIES= graphics
|
||||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||||
MASTER_SITE_SUBDIR= lioux
|
MASTER_SITE_SUBDIR= lioux
|
||||||
|
|
|
@ -60,8 +60,13 @@ const char *video_device = "/dev/bktr0";
|
||||||
|
|
||||||
static UINT8 *video_buf;
|
static UINT8 *video_buf;
|
||||||
|
|
||||||
|
static int signal_expected = 0;
|
||||||
|
static int unexpected_signals = 0;
|
||||||
|
|
||||||
static void catchsignal(int signal)
|
static void catchsignal(int signal)
|
||||||
{
|
{
|
||||||
|
if (!signal_expected) unexpected_signals++;
|
||||||
|
signal_expected = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +90,9 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
height = s->height;
|
height = s->height;
|
||||||
|
|
||||||
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
||||||
|
if (s->tuner_fd < 0) {
|
||||||
|
perror("Warning: Tuner not opened continuing");
|
||||||
|
}
|
||||||
|
|
||||||
video_fd = open(video_device, O_RDWR);
|
video_fd = open(video_device, O_RDWR);
|
||||||
if (video_fd < 0) {
|
if (video_fd < 0) {
|
||||||
|
@ -95,11 +103,12 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
geo.rows = height;
|
geo.rows = height;
|
||||||
geo.columns = width;
|
geo.columns = width;
|
||||||
geo.frames = 1;
|
geo.frames = 1;
|
||||||
geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
|
geo.oformat = METEOR_GEO_YUV_PACKED;
|
||||||
|
|
||||||
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
|
|
||||||
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
||||||
perror ("METEORSETGEO");
|
perror ("METEORSETGEO");
|
||||||
|
@ -122,7 +131,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
perror ("METEORSINPUT");
|
perror ("METEORSINPUT");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
|
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED,
|
||||||
video_fd, (off_t) 0);
|
video_fd, (off_t) 0);
|
||||||
if (video_buf == MAP_FAILED) {
|
if (video_buf == MAP_FAILED) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
|
@ -131,6 +140,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
c = METEOR_CAP_CONTINOUS;
|
c = METEOR_CAP_CONTINOUS;
|
||||||
ioctl(s->fd, METEORCAPTUR, &c);
|
ioctl(s->fd, METEORCAPTUR, &c);
|
||||||
c = SIGUSR1;
|
c = SIGUSR1;
|
||||||
|
signal_expected = 1;
|
||||||
ioctl (s->fd, METEORSSIGNAL, &c);
|
ioctl (s->fd, METEORSSIGNAL, &c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -173,15 +183,23 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
if (av_new_packet(pkt, size + halfsize) < 0)
|
if (av_new_packet(pkt, size + halfsize) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
if (unexpected_signals > 0) {
|
||||||
|
unexpected_signals--;
|
||||||
|
} else {
|
||||||
|
signal_expected = 1;
|
||||||
sigemptyset (&msig);
|
sigemptyset (&msig);
|
||||||
sigsuspend (&msig);
|
sigsuspend (&msig);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unexpected_signals & 1) {
|
||||||
|
bzero (pkt->data, size + halfsize);
|
||||||
|
} else {
|
||||||
lum = pkt->data;
|
lum = pkt->data;
|
||||||
cb = lum + size;
|
cb = lum + size;
|
||||||
cr = cb + size/4;
|
cr = cb + size/4;
|
||||||
|
|
||||||
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
||||||
|
}
|
||||||
return size + halfsize;
|
return size + halfsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +226,7 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
s->width = width;
|
s->width = width;
|
||||||
s->height = height;
|
s->height = height;
|
||||||
s->frame_rate = frame_rate;
|
s->frame_rate = frame_rate;
|
||||||
s->frame_size = width*height*2; /*RGB*/
|
s->frame_size = width*height*2;
|
||||||
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
||||||
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
||||||
st->codec.width = width;
|
st->codec.width = width;
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
PORTNAME= ffmpeg
|
PORTNAME= ffmpeg
|
||||||
PORTVERSION= 0.4.5
|
PORTVERSION= 0.4.5
|
||||||
PORTREVISION= 3
|
PORTREVISION= 4
|
||||||
CATEGORIES= graphics
|
CATEGORIES= graphics
|
||||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||||
MASTER_SITE_SUBDIR= lioux
|
MASTER_SITE_SUBDIR= lioux
|
||||||
|
|
|
@ -60,8 +60,13 @@ const char *video_device = "/dev/bktr0";
|
||||||
|
|
||||||
static UINT8 *video_buf;
|
static UINT8 *video_buf;
|
||||||
|
|
||||||
|
static int signal_expected = 0;
|
||||||
|
static int unexpected_signals = 0;
|
||||||
|
|
||||||
static void catchsignal(int signal)
|
static void catchsignal(int signal)
|
||||||
{
|
{
|
||||||
|
if (!signal_expected) unexpected_signals++;
|
||||||
|
signal_expected = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +90,9 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
height = s->height;
|
height = s->height;
|
||||||
|
|
||||||
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
s->tuner_fd = open ("/dev/tuner0", O_RDWR);
|
||||||
|
if (s->tuner_fd < 0) {
|
||||||
|
perror("Warning: Tuner not opened continuing");
|
||||||
|
}
|
||||||
|
|
||||||
video_fd = open(video_device, O_RDWR);
|
video_fd = open(video_device, O_RDWR);
|
||||||
if (video_fd < 0) {
|
if (video_fd < 0) {
|
||||||
|
@ -95,11 +103,12 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
geo.rows = height;
|
geo.rows = height;
|
||||||
geo.columns = width;
|
geo.columns = width;
|
||||||
geo.frames = 1;
|
geo.frames = 1;
|
||||||
geo.oformat = METEOR_GEO_YUV_PACKED; // RGB
|
geo.oformat = METEOR_GEO_YUV_PACKED;
|
||||||
|
|
||||||
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
if ((format == PAL) && (height <= (PAL_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
if ((format == NTSC) && (height <= (NTSC_HEIGHT/2)))
|
||||||
geo.oformat |= METEOR_GEO_ODD_ONLY;
|
geo.oformat |= METEOR_GEO_EVEN_ONLY;
|
||||||
|
|
||||||
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
if (ioctl(video_fd, METEORSETGEO, &geo) < 0) {
|
||||||
perror ("METEORSETGEO");
|
perror ("METEORSETGEO");
|
||||||
|
@ -122,7 +131,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
perror ("METEORSINPUT");
|
perror ("METEORSINPUT");
|
||||||
return -EIO;
|
return -EIO;
|
||||||
}
|
}
|
||||||
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED, // RGB
|
video_buf = mmap((caddr_t)0, width*height*2, PROT_READ, MAP_SHARED,
|
||||||
video_fd, (off_t) 0);
|
video_fd, (off_t) 0);
|
||||||
if (video_buf == MAP_FAILED) {
|
if (video_buf == MAP_FAILED) {
|
||||||
perror ("mmap");
|
perror ("mmap");
|
||||||
|
@ -131,6 +140,7 @@ static int bktr_init(AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
c = METEOR_CAP_CONTINOUS;
|
c = METEOR_CAP_CONTINOUS;
|
||||||
ioctl(s->fd, METEORCAPTUR, &c);
|
ioctl(s->fd, METEORCAPTUR, &c);
|
||||||
c = SIGUSR1;
|
c = SIGUSR1;
|
||||||
|
signal_expected = 1;
|
||||||
ioctl (s->fd, METEORSSIGNAL, &c);
|
ioctl (s->fd, METEORSSIGNAL, &c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -173,15 +183,23 @@ static int grab_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||||
if (av_new_packet(pkt, size + halfsize) < 0)
|
if (av_new_packet(pkt, size + halfsize) < 0)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
|
if (unexpected_signals > 0) {
|
||||||
|
unexpected_signals--;
|
||||||
|
} else {
|
||||||
|
signal_expected = 1;
|
||||||
sigemptyset (&msig);
|
sigemptyset (&msig);
|
||||||
sigsuspend (&msig);
|
sigsuspend (&msig);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (unexpected_signals & 1) {
|
||||||
|
bzero (pkt->data, size + halfsize);
|
||||||
|
} else {
|
||||||
lum = pkt->data;
|
lum = pkt->data;
|
||||||
cb = lum + size;
|
cb = lum + size;
|
||||||
cr = cb + size/4;
|
cr = cb + size/4;
|
||||||
|
|
||||||
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
bf_yuv422_to_yuv420p (lum, cb, cr, video_buf, s->width, s->height);
|
||||||
|
}
|
||||||
return size + halfsize;
|
return size + halfsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -208,7 +226,7 @@ static int grab_read_header (AVFormatContext *s1, AVFormatParameters *ap)
|
||||||
s->width = width;
|
s->width = width;
|
||||||
s->height = height;
|
s->height = height;
|
||||||
s->frame_rate = frame_rate;
|
s->frame_rate = frame_rate;
|
||||||
s->frame_size = width*height*2; /*RGB*/
|
s->frame_size = width*height*2;
|
||||||
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
st->codec.pix_fmt = PIX_FMT_YUV420P;
|
||||||
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
st->codec.codec_id = CODEC_ID_RAWVIDEO;
|
||||||
st->codec.width = width;
|
st->codec.width = width;
|
||||||
|
|
Loading…
Add table
Reference in a new issue