/* Gnome-Streamer * Copyright (C) <1999> Erik Walthinsen * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ //#define DEBUG_ENABLED #include #include extern GstColorSpaceConverter gst_colorspace_rgb2rgb_get_converter(GstColorSpace *space, GstColorSpaceType srcspace, GstColorSpaceType destspace); extern GstColorSpaceConverter gst_colorspace_yuv2rgb_get_converter(GstColorSpace *space, GstColorSpaceType srcspace, GstColorSpaceType destspace); extern GstColorSpaceConverter gst_colorspace_rgb2yuv_get_converter(GstColorSpace *space, GstColorSpaceType srcspace, GstColorSpaceType destspace); extern GstColorSpaceConverter gst_colorspace_yuv2yuv_get_converter(GstColorSpace *space, GstColorSpaceType srcspace, GstColorSpaceType destspace); GstColorSpace *gst_colorspace_new(int width, int height, GstColorSpaceType srcspace, GstColorSpaceType destspace, GdkVisual *destvisual) { GstColorSpace *new = g_malloc(sizeof(GstColorSpace)); new->width = width; new->height = height; new->srcspace = srcspace; new->destspace = destspace; new->visual = destvisual; new->convert = NULL; DEBUG("gst_colorspace: new\n"); if (GST_COLORSPACE_IS_RGB_TYPE(srcspace)) { if (GST_COLORSPACE_IS_RGB_TYPE(destspace)) { new->convert = gst_colorspace_rgb2rgb_get_converter(new, srcspace, destspace); } else { //return gst_colorspace_rgb2yuv_get_converter(srcspace, destspace); } } else if (GST_COLORSPACE_IS_YUV_TYPE(srcspace)) { if (GST_COLORSPACE_IS_RGB_TYPE(destspace)) { new->convert = gst_colorspace_yuv2rgb_get_converter(new, srcspace, destspace); } else { //return gst_colorspace_yuv2yuv_get_converter(srcspace, destspace); } } if (new->convert == NULL) { g_print("gst_colorspace: conversion not implemented\n"); } return new; } void gst_colorspace_destroy(GstColorSpace *space) { if (space->color_tables) g_free(space->color_tables); g_free(space); }