gsttimedvaluecontrolsource.h 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. /* GStreamer
  2. *
  3. * Copyright (C) 2007 Sebastian Dröge <[email protected]>
  4. * 2011 Stefan Sauer <[email protected]>
  5. *
  6. * gsttimedvaluecontrolsource.h: Base class for timeed value based control
  7. * sources
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Library General Public
  11. * License as published by the Free Software Foundation; either
  12. * version 2 of the License, or (at your option) any later version.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Library General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Library General Public
  20. * License along with this library; if not, write to the
  21. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  22. * Boston, MA 02110-1301, USA.
  23. */
  24. #ifndef __GST_TIMED_VALUE_CONTROL_SOURCE_H__
  25. #define __GST_TIMED_VALUE_CONTROL_SOURCE_H__
  26. #include <glib-object.h>
  27. #include <gst/gst.h>
  28. #include <gst/gstcontrolsource.h>
  29. G_BEGIN_DECLS
  30. #define GST_TYPE_TIMED_VALUE_CONTROL_SOURCE \
  31. (gst_timed_value_control_source_get_type ())
  32. #define GST_TIMED_VALUE_CONTROL_SOURCE(obj) \
  33. (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSource))
  34. #define GST_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
  35. (G_TYPE_CHECK_CLASS_CAST ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
  36. #define GST_IS_TIMED_VALUE_CONTROL_SOURCE(obj) \
  37. (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
  38. #define GST_IS_TIMED_VALUE_CONTROL_SOURCE_CLASS(vtable) \
  39. (G_TYPE_CHECK_CLASS_TYPE ((vtable), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE))
  40. #define GST_TIMED_VALUE_CONTROL_SOURCE_GET_CLASS(inst) \
  41. (G_TYPE_INSTANCE_GET_CLASS ((inst), GST_TYPE_TIMED_VALUE_CONTROL_SOURCE, GstTimedValueControlSourceClass))
  42. typedef struct _GstTimedValueControlSource GstTimedValueControlSource;
  43. typedef struct _GstTimedValueControlSourceClass GstTimedValueControlSourceClass;
  44. typedef struct _GstTimedValueControlSourcePrivate GstTimedValueControlSourcePrivate;
  45. typedef struct _GstControlPoint GstControlPoint;
  46. /**
  47. * GstControlPoint:
  48. *
  49. * a internal structure for value+time and various temporary
  50. * values used for interpolation. This "inherits" from
  51. * GstTimedValue.
  52. */
  53. struct _GstControlPoint
  54. {
  55. /* fields from GstTimedValue. DO NOT CHANGE! */
  56. GstClockTime timestamp; /* timestamp of the value change */
  57. gdouble value; /* the new value */
  58. /* internal fields */
  59. /* Caches for the interpolators */
  60. /* FIXME: we should not have this here already ... */
  61. union {
  62. struct {
  63. gdouble h;
  64. gdouble z;
  65. } cubic;
  66. } cache;
  67. };
  68. /**
  69. * GstTimedValueControlSource:
  70. *
  71. * The instance structure of #GstControlSource.
  72. */
  73. struct _GstTimedValueControlSource {
  74. GstControlSource parent;
  75. /*< protected >*/
  76. GMutex lock;
  77. GSequence *values; /* List of GstControlPoint */
  78. gint nvalues; /* Number of control points */
  79. gboolean valid_cache;
  80. /*< private >*/
  81. GstTimedValueControlSourcePrivate *priv;
  82. gpointer _gst_reserved[GST_PADDING];
  83. };
  84. struct _GstTimedValueControlSourceClass {
  85. GstControlSourceClass parent_class;
  86. /*< private >*/
  87. gpointer _gst_reserved[GST_PADDING];
  88. };
  89. #define GST_TIMED_VALUE_CONTROL_SOURCE_LOCK(o) \
  90. g_mutex_lock(&((GstTimedValueControlSource *)o)->lock)
  91. #define GST_TIMED_VALUE_CONTROL_SOURCE_UNLOCK(o) \
  92. g_mutex_unlock(&((GstTimedValueControlSource *)o)->lock)
  93. GType gst_timed_value_control_source_get_type (void);
  94. /* Functions */
  95. GSequenceIter * gst_timed_value_control_source_find_control_point_iter (
  96. GstTimedValueControlSource * self,
  97. GstClockTime timestamp);
  98. gboolean gst_timed_value_control_source_set (GstTimedValueControlSource * self,
  99. GstClockTime timestamp,
  100. const gdouble value);
  101. gboolean gst_timed_value_control_source_set_from_list (GstTimedValueControlSource * self,
  102. const GSList * timedvalues);
  103. gboolean gst_timed_value_control_source_unset (GstTimedValueControlSource * self,
  104. GstClockTime timestamp);
  105. void gst_timed_value_control_source_unset_all (GstTimedValueControlSource *self);
  106. GList * gst_timed_value_control_source_get_all (GstTimedValueControlSource * self);
  107. gint gst_timed_value_control_source_get_count (GstTimedValueControlSource * self);
  108. void gst_timed_value_control_invalidate_cache (GstTimedValueControlSource * self);
  109. G_END_DECLS
  110. #endif /* __GST_TIMED_VALUE_CONTROL_SOURCE_H__ */