video: move chroma functions to separate file
authorWim Taymans <wim.taymans@collabora.co.uk>
Fri, 17 May 2013 13:45:41 +0000 (15:45 +0200)
committerWim Taymans <wim.taymans@collabora.co.uk>
Mon, 27 May 2013 09:05:06 +0000 (11:05 +0200)
gst-libs/gst/video/Makefile.am
gst-libs/gst/video/video-chroma.c [new file with mode: 0644]
gst-libs/gst/video/video-chroma.h [new file with mode: 0644]
gst-libs/gst/video/video-format.c
gst-libs/gst/video/video-format.h

index ce086b4..292415e 100644 (file)
@@ -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           \
diff --git a/gst-libs/gst/video/video-chroma.c b/gst-libs/gst/video/video-chroma.c
new file mode 100644 (file)
index 0000000..0799b1f
--- /dev/null
@@ -0,0 +1,78 @@
+/* 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;
+}
diff --git a/gst-libs/gst/video/video-chroma.h b/gst-libs/gst/video/video-chroma.h
new file mode 100644 (file)
index 0000000..0dee38a
--- /dev/null
@@ -0,0 +1,59 @@
+/* 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__ */
index 9687509..8fb69f7 100644 (file)
@@ -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;
-}
index 42b23e9..c0c7390 100644 (file)
@@ -144,36 +144,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
  *   0=Y, 1=U, 2=V.
@@ -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