summaryrefslogtreecommitdiff
path: root/include/gst/base/gsttypefindhelper.h
blob: bda346cac19e8222c831de9b585b6d8d72e9d35e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
/* GStreamer
 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
 * Copyright (C) 2000,2005 Wim Taymans <wim@fluendo.com>
 * Copyright (C) 2006      Tim-Philipp Müller <tim centricular net>
 *
 * gsttypefindhelper.h:
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef __GST_TYPEFINDHELPER_H__
#define __GST_TYPEFINDHELPER_H__

#include <gst/gst.h>
#include <gst/base/base-prelude.h>

G_BEGIN_DECLS

GST_BASE_API
GstCaps * gst_type_find_helper (GstPad *src, guint64 size);

GST_BASE_API
GstCaps * gst_type_find_helper_for_data   (GstObject              *obj,
                                           const guint8           *data,
                                           gsize                   size,
                                           GstTypeFindProbability *prob);

GST_BASE_API
GstCaps * gst_type_find_helper_for_data_with_extension (GstObject              *obj,
                                                        const guint8           *data,
                                                        gsize                   size,
                                                        const gchar            *extension,
                                                        GstTypeFindProbability *prob);

GST_BASE_API
GstCaps * gst_type_find_helper_for_buffer (GstObject              *obj,
                                           GstBuffer              *buf,
                                           GstTypeFindProbability *prob);

GST_BASE_API
GstCaps * gst_type_find_helper_for_buffer_with_extension (GstObject              *obj,
                                                          GstBuffer              *buf,
                                                          const gchar            *extension,
                                                          GstTypeFindProbability *prob);

GST_BASE_API
GstCaps * gst_type_find_helper_for_extension (GstObject * obj,
                                              const gchar * extension);

/**
 * GstTypeFindHelperGetRangeFunction:
 * @obj: a #GstObject that will handle the getrange request
 * @parent: (allow-none): the parent of @obj or %NULL
 * @offset: the offset of the range
 * @length: the length of the range
 * @buffer: (out): a memory location to hold the result buffer
 *
 * This function will be called by gst_type_find_helper_get_range() when
 * typefinding functions request to peek at the data of a stream at certain
 * offsets. If this function returns GST_FLOW_OK, the result buffer will be
 * stored in @buffer. The  contents of @buffer is invalid for any other
 * return value.
 *
 * This function is supposed to behave exactly like a #GstPadGetRangeFunction.
 *
 * Returns: GST_FLOW_OK for success
 */
typedef GstFlowReturn (*GstTypeFindHelperGetRangeFunction) (GstObject  *obj,
                                                            GstObject  *parent,
                                                            guint64     offset,
                                                            guint       length,
                                                            GstBuffer **buffer);
GST_BASE_API
GstCaps * gst_type_find_helper_get_range (GstObject                         *obj,
                                          GstObject                         *parent,
                                          GstTypeFindHelperGetRangeFunction  func,
                                          guint64                            size,
                                          const gchar                       *extension,
                                          GstTypeFindProbability            *prob);

GST_BASE_API
GstFlowReturn gst_type_find_helper_get_range_full (GstObject                         *obj,
                                                   GstObject                         *parent,
                                                   GstTypeFindHelperGetRangeFunction  func,
                                                   guint64                            size,
                                                   const gchar                       *extension,
                                                   GstCaps                          **caps,
                                                   GstTypeFindProbability            *prob);

G_END_DECLS

#endif /* __GST_TYPEFINDHELPER_H__ */