aggregator: Assert if the sink/src pad type that is to be used is not a GstAggregator...
[platform/upstream/gstreamer.git] / libs / gst / base / gsttypefindhelper.h
1 /* GStreamer
2  * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3  * Copyright (C) 2000,2005 Wim Taymans <wim@fluendo.com>
4  * Copyright (C) 2006      Tim-Philipp Müller <tim centricular net>
5  *
6  * gsttypefindhelper.h:
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
24 #ifndef __GST_TYPEFINDHELPER_H__
25 #define __GST_TYPEFINDHELPER_H__
26
27 #include <gst/gst.h>
28 #include <gst/base/base-prelude.h>
29
30 G_BEGIN_DECLS
31
32 GST_BASE_API
33 GstCaps * gst_type_find_helper (GstPad *src, guint64 size);
34
35 GST_BASE_API
36 GstCaps * gst_type_find_helper_for_data   (GstObject              *obj,
37                                            const guint8           *data,
38                                            gsize                   size,
39                                            GstTypeFindProbability *prob);
40
41 GST_BASE_API
42 GstCaps * gst_type_find_helper_for_data_with_extension (GstObject              *obj,
43                                                         const guint8           *data,
44                                                         gsize                   size,
45                                                         const gchar            *extension,
46                                                         GstTypeFindProbability *prob);
47
48 GST_BASE_API
49 GstCaps * gst_type_find_helper_for_buffer (GstObject              *obj,
50                                            GstBuffer              *buf,
51                                            GstTypeFindProbability *prob);
52
53 GST_BASE_API
54 GstCaps * gst_type_find_helper_for_buffer_with_extension (GstObject              *obj,
55                                                           GstBuffer              *buf,
56                                                           const gchar            *extension,
57                                                           GstTypeFindProbability *prob);
58
59 GST_BASE_API
60 GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
61                                               const gchar * extension);
62
63 /**
64  * GstTypeFindHelperGetRangeFunction:
65  * @obj: a #GstObject that will handle the getrange request
66  * @parent: (allow-none): the parent of @obj or %NULL
67  * @offset: the offset of the range
68  * @length: the length of the range
69  * @buffer: (out): a memory location to hold the result buffer
70  *
71  * This function will be called by gst_type_find_helper_get_range() when
72  * typefinding functions request to peek at the data of a stream at certain
73  * offsets. If this function returns GST_FLOW_OK, the result buffer will be
74  * stored in @buffer. The  contents of @buffer is invalid for any other
75  * return value.
76  *
77  * This function is supposed to behave exactly like a #GstPadGetRangeFunction.
78  *
79  * Returns: GST_FLOW_OK for success
80  */
81 typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject  *obj,
82                                                             GstObject  *parent,
83                                                             guint64     offset,
84                                                             guint       length,
85                                                             GstBuffer **buffer);
86 GST_BASE_API
87 GstCaps * gst_type_find_helper_get_range (GstObject                         *obj,
88                                           GstObject                         *parent,
89                                           GstTypeFindHelperGetRangeFunction  func,
90                                           guint64                            size,
91                                           const gchar                       *extension,
92                                           GstTypeFindProbability            *prob);
93
94 GST_BASE_API
95 GstFlowReturn gst_type_find_helper_get_range_full (GstObject                         *obj,
96                                                    GstObject                         *parent,
97                                                    GstTypeFindHelperGetRangeFunction  func,
98                                                    guint64                            size,
99                                                    const gchar                       *extension,
100                                                    GstCaps                          **caps,
101                                                    GstTypeFindProbability            *prob);
102
103 G_END_DECLS
104
105 #endif /* __GST_TYPEFINDHELPER_H__ */