gstcontrolsource.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. /* GStreamer
  2. *
  3. * Copyright (C) 2007 Sebastian Dröge <[email protected]>
  4. *
  5. * gstcontrolsource.h: Interface declaration for control sources
  6. *
  7. * This library is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU Library General Public
  9. * License as published by the Free Software Foundation; either
  10. * version 2 of the License, or (at your option) any later version.
  11. *
  12. * This library is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  15. * Library General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Library General Public
  18. * License along with this library; if not, write to the
  19. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  20. * Boston, MA 02110-1301, USA.
  21. */
  22. #ifndef __GST_CONTROL_SOURCE_H__
  23. #define __GST_CONTROL_SOURCE_H__
  24. #include <gst/gstconfig.h>
  25. #include <glib-object.h>
  26. #include <gst/gstclock.h>
  27. G_BEGIN_DECLS
  28. #define GST_TYPE_CONTROL_SOURCE \
  29. (gst_control_source_get_type())
  30. #define GST_CONTROL_SOURCE(obj) \
  31. (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_CONTROL_SOURCE,GstControlSource))
  32. #define GST_CONTROL_SOURCE_CLASS(klass) \
  33. (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_CONTROL_SOURCE,GstControlSourceClass))
  34. #define GST_IS_CONTROL_SOURCE(obj) \
  35. (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_CONTROL_SOURCE))
  36. #define GST_IS_CONTROL_SOURCE_CLASS(klass) \
  37. (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_CONTROL_SOURCE))
  38. #define GST_CONTROL_SOURCE_GET_CLASS(obj) \
  39. (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_CONTOL_SOURCE, GstControlSourceClass))
  40. typedef struct _GstControlSource GstControlSource;
  41. typedef struct _GstControlSourceClass GstControlSourceClass;
  42. typedef struct _GstTimedValue GstTimedValue;
  43. typedef struct _GstValueArray GstValueArray;
  44. /**
  45. * GstTimedValue:
  46. * @timestamp: timestamp of the value change
  47. * @value: the corresponding value
  48. *
  49. * Structure for saving a timestamp and a value.
  50. */
  51. struct _GstTimedValue
  52. {
  53. GstClockTime timestamp;
  54. gdouble value;
  55. };
  56. /**
  57. * GstControlSourceGetValue:
  58. * @self: the #GstControlSource instance
  59. * @timestamp: timestamp for which a value should be calculated
  60. * @value: a #GValue which will be set to the result. It must be initialized to the correct type.
  61. *
  62. * Function for returning a value for a given timestamp.
  63. *
  64. * Returns: %TRUE if the value was successfully calculated.
  65. *
  66. */
  67. typedef gboolean (* GstControlSourceGetValue) (GstControlSource *self,
  68. GstClockTime timestamp, gdouble *value);
  69. /**
  70. * GstControlSourceGetValueArray:
  71. * @self: the #GstControlSource instance
  72. * @timestamp: timestamp for which a value should be calculated
  73. * @interval: the time spacing between subsequent values
  74. * @n_values: the number of values
  75. * @values: array to put control-values in
  76. *
  77. * Function for returning an array of values for starting at a given timestamp.
  78. *
  79. * Returns: %TRUE if the values were successfully calculated.
  80. *
  81. */
  82. typedef gboolean (* GstControlSourceGetValueArray) (GstControlSource *self,
  83. GstClockTime timestamp, GstClockTime interval, guint n_values, gdouble *values);
  84. /**
  85. * GstControlSource:
  86. * @get_value: Function for returning a value for a given timestamp
  87. * @get_value_array: Function for returning a #GstValueArray for a given timestamp
  88. *
  89. * The instance structure of #GstControlSource.
  90. */
  91. struct _GstControlSource {
  92. GstObject parent;
  93. /*< public >*/
  94. GstControlSourceGetValue get_value; /* Returns the value for a property at a given timestamp */
  95. GstControlSourceGetValueArray get_value_array; /* Returns values for a property in a given timespan */
  96. /*< private >*/
  97. gpointer _gst_reserved[GST_PADDING];
  98. };
  99. /**
  100. * GstControlSourceClass:
  101. * @parent_class: Parent class
  102. *
  103. * The class structure of #GstControlSource.
  104. */
  105. struct _GstControlSourceClass
  106. {
  107. GstObjectClass parent_class;
  108. /*< private >*/
  109. gpointer _gst_reserved[GST_PADDING];
  110. };
  111. GType gst_control_source_get_type (void);
  112. /* Functions */
  113. gboolean gst_control_source_get_value (GstControlSource *self, GstClockTime timestamp,
  114. gdouble *value);
  115. gboolean gst_control_source_get_value_array (GstControlSource *self, GstClockTime timestamp,
  116. GstClockTime interval, guint n_values,
  117. gdouble *values);
  118. G_END_DECLS
  119. #endif /* __GST_CONTROL_SOURCE_H__ */