2 * Copyright (C) 2009 Sebastian Dröge <sebastian.droege@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
27 #include "mxfessence.h"
29 GST_DEBUG_CATEGORY_EXTERN (mxf_debug);
30 #define GST_CAT_DEFAULT mxf_debug
32 static GSList *_mxf_essence_element_handler_registry = NULL;
35 mxf_essence_element_handler_register (const MXFEssenceElementHandler * handler)
37 _mxf_essence_element_handler_registry =
38 g_slist_prepend (_mxf_essence_element_handler_registry,
42 const MXFEssenceElementHandler *
43 mxf_essence_element_handler_find (const MXFMetadataTimelineTrack * track)
46 const MXFEssenceElementHandler *ret = NULL;
48 for (l = _mxf_essence_element_handler_registry; l; l = l->next) {
49 MXFEssenceElementHandler *current = l->data;
51 if (current->handles_track (track)) {
59 static GList *_essence_element_writer_registry = NULL;
60 static GPtrArray *_essence_element_writer_pad_templates = NULL;
63 mxf_essence_element_writer_register (const MXFEssenceElementWriter * writer)
65 _essence_element_writer_registry =
66 g_list_prepend (_essence_element_writer_registry, (gpointer) writer);
68 if (!_essence_element_writer_pad_templates)
69 _essence_element_writer_pad_templates = g_ptr_array_new ();
71 if (_essence_element_writer_pad_templates->len > 0 &&
72 g_ptr_array_index (_essence_element_writer_pad_templates,
73 _essence_element_writer_pad_templates->len - 1) == NULL)
74 g_ptr_array_remove_index (_essence_element_writer_pad_templates,
75 _essence_element_writer_pad_templates->len - 1);
77 g_ptr_array_add (_essence_element_writer_pad_templates,
78 (gpointer) writer->pad_template);
81 const GstPadTemplate **
82 mxf_essence_element_writer_get_pad_templates (void)
84 if (!_essence_element_writer_pad_templates
85 || _essence_element_writer_pad_templates->len == 0)
88 if (g_ptr_array_index (_essence_element_writer_pad_templates,
89 _essence_element_writer_pad_templates->len - 1))
90 g_ptr_array_add (_essence_element_writer_pad_templates, NULL);
92 return (const GstPadTemplate **) _essence_element_writer_pad_templates->pdata;
95 const MXFEssenceElementWriter *
96 mxf_essence_element_writer_find (const GstPadTemplate * templ)
98 GList *l = _essence_element_writer_registry;
100 for (; l; l = l->next) {
101 MXFEssenceElementWriter *writer = l->data;
103 if (writer->pad_template == templ)