1 /* GStreamer encoding profile registry
2  * Copyright (C) 2010 Edward Hervey <edward.hervey@collabora.co.uk>
3  *           (C) 2010 Nokia Corporation
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_PROFILE_REGISTRY_H__
22 #define __GST_PROFILE_REGISTRY_H__
23 
24 #include <gst/pbutils/encoding-profile.h>
25 
26 G_BEGIN_DECLS
27 
28 
29 /* FIXME/UNKNOWNS
30  *
31  * Should encoding categories be well-known strings/quarks ?
32  *
33  */
34 
35 /**
36  * GST_ENCODING_CATEGORY_DEVICE:
37  *
38  * #GstEncodingTarget category for device-specific targets.
39  * The name of the target will usually be the constructor and model of the device,
40  * and that target will contain #GstEncodingProfiles suitable for that device.
41  */
42 #define GST_ENCODING_CATEGORY_DEVICE            "device"
43 
44 /**
45  * GST_ENCODING_CATEGORY_ONLINE_SERVICE:
46  *
47  * #GstEncodingTarget category for online-services.
48  * The name of the target will usually be the name of the online service
49  * and that target will contain #GstEncodingProfiles suitable for that online
50  * service.
51  */
52 
53 #define GST_ENCODING_CATEGORY_ONLINE_SERVICE    "online-service"
54 
55 /**
56  * GST_ENCODING_CATEGORY_STORAGE_EDITING:
57  *
58  * #GstEncodingTarget category for storage, archiving and editing targets.
59  * Those targets can be lossless and/or provide very fast random access content.
60  * The name of the target will usually be the container type or editing target,
61  * and that target will contain #GstEncodingProfiles suitable for editing or
62  * storage.
63  */
64 #define GST_ENCODING_CATEGORY_STORAGE_EDITING   "storage-editing"
65 
66 /**
67  * GST_ENCODING_CATEGORY_CAPTURE:
68  *
69  * #GstEncodingTarget category for recording and capture.
70  * Targets within this category are optimized for low latency encoding.
71  */
72 #define GST_ENCODING_CATEGORY_CAPTURE           "capture"
73 
74 /**
75  * GST_ENCODING_CATEGORY_FILE_EXTENSION:
76  *
77  * #GstEncodingTarget category for file extensions.
78  * The name of the target will be the name of the file extensions possible
79  * for a particular target. Those targets are defining like 'default' formats
80  * usually used for a particular file extension.
81  */
82 
83 #define GST_ENCODING_CATEGORY_FILE_EXTENSION    "file-extension"
84 
85 /**
86  * GstEncodingTarget:
87  *
88  * Collection of #GstEncodingProfile for a specific target or use-case.
89  *
90  * When being stored/loaded, targets come from a specific category, like
91  * #GST_ENCODING_CATEGORY_DEVICE.
92  */
93 #define GST_TYPE_ENCODING_TARGET                        \
94   (gst_encoding_target_get_type ())
95 #define GST_ENCODING_TARGET(obj)                        \
96   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_ENCODING_TARGET, GstEncodingTarget))
97 #define GST_IS_ENCODING_TARGET(obj)                     \
98   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_ENCODING_TARGET))
99 
100 typedef struct _GstEncodingTarget GstEncodingTarget;
101 typedef GObjectClass GstEncodingTargetClass;
102 
103 GST_PBUTILS_API
104 GType gst_encoding_target_get_type (void);
105 
106 /**
107  * gst_encoding_target_unref:
108  * @target: a #GstEncodingTarget
109  *
110  * Decreases the reference count of the @target, possibly freeing it.
111  */
112 #define gst_encoding_target_unref(target) \
113   (g_object_unref ((GObject*) target))
114 
115 /**
116  * gst_encoding_target_ref:
117  * @target: a #GstEncodingTarget
118  *
119  * Increases the reference count of the @target.
120  */
121 #define gst_encoding_target_ref(target) \
122   (g_object_ref ((GObject*) target))
123 
124 GST_PBUTILS_API
125 GstEncodingTarget *     gst_encoding_target_new                 (const gchar *name,
126                                                                  const gchar *category,
127                                                                  const gchar *description,
128                                                                  const GList *profiles);
129 
130 GST_PBUTILS_API
131 const gchar *           gst_encoding_target_get_name            (GstEncodingTarget *target);
132 
133 GST_PBUTILS_API
134 const gchar *           gst_encoding_target_get_category        (GstEncodingTarget *target);
135 
136 GST_PBUTILS_API
137 const gchar *           gst_encoding_target_get_description     (GstEncodingTarget *target);
138 
139 GST_PBUTILS_API
140 const GList *           gst_encoding_target_get_profiles        (GstEncodingTarget *target);
141 
142 GST_PBUTILS_API
143 GstEncodingProfile *    gst_encoding_target_get_profile         (GstEncodingTarget *target,
144                                                                  const gchar *name);
145 
146 GST_PBUTILS_API
147 gboolean                gst_encoding_target_add_profile         (GstEncodingTarget *target,
148                                                                  GstEncodingProfile *profile);
149 
150 GST_PBUTILS_API
151 gboolean                gst_encoding_target_save                (GstEncodingTarget *target,
152                                                                  GError **error);
153 
154 GST_PBUTILS_API
155 gboolean                gst_encoding_target_save_to_file        (GstEncodingTarget *target,
156                                                                  const gchar *filepath,
157                                                                  GError **error);
158 
159 GST_PBUTILS_API
160 GstEncodingTarget *     gst_encoding_target_load                (const gchar *name,
161                                                                  const gchar *category,
162                                                                  GError **error);
163 
164 GST_PBUTILS_API
165 GstEncodingTarget *     gst_encoding_target_load_from_file      (const gchar *filepath,
166                                                                  GError **error);
167 
168 GST_PBUTILS_API
169 GList *                 gst_encoding_list_available_categories  (void);
170 
171 GST_PBUTILS_API
172 GList *                 gst_encoding_list_all_targets           (const gchar * categoryname);
173 
174 #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
175 G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstEncodingTarget, gst_object_unref)
176 #endif
177 
178 G_END_DECLS
179 
180 #endif  /* __GST_PROFILE_REGISTRY_H__ */
181