79 lines
2.0 KiB
C
79 lines
2.0 KiB
C
/* 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;
|
|
}
|