properties(0),
flacStart(0),
streamStart(0),
- streamLength(0),
scanned(false),
hasXiphComment(false),
hasID3v2(false),
TagUnion tag;
Properties *properties;
- ByteVector streamInfoData;
ByteVector xiphCommentData;
List<MetadataBlock *> blocks;
long flacStart;
long streamStart;
- long streamLength;
bool scanned;
bool hasXiphComment;
return d->properties;
}
-
bool FLAC::File::save()
{
if(readOnly()) {
d->ID3v2FrameFactory = factory;
}
-
////////////////////////////////////////////////////////////////////////////////
// private members
////////////////////////////////////////////////////////////////////////////////
return;
if(d->hasXiphComment)
- d->tag.set(FlacXiphIndex, new Ogg::XiphComment(xiphCommentData()));
+ d->tag.set(FlacXiphIndex, new Ogg::XiphComment(d->xiphCommentData));
else
d->tag.set(FlacXiphIndex, new Ogg::XiphComment);
- if(readProperties)
- d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle);
-}
+ if(readProperties) {
-ByteVector FLAC::File::streamInfoData()
-{
- return isValid() ? d->streamInfoData : ByteVector();
+ // First block should be the stream_info metadata
+
+ const ByteVector infoData = d->blocks.front()->render();
+
+ long streamLength;
+
+ if(d->hasID3v1)
+ streamLength = d->ID3v1Location - d->streamStart;
+ else
+ streamLength = File::length() - d->streamStart;
+
+ d->properties = new Properties(infoData, streamLength, propertiesStyle);
+ }
}
-ByteVector FLAC::File::xiphCommentData() const
+ByteVector FLAC::File::streamInfoData()
{
- return (isValid() && d->hasXiphComment) ? d->xiphCommentData : ByteVector();
+ return ByteVector();
}
long FLAC::File::streamLength()
{
- return d->streamLength;
+ return 0;
}
void FLAC::File::scan()
return;
}
- d->streamInfoData = readBlock(length);
- d->blocks.append(new UnknownMetadataBlock(blockType, d->streamInfoData));
+ d->blocks.append(new UnknownMetadataBlock(blockType, readBlock(length)));
nextBlockOffset += length + 4;
// Search through the remaining metadata
// End of metadata, now comes the datastream
d->streamStart = nextBlockOffset;
- d->streamLength = File::length() - d->streamStart;
-
- if(d->hasID3v1)
- d->streamLength -= 128;
d->scanned = true;
}
* Returns the block of data used by FLAC::Properties for parsing the
* stream properties.
*
- * \deprecated This method will not be public in a future release.
+ * \deprecated Always returns an empty vector.
*/
ByteVector streamInfoData(); // BIC: remove
* Returns the length of the audio-stream, used by FLAC::Properties for
* calculating the bitrate.
*
- * \deprecated This method will not be public in a future release.
+ * \deprecated Always returns zero.
*/
long streamLength(); // BIC: remove
void scan();
long findID3v2();
long findID3v1();
- ByteVector xiphCommentData() const;
class FilePrivate;
FilePrivate *d;