videoaggregator: Create a new GstVideoAggregator baseclass
[platform/upstream/gstreamer.git] / gst-libs / gst / video / gstvideoaggregator.h
1 /* Generic video aggregator plugin
2  * Copyright (C) 2008 Wim Taymans <wim@fluendo.com>
3  * Copyright (C) 2010 Sebastian Dröge <sebastian.droege@collabora.co.uk>
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  
21 #ifndef __GST_VIDEO_AGGREGATOR_H__
22 #define __GST_VIDEO_AGGREGATOR_H__
23
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26 #include <gst/base/gstaggregator.h>
27
28 #include "gstvideoaggregatorpad.h"
29
30 G_BEGIN_DECLS
31
32 #define GST_TYPE_VIDEO_AGGREGATOR (gst_videoaggregator_get_type())
33 #define GST_VIDEO_AGGREGATOR(obj) \
34         (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregator))
35 #define GST_VIDEO_AGGREGATOR_CLASS(klass) \
36         (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_VIDEO_AGGREGATOR, GstVideoAggregatorClass))
37 #define GST_IS_VIDEO_AGGREGATOR(obj) \
38         (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_VIDEO_AGGREGATOR))
39 #define GST_IS_VIDEO_AGGREGATOR_CLASS(klass) \
40         (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_VIDEO_AGGREGATOR))
41 #define GST_VIDEO_AGGREGATOR_GET_CLASS(obj) \
42         (G_TYPE_INSTANCE_GET_CLASS((obj),GST_TYPE_VIDEO_AGGREGATOR,GstVideoAggregatorClass))
43
44 typedef struct _GstVideoAggregator GstVideoAggregator;
45 typedef struct _GstVideoAggregatorClass GstVideoAggregatorClass;
46 typedef struct _GstVideoAggregatorPrivate GstVideoAggregatorPrivate;
47
48 /**
49  * GstVideoAggregator:
50  * @info: The #GstVideoInfo representing the currently set
51  * srcpad caps.
52  */
53 struct _GstVideoAggregator
54 {
55   GstAggregator aggregator;
56
57   /*< public >*/
58   /* Output caps */
59   GstVideoInfo info;
60
61   /* < private > */
62   GstVideoAggregatorPrivate *priv;
63   gpointer          _gst_reserved[GST_PADDING];
64 };
65
66 /**
67  * GstVideoAggregatorClass:
68  * @disable_frame_conversion: Optional.
69  *                            Allows subclasses to disable the frame colorspace
70  *                            conversion feature
71  * @update_info:              Optional.
72  *                            Lets subclasses update the src #GstVideoInfo representing
73  *                            the src pad caps before usage.
74  * @aggregate_frames:         Lets subclasses aggregate frames that are ready. Subclasses
75  *                            should iterate the GstElement.sinkpads and use the already
76  *                            mapped #GstVideoFrame from GstVideoAggregatorPad.aggregated_frame
77  *                            or directly use the #GstBuffer from GstVideoAggregatorPad.buffer
78  *                            if it needs to map the buffer in a special way. The result of the
79  *                            aggregation should land in @outbuffer.
80  * @get_output_buffer:        Optional.
81  *                            Lets subclasses provide a #GstBuffer to be used as @outbuffer of
82  *                            the #aggregate_frames vmethod.
83  * @negotiated_caps:          Optional.
84  *                            Notifies subclasses what caps format has been negotiated
85  **/
86 struct _GstVideoAggregatorClass
87 {
88   /*< private >*/
89   GstAggregatorClass parent_class;
90
91   /*< public >*/
92   gboolean           disable_frame_conversion;
93
94   gboolean           (*update_info)               (GstVideoAggregator *  videoaggregator,
95                                                    GstVideoInfo       *  info);
96   GstFlowReturn      (*aggregate_frames)          (GstVideoAggregator *  videoaggregator,
97                                                    GstBuffer          *  outbuffer);
98   GstFlowReturn      (*get_output_buffer)         (GstVideoAggregator *  videoaggregator,
99                                                    GstBuffer          ** outbuffer);
100   gboolean           (*negotiated_caps)           (GstVideoAggregator *  videoaggregator,
101                                                    GstCaps            *  caps);
102   /* < private > */
103   gpointer            _gst_reserved[GST_PADDING];
104 };
105
106 GType gst_videoaggregator_get_type       (void);
107
108 G_END_DECLS
109 #endif /* __GST_VIDEO_AGGREGATOR_H__ */