diff options
author | Chris Lord <chris@openedhand.com> | 2006-09-01 18:01:05 +0000 |
---|---|---|
committer | Chris Lord <chris@openedhand.com> | 2006-09-01 18:01:05 +0000 |
commit | f1f8c5a6a7234a7b618f98efbb3d28e414890fa9 (patch) | |
tree | c102f2cf6c35a43ba5591eb4f53e01f97408653b /meta/packages/gstreamer | |
parent | b89a8f8820c5322ed060e74bfae6181fb1602251 (diff) | |
download | poky-f1f8c5a6a7234a7b618f98efbb3d28e414890fa9.tar.gz |
Add gstreamer 0.10 - Mostly packages from OE + updates and gstreamer
binary registry patch
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@694 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gstreamer')
10 files changed, 849 insertions, 0 deletions
diff --git a/meta/packages/gstreamer/gst-plugins-bad_0.10.3.bb b/meta/packages/gstreamer/gst-plugins-bad_0.10.3.bb new file mode 100644 index 0000000000..75dc20170f --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins-bad_0.10.3.bb | |||
@@ -0,0 +1,6 @@ | |||
1 | require gst-plugins.inc | ||
2 | DEPENDS += "gst-plugins-base" | ||
3 | |||
4 | EXTRA_OECONF += "--disable-examples --disable-experimental --disable-sdl \ | ||
5 | --with-plugins=divx,libmms,musicbrainz,swfdec,xvid,wavpack" | ||
6 | |||
diff --git a/meta/packages/gstreamer/gst-plugins-base_0.10.9.bb b/meta/packages/gstreamer/gst-plugins-base_0.10.9.bb new file mode 100644 index 0000000000..88f3a31577 --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins-base_0.10.9.bb | |||
@@ -0,0 +1,11 @@ | |||
1 | require gst-plugins.inc | ||
2 | DEPENDS += "libx11 alsa-lib freetype gnome-vfs liboil libogg libvorbis tremor" | ||
3 | PROVIDES_${PN} += "gst-plugins" | ||
4 | |||
5 | EXTRA_OECONF += "--with-plugins=ximagesink,alsa,gnomevfs,ogg,vorbis \ | ||
6 | --disable-freetypetest --disable-pango --disable-theora" | ||
7 | |||
8 | do_stage() { | ||
9 | autotools_stage_all | ||
10 | } | ||
11 | |||
diff --git a/meta/packages/gstreamer/gst-plugins-good_0.10.4.bb b/meta/packages/gstreamer/gst-plugins-good_0.10.4.bb new file mode 100644 index 0000000000..cb0a818ebf --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins-good_0.10.4.bb | |||
@@ -0,0 +1,7 @@ | |||
1 | require gst-plugins.inc | ||
2 | DEPENDS += "gst-plugins-base gconf cairo jpeg libpng gtk+ zlib libid3tag flac \ | ||
3 | speex" | ||
4 | |||
5 | EXTRA_OECONF += " --with-plugins=ximagesrc,cairo,flac,gconfelements,gdkpixbuf,\ | ||
6 | jpeg,png,speex,taglib \ | ||
7 | --disable-aalib --disable-esd --disable-shout2" | ||
diff --git a/meta/packages/gstreamer/gst-plugins-ugly/lame-autoconf.patch b/meta/packages/gstreamer/gst-plugins-ugly/lame-autoconf.patch new file mode 100644 index 0000000000..e2f455991a --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins-ugly/lame-autoconf.patch | |||
@@ -0,0 +1,11 @@ | |||
1 | --- gst-plugins-ugly-0.10.4/configure.ac.old 2006-09-01 18:55:40.000000000 +0100 | ||
2 | +++ gst-plugins-ugly-0.10.4/configure.ac 2006-09-01 18:56:36.000000000 +0100 | ||
3 | @@ -282,7 +282,7 @@ | ||
4 | LAME_LIBS="-lmp3lame -lm" | ||
5 | dnl is lame presets available | ||
6 | LAME_CFLAGS="" | ||
7 | - AC_TRY_RUN([ | ||
8 | + AC_TRY_COMPILE([ | ||
9 | #include <lame/lame.h> | ||
10 | int main (int argc, char *argv[]) | ||
11 | { | ||
diff --git a/meta/packages/gstreamer/gst-plugins-ugly_0.10.4.bb b/meta/packages/gstreamer/gst-plugins-ugly_0.10.4.bb new file mode 100644 index 0000000000..ad287d90ae --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins-ugly_0.10.4.bb | |||
@@ -0,0 +1,6 @@ | |||
1 | require gst-plugins.inc | ||
2 | DEPENDS += "gst-plugins-base libid3tag libmad mpeg2dec liba52 lame" | ||
3 | |||
4 | SRC_URI += " file://lame-autoconf.patch;patch=1" | ||
5 | EXTRA_OECONF += "--with-plugins=a52dec,lame,id3tag,mad,mpeg2dec" | ||
6 | |||
diff --git a/meta/packages/gstreamer/gst-plugins.inc b/meta/packages/gstreamer/gst-plugins.inc new file mode 100644 index 0000000000..1ce7ef8d91 --- /dev/null +++ b/meta/packages/gstreamer/gst-plugins.inc | |||
@@ -0,0 +1,29 @@ | |||
1 | DESCRIPTION = "Plugins for GStreamer" | ||
2 | SECTION = "multimedia" | ||
3 | PRIORITY = "optional" | ||
4 | MAINTAINER = "Felix Domke <tmbinc@elitedvb.net>" | ||
5 | DEPENDS = "gstreamer" | ||
6 | |||
7 | inherit autotools pkgconfig | ||
8 | |||
9 | SRC_URI = "http://gstreamer.freedesktop.org/src/${PN}/${PN}-${PV}.tar.bz2" | ||
10 | |||
11 | EXTRA_OECONF = "--disable-valgrind --disable-debug --disable-examples " | ||
12 | |||
13 | acpaths = "-I ${S}/common/m4 -I ${S}/m4" | ||
14 | |||
15 | LIBV = "0.10" | ||
16 | |||
17 | python populate_packages_prepend () { | ||
18 | gst_libdir = bb.data.expand('${libdir}/gstreamer-${LIBV}', d) | ||
19 | postinst = bb.data.getVar('plugin_postinst', d, 1) | ||
20 | |||
21 | do_split_packages(d, gst_libdir, '^libgst(.*)\.so$', 'gst-plugin-%s', 'GStreamer plugin for %s', postinst=postinst) | ||
22 | do_split_packages(d, gst_libdir, '^libgst(.*)\.l?a$', 'gst-plugin-%s-dev', 'GStreamer plugin for %s (development files)') | ||
23 | } | ||
24 | |||
25 | #do_stage() { | ||
26 | # autotools_stage_all | ||
27 | #} | ||
28 | |||
29 | ALLOW_EMPTY = "1" | ||
diff --git a/meta/packages/gstreamer/gstreamer-0.10.9/gstreamer-0.9-binary-registry.patch b/meta/packages/gstreamer/gstreamer-0.10.9/gstreamer-0.9-binary-registry.patch new file mode 100644 index 0000000000..e166fc37ee --- /dev/null +++ b/meta/packages/gstreamer/gstreamer-0.10.9/gstreamer-0.9-binary-registry.patch | |||
@@ -0,0 +1,65 @@ | |||
1 | diff -urNd ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/gst.c gstreamer-0.10.9/gst/gst.c | ||
2 | --- ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/gst.c 2006-07-11 21:16:04.000000000 +0100 | ||
3 | +++ gstreamer-0.10.9/gst/gst.c 2006-09-01 12:30:36.000000000 +0100 | ||
4 | @@ -553,7 +553,7 @@ | ||
5 | GList *l; | ||
6 | |||
7 | GST_DEBUG ("reading registry cache: %s", registry_file); | ||
8 | - gst_registry_xml_read_cache (default_registry, registry_file); | ||
9 | + gst_registry_binary_read_cache (default_registry, registry_file); | ||
10 | |||
11 | /* scan paths specified via --gst-plugin-path */ | ||
12 | GST_DEBUG ("scanning paths added via --gst-plugin-path"); | ||
13 | @@ -624,7 +624,7 @@ | ||
14 | } | ||
15 | |||
16 | GST_DEBUG ("writing registry cache"); | ||
17 | - if (!gst_registry_xml_write_cache (default_registry, registry_file)) { | ||
18 | + if (!gst_registry_binary_write_cache (default_registry, registry_file)) { | ||
19 | g_warning ("Problem writing registry cache to %s: %s", registry_file, | ||
20 | g_strerror (errno)); | ||
21 | return FALSE; | ||
22 | @@ -700,7 +700,7 @@ | ||
23 | |||
24 | if (WEXITSTATUS (status) == EXIT_SUCCESS) { | ||
25 | GST_DEBUG ("parent reading registry cache"); | ||
26 | - gst_registry_xml_read_cache (default_registry, registry_file); | ||
27 | + gst_registry_binary_read_cache (default_registry, registry_file); | ||
28 | } else { | ||
29 | GST_DEBUG ("parent re-scanning registry"); | ||
30 | scan_and_update_registry (default_registry, registry_file, FALSE); | ||
31 | @@ -722,7 +722,7 @@ | ||
32 | registry_file = g_strdup (g_getenv ("GST_REGISTRY")); | ||
33 | if (registry_file == NULL) { | ||
34 | registry_file = g_build_filename (g_get_home_dir (), | ||
35 | - ".gstreamer-" GST_MAJORMINOR, "registry." HOST_CPU ".xml", NULL); | ||
36 | + ".gstreamer-" GST_MAJORMINOR, "registry." HOST_CPU ".bin", NULL); | ||
37 | } | ||
38 | #ifdef HAVE_FORK | ||
39 | if (g_getenv ("GST_REGISTRY_FORK") == NULL | ||
40 | diff -urNd ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/gstregistry.h gstreamer-0.10.9/gst/gstregistry.h | ||
41 | --- ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/gstregistry.h 2006-07-11 21:16:04.000000000 +0100 | ||
42 | +++ gstreamer-0.10.9/gst/gstregistry.h 2006-09-01 12:30:36.000000000 +0100 | ||
43 | @@ -105,8 +105,8 @@ | ||
44 | GstPlugin * gst_registry_lookup (GstRegistry *registry, const char *filename); | ||
45 | GstPluginFeature * gst_registry_lookup_feature (GstRegistry *registry, const char *name); | ||
46 | |||
47 | -gboolean gst_registry_xml_read_cache (GstRegistry * registry, const char *location); | ||
48 | -gboolean gst_registry_xml_write_cache (GstRegistry * registry, const char *location); | ||
49 | +gboolean gst_registry_binary_read_cache (GstRegistry * registry, const char *location); | ||
50 | +gboolean gst_registry_binary_write_cache (GstRegistry * registry, const char *location); | ||
51 | |||
52 | void _gst_registry_remove_cache_plugins (GstRegistry *registry); | ||
53 | |||
54 | diff -urNd ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/Makefile.am gstreamer-0.10.9/gst/Makefile.am | ||
55 | --- ../gstreamer-0.10.9-r0/gstreamer-0.10.9/gst/Makefile.am 2006-07-13 16:31:47.000000000 +0100 | ||
56 | +++ gstreamer-0.10.9/gst/Makefile.am 2006-09-01 12:30:36.000000000 +0100 | ||
57 | @@ -9,7 +9,7 @@ | ||
58 | if GST_DISABLE_REGISTRY | ||
59 | GST_REGISTRY_SRC = | ||
60 | else | ||
61 | -GST_REGISTRY_SRC = gstregistryxml.c | ||
62 | +GST_REGISTRY_SRC = gstregistrybinary.c | ||
63 | endif | ||
64 | |||
65 | if GST_DISABLE_PARSE | ||
diff --git a/meta/packages/gstreamer/gstreamer/gstregistrybinary.c b/meta/packages/gstreamer/gstreamer/gstregistrybinary.c new file mode 100644 index 0000000000..c1f3e71af6 --- /dev/null +++ b/meta/packages/gstreamer/gstreamer/gstregistrybinary.c | |||
@@ -0,0 +1,487 @@ | |||
1 | /* GStreamer | ||
2 | * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> | ||
3 | * 2000 Wim Taymans <wtay@chello.be> | ||
4 | * 2005 David A. Schleef <ds@schleef.org> | ||
5 | * | ||
6 | * gstregistryxml.c: GstRegistry object, support routines | ||
7 | * | ||
8 | * This library is free software; you can redistribute it and/or | ||
9 | * modify it ulnder 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., 59 Temple Place - Suite 330, | ||
21 | * Boston, MA 02111-1307, USA. | ||
22 | */ | ||
23 | |||
24 | |||
25 | #include <gst/gstregistrybinary.h> | ||
26 | |||
27 | /* | ||
28 | ** Simple handy function to write a memory location to the registry cache file | ||
29 | */ | ||
30 | inline static gboolean | ||
31 | gst_registry_binary_write(GstRegistry *registry, const void *mem, const ssize_t size) | ||
32 | { | ||
33 | if (write(registry->cache_file, mem, size) != size) | ||
34 | { | ||
35 | GST_ERROR("Failed to write binary registry element: ptr=%p size=%u error=%s\n", | ||
36 | mem, size, strerror(errno)); | ||
37 | return FALSE; | ||
38 | } | ||
39 | return TRUE; | ||
40 | } | ||
41 | |||
42 | /* | ||
43 | ** Save features GstBinary style | ||
44 | */ | ||
45 | static gboolean | ||
46 | gst_registry_binary_fill_feature(GList **list, GstPluginFeature *orig, GstBinaryPluginFeature *dest, const char *name) | ||
47 | { | ||
48 | GstBinaryChunck *chk; | ||
49 | |||
50 | if ((chk = calloc(1, sizeof (GstBinaryChunck))) == NULL) | ||
51 | return FALSE; | ||
52 | |||
53 | chk->data = dest; | ||
54 | chk->size = sizeof (GstBinaryPluginFeature); | ||
55 | |||
56 | *list = g_list_append(*list, chk); | ||
57 | |||
58 | dest->rank = orig->rank; | ||
59 | if (!strncpy(dest->typename, name, GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN) || | ||
60 | !strncpy(dest->name, orig->name, GST_BINARY_REGISTRY_TYPENAME_NAME_LEN)) | ||
61 | { | ||
62 | GST_ERROR("Failed to write binary registry feature"); | ||
63 | goto fail; | ||
64 | } | ||
65 | |||
66 | if (GST_IS_ELEMENT_FACTORY(orig)) | ||
67 | { | ||
68 | GstElementFactory *factory = GST_ELEMENT_FACTORY(orig); | ||
69 | |||
70 | if (!strncpy(dest->longname, factory->details.longname, GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN) || | ||
71 | !strncpy(dest->class, factory->details.klass, GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN) || | ||
72 | !strncpy(dest->description, factory->details.description, GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN) || | ||
73 | !strncpy(dest->author, factory->details.author, GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN)) | ||
74 | { | ||
75 | GST_ERROR("Failed to write binary registry feature"); | ||
76 | goto fail; | ||
77 | } | ||
78 | } | ||
79 | |||
80 | dest->npadtemplates = dest->ninterfaces = dest->nuritypes = 0; | ||
81 | return TRUE; | ||
82 | |||
83 | fail: | ||
84 | free(chk); | ||
85 | return FALSE; | ||
86 | } | ||
87 | |||
88 | |||
89 | /* | ||
90 | ** Initialize the GstBinaryRegistryMagic, setting both our magic number and gstreamer major/minor version | ||
91 | */ | ||
92 | inline static gboolean | ||
93 | gst_registry_binary_initialize_magic(GstBinaryRegistryMagic *m) | ||
94 | { | ||
95 | if (!strncpy(m->magic, GST_MAGIC_BINARY_REGISTRY_STR, GST_MAGIC_BINARY_REGISTRY_LEN) || | ||
96 | !strncpy(m->version, GST_MAJORMINOR, GST_BINARY_REGISTRY_VERSION_LEN)) | ||
97 | { | ||
98 | GST_ERROR("Failed to write magic to the registry magic structure"); | ||
99 | return FALSE; | ||
100 | } | ||
101 | return TRUE; | ||
102 | } | ||
103 | |||
104 | /* | ||
105 | ** Check GstBinaryRegistryMagic validity. | ||
106 | ** Return a pointer pointing right after the magic structure | ||
107 | */ | ||
108 | static gchar * | ||
109 | gst_registry_binary_check_magic(gchar *in) | ||
110 | { | ||
111 | GstBinaryRegistryMagic *m = (GstBinaryRegistryMagic *) in; | ||
112 | |||
113 | if (m == NULL || m->magic == NULL || m->version == NULL) | ||
114 | { | ||
115 | GST_ERROR("Binary registry magic structure is broken"); | ||
116 | return NULL; | ||
117 | } | ||
118 | if (strncmp(m->magic, GST_MAGIC_BINARY_REGISTRY_STR, GST_MAGIC_BINARY_REGISTRY_LEN) != 0) | ||
119 | { | ||
120 | GST_ERROR("Binary registry magic is different : %02x%02x%02x%02x != %02x%02x%02x%02x", | ||
121 | GST_MAGIC_BINARY_REGISTRY_STR[0] & 0xff, GST_MAGIC_BINARY_REGISTRY_STR[1] & 0xff, | ||
122 | GST_MAGIC_BINARY_REGISTRY_STR[2] & 0xff, GST_MAGIC_BINARY_REGISTRY_STR[3] & 0xff, | ||
123 | m->magic[0] & 0xff, m->magic[1] & 0xff, m->magic[2] & 0xff, m->magic[3] & 0xff); | ||
124 | return NULL; | ||
125 | } | ||
126 | if (strncmp(m->version, GST_MAJORMINOR, GST_BINARY_REGISTRY_VERSION_LEN)) | ||
127 | { | ||
128 | GST_ERROR("Binary registry magic version is different : %s != %s", | ||
129 | GST_MAJORMINOR, m->version); | ||
130 | return NULL; | ||
131 | } | ||
132 | return (in + sizeof (GstBinaryRegistryMagic)); | ||
133 | } | ||
134 | |||
135 | /* | ||
136 | ** Adapt a GstPlugin to our GstBinaryPluginElement structure, and write it to the | ||
137 | ** registry file. | ||
138 | */ | ||
139 | static gboolean | ||
140 | gst_registry_binary_save_plugin(GList **list, GstRegistry *registry, GstPlugin *plugin) | ||
141 | { | ||
142 | GstBinaryPluginElement *e; | ||
143 | GstBinaryChunck *chk; | ||
144 | GList *walk; | ||
145 | |||
146 | if ((e = calloc(1, sizeof (GstBinaryPluginElement))) == NULL || | ||
147 | (chk = calloc(1, sizeof (GstBinaryChunck))) == NULL) | ||
148 | return FALSE; | ||
149 | |||
150 | chk->data = e; | ||
151 | chk->size = sizeof (GstBinaryPluginElement); | ||
152 | *list = g_list_append(*list, chk); | ||
153 | |||
154 | if (!strncpy(e->name, plugin->desc.name, GST_BINARY_REGISTRY_NAME_LEN) || | ||
155 | !strncpy(e->description, plugin->desc.description, GST_BINARY_REGISTRY_DESCRIPTION_LEN) || | ||
156 | !strncpy(e->filename, plugin->filename, _POSIX_PATH_MAX) || | ||
157 | !strncpy(e->version, plugin->desc.version, GST_BINARY_REGISTRY_VERSION_LEN) || | ||
158 | !strncpy(e->license, plugin->desc.license, GST_BINARY_REGISTRY_LICENSE_LEN) || | ||
159 | !strncpy(e->source, plugin->desc.source, GST_BINARY_REGISTRY_SOURCE_LEN) || | ||
160 | !strncpy(e->package, plugin->desc.package, GST_BINARY_REGISTRY_PACKAGE_LEN) || | ||
161 | !strncpy(e->origin, plugin->desc.origin, GST_BINARY_REGISTRY_ORIGIN_LEN)) | ||
162 | { | ||
163 | GST_DEBUG("Can't adapt GstPlugin to GstBinaryPluginElement"); | ||
164 | goto fail; | ||
165 | } | ||
166 | |||
167 | e->size = plugin->file_size; | ||
168 | e->m32p = plugin->file_mtime; | ||
169 | |||
170 | GList *ft_list = gst_registry_get_feature_list_by_plugin(registry, plugin->desc.name); | ||
171 | |||
172 | for (walk = ft_list; walk; walk = g_list_next(walk), e->nfeatures++) | ||
173 | { | ||
174 | GstPluginFeature *curfeat = GST_PLUGIN_FEATURE (walk->data); | ||
175 | GstBinaryPluginFeature *newfeat; | ||
176 | const char *feat_name = g_type_name(G_OBJECT_TYPE(curfeat)); | ||
177 | |||
178 | if ((newfeat = calloc(1, sizeof (GstBinaryPluginFeature))) == NULL) | ||
179 | goto fail; | ||
180 | |||
181 | if (!feat_name || !gst_registry_binary_fill_feature(list, curfeat, newfeat, feat_name)) | ||
182 | { | ||
183 | GST_ERROR("Can't fill plugin feature, aborting."); | ||
184 | goto fail; | ||
185 | } | ||
186 | } | ||
187 | |||
188 | GST_DEBUG("Found %d features in plugin \"%s\"\n", e->nfeatures, e->name); | ||
189 | return TRUE; | ||
190 | |||
191 | fail: | ||
192 | free(chk); | ||
193 | free(e); | ||
194 | return FALSE; | ||
195 | } | ||
196 | |||
197 | /* | ||
198 | ** Write the cache to file. Part of the code was taken from gstregistryxml.c | ||
199 | */ | ||
200 | gboolean | ||
201 | gst_registry_binary_write_cache(GstRegistry *registry, const char *location) | ||
202 | { | ||
203 | GList *walk; | ||
204 | char *tmp_location; | ||
205 | GstBinaryRegistryMagic *magic; | ||
206 | GstBinaryChunck *magic_chunck; | ||
207 | GList *to_write = NULL; | ||
208 | |||
209 | GST_INFO("Writing binary registry cache"); | ||
210 | |||
211 | g_return_val_if_fail (GST_IS_REGISTRY (registry), FALSE); | ||
212 | tmp_location = g_strconcat (location, ".tmpXXXXXX", NULL); | ||
213 | registry->cache_file = g_mkstemp (tmp_location); | ||
214 | if (registry->cache_file == -1) | ||
215 | { | ||
216 | char *dir; | ||
217 | |||
218 | /* oops, I bet the directory doesn't exist */ | ||
219 | dir = g_path_get_dirname (location); | ||
220 | g_mkdir_with_parents (dir, 0777); | ||
221 | g_free (dir); | ||
222 | |||
223 | registry->cache_file = g_mkstemp (tmp_location); | ||
224 | } | ||
225 | |||
226 | if (registry->cache_file == -1) | ||
227 | goto fail; | ||
228 | |||
229 | if ((magic = calloc(1, sizeof (GstBinaryRegistryMagic))) == NULL || | ||
230 | !gst_registry_binary_initialize_magic(magic)) | ||
231 | goto fail; | ||
232 | |||
233 | if ((magic_chunck = calloc(1, sizeof (GstBinaryChunck))) == NULL) | ||
234 | goto fail; | ||
235 | |||
236 | magic_chunck->data = magic; | ||
237 | magic_chunck->size = sizeof (GstBinaryRegistryMagic); | ||
238 | to_write = g_list_append(to_write, magic_chunck); | ||
239 | |||
240 | /* Iterate trough the list of plugins in the GstRegistry and adapt them to our structures */ | ||
241 | for (walk = g_list_last(registry->plugins); walk; walk = g_list_previous(walk)) | ||
242 | { | ||
243 | GstPlugin *plugin = GST_PLUGIN(walk->data); | ||
244 | |||
245 | if (!plugin->filename) | ||
246 | continue; | ||
247 | |||
248 | if (plugin->flags & GST_PLUGIN_FLAG_CACHED) | ||
249 | { | ||
250 | int ret; | ||
251 | struct stat statbuf; | ||
252 | |||
253 | ret = g_stat (plugin->filename, &statbuf); | ||
254 | if ((ret = g_stat (plugin->filename, &statbuf)) < 0 || | ||
255 | plugin->file_mtime != statbuf.st_mtime || | ||
256 | plugin->file_size != statbuf.st_size) | ||
257 | continue; | ||
258 | } | ||
259 | |||
260 | if (!gst_registry_binary_save_plugin(&to_write, registry, plugin)) | ||
261 | { | ||
262 | GST_ERROR("Can't write binary plugin information for \"%s\"", plugin->filename); | ||
263 | continue; /* Try anyway */ | ||
264 | } | ||
265 | } | ||
266 | |||
267 | for (walk = g_list_first(to_write); walk; walk = g_list_next(walk)) | ||
268 | { | ||
269 | GstBinaryChunck *cur = walk->data; | ||
270 | |||
271 | if (!gst_registry_binary_write(registry, cur->data, cur->size)) | ||
272 | { | ||
273 | free(cur->data); | ||
274 | free(cur); | ||
275 | g_list_free(to_write); | ||
276 | goto fail; | ||
277 | } | ||
278 | free(cur->data); | ||
279 | free(cur); | ||
280 | } | ||
281 | g_list_free(to_write); | ||
282 | |||
283 | if (close(registry->cache_file) < 0) | ||
284 | { | ||
285 | GST_DEBUG("Can't close registry file : %s", strerror(errno)); | ||
286 | goto fail; | ||
287 | } | ||
288 | |||
289 | if (g_file_test (tmp_location, G_FILE_TEST_EXISTS)) { | ||
290 | #ifdef WIN32 | ||
291 | remove (location); | ||
292 | #endif | ||
293 | rename (tmp_location, location); | ||
294 | } | ||
295 | |||
296 | g_free (tmp_location); | ||
297 | return TRUE; | ||
298 | |||
299 | fail: | ||
300 | g_free(tmp_location); | ||
301 | return FALSE; | ||
302 | } | ||
303 | |||
304 | static GstPluginFeature* | ||
305 | gst_registry_binary_load_feature(GstBinaryPluginFeature *in) | ||
306 | { | ||
307 | GstPluginFeature *feature; | ||
308 | GType type; | ||
309 | |||
310 | if (!in->typename || !*(in->typename)) | ||
311 | return NULL; | ||
312 | |||
313 | /* GST_INFO("Plugin feature typename : %s", in->typename);*/ | ||
314 | |||
315 | if (!(type = g_type_from_name(in->typename))) | ||
316 | { | ||
317 | GST_ERROR("Unknown type from typename"); | ||
318 | return NULL; | ||
319 | } | ||
320 | feature = g_object_new (type, NULL); | ||
321 | |||
322 | if (!feature) { | ||
323 | GST_ERROR("Can't create feature from type"); | ||
324 | return NULL; | ||
325 | } | ||
326 | |||
327 | if (!GST_IS_PLUGIN_FEATURE (feature)) { | ||
328 | /* don't really know what it is */ | ||
329 | if (GST_IS_OBJECT (feature)) | ||
330 | gst_object_unref (feature); | ||
331 | else | ||
332 | g_object_unref (feature); | ||
333 | return NULL; | ||
334 | } | ||
335 | |||
336 | feature->name = g_strdup(in->name); | ||
337 | feature->rank = in->rank; | ||
338 | |||
339 | if (GST_IS_ELEMENT_FACTORY(feature)) | ||
340 | { | ||
341 | GstElementFactory *factory = GST_ELEMENT_FACTORY(feature); | ||
342 | |||
343 | factory->details.longname = g_strdup(in->longname); | ||
344 | factory->details.klass = g_strdup(in->class); | ||
345 | factory->details.description = g_strdup(in->description); | ||
346 | factory->details.author = g_strdup(in->author); | ||
347 | |||
348 | /* GST_INFO("Element factory : %s", factory->details.longname); */ | ||
349 | } | ||
350 | |||
351 | GST_DEBUG("Added feature %p with name %s", feature, feature->name); | ||
352 | return feature; | ||
353 | } | ||
354 | |||
355 | /* | ||
356 | ** Make a new plugin from current GstBinaryPluginElement structure | ||
357 | ** and save it to the GstRegistry. Return an offset to the next | ||
358 | ** GstBinaryPluginElement structure. | ||
359 | */ | ||
360 | static unsigned long | ||
361 | gst_registry_binary_get_binary_plugin(GstRegistry *registry, gchar *in) | ||
362 | { | ||
363 | GstBinaryPluginElement *p = (GstBinaryPluginElement *) in; | ||
364 | GstPlugin *plugin = NULL; | ||
365 | GList *plugin_features = NULL; | ||
366 | GstBinaryPluginFeature *feat; | ||
367 | unsigned int i; | ||
368 | unsigned long offset; | ||
369 | |||
370 | plugin = g_object_new (GST_TYPE_PLUGIN, NULL); | ||
371 | |||
372 | plugin->flags |= GST_PLUGIN_FLAG_CACHED; | ||
373 | |||
374 | plugin->desc.name = g_strdup(p->name); | ||
375 | plugin->desc.description= g_strdup(p->description); | ||
376 | plugin->filename = g_strdup(p->filename); | ||
377 | plugin->desc.version = g_strdup(p->version); | ||
378 | plugin->desc.license = g_strdup(p->license); | ||
379 | plugin->desc.source = g_strdup(p->source); | ||
380 | plugin->desc.package = g_strdup(p->package); | ||
381 | plugin->desc.origin = g_strdup(p->origin); | ||
382 | plugin->file_mtime = p->m32p; | ||
383 | plugin->file_size = p->size; | ||
384 | plugin->basename = g_path_get_basename (plugin->filename); | ||
385 | |||
386 | if (plugin->file_mtime < 0 || plugin->file_size < 0) | ||
387 | { | ||
388 | GST_ERROR("Plugin time or file size is not valid !"); | ||
389 | g_free(plugin); | ||
390 | return -1; | ||
391 | } | ||
392 | |||
393 | if (p->nfeatures < 0) | ||
394 | { | ||
395 | GST_ERROR("The number of feature structure is not valid !"); | ||
396 | gst_object_unref(plugin); | ||
397 | return -1; | ||
398 | } | ||
399 | |||
400 | for (feat = (GstBinaryPluginFeature *) (in + sizeof (GstBinaryPluginElement)), i = 0; | ||
401 | i < p->nfeatures; i++, feat++) | ||
402 | { | ||
403 | GstPluginFeature *gstfeat; | ||
404 | |||
405 | if ((gstfeat = gst_registry_binary_load_feature(feat)) == NULL) | ||
406 | { | ||
407 | g_list_free(plugin_features); | ||
408 | g_free(plugin); | ||
409 | GST_ERROR("Error while loading binary feature"); | ||
410 | return -1; | ||
411 | } | ||
412 | gstfeat->plugin_name = g_strdup(plugin->desc.name); | ||
413 | plugin_features = g_list_prepend(plugin_features, gstfeat); | ||
414 | } | ||
415 | |||
416 | GST_DEBUG("Added plugin \"%s\" to global registry from binary registry", plugin->desc.name); | ||
417 | GList *g; | ||
418 | |||
419 | gst_registry_add_plugin (registry, plugin); | ||
420 | for (g = plugin_features; g; g = g_list_next (g)) | ||
421 | gst_registry_add_feature (registry, GST_PLUGIN_FEATURE (g->data)); | ||
422 | /* g_list_free(plugin_features); */ | ||
423 | |||
424 | offset = sizeof (GstBinaryPluginElement) + p->nfeatures * sizeof (GstBinaryPluginFeature); | ||
425 | return offset; | ||
426 | } | ||
427 | |||
428 | |||
429 | /* | ||
430 | ** Read the cache and adapt it to fill GstRegistry | ||
431 | */ | ||
432 | gboolean | ||
433 | gst_registry_binary_read_cache(GstRegistry *registry, const char *location) | ||
434 | { | ||
435 | GMappedFile *mapped = NULL; | ||
436 | GTimer *timer = NULL; | ||
437 | gchar *contents = NULL; | ||
438 | gdouble seconds; | ||
439 | unsigned long offset, inc; | ||
440 | gsize size; | ||
441 | |||
442 | /* make sure these types exist */ | ||
443 | GST_TYPE_ELEMENT_FACTORY; | ||
444 | GST_TYPE_TYPE_FIND_FACTORY; | ||
445 | GST_TYPE_INDEX_FACTORY; | ||
446 | |||
447 | timer = g_timer_new (); | ||
448 | |||
449 | if ((mapped = g_mapped_file_new(location, FALSE, NULL)) == NULL || | ||
450 | (contents = g_mapped_file_get_contents(mapped)) == NULL) | ||
451 | { | ||
452 | GST_ERROR("Can't load file : %s", strerror(errno)); | ||
453 | return FALSE; | ||
454 | } | ||
455 | if ((contents = gst_registry_binary_check_magic(contents)) == NULL) | ||
456 | { | ||
457 | GST_ERROR("Binary registry type not recognized (invalid magic)"); | ||
458 | g_mapped_file_free(mapped); | ||
459 | return FALSE; | ||
460 | } | ||
461 | |||
462 | if ((size = g_mapped_file_get_length(mapped)) < sizeof (GstBinaryPluginElement)) | ||
463 | { | ||
464 | GST_INFO("No binary plugins structure to read"); | ||
465 | return TRUE; /* This is not really an error */ | ||
466 | } | ||
467 | |||
468 | for (offset = inc = 0; (offset + sizeof (GstBinaryPluginElement)) < size && | ||
469 | (inc = gst_registry_binary_get_binary_plugin(registry, contents + offset)) > 0; | ||
470 | offset += inc) | ||
471 | ; /* May want in the future to do something here */ | ||
472 | if (inc < 0) | ||
473 | { | ||
474 | GST_DEBUG("Problem while reading binary registry"); | ||
475 | return FALSE; | ||
476 | } | ||
477 | |||
478 | g_timer_stop (timer); | ||
479 | seconds = g_timer_elapsed (timer, NULL); | ||
480 | g_timer_destroy (timer); | ||
481 | |||
482 | GST_INFO ("loaded %s in %f seconds", location, seconds); | ||
483 | |||
484 | if (mapped) | ||
485 | g_mapped_file_free (mapped); | ||
486 | return TRUE; | ||
487 | } | ||
diff --git a/meta/packages/gstreamer/gstreamer/gstregistrybinary.h b/meta/packages/gstreamer/gstreamer/gstregistrybinary.h new file mode 100644 index 0000000000..2ef24d765d --- /dev/null +++ b/meta/packages/gstreamer/gstreamer/gstregistrybinary.h | |||
@@ -0,0 +1,194 @@ | |||
1 | /* GStreamer | ||
2 | * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> | ||
3 | * 2000 Wim Taymans <wim.taymans@chello.be> | ||
4 | * | ||
5 | * gstregistry.h: Header for registry handling | ||
6 | * | ||
7 | * This library is free software; you can redistribute it and/or | ||
8 | * modify it under the terms of the GNU Library General Public | ||
9 | * License as published by the Free Software Foundation; either | ||
10 | * version 2 of the License, or (at your option) any later version. | ||
11 | * | ||
12 | * This library is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | * Library General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU Library General Public | ||
18 | * License along with this library; if not, write to the | ||
19 | * Free Software Foundation, Inc., 59 Temple Place - Suite 330, | ||
20 | * Boston, MA 02111-1307, USA. | ||
21 | */ | ||
22 | |||
23 | /* SUGGESTIONS AND TODO : | ||
24 | ** ==================== | ||
25 | ** - Use a compressed registry, but would induce performance loss | ||
26 | ** - Encrypt the registry, for security purpose, but would also reduce performances | ||
27 | ** - Also have a non-mmap based cache reading (work with file descriptors) | ||
28 | */ | ||
29 | |||
30 | #ifndef __GST_REGISTRYBINARY_H__ | ||
31 | #define __GST_REGISTRYBINARY_H__ | ||
32 | |||
33 | #ifdef HAVE_CONFIG_H | ||
34 | # include "config.h" | ||
35 | #endif | ||
36 | |||
37 | #include <stdio.h> | ||
38 | #include <errno.h> | ||
39 | #include <sys/types.h> | ||
40 | #include <sys/stat.h> | ||
41 | #include <dirent.h> | ||
42 | #include <fcntl.h> | ||
43 | #include <sys/mman.h> | ||
44 | #ifdef HAVE_UNISTD_H | ||
45 | #include <unistd.h> | ||
46 | #endif | ||
47 | |||
48 | #include <gst/gst_private.h> | ||
49 | #include <gst/gstelement.h> | ||
50 | #include <gst/gsttypefind.h> | ||
51 | #include <gst/gsttypefindfactory.h> | ||
52 | #include <gst/gsturi.h> | ||
53 | #include <gst/gstinfo.h> | ||
54 | #include <gst/gstenumtypes.h> | ||
55 | #include <gst/gstregistry.h> | ||
56 | #include <gst/gstpadtemplate.h> | ||
57 | |||
58 | #include "glib-compat-private.h" | ||
59 | #include <glib/gstdio.h> | ||
60 | |||
61 | /* A magic, written at the beginning of the file */ | ||
62 | #define GST_MAGIC_BINARY_REGISTRY_STR "\xc0\xde\xf0\x0d" | ||
63 | #define GST_MAGIC_BINARY_REGISTRY_LEN (4) | ||
64 | #define GST_MAGIC_BINARY_VERSION_LEN (64) | ||
65 | |||
66 | typedef struct _GstBinaryRegistryMagic | ||
67 | { | ||
68 | char magic[GST_MAGIC_BINARY_REGISTRY_LEN]; | ||
69 | char version[GST_MAGIC_BINARY_VERSION_LEN]; | ||
70 | } GstBinaryRegistryMagic; | ||
71 | |||
72 | |||
73 | /* Used to store pointers to write */ | ||
74 | typedef struct _GstBinaryChunck | ||
75 | { | ||
76 | void *data; | ||
77 | unsigned int size; | ||
78 | } GstBinaryChunck; | ||
79 | |||
80 | |||
81 | /* A structure containing (staticely) every information needed for a plugin | ||
82 | ** | ||
83 | ** Notes : | ||
84 | ** "nfeatures" is used to say how many GstBinaryPluginFeature structures we will have | ||
85 | ** right after the structure itself. | ||
86 | */ | ||
87 | |||
88 | /* Various lenght defines for our GstBinaryPluginElement structure | ||
89 | ** Note : We could eventually use smaller size | ||
90 | */ | ||
91 | #define GST_BINARY_REGISTRY_NAME_LEN (256) | ||
92 | #define GST_BINARY_REGISTRY_DESCRIPTION_LEN (1024) | ||
93 | #define GST_BINARY_REGISTRY_VERSION_LEN (64) | ||
94 | #define GST_BINARY_REGISTRY_LICENSE_LEN (256) | ||
95 | #define GST_BINARY_REGISTRY_SOURCE_LEN (256) | ||
96 | #define GST_BINARY_REGISTRY_PACKAGE_LEN (1024) | ||
97 | #define GST_BINARY_REGISTRY_ORIGIN_LEN (1024) | ||
98 | |||
99 | typedef struct _GstBinaryPluginElement | ||
100 | { | ||
101 | char name[GST_BINARY_REGISTRY_NAME_LEN]; | ||
102 | char description[GST_BINARY_REGISTRY_DESCRIPTION_LEN]; | ||
103 | char filename[_POSIX_PATH_MAX]; | ||
104 | char version[GST_BINARY_REGISTRY_VERSION_LEN]; | ||
105 | char license[GST_BINARY_REGISTRY_LICENSE_LEN]; | ||
106 | char source[GST_BINARY_REGISTRY_SOURCE_LEN]; | ||
107 | char package[GST_BINARY_REGISTRY_PACKAGE_LEN]; | ||
108 | char origin[GST_BINARY_REGISTRY_ORIGIN_LEN]; | ||
109 | unsigned long size; | ||
110 | unsigned long m32p; | ||
111 | unsigned int nfeatures; | ||
112 | } GstBinaryPluginElement; | ||
113 | |||
114 | |||
115 | /* A structure containing the plugin features | ||
116 | ** | ||
117 | ** Note : | ||
118 | ** "npadtemplates" is used to store the number of GstBinaryPadTemplate structures following the structure itself. | ||
119 | ** "ninterfaces" is used to store the number of GstBinaryInterface structures following the structure itself. | ||
120 | ** "nuritypes" is used to store the number of GstBinaryUriType structures following the structure itself. | ||
121 | */ | ||
122 | #define GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN (256) | ||
123 | #define GST_BINARY_REGISTRY_TYPENAME_NAME_LEN (256) | ||
124 | #define GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN (1024) | ||
125 | #define GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN (512) | ||
126 | #define GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN (1024) | ||
127 | #define GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN (256) | ||
128 | |||
129 | typedef struct _GstBinaryPluginFeature | ||
130 | { | ||
131 | char typename[GST_BINARY_REGISTRY_TYPENAME_TYPENAME_LEN]; | ||
132 | char name[GST_BINARY_REGISTRY_TYPENAME_NAME_LEN]; | ||
133 | unsigned long rank; | ||
134 | char longname[GST_BINARY_REGISTRY_TYPENAME_LONGNAME_LEN]; | ||
135 | char class[GST_BINARY_REGISTRY_TYPENAME_CLASS_LEN]; | ||
136 | char description[GST_BINARY_REGISTRY_TYPENAME_DESCRIPTION_LEN]; | ||
137 | char author[GST_BINARY_REGISTRY_TYPENAME_AUTHOR_LEN]; | ||
138 | unsigned int npadtemplates; | ||
139 | unsigned int ninterfaces; | ||
140 | unsigned int nuritypes; | ||
141 | } GstBinaryPluginFeature; | ||
142 | |||
143 | |||
144 | /* | ||
145 | ** A structure containing the static pad templates of a plugin feature | ||
146 | */ | ||
147 | #define GST_BINARY_REGISTRY_PADTEMPLATE_NAME_LEN (256) | ||
148 | #define GST_BINARY_REGISTRY_PADTEMPLATE_CAP_LEN (1024) | ||
149 | |||
150 | typedef struct _GstBinaryPadTemplate | ||
151 | { | ||
152 | char name[GST_BINARY_REGISTRY_PADTEMPLATE_NAME_LEN]; | ||
153 | char cap[GST_BINARY_REGISTRY_PADTEMPLATE_CAP_LEN]; | ||
154 | int direction; /* Either 0:"sink" or 1:"src" */ | ||
155 | GstPadPresence presence; | ||
156 | } GstBinaryPadTemplate; | ||
157 | |||
158 | /* | ||
159 | ** A very simple structure defining the plugin feature interface string | ||
160 | */ | ||
161 | #define GST_BINARY_REGISTRY_INTERFACE_INTERFACE_LEN (512) | ||
162 | typedef struct _GstBinaryInterface | ||
163 | { | ||
164 | char interface[GST_BINARY_REGISTRY_INTERFACE_INTERFACE_LEN]; | ||
165 | unsigned long size; | ||
166 | } GstBinaryInterface; | ||
167 | |||
168 | /* Uri Type */ | ||
169 | typedef struct _GstBinaryUriType | ||
170 | { | ||
171 | GstURIType type; | ||
172 | unsigned long nuriprotocols; | ||
173 | } GstBinaryUriType; | ||
174 | |||
175 | /* | ||
176 | ** Function prototypes | ||
177 | */ | ||
178 | |||
179 | /* Local prototypes */ | ||
180 | inline static gboolean gst_registry_binary_write(GstRegistry *registry, const void *mem, const ssize_t size); | ||
181 | inline static gboolean gst_registry_binary_initialize_magic(GstBinaryRegistryMagic *m); | ||
182 | static gboolean gst_registry_binary_fill_feature(GList **list, GstPluginFeature *, GstBinaryPluginFeature *, const char *); | ||
183 | static gboolean gst_registry_binary_save_plugin(GList **list, GstRegistry *registry, GstPlugin *plugin); | ||
184 | static gchar *gst_registry_binary_check_magic(gchar *in); | ||
185 | static GstPluginFeature *gst_registry_binary_load_feature(GstBinaryPluginFeature *); | ||
186 | static unsigned long gst_registry_binary_get_binary_plugin(GstRegistry *registry, gchar *in); | ||
187 | |||
188 | /* Exportable */ | ||
189 | gboolean gst_registry_binary_write_cache(GstRegistry *registry, const char *location); | ||
190 | gboolean gst_registry_binary_read_cache(GstRegistry *registry, const char *location); | ||
191 | |||
192 | #endif /* !__GST_REGISTRYBINARY_H__ */ | ||
193 | |||
194 | |||
diff --git a/meta/packages/gstreamer/gstreamer_0.10.9.bb b/meta/packages/gstreamer/gstreamer_0.10.9.bb new file mode 100644 index 0000000000..66db827523 --- /dev/null +++ b/meta/packages/gstreamer/gstreamer_0.10.9.bb | |||
@@ -0,0 +1,33 @@ | |||
1 | DESCRIPTION = "GStreamer is a multimedia framework for encoding and decoding video and sound. \ | ||
2 | It supports a wide range of formats including mp3, ogg, avi, mpeg and quicktime." | ||
3 | SECTION = "multimedia" | ||
4 | PRIORITY = "optional" | ||
5 | LICENSE = "LGPL" | ||
6 | HOMEPAGE = "http://www.gstreamer.net/" | ||
7 | MAINTAINER = "Felix Domke <tmbinc@elitedvb.net>" | ||
8 | DEPENDS = "glib-2.0 gettext-native popt" | ||
9 | |||
10 | inherit autotools pkgconfig | ||
11 | |||
12 | SRC_URI = "http://gstreamer.freedesktop.org/src/gstreamer/gstreamer-${PV}.tar.bz2 \ | ||
13 | file://gstregistrybinary.c \ | ||
14 | file://gstregistrybinary.h \ | ||
15 | file://gstreamer-0.9-binary-registry.patch;patch=1" | ||
16 | EXTRA_OECONF = "--disable-docs-build --disable-dependency-tracking --with-check=no" | ||
17 | |||
18 | do_compile_prepend () { | ||
19 | mv ${WORKDIR}/gstregistrybinary.[ch] ${S}/gst/ | ||
20 | } | ||
21 | |||
22 | do_stage() { | ||
23 | oe_runmake install prefix=${STAGING_DIR} \ | ||
24 | bindir=${STAGING_BINDIR} \ | ||
25 | includedir=${STAGING_INCDIR} \ | ||
26 | libdir=${STAGING_LIBDIR} \ | ||
27 | datadir=${STAGING_DATADIR} \ | ||
28 | mandir=${STAGING_DIR}/share/man | ||
29 | } | ||
30 | |||
31 | FILES_${PN} += " ${libdir}/gstreamer-0.10/*.so" | ||
32 | FILES_${PN}-dev += " ${libdir}/gstreamer-0.10/*.la ${libdir}/gstreamer-0.10/*.a" | ||
33 | |||