summaryrefslogtreecommitdiff
path: root/src/post/goom/xine_goom.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/post/goom/xine_goom.c')
-rw-r--r--src/post/goom/xine_goom.c120
1 files changed, 60 insertions, 60 deletions
diff --git a/src/post/goom/xine_goom.c b/src/post/goom/xine_goom.c
index db7079423..72692ffe1 100644
--- a/src/post/goom/xine_goom.c
+++ b/src/post/goom/xine_goom.c
@@ -1,18 +1,18 @@
/*
* Copyright (C) 2000-2004 the xine project
- *
+ *
* This file is part of xine, a free video player.
- *
+ *
* xine is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
- *
+ *
* xine is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
@@ -71,19 +71,19 @@ struct post_plugin_goom_s {
/* private data */
xine_video_port_t *vo_port;
post_out_t video_output;
-
+
post_class_goom_t *class;
-
+
/* private metronom for syncing the video */
metronom_t *metronom;
-
+
/* goom context */
PluginInfo *goom;
-
- int data_idx;
+
+ int data_idx;
gint16 data [2][NUMSAMPLES];
audio_buffer_t buf; /* dummy buffer just to hold a copy of audio data */
-
+
int channels;
int sample_rate;
int samples_per_frame;
@@ -99,7 +99,7 @@ struct post_plugin_goom_s {
yuv_planes_t yuv;
-
+
/* frame skipping */
int skip_frame;
};
@@ -110,12 +110,12 @@ static void *goom_init_plugin(xine_t *xine, void *);
/* plugin catalog information */
-static const post_info_t goom_special_info = {
+static const post_info_t goom_special_info = {
XINE_POST_TYPE_AUDIO_VISUALIZATION
};
const plugin_info_t xine_plugin_info[] EXPORTED = {
- /* type, API, "name", version, special_info, init_function */
+ /* type, API, "name", version, special_info, init_function */
{ PLUGIN_POST | PLUGIN_MUST_PRELOAD, 9, "goom", XINE_VERSION_CODE, &goom_special_info, &goom_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
@@ -144,7 +144,7 @@ static void goom_port_put_buffer (xine_audio_port_t *this, audio_buffer_t *buf,
static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) {
post_class_goom_t *class = (post_class_goom_t*) data;
-
+
if(class->ip) {
post_plugin_goom_t *this = class->ip;
@@ -160,7 +160,7 @@ static void fps_changed_cb(void *data, xine_cfg_entry_t *cfg) {
static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) {
post_class_goom_t *class = (post_class_goom_t*) data;
-
+
if(class->ip) {
post_plugin_goom_t *this = class->ip;
this->width = cfg->num_value;
@@ -169,7 +169,7 @@ static void width_changed_cb(void *data, xine_cfg_entry_t *cfg) {
static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) {
post_class_goom_t *class = (post_class_goom_t*) data;
-
+
if(class->ip) {
post_plugin_goom_t *this = class->ip;
this->height = cfg->num_value;
@@ -178,7 +178,7 @@ static void height_changed_cb(void *data, xine_cfg_entry_t *cfg) {
static void csc_method_changed_cb(void *data, xine_cfg_entry_t *cfg) {
post_class_goom_t *class = (post_class_goom_t*) data;
-
+
if(class->ip) {
post_plugin_goom_t *this = class->ip;
this->csc_method = cfg->num_value;
@@ -192,14 +192,14 @@ static void *goom_init_plugin(xine_t *xine, void *data)
if (!this)
return NULL;
-
+
this->class.open_plugin = goom_open_plugin;
this->class.get_identifier = goom_get_identifier;
this->class.get_description = goom_get_description;
this->class.dispose = goom_class_dispose;
this->ip = NULL;
this->xine = xine;
-
+
cfg = xine->config;
cfg->register_num (cfg, "effects.goom.fps", FPS,
@@ -212,12 +212,12 @@ static void *goom_init_plugin(xine_t *xine, void *data)
_("goom image width"),
_("The width in pixels of the image to be generated."),
10, width_changed_cb, this);
-
+
cfg->register_num (cfg, "effects.goom.height", GOOM_HEIGHT,
_("goom image height"),
_("The height in pixels of the image to be generated."),
10, height_changed_cb, this);
-
+
cfg->register_enum (cfg, "effects.goom.csc_method", 0,
goom_csc_methods,
@@ -246,34 +246,34 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
free(this);
return NULL;
}
-
+
_x_post_init(&this->post, 1, 0);
-
+
/*
* Lookup config entries.
*/
this->class = class;
class->ip = this;
this->vo_port = video_target[0];
-
+
this->metronom = _x_metronom_init(1, 0, class->xine);
lprintf("goom_open_plugin\n");
if(xine_config_lookup_entry(class->xine, "effects.goom.fps",
- &fps_entry))
+ &fps_entry))
fps_changed_cb(class, &fps_entry);
if(xine_config_lookup_entry(class->xine, "effects.goom.width",
- &width_entry))
+ &width_entry))
width_changed_cb(class, &width_entry);
if(xine_config_lookup_entry(class->xine, "effects.goom.height",
- &height_entry))
+ &height_entry))
height_changed_cb(class, &height_entry);
if(xine_config_lookup_entry(class->xine, "effects.goom.csc_method",
- &csc_method_entry))
+ &csc_method_entry))
csc_method_changed_cb(class, &csc_method_entry);
this->width_back = this->width;
@@ -285,13 +285,13 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
this->ratio = (double)this->width_back/(double)this->height_back;
this->buf.mem = NULL;
- this->buf.mem_size = 0;
+ this->buf.mem_size = 0;
port = _x_post_intercept_audio_port(&this->post, audio_target[0], &input, &output);
port->new_port.open = goom_port_open;
port->new_port.close = goom_port_close;
port->new_port.put_buffer = goom_port_put_buffer;
-
+
outputv = &this->video_output;
outputv->xine_out.name = "generated video";
outputv->xine_out.type = XINE_POST_DATA_VIDEO;
@@ -299,7 +299,7 @@ static post_plugin_t *goom_open_plugin(post_class_t *class_gen, int inputs,
outputv->xine_out.rewire = goom_rewire_video;
outputv->post = &this->post;
xine_list_push_back(this->post.output, outputv);
-
+
this->post.xine_post.audio_input[0] = &port->new_port;
this->post.dispose = goom_dispose;
@@ -322,13 +322,13 @@ static void goom_class_dispose(post_class_t *class_gen)
post_class_goom_t *this = (post_class_goom_t*) class_gen;
this->xine->config->unregister_callback(this->xine->config,
- "effects.goom.fps");
+ "effects.goom.fps");
this->xine->config->unregister_callback(this->xine->config,
- "effects.goom.width");
+ "effects.goom.width");
this->xine->config->unregister_callback(this->xine->config,
- "effects.goom.height");
+ "effects.goom.height");
this->xine->config->unregister_callback(this->xine->config,
- "effects.goom.csc_method");
+ "effects.goom.csc_method");
free(class_gen);
}
@@ -358,7 +358,7 @@ static int goom_rewire_video(xine_post_out_t *output_gen, void *data)
xine_video_port_t *old_port = *(xine_video_port_t **)output_gen->data;
xine_video_port_t *new_port = (xine_video_port_t *)data;
post_plugin_goom_t *this = (post_plugin_goom_t *)output->post;
-
+
if (!data)
return 0;
/* register our stream at the new output port */
@@ -377,12 +377,12 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
_x_post_rewire(&this->post);
_x_post_inc_usage(port);
-
+
port->stream = stream;
port->bits = bits;
port->rate = rate;
port->mode = mode;
-
+
this->channels = _x_ao_mode2channels(mode);
this->sample_rate = rate;
this->samples_per_frame = rate / this->fps;
@@ -392,7 +392,7 @@ static int goom_port_open(xine_audio_port_t *port_gen, xine_stream_t *stream,
this->do_samples_skip = 0;
this->left_to_read = NUMSAMPLES;
-
+
(this->vo_port->open) (this->vo_port, XINE_ANON_STREAM);
this->metronom->set_master(this->metronom, stream->metronom);
@@ -407,18 +407,18 @@ static void goom_port_close(xine_audio_port_t *port_gen, xine_stream_t *stream )
free_yuv_planes(&this->yuv);
port->stream = NULL;
-
+
this->vo_port->close(this->vo_port, XINE_ANON_STREAM);
this->metronom->set_master(this->metronom, NULL);
-
+
port->original_port->close(port->original_port, stream );
-
+
_x_post_dec_usage(port);
}
-static void goom_port_put_buffer (xine_audio_port_t *port_gen,
+static void goom_port_put_buffer (xine_audio_port_t *port_gen,
audio_buffer_t *buf, xine_stream_t *stream) {
-
+
post_audio_port_t *port = (post_audio_port_t *)port_gen;
post_plugin_goom_t *this = (post_plugin_goom_t *)port->post;
vo_frame_t *frame;
@@ -431,28 +431,28 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
int width, height;
int current_sample = 0;
-
+
/* make a copy of buf data for private use */
if( this->buf.mem_size < buf->mem_size ) {
this->buf.mem = realloc(this->buf.mem, buf->mem_size);
this->buf.mem_size = buf->mem_size;
}
- memcpy(this->buf.mem, buf->mem,
+ memcpy(this->buf.mem, buf->mem,
buf->num_frames*this->channels*((port->bits == 8)?1:2));
this->buf.num_frames = buf->num_frames;
-
+
/* pass data to original port */
- port->original_port->put_buffer(port->original_port, buf, stream);
-
+ port->original_port->put_buffer(port->original_port, buf, stream);
+
/* we must not use original data anymore, it should have already being moved
* to the fifo of free audio buffers. just use our private copy instead.
*/
- buf = &this->buf;
+ buf = &this->buf;
j = (this->channels >= 2) ? 1 : 0;
while (current_sample < buf->num_frames) {
-
+
if (this->do_samples_skip) {
if (current_sample + this->left_to_read > buf->num_frames) {
this->left_to_read -= (buf->num_frames-current_sample);
@@ -461,14 +461,14 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
current_sample+=this->left_to_read;
this->left_to_read = NUMSAMPLES;
this->do_samples_skip = 0;
-
+
}
} else {
if( port->bits == 8 ) {
data8 = (int8_t *)buf->mem;
data8 += current_sample * this->channels;
-
+
/* scale 8 bit data to 16 bits and convert to signed as well */
for ( i=current_sample ; this->data_idx < NUMSAMPLES && i < buf->num_frames;
i++, this->data_idx++,data8 += this->channels) {
@@ -507,13 +507,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
frame = this->vo_port->get_frame (this->vo_port, this->width_back, this->height_back,
this->ratio, XINE_IMGFMT_YUY2,
VO_BOTH_FIELDS);
-
+
frame->extra_info->invalid = 1;
-
+
frame->duration = 90000 * this->samples_per_frame / this->sample_rate;
frame->pts = pts;
this->metronom->got_video_frame(this->metronom, frame);
-
+
if (!this->skip_frame) {
/* Try to be fast */
goom_frame = (uint8_t *)goom_update (this->goom, this->data, 0, 0, NULL, NULL);
@@ -521,13 +521,13 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
dest_ptr = frame -> base[0];
goom_frame_end = goom_frame + 4 * (this->width_back * this->height_back);
- if ((this->csc_method == 1) &&
+ if ((this->csc_method == 1) &&
(xine_mm_accel() & MM_ACCEL_X86_MMX)) {
int plane_ptr = 0;
while (goom_frame < goom_frame_end) {
uint8_t r, g, b;
-
+
/* don't take endianness into account since MMX is only available
* on Intel processors */
b = *goom_frame; goom_frame++;
@@ -563,7 +563,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
g2 = *goom_frame; goom_frame++;
r2 = *goom_frame; goom_frame += 2;
#endif
-
+
*dest_ptr = COMPUTE_Y(r1, g1, b1);
dest_ptr++;
*dest_ptr = COMPUTE_U(r1, g1, b1);
@@ -585,7 +585,7 @@ static void goom_port_put_buffer (xine_audio_port_t *port_gen,
}
frame->free(frame);
-
+
width = this->width;
height = this->height;
if ((width != this->width_back) || (height != this->height_back)) {