mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
small fixes
Original commit message from CVS: small fixes
This commit is contained in:
parent
41ff6133d6
commit
2382ecd4cb
1 changed files with 7 additions and 0 deletions
|
@ -104,11 +104,13 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
|
|
||||||
GstCaps *caps = NULL;
|
GstCaps *caps = NULL;
|
||||||
|
|
||||||
|
g_assert (GST_IS_BUFFER (buf));
|
||||||
/* get caps of pad */
|
/* get caps of pad */
|
||||||
caps = GST_PAD_CAPS (pad);
|
caps = GST_PAD_CAPS (pad);
|
||||||
if (caps == NULL)
|
if (caps == NULL)
|
||||||
{
|
{
|
||||||
/* ERROR: could not get caps of pad */
|
/* ERROR: could not get caps of pad */
|
||||||
|
g_error ("gstaudio: warning: could not get caps of pad %p\n", pad);
|
||||||
length = 0.0;
|
length = 0.0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -118,8 +120,13 @@ gst_audio_length (GstPad* pad, GstBuffer* buf)
|
||||||
gst_caps_get_int (caps, "channels", &channels);
|
gst_caps_get_int (caps, "channels", &channels);
|
||||||
gst_caps_get_int (caps, "rate", &rate);
|
gst_caps_get_int (caps, "rate", &rate);
|
||||||
|
|
||||||
|
g_assert (bytes != 0);
|
||||||
|
g_assert (width != 0);
|
||||||
|
g_assert (channels != 0);
|
||||||
|
g_assert (rate != 0);
|
||||||
length = (bytes * 8.0) / (double) (rate * channels * width);
|
length = (bytes * 8.0) / (double) (rate * channels * width);
|
||||||
}
|
}
|
||||||
|
/* g_print ("DEBUG: audio: returning length of %f\n", length); */
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue