mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-20 16:51:10 +00:00
colorspace: Use GST_CHECK_PLUGINS_BASE_VERSION() instead of other hacks
This commit is contained in:
parent
2271608c43
commit
eccb88afb0
2 changed files with 12 additions and 10 deletions
|
@ -27,6 +27,8 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "gstcolorspaceorc.h"
|
#include "gstcolorspaceorc.h"
|
||||||
|
|
||||||
|
/* For GST_CHECK_PLUGINS_BASE_VERSION() */
|
||||||
|
#include <gst/pbutils/pbutils.h>
|
||||||
|
|
||||||
static void colorspace_convert_generic (ColorspaceConvert * convert,
|
static void colorspace_convert_generic (ColorspaceConvert * convert,
|
||||||
guint8 * dest, const guint8 * src);
|
guint8 * dest, const guint8 * src);
|
||||||
|
@ -99,7 +101,7 @@ colorspace_convert_new (GstVideoFormat to_format, ColorSpaceColorSpec to_spec,
|
||||||
|
|
||||||
convert->tmpline = g_malloc (sizeof (guint32) * width * 2);
|
convert->tmpline = g_malloc (sizeof (guint32) * width * 2);
|
||||||
|
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
if (to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) {
|
if (to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) {
|
||||||
/* build poor man's palette, taken from ffmpegcolorspace */
|
/* build poor man's palette, taken from ffmpegcolorspace */
|
||||||
static const guint8 pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff };
|
static const guint8 pal_value[6] = { 0x00, 0x33, 0x66, 0x99, 0xcc, 0xff };
|
||||||
|
@ -882,7 +884,7 @@ putline_A420 (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
|
||||||
FRAME_GET_LINE (dest, 3, j), src, convert->width / 2);
|
FRAME_GET_LINE (dest, 3, j), src, convert->width / 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
static void
|
static void
|
||||||
getline_RGB8P (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
|
getline_RGB8P (ColorspaceConvert * convert, guint8 * dest, const guint8 * src,
|
||||||
int j)
|
int j)
|
||||||
|
@ -961,7 +963,7 @@ static const ColorspaceLine lines[] = {
|
||||||
{GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
|
{GST_VIDEO_FORMAT_BGR15, getline_BGR15, putline_BGR15},
|
||||||
{GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
|
{GST_VIDEO_FORMAT_UYVP, getline_UYVP, putline_UYVP},
|
||||||
{GST_VIDEO_FORMAT_A420, getline_A420, putline_A420}
|
{GST_VIDEO_FORMAT_A420, getline_A420, putline_A420}
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
, {GST_VIDEO_FORMAT_RGB8_PALETTED, getline_RGB8P, putline_RGB8P}
|
, {GST_VIDEO_FORMAT_RGB8_PALETTED, getline_RGB8P, putline_RGB8P}
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,18 +40,18 @@
|
||||||
#include "gstcolorspace.h"
|
#include "gstcolorspace.h"
|
||||||
#include <gst/video/video.h>
|
#include <gst/video/video.h>
|
||||||
|
|
||||||
|
/* For GST_CHECK_PLUGINS_BASE_VERSION() */
|
||||||
|
#include <gst/pbutils/pbutils.h>
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY (colorspace_debug);
|
GST_DEBUG_CATEGORY (colorspace_debug);
|
||||||
#define GST_CAT_DEFAULT colorspace_debug
|
#define GST_CAT_DEFAULT colorspace_debug
|
||||||
GST_DEBUG_CATEGORY (colorspace_performance);
|
GST_DEBUG_CATEGORY (colorspace_performance);
|
||||||
|
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if !GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
#define VIDEO_CAPS_RGB8_PALETTED \
|
#define VIDEO_CAPS_RGB8_PALETTED \
|
||||||
"video/x-raw-rgb, bpp = (int)8, depth = (int)8, " \
|
GST_VIDEO_CAPS_RGB8_PALETTED "; "
|
||||||
"width = "GST_VIDEO_SIZE_RANGE" , " \
|
|
||||||
"height = " GST_VIDEO_SIZE_RANGE ", " \
|
|
||||||
"framerate = "GST_VIDEO_FPS_RANGE "; "
|
|
||||||
#else
|
#else
|
||||||
#define VIDEO_CAPS_RGB8_PALETTED /* no-op */
|
#define VIDEO_CAPS_RGB8_PALETTED /* no-op */
|
||||||
#endif
|
#endif
|
||||||
|
@ -315,7 +315,7 @@ gst_csp_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
|
||||||
if (space->convert) {
|
if (space->convert) {
|
||||||
colorspace_convert_set_interlaced (space->convert, in_interlaced);
|
colorspace_convert_set_interlaced (space->convert, in_interlaced);
|
||||||
}
|
}
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
/* palette, only for from data */
|
/* palette, only for from data */
|
||||||
if (space->from_format == GST_VIDEO_FORMAT_RGB8_PALETTED &&
|
if (space->from_format == GST_VIDEO_FORMAT_RGB8_PALETTED &&
|
||||||
space->to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) {
|
space->to_format == GST_VIDEO_FORMAT_RGB8_PALETTED) {
|
||||||
|
@ -371,7 +371,7 @@ format_mismatch:
|
||||||
space->to_format = GST_VIDEO_FORMAT_UNKNOWN;
|
space->to_format = GST_VIDEO_FORMAT_UNKNOWN;
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#ifdef GST_VIDEO_CAPS_RGB8_PALETTED
|
#if GST_CHECK_PLUGINS_BASE_VERSION(0, 10, 32)
|
||||||
invalid_palette:
|
invalid_palette:
|
||||||
{
|
{
|
||||||
GST_ERROR_OBJECT (space, "invalid palette");
|
GST_ERROR_OBJECT (space, "invalid palette");
|
||||||
|
|
Loading…
Reference in a new issue