Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ImportFileHandle *FLACImportPlugin::Open(wxString filename)
- {
- // First check if it really is a FLAC file
- int cnt;
- wxFile binaryFile;
- if (!binaryFile.Open(filename)) {
- return false; // File not found
- }
- #ifdef USE_LIBID3TAG
- // Skip any ID3 tags that might be present
- id3_byte_t query[ID3_TAG_QUERYSIZE];
- cnt = binaryFile.Read(query, sizeof(query));
- cnt = id3_tag_query(query, cnt);
- binaryFile.Seek(cnt);
- #endif
- char buf[5];
- cnt = binaryFile.Read(buf, 4);
- binaryFile.Close();
- if (cnt == wxInvalidOffset || strncmp(buf, FLAC_HEADER, 4) != 0) {
- // File is not a FLAC file
- return false;
- }
- // Open the file for import
- FLACImportFileHandle *handle = new FLACImportFileHandle(filename);
- bool success = handle->Init();
- if (!success) {
- delete handle;
- return NULL;
- }
- return handle;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement