本文整理汇总了C++中FLAC__stream_decoder_delete函数的典型用法代码示例。如果您正苦于以下问题:C++ FLAC__stream_decoder_delete函数的具体用法?C++ FLAC__stream_decoder_delete怎么用?C++ FLAC__stream_decoder_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FLAC__stream_decoder_delete函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flacdecode_init
static void flacdecode_init(struct xlplayer *xlplayer)
{
struct flacdecode_vars *self = xlplayer->dec_data;
int src_error;
if (!(self->decoder = FLAC__stream_decoder_new()))
{
fprintf(stderr, "flacdecode_init: %s could not initialise flac decoder\n", xlplayer->playername);
goto cleanup;
}
if (FLAC__stream_decoder_init_file(self->decoder, xlplayer->pathname, flac_writer_callback, NULL, flac_error_callback, xlplayer) != FLAC__STREAM_DECODER_INIT_STATUS_OK)
{
fprintf(stderr, "flacdecode_init: %s error during flac player initialisation\n", xlplayer->playername);
FLAC__stream_decoder_delete(self->decoder);
goto cleanup;
}
if (xlplayer->seek_s)
{
self->suppress_audio_output = TRUE; /* prevent seek noise */
FLAC__stream_decoder_seek_absolute(self->decoder, ((FLAC__uint64)xlplayer->seek_s) * ((FLAC__uint64)self->metainfo.data.stream_info.sample_rate));
self->suppress_audio_output = FALSE;
}
if ((self->resample_f = (self->metainfo.data.stream_info.sample_rate != xlplayer->samplerate)))
{
fprintf(stderr, "flacdecode_init: %s configuring resampler\n", xlplayer->playername);
xlplayer->src_state = src_new(xlplayer->rsqual, self->metainfo.data.stream_info.channels, &src_error);
if (src_error)
{
fprintf(stderr, "flacdecode_init: %s src_new reports - %s\n", xlplayer->playername, src_strerror(src_error));
FLAC__stream_decoder_delete(self->decoder);
goto cleanup;
}
xlplayer->src_data.output_frames = 0;
xlplayer->src_data.data_in = xlplayer->src_data.data_out = NULL;
xlplayer->src_data.src_ratio = (double)xlplayer->samplerate / (double)self->metainfo.data.stream_info.sample_rate;
xlplayer->src_data.end_of_input = 0;
self->totalsamples = self->metainfo.data.stream_info.total_samples;
}
else
xlplayer->src_state = NULL;
self->suppress_audio_output = FALSE;
self->flbuf = NULL;
return;
cleanup:
free(self);
xlplayer->playmode = PM_STOPPED;
xlplayer->command = CMD_COMPLETE;
}
示例2: HandleFLAC
static status_t HandleFLAC(const char *filename, MediaScannerClient* client)
{
status_t status = UNKNOWN_ERROR;
FLAC__StreamDecoder *decoder;
decoder = FLAC__stream_decoder_new();
if (!decoder)
return status;
FLAC__stream_decoder_set_md5_checking(decoder, false);
FLAC__stream_decoder_set_metadata_ignore_all(decoder);
FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_STREAMINFO);
FLAC__stream_decoder_set_metadata_respond(decoder, FLAC__METADATA_TYPE_VORBIS_COMMENT);
FLAC__StreamDecoderInitStatus init_status;
init_status = FLAC__stream_decoder_init_file(decoder, filename, flac_write, flac_metadata, flac_error, client);
if (init_status != FLAC__STREAM_DECODER_INIT_STATUS_OK)
goto exit;
if (!FLAC__stream_decoder_process_until_end_of_metadata(decoder))
goto exit;
status = OK;
exit:
FLAC__stream_decoder_finish(decoder);
FLAC__stream_decoder_delete(decoder);
return status;
}
示例3: FLAC__stream_decoder_new
bool CFlacDec::GetMetaData(FILE *in, const bool /*nice*/, CAudioMetaData* m)
{
FLAC__StreamDecoder *vf;
vf = FLAC__stream_decoder_new();
FLAC__stream_decoder_set_metadata_ignore_all(vf);
// we need streaminfo (default on) and FLAC__METADATA_TYPE_VORBIS_COMMENT (default off) for ID3 tags
FLAC__stream_decoder_set_metadata_respond(vf, FLAC__METADATA_TYPE_STREAMINFO);
FLAC__stream_decoder_set_metadata_respond(vf, FLAC__METADATA_TYPE_VORBIS_COMMENT);
if (!Open(in, vf))
{
return false;
}
if (FLAC__stream_decoder_process_until_end_of_metadata(vf)) {
// if the metadata callback was called mMetadata should be filled with infos
if (mMetadata) {
SetMetaData(mMetadata, m);
}
}
// clean up stuff, the mMetadata may be used later again so let the decoder free it
FLAC__stream_decoder_finish(vf);
FLAC__stream_decoder_delete(vf);
return true;
}
示例4: SDKCloseFile
static prMALError
SDKCloseFile(
imStdParms *stdParms,
imFileRef *file,
PrivateDataH pdH)
{
if (file && *file) //If we have a file handle, close it
{
SDKQuietFile (stdParms, file, pdH);
}
if (pdH) //If we have private data, release it and clean up
{
(*pdH)->suiteBasic->ReleaseSuite(kPrSDKAudioSuite, kPrSDKAudioSuiteVersion);
if((*pdH)->flacDecoder != NULL)
{
FLAC__stream_decoder_finish((*pdH)->flacDecoder);
FLAC__stream_decoder_delete((*pdH)->flacDecoder);
}
if((*pdH)->audioConversionBuffer)
{
stdParms->piSuites->memFuncs->disposePtr((*pdH)->audioConversionBuffer);
}
stdParms->piSuites->memFuncs->disposeHandle(reinterpret_cast<char**>(pdH));
}
return malNoError;
}
示例5: FLAC__stream_decoder_delete
FlacReader::~FlacReader()
{
if( m_decoder )
{
FLAC__stream_decoder_delete( m_decoder );
}
}
示例6: FLAC__stream_decoder_finish
FLACInputStream::~FLACInputStream() {
if (m_decoder) {
FLAC__stream_decoder_finish(m_decoder);
FLAC__stream_decoder_delete(m_decoder);
m_decoder = 0;
}
}
示例7: safe_decoder_delete_
void safe_decoder_delete_(FLAC__StreamDecoder *decoder)
{
if(decoder) {
safe_decoder_finish_(decoder);
FLAC__stream_decoder_delete(decoder);
}
}
示例8: ba_reader
void SampleBuffer::loadFromBase64( const QString & _data )
{
char * dst = NULL;
int dsize = 0;
base64::decode( _data, &dst, &dsize );
#ifdef LMMS_HAVE_FLAC_STREAM_DECODER_H
QByteArray orig_data = QByteArray::fromRawData( dst, dsize );
QBuffer ba_reader( &orig_data );
ba_reader.open( QBuffer::ReadOnly );
QBuffer ba_writer;
ba_writer.open( QBuffer::WriteOnly );
flacStreamDecoderClientData cdata = { &ba_reader, &ba_writer } ;
FLAC__StreamDecoder * flac_dec = FLAC__stream_decoder_new();
FLAC__stream_decoder_set_read_callback( flac_dec,
flacStreamDecoderReadCallback );
FLAC__stream_decoder_set_write_callback( flac_dec,
flacStreamDecoderWriteCallback );
FLAC__stream_decoder_set_error_callback( flac_dec,
flacStreamDecoderErrorCallback );
FLAC__stream_decoder_set_metadata_callback( flac_dec,
flacStreamDecoderMetadataCallback );
FLAC__stream_decoder_set_client_data( flac_dec, &cdata );
FLAC__stream_decoder_init( flac_dec );
FLAC__stream_decoder_process_until_end_of_stream( flac_dec );
FLAC__stream_decoder_finish( flac_dec );
FLAC__stream_decoder_delete( flac_dec );
ba_reader.close();
orig_data = ba_writer.buffer();
printf("%d\n", (int) orig_data.size() );
m_origFrames = orig_data.size() / sizeof( sampleFrame );
MM_FREE( m_origData );
m_origData = MM_ALLOC( sampleFrame, m_origFrames );
memcpy( m_origData, orig_data.data(), orig_data.size() );
#else /* LMMS_HAVE_FLAC_STREAM_DECODER_H */
m_origFrames = dsize / sizeof( sampleFrame );
MM_FREE( m_origData );
m_origData = MM_ALLOC( sampleFrame, m_origFrames );
memcpy( m_origData, dst, dsize );
#endif
delete[] dst;
m_audioFile = QString();
update();
}
示例9: m_bitdepth
FlacReader::FlacReader( MemoryIo* source )
: m_bitdepth( 0 )
, m_channels( 0 )
, m_samplerate( 0 )
, m_decoder( 0 )
, m_source( source )
, m_sourcepos( 0 )
, m_totalsamples( 0 )
{
m_decoder = FLAC__stream_decoder_new();
if( !m_decoder )
{
throw std::runtime_error( "failed to create the flac decoder" );
}
FLAC__StreamDecoderInitStatus status = FLAC__stream_decoder_init_stream(
m_decoder,
&FlacReader::read_callback,
&FlacReader::seek_callback,
&FlacReader::tell_callback,
&FlacReader::length_callback,
&FlacReader::eof_callback,
&FlacReader::write_callback,
0,
&FlacReader::error_callback,
this );
if( status != FLAC__STREAM_DECODER_INIT_STATUS_OK )
{
FLAC__stream_decoder_delete( m_decoder );
throw std::runtime_error(
FLAC__StreamDecoderInitStatusString[ status ] );
}
if( !FLAC__stream_decoder_process_until_end_of_stream( m_decoder ) )
{
FLAC__StreamDecoderState state =
FLAC__stream_decoder_get_state( m_decoder );
FLAC__stream_decoder_delete( m_decoder );
if( m_error )
{
throw StrException( m_error );
}
else
{
throw std::runtime_error(
FLAC__StreamDecoderStateString[ state ] );
}
}
}
示例10: LOGV
FLACParser::~FLACParser()
{
LOGV("FLACParser::~FLACParser");
if (mDecoder != NULL) {
FLAC__stream_decoder_delete(mDecoder);
mDecoder = NULL;
}
}
示例11: flac_close
void flac_close(void *client_data){
flacfile *flac;
flac=(flacfile *)client_data;
free(flac->block_buf);
free(flac->oldbuf);
FLAC__stream_decoder_delete(flac->decoder);
free(flac);
}
示例12: FLAC_plugin__decoder_delete
void FLAC_plugin__decoder_delete(FLAC__StreamDecoder *decoder)
{
if (decoder)
{
FLAC_plugin__decoder_finish(decoder);
FLAC__stream_decoder_delete(decoder);
}
}
示例13: stop_read
static int stop_read(sox_format_t * const ft)
{
priv_t * p = (priv_t *)ft->priv;
if (!FLAC__stream_decoder_finish(p->decoder) && p->eof)
lsx_warn("decoder MD5 checksum mismatch.");
FLAC__stream_decoder_delete(p->decoder);
return SOX_SUCCESS;
}
示例14: free_flac
static void free_flac(FEED *feed) {
FLAC_FEED *ffeed;
if (feed == NULL) return;
ffeed = (FLAC_FEED *)feed;
FLAC__stream_decoder_delete(ffeed->decoder);
free_feed(feed);
return;
}
示例15: FLAC__stream_decoder_finish
void OAFLACReader::close()
{
if (mDecoder != nullptr)
{
FLAC__stream_decoder_finish(mDecoder);
FLAC__stream_decoder_delete(mDecoder);
mDecoder = nullptr;
}
}