예제 #1
0
파일: dec_audio.c 프로젝트: Bl4Cc4t/mpv
void audio_uninit(struct dec_audio *d_audio)
{
    if (!d_audio)
        return;
    if (d_audio->afilter) {
        MP_VERBOSE(d_audio, "Uninit audio filters...\n");
        af_destroy(d_audio->afilter);
        d_audio->afilter = NULL;
    }
    uninit_decoder(d_audio);
    talloc_free(d_audio->decode_buffer);
    talloc_free(d_audio);
}
예제 #2
0
파일: dec_audio.c 프로젝트: ihling/mpv
void audio_uninit(struct dec_audio *d_audio)
{
    if (!d_audio)
        return;
    if (d_audio->afilter) {
        mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio filters...\n");
        af_destroy(d_audio->afilter);
        d_audio->afilter = NULL;
    }
    uninit_decoder(d_audio);
    talloc_free(d_audio->decode_buffer);
    talloc_free(d_audio);
}
예제 #3
0
파일: dec_audio.c 프로젝트: ArcherSeven/mpv
void uninit_audio(sh_audio_t *sh_audio)
{
    if (sh_audio->afilter) {
        mp_msg(MSGT_DECAUDIO, MSGL_V, "Uninit audio filters...\n");
        af_destroy(sh_audio->afilter);
        sh_audio->afilter = NULL;
    }
    if (sh_audio->initialized) {
        mp_tmsg(MSGT_DECAUDIO, MSGL_V, "Uninit audio.\n");
        sh_audio->ad_driver->uninit(sh_audio);
        sh_audio->initialized = 0;
    }
    talloc_free(sh_audio->gsh->decoder_desc);
    sh_audio->gsh->decoder_desc = NULL;
    av_freep(&sh_audio->a_buffer);
}
예제 #4
0
파일: dec_audio.c 프로젝트: Bl4Cc4t/mpv
int audio_init_filters(struct dec_audio *d_audio, int in_samplerate,
                       int *out_samplerate, struct mp_chmap *out_channels,
                       int *out_format)
{
    if (!d_audio->afilter)
        d_audio->afilter = af_new(d_audio->global);
    struct af_stream *afs = d_audio->afilter;

    // input format: same as codec's output format:
    mp_audio_buffer_get_format(d_audio->decode_buffer, &afs->input);
    // Sample rate can be different when adjusting playback speed
    afs->input.rate = in_samplerate;

    // output format: same as ao driver's input format (if missing, fallback to input)
    afs->output.rate = *out_samplerate;
    mp_audio_set_channels(&afs->output, out_channels);
    mp_audio_set_format(&afs->output, *out_format);

    afs->metadata = d_audio->metadata;

    afs->replaygain_data = d_audio->replaygain_data;

    char *s_from = mp_audio_config_to_str(&afs->input);
    char *s_to = mp_audio_config_to_str(&afs->output);
    MP_VERBOSE(d_audio, "Building audio filter chain for %s -> %s...\n", s_from, s_to);
    talloc_free(s_from);
    talloc_free(s_to);

    // let's autoprobe it!
    if (af_init(afs) != 0) {
        af_destroy(afs);
        d_audio->afilter = NULL;
        return 0;   // failed :(
    }

    *out_samplerate = afs->output.rate;
    *out_channels = afs->output.channels;
    *out_format = afs->output.format;

    return 1;
}
예제 #5
0
파일: dec_audio.c 프로젝트: ArcherSeven/mpv
int init_audio_filters(sh_audio_t *sh_audio, int in_samplerate,
                       int *out_samplerate, struct mp_chmap *out_channels,
                       int *out_format)
{
    if (!sh_audio->afilter)
        sh_audio->afilter = af_new(sh_audio->opts);
    struct af_stream *afs = sh_audio->afilter;

    // input format: same as codec's output format:
    afs->input.rate = in_samplerate;
    mp_audio_set_channels(&afs->input, &sh_audio->channels);
    mp_audio_set_format(&afs->input, sh_audio->sample_format);

    // output format: same as ao driver's input format (if missing, fallback to input)
    afs->output.rate = *out_samplerate;
    mp_audio_set_channels(&afs->output, out_channels);
    mp_audio_set_format(&afs->output, *out_format);

    char *s_from = mp_audio_config_to_str(&afs->input);
    char *s_to = mp_audio_config_to_str(&afs->output);
    mp_tmsg(MSGT_DECAUDIO, MSGL_V,
            "Building audio filter chain for %s -> %s...\n", s_from, s_to);
    talloc_free(s_from);
    talloc_free(s_to);

    // let's autoprobe it!
    if (af_init(afs) != 0) {
        af_destroy(afs);
        sh_audio->afilter = NULL;
        return 0;   // failed :(
    }

    *out_samplerate = afs->output.rate;
    *out_channels = afs->output.channels;
    *out_format = afs->output.format;

    return 1;
}