On Saturday 26 August 2006 23:12, Martin Dauskardt wrote:
> There is much work in progress ... But Hans, please be aware that
> there are not only mythtv users !
See, my scheme worked: change the API and see who complains!
But seriously, I am going to be ruthless in this: the current driver (up
to 0.7.0) is full of ivtv-specific ioctls that need to be converted to
standard V4L2 ioctls. With the upcoming 0.8.0 and 2.6.18 the MPEG
encoding ioctls are converted and all the miscelaneous ioctls. The
decoding and OSD ioctls are still untouched.
It is important to know that once a command is converted to a v4l2
command it will not change again. And the code will automatically
support other MPEG cards not based on the conexant chip.
> There are two vdr-plugins which are tainted by the changes. I managed
> to adapt the pvr350-Plugin, but as I mentioned several times, the
> decoder start/stop ioctls are much slower than the fwapi calls which
> were used by the plugin before.
When I start working on the decoder ioctls I will investigate this and
fix it properly. You can speed this up by mailing me a summary of
what's happening, that'll save me time searching through the mail
archive. Actually, if you provide me with the info (and code) you have,
then I'll do my best to look at it next weekend.
> Big problem is the pvrinput-Plugin: Teletext does no longer work, and
> the DNR filters seem also to be broken.
>
> The code looks like this:
>
> --------------------------------------------------------------------
> void cPvrReadThread::Action(void)
> {
> active = true;
>
> unsigned char buffer[BUFFSIZE];
> int r;
>
> if (vbi_fd > 0)
> {
> int vbi_insert = 1;
> if (ioctl(vbi_fd, IVTV_IOC_S_VBI_EMBED, &vbi_insert) < 0)
This is a new control:
#define V4L2_CID_MPEG_STREAM_VBI_FMT (V4L2_CID_MPEG_BASE+7)
enum v4l2_mpeg_stream_vbi_fmt {
V4L2_MPEG_STREAM_VBI_FMT_NONE = 0, /* No VBI in the MPEG stream
*/
V4L2_MPEG_STREAM_VBI_FMT_IVTV = 1, /* VBI in private packets,
IVTV format */
};
You've probably discovered the new VIDIOC_S_EXT_CTRLS ioctl that can be
used to set MPEG controls. This is one of them.
Note that for testing you need the latest ivtv from the 0.8 branch. I
only added support for this in ivtv last Friday. Before that the
control was in v4l-dvb and 2.6.18-rcX, but not yet in ivtv. That is now
fixed.
> {
> log(0, "Error setting vbi embedded mode, %d:%s", errno,
> strerror(errno)); }
> struct v4l2_format vbi_fmt;
> vbi_fmt.type = V4L2_BUF_TYPE_SLICED_VBI_CAPTURE;
> vbi_fmt.fmt.sliced.service_set = V4L2_SLICED_TELETEXT_B;
> if (ioctl(vbi_fd, VIDIOC_S_FMT, &vbi_fmt) < 0)
> {
> log(0, "Error setting vbi mode, %d:%s", errno, strerror(errno));
> }
> }
>
> while (active)
> {
> r = read(video_fd, buffer, BUFFSIZE);
> if (r == -1)
> {
> log(0, "Error reading from video device, %d:%s", errno,
> strerror(errno)); break;
> }
> if (r > 0)
> {
> ParseProgramStream(buffer, r);
> }
> }
> }
>
> ---------------------------------------------------------------
>
> bool cPvrDevice::SetCodec(void)
> {
> struct ivtv_ioctl_codec codec;
>
> if (IOCTL(video_fd, IVTV_IOC_G_CODEC, &codec) != 0)
> {
> log(0, "IVTV_IOC_G_CODEC failed, %d:%s", errno, strerror(errno));
> return false;
> }
Again, all codec controls are now done through VIDIOC_S_EXT_CTRLS and
are all defined in videodev2.h from the 2.6.18-rcX kernel or directly
from the v4l-dvb repository at www.linuxtv.org.
The v4l2 spec isn't updated yet, although I've send several bits of
documentation to the maintainer of that spec. See also MythTV (svn
trunk) where this is already implemented.
> codec.stream_type = IVTV_STREAM_DVD_S2; // IVTV_STREAM_PS or
> IVTV_STREAM_DVD_S2
> codec.aspect = PvrSetup.AspectRatio + 1;
> codec.pulldown = PvrSetup.Pulldown;
> codec.bitrate = PvrSetup.VideoBitrate * 1000;
> codec.bitrate_peak = 15000000;
> codec.bitrate_mode = bitrateCBR;
>
> codec.framespergop = PvrSetup.FramesPerGop; // 15 for NTSC
> codec.bframes = PvrSetup.BFrames + 1;
> codec.gop_closure = PvrSetup.GopClosure;
>
> codec.dnr_mode = PvrSetup.DnrMode;
> codec.dnr_type = PvrSetup.DnrType;
> codec.dnr_spatial = PvrSetup.DnrSpatial;
> codec.dnr_temporal = PvrSetup.DnrTemporal;
>
> codec.audio_bitmask = 0x0009 | ((PvrSetup.AudioBitrate + 1) << 4);
> codec.framerate = 1;
>
> if (IOCTL(video_fd, IVTV_IOC_S_CODEC, &codec) != 0)
> {
> log(0, "IVTV_IOC_S_CODEC failed, %d:%s", errno, strerror(errno));
> return false;
> }
> return true;
> }
>
> ---------------------------------------------------------------------
>------- Could you help me to adapt this to the new (v4l2 ?) commands?
> Which other header files than ivtv.h and videodev2.h have to be
> included?
That should be it. Note that I'll be investigating how difficult it is
to backport the changes to the older versions. It would be very nice if
the API is the same for all versions of the driver.
Feel free to ask any questions about this conversion, I'll be happy to
answer them.
Hans
_______________________________________________
ivtv-devel mailing list
[email protected]
http://ivtvdriver.org/mailman/listinfo/ivtv-devel