+2005-11-21 Thomas Vander Stichele <thomas at apestaart dot org>
+
+ * check/Makefile.am:
+ * gst-libs/gst/audio/audio.c: (gst_audio_duration_from_pad_buffer):
+ * gst-libs/gst/audio/audio.h:
+ add a method that returns a proper GstClockTime
+
2005-11-21 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/interfaces/xoverlay.c: (gst_x_overlay_base_init),
elements/audioconvert \
elements/audioresample \
elements/volume \
+ generic/states \
pipelines/simple_launch_lines \
clocks/selection \
$(check_vorbis)
# tests to fix leaks in
VALGRIND_TO_FIX = \
elements/audioresample \
+ generic/states \
pipelines/simple_launch_lines
# these tests don't even pass
-# generic/states: elements need state fixin' before this can be added
-noinst_PROGRAMS = \
- generic/states
+noinst_PROGRAMS =
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)
return length;
}
+double
+gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf)
+{
+/* calculate length in nanoseconds
+ * of audio buffer buf
+ * based on capabilities of pad
+ */
+
+ long bytes = 0;
+ int width = 0;
+ int channels = 0;
+ int rate = 0;
+
+ GstClockTime length;
+
+ const GstCaps *caps = NULL;
+ GstStructure *structure;
+
+ g_assert (GST_IS_BUFFER (buf));
+ /* get caps of pad */
+ caps = GST_PAD_CAPS (pad);
+ if (caps == NULL) {
+ /* ERROR: could not get caps of pad */
+ g_warning ("gstaudio: could not get caps of pad %s:%s\n",
+ GST_ELEMENT_NAME (gst_pad_get_parent (pad)), GST_PAD_NAME (pad));
+ length = GST_CLOCK_TIME_NONE;
+ } else {
+ structure = gst_caps_get_structure (caps, 0);
+ bytes = GST_BUFFER_SIZE (buf);
+ gst_structure_get_int (structure, "width", &width);
+ gst_structure_get_int (structure, "channels", &channels);
+ gst_structure_get_int (structure, "rate", &rate);
+
+ g_assert (bytes != 0);
+ g_assert (width != 0);
+ g_assert (channels != 0);
+ g_assert (rate != 0);
+ length = (bytes * 8.0 * GST_SECOND) / (rate * channels * width);
+ }
+ /* g_print ("DEBUG: audio: returning length of %f\n", length); */
+ return length;
+}
+
long
gst_audio_highest_sample_value (GstPad * pad)
/* calculate highest possible sample value
/* calculate length in seconds of audio buffer buf based on caps of pad */
double gst_audio_length (GstPad* pad, GstBuffer* buf);
+double gst_audio_duration_from_pad_buffer (GstPad * pad, GstBuffer * buf);
+
/* calculate highest possible sample value based on capabilities of pad */
long gst_audio_highest_sample_value (GstPad* pad);
elements/audioconvert \
elements/audioresample \
elements/volume \
+ generic/states \
pipelines/simple_launch_lines \
clocks/selection \
$(check_vorbis)
# tests to fix leaks in
VALGRIND_TO_FIX = \
elements/audioresample \
+ generic/states \
pipelines/simple_launch_lines
# these tests don't even pass
-# generic/states: elements need state fixin' before this can be added
-noinst_PROGRAMS = \
- generic/states
+noinst_PROGRAMS =
AM_CFLAGS = $(GST_OBJ_CFLAGS) $(GST_CHECK_CFLAGS) $(CHECK_CFLAGS)
LDADD = $(GST_OBJ_LIBS) $(GST_CHECK_LIBS) $(CHECK_LIBS)