Quick readme till we get something better:

doc/ - contains documentation
driver/ - actual driver files, Makefile, etc
utils/ - some useful (and required) tools for extracting firmware, etc.

please check the readme file in utils/ for firmware extracting instructions.

*****************************************
*** THIS IS A DEVELOPMENT BRANCH. IT MAY NOT BE STABLE
*** USE AT YOUR OWN RISK :)
*****************************************

=== Current state of the driver ========
October 23, 2003
Lots of patches:
 * kernel locking patch by Jens Axboe
 * VCD/MPG1 fix by Phil Jensen
 * Matt's new kernel-timer 'dead dma' detection

Plus some other random stuff i threw in. This might be broken, really haven't tested it.

-tmk

October 2, 2003
Applied patch to make the driver work with both versions of V4L2 headers floating around (thanks isaac)

-tmk

September 30, 2003
one small fb fix (was calling something it shouldn't have i think)

get_timing ioctl cleaned up to prevent bogus values from escaping (ie fixes mythtv seeking problem).. this may have introduced some corruption into the OSD, but i don't see how..

-tmk

September 25, 2003
freezes while osd is going on should be gone now. still need to merge the osd dma 
stuff into a 'stream' construct.

-tmk

September 23, 2003
Seem to have gotten the rough code a little smoother. Not done yet though, but certainly passable.

-tmk

September 20, 2003
Added some REALLY rough code to ivtv-fb and ivtv-driver to sync up dma's between osd and decoder calls. This seems to make osd via the IVTVFB_IOCTL_PREP_FRAME ioctl stable.

Still needs some love though.

-tmk

September 17, 2003
rather than fix the kernel bug, i just made the thread persistent. Probably a slightly cleaner solution anyways. no need to make so many threads :)

-tmk

September 15, 2003
put in my own version of the threading fix. threads seem to crash if un/reloaded too much though. kernel bug?

-tmk

September 14, 2003
Fixed some option bugs (yuv_buffers and dec_yuv_buffers)

-tmk

September 11, 2003
Removed mythtv patch, since cvs mythtv has better code in it

fixed encoder poll() code. works properly now :)

ran ivtv-fb.c through indent. ahhhhh
also added some ioctls to ivtv-fb.c to allow myth to write directly.

-tmk

September 9, 2003
Fixed some compile problems on old gcc, added mythtv patch for pcr-350 tv-out
-tmk

September 8, 2003
Driver now checks to see if bus mastering is enabled during module load. Module load fails if it is not!

-lmm

September 8, 2003
Put tuner.signal into G_TUNER ioctl

-tmk

September 7, 2003
API stuff for ff/slow, v4l2 cid's, cfg start/stop decode

-tmk

September 6, 2003
Merged in some new algorithms. Might be a little unstable still. A bit more work remains also

(and later that same day...)
got everything merged sucessfully i think. seems nice and stable.

(still later)
i'm seeing occasional freezes (dma-done never gets called), otherwise seemsok

-tmk

September 4, 2003
Some more work and messy patching. Things might be unstable until i get my merges straightened out.

-tmk

August 29, 2003
Decoder probably working now. Still a couple of bugs that will stop decoding sometimes, but overall is smooth for me. encoding/decoding should work now too.

encoding/decoding simultaneously works, but there's a bug in irq masking (i think) so if you close the encoder stream, bye bye decoding

-tmk

August 23, 2003
Progress made. A couple of dumb bugs holding me back
-tmk

August 21, 2003
Found bug in decoder dma_handle assignment. Probably was making it break. will test tonight
-tmk

August 19, 2003
More decoder work. Probably still broken
-tmk

August 13, 2003
Checked in first part of decoder fixup. Might work, probably doesn't

-tmk

July 31, 2003
New version of msp3400.c (patched)

-tmk

July 23, 2003
Decoder working! seems pretty stable, needs some cleanup though.

hurrah!

-tmk

July 16, 2003
Added a patch to stop some problems with PAL scaling. Thanks Bastiaan
Minimally tested.

-tmk

July 7, 2003
Finally tracked down/killed the audio whine (NTSC), enabled stereo mode for everyone. Hopefully this is the end of the low-level audio bugs. There're still several little UI bugs that need to be squished (eg volume setting doesn't work as advertised)

-tmk

June 25, 2003
Fixes: Jitter bug fixed (scaled video would 'bounce' sometimes)
       Fixed test_ioctl problem caused by new audio bitmask implementation
       Audio settings are now meaningful (encoded data rate and source rate)
-tmk

June 24, 2003
Updated the FAQ

-tmk

June 23, 2003
Added underlying VBI support (i'll be needing a volunteer to solidify the settings)

Made YUV_fixup experimental. To use it you'll need to define YUV_FIXUP

... and later that same day

Big update to audio settings (selecting bitrate etc). It might even work! try your v4l2 control panels on it (that means YOU scott ;) Guarenteed not to properly set the msp or anything except the firmware API call.

-tmk

June 22, 2003
Fixed MSP whine (though not as clean as i'd like)

Please test and let me know of problems
-tmk

June 19, 2003
Added in Scott's brightness/etc patch

-tmk

June 17, 2003
Somehow the fps settings for PAL got moved or disappeared. Big thanks to Isaac of mythtv fame for submitting a patch before I knew what had happened :)

Can PAL folks test and see if this helps with the 'shaking' ?

-tmk

June 12, 2003
OK i'm back from vacation, and I've got a little present for all y'all. 

Multi card support! It was mostly working, but there was one variable that was incorrectly shared. Fixed that and things seem happy. Have fun testing ;)

-tmk

May 19, 2003
Non-blocking IO, minor saa7115 patch.

-tmk

May 18, 2003
Added some spinlocks; should eliminate some of the queue problems

-tmk

May 14, 2003
Code cleanup, some extra debugging output, no functional changes

-tmk

May 10, 2003
Fixed YUV-fixup partially, no more artifacts when using cat (yay)
Outstanding bugs with YUV-fixup: 
* large read buffers (ie buffers big enough to hold a whole frame) 
    will segfault it, so be careful with those big buffers :)
* same goes for extremely small ( < 32 bytes) buffers

Applied a few patches, notably a patch to fix the Oops/segfaults on unloading (thx john) and patches to set mpg options (bitrate, codec, etc).. thx to alex for that one

-tmk

May 8, 2003
Cleaned a few things up including some segfaults (hopefully)

Reduced the default logging to errors only. For a moderate amount of debugging,
use debug=3. For FULL debugging, debug=127

Added EXPERIMENTAL yuv_fixup support. Please test it. Be aware that it may
lock your system. It seems to generate YUV with a few artifacts, but i'm
satisfied enough with the result that i'm releasing it now.

Key test points:
* Does it work with PAL?
* Does it work with resized video?
* Is it stable?
* Is the picture clear?

Also as part of this, i needed to increase the buffer size so that the YUV 
Macroblocks would fit cleanly into a buffer. Assuming Alex's tests are correct,
The card will always return a 720width yuv buffer regardless of the configured
size, with the extra bytes being garbage. The driver SHOULD handle this and give
you valid YUV.

-tmk

April 30, 2003
Fixed a couple bugs:
* Closing streams was causing capturing (on other streams) to stop altogether
* Some erroneous logs were being generated

And spent some time updating the FAQ and docs.

-tmk

April 28, 2003 - part 2
Updated again, fixed a few things. YUV sort-of works now. It's not descrambled 
though, so you won't be able to view it. Also it locked my machine once in YUV
mode, so be careful.

To make the yuv device:
mknod /dev/yuv0 c 81 32

-tmk

April 28, 2003
**MAJOR** update. Totally new DMA method, there will most likely be problems

Test and let me know how it goes. YUV coming soon (video only for now)

Make sure you 'make clean' before making this one.

If you want a more stable release, use this instead (it will get the last cvs commit before the new code went in):
`cvs checkout -r pre-qbuf ivtv`

-tmk

April 24, 2003 - part 2
* Included FAQ with distro. See doc/
* Included videodev2.h, for those who need it, place it in 
    driver/ and compile. should "just work".. It comes packaged
    in utils/ for now though
* Patched test_ioctl to latest/greatest.

April 24, 2003
Major code cleanup (removed a lot of unused parts)

Added some saa7115 fixes:
* PAL blanking interval changed to remove artifacts
* "Auto-gain" disabled (causes video "pumping")
* Fix for LIRC posted to mailing list (reg 0x17 to 0x98)

Lots of utils patches, not going to mention all of them.

Errata: I mistyped in a previous update..
Multiple minors. IvyTV will now register 3 video devices on char-major 81:
(card-num)+0 is mpg
(card-num)+32 is mpg -- should read "is YUV"

of course, YUV and VBI are not supported yet. (YUV may come soon)

-tmk

April 17, 2003
A few problems are starting to appear as we get a wider test base. Some of them are kind of strange but i'm tracking them down as I can.

Today brings better buffer-full handling, bugfixes in stream handling, DMA bugfixes, and some minor architectural changes. Also, the pop when changing channels should be gone now.

-tmk

April 12, 2003

Added in resolution switching code. Use test_ioctl with the -e and -f options to switch. Also, you'll have to set the resolution manually depending on your standard. No more freebies :)

From my testing, as long as you pick a standard horizontal res, you can set the vertical to whatever you want. The horizontal resolution seems to be much pickier, and somtimes gets wierd artifacts. The standard sizes seem to work well though.

PLEASE test and let the mailing-list know of any problems you find. There will be a bit of anti-alias optimisation and such i'm sure.

-tmk

April 9, 2003

Merged in a patch which removes our dependancy on soundcore, and
also saves us having to allocate some memory. thanks to alex for
that one.

Unfortunately, you'll have to re-extract your firmware. The
firmware extraction utility has been updated also.

more coming soon.
-tmk

March 16,2003
Fixed a couple little things, added a nice ioctl program to utils/ (thanks alex!)
Moved FAQ to main site

April 02,2003
Oof. I had a rather large set of bugs in my audio switching code. Should be foxed now. Guess that's what i get for not testing it.

-tmk

March 31,2003
After a bit of a break, I'm back.

There's now audio an switching ioctl in the driver, supported both by test_ioctl.c and by the driver internally. It should automatically change the audio input when you set the video input. Oh, and it's untested :)

You'll also notice a few new files. We branched the msp (audio) driver into our codebase until we can get an update put in the mainstream msp driver. This means you'll need to load the local copy of the msp driver, not the one that's in the kernel tree. (you didn't need it at all before)

-tmk

March 15,2003

UPDATE: PAL switching may work now, if you setup the stream before capturing.

Multiple minors. IvyTV will now register 3 video devices on char-major 81:
(card-num)+0 is mpg
(card-num)+32 is mpg
(card-num)+224 is vbi

that means minors 0, 32 and 224 for all of us with just one card.

YUV and VBI streams don't work yet, so don't bother with those :)

Also hopefully very soon we'll have the ability to switch between NTSC and PAL via ioctl. The basics are in there now, i just have to connect all the piping, so to speak.

Please let me know about any stability issues you run into. A lot of code is changing, and i'm sure there are bugs. 

-tmk

March 14,2003
Multiple opens now supported

I haven't done too much testing, so feedback is appreciated. This is limited to mpg streams only for now, (only checks stream index 0), but you can change channels and do pretty much anything that doesn't requre a read() command without killing your capture. trying to read() should return -EBUSY. closing a non-capturing open won't hurt your capture like it used to.

So far i've tested it by changing channels while capturing. it works. and it's fast :)

i suppose it's feasable now to watch tv using the card and john's ptune.pl script like so:

mplayer -framedrop /dev/video0 

and while that's running, load up ptune and change channels. Smooth, eh? :)

-tmk


March 13,2003
Added some ioctls and cleaned up unloading. 

Biggest change is that there's now a .h file in utils for you to use if you want to directly call the firmware API stuff to set various things up. This is an expert interface only, not for use unless you are testing the driver.

-tmk

March 12,2003
More small updates. Switched ioctls over to fops style, made chann.c work with current cvs (warning, the source is ugly), a few other minor fixes.

v4l2 channel changing is tested and works.

-tmk

March 11,2003
Input selection, channel changing and standard selection (except secam) should be working, or close to it. If you feel like helping out, now would be a good time to get ready with your v4l2 ioctl programs. The various ENUM ioctls should show you what's currently supported. Test it and let me know how it goes. 

-tmk

March 10,2003 (was tagged as march 11 before, sorry)
Finally on the right track with v4l2.. IOCTLS are fleshing themselves out (sorry no v4l1 stuff yet) and in a couple days we should be ready to actually start changing channels and selecting inputs via v4l2. 

Also, a bunch of little bugfixes went in today, as well as increasing the number of buffers. Should be a full second of buffering now, +/- a bit due to varying frame size.

John and friends are hard at work figuring out what format the YUV is in, so hopefully soon we'll have an uncompressed stream available for the likes of xawtv.

There's just something cool about running "mplayer -framedrop /dev/video0" and getting more-or-less live TV :)

-tmk

March 8,2003

Initial v4l2 support. Right now, it's just a skeleton, but it'll get fleshed out pretty soon.

check your kernel log for which minor the card grabbed, and cat from /dev/video? instead of /dev/ivtv0 or whatever you named yours. We're still registering the /dev/ivtv0 chardev though, so use that if you like :)

Also, we've finally got some PAL saa7115 settings (thanks alex!)

To use them, you'll have to run an ioctl or patch the code manually. V4l2 standards setting coming soon.....

-tmk

March 4,2003
Bug fix in card detection type

March 2,2003
Added support for the iTVC16(encode only) chip, also some little bug fixes.

Put some logic in to hopefully close down the stream a little nicer.

-tmk

Feb 28,2003
Bunch of updates, current tasklist:

Requested
* DEVFS-Support would be nice to have, too.

Completed
* put 'warmstart' video stream init into read()
 - john seems to think there's no such thing
* move video stream init out of open()
 - it's now in read(), will soon cease to exist as we know it
* Remove first 4 bytes of stream (in some cases?)
 - thanks miguel
* After capture, unload/reload of driver usually results in no captures
 - john's updated init settings did the trick

New bugs
* saa7115 settings don't work on some systems (requires tasks "A" *and* "B" to work)

---Old/unfinished stuff since last update---
Features/todo
* Automatic tuner detection
* PAL/SECAM settings for saa7115 drv
* PAL/SECAM settings for ivtv drv
* v4l2 support
 - video settings (bright,contrast, etc) into saa7115
 - general v4l2 api implementation
* clean up capture init/termination
* break ivtv-driver.c out into 2 or 3 smaller files
* iTVC16 support
* pvr 350 output support


Feb 27,2003
Put in some ioctls for changing the channel, selecting input, etc.


Feb 27,2003 - Wow has it been 2 weeks?
After many hours of hacking at the saa7115, i've included a stripped-down
but functional (for NTSC at least) driver for the saa7115. Testers, please
tell me how it goes! I've barely tested it.. Please try the different
inputs (well, try them when i make ioctl's that can switch them ;)

Current known bugs
* driver doesn't capture (sometimes hangs) after unload/reload. I think
  it's due to not shutting the parts down properly. I'll look at that now.
* only captures on channel 4.. tuner support coming soon.. really!
* no PAL settings yet
* in linux mplayer, video is interlaced-looking, and audio not synced.
  Video plays fine in windows. <shrug>

How can you help?
* Write PAL support into the saa7115 driver. John or myself can
  provide a datasheet for you.
* If you are video saavy, look at the output video and find out why it
  looks interlaced/audio not synced.


Feb 12, 2003 - later that same evening
John posted his logs of the saa7115 init from the windows driver (thanks john!) and i did a quick import of them into the code.

So now NTSC folks can get a rough (but better than with 7114) capture! hurrah.

note that doc/capturing.txt is updated! read it

I'm tired of coding for tonight, so the saa7115 driver proper will have to wait until tomorrow.

Known bugs:
* driver doesn't capture (sometimes hangs) after unload/reload. Probably not freeing up rescources properly
* only captures on channel 4
* video isn't 100% clean
* no PAL settings yet

Feb 12, 2003 - evening
Found/Fixed one problem with the buffering. Still getting *some* data corruption, but it seems really minor. Looks like ocassionally the first byte of a transfer will get set to '0x00' .. it's not coming from the card either, from what I can tell.. very strange....

I'm going to go work on the SAA7115 driver now, since John was kind enough to post dumps.

-tmk

Feb 12, 2003
Sorry for the delay. I made some changes that blew up on me. Back on track now, and i've hacked around the saa7115 driver, sort of. You can capture, but the data is garbled. It's just a matter of register settings now.

doc/capturing.txt updated with instructions.

* Implemented a ringbuffer solution instead of simple read/write buffer
* Basic saa7115 support
* included saa7114 driver in distro. This will NOT be maintained. I'll most likely delete it when something better is available.
* some garbling still (even with my saa7115 driver)... That's next on the fix-it list.

-tmk

Feb 6, 2003 - part 2
* Audio stream more or less fixed (haven't tested mplayer, windows is happy)
* Overhauled firmware-upload process
* Wrote nicer extraction tool. Dummy-friendly! ;)
* Went to bed. Night!

Feb 6, 2003
* The card will now capture until you tell it to stop. It also now has no trouble
  running multiple captures (used to have to reboot)
* Datastream still has some errors in it, haven't looked into that yet
* Audio may or may not be a problem (windows plays it, but it's slowed down)
  mplayer doesn't play it at all. May be a bitrate err, may be a stream corruption
  error
* Fixed compiling on pre-3.2 gcc (i think.. someone test?)

--

Feb 5, 2003
Initial CVS upload. A few changes were made without testing, so it may not 
work too well. I wouldn't worry though.. It will be fixed :) It at least compiles...

Known problems:
* Captures between 0 and 7MB worth of mpeg before stopping, usually 128k.
* Once stopped, it wont capture any more until reboot.
* John mentioned that the datastream is still corrupted. Probably a bug
    in the copying to client part, though it could be anywhere
    in the process.
* Captures with audio don't play well in any players that I know of. 
   I think this is due to an incomplete data stream (big ones are rare)

If you want to help:
Email the developers, ask for something to do. We could use a couple of
testers also.

If you can't get ahold of us, here's the current laundrylist:
* sift through the code, looking for FIXME, and fix :)
* write/modify drivers for the saa7115 and/or msp34xx chips
* come up with a *good* method of firmware transfer and code it in
* look for things done wrong (there are many) and do them The Right Way(TM)

-tmk (nufan_wfk at yahoo.com)
