4c7904487c820835afe42172f983c1b7af27227d
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 /**
21 * SECTION:element-ducatimpeg4dec
22 *
23 * FIXME:Describe ducatimpeg4dec here.
24 *
25 * <refsect2>
26 * <title>Example launch line</title>
27 * |[
28 * gst-launch -v -m fakesrc ! ducatimpeg4dec ! fakesink silent=TRUE
29 * ]|
30 * </refsect2>
31 */
33 #ifdef HAVE_CONFIG_H
34 # include <config.h>
35 #endif
37 #include <gst/gst.h>
38 #include <gst/video/video.h>
40 #include "gstducatimpeg4dec.h"
43 #define PADX 32
44 #define PADY 32
47 GST_BOILERPLATE (GstDucatiMpeg4Dec, gst_ducati_mpeg4dec, GstDucatiVidDec,
48 GST_TYPE_DUCATIVIDDEC);
50 #define MPEG4DEC_SINKCAPS_COMMON \
51 "width = (int)[ 16, 2048 ], " \
52 "height = (int)[ 16, 2048 ], " \
53 "framerate = (fraction)[ 0, max ]"
55 static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
56 GST_PAD_SINK,
57 GST_PAD_ALWAYS,
58 GST_STATIC_CAPS (
59 "video/mpeg, "
60 "mpegversion = (int)4, "
61 "systemstream = (boolean)false, "
62 MPEG4DEC_SINKCAPS_COMMON ";"
63 "video/x-divx, "
64 "divxversion = (int)[4, 5], " /* TODO check this */
65 MPEG4DEC_SINKCAPS_COMMON ";"
66 "video/x-xvid, "
67 MPEG4DEC_SINKCAPS_COMMON ";"
68 "video/x-3ivx, "
69 MPEG4DEC_SINKCAPS_COMMON ";"
70 )
71 );
73 /* GstDucatiVidDec vmethod implementations */
75 static void
76 gst_ducati_mpeg4dec_update_buffer_size (GstDucatiVidDec * self)
77 {
78 gint w = self->width;
79 gint h = self->height;
81 /* calculate output buffer parameters: */
82 self->padded_width = (w + PADX + 0x7f) & ~0x7f;
83 self->padded_height = h + PADY;
84 self->min_buffers = 8;
85 }
87 static gboolean
88 gst_ducati_mpeg4dec_allocate_params (GstDucatiVidDec * self, gint params_sz,
89 gint dynparams_sz, gint status_sz, gint inargs_sz, gint outargs_sz)
90 {
91 gboolean ret = parent_class->allocate_params (self,
92 sizeof (IMPEG4VDEC_Params), sizeof (IMPEG4VDEC_DynamicParams),
93 sizeof (IMPEG4VDEC_Status), sizeof (IMPEG4VDEC_InArgs),
94 sizeof (IMPEG4VDEC_OutArgs));
96 if (ret) {
97 IMPEG4VDEC_Params *params = (IMPEG4VDEC_Params *) self->params;
98 self->params->displayDelay = IVIDDEC3_DISPLAY_DELAY_1;
99 self->dynParams->lateAcquireArg = -1;
100 params->outloopDeBlocking = TRUE;
101 params->sorensonSparkStream = FALSE;
102 params->ErrorConcealmentON = FALSE;
103 }
105 return ret;
106 }
108 /* GObject vmethod implementations */
110 static void
111 gst_ducati_mpeg4dec_base_init (gpointer gclass)
112 {
113 GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
115 gst_element_class_set_details_simple (element_class,
116 "DucatiMpeg4Dec",
117 "Codec/Decoder/Video",
118 "Decodes video in MPEG-4 format with ducati",
119 "Rob Clark <rob@ti.com>");
121 gst_element_class_add_pad_template (element_class,
122 gst_static_pad_template_get (&sink_factory));
123 }
125 static void
126 gst_ducati_mpeg4dec_class_init (GstDucatiMpeg4DecClass * klass)
127 {
128 GstDucatiVidDecClass *bclass = GST_DUCATIVIDDEC_CLASS (klass);
129 bclass->codec_name = "ivahd_mpeg4dec";
130 bclass->update_buffer_size =
131 GST_DEBUG_FUNCPTR (gst_ducati_mpeg4dec_update_buffer_size);
132 bclass->allocate_params =
133 GST_DEBUG_FUNCPTR (gst_ducati_mpeg4dec_allocate_params);
134 }
136 static void
137 gst_ducati_mpeg4dec_init (GstDucatiMpeg4Dec * self,
138 GstDucatiMpeg4DecClass * gclass)
139 {
140 }