2007-12-21 00:03:10 +00:00
|
|
|
|
|
|
|
#ifndef _GST_GL_BUFFER_H_
|
|
|
|
#define _GST_GL_BUFFER_H_
|
|
|
|
|
|
|
|
#include <gst/gst.h>
|
|
|
|
#include <gst/video/video.h>
|
2007-12-24 21:04:45 +00:00
|
|
|
#include <gstgldisplay.h>
|
2007-12-21 00:03:10 +00:00
|
|
|
|
|
|
|
typedef struct _GstGLBuffer GstGLBuffer;
|
|
|
|
|
|
|
|
#define GST_TYPE_GL_BUFFER (gst_gl_buffer_get_type())
|
|
|
|
|
|
|
|
#define GST_IS_GL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_GL_BUFFER))
|
|
|
|
#define GST_GL_BUFFER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_GL_BUFFER, GstGLBuffer))
|
|
|
|
|
|
|
|
typedef enum {
|
2007-12-29 00:37:40 +00:00
|
|
|
GST_GL_BUFFER_FORMAT_UNKNOWN,
|
2007-12-27 00:52:22 +00:00
|
|
|
GST_GL_BUFFER_FORMAT_RGBA,
|
|
|
|
GST_GL_BUFFER_FORMAT_RGB,
|
|
|
|
GST_GL_BUFFER_FORMAT_YUYV,
|
|
|
|
GST_GL_BUFFER_FORMAT_PLANAR444,
|
|
|
|
GST_GL_BUFFER_FORMAT_PLANAR422,
|
|
|
|
GST_GL_BUFFER_FORMAT_PLANAR420
|
|
|
|
} GstGLBufferFormat;
|
2007-12-21 00:03:10 +00:00
|
|
|
|
|
|
|
struct _GstGLBuffer {
|
|
|
|
GstBuffer buffer;
|
|
|
|
|
|
|
|
GstGLDisplay *display;
|
|
|
|
|
2007-12-27 00:52:22 +00:00
|
|
|
GstGLBufferFormat format;
|
|
|
|
gboolean is_yuv;
|
2007-12-21 00:03:10 +00:00
|
|
|
|
2007-12-24 20:53:55 +00:00
|
|
|
GLuint texture;
|
2007-12-27 00:52:22 +00:00
|
|
|
GLuint texture_u;
|
|
|
|
GLuint texture_v;
|
2007-12-21 00:03:10 +00:00
|
|
|
|
|
|
|
int width;
|
|
|
|
int height;
|
|
|
|
};
|
|
|
|
|
|
|
|
GType gst_gl_buffer_get_type (void);
|
|
|
|
|
2008-01-06 03:01:39 +00:00
|
|
|
#define gst_gl_buffer_ref(x) ((GstGLBuffer *)(gst_buffer_ref((GstBuffer *)(x))))
|
|
|
|
#define gst_gl_buffer_unref(x) (gst_buffer_unref((GstBuffer *)(x)))
|
|
|
|
|
2007-12-27 00:52:22 +00:00
|
|
|
GstGLBuffer * gst_gl_buffer_new (GstGLDisplay *display,
|
2007-12-29 00:37:40 +00:00
|
|
|
int width, int height);
|
|
|
|
GstGLBuffer * gst_gl_buffer_new_with_format (GstGLDisplay *display,
|
2007-12-27 00:52:22 +00:00
|
|
|
GstGLBufferFormat format, int width, int height);
|
2007-12-29 00:37:40 +00:00
|
|
|
GstGLBuffer * gst_gl_buffer_new_from_video_format (GstGLDisplay *display,
|
|
|
|
GstVideoFormat format, int width, int height);
|
|
|
|
void gst_gl_buffer_upload (GstGLBuffer *buffer,
|
|
|
|
GstVideoFormat format, void *data);
|
2007-12-27 04:15:26 +00:00
|
|
|
void gst_gl_buffer_download (GstGLBuffer *buffer, GstVideoFormat format,
|
|
|
|
void *data);
|
|
|
|
|
|
|
|
|
|
|
|
#define GST_GL_VIDEO_CAPS \
|
|
|
|
"video/x-raw-gl," \
|
2007-12-29 00:37:40 +00:00
|
|
|
"format=(int)1," \
|
|
|
|
"is_yuv=(boolean)FALSE," \
|
2007-12-27 04:15:26 +00:00
|
|
|
"width=(int)[1,2048]," \
|
|
|
|
"height=(int)[1,2048]," \
|
|
|
|
"pixel-aspect-ratio=(fraction)1/1," \
|
|
|
|
"framerate=(fraction)[0/1,100/1]"
|
|
|
|
|
2007-12-29 00:37:40 +00:00
|
|
|
GstGLBufferFormat gst_gl_buffer_format_from_video_format (GstVideoFormat format);
|
|
|
|
int gst_gl_buffer_format_get_size (GstGLBufferFormat format, int width,
|
|
|
|
int height);
|
|
|
|
gboolean gst_gl_buffer_format_parse_caps (GstCaps *caps, GstGLBufferFormat *format,
|
|
|
|
int *width, int *height);
|
|
|
|
|
2007-12-21 00:03:10 +00:00
|
|
|
|
|
|
|
#endif
|
|
|
|
|