USB DVD Device Support
Home › Forums › Development › USB DVD Device Support
- This topic is empty.
-
AuthorPosts
-
January 26, 2011 at 1:05 pm #23376AnonymousInactive
I’m continuing here a thread opened at (more or less): http://www.wiimc.org/forum/viewtopic.php?f=4&t=1033&start=140#p4829. I think that the Development area is more appropriate for this topic.
@rodries wrote:
@clava wrote:
I tried to patch libdvdcss/device.c, redirecting disk I/O through libc_open, libc_seek, … functions (in place of di_* functions). Unfortunately, it does not seem to work. Any advice?
You are in the rigth way
A quick update. I currently have got a custom version of WiiMC able to mount a usb devices as iso9660 (besides fat, ntfs and ext). It’s still a bit instable, but it is already able to browse the DVD folders and play the vob files.
Basically, I extended the mount function of the iso9660 ogc module to take the mount point and the disk interface as parameters. In this way, it is possible to browse the device as a usual “usb1:/” media. I changed fileop.cpp accordingly for supporting iso9660 in addiction to the other filesystem types (I’m using the auto-detection function IsDvdUSB() for selecting the iso fyle system). Moreover I replaced the USBStorage_Deinitialize() with a more usual device->shoutdown() call.
I still have an issue in opening the VIDEO_TS folder as a DVD device (device=usb1:/VIDEO_TS, file=dvd://). I think the answer is still around libdvdread4, libdvdcss & libdvdnav… Unfortunatley I’ve not so much time for wiimc development… but the USB DVD support is not so far!
January 26, 2011 at 1:43 pm #28293aka107Participantok
I have a problem here, I haven’t a dvd-usb so I can’t test anything
If you have a problem the only way I can help you is asking me a specific question and pasting the codeIn dvd_reader.c
#ifdef GEKKO
if (!strcmp(path, "/dev/di")) {
ret_val = DVDOpenImageFile( path, have_css );
free(path);
return ret_val;
}
#endif
I think you have a problem here, I don’t know how to handle it without testing
static int di_open ( dvdcss_t, char const * );
static int di_seek ( dvdcss_t, int );
static int di_read ( dvdcss_t, void *, int );
static int di_readv ( dvdcss_t, struct iovec *, int );You have to redo this functions to use the usb device (libdvdcss/device.c)
January 26, 2011 at 4:44 pm #28294AnonymousInactiveHi Rodries,
Thanks for your quick answer!
I’m investigating the possibility of storing a UDF/ISO file system on a memory key, dumping a .iso image through the linux dd utility. Ubuntu is able to mount it correctly; this evening (Italian time) I’ll check on the Wii. This would simplify the debugging, for me too, enabing you to test the code. If this works, I can share my patched source code.
About your suggestions about di_* functions I’m a bit puzzled by the fact that now I’m playing a “regular” file, through “usb1:/” device (by means of iso9660 devops, of course). What’s the difference with respect to play a .ifo file from a fat or ntfs filesystem (at least from the dvdlib point of view)? Surely I’m missing someting! As soon as possible I’ll try to study the dvd stream implementation a bit more in detail.
January 26, 2011 at 5:25 pm #28295aka107Participant@clava wrote:
Hi Rodries,
Thanks for your quick answer!
I’m investigating the possibility of storing a UDF/ISO file system on a memory key, dumping a .iso image through the linux dd utility. Ubuntu is able to mount it correctly; this evening (Italian time) I’ll check on the Wii. This would simplify the debugging, for me too, enabing you to test the code. If this works, I can share my patched source code.
About your suggestions about di_* functions I’m a bit puzzled by the fact that now I’m playing a “regular” file, through “usb1:/” device (by means of iso9660 devops, of course). What’s the difference with respect to play a .ifo file from a fat or ntfs filesystem (at least from the dvdlib point of view)? Surely I’m missing someting! As soon as possible I’ll try to study the dvd stream implementation a bit more in detail.
di_* changes will allow to play a video dvd, using dvdnav and dvd:// instead use usb-dvd as a dvd data
January 27, 2011 at 11:45 pm #28296AnonymousInactiveHi Rodries & Tantric
Attached the code for iso9660 filesystem support on USB devices.
It allows mounting external USB DVD drives as data devices. It works for playing vob files from not encrypted DVDs. It still doesn’t work when opening .ifo files (equivalent to the mplayer command: “mplayer dvd:// –dvd-device usb1:/VIDEO_TS”).
Tested on a HP external USB DVD Drive.@Rodries
I was able to store a DVD iso image on a memory key with the dd command, but unfortunately it works only when I mount it in Linux.January 29, 2011 at 9:38 am #28297AnonymousInactiveFixed too early free in ISO9660_Unmount() and added “:” to device name when calling RemoveDevice.
January 29, 2011 at 12:08 pm #28298aka107ParticipantThks clava
Your code seems pretty gooddi_* changes will allow to play a video dvd, using dvdnav and dvd:// instead use usb-dvd as a dvd data
What I mean is if you patch di_* functions mplayer will use the usbdvd device as the internal wii dvd, mplayer will handle the usbdevice as a dvd not as a usbstorage unit
Maybe instead pacth di_* funcs you can try to patch di.c in libogc so it will be more generic but I haven’t think about it too much.January 29, 2011 at 3:04 pm #28292AnonymousInactiveI think there are 2 possibilities for external USB DVD drive support:
1) patch the di_* functions (or di.c), so that mplayer handles the usbdevice as the internal wii dvd.
2) support the external USB DVD device as a usbstorage unit.Probably it would be nice to implement them both. However, my development was in the second direction.
The advantage of “my” solution are:
– udf/iso9660 filesystem support added to WiiMC
– data DVD browsing as a usual usbstorage
– video DVD playback selecting the .ifo file (mplayer file mode “mplayer dvd:// –dvd-device usb1:/VIDEO_TS”).
– easier and safer… in other words, I’m not sure I have the skills for implementing “your” first solution!!!About video DVD playback selecting .ifo file, it works fine on DVD structures copied on a normal usbstorage (even on encrypted DVDs).
Unfortunately it doesn’t work when the usb device is the DVD drive and I really don’t know why. I tested the open/close/seek/read functions used libdvdread4/dvd_input.c and they works. I seek for undersized buffers, but I didn’t find anything. Simply when I play dvd files as dvd:// the dvd motor starts and I got a “file non found” error. If I try to use dvdnav://, wiimc freezes. I see no problem from the conceptual point of view, but it doesn’t work!
I’ve no special hw for debugging, and it not easy to debug a sw by message boxes… so any suggestions are really welcome.
January 29, 2011 at 5:29 pm #28299rodriesKeymasterMy suggestion is to re-read what rodries wrote. He already answered this:
di_* changes will allow to play a video dvd, using dvdnav and dvd://
January 29, 2011 at 7:57 pm #28300AnonymousInactiveHi Tantric,
I may be wrong, but I think that the Rodries suggestion is for handling the usb dvd device as it was the internal wii dvd:
@rodries wrote:What I mean is if you patch di_* functions mplayer will use the usbdvd device as the internal wii dvd, mplayer will handle the usbdevice as a dvd not as a usbstorage unit
What I trying to do, instead, is to have the usb dvd handled as a normal fat, nfts or ext usb storage, playing dvd as plain files (not as /dev/di device) through the canonical open/read/seek systemcalls. With the wiimc patched code I’m able to play media from dvds without problems (e.g. yesterday night I played a dvd as vob files).
As far as I know there is no custom code in dvdreader for dealing with filesystem types, so the iso9660 should be supported by default (when mountd ad usb1:/). Unfortunately, in practice, it doesn’t work.In the next day I could study the Rodries’ solution, but I’m still a bit puzzled by the fact that the plain file solution doesn’t work.
January 31, 2011 at 10:14 pm #28301AnonymousInactiveI did some more testing about playing media from my external USB DVD. I often have problem opening the last entry of a folder (e.g. the last vob of a video DVD or the last movie of a data DVD containing avi files). Could someone check if this happens with the internal wii DVD too (browsed as a data disk)? I cannot try by myself because of the D3-2 drive…
If so, it may indicate a problem in the iso9660 module. The same issue could be the reason of the failure in playing most of the dvd through mplayer/libdvd* (btw, I succeeded in playing one of them through libdvd*, so the plain file approach seems feasible).
February 1, 2011 at 3:13 pm #28302aka107Participant@clava wrote:
I did some more testing about playing media from my external USB DVD. I often have problem opening the last entry of a folder (e.g. the last vob of a video DVD or the last movie of a data DVD containing avi files). Could someone check if this happens with the internal wii DVD too (browsed as a data disk)? I cannot try by myself because of the D3-2 drive…
If so, it may indicate a problem in the iso9660 module. The same issue could be the reason of the failure in playing most of the dvd through mplayer/libdvd* (btw, I succeeded in playing one of them through libdvd*, so the plain file approach seems feasible).
I have bad reports loading srt files from iso9660, maybe there is something wrong.
Do you have an usbgecko?February 1, 2011 at 5:01 pm #28303AnonymousInactiveNo, I haven’t a usbgecko.
What I have in mind is to write a log to the sd, tracing calls, params and retval of the iso9660 APIs.
From code inspection and tests with an external main I didn’t find any problems.February 2, 2011 at 6:37 pm #28307AnonymousInactiveA quick update.
The following is the log of a working avi, during wiimc playback (video1.avi):
...
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80dc1468 path usb1:/video1.ifo flag: 0 mode: 438
_ISO9660_open_r(): retval: -1 (NOENT)
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80dc1468 path usb1:/video1.idx flag: 0 mode: 438
_ISO9660_open_r(): retval: -1 (NOENT)
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80dc3470 path usb1:/video1.avi flag: 0 mode: 438
_ISO9660_open_r(): retval: 0x80dc3470
_ISO9660_seek_r() - r: 0x80d1e4c8 fd: 0x80dc3470 dir: 2 pos: 0
_ISO9660_seek_r(): retval: 694792192
_ISO9660_seek_r() - r: 0x80d1e4c8 fd: 0x80dc3470 dir: 0 pos: 0
_ISO9660_seek_r(): retval: 0
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90012000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90022000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90032000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90042000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3470 dir: 0 pos: 690970624
_ISO9660_seek_r(): retval: 690970624
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90012000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3470 ptr: 0x90022000 len: 65536
...
…and this is the log of a not working avi (video2.avi, the last entry in the directory listing):
...
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80f081c8 path usb1:/video2.ifo flag: 0 mode: 438
_ISO9660_open_r(): retval: -1 (NOENT)
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80f081c8 path usb1:/video2.idx flag: 0 mode: 438
_ISO9660_open_r(): retval: -1 (NOENT)
_ISO9660_open_r() - r: 0x80d1e4c8 fd: fileStruct: 0x80dc3410 path usb1:/video2.avi flag: 0 mode: 438
_ISO9660_open_r(): retval: 0x80dc3410
_ISO9660_seek_r() - r: 0x80d1e4c8 fd: 0x80dc3410 dir: 2 pos: 0
_ISO9660_seek_r(): retval: 704012712
_ISO9660_seek_r() - r: 0x80d1e4c8 fd: 0x80dc3410 dir: 0 pos: 0
_ISO9660_seek_r(): retval: 0
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90012000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90022000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90032000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90042000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3410 dir: 0 pos: 699340800
_ISO9660_seek_r(): retval: 699340800
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3410 dir: 0 pos: -1411414016
_ISO9660_seek_r(): retval: -1 (EOVERFLOW)
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90012000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3410 dir: 0 pos: 565235712
_ISO9660_seek_r(): retval: 565235712
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3410 dir: 0 pos: 1814685696
_ISO9660_seek_r(): retval: -1 (EINVAL,pos)
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90002000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_read_r() - r: 0x80d1aad8 fd: 0x80dc3410 ptr: 0x90012000 len: 65536
_ISO9660_read_r(): retval: 65536
_ISO9660_seek_r() - r: 0x80d1aad8 fd: 0x80dc3410 dir: 0 pos: 862134272
_ISO9660_seek_r(): retval: -1 (EINVAL,pos)
...
The log of video2.avi contains several out-of-range fseek. The same media plays correctly when copied on an external ntfs usb disk.
Now I have to check if the problem is in the DIR_ENTRY sector field (addressing a wrong disk block), or in wrong data read by readSectors().
February 2, 2011 at 7:52 pm #28308rodriesKeymasterExcellent, so what you may have found is a type issue in the iso9660 implementation. check the types for the definitions of fseek, fread, etc and compare to a working devoptab (eg: tinysmb) to make sure they are correct: eg: size_t instead of u32 or int.
-
AuthorPosts
- You must be logged in to reply to this topic.