Example #1
0
int udfread_open(udfread *udf, const char *path)
{
    udfread_block_input *input;
    int result;

    input = block_input_new(path);
    if (!input) {
        return -1;
    }

    result = udfread_open_input(udf, input);
    if (result < 0) {
        input->close(input);
    }

    return result;
}
Example #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;
}