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

Method SendTag

src/encoder/plugins/FlacEncoderPlugin.cxx:208–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

206}
207
208void
209FlacEncoder::SendTag(const Tag &tag)
210{
211 /* re-initialize encoder since flac_encoder_finish resets everything */
212 flac_encoder_setup(fse, compression, oggflac, audio_format);
213
214 FLAC__StreamMetadata *metadata = FLAC__metadata_object_new(FLAC__METADATA_TYPE_VORBIS_COMMENT);
215 FLAC__StreamMetadata_VorbisComment_Entry entry;
216
217 for (const auto &item : tag) {
218 char name[64];
219 ToUpperASCII(name, tag_item_names[item.type], sizeof(name));
220 FLAC__metadata_object_vorbiscomment_entry_from_name_value_pair(&entry, name, item.value);
221 FLAC__metadata_object_vorbiscomment_append_comment(metadata, entry, false);
222 }
223
224 FLAC__stream_encoder_set_metadata(fse,&metadata,1);
225
226 auto init_status = FLAC__stream_encoder_init_ogg_stream(fse,
227 nullptr, WriteCallback,
228 nullptr, nullptr, nullptr,
229 this);
230
231 FLAC__metadata_object_delete(metadata);
232
233 if (init_status != FLAC__STREAM_ENCODER_INIT_STATUS_OK)
234 throw FmtRuntimeError("failed to initialize encoder: {}",
235 FLAC__StreamEncoderInitStatusString[init_status]);
236}
237
238template<typename T>
239static std::span<const FLAC__int32>

Callers

nothing calls this directly

Calls 2

flac_encoder_setupFunction · 0.85
ToUpperASCIIFunction · 0.85

Tested by

no test coverage detected