本文整理汇总了C++中DB_decoder_t::free方法的典型用法代码示例。如果您正苦于以下问题:C++ DB_decoder_t::free方法的具体用法?C++ DB_decoder_t::free怎么用?C++ DB_decoder_t::free使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DB_decoder_t
的用法示例。
在下文中一共展示了DB_decoder_t::free方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
int64_t res = fwrite (buffer, 1, sz, temp_file);
if (sz != res) {
fprintf (stderr, "converter: write error (%lld bytes written out of %d)\n", res, sz);
goto error;
}
}
if (abort && *abort) {
goto error;
}
if (temp_file && temp_file != enc_pipe) {
fseek (temp_file, wavehdr_size, SEEK_SET);
fwrite (&outsize, 1, 4, temp_file);
fclose (temp_file);
temp_file = NULL;
}
if (encoder_preset->encoder[0] && encoder_preset->method == DDB_ENCODER_METHOD_FILE) {
enc_pipe = popen (enc, "w");
}
}
}
err = 0;
error:
if (temp_file && temp_file != enc_pipe) {
fclose (temp_file);
temp_file = NULL;
}
if (enc_pipe) {
pclose (enc_pipe);
enc_pipe = NULL;
}
if (dec && fileinfo) {
dec->free (fileinfo);
fileinfo = NULL;
}
if (abort && *abort && out[0]) {
unlink (out);
}
if (input_file_name[0] && strcmp (input_file_name, "-")) {
unlink (input_file_name);
}
// write junklib tags
uint32_t tagflags = JUNK_STRIP_ID3V2 | JUNK_STRIP_APEV2 | JUNK_STRIP_ID3V1;
if (encoder_preset->tag_id3v2) {
tagflags |= JUNK_WRITE_ID3V2;
}
if (encoder_preset->tag_id3v1) {
tagflags |= JUNK_WRITE_ID3V1;
}
if (encoder_preset->tag_apev2) {
tagflags |= JUNK_WRITE_APEV2;
}
DB_playItem_t *out_it = deadbeef->pl_item_alloc ();
deadbeef->pl_item_copy (out_it, it);
deadbeef->pl_replace_meta (out_it, ":URI", out);
deadbeef->pl_delete_meta (out_it, "cuesheet");
deadbeef->junk_rewrite_tags (out_it, tagflags, encoder_preset->id3v2_version + 3, "iso8859-1");
// write flac tags
if (encoder_preset->tag_flac) {
// find flac decoder plugin
DB_decoder_t **plugs = deadbeef->plug_get_decoder_list ();
DB_decoder_t *flac = NULL;
示例2: if
//.........这里部分代码省略.........
header_written = 1;
}
int64_t res = write (temp_file, buffer, sz);
if (sz != res) {
fprintf (stderr, "converter: write error (%"PRId64" bytes written out of %d)\n", res, sz);
goto error;
}
}
if (abort && *abort) {
goto error;
}
if (temp_file != -1 && (!enc_pipe || temp_file != fileno (enc_pipe))) {
lseek (temp_file, wavehdr_size, SEEK_SET);
if (4 != write (temp_file, &outsize, 4)) {
fprintf (stderr, "converter: data size write error\n");
goto error;
}
if (temp_file != -1 && (!enc_pipe || temp_file != fileno (enc_pipe))) {
close (temp_file);
temp_file = -1;
}
}
if (encoder_preset->encoder[0] && encoder_preset->method == DDB_ENCODER_METHOD_FILE) {
enc_pipe = popen (enc, "w");
}
}
}
err = 0;
error:
if (buffer) {
free (buffer);
buffer = NULL;
}
if (dspbuffer) {
free (dspbuffer);
dspbuffer = NULL;
}
if (temp_file != -1 && (!enc_pipe || temp_file != fileno (enc_pipe))) {
close (temp_file);
temp_file = -1;
}
if (enc_pipe) {
pclose (enc_pipe);
enc_pipe = NULL;
}
if (dec && fileinfo) {
dec->free (fileinfo);
fileinfo = NULL;
}
if (abort && *abort && out[0]) {
unlink (out);
}
if (input_file_name[0] && strcmp (input_file_name, "-")) {
unlink (input_file_name);
}
if (err != 0) {
return err;
}
// write junklib tags
DB_playItem_t *out_it = NULL;
示例3: malloc
//.........这里部分代码省略.........
int samplesize = fileinfo->fmt.channels * fileinfo->fmt.bps / 8;
int bs = 2000 * samplesize;
ddb_waveformat_t fmt;
buffer = malloc (bs);
if (!fileinfo->fmt.is_float) {
bufferf = malloc (2000 * sizeof (float) * fileinfo->fmt.channels);
memcpy (&fmt, &fileinfo->fmt, sizeof (fmt));
fmt.bps = 32;
fmt.is_float = 1;
}
else {
bufferf = buffer;
}
int eof = 0;
for (;;) {
if (eof) {
break;
}
if (st->settings->pabort && *(st->settings->pabort)) {
break;
}
int sz = dec->read (fileinfo, buffer, bs); // read one block
deadbeef->mutex_lock (st->settings->sync_mutex);
int samplesize = fileinfo->fmt.channels * (fileinfo->fmt.bps >> 3);
int numsamples = sz / samplesize;
st->settings->cd_samples_processed += numsamples * 44100 / fileinfo->fmt.samplerate;
deadbeef->mutex_unlock (st->settings->sync_mutex);
if (sz != bs) {
eof = 1;
}
// convert from native output to float,
// only if the input is not float already
if (!fileinfo->fmt.is_float) {
deadbeef->pcm_convert (&fileinfo->fmt, buffer, &fmt, bufferf, sz);
}
int frames = sz / samplesize;
ebur128_add_frames_float (st->gain_state[st->track_index], (float*) bufferf, frames); // collect data
ebur128_add_frames_float (st->peak_state[st->track_index], (float*) bufferf, frames); // collect data
}
}
if (!st->settings->pabort || !(*(st->settings->pabort))) {
// calculating track peak
// libEBUR128 calculates peak per channel, so we have to pick the highest value
double tr_peak = 0;
double ch_peak = 0;
int res;
for (int ch = 0; ch < fileinfo->fmt.channels; ++ch) {
res = ebur128_sample_peak (st->peak_state[st->track_index], ch, &ch_peak);
//trace ("rg_scanner: peak for ch %d: %f\n", ch, ch_peak);
if (ch_peak > tr_peak) {
//trace ("rg_scanner: %f > %f\n", ch_peak, tr_peak);
tr_peak = ch_peak;
}
}
st->settings->results[st->track_index].track_peak = (float) tr_peak;
// calculate track loudness
double loudness = st->settings->ref_loudness;
ebur128_loudness_global (st->gain_state[st->track_index], &loudness);
/*
* EBUR128 sets the target level to -23 LUFS = 84dB
* -> -23 - loudness = track gain to get to 84dB
*
* The old implementation of RG used 89dB, most people still use that
* -> the above + (loudness - 84) = track gain to get to 89dB (or user specified)
*/
st->settings->results[st->track_index].track_gain = -23 - loudness + st->settings->ref_loudness - 84;
}
}
error:
// clean up
if (fileinfo) {
dec->free (fileinfo);
}
if (buffer && buffer != bufferf) {
free (buffer);
buffer = NULL;
}
if (bufferf) {
free (bufferf);
bufferf = NULL;
}
}