tag: Update for taglist/tag event API changes

This commit is contained in:
Sebastian Dröge 2012-07-28 00:19:51 +02:00
parent dd25411161
commit 0827f54b93
19 changed files with 55 additions and 91 deletions

View file

@ -301,9 +301,11 @@ gst_dvdemux_add_pad (GstDVDemux * dvdemux, GstStaticPadTemplate * template)
gst_pad_push_event (pad, gst_event_new_segment (&dvdemux->time_segment)); gst_pad_push_event (pad, gst_event_new_segment (&dvdemux->time_segment));
if (no_more_pads) { if (no_more_pads) {
gst_pad_push_event (pad, GstTagList *tags;
gst_event_new_tag ("GstDemuxer",
gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "DV", NULL))); tags = gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "DV", NULL);
gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
gst_pad_push_event (pad, gst_event_new_tag (tags));
} }
return pad; return pad;

View file

@ -319,7 +319,7 @@ gst_flac_tag_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
id_data, 4, NULL); id_data, 4, NULL);
if (tag->tags != NULL) { if (tag->tags != NULL) {
gst_pad_push_event (tag->srcpad, gst_pad_push_event (tag->srcpad,
gst_event_new_tag ("GstFlacTag", gst_tag_list_copy (tag->tags))); gst_event_new_tag (gst_tag_list_ref (tag->tags)));
} }
gst_buffer_unref (tag->vorbiscomment); gst_buffer_unref (tag->vorbiscomment);

View file

@ -788,8 +788,7 @@ gst_soup_http_src_got_headers_cb (SoupMessage * msg, GstSoupHTTPSrc * src)
if (!gst_tag_list_is_empty (tag_list)) { if (!gst_tag_list_is_empty (tag_list)) {
GST_DEBUG_OBJECT (src, GST_DEBUG_OBJECT (src,
"calling gst_element_found_tags with %" GST_PTR_FORMAT, tag_list); "calling gst_element_found_tags with %" GST_PTR_FORMAT, tag_list);
gst_pad_push_event (GST_BASE_SRC_PAD (src), gst_event_new_tag ("GstSrc", gst_pad_push_event (GST_BASE_SRC_PAD (src), gst_event_new_tag (tag_list));
tag_list));
} else { } else {
gst_tag_list_free (tag_list); gst_tag_list_free (tag_list);
} }

View file

@ -258,9 +258,8 @@ gst_wavpack_dec_post_tags (GstWavpackDec * dec)
bitrate = gst_util_uint64_scale (size, 8 * GST_SECOND, duration); bitrate = gst_util_uint64_scale (size, 8 * GST_SECOND, duration);
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE, gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE,
(guint) bitrate, NULL); (guint) bitrate, NULL);
gst_audio_decoder_merge_tags (GST_AUDIO_DECODER (dec), list,
gst_element_post_message (GST_ELEMENT (dec), GST_TAG_MERGE_REPLACE);
gst_message_new_tag (GST_OBJECT (dec), list));
} }
} }

View file

@ -1632,7 +1632,7 @@ gst_flac_parse_pre_push_frame (GstBaseParse * parse, GstBaseParseFrame * frame)
/* Push tags */ /* Push tags */
if (flacparse->tags) { if (flacparse->tags) {
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse), gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (flacparse),
gst_event_new_tag ("GstParser", flacparse->tags)); gst_event_new_tag (flacparse->tags));
flacparse->tags = NULL; flacparse->tags = NULL;
} }
/* Push toc */ /* Push toc */

View file

@ -1350,7 +1350,7 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
GST_TAG_NOMINAL_BITRATE, mp3parse->hdr_bitrate, NULL); GST_TAG_NOMINAL_BITRATE, mp3parse->hdr_bitrate, NULL);
} }
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse), gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse),
gst_event_new_tag ("GstParser", taglist)); gst_event_new_tag (taglist));
g_free (codec); g_free (codec);
/* also signals the end of first-frame processing */ /* also signals the end of first-frame processing */
@ -1389,7 +1389,7 @@ gst_mpeg_audio_parse_pre_push_frame (GstBaseParse * parse,
/* if the taglist exists, we need to send it */ /* if the taglist exists, we need to send it */
if (taglist) { if (taglist) {
gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse), gst_pad_push_event (GST_BASE_PARSE_SRC_PAD (mp3parse),
gst_event_new_tag ("GstParser", taglist)); gst_event_new_tag (taglist));
} }
/* usual clipping applies */ /* usual clipping applies */

View file

@ -5122,7 +5122,7 @@ push_tag_lists (GstAviDemux * avi)
if (pad && tags) { if (pad && tags) {
GST_DEBUG_OBJECT (pad, "Tags: %" GST_PTR_FORMAT, tags); GST_DEBUG_OBJECT (pad, "Tags: %" GST_PTR_FORMAT, tags);
gst_pad_push_event (pad, gst_event_new_tag ("GstDemuxer", tags)); gst_pad_push_event (pad, gst_event_new_tag (tags));
stream->taglist = NULL; stream->taglist = NULL;
} }
} }
@ -5134,7 +5134,8 @@ push_tag_lists (GstAviDemux * avi)
GST_TAG_CONTAINER_FORMAT, "AVI", NULL); GST_TAG_CONTAINER_FORMAT, "AVI", NULL);
GST_DEBUG_OBJECT (avi, "Global tags: %" GST_PTR_FORMAT, tags); GST_DEBUG_OBJECT (avi, "Global tags: %" GST_PTR_FORMAT, tags);
gst_avi_demux_push_event (avi, gst_event_new_tag ("GstDemuxer", tags)); gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
gst_avi_demux_push_event (avi, gst_event_new_tag (tags));
avi->globaltags = NULL; avi->globaltags = NULL;
avi->got_tags = FALSE; avi->got_tags = FALSE;
} }

View file

@ -177,8 +177,7 @@ static void
gst_avi_subtitle_title_tag (GstAviSubtitle * sub, gchar * title) gst_avi_subtitle_title_tag (GstAviSubtitle * sub, gchar * title)
{ {
gst_pad_push_event (sub->src, gst_pad_push_event (sub->src,
gst_event_new_tag ("GstParser", gst_tag_list_new (GST_TAG_TITLE, title, gst_event_new_tag (gst_tag_list_new (GST_TAG_TITLE, title, NULL)));
NULL)));
} }
static GstFlowReturn static GstFlowReturn

View file

@ -148,7 +148,7 @@ gst_tag_inject_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
if (self->tags && !gst_tag_list_is_empty (self->tags)) { if (self->tags && !gst_tag_list_is_empty (self->tags)) {
GST_DEBUG ("tag event :%" GST_PTR_FORMAT, self->tags); GST_DEBUG ("tag event :%" GST_PTR_FORMAT, self->tags);
gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (trans), gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (trans),
gst_event_new_tag ("GstTagInject", gst_tag_list_copy (self->tags))); gst_event_new_tag (gst_tag_list_ref (self->tags)));
} }
} }

View file

@ -797,8 +797,8 @@ gst_flv_demux_push_tags (GstFlvDemux * demux)
if (demux->taglist) { if (demux->taglist) {
GST_DEBUG_OBJECT (demux, "pushing tags out %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (demux, "pushing tags out %" GST_PTR_FORMAT,
demux->taglist); demux->taglist);
gst_flv_demux_push_src_event (demux, gst_event_new_tag ("GstDemuxer", gst_tag_list_set_scope (demux->taglist, GST_TAG_SCOPE_GLOBAL);
demux->taglist)); gst_flv_demux_push_src_event (demux, gst_event_new_tag (demux->taglist));
demux->taglist = gst_tag_list_new_empty (); demux->taglist = gst_tag_list_new_empty ();
demux->push_tags = FALSE; demux->push_tags = FALSE;
} }

View file

@ -614,10 +614,7 @@ gst_icydemux_send_tag_event (GstICYDemux * icydemux, GstTagList * tags)
{ {
GstEvent *event; GstEvent *event;
gst_element_post_message (GST_ELEMENT (icydemux), event = gst_event_new_tag (tags);
gst_message_new_tag (GST_OBJECT (icydemux), gst_tag_list_copy (tags)));
event = gst_event_new_tag ("GstDemuxer", tags);
GST_EVENT_TIMESTAMP (event) = 0; GST_EVENT_TIMESTAMP (event) = 0;
GST_DEBUG_OBJECT (icydemux, "Sending tag event on src pad"); GST_DEBUG_OBJECT (icydemux, "Sending tag event on src pad");

View file

@ -798,7 +798,7 @@ gst_qtdemux_push_tags (GstQTDemux * qtdemux, QtDemuxStream * stream)
GST_DEBUG_OBJECT (qtdemux, "Sending tags %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (qtdemux, "Sending tags %" GST_PTR_FORMAT,
stream->pending_tags); stream->pending_tags);
gst_pad_push_event (stream->pad, gst_pad_push_event (stream->pad,
gst_event_new_tag ("GstDemuxer", stream->pending_tags)); gst_event_new_tag (stream->pending_tags));
stream->pending_tags = NULL; stream->pending_tags = NULL;
} }
@ -806,8 +806,7 @@ gst_qtdemux_push_tags (GstQTDemux * qtdemux, QtDemuxStream * stream)
GST_DEBUG_OBJECT (qtdemux, "Sending global tags %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (qtdemux, "Sending global tags %" GST_PTR_FORMAT,
qtdemux->tag_list); qtdemux->tag_list);
gst_pad_push_event (stream->pad, gst_pad_push_event (stream->pad,
gst_event_new_tag ("GstDemuxer", gst_event_new_tag (gst_tag_list_ref (qtdemux->tag_list)));
gst_tag_list_copy (qtdemux->tag_list)));
stream->send_global_tags = FALSE; stream->send_global_tags = FALSE;
} }
} }
@ -1883,20 +1882,6 @@ gst_qtdemux_change_state (GstElement * element, GstStateChange transition)
return result; return result;
} }
static void
qtdemux_post_global_tags (GstQTDemux * qtdemux)
{
if (qtdemux->tag_list) {
/* all header tags ready and parsed, push them */
GST_INFO_OBJECT (qtdemux, "posting global tags: %" GST_PTR_FORMAT,
qtdemux->tag_list);
/* post now, send event on pads later */
gst_element_post_message (GST_ELEMENT (qtdemux),
gst_message_new_tag (GST_OBJECT (qtdemux),
gst_tag_list_copy (qtdemux->tag_list)));
}
}
static void static void
qtdemux_parse_ftyp (GstQTDemux * qtdemux, const guint8 * buffer, gint length) qtdemux_parse_ftyp (GstQTDemux * qtdemux, const guint8 * buffer, gint length)
{ {
@ -2814,9 +2799,6 @@ beach:
/* digested all data, show what we have */ /* digested all data, show what we have */
ret = qtdemux_expose_streams (qtdemux); ret = qtdemux_expose_streams (qtdemux);
/* Only post, event on pads is done after newsegment */
qtdemux_post_global_tags (qtdemux);
qtdemux->state = QTDEMUX_STATE_MOVIE; qtdemux->state = QTDEMUX_STATE_MOVIE;
GST_DEBUG_OBJECT (qtdemux, "switching state to STATE_MOVIE (%d)", GST_DEBUG_OBJECT (qtdemux, "switching state to STATE_MOVIE (%d)",
qtdemux->state); qtdemux->state);
@ -4108,10 +4090,6 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
demux->state = QTDEMUX_STATE_MOVIE; demux->state = QTDEMUX_STATE_MOVIE;
demux->neededbytes = next_entry_size (demux); demux->neededbytes = next_entry_size (demux);
demux->mdatleft = size; demux->mdatleft = size;
/* Only post, event on pads is done after newsegment */
qtdemux_post_global_tags (demux);
} else { } else {
/* no headers yet, try to get them */ /* no headers yet, try to get them */
guint bs; guint bs;
@ -4250,10 +4228,6 @@ gst_qtdemux_chain (GstPad * sinkpad, GstObject * parent, GstBuffer * inbuf)
demux->neededbytes = next_entry_size (demux); demux->neededbytes = next_entry_size (demux);
demux->state = QTDEMUX_STATE_MOVIE; demux->state = QTDEMUX_STATE_MOVIE;
demux->mdatleft = gst_adapter_available (demux->adapter); demux->mdatleft = gst_adapter_available (demux->adapter);
/* Only post, event on pads is done after newsegment */
qtdemux_post_global_tags (demux);
} else { } else {
GST_DEBUG_OBJECT (demux, "Carrying on normally"); GST_DEBUG_OBJECT (demux, "Carrying on normally");
gst_adapter_flush (demux->adapter, demux->neededbytes); gst_adapter_flush (demux->adapter, demux->neededbytes);
@ -7761,8 +7735,6 @@ qtdemux_expose_streams (GstQTDemux * qtdemux)
if (qtdemux->n_streams == 1 && qtdemux->streams[0]->redirect_uri != NULL) { if (qtdemux->n_streams == 1 && qtdemux->streams[0]->redirect_uri != NULL) {
GstMessage *m; GstMessage *m;
qtdemux_post_global_tags (qtdemux);
GST_INFO_OBJECT (qtdemux, "Issuing a redirect due to a single track with " GST_INFO_OBJECT (qtdemux, "Issuing a redirect due to a single track with "
"an external content"); "an external content");
m = gst_message_new_element (GST_OBJECT_CAST (qtdemux), m = gst_message_new_element (GST_OBJECT_CAST (qtdemux),
@ -8638,8 +8610,10 @@ qtdemux_parse_udta (GstQTDemux * qtdemux, GNode * udta)
} }
GST_DEBUG_OBJECT (qtdemux, "new tag list"); GST_DEBUG_OBJECT (qtdemux, "new tag list");
if (!qtdemux->tag_list) if (!qtdemux->tag_list) {
qtdemux->tag_list = gst_tag_list_new_empty (); qtdemux->tag_list = gst_tag_list_new_empty ();
gst_tag_list_set_scope (qtdemux->tag_list, GST_TAG_SCOPE_GLOBAL);
}
i = 0; i = 0;
while (i < G_N_ELEMENTS (add_funcs)) { while (i < G_N_ELEMENTS (add_funcs)) {
@ -8856,8 +8830,10 @@ qtdemux_add_container_format (GstQTDemux * qtdemux, GstTagList * tags)
{ {
const gchar *fmt; const gchar *fmt;
if (tags == NULL) if (tags == NULL) {
tags = gst_tag_list_new_empty (); tags = gst_tag_list_new_empty ();
gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
}
if (qtdemux->major_brand == FOURCC_mjp2) if (qtdemux->major_brand == FOURCC_mjp2)
fmt = "Motion JPEG 2000"; fmt = "Motion JPEG 2000";
@ -8934,8 +8910,10 @@ qtdemux_parse_tree (GstQTDemux * qtdemux)
} }
} }
if (datetime) { if (datetime) {
if (!qtdemux->tag_list) if (!qtdemux->tag_list) {
qtdemux->tag_list = gst_tag_list_new_empty (); qtdemux->tag_list = gst_tag_list_new_empty ();
gst_tag_list_set_scope (qtdemux->tag_list, GST_TAG_SCOPE_GLOBAL);
}
/* Use KEEP as explicit tags should have a higher priority than mvhd tag */ /* Use KEEP as explicit tags should have a higher priority than mvhd tag */
gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_KEEP, GST_TAG_DATE_TIME, gst_tag_list_add (qtdemux->tag_list, GST_TAG_MERGE_KEEP, GST_TAG_DATE_TIME,

View file

@ -472,6 +472,7 @@ gst_matroska_demux_reset (GstElement * element)
gst_tag_list_free (demux->common.global_tags); gst_tag_list_free (demux->common.global_tags);
} }
demux->common.global_tags = gst_tag_list_new_empty (); demux->common.global_tags = gst_tag_list_new_empty ();
gst_tag_list_set_scope (demux->common.global_tags, GST_TAG_SCOPE_GLOBAL);
if (demux->common.cached_buffer) { if (demux->common.cached_buffer) {
if (demux->common.cached_data) { if (demux->common.cached_data) {
@ -1492,7 +1493,7 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
GST_PTR_FORMAT, stream->pending_tags, GST_PTR_FORMAT, stream->pending_tags,
GST_DEBUG_PAD_NAME (stream->pad), stream->pending_tags); GST_DEBUG_PAD_NAME (stream->pad), stream->pending_tags);
gst_pad_push_event (stream->pad, gst_pad_push_event (stream->pad,
gst_event_new_tag ("GstDemuxer", stream->pending_tags)); gst_event_new_tag (stream->pending_tags));
stream->pending_tags = NULL; stream->pending_tags = NULL;
} }
} }
@ -1504,7 +1505,7 @@ gst_matroska_demux_send_event (GstMatroskaDemux * demux, GstEvent * event)
GST_DEBUG_OBJECT (demux, "Sending global_tags %p : %" GST_PTR_FORMAT, GST_DEBUG_OBJECT (demux, "Sending global_tags %p : %" GST_PTR_FORMAT,
demux->common.global_tags, demux->common.global_tags); demux->common.global_tags, demux->common.global_tags);
tag_event = gst_event_new_tag ("GstDemuxer", demux->common.global_tags); tag_event = gst_event_new_tag (demux->common.global_tags);
for (i = 0; i < demux->common.src->len; i++) { for (i = 0; i < demux->common.src->len; i++) {
GstMatroskaTrackContext *stream; GstMatroskaTrackContext *stream;

View file

@ -439,7 +439,7 @@ gst_matroska_read_common_found_global_tag (GstMatroskaReadCommon * common,
gst_tag_list_insert (common->global_tags, taglist, GST_TAG_MERGE_APPEND); gst_tag_list_insert (common->global_tags, taglist, GST_TAG_MERGE_APPEND);
gst_tag_list_free (taglist); gst_tag_list_free (taglist);
} else { } else {
GstEvent *tag_event = gst_event_new_tag ("GstDemuxer", taglist); GstEvent *tag_event = gst_event_new_tag (taglist);
gint i; gint i;
/* hm, already sent, no need to cache and wait anymore */ /* hm, already sent, no need to cache and wait anymore */
@ -688,6 +688,7 @@ gst_matroska_read_common_parse_attachments (GstMatroskaReadCommon * common,
} }
taglist = gst_tag_list_new_empty (); taglist = gst_tag_list_new_empty ();
gst_tag_list_set_scope (taglist, GST_TAG_SCOPE_GLOBAL);
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) { while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {
if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK) if ((ret = gst_ebml_peek_id (ebml, &id)) != GST_FLOW_OK)
@ -1701,6 +1702,7 @@ gst_matroska_read_common_parse_info (GstMatroskaReadCommon * common,
GST_DEBUG_OBJECT (common, "Title: %s", GST_STR_NULL (text)); GST_DEBUG_OBJECT (common, "Title: %s", GST_STR_NULL (text));
taglist = gst_tag_list_new (GST_TAG_TITLE, text, NULL); taglist = gst_tag_list_new (GST_TAG_TITLE, text, NULL);
gst_tag_list_set_scope (taglist, GST_TAG_SCOPE_GLOBAL);
gst_matroska_read_common_found_global_tag (common, el, taglist); gst_matroska_read_common_found_global_tag (common, el, taglist);
g_free (text); g_free (text);
break; break;
@ -1971,6 +1973,7 @@ gst_matroska_read_common_parse_metadata (GstMatroskaReadCommon * common,
} }
taglist = gst_tag_list_new_empty (); taglist = gst_tag_list_new_empty ();
gst_tag_list_set_scope (taglist, GST_TAG_SCOPE_GLOBAL);
common->toc_updated = FALSE; common->toc_updated = FALSE;
while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) { while (ret == GST_FLOW_OK && gst_ebml_read_has_remaining (ebml, 1, TRUE)) {

View file

@ -594,8 +594,8 @@ gst_multipart_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
gst_pad_push_event (srcpad->pad, gst_event_new_segment (&segment)); gst_pad_push_event (srcpad->pad, gst_event_new_segment (&segment));
tags = gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "Multipart", NULL); tags = gst_tag_list_new (GST_TAG_CONTAINER_FORMAT, "Multipart", NULL);
gst_pad_push_event (srcpad->pad, gst_event_new_tag ("GstDemuxer", gst_tag_list_set_scope (tags, GST_TAG_SCOPE_GLOBAL);
tags)); gst_pad_push_event (srcpad->pad, gst_event_new_tag (tags));
GST_BUFFER_TIMESTAMP (outbuf) = 0; GST_BUFFER_TIMESTAMP (outbuf) = 0;
} else { } else {

View file

@ -634,11 +634,7 @@ gst_rg_analysis_handle_eos (GstRgAnalysis * filter)
GST_TAG_REFERENCE_LEVEL, filter->reference_level, NULL); GST_TAG_REFERENCE_LEVEL, filter->reference_level, NULL);
/* This steals our reference to the list: */ /* This steals our reference to the list: */
gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (GST_BASE_TRANSFORM gst_pad_push_event (GST_BASE_TRANSFORM_SRC_PAD (GST_BASE_TRANSFORM
(filter)), gst_event_new_tag ("GstAnalysis", (filter)), gst_event_new_tag (gst_tag_list_ref (tag_list)));
gst_tag_list_copy (tag_list)));
/* special case element, also post here */
gst_element_post_message (GST_ELEMENT_CAST (filter),
gst_message_new_tag (GST_OBJECT (filter), tag_list));
} }
} }

View file

@ -2082,8 +2082,7 @@ gst_wavparse_add_src_pad (GstWavParse * wav, GstBuffer * buf)
} }
if (wav->tags) { if (wav->tags) {
gst_pad_push_event (wav->srcpad, gst_event_new_tag ("GstParser", gst_pad_push_event (wav->srcpad, gst_event_new_tag (wav->tags));
wav->tags));
wav->tags = NULL; wav->tags = NULL;
} }
} }

View file

@ -246,7 +246,7 @@ static void
send_tag_event (GstElement * element, GstTagList * tag_list) send_tag_event (GstElement * element, GstTagList * tag_list)
{ {
GstPad *pad = gst_element_get_static_pad (element, "sink"); GstPad *pad = gst_element_get_static_pad (element, "sink");
GstEvent *event = gst_event_new_tag ("test", tag_list); GstEvent *event = gst_event_new_tag (tag_list);
fail_unless (gst_pad_send_event (pad, event), fail_unless (gst_pad_send_event (pad, event),
"Cannot send TAG event: Not handled."); "Cannot send TAG event: Not handled.");

View file

@ -386,7 +386,7 @@ GST_START_TEST (test_events)
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463, GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415, GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
GST_TAG_ARTIST, "Foobar", NULL); GST_TAG_ARTIST, "Foobar", NULL);
event = gst_event_new_tag ("test", tag_list); event = gst_event_new_tag (tag_list);
new_event = send_tag_event (element, event); new_event = send_tag_event (element, event);
gst_event_parse_tag (new_event, &tag_list); gst_event_parse_tag (new_event, &tag_list);
fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_ARTIST, &artist)); fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_ARTIST, &artist));
@ -401,7 +401,7 @@ GST_START_TEST (test_events)
GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463, GST_TAG_TRACK_GAIN, +4.95, GST_TAG_TRACK_PEAK, 0.59463,
GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415, GST_TAG_ALBUM_GAIN, -1.54, GST_TAG_ALBUM_PEAK, 0.693415,
GST_TAG_ARTIST, "Foobar", NULL); GST_TAG_ARTIST, "Foobar", NULL);
event = gst_event_new_tag ("test", tag_list); event = gst_event_new_tag (tag_list);
new_event = send_tag_event (element, event); new_event = send_tag_event (element, event);
gst_event_parse_tag (new_event, &tag_list); gst_event_parse_tag (new_event, &tag_list);
fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_ARTIST, &artist)); fail_unless (gst_tag_list_get_string (tag_list, GST_TAG_ARTIST, &artist));
@ -429,8 +429,7 @@ GST_START_TEST (test_simple)
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL); GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, -9.45); /* pre-amp + track gain */ fail_unless_gain (element, -9.45); /* pre-amp + track gain */
send_eos_event (element); send_eos_event (element);
@ -443,8 +442,7 @@ GST_START_TEST (test_simple)
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, -3.45, GST_TAG_TRACK_PEAK, 1.0,
GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL); GST_TAG_ALBUM_GAIN, +2.09, GST_TAG_ALBUM_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, -3.91); /* pre-amp + album gain */ fail_unless_gain (element, -3.91); /* pre-amp + album gain */
/* Switching back to track mode in the middle of a stream: */ /* Switching back to track mode in the middle of a stream: */
@ -476,8 +474,7 @@ GST_START_TEST (test_fallback_gain)
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, +3.5, GST_TAG_TRACK_PEAK, 1.0, GST_TAG_TRACK_GAIN, +3.5, GST_TAG_TRACK_PEAK, 1.0,
GST_TAG_ALBUM_GAIN, -0.5, GST_TAG_ALBUM_PEAK, 1.0, NULL); GST_TAG_ALBUM_GAIN, -0.5, GST_TAG_ALBUM_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, -2.50); /* pre-amp + track gain */ fail_unless_gain (element, -2.50); /* pre-amp + track gain */
send_eos_event (element); send_eos_event (element);
@ -525,8 +522,7 @@ GST_START_TEST (test_fallback_track)
tag_list = gst_tag_list_new_empty (); tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, +2.11, GST_TAG_TRACK_PEAK, 1.0, NULL); GST_TAG_TRACK_GAIN, +2.11, GST_TAG_TRACK_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, -3.89); /* pre-amp + track gain */ fail_unless_gain (element, -3.89); /* pre-amp + track gain */
send_eos_event (element); send_eos_event (element);
@ -553,8 +549,7 @@ GST_START_TEST (test_fallback_album)
tag_list = gst_tag_list_new_empty (); tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_ALBUM_GAIN, +3.73, GST_TAG_ALBUM_PEAK, 1.0, NULL); GST_TAG_ALBUM_GAIN, +3.73, GST_TAG_ALBUM_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, -2.27); /* pre-amp + album gain */ fail_unless_gain (element, -2.27); /* pre-amp + album gain */
send_eos_event (element); send_eos_event (element);
@ -578,8 +573,7 @@ GST_START_TEST (test_headroom)
tag_list = gst_tag_list_new_empty (); tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, +3.50, GST_TAG_TRACK_PEAK, 1.0, NULL); GST_TAG_TRACK_GAIN, +3.50, GST_TAG_TRACK_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_target_gain (element, +3.50); /* pre-amp + track gain */ fail_unless_target_gain (element, +3.50); /* pre-amp + track gain */
fail_unless_result_gain (element, +0.00); fail_unless_result_gain (element, +0.00);
send_eos_event (element); send_eos_event (element);
@ -591,8 +585,7 @@ GST_START_TEST (test_headroom)
tag_list = gst_tag_list_new_empty (); tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, +9.18, GST_TAG_TRACK_PEAK, 0.687149, NULL); GST_TAG_TRACK_GAIN, +9.18, GST_TAG_TRACK_PEAK, 0.687149, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_target_gain (element, +9.18); /* pre-amp + track gain */ fail_unless_target_gain (element, +9.18); /* pre-amp + track gain */
/* Result is 20. * log10 (1. / peak) + headroom. */ /* Result is 20. * log10 (1. / peak) + headroom. */
fail_unless_result_gain (element, 5.2589816238303335); fail_unless_result_gain (element, 5.2589816238303335);
@ -605,8 +598,7 @@ GST_START_TEST (test_headroom)
tag_list = gst_tag_list_new_empty (); tag_list = gst_tag_list_new_empty ();
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_ALBUM_GAIN, +5.50, GST_TAG_ALBUM_PEAK, 1.0, NULL); GST_TAG_ALBUM_GAIN, +5.50, GST_TAG_ALBUM_PEAK, 1.0, NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_target_gain (element, +5.50); /* pre-amp + album gain */ fail_unless_target_gain (element, +5.50); /* pre-amp + album gain */
fail_unless_result_gain (element, +2.00); /* headroom */ fail_unless_result_gain (element, +2.00); /* headroom */
send_eos_event (element); send_eos_event (element);
@ -632,8 +624,7 @@ GST_START_TEST (test_reference_level)
gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE, gst_tag_list_add (tag_list, GST_TAG_MERGE_REPLACE,
GST_TAG_TRACK_GAIN, 0.00, GST_TAG_TRACK_PEAK, 0.2, GST_TAG_TRACK_GAIN, 0.00, GST_TAG_TRACK_PEAK, 0.2,
GST_TAG_REFERENCE_LEVEL, 83., NULL); GST_TAG_REFERENCE_LEVEL, 83., NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
/* Because our authorative reference is 89 dB, we bump it up by +6 dB. */ /* Because our authorative reference is 89 dB, we bump it up by +6 dB. */
fail_unless_gain (element, +6.00); /* pre-amp + track gain */ fail_unless_gain (element, +6.00); /* pre-amp + track gain */
send_eos_event (element); send_eos_event (element);
@ -649,8 +640,7 @@ GST_START_TEST (test_reference_level)
GST_TAG_TRACK_GAIN, 1.23, GST_TAG_TRACK_PEAK, 0.1, GST_TAG_TRACK_GAIN, 1.23, GST_TAG_TRACK_PEAK, 0.1,
GST_TAG_ALBUM_GAIN, 0.00, GST_TAG_ALBUM_PEAK, 0.2, GST_TAG_ALBUM_GAIN, 0.00, GST_TAG_ALBUM_PEAK, 0.2,
GST_TAG_REFERENCE_LEVEL, 83., NULL); GST_TAG_REFERENCE_LEVEL, 83., NULL);
fail_unless (send_tag_event (element, gst_event_new_tag ("test", fail_unless (send_tag_event (element, gst_event_new_tag (tag_list)) == NULL);
tag_list)) == NULL);
fail_unless_gain (element, +6.00); /* pre-amp + album gain */ fail_unless_gain (element, +6.00); /* pre-amp + album gain */
cleanup_rgvolume (element); cleanup_rgvolume (element);