gstformat.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /* GStreamer
  2. * Copyright (C) 1999,2000 Erik Walthinsen <[email protected]>
  3. * 2000 Wim Taymans <[email protected]>
  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. #ifndef __GST_FORMAT_H__
  24. #define __GST_FORMAT_H__
  25. #include <glib.h>
  26. #include <gst/gstiterator.h>
  27. G_BEGIN_DECLS
  28. /**
  29. * GstFormat:
  30. * @GST_FORMAT_UNDEFINED: undefined format
  31. * @GST_FORMAT_DEFAULT: the default format of the pad/element. This can be
  32. * samples for raw audio, frames/fields for raw video (some, but not all,
  33. * elements support this; use @GST_FORMAT_TIME if you don't have a good
  34. * reason to query for samples/frames)
  35. * @GST_FORMAT_BYTES: bytes
  36. * @GST_FORMAT_TIME: time in nanoseconds
  37. * @GST_FORMAT_BUFFERS: buffers (few, if any, elements implement this as of
  38. * May 2009)
  39. * @GST_FORMAT_PERCENT: percentage of stream (few, if any, elements implement
  40. * this as of May 2009)
  41. *
  42. * Standard predefined formats
  43. */
  44. /* NOTE: don't forget to update the table in gstformat.c when changing
  45. * this enum */
  46. typedef enum {
  47. GST_FORMAT_UNDEFINED = 0, /* must be first in list */
  48. GST_FORMAT_DEFAULT = 1,
  49. GST_FORMAT_BYTES = 2,
  50. GST_FORMAT_TIME = 3,
  51. GST_FORMAT_BUFFERS = 4,
  52. GST_FORMAT_PERCENT = 5
  53. } GstFormat;
  54. /* a percentage is always relative to 1000000 */
  55. /**
  56. * GST_FORMAT_PERCENT_MAX:
  57. *
  58. * The PERCENT format is between 0 and this value
  59. */
  60. #define GST_FORMAT_PERCENT_MAX G_GINT64_CONSTANT (1000000)
  61. /**
  62. * GST_FORMAT_PERCENT_SCALE:
  63. *
  64. * The value used to scale down the reported PERCENT format value to
  65. * its real value.
  66. */
  67. #define GST_FORMAT_PERCENT_SCALE G_GINT64_CONSTANT (10000)
  68. typedef struct _GstFormatDefinition GstFormatDefinition;
  69. /**
  70. * GstFormatDefinition:
  71. * @value: The unique id of this format
  72. * @nick: A short nick of the format
  73. * @description: A longer description of the format
  74. * @quark: A quark for the nick
  75. *
  76. * A format definition
  77. */
  78. struct _GstFormatDefinition
  79. {
  80. GstFormat value;
  81. const gchar *nick;
  82. const gchar *description;
  83. GQuark quark;
  84. };
  85. const gchar* gst_format_get_name (GstFormat format);
  86. GQuark gst_format_to_quark (GstFormat format);
  87. /* register a new format */
  88. GstFormat gst_format_register (const gchar *nick,
  89. const gchar *description);
  90. GstFormat gst_format_get_by_nick (const gchar *nick);
  91. /* check if a format is in an array of formats */
  92. gboolean gst_formats_contains (const GstFormat *formats, GstFormat format);
  93. /* query for format details */
  94. const GstFormatDefinition*
  95. gst_format_get_details (GstFormat format);
  96. GstIterator* gst_format_iterate_definitions (void);
  97. G_END_DECLS
  98. #endif /* __GST_FORMAT_H__ */