2006-05-30 14:35:18 +00:00
|
|
|
/* GStreamer taglib-based APEv2 muxer
|
|
|
|
* Copyright (C) 2006 Christophe Fergeau <teuf@gnome.org>
|
|
|
|
* Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
|
2007-09-13 15:04:15 +00:00
|
|
|
* Copyright (C) 2006 Sebastian Dröge <slomo@circular-chaos.org>
|
2006-05-30 14:35:18 +00:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Library General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Library General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Library General Public
|
|
|
|
* License along with this library; if not, write to the
|
2012-11-04 00:07:18 +00:00
|
|
|
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
2006-05-30 14:35:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* SECTION:element-apev2mux
|
|
|
|
* @see_also: #GstTagSetter
|
|
|
|
*
|
|
|
|
* This element adds APEv2 tags to the beginning of a stream using the taglib
|
|
|
|
* library.
|
2009-01-28 15:46:06 +00:00
|
|
|
*
|
2006-05-30 14:35:18 +00:00
|
|
|
* Applications can set the tags to write using the #GstTagSetter interface.
|
|
|
|
* Tags sent by upstream elements will be picked up automatically (and merged
|
|
|
|
* according to the merge mode set via the tag setter interface).
|
2009-01-28 15:46:06 +00:00
|
|
|
*
|
|
|
|
* <refsect2>
|
|
|
|
* <title>Example pipelines</title>
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -v filesrc location=foo.ogg ! decodebin ! audioconvert ! lame ! apev2mux ! filesink location=foo.mp3
|
2009-01-28 15:46:06 +00:00
|
|
|
* ]| A pipeline that transcodes a file from Ogg/Vorbis to mp3 format with an
|
|
|
|
* APEv2 that contains the same as the the Ogg/Vorbis file. Make sure the
|
|
|
|
* Ogg/Vorbis file actually has comments to preserve.
|
|
|
|
* |[
|
2012-08-26 21:39:55 +00:00
|
|
|
* gst-launch-1.0 -m filesrc location=foo.mp3 ! apedemux ! fakesink silent=TRUE 2> /dev/null | grep taglist
|
2009-01-28 15:46:06 +00:00
|
|
|
* ]| Verify that tags have been written.
|
2006-05-30 14:35:18 +00:00
|
|
|
* </refsect2>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include <config.h>
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include "gstapev2mux.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <apetag.h>
|
|
|
|
#include <gst/tag/tag.h>
|
|
|
|
|
|
|
|
using namespace TagLib;
|
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_STATIC (gst_apev2_mux_debug);
|
|
|
|
#define GST_CAT_DEFAULT gst_apev2_mux_debug
|
|
|
|
|
|
|
|
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
|
|
GST_PAD_SRC,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("application/x-apetag"));
|
|
|
|
|
2012-02-12 16:22:21 +00:00
|
|
|
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
|
|
GST_PAD_SINK,
|
|
|
|
GST_PAD_ALWAYS,
|
|
|
|
GST_STATIC_CAPS ("ANY"));
|
|
|
|
|
2012-02-12 17:03:37 +00:00
|
|
|
G_DEFINE_TYPE (GstApev2Mux, gst_apev2_mux, GST_TYPE_TAG_MUX);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2012-02-12 16:22:21 +00:00
|
|
|
static GstBuffer *gst_apev2_mux_render_tag (GstTagMux * mux,
|
|
|
|
const GstTagList * taglist);
|
|
|
|
static GstBuffer *gst_apev2_mux_render_end_tag (GstTagMux * mux,
|
|
|
|
const GstTagList * taglist);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
static void
|
2012-02-01 17:01:27 +00:00
|
|
|
gst_apev2_mux_class_init (GstApev2MuxClass * klass)
|
2006-05-30 14:35:18 +00:00
|
|
|
{
|
2012-02-01 17:01:27 +00:00
|
|
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
|
|
|
2012-02-12 17:03:37 +00:00
|
|
|
GST_TAG_MUX_CLASS (klass)->render_start_tag =
|
2012-02-01 17:01:27 +00:00
|
|
|
GST_DEBUG_FUNCPTR (gst_apev2_mux_render_tag);
|
2012-02-12 17:03:37 +00:00
|
|
|
GST_TAG_MUX_CLASS (klass)->render_end_tag =
|
|
|
|
GST_DEBUG_FUNCPTR (gst_apev2_mux_render_end_tag);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2012-02-12 17:03:37 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&sink_template));
|
2006-05-30 14:35:18 +00:00
|
|
|
gst_element_class_add_pad_template (element_class,
|
|
|
|
gst_static_pad_template_get (&src_template));
|
|
|
|
|
2012-04-09 23:51:41 +00:00
|
|
|
gst_element_class_set_static_metadata (element_class,
|
2007-09-19 10:22:40 +00:00
|
|
|
"TagLib-based APEv2 Muxer", "Formatter/Metadata",
|
|
|
|
"Adds an APEv2 header to the beginning of files using taglib",
|
|
|
|
"Sebastian Dröge <slomo@circular-chaos.org>");
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
GST_DEBUG_CATEGORY_INIT (gst_apev2_mux_debug, "apev2mux", 0,
|
|
|
|
"taglib-based APEv2 tag muxer");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2012-02-01 17:01:27 +00:00
|
|
|
gst_apev2_mux_init (GstApev2Mux * apev2mux)
|
2006-05-30 14:35:18 +00:00
|
|
|
{
|
|
|
|
/* nothing to do */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
add_one_tag (const GstTagList * list, const gchar * tag, gpointer user_data)
|
|
|
|
{
|
|
|
|
APE::Tag * apev2tag = (APE::Tag *) user_data;
|
|
|
|
gboolean result;
|
|
|
|
|
|
|
|
/* FIXME: if there are several values set for the same tag, this won't
|
|
|
|
* work, only the first value will be taken into account
|
|
|
|
*/
|
|
|
|
if (strcmp (tag, GST_TAG_TITLE) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *title;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &title);
|
2006-05-30 14:35:18 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting title to %s", title);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->setTitle (String (title, String::UTF8));
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ALBUM) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *album;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &album);
|
2006-05-30 14:35:18 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting album to %s", album);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->setAlbum (String (album, String::UTF8));
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ARTIST) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *artist;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &artist);
|
2006-05-30 14:35:18 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting artist to %s", artist);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->setArtist (String (artist, String::UTF8));
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
2007-09-25 19:09:33 +00:00
|
|
|
} else if (strcmp (tag, GST_TAG_COMPOSER) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *composer;
|
2007-09-25 19:09:33 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &composer);
|
2007-09-25 19:09:33 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting composer to %s", composer);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("COMPOSER", String::UTF8),
|
|
|
|
String (composer, String::UTF8));
|
2007-09-25 19:09:33 +00:00
|
|
|
}
|
2006-05-30 14:35:18 +00:00
|
|
|
} else if (strcmp (tag, GST_TAG_GENRE) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *genre;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &genre);
|
2006-05-30 14:35:18 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting genre to %s", genre);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->setGenre (String (genre, String::UTF8));
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_COMMENT) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const char *comment;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &comment);
|
2006-05-30 14:35:18 +00:00
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting comment to %s", comment);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->setComment (String (comment, String::UTF8));
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_DATE) == 0) {
|
|
|
|
GDate *date;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_date_index (list, tag, 0, &date);
|
|
|
|
if (result != FALSE) {
|
|
|
|
GDateYear year;
|
|
|
|
|
|
|
|
year = g_date_get_year (date);
|
|
|
|
GST_DEBUG ("Setting track year to %d", year);
|
|
|
|
apev2tag->setYear (year);
|
|
|
|
g_date_free (date);
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_TRACK_NUMBER) == 0) {
|
|
|
|
guint track_number;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_uint_index (list, tag, 0, &track_number);
|
|
|
|
if (result != FALSE) {
|
|
|
|
guint total_tracks;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_uint_index (list, GST_TAG_TRACK_COUNT,
|
|
|
|
0, &total_tracks);
|
|
|
|
if (result) {
|
|
|
|
gchar *tag_str;
|
|
|
|
|
|
|
|
tag_str = g_strdup_printf ("%d/%d", track_number, total_tracks);
|
|
|
|
GST_DEBUG ("Setting track number to %s", tag_str);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("TRACK", String::UTF8),
|
|
|
|
String (tag_str, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (tag_str);
|
|
|
|
} else {
|
|
|
|
GST_DEBUG ("Setting track number to %d", track_number);
|
|
|
|
apev2tag->setTrack (track_number);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_TRACK_COUNT) == 0) {
|
|
|
|
guint n;
|
|
|
|
|
|
|
|
if (gst_tag_list_get_uint_index (list, GST_TAG_TRACK_NUMBER, 0, &n)) {
|
|
|
|
GST_DEBUG ("track-count handled with track-number, skipping");
|
|
|
|
} else if (gst_tag_list_get_uint_index (list, GST_TAG_TRACK_COUNT, 0, &n)) {
|
|
|
|
gchar *tag_str;
|
|
|
|
|
|
|
|
tag_str = g_strdup_printf ("0/%d", n);
|
|
|
|
GST_DEBUG ("Setting track number to %s", tag_str);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("TRACK", String::UTF8),
|
|
|
|
String (tag_str, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (tag_str);
|
|
|
|
}
|
|
|
|
#if 0
|
|
|
|
} else if (strcmp (tag, GST_TAG_ALBUM_VOLUME_NUMBER) == 0) {
|
|
|
|
guint volume_number;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_uint_index (list, tag, 0, &volume_number);
|
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
guint volume_count;
|
|
|
|
gchar *tag_str;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_uint_index (list, GST_TAG_ALBUM_VOLUME_COUNT,
|
|
|
|
0, &volume_count);
|
|
|
|
|
|
|
|
if (result) {
|
|
|
|
tag_str = g_strdup_printf ("CD %d/%d", volume_number, volume_count);
|
|
|
|
} else {
|
|
|
|
tag_str = g_strdup_printf ("CD %d", volume_number);
|
|
|
|
}
|
|
|
|
|
|
|
|
GST_DEBUG ("Setting album number to %s", tag_str);
|
|
|
|
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("MEDIA", String::UTF8),
|
|
|
|
String (tag_str, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (tag_str);
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ALBUM_VOLUME_COUNT) == 0) {
|
|
|
|
guint n;
|
|
|
|
|
|
|
|
if (gst_tag_list_get_uint_index (list, GST_TAG_ALBUM_VOLUME_NUMBER, 0, &n)) {
|
|
|
|
GST_DEBUG ("volume-count handled with volume-number, skipping");
|
|
|
|
} else if (gst_tag_list_get_uint_index (list, GST_TAG_ALBUM_VOLUME_COUNT,
|
|
|
|
0, &n)) {
|
|
|
|
gchar *tag_str;
|
|
|
|
|
|
|
|
tag_str = g_strdup_printf ("CD 0/%u", n);
|
|
|
|
GST_DEBUG ("Setting album volume number/count to %s", tag_str);
|
|
|
|
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("MEDIA", String::UTF8),
|
|
|
|
String (tag_str, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (tag_str);
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
} else if (strcmp (tag, GST_TAG_COPYRIGHT) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const gchar *copyright;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, ©right);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting copyright to %s", copyright);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("COPYRIGHT", String::UTF8),
|
|
|
|
String (copyright, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_LOCATION) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const gchar *location;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &location);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting location to %s", location);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("FILE", String::UTF8),
|
|
|
|
String (location, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ISRC) == 0) {
|
2010-06-18 17:13:58 +00:00
|
|
|
const gchar *isrc;
|
2006-05-30 14:35:18 +00:00
|
|
|
|
2010-06-18 17:13:58 +00:00
|
|
|
result = gst_tag_list_peek_string_index (list, tag, 0, &isrc);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
GST_DEBUG ("Setting ISRC to %s", isrc);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("ISRC", String::UTF8),
|
|
|
|
String (isrc, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_TRACK_GAIN) == 0) {
|
|
|
|
gdouble value;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_double_index (list, tag, 0, &value);
|
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
gchar *track_gain = (gchar *) g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
|
|
|
|
|
|
|
|
track_gain = g_ascii_dtostr (track_gain, G_ASCII_DTOSTR_BUF_SIZE, value);
|
|
|
|
GST_DEBUG ("Setting track gain to %s", track_gain);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("REPLAYGAIN_TRACK_GAIN",
|
|
|
|
String::UTF8), String (track_gain, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (track_gain);
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_TRACK_PEAK) == 0) {
|
|
|
|
gdouble value;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_double_index (list, tag, 0, &value);
|
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
gchar *track_peak = (gchar *) g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
|
|
|
|
|
|
|
|
track_peak = g_ascii_dtostr (track_peak, G_ASCII_DTOSTR_BUF_SIZE, value);
|
|
|
|
GST_DEBUG ("Setting track peak to %s", track_peak);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("REPLAYGAIN_TRACK_PEAK",
|
|
|
|
String::UTF8), String (track_peak, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (track_peak);
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ALBUM_GAIN) == 0) {
|
|
|
|
gdouble value;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_double_index (list, tag, 0, &value);
|
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
gchar *album_gain = (gchar *) g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
|
|
|
|
|
|
|
|
album_gain = g_ascii_dtostr (album_gain, G_ASCII_DTOSTR_BUF_SIZE, value);
|
|
|
|
GST_DEBUG ("Setting album gain to %s", album_gain);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("REPLAYGAIN_ALBUM_GAIN",
|
|
|
|
String::UTF8), String (album_gain, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (album_gain);
|
|
|
|
}
|
|
|
|
} else if (strcmp (tag, GST_TAG_ALBUM_PEAK) == 0) {
|
|
|
|
gdouble value;
|
|
|
|
|
|
|
|
result = gst_tag_list_get_double_index (list, tag, 0, &value);
|
|
|
|
|
|
|
|
if (result != FALSE) {
|
|
|
|
gchar *album_peak = (gchar *) g_malloc0 (G_ASCII_DTOSTR_BUF_SIZE);
|
|
|
|
|
|
|
|
album_peak = g_ascii_dtostr (album_peak, G_ASCII_DTOSTR_BUF_SIZE, value);
|
|
|
|
GST_DEBUG ("Setting album peak to %s", album_peak);
|
2010-01-13 08:17:05 +00:00
|
|
|
apev2tag->addValue (String ("REPLAYGAIN_ALBUM_PEAK",
|
|
|
|
String::UTF8), String (album_peak, String::UTF8), true);
|
2006-05-30 14:35:18 +00:00
|
|
|
g_free (album_peak);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
GST_WARNING ("Unsupported tag: %s", tag);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static GstBuffer *
|
2012-02-12 16:22:21 +00:00
|
|
|
gst_apev2_mux_render_tag (GstTagMux * mux, const GstTagList * taglist)
|
2006-05-30 14:35:18 +00:00
|
|
|
{
|
|
|
|
APE::Tag apev2tag;
|
|
|
|
ByteVector rendered_tag;
|
|
|
|
GstBuffer *buf;
|
|
|
|
guint tag_size;
|
|
|
|
|
|
|
|
/* Render the tag */
|
|
|
|
gst_tag_list_foreach (taglist, add_one_tag, &apev2tag);
|
|
|
|
|
|
|
|
rendered_tag = apev2tag.render ();
|
|
|
|
tag_size = rendered_tag.size ();
|
|
|
|
|
|
|
|
GST_LOG_OBJECT (mux, "tag size = %d bytes", tag_size);
|
|
|
|
|
|
|
|
/* Create buffer with tag */
|
|
|
|
buf = gst_buffer_new_and_alloc (tag_size);
|
2012-02-01 17:01:27 +00:00
|
|
|
gst_buffer_fill (buf, 0, rendered_tag.data (), tag_size);
|
2006-05-30 14:35:18 +00:00
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
|
|
|
|
2012-02-12 16:22:21 +00:00
|
|
|
static GstBuffer *
|
|
|
|
gst_apev2_mux_render_end_tag (GstTagMux * mux, const GstTagList * taglist)
|
2006-05-30 14:35:18 +00:00
|
|
|
{
|
2012-02-12 16:22:21 +00:00
|
|
|
return NULL;
|
2006-05-30 14:35:18 +00:00
|
|
|
}
|