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 "gstducati.h"
25 #include "gstducatih264dec.h"
26 #include "gstducatimpeg4dec.h"
27 #include "gstducatimpeg2dec.h"
28 #include "gstducativc1dec.h"
29 #include "gstducativp6dec.h"
30 #include "gstducativp7dec.h"
31 #include "gstducatirvdec.h"
32 #include "gstducatih264enc.h"
34 GST_DEBUG_CATEGORY (gst_ducati_debug);
36 static gboolean
37 plugin_init (GstPlugin * plugin)
38 {
39 GST_DEBUG_CATEGORY_INIT (gst_ducati_debug, "ducati", 0, "ducati");
41 /* TODO .. find some way to reasonably detect if the corresponding
42 * codecs are actually available..
43 */
44 return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264DEC) &&
45 gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4DEC) &&
46 gst_element_register (plugin, "ducatimpeg2dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG2DEC) &&
47 gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC) &&
48 gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP6DEC) &&
49 gst_element_register (plugin, "ducativp7dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP7DEC) &&
50 gst_element_register (plugin, "ducatirvdec", GST_RANK_PRIMARY, GST_TYPE_DUCATIRVDEC) &&
51 gst_element_register (plugin, "ducatih264enc", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264ENC);
52 }
54 void *
55 gst_ducati_alloc_1d (gint sz)
56 {
57 MemAllocBlock block = {
58 .pixelFormat = PIXEL_FMT_PAGE,
59 .dim.len = sz,
60 };
61 return MemMgr_Alloc (&block, 1);
62 }
64 void *
65 gst_ducati_alloc_2d (gint width, gint height, guint * sz)
66 {
67 MemAllocBlock block[] = { {
68 .pixelFormat = PIXEL_FMT_8BIT,
69 .dim = {.area = {
70 .width = width,
71 .height = ALIGN2 (height, 1),
72 }},
73 .stride = 4096
74 }, {
75 .pixelFormat = PIXEL_FMT_16BIT,
76 .dim = {.area = {
77 .width = width,
78 .height = ALIGN2 (height, 1) / 2,
79 }},
80 .stride = 4096
81 }
82 };
83 if (sz) {
84 *sz = (4096 * ALIGN2 (height, 1) * 3) / 2;
85 }
86 return MemMgr_Alloc (block, 2);
87 }
89 XDAS_Int16
90 gst_ducati_get_mem_type (SSPtr paddr)
91 {
92 XDAS_Int16 type = -1;
94 if ((0x60000000 <= paddr) && (paddr < 0x68000000))
95 type = XDM_MEMTYPE_TILED8;
96 else if ((0x68000000 <= paddr) && (paddr < 0x70000000))
97 type = XDM_MEMTYPE_TILED16;
98 else if ((0x70000000 <= paddr) && (paddr < 0x78000000))
99 type = XDM_MEMTYPE_TILED32;
100 else if ((0x78000000 <= paddr) && (paddr < 0x80000000))
101 type = XDM_MEMTYPE_TILEDPAGE;
103 return type;
104 }
106 /* PACKAGE: this is usually set by autotools depending on some _INIT macro
107 * in configure.ac and then written into and defined in config.h, but we can
108 * just set it ourselves here in case someone doesn't use autotools to
109 * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
110 */
111 #ifndef PACKAGE
112 # define PACKAGE "ducati"
113 #endif
115 GST_PLUGIN_DEFINE (
116 GST_VERSION_MAJOR,
117 GST_VERSION_MINOR,
118 "ducati",
119 "Hardware accellerated codecs for OMAP4",
120 plugin_init,
121 VERSION,
122 "LGPL",
123 "GStreamer",
124 "http://gstreamer.net/"
125 )