Commit 2b74311b authored by Max Kellermann's avatar Max Kellermann

vorbis_encoder: pass vorbis_comment to tag helper functions

Prepare the removal of vorbis_encoder.vc.
parent a899c210
...@@ -264,34 +264,34 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error) ...@@ -264,34 +264,34 @@ vorbis_encoder_flush(struct encoder *_encoder, G_GNUC_UNUSED GError **error)
return true; return true;
} }
static void add_tag(struct vorbis_encoder *encoder, static void
const char *name, char *value) add_tag(vorbis_comment *vc, const char *name, char *value)
{ {
if (value) { if (value) {
union { union {
const char *in; const char *in;
char *out; char *out;
} u = { .in = name }; } u = { .in = name };
vorbis_comment_add_tag(&encoder->vc, u.out, value);
vorbis_comment_add_tag(vc, u.out, value);
} }
} }
static void static void
copy_tag_to_vorbis_comment(struct vorbis_encoder *encoder, copy_tag_to_vorbis_comment(vorbis_comment *vc, const struct tag *tag)
const struct tag *tag)
{ {
for (unsigned i = 0; i < tag->num_items; i++) { for (unsigned i = 0; i < tag->num_items; i++) {
switch (tag->items[i]->type) { switch (tag->items[i]->type) {
case TAG_ITEM_ARTIST: case TAG_ITEM_ARTIST:
add_tag(encoder, "ARTIST", tag->items[i]->value); add_tag(vc, "ARTIST", tag->items[i]->value);
break; break;
case TAG_ITEM_ALBUM: case TAG_ITEM_ALBUM:
add_tag(encoder, "ALBUM", tag->items[i]->value); add_tag(vc, "ALBUM", tag->items[i]->value);
break; break;
case TAG_ITEM_TITLE: case TAG_ITEM_TITLE:
add_tag(encoder, "TITLE", tag->items[i]->value); add_tag(vc, "TITLE", tag->items[i]->value);
break; break;
default: default:
...@@ -310,7 +310,7 @@ vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag, ...@@ -310,7 +310,7 @@ vorbis_encoder_tag(struct encoder *_encoder, const struct tag *tag,
if (!vorbis_encoder_reinit(encoder, error)) if (!vorbis_encoder_reinit(encoder, error))
return false; return false;
copy_tag_to_vorbis_comment(encoder, tag); copy_tag_to_vorbis_comment(&encoder->vc, tag);
vorbis_encoder_send_header(encoder); vorbis_encoder_send_header(encoder);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment