Initial release.
[gst-davinci.git] / ti_plugins / fbvideosink / src / gstfbvideosink.h~
blob1156a2dc72d1d71951fcefafa43ab2d39e699c9d
1 /*
2  * gstfbvideosink.h
3  *
4  * Header file for Video Display Driver Sink Module for Gstreamer
5  * implementation on DM644x device 
6  *
7  * Copyright (C) 2007 Texas Instruments, Inc.
8  *
9  * This program is free software; you can redistribute it and/or modify it
10  * under the terms of the GNU Lesser General Public License as published 
11  * by the Free Software Foundation version 2.1 of the License.
12  *
13  * This program is distributed "as is" WITHOUT ANY WARRANTY of any kind,
14  * whether express or implied; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16  * Lesser General Public License for more details.
17  */
19 #ifndef __FBVIDEOSINK_DEMUX_H__
20 #define __FBVIDEOSINK_DEMUX_H__
22 #include <stdio.h>
23 #include <stdlib.h>
24 #include <string.h>
25 #include <sys/ioctl.h>
26 #include <sys/types.h>
27 #include <fcntl.h>
28 #include <sys/mman.h>
29 #include <unistd.h>
30 #include <sys/stat.h>
31 #include <errno.h>
32 #include <linux/fb.h>
34 #include <xdc/std.h>
35 #include <ti/sdo/ce/video/viddec.h>
36 #include <ti/sdo/ce/CERuntime.h>
37 #include <ti/sdo/ce/Engine.h>
38 #include <ti/sdo/ce/trace/gt.h>
39 #include <ti/sdo/ce/osal/Memory.h>
42 #define FBIO_WAITFORVSYNC _IOW('F', 0x20, u_int32_t)
43 #define FBIO_SETPOSX      _IOW('F', 0x22, u_int32_t)
44 #define FBIO_SETPOSY      _IOW('F', 0x23, u_int32_t)
47 #define MAX_NO_OF_CMEM_OUTPUT_BUFFERS 15
48 #define TRIPLE_BUF   3
49 #define DOUBLE_BUF   2
51 #include <gst/gst.h>
52 #include <gst/video/gstvideosink.h>
55 G_BEGIN_DECLS
56 #define GST_TYPE_FBVIDEOSINK          (gst_fbvideosink_get_type())
57 #define GST_FBVIDEOSINK(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_FBVIDEOSINK, GstFbVideoSink))
58 #define GST_FBVIDEOSINK_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass) , GST_TYPE_FBVIDEOSINK, GstFbVideoSink))
59 #define GST_FBVIDEOSINK_GET_CLASS(klass)   (G_TYPE_INSTANCE_GET_CLASS((klass),GST_TYPE_FBVIDEOSINK,GstFbVideoSinkClass))
60 #define GST_IS_FBVIDEOSINK(obj)       (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_FBVIDEOSINK))
61 #define GST_IS_FBVIDEOSINK_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass) , GST_TYPE_FBVIDEOSINK))
62 typedef struct _GstFbVideoSink GstFbVideoSink;
63 typedef struct _GstFbVideoSinkClass GstFbVideoSinkClass;
64 typedef struct _GstFbContext GstFbContext;
65 typedef struct _GstFbImageFormat GstFbImageFormat;
66 typedef struct _GstFbImageBuffer GstFbImageBuffer;
67 typedef struct _GstFbImageBufferClass GstFbImageBufferClass;
70         The Context of the Frame Buffer Device
73 #define         DEFAULT_DEVICE  "/dev/fb/3"
75 //#define SLOW_MEMCOPY
76 //#define DEBUG_OUT
77 #define DEALLOC
80 #define SCREEN_BPP              16
81 #define D1_WIDTH            720
82 #define D1_HEIGHT           480
83 #define D1_MAX_HEIGHT       576
86 struct _GstFbContext {
87     gint fbdevFd;
88     struct fb_var_screeninfo vScreenInfo;
89     struct fb_fix_screeninfo fScreenInfo;
90     guint8 *data;               //pointer to the mapped memory
91     gint screensize;
92     gint noofbuffers;           //no of buffers that will be used 1 - single, 2- double....
93 //      gint    bufferIndex;     //index to the cur buffer
94     gint bpp;                   //bits per pixel
95     gint depth;                 //color depth
96     gint endianness;            //endianess
97     gint width;                 //width in px
98     gint height;                //height in px
99     gint widthmm;               //width in mm
100     gint heightmm;              //height in mm
101     GValue *par;                //calculated pixel aspect ratio
102     GList *formats_list;        //list of formats supported by the frame buffer device
103     gint im_format;
104     GstCaps *caps;              //capabilities to latch on to the fbdev
106     //allocation of hardware buffers
107     gboolean avail[10];
108     guint8 *buffers[10];
109     gboolean doneonce;
112 struct _GstFbImageFormat {
113     gint format;
114     GstCaps *caps;
117 struct _GstFbImageBuffer {
118     GstBuffer buffer;
119     GstFbVideoSink *fbvideosink;
120     gint width;
121     gint height;
122     gint im_format;
123     size_t size;
126 struct _GstFbVideoSink {
128     GstVideoSink videosink;
130     GstFbContext *fbcontext;
131     GstFbImageBuffer *fbimage;
132     GstFbImageBuffer *cur_image;
134     gint fps_n;
135     gint fps_d;
137     /* object-set pixel aspect ratio */
138     GValue *par;
139     GMutex *fb_lock;
140     GMutex *pool_lock;
141     GSList *cmem_buffers_list;
143     /* width and height of the incoming vid frames */
144     guint video_width;
145     guint video_height;
147     gchar *device;
148     guint framesDisplayed;
149         guint8 buffers_allocated;
150         GMutex *buffer_lock;
154 struct _GstFbVideoSinkClass {
155     GstVideoSinkClass parent_class;
158 struct cmem_buffers_node
160         XDAS_Int8 * ptr;
161         guint size;
166 GType gst_fbvideosink_get_type(void);
168 G_END_DECLS
169 #endif