gstvideosink.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. /* GStreamer video sink base class
  2. * Copyright (C) <2003> Julien Moutte <[email protected]>
  3. * Copyright (C) <2009> Tim-Philipp Müller <tim centricular net>
  4. *
  5. * This library is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU Library General Public
  7. * License as published by the Free Software Foundation; either
  8. * version 2 of the License, or (at your option) any later version.
  9. *
  10. * This library is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * Library General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU Library General Public
  16. * License along with this library; if not, write to the
  17. * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
  18. * Boston, MA 02110-1301, USA.
  19. */
  20. /* FIXME 0.11: turn this into a proper base class */
  21. #ifndef __GST_VIDEO_SINK_H__
  22. #define __GST_VIDEO_SINK_H__
  23. #include <gst/gst.h>
  24. #include <gst/base/gstbasesink.h>
  25. G_BEGIN_DECLS
  26. #define GST_TYPE_VIDEO_SINK (gst_video_sink_get_type())
  27. #define GST_VIDEO_SINK(obj) \
  28. (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VIDEO_SINK, GstVideoSink))
  29. #define GST_VIDEO_SINK_CLASS(klass) \
  30. (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
  31. #define GST_IS_VIDEO_SINK(obj) \
  32. (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VIDEO_SINK))
  33. #define GST_IS_VIDEO_SINK_CLASS(klass) \
  34. (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_VIDEO_SINK))
  35. #define GST_VIDEO_SINK_GET_CLASS(klass) \
  36. (G_TYPE_INSTANCE_GET_CLASS ((klass), GST_TYPE_VIDEO_SINK, GstVideoSinkClass))
  37. /**
  38. * GST_VIDEO_SINK_CAST:
  39. * @obj: a #GstVideoSink or derived object
  40. *
  41. * Cast @obj to a #GstVideoSink without runtime type check.
  42. */
  43. #define GST_VIDEO_SINK_CAST(obj) ((GstVideoSink *) (obj))
  44. /**
  45. * GST_VIDEO_SINK_PAD:
  46. * @obj: a #GstVideoSink
  47. *
  48. * Get the sink #GstPad of @obj.
  49. */
  50. #define GST_VIDEO_SINK_PAD(obj) GST_BASE_SINK_PAD(obj)
  51. #define GST_VIDEO_SINK_WIDTH(obj) (GST_VIDEO_SINK_CAST (obj)->width)
  52. #define GST_VIDEO_SINK_HEIGHT(obj) (GST_VIDEO_SINK_CAST (obj)->height)
  53. typedef struct _GstVideoSink GstVideoSink;
  54. typedef struct _GstVideoSinkClass GstVideoSinkClass;
  55. typedef struct _GstVideoRectangle GstVideoRectangle;
  56. typedef struct _GstVideoSinkPrivate GstVideoSinkPrivate;
  57. /**
  58. * GstVideoRectangle:
  59. * @x: X coordinate of rectangle's top-left point
  60. * @y: Y coordinate of rectangle's top-left point
  61. * @w: width of the rectangle
  62. * @h: height of the rectangle
  63. *
  64. * Helper structure representing a rectangular area.
  65. */
  66. struct _GstVideoRectangle {
  67. gint x;
  68. gint y;
  69. gint w;
  70. gint h;
  71. };
  72. /**
  73. * GstVideoSink:
  74. * @height: video height (derived class needs to set this)
  75. * @width: video width (derived class needs to set this)
  76. *
  77. * The video sink instance structure. Derived video sinks should set the
  78. * @height and @width members.
  79. */
  80. struct _GstVideoSink {
  81. GstBaseSink element; /* FIXME 0.11: this should not be called 'element' */
  82. /*< public >*/
  83. gint width, height;
  84. /*< private >*/
  85. GstVideoSinkPrivate *priv;
  86. gpointer _gst_reserved[GST_PADDING];
  87. };
  88. /**
  89. * GstVideoSinkClass:
  90. * @parent_class: the parent class structure
  91. * @show_frame: render a video frame. Maps to #GstBaseSinkClass.render() and
  92. * #GstBaseSinkClass.preroll() vfuncs. Rendering during preroll will be
  93. * suppressed if the #GstVideoSink:show-preroll-frame property is set to
  94. * %FALSE.
  95. *
  96. * The video sink class structure. Derived classes should override the
  97. * @show_frame virtual function.
  98. */
  99. struct _GstVideoSinkClass {
  100. GstBaseSinkClass parent_class;
  101. GstFlowReturn (*show_frame) (GstVideoSink *video_sink, GstBuffer *buf);
  102. /*< private >*/
  103. gpointer _gst_reserved[GST_PADDING];
  104. };
  105. GType gst_video_sink_get_type (void);
  106. void gst_video_sink_center_rect (GstVideoRectangle src, GstVideoRectangle dst,
  107. GstVideoRectangle *result, gboolean scaling);
  108. G_END_DECLS
  109. #endif /* __GST_VIDEO_SINK_H__ */