1
mirror of https://github.com/mpv-player/mpv synced 2024-11-11 00:15:33 +01:00
mpv/fibmap_mplayer.c
lgb 997c6f8f7b Return of the 'Old-style-DVD-support', with dynamic loading (using libdl) so
no more conflict with libdvdread: you can compile in both of libdvdread and
libcss support! You can even select libcss.so to load from command line or
configuration file, with '-csslib /usr/local/lib/libcss.so' or something
similar. Default for this option is /usr/local/lib/libcss.so. Note: libcss
version (ver>0.1) with newer API is not supported in this version! This is
the first version so stay tuned :)


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@3976 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-01-04 13:08:14 +00:00

39 lines
897 B
C

/* (C)2001,2002 by LGB (Gábor Lénárt), lgb@lgb.hu
Part of MPlayer project, this source is copyrighted according to GNU/GPL. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/stat.h>
#ifndef FIBMAP
#define FIBMAP 1
#endif
int main ( int argc , char ** argv )
{
int fd,lba=0;
if (argc!=2) {
fprintf(stderr,"Bad usage.\n");
return 1;
}
if ((fd = open(argv[1], O_RDONLY)) == -1) {
fprintf(stderr,"Cannot open file %s: %s\n",
argv[1] ? argv[1] : "(NULL)", strerror(errno));
return 1;
}
if (ioctl(fd, FIBMAP, &lba) != 0) {
fprintf(stderr,"fibmap ioctl: %s (Hint: %s is not suid root?)\n",strerror(errno),argv[0]);
close(fd);
return 1;
}
close(fd);
printf("%d\n",lba);
return 0;
}