diff options
author | Thiago Santos <thiagoss@osg.samsung.com> | 2015-09-01 18:00:01 -0300 |
---|---|---|
committer | Thiago Santos <thiagoss@osg.samsung.com> | 2015-11-01 08:51:51 -0300 |
commit | 162398a18877fd0c75794012388526320bce7c3d (patch) | |
tree | 8d19d08ed9edb3f95441d714d6cf7f9b0d02874f | |
parent | 973cd86c99fadf3583ba0b27e5c785f1dc3c5860 (diff) |
capsquerycache: new gstminiobject to do caching of caps queries
It should provide a caps->caps mapping, allowing cache of caps
queries by mapping filter->result.
-rw-r--r-- | gst/Makefile.am | 2 | ||||
-rw-r--r-- | gst/gstcapsquerycache.c | 77 | ||||
-rw-r--r-- | gst/gstcapsquerycache.h | 56 | ||||
-rw-r--r-- | tests/check/Makefile.am | 1 | ||||
-rw-r--r-- | tests/check/gst/.gitignore | 1 | ||||
-rw-r--r-- | tests/check/gst/gstcapsquerycache.c | 49 |
6 files changed, 186 insertions, 0 deletions
diff --git a/gst/Makefile.am b/gst/Makefile.am index dda710f13..6468aa29f 100644 --- a/gst/Makefile.am +++ b/gst/Makefile.am @@ -65,6 +65,7 @@ libgstreamer_@GST_API_VERSION@_la_SOURCES = \ gstbus.c \ gstcaps.c \ gstcapsfeatures.c \ + gstcapsquerycache.c \ gstchildproxy.c \ gstclock.c \ gstclock-linreg.c \ @@ -174,6 +175,7 @@ gst_headers = \ gstbus.h \ gstcaps.h \ gstcapsfeatures.h \ + gstcapsquerycache.h \ gstchildproxy.h \ gstclock.h \ gstcompat.h \ diff --git a/gst/gstcapsquerycache.c b/gst/gstcapsquerycache.c new file mode 100644 index 000000000..d88cc0c5f --- /dev/null +++ b/gst/gstcapsquerycache.c @@ -0,0 +1,77 @@ +/* GStreamer + * Copyright (C) 2015 Samsung Electronics. All rights reserved. + * Author: Thiago Santos <thiagoss@osg.samsung.com> + * + * 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. + */ + +/** + * SECTION:gstcapsquerycache + * @short_description: Implements caching of caps queries and results + * @see_also: #GstCaps, #GstQuery, #GstMiniObject + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "gst_private.h" +#include <gst/gst.h> +#include <gst/gstcapsquerycache.h> + +typedef struct _GstCapsQueryCacheImpl +{ + GstCapsQueryCache caps; + +} GstCapsQueryCacheImpl; + +GType _gst_caps_query_cache_type = 0; + +GST_DEFINE_MINI_OBJECT_TYPE (GstCapsQueryCache, gst_caps_query_cache); + +/* creation/deletion */ +static void +_gst_caps_query_cache_free (GstCapsQueryCache * capscache) +{ + /* TODO implement */ + g_slice_free1 (sizeof (GstCapsQueryCacheImpl), capscache); +} + +static void +gst_caps_query_cache_init (GstCapsQueryCache * capscache) +{ + gst_mini_object_init (GST_MINI_OBJECT_CAST (capscache), 0, + _gst_caps_query_cache_type, NULL, NULL, + (GstMiniObjectFreeFunction) _gst_caps_query_cache_free); +} + +/** + * gst_caps_query_cache_new: + * + * Returns: (transfer full): the new #GstCapsQueryCache + */ +GstCapsQueryCache * +gst_caps_query_cache_new (void) +{ + GstCapsQueryCache *capscache; + + capscache = (GstCapsQueryCache *) g_slice_new (GstCapsQueryCacheImpl); + + gst_caps_query_cache_init (capscache); + + return capscache; +} diff --git a/gst/gstcapsquerycache.h b/gst/gstcapsquerycache.h new file mode 100644 index 000000000..d0f904bd4 --- /dev/null +++ b/gst/gstcapsquerycache.h @@ -0,0 +1,56 @@ +/* GStreamer + * Copyright (C) 2015 Samsung Electronics. All rights reserved. + * Author: Thiago Santos <thiagoss@osg.samsung.com> + * + * 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_CAPS_QUERY_CACHE_H__ +#define __GST_CAPS_QUERY_CACHE_H__ + +#include <gst/gstconfig.h> +#include <gst/gstminiobject.h> +#include <gst/gstcaps.h> +#include <gst/glib-compat.h> + +G_BEGIN_DECLS + +GST_EXPORT GType _gst_caps_query_cache_type; + +#define GST_TYPE_CAPS_QUERY_CACHE (_gst_caps_query_cache_type) +#define GST_IS_CAPS_QUERY_CACHE(obj) (GST_IS_MINI_OBJECT_TYPE((obj), GST_TYPE_CAPS_QUERY_CACHE)) +#define GST_CAPS_QUERY_CACHE_CAST(obj) ((GstCapsQueryCache*)(obj)) +#define GST_CAPS_QUERY_CACHE(obj) (GST_CAPS_QUERY_CACHE_CAST(obj)) + +typedef struct _GstCapsQueryCache GstCapsQueryCache; + +/** + * GstCapsQueryCache: + * @mini_object: the parent type + * + * Object describing media types. + */ +struct _GstCapsQueryCache { + GstMiniObject mini_object; +}; + +GType gst_caps_query_cache_get_type (void); + +GstCapsQueryCache * gst_caps_query_cache_new (void); + +G_END_DECLS + +#endif /* __GST_CAPS_QUERY_CACHE_H__ */ diff --git a/tests/check/Makefile.am b/tests/check/Makefile.am index 07ad657af..7a1960f59 100644 --- a/tests/check/Makefile.am +++ b/tests/check/Makefile.am @@ -120,6 +120,7 @@ check_PROGRAMS = \ gst/gstbus \ gst/gstcaps \ gst/gstcapsfeatures \ + gst/gstcapsquerycache \ $(CXX_CHECKS) \ gst/gstdatetime \ gst/gstdevice \ diff --git a/tests/check/gst/.gitignore b/tests/check/gst/.gitignore index fcea84e7a..91843f6e3 100644 --- a/tests/check/gst/.gitignore +++ b/tests/check/gst/.gitignore @@ -9,6 +9,7 @@ gstbufferpool gstbus gstcaps gstcapsfeatures +gstcapsquerycache gstchildproxy gstclock gstcontroller diff --git a/tests/check/gst/gstcapsquerycache.c b/tests/check/gst/gstcapsquerycache.c new file mode 100644 index 000000000..581a8d7c5 --- /dev/null +++ b/tests/check/gst/gstcapsquerycache.c @@ -0,0 +1,49 @@ +/* GStreamer + * Copyright (C) 2015 Samsung Electronics. All rights reserved. + * Author: Thiago Santos <thiagoss@osg.samsung.com> + * + * gstcapsquerycache.c: Unit test for GstCapsQueryCache + * + * 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. + */ + +#include <gst/check/gstcheck.h> +#include <gst/gstcapsquerycache.h> + +GST_START_TEST (test_create) +{ + GstCapsQueryCache *capscache; + + capscache = gst_caps_query_cache_new (); + + gst_mini_object_unref (GST_MINI_OBJECT_CAST (capscache)); +} + +GST_END_TEST; + +static Suite * +gst_caps_query_cache_suite (void) +{ + Suite *s = suite_create ("GstCapsQueryCache"); + TCase *tc_chain = tcase_create ("operations"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_create); + + return s; +} + +GST_CHECK_MAIN (gst_caps_query_cache); |