ofa: cleanup

Avoid repeating casting to GstAudioFilter when one will do
Use object related logging to make it easier to get just the logs we want

https://bugzilla.gnome.org/show_bug.cgi?id=656641
This commit is contained in:
Vincent Penquerc'h 2011-08-17 10:55:59 +01:00 committed by Sebastian Dröge
parent 683fbaa81a
commit 6ef56f56d7

View file

@ -115,9 +115,11 @@ static void
create_fingerprint (GstOFA * ofa)
{
GstBuffer *buf;
gint rate = GST_AUDIO_FILTER (ofa)->format.rate;
gint channels = GST_AUDIO_FILTER (ofa)->format.channels;
gint endianness;
GstAudioFilter *ofa_filter = GST_AUDIO_FILTER (ofa);
gint rate = ofa_filter->format.rate;
gint channels = ofa_filter->format.channels;
gint endianness =
ofa_filter->format.bigend ? OFA_BIG_ENDIAN : OFA_LITTLE_ENDIAN;
GstTagList *tags;
guint available;
@ -135,7 +137,7 @@ create_fingerprint (GstOFA * ofa)
endianness = OFA_LITTLE_ENDIAN;
GST_DEBUG ("Generating fingerprint");
GST_DEBUG_OBJECT (ofa, "Generating fingerprint");
buf = gst_adapter_take_buffer (ofa->adapter, available);
@ -143,7 +145,7 @@ create_fingerprint (GstOFA * ofa)
endianness, GST_BUFFER_SIZE (buf) / 2, rate,
(channels == 2) ? 1 : 0));
GST_DEBUG ("Generated fingerprint");
GST_DEBUG_OBJECT (ofa, "Generated fingerprint");
gst_buffer_unref (buf);
@ -165,7 +167,8 @@ gst_ofa_event (GstBaseTransform * trans, GstEvent * event)
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
case GST_EVENT_NEWSEGMENT:
GST_DEBUG ("Got %s event, clearing buffer", GST_EVENT_TYPE_NAME (event));
GST_DEBUG_OBJECT (ofa, "Got %s event, clearing buffer",
GST_EVENT_TYPE_NAME (event));
gst_adapter_clear (ofa->adapter);
ofa->record = TRUE;
g_free (ofa->fingerprint);
@ -200,10 +203,11 @@ static GstFlowReturn
gst_ofa_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
{
GstOFA *ofa = GST_OFA (trans);
GstAudioFilter *ofa_filter = GST_AUDIO_FILTER (ofa);
guint64 nframes;
GstClockTime duration;
gint rate = GST_AUDIO_FILTER (ofa)->format.rate;
gint channels = GST_AUDIO_FILTER (ofa)->format.channels;
gint rate = ofa_filter->format.rate;
gint channels = ofa_filter->format.channels;
g_return_val_if_fail (rate > 0 && channels > 0, GST_FLOW_NOT_NEGOTIATED);