gstreamer/libs/colorspace/gstcolorspace.c
Wim Taymans d3fb1a8bd3 Added SCR and mux_rate calculations in the MPEG1 multiplexer. worked toward a unified putbits implementation
Original commit message from CVS:
Added SCR and mux_rate calculations in the MPEG1 multiplexer.
worked toward a unified putbits implementation
Added an MPEG audio layer 1&2 encoder.
2000-06-16 22:30:24 +00:00

76 lines
2.9 KiB
C

/* Gnome-Streamer
* Copyright (C) <1999> Erik Walthinsen <omega@cse.ogi.edu>
*
* 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 <gst/gst.h>
#include <gstcolorspace.h>
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->color_tables = NULL;
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);
}