Blame gst/gstformat.h

Packit f546b1
/* GStreamer
Packit f546b1
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
Packit f546b1
 *                    2000 Wim Taymans <wim.taymans@chello.be>
Packit f546b1
 *
Packit f546b1
 * gstformat.h: Header for GstFormat types used in queries and
Packit f546b1
 *              seeking.
Packit f546b1
 *
Packit f546b1
 * This library is free software; you can redistribute it and/or
Packit f546b1
 * modify it under the terms of the GNU Library General Public
Packit f546b1
 * License as published by the Free Software Foundation; either
Packit f546b1
 * version 2 of the License, or (at your option) any later version.
Packit f546b1
 *
Packit f546b1
 * This library is distributed in the hope that it will be useful,
Packit f546b1
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit f546b1
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit f546b1
 * Library General Public License for more details.
Packit f546b1
 *
Packit f546b1
 * You should have received a copy of the GNU Library General Public
Packit f546b1
 * License along with this library; if not, write to the
Packit f546b1
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
Packit f546b1
 * Boston, MA 02110-1301, USA.
Packit f546b1
 */
Packit f546b1
Packit f546b1
Packit f546b1
#ifndef __GST_FORMAT_H__
Packit f546b1
#define __GST_FORMAT_H__
Packit f546b1
Packit f546b1
#include <glib.h>
Packit f546b1
Packit f546b1
#include <gst/gstiterator.h>
Packit f546b1
Packit f546b1
G_BEGIN_DECLS
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstFormat:
Packit f546b1
 * @GST_FORMAT_UNDEFINED: undefined format
Packit f546b1
 * @GST_FORMAT_DEFAULT: the default format of the pad/element. This can be
Packit f546b1
 *    samples for raw audio, frames/fields for raw video (some, but not all,
Packit f546b1
 *    elements support this; use @GST_FORMAT_TIME if you don't have a good
Packit f546b1
 *    reason to query for samples/frames)
Packit f546b1
 * @GST_FORMAT_BYTES: bytes
Packit f546b1
 * @GST_FORMAT_TIME: time in nanoseconds
Packit f546b1
 * @GST_FORMAT_BUFFERS: buffers (few, if any, elements implement this as of
Packit f546b1
 *     May 2009)
Packit f546b1
 * @GST_FORMAT_PERCENT: percentage of stream (few, if any, elements implement
Packit f546b1
 *     this as of May 2009)
Packit f546b1
 *
Packit f546b1
 * Standard predefined formats
Packit f546b1
 */
Packit f546b1
/* NOTE: don't forget to update the table in gstformat.c when changing
Packit f546b1
 * this enum */
Packit f546b1
typedef enum {
Packit f546b1
  GST_FORMAT_UNDEFINED  =  0, /* must be first in list */
Packit f546b1
  GST_FORMAT_DEFAULT    =  1,
Packit f546b1
  GST_FORMAT_BYTES      =  2,
Packit f546b1
  GST_FORMAT_TIME       =  3,
Packit f546b1
  GST_FORMAT_BUFFERS    =  4,
Packit f546b1
  GST_FORMAT_PERCENT    =  5
Packit f546b1
} GstFormat;
Packit f546b1
Packit f546b1
/* a percentage is always relative to 1000000 */
Packit f546b1
/**
Packit f546b1
 * GST_FORMAT_PERCENT_MAX:
Packit f546b1
 *
Packit f546b1
 * The PERCENT format is between 0 and this value
Packit f546b1
 */
Packit f546b1
#define GST_FORMAT_PERCENT_MAX          G_GINT64_CONSTANT (1000000)
Packit f546b1
/**
Packit f546b1
 * GST_FORMAT_PERCENT_SCALE:
Packit f546b1
 *
Packit f546b1
 * The value used to scale down the reported PERCENT format value to
Packit f546b1
 * its real value.
Packit f546b1
 */
Packit f546b1
#define GST_FORMAT_PERCENT_SCALE        G_GINT64_CONSTANT (10000)
Packit f546b1
Packit f546b1
typedef struct _GstFormatDefinition GstFormatDefinition;
Packit f546b1
Packit f546b1
/**
Packit f546b1
 * GstFormatDefinition:
Packit f546b1
 * @value: The unique id of this format
Packit f546b1
 * @nick: A short nick of the format
Packit f546b1
 * @description: A longer description of the format
Packit f546b1
 * @quark: A quark for the nick
Packit f546b1
 *
Packit f546b1
 * A format definition
Packit f546b1
 */
Packit f546b1
struct _GstFormatDefinition
Packit f546b1
{
Packit f546b1
  GstFormat    value;
Packit f546b1
  const gchar *nick;
Packit f546b1
  const gchar *description;
Packit f546b1
  GQuark       quark;
Packit f546b1
};
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const gchar*    gst_format_get_name             (GstFormat format);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GQuark          gst_format_to_quark             (GstFormat format);
Packit f546b1
Packit f546b1
/* register a new format */
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstFormat       gst_format_register             (const gchar *nick,
Packit f546b1
                                                 const gchar *description);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstFormat       gst_format_get_by_nick          (const gchar *nick);
Packit f546b1
Packit f546b1
/* check if a format is in an array of formats */
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
gboolean        gst_formats_contains            (const GstFormat *formats, GstFormat format);
Packit f546b1
Packit f546b1
/* query for format details */
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
const GstFormatDefinition*
Packit f546b1
                gst_format_get_details          (GstFormat format);
Packit f546b1
Packit f546b1
GST_API
Packit f546b1
GstIterator*    gst_format_iterate_definitions  (void);
Packit f546b1
Packit f546b1
G_END_DECLS
Packit f546b1
Packit f546b1
#endif /* __GST_FORMAT_H__ */