1 /*
2  * gst-plugins-bad
3  * Copyright (C) Carl-Anton Ingmarsson 2010 <ca.ingmarsson@gmail.com>
4  *               2012 Edward Hervey <edward@collabora.com>
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Library General Public License for more details.
15  *
16  * You should have received a copy of the GNU Library General Public
17  * License along with this library; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 02111-1307, USA.
20  */
21 
22 #ifndef _GST_VDP_VIDEO_BUFFERPOOL_H_
23 #define _GST_VDP_VIDEO_BUFFERPOOL_H_
24 
25 #include <gst/gst.h>
26 #include <gst/video/video.h>
27 #include <gst/video/gstvideometa.h>
28 #include <gst/video/gstvideopool.h>
29 #include "gstvdpdevice.h"
30 
31 G_BEGIN_DECLS
32 
33 #define GST_VDPAU_SURFACE_META_GET(buf) ((GstVdpauMeta *)gst_buffer_get_meta(buf,gst_vdpau_surface_meta_api_get_type()))
34 #define GST_VDPAU_SURFACE_META_ADD(buf) ((GstVdpauMeta *)gst_buffer_add_meta(buf,gst_vdpau_surface_meta_get_info(),NULL))
35 
36 struct _GstVdpauSurfaceMeta {
37 	GstMeta meta;
38 
39 	GstVdpDevice *device;
40 	VdpVideoSurface surface;
41 };
42 
43 GType gst_vdpau_surface_meta_api_get_type (void);
44 
45 const GstMetaInfo * gst_vdpau_surface_meta_get_info (void);
46 /**
47  * GST_BUFFER_POOL_OPTION_VDP_VIDEO_META:
48  *
49  * An option that can be activated on bufferpool to request VdpVideo metadata
50  * on buffers from the pool.
51  */
52 #define GST_BUFFER_POOL_OPTION_VDP_VIDEO_META "GstBufferPoolOptionVdpVideoMeta"
53 
54 typedef struct _GstVdpVideoBufferPool GstVdpVideoBufferPool;
55 typedef struct _GstVdpVideoBufferPoolClass GstVdpVideoBufferPoolClass;
56 
57 /* buffer pool functions */
58 #define GST_TYPE_VDP_VIDEO_BUFFER_POOL      (gst_vdp_video_buffer_pool_get_type())
59 #define GST_IS_VDP_VIDEO_BUFFER_POOL(obj)   (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_VDP_VIDEO_BUFFER_POOL))
60 #define GST_VDP_VIDEO_BUFFER_POOL(obj)      (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_VDP_VIDEO_BUFFER_POOL, GstVdpVideoBufferPool))
61 #define GST_VDP_VIDEO_BUFFER_POOL_CAST(obj) ((GstVdpVideoBufferPool*)(obj))
62 
63 struct _GstVdpVideoBufferPool
64 {
65   GstBufferPool bufferpool;
66 
67   GstVdpDevice *device;
68 
69   GstVideoInfo  info;
70   VdpChromaType chroma_type;
71 
72   gboolean      add_videometa;
73   gboolean      add_vdpmeta;
74 };
75 
76 struct _GstVdpVideoBufferPoolClass
77 {
78   GstBufferPoolClass parent_class;
79 };
80 
81 GType gst_vdp_video_buffer_pool_get_type (void);
82 GstBufferPool *gst_vdp_video_buffer_pool_new (GstVdpDevice *device);
83 
84 GstCaps *gst_vdp_video_buffer_get_caps (gboolean filter, VdpChromaType chroma_type);
85 #if 0
86 GstCaps *gst_vdp_video_buffer_get_allowed_caps (GstVdpDevice * device);
87 
88 gboolean gst_vdp_video_buffer_calculate_size (guint32 fourcc, gint width, gint height, guint *size);
89 /* FIXME : Replace with map/unmap  */
90 gboolean gst_vdp_video_buffer_download (GstVdpVideoBuffer *inbuf, GstBuffer *outbuf, guint32 fourcc, gint width, gint height);
91 gboolean gst_vdp_video_buffer_upload (GstVdpVideoBuffer *video_buf, GstBuffer *src_buf, guint fourcc, gint width, gint height);
92 #endif
93 
94 
95 G_END_DECLS
96 
97 #endif /* _GST_VDP_VIDEO_BUFFER_POOL_H_ */
98