Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / sys / pvr2d / gstpvr.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  */
19
20 #ifdef HAVE_CONFIG_H
21 #  include <config.h>
22 #endif
23
24 #include "gstpvr.h"
25 #include "gstpvrvideosink.h"
26
27 GST_DEBUG_CATEGORY (gst_debug_pvrvideosink);
28
29 static gboolean
30 plugin_init (GstPlugin * plugin)
31 {
32   GST_DEBUG_CATEGORY_INIT (gst_debug_pvrvideosink, "pvrvideosink", 0,
33       "pvrvideosink");
34
35   return gst_element_register (plugin, "pvrvideosink", GST_RANK_PRIMARY,
36       GST_TYPE_PVRVIDEOSINK);
37 }
38
39 void *
40 gst_ducati_alloc_1d (gint sz)
41 {
42   MemAllocBlock block = {
43     .pixelFormat = PIXEL_FMT_PAGE,
44     .dim.len = sz,
45   };
46   return MemMgr_Alloc (&block, 1);
47 }
48
49 void *
50 gst_ducati_alloc_2d (gint width, gint height, guint * sz)
51 {
52   MemAllocBlock block[] = { {
53           .pixelFormat = PIXEL_FMT_8BIT,
54           .dim = {.area = {
55                       .width = width,
56                       .height = ALIGN2 (height, 1),
57                   }},
58       .stride = 4096}, {
59         .pixelFormat = PIXEL_FMT_16BIT,
60         .dim = {.area = {
61                     .width = width,
62                     .height = ALIGN2 (height, 1) / 2,
63                 }},
64       .stride = 4096}
65   };
66   if (sz) {
67     *sz = (4096 * ALIGN2 (height, 1) * 3) / 2;
68   }
69   return MemMgr_Alloc (block, 2);
70 }
71
72 /* PACKAGE: this is usually set by autotools depending on some _INIT macro
73  * in configure.ac and then written into and defined in config.h, but we can
74  * just set it ourselves here in case someone doesn't use autotools to
75  * compile this code. GST_PLUGIN_DEFINE needs PACKAGE to be defined.
76  */
77 #ifndef PACKAGE
78 #  define PACKAGE "ducati"
79 #endif
80
81 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
82     GST_VERSION_MINOR,
83     "pvr",
84     "Pvr2d based plugin",
85     plugin_init, VERSION, "LGPL", "GStreamer", "http://gstreamer.net/")