Quantcast
Channel: Adobe Community: Message List - XMP SDK
Viewing all articles
Browse latest Browse all 801

"XMPFiles::GetXMP - No open file" on random files, on random occasions.

$
0
0

Hi!

 

When reading XMP data from files, the toolkit sometimes fails to open the file and I am not quite sure how to approach the problem. My method:

 

QStringXmpParser::getXmpContent(QStringfilePath)

{
    try{
        SXMPMeta::Initialize();
        SXMPFiles::Initialize();

        XMP_VersionInfocoreVersion;
        SXMPMeta::GetVersionInfo(&coreVersion);

        std::stringxmpContent;
        XMP_OptionBitsopts=kXMPFiles_OpenForRead|kXMPFiles_OpenUsePacketScanning;
        XMP_StringPtrfilenamePtr=(XMP_StringPtr)filePath.toUtf8();

        SXMPFilesmyfile;
        if(!myfile.Initialize(opts)){
            qDebug()<<"FailedtoinitializeSXMPFile.";
        }
        if(!myfile.OpenFile(filenamePtr,kXMP_UnknownFile,opts)){
            qDebug()<<"FailedtoopenSXMPFilefor"<<filePath;
        }
        if(!myfile.GetXMP(NULL,&xmpContent)){
            qDebug()<<"NoXMPdatainfile"<<filePath;
        }

        SXMPFiles::Terminate();
        SXMPMeta::Terminate();

        returnQString::fromUtf8(xmpContent.c_str());
    }catch(XMP_Error&e){
        qDebug()<<"Exception:"<<e.GetErrMsg();
        return"";
    }
}

 

I often get the output:

 

Failed to open SXMPFile for  "(...)52x61.jpg"

Exception:  XMPFiles::GetXMP - No open file


Oddly, rescanning the file may solve the problem - so I am not sure where there is a problem in the first place. Are there any alterations for the code I should try?

 

Greetings,

smon


Viewing all articles
Browse latest Browse all 801

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>