5cb800b5c9c3ef98cad4e1af95ceef7c6a84fc51
1 /*
2 * GStreamer
3 * Copyright (c) 2010, Texas Instruments Incorporated
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation
8 * version 2.1 of the License.
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 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 */
20 #ifdef HAVE_CONFIG_H
21 # include <config.h>
22 #endif
24 #include <gst/gst.h>
26 #include "gstducatih264dec.h"
27 #include "gstducatimpeg4dec.h"
28 #include "gstducativc1dec.h"
29 #include "gstducativp6dec.h"
31 GST_DEBUG_CATEGORY (gst_ducati_debug);
33 static gboolean
34 plugin_init (GstPlugin * plugin)
35 {
36 GST_DEBUG_CATEGORY_INIT (gst_ducati_debug, "ducati", 0, "ducati");
38 /* TODO .. find some way to reasonably detect if the corresponding
39 * codecs are actually available..
40 */
41 return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264DEC) &&
42 gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4DEC) &&
43 gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC) &&
44 gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP6DEC);
45 }
47 void *
48 gst_ducati_alloc_1d (gint sz)
49 {
50 MemAllocBlock block = {
51 .pixelFormat = PIXEL_FMT_PAGE,
52 .dim.len = sz,
53 };
54 return MemMgr_Alloc (&block, 1);
55 }
57 void *
58 gst_ducati_alloc_2d (gint width, gint height)
59 {
60 MemAllocBlock block[] = { {
61 .pixelFormat = PIXEL_FMT_8BIT,
62 .dim = {.area = {
63 .width = width,
64 .height = height,
65 }}
66 }, {
67 .pixelFormat = PIXEL_FMT_16BIT,
68 .dim = {.area = {
69 .width = width,
70 .height = height / 2,
71 }}
72 }
73 };
74 return MemMgr_Alloc (block, 2);
75 }
77 XDAS_Int16
78 gst_ducati_get_mem_type (SSPtr paddr)
79 {
80 if ((0x60000000 <= paddr) && (paddr < 0x68000000))
81 return XDM_MEMTYPE_TILED8;
82 if ((0x68000000 <= paddr) && (paddr < 0x70000000))
83 return XDM_MEMTYPE_TILED16;
84 if ((0x70000000 <= paddr) && (paddr < 0x78000000))
85 return XDM_MEMTYPE_TILED32;
86 if ((0x78000000 <= paddr) && (paddr < 0x80000000))
87 return XDM_MEMTYPE_RAW;
88 return -1;
89 }
91 /* PACKAGE: this is usually set by autotools depending on some _INIT macro
92 * in configure.ac and then written into and defined in config.h, but we can
93 * just set it ourselves here in case someone doesn't use autotools to
94 * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
95 */
96 #ifndef PACKAGE
97 # define PACKAGE "ducati"
98 #endif
100 GST_PLUGIN_DEFINE (
101 GST_VERSION_MAJOR,
102 GST_VERSION_MINOR,
103 "ducati",
104 "Hardware accellerated codecs for OMAP4",
105 plugin_init,
106 VERSION,
107 "LGPL",
108 "GStreamer",
109 "http://gstreamer.net/"
110 )