Tizen 2.0 Release
[framework/multimedia/gst-plugins-bad0.10.git] / sys / vdpau / gstvdp / gstvdpvideobuffer.h
1 /* 
2  * GStreamer
3  * Copyright (C) 2009 Carl-Anton Ingmarsson <ca.ingmarsson@gmail.com>
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Library General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
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  * Library General Public License for more details.
14  *
15  * You should have received a copy of the GNU Library General Public
16  * License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18  * Boston, MA 02111-1307, USA.
19  */
20
21 #ifndef _GST_VDP_VIDEO_BUFFER_H_
22 #define _GST_VDP_VIDEO_BUFFER_H_
23
24 #include <gst/gst.h>
25 #include <gst/video/video.h>
26
27 #include "gstvdpbuffer.h"
28 #include "gstvdpdevice.h"
29
30 typedef struct _GstVdpVideoBuffer GstVdpVideoBuffer;
31
32 #define GST_TYPE_VDP_VIDEO_BUFFER (gst_vdp_video_buffer_get_type())
33
34 #define GST_IS_VDP_VIDEO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VDP_VIDEO_BUFFER))
35 #define GST_VDP_VIDEO_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VDP_VIDEO_BUFFER, GstVdpVideoBuffer))
36
37 struct _GstVdpVideoBuffer {
38   GstVdpBuffer vdp_buffer;
39
40   GstVdpDevice *device;
41   VdpVideoSurface surface;
42 };
43
44 typedef struct
45 {
46   VdpChromaType chroma_type;
47   VdpYCbCrFormat format;
48   guint32 fourcc;
49 } GstVdpVideoBufferFormats;
50
51 static const VdpChromaType chroma_types[] =
52     { VDP_CHROMA_TYPE_420, VDP_CHROMA_TYPE_422, VDP_CHROMA_TYPE_444 };
53
54 static const GstVdpVideoBufferFormats formats[] = {
55   {
56         VDP_CHROMA_TYPE_420,
57         VDP_YCBCR_FORMAT_YV12,
58         GST_MAKE_FOURCC ('I', '4', '2', '0')
59       },
60   {
61         VDP_CHROMA_TYPE_420,
62         VDP_YCBCR_FORMAT_YV12,
63         GST_MAKE_FOURCC ('Y', 'V', '1', '2')
64       },
65   {
66         VDP_CHROMA_TYPE_420,
67         VDP_YCBCR_FORMAT_NV12,
68         GST_MAKE_FOURCC ('N', 'V', '1', '2')
69       },
70   {
71         VDP_CHROMA_TYPE_422,
72         VDP_YCBCR_FORMAT_UYVY,
73         GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y')
74       },
75   {
76         VDP_CHROMA_TYPE_444,
77         VDP_YCBCR_FORMAT_V8U8Y8A8,
78         GST_MAKE_FOURCC ('A', 'Y', 'U', 'V')
79       },
80   {
81         VDP_CHROMA_TYPE_444,
82         VDP_YCBCR_FORMAT_Y8U8V8A8,
83         GST_MAKE_FOURCC ('A', 'V', 'U', 'Y')
84   },
85   {
86         VDP_CHROMA_TYPE_422,
87         VDP_YCBCR_FORMAT_YUYV,
88         GST_MAKE_FOURCC ('Y', 'U', 'Y', '2')
89       },
90 };
91
92 GType gst_vdp_video_buffer_get_type (void);
93
94 GstVdpVideoBuffer *gst_vdp_video_buffer_new (GstVdpDevice * device, VdpChromaType chroma_type, gint width, gint height, GError **error);
95
96 GstCaps *gst_vdp_video_buffer_get_caps (gboolean filter, VdpChromaType chroma_type);
97 GstCaps *gst_vdp_video_buffer_get_allowed_caps (GstVdpDevice * device);
98
99 gboolean gst_vdp_video_buffer_calculate_size (guint32 fourcc, gint width, gint height, guint *size);
100 gboolean gst_vdp_video_buffer_download (GstVdpVideoBuffer *inbuf, GstBuffer *outbuf, guint32 fourcc, gint width, gint height);
101 gboolean gst_vdp_video_buffer_upload (GstVdpVideoBuffer *video_buf, GstBuffer *src_buf, guint fourcc, gint width, gint height);
102
103 #define GST_VDP_VIDEO_CAPS \
104   "video/x-vdpau-video, " \
105   "chroma-type = (int)[0,2], " \
106   "width = (int)[1,4096], " \
107   "height = (int)[1,4096]"
108
109 #endif