MCPcopy Create free account
hub / github.com/MusicPlayerDaemon/MPD / lame_encoder_setup

Function lame_encoder_setup

src/encoder/plugins/LameEncoderPlugin.cxx:93–123  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

91}
92
93static void
94lame_encoder_setup(lame_global_flags *gfp, float quality, int bitrate,
95 const AudioFormat &audio_format)
96{
97 if (quality >= -1.0f) {
98 /* a quality was configured (VBR) */
99
100 if (0 != lame_set_VBR(gfp, vbr_rh))
101 throw std::runtime_error("error setting lame VBR mode");
102
103 if (0 != lame_set_VBR_q(gfp, int(quality)))
104 throw std::runtime_error("error setting lame VBR quality");
105 } else {
106 /* a bit rate was configured */
107
108 if (0 != lame_set_brate(gfp, bitrate))
109 throw std::runtime_error("error setting lame bitrate");
110 }
111
112 if (0 != lame_set_num_channels(gfp, audio_format.channels))
113 throw std::runtime_error("error setting lame num channels");
114
115 if (0 != lame_set_in_samplerate(gfp, audio_format.sample_rate))
116 throw std::runtime_error("error setting lame sample rate");
117
118 if (0 != lame_set_out_samplerate(gfp, audio_format.sample_rate))
119 throw std::runtime_error("error setting lame out sample rate");
120
121 if (0 > lame_init_params(gfp))
122 throw std::runtime_error("error initializing lame params");
123}
124
125Encoder *
126PreparedLameEncoder::Open(AudioFormat &audio_format)

Callers 1

OpenMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected