c - 使用 libdvdnav 时出现 libdvdcss 错误

标签 c

我有一个示例代码,它可以打开安装在/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/

相关文章:

objective-c - 随机 C/Objective-C 问题

c - 在不强制转换的情况下对 unsigned char * 使用字符串方法

c - 使用 libusb 输出不正确

c - 当你在 C 的结构中有一个数组时,最佳实践是什么?

c - 在线程安全和可重入代码中使用 utf8proc

objective-c - xcode 中的 strcpy

c - Sprintf 连接字符串

c - 如何用LLVM或其他工具标记基本 block 的边界?

c - 在 C 中获取当前事件的窗口标题

c - 如何删除 (POSIX) C 中的目录及其内容?