diff options
author | waker <wakeroid@gmail.com> | 2011-03-20 19:26:31 +0100 |
---|---|---|
committer | waker <wakeroid@gmail.com> | 2011-03-20 19:26:31 +0100 |
commit | aca4048694c3e32c2a07e0be0214808d29945cc7 (patch) | |
tree | f8b4f4a0e514cf71245fd058be3c5f89157314e7 | |
parent | ac219f835bf6db125c0abaa65669b924510b2c4f (diff) |
added ogg and flac tag writing to converter
-rw-r--r-- | plugins/converter/converter.c | 45 | ||||
-rw-r--r-- | plugins/converter/converter.glade | 2 | ||||
-rw-r--r-- | plugins/converter/interface.c | 2 |
3 files changed, 48 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; } diff --git a/plugins/converter/converter.glade b/plugins/converter/converter.glade index 6f5b68ba..f1a9a17f 100644 --- a/plugins/converter/converter.glade +++ b/plugins/converter/converter.glade @@ -1348,6 +1348,7 @@ Temporary file</property> <child> <widget class="GtkCheckButton" id="oggvorbis"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">OggVorbis</property> <property name="use_underline">True</property> @@ -1369,6 +1370,7 @@ Temporary file</property> <child> <widget class="GtkCheckButton" id="flac"> + <property name="visible">True</property> <property name="can_focus">True</property> <property name="label" translatable="yes">FLAC</property> <property name="use_underline">True</property> diff --git a/plugins/converter/interface.c b/plugins/converter/interface.c index ff220703..64f2ba74 100644 --- a/plugins/converter/interface.c +++ b/plugins/converter/interface.c @@ -582,11 +582,13 @@ create_convpreset_editor (void) (GtkAttachOptions) (0), 0, 0); oggvorbis = gtk_check_button_new_with_mnemonic (_("OggVorbis")); + gtk_widget_show (oggvorbis); gtk_table_attach (GTK_TABLE (table2), oggvorbis, 2, 3, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); flac = gtk_check_button_new_with_mnemonic (_("FLAC")); + gtk_widget_show (flac); gtk_table_attach (GTK_TABLE (table2), flac, 1, 2, 1, 2, (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); |