ext/xine/xineinput.c: call parent dispose.

Original commit message from CVS:
2004-02-23  Benjamin Otte  <otte@gnome.org>

* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
This commit is contained in:
Benjamin Otte 2004-02-23 22:21:30 +00:00
parent 678a8ee805
commit 409ddc4500
6 changed files with 120 additions and 92 deletions

View file

@ -1,3 +1,31 @@
2004-02-23 Benjamin Otte <otte@gnome.org>
* ext/xine/xineinput.c: (gst_xine_input_dispose):
(gst_xine_input_subclass_init):
call parent dispose.
change pad template for CD reader correctly
* ext/xine/Makefile.am:
* ext/xine/gstxine.h:
* ext/xine/xine.c: (plugin_init):
* ext/xine/xineaudiosink.c:
wrap audio sinks, too
* gst-libs/gst/resample/private.h:
* gst-libs/gst/resample/resample.c: (gst_resample_init),
(gst_resample_reinit), (gst_resample_scale),
(gst_resample_nearest_s16), (gst_resample_bilinear_s16),
(gst_resample_sinc_slow_s16), (gst_resample_sinc_s16),
(gst_resample_sinc_ft_s16), (gst_resample_nearest_float),
(gst_resample_bilinear_float), (gst_resample_sinc_slow_float),
(gst_resample_sinc_float), (gst_resample_sinc_ft_float):
* gst-libs/gst/resample/resample.h:
* gst/audioscale/gstaudioscale.c: (gst_audioscale_method_get_type),
(gst_audioscale_class_init), (gst_audioscale_link),
(gst_audioscale_get_buffer), (gst_audioscale_init),
(gst_audioscale_chain), (gst_audioscale_set_property),
(gst_audioscale_get_property):
* gst/audioscale/gstaudioscale.h:
s/resample_*/gst_resample_*/i to not clobber namespaces
2004-02-23 Julien MOUTTE <julien@moutte.net>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),

View file

@ -23,17 +23,17 @@
#include "resample.h"
void resample_nearest_s16(resample_t *r);
void resample_bilinear_s16(resample_t *r);
void resample_sinc_s16(resample_t *r);
void resample_sinc_slow_s16(resample_t *r);
void resample_sinc_ft_s16(resample_t * r);
void gst_resample_nearest_s16(gst_resample_t *r);
void gst_resample_bilinear_s16(gst_resample_t *r);
void gst_resample_sinc_s16(gst_resample_t *r);
void gst_resample_sinc_slow_s16(gst_resample_t *r);
void gst_resample_sinc_ft_s16(gst_resample_t * r);
void resample_nearest_float(resample_t *r);
void resample_bilinear_float(resample_t *r);
void resample_sinc_float(resample_t *r);
void resample_sinc_slow_float(resample_t *r);
void resample_sinc_ft_float(resample_t * r);
void gst_resample_nearest_float(gst_resample_t *r);
void gst_resample_bilinear_float(gst_resample_t *r);
void gst_resample_sinc_float(gst_resample_t *r);
void gst_resample_sinc_slow_float(gst_resample_t *r);
void gst_resample_sinc_ft_float(gst_resample_t * r);
typedef struct functable_s functable_t;

View file

@ -66,7 +66,7 @@ signed short double_to_s16_ppcasm(double x)
return rint(x);
}
void resample_init(resample_t * r)
void gst_resample_init(gst_resample_t * r)
{
r->i_start = 0;
if(r->filter_length&1){
@ -77,10 +77,10 @@ void resample_init(resample_t * r)
memset(r->acc, 0, sizeof(r->acc));
resample_reinit(r);
gst_resample_reinit(r);
}
void resample_reinit(resample_t * r)
void gst_resample_reinit(gst_resample_t * r)
{
/* i_inc is the number of samples that the output increments for
* each input sample. o_inc is the opposite. */
@ -89,40 +89,40 @@ void resample_reinit(resample_t * r)
r->halftaps = (r->filter_length - 1.0) * 0.5;
if (r->format == RESAMPLE_S16) {
if (r->format == GST_RESAMPLE_S16) {
switch (r->method) {
default:
case RESAMPLE_NEAREST:
r->scale = resample_nearest_s16;
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_s16;
break;
case RESAMPLE_BILINEAR:
r->scale = resample_bilinear_s16;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_s16;
break;
case RESAMPLE_SINC_SLOW:
r->scale = resample_sinc_s16;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_s16;
break;
case RESAMPLE_SINC:
r->scale = resample_sinc_ft_s16;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_s16;
break;
}
} else if (r->format == RESAMPLE_FLOAT) {
} else if (r->format == GST_RESAMPLE_FLOAT) {
switch (r->method) {
default:
case RESAMPLE_NEAREST:
r->scale = resample_nearest_float;
case GST_RESAMPLE_NEAREST:
r->scale = gst_resample_nearest_float;
break;
case RESAMPLE_BILINEAR:
r->scale = resample_bilinear_float;
case GST_RESAMPLE_BILINEAR:
r->scale = gst_resample_bilinear_float;
break;
case RESAMPLE_SINC_SLOW:
r->scale = resample_sinc_float;
case GST_RESAMPLE_SINC_SLOW:
r->scale = gst_resample_sinc_float;
break;
case RESAMPLE_SINC:
r->scale = resample_sinc_ft_float;
case GST_RESAMPLE_SINC:
r->scale = gst_resample_sinc_ft_float;
break;
}
} else {
fprintf (stderr, "resample: Unexpected format \"%d\"\n", r->format);
fprintf (stderr, "gst_resample: Unexpected format \"%d\"\n", r->format);
}
}
@ -140,7 +140,7 @@ void resample_reinit(resample_t * r)
* i_start_buf is the time of the first sample in the temporary
* buffer.
*/
void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
void gst_resample_scale(gst_resample_t * r, void *i_buf, unsigned int i_size)
{
int o_size;
@ -160,11 +160,11 @@ void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
r->o_buf = r->get_buffer(r->priv, o_size);
if(r->verbose){
printf("resample_scale: i_buf=%p i_size=%d\n",
printf("gst_resample_scale: i_buf=%p i_size=%d\n",
i_buf,i_size);
printf("resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
printf("gst_resample_scale: i_samples=%d o_samples=%d i_inc=%g o_buf=%p\n",
r->i_samples, r->o_samples, r->i_inc, r->o_buf);
printf("resample_scale: i_start=%g i_end=%g o_start=%g\n",
printf("gst_resample_scale: i_start=%g i_end=%g o_start=%g\n",
r->i_start, r->i_end, r->o_start);
}
@ -172,7 +172,7 @@ void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
int size = (r->filter_length + r->i_samples) * sizeof(double) * 2;
if(r->verbose){
printf("resample temp buffer size=%d\n",size);
printf("gst_resample temp buffer size=%d\n",size);
}
if(r->buffer)free(r->buffer);
r->buffer_len = size;
@ -180,7 +180,7 @@ void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
memset(r->buffer, 0, size);
}
if (r->format==RESAMPLE_S16) {
if (r->format==GST_RESAMPLE_S16) {
if(r->channels==2){
conv_double_short(
r->buffer + r->filter_length * sizeof(double) * 2,
@ -190,7 +190,7 @@ void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
r->buffer + r->filter_length * sizeof(double) * 2,
r->i_buf, r->i_samples, sizeof(double) * 2);
}
} else if (r->format==RESAMPLE_FLOAT) {
} else if (r->format==GST_RESAMPLE_FLOAT) {
if(r->channels==2){
conv_double_float(
r->buffer + r->filter_length * sizeof(double) * 2,
@ -216,7 +216,7 @@ void resample_scale(resample_t * r, void *i_buf, unsigned int i_size)
r->i_start -= r->o_samples;
}
void resample_nearest_s16(resample_t * r)
void gst_resample_nearest_s16(gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int i_count = 0;
@ -262,7 +262,7 @@ void resample_nearest_s16(resample_t * r)
}
}
void resample_bilinear_s16(resample_t * r)
void gst_resample_bilinear_s16(gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int o_count = 0;
@ -311,7 +311,7 @@ void resample_bilinear_s16(resample_t * r)
}
}
void resample_sinc_slow_s16(resample_t * r)
void gst_resample_sinc_slow_s16(gst_resample_t * r)
{
signed short *i_ptr, *o_ptr;
int i, j;
@ -324,7 +324,7 @@ void resample_sinc_slow_s16(resample_t * r)
if (!r->buffer) {
int size = r->filter_length * 2 * r->channels;
printf("resample temp buffer\n");
printf("gst_resample temp buffer\n");
r->buffer = malloc(size);
memset(r->buffer, 0, size);
}
@ -377,7 +377,7 @@ void resample_sinc_slow_s16(resample_t * r)
}
/* only works for channels == 2 ???? */
void resample_sinc_s16(resample_t * r)
void gst_resample_sinc_s16(gst_resample_t * r)
{
double *ptr;
signed short *o_ptr;
@ -468,7 +468,7 @@ static functable_t *ft;
double out_tmp[10000];
void resample_sinc_ft_s16(resample_t * r)
void gst_resample_sinc_ft_s16(gst_resample_t * r)
{
double *ptr;
signed short *o_ptr;
@ -567,7 +567,7 @@ void resample_sinc_ft_s16(resample_t * r)
********/
void resample_nearest_float(resample_t * r)
void gst_resample_nearest_float(gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int i_count = 0;
@ -613,7 +613,7 @@ void resample_nearest_float(resample_t * r)
}
}
void resample_bilinear_float(resample_t * r)
void gst_resample_bilinear_float(gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int o_count = 0;
@ -662,7 +662,7 @@ void resample_bilinear_float(resample_t * r)
}
}
void resample_sinc_slow_float(resample_t * r)
void gst_resample_sinc_slow_float(gst_resample_t * r)
{
float *i_ptr, *o_ptr;
int i, j;
@ -675,7 +675,7 @@ void resample_sinc_slow_float(resample_t * r)
if (!r->buffer) {
int size = r->filter_length * sizeof(float) * r->channels;
printf("resample temp buffer\n");
printf("gst_resample temp buffer\n");
r->buffer = malloc(size);
memset(r->buffer, 0, size);
}
@ -728,7 +728,7 @@ void resample_sinc_slow_float(resample_t * r)
}
/* only works for channels == 2 ???? */
void resample_sinc_float(resample_t * r)
void gst_resample_sinc_float(gst_resample_t * r)
{
double *ptr;
float *o_ptr;
@ -778,7 +778,7 @@ void resample_sinc_float(resample_t * r)
}
}
void resample_sinc_ft_float(resample_t * r)
void gst_resample_sinc_ft_float(gst_resample_t * r)
{
double *ptr;
float *o_ptr;

View file

@ -18,30 +18,30 @@
*/
#ifndef __RESAMPLE_H__
#define __RESAMPLE_H__
#ifndef __GST_RESAMPLE_H__
#define __GST_RESAMPLE_H__
typedef enum {
RESAMPLE_NEAREST = 0,
RESAMPLE_BILINEAR,
RESAMPLE_SINC_SLOW,
RESAMPLE_SINC,
} resample_method;
GST_RESAMPLE_NEAREST = 0,
GST_RESAMPLE_BILINEAR,
GST_RESAMPLE_SINC_SLOW,
GST_RESAMPLE_SINC,
} gst_resample_method;
typedef enum {
RESAMPLE_S16 = 0,
RESAMPLE_FLOAT
} resample_format;
GST_RESAMPLE_S16 = 0,
GST_RESAMPLE_FLOAT
} gst_resample_format;
typedef struct resample_s resample_t;
typedef struct gst_resample_s gst_resample_t;
struct resample_s {
struct gst_resample_s {
/* parameters */
resample_method method;
gst_resample_method method;
int channels;
int verbose;
resample_format format;
gst_resample_format format;
int filter_length;
@ -81,16 +81,16 @@ struct resample_s {
double acc[10];
/* methods */
void (*scale)(resample_t *r);
void (*scale)(gst_resample_t *r);
double ack;
};
void resample_init(resample_t *r);
void gst_resample_init(gst_resample_t *r);
void resample_reinit(resample_t *r);
void gst_resample_reinit(gst_resample_t *r);
void resample_scale(resample_t *r, void *i_buf, unsigned int size);
void gst_resample_scale(gst_resample_t *r, void *i_buf, unsigned int size);
#endif /* __RESAMPLE_H__ */
#endif /* __GST_RESAMPLE_H__ */

View file

@ -73,9 +73,9 @@ gst_audioscale_method_get_type (void)
{
static GType audioscale_method_type = 0;
static GEnumValue audioscale_methods[] = {
{ RESAMPLE_NEAREST, "0", "Nearest" },
{ RESAMPLE_BILINEAR, "1", "Bilinear" },
{ RESAMPLE_SINC, "2", "Sinc" },
{ GST_RESAMPLE_NEAREST, "0", "Nearest" },
{ GST_RESAMPLE_BILINEAR, "1", "Bilinear" },
{ GST_RESAMPLE_SINC, "2", "Sinc" },
{ 0, NULL, NULL },
};
if(!audioscale_method_type){
@ -153,7 +153,7 @@ gst_audioscale_class_init (AudioscaleClass *klass)
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_METHOD,
g_param_spec_enum ("method", "method", "method", GST_TYPE_AUDIOSCALE_METHOD,
RESAMPLE_SINC, G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
GST_RESAMPLE_SINC, G_PARAM_READWRITE|G_PARAM_CONSTRUCT));
parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
}
@ -210,7 +210,7 @@ static GstPadLinkReturn
gst_audioscale_link (GstPad * pad, const GstCaps * caps)
{
Audioscale *audioscale;
resample_t *r;
gst_resample_t *r;
GstStructure *structure;
int rate;
int channels;
@ -219,7 +219,7 @@ gst_audioscale_link (GstPad * pad, const GstCaps * caps)
GstPad *otherpad;
audioscale = GST_AUDIOSCALE (gst_pad_get_parent (pad));
r = audioscale->resample;
r = audioscale->gst_resample;
otherpad = (pad == audioscale->srcpad) ? audioscale->sinkpad
: audioscale->srcpad;
@ -259,7 +259,7 @@ gst_audioscale_link (GstPad * pad, const GstCaps * caps)
} else {
r->i_rate = rate;
}
resample_reinit(r);
gst_resample_reinit(r);
return GST_PAD_LINK_OK;
}
@ -272,8 +272,8 @@ gst_audioscale_get_buffer (void *priv, unsigned int size)
audioscale->outbuf = gst_buffer_new();
GST_BUFFER_SIZE(audioscale->outbuf) = size;
GST_BUFFER_DATA(audioscale->outbuf) = g_malloc(size);
GST_BUFFER_TIMESTAMP(audioscale->outbuf) = audioscale->offset * GST_SECOND / audioscale->resample->o_rate;
audioscale->offset += size / sizeof(gint16) / audioscale->resample->channels;
GST_BUFFER_TIMESTAMP(audioscale->outbuf) = audioscale->offset * GST_SECOND / audioscale->gst_resample->o_rate;
audioscale->offset += size / sizeof(gint16) / audioscale->gst_resample->channels;
return GST_BUFFER_DATA(audioscale->outbuf);
}
@ -281,7 +281,7 @@ gst_audioscale_get_buffer (void *priv, unsigned int size)
static void
gst_audioscale_init (Audioscale *audioscale)
{
resample_t *r;
gst_resample_t *r;
audioscale->sinkpad = gst_pad_new_from_template (
gst_static_pad_template_get (&gst_audioscale_sink_template), "sink");
@ -297,20 +297,20 @@ gst_audioscale_init (Audioscale *audioscale)
gst_pad_set_link_function (audioscale->srcpad, gst_audioscale_link);
gst_pad_set_getcaps_function (audioscale->srcpad, gst_audioscale_getcaps);
r = g_new0(resample_t,1);
audioscale->resample = r;
r = g_new0(gst_resample_t,1);
audioscale->gst_resample = r;
r->priv = audioscale;
r->get_buffer = gst_audioscale_get_buffer;
r->method = RESAMPLE_SINC;
r->method = GST_RESAMPLE_SINC;
r->channels = 0;
r->filter_length = 16;
r->i_rate = -1;
r->o_rate = -1;
r->format = RESAMPLE_S16;
r->format = GST_RESAMPLE_S16;
/*r->verbose = 1; */
resample_init(r);
gst_resample_init(r);
/* we will be reinitialized when the G_PARAM_CONSTRUCTs hit */
}
@ -339,7 +339,7 @@ gst_audioscale_chain (GstPad *pad, GstData *_data)
GST_DEBUG ("gst_audioscale_chain: got buffer of %ld bytes in '%s'\n",
size, gst_element_get_name (GST_ELEMENT (audioscale)));
resample_scale (audioscale->resample, data, size);
gst_resample_scale (audioscale->gst_resample, data, size);
gst_pad_push (audioscale->srcpad, GST_DATA (audioscale->outbuf));
@ -351,12 +351,12 @@ gst_audioscale_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
Audioscale *src;
resample_t *r;
gst_resample_t *r;
/* it's not null if we got it, but it might not be ours */
g_return_if_fail(GST_IS_AUDIOSCALE(object));
src = GST_AUDIOSCALE(object);
r = src->resample;
r = src->gst_resample;
switch (prop_id) {
case ARG_FILTERLEN:
@ -371,17 +371,17 @@ gst_audioscale_set_property (GObject * object, guint prop_id,
break;
}
resample_reinit (r);
gst_resample_reinit (r);
}
static void
gst_audioscale_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
Audioscale *src;
resample_t *r;
gst_resample_t *r;
src = GST_AUDIOSCALE (object);
r = src->resample;
r = src->gst_resample;
switch (prop_id) {
case ARG_FILTERLEN:

View file

@ -59,7 +59,7 @@ struct _Audioscale {
gboolean passthru;
gint64 offset;
resample_t *resample;
gst_resample_t *gst_resample;
GstBuffer *outbuf;
};