ext, gst, gst-libs, tests: update for tag list API changes

This commit is contained in:
Tim-Philipp Müller 2011-10-30 11:09:10 +00:00
parent 7eb0985282
commit 5ee51e47a1
21 changed files with 62 additions and 189 deletions

View file

@ -1714,7 +1714,7 @@ gst_ogg_chain_new_stream (GstOggChain * chain, guint32 serialno)
goto init_failed;
/* FIXME: either do something with it or remove it */
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_SERIAL, serialno,
NULL);
gst_tag_list_free (list);
@ -2406,7 +2406,7 @@ gst_ogg_demux_activate_chain (GstOggDemux * ogg, GstOggChain * chain,
gst_ogg_demux_send_event (ogg, event);
gst_element_found_tags (GST_ELEMENT_CAST (ogg),
gst_tag_list_new_full (GST_TAG_CONTAINER_FORMAT, "Ogg", NULL));
gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "Ogg", NULL));
}
GST_DEBUG_OBJECT (ogg, "starting chain");

View file

@ -461,7 +461,7 @@ extract_tags_theora (GstOggStream * pad, ogg_packet * packet)
(const guint8 *) "\201theora", 7, &pad->taglist);
if (!pad->taglist)
pad->taglist = gst_tag_list_new ();
pad->taglist = gst_tag_list_new_empty ();
if (pad->bitrate)
gst_tag_list_add (pad->taglist, GST_TAG_MERGE_REPLACE,
@ -775,7 +775,7 @@ extract_tags_vorbis (GstOggStream * pad, ogg_packet * packet)
(const guint8 *) "\003vorbis", 7, &pad->taglist);
if (!pad->taglist)
pad->taglist = gst_tag_list_new ();
pad->taglist = gst_tag_list_new_empty ();
gst_tag_list_add (pad->taglist, GST_TAG_MERGE_REPLACE,
GST_TAG_ENCODER_VERSION, pad->version, NULL);
@ -866,7 +866,7 @@ extract_tags_count (GstOggStream * pad, ogg_packet * packet)
tag_list_from_vorbiscomment_packet (packet, NULL, 0, &pad->taglist);
if (!pad->taglist)
pad->taglist = gst_tag_list_new ();
pad->taglist = gst_tag_list_new_empty ();
if (pad->bitrate)
gst_tag_list_add (pad->taglist, GST_TAG_MERGE_REPLACE,
@ -1796,7 +1796,7 @@ extract_tags_kate (GstOggStream * pad, ogg_packet * packet)
g_strdelimit (language, NULL, '\0');
canonical = gst_tag_get_language_code_iso_639_1 (language);
if (canonical) {
list = gst_tag_list_new_full (GST_TAG_LANGUAGE_CODE, canonical, NULL);
list = gst_tag_list_new (GST_TAG_LANGUAGE_CODE, canonical, NULL);
} else {
GST_WARNING ("Unknown or invalid language code %s, ignored", language);
}

View file

@ -668,9 +668,7 @@ gst_ogm_parse_stream_header (GstOgmParse * ogm, const guint8 * data, guint size)
{
GstTagList *tags;
tags = gst_tag_list_new ();
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
"Ogm", NULL);
tags = gst_tag_list_new (GST_TAG_SUBTITLE_CODEC, "Ogm", NULL);
gst_element_found_tags_for_pad (GST_ELEMENT (ogm), ogm->srcpad, tags);
}
}

View file

@ -769,7 +769,7 @@ theora_handle_comment_packet (GstTheoraDec * dec, ogg_packet * packet)
if (!list) {
GST_ERROR_OBJECT (dec, "couldn't decode comments");
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
}
if (encoder) {
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,

View file

@ -276,6 +276,7 @@ vorbis_handle_identification_packet (GstVorbisDec * vd)
return GST_FLOW_OK;
}
/* FIXME 0.11: remove tag handling and let container take care of that? */
static GstFlowReturn
vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
{
@ -303,7 +304,7 @@ vorbis_handle_comment_packet (GstVorbisDec * vd, ogg_packet * packet)
if (!vd->taglist) {
GST_ERROR_OBJECT (vd, "couldn't decode comments");
vd->taglist = gst_tag_list_new ();
vd->taglist = gst_tag_list_new_empty ();
}
if (encoder) {
if (encoder[0])

View file

@ -226,7 +226,7 @@ gst_vorbis_enc_start (GstAudioEncoder * enc)
GstVorbisEnc *vorbisenc = GST_VORBISENC (enc);
GST_DEBUG_OBJECT (enc, "start");
vorbisenc->tags = gst_tag_list_new ();
vorbisenc->tags = gst_tag_list_new_empty ();
vorbisenc->header_sent = FALSE;
return TRUE;

View file

@ -1686,7 +1686,7 @@ gst_audio_encoder_activate (GstAudioEncoder * enc, gboolean active)
if (enc->priv->tags)
gst_tag_list_free (enc->priv->tags);
enc->priv->tags = gst_tag_list_new ();
enc->priv->tags = gst_tag_list_new_empty ();
if (!enc->priv->active && klass->start)
result = klass->start (enc);

View file

@ -1294,7 +1294,7 @@ gst_cdda_base_src_add_tags (GstCddaBaseSrc * src)
guint num_sectors;
if (src->tracks[i].tags == NULL)
src->tracks[i].tags = gst_tag_list_new ();
src->tracks[i].tags = gst_tag_list_new_empty ();
num_sectors = src->tracks[i].end - src->tracks[i].start + 1;
gst_cdda_base_src_convert (src, sector_format, num_sectors,
@ -1428,7 +1428,7 @@ gst_cdda_base_src_start (GstBaseSrc * basesrc)
GST_LOG_OBJECT (basesrc, "opening device %s", device);
src->tags = gst_tag_list_new ();
src->tags = gst_tag_list_new_empty ();
ret = klass->open (src, device);
g_free (device);

View file

@ -650,7 +650,7 @@ gst_riff_parse_info (GstElement * element,
}
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
ptr = data;
left = size;

View file

@ -458,7 +458,7 @@ gst_exif_reader_init (GstExifReader * reader, gint byte_order,
{
ensure_exif_tags ();
reader->taglist = gst_tag_list_new ();
reader->taglist = gst_tag_list_new_empty ();
reader->buffer = buf;
reader->base_offset = base_offset;
reader->byte_order = byte_order;

View file

@ -261,7 +261,7 @@ gst_tag_list_new_from_id3v1 (const guint8 * data)
if (data[0] != 'T' || data[1] != 'A' || data[2] != 'G')
return NULL;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_tag_extract_id3v1_string (list, GST_TAG_TITLE, (gchar *) & data[3], 30);
gst_tag_extract_id3v1_string (list, GST_TAG_ARTIST, (gchar *) & data[33], 30);
gst_tag_extract_id3v1_string (list, GST_TAG_ALBUM, (gchar *) & data[63], 30);

View file

@ -459,7 +459,7 @@ gst_tag_list_from_vorbiscomment (const guint8 * data, gsize size,
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (id_data != NULL || id_data_length == 0, NULL);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
if (size < 11 || size <= id_data_length + 4)
goto error;

View file

@ -1343,7 +1343,7 @@ gst_tag_list_from_xmp_buffer (GstBuffer * buffer)
/* no tag can be longer that the whole buffer */
part = g_malloc (xp2 - xp1);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
/* parse data into a list of nodes */
/* data is between xp1..xp2 */

View file

@ -479,7 +479,7 @@ id3v2_frames_to_tag_list (ID3TagsWorking * work, guint size)
return FALSE; /* Must have at least one frame */
}
work->tags = gst_tag_list_new ();
work->tags = gst_tag_list_new_empty ();
while (work->hdr.frame_data_size > frame_hdr_size) {
guint frame_size = 0;

View file

@ -1113,10 +1113,7 @@ gst_audio_test_src_fill (GstBaseSrc * basesrc, guint64 offset,
if (!src->tags_pushed) {
GstTagList *taglist;
taglist = gst_tag_list_new ();
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND,
GST_TAG_DESCRIPTION, "audiotest wave", NULL);
taglist = gst_tag_list_new (GST_TAG_DESCRIPTION, "audiotest wave", NULL);
eclass = GST_ELEMENT_CLASS (parent_class);
if (eclass->send_event)

View file

@ -319,7 +319,7 @@ gst_ssa_parse_chain (GstPad * sinkpad, GstBuffer * buf)
if (G_UNLIKELY (parse->send_tags)) {
GstTagList *tags;
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
"SubStation Alpha", NULL);
gst_element_found_tags_for_pad (GST_ELEMENT (parse), parse->srcpad, tags);

View file

@ -1461,12 +1461,9 @@ handle_buffer (GstSubParse * self, GstBuffer * buf)
/* push tags */
if (self->subtitle_codec != NULL) {
GstTagList *tags;
tags = gst_tag_list_new ();
gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_SUBTITLE_CODEC,
self->subtitle_codec, NULL);
gst_element_found_tags_for_pad (GST_ELEMENT (self), self->srcpad, tags);
gst_element_found_tags_for_pad (GST_ELEMENT (self), self->srcpad,
gst_tag_list_new (GST_TAG_SUBTITLE_CODEC, self->subtitle_codec,
NULL));
}
}

View file

@ -234,7 +234,7 @@ GST_START_TEST (test_empty_tags_set)
vorbistag = setup_vorbistag ();
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, "foobar", NULL);
gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
GST_TAG_MERGE_REPLACE);
@ -290,7 +290,7 @@ GST_START_TEST (test_filled_tags_unset)
vorbistag = setup_vorbistag ();
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
GST_TAG_MERGE_REPLACE);
gst_tag_setter_set_tag_merge_mode (GST_TAG_SETTER (vorbistag),
@ -345,7 +345,7 @@ GST_START_TEST (test_filled_tags_change)
vorbistag = setup_vorbistag ();
tags = gst_tag_list_new ();
tags = gst_tag_list_new_empty ();
gst_tag_list_add (tags, GST_TAG_MERGE_REPLACE, GST_TAG_TITLE, "foobar", NULL);
gst_tag_setter_merge_tags (GST_TAG_SETTER (vorbistag), tags,
GST_TAG_MERGE_REPLACE);

View file

@ -428,7 +428,7 @@ GST_START_TEST (test_pb_utils_taglist_add_codec_info)
GstCaps *caps;
gst_pb_utils_init ();
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
caps = gst_caps_new_empty_simple ("video/x-theora");
ASSERT_CRITICAL (fail_if
(gst_pb_utils_add_codec_description_to_tag_list (NULL,

View file

@ -185,7 +185,7 @@ GST_START_TEST (test_musicbrainz_tag_registration)
gst_tag_register_musicbrainz_tags ();
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
/* musicbrainz tags aren't registered yet */
gst_vorbis_tag_add (list, "MUSICBRAINZ_TRACKID", "123456");
@ -234,7 +234,7 @@ GST_START_TEST (test_vorbis_tags)
{
GstTagList *list;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
/* NULL pointers aren't allowed */
ASSERT_CRITICAL (gst_vorbis_tag_add (NULL, "key", "value"));
@ -370,38 +370,38 @@ GST_START_TEST (test_vorbis_tags)
/* there can only be one language per taglist ... */
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "fr");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "[fr]");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "French [fr]");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "fr");
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "[eng] English");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "eng");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "[eng]");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "eng");
/* free-form *sigh* */
gst_tag_list_free (list);
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "LANGUAGE", "English");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LANGUAGE_CODE, "English");
@ -532,7 +532,7 @@ GST_START_TEST (test_vorbis_tags)
{
GDate *date = NULL;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "DATE", "2006-09-25 22:02:38");
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
@ -549,7 +549,7 @@ GST_START_TEST (test_vorbis_tags)
{
GDate *date = NULL;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "DATE", "1992-00-00");
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
@ -564,7 +564,7 @@ GST_START_TEST (test_vorbis_tags)
{
GDate *date = NULL;
list = gst_tag_list_new ();
list = gst_tag_list_new_empty ();
gst_vorbis_tag_add (list, "DATE", "1992-05-00");
fail_unless (gst_tag_list_get_date_index (list, GST_TAG_DATE, 0, &date));
@ -957,7 +957,7 @@ GST_START_TEST (test_xmp_formatting)
gsize len;
/* test data */
list = gst_tag_list_new_full (GST_TAG_TITLE, "test title",
list = gst_tag_list_new (GST_TAG_TITLE, "test title",
GST_TAG_DESCRIPTION, "test decription",
GST_TAG_KEYWORDS, "keyword1", GST_TAG_KEYWORDS, "keyword2", NULL);
@ -1052,65 +1052,6 @@ GST_START_TEST (test_xmp_parsing)
GST_END_TEST;
static void
tag_list_equals (GstTagList * taglist, GstTagList * taglist2)
{
const gchar *name_sent, *name_recv;
const GValue *value_sent, *value_recv;
gboolean found;
gint comparison;
gint n_recv;
gint n_sent;
gint i, j;
/* verify tags */
fail_unless (taglist2 != NULL);
n_recv = gst_structure_n_fields (taglist2);
n_sent = gst_structure_n_fields (taglist);
fail_unless (n_recv == n_sent);
fail_unless (n_sent > 0);
/* FIXME: compare taglist values */
for (i = 0; i < n_sent; i++) {
name_sent = gst_structure_nth_field_name (taglist, i);
value_sent = gst_structure_get_value (taglist, name_sent);
found = FALSE;
for (j = 0; j < n_recv; j++) {
name_recv = gst_structure_nth_field_name (taglist2, j);
if (!strcmp (name_sent, name_recv)) {
value_recv = gst_structure_get_value (taglist2, name_recv);
comparison = gst_value_compare (value_sent, value_recv);
if (comparison != GST_VALUE_EQUAL) {
gchar *vs = g_strdup_value_contents (value_sent);
gchar *vr = g_strdup_value_contents (value_recv);
GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'",
G_VALUE_TYPE_NAME (value_sent), vs,
G_VALUE_TYPE_NAME (value_recv), vr);
g_free (vs);
g_free (vr);
}
if (comparison != GST_VALUE_EQUAL &&
G_VALUE_HOLDS (value_sent, G_TYPE_DOUBLE)) {
gdouble vs;
gdouble vr;
/* add some tolerance for doubles */
vs = g_value_get_double (value_sent);
vr = g_value_get_double (value_recv);
if (vr >= vs - 0.001 && vr <= vs + 0.001)
comparison = GST_VALUE_EQUAL;
}
fail_unless (comparison == GST_VALUE_EQUAL,
"tag item %s has been received with different type or value",
name_sent);
found = TRUE;
break;
}
}
fail_unless (found, "tag item %s is lost", name_sent);
}
}
static void
do_xmp_tag_serialization_deserialization (GstTagList * taglist,
const gchar ** schemas)
@ -1121,7 +1062,7 @@ do_xmp_tag_serialization_deserialization (GstTagList * taglist,
buf = gst_tag_list_to_xmp_buffer_full (taglist, TRUE, schemas);
taglist2 = gst_tag_list_from_xmp_buffer (buf);
tag_list_equals (taglist, taglist2);
fail_unless (gst_tag_list_is_equal (taglist, taglist2));
gst_buffer_unref (buf);
gst_tag_list_free (taglist2);
@ -1131,7 +1072,7 @@ static void
do_simple_xmp_tag_serialization_deserialization (const gchar * gsttag,
GValue * value)
{
GstTagList *taglist = gst_tag_list_new ();
GstTagList *taglist = gst_tag_list_new_empty ();
gst_tag_list_add_value (taglist, GST_TAG_MERGE_REPLACE, gsttag, value);
@ -1323,7 +1264,7 @@ GST_END_TEST;
GST_START_TEST (test_xmp_compound_tags)
{
const gchar *schemas[] = { "Iptc4xmpExt", NULL };
GstTagList *taglist = gst_tag_list_new ();
GstTagList *taglist = gst_tag_list_new_empty ();
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_KEYWORDS, "k1",
GST_TAG_KEYWORDS, "k2", GST_TAG_TITLE, "title", GST_TAG_KEYWORDS, "k3",
@ -1331,7 +1272,7 @@ GST_START_TEST (test_xmp_compound_tags)
do_xmp_tag_serialization_deserialization (taglist, NULL);
gst_tag_list_free (taglist);
taglist = gst_tag_list_new ();
taglist = gst_tag_list_new_empty ();
gst_tag_list_add (taglist, GST_TAG_MERGE_APPEND, GST_TAG_GEO_LOCATION_COUNTRY,
"Brazil", GST_TAG_GEO_LOCATION_CITY, "Campina Grande", NULL);
do_xmp_tag_serialization_deserialization (taglist, schemas);
@ -1346,7 +1287,7 @@ GST_START_TEST (test_exif_parsing)
GstTagList *taglist;
GstBuffer *buf;
GstByteWriter writer;
const gchar *str;
const gchar *str = NULL;
gst_byte_writer_init (&writer);
@ -1371,11 +1312,9 @@ GST_START_TEST (test_exif_parsing)
taglist = gst_tag_list_from_exif_buffer (buf, G_LITTLE_ENDIAN, 8);
fail_unless (gst_structure_n_fields (taglist) == 1);
fail_unless (gst_structure_has_field_typed (taglist, GST_TAG_COPYRIGHT,
G_TYPE_STRING));
str = gst_structure_get_string (taglist, GST_TAG_COPYRIGHT);
fail_unless (strcmp (str, "my copyright") == 0);
fail_unless (gst_tag_list_get_tag_size (taglist, GST_TAG_COPYRIGHT) == 1);
gst_tag_list_peek_string_index (taglist, GST_TAG_COPYRIGHT, 0, &str);
fail_unless_equals_string (str, "my copyright");
gst_tag_list_free (taglist);
gst_buffer_unref (buf);
@ -1395,7 +1334,7 @@ do_exif_tag_serialization_deserialization (GstTagList * taglist)
taglist2 = gst_tag_list_from_exif_buffer (buf, G_LITTLE_ENDIAN, 0);
gst_buffer_unref (buf);
tag_list_equals (taglist, taglist2);
fail_unless (gst_tag_list_is_equal (taglist, taglist2));
gst_tag_list_free (taglist2);
/* BE */
@ -1403,7 +1342,7 @@ do_exif_tag_serialization_deserialization (GstTagList * taglist)
taglist2 = gst_tag_list_from_exif_buffer (buf, G_BIG_ENDIAN, 0);
gst_buffer_unref (buf);
tag_list_equals (taglist, taglist2);
fail_unless (gst_tag_list_is_equal (taglist, taglist2));
gst_tag_list_free (taglist2);
/* APP1 */
@ -1411,7 +1350,7 @@ do_exif_tag_serialization_deserialization (GstTagList * taglist)
taglist2 = gst_tag_list_from_exif_buffer_with_tiff_header (buf);
gst_buffer_unref (buf);
tag_list_equals (taglist, taglist2);
fail_unless (gst_tag_list_is_equal (taglist, taglist2));
gst_tag_list_free (taglist2);
}
@ -1419,7 +1358,7 @@ static void
do_simple_exif_tag_serialization_deserialization (const gchar * gsttag,
GValue * value)
{
GstTagList *taglist = gst_tag_list_new ();
GstTagList *taglist = gst_tag_list_new_empty ();
gst_tag_list_add_value (taglist, GST_TAG_MERGE_REPLACE, gsttag, value);
do_exif_tag_serialization_deserialization (taglist);
@ -1438,7 +1377,7 @@ GST_START_TEST (test_exif_multiple_tags)
gst_tag_register_musicbrainz_tags ();
taglist = gst_tag_list_new_full (GST_TAG_ARTIST, "artist",
taglist = gst_tag_list_new (GST_TAG_ARTIST, "artist",
GST_TAG_DEVICE_MANUFACTURER, "make",
GST_TAG_DEVICE_MODEL, "model", GST_TAG_GEO_LOCATION_LATITUDE, 45.5,
GST_TAG_GEO_LOCATION_LONGITUDE, -10.25,
@ -1806,22 +1745,22 @@ GST_START_TEST (test_exif_tags_serialization_deserialization)
/* flash is a little bit more tricky, because 2 tags are merged into 1 in
* exif */
taglist = gst_tag_list_new_full (GST_TAG_CAPTURING_FLASH_FIRED, FALSE,
taglist = gst_tag_list_new (GST_TAG_CAPTURING_FLASH_FIRED, FALSE,
GST_TAG_CAPTURING_FLASH_MODE, "auto", NULL);
do_exif_tag_serialization_deserialization (taglist);
gst_tag_list_free (taglist);
taglist = gst_tag_list_new_full (GST_TAG_CAPTURING_FLASH_FIRED, TRUE,
taglist = gst_tag_list_new (GST_TAG_CAPTURING_FLASH_FIRED, TRUE,
GST_TAG_CAPTURING_FLASH_MODE, "auto", NULL);
do_exif_tag_serialization_deserialization (taglist);
gst_tag_list_free (taglist);
taglist = gst_tag_list_new_full (GST_TAG_CAPTURING_FLASH_FIRED, FALSE,
taglist = gst_tag_list_new (GST_TAG_CAPTURING_FLASH_FIRED, FALSE,
GST_TAG_CAPTURING_FLASH_MODE, "never", NULL);
do_exif_tag_serialization_deserialization (taglist);
gst_tag_list_free (taglist);
taglist = gst_tag_list_new_full (GST_TAG_CAPTURING_FLASH_FIRED, TRUE,
taglist = gst_tag_list_new (GST_TAG_CAPTURING_FLASH_FIRED, TRUE,
GST_TAG_CAPTURING_FLASH_MODE, "always", NULL);
do_exif_tag_serialization_deserialization (taglist);
gst_tag_list_free (taglist);

View file

@ -76,65 +76,6 @@ test_element_init (TestElement * this)
{
}
static void
tag_list_equals (GstTagList * taglist, GstTagList * taglist2)
{
const gchar *name_sent, *name_recv;
const GValue *value_sent, *value_recv;
gboolean found;
gint comparison;
gint n_recv;
gint n_sent;
gint i, j;
/* verify tags */
fail_unless (taglist2 != NULL);
n_recv = gst_structure_n_fields (taglist2);
n_sent = gst_structure_n_fields (taglist);
fail_unless (n_recv == n_sent);
fail_unless (n_sent > 0);
/* FIXME: compare taglist values */
for (i = 0; i < n_sent; i++) {
name_sent = gst_structure_nth_field_name (taglist, i);
value_sent = gst_structure_get_value (taglist, name_sent);
found = FALSE;
for (j = 0; j < n_recv; j++) {
name_recv = gst_structure_nth_field_name (taglist2, j);
if (!strcmp (name_sent, name_recv)) {
value_recv = gst_structure_get_value (taglist2, name_recv);
comparison = gst_value_compare (value_sent, value_recv);
if (comparison != GST_VALUE_EQUAL) {
gchar *vs = g_strdup_value_contents (value_sent);
gchar *vr = g_strdup_value_contents (value_recv);
GST_DEBUG ("sent = %s:'%s', recv = %s:'%s'",
G_VALUE_TYPE_NAME (value_sent), vs,
G_VALUE_TYPE_NAME (value_recv), vr);
g_free (vs);
g_free (vr);
}
if (comparison != GST_VALUE_EQUAL &&
G_VALUE_HOLDS (value_sent, G_TYPE_DOUBLE)) {
gdouble vs;
gdouble vr;
/* add some tolerance for doubles */
vs = g_value_get_double (value_sent);
vr = g_value_get_double (value_recv);
if (vr >= vs - 0.001 && vr <= vs + 0.001)
comparison = GST_VALUE_EQUAL;
}
fail_unless (comparison == GST_VALUE_EQUAL,
"tag item %s has been received with different type or value",
name_sent);
found = TRUE;
break;
}
}
fail_unless (found, "tag item %s is lost", name_sent);
}
}
static gboolean
gst_buffer_equals (GstBuffer * buf_a, GstBuffer * buf_b)
{
@ -159,7 +100,7 @@ gst_buffer_equals (GstBuffer * buf_a, GstBuffer * buf_b)
static GstTagList *
create_taglist (void)
{
return gst_tag_list_new_full (GST_TAG_ARTIST, "artist",
return gst_tag_list_new (GST_TAG_ARTIST, "artist",
GST_TAG_TITLE, "title", GST_TAG_COPYRIGHT, "copyright", NULL);
}
@ -213,7 +154,7 @@ GST_START_TEST (test_disable)
GstBuffer *buf;
const gchar *str;
taglist = gst_tag_list_new_full (GST_TAG_ARTIST, "artist", NULL);
taglist = gst_tag_list_new (GST_TAG_ARTIST, "artist", NULL);
/* add a tag that is mapped on xmp schema (as of Mar, 21th 2011) */
gst_tag_list_add (taglist, GST_TAG_MERGE_REPLACE, GST_TAG_USER_RATING, 5,
@ -223,7 +164,7 @@ GST_START_TEST (test_disable)
gst_tag_xmp_writer_tag_list_to_xmp_buffer (GST_TAG_XMP_WRITER
(test_element), taglist, TRUE);
taglist2 = gst_tag_list_from_xmp_buffer (buf);
tag_list_equals (taglist, taglist2);
fail_unless (gst_tag_list_is_equal (taglist, taglist2));
gst_tag_list_free (taglist2);
gst_buffer_unref (buf);