tag: id3: encapsulate ID3V2 blob frames in GstSample

id3mux and id3v2mux expect GST_TAG_ID3V2_FRAME type to be stored in a
GstSample and not a buffer, which is also needed because we can't
attach extradata/caps to buffers any more. These are private tags
no one should be poking at, and also the extra info is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=707765
This commit is contained in:
Matthieu Bouron 2013-09-03 17:27:37 +01:00 committed by Tim-Philipp Müller
parent 6d7ab5a8f9
commit 7b3ca538fd
2 changed files with 7 additions and 3 deletions

View file

@ -393,6 +393,7 @@ static void
id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size) id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
{ {
GstBuffer *blob; GstBuffer *blob;
GstSample *sample;
guint8 *frame_data; guint8 *frame_data;
#if 0 #if 0
GstCaps *caps; GstCaps *caps;
@ -420,6 +421,9 @@ id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
blob = gst_buffer_new_and_alloc (frame_size); blob = gst_buffer_new_and_alloc (frame_size);
gst_buffer_fill (blob, 0, frame_data, frame_size); gst_buffer_fill (blob, 0, frame_data, frame_size);
sample = gst_sample_new (blob, NULL, NULL, NULL);
gst_buffer_unref (blob);
/* Sanitize frame id */ /* Sanitize frame id */
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
if (!g_ascii_isalnum (frame_data[i])) if (!g_ascii_isalnum (frame_data[i]))
@ -440,8 +444,8 @@ id3v2_add_id3v2_frame_blob_to_taglist (ID3TagsWorking * work, guint size)
/* gst_util_dump_mem (GST_BUFFER_DATA (blob), GST_BUFFER_SIZE (blob)); */ /* gst_util_dump_mem (GST_BUFFER_DATA (blob), GST_BUFFER_SIZE (blob)); */
gst_tag_list_add (work->tags, GST_TAG_MERGE_APPEND, gst_tag_list_add (work->tags, GST_TAG_MERGE_APPEND,
GST_TAG_ID3V2_FRAME, blob, NULL); GST_TAG_ID3V2_FRAME, sample, NULL);
gst_buffer_unref (blob); gst_sample_unref (sample);
} }
static gboolean static gboolean

View file

@ -191,7 +191,7 @@ gst_tag_register_tags_internal (gpointer unused)
_("Media (image/video) intended vertical pixel density in ppi"), NULL); _("Media (image/video) intended vertical pixel density in ppi"), NULL);
gst_tag_register_static (GST_TAG_ID3V2_FRAME, GST_TAG_FLAG_META, gst_tag_register_static (GST_TAG_ID3V2_FRAME, GST_TAG_FLAG_META,
GST_TYPE_BUFFER, _("ID3v2 frame"), _("unparsed id3v2 tag frame"), GST_TYPE_SAMPLE, _("ID3v2 frame"), _("unparsed id3v2 tag frame"),
gst_tag_merge_use_first); gst_tag_merge_use_first);
gst_tag_register_static (GST_TAG_MUSICAL_KEY, GST_TAG_FLAG_META, gst_tag_register_static (GST_TAG_MUSICAL_KEY, GST_TAG_FLAG_META,