1/* GStreamer
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wim.taymans@chello.be>
4 *
5 * gstformat.h: Header for GstFormat types used in queries and
6 * seeking.
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2 of the License, or (at your option) any later version.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
17 *
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
21 * Boston, MA 02110-1301, USA.
22 */
23
24
25#ifndef __GST_FORMAT_H__
26#define __GST_FORMAT_H__
27
28#include <glib.h>
29
30#include <gst/gstiterator.h>
31
32G_BEGIN_DECLS
33
34/**
35 * GstFormat:
36 * @GST_FORMAT_UNDEFINED: undefined format
37 * @GST_FORMAT_DEFAULT: the default format of the pad/element. This can be
38 * samples for raw audio, frames/fields for raw video (some, but not all,
39 * elements support this; use @GST_FORMAT_TIME if you don't have a good
40 * reason to query for samples/frames)
41 * @GST_FORMAT_BYTES: bytes
42 * @GST_FORMAT_TIME: time in nanoseconds
43 * @GST_FORMAT_BUFFERS: buffers (few, if any, elements implement this as of
44 * May 2009)
45 * @GST_FORMAT_PERCENT: percentage of stream (few, if any, elements implement
46 * this as of May 2009)
47 *
48 * Standard predefined formats
49 */
50/* NOTE: don't forget to update the table in gstformat.c when changing
51 * this enum */
52typedef enum {
53 GST_FORMAT_UNDEFINED = 0, /* must be first in list */
54 GST_FORMAT_DEFAULT = 1,
55 GST_FORMAT_BYTES = 2,
56 GST_FORMAT_TIME = 3,
57 GST_FORMAT_BUFFERS = 4,
58 GST_FORMAT_PERCENT = 5
59} GstFormat;
60
61/* a percentage is always relative to 1000000 */
62/**
63 * GST_FORMAT_PERCENT_MAX:
64 *
65 * The PERCENT format is between 0 and this value
66 */
67#define GST_FORMAT_PERCENT_MAX G_GINT64_CONSTANT (1000000)
68/**
69 * GST_FORMAT_PERCENT_SCALE:
70 *
71 * The value used to scale down the reported PERCENT format value to
72 * its real value.
73 */
74#define GST_FORMAT_PERCENT_SCALE G_GINT64_CONSTANT (10000)
75
76typedef struct _GstFormatDefinition GstFormatDefinition;
77
78/**
79 * GstFormatDefinition:
80 * @value: The unique id of this format
81 * @nick: A short nick of the format
82 * @description: A longer description of the format
83 * @quark: A quark for the nick
84 *
85 * A format definition
86 */
87struct _GstFormatDefinition
88{
89 GstFormat value;
90 const gchar *nick;
91 const gchar *description;
92 GQuark quark;
93};
94
95GST_API
96const gchar* gst_format_get_name (GstFormat format);
97
98GST_API
99GQuark gst_format_to_quark (GstFormat format);
100
101/* register a new format */
102
103GST_API
104GstFormat gst_format_register (const gchar *nick,
105 const gchar *description);
106
107GST_API
108GstFormat gst_format_get_by_nick (const gchar *nick);
109
110/* check if a format is in an array of formats */
111
112GST_API
113gboolean gst_formats_contains (const GstFormat *formats, GstFormat format);
114
115/* query for format details */
116
117GST_API
118const GstFormatDefinition*
119 gst_format_get_details (GstFormat format);
120
121GST_API
122GstIterator* gst_format_iterate_definitions (void);
123
124G_END_DECLS
125
126#endif /* __GST_FORMAT_H__ */
127

source code of include/gstreamer-1.0/gst/gstformat.h