本文整理汇总了C++中FileSource::getLocalFilename方法的典型用法代码示例。如果您正苦于以下问题:C++ FileSource::getLocalFilename方法的具体用法?C++ FileSource::getLocalFilename怎么用?C++ FileSource::getLocalFilename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileSource
的用法示例。
在下文中一共展示了FileSource::getLocalFilename方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QString
WavFileReader::WavFileReader(FileSource source, bool fileUpdating) :
m_file(0),
m_source(source),
m_path(source.getLocalFilename()),
m_buffer(0),
m_bufsiz(0),
m_lastStart(0),
m_lastCount(0),
m_updating(fileUpdating)
{
m_frameCount = 0;
m_channelCount = 0;
m_sampleRate = 0;
m_fileInfo.format = 0;
m_fileInfo.frames = 0;
m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo);
if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) {
std::cerr << "WavFileReader::initialize: Failed to open file at \""
<< m_path << "\" ("
<< sf_strerror(m_file) << ")" << std::endl;
if (m_file) {
m_error = QString("Couldn't load audio file '%1':\n%2")
.arg(m_path).arg(sf_strerror(m_file));
} else {
m_error = QString("Failed to open audio file '%1'")
.arg(m_path);
}
return;
}
if (m_fileInfo.channels > 0) {
m_frameCount = m_fileInfo.frames;
m_channelCount = m_fileInfo.channels;
m_sampleRate = m_fileInfo.samplerate;
}
// std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl;
}
示例2: profiler
QuickTimeFileReader::QuickTimeFileReader(FileSource source,
DecodeMode decodeMode,
CacheMode mode,
size_t targetRate,
ProgressReporter *reporter) :
CodedAudioFileReader(mode, targetRate),
m_source(source),
m_path(source.getLocalFilename()),
m_d(new D),
m_reporter(reporter),
m_cancelled(false),
m_completion(0),
m_decodeThread(0)
{
m_channelCount = 0;
m_fileRate = 0;
Profiler profiler("QuickTimeFileReader::QuickTimeFileReader", true);
SVDEBUG << "QuickTimeFileReader: path is \"" << m_path << "\"" << endl;
long QTversion;
#ifdef WIN32
InitializeQTML(0); // FIXME should check QT version
#else
m_d->err = Gestalt(gestaltQuickTime,&QTversion);
if ((m_d->err != noErr) || (QTversion < 0x07000000)) {
m_error = QString("Failed to find compatible version of QuickTime (version 7 or above required)");
return;
}
#endif
EnterMovies();
Handle dataRef;
OSType dataRefType;
// CFStringRef URLString = CFStringCreateWithCString
// (0, m_path.toLocal8Bit().data(), 0);
QByteArray ba = m_path.toLocal8Bit();
CFURLRef url = CFURLCreateFromFileSystemRepresentation
(kCFAllocatorDefault,
(const UInt8 *)ba.data(),
(CFIndex)ba.length(),
false);
// m_d->err = QTNewDataReferenceFromURLCFString
m_d->err = QTNewDataReferenceFromCFURL
(url, 0, &dataRef, &dataRefType);
if (m_d->err) {
m_error = QString("Error creating data reference for QuickTime decoder: code %1").arg(m_d->err);
return;
}
short fileID = movieInDataForkResID;
short flags = 0;
m_d->err = NewMovieFromDataRef
(&m_d->movie, flags, &fileID, dataRef, dataRefType);
DisposeHandle(dataRef);
if (m_d->err) {
m_error = QString("Error creating new movie for QuickTime decoder: code %1").arg(m_d->err);
return;
}
Boolean isProtected = 0;
Track aTrack = GetMovieIndTrackType
(m_d->movie, 1, SoundMediaType,
movieTrackMediaType | movieTrackEnabledOnly);
if (aTrack) {
Media aMedia = GetTrackMedia(aTrack); // get the track media
if (aMedia) {
MediaHandler mh = GetMediaHandler(aMedia); // get the media handler we can query
if (mh) {
m_d->err = QTGetComponentProperty(mh,
kQTPropertyClass_DRM,
kQTDRMPropertyID_IsProtected,
sizeof(Boolean), &isProtected,nil);
} else {
m_d->err = 1;
}
} else {
m_d->err = 1;
}
} else {
m_d->err = 1;
}
if (m_d->err && m_d->err != kQTPropertyNotSupportedErr) {
m_error = QString("Error checking for DRM in QuickTime decoder: code %1").arg(m_d->err);
return;
} else if (!m_d->err && isProtected) {
m_error = QString("File is protected with DRM");
//.........这里部分代码省略.........