diff options
author | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-28 18:09:33 +0200 |
---|---|---|
committer | Sebastian Dröge <slomo@circular-chaos.org> | 2013-07-28 18:10:55 +0200 |
commit | a20b0376b3eb19a7de7aa5c3a3b95a98f5a61a53 (patch) | |
tree | a6477083af69c93896df58815e2fd7089716243c | |
parent | a07c3c796eca9996075a8d9863d9b3400c75759e (diff) | |
download | gst-plugins-good-a20b0376b3eb19a7de7aa5c3a3b95a98f5a61a53.tar.gz gst-plugins-good-a20b0376b3eb19a7de7aa5c3a3b95a98f5a61a53.tar.xz |
flacenc: Fix handling of image tags
The caps should be used to get the mimetype and there is
only an info structure for the GstSample if the image-type
is not NONE.
-rw-r--r-- | ext/flac/gstflacenc.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/ext/flac/gstflacenc.c b/ext/flac/gstflacenc.c index 570c908bf..52525b7d5 100644 --- a/ext/flac/gstflacenc.c +++ b/ext/flac/gstflacenc.c @@ -625,6 +625,7 @@ gst_flac_enc_set_metadata (GstFlacEnc * flacenc, GstAudioInfo * info, if (n_images + n_preview_images > 0) { GstSample *sample; GstBuffer *buffer; + GstCaps *caps; const GstStructure *structure; GstTagImageType image_type = GST_TAG_IMAGE_TYPE_NONE; gint i; @@ -641,16 +642,22 @@ gst_flac_enc_set_metadata (GstFlacEnc * flacenc, GstAudioInfo * info, } structure = gst_sample_get_info (sample); - if (!structure) { - GST_ERROR_OBJECT (flacenc, "No image tag info"); + caps = gst_sample_get_caps (sample); + if (!caps) { + GST_FIXME_OBJECT (flacenc, "Image tag without caps"); + gst_sample_unref (sample); continue; } flacenc->meta[entries] = FLAC__metadata_object_new (FLAC__METADATA_TYPE_PICTURE); - gst_structure_get (structure, "image-type", GST_TYPE_TAG_IMAGE_TYPE, - &image_type, NULL); + if (structure) + gst_structure_get (structure, "image-type", GST_TYPE_TAG_IMAGE_TYPE, + &image_type, NULL); + else + image_type = GST_TAG_IMAGE_TYPE_NONE; + /* Convert to ID3v2 APIC image type */ if (image_type == GST_TAG_IMAGE_TYPE_NONE) image_type = (i < n_images) ? 0x00 : 0x01; @@ -665,6 +672,9 @@ gst_flac_enc_set_metadata (GstFlacEnc * flacenc, GstAudioInfo * info, /* FIXME: There's no way to set the picture type in libFLAC */ flacenc->meta[entries]->data.picture.type = image_type; + + structure = gst_caps_get_structure (caps, 0); + FLAC__metadata_object_picture_set_mime_type (flacenc->meta[entries], (char *) gst_structure_get_name (structure), TRUE); |