mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-22 00:06:36 +00:00
ext/wavpack/gstwavpackdec.c: Post audio codec and average bitrate tags on bus (#344472).
Original commit message from CVS: Patch by: Sebastian Dröge <slomo at circular-chaos.org> * ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_post_tags), (gst_wavpack_dec_chain): Post audio codec and average bitrate tags on bus (#344472). * ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_base_init), (gst_wavpack_parse_src_query): Forward queries in other formats (BYTE format in particular) upstream; add Sebastian to authors.
This commit is contained in:
parent
a411f9e71a
commit
93ccc87f1d
3 changed files with 50 additions and 4 deletions
14
ChangeLog
14
ChangeLog
|
@ -1,3 +1,16 @@
|
||||||
|
2006-08-24 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
Patch by: Sebastian Dröge <slomo at circular-chaos.org>
|
||||||
|
|
||||||
|
* ext/wavpack/gstwavpackdec.c: (gst_wavpack_dec_post_tags),
|
||||||
|
(gst_wavpack_dec_chain):
|
||||||
|
Post audio codec and average bitrate tags on bus (#344472).
|
||||||
|
|
||||||
|
* ext/wavpack/gstwavpackparse.c: (gst_wavpack_parse_base_init),
|
||||||
|
(gst_wavpack_parse_src_query):
|
||||||
|
Forward queries in other formats (BYTE format in particular)
|
||||||
|
upstream; add Sebastian to authors.
|
||||||
|
|
||||||
2006-08-23 Edgard Lima <edgard.lima@indt.org.br>
|
2006-08-23 Edgard Lima <edgard.lima@indt.org.br>
|
||||||
|
|
||||||
* sys/v4l2/gstv4l2src.c:
|
* sys/v4l2/gstv4l2src.c:
|
||||||
|
@ -6,7 +19,6 @@
|
||||||
Fix set_caps to set width and height to the values the driver is
|
Fix set_caps to set width and height to the values the driver is
|
||||||
really working with.
|
really working with.
|
||||||
|
|
||||||
|
|
||||||
2006-08-23 Tim-Philipp Müller <tim at centricular dot net>
|
2006-08-23 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_push_block):
|
* ext/wavpack/gstwavpackenc.c: (gst_wavpack_enc_push_block):
|
||||||
|
|
|
@ -236,6 +236,33 @@ gst_wavpack_dec_clip_outgoing_buffer (GstWavpackDec * dec, GstBuffer * buf)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_wavpack_dec_post_tags (GstWavpackDec * dec, WavpackHeader * wph)
|
||||||
|
{
|
||||||
|
GstTagList *list;
|
||||||
|
GstFormat format_time = GST_FORMAT_TIME, format_bytes = GST_FORMAT_BYTES;
|
||||||
|
gint64 duration, size;
|
||||||
|
|
||||||
|
list = gst_tag_list_new ();
|
||||||
|
|
||||||
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE,
|
||||||
|
GST_TAG_AUDIO_CODEC, "Wavpack", NULL);
|
||||||
|
|
||||||
|
/* try to estimate the average bitrate */
|
||||||
|
if (gst_pad_query_peer_duration (dec->sinkpad, &format_bytes, &size) &&
|
||||||
|
gst_pad_query_peer_duration (dec->sinkpad, &format_time, &duration) &&
|
||||||
|
size > 0 && duration > 0) {
|
||||||
|
guint64 bitrate;
|
||||||
|
|
||||||
|
bitrate = gst_util_uint64_scale (size, 8 * GST_SECOND, duration);
|
||||||
|
gst_tag_list_add (list, GST_TAG_MERGE_REPLACE, GST_TAG_BITRATE,
|
||||||
|
(guint) bitrate, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
gst_element_post_message (GST_ELEMENT (dec),
|
||||||
|
gst_message_new_tag (GST_OBJECT (dec), list));
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
|
gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
@ -314,6 +341,10 @@ gst_wavpack_dec_chain (GstPad * pad, GstBuffer * buf)
|
||||||
/* should always succeed */
|
/* should always succeed */
|
||||||
gst_pad_set_caps (dec->srcpad, caps);
|
gst_pad_set_caps (dec->srcpad, caps);
|
||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
|
|
||||||
|
/* send GST_TAG_AUDIO_CODEC and GST_TAG_BITRATE tags before something
|
||||||
|
* is decoded or after the format has changed */
|
||||||
|
gst_wavpack_dec_post_tags (dec, &wph);
|
||||||
}
|
}
|
||||||
|
|
||||||
unpacked_size = wph.block_samples * (dec->width / 8) * dec->channels;
|
unpacked_size = wph.block_samples * (dec->width / 8) * dec->channels;
|
||||||
|
|
|
@ -97,7 +97,8 @@ gst_wavpack_parse_base_init (gpointer klass)
|
||||||
GST_ELEMENT_DETAILS ("WavePack parser",
|
GST_ELEMENT_DETAILS ("WavePack parser",
|
||||||
"Codec/Demuxer/Audio",
|
"Codec/Demuxer/Audio",
|
||||||
"Parses Wavpack files",
|
"Parses Wavpack files",
|
||||||
"Arwed v. Merkatz <v.merkatz@gmx.net>");
|
"Arwed v. Merkatz <v.merkatz@gmx.net>, "
|
||||||
|
"Sebastian Dröge <slomo@circular-chaos.org>");
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
gst_element_class_add_pad_template (element_class,
|
||||||
|
@ -292,7 +293,8 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (parse, "cannot handle position query in "
|
GST_DEBUG_OBJECT (parse, "cannot handle position query in "
|
||||||
"%s format", gst_format_get_name (format));
|
"%s format. Forwarding upstream.", gst_format_get_name (format));
|
||||||
|
ret = gst_pad_query_default (pad, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -327,7 +329,8 @@ gst_wavpack_parse_src_query (GstPad * pad, GstQuery * query)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GST_DEBUG_OBJECT (parse, "cannot handle duration query in "
|
GST_DEBUG_OBJECT (parse, "cannot handle duration query in "
|
||||||
"%s format", gst_format_get_name (format));
|
"%s format. Forwarding upstream.", gst_format_get_name (format));
|
||||||
|
ret = gst_pad_query_default (pad, query);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue