summaryrefslogtreecommitdiff
path: root/plugins/converter/converter.c
diff options
context:
space:
mode:
authorGravatar waker <wakeroid@gmail.com>2011-03-20 19:26:31 +0100
committerGravatar waker <wakeroid@gmail.com>2011-03-20 19:26:31 +0100
commitaca4048694c3e32c2a07e0be0214808d29945cc7 (patch)
treef8b4f4a0e514cf71245fd058be3c5f89157314e7 /plugins/converter/converter.c
parentac219f835bf6db125c0abaa65669b924510b2c4f (diff)
added ogg and flac tag writing to converter
Diffstat (limited to 'plugins/converter/converter.c')
-rw-r--r--plugins/converter/converter.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/plugins/converter/converter.c b/plugins/converter/converter.c
index 5d6ca1fa..a2df60fc 100644
--- a/plugins/converter/converter.c
+++ b/plugins/converter/converter.c
@@ -793,7 +793,7 @@ error:
unlink (input_file_name);
}
- // write tags
+ // write junklib tags
uint32_t tagflags = JUNK_STRIP_ID3V2 | JUNK_STRIP_APEV2 | JUNK_STRIP_ID3V1;
if (encoder_preset->tag_id3v2) {
tagflags |= JUNK_WRITE_ID3V2;
@@ -810,8 +810,51 @@ error:
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;
+ for (int i = 0; plugs[i]; i++) {
+ if (!strcmp (plugs[i]->plugin.id, "stdflac")) {
+ flac = plugs[i];
+ break;
+ }
+ }
+ if (!flac) {
+ fprintf (stderr, "converter: flac plugin not found, cannot write flac metadata\n");
+ }
+ else {
+ if (0 != flac->write_metadata (out_it)) {
+ fprintf (stderr, "converter: failed to write flac metadata, not a flac file?\n");
+ }
+ }
+ }
+
+ // write vorbis tags
+ if (encoder_preset->tag_oggvorbis) {
+ // find flac decoder plugin
+ DB_decoder_t **plugs = deadbeef->plug_get_decoder_list ();
+ DB_decoder_t *ogg = NULL;
+ for (int i = 0; plugs[i]; i++) {
+ if (!strcmp (plugs[i]->plugin.id, "stdogg")) {
+ ogg = plugs[i];
+ break;
+ }
+ }
+ if (!ogg) {
+ fprintf (stderr, "converter: ogg plugin not found, cannot write ogg metadata\n");
+ }
+ else {
+ if (0 != ogg->write_metadata (out_it)) {
+ fprintf (stderr, "converter: failed to write ogg metadata, not an ogg file?\n");
+ }
+ }
+ }
+
deadbeef->pl_item_unref (out_it);
+
return err;
}