]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gst-plugin-ducati.git/blob - src/gstducati.c
vp7dec: add On2 VP7 support
[glsdk/gst-plugin-ducati.git] / src / gstducati.c
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"
30 #include "gstducativp7dec.h"
32 GST_DEBUG_CATEGORY (gst_ducati_debug);
34 static gboolean
35 plugin_init (GstPlugin * plugin)
36 {
37   GST_DEBUG_CATEGORY_INIT (gst_ducati_debug, "ducati", 0, "ducati");
39   /* TODO .. find some way to reasonably detect if the corresponding
40    * codecs are actually available..
41    */
42   return gst_element_register (plugin, "ducatih264dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIH264DEC) &&
43       gst_element_register (plugin, "ducatimpeg4dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIMPEG4DEC) &&
44       gst_element_register (plugin, "ducativc1dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVC1DEC) &&
45       gst_element_register (plugin, "ducativp6dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP6DEC) &&
46       gst_element_register (plugin, "ducativp7dec", GST_RANK_PRIMARY, GST_TYPE_DUCATIVP7DEC);
47 }
49 void *
50 gst_ducati_alloc_1d (gint sz)
51 {
52   MemAllocBlock block = {
53     .pixelFormat = PIXEL_FMT_PAGE,
54     .dim.len = sz,
55   };
56   return MemMgr_Alloc (&block, 1);
57 }
59 void *
60 gst_ducati_alloc_2d (gint width, gint height)
61 {
62   MemAllocBlock block[] = { {
63           .pixelFormat = PIXEL_FMT_8BIT,
64           .dim = {.area = {
65                       .width = width,
66                       .height = height,
67                   }}
68       }, {
69         .pixelFormat = PIXEL_FMT_16BIT,
70         .dim = {.area = {
71                     .width = width,
72                     .height = height / 2,
73                 }}
74       }
75   };
76   return MemMgr_Alloc (block, 2);
77 }
79 XDAS_Int16
80 gst_ducati_get_mem_type (SSPtr paddr)
81 {
82   if ((0x60000000 <= paddr) && (paddr < 0x68000000))
83     return XDM_MEMTYPE_TILED8;
84   if ((0x68000000 <= paddr) && (paddr < 0x70000000))
85     return XDM_MEMTYPE_TILED16;
86   if ((0x70000000 <= paddr) && (paddr < 0x78000000))
87     return XDM_MEMTYPE_TILED32;
88   if ((0x78000000 <= paddr) && (paddr < 0x80000000))
89     return XDM_MEMTYPE_RAW;
90   return -1;
91 }
93 /* PACKAGE: this is usually set by autotools depending on some _INIT macro
94  * in configure.ac and then written into and defined in config.h, but we can
95  * just set it ourselves here in case someone doesn't use autotools to
96  * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
97  */
98 #ifndef PACKAGE
99 #  define PACKAGE "ducati"
100 #endif
102 GST_PLUGIN_DEFINE (
103     GST_VERSION_MAJOR,
104     GST_VERSION_MINOR,
105     "ducati",
106     "Hardware accellerated codecs for OMAP4",
107     plugin_init,
108     VERSION,
109     "LGPL",
110     "GStreamer",
111     "http://gstreamer.net/"