Merge branch 'master' into 0.11

Conflicts:
	gst-libs/gst/video/video.h
	gst/playback/gstplaysinkaudioconvert.c
	gst/playback/gstplaysinkvideoconvert.c
	tests/check/libs/rtp.c
This commit is contained in:
Wim Taymans 2011-06-02 12:18:13 +02:00
commit f9967e4aac
26 changed files with 569 additions and 99 deletions

View file

@ -76,6 +76,7 @@ check: check-exports
CRUFT_FILES = \
$(top_builddir)/common/shave \
$(top_builddir)/common/shave-libtool \
$(top_builddir)/gst-libs/gst/audio/testchannels \
$(top_builddir)/tools/gst-discoverer

View file

@ -1004,6 +1004,7 @@ tests/Makefile
tests/check/Makefile
tests/examples/Makefile
tests/examples/app/Makefile
tests/examples/audio/Makefile
tests/examples/dynamic/Makefile
tests/examples/encoding/Makefile
tests/examples/gio/Makefile

View file

@ -1,4 +1,4 @@
libgstaudio_la-multichannel-enumtypes.lo
audio-enumtypes.c
audio-enumtypes.h
testchannels

View file

@ -52,11 +52,6 @@ libgstaudio_@GST_MAJORMINOR@_la_LIBADD = $(GST_BASE_LIBS) $(GST_LIBS) \
$(top_builddir)/gst-libs/gst/interfaces/libgstinterfaces-@GST_MAJORMINOR@.la
libgstaudio_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
noinst_PROGRAMS = testchannels
testchannels_SOURCES = testchannels.c
testchannels_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
testchannels_LDADD = $(GST_LIBS)
include $(top_srcdir)/common/gst-glib-gen.mak
if HAVE_INTROSPECTION

View file

@ -186,11 +186,11 @@ gst_fft_f32_window (GstFFTF32 * self, gfloat * timedata, GstFFTWindow window)
break;
case GST_FFT_WINDOW_HAMMING:
for (i = 0; i < len; i++)
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_HANN:
for (i = 0; i < len; i++)
timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.5 - 0.5 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_BARTLETT:
for (i = 0; i < len; i++)

View file

@ -186,11 +186,11 @@ gst_fft_f64_window (GstFFTF64 * self, gdouble * timedata, GstFFTWindow window)
break;
case GST_FFT_WINDOW_HAMMING:
for (i = 0; i < len; i++)
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_HANN:
for (i = 0; i < len; i++)
timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.5 - 0.5 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_BARTLETT:
for (i = 0; i < len; i++)

View file

@ -186,11 +186,11 @@ gst_fft_s16_window (GstFFTS16 * self, gint16 * timedata, GstFFTWindow window)
break;
case GST_FFT_WINDOW_HAMMING:
for (i = 0; i < len; i++)
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_HANN:
for (i = 0; i < len; i++)
timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.5 - 0.5 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_BARTLETT:
for (i = 0; i < len; i++)

View file

@ -185,11 +185,11 @@ gst_fft_s32_window (GstFFTS32 * self, gint32 * timedata, GstFFTWindow window)
break;
case GST_FFT_WINDOW_HAMMING:
for (i = 0; i < len; i++)
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.53836 - 0.46164 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_HANN:
for (i = 0; i < len; i++)
timedata[i] *= (0.5 - 0.5 * cos (2.0 * M_PI * i / len));
timedata[i] *= (0.5 - 0.5 * cos (2.0 * G_PI * i / len));
break;
case GST_FFT_WINDOW_BARTLETT:
for (i = 0; i < len; i++)

View file

@ -436,67 +436,137 @@ typedef enum {
#define GST_VIDEO_BUFFER_PROGRESSIVE GST_BUFFER_FLAG_MEDIA4
/* functions */
const GValue *gst_video_frame_rate (GstPad *pad);
gboolean gst_video_get_size (GstPad *pad,
gint *width,
gint *height);
const GValue * gst_video_frame_rate (GstPad * pad);
gboolean gst_video_calculate_display_ratio (guint *dar_n, guint *dar_d,
guint video_width, guint video_height,
guint video_par_n, guint video_par_d,
guint display_par_n, guint display_par_d);
gboolean gst_video_get_size (GstPad * pad,
gint * width,
gint * height);
gboolean gst_video_format_parse_caps (const GstCaps *caps,
GstVideoFormat *format, int *width, int *height);
gboolean gst_video_format_parse_caps_interlaced (GstCaps *caps, gboolean *interlaced);
gboolean gst_video_parse_caps_framerate (GstCaps *caps,
int *fps_n, int *fps_d);
gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps *caps,
int *par_n, int *par_d);
const char *gst_video_parse_caps_color_matrix (GstCaps * caps);
const char *gst_video_parse_caps_chroma_site (GstCaps * caps);
GstBuffer *gst_video_parse_caps_palette (GstCaps * caps);
GstCaps * gst_video_format_new_caps (GstVideoFormat format,
int width, int height, int framerate_n, int framerate_d,
int par_n, int par_d);
GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format,
int width, int height, int framerate_n, int framerate_d,
int par_n, int par_d, gboolean interlaced);
GstCaps * gst_video_format_new_template_caps (GstVideoFormat format);
GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc);
guint32 gst_video_format_to_fourcc (GstVideoFormat format);
gboolean gst_video_format_is_rgb (GstVideoFormat format);
gboolean gst_video_format_is_yuv (GstVideoFormat format);
gboolean gst_video_format_is_gray (GstVideoFormat format);
gboolean gst_video_format_has_alpha (GstVideoFormat format);
int gst_video_format_get_component_depth (GstVideoFormat format, int component);
int gst_video_format_get_row_stride (GstVideoFormat format, int component,
int width);
int gst_video_format_get_pixel_stride (GstVideoFormat format, int component);
int gst_video_format_get_component_width (GstVideoFormat format, int component,
int width);
int gst_video_format_get_component_height (GstVideoFormat format, int component,
int height);
int gst_video_format_get_component_offset (GstVideoFormat format, int component,
int width, int height);
int gst_video_format_get_size (GstVideoFormat format, int width, int height);
gboolean gst_video_get_size_from_caps (const GstCaps * caps, gint * size);
gboolean gst_video_format_convert (GstVideoFormat format, int width, int height,
int fps_n, int fps_d,
GstFormat src_format, gint64 src_value,
GstFormat dest_format, gint64 * dest_value);
gboolean gst_video_calculate_display_ratio (guint * dar_n,
guint * dar_d,
guint video_width,
guint video_height,
guint video_par_n,
guint video_par_d,
guint display_par_n,
guint display_par_d);
GstEvent *gst_video_event_new_still_frame (gboolean in_still);
gboolean gst_video_event_parse_still_frame (GstEvent *event, gboolean *in_still);
gboolean gst_video_format_parse_caps (const GstCaps * caps,
GstVideoFormat * format,
int * width,
int * height);
GstBuffer *gst_video_convert_frame(GstBuffer *buf, GstCaps *from_caps, const GstCaps *to_caps,
GstClockTime timeout, GError **error);
gboolean gst_video_format_parse_caps_interlaced (GstCaps * caps,
gboolean * interlaced);
typedef void (*GstVideoConvertFrameCallback) (GstBuffer *buf, GError *error, gpointer user_data);
void gst_video_convert_frame_async(GstBuffer *buf, GstCaps *from_caps, const GstCaps *to_caps,
GstClockTime timeout, GstVideoConvertFrameCallback callback,
gpointer user_data, GDestroyNotify destroy_notify);
gboolean gst_video_parse_caps_pixel_aspect_ratio (GstCaps * caps,
int * par_n,
int * par_d);
gboolean gst_video_parse_caps_framerate (GstCaps * caps,
int * fps_n,
int * fps_d);
const char * gst_video_parse_caps_color_matrix (GstCaps * caps);
const char * gst_video_parse_caps_chroma_site (GstCaps * caps);
GstBuffer * gst_video_parse_caps_palette (GstCaps * caps);
/* create caps given format and details */
GstCaps * gst_video_format_new_caps (GstVideoFormat format,
int width, int height,
int framerate_n,
int framerate_d,
int par_n, int par_d);
GstCaps * gst_video_format_new_caps_interlaced (GstVideoFormat format,
int width, int height,
int framerate_n,
int framerate_d,
int par_n, int par_d,
gboolean interlaced);
GstCaps * gst_video_format_new_template_caps (GstVideoFormat format);
/* format properties */
GstVideoFormat gst_video_format_from_fourcc (guint32 fourcc) G_GNUC_CONST;
guint32 gst_video_format_to_fourcc (GstVideoFormat format) G_GNUC_CONST;
gboolean gst_video_format_is_rgb (GstVideoFormat format) G_GNUC_CONST;
gboolean gst_video_format_is_yuv (GstVideoFormat format) G_GNUC_CONST;
gboolean gst_video_format_is_gray (GstVideoFormat format) G_GNUC_CONST;
gboolean gst_video_format_has_alpha (GstVideoFormat format) G_GNUC_CONST;
int gst_video_format_get_component_depth (GstVideoFormat format,
int component) G_GNUC_CONST;
int gst_video_format_get_row_stride (GstVideoFormat format,
int component,
int width) G_GNUC_CONST;
int gst_video_format_get_pixel_stride (GstVideoFormat format,
int component) G_GNUC_CONST;
int gst_video_format_get_component_width (GstVideoFormat format,
int component,
int width) G_GNUC_CONST;
int gst_video_format_get_component_height (GstVideoFormat format,
int component,
int height) G_GNUC_CONST;
int gst_video_format_get_component_offset (GstVideoFormat format,
int component,
int width,
int height) G_GNUC_CONST;
int gst_video_format_get_size (GstVideoFormat format,
int width,
int height) G_GNUC_CONST;
gboolean gst_video_get_size_from_caps (const GstCaps * caps, gint * size);
gboolean gst_video_format_convert (GstVideoFormat format,
int width,
int height,
int fps_n,
int fps_d,
GstFormat src_format,
gint64 src_value,
GstFormat dest_format,
gint64 * dest_value);
/* video still frame event creation and parsing */
GstEvent * gst_video_event_new_still_frame (gboolean in_still);
gboolean gst_video_event_parse_still_frame (GstEvent * event, gboolean * in_still);
/* convert/encode video frame from one format to another */
typedef void (*GstVideoConvertFrameCallback) (GstBuffer * buf, GError *error, gpointer user_data);
void gst_video_convert_frame_async (GstBuffer * buf,
const GstCaps * to_caps,
GstClockTime timeout,
GstVideoConvertFrameCallback callback,
gpointer user_data,
GDestroyNotify destroy_notify);
GstBuffer * gst_video_convert_frame (GstBuffer * buf,
const GstCaps * to_caps,
GstClockTime timeout,
GError ** error);
G_END_DECLS
#endif /* __GST_VIDEO_H__ */

View file

@ -63,12 +63,12 @@
/* the volume factor is a range from 0.0 to (arbitrary) VOLUME_MAX_DOUBLE = 10.0
* we map 1.0 to VOLUME_UNITY_INT*
*/
#define VOLUME_UNITY_INT8 32 /* internal int for unity 2^(8-3) */
#define VOLUME_UNITY_INT8_BIT_SHIFT 5 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT16 8192 /* internal int for unity 2^(16-3) */
#define VOLUME_UNITY_INT16_BIT_SHIFT 13 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT24 2097152 /* internal int for unity 2^(24-3) */
#define VOLUME_UNITY_INT24_BIT_SHIFT 21 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT8 8 /* internal int for unity 2^(8-5) */
#define VOLUME_UNITY_INT8_BIT_SHIFT 3 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT16 2048 /* internal int for unity 2^(16-5) */
#define VOLUME_UNITY_INT16_BIT_SHIFT 11 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT24 524288 /* internal int for unity 2^(24-5) */
#define VOLUME_UNITY_INT24_BIT_SHIFT 19 /* number of bits to shift for unity */
#define VOLUME_UNITY_INT32 134217728 /* internal int for unity 2^(32-5) */
#define VOLUME_UNITY_INT32_BIT_SHIFT 27
#define VOLUME_MAX_DOUBLE 10.0
@ -677,7 +677,7 @@ volume_process_int16 (GstVolume * self, gpointer bytes, guint n_bytes)
guint num_samples = n_bytes / sizeof (gint16);
/* hard coded in volume.orc */
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 13);
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 11);
orc_process_int16 (data, self->current_vol_i16, num_samples);
}
@ -689,7 +689,7 @@ volume_process_int16_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
guint num_samples = n_bytes / sizeof (gint16);
/* hard coded in volume.orc */
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 13);
g_assert (VOLUME_UNITY_INT16_BIT_SHIFT == 11);
orc_process_int16_clamp (data, self->current_vol_i16, num_samples);
}
@ -725,7 +725,7 @@ volume_process_int8 (GstVolume * self, gpointer bytes, guint n_bytes)
guint num_samples = n_bytes / sizeof (gint8);
/* hard coded in volume.orc */
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 5);
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 3);
orc_process_int8 (data, self->current_vol_i8, num_samples);
}
@ -737,7 +737,7 @@ volume_process_int8_clamp (GstVolume * self, gpointer bytes, guint n_bytes)
guint num_samples = n_bytes / sizeof (gint8);
/* hard coded in volume.orc */
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 5);
g_assert (VOLUME_UNITY_INT8_BIT_SHIFT == 3);
orc_process_int8_clamp (data, self->current_vol_i8, num_samples);
}

View file

@ -37,7 +37,7 @@ convsssql d1, t1
.temp 4 t1
mulswl t1, d1, p1
shrsl t1, t1, 13
shrsl t1, t1, 11
convlw d1, t1
@ -47,7 +47,7 @@ convlw d1, t1
.temp 4 t1
mulswl t1, d1, p1
shrsl t1, t1, 13
shrsl t1, t1, 11
convssslw d1, t1
.function orc_process_int8
@ -56,7 +56,7 @@ convssslw d1, t1
.temp 2 t1
mulsbw t1, d1, p1
shrsw t1, t1, 5
shrsw t1, t1, 3
convwb d1, t1
@ -66,7 +66,7 @@ convwb d1, t1
.temp 2 t1
mulsbw t1, d1, p1
shrsw t1, t1, 5
shrsw t1, t1, 3
convssswb d1, t1
.function orc_memset_f64

View file

@ -172,6 +172,7 @@ VALGRIND_TO_FIX = \
noinst_PROGRAMS = $(check_libvisual)
noinst_HEADERS = \
libs/struct_arm.h \
libs/struct_i386.h \
libs/struct_i386_osx.h \
libs/struct_x86_64.h

View file

@ -26,4 +26,5 @@ videoscale
vorbistag
playbin
playbin2
playbin2-compressed
subparse

View file

@ -573,7 +573,6 @@ GST_START_TEST (test_add_pad)
GstElement *bin, *src1, *src2, *adder, *sink;
GstBus *bus;
GstPad *srcpad;
GstStreamConsistency *consist;
gboolean res;
GST_INFO ("preparing test");
@ -600,7 +599,6 @@ GST_START_TEST (test_add_pad)
fail_unless (res == TRUE, NULL);
srcpad = gst_element_get_static_pad (adder, "src");
consist = gst_consistency_checker_new (srcpad);
gst_object_unref (srcpad);
main_loop = g_main_loop_new (NULL, FALSE);
@ -656,7 +654,6 @@ GST_START_TEST (test_remove_pad)
GstBus *bus;
GstPad *pad, *srcpad;
gboolean res;
GstStreamConsistency *consist;
GST_INFO ("preparing test");
@ -682,7 +679,6 @@ GST_START_TEST (test_remove_pad)
fail_if (pad == NULL, NULL);
srcpad = gst_element_get_static_pad (adder, "src");
consist = gst_consistency_checker_new (srcpad);
gst_object_unref (srcpad);
main_loop = g_main_loop_new (NULL, FALSE);

View file

@ -174,7 +174,7 @@ check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
guint32 b_mask, guint32 a_mask, guint8 r_expected, guint8 g_expected,
guint8 b_expected, guint endianness, guint bpp, guint depth)
{
guint32 pixel, red, green, blue, alpha;
guint32 pixel, red, green, blue;
switch (bpp) {
case 32:{
@ -210,7 +210,7 @@ check_rgb_buf (const guint8 * pixels, guint32 r_mask, guint32 g_mask,
red = right_shift_colour (r_mask, pixel);
green = right_shift_colour (g_mask, pixel);
blue = right_shift_colour (b_mask, pixel);
alpha = right_shift_colour (a_mask, pixel);
/* alpha = right_shift_colour (a_mask, pixel); */
/* can't enable this by default, valgrind will complain about accessing
* uninitialised memory for the depth=24,bpp=32 formats ... */

View file

@ -313,6 +313,53 @@ GST_START_TEST (test_double_s8)
GST_END_TEST;
GST_START_TEST (test_ten_s8)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gint8 in[2] = { 64, -10 };
gint8 out[2] = { 127, -100 }; /* notice the clamped sample */
gint8 *res;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (2);
memcpy (GST_BUFFER_DATA (inbuffer), in, 2);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 2) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S8);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = (gint8 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 2) == 0);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_s8)
{
GstElement *volume;
@ -496,6 +543,53 @@ GST_START_TEST (test_double_s16)
GST_END_TEST;
GST_START_TEST (test_ten_s16)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gint16 in[2] = { 16384, -10 };
gint16 out[2] = { 32767, -100 }; /* notice the clamped sample */
gint16 *res;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (4);
memcpy (GST_BUFFER_DATA (inbuffer), in, 4);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 4) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S16);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = (gint16 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 4) == 0);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_s16)
{
@ -716,6 +810,61 @@ GST_START_TEST (test_double_s24)
GST_END_TEST;
GST_START_TEST (test_ten_s24)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gint32 in_32[2] = { 4194304, -10 };
guint8 in[6];
guint8 *res;
gint32 res_32[2];
gint32 out_32[2] = { 8388607, -100 }; /* notice the clamped sample */
write_unaligned_u24 (in, in_32[0]);
write_unaligned_u24 (in + 3, in_32[1]);
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (6);
memcpy (GST_BUFFER_DATA (inbuffer), in, 6);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 6) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S24);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = GST_BUFFER_DATA (outbuffer);
res_32[0] = get_unaligned_i24 (res);
res_32[1] = get_unaligned_i24 ((res + 3));
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out_32[0], out_32[1],
res_32[0], res_32[1]);
fail_unless (memcmp (res_32, out_32, 8) == 0);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_s24)
{
@ -910,6 +1059,52 @@ GST_START_TEST (test_double_s32)
GST_END_TEST;
GST_START_TEST (test_ten_s32)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gint32 in[2] = { 1073741824, -10 };
gint32 out[2] = { 2147483647, -100 }; /* notice the clamped sample */
gint32 *res;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_S32);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = (gint32 *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+5d %+5d real %+5d %+5d", out[0], out[1], res[0],
res[1]);
fail_unless (memcmp (GST_BUFFER_DATA (outbuffer), out, 8) == 0);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_s32)
{
@ -1097,6 +1292,54 @@ GST_START_TEST (test_double_f32)
GST_END_TEST;
GST_START_TEST (test_ten_f32)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gfloat in[2] = { 0.75, -0.25 };
gfloat out[2] = { 7.5, -2.5 }; /* nothing is clamped */
gfloat *res;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (8);
memcpy (GST_BUFFER_DATA (inbuffer), in, 8);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 8) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F32);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = (gfloat *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
res[0], res[1]);
fail_unless_equals_float (res[0], out[0]);
fail_unless_equals_float (res[1], out[1]);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_f32)
{
@ -1285,6 +1528,54 @@ GST_START_TEST (test_double_f64)
GST_END_TEST;
GST_START_TEST (test_ten_f64)
{
GstElement *volume;
GstBuffer *inbuffer;
GstBuffer *outbuffer;
GstCaps *caps;
gdouble in[2] = { 0.75, -0.25 };
gdouble out[2] = { 7.5, -2.5 }; /* nothing is clamped */
gdouble *res;
volume = setup_volume ();
g_object_set (G_OBJECT (volume), "volume", 10.0, NULL);
fail_unless (gst_element_set_state (volume,
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
"could not set to playing");
inbuffer = gst_buffer_new_and_alloc (16);
memcpy (GST_BUFFER_DATA (inbuffer), in, 16);
fail_unless (memcmp (GST_BUFFER_DATA (inbuffer), in, 16) == 0);
caps = gst_caps_from_string (VOLUME_CAPS_STRING_F64);
gst_buffer_set_caps (inbuffer, caps);
gst_caps_unref (caps);
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
/* FIXME: reffing the inbuffer should make the transformation not be
* inplace
gst_buffer_ref (inbuffer);
*/
/* pushing gives away my reference ... */
fail_unless (gst_pad_push (mysrcpad, inbuffer) == GST_FLOW_OK);
/* ... but it ends up being modified inplace and
* collected on the global buffer list */
ASSERT_BUFFER_REFCOUNT (inbuffer, "inbuffer", 1);
fail_unless_equals_int (g_list_length (buffers), 1);
fail_if ((outbuffer = (GstBuffer *) buffers->data) == NULL);
fail_unless (inbuffer == outbuffer);
res = (gdouble *) GST_BUFFER_DATA (outbuffer);
GST_INFO ("expected %+1.4f %+1.4f real %+1.4f %+1.4f", out[0], out[1],
res[0], res[1]);
fail_unless_equals_float (res[0], out[0]);
fail_unless_equals_float (res[1], out[1]);
/* cleanup */
cleanup_volume (volume);
}
GST_END_TEST;
GST_START_TEST (test_mute_f64)
{
@ -1524,26 +1815,32 @@ volume_suite (void)
tcase_add_test (tc_chain, test_unity_s8);
tcase_add_test (tc_chain, test_half_s8);
tcase_add_test (tc_chain, test_double_s8);
tcase_add_test (tc_chain, test_ten_s8);
tcase_add_test (tc_chain, test_mute_s8);
tcase_add_test (tc_chain, test_unity_s16);
tcase_add_test (tc_chain, test_half_s16);
tcase_add_test (tc_chain, test_double_s16);
tcase_add_test (tc_chain, test_ten_s16);
tcase_add_test (tc_chain, test_mute_s16);
tcase_add_test (tc_chain, test_unity_s24);
tcase_add_test (tc_chain, test_half_s24);
tcase_add_test (tc_chain, test_double_s24);
tcase_add_test (tc_chain, test_ten_s24);
tcase_add_test (tc_chain, test_mute_s24);
tcase_add_test (tc_chain, test_unity_s32);
tcase_add_test (tc_chain, test_half_s32);
tcase_add_test (tc_chain, test_double_s32);
tcase_add_test (tc_chain, test_ten_s32);
tcase_add_test (tc_chain, test_mute_s32);
tcase_add_test (tc_chain, test_unity_f32);
tcase_add_test (tc_chain, test_half_f32);
tcase_add_test (tc_chain, test_double_f32);
tcase_add_test (tc_chain, test_ten_f32);
tcase_add_test (tc_chain, test_mute_f32);
tcase_add_test (tc_chain, test_unity_f64);
tcase_add_test (tc_chain, test_half_f64);
tcase_add_test (tc_chain, test_double_f64);
tcase_add_test (tc_chain, test_ten_f64);
tcase_add_test (tc_chain, test_mute_f64);
tcase_add_test (tc_chain, test_wrong_caps);
tcase_add_test (tc_chain, test_passthrough);

View file

@ -204,7 +204,7 @@ _create_audio_buffer (void)
{
GstBuffer *buffer;
ogg_packet packet;
float **vorbis_buffer;
float **vorbis_buffer G_GNUC_UNUSED;
vorbis_buffer = vorbis_analysis_buffer (&vd, 0);
vorbis_analysis_wrote (&vd, 0);

View file

@ -92,11 +92,16 @@
#include "struct_x86_64.h"
#define HAVE_ABI_SIZES TRUE
#else
#ifdef HAVE_CPU_ARM
#include "struct_arm.h"
#define HAVE_ABI_SIZES TRUE
#else
/* in case someone wants to generate a new arch */
#include "struct_i386.h"
#define HAVE_ABI_SIZES FALSE
#endif
#endif
#endif
/* disabled for 0.11 */
#undef HAVE_ABI_SIZES

View file

@ -674,14 +674,11 @@ GST_START_TEST (test_rtcp_buffer)
{
GstBuffer *buf;
GstRTCPPacket packet;
guint8 *data;
gsize size;
GstRTCPBuffer rtcp = { NULL, };
buf = gst_rtcp_buffer_new (1400);
fail_unless (buf != NULL);
data = gst_buffer_map (buf, &size, NULL, GST_MAP_READ);
fail_unless_equals_int (size, 1400);
fail_unless_equals_int (gst_buffer_get_size (buf), 1400);
gst_rtcp_buffer_map (buf, GST_MAP_READWRITE, &rtcp);

View file

@ -0,0 +1,100 @@
GstCheckABIStruct list[] = {
{"GstAppBufferClass", sizeof (GstAppBufferClass), 16},
{"GstAppBuffer", sizeof (GstAppBuffer), 96},
{"GstAppSinkCallbacks", sizeof (GstAppSinkCallbacks), 28},
{"GstAppSinkClass", sizeof (GstAppSinkClass), 404},
{"GstAppSink", sizeof (GstAppSink), 432},
{"GstAppSrcCallbacks", sizeof (GstAppSrcCallbacks), 28},
{"GstAppSrcClass", sizeof (GstAppSrcClass), 412},
{"GstAppSrc", sizeof (GstAppSrc), 416},
{"GstAudioClockClass", sizeof (GstAudioClockClass), 192},
{"GstAudioClock", sizeof (GstAudioClock), 232},
{"GstAudioFilterClass", sizeof (GstAudioFilterClass), 396},
{"GstAudioFilter", sizeof (GstAudioFilter), 504},
{"GstAudioSinkClass", sizeof (GstAudioSinkClass), 432},
{"GstAudioSink", sizeof (GstAudioSink), 488},
{"GstAudioSrcClass", sizeof (GstAudioSrcClass), 460},
{"GstAudioSrc", sizeof (GstAudioSrc), 488},
{"GstBaseAudioSinkClass", sizeof (GstBaseAudioSinkClass), 388},
{"GstBaseAudioSink", sizeof (GstBaseAudioSink), 464},
{"GstBaseAudioSrcClass", sizeof (GstBaseAudioSrcClass), 416},
{"GstBaseAudioSrc", sizeof (GstBaseAudioSrc), 464},
{"GstBaseRTPAudioPayloadClass", sizeof (GstBaseRTPAudioPayloadClass), 288},
{"GstBaseRTPAudioPayload", sizeof (GstBaseRTPAudioPayload), 384},
{"GstBaseRTPDepayloadClass", sizeof (GstBaseRTPDepayloadClass), 280},
{"GstBaseRTPDepayload", sizeof (GstBaseRTPDepayload), 328},
{"GstBaseRTPPayloadClass", sizeof (GstBaseRTPPayloadClass), 272},
{"GstBaseRTPPayload", sizeof (GstBaseRTPPayload), 336},
{"GstCddaBaseSrcClass", sizeof (GstCddaBaseSrcClass), 432},
{"GstCddaBaseSrc", sizeof (GstCddaBaseSrc), 528},
{"GstCddaBaseSrcTrack", sizeof (GstCddaBaseSrcTrack), 36},
{"GstColorBalanceChannelClass", sizeof (GstColorBalanceChannelClass), 88},
{"GstColorBalanceChannel", sizeof (GstColorBalanceChannel), 24},
{"GstColorBalanceClass", sizeof (GstColorBalanceClass), 44},
{"GstDiscovererClass", sizeof (GstDiscovererClass), 96},
{"GstDiscoverer", sizeof (GstDiscoverer), 32},
{"GstFFTF32Complex", sizeof (GstFFTF32Complex), 8},
{"GstFFTF32", sizeof (GstFFTF32), 28},
{"GstFFTF64Complex", sizeof (GstFFTF64Complex), 16},
{"GstFFTF64", sizeof (GstFFTF64), 28},
{"GstFFTS16Complex", sizeof (GstFFTS16Complex), 4},
{"GstFFTS16", sizeof (GstFFTS16), 28},
{"GstFFTS32Complex", sizeof (GstFFTS32Complex), 8},
{"GstFFTS32", sizeof (GstFFTS32), 28},
{"GstMixerClass", sizeof (GstMixerClass), 72},
{"GstMixerOptionsClass", sizeof (GstMixerOptionsClass), 100},
{"GstMixerOptions", sizeof (GstMixerOptions), 52},
{"GstMixerTrackClass", sizeof (GstMixerTrackClass), 84},
{"GstMixerTrack", sizeof (GstMixerTrack), 32},
{"GstNavigationInterface", sizeof (GstNavigationInterface), 28},
{"GstNetAddress", sizeof (GstNetAddress), 40},
{"GstNetBufferClass", sizeof (GstNetBufferClass), 32},
{"GstNetBuffer", sizeof (GstNetBuffer), 184},
{"GstPropertyProbeInterface", sizeof (GstPropertyProbeInterface), 44},
{"gst_riff_acid", sizeof (gst_riff_acid), 24},
{"gst_riff_dmlh", sizeof (gst_riff_dmlh), 4},
{"gst_riff_index_entry", sizeof (gst_riff_index_entry), 16},
{"gst_riff_strf_auds", sizeof (gst_riff_strf_auds), 16},
{"gst_riff_strf_iavs", sizeof (gst_riff_strf_iavs), 32},
{"gst_riff_strf_vids", sizeof (gst_riff_strf_vids), 40},
{"gst_riff_strh", sizeof (gst_riff_strh), 48},
{"GstRingBufferClass", sizeof (GstRingBufferClass), 172},
{"GstRingBuffer", sizeof (GstRingBuffer), 232},
{"GstRingBufferSpec", sizeof (GstRingBufferSpec), 120},
{"GstRTCPPacket", sizeof (GstRTCPPacket), 36},
{"GstRTPPayloadInfo", sizeof (GstRTPPayloadInfo), 24},
{"GstRTSPExtensionInterface", sizeof (GstRTSPExtensionInterface), 60},
{"GstRTSPMessage", sizeof (GstRTSPMessage), 28},
{"GstRTSPRange", sizeof (GstRTSPRange), 8},
{"GstRTSPTime", sizeof (GstRTSPTime), 16},
{"GstRTSPTimeRange", sizeof (GstRTSPTimeRange), 40},
{"GstRTSPTransport", sizeof (GstRTSPTransport), 76},
{"GstRTSPUrl", sizeof (GstRTSPUrl), 32},
{"GstRTSPWatchFuncs", sizeof (GstRTSPWatchFuncs), 40},
{"GstSDPAttribute", sizeof (GstSDPAttribute), 8},
{"GstSDPBandwidth", sizeof (GstSDPBandwidth), 8},
{"GstSDPConnection", sizeof (GstSDPConnection), 20},
{"GstSDPKey", sizeof (GstSDPKey), 8},
{"GstSDPMedia", sizeof (GstSDPMedia), 44},
{"GstSDPMessage", sizeof (GstSDPMessage), 96},
{"GstSDPOrigin", sizeof (GstSDPOrigin), 24},
{"GstSDPTime", sizeof (GstSDPTime), 12},
{"GstSDPZone", sizeof (GstSDPZone), 8},
{"GstStreamVolumeInterface", sizeof (GstStreamVolumeInterface), 24},
{"GstTagDemuxClass", sizeof (GstTagDemuxClass), 284},
{"GstTagDemux", sizeof (GstTagDemux), 160},
{"GstTunerChannelClass", sizeof (GstTunerChannelClass), 92},
{"GstTunerChannel", sizeof (GstTunerChannel), 40},
{"GstTunerClass", sizeof (GstTunerClass), 76},
{"GstTunerNormClass", sizeof (GstTunerNormClass), 84},
{"GstTunerNorm", sizeof (GstTunerNorm), 40},
{"GstVideoFilterClass", sizeof (GstVideoFilterClass), 376},
{"GstVideoFilter", sizeof (GstVideoFilter), 376},
{"GstVideoOrientationInterface", sizeof (GstVideoOrientationInterface), 56},
{"GstVideoRectangle", sizeof (GstVideoRectangle), 16},
{"GstVideoSinkClass", sizeof (GstVideoSinkClass), 384},
{"GstVideoSink", sizeof (GstVideoSink), 432},
{"GstXOverlayClass", sizeof (GstXOverlayClass), 32},
{NULL, 0, 0}
};

View file

@ -272,7 +272,6 @@ GST_START_TEST (test_continuity)
{
GstClockTime next_timestamp;
gint64 last_granulepos;
/* first buffer should have timestamp of TIMESTAMP_OFFSET, granulepos to
* match the timestamp of the end of the last sample in the output buffer.
@ -281,7 +280,6 @@ GST_START_TEST (test_continuity)
* take care to timestamp correctly based on the offset of the input data
* however, so it does do sub-granulepos timestamping. */
buffer = gst_buffer_straw_get_buffer (bin, pad);
last_granulepos = GST_BUFFER_OFFSET_END (buffer);
check_buffer_timestamp (buffer, 0);
/* plain division because I know the answer is exact */
check_buffer_duration (buffer, GST_SECOND / 10);

View file

@ -8,7 +8,7 @@ if USE_GIO
GIO_SUBDIRS = gio
endif
SUBDIRS = app dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec volume v4l encoding
SUBDIRS = app audio dynamic $(FT2_SUBDIRS) $(GIO_SUBDIRS) overlay playrec volume v4l encoding
DIST_SUBDIRS = app dynamic gio overlay seek snapshot playrec volume v4l encoding

1
tests/examples/audio/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
testchannels

View file

@ -0,0 +1,6 @@
noinst_PROGRAMS = testchannels
testchannels_SOURCES = testchannels.c
testchannels_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS)
testchannels_LDADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-$(GST_MAJORMINOR) $(GST_LIBS)

View file

@ -17,8 +17,8 @@
* Boston, MA 02111-1307, USA.
*/
#include "multichannel.c"
#include "audio-enumtypes.c"
#include <gst/audio/multichannel.h>
#include <gst/audio/audio-enumtypes.h>
gint
main (gint argc, gchar * argv[])

View file

@ -32,6 +32,7 @@ EXPORTS
gst_video_format_to_fourcc
gst_video_frame_rate
gst_video_get_size
gst_video_get_size_from_caps
gst_video_parse_caps_chroma_site
gst_video_parse_caps_color_matrix
gst_video_parse_caps_framerate