ddr-1394 / project bs digital quick howto This should get you running with the current development version of ddr1394 software. If you read this and attempt to setup the environment described here, you must email timecop@pbx.mine.nu and report success or failure, providing your tuner model, firewire chipset used and other details. * required bits are in the tarball available for download from this site * required hardware: * Linux PC, 400Mhz+ * OHCI-compliant firewire card * BS-digital Hivision Tuner with firewire output port * BS-digital antenna Note on OHCI cards: TI-chipset cards are known to work (I've tried 3 of them). VIA-based cards may or may not work. Linux support for VIA / NEC chipsets is quite shitty. Better be using original TI chipset. To install, you need to install things in this order: libraw1394 (slightly modified, cvs version of libraw1394) (needs make install) libavc1394 (slightly modified, cvs version of libavc1394) (needs make install) ddr1394 (the main application) (just run it from the current directory while testing) If you have old copies of libavc/libraw you need to get rid of them. Better yet, build a new dedicated PC for testing this - don't run ddr1394 on your network router or file server. During recording the system should not be used. Also, it's probably better not to have X running during recording or debugging of this software. Build a headless PC and ssh in while hacking on ddr1394. If you eventually going to use this as part of your HDTV setup, you'll probably want a small low-profile machine to fit somewhere near your TV/HDTV tuner... Since these are CVS versions you need to run autogen.sh/bootstrap to create configure scripts. This needs kernel 2.4.22+, compiled with 1394 stuff as modules: 1394up script: #!/bin/sh insmod ieee1394 insmod raw1394 insmod ohci1394 1394dn script: #!/bin/sh rmmod ohci1394 rmmod raw1394 rmmod ieee1394 you need to compile ieee1394, raw1394, ohci1394 as modules. during development you'll need to reinsmod the modules many times so you can use these scripts to quickly load/remove 1394 modules. when you load the modules you should see something like this: ohci1394_0: OHCI-1394 1.0 (PCI): IRQ=[11] MMIO=[f400c000-f400c7ff] Max Packet=[2048] ieee1394: Node added: ID:BUS[0-00:1023] GUID[0050c90000020777] ieee1394: Host added: ID:BUS[0-01:1023] GUID[0001080000027fa1] one of the nodes would be your HDTV tuner. on removal and reinsert you see this: ieee1394: Node changed: 0-01:1023 -> 0-00:1023 ieee1394: Node removed: ID:BUS[0-00:1023] GUID[0050c90000020777] ohci1394_0: SelfID received, but NodeID invalid (probably new bus reset occurred): 0800FFC0 ieee1394: Node added: ID:BUS[0-00:1023] GUID[0050c90000020777] ieee1394: Node changed: 0-00:1023 -> 0-01:1023 In iec61883.cc, find function called MPEG1394Stream::findHDVR and modify it around lines 735: if (rom_dir.vendor_id == 0x000050c9 && rom_dir.model_id == 0x00000002) { printf("Found Tuner\n"); Replace the vendor and model ID's to the correct model for your tuner (use romtest utility from libavc1394 to show this information about your tuner). Same information is also in the connecting node ID (notice the text above). Of course, you are welcome to contribute an "automated" way of detecting this as well. once the modules are up, run ddr1394 with no command line arguments and watch the window. go to your HDTV tuner "DVHS" setup menu, and "add new I-link devices". It should show Linux-OHCI as the DVHS recorder, select that and follow whatever prompts on your tuner to activate it as master recording device. If your HDTV tuner doesn't detect any external DVHS devices, you need to watch the debug output for "unimplemented" commands and implement them following the specifications in AVC3.0.pdf or Tape_22.pdf available from this website. You should see some debug information start scrolling on the screen, such as command_handler: b2 : 00 (1f/07) : 70 command_handler: b2 : 00 (1f/07) : 70 command_handler: b2 : 00 (1f/07) : 70 (that means the unit is requesting power on of the DVHS deck) For explanation of each command hex code, look in the headers for libavc1394 and reference them with the command/status names mentioned in AVC30.pdf If you needed to implement any new commands, do so, and try until your tuner can detect the linux machine as dvhs device. After that, tune into BS1, BS2 or WOWOW non-scramble while its transmitting non-hdtv content, and press "temporary record" button. You should see some screens similar to what shown in screenshots. Press record, and you should start geting a file that looks like "2003-08-10:10:10:30" in the same directory where ddr1394 is running. If the file size is 0, that means the software fucked up. What works for me, is usually removing firewire cable, plugging it back in. Sometimes that makes it work. This has something to do with ISO channels not properly opening. Also one of the things that needs to be fixed. If the file size IS 0, you won't be able to Ctrl+C ddr1394 application. In this case, use kill, or Ctrl+\ to terminate it. This will leave polluted ROM leafs on the bus, which means you better do 1394dn/1394up combo to reload the modules and clear the node rom. Then you can insert/remove the 1394 cable a few times and try again until it works. If the recording start was successful, you should see the file increase about 1 meg/second in size. That means its recording! If it doesn't increase, you can try fucking around with iPCR settings in plug.cc, specifically the iso channel number (32 is what my tuner uses, yours could use whatever), or trying to read the specs and figuring out what went wrong elsewhere. some of the possible debug output you may see: command_handler: da : 01 (04/00) : 7f command_handler: b2 : 01 (1f/07) : 7f command_handler: d0 : 01 (04/00) : 7f command_handler: da : 01 (04/00) : 7f ^ during recording after request to stop recording libplug1394 debug: request type=1 tcode=4 length=4 libplug1394 debug: context = libplug1394 input context libplug1394 debug: destination_offset=4 libplug1394 debug: response: 0xFFC00060 libplug1394 debug: 0xFFC10000 libplug1394 debug: 0x00000000 libplug1394 debug: 0x00002081 command_handler: d0 : 01 (04/00) : 7f libplug1394 debug: request type=4 tcode=9 length=4 libplug1394 debug: context = libplug1394 input context libplug1394 debug: response: 0xFFC000B0 libplug1394 debug: 0xFFC10000 libplug1394 debug: 0x00000000 libplug1394 debug: 0x00040002 libplug1394 debug: 0x00002081 after recording finished command_handler: da : 01 (04/00) : 7f command_handler: b2 : 00 (1f/07) : 60 IEC61883Stream::stop - Stopped Stream Decrementing output connections count command_handler: b2 : 00 (1f/07) : 60 command_handler: b2 : 00 (1f/07) : 60 Do whatever is necessary on your HDTV tuner to stop recording (usually press power button, or a button on remote). Now you have some megabytes size file called "2003-08-10:10:10:30" or something similar. This is the normal unmodified mpeg2ts stream, ready for whatever you want to do with it. In Linux, you can use mplayer or vlc to playback the contents. I was not able to get AAC audio working out of these streams in either mplayer or vlc. Your mileage may vary (I used windows versions, too not Linux so who knows). If you wanted to cut out commercials/re-encode the huge .ts file into something else, you best copy it to a Windows PC and use TSDemux utility linked from the main page of this project to demux the stream into MPEG2 and AAC audio. Now you are done and can do whatever you want with the resulting mpeg2 elementary video stream and aac audio stream. If you want other data that was in the mpeg2ts stream, such as subtitles or BML? whatever the fuck that is, data, go find some utility that displays contents of mpeg2ts streams and allows you to save arbitrary streams. I am not interested in that, not much anyway. WHEN THINGS GO WRONG This is work in progress, of course. Its not expected to work. Infact, I dont expect it to work for anyone except me. If it doesnt work for you, and you have programming skills (if you got this far, I assume you do), please!!! Read the specifications mentioned in the main page, and see if you can fix / correct / add functionality that is required. If you do anything with the source, please!!! contact me with patches/changes/stories of success/failure/whatever. If you are interested in working on this project, have the required equipment and programming skills please contact me! timecop at pbx dot mine dot nu All the credit for writing AV/C target code as well as entire ddr1394 application goes to Dan Dennedy, however in my last e-mail correspondence to him he clearly stated he has no time or hardware to continue working on this project.