2 * Plugin Name : gstgdecoder.h
3 * Description : Header file for Video Decoder for for TI Davinci DM644x
5 * Copyright (C) 2007 Texas Instruments, Inc.
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU Lesser General Public License as published
9 * by the Free Software Foundation version 2.1 of the License.
11 * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
12 * whether express or implied; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 #ifndef __GST_GDECODER_H__
17 #define __GST_GDECODER_H__
27 #include <sys/types.h>
35 #include <gst/base/gstadapter.h>
38 #define IDMA3_USEFULLPACKAGEPATH
43 #include <ti/sdo/ce/video/viddec.h>
44 #include <ti/sdo/ce/CERuntime.h>
45 #include <ti/sdo/ce/Engine.h>
46 #include <ti/sdo/ce/trace/gt.h>
47 #include <ti/sdo/ce/osal/Memory.h>
48 #include <ti/sdo/fc/acpy3/idma3.h>
50 #include <ti/sdo/ivc1dec.h>
52 #define CLOCK_BASE 9LL
53 #define CLOCK_FREQ CLOCK_BASE * 10000
55 #define MPEGTIME_TO_GSTTIME(time) (((time) * (GST_MSECOND/10)) / CLOCK_BASE)
56 #define GSTTIME_TO_MPEGTIME(time) (((time) * CLOCK_BASE) / (GST_MSECOND/10))
58 #define MAX_FRAME_WIDTH 720
59 #define MAX_FRAME_HEIGHT 480
60 #define PREROLL_TIME 180000000
61 #define FRAME_DURATION 33366666 //We can't hardcode this, get it from demuxer
63 #define GDECODER_INIT_STATE 0
64 #define GDECODER_PROCESS_STATE 1
66 /* Begin Declaration */
69 #define GST_TYPE_GDECODER (gst_gdecoder_get_type())
70 #define GST_TYPE_GDECODER_ENGINE (gst_gdecoder_get_engine_type())
71 #define GST_TYPE_GDECODER_CODEC (gst_gdecoder_get_codec_type())
72 #define GST_GDECODER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_GDECODER,GstGDecoder))
73 #define GST_GDECODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_GDECODER,GstGDecoderClass))
74 #define GST_GDECODER_GET_CLASS(klass) (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_GDECODER,GstGDecoderClass))
75 #define GST_IS_GDECODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_GDECODER))
76 #define GST_IS_GDECODER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_GDECODER))
78 typedef struct _GstGDecoder GstGDecoder
;
79 typedef struct _GstGDecoderClass GstGDecoderClass
;
91 gboolean isCodecPropSet
;
97 XDM_BufDesc outBufDesc
;
98 XDM_BufDesc inBufDesc
;
99 guint32 readOffset
; //File read offset
100 XDAS_Int32 inBufSize
; //For free
101 guint32 curInBufStartOffset
;
112 GSList
*displaybuf_pool
;
118 guint64 bytesConsumed
;
120 guint32 preroll_buflen
;
122 gboolean enable_processing
;
123 GMutex
*process_lock
;
126 struct _GstGDecoderClass
{
127 GstElementClass parent_class
;
128 GstPadTemplate
*sink_template
;
129 GstPadTemplate
*src_template
;
132 GType
gst_gdecoder_get_type(void);
133 gboolean
gst_gdecoder_plugin_init(GstPlugin
* plugin
);
134 static void gst_gdecoder_base_init(GstGDecoderClass
* klass
);
135 static void gst_gdecoder_class_init(GstGDecoderClass
* klass
);
136 static void gst_gdecoder_init(GstGDecoder
* gdecoder
);
137 static GstFlowReturn
gst_gdecoder_chain(GstPad
* pad
,GstBuffer
* buffer
);
138 static GstStateChangeReturn
gst_gdecoder_change_state(GstElement
*
143 static gboolean
gst_gdecoder_decoder_initialize(GstGDecoder
*
145 static GstCaps
*gst_gdecoder_sink_getcaps(GstPad
* pad
);
146 static gboolean
gst_gdecoder_sink_setcaps(GstPad
* pad
,
149 static gboolean
gst_gdecoder_src_event(GstPad
* pad
, GstEvent
* event
);
150 static gboolean
gst_gdecoder_sink_event(GstPad
* pad
,
153 static gboolean
gst_gdecoder_sink_activate(GstPad
* sinkpad
);
154 static gboolean
gst_gdecoder_sink_activate_pull(GstPad
* sinkpad
,
156 static void gst_gdecoder_loop(GstPad
* pad
);
157 static void gst_gdecoder_set_property(GObject
* object
, guint prop_id
,
158 const GValue
* value
,
160 static gboolean
gst_gdecoder_open_engine(GstGDecoder
* gdecoder
);
161 void gst_gdecoder_reset(GstGDecoder
* gdecoder
);
162 void gst_gdecoder_cleanup(GstGDecoder
* gdecoder
);
166 #endif /* __GST_GDECODER_H__ */