Commit b5de0552 authored by Wim Taymans's avatar Wim Taymans
Browse files

video: move chroma functions to separate file

parent 620e3aad
......@@ -3,7 +3,7 @@ ORC_SOURCE=video-orc
include $(top_srcdir)/common/orc.mak
glib_enum_headers = video.h video-format.h video-color.h video-info.h \
colorbalance.h navigation.h
colorbalance.h navigation.h video-chroma.h
glib_enum_define = GST_VIDEO
glib_gen_prefix = gst_video
glib_gen_basename = video
......@@ -23,6 +23,7 @@ libgstvideo_@GST_API_VERSION@_la_SOURCES = \
video.c \
video-event.c \
video-format.c \
video-chroma.c \
video-color.c \
video-info.c \
video-frame.c \
......@@ -49,6 +50,7 @@ libgstvideo_@GST_API_VERSION@include_HEADERS = \
video.h \
video-event.h \
video-format.h \
video-chroma.h \
video-color.h \
video-info.h \
video-frame.h \
......
/* GStreamer
* Copyright (C) 2013 Wim Taymans <wim.taymans@gmail.com>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <string.h>
#include <stdio.h>
#include "video-format.h"
typedef struct
{
const gchar *name;
GstVideoChromaSite site;
} ChromaSiteInfo;
static const ChromaSiteInfo chromasite[] = {
{"jpeg", GST_VIDEO_CHROMA_SITE_JPEG},
{"mpeg2", GST_VIDEO_CHROMA_SITE_MPEG2},
{"dv", GST_VIDEO_CHROMA_SITE_DV}
};
/**
* gst_video_chroma_from_string:
* @s: a chromasite string
*
* Convert @s to a #GstVideoChromaSite
*
* Returns: a #GstVideoChromaSite or %GST_VIDEO_CHROMA_SITE_UNKNOWN when @s does
* not contain a valid chroma description.
*/
GstVideoChromaSite
gst_video_chroma_from_string (const gchar * s)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
if (g_str_equal (chromasite[i].name, s))
return chromasite[i].site;
}
return GST_VIDEO_CHROMA_SITE_UNKNOWN;
}
/**
* gst_video_chroma_to_string:
* @site: a #GstVideoChromaSite
*
* Converts @site to its string representation.
*
* Returns: a string describing @site.
*/
const gchar *
gst_video_chroma_to_string (GstVideoChromaSite site)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
if (chromasite[i].site == site)
return chromasite[i].name;
}
return NULL;
}
/* GStreamer
* Copyright (C) <2013> Wim Taymans <wim.taymans@gmail.com>
*
* 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., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#ifndef __GST_VIDEO_CHROMA_H__
#define __GST_VIDEO_CHROMA_H__
#include <gst/gst.h>
G_BEGIN_DECLS
/**
* GstVideoChromaSite:
* @GST_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
* @GST_VIDEO_CHROMA_SITE_NONE: no cositing
* @GST_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
* @GST_VIDEO_CHROMA_SITE_V_COSITED: chroma is vertically cosited
* @GST_VIDEO_CHROMA_SITE_ALT_LINE: choma samples are sited on alternate lines
* @GST_VIDEO_CHROMA_SITE_COSITED: chroma samples cosited with luma samples
* @GST_VIDEO_CHROMA_SITE_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
* @GST_VIDEO_CHROMA_SITE_MPEG2: mpeg2 style cositing
* @GST_VIDEO_CHROMA_SITE_DV: DV style cositing
*
* Various Chroma sitings.
*/
typedef enum {
GST_VIDEO_CHROMA_SITE_UNKNOWN = 0,
GST_VIDEO_CHROMA_SITE_NONE = (1 << 0),
GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
GST_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
/* some common chroma cositing */
GST_VIDEO_CHROMA_SITE_COSITED = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
GST_VIDEO_CHROMA_SITE_JPEG = (GST_VIDEO_CHROMA_SITE_NONE),
GST_VIDEO_CHROMA_SITE_MPEG2 = (GST_VIDEO_CHROMA_SITE_H_COSITED),
GST_VIDEO_CHROMA_SITE_DV = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
} GstVideoChromaSite;
GstVideoChromaSite gst_video_chroma_from_string (const gchar * s);
const gchar * gst_video_chroma_to_string (GstVideoChromaSite site);
G_END_DECLS
#endif /* __GST_VIDEO_CHROMA_H__ */
......@@ -2371,54 +2371,3 @@ gst_video_format_get_palette (GstVideoFormat format, gsize * size)
return NULL;
}
}
typedef struct
{
const gchar *name;
GstVideoChromaSite site;
} ChromaSiteInfo;
static const ChromaSiteInfo chromasite[] = {
{"jpeg", GST_VIDEO_CHROMA_SITE_JPEG},
{"mpeg2", GST_VIDEO_CHROMA_SITE_MPEG2},
{"dv", GST_VIDEO_CHROMA_SITE_DV}
};
/**
* gst_video_chroma_from_string:
* @s: a chromasite string
*
* Convert @s to a #GstVideoChromaSite
*
* Returns: a #GstVideoChromaSite or %GST_VIDEO_CHROMA_SITE_UNKNOWN when @s does
* not contain a valid chroma description.
*/
GstVideoChromaSite
gst_video_chroma_from_string (const gchar * s)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
if (g_str_equal (chromasite[i].name, s))
return chromasite[i].site;
}
return GST_VIDEO_CHROMA_SITE_UNKNOWN;
}
/**
* gst_video_chroma_to_string:
* @site: a #GstVideoChromaSite
*
* Converts @site to its string representation.
*
* Returns: a string describing @site.
*/
const gchar *
gst_video_chroma_to_string (GstVideoChromaSite site)
{
gint i;
for (i = 0; i < G_N_ELEMENTS (chromasite); i++) {
if (chromasite[i].site == site)
return chromasite[i].name;
}
return NULL;
}
......@@ -143,36 +143,6 @@ typedef enum {
typedef struct _GstVideoFormatInfo GstVideoFormatInfo;
/**
* GstVideoChromaSite:
* @GST_VIDEO_CHROMA_SITE_UNKNOWN: unknown cositing
* @GST_VIDEO_CHROMA_SITE_NONE: no cositing
* @GST_VIDEO_CHROMA_SITE_H_COSITED: chroma is horizontally cosited
* @GST_VIDEO_CHROMA_SITE_V_COSITED: chroma is vertically cosited
* @GST_VIDEO_CHROMA_SITE_ALT_LINE: choma samples are sited on alternate lines
* @GST_VIDEO_CHROMA_SITE_COSITED: chroma samples cosited with luma samples
* @GST_VIDEO_CHROMA_SITE_JPEG: jpeg style cositing, also for mpeg1 and mjpeg
* @GST_VIDEO_CHROMA_SITE_MPEG2: mpeg2 style cositing
* @GST_VIDEO_CHROMA_SITE_DV: DV style cositing
*
* Various Chroma sitings.
*/
typedef enum {
GST_VIDEO_CHROMA_SITE_UNKNOWN = 0,
GST_VIDEO_CHROMA_SITE_NONE = (1 << 0),
GST_VIDEO_CHROMA_SITE_H_COSITED = (1 << 1),
GST_VIDEO_CHROMA_SITE_V_COSITED = (1 << 2),
GST_VIDEO_CHROMA_SITE_ALT_LINE = (1 << 3),
/* some common chroma cositing */
GST_VIDEO_CHROMA_SITE_COSITED = (GST_VIDEO_CHROMA_SITE_H_COSITED | GST_VIDEO_CHROMA_SITE_V_COSITED),
GST_VIDEO_CHROMA_SITE_JPEG = (GST_VIDEO_CHROMA_SITE_NONE),
GST_VIDEO_CHROMA_SITE_MPEG2 = (GST_VIDEO_CHROMA_SITE_H_COSITED),
GST_VIDEO_CHROMA_SITE_DV = (GST_VIDEO_CHROMA_SITE_COSITED | GST_VIDEO_CHROMA_SITE_ALT_LINE),
} GstVideoChromaSite;
GstVideoChromaSite gst_video_chroma_from_string (const gchar * s);
const gchar * gst_video_chroma_to_string (GstVideoChromaSite site);
/**
* GstVideoFormatFlags:
* @GST_VIDEO_FORMAT_FLAG_YUV: The video format is YUV, components are numbered
......@@ -223,6 +193,8 @@ typedef enum
#define GST_VIDEO_COMP_INDEX 0
#define GST_VIDEO_COMP_PALETTE 1
#include <gst/video/video-chroma.h>
/**
* GstVideoPackFlags:
* @GST_VIDEO_PACK_FLAG_NONE: No flag
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment