*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/**
* <refsect2>
* <title>Example pipelines</title>
* |[
- * gst-launch -v filesrc location=foo.ogg ! decodebin ! audioconvert ! lame ! id3v2mux ! filesink location=foo.mp3
+ * gst-launch-1.0 -v filesrc location=foo.ogg ! decodebin ! audioconvert ! lame ! id3v2mux ! filesink location=foo.mp3
* ]| A pipeline that transcodes a file from Ogg/Vorbis to mp3 format with an
* ID3v2 that contains the same as the the Ogg/Vorbis file. Make sure the
* Ogg/Vorbis file actually has comments to preserve.
* |[
- * gst-launch -m filesrc location=foo.mp3 ! id3demux ! fakesink silent=TRUE 2> /dev/null | grep taglist
+ * gst-launch-1.0 -m filesrc location=foo.mp3 ! id3demux ! fakesink silent=TRUE 2> /dev/null | grep taglist
* ]| Verify that tags have been written.
* </refsect2>
*/
GST_TAG_MUX_CLASS (klass)->render_end_tag =
GST_DEBUG_FUNCPTR (gst_id3v2_mux_render_end_tag);
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
+ gst_element_class_add_static_pad_template (element_class, &sink_template);
+ gst_element_class_add_static_pad_template (element_class, &src_template);
gst_element_class_set_static_metadata (element_class,
"TagLib-based ID3v2 Muxer", "Formatter/Metadata",
GstMapInfo map;
gst_buffer_map (buf, &map, GST_MAP_READ);
- GST_DEBUG ("Injecting ID3v2.%u frame %u/%u of length %u and type %"
+ GST_DEBUG ("Injecting ID3v2.%u frame %u/%u of length %" G_GSIZE_FORMAT " and type %"
GST_PTR_FORMAT, version, i, num_tags, map.size, s);
frame = factory->createFrame (ByteVector ((const char *) map.data,
mime_type = gst_structure_get_name (s);
if (mime_type != NULL) {
ID3v2::AttachedPictureFrame * frame;
- const gchar *desc;
+ const gchar *desc = NULL;
GstMapInfo map;
+ const GstStructure *info_struct;
+
+ info_struct = gst_sample_get_info (sample);
+ if (!info_struct
+ || !gst_structure_has_name (info_struct, "GstTagImageInfo"))
+ info_struct = NULL;
if (strcmp (mime_type, "text/uri-list") == 0)
mime_type = "-->";
gst_buffer_map (image, &map, GST_MAP_READ);
- GST_DEBUG ("Attaching picture of %u bytes and mime type %s",
+ GST_DEBUG ("Attaching picture of %" G_GSIZE_FORMAT " bytes and mime type %s",
map.size, mime_type);
id3v2tag->addFrame (frame);
gst_buffer_unmap (image, &map);
- desc = gst_structure_get_string (s, "image-description");
+ if (info_struct)
+ desc = gst_structure_get_string (info_struct, "image-description");
+
frame->setDescription ((desc) ? desc : "");
- /* FIXME set image type properly from caps */
if (strcmp (tag, GST_TAG_PREVIEW_IMAGE) == 0) {
frame->setType (ID3v2::AttachedPictureFrame::FileIcon);
} else {
- frame->setType (ID3v2::AttachedPictureFrame::Other);
+ int image_type = ID3v2::AttachedPictureFrame::Other;
+
+ if (info_struct) {
+ if (gst_structure_get (info_struct, "image-type",
+ GST_TYPE_TAG_IMAGE_TYPE, &image_type, NULL)) {
+ if (image_type > 0 && image_type <= 18) {
+ image_type += 2;
+ } else {
+ image_type = ID3v2::AttachedPictureFrame::Other;
+ }
+ }
+ }
+
+ frame->setType ((TagLib::ID3v2::AttachedPictureFrame::Type) image_type);
}
}
} else {
frame->setIdentification ("album");
GST_DEBUG ("adding album relative-volume frame");
}
-
+
/* find the value for the paired tag (gain, if this is peak, and
* vice versa). if both tags exist, only write the frame when
* we're processing the peak tag.