diff options
Diffstat (limited to 'src/libxinevdec')
-rw-r--r-- | src/libxinevdec/Makefile.am | 3 | ||||
-rw-r--r-- | src/libxinevdec/bitplane.c | 36 | ||||
-rw-r--r-- | src/libxinevdec/foovideo.c | 14 | ||||
-rw-r--r-- | src/libxinevdec/gdkpixbuf.c | 41 | ||||
-rw-r--r-- | src/libxinevdec/image.c | 48 | ||||
-rw-r--r-- | src/libxinevdec/rgb.c | 82 | ||||
-rw-r--r-- | src/libxinevdec/xine_theora_decoder.c | 40 | ||||
-rw-r--r-- | src/libxinevdec/yuv.c | 46 |
8 files changed, 164 insertions, 146 deletions
diff --git a/src/libxinevdec/Makefile.am b/src/libxinevdec/Makefile.am index 9805eb09e..b7dbe1db1 100644 --- a/src/libxinevdec/Makefile.am +++ b/src/libxinevdec/Makefile.am @@ -1,3 +1,4 @@ +include $(top_builddir)/misc/Makefile.plugins include $(top_srcdir)/misc/Makefile.common AM_CFLAGS = $(VISIBILITY_FLAG) @@ -43,4 +44,4 @@ xineplug_decode_gdk_pixbuf_la_LIBADD = $(XINE_LIB) $(DYNAMIC_LD_LIBS) $(GDK_PIXB xineplug_decode_theora_la_SOURCES = xine_theora_decoder.c xineplug_decode_theora_la_CFLAGS = $(AM_CFLAGS) $(OGG_CFLAGS) $(THEORA_CFLAGS) -xineplug_decode_theora_la_LIBADD = $(XINE_LIB) $(OGG_LIBS) $(THEORA_LIBS) +xineplug_decode_theora_la_LIBADD = $(XINE_LIB) $(OGG_LIBS) $(THEORA_LIBS) $(LTLIBINTL) diff --git a/src/libxinevdec/bitplane.c b/src/libxinevdec/bitplane.c index bf868ad2a..76b7c8a89 100644 --- a/src/libxinevdec/bitplane.c +++ b/src/libxinevdec/bitplane.c @@ -29,6 +29,10 @@ * - untested (found no testfiles) IFF-ANIM OPT 3, 4 and 6 */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -252,7 +256,7 @@ static uint8_t *bitplane_decode_byterun1 (uint8_t *compressed, int i = 0; int j = 0; - uint8_t *uncompressed = xine_xmalloc( size_uncompressed ); + uint8_t *uncompressed = calloc(1, size_uncompressed ); while ( i < size_compressed && pixel_ptr < size_uncompressed ) { @@ -1158,8 +1162,8 @@ static void bitplane_decode_data (video_decoder_t *this_gen, this->bytes_per_pixel = 1; /* New Buffer for indexes (palette based formats) */ - this->index_buf = xine_xmalloc( this->num_pixel * this->bytes_per_pixel ); - this->index_buf_hist = xine_xmalloc( this->num_pixel * this->bytes_per_pixel ); + this->index_buf = calloc( this->num_pixel, this->bytes_per_pixel ); + this->index_buf_hist = calloc( this->num_pixel, this->bytes_per_pixel ); this->num_bitplanes = bih->biPlanes; this->camg_mode = bih->biCompression; @@ -1189,7 +1193,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen, if (this->buf) free (this->buf); this->bufsize = VIDEOBUFSIZE; - this->buf = xine_xmalloc(this->bufsize); + this->buf = calloc(1, this->bufsize); this->size = 0; this->framenumber = 0; @@ -1255,7 +1259,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen, case BUF_VIDEO_BITPLANE: /* uncompressed Buffer, set decoded_buf pointer direct to input stream */ if( this->buf_uk == NULL ) - this->buf_uk = xine_xmalloc( (this->size) ); + this->buf_uk = malloc(this->size); xine_fast_memcpy (this->buf_uk, this->buf, this->size); break; case BUF_VIDEO_BITPLANE_BR1: @@ -1294,7 +1298,7 @@ static void bitplane_decode_data (video_decoder_t *this_gen, } } if( this->buf_uk_hist == NULL ) { - this->buf_uk_hist = xine_xmalloc( (this->size_uk) ); + this->buf_uk_hist = malloc(this->size_uk); xine_fast_memcpy (this->buf_uk_hist, this->buf_uk, this->size_uk); xine_fast_memcpy (this->index_buf_hist, this->index_buf, (this->num_pixel * this->bytes_per_pixel)); @@ -1306,20 +1310,12 @@ static void bitplane_decode_data (video_decoder_t *this_gen, /* when no start-picture is given, create a empty one */ if( this->buf_uk_hist == NULL ) { this->size_uk = (((this->num_pixel) / 8) * this->num_bitplanes); - this->buf_uk = xine_xmalloc( (this->size_uk) ); - this->buf_uk_hist = xine_xmalloc( (this->size_uk) ); - for (i = 0; i < this->size_uk; i++) { - this->buf_uk[i] = 0; - this->buf_uk_hist[i] = 0; - } + this->buf_uk = calloc(this->num_bitplanes, ((this->num_pixel) / 8)); + this->buf_uk_hist = calloc(this->num_bitplanes, ((this->num_pixel) / 8)); } if( this->index_buf == NULL ) { - this->index_buf = xine_xmalloc( (this->num_pixel * this->bytes_per_pixel) ); - this->index_buf_hist = xine_xmalloc( (this->num_pixel * this->bytes_per_pixel) ); - for (i = 0; i < (this->num_pixel * this->bytes_per_pixel); i++) { - this->index_buf[i] = 0; - this->index_buf_hist[i] = 0; - } + this->index_buf = calloc( this->num_pixel, this->bytes_per_pixel ); + this->index_buf_hist = calloc( this->num_pixel, this->bytes_per_pixel ); } switch( anhd->operation ) { @@ -1523,7 +1519,7 @@ static void bitplane_dispose (video_decoder_t *this_gen) { static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { - bitplane_decoder_t *this = (bitplane_decoder_t *) xine_xmalloc (sizeof (bitplane_decoder_t)); + bitplane_decoder_t *this = (bitplane_decoder_t *) calloc(1, sizeof(bitplane_decoder_t)); this->video_decoder.decode_data = bitplane_decode_data; this->video_decoder.flush = bitplane_flush; @@ -1558,7 +1554,7 @@ static void dispose_class (video_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { - bitplane_class_t *this = (bitplane_class_t *) xine_xmalloc (sizeof (bitplane_class_t)); + bitplane_class_t *this = (bitplane_class_t *) calloc(1, sizeof(bitplane_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; diff --git a/src/libxinevdec/foovideo.c b/src/libxinevdec/foovideo.c index 98e0ebc0b..6e1fd0ac3 100644 --- a/src/libxinevdec/foovideo.c +++ b/src/libxinevdec/foovideo.c @@ -24,6 +24,10 @@ * frame when the frames are played in succession. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -63,7 +67,7 @@ typedef struct foovideo_decoder_s { /* these are variables exclusive to the foo video decoder */ unsigned char current_yuv_byte; - + } foovideo_decoder_t; /************************************************************************** @@ -94,7 +98,7 @@ static void foovideo_decode_data (video_decoder_t *this_gen, this->video_step = buf->decoder_info[0]; _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { /* need to initialize */ (this->stream->video_out->open) (this->stream->video_out, this->stream); @@ -206,7 +210,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre foovideo_decoder_t *this ; - this = (foovideo_decoder_t *) xine_xmalloc (sizeof (foovideo_decoder_t)); + this = (foovideo_decoder_t *) calloc(1, sizeof(foovideo_decoder_t)); this->video_decoder.decode_data = foovideo_decode_data; this->video_decoder.flush = foovideo_flush; @@ -256,7 +260,7 @@ static void *init_plugin (xine_t *xine, void *data) { foovideo_class_t *this; - this = (foovideo_class_t *) xine_xmalloc (sizeof (foovideo_class_t)); + this = (foovideo_class_t *) calloc(1, sizeof(foovideo_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; @@ -272,7 +276,7 @@ static void *init_plugin (xine_t *xine, void *data) { * list of valid buffer types (and add a new one if the one you need does * not exist). Terminate the list with a 0. */ -static const uint32_t video_types[] = { +static const uint32_t video_types[] = { /* BUF_VIDEO_FOOVIDEO, */ BUF_VIDEO_VQA, BUF_VIDEO_SORENSON_V3, diff --git a/src/libxinevdec/gdkpixbuf.c b/src/libxinevdec/gdkpixbuf.c index b5acdfa42..8815edabe 100644 --- a/src/libxinevdec/gdkpixbuf.c +++ b/src/libxinevdec/gdkpixbuf.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2006 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 @@ -20,6 +20,11 @@ * a gdk-pixbuf-based image video decoder */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + + #include <stdlib.h> #include <string.h> @@ -60,7 +65,7 @@ typedef struct image_decoder_s { xine_stream_t *stream; int video_open; - + GdkPixbufLoader *loader; } image_decoder_t; @@ -153,8 +158,8 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { * alloc and draw video frame */ img = this->stream->video_out->get_frame (this->stream->video_out, width, - height, (double)width/(double)height, - XINE_IMGFMT_YUY2, + height, (double)width/(double)height, + XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; img->duration = 3600; @@ -162,9 +167,9 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { yuv444_to_yuy2(&yuv_planes, img->base[0], img->pitches[0]); free_yuv_planes(&yuv_planes); - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, img->duration); - + img->draw(img, this->stream); img->free(img); } @@ -173,7 +178,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { static void image_flush (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * flush out any frames that are still stored in the decoder */ @@ -182,7 +187,7 @@ static void image_flush (video_decoder_t *this_gen) { static void image_reset (video_decoder_t *this_gen) { image_decoder_t *this = (image_decoder_t *) this_gen; - + /* * reset decoder after engine flush (prepare for new * video data not related to recently decoded data) @@ -198,7 +203,7 @@ static void image_reset (video_decoder_t *this_gen) { static void image_discontinuity (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * a time reference discontinuity has happened. * that is, it must forget any currently held pts value @@ -226,7 +231,7 @@ static void image_dispose (video_decoder_t *this_gen) { } -static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { image_class_t *cls = (image_class_t *) class_gen; @@ -236,7 +241,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, g_type_init (); - this = (image_decoder_t *) xine_xmalloc (sizeof (image_decoder_t)); + this = (image_decoder_t *) calloc(1, sizeof(image_decoder_t)); this->video_decoder.decode_data = image_decode_data; this->video_decoder.flush = image_flush; @@ -269,7 +274,7 @@ static void dispose_class (video_decoder_class_t *this_gen) { image_class_t *this = (image_class_t *) this_gen; lprintf("class closed\n"); - + free (this); } @@ -277,7 +282,7 @@ static void *init_class (xine_t *xine, void *data) { image_class_t *this; - this = (image_class_t *) xine_xmalloc (sizeof (image_class_t)); + this = (image_class_t *) calloc(1, sizeof(image_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; @@ -289,7 +294,7 @@ static void *init_class (xine_t *xine, void *data) { */ lprintf("class opened\n"); - + return this; } @@ -305,7 +310,7 @@ static const decoder_info_t dec_info_image = { }; 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_VIDEO_DECODER, 18, "gdkpixbuf", XINE_VERSION_CODE, &dec_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/image.c b/src/libxinevdec/image.c index a338e3cab..2c19d36fb 100644 --- a/src/libxinevdec/image.c +++ b/src/libxinevdec/image.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2003-2005 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 @@ -20,6 +20,10 @@ * a image video decoder */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdlib.h> #include <string.h> @@ -67,7 +71,7 @@ typedef struct image_decoder_s { xine_stream_t *stream; int video_open; - + unsigned char *image; int index; @@ -85,10 +89,10 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { xine_buffer_copyin(this->image, this->index, buf->mem, buf->size); this->index += buf->size; - + if (buf->decoder_flags & BUF_FLAG_FRAME_END) { int width, height, i; - MagickBooleanType status; + int status; MagickWand *wand; uint8_t *img_buf, *img_buf_ptr; yuv_planes_t yuv_planes; @@ -101,7 +105,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { status = MagickReadImageBlob(wand, this->image, this->index); this->index = 0; - if (status == MagickFalse) { + if (!status) { DestroyMagickWand(wand); lprintf("error loading image\n"); return; @@ -139,8 +143,8 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { * alloc and draw video frame */ img = this->stream->video_out->get_frame (this->stream->video_out, width, - height, (double)width/(double)height, - XINE_IMGFMT_YUY2, + height, (double)width/(double)height, + XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); img->pts = buf->pts; img->duration = 3600; @@ -148,9 +152,9 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { yuv444_to_yuy2(&yuv_planes, img->base[0], img->pitches[0]); free_yuv_planes(&yuv_planes); - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, img->duration); - + img->draw(img, this->stream); img->free(img); } @@ -159,7 +163,7 @@ static void image_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { static void image_flush (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * flush out any frames that are still stored in the decoder */ @@ -168,19 +172,19 @@ static void image_flush (video_decoder_t *this_gen) { static void image_reset (video_decoder_t *this_gen) { image_decoder_t *this = (image_decoder_t *) this_gen; - + /* * reset decoder after engine flush (prepare for new * video data not related to recently decoded data) */ - + this->index = 0; } static void image_discontinuity (video_decoder_t *this_gen) { /* image_decoder_t *this = (image_decoder_t *) this_gen; */ - + /* * a time reference discontinuity has happened. * that is, it must forget any currently held pts value @@ -204,7 +208,7 @@ static void image_dispose (video_decoder_t *this_gen) { } -static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, +static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stream_t *stream) { image_class_t *cls = (image_class_t *) class_gen; @@ -212,7 +216,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, lprintf("opened\n"); - this = (image_decoder_t *) xine_xmalloc (sizeof (image_decoder_t)); + this = (image_decoder_t *) calloc(1, sizeof(image_decoder_t)); this->video_decoder.decode_data = image_decode_data; this->video_decoder.flush = image_flush; @@ -247,7 +251,7 @@ static void dispose_class (video_decoder_class_t *this_gen) { image_class_t *this = (image_class_t *) this_gen; lprintf("class closed\n"); - + free (this); } @@ -255,7 +259,7 @@ static void *init_class (xine_t *xine, void *data) { image_class_t *this; - this = (image_class_t *) xine_xmalloc (sizeof (image_class_t)); + this = (image_class_t *) calloc(1, sizeof(image_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; @@ -267,7 +271,7 @@ static void *init_class (xine_t *xine, void *data) { */ lprintf("class opened\n"); - + return this; } @@ -284,7 +288,7 @@ static const decoder_info_t dec_info_image = { }; 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_VIDEO_DECODER, 18, "image", XINE_VERSION_CODE, &dec_info_image, init_class }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/rgb.c b/src/libxinevdec/rgb.c index 0e7be4c18..9e28afd90 100644 --- a/src/libxinevdec/rgb.c +++ b/src/libxinevdec/rgb.c @@ -27,10 +27,14 @@ * file can be 32-, 24-, 16-, 8-, 4-, 2-, or 1-bit. Any resolutions <= 8 * can also be greyscale depending on what the QT file specifies. * - * One more catch: Raw RGB from a Microsoft file is upside down. This is + * One more catch: Raw RGB from a Microsoft file is upside down. This is * indicated by a negative height parameter. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -76,7 +80,7 @@ typedef struct rgb_decoder_s { unsigned char yuv_palette[256 * 4]; yuv_planes_t yuv_planes; - + } rgb_decoder_t; static void rgb_decode_data (video_decoder_t *this_gen, @@ -117,7 +121,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, this->video_step = buf->decoder_info[0]; _x_stream_info_set(this->stream, XINE_STREAM_INFO_FRAME_DURATION, this->video_step); } - + if (buf->decoder_flags & BUF_FLAG_STDHEADER) { /* need to initialize */ (this->stream->video_out->open) (this->stream->video_out, this->stream); @@ -145,7 +149,7 @@ static void rgb_decode_data (video_decoder_t *this_gen, /* minimal buffer size */ this->bufsize = this->width * this->height * this->bytes_per_pixel; - this->buf = xine_xmalloc(this->bufsize); + this->buf = calloc(1, this->bufsize); this->size = 0; init_yuv_planes(&this->yuv_planes, this->width, this->height); @@ -191,11 +195,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, palette_index = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; } else if (this->bytes_per_pixel == 2) { @@ -205,11 +209,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, buf_ptr += 2; UNPACK_BGR15(packed_pixel, r, g, b); - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } else { @@ -222,11 +226,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, /* the next line takes care of 'A' in the 32-bit case */ buf_ptr += this->bytes_per_pixel - 3; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } @@ -246,18 +250,18 @@ static void rgb_decode_data (video_decoder_t *this_gen, } if (pixel_byte & 0x80) { - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[1 * 4 + 2]; } else { - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[0 * 4 + 2]; } pixels_left--; @@ -271,11 +275,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, } palette_index = (pixel_byte & 0xC0) >> 6; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; pixels_left--; @@ -289,11 +293,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, } palette_index = (pixel_byte & 0xF0) >> 4; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; pixels_left--; @@ -303,11 +307,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, palette_index = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 0]; - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 1]; - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = this->yuv_palette[palette_index * 4 + 2]; } else if (this->bytes_per_pixel == 2) { @@ -317,16 +321,16 @@ static void rgb_decode_data (video_decoder_t *this_gen, buf_ptr += 2; UNPACK_RGB15(packed_pixel, r, g, b); - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } else { - /* RGB24 or ARGB32; the next line takes care of 'A' in the + /* RGB24 or ARGB32; the next line takes care of 'A' in the * 32-bit case */ buf_ptr += this->bytes_per_pixel - 3; @@ -334,11 +338,11 @@ static void rgb_decode_data (video_decoder_t *this_gen, g = this->buf[buf_ptr++]; b = this->buf[buf_ptr++]; - this->yuv_planes.y[row_ptr + pixel_ptr] = + this->yuv_planes.y[row_ptr + pixel_ptr] = COMPUTE_Y(r, g, b); - this->yuv_planes.u[row_ptr + pixel_ptr] = + this->yuv_planes.u[row_ptr + pixel_ptr] = COMPUTE_U(r, g, b); - this->yuv_planes.v[row_ptr + pixel_ptr] = + this->yuv_planes.v[row_ptr + pixel_ptr] = COMPUTE_V(r, g, b); } @@ -398,7 +402,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre rgb_decoder_t *this ; - this = (rgb_decoder_t *) xine_xmalloc (sizeof (rgb_decoder_t)); + this = (rgb_decoder_t *) calloc(1, sizeof(rgb_decoder_t)); this->video_decoder.decode_data = rgb_decode_data; this->video_decoder.flush = rgb_flush; @@ -432,7 +436,7 @@ static void *init_plugin (xine_t *xine, void *data) { rgb_class_t *this; - this = (rgb_class_t *) xine_xmalloc (sizeof (rgb_class_t)); + this = (rgb_class_t *) calloc(1, sizeof(rgb_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; @@ -446,7 +450,7 @@ static void *init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static const uint32_t video_types[] = { +static const uint32_t video_types[] = { BUF_VIDEO_RGB, 0 }; @@ -457,7 +461,7 @@ static const decoder_info_t dec_info_video = { }; 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_VIDEO_DECODER, 18, "rgb", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/xine_theora_decoder.c b/src/libxinevdec/xine_theora_decoder.c index c71ce7559..bf51a8779 100644 --- a/src/libxinevdec/xine_theora_decoder.c +++ b/src/libxinevdec/xine_theora_decoder.c @@ -1,18 +1,18 @@ /* * Copyright (C) 2001-2003 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 @@ -101,17 +101,17 @@ static void yuv2frame(yuv_buffer *yuv, vo_frame_t *frame, int offset_x, int offs crop_offset=offset_x+yuv->y_stride*offset_y; for(i=0;i<frame->height;i++) - xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, - yuv->y+crop_offset+yuv->y_stride*i, + xine_fast_memcpy(frame->base[0]+frame->pitches[0]*i, + yuv->y+crop_offset+yuv->y_stride*i, frame->width); crop_offset=(offset_x/2)+(yuv->uv_stride)*(offset_y/2); for(i=0;i<frame->height/2;i++){ - xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, - yuv->u+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[1]+frame->pitches[1]*i, + yuv->u+crop_offset+yuv->uv_stride*i, frame->width/2); - xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, - yuv->v+crop_offset+yuv->uv_stride*i, + xine_fast_memcpy(frame->base[2]+frame->pitches[2]*i, + yuv->v+crop_offset+yuv->uv_stride*i, frame->width/2); } @@ -123,7 +123,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { if (buf->decoder_flags & BUF_FLAG_FRAME_START) { this->done=0; /*start from the beginnig*/ - this->reject=0;/*new packet - new try*/ + this->reject=0;/*new packet - new try*/ /*copy the ogg_packet struct and the sum, correct the adress of the packet*/ xine_fast_memcpy (&this->op, buf->content, sizeof(ogg_packet)); @@ -142,7 +142,7 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { } readin_op (this, buf->content, buf->size ); } - + if ((buf->decoder_flags & BUF_FLAG_FRAME_END) && !this->reject) { if ( this->done != this->op.bytes ) { printf ("libtheora: A packet changed its size during transfer - rejected\n"); @@ -156,8 +156,8 @@ static int collect_data (theora_decoder_t *this, buf_element_t *buf ) { static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { /* - * decode data from buf and feed decoded frames to - * video output + * decode data from buf and feed decoded frames to + * video output */ theora_decoder_t *this = (theora_decoder_t *) this_gen; vo_frame_t *frame; @@ -195,7 +195,7 @@ static void theora_decode_data (video_decoder_t *this_gen, buf_element_t *buf) { } /*headers are now decoded. initialize the decoder*/ theora_decode_init (&this->t_state, &this->t_info); - + lprintf("theora stream is Theora %dx%d %.02f fps video.\n" " frame content is %dx%d with offset (%d,%d).\n" " pixel aspect is %d:%d.\n", @@ -312,7 +312,7 @@ static video_decoder_t *theora_open_plugin (video_decoder_class_t *class_gen, xi theora_decoder_t *this ; - this = (theora_decoder_t *) xine_xmalloc (sizeof (theora_decoder_t)); + this = (theora_decoder_t *) calloc(1, sizeof(theora_decoder_t)); this->theora_decoder.decode_data = theora_decode_data; this->theora_decoder.flush = theora_flush; @@ -353,7 +353,7 @@ static char *theora_get_identifier (video_decoder_class_t *this) { static char *theora_get_description (video_decoder_class_t *this) { /* - * return human readable (verbose = 1 line) description for + * return human readable (verbose = 1 line) description for * this plugin class */ return "theora video decoder plugin"; @@ -369,8 +369,8 @@ static void theora_dispose_class (video_decoder_class_t *this) { static void *init_plugin (xine_t *xine, void *data) { /*initialize our plugin*/ theora_class_t *this; - - this = (theora_class_t *) xine_xmalloc (sizeof (theora_class_t)); + + this = (theora_class_t *) calloc(1, sizeof(theora_class_t)); this->decoder_class.open_plugin = theora_open_plugin; this->decoder_class.get_identifier = theora_get_identifier; @@ -392,7 +392,7 @@ static const decoder_info_t dec_info_video = { }; 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_VIDEO_DECODER, 18, "theora", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; diff --git a/src/libxinevdec/yuv.c b/src/libxinevdec/yuv.c index 2b8657685..6cb1b240c 100644 --- a/src/libxinevdec/yuv.c +++ b/src/libxinevdec/yuv.c @@ -22,6 +22,10 @@ * a way that xine can display them. */ +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -58,7 +62,7 @@ typedef struct yuv_decoder_s { int width; /* the width of a video frame */ int height; /* the height of a video frame */ double ratio; /* the width to height ratio */ - + int progressive; int top_field_first; @@ -100,10 +104,10 @@ static void yuv_decode_data (video_decoder_t *this_gen, this->ratio = (double)buf->decoder_info[1] / (double)buf->decoder_info[2]; else this->ratio = (double)this->width / (double)this->height; - + this->progressive = buf->decoder_info[3]; this->top_field_first = buf->decoder_info[4]; - + if (this->buf) { free (this->buf); this->buf = NULL; @@ -121,7 +125,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, case BUF_VIDEO_YUY2: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YUY2"); break; - + case BUF_VIDEO_YV12: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw YV12"); break; @@ -133,13 +137,13 @@ static void yuv_decode_data (video_decoder_t *this_gen, case BUF_VIDEO_GREY: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Greyscale YUV"); break; - + case BUF_VIDEO_I420: _x_meta_info_set_utf8(this->stream, XINE_META_INFO_VIDEOCODEC, "Raw I420"); break; } - + _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_WIDTH, this->width); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, this->height); _x_stream_info_set(this->stream, XINE_STREAM_INFO_VIDEO_RATIO, this->ratio*10000); @@ -162,14 +166,14 @@ static void yuv_decode_data (video_decoder_t *this_gen, xine_fast_memcpy (&this->buf[this->size], buf->content, buf->size); this->size += buf->size; - + src = this->buf; } if (buf->decoder_flags & BUF_FLAG_FRAME_END) { if (buf->type == BUF_VIDEO_YUY2) { - + img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YUY2, VO_BOTH_FIELDS); @@ -180,14 +184,14 @@ static void yuv_decode_data (video_decoder_t *this_gen, /* dst */ img->base[0], img->pitches[0], /* width x height */ - this->width, this->height); - + this->width, this->height); + } else if (buf->type == BUF_VIDEO_YV12) { img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); - + yv12_to_yv12( /* Y */ src, this->width, @@ -202,7 +206,7 @@ static void yuv_decode_data (video_decoder_t *this_gen, this->width, this->height); } else if (buf->type == BUF_VIDEO_I420) { - + img = this->stream->video_out->get_frame (this->stream->video_out, this->width, this->height, this->ratio, XINE_IMGFMT_YV12, VO_BOTH_FIELDS); @@ -229,17 +233,17 @@ static void yuv_decode_data (video_decoder_t *this_gen, yuv9_to_yv12( /* Y */ - src, + src, this->width, - img->base[0], + img->base[0], img->pitches[0], /* U */ - src + (this->width * this->height), + src + (this->width * this->height), this->width / 4, img->base[1], img->pitches[1], /* V */ - src + (this->width * this->height) + + src + (this->width * this->height) + (this->width * this->height / 16), this->width / 4, img->base[2], @@ -321,7 +325,7 @@ static video_decoder_t *open_plugin (video_decoder_class_t *class_gen, xine_stre yuv_decoder_t *this ; - this = (yuv_decoder_t *) xine_xmalloc (sizeof (yuv_decoder_t)); + this = (yuv_decoder_t *) calloc(1, sizeof(yuv_decoder_t)); this->video_decoder.decode_data = yuv_decode_data; this->video_decoder.flush = yuv_flush; @@ -355,7 +359,7 @@ static void *init_plugin (xine_t *xine, void *data) { yuv_class_t *this; - this = (yuv_class_t *) xine_xmalloc (sizeof (yuv_class_t)); + this = (yuv_class_t *) calloc(1, sizeof(yuv_class_t)); this->decoder_class.open_plugin = open_plugin; this->decoder_class.get_identifier = get_identifier; @@ -369,8 +373,8 @@ static void *init_plugin (xine_t *xine, void *data) { * exported plugin catalog entry */ -static const uint32_t video_types[] = { - BUF_VIDEO_YUY2, +static const uint32_t video_types[] = { + BUF_VIDEO_YUY2, BUF_VIDEO_YV12, BUF_VIDEO_YVU9, BUF_VIDEO_GREY, @@ -384,7 +388,7 @@ static const decoder_info_t dec_info_video = { }; 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_VIDEO_DECODER, 18, "yuv", XINE_VERSION_CODE, &dec_info_video, init_plugin }, { PLUGIN_NONE, 0, "", 0, NULL, NULL } }; |