
Content-Type: text/plain; charset=iso-8859-1
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sun, May 20, 2001 at 12:29:28AM +0200, St=E9phane Borel wrote:
> On Sat, May 19, 2001 at 11:15:45PM +0200, German Tischler wrote:
> > Recent development versions of vlc don't seem to be able to handle
> > dvd input on FreeBSD at all, at least I get the messages
> >=20
> > dvd error: can't find sector
> > dvd error: can't find next cell
>=20
> It seems that I have broken something: I'll try to find out what
> happened. It would be usefull if you could tell me when the breakage
> occured.

I wouldn't say vlc is broken here, it's more like FreeBSD is broken.
FreeBSD cannot handle accesses to the device that don't access it at
a sector boundary right now (sector boundary !=3D block boundary).
I have attached a patch that makes it work for me. I don't know if
it is the right way to fix the problem, but it works.
When an unaligned access should happen, the patch reades the two
sectors that could be involved and then copies out the relevant parts.
I put it in ifdef so it shouldn't hurt performance on other platforms.

Btw. I have only tested this with non-encrypted DVDs as I don't have
any encrypted at hand.

--gt


-- Attached file included as plaintext by Listar --

*** plugins/dvd/dvd_ifo.c	Sun May 20 17:38:10 2001
--- plugins/dvd/dvd_ifo.c.orig	Sat May 19 12:34:14 2001
***************
*** 67,109 ****
  static __inline__ u8* FillBuffer( ifo_t* p_ifo, u8* pi_buffer, off_t i_pos )
  {
      memset( pi_buffer, 0, DVD_LB_SIZE );
!     
!     #if defined(__FreeBSD__)
!     if ( i_pos % 2048 )
!     {
!       off_t newpos1 = i_pos - (i_pos % DVD_LB_SIZE);
!       off_t newpos2 = newpos1 + DVD_LB_SIZE;
!       off_t relpos1 = i_pos % DVD_LB_SIZE;
!       off_t relpos2 = DVD_LB_SIZE - (DVD_LB_SIZE-relpos1);
!       unsigned char * tmem1 = malloc(2*DVD_LB_SIZE);
!       unsigned char * tmem2 = tmem1+DVD_LB_SIZE;
! 
!       intf_WarnMsg( 1, "Warning: position is not a multiple of 2048!");
!       
!       if ( ! tmem1 )
!       {
!       	p_ifo->i_pos = -1;
!       	free(tmem1);
!       	return pi_buffer;
!       }
!       
!       lseek(p_ifo->i_fd, newpos1, SEEK_SET);
!       read(p_ifo->i_fd, tmem1, DVD_LB_SIZE);
!       lseek(p_ifo->i_fd, newpos2, SEEK_SET);
!       read(p_ifo->i_fd, tmem2, DVD_LB_SIZE);
!       
!       memcpy(pi_buffer, tmem1+relpos1, (DVD_LB_SIZE-relpos1));
!       memcpy(pi_buffer+(DVD_LB_SIZE-relpos1), tmem2, relpos2);
!       
!       p_ifo->i_pos = i_pos;
!       free(tmem1);
!     }
!     else
!     #endif
!     {
!       p_ifo->i_pos = lseek( p_ifo->i_fd, i_pos, SEEK_SET );
!       read( p_ifo->i_fd, pi_buffer, DVD_LB_SIZE );
!     }
  
      return pi_buffer;
  }
--- 67,74 ----
  static __inline__ u8* FillBuffer( ifo_t* p_ifo, u8* pi_buffer, off_t i_pos )
  {
      memset( pi_buffer, 0, DVD_LB_SIZE );
!     p_ifo->i_pos = lseek( p_ifo->i_fd, i_pos, SEEK_SET );
!     read( p_ifo->i_fd, pi_buffer, DVD_LB_SIZE );
  
      return pi_buffer;
  }


-- Attached file included as plaintext by Listar --

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: ssAfd/3hCGCID8KDj1+ndvH7S6KXbnpB

[payload removed: 376 characters in 6 lines]
=RrIn
-----END PGP SIGNATURE-----



