Commit bf08ca70 authored by Sebastian Dröge's avatar Sebastian Dröge
Browse files

Merge branch 'master' into 0.11

parents e614c6bd 7716358d
......@@ -259,7 +259,7 @@ AC_CHECK_FUNC(gethostbyname,,[AC_CHECK_LIB(nsl,gethostbyname)])
dnl *** checks for dependency libraries ***
dnl GLib is required
AG_GST_GLIB_CHECK([2.22])
AG_GST_GLIB_CHECK([2.24])
ORC_CHECK([0.4.11])
......
......@@ -70,6 +70,7 @@
#include "gst/gst-i18n-plugin.h"
#include "gstgnomevfssrc.h"
#include <gnome-vfs-module-2.0/libgnomevfs/gnome-vfs-cancellable-ops.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -128,6 +129,8 @@ static void gst_gnome_vfs_src_get_property (GObject * object, guint prop_id,
static gboolean gst_gnome_vfs_src_stop (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_start (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_is_seekable (GstBaseSrc * src);
static gboolean gst_gnome_vfs_src_unlock (GstBaseSrc * basesrc);
static gboolean gst_gnome_vfs_src_unlock_stop (GstBaseSrc * basesrc);
static gboolean gst_gnome_vfs_src_get_size (GstBaseSrc * src, guint64 * size);
static GstFlowReturn gst_gnome_vfs_src_create (GstBaseSrc * basesrc,
guint64 offset, guint size, GstBuffer ** buffer);
......@@ -202,6 +205,9 @@ gst_gnome_vfs_src_class_init (GstGnomeVFSSrcClass * klass)
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_stop);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_unlock);
gstbasesrc_class->unlock_stop =
GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_unlock_stop);
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_get_size);
gstbasesrc_class->is_seekable =
GST_DEBUG_FUNCPTR (gst_gnome_vfs_src_is_seekable);
......@@ -214,7 +220,9 @@ gst_gnome_vfs_src_init (GstGnomeVFSSrc * gnomevfssrc)
{
gnomevfssrc->uri = NULL;
gnomevfssrc->uri_name = NULL;
gnomevfssrc->context = NULL;
gnomevfssrc->handle = NULL;
gnomevfssrc->interrupted = FALSE;
gnomevfssrc->curoffset = 0;
gnomevfssrc->seekable = FALSE;
......@@ -563,6 +571,7 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
guint8 *data, *ptr;
gsize todo;
GstGnomeVFSSrc *src;
gboolean interrupted = FALSE;
src = GST_GNOME_VFS_SRC (basesrc);
......@@ -593,9 +602,21 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
ptr = data;
todo = size;
while (todo > 0) {
while (!src->interrupted && todo > 0) {
/* this can return less that we ask for */
res = gnome_vfs_read (src->handle, ptr, todo, &readbytes);
res =
gnome_vfs_read_cancellable (src->handle, data, todo, &readbytes,
src->context);
if (G_UNLIKELY (res == GNOME_VFS_ERROR_CANCELLED)) {
GST_DEBUG_OBJECT (src, "interrupted");
/* Just take what we've so far gotten and return */
size = size - todo;
todo = 0;
interrupted = TRUE;
break;
}
if (G_UNLIKELY (res == GNOME_VFS_ERROR_EOF || (res == GNOME_VFS_OK
&& readbytes == 0)))
......@@ -614,6 +635,9 @@ gst_gnome_vfs_src_create (GstBaseSrc * basesrc, guint64 offset, guint size,
}
gst_buffer_unmap (buf, data, size);
if (interrupted)
goto interrupted;
GST_BUFFER_OFFSET (buf) = src->curoffset;
src->curoffset += size;
......@@ -644,6 +668,11 @@ read_failed:
("Failed to read data: %s", gnome_vfs_result_to_string (res)));
return GST_FLOW_ERROR;
}
interrupted:
{
gst_buffer_unref (buf);
return GST_FLOW_WRONG_STATE;
}
eos:
{
gst_buffer_unmap (buf, data, size);
......@@ -733,6 +762,37 @@ gst_gnome_vfs_src_query (GstBaseSrc * basesrc, GstQuery * query)
return ret;
}
/* Interrupt a blocking request. */
static gboolean
gst_gnome_vfs_src_unlock (GstBaseSrc * basesrc)
{
GstGnomeVFSSrc *src;
src = GST_GNOME_VFS_SRC (basesrc);
GST_DEBUG_OBJECT (src, "unlock()");
src->interrupted = TRUE;
if (src->context) {
GnomeVFSCancellation *cancel =
gnome_vfs_context_get_cancellation (src->context);
if (cancel)
gnome_vfs_cancellation_cancel (cancel);
}
return TRUE;
}
/* Interrupt interrupt. */
static gboolean
gst_gnome_vfs_src_unlock_stop (GstBaseSrc * basesrc)
{
GstGnomeVFSSrc *src;
src = GST_GNOME_VFS_SRC (basesrc);
GST_DEBUG_OBJECT (src, "unlock_stop()");
src->interrupted = FALSE;
return TRUE;
}
static gboolean
gst_gnome_vfs_src_get_size (GstBaseSrc * basesrc, guint64 * size)
{
......@@ -786,6 +846,7 @@ gst_gnome_vfs_src_start (GstBaseSrc * basesrc)
gst_gnome_vfs_src_push_callbacks (src);
src->context = gnome_vfs_context_new ();
if (src->uri != NULL) {
GnomeVFSOpenMode mode = GNOME_VFS_OPEN_READ;
......@@ -857,6 +918,9 @@ gst_gnome_vfs_src_stop (GstBaseSrc * basesrc)
src->handle = NULL;
}
src->curoffset = 0;
src->interrupted = FALSE;
gnome_vfs_context_free (src->context);
src->context = NULL;
return TRUE;
}
......@@ -58,8 +58,10 @@ struct _GstGnomeVFSSrc
/* uri, file, ... */
GnomeVFSURI *uri;
gchar *uri_name;
GnomeVFSContext *context;
GnomeVFSHandle *handle;
gboolean own_handle;
gboolean interrupted;
GnomeVFSFileOffset curoffset; /* current offset in file */
gboolean seekable;
......
......@@ -114,6 +114,7 @@ GST_DEBUG_CATEGORY (pango_debug);
#define DEFAULT_PROP_AUTO_ADJUST_SIZE TRUE
#define DEFAULT_PROP_VERTICAL_RENDER FALSE
#define DEFAULT_PROP_COLOR 0xffffffff
#define DEFAULT_PROP_OUTLINE_COLOR 0xff000000
/* make a property of me */
#define DEFAULT_SHADING_VALUE -80
......@@ -186,6 +187,8 @@ enum
PROP_AUTO_ADJUST_SIZE,
PROP_VERTICAL_RENDER,
PROP_COLOR,
PROP_SHADOW,
PROP_OUTLINE_COLOR,
PROP_LAST
};
......@@ -518,6 +521,18 @@ gst_base_text_overlay_class_init (GstBaseTextOverlayClass * klass)
"Color to use for text (big-endian ARGB).", 0, G_MAXUINT32,
DEFAULT_PROP_COLOR,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
/**
* GstTextOverlay:outline-color
*
* Color of the outline of the rendered text.
*
* Since: 0.10.35
**/
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_OUTLINE_COLOR,
g_param_spec_uint ("outline-color", "Text Outline Color",
"Color to use for outline the text (big-endian ARGB).", 0,
G_MAXUINT32, DEFAULT_PROP_OUTLINE_COLOR,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
/**
* GstBaseTextOverlay:line-alignment
......@@ -666,6 +681,7 @@ gst_base_text_overlay_init (GstBaseTextOverlay * overlay,
gst_base_text_overlay_adjust_values_with_fontdesc (overlay, desc);
overlay->color = DEFAULT_PROP_COLOR;
overlay->outline_color = DEFAULT_PROP_OUTLINE_COLOR;
overlay->halign = DEFAULT_PROP_HALIGNMENT;
overlay->valign = DEFAULT_PROP_VALIGNMENT;
overlay->xpad = DEFAULT_PROP_XPAD;
......@@ -902,6 +918,9 @@ gst_base_text_overlay_set_property (GObject * object, guint prop_id,
case PROP_COLOR:
overlay->color = g_value_get_uint (value);
break;
case PROP_OUTLINE_COLOR:
overlay->outline_color = g_value_get_uint (value);
break;
case PROP_SILENT:
overlay->silent = g_value_get_boolean (value);
break;
......@@ -994,6 +1013,9 @@ gst_base_text_overlay_get_property (GObject * object, guint prop_id,
case PROP_COLOR:
g_value_set_uint (value, overlay->color);
break;
case PROP_OUTLINE_COLOR:
g_value_set_uint (value, overlay->outline_color);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1411,9 +1433,14 @@ gst_base_text_overlay_render_pangocairo (GstBaseTextOverlay * overlay,
pango_cairo_show_layout (cr, overlay->layout);
cairo_restore (cr);
a = (overlay->outline_color >> 24) & 0xff;
r = (overlay->outline_color >> 16) & 0xff;
g = (overlay->outline_color >> 8) & 0xff;
b = (overlay->outline_color >> 0) & 0xff;
/* draw outline text */
cairo_save (cr);
cairo_set_source_rgb (cr, 0.0, 0.0, 0.0);
cairo_set_source_rgba (cr, r / 255.0, g / 255.0, b / 255.0, a / 255.0);
cairo_set_line_width (cr, overlay->outline_offset);
pango_cairo_layout_path (cr, overlay->layout);
cairo_stroke (cr);
......
......@@ -136,7 +136,7 @@ struct _GstBaseTextOverlay {
gboolean want_shading;
gboolean silent;
gboolean wait_text;
guint color;
guint color, outline_color;
PangoLayout *layout;
gdouble shadow_offset;
......
......@@ -377,8 +377,10 @@ gst_text_render_fixate_caps (GstPad * pad, GstCaps * caps)
GstStructure *s = gst_caps_get_structure (caps, 0);
GST_DEBUG ("Fixating caps %" GST_PTR_FORMAT, caps);
gst_structure_fixate_field_nearest_int (s, "width", render->image_width);
gst_structure_fixate_field_nearest_int (s, "height", render->image_height);
gst_structure_fixate_field_nearest_int (s, "width", MAX (render->image_width,
DEFAULT_RENDER_WIDTH));
gst_structure_fixate_field_nearest_int (s, "height",
MAX (render->image_height + render->ypad, DEFAULT_RENDER_HEIGHT));
GST_DEBUG ("Fixated to %" GST_PTR_FORMAT, caps);
gst_object_unref (render);
......@@ -401,12 +403,12 @@ gst_text_renderer_image_to_ayuv (GstTextRender * render, guchar * pixbuf,
width = render->image_width;
height = render->image_height;
bitp = render->text_image;
for (y = 0; y < height; y++) {
for (y = 0; y < height && ypos + y < render->height; y++) {
int n;
p = pixbuf + (ypos + y) * stride + xpos * 4;
for (n = 0; n < width; n++) {
bitp = render->text_image + y * width * 4;
for (n = 0; n < width && n < render->width; n++) {
b = bitp[CAIRO_ARGB_B];
g = bitp[CAIRO_ARGB_G];
r = bitp[CAIRO_ARGB_R];
......@@ -437,11 +439,11 @@ gst_text_renderer_image_to_argb (GstTextRender * render, guchar * pixbuf,
width = render->image_width;
height = render->image_height;
bitp = render->text_image;
for (i = 0; i < height; i++) {
for (i = 0; i < height && ypos + i < render->height; i++) {
p = pixbuf + (ypos + i) * stride + xpos * 4;
for (j = 0; j < width; j++) {
bitp = render->text_image + i * width * 4;
for (j = 0; j < width && j < render->width; j++) {
p[0] = bitp[CAIRO_ARGB_A];
p[1] = bitp[CAIRO_ARGB_R];
p[2] = bitp[CAIRO_ARGB_G];
......@@ -462,7 +464,7 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
GstTextRender *render;
GstFlowReturn ret;
GstBuffer *outbuf;
GstCaps *caps = NULL;
GstCaps *caps = NULL, *padcaps;
guint8 *data;
gsize size;
gint n;
......@@ -487,18 +489,20 @@ gst_text_render_chain (GstPad * pad, GstBuffer * inbuf)
gst_text_render_check_argb (render);
if (!render->use_ARGB) {
caps =
gst_video_format_new_caps (GST_VIDEO_FORMAT_AYUV, render->width,
render->height, 1, 1, 1, 1);
} else {
caps =
gst_video_format_new_caps (GST_VIDEO_FORMAT_ARGB, render->width,
render->height, 1, 1, 1, 1);
padcaps = gst_pad_get_caps (render->srcpad, NULL);
caps = gst_pad_peer_get_caps (render->srcpad, padcaps);
gst_caps_unref (padcaps);
if (!caps || gst_caps_is_empty (caps)) {
GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));
ret = GST_FLOW_ERROR;
goto done;
}
gst_caps_truncate (caps);
gst_pad_fixate_caps (render->srcpad, caps);
if (!gst_pad_set_caps (render->srcpad, caps)) {
gst_caps_unref (caps);
GST_ELEMENT_ERROR (render, CORE, NEGOTIATION, (NULL), (NULL));
ret = GST_FLOW_ERROR;
goto done;
......
......@@ -989,7 +989,8 @@ theora_enc_read_multipass_cache (GstTheoraEnc * enc)
{
GstBuffer *cache_buf;
const guint8 *cache_data;
gsize bytes_read = 0, bytes_consumed = 0;
gsize bytes_read = 0;
gint bytes_consumed = 0;
GIOStatus stat = G_IO_STATUS_NORMAL;
gboolean done = FALSE;
......@@ -1064,7 +1065,7 @@ theora_enc_write_multipass_cache (GstTheoraEnc * enc, gboolean begin,
}
if (stat == G_IO_STATUS_ERROR || bytes_read < 0 || bytes_written < 0) {
if (stat == G_IO_STATUS_ERROR || bytes_read < 0) {
if (begin) {
if (eos)
GST_ELEMENT_WARNING (enc, RESOURCE, WRITE, (NULL),
......
......@@ -555,7 +555,7 @@ too_small:
* codec initialization data).
*
* Parses a interleaved (also known as "complex") stream´s strf
* structure plus optionally some extradata from input data. This
* structure plus optionally some extradata from input data. This
* function takes ownership of @buf.
*
* Returns: TRUE if parsing succeeded, otherwise FALSE.
......@@ -643,7 +643,6 @@ gst_riff_parse_info (GstElement * element,
GstTagList *taglist;
g_return_if_fail (_taglist != NULL);
g_return_if_fail (buf != NULL);
if (!buf) {
*_taglist = NULL;
......
......@@ -2627,14 +2627,6 @@ deserialize_resolution (GstExifReader * exif_reader,
unit = GST_READ_UINT16_BE (tagdata->offset_as_data);
}
if (unit != 2 && unit != 3) {
GST_WARNING ("Invalid resolution unit, ignoring PPI tags");
return 0;
}
xres = gst_exif_reader_get_pending_tag (exif_reader, EXIF_TAG_XRESOLUTION);
yres = gst_exif_reader_get_pending_tag (exif_reader, EXIF_TAG_YRESOLUTION);
switch (unit) {
case 2: /* inch */
multiplier = 1;
......@@ -2643,15 +2635,16 @@ deserialize_resolution (GstExifReader * exif_reader,
multiplier = 1 / 2.54;
break;
default:
multiplier = 1;
g_assert_not_reached ();
break;
GST_WARNING ("Invalid resolution unit, ignoring PPI tags");
return 0;
}
xres = gst_exif_reader_get_pending_tag (exif_reader, EXIF_TAG_XRESOLUTION);
if (xres) {
parse_exif_rational_tag (exif_reader, GST_TAG_IMAGE_HORIZONTAL_PPI,
xres->count, xres->offset, multiplier, FALSE);
}
yres = gst_exif_reader_get_pending_tag (exif_reader, EXIF_TAG_YRESOLUTION);
if (yres) {
parse_exif_rational_tag (exif_reader, GST_TAG_IMAGE_VERTICAL_PPI,
yres->count, yres->offset, multiplier, FALSE);
......@@ -2670,7 +2663,7 @@ serialize_scene_type (GstExifWriter * writer, const GstTagList * taglist,
if (gst_tag_list_peek_string_index (taglist, GST_TAG_CAPTURING_SOURCE, 0,
&str)) {
if (strcmp (str, "dsc") == 0) {
value = 0;
value = 1;
}
}
......
......@@ -129,6 +129,9 @@ gst_audiostestsrc_wave_get_type (void)
{GST_AUDIO_TEST_SRC_WAVE_TICKS, "Periodic Ticks", "ticks"},
{GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE, "White Gaussian noise",
"gaussian-noise"},
{GST_AUDIO_TEST_SRC_WAVE_RED_NOISE, "Red (brownian) noise", "red-noise"},
{GST_AUDIO_TEST_SRC_WAVE_BLUE_NOISE, "Blue noise", "blue-noise"},
{GST_AUDIO_TEST_SRC_WAVE_VIOLET_NOISE, "Violet noise", "violet-noise"},
{0, NULL, NULL},
};
......@@ -836,6 +839,109 @@ static const ProcessFunc gaussian_white_noise_funcs[] = {
(ProcessFunc) gst_audio_test_src_create_gaussian_white_noise_double
};
/* Brownian (Red) Noise: noise where the power density decreases by 6 dB per
* octave with increasing frequency
*
* taken from http://vellocet.com/dsp/noise/VRand.html
* by Andrew Simper of Vellocet (andy@vellocet.com)
*/
#define DEFINE_RED_NOISE(type,scale) \
static void \
gst_audio_test_src_create_red_noise_##type (GstAudioTestSrc * src, g##type * samples) \
{ \
gint i, c; \
gdouble amp = (src->volume * scale); \
gdouble state = src->red.state; \
\
for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
for (c = 0; c < src->channels; ++c) { \
while (TRUE) { \
gdouble r = g_rand_double_range (src->gen, -1.0, 1.0); \
state += r; \
if (state<-8.0f || state>8.0f) state -= r; \
else break; \
} \
samples[i++] = (g##type) (amp * state * 0.0625f); /* /16.0 */ \
} \
} \
src->red.state = state; \
}
DEFINE_RED_NOISE (int16, 32767.0);
DEFINE_RED_NOISE (int32, 2147483647.0);
DEFINE_RED_NOISE (float, 1.0);
DEFINE_RED_NOISE (double, 1.0);
static const ProcessFunc red_noise_funcs[] = {
(ProcessFunc) gst_audio_test_src_create_red_noise_int16,
(ProcessFunc) gst_audio_test_src_create_red_noise_int32,
(ProcessFunc) gst_audio_test_src_create_red_noise_float,
(ProcessFunc) gst_audio_test_src_create_red_noise_double
};
/* Blue Noise: apply spectral inversion to pink noise */
#define DEFINE_BLUE_NOISE(type) \
static void \
gst_audio_test_src_create_blue_noise_##type (GstAudioTestSrc * src, g##type * samples) \
{ \
gint i, c; \
static gdouble flip=1.0; \
\
gst_audio_test_src_create_pink_noise_##type (src, samples); \
for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
for (c = 0; c < src->channels; ++c) { \
samples[i++] *= flip; \
} \
flip *= -1.0; \
} \
}
DEFINE_BLUE_NOISE (int16);
DEFINE_BLUE_NOISE (int32);
DEFINE_BLUE_NOISE (float);
DEFINE_BLUE_NOISE (double);
static const ProcessFunc blue_noise_funcs[] = {
(ProcessFunc) gst_audio_test_src_create_blue_noise_int16,
(ProcessFunc) gst_audio_test_src_create_blue_noise_int32,
(ProcessFunc) gst_audio_test_src_create_blue_noise_float,
(ProcessFunc) gst_audio_test_src_create_blue_noise_double
};
/* Violet Noise: apply spectral inversion to red noise */
#define DEFINE_VIOLET_NOISE(type) \
static void \
gst_audio_test_src_create_violet_noise_##type (GstAudioTestSrc * src, g##type * samples) \
{ \
gint i, c; \
static gdouble flip=1.0; \
\
gst_audio_test_src_create_red_noise_##type (src, samples); \
for (i = 0; i < src->generate_samples_per_buffer * src->channels; ) { \
for (c = 0; c < src->channels; ++c) { \
samples[i++] *= flip; \
} \
flip *= -1.0; \
} \
}
DEFINE_VIOLET_NOISE (int16);
DEFINE_VIOLET_NOISE (int32);
DEFINE_VIOLET_NOISE (float);
DEFINE_VIOLET_NOISE (double);
static const ProcessFunc violet_noise_funcs[] = {
(ProcessFunc) gst_audio_test_src_create_violet_noise_int16,
(ProcessFunc) gst_audio_test_src_create_violet_noise_int32,
(ProcessFunc) gst_audio_test_src_create_violet_noise_float,
(ProcessFunc) gst_audio_test_src_create_violet_noise_double
};
/*
* gst_audio_test_src_change_wave:
* Assign function pointer of wave genrator.
......@@ -888,6 +994,23 @@ gst_audio_test_src_change_wave (GstAudioTestSrc * src)
src->gen = g_rand_new ();
src->process = gaussian_white_noise_funcs[src->format];
break;
case GST_AUDIO_TEST_SRC_WAVE_RED_NOISE:
if (!(src->gen))
src->gen = g_rand_new ();
src->red.state = 0.0;
src->process = red_noise_funcs[src->format];
break;
case GST_AUDIO_TEST_SRC_WAVE_BLUE_NOISE:
if (!(src->gen))
src->gen = g_rand_new ();
gst_audio_test_src_init_pink_noise (src);
src->process = blue_noise_funcs[src->format];
break;
case GST_AUDIO_TEST_SRC_WAVE_VIOLET_NOISE:
if (!(src->gen))
src->gen = g_rand_new ();
src->red.state = 0.0;
src->process = violet_noise_funcs[src->format];
default:
GST_ERROR ("invalid wave-form");
break;
......
......@@ -50,6 +50,7 @@ G_BEGIN_DECLS
* @GST_AUDIO_TEST_SRC_WAVE_SINE_TAB: sine wave using a table
* @GST_AUDIO_TEST_SRC_WAVE_TICKS: periodic ticks
* @GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE: white (zero mean) Gaussian noise; volume sets the standard deviation of the noise in units of the range of values of the sample type, e.g. volume=0.1 produces noise with a standard deviation of 0.1*32767=3277 with 16-bit integer samples, or 0.1*1.0=0.1 with floating-point samples.
* @GST_AUDIO_TEST_SRC_WAVE_RED_NOISE: red (brownian) noise
*
* Different types of supported sound waves.
*/
......@@ -63,8 +64,11 @@ typedef enum {
GST_AUDIO_TEST_SRC_WAVE_PINK_NOISE,
GST_AUDIO_TEST_SRC_WAVE_SINE_TAB,
GST_AUDIO_TEST_SRC_WAVE_TICKS,
GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE
} GstAudioTestSrcWave;
GST_AUDIO_TEST_SRC_WAVE_GAUSSIAN_WHITE_NOISE,
GST_AUDIO_TEST_SRC_WAVE_RED_NOISE,
GST_AUDIO_TEST_SRC_WAVE_BLUE_NOISE,
GST_AUDIO_TEST_SRC_WAVE_VIOLET_NOISE
} GstAudioTestSrcWave;
#define PINK_MAX_RANDOM_ROWS (30)
#define PINK_RANDOM_BITS (16)
......@@ -78,6 +82,10 @@ typedef struct {
gdouble scalar; /* Used to scale within range of -1.0 to +1.0 */
} GstPinkNoise;
typedef struct {
gdouble state; /* noise state */
} GstRedNoise;
typedef enum {
GST_AUDIO_TEST_SRC_FORMAT_NONE = -1,
GST_AUDIO_TEST_SRC_FORMAT_S16 = 0,
......@@ -105,14 +113,14 @@ struct _GstAudioTestSrc {
GstAudioTestSrcWave wave;
gdouble volume;
gdouble freq;
/* audio parameters */
gint channels;
gint samplerate;
gint samples_per_buffer;
gint sample_size;
GstAudioTestSrcFormat format;
/*< private >*/
gboolean tags_pushed; /* send tags just once ? */
GstClockTimeDiff timestamp_offset; /* base offset */
......@@ -125,11 +133,12 @@ struct _GstAudioTestSrc {
gint generate_samples_per_buffer; /* used to generate a partial buffer */
gboolean can_activate_pull;
gboolean reverse; /* play backwards */