decoder/flac: add method FLACMetadataChain::Scan()
Merge common code.
This commit is contained in:
parent
343de8b8ab
commit
3c2d73d161
@ -373,15 +373,7 @@ oggflac_scan_file(const char *file,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FLACMetadataIterator iterator(chain);
|
chain.Scan(handler, handler_ctx);
|
||||||
do {
|
|
||||||
FLAC__StreamMetadata *block = iterator.GetBlock();
|
|
||||||
if (block == nullptr)
|
|
||||||
break;
|
|
||||||
|
|
||||||
flac_scan_metadata(block, handler, handler_ctx);
|
|
||||||
} while (iterator.Next());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,7 +250,15 @@ flac_scan_file2(const char *file,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
FLACMetadataIterator iterator(chain);
|
chain.Scan(handler, handler_ctx);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
FLACMetadataChain::Scan(const struct tag_handler *handler, void *handler_ctx)
|
||||||
|
{
|
||||||
|
FLACMetadataIterator iterator(*this);
|
||||||
|
|
||||||
do {
|
do {
|
||||||
FLAC__StreamMetadata *block = iterator.GetBlock();
|
FLAC__StreamMetadata *block = iterator.GetBlock();
|
||||||
if (block == nullptr)
|
if (block == nullptr)
|
||||||
@ -258,6 +266,4 @@ flac_scan_file2(const char *file,
|
|||||||
|
|
||||||
flac_scan_metadata(block, handler, handler_ctx);
|
flac_scan_metadata(block, handler, handler_ctx);
|
||||||
} while (iterator.Next());
|
} while (iterator.Next());
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,8 @@ public:
|
|||||||
const char *GetStatusString() const {
|
const char *GetStatusString() const {
|
||||||
return FLAC__Metadata_ChainStatusString[GetStatus()];
|
return FLAC__Metadata_ChainStatusString[GetStatus()];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Scan(const struct tag_handler *handler, void *handler_ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
class FLACMetadataIterator {
|
class FLACMetadataIterator {
|
||||||
|
Loading…
Reference in New Issue
Block a user