25 #include <sys/types.h> 42 m_path(source.getLocalFilename()),
46 m_commentsRead(false),
56 Profiler profiler(
"OggVorbisFileReader::OggVorbisFileReader",
true);
61 if (!(
m_oggz = oggz_open(
m_path.toLocal8Bit().data(), OGGZ_READ))) {
67 m_fishSound = fish_sound_new(FISH_SOUND_DECODE, &fsinfo);
77 (tr(
"Decoding %1...").arg(QFileInfo(
m_path).fileName()));
80 while (oggz_read(
m_oggz, 1024) > 0);
94 while (oggz_read(
m_oggz, 1024) > 0 &&
147 fish_sound_prepare_truncation(fs, packet->granulepos, packet->e_o_s);
148 fish_sound_decode(fs, packet->packet, packet->bytes);
175 const FishSoundComment *comment;
176 comment = fish_sound_comment_first_byname(fs,
"TITLE");
177 if (comment && comment->value) {
178 reader->
m_title = QString::fromUtf8(comment->value);
180 comment = fish_sound_comment_first_byname(fs,
"ARTIST");
181 if (comment && comment->value) {
182 reader->
m_maker = QString::fromUtf8(comment->value);
184 comment = fish_sound_comment_first(fs);
186 reader->
m_tags[QString::fromUtf8(comment->name).toUpper()] =
187 QString::fromUtf8(comment->value);
188 comment = fish_sound_comment_next(fs, comment);
194 FishSoundInfo fsinfo;
195 fish_sound_command(fs, FISH_SOUND_GET_INFO,
196 &fsinfo,
sizeof(FishSoundInfo));
213 extensions.insert(
"ogg");
214 extensions.insert(
"oga");
220 std::set<QString> extensions;
222 return (extensions.find(extension.toLower()) != extensions.end());
228 return (type ==
"application/ogg");
QString getExtension() const
Return the file extension for this file, if any.
OggVorbisFileReader(FileSource source, DecodeMode decodeMode, CacheMode cacheMode, int targetRate=0, bool normalised=false, ProgressReporter *reporter=0)
static void getSupportedExtensions(std::set< QString > &extensions)
DecodeThread * m_decodeThread
void addSamplesToDecodeCache(float **samples, int nframes)
virtual ~OggVorbisFileReader()
static int readPacket(OGGZ *, ogg_packet *, long, void *)
OggVorbisFileReader * m_reader
FileSource is a class used to refer to the contents of a file that may be either local or at a remote...
virtual void setProgress(int percentage)=0
static bool supportsContentType(QString type)
bool isDecodeCacheInitialised() const
void initialiseDecodeCache()
QString getContentType() const
Return the MIME content type of this file, if known.
virtual void setMessage(QString text)=0
void startSerialised(QString id)
static int acceptFrames(FishSound *, float **, long, void *)
ProgressReporter * m_reporter
static bool supports(FileSource &source)
static bool supportsExtension(QString ext)
Profile point instance class.