Пример #1
0
int main(int argc, const char *argv[])
{
    udfread *udf;
    UDFFILE *fp;

    if (argc < 3) {
        fprintf(stderr, "usage: udfcat <image> <file>\n"
                "    image   path to UDF filesystem image (raw device or image file)\n"
                "    file    path to file inside UDF filesystem\n");
        return -1;
    }

    udf = udfread_init();
    if (!udf) {
        fprintf(stderr, "udfread_init() failed\n");
        return -1;
    }
    if (udfread_open(udf, argv[1]) < 0) {
        fprintf(stderr, "udfread_open(%s) failed\n", argv[1]);
        udfread_close(udf);
        return -1;
    }

    fp = udfread_file_open(udf, argv[2]);
    if (!fp) {
        fprintf(stderr, "udfread_file_open(%s) failed\n", argv[2]);
        udfread_close(udf);
        return -1;
    }

    _cat(fp);

    udfread_file_close(fp);
    udfread_close(udf);
}
Пример #2
0
MythCDROM::ImageType MythCDROM::inspectImage(const QString &path)
{
    ImageType imageType = kUnknown;

    if (path.startsWith("bd:"))
        imageType = kBluray;
    else if (path.startsWith("dvd:"))
        imageType = kDVD;
    else
    {
        blockInput_t blockInput;

        blockInput.file = new RemoteFile(path);
        blockInput.input.close = _def_close;
        blockInput.input.read = _def_read;
        blockInput.input.size = _def_size;

        if (blockInput.file->isOpen())
        {
            udfread *udf = udfread_init();
            if (udfread_open_input(udf, &blockInput.input) == 0)
            {
                UDFDIR *dir = udfread_opendir(udf, "/BDMV");

                if (dir)
                {
                    LOG(VB_MEDIA, LOG_INFO, QString("Found Bluray at %1").arg(path));
                    imageType = kBluray;
                }
                else
                {
                    dir = udfread_opendir(udf, "/VIDEO_TS");

                    if (dir)
                    {
                        LOG(VB_MEDIA, LOG_INFO, QString("Found DVD at %1").arg(path));
                        imageType = kDVD;
                    }
                    else
                    {
                        LOG(VB_MEDIA, LOG_ERR, QString("inspectImage - unknown"));
                    }
                }

                if (dir)
                {
                    udfread_closedir(dir);
                }

                udfread_close(udf);
            }
        }
        else
        {
            LOG(VB_MEDIA, LOG_ERR, QString("inspectImage - unable to open \"%1\"").arg(path));
            delete blockInput.file;
        }
    }

    return imageType;
}