decoder/sndfile: implement scan_stream() instead of scan_file()
This commit is contained in:
parent
eaa9a1e33b
commit
c4bea3dfe4
1
NEWS
1
NEWS
|
@ -33,6 +33,7 @@ ver 0.19 (not yet released)
|
||||||
- vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
|
- vorbis, flac, opus: honor DESCRIPTION= tag in Xiph-based files as a comment to the song
|
||||||
- audiofile: support scanning remote files
|
- audiofile: support scanning remote files
|
||||||
- audiofile: log libaudiofile errors
|
- audiofile: log libaudiofile errors
|
||||||
|
- sndfile: support scanning remote files
|
||||||
- sndfile: support tags "comment", "album", "track", "genre"
|
- sndfile: support tags "comment", "album", "track", "genre"
|
||||||
* encoder:
|
* encoder:
|
||||||
- shine: new encoder plugin
|
- shine: new encoder plugin
|
||||||
|
|
|
@ -234,21 +234,22 @@ static constexpr struct {
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
sndfile_scan_file(Path path_fs,
|
sndfile_scan_stream(InputStream &is,
|
||||||
const struct tag_handler *handler, void *handler_ctx)
|
const struct tag_handler *handler, void *handler_ctx)
|
||||||
{
|
{
|
||||||
SF_INFO info;
|
SF_INFO info;
|
||||||
|
|
||||||
info.format = 0;
|
info.format = 0;
|
||||||
|
|
||||||
SNDFILE *const sf = sf_open(path_fs.c_str(), SFM_READ, &info);
|
SndfileInputStream sis{nullptr, is};
|
||||||
|
SNDFILE *const sf = sf_open_virtual(&vio, SFM_READ, &info, &sis);
|
||||||
if (sf == nullptr)
|
if (sf == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!audio_valid_sample_rate(info.samplerate)) {
|
if (!audio_valid_sample_rate(info.samplerate)) {
|
||||||
sf_close(sf);
|
sf_close(sf);
|
||||||
FormatWarning(sndfile_domain,
|
FormatWarning(sndfile_domain,
|
||||||
"Invalid sample rate in %s", path_fs.c_str());
|
"Invalid sample rate in %s", is.GetURI());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,8 +300,8 @@ const struct DecoderPlugin sndfile_decoder_plugin = {
|
||||||
nullptr,
|
nullptr,
|
||||||
sndfile_stream_decode,
|
sndfile_stream_decode,
|
||||||
nullptr,
|
nullptr,
|
||||||
sndfile_scan_file,
|
|
||||||
nullptr,
|
nullptr,
|
||||||
|
sndfile_scan_stream,
|
||||||
nullptr,
|
nullptr,
|
||||||
sndfile_suffixes,
|
sndfile_suffixes,
|
||||||
sndfile_mime_types,
|
sndfile_mime_types,
|
||||||
|
|
Loading…
Reference in New Issue