我有一个示例代码,它可以打开安装在/mnt/iso 文件夹中的 DVD 并在屏幕上打印输出。 这是代码:
#include <stdio.h>
#include <dvdnav/dvdnav.h>
#include <dvdnav/dvdnav_events.h>
#include <sys/types.h>
#include <stdlib.h>
int main(int argc, char **argv) {
dvdnav_t *dvdnav;
int finished, len, event;
uint8_t buf[2050];
/* Open the DVD */
dvdnav_open(&dvdnav, "/mnt/iso");
fprintf(stderr, "Reading...\n");
finished = 0;
while (!finished) {
int result = dvdnav_get_next_block(dvdnav, buf, &event, &len);
if (result == DVDNAV_STATUS_ERR) {
fprintf(stderr, "Error getting next block (%s)\n",
dvdnav_err_to_string(dvdnav));
exit(1);
}
switch (event) {
case DVDNAV_BLOCK_OK:
/* Write output to stdout */
fwrite(buf, len, 1, stdout);
break;
case DVDNAV_STILL_FRAME:
fprintf(stderr, "Skipping still frame\n");
dvdnav_still_skip(dvdnav);
break;
case DVDNAV_STOP:
finished = 1;
break;
default:
fprintf(stderr, "Unhandled event (%i)\n", event);
finished = 1;
}
}
dvdnav_close(dvdnav);
return 0;
}
但是,当我尝试编译代码并运行它时,出现以下错误:
libdvdnav: Using dvdnav version 4.2.1
libdvdread: Attempting to use device /dev/loop1 mounted on /mnt/iso for CSS authentication
libdvdread: Could not open /dev/loop1 with libdvdcss.
libdvdread: Can't open /dev/loop1 for reading
libdvdread: Device /dev/loop1 inaccessible, CSS authentication not available.
libdvdnav: Can't read name block. Probably not a DVD-ROM device.
libdvdnav: Unable to find map file '/home/user/.dvdnav/.map'
libdvdnav: DVD disk reports itself with Region mask 0x00c00000. Regions: 1 2 3 4 5 6
Reading...
Unhandled event (9)
我不确定问题到底是什么,如果有人能指出问题就太好了。谢谢!
最佳答案
直接使用 ISO 文件而不是安装它对我来说很有效。 CSS 问题已解决并且可以正常工作。
关于c - 使用 libdvdnav 时出现 libdvdcss 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27473271/