2019-05-27 14:55:05 +08:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/*
|
|
|
|
file operation functions
|
|
|
|
Copyright (C) 2003-2004 Kevin Thayer <nufan_wfk at yahoo.com>
|
|
|
|
Copyright (C) 2004 Chris Kennedy <c@groovy.org>
|
|
|
|
Copyright (C) 2005-2007 Hans Verkuil <hverkuil@xs4all.nl>
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ivtv-driver.h"
|
|
|
|
#include "ivtv-fileops.h"
|
|
|
|
#include "ivtv-i2c.h"
|
|
|
|
#include "ivtv-queue.h"
|
|
|
|
#include "ivtv-udma.h"
|
|
|
|
#include "ivtv-irq.h"
|
|
|
|
#include "ivtv-vbi.h"
|
|
|
|
#include "ivtv-mailbox.h"
|
2007-08-23 17:32:46 +08:00
|
|
|
#include "ivtv-routing.h"
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
#include "ivtv-streams.h"
|
|
|
|
#include "ivtv-yuv.h"
|
|
|
|
#include "ivtv-ioctl.h"
|
2007-05-17 19:08:45 +08:00
|
|
|
#include "ivtv-cards.h"
|
2010-06-13 00:33:21 +08:00
|
|
|
#include "ivtv-firmware.h"
|
2010-03-28 01:10:13 +08:00
|
|
|
#include <media/v4l2-event.h>
|
2015-11-10 22:01:44 +08:00
|
|
|
#include <media/i2c/saa7115.h>
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* This function tries to claim the stream for a specific file descriptor.
|
|
|
|
If no one else is using this stream then the stream is claimed and
|
|
|
|
associated VBI streams are also automatically claimed.
|
|
|
|
Possible error returns: -EBUSY if someone else has claimed
|
|
|
|
the stream or 0 on success. */
|
2012-09-03 06:13:14 +08:00
|
|
|
int ivtv_claim_stream(struct ivtv_open_id *id, int type)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[type];
|
|
|
|
struct ivtv_stream *s_vbi;
|
|
|
|
int vbi_type;
|
|
|
|
|
|
|
|
if (test_and_set_bit(IVTV_F_S_CLAIMED, &s->s_flags)) {
|
|
|
|
/* someone already claimed this stream */
|
2011-10-12 16:36:04 +08:00
|
|
|
if (s->fh == &id->fh) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* yes, this file descriptor did. So that's OK. */
|
|
|
|
return 0;
|
|
|
|
}
|
2011-10-12 16:36:04 +08:00
|
|
|
if (s->fh == NULL && (type == IVTV_DEC_STREAM_TYPE_VBI ||
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
type == IVTV_ENC_STREAM_TYPE_VBI)) {
|
|
|
|
/* VBI is handled already internally, now also assign
|
|
|
|
the file descriptor to this stream for external
|
|
|
|
reading of the stream. */
|
2011-10-12 16:36:04 +08:00
|
|
|
s->fh = &id->fh;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
IVTV_DEBUG_INFO("Start Read VBI\n");
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
/* someone else is using this stream already */
|
|
|
|
IVTV_DEBUG_INFO("Stream %d is busy\n", type);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
2011-10-12 16:36:04 +08:00
|
|
|
s->fh = &id->fh;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (type == IVTV_DEC_STREAM_TYPE_VBI) {
|
|
|
|
/* Enable reinsertion interrupt */
|
|
|
|
ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* IVTV_DEC_STREAM_TYPE_MPG needs to claim IVTV_DEC_STREAM_TYPE_VBI,
|
|
|
|
IVTV_ENC_STREAM_TYPE_MPG needs to claim IVTV_ENC_STREAM_TYPE_VBI
|
|
|
|
(provided VBI insertion is on and sliced VBI is selected), for all
|
|
|
|
other streams we're done */
|
|
|
|
if (type == IVTV_DEC_STREAM_TYPE_MPG) {
|
|
|
|
vbi_type = IVTV_DEC_STREAM_TYPE_VBI;
|
|
|
|
} else if (type == IVTV_ENC_STREAM_TYPE_MPG &&
|
2008-10-04 19:05:30 +08:00
|
|
|
itv->vbi.insert_mpeg && !ivtv_raw_vbi(itv)) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
vbi_type = IVTV_ENC_STREAM_TYPE_VBI;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
s_vbi = &itv->streams[vbi_type];
|
|
|
|
|
|
|
|
if (!test_and_set_bit(IVTV_F_S_CLAIMED, &s_vbi->s_flags)) {
|
|
|
|
/* Enable reinsertion interrupt */
|
|
|
|
if (vbi_type == IVTV_DEC_STREAM_TYPE_VBI)
|
|
|
|
ivtv_clear_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT);
|
|
|
|
}
|
|
|
|
/* mark that it is used internally */
|
|
|
|
set_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
2012-09-03 06:13:14 +08:00
|
|
|
EXPORT_SYMBOL(ivtv_claim_stream);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* This function releases a previously claimed stream. It will take into
|
|
|
|
account associated VBI streams. */
|
|
|
|
void ivtv_release_stream(struct ivtv_stream *s)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = s->itv;
|
|
|
|
struct ivtv_stream *s_vbi;
|
|
|
|
|
2011-10-12 16:36:04 +08:00
|
|
|
s->fh = NULL;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if ((s->type == IVTV_DEC_STREAM_TYPE_VBI || s->type == IVTV_ENC_STREAM_TYPE_VBI) &&
|
|
|
|
test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) {
|
|
|
|
/* this stream is still in use internally */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if (!test_and_clear_bit(IVTV_F_S_CLAIMED, &s->s_flags)) {
|
|
|
|
IVTV_DEBUG_WARN("Release stream %s not in use!\n", s->name);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ivtv_flush_queues(s);
|
|
|
|
|
|
|
|
/* disable reinsertion interrupt */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_VBI)
|
|
|
|
ivtv_set_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT);
|
|
|
|
|
|
|
|
/* IVTV_DEC_STREAM_TYPE_MPG needs to release IVTV_DEC_STREAM_TYPE_VBI,
|
|
|
|
IVTV_ENC_STREAM_TYPE_MPG needs to release IVTV_ENC_STREAM_TYPE_VBI,
|
|
|
|
for all other streams we're done */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_MPG)
|
|
|
|
s_vbi = &itv->streams[IVTV_DEC_STREAM_TYPE_VBI];
|
|
|
|
else if (s->type == IVTV_ENC_STREAM_TYPE_MPG)
|
|
|
|
s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
|
|
|
|
else
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* clear internal use flag */
|
|
|
|
if (!test_and_clear_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags)) {
|
|
|
|
/* was already cleared */
|
|
|
|
return;
|
|
|
|
}
|
2011-10-12 16:36:04 +08:00
|
|
|
if (s_vbi->fh) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* VBI stream still claimed by a file descriptor */
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* disable reinsertion interrupt */
|
|
|
|
if (s_vbi->type == IVTV_DEC_STREAM_TYPE_VBI)
|
|
|
|
ivtv_set_irq_mask(itv, IVTV_IRQ_DEC_VBI_RE_INSERT);
|
|
|
|
clear_bit(IVTV_F_S_CLAIMED, &s_vbi->s_flags);
|
|
|
|
ivtv_flush_queues(s_vbi);
|
|
|
|
}
|
2012-09-03 06:13:14 +08:00
|
|
|
EXPORT_SYMBOL(ivtv_release_stream);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
static void ivtv_dualwatch(struct ivtv *itv)
|
|
|
|
{
|
|
|
|
struct v4l2_tuner vt;
|
2009-01-02 06:02:31 +08:00
|
|
|
u32 new_stereo_mode;
|
2010-06-27 17:07:26 +08:00
|
|
|
const u32 dual = 0x02;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2010-06-27 17:07:26 +08:00
|
|
|
new_stereo_mode = v4l2_ctrl_g_ctrl(itv->cxhdl.audio_mode);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
memset(&vt, 0, sizeof(vt));
|
2008-11-30 06:38:23 +08:00
|
|
|
ivtv_call_all(itv, tuner, g_tuner, &vt);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (vt.audmode == V4L2_TUNER_MODE_LANG1_LANG2 && (vt.rxsubchans & V4L2_TUNER_SUB_LANG2))
|
|
|
|
new_stereo_mode = dual;
|
|
|
|
|
|
|
|
if (new_stereo_mode == itv->dualwatch_stereo_mode)
|
|
|
|
return;
|
|
|
|
|
2010-06-27 17:07:26 +08:00
|
|
|
IVTV_DEBUG_INFO("dualwatch: change stereo flag from 0x%x to 0x%x.\n",
|
|
|
|
itv->dualwatch_stereo_mode, new_stereo_mode);
|
|
|
|
if (v4l2_ctrl_s_ctrl(itv->cxhdl.audio_mode, new_stereo_mode))
|
|
|
|
IVTV_DEBUG_INFO("dualwatch: changing stereo flag failed\n");
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void ivtv_update_pgm_info(struct ivtv *itv)
|
|
|
|
{
|
|
|
|
u32 wr_idx = (read_enc(itv->pgm_info_offset) - itv->pgm_info_offset - 4) / 24;
|
|
|
|
int cnt;
|
|
|
|
int i = 0;
|
|
|
|
|
|
|
|
if (wr_idx >= itv->pgm_info_num) {
|
|
|
|
IVTV_DEBUG_WARN("Invalid PGM index %d (>= %d)\n", wr_idx, itv->pgm_info_num);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
cnt = (wr_idx + itv->pgm_info_num - itv->pgm_info_write_idx) % itv->pgm_info_num;
|
|
|
|
while (i < cnt) {
|
|
|
|
int idx = (itv->pgm_info_write_idx + i) % itv->pgm_info_num;
|
|
|
|
struct v4l2_enc_idx_entry *e = itv->pgm_info + idx;
|
|
|
|
u32 addr = itv->pgm_info_offset + 4 + idx * 24;
|
2007-08-24 04:48:41 +08:00
|
|
|
const int mapping[8] = { -1, V4L2_ENC_IDX_FRAME_I, V4L2_ENC_IDX_FRAME_P, -1,
|
|
|
|
V4L2_ENC_IDX_FRAME_B, -1, -1, -1 };
|
|
|
|
// 1=I, 2=P, 4=B
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
e->offset = read_enc(addr + 4) + ((u64)read_enc(addr + 8) << 32);
|
|
|
|
if (e->offset > itv->mpg_data_received) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
e->offset += itv->vbi_data_inserted;
|
|
|
|
e->length = read_enc(addr);
|
|
|
|
e->pts = read_enc(addr + 16) + ((u64)(read_enc(addr + 20) & 1) << 32);
|
2007-08-24 04:48:41 +08:00
|
|
|
e->flags = mapping[read_enc(addr + 12) & 7];
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
i++;
|
|
|
|
}
|
|
|
|
itv->pgm_info_write_idx = (itv->pgm_info_write_idx + i) % itv->pgm_info_num;
|
|
|
|
}
|
|
|
|
|
|
|
|
static struct ivtv_buffer *ivtv_get_buffer(struct ivtv_stream *s, int non_block, int *err)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = s->itv;
|
|
|
|
struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
|
|
|
|
struct ivtv_buffer *buf;
|
|
|
|
DEFINE_WAIT(wait);
|
|
|
|
|
|
|
|
*err = 0;
|
|
|
|
while (1) {
|
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_MPG) {
|
|
|
|
/* Process pending program info updates and pending VBI data */
|
|
|
|
ivtv_update_pgm_info(itv);
|
|
|
|
|
2008-04-17 03:13:15 +08:00
|
|
|
if (time_after(jiffies,
|
|
|
|
itv->dualwatch_jiffies +
|
|
|
|
msecs_to_jiffies(1000))) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
itv->dualwatch_jiffies = jiffies;
|
|
|
|
ivtv_dualwatch(itv);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags) &&
|
|
|
|
!test_bit(IVTV_F_S_APPL_IO, &s_vbi->s_flags)) {
|
|
|
|
while ((buf = ivtv_dequeue(s_vbi, &s_vbi->q_full))) {
|
|
|
|
/* byteswap and process VBI data */
|
|
|
|
ivtv_process_vbi_data(itv, buf, s_vbi->dma_pts, s_vbi->type);
|
|
|
|
ivtv_enqueue(s_vbi, buf, &s_vbi->q_free);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
buf = &itv->vbi.sliced_mpeg_buf;
|
|
|
|
if (buf->readpos != buf->bytesused) {
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* do we have leftover data? */
|
|
|
|
buf = ivtv_dequeue(s, &s->q_io);
|
|
|
|
if (buf)
|
|
|
|
return buf;
|
|
|
|
|
|
|
|
/* do we have new data? */
|
|
|
|
buf = ivtv_dequeue(s, &s->q_full);
|
|
|
|
if (buf) {
|
2007-07-28 23:07:12 +08:00
|
|
|
if ((buf->b_flags & IVTV_F_B_NEED_BUF_SWAP) == 0)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return buf;
|
2007-07-28 23:07:12 +08:00
|
|
|
buf->b_flags &= ~IVTV_F_B_NEED_BUF_SWAP;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_MPG)
|
|
|
|
/* byteswap MPG data */
|
|
|
|
ivtv_buf_swap(buf);
|
|
|
|
else if (s->type != IVTV_DEC_STREAM_TYPE_VBI) {
|
|
|
|
/* byteswap and process VBI data */
|
|
|
|
ivtv_process_vbi_data(itv, buf, s->dma_pts, s->type);
|
|
|
|
}
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* return if end of stream */
|
|
|
|
if (s->type != IVTV_DEC_STREAM_TYPE_VBI && !test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
|
|
|
|
IVTV_DEBUG_INFO("EOS %s\n", s->name);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2007-08-24 04:51:07 +08:00
|
|
|
/* return if file was opened with O_NONBLOCK */
|
|
|
|
if (non_block) {
|
|
|
|
*err = -EAGAIN;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* wait for more data to arrive */
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_unlock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE);
|
|
|
|
/* New buffers might have become available before we were added to the waitqueue */
|
|
|
|
if (!s->q_full.buffers)
|
|
|
|
schedule();
|
|
|
|
finish_wait(&s->waitq, &wait);
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_lock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (signal_pending(current)) {
|
|
|
|
/* return if a signal was received */
|
|
|
|
IVTV_DEBUG_INFO("User stopped %s\n", s->name);
|
|
|
|
*err = -EINTR;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void ivtv_setup_sliced_vbi_buf(struct ivtv *itv)
|
|
|
|
{
|
|
|
|
int idx = itv->vbi.inserted_frame % IVTV_VBI_FRAMES;
|
|
|
|
|
|
|
|
itv->vbi.sliced_mpeg_buf.buf = itv->vbi.sliced_mpeg_data[idx];
|
|
|
|
itv->vbi.sliced_mpeg_buf.bytesused = itv->vbi.sliced_mpeg_size[idx];
|
|
|
|
itv->vbi.sliced_mpeg_buf.readpos = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static size_t ivtv_copy_buf_to_user(struct ivtv_stream *s, struct ivtv_buffer *buf,
|
|
|
|
char __user *ubuf, size_t ucount)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = s->itv;
|
|
|
|
size_t len = buf->bytesused - buf->readpos;
|
|
|
|
|
|
|
|
if (len > ucount) len = ucount;
|
|
|
|
if (itv->vbi.insert_mpeg && s->type == IVTV_ENC_STREAM_TYPE_MPG &&
|
2008-10-04 19:05:30 +08:00
|
|
|
!ivtv_raw_vbi(itv) && buf != &itv->vbi.sliced_mpeg_buf) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
const char *start = buf->buf + buf->readpos;
|
|
|
|
const char *p = start + 1;
|
|
|
|
const u8 *q;
|
|
|
|
u8 ch = itv->search_pack_header ? 0xba : 0xe0;
|
|
|
|
int stuffing, i;
|
|
|
|
|
|
|
|
while (start + len > p && (q = memchr(p, 0, start + len - p))) {
|
|
|
|
p = q + 1;
|
|
|
|
if ((char *)q + 15 >= buf->buf + buf->bytesused ||
|
|
|
|
q[1] != 0 || q[2] != 1 || q[3] != ch) {
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (!itv->search_pack_header) {
|
|
|
|
if ((q[6] & 0xc0) != 0x80)
|
|
|
|
continue;
|
|
|
|
if (((q[7] & 0xc0) == 0x80 && (q[9] & 0xf0) == 0x20) ||
|
|
|
|
((q[7] & 0xc0) == 0xc0 && (q[9] & 0xf0) == 0x30)) {
|
|
|
|
ch = 0xba;
|
|
|
|
itv->search_pack_header = 1;
|
|
|
|
p = q + 9;
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
stuffing = q[13] & 7;
|
|
|
|
/* all stuffing bytes must be 0xff */
|
|
|
|
for (i = 0; i < stuffing; i++)
|
|
|
|
if (q[14 + i] != 0xff)
|
|
|
|
break;
|
|
|
|
if (i == stuffing && (q[4] & 0xc4) == 0x44 && (q[12] & 3) == 3 &&
|
|
|
|
q[14 + stuffing] == 0 && q[15 + stuffing] == 0 &&
|
|
|
|
q[16 + stuffing] == 1) {
|
|
|
|
itv->search_pack_header = 0;
|
|
|
|
len = (char *)q - start;
|
|
|
|
ivtv_setup_sliced_vbi_buf(itv);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (copy_to_user(ubuf, (u8 *)buf->buf + buf->readpos, len)) {
|
|
|
|
IVTV_DEBUG_WARN("copy %zd bytes to user failed for %s\n", len, s->name);
|
|
|
|
return -EFAULT;
|
|
|
|
}
|
|
|
|
/*IVTV_INFO("copied %lld %d %d %d %d %d vbi %d\n", itv->mpg_data_received, len, ucount,
|
|
|
|
buf->readpos, buf->bytesused, buf->bytesused - buf->readpos - len,
|
|
|
|
buf == &itv->vbi.sliced_mpeg_buf); */
|
|
|
|
buf->readpos += len;
|
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_MPG && buf != &itv->vbi.sliced_mpeg_buf)
|
|
|
|
itv->mpg_data_received += len;
|
|
|
|
return len;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ivtv_read(struct ivtv_stream *s, char __user *ubuf, size_t tot_count, int non_block)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = s->itv;
|
|
|
|
size_t tot_written = 0;
|
|
|
|
int single_frame = 0;
|
|
|
|
|
2011-10-12 16:36:04 +08:00
|
|
|
if (atomic_read(&itv->capturing) == 0 && s->fh == NULL) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* shouldn't happen */
|
|
|
|
IVTV_DEBUG_WARN("Stream %s not initialized before read\n", s->name);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Each VBI buffer is one frame, the v4l2 API says that for VBI the frames should
|
|
|
|
arrive one-by-one, so make sure we never output more than one VBI frame at a time */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_VBI ||
|
2008-10-04 19:05:30 +08:00
|
|
|
(s->type == IVTV_ENC_STREAM_TYPE_VBI && !ivtv_raw_vbi(itv)))
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
single_frame = 1;
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
struct ivtv_buffer *buf;
|
|
|
|
int rc;
|
|
|
|
|
|
|
|
buf = ivtv_get_buffer(s, non_block, &rc);
|
2007-08-24 04:51:07 +08:00
|
|
|
/* if there is no data available... */
|
|
|
|
if (buf == NULL) {
|
|
|
|
/* if we got data, then return that regardless */
|
|
|
|
if (tot_written)
|
|
|
|
break;
|
|
|
|
/* EOS condition */
|
|
|
|
if (rc == 0) {
|
|
|
|
clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
|
|
|
|
clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
ivtv_release_stream(s);
|
|
|
|
}
|
|
|
|
/* set errno */
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return rc;
|
2007-08-24 04:51:07 +08:00
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
rc = ivtv_copy_buf_to_user(s, buf, ubuf + tot_written, tot_count - tot_written);
|
|
|
|
if (buf != &itv->vbi.sliced_mpeg_buf) {
|
|
|
|
ivtv_enqueue(s, buf, (buf->readpos == buf->bytesused) ? &s->q_free : &s->q_io);
|
|
|
|
}
|
|
|
|
else if (buf->readpos == buf->bytesused) {
|
|
|
|
int idx = itv->vbi.inserted_frame % IVTV_VBI_FRAMES;
|
|
|
|
itv->vbi.sliced_mpeg_size[idx] = 0;
|
|
|
|
itv->vbi.inserted_frame++;
|
|
|
|
itv->vbi_data_inserted += buf->bytesused;
|
|
|
|
}
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
tot_written += rc;
|
|
|
|
|
|
|
|
if (tot_written == tot_count || single_frame)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return tot_written;
|
|
|
|
}
|
|
|
|
|
|
|
|
static ssize_t ivtv_read_pos(struct ivtv_stream *s, char __user *ubuf, size_t count,
|
|
|
|
loff_t *pos, int non_block)
|
|
|
|
{
|
|
|
|
ssize_t rc = count ? ivtv_read(s, ubuf, count, non_block) : 0;
|
|
|
|
struct ivtv *itv = s->itv;
|
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("read %zd from %s, got %zd\n", count, s->name, rc);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (rc > 0)
|
2019-02-22 14:36:41 +08:00
|
|
|
*pos += rc;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ivtv_start_capture(struct ivtv_open_id *id)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
|
|
|
struct ivtv_stream *s_vbi;
|
|
|
|
|
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_RAD ||
|
|
|
|
s->type == IVTV_DEC_STREAM_TYPE_MPG ||
|
|
|
|
s->type == IVTV_DEC_STREAM_TYPE_YUV ||
|
|
|
|
s->type == IVTV_DEC_STREAM_TYPE_VOUT) {
|
|
|
|
/* you cannot read from these stream types. */
|
2012-10-01 17:23:53 +08:00
|
|
|
return -EINVAL;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Try to claim this stream. */
|
|
|
|
if (ivtv_claim_stream(id, s->type))
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
/* This stream does not need to start capturing */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_VBI) {
|
|
|
|
set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If capture is already in progress, then we also have to
|
|
|
|
do nothing extra. */
|
|
|
|
if (test_bit(IVTV_F_S_STREAMOFF, &s->s_flags) || test_and_set_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
|
|
|
|
set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Start VBI capture if required */
|
|
|
|
s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
|
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_MPG &&
|
|
|
|
test_bit(IVTV_F_S_INTERNAL_USE, &s_vbi->s_flags) &&
|
|
|
|
!test_and_set_bit(IVTV_F_S_STREAMING, &s_vbi->s_flags)) {
|
|
|
|
/* Note: the IVTV_ENC_STREAM_TYPE_VBI is claimed
|
|
|
|
automatically when the MPG stream is claimed.
|
|
|
|
We only need to start the VBI capturing. */
|
|
|
|
if (ivtv_start_v4l2_encode_stream(s_vbi)) {
|
|
|
|
IVTV_DEBUG_WARN("VBI capture start failed\n");
|
|
|
|
|
|
|
|
/* Failure, clean up and return an error */
|
|
|
|
clear_bit(IVTV_F_S_STREAMING, &s_vbi->s_flags);
|
|
|
|
clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
|
|
|
|
/* also releases the associated VBI stream */
|
|
|
|
ivtv_release_stream(s);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
IVTV_DEBUG_INFO("VBI insertion started\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Tell the card to start capturing */
|
|
|
|
if (!ivtv_start_v4l2_encode_stream(s)) {
|
|
|
|
/* We're done */
|
|
|
|
set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
/* Resume a possibly paused encoder */
|
|
|
|
if (test_and_clear_bit(IVTV_F_I_ENC_PAUSED, &itv->i_flags))
|
|
|
|
ivtv_vapi(itv, CX2341X_ENC_PAUSE_ENCODER, 1, 1);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* failure, clean up */
|
|
|
|
IVTV_DEBUG_WARN("Failed to start capturing for stream %s\n", s->name);
|
|
|
|
|
|
|
|
/* Note: the IVTV_ENC_STREAM_TYPE_VBI is released
|
|
|
|
automatically when the MPG stream is released.
|
|
|
|
We only need to stop the VBI capturing. */
|
|
|
|
if (s->type == IVTV_ENC_STREAM_TYPE_MPG &&
|
|
|
|
test_bit(IVTV_F_S_STREAMING, &s_vbi->s_flags)) {
|
|
|
|
ivtv_stop_v4l2_encode_stream(s_vbi, 0);
|
|
|
|
clear_bit(IVTV_F_S_STREAMING, &s_vbi->s_flags);
|
|
|
|
}
|
|
|
|
clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
|
|
|
|
ivtv_release_stream(s);
|
|
|
|
return -EIO;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t ivtv_v4l2_read(struct file * filp, char __user *buf, size_t count, loff_t * pos)
|
|
|
|
{
|
2010-03-28 01:10:13 +08:00
|
|
|
struct ivtv_open_id *id = fh2id(filp->private_data);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
2012-06-24 18:26:10 +08:00
|
|
|
ssize_t rc;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("read %zd bytes from %s\n", count, s->name);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
if (mutex_lock_interruptible(&itv->serialize_lock))
|
|
|
|
return -ERESTARTSYS;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
rc = ivtv_start_capture(id);
|
2012-06-24 18:26:10 +08:00
|
|
|
if (!rc)
|
|
|
|
rc = ivtv_read_pos(s, buf, count, pos, filp->f_flags & O_NONBLOCK);
|
|
|
|
mutex_unlock(&itv->serialize_lock);
|
|
|
|
return rc;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int ivtv_start_decoding(struct ivtv_open_id *id, int speed)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
2010-06-13 00:33:21 +08:00
|
|
|
int rc;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
if (atomic_read(&itv->decoding) == 0) {
|
|
|
|
if (ivtv_claim_stream(id, s->type)) {
|
|
|
|
/* someone else is using this stream already */
|
|
|
|
IVTV_DEBUG_WARN("start decode, stream already claimed\n");
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
2010-06-13 00:33:21 +08:00
|
|
|
rc = ivtv_start_v4l2_decode_stream(s, 0);
|
2010-06-13 00:41:57 +08:00
|
|
|
if (rc < 0) {
|
|
|
|
if (rc == -EAGAIN)
|
|
|
|
rc = ivtv_start_v4l2_decode_stream(s, 0);
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_MPG)
|
|
|
|
return ivtv_set_speed(itv, speed);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
static ssize_t ivtv_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *pos)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
2010-03-28 01:10:13 +08:00
|
|
|
struct ivtv_open_id *id = fh2id(filp->private_data);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
2007-10-16 14:21:46 +08:00
|
|
|
struct yuv_playback_info *yi = &itv->yuv_info;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv_buffer *buf;
|
|
|
|
struct ivtv_queue q;
|
|
|
|
int bytes_written = 0;
|
|
|
|
int mode;
|
|
|
|
int rc;
|
|
|
|
DEFINE_WAIT(wait);
|
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("write %zd bytes to %s\n", count, s->name);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
if (s->type != IVTV_DEC_STREAM_TYPE_MPG &&
|
|
|
|
s->type != IVTV_DEC_STREAM_TYPE_YUV &&
|
|
|
|
s->type != IVTV_DEC_STREAM_TYPE_VOUT)
|
|
|
|
/* not decoder streams */
|
2012-10-01 17:23:53 +08:00
|
|
|
return -EINVAL;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* Try to claim this stream */
|
|
|
|
if (ivtv_claim_stream(id, s->type))
|
|
|
|
return -EBUSY;
|
|
|
|
|
|
|
|
/* This stream does not need to start any decoding */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_VOUT) {
|
2007-08-26 01:11:23 +08:00
|
|
|
int elems = count / sizeof(struct v4l2_sliced_vbi_data);
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
2010-12-20 08:59:56 +08:00
|
|
|
return ivtv_write_vbi_from_user(itv,
|
2010-12-18 21:48:17 +08:00
|
|
|
(const struct v4l2_sliced_vbi_data __user *)user_buf, elems);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
mode = s->type == IVTV_DEC_STREAM_TYPE_MPG ? OUT_MPG : OUT_YUV;
|
|
|
|
|
|
|
|
if (ivtv_set_output_mode(itv, mode) != mode) {
|
|
|
|
ivtv_release_stream(s);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
ivtv_queue_init(&q);
|
|
|
|
set_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
|
2008-06-21 20:25:23 +08:00
|
|
|
/* Start decoder (returns 0 if already started) */
|
|
|
|
rc = ivtv_start_decoding(id, itv->speed);
|
|
|
|
if (rc) {
|
|
|
|
IVTV_DEBUG_WARN("Failed start decode stream %s\n", s->name);
|
|
|
|
|
|
|
|
/* failure, clean up */
|
|
|
|
clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
|
|
|
|
clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
retry:
|
V4L/DVB (6717): ivtv: Initial merge of video48 yuv handling into the IVTV_IOC_DMA_FRAME framework
Previously, all yuv data written to /dev/video48 had only basic support with
no double buffering to avoid display tearing.
With this patch, yuv frames written to video48 are now handled by the existing
IVTV_IOC_DMA_FRAME framework. As such, the frames are hardware buffered to
avoid tearing, and honour scaling mode & field order options. Unlike the
proprietary IVTV_IOC_DMA_FRAME ioctl, all parameters are controlled by the
V4L2 API.
Due to mpeg & yuv output restrictions being different, their V4L2 output
controls have been separated. To control the yuv output, the V4L2 calls must
be done via video48.
If the ivtvfb module is loaded, there will be one side effect to this merge.
The yuv output window will be constrained to the visible framebuffer area. In
the event that a virtual framebuffer size is being used, the limit to the
output size will be the virtual dimensions, but only the portion that falls
within the currently visible area of the framebuffer will be shown.
Like the IVTV_IOC_DMA_FRAME ioctl, the supplied frames must be padded to 720
pixels wide. However the height must only be padded up the nearest multiple
of 32. This would mean an image of 102 lines must be padded to 128. As long
as the true source image size is given, the padding will not be visible in
the final output.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-11-06 01:27:09 +08:00
|
|
|
/* If possible, just DMA the entire frame - Check the data transfer size
|
|
|
|
since we may get here before the stream has been fully set-up */
|
|
|
|
if (mode == OUT_YUV && s->q_full.length == 0 && itv->dma_data_req_size) {
|
|
|
|
while (count >= itv->dma_data_req_size) {
|
2008-10-11 17:39:05 +08:00
|
|
|
rc = ivtv_yuv_udma_stream_frame(itv, (void __user *)user_buf);
|
|
|
|
|
|
|
|
if (rc < 0)
|
|
|
|
return rc;
|
|
|
|
|
|
|
|
bytes_written += itv->dma_data_req_size;
|
|
|
|
user_buf += itv->dma_data_req_size;
|
|
|
|
count -= itv->dma_data_req_size;
|
V4L/DVB (6717): ivtv: Initial merge of video48 yuv handling into the IVTV_IOC_DMA_FRAME framework
Previously, all yuv data written to /dev/video48 had only basic support with
no double buffering to avoid display tearing.
With this patch, yuv frames written to video48 are now handled by the existing
IVTV_IOC_DMA_FRAME framework. As such, the frames are hardware buffered to
avoid tearing, and honour scaling mode & field order options. Unlike the
proprietary IVTV_IOC_DMA_FRAME ioctl, all parameters are controlled by the
V4L2 API.
Due to mpeg & yuv output restrictions being different, their V4L2 output
controls have been separated. To control the yuv output, the V4L2 calls must
be done via video48.
If the ivtvfb module is loaded, there will be one side effect to this merge.
The yuv output window will be constrained to the visible framebuffer area. In
the event that a virtual framebuffer size is being used, the limit to the
output size will be the virtual dimensions, but only the portion that falls
within the currently visible area of the framebuffer will be shown.
Like the IVTV_IOC_DMA_FRAME ioctl, the supplied frames must be padded to 720
pixels wide. However the height must only be padded up the nearest multiple
of 32. This would mean an image of 102 lines must be padded to 128. As long
as the true source image size is given, the padding will not be visible in
the final output.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-11-06 01:27:09 +08:00
|
|
|
}
|
|
|
|
if (count == 0) {
|
|
|
|
IVTV_DEBUG_HI_FILE("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused);
|
|
|
|
return bytes_written;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
for (;;) {
|
|
|
|
/* Gather buffers */
|
|
|
|
while (q.length - q.bytesused < count && (buf = ivtv_dequeue(s, &s->q_io)))
|
|
|
|
ivtv_enqueue(s, buf, &q);
|
|
|
|
while (q.length - q.bytesused < count && (buf = ivtv_dequeue(s, &s->q_free))) {
|
|
|
|
ivtv_enqueue(s, buf, &q);
|
|
|
|
}
|
|
|
|
if (q.buffers)
|
|
|
|
break;
|
|
|
|
if (filp->f_flags & O_NONBLOCK)
|
|
|
|
return -EAGAIN;
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_unlock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
prepare_to_wait(&s->waitq, &wait, TASK_INTERRUPTIBLE);
|
|
|
|
/* New buffers might have become free before we were added to the waitqueue */
|
|
|
|
if (!s->q_free.buffers)
|
|
|
|
schedule();
|
|
|
|
finish_wait(&s->waitq, &wait);
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_lock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (signal_pending(current)) {
|
|
|
|
IVTV_DEBUG_INFO("User stopped %s\n", s->name);
|
|
|
|
return -EINTR;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* copy user data into buffers */
|
|
|
|
while ((buf = ivtv_dequeue(s, &q))) {
|
2007-10-16 14:21:46 +08:00
|
|
|
/* yuv is a pain. Don't copy more data than needed for a single
|
|
|
|
frame, otherwise we lose sync with the incoming stream */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_YUV &&
|
|
|
|
yi->stream_size + count > itv->dma_data_req_size)
|
|
|
|
rc = ivtv_buf_copy_from_user(s, buf, user_buf,
|
|
|
|
itv->dma_data_req_size - yi->stream_size);
|
|
|
|
else
|
|
|
|
rc = ivtv_buf_copy_from_user(s, buf, user_buf, count);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2007-10-16 14:21:46 +08:00
|
|
|
/* Make sure we really got all the user data */
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (rc < 0) {
|
|
|
|
ivtv_queue_move(s, &q, NULL, &s->q_free, 0);
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
user_buf += rc;
|
|
|
|
count -= rc;
|
|
|
|
bytes_written += rc;
|
|
|
|
|
2007-10-16 14:21:46 +08:00
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
|
|
|
|
yi->stream_size += rc;
|
|
|
|
/* If we have a complete yuv frame, break loop now */
|
|
|
|
if (yi->stream_size == itv->dma_data_req_size) {
|
|
|
|
ivtv_enqueue(s, buf, &s->q_full);
|
|
|
|
yi->stream_size = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (buf->bytesused != s->buf_size) {
|
|
|
|
/* incomplete, leave in q_io for next time */
|
|
|
|
ivtv_enqueue(s, buf, &s->q_io);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
/* Byteswap MPEG buffer */
|
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_MPG)
|
|
|
|
ivtv_buf_swap(buf);
|
|
|
|
ivtv_enqueue(s, buf, &s->q_full);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (test_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags)) {
|
|
|
|
if (s->q_full.length >= itv->dma_data_req_size) {
|
|
|
|
int got_sig;
|
|
|
|
|
V4L/DVB (6717): ivtv: Initial merge of video48 yuv handling into the IVTV_IOC_DMA_FRAME framework
Previously, all yuv data written to /dev/video48 had only basic support with
no double buffering to avoid display tearing.
With this patch, yuv frames written to video48 are now handled by the existing
IVTV_IOC_DMA_FRAME framework. As such, the frames are hardware buffered to
avoid tearing, and honour scaling mode & field order options. Unlike the
proprietary IVTV_IOC_DMA_FRAME ioctl, all parameters are controlled by the
V4L2 API.
Due to mpeg & yuv output restrictions being different, their V4L2 output
controls have been separated. To control the yuv output, the V4L2 calls must
be done via video48.
If the ivtvfb module is loaded, there will be one side effect to this merge.
The yuv output window will be constrained to the visible framebuffer area. In
the event that a virtual framebuffer size is being used, the limit to the
output size will be the virtual dimensions, but only the portion that falls
within the currently visible area of the framebuffer will be shown.
Like the IVTV_IOC_DMA_FRAME ioctl, the supplied frames must be padded to 720
pixels wide. However the height must only be padded up the nearest multiple
of 32. This would mean an image of 102 lines must be padded to 128. As long
as the true source image size is given, the padding will not be visible in
the final output.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-11-06 01:27:09 +08:00
|
|
|
if (mode == OUT_YUV)
|
|
|
|
ivtv_yuv_setup_stream_frame(itv);
|
|
|
|
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_unlock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
prepare_to_wait(&itv->dma_waitq, &wait, TASK_INTERRUPTIBLE);
|
|
|
|
while (!(got_sig = signal_pending(current)) &&
|
|
|
|
test_bit(IVTV_F_S_DMA_PENDING, &s->s_flags)) {
|
|
|
|
schedule();
|
|
|
|
}
|
|
|
|
finish_wait(&itv->dma_waitq, &wait);
|
2011-10-11 17:06:58 +08:00
|
|
|
mutex_lock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (got_sig) {
|
|
|
|
IVTV_DEBUG_INFO("User interrupted %s\n", s->name);
|
|
|
|
return -EINTR;
|
|
|
|
}
|
|
|
|
|
|
|
|
clear_bit(IVTV_F_S_NEEDS_DATA, &s->s_flags);
|
|
|
|
ivtv_queue_move(s, &s->q_full, NULL, &s->q_predma, itv->dma_data_req_size);
|
|
|
|
ivtv_dma_stream_dec_prepare(s, itv->dma_data_req_offset + IVTV_DECODER_OFFSET, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* more user data is available, wait until buffers become free
|
|
|
|
to transfer the rest. */
|
|
|
|
if (count && !(filp->f_flags & O_NONBLOCK))
|
|
|
|
goto retry;
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("Wrote %d bytes to %s (%d)\n", bytes_written, s->name, s->q_full.bytesused);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return bytes_written;
|
|
|
|
}
|
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
ssize_t ivtv_v4l2_write(struct file *filp, const char __user *user_buf, size_t count, loff_t *pos)
|
|
|
|
{
|
|
|
|
struct ivtv_open_id *id = fh2id(filp->private_data);
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
ssize_t res;
|
|
|
|
|
|
|
|
if (mutex_lock_interruptible(&itv->serialize_lock))
|
|
|
|
return -ERESTARTSYS;
|
|
|
|
res = ivtv_write(filp, user_buf, count, pos);
|
|
|
|
mutex_unlock(&itv->serialize_lock);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2017-07-03 15:02:56 +08:00
|
|
|
__poll_t ivtv_v4l2_dec_poll(struct file *filp, poll_table *wait)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
2010-03-28 01:10:13 +08:00
|
|
|
struct ivtv_open_id *id = fh2id(filp->private_data);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
2017-07-03 15:02:56 +08:00
|
|
|
__poll_t res = 0;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* add stream's waitq to the poll list */
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("Decoder poll\n");
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2010-03-28 01:10:13 +08:00
|
|
|
/* If there are subscribed events, then only use the new event
|
|
|
|
API instead of the old video.h based API. */
|
2011-06-14 04:44:42 +08:00
|
|
|
if (!list_empty(&id->fh.subscribed)) {
|
|
|
|
poll_wait(filp, &id->fh.wait, wait);
|
2010-03-28 01:10:13 +08:00
|
|
|
/* Turn off the old-style vsync events */
|
|
|
|
clear_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags);
|
|
|
|
if (v4l2_event_pending(&id->fh))
|
2018-02-12 06:34:03 +08:00
|
|
|
res = EPOLLPRI;
|
2010-03-28 01:10:13 +08:00
|
|
|
} else {
|
|
|
|
/* This is the old-style API which is here only for backwards
|
|
|
|
compatibility. */
|
|
|
|
poll_wait(filp, &s->waitq, wait);
|
|
|
|
set_bit(IVTV_F_I_EV_VSYNC_ENABLED, &itv->i_flags);
|
|
|
|
if (test_bit(IVTV_F_I_EV_VSYNC, &itv->i_flags) ||
|
|
|
|
test_bit(IVTV_F_I_EV_DEC_STOPPED, &itv->i_flags))
|
2018-02-12 06:34:03 +08:00
|
|
|
res = EPOLLPRI;
|
2010-03-28 01:10:13 +08:00
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* Allow write if buffers are available for writing */
|
|
|
|
if (s->q_free.buffers)
|
2018-02-12 06:34:03 +08:00
|
|
|
res |= EPOLLOUT | EPOLLWRNORM;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2017-07-03 15:02:56 +08:00
|
|
|
__poll_t ivtv_v4l2_enc_poll(struct file *filp, poll_table *wait)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
2017-07-03 15:14:15 +08:00
|
|
|
__poll_t req_events = poll_requested_events(wait);
|
2010-03-28 01:10:13 +08:00
|
|
|
struct ivtv_open_id *id = fh2id(filp->private_data);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
|
|
|
int eof = test_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
|
2017-07-03 15:02:56 +08:00
|
|
|
__poll_t res = 0;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* Start a capture if there is none */
|
2012-02-03 16:12:18 +08:00
|
|
|
if (!eof && !test_bit(IVTV_F_S_STREAMING, &s->s_flags) &&
|
2012-10-01 17:23:53 +08:00
|
|
|
s->type != IVTV_ENC_STREAM_TYPE_RAD &&
|
2018-02-12 06:34:03 +08:00
|
|
|
(req_events & (EPOLLIN | EPOLLRDNORM))) {
|
2007-08-19 18:10:55 +08:00
|
|
|
int rc;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
mutex_lock(&itv->serialize_lock);
|
2007-08-19 18:10:55 +08:00
|
|
|
rc = ivtv_start_capture(id);
|
2012-06-24 18:26:10 +08:00
|
|
|
mutex_unlock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (rc) {
|
|
|
|
IVTV_DEBUG_INFO("Could not start capture for %s (%d)\n",
|
|
|
|
s->name, rc);
|
2018-02-12 06:34:03 +08:00
|
|
|
return EPOLLERR;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_FILE("Encoder poll started capture\n");
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
/* add stream's waitq to the poll list */
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_HI_FILE("Encoder poll\n");
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
poll_wait(filp, &s->waitq, wait);
|
2011-06-28 21:40:42 +08:00
|
|
|
if (v4l2_event_pending(&id->fh))
|
2018-02-12 06:34:03 +08:00
|
|
|
res |= EPOLLPRI;
|
2011-06-28 21:40:42 +08:00
|
|
|
else
|
2011-06-14 04:44:42 +08:00
|
|
|
poll_wait(filp, &id->fh.wait, wait);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2008-04-28 23:18:00 +08:00
|
|
|
if (s->q_full.length || s->q_io.length)
|
2018-02-12 06:34:03 +08:00
|
|
|
return res | EPOLLIN | EPOLLRDNORM;
|
2008-04-28 23:18:00 +08:00
|
|
|
if (eof)
|
2018-02-12 06:34:03 +08:00
|
|
|
return res | EPOLLHUP;
|
2011-06-28 21:40:42 +08:00
|
|
|
return res;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void ivtv_stop_capture(struct ivtv_open_id *id, int gop_end)
|
|
|
|
{
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_FILE("close() of %s\n", s->name);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
/* 'Unclaim' this stream */
|
|
|
|
|
|
|
|
/* Stop capturing */
|
|
|
|
if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
|
|
|
|
struct ivtv_stream *s_vbi = &itv->streams[IVTV_ENC_STREAM_TYPE_VBI];
|
|
|
|
|
|
|
|
IVTV_DEBUG_INFO("close stopping capture\n");
|
|
|
|
/* Special case: a running VBI capture for VBI insertion
|
|
|
|
in the mpeg stream. Need to stop that too. */
|
|
|
|
if (id->type == IVTV_ENC_STREAM_TYPE_MPG &&
|
|
|
|
test_bit(IVTV_F_S_STREAMING, &s_vbi->s_flags) &&
|
|
|
|
!test_bit(IVTV_F_S_APPL_IO, &s_vbi->s_flags)) {
|
|
|
|
IVTV_DEBUG_INFO("close stopping embedded VBI capture\n");
|
|
|
|
ivtv_stop_v4l2_encode_stream(s_vbi, 0);
|
|
|
|
}
|
|
|
|
if ((id->type == IVTV_DEC_STREAM_TYPE_VBI ||
|
|
|
|
id->type == IVTV_ENC_STREAM_TYPE_VBI) &&
|
|
|
|
test_bit(IVTV_F_S_INTERNAL_USE, &s->s_flags)) {
|
|
|
|
/* Also used internally, don't stop capturing */
|
2011-10-12 16:36:04 +08:00
|
|
|
s->fh = NULL;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
ivtv_stop_v4l2_encode_stream(s, gop_end);
|
|
|
|
}
|
|
|
|
}
|
2007-08-24 04:51:07 +08:00
|
|
|
if (!gop_end) {
|
|
|
|
clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
|
|
|
|
ivtv_release_stream(s);
|
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
|
2007-03-03 19:50:42 +08:00
|
|
|
static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_FILE("close() of %s\n", s->name);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2010-05-24 09:27:49 +08:00
|
|
|
if (id->type == IVTV_DEC_STREAM_TYPE_YUV &&
|
|
|
|
test_bit(IVTV_F_I_DECODING_YUV, &itv->i_flags)) {
|
|
|
|
/* Restore registers we've changed & clean up any mess */
|
|
|
|
ivtv_yuv_close(itv);
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Stop decoding */
|
|
|
|
if (test_bit(IVTV_F_S_STREAMING, &s->s_flags)) {
|
|
|
|
IVTV_DEBUG_INFO("close stopping decode\n");
|
|
|
|
|
|
|
|
ivtv_stop_v4l2_decode_stream(s, flags, pts);
|
2007-08-21 03:01:58 +08:00
|
|
|
itv->output_mode = OUT_NONE;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
}
|
|
|
|
clear_bit(IVTV_F_S_APPL_IO, &s->s_flags);
|
|
|
|
clear_bit(IVTV_F_S_STREAMOFF, &s->s_flags);
|
2010-05-24 09:27:49 +08:00
|
|
|
|
2007-08-21 03:01:58 +08:00
|
|
|
if (itv->output_mode == OUT_UDMA_YUV && id->yuv_frames)
|
2007-08-19 02:58:51 +08:00
|
|
|
itv->output_mode = OUT_NONE;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
|
|
|
itv->speed = 0;
|
2007-07-22 19:46:38 +08:00
|
|
|
clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
ivtv_release_stream(s);
|
|
|
|
}
|
|
|
|
|
2008-12-30 17:58:20 +08:00
|
|
|
int ivtv_v4l2_close(struct file *filp)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
2010-03-28 01:10:13 +08:00
|
|
|
struct v4l2_fh *fh = filp->private_data;
|
|
|
|
struct ivtv_open_id *id = fh2id(fh);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv *itv = id->itv;
|
|
|
|
struct ivtv_stream *s = &itv->streams[id->type];
|
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_FILE("close %s\n", s->name);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
mutex_lock(&itv->serialize_lock);
|
|
|
|
|
2011-10-11 16:18:08 +08:00
|
|
|
/* Stop radio */
|
|
|
|
if (id->type == IVTV_ENC_STREAM_TYPE_RAD &&
|
|
|
|
v4l2_fh_is_singular_file(filp)) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Closing radio device, return to TV mode */
|
|
|
|
ivtv_mute(itv);
|
|
|
|
/* Mark that the radio is no longer in use */
|
|
|
|
clear_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
|
|
|
|
/* Switch tuner to TV */
|
2014-04-29 03:53:01 +08:00
|
|
|
ivtv_call_all(itv, video, s_std, itv->std);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Select correct audio input (i.e. TV tuner or Line in) */
|
|
|
|
ivtv_audio_set_io(itv);
|
2009-04-01 14:15:52 +08:00
|
|
|
if (itv->hw_flags & IVTV_HW_SAA711X) {
|
|
|
|
ivtv_call_hw(itv, IVTV_HW_SAA711X, video, s_crystal_freq,
|
|
|
|
SAA7115_FREQ_32_11_MHZ, 0);
|
2007-05-17 19:08:45 +08:00
|
|
|
}
|
2007-10-15 04:27:56 +08:00
|
|
|
if (atomic_read(&itv->capturing) > 0) {
|
|
|
|
/* Undo video mute */
|
|
|
|
ivtv_vapi(itv, CX2341X_ENC_MUTE_VIDEO, 1,
|
2011-10-11 16:18:08 +08:00
|
|
|
v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute) |
|
|
|
|
(v4l2_ctrl_g_ctrl(itv->cxhdl.video_mute_yuv) << 8));
|
2007-10-15 04:27:56 +08:00
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Done! Unmute and continue. */
|
|
|
|
ivtv_unmute(itv);
|
2011-10-11 16:18:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
v4l2_fh_del(fh);
|
|
|
|
v4l2_fh_exit(fh);
|
|
|
|
|
|
|
|
/* Easy case first: this stream was never claimed by us */
|
2012-06-24 18:26:10 +08:00
|
|
|
if (s->fh != &id->fh)
|
|
|
|
goto close_done;
|
2011-10-11 16:18:08 +08:00
|
|
|
|
|
|
|
/* 'Unclaim' this stream */
|
|
|
|
|
|
|
|
if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) {
|
2007-07-22 20:39:56 +08:00
|
|
|
struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT];
|
|
|
|
|
2011-11-24 20:58:53 +08:00
|
|
|
ivtv_stop_decoding(id, V4L2_DEC_CMD_STOP_TO_BLACK | V4L2_DEC_CMD_STOP_IMMEDIATELY, 0);
|
2007-07-22 20:39:56 +08:00
|
|
|
|
|
|
|
/* If all output streams are closed, and if the user doesn't have
|
2007-08-26 01:11:23 +08:00
|
|
|
IVTV_DEC_STREAM_TYPE_VOUT open, then disable CC on TV-out. */
|
2007-07-22 20:39:56 +08:00
|
|
|
if (itv->output_mode == OUT_NONE && !test_bit(IVTV_F_S_APPL_IO, &s_vout->s_flags)) {
|
2007-08-26 01:11:23 +08:00
|
|
|
/* disable CC on TV-out */
|
|
|
|
ivtv_disable_cc(itv);
|
2007-07-22 20:39:56 +08:00
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
} else {
|
|
|
|
ivtv_stop_capture(id, 0);
|
|
|
|
}
|
2012-06-24 18:26:10 +08:00
|
|
|
close_done:
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
kfree(id);
|
2012-06-24 18:26:10 +08:00
|
|
|
mutex_unlock(&itv->serialize_lock);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
static int ivtv_open(struct file *filp)
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
{
|
2010-06-13 00:33:21 +08:00
|
|
|
struct video_device *vdev = video_devdata(filp);
|
2011-10-11 17:06:58 +08:00
|
|
|
struct ivtv_stream *s = video_get_drvdata(vdev);
|
2007-08-19 18:10:55 +08:00
|
|
|
struct ivtv *itv = s->itv;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
struct ivtv_open_id *item;
|
2010-03-28 01:10:13 +08:00
|
|
|
int res = 0;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2007-08-19 17:08:58 +08:00
|
|
|
IVTV_DEBUG_FILE("open %s\n", s->name);
|
2007-07-22 23:52:40 +08:00
|
|
|
|
2011-10-11 17:06:58 +08:00
|
|
|
if (ivtv_init_on_first_open(itv)) {
|
|
|
|
IVTV_ERR("Failed to initialize on device %s\n",
|
|
|
|
video_device_node_name(vdev));
|
|
|
|
return -ENXIO;
|
|
|
|
}
|
|
|
|
|
2010-06-13 00:33:21 +08:00
|
|
|
#ifdef CONFIG_VIDEO_ADV_DEBUG
|
2010-06-13 00:41:57 +08:00
|
|
|
/* Unless ivtv_fw_debug is set, error out if firmware dead. */
|
2010-06-13 00:33:21 +08:00
|
|
|
if (ivtv_fw_debug) {
|
|
|
|
IVTV_WARN("Opening %s with dead firmware lockout disabled\n",
|
|
|
|
video_device_node_name(vdev));
|
|
|
|
IVTV_WARN("Selected firmware errors will be ignored\n");
|
2010-06-13 00:41:57 +08:00
|
|
|
} else {
|
2010-06-13 00:33:21 +08:00
|
|
|
#else
|
2010-06-13 00:41:57 +08:00
|
|
|
if (1) {
|
2010-06-13 00:33:21 +08:00
|
|
|
#endif
|
2010-06-13 00:41:57 +08:00
|
|
|
res = ivtv_firmware_check(itv, "ivtv_serialized_open");
|
|
|
|
if (res == -EAGAIN)
|
|
|
|
res = ivtv_firmware_check(itv, "ivtv_serialized_open");
|
|
|
|
if (res < 0)
|
|
|
|
return -EIO;
|
|
|
|
}
|
2010-06-13 00:33:21 +08:00
|
|
|
|
2007-08-19 18:10:55 +08:00
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_MPG &&
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_YUV].s_flags))
|
|
|
|
return -EBUSY;
|
|
|
|
|
2007-08-19 18:10:55 +08:00
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_YUV &&
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
test_bit(IVTV_F_S_CLAIMED, &itv->streams[IVTV_DEC_STREAM_TYPE_MPG].s_flags))
|
|
|
|
return -EBUSY;
|
|
|
|
|
2007-08-19 18:10:55 +08:00
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (read_reg(0x82c) == 0) {
|
|
|
|
IVTV_ERR("Tried to open YUV output device but need to send data to mpeg decoder before it can be used\n");
|
|
|
|
/* return -ENODEV; */
|
|
|
|
}
|
|
|
|
ivtv_udma_alloc(itv);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Allocate memory */
|
2010-03-28 01:10:13 +08:00
|
|
|
item = kzalloc(sizeof(struct ivtv_open_id), GFP_KERNEL);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
if (NULL == item) {
|
|
|
|
IVTV_DEBUG_WARN("nomem on v4l2 open\n");
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
2015-03-10 00:33:55 +08:00
|
|
|
v4l2_fh_init(&item->fh, &s->vdev);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
item->itv = itv;
|
2007-08-19 18:10:55 +08:00
|
|
|
item->type = s->type;
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2010-03-28 01:10:13 +08:00
|
|
|
filp->private_data = &item->fh;
|
2011-10-11 16:18:08 +08:00
|
|
|
v4l2_fh_add(&item->fh);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
|
2011-10-11 16:18:08 +08:00
|
|
|
if (item->type == IVTV_ENC_STREAM_TYPE_RAD &&
|
|
|
|
v4l2_fh_is_singular_file(filp)) {
|
2007-08-18 22:46:05 +08:00
|
|
|
if (!test_bit(IVTV_F_I_RADIO_USER, &itv->i_flags)) {
|
|
|
|
if (atomic_read(&itv->capturing) > 0) {
|
|
|
|
/* switching to radio while capture is
|
|
|
|
in progress is not polite */
|
2011-10-11 16:18:08 +08:00
|
|
|
v4l2_fh_del(&item->fh);
|
2010-03-28 01:10:13 +08:00
|
|
|
v4l2_fh_exit(&item->fh);
|
2007-08-18 22:46:05 +08:00
|
|
|
kfree(item);
|
|
|
|
return -EBUSY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* Mark that the radio is being used. */
|
|
|
|
set_bit(IVTV_F_I_RADIO_USER, &itv->i_flags);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* We have the radio */
|
|
|
|
ivtv_mute(itv);
|
|
|
|
/* Switch tuner to radio */
|
2008-11-30 06:38:23 +08:00
|
|
|
ivtv_call_all(itv, tuner, s_radio);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Select the correct audio input (i.e. radio tuner) */
|
|
|
|
ivtv_audio_set_io(itv);
|
2008-11-30 06:38:23 +08:00
|
|
|
if (itv->hw_flags & IVTV_HW_SAA711X) {
|
2009-04-01 14:15:52 +08:00
|
|
|
ivtv_call_hw(itv, IVTV_HW_SAA711X, video, s_crystal_freq,
|
|
|
|
SAA7115_FREQ_32_11_MHZ, SAA7115_FREQ_FL_APLL);
|
2007-05-17 19:08:45 +08:00
|
|
|
}
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
/* Done! Unmute and continue. */
|
|
|
|
ivtv_unmute(itv);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* YUV or MPG Decoding Mode? */
|
2007-10-16 14:21:46 +08:00
|
|
|
if (s->type == IVTV_DEC_STREAM_TYPE_MPG) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
clear_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);
|
2007-10-16 14:21:46 +08:00
|
|
|
} else if (s->type == IVTV_DEC_STREAM_TYPE_YUV) {
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
set_bit(IVTV_F_I_DEC_YUV, &itv->i_flags);
|
2007-10-16 14:21:46 +08:00
|
|
|
/* For yuv, we need to know the dma size before we start */
|
|
|
|
itv->dma_data_req_size =
|
V4L/DVB (6717): ivtv: Initial merge of video48 yuv handling into the IVTV_IOC_DMA_FRAME framework
Previously, all yuv data written to /dev/video48 had only basic support with
no double buffering to avoid display tearing.
With this patch, yuv frames written to video48 are now handled by the existing
IVTV_IOC_DMA_FRAME framework. As such, the frames are hardware buffered to
avoid tearing, and honour scaling mode & field order options. Unlike the
proprietary IVTV_IOC_DMA_FRAME ioctl, all parameters are controlled by the
V4L2 API.
Due to mpeg & yuv output restrictions being different, their V4L2 output
controls have been separated. To control the yuv output, the V4L2 calls must
be done via video48.
If the ivtvfb module is loaded, there will be one side effect to this merge.
The yuv output window will be constrained to the visible framebuffer area. In
the event that a virtual framebuffer size is being used, the limit to the
output size will be the virtual dimensions, but only the portion that falls
within the currently visible area of the framebuffer will be shown.
Like the IVTV_IOC_DMA_FRAME ioctl, the supplied frames must be padded to 720
pixels wide. However the height must only be padded up the nearest multiple
of 32. This would mean an image of 102 lines must be padded to 128. As long
as the true source image size is given, the padding will not be visible in
the final output.
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-11-06 01:27:09 +08:00
|
|
|
1080 * ((itv->yuv_info.v4l2_src_h + 31) & ~31);
|
2007-10-16 14:21:46 +08:00
|
|
|
itv->yuv_info.stream_size = 0;
|
|
|
|
}
|
2007-08-19 18:10:55 +08:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2012-06-24 18:26:10 +08:00
|
|
|
int ivtv_v4l2_open(struct file *filp)
|
|
|
|
{
|
|
|
|
struct video_device *vdev = video_devdata(filp);
|
|
|
|
int res;
|
|
|
|
|
|
|
|
if (mutex_lock_interruptible(vdev->lock))
|
|
|
|
return -ERESTARTSYS;
|
|
|
|
res = ivtv_open(filp);
|
|
|
|
mutex_unlock(vdev->lock);
|
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
void ivtv_mute(struct ivtv *itv)
|
|
|
|
{
|
|
|
|
if (atomic_read(&itv->capturing))
|
|
|
|
ivtv_vapi(itv, CX2341X_ENC_MUTE_AUDIO, 1, 1);
|
|
|
|
IVTV_DEBUG_INFO("Mute\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
void ivtv_unmute(struct ivtv *itv)
|
|
|
|
{
|
|
|
|
if (atomic_read(&itv->capturing)) {
|
2007-08-18 22:46:05 +08:00
|
|
|
ivtv_msleep_timeout(100, 0);
|
V4L/DVB (5345): ivtv driver for Conexant cx23416/cx23415 MPEG encoder/decoder
It took three core maintainers, over four years of work, eight new i2c
modules, eleven new V4L2 ioctls, three new DVB video ioctls, a Sliced
VBI API, a new MPEG encoder API, an enhanced DVB video MPEG decoding
API, major YUV/OSD contributions from Ian and John, web/wiki/svn/trac
support from Axel Thimm, (hardware) support from Hauppauge, support and
assistance from the v4l-dvb people and the many, many users of ivtv to
finally make it possible to merge this driver into the kernel.
Thank you all!
Signed-off-by: Kevin Thayer <nufan_wfk@yahoo.com>
Signed-off-by: Chris Kennedy <c@groovy.org>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: John P Harvey <john.p.harvey@btinternet.com>
Signed-off-by: Ian Armstrong <ian@iarmst.demon.co.uk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
2007-04-27 23:31:25 +08:00
|
|
|
ivtv_vapi(itv, CX2341X_ENC_MISC, 1, 12);
|
|
|
|
ivtv_vapi(itv, CX2341X_ENC_MUTE_AUDIO, 1, 0);
|
|
|
|
}
|
|
|
|
IVTV_DEBUG_INFO("Unmute\n");
|
|
|
|
}
|